!(function (e) {
  var t = {};
  function n(i) {
    if (t[i]) return t[i].exports;
    var o = (t[i] = { i: i, l: !1, exports: {} });
    return e[i].call(o.exports, o, o.exports, n), (o.l = !0), o.exports;
  }
  (n.m = e),
    (n.c = t),
    (n.d = function (e, t, i) {
      n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: i });
    }),
    (n.r = function (e) {
      "undefined" != typeof Symbol &&
        Symbol.toStringTag &&
        Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }),
        Object.defineProperty(e, "__esModule", { value: !0 });
    }),
    (n.t = function (e, t) {
      if ((1 & t && (e = n(e)), 8 & t)) return e;
      if (4 & t && "object" == typeof e && e && e.__esModule) return e;
      var i = Object.create(null);
      if (
        (n.r(i),
        Object.defineProperty(i, "default", { enumerable: !0, value: e }),
        2 & t && "string" != typeof e)
      )
        for (var o in e)
          n.d(
            i,
            o,
            function (t) {
              return e[t];
            }.bind(null, o)
          );
      return i;
    }),
    (n.n = function (e) {
      var t =
        e && e.__esModule
          ? function () {
              return e.default;
            }
          : function () {
              return e;
            };
      return n.d(t, "a", t), t;
    }),
    (n.o = function (e, t) {
      return Object.prototype.hasOwnProperty.call(e, t);
    }),
    (n.p = "./"),
    n((n.s = 32));
})([
  function (e, t, n) {
    var i = n(19),
      o = n(5);
    (e.exports = function (e, t) {
      var n = o(e, t, "get");
      return i(e, n);
    }),
      (e.exports.default = e.exports),
      (e.exports.__esModule = !0);
  },
  function (e, t) {
    (e.exports = function (e, t, n) {
      return (
        t in e
          ? Object.defineProperty(e, t, {
              value: n,
              enumerable: !0,
              configurable: !0,
              writable: !0,
            })
          : (e[t] = n),
        e
      );
    }),
      (e.exports.default = e.exports),
      (e.exports.__esModule = !0);
  },
  function (e, t, n) {
    var i = n(20),
      o = n(5);
    (e.exports = function (e, t, n) {
      var s = o(e, t, "set");
      return i(e, s, n), n;
    }),
      (e.exports.default = e.exports),
      (e.exports.__esModule = !0);
  },
  function (e, t, n) {
    var i, o, s;
    (o = []),
      void 0 ===
        (s =
          "function" ==
          typeof (i = function () {
            var e = 52.35987755982988,
              t = 3.141592653589793,
              n = 6378245,
              i = 0.006693421622965943,
              o = function (t, n) {
                var i = (t = +t) - 0.0065,
                  o = (n = +n) - 0.006,
                  s = Math.sqrt(i * i + o * o) - 2e-5 * Math.sin(o * e),
                  r = Math.atan2(o, i) - 3e-6 * Math.cos(i * e);
                return [s * Math.cos(r), s * Math.sin(r)];
              },
              s = function (t, n) {
                (n = +n), (t = +t);
                var i = Math.sqrt(t * t + n * n) + 2e-5 * Math.sin(n * e),
                  o = Math.atan2(n, t) + 3e-6 * Math.cos(t * e);
                return [i * Math.cos(o) + 0.0065, i * Math.sin(o) + 0.006];
              },
              r = function (e, o) {
                if (h((e = +e), (o = +o))) return [e, o];
                var s = l(e - 105, o - 35),
                  r = c(e - 105, o - 35),
                  a = (o / 180) * t,
                  u = Math.sin(a);
                u = 1 - i * u * u;
                var d = Math.sqrt(u);
                return (
                  (s = (180 * s) / (((n * (1 - i)) / (u * d)) * t)),
                  [e + (r = (180 * r) / ((n / d) * Math.cos(a) * t)), o + s]
                );
              },
              a = function (e, o) {
                if (h((e = +e), (o = +o))) return [e, o];
                var s = l(e - 105, o - 35),
                  r = c(e - 105, o - 35),
                  a = (o / 180) * t,
                  u = Math.sin(a);
                u = 1 - i * u * u;
                var d = Math.sqrt(u);
                return (
                  (s = (180 * s) / (((n * (1 - i)) / (u * d)) * t)),
                  [
                    2 * e - (e + (r = (180 * r) / ((n / d) * Math.cos(a) * t))),
                    2 * o - (o + s),
                  ]
                );
              },
              l = function (e, n) {
                var i =
                  2 * (e = +e) -
                  100 +
                  3 * (n = +n) +
                  0.2 * n * n +
                  0.1 * e * n +
                  0.2 * Math.sqrt(Math.abs(e));
                return (
                  (i +=
                    (2 *
                      (20 * Math.sin(6 * e * t) + 20 * Math.sin(2 * e * t))) /
                    3),
                  (i +=
                    (2 * (20 * Math.sin(n * t) + 40 * Math.sin((n / 3) * t))) /
                    3),
                  (i +=
                    (2 *
                      (160 * Math.sin((n / 12) * t) +
                        320 * Math.sin((n * t) / 30))) /
                    3)
                );
              },
              c = function (e, n) {
                var i =
                  300 +
                  (e = +e) +
                  2 * (n = +n) +
                  0.1 * e * e +
                  0.1 * e * n +
                  0.1 * Math.sqrt(Math.abs(e));
                return (
                  (i +=
                    (2 *
                      (20 * Math.sin(6 * e * t) + 20 * Math.sin(2 * e * t))) /
                    3),
                  (i +=
                    (2 * (20 * Math.sin(e * t) + 40 * Math.sin((e / 3) * t))) /
                    3),
                  (i +=
                    (2 *
                      (150 * Math.sin((e / 12) * t) +
                        300 * Math.sin((e / 30) * t))) /
                    3)
                );
              },
              h = function (e, t) {
                return (
                  (t = +t),
                  !((e = +e) > 73.66 && e < 135.05 && t > 3.86 && t < 53.55)
                );
              };
            return {
              bd09towgs84: function (e, t) {
                const [n, i] = o(e, t);
                return a(n, i);
              },
              bd09togcj02: o,
              gcj02tobd09: s,
              gcj02towgs84: a,
              wgs84togcj02: r,
              wgs84tobd09: function (e, t) {
                const [n, i] = r(e, t);
                return s(n, i);
              },
            };
          })
            ? i.apply(t, o)
            : i) || (e.exports = s);
  },
  function (e, t) {
    var n;
    n = (function () {
      return this;
    })();
    try {
      n = n || new Function("return this")();
    } catch (e) {
      "object" == typeof window && (n = window);
    }
    e.exports = n;
  },
  function (e, t) {
    (e.exports = function (e, t, n) {
      if (!t.has(e))
        throw new TypeError(
          "attempted to " + n + " private field on non-instance"
        );
      return t.get(e);
    }),
      (e.exports.default = e.exports),
      (e.exports.__esModule = !0);
  },
  function (e, t) {
    var n,
      i,
      o = (e.exports = {});
    function s() {
      throw new Error("setTimeout has not been defined");
    }
    function r() {
      throw new Error("clearTimeout has not been defined");
    }
    function a(e) {
      if (n === setTimeout) return setTimeout(e, 0);
      if ((n === s || !n) && setTimeout)
        return (n = setTimeout), setTimeout(e, 0);
      try {
        return n(e, 0);
      } catch (t) {
        try {
          return n.call(null, e, 0);
        } catch (t) {
          return n.call(this, e, 0);
        }
      }
    }
    !(function () {
      try {
        n = "function" == typeof setTimeout ? setTimeout : s;
      } catch (e) {
        n = s;
      }
      try {
        i = "function" == typeof clearTimeout ? clearTimeout : r;
      } catch (e) {
        i = r;
      }
    })();
    var l,
      c = [],
      h = !1,
      u = -1;
    function d() {
      h &&
        l &&
        ((h = !1), l.length ? (c = l.concat(c)) : (u = -1), c.length && p());
    }
    function p() {
      if (!h) {
        var e = a(d);
        h = !0;
        for (var t = c.length; t; ) {
          for (l = c, c = []; ++u < t; ) l && l[u].run();
          (u = -1), (t = c.length);
        }
        (l = null),
          (h = !1),
          (function (e) {
            if (i === clearTimeout) return clearTimeout(e);
            if ((i === r || !i) && clearTimeout)
              return (i = clearTimeout), clearTimeout(e);
            try {
              i(e);
            } catch (t) {
              try {
                return i.call(null, e);
              } catch (t) {
                return i.call(this, e);
              }
            }
          })(e);
      }
    }
    function f(e, t) {
      (this.fun = e), (this.array = t);
    }
    function m() {}
    (o.nextTick = function (e) {
      var t = new Array(arguments.length - 1);
      if (arguments.length > 1)
        for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
      c.push(new f(e, t)), 1 !== c.length || h || a(p);
    }),
      (f.prototype.run = function () {
        this.fun.apply(null, this.array);
      }),
      (o.title = "browser"),
      (o.browser = !0),
      (o.env = {}),
      (o.argv = []),
      (o.version = ""),
      (o.versions = {}),
      (o.on = m),
      (o.addListener = m),
      (o.once = m),
      (o.off = m),
      (o.removeListener = m),
      (o.removeAllListeners = m),
      (o.emit = m),
      (o.prependListener = m),
      (o.prependOnceListener = m),
      (o.listeners = function (e) {
        return [];
      }),
      (o.binding = function (e) {
        throw new Error("process.binding is not supported");
      }),
      (o.cwd = function () {
        return "/";
      }),
      (o.chdir = function (e) {
        throw new Error("process.chdir is not supported");
      }),
      (o.umask = function () {
        return 0;
      });
  },
  ,
  function (e, t, n) {
    "use strict";
    (function (e) {
      var n,
        i,
        o =
          ((n = []),
          {
            getAll: function () {
              return n;
            },
            removeAll: function () {
              n = [];
            },
            add: function (e) {
              n.push(e);
            },
            remove: function (e) {
              var t = n.indexOf(e);
              -1 !== t && n.splice(t, 1);
            },
            update: function (e, t) {
              if (0 === n.length) return !1;
              var i = 0;
              for (e = void 0 !== e ? e : o.now(); i < n.length; )
                n[i].update(e) || t ? i++ : n.splice(i, 1);
              return !0;
            },
          });
      "undefined" == typeof window && void 0 !== e
        ? (o.now = function () {
            var t = e.hrtime();
            return 1e3 * t[0] + t[1] / 1e6;
          })
        : "undefined" != typeof window &&
          void 0 !== window.performance &&
          void 0 !== window.performance.now
        ? (o.now = window.performance.now.bind(window.performance))
        : void 0 !== Date.now
        ? (o.now = Date.now)
        : (o.now = function () {
            return new Date().getTime();
          }),
        (o.Tween = function (e) {
          var t,
            n = e,
            i = {},
            s = {},
            r = {},
            a = 1e3,
            l = 0,
            c = 0,
            h = !1,
            u = !1,
            d = !1,
            p = !1,
            f = 0,
            m = null,
            g = o.Easing.Linear.None,
            v = o.Interpolation.Linear,
            y = [],
            b = null,
            x = !1,
            w = null,
            C = null,
            T = null;
          (this.to = function (e, t) {
            return (s = e), void 0 !== t && (a = t), this;
          }),
            (this.reStart = function (e) {
              return (u = e), this;
            }),
            (this.start = function (e) {
              for (var t in (o.add(this),
              (d = !0),
              (x = !1),
              (m = void 0 !== e ? e : o.now()),
              (m += f),
              s)) {
                if (s[t] instanceof Array) {
                  if (0 === s[t].length) continue;
                  s[t] = [n[t]].concat(s[t]);
                }
                void 0 !== n[t] &&
                  ((!u || (u && void 0 === i[t])) &&
                    ((i[t] = n[t]), (a -= a * l)),
                  i[t] instanceof Array == !1 && (i[t] *= 1),
                  (r[t] = i[t] || 0));
              }
              return this;
            }),
            (this.stop = function () {
              return d
                ? (o.remove(this),
                  (d = !1),
                  null !== T && T.call(n, n),
                  this.stopChainedTweens(),
                  this)
                : this;
            }),
            (this.end = function () {
              return this.update(m + a), this;
            }),
            (this.stopChainedTweens = function () {
              for (var e = 0, t = y.length; e < t; e++) y[e].stop();
            }),
            (this.delay = function (e) {
              return (f = e), this;
            }),
            (this.repeat = function (e) {
              return (c = e), this;
            }),
            (this.repeatDelay = function (e) {
              return (t = e), this;
            }),
            (this.yoyo = function (e) {
              return (h = e), this;
            }),
            (this.easing = function (e) {
              return (g = e), this;
            }),
            (this.interpolation = function (e) {
              return (v = e), this;
            }),
            (this.chain = function () {
              return (y = arguments), this;
            }),
            (this.onStart = function (e) {
              return (b = e), this;
            }),
            (this.onUpdate = function (e) {
              return (w = e), this;
            }),
            (this.onComplete = function (e) {
              return (C = e), this;
            }),
            (this.onStop = function (e) {
              return (T = e), this;
            }),
            (this.update = function (e) {
              var o, u, d;
              if (e < m) return !0;
              for (o in (!1 === x && (null !== b && b.call(n, n), (x = !0)),
              (d = g((u = (u = (e - m) / a) > 1 ? 1 : u))),
              (l = d),
              s))
                if (void 0 !== i[o]) {
                  var T = i[o] || 0,
                    _ = s[o];
                  _ instanceof Array
                    ? (n[o] = v(_, d))
                    : ("string" == typeof _ &&
                        (_ =
                          "+" === _.charAt(0) || "-" === _.charAt(0)
                            ? T + parseFloat(_)
                            : parseFloat(_)),
                      "number" == typeof _ && (n[o] = T + (_ - T) * d));
                }
              if ((null !== w && w.call(n, d), 1 === u)) {
                if (c > 0) {
                  for (o in (isFinite(c) && c--, r)) {
                    if (
                      ("string" == typeof s[o] &&
                        (r[o] = r[o] + parseFloat(s[o])),
                      h)
                    ) {
                      var D = r[o];
                      (r[o] = s[o]), (s[o] = D);
                    }
                    i[o] = r[o];
                  }
                  return h && (p = !p), (m = void 0 !== t ? e + t : e + f), !0;
                }
                null !== C && C.call(n, n);
                for (var M = 0, S = y.length; M < S; M++) y[M].start(m + a);
                return !1;
              }
              return !0;
            });
        }),
        (o.Easing = {
          Linear: {
            None: function (e) {
              return e;
            },
          },
          Quadratic: {
            In: function (e) {
              return e * e;
            },
            Out: function (e) {
              return e * (2 - e);
            },
            InOut: function (e) {
              return (e *= 2) < 1 ? 0.5 * e * e : -0.5 * (--e * (e - 2) - 1);
            },
          },
          Cubic: {
            In: function (e) {
              return e * e * e;
            },
            Out: function (e) {
              return --e * e * e + 1;
            },
            InOut: function (e) {
              return (e *= 2) < 1
                ? 0.5 * e * e * e
                : 0.5 * ((e -= 2) * e * e + 2);
            },
          },
          Quartic: {
            In: function (e) {
              return e * e * e * e;
            },
            Out: function (e) {
              return 1 - --e * e * e * e;
            },
            InOut: function (e) {
              return (e *= 2) < 1
                ? 0.5 * e * e * e * e
                : -0.5 * ((e -= 2) * e * e * e - 2);
            },
          },
          Quintic: {
            In: function (e) {
              return e * e * e * e * e;
            },
            Out: function (e) {
              return --e * e * e * e * e + 1;
            },
            InOut: function (e) {
              return (e *= 2) < 1
                ? 0.5 * e * e * e * e * e
                : 0.5 * ((e -= 2) * e * e * e * e + 2);
            },
          },
          Sinusoidal: {
            In: function (e) {
              return 1 - Math.cos((e * Math.PI) / 2);
            },
            Out: function (e) {
              return Math.sin((e * Math.PI) / 2);
            },
            InOut: function (e) {
              return 0.5 * (1 - Math.cos(Math.PI * e));
            },
          },
          Exponential: {
            In: function (e) {
              return 0 === e ? 0 : Math.pow(1024, e - 1);
            },
            Out: function (e) {
              return 1 === e ? 1 : 1 - Math.pow(2, -10 * e);
            },
            InOut: function (e) {
              return 0 === e
                ? 0
                : 1 === e
                ? 1
                : (e *= 2) < 1
                ? 0.5 * Math.pow(1024, e - 1)
                : 0.5 * (2 - Math.pow(2, -10 * (e - 1)));
            },
          },
          Circular: {
            In: function (e) {
              return 1 - Math.sqrt(1 - e * e);
            },
            Out: function (e) {
              return Math.sqrt(1 - --e * e);
            },
            InOut: function (e) {
              return (e *= 2) < 1
                ? -0.5 * (Math.sqrt(1 - e * e) - 1)
                : 0.5 * (Math.sqrt(1 - (e -= 2) * e) + 1);
            },
          },
          Elastic: {
            In: function (e) {
              return 0 === e
                ? 0
                : 1 === e
                ? 1
                : -Math.pow(2, 10 * (e - 1)) *
                  Math.sin(5 * (e - 1.1) * Math.PI);
            },
            Out: function (e) {
              return 0 === e
                ? 0
                : 1 === e
                ? 1
                : Math.pow(2, -10 * e) * Math.sin(5 * (e - 0.1) * Math.PI) + 1;
            },
            InOut: function (e) {
              return 0 === e
                ? 0
                : 1 === e
                ? 1
                : (e *= 2) < 1
                ? -0.5 *
                  Math.pow(2, 10 * (e - 1)) *
                  Math.sin(5 * (e - 1.1) * Math.PI)
                : 0.5 *
                    Math.pow(2, -10 * (e - 1)) *
                    Math.sin(5 * (e - 1.1) * Math.PI) +
                  1;
            },
          },
          Back: {
            In: function (e) {
              var t = 1.70158;
              return e * e * ((t + 1) * e - t);
            },
            Out: function (e) {
              var t = 1.70158;
              return --e * e * ((t + 1) * e + t) + 1;
            },
            InOut: function (e) {
              var t = 2.5949095;
              return (e *= 2) < 1
                ? e * e * ((t + 1) * e - t) * 0.5
                : 0.5 * ((e -= 2) * e * ((t + 1) * e + t) + 2);
            },
          },
          Bounce: {
            In: function (e) {
              return 1 - o.Easing.Bounce.Out(1 - e);
            },
            Out: function (e) {
              return e < 1 / 2.75
                ? 7.5625 * e * e
                : e < 2 / 2.75
                ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75
                : e < 2.5 / 2.75
                ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375
                : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375;
            },
            InOut: function (e) {
              return e < 0.5
                ? 0.5 * o.Easing.Bounce.In(2 * e)
                : 0.5 * o.Easing.Bounce.Out(2 * e - 1) + 0.5;
            },
          },
        }),
        (o.Interpolation = {
          Linear: function (e, t) {
            var n = e.length - 1,
              i = n * t,
              s = Math.floor(i),
              r = o.Interpolation.Utils.Linear;
            return t < 0
              ? r(e[0], e[1], i)
              : t > 1
              ? r(e[n], e[n - 1], n - i)
              : r(e[s], e[s + 1 > n ? n : s + 1], i - s);
          },
          Bezier: function (e, t) {
            for (
              var n = 0,
                i = e.length - 1,
                s = Math.pow,
                r = o.Interpolation.Utils.Bernstein,
                a = 0;
              a <= i;
              a++
            )
              n += s(1 - t, i - a) * s(t, a) * e[a] * r(i, a);
            return n;
          },
          CatmullRom: function (e, t) {
            var n = e.length - 1,
              i = n * t,
              s = Math.floor(i),
              r = o.Interpolation.Utils.CatmullRom;
            return e[0] === e[n]
              ? (t < 0 && (s = Math.floor((i = n * (1 + t)))),
                r(
                  e[(s - 1 + n) % n],
                  e[s],
                  e[(s + 1) % n],
                  e[(s + 2) % n],
                  i - s
                ))
              : t < 0
              ? e[0] - (r(e[0], e[0], e[1], e[1], -i) - e[0])
              : t > 1
              ? e[n] - (r(e[n], e[n], e[n - 1], e[n - 1], i - n) - e[n])
              : r(
                  e[s ? s - 1 : 0],
                  e[s],
                  e[n < s + 1 ? n : s + 1],
                  e[n < s + 2 ? n : s + 2],
                  i - s
                );
          },
          Utils: {
            Linear: function (e, t, n) {
              return (t - e) * n + e;
            },
            Bernstein: function (e, t) {
              var n = o.Interpolation.Utils.Factorial;
              return n(e) / n(t) / n(e - t);
            },
            Factorial:
              ((i = [1]),
              function (e) {
                var t = 1;
                if (i[e]) return i[e];
                for (var n = e; n > 1; n--) t *= n;
                return (i[e] = t), t;
              }),
            CatmullRom: function (e, t, n, i, o) {
              var s = 0.5 * (n - e),
                r = 0.5 * (i - t),
                a = o * o;
              return (
                (2 * t - 2 * n + s + r) * (o * a) +
                (-3 * t + 3 * n - 2 * s - r) * a +
                s * o +
                t
              );
            },
          },
        }),
        (t.a = o);
    }).call(this, n(6));
  },
  function (e, t, n) {
    /*! Tweakpane 3.1.0 (c) 2016 cocopon, licensed under the MIT license. */
    !(function (e) {
      "use strict";
      class t {
        constructor(e) {
          this.controller_ = e;
        }
        get element() {
          return this.controller_.view.element;
        }
        get disabled() {
          return this.controller_.viewProps.get("disabled");
        }
        set disabled(e) {
          this.controller_.viewProps.set("disabled", e);
        }
        get hidden() {
          return this.controller_.viewProps.get("hidden");
        }
        set hidden(e) {
          this.controller_.viewProps.set("hidden", e);
        }
        dispose() {
          this.controller_.viewProps.set("disposed", !0);
        }
      }
      class n {
        constructor(e) {
          this.target = e;
        }
      }
      class i extends n {
        constructor(e, t, n, i) {
          super(e),
            (this.value = t),
            (this.presetKey = n),
            (this.last = null == i || i);
        }
      }
      class o extends n {
        constructor(e, t, n) {
          super(e), (this.value = t), (this.presetKey = n);
        }
      }
      class s extends n {
        constructor(e, t) {
          super(e), (this.expanded = t);
        }
      }
      class r extends n {
        constructor(e, t) {
          super(e), (this.index = t);
        }
      }
      function a(e) {
        return null == e;
      }
      function l(e, t) {
        if (e.length !== t.length) return !1;
        for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
        return !0;
      }
      const c = {
        alreadydisposed: () => "View has been already disposed",
        invalidparams: (e) => `Invalid parameters for '${e.name}'`,
        nomatchingcontroller: (e) => `No matching controller for '${e.key}'`,
        nomatchingview: (e) =>
          `No matching view for '${JSON.stringify(e.params)}'`,
        notbindable: () => "Value is not bindable",
        propertynotfound: (e) => `Property '${e.name}' not found`,
        shouldneverhappen: () => "This error should never happen",
      };
      class h {
        constructor(e) {
          var t;
          (this.message =
            null !== (t = c[e.type](e.context)) && void 0 !== t
              ? t
              : "Unexpected error"),
            (this.name = this.constructor.name),
            (this.stack = new Error(this.message).stack),
            (this.type = e.type);
        }
        static alreadyDisposed() {
          return new h({ type: "alreadydisposed" });
        }
        static notBindable() {
          return new h({ type: "notbindable" });
        }
        static propertyNotFound(e) {
          return new h({ type: "propertynotfound", context: { name: e } });
        }
        static shouldNeverHappen() {
          return new h({ type: "shouldneverhappen" });
        }
      }
      class u {
        constructor(e, t, n) {
          (this.obj_ = e),
            (this.key_ = t),
            (this.presetKey_ = null != n ? n : t);
        }
        static isBindable(e) {
          return null !== e && "object" == typeof e;
        }
        get key() {
          return this.key_;
        }
        get presetKey() {
          return this.presetKey_;
        }
        read() {
          return this.obj_[this.key_];
        }
        write(e) {
          this.obj_[this.key_] = e;
        }
        writeProperty(e, t) {
          const n = this.read();
          if (!u.isBindable(n)) throw h.notBindable();
          if (!(e in n)) throw h.propertyNotFound(e);
          n[e] = t;
        }
      }
      class d extends t {
        get label() {
          return this.controller_.props.get("label");
        }
        set label(e) {
          this.controller_.props.set("label", e);
        }
        get title() {
          var e;
          return null !==
            (e = this.controller_.valueController.props.get("title")) &&
            void 0 !== e
            ? e
            : "";
        }
        set title(e) {
          this.controller_.valueController.props.set("title", e);
        }
        on(e, t) {
          const i = t.bind(this);
          return (
            this.controller_.valueController.emitter.on(e, () => {
              i(new n(this));
            }),
            this
          );
        }
      }
      class p {
        constructor() {
          this.observers_ = {};
        }
        on(e, t) {
          let n = this.observers_[e];
          return (
            n || (n = this.observers_[e] = []), n.push({ handler: t }), this
          );
        }
        off(e, t) {
          const n = this.observers_[e];
          return (
            n && (this.observers_[e] = n.filter((e) => e.handler !== t)), this
          );
        }
        emit(e, t) {
          const n = this.observers_[e];
          n &&
            n.forEach((e) => {
              e.handler(t);
            });
        }
      }
      const f = "tp";
      function m(e) {
        return (t, n) =>
          [f, "-", e, "v", t ? "_" + t : "", n ? "-" + n : ""].join("");
      }
      function g(e) {
        return e.rawValue;
      }
      function v(e, t) {
        var n, i;
        e.emitter.on("change", ((n = g), (i = t), (e) => i(n(e)))),
          t(e.rawValue);
      }
      function y(e, t, n) {
        v(e.value(t), n);
      }
      function b(e, t) {
        return (n) => {
          !(function (e, t, n) {
            n ? e.classList.add(t) : e.classList.remove(t);
          })(e, t, n);
        };
      }
      function x(e, t) {
        v(e, (e) => {
          t.textContent = null != e ? e : "";
        });
      }
      const w = m("btn");
      class C {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(w()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("button");
          n.classList.add(w("b")),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.buttonElement = n);
          const i = e.createElement("div");
          i.classList.add(w("t")),
            x(t.props.value("title"), i),
            this.buttonElement.appendChild(i);
        }
      }
      class T {
        constructor(e, t) {
          (this.emitter = new p()),
            (this.onClick_ = this.onClick_.bind(this)),
            (this.props = t.props),
            (this.viewProps = t.viewProps),
            (this.view = new C(e, {
              props: this.props,
              viewProps: this.viewProps,
            })),
            this.view.buttonElement.addEventListener("click", this.onClick_);
        }
        onClick_() {
          this.emitter.emit("click", { sender: this });
        }
      }
      class _ {
        constructor(e, t) {
          var n;
          (this.constraint_ = null == t ? void 0 : t.constraint),
            (this.equals_ =
              null !== (n = null == t ? void 0 : t.equals) && void 0 !== n
                ? n
                : (e, t) => e === t),
            (this.emitter = new p()),
            (this.rawValue_ = e);
        }
        get constraint() {
          return this.constraint_;
        }
        get rawValue() {
          return this.rawValue_;
        }
        set rawValue(e) {
          this.setRawValue(e, { forceEmit: !1, last: !0 });
        }
        setRawValue(e, t) {
          const n = null != t ? t : { forceEmit: !1, last: !0 },
            i = this.constraint_ ? this.constraint_.constrain(e) : e;
          (!this.equals_(this.rawValue_, i) || n.forceEmit) &&
            (this.emitter.emit("beforechange", { sender: this }),
            (this.rawValue_ = i),
            this.emitter.emit("change", {
              options: n,
              rawValue: i,
              sender: this,
            }));
        }
      }
      class D {
        constructor(e) {
          (this.emitter = new p()), (this.value_ = e);
        }
        get rawValue() {
          return this.value_;
        }
        set rawValue(e) {
          this.setRawValue(e, { forceEmit: !1, last: !0 });
        }
        setRawValue(e, t) {
          const n = null != t ? t : { forceEmit: !1, last: !0 };
          (this.value_ !== e || n.forceEmit) &&
            (this.emitter.emit("beforechange", { sender: this }),
            (this.value_ = e),
            this.emitter.emit("change", {
              options: n,
              rawValue: this.value_,
              sender: this,
            }));
        }
      }
      function M(e, t) {
        const n = null == t ? void 0 : t.constraint,
          i = null == t ? void 0 : t.equals;
        return n || i ? new _(e, t) : new D(e);
      }
      class S {
        constructor(e) {
          (this.emitter = new p()), (this.valMap_ = e);
          for (const e in this.valMap_)
            this.valMap_[e].emitter.on("change", () => {
              this.emitter.emit("change", { key: e, sender: this });
            });
        }
        static createCore(e) {
          return Object.keys(e).reduce(
            (t, n) => Object.assign(t, { [n]: M(e[n]) }),
            {}
          );
        }
        static fromObject(e) {
          const t = this.createCore(e);
          return new S(t);
        }
        get(e) {
          return this.valMap_[e].rawValue;
        }
        set(e, t) {
          this.valMap_[e].rawValue = t;
        }
        value(e) {
          return this.valMap_[e];
        }
      }
      function P(e) {
        return (t) => (n) => {
          if (!t && void 0 === n) return { succeeded: !1, value: void 0 };
          if (t && void 0 === n) return { succeeded: !0, value: void 0 };
          const i = e(n);
          return void 0 !== i
            ? { succeeded: !0, value: i }
            : { succeeded: !1, value: void 0 };
        };
      }
      function R(e) {
        return {
          custom: (t) => P(t)(e),
          boolean: P((e) => ("boolean" == typeof e ? e : void 0))(e),
          number: P((e) => ("number" == typeof e ? e : void 0))(e),
          string: P((e) => ("string" == typeof e ? e : void 0))(e),
          function: P((e) => ("function" == typeof e ? e : void 0))(e),
          constant: (t) => P((e) => (e === t ? t : void 0))(e),
          raw: P((e) => e)(e),
          object: (t) =>
            P((e) => {
              var n;
              if (null !== (n = e) && "object" == typeof n)
                return (function (e, t) {
                  return Object.keys(t).reduce((n, i) => {
                    if (void 0 === n) return;
                    const o = (0, t[i])(e[i]);
                    return o.succeeded
                      ? Object.assign(Object.assign({}, n), { [i]: o.value })
                      : void 0;
                  }, {});
                })(e, t);
            })(e),
          array: (t) =>
            P((e) => {
              var n;
              if (Array.isArray(e))
                return (
                  (n = t),
                  e.reduce((e, t) => {
                    if (void 0 === e) return;
                    const i = n(t);
                    return i.succeeded && void 0 !== i.value
                      ? [...e, i.value]
                      : void 0;
                  }, [])
                );
            })(e),
        };
      }
      const A = { optional: R(!0), required: R(!1) };
      function E(e, t) {
        const n = A.required.object(t)(e);
        return n.succeeded ? n.value : void 0;
      }
      const k = m(""),
        I = { veryfirst: "vfst", first: "fst", last: "lst", verylast: "vlst" };
      class H {
        constructor(e) {
          (this.parent_ = null),
            (this.blade = e.blade),
            (this.view = e.view),
            (this.viewProps = e.viewProps);
          const t = this.view.element;
          this.blade.value("positions").emitter.on("change", () => {
            ["veryfirst", "first", "last", "verylast"].forEach((e) => {
              t.classList.remove(k(void 0, I[e]));
            }),
              this.blade.get("positions").forEach((e) => {
                t.classList.add(k(void 0, I[e]));
              });
          }),
            this.viewProps.handleDispose(() => {
              !(function (e) {
                e && e.parentElement && e.parentElement.removeChild(e);
              })(t);
            });
        }
        get parent() {
          return this.parent_;
        }
      }
      const L = "http://www.w3.org/2000/svg";
      function O(e) {
        e.offsetHeight;
      }
      function V(e) {
        return void 0 !== e.ontouchstart;
      }
      function F() {
        return new Function("return this")().document;
      }
      const z = {
        check: '<path d="M2 8l4 4l8 -8"/>',
        dropdown: '<path d="M5 7h6l-3 3 z"/>',
        p2dpad:
          '<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>',
      };
      function j(e, t) {
        const n = e.createElementNS(L, "svg");
        return (n.innerHTML = z[t]), n;
      }
      function B(e, t, n) {
        e.insertBefore(t, e.children[n]);
      }
      function U(e) {
        e.parentElement && e.parentElement.removeChild(e);
      }
      function N(e) {
        for (; e.children.length > 0; ) e.removeChild(e.children[0]);
      }
      function G(e) {
        return e.relatedTarget
          ? e.relatedTarget
          : "explicitOriginalTarget" in e
          ? e.explicitOriginalTarget
          : null;
      }
      const W = m("lbl");
      class Y {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(W()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("div");
          n.classList.add(W("l")),
            y(t.props, "label", (t) => {
              a(t)
                ? this.element.classList.add(W(void 0, "nol"))
                : (this.element.classList.remove(W(void 0, "nol")),
                  (function (e) {
                    for (; e.childNodes.length > 0; )
                      e.removeChild(e.childNodes[0]);
                  })(n),
                  n.appendChild(
                    (function (e, t) {
                      const n = e.createDocumentFragment();
                      return (
                        t
                          .split("\n")
                          .map((t) => e.createTextNode(t))
                          .forEach((t, i) => {
                            i > 0 && n.appendChild(e.createElement("br")),
                              n.appendChild(t);
                          }),
                        n
                      );
                    })(e, t)
                  ));
            }),
            this.element.appendChild(n),
            (this.labelElement = n);
          const i = e.createElement("div");
          i.classList.add(W("v")),
            this.element.appendChild(i),
            (this.valueElement = i);
        }
      }
      class K extends H {
        constructor(e, t) {
          const n = t.valueController.viewProps;
          super(
            Object.assign(Object.assign({}, t), {
              view: new Y(e, { props: t.props, viewProps: n }),
              viewProps: n,
            })
          ),
            (this.props = t.props),
            (this.valueController = t.valueController),
            this.view.valueElement.appendChild(
              this.valueController.view.element
            );
        }
      }
      const $ = {
        id: "button",
        type: "blade",
        accept(e) {
          const t = A,
            n = E(e, {
              title: t.required.string,
              view: t.required.constant("button"),
              label: t.optional.string,
            });
          return n ? { params: n } : null;
        },
        controller: (e) =>
          new K(e.document, {
            blade: e.blade,
            props: S.fromObject({ label: e.params.label }),
            valueController: new T(e.document, {
              props: S.fromObject({ title: e.params.title }),
              viewProps: e.viewProps,
            }),
          }),
        api: (e) =>
          e.controller instanceof K && e.controller.valueController instanceof T
            ? new d(e.controller)
            : null,
      };
      class X extends H {
        constructor(e) {
          super(e), (this.value = e.value);
        }
      }
      function q() {
        return new S({ positions: M([], { equals: l }) });
      }
      class Z extends S {
        constructor(e) {
          super(e);
        }
        static create(e) {
          const t = {
              completed: !0,
              expanded: e,
              expandedHeight: null,
              shouldFixHeight: !1,
              temporaryExpanded: null,
            },
            n = S.createCore(t);
          return new Z(n);
        }
        get styleExpanded() {
          var e;
          return null !== (e = this.get("temporaryExpanded")) && void 0 !== e
            ? e
            : this.get("expanded");
        }
        get styleHeight() {
          if (!this.styleExpanded) return "0";
          const e = this.get("expandedHeight");
          return this.get("shouldFixHeight") && !a(e) ? e + "px" : "auto";
        }
        bindExpandedClass(e, t) {
          const n = () => {
            this.styleExpanded ? e.classList.add(t) : e.classList.remove(t);
          };
          y(this, "expanded", n), y(this, "temporaryExpanded", n);
        }
        cleanUpTransition() {
          this.set("shouldFixHeight", !1),
            this.set("expandedHeight", null),
            this.set("completed", !0);
        }
      }
      function Q(e, t) {
        t.style.height = e.styleHeight;
      }
      function J(e, t) {
        e.value("expanded").emitter.on("beforechange", () => {
          e.set("completed", !1),
            a(e.get("expandedHeight")) &&
              e.set(
                "expandedHeight",
                (function (e, t) {
                  let n = 0;
                  return (
                    (function (e, t) {
                      const n = e.style.transition;
                      (e.style.transition = "none"),
                        t(),
                        (e.style.transition = n);
                    })(t, () => {
                      e.set("expandedHeight", null),
                        e.set("temporaryExpanded", !0),
                        O(t),
                        (n = t.clientHeight),
                        e.set("temporaryExpanded", null),
                        O(t);
                    }),
                    n
                  );
                })(e, t)
              ),
            e.set("shouldFixHeight", !0),
            O(t);
        }),
          e.emitter.on("change", () => {
            Q(e, t);
          }),
          Q(e, t),
          t.addEventListener("transitionend", (t) => {
            "height" === t.propertyName && e.cleanUpTransition();
          });
      }
      class ee extends t {
        constructor(e, t) {
          super(e), (this.rackApi_ = t);
        }
      }
      class te {
        constructor(e) {
          (this.emitter = new p()),
            (this.items_ = []),
            (this.cache_ = new Set()),
            (this.onSubListAdd_ = this.onSubListAdd_.bind(this)),
            (this.onSubListRemove_ = this.onSubListRemove_.bind(this)),
            (this.extract_ = e);
        }
        get items() {
          return this.items_;
        }
        allItems() {
          return Array.from(this.cache_);
        }
        find(e) {
          for (const t of this.allItems()) if (e(t)) return t;
          return null;
        }
        includes(e) {
          return this.cache_.has(e);
        }
        add(e, t) {
          if (this.includes(e)) throw h.shouldNeverHappen();
          const n = void 0 !== t ? t : this.items_.length;
          this.items_.splice(n, 0, e), this.cache_.add(e);
          const i = this.extract_(e);
          i &&
            (i.emitter.on("add", this.onSubListAdd_),
            i.emitter.on("remove", this.onSubListRemove_),
            i.allItems().forEach((e) => {
              this.cache_.add(e);
            })),
            this.emitter.emit("add", {
              index: n,
              item: e,
              root: this,
              target: this,
            });
        }
        remove(e) {
          const t = this.items_.indexOf(e);
          if (t < 0) return;
          this.items_.splice(t, 1), this.cache_.delete(e);
          const n = this.extract_(e);
          n &&
            (n.emitter.off("add", this.onSubListAdd_),
            n.emitter.off("remove", this.onSubListRemove_)),
            this.emitter.emit("remove", {
              index: t,
              item: e,
              root: this,
              target: this,
            });
        }
        onSubListAdd_(e) {
          this.cache_.add(e.item),
            this.emitter.emit("add", {
              index: e.index,
              item: e.item,
              root: this,
              target: e.target,
            });
        }
        onSubListRemove_(e) {
          this.cache_.delete(e.item),
            this.emitter.emit("remove", {
              index: e.index,
              item: e.item,
              root: this,
              target: e.target,
            });
        }
      }
      class ne extends t {
        constructor(e) {
          super(e),
            (this.onBindingChange_ = this.onBindingChange_.bind(this)),
            (this.emitter_ = new p()),
            this.controller_.binding.emitter.on(
              "change",
              this.onBindingChange_
            );
        }
        get label() {
          return this.controller_.props.get("label");
        }
        set label(e) {
          this.controller_.props.set("label", e);
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
        refresh() {
          this.controller_.binding.read();
        }
        onBindingChange_(e) {
          const t = e.sender.target.read();
          this.emitter_.emit("change", {
            event: new i(
              this,
              t,
              this.controller_.binding.target.presetKey,
              e.options.last
            ),
          });
        }
      }
      class ie extends K {
        constructor(e, t) {
          super(e, t), (this.binding = t.binding);
        }
      }
      class oe extends t {
        constructor(e) {
          super(e),
            (this.onBindingUpdate_ = this.onBindingUpdate_.bind(this)),
            (this.emitter_ = new p()),
            this.controller_.binding.emitter.on(
              "update",
              this.onBindingUpdate_
            );
        }
        get label() {
          return this.controller_.props.get("label");
        }
        set label(e) {
          this.controller_.props.set("label", e);
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
        refresh() {
          this.controller_.binding.read();
        }
        onBindingUpdate_(e) {
          const t = e.sender.target.read();
          this.emitter_.emit("update", {
            event: new o(this, t, this.controller_.binding.target.presetKey),
          });
        }
      }
      class se extends K {
        constructor(e, t) {
          super(e, t),
            (this.binding = t.binding),
            this.viewProps.bindDisabled(this.binding.ticker),
            this.viewProps.handleDispose(() => {
              this.binding.dispose();
            });
        }
      }
      function re(e) {
        return e instanceof ce
          ? e.apiSet_
          : e instanceof ee
          ? e.rackApi_.apiSet_
          : null;
      }
      function ae(e, t) {
        const n = e.find((e) => e.controller_ === t);
        if (!n) throw h.shouldNeverHappen();
        return n;
      }
      function le(e, t, n) {
        if (!u.isBindable(e)) throw h.notBindable();
        return new u(e, t, n);
      }
      class ce extends t {
        constructor(e, t) {
          super(e),
            (this.onRackAdd_ = this.onRackAdd_.bind(this)),
            (this.onRackRemove_ = this.onRackRemove_.bind(this)),
            (this.onRackInputChange_ = this.onRackInputChange_.bind(this)),
            (this.onRackMonitorUpdate_ = this.onRackMonitorUpdate_.bind(this)),
            (this.emitter_ = new p()),
            (this.apiSet_ = new te(re)),
            (this.pool_ = t);
          const n = this.controller_.rack;
          n.emitter.on("add", this.onRackAdd_),
            n.emitter.on("remove", this.onRackRemove_),
            n.emitter.on("inputchange", this.onRackInputChange_),
            n.emitter.on("monitorupdate", this.onRackMonitorUpdate_),
            n.children.forEach((e) => {
              this.setUpApi_(e);
            });
        }
        get children() {
          return this.controller_.rack.children.map((e) => ae(this.apiSet_, e));
        }
        addInput(e, t, n) {
          const i = null != n ? n : {},
            o = this.controller_.view.element.ownerDocument,
            s = this.pool_.createInput(o, le(e, t, i.presetKey), i),
            r = new ne(s);
          return this.add(r, i.index);
        }
        addMonitor(e, t, n) {
          const i = null != n ? n : {},
            o = this.controller_.view.element.ownerDocument,
            s = this.pool_.createMonitor(o, le(e, t), i),
            r = new oe(s);
          return this.add(r, i.index);
        }
        addFolder(e) {
          return (function (e, t) {
            return e.addBlade(
              Object.assign(Object.assign({}, t), { view: "folder" })
            );
          })(this, e);
        }
        addButton(e) {
          return (function (e, t) {
            return e.addBlade(
              Object.assign(Object.assign({}, t), { view: "button" })
            );
          })(this, e);
        }
        addSeparator(e) {
          return (function (e, t) {
            const n = null != t ? t : {};
            return e.addBlade(
              Object.assign(Object.assign({}, n), { view: "separator" })
            );
          })(this, e);
        }
        addTab(e) {
          return (function (e, t) {
            return e.addBlade(
              Object.assign(Object.assign({}, t), { view: "tab" })
            );
          })(this, e);
        }
        add(e, t) {
          this.controller_.rack.add(e.controller_, t);
          const n = this.apiSet_.find((t) => t.controller_ === e.controller_);
          return n && this.apiSet_.remove(n), this.apiSet_.add(e), e;
        }
        remove(e) {
          this.controller_.rack.remove(e.controller_);
        }
        addBlade(e) {
          const t = this.controller_.view.element.ownerDocument,
            n = this.pool_.createBlade(t, e),
            i = this.pool_.createBladeApi(n);
          return this.add(i, e.index);
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
        setUpApi_(e) {
          this.apiSet_.find((t) => t.controller_ === e) ||
            this.apiSet_.add(this.pool_.createBladeApi(e));
        }
        onRackAdd_(e) {
          this.setUpApi_(e.bladeController);
        }
        onRackRemove_(e) {
          if (e.isRoot) {
            const t = ae(this.apiSet_, e.bladeController);
            this.apiSet_.remove(t);
          }
        }
        onRackInputChange_(e) {
          const t = e.bladeController;
          if (t instanceof ie) {
            const n = ae(this.apiSet_, t),
              o = t.binding;
            this.emitter_.emit("change", {
              event: new i(
                n,
                o.target.read(),
                o.target.presetKey,
                e.options.last
              ),
            });
          } else if (t instanceof X) {
            const n = ae(this.apiSet_, t);
            this.emitter_.emit("change", {
              event: new i(n, t.value.rawValue, void 0, e.options.last),
            });
          }
        }
        onRackMonitorUpdate_(e) {
          if (!(e.bladeController instanceof se)) throw h.shouldNeverHappen();
          const t = ae(this.apiSet_, e.bladeController),
            n = e.bladeController.binding;
          this.emitter_.emit("update", {
            event: new o(t, n.target.read(), n.target.presetKey),
          });
        }
      }
      class he extends ee {
        constructor(e, t) {
          super(e, new ce(e.rackController, t)),
            (this.emitter_ = new p()),
            this.controller_.foldable
              .value("expanded")
              .emitter.on("change", (e) => {
                this.emitter_.emit("fold", {
                  event: new s(this, e.sender.rawValue),
                });
              }),
            this.rackApi_.on("change", (e) => {
              this.emitter_.emit("change", { event: e });
            }),
            this.rackApi_.on("update", (e) => {
              this.emitter_.emit("update", { event: e });
            });
        }
        get expanded() {
          return this.controller_.foldable.get("expanded");
        }
        set expanded(e) {
          this.controller_.foldable.set("expanded", e);
        }
        get title() {
          return this.controller_.props.get("title");
        }
        set title(e) {
          this.controller_.props.set("title", e);
        }
        get children() {
          return this.rackApi_.children;
        }
        addInput(e, t, n) {
          return this.rackApi_.addInput(e, t, n);
        }
        addMonitor(e, t, n) {
          return this.rackApi_.addMonitor(e, t, n);
        }
        addFolder(e) {
          return this.rackApi_.addFolder(e);
        }
        addButton(e) {
          return this.rackApi_.addButton(e);
        }
        addSeparator(e) {
          return this.rackApi_.addSeparator(e);
        }
        addTab(e) {
          return this.rackApi_.addTab(e);
        }
        add(e, t) {
          return this.rackApi_.add(e, t);
        }
        remove(e) {
          this.rackApi_.remove(e);
        }
        addBlade(e) {
          return this.rackApi_.addBlade(e);
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
      }
      class ue extends H {
        constructor(e) {
          super({
            blade: e.blade,
            view: e.view,
            viewProps: e.rackController.viewProps,
          }),
            (this.rackController = e.rackController);
        }
      }
      class de {
        constructor(e, t) {
          const n = m(t.viewName);
          (this.element = e.createElement("div")),
            this.element.classList.add(n()),
            t.viewProps.bindClassModifiers(this.element);
        }
      }
      function pe(e) {
        return e instanceof ge
          ? e.rack
          : e instanceof ue
          ? e.rackController.rack
          : null;
      }
      function fe(e) {
        const t = pe(e);
        return t ? t.bcSet_ : null;
      }
      class me {
        constructor(e) {
          var t;
          (this.onBladePositionsChange_ =
            this.onBladePositionsChange_.bind(this)),
            (this.onSetAdd_ = this.onSetAdd_.bind(this)),
            (this.onSetRemove_ = this.onSetRemove_.bind(this)),
            (this.onChildDispose_ = this.onChildDispose_.bind(this)),
            (this.onChildPositionsChange_ =
              this.onChildPositionsChange_.bind(this)),
            (this.onChildInputChange_ = this.onChildInputChange_.bind(this)),
            (this.onChildMonitorUpdate_ =
              this.onChildMonitorUpdate_.bind(this)),
            (this.onChildValueChange_ = this.onChildValueChange_.bind(this)),
            (this.onChildViewPropsChange_ =
              this.onChildViewPropsChange_.bind(this)),
            (this.onDescendantLayout_ = this.onDescendantLayout_.bind(this)),
            (this.onDescendantInputChange_ =
              this.onDescendantInputChange_.bind(this)),
            (this.onDescendantMonitorUpdate_ =
              this.onDescendantMonitorUpdate_.bind(this)),
            (this.emitter = new p()),
            (this.blade_ = null != e ? e : null),
            null === (t = this.blade_) ||
              void 0 === t ||
              t
                .value("positions")
                .emitter.on("change", this.onBladePositionsChange_),
            (this.bcSet_ = new te(fe)),
            this.bcSet_.emitter.on("add", this.onSetAdd_),
            this.bcSet_.emitter.on("remove", this.onSetRemove_);
        }
        get children() {
          return this.bcSet_.items;
        }
        add(e, t) {
          e.parent && e.parent.remove(e),
            (e.parent_ = this),
            this.bcSet_.add(e, t);
        }
        remove(e) {
          (e.parent_ = null), this.bcSet_.remove(e);
        }
        find(e) {
          return this.bcSet_.allItems().filter((t) => t instanceof e);
        }
        onSetAdd_(e) {
          this.updatePositions_();
          const t = e.target === e.root;
          if (
            (this.emitter.emit("add", {
              bladeController: e.item,
              index: e.index,
              isRoot: t,
              sender: this,
            }),
            !t)
          )
            return;
          const n = e.item;
          if (
            (n.viewProps.emitter.on("change", this.onChildViewPropsChange_),
            n.blade
              .value("positions")
              .emitter.on("change", this.onChildPositionsChange_),
            n.viewProps.handleDispose(this.onChildDispose_),
            n instanceof ie)
          )
            n.binding.emitter.on("change", this.onChildInputChange_);
          else if (n instanceof se)
            n.binding.emitter.on("update", this.onChildMonitorUpdate_);
          else if (n instanceof X)
            n.value.emitter.on("change", this.onChildValueChange_);
          else {
            const e = pe(n);
            if (e) {
              const t = e.emitter;
              t.on("layout", this.onDescendantLayout_),
                t.on("inputchange", this.onDescendantInputChange_),
                t.on("monitorupdate", this.onDescendantMonitorUpdate_);
            }
          }
        }
        onSetRemove_(e) {
          this.updatePositions_();
          const t = e.target === e.root;
          if (
            (this.emitter.emit("remove", {
              bladeController: e.item,
              isRoot: t,
              sender: this,
            }),
            !t)
          )
            return;
          const n = e.item;
          if (n instanceof ie)
            n.binding.emitter.off("change", this.onChildInputChange_);
          else if (n instanceof se)
            n.binding.emitter.off("update", this.onChildMonitorUpdate_);
          else if (n instanceof X)
            n.value.emitter.off("change", this.onChildValueChange_);
          else {
            const e = pe(n);
            if (e) {
              const t = e.emitter;
              t.off("layout", this.onDescendantLayout_),
                t.off("inputchange", this.onDescendantInputChange_),
                t.off("monitorupdate", this.onDescendantMonitorUpdate_);
            }
          }
        }
        updatePositions_() {
          const e = this.bcSet_.items.filter((e) => !e.viewProps.get("hidden")),
            t = e[0],
            n = e[e.length - 1];
          this.bcSet_.items.forEach((e) => {
            const i = [];
            e === t &&
              (i.push("first"),
              (this.blade_ &&
                !this.blade_.get("positions").includes("veryfirst")) ||
                i.push("veryfirst")),
              e === n &&
                (i.push("last"),
                (this.blade_ &&
                  !this.blade_.get("positions").includes("verylast")) ||
                  i.push("verylast")),
              e.blade.set("positions", i);
          });
        }
        onChildPositionsChange_() {
          this.updatePositions_(),
            this.emitter.emit("layout", { sender: this });
        }
        onChildViewPropsChange_(e) {
          this.updatePositions_(),
            this.emitter.emit("layout", { sender: this });
        }
        onChildDispose_() {
          this.bcSet_.items
            .filter((e) => e.viewProps.get("disposed"))
            .forEach((e) => {
              this.bcSet_.remove(e);
            });
        }
        onChildInputChange_(e) {
          const t = (function (e, t) {
            for (let n = 0; n < e.length; n++) {
              const i = e[n];
              if (i instanceof ie && i.binding === t) return i;
            }
            return null;
          })(this.find(ie), e.sender);
          if (!t) throw h.shouldNeverHappen();
          this.emitter.emit("inputchange", {
            bladeController: t,
            options: e.options,
            sender: this,
          });
        }
        onChildMonitorUpdate_(e) {
          const t = (function (e, t) {
            for (let n = 0; n < e.length; n++) {
              const i = e[n];
              if (i instanceof se && i.binding === t) return i;
            }
            return null;
          })(this.find(se), e.sender);
          if (!t) throw h.shouldNeverHappen();
          this.emitter.emit("monitorupdate", {
            bladeController: t,
            sender: this,
          });
        }
        onChildValueChange_(e) {
          const t = (function (e, t) {
            for (let n = 0; n < e.length; n++) {
              const i = e[n];
              if (i instanceof X && i.value === t) return i;
            }
            return null;
          })(this.find(X), e.sender);
          if (!t) throw h.shouldNeverHappen();
          this.emitter.emit("inputchange", {
            bladeController: t,
            options: e.options,
            sender: this,
          });
        }
        onDescendantLayout_(e) {
          this.updatePositions_(),
            this.emitter.emit("layout", { sender: this });
        }
        onDescendantInputChange_(e) {
          this.emitter.emit("inputchange", {
            bladeController: e.bladeController,
            options: e.options,
            sender: this,
          });
        }
        onDescendantMonitorUpdate_(e) {
          this.emitter.emit("monitorupdate", {
            bladeController: e.bladeController,
            sender: this,
          });
        }
        onBladePositionsChange_() {
          this.updatePositions_();
        }
      }
      class ge extends H {
        constructor(e, t) {
          super(
            Object.assign(Object.assign({}, t), {
              view: new de(e, { viewName: "brk", viewProps: t.viewProps }),
            })
          ),
            (this.onRackAdd_ = this.onRackAdd_.bind(this)),
            (this.onRackRemove_ = this.onRackRemove_.bind(this));
          const n = new me(t.root ? void 0 : t.blade);
          n.emitter.on("add", this.onRackAdd_),
            n.emitter.on("remove", this.onRackRemove_),
            (this.rack = n),
            this.viewProps.handleDispose(() => {
              for (let e = this.rack.children.length - 1; e >= 0; e--)
                this.rack.children[e].viewProps.set("disposed", !0);
            });
        }
        onRackAdd_(e) {
          e.isRoot &&
            B(this.view.element, e.bladeController.view.element, e.index);
        }
        onRackRemove_(e) {
          e.isRoot && U(e.bladeController.view.element);
        }
      }
      const ve = m("cnt");
      class ye {
        constructor(e, t) {
          var n;
          (this.className_ = m(
            null !== (n = t.viewName) && void 0 !== n ? n : "fld"
          )),
            (this.element = e.createElement("div")),
            this.element.classList.add(this.className_(), ve()),
            t.viewProps.bindClassModifiers(this.element),
            (this.foldable_ = t.foldable),
            this.foldable_.bindExpandedClass(
              this.element,
              this.className_(void 0, "expanded")
            ),
            y(
              this.foldable_,
              "completed",
              b(this.element, this.className_(void 0, "cpl"))
            );
          const i = e.createElement("button");
          i.classList.add(this.className_("b")),
            y(t.props, "title", (e) => {
              a(e)
                ? this.element.classList.add(this.className_(void 0, "not"))
                : this.element.classList.remove(this.className_(void 0, "not"));
            }),
            t.viewProps.bindDisabled(i),
            this.element.appendChild(i),
            (this.buttonElement = i);
          const o = e.createElement("div");
          o.classList.add(this.className_("t")),
            x(t.props.value("title"), o),
            this.buttonElement.appendChild(o),
            (this.titleElement = o);
          const s = e.createElement("div");
          s.classList.add(this.className_("m")),
            this.buttonElement.appendChild(s);
          const r = t.containerElement;
          r.classList.add(this.className_("c")),
            this.element.appendChild(r),
            (this.containerElement = r);
        }
      }
      class be extends ue {
        constructor(e, t) {
          var n;
          const i = Z.create(null === (n = t.expanded) || void 0 === n || n),
            o = new ge(e, {
              blade: t.blade,
              root: t.root,
              viewProps: t.viewProps,
            });
          super(
            Object.assign(Object.assign({}, t), {
              rackController: o,
              view: new ye(e, {
                containerElement: o.view.element,
                foldable: i,
                props: t.props,
                viewName: t.root ? "rot" : void 0,
                viewProps: t.viewProps,
              }),
            })
          ),
            (this.onTitleClick_ = this.onTitleClick_.bind(this)),
            (this.props = t.props),
            (this.foldable = i),
            J(this.foldable, this.view.containerElement),
            this.rackController.rack.emitter.on("add", () => {
              this.foldable.cleanUpTransition();
            }),
            this.rackController.rack.emitter.on("remove", () => {
              this.foldable.cleanUpTransition();
            }),
            this.view.buttonElement.addEventListener(
              "click",
              this.onTitleClick_
            );
        }
        get document() {
          return this.view.element.ownerDocument;
        }
        onTitleClick_() {
          this.foldable.set("expanded", !this.foldable.get("expanded"));
        }
      }
      const xe = {
        id: "folder",
        type: "blade",
        accept(e) {
          const t = A,
            n = E(e, {
              title: t.required.string,
              view: t.required.constant("folder"),
              expanded: t.optional.boolean,
            });
          return n ? { params: n } : null;
        },
        controller: (e) =>
          new be(e.document, {
            blade: e.blade,
            expanded: e.params.expanded,
            props: S.fromObject({ title: e.params.title }),
            viewProps: e.viewProps,
          }),
        api: (e) =>
          e.controller instanceof be ? new he(e.controller, e.pool) : null,
      };
      class we extends X {
        constructor(e, t) {
          const n = t.valueController.viewProps;
          super(
            Object.assign(Object.assign({}, t), {
              value: t.valueController.value,
              view: new Y(e, { props: t.props, viewProps: n }),
              viewProps: n,
            })
          ),
            (this.props = t.props),
            (this.valueController = t.valueController),
            this.view.valueElement.appendChild(
              this.valueController.view.element
            );
        }
      }
      class Ce extends t {}
      const Te = m("spr");
      class _e {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(Te()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("hr");
          n.classList.add(Te("r")), this.element.appendChild(n);
        }
      }
      class De extends H {
        constructor(e, t) {
          super(
            Object.assign(Object.assign({}, t), {
              view: new _e(e, { viewProps: t.viewProps }),
            })
          );
        }
      }
      const Me = {
          id: "separator",
          type: "blade",
          accept(e) {
            const t = E(e, { view: A.required.constant("separator") });
            return t ? { params: t } : null;
          },
          controller: (e) =>
            new De(e.document, { blade: e.blade, viewProps: e.viewProps }),
          api: (e) =>
            e.controller instanceof De ? new Ce(e.controller) : null,
        },
        Se = m("");
      function Pe(e, t) {
        return b(e, Se(void 0, t));
      }
      class Re extends S {
        constructor(e) {
          super(e);
        }
        static create(e) {
          var t, n;
          const i = null != e ? e : {},
            o = {
              disabled: null !== (t = i.disabled) && void 0 !== t && t,
              disposed: !1,
              hidden: null !== (n = i.hidden) && void 0 !== n && n,
            },
            s = S.createCore(o);
          return new Re(s);
        }
        bindClassModifiers(e) {
          y(this, "disabled", Pe(e, "disabled")),
            y(this, "hidden", Pe(e, "hidden"));
        }
        bindDisabled(e) {
          y(this, "disabled", (t) => {
            e.disabled = t;
          });
        }
        bindTabIndex(e) {
          y(this, "disabled", (t) => {
            e.tabIndex = t ? -1 : 0;
          });
        }
        handleDispose(e) {
          this.value("disposed").emitter.on("change", (t) => {
            t && e();
          });
        }
      }
      const Ae = m("tbi");
      class Ee {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(Ae()),
            t.viewProps.bindClassModifiers(this.element),
            y(t.props, "selected", (e) => {
              e
                ? this.element.classList.add(Ae(void 0, "sel"))
                : this.element.classList.remove(Ae(void 0, "sel"));
            });
          const n = e.createElement("button");
          n.classList.add(Ae("b")),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.buttonElement = n);
          const i = e.createElement("div");
          i.classList.add(Ae("t")),
            x(t.props.value("title"), i),
            this.buttonElement.appendChild(i),
            (this.titleElement = i);
        }
      }
      class ke {
        constructor(e, t) {
          (this.emitter = new p()),
            (this.onClick_ = this.onClick_.bind(this)),
            (this.props = t.props),
            (this.viewProps = t.viewProps),
            (this.view = new Ee(e, { props: t.props, viewProps: t.viewProps })),
            this.view.buttonElement.addEventListener("click", this.onClick_);
        }
        onClick_() {
          this.emitter.emit("click", { sender: this });
        }
      }
      class Ie {
        constructor(e, t) {
          (this.onItemClick_ = this.onItemClick_.bind(this)),
            (this.ic_ = new ke(e, {
              props: t.itemProps,
              viewProps: Re.create(),
            })),
            this.ic_.emitter.on("click", this.onItemClick_),
            (this.cc_ = new ge(e, { blade: q(), viewProps: Re.create() })),
            (this.props = t.props),
            y(this.props, "selected", (e) => {
              this.itemController.props.set("selected", e),
                this.contentController.viewProps.set("hidden", !e);
            });
        }
        get itemController() {
          return this.ic_;
        }
        get contentController() {
          return this.cc_;
        }
        onItemClick_() {
          this.props.set("selected", !0);
        }
      }
      class He {
        constructor(e, t) {
          (this.controller_ = e), (this.rackApi_ = t);
        }
        get title() {
          var e;
          return null !==
            (e = this.controller_.itemController.props.get("title")) &&
            void 0 !== e
            ? e
            : "";
        }
        set title(e) {
          this.controller_.itemController.props.set("title", e);
        }
        get selected() {
          return this.controller_.props.get("selected");
        }
        set selected(e) {
          this.controller_.props.set("selected", e);
        }
        get children() {
          return this.rackApi_.children;
        }
        addButton(e) {
          return this.rackApi_.addButton(e);
        }
        addFolder(e) {
          return this.rackApi_.addFolder(e);
        }
        addSeparator(e) {
          return this.rackApi_.addSeparator(e);
        }
        addTab(e) {
          return this.rackApi_.addTab(e);
        }
        add(e, t) {
          this.rackApi_.add(e, t);
        }
        remove(e) {
          this.rackApi_.remove(e);
        }
        addInput(e, t, n) {
          return this.rackApi_.addInput(e, t, n);
        }
        addMonitor(e, t, n) {
          return this.rackApi_.addMonitor(e, t, n);
        }
        addBlade(e) {
          return this.rackApi_.addBlade(e);
        }
      }
      class Le extends ee {
        constructor(e, t) {
          super(e, new ce(e.rackController, t)),
            (this.onPageAdd_ = this.onPageAdd_.bind(this)),
            (this.onPageRemove_ = this.onPageRemove_.bind(this)),
            (this.onSelect_ = this.onSelect_.bind(this)),
            (this.emitter_ = new p()),
            (this.pageApiMap_ = new Map()),
            this.rackApi_.on("change", (e) => {
              this.emitter_.emit("change", { event: e });
            }),
            this.rackApi_.on("update", (e) => {
              this.emitter_.emit("update", { event: e });
            }),
            this.controller_.tab.selectedIndex.emitter.on(
              "change",
              this.onSelect_
            ),
            this.controller_.pageSet.emitter.on("add", this.onPageAdd_),
            this.controller_.pageSet.emitter.on("remove", this.onPageRemove_),
            this.controller_.pageSet.items.forEach((e) => {
              this.setUpPageApi_(e);
            });
        }
        get pages() {
          return this.controller_.pageSet.items.map((e) => {
            const t = this.pageApiMap_.get(e);
            if (!t) throw h.shouldNeverHappen();
            return t;
          });
        }
        addPage(e) {
          const t = this.controller_.view.element.ownerDocument,
            n = new Ie(t, {
              itemProps: S.fromObject({ selected: !1, title: e.title }),
              props: S.fromObject({ selected: !1 }),
            });
          this.controller_.add(n, e.index);
          const i = this.pageApiMap_.get(n);
          if (!i) throw h.shouldNeverHappen();
          return i;
        }
        removePage(e) {
          this.controller_.remove(e);
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
        setUpPageApi_(e) {
          const t = this.rackApi_.apiSet_.find(
            (t) => t.controller_ === e.contentController
          );
          if (!t) throw h.shouldNeverHappen();
          const n = new He(e, t);
          this.pageApiMap_.set(e, n);
        }
        onPageAdd_(e) {
          this.setUpPageApi_(e.item);
        }
        onPageRemove_(e) {
          if (!this.pageApiMap_.get(e.item)) throw h.shouldNeverHappen();
          this.pageApiMap_.delete(e.item);
        }
        onSelect_(e) {
          this.emitter_.emit("select", { event: new r(this, e.rawValue) });
        }
      }
      class Oe {
        constructor() {
          (this.onItemSelectedChange_ = this.onItemSelectedChange_.bind(this)),
            (this.empty = M(!0)),
            (this.selectedIndex = M(-1)),
            (this.items_ = []);
        }
        add(e, t) {
          const n = null != t ? t : this.items_.length;
          this.items_.splice(n, 0, e),
            e.emitter.on("change", this.onItemSelectedChange_),
            this.keepSelection_();
        }
        remove(e) {
          const t = this.items_.indexOf(e);
          t < 0 ||
            (this.items_.splice(t, 1),
            e.emitter.off("change", this.onItemSelectedChange_),
            this.keepSelection_());
        }
        keepSelection_() {
          if (0 === this.items_.length)
            return (
              (this.selectedIndex.rawValue = -1),
              void (this.empty.rawValue = !0)
            );
          const e = this.items_.findIndex((e) => e.rawValue);
          e < 0
            ? (this.items_.forEach((e, t) => {
                e.rawValue = 0 === t;
              }),
              (this.selectedIndex.rawValue = 0))
            : (this.items_.forEach((t, n) => {
                t.rawValue = n === e;
              }),
              (this.selectedIndex.rawValue = e)),
            (this.empty.rawValue = !1);
        }
        onItemSelectedChange_(e) {
          if (e.rawValue) {
            const t = this.items_.findIndex((t) => t === e.sender);
            this.items_.forEach((e, n) => {
              e.rawValue = n === t;
            }),
              (this.selectedIndex.rawValue = t);
          } else this.keepSelection_();
        }
      }
      const Ve = m("tab");
      class Fe {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(Ve(), ve()),
            t.viewProps.bindClassModifiers(this.element),
            v(t.empty, b(this.element, Ve(void 0, "nop")));
          const n = e.createElement("div");
          n.classList.add(Ve("i")),
            this.element.appendChild(n),
            (this.itemsElement = n);
          const i = t.contentsElement;
          i.classList.add(Ve("c")),
            this.element.appendChild(i),
            (this.contentsElement = i);
        }
      }
      class ze extends ue {
        constructor(e, t) {
          const n = new ge(e, { blade: t.blade, viewProps: t.viewProps }),
            i = new Oe();
          super({
            blade: t.blade,
            rackController: n,
            view: new Fe(e, {
              contentsElement: n.view.element,
              empty: i.empty,
              viewProps: t.viewProps,
            }),
          }),
            (this.onPageAdd_ = this.onPageAdd_.bind(this)),
            (this.onPageRemove_ = this.onPageRemove_.bind(this)),
            (this.pageSet_ = new te(() => null)),
            this.pageSet_.emitter.on("add", this.onPageAdd_),
            this.pageSet_.emitter.on("remove", this.onPageRemove_),
            (this.tab = i);
        }
        get pageSet() {
          return this.pageSet_;
        }
        add(e, t) {
          this.pageSet_.add(e, t);
        }
        remove(e) {
          this.pageSet_.remove(this.pageSet_.items[e]);
        }
        onPageAdd_(e) {
          const t = e.item;
          B(this.view.itemsElement, t.itemController.view.element, e.index),
            this.rackController.rack.add(t.contentController, e.index),
            this.tab.add(t.props.value("selected"));
        }
        onPageRemove_(e) {
          const t = e.item;
          U(t.itemController.view.element),
            this.rackController.rack.remove(t.contentController),
            this.tab.remove(t.props.value("selected"));
        }
      }
      const je = {
        id: "tab",
        type: "blade",
        accept(e) {
          const t = A,
            n = E(e, {
              pages: t.required.array(
                t.required.object({ title: t.required.string })
              ),
              view: t.required.constant("tab"),
            });
          return n && 0 !== n.pages.length ? { params: n } : null;
        },
        controller(e) {
          const t = new ze(e.document, {
            blade: e.blade,
            viewProps: e.viewProps,
          });
          return (
            e.params.pages.forEach((n) => {
              const i = new Ie(e.document, {
                itemProps: S.fromObject({ selected: !1, title: n.title }),
                props: S.fromObject({ selected: !1 }),
              });
              t.add(i);
            }),
            t
          );
        },
        api: (e) =>
          e.controller instanceof ze ? new Le(e.controller, e.pool) : null,
      };
      class Be {
        constructor() {
          (this.disabled = !1), (this.emitter = new p());
        }
        dispose() {}
        tick() {
          this.disabled || this.emitter.emit("tick", { sender: this });
        }
      }
      class Ue {
        constructor(e, t) {
          (this.disabled_ = !1),
            (this.timerId_ = null),
            (this.onTick_ = this.onTick_.bind(this)),
            (this.doc_ = e),
            (this.emitter = new p()),
            (this.interval_ = t),
            this.setTimer_();
        }
        get disabled() {
          return this.disabled_;
        }
        set disabled(e) {
          (this.disabled_ = e),
            this.disabled_ ? this.clearTimer_() : this.setTimer_();
        }
        dispose() {
          this.clearTimer_();
        }
        clearTimer_() {
          if (null === this.timerId_) return;
          const e = this.doc_.defaultView;
          e && e.clearInterval(this.timerId_), (this.timerId_ = null);
        }
        setTimer_() {
          if ((this.clearTimer_(), this.interval_ <= 0)) return;
          const e = this.doc_.defaultView;
          e && (this.timerId_ = e.setInterval(this.onTick_, this.interval_));
        }
        onTick_() {
          this.disabled_ || this.emitter.emit("tick", { sender: this });
        }
      }
      class Ne {
        constructor(e) {
          this.constraints = e;
        }
        constrain(e) {
          return this.constraints.reduce((e, t) => t.constrain(e), e);
        }
      }
      function Ge(e, t) {
        if (e instanceof t) return e;
        if (e instanceof Ne) {
          const n = e.constraints.reduce(
            (e, n) => e || (n instanceof t ? n : null),
            null
          );
          if (n) return n;
        }
        return null;
      }
      class We {
        constructor(e) {
          this.options = e;
        }
        constrain(e) {
          const t = this.options;
          return 0 === t.length || t.filter((t) => t.value === e).length > 0
            ? e
            : t[0].value;
        }
      }
      class Ye {
        constructor(e) {
          (this.maxValue = e.max), (this.minValue = e.min);
        }
        constrain(e) {
          let t = e;
          return (
            a(this.minValue) || (t = Math.max(t, this.minValue)),
            a(this.maxValue) || (t = Math.min(t, this.maxValue)),
            t
          );
        }
      }
      class Ke {
        constructor(e, t = 0) {
          (this.step = e), (this.origin = t);
        }
        constrain(e) {
          const t = this.origin % this.step;
          return t + Math.round((e - t) / this.step) * this.step;
        }
      }
      const $e = m("lst");
      class Xe {
        constructor(e, t) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.props_ = t.props),
            (this.element = e.createElement("div")),
            this.element.classList.add($e()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("select");
          n.classList.add($e("s")),
            y(this.props_, "options", (t) => {
              N(n),
                t.forEach((t, i) => {
                  const o = e.createElement("option");
                  (o.dataset.index = String(i)),
                    (o.textContent = t.text),
                    (o.value = String(t.value)),
                    n.appendChild(o);
                });
            }),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.selectElement = n);
          const i = e.createElement("div");
          i.classList.add($e("m")),
            i.appendChild(j(e, "dropdown")),
            this.element.appendChild(i),
            t.value.emitter.on("change", this.onValueChange_),
            (this.value_ = t.value),
            this.update_();
        }
        update_() {
          this.selectElement.value = String(this.value_.rawValue);
        }
        onValueChange_() {
          this.update_();
        }
      }
      class qe {
        constructor(e, t) {
          (this.onSelectChange_ = this.onSelectChange_.bind(this)),
            (this.props = t.props),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new Xe(e, {
              props: this.props,
              value: this.value,
              viewProps: this.viewProps,
            })),
            this.view.selectElement.addEventListener(
              "change",
              this.onSelectChange_
            );
        }
        onSelectChange_(e) {
          const t = e.currentTarget.selectedOptions.item(0);
          if (!t) return;
          const n = Number(t.dataset.index);
          this.value.rawValue = this.props.get("options")[n].value;
        }
      }
      const Ze = m("pop");
      class Qe {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(Ze()),
            t.viewProps.bindClassModifiers(this.element),
            v(t.shows, b(this.element, Ze(void 0, "v")));
        }
      }
      class Je {
        constructor(e, t) {
          (this.shows = M(!1)),
            (this.viewProps = t.viewProps),
            (this.view = new Qe(e, {
              shows: this.shows,
              viewProps: this.viewProps,
            }));
        }
      }
      const et = m("txt");
      class tt {
        constructor(e, t) {
          (this.onChange_ = this.onChange_.bind(this)),
            (this.element = e.createElement("div")),
            this.element.classList.add(et()),
            t.viewProps.bindClassModifiers(this.element),
            (this.props_ = t.props),
            this.props_.emitter.on("change", this.onChange_);
          const n = e.createElement("input");
          n.classList.add(et("i")),
            (n.type = "text"),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.inputElement = n),
            t.value.emitter.on("change", this.onChange_),
            (this.value_ = t.value),
            this.refresh();
        }
        refresh() {
          const e = this.props_.get("formatter");
          this.inputElement.value = e(this.value_.rawValue);
        }
        onChange_() {
          this.refresh();
        }
      }
      class nt {
        constructor(e, t) {
          (this.onInputChange_ = this.onInputChange_.bind(this)),
            (this.parser_ = t.parser),
            (this.props = t.props),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new tt(e, {
              props: t.props,
              value: this.value,
              viewProps: this.viewProps,
            })),
            this.view.inputElement.addEventListener(
              "change",
              this.onInputChange_
            );
        }
        onInputChange_(e) {
          const t = e.currentTarget.value,
            n = this.parser_(t);
          a(n) || (this.value.rawValue = n), this.view.refresh();
        }
      }
      function it(e) {
        return "false" !== e && !!e;
      }
      function ot(e) {
        return (function (e) {
          return String(e);
        })(e);
      }
      class st {
        constructor(e) {
          this.text = e;
        }
        evaluate() {
          return Number(this.text);
        }
        toString() {
          return this.text;
        }
      }
      const rt = {
        "**": (e, t) => Math.pow(e, t),
        "*": (e, t) => e * t,
        "/": (e, t) => e / t,
        "%": (e, t) => e % t,
        "+": (e, t) => e + t,
        "-": (e, t) => e - t,
        "<<": (e, t) => e << t,
        ">>": (e, t) => e >> t,
        ">>>": (e, t) => e >>> t,
        "&": (e, t) => e & t,
        "^": (e, t) => e ^ t,
        "|": (e, t) => e | t,
      };
      class at {
        constructor(e, t, n) {
          (this.left = t), (this.operator = e), (this.right = n);
        }
        evaluate() {
          const e = rt[this.operator];
          if (!e)
            throw new Error("unexpected binary operator: '" + this.operator);
          return e(this.left.evaluate(), this.right.evaluate());
        }
        toString() {
          return [
            "b(",
            this.left.toString(),
            this.operator,
            this.right.toString(),
            ")",
          ].join(" ");
        }
      }
      const lt = { "+": (e) => e, "-": (e) => -e, "~": (e) => ~e };
      class ct {
        constructor(e, t) {
          (this.operator = e), (this.expression = t);
        }
        evaluate() {
          const e = lt[this.operator];
          if (!e)
            throw new Error("unexpected unary operator: '" + this.operator);
          return e(this.expression.evaluate());
        }
        toString() {
          return ["u(", this.operator, this.expression.toString(), ")"].join(
            " "
          );
        }
      }
      function ht(e) {
        return (t, n) => {
          for (let i = 0; i < e.length; i++) {
            const o = e[i](t, n);
            if ("" !== o) return o;
          }
          return "";
        };
      }
      function ut(e, t) {
        var n;
        const i = e.substr(t).match(/^\s+/);
        return null !== (n = i && i[0]) && void 0 !== n ? n : "";
      }
      function dt(e, t) {
        var n;
        const i = e.substr(t).match(/^[0-9]+/);
        return null !== (n = i && i[0]) && void 0 !== n ? n : "";
      }
      function pt(e, t) {
        const n = e.substr(t, 1);
        if (((t += 1), "e" !== n.toLowerCase())) return "";
        const i = (function (e, t) {
          const n = dt(e, t);
          if ("" !== n) return n;
          const i = e.substr(t, 1);
          if ("-" !== i && "+" !== i) return "";
          const o = dt(e, (t += 1));
          return "" === o ? "" : i + o;
        })(e, t);
        return "" === i ? "" : n + i;
      }
      function ft(e, t) {
        const n = e.substr(t, 1);
        if ("0" === n) return n;
        const i = (function (e, t) {
          const n = e.substr(t, 1);
          return n.match(/^[1-9]$/) ? n : "";
        })(e, t);
        return (t += i.length), "" === i ? "" : i + dt(e, t);
      }
      const mt = ht([
          function (e, t) {
            const n = ft(e, t);
            if (((t += n.length), "" === n)) return "";
            const i = e.substr(t, 1);
            if (((t += i.length), "." !== i)) return "";
            const o = dt(e, t);
            return n + i + o + pt(e, (t += o.length));
          },
          function (e, t) {
            const n = e.substr(t, 1);
            if (((t += n.length), "." !== n)) return "";
            const i = dt(e, t);
            return (t += i.length), "" === i ? "" : n + i + pt(e, t);
          },
          function (e, t) {
            const n = ft(e, t);
            return (t += n.length), "" === n ? "" : n + pt(e, t);
          },
        ]),
        gt = ht([
          function (e, t) {
            const n = e.substr(t, 2);
            if (((t += n.length), "0b" !== n.toLowerCase())) return "";
            const i = (function (e, t) {
              var n;
              const i = e.substr(t).match(/^[01]+/);
              return null !== (n = i && i[0]) && void 0 !== n ? n : "";
            })(e, t);
            return "" === i ? "" : n + i;
          },
          function (e, t) {
            const n = e.substr(t, 2);
            if (((t += n.length), "0o" !== n.toLowerCase())) return "";
            const i = (function (e, t) {
              var n;
              const i = e.substr(t).match(/^[0-7]+/);
              return null !== (n = i && i[0]) && void 0 !== n ? n : "";
            })(e, t);
            return "" === i ? "" : n + i;
          },
          function (e, t) {
            const n = e.substr(t, 2);
            if (((t += n.length), "0x" !== n.toLowerCase())) return "";
            const i = (function (e, t) {
              var n;
              const i = e.substr(t).match(/^[0-9a-f]+/i);
              return null !== (n = i && i[0]) && void 0 !== n ? n : "";
            })(e, t);
            return "" === i ? "" : n + i;
          },
        ]),
        vt = ht([gt, mt]);
      function yt(e, t) {
        var n;
        return null !==
          (n = (function (e, t) {
            const n = vt(e, t);
            return (
              (t += n.length),
              "" === n ? null : { evaluable: new st(n), cursor: t }
            );
          })(e, t)) && void 0 !== n
          ? n
          : (function (e, t) {
              const n = e.substr(t, 1);
              if (((t += n.length), "(" !== n)) return null;
              const i = wt(e, t);
              if (!i) return null;
              (t = i.cursor), (t += ut(e, t).length);
              const o = e.substr(t, 1);
              return (
                (t += o.length),
                ")" !== o ? null : { evaluable: i.evaluable, cursor: t }
              );
            })(e, t);
      }
      function bt(e, t, n) {
        n += ut(t, n).length;
        const i = e.filter((e) => t.startsWith(e, n))[0];
        return i
          ? ((n += i.length), { cursor: (n += ut(t, n).length), operator: i })
          : null;
      }
      const xt = [
        ["**"],
        ["*", "/", "%"],
        ["+", "-"],
        ["<<", ">>>", ">>"],
        ["&"],
        ["^"],
        ["|"],
      ].reduce(
        (e, t) =>
          (function (e, t) {
            return (n, i) => {
              const o = e(n, i);
              if (!o) return null;
              i = o.cursor;
              let s = o.evaluable;
              for (;;) {
                const o = bt(t, n, i);
                if (!o) break;
                i = o.cursor;
                const r = e(n, i);
                if (!r) return null;
                (i = r.cursor), (s = new at(o.operator, s, r.evaluable));
              }
              return s ? { cursor: i, evaluable: s } : null;
            };
          })(e, t),
        function e(t, n) {
          const i = yt(t, n);
          if (i) return i;
          const o = t.substr(n, 1);
          if (((n += o.length), "+" !== o && "-" !== o && "~" !== o))
            return null;
          const s = e(t, n);
          return s
            ? { cursor: (n = s.cursor), evaluable: new ct(o, s.evaluable) }
            : null;
        }
      );
      function wt(e, t) {
        return (t += ut(e, t).length), xt(e, t);
      }
      function Ct(e) {
        var t;
        const n = (function (e) {
          const t = wt(e, 0);
          return t
            ? t.cursor + ut(e, t.cursor).length !== e.length
              ? null
              : t.evaluable
            : null;
        })(e);
        return null !== (t = null == n ? void 0 : n.evaluate()) && void 0 !== t
          ? t
          : null;
      }
      function Tt(e) {
        if ("number" == typeof e) return e;
        if ("string" == typeof e) {
          const t = Ct(e);
          if (!a(t)) return t;
        }
        return 0;
      }
      function _t(e) {
        return String(e);
      }
      function Dt(e) {
        return (t) => t.toFixed(Math.max(Math.min(e, 20), 0));
      }
      const Mt = Dt(0);
      function St(e) {
        return Mt(e) + "%";
      }
      function Pt(e) {
        return String(e);
      }
      function Rt(e) {
        return e;
      }
      function At(e, t) {
        for (; e.length < t; ) e.push(void 0);
      }
      function Et(e) {
        const t = [];
        return At(t, e), M(t);
      }
      function kt(e) {
        const t = e.indexOf(void 0);
        return t < 0 ? e : e.slice(0, t);
      }
      function It({ primary: e, secondary: t, forward: n, backward: i }) {
        let o = !1;
        function s(e) {
          o || ((o = !0), e(), (o = !1));
        }
        e.emitter.on("change", (i) => {
          s(() => {
            t.setRawValue(n(e, t), i.options);
          });
        }),
          t.emitter.on("change", (o) => {
            s(() => {
              e.setRawValue(i(e, t), o.options);
            }),
              s(() => {
                t.setRawValue(n(e, t), o.options);
              });
          }),
          s(() => {
            t.setRawValue(n(e, t), { forceEmit: !1, last: !0 });
          });
      }
      function Ht(e, t) {
        const n = e * (t.altKey ? 0.1 : 1) * (t.shiftKey ? 10 : 1);
        return t.upKey ? +n : t.downKey ? -n : 0;
      }
      function Lt(e) {
        return {
          altKey: e.altKey,
          downKey: "ArrowDown" === e.key,
          shiftKey: e.shiftKey,
          upKey: "ArrowUp" === e.key,
        };
      }
      function Ot(e) {
        return {
          altKey: e.altKey,
          downKey: "ArrowLeft" === e.key,
          shiftKey: e.shiftKey,
          upKey: "ArrowRight" === e.key,
        };
      }
      function Vt(e) {
        return (
          (function (e) {
            return "ArrowUp" === e || "ArrowDown" === e;
          })(e) ||
          "ArrowLeft" === e ||
          "ArrowRight" === e
        );
      }
      function Ft(e, t) {
        var n, i;
        const o = t.ownerDocument.defaultView,
          s = t.getBoundingClientRect();
        return {
          x:
            e.pageX -
            ((null !== (n = o && o.scrollX) && void 0 !== n ? n : 0) + s.left),
          y:
            e.pageY -
            ((null !== (i = o && o.scrollY) && void 0 !== i ? i : 0) + s.top),
        };
      }
      class zt {
        constructor(e) {
          (this.lastTouch_ = null),
            (this.onDocumentMouseMove_ = this.onDocumentMouseMove_.bind(this)),
            (this.onDocumentMouseUp_ = this.onDocumentMouseUp_.bind(this)),
            (this.onMouseDown_ = this.onMouseDown_.bind(this)),
            (this.onTouchEnd_ = this.onTouchEnd_.bind(this)),
            (this.onTouchMove_ = this.onTouchMove_.bind(this)),
            (this.onTouchStart_ = this.onTouchStart_.bind(this)),
            (this.elem_ = e),
            (this.emitter = new p()),
            e.addEventListener("touchstart", this.onTouchStart_, {
              passive: !1,
            }),
            e.addEventListener("touchmove", this.onTouchMove_, { passive: !0 }),
            e.addEventListener("touchend", this.onTouchEnd_),
            e.addEventListener("mousedown", this.onMouseDown_);
        }
        computePosition_(e) {
          const t = this.elem_.getBoundingClientRect();
          return {
            bounds: { width: t.width, height: t.height },
            point: e ? { x: e.x, y: e.y } : null,
          };
        }
        onMouseDown_(e) {
          var t;
          e.preventDefault(),
            null === (t = e.currentTarget) || void 0 === t || t.focus();
          const n = this.elem_.ownerDocument;
          n.addEventListener("mousemove", this.onDocumentMouseMove_),
            n.addEventListener("mouseup", this.onDocumentMouseUp_),
            this.emitter.emit("down", {
              altKey: e.altKey,
              data: this.computePosition_(Ft(e, this.elem_)),
              sender: this,
              shiftKey: e.shiftKey,
            });
        }
        onDocumentMouseMove_(e) {
          this.emitter.emit("move", {
            altKey: e.altKey,
            data: this.computePosition_(Ft(e, this.elem_)),
            sender: this,
            shiftKey: e.shiftKey,
          });
        }
        onDocumentMouseUp_(e) {
          const t = this.elem_.ownerDocument;
          t.removeEventListener("mousemove", this.onDocumentMouseMove_),
            t.removeEventListener("mouseup", this.onDocumentMouseUp_),
            this.emitter.emit("up", {
              altKey: e.altKey,
              data: this.computePosition_(Ft(e, this.elem_)),
              sender: this,
              shiftKey: e.shiftKey,
            });
        }
        onTouchStart_(e) {
          e.preventDefault();
          const t = e.targetTouches.item(0),
            n = this.elem_.getBoundingClientRect();
          this.emitter.emit("down", {
            altKey: e.altKey,
            data: this.computePosition_(
              t ? { x: t.clientX - n.left, y: t.clientY - n.top } : void 0
            ),
            sender: this,
            shiftKey: e.shiftKey,
          }),
            (this.lastTouch_ = t);
        }
        onTouchMove_(e) {
          const t = e.targetTouches.item(0),
            n = this.elem_.getBoundingClientRect();
          this.emitter.emit("move", {
            altKey: e.altKey,
            data: this.computePosition_(
              t ? { x: t.clientX - n.left, y: t.clientY - n.top } : void 0
            ),
            sender: this,
            shiftKey: e.shiftKey,
          }),
            (this.lastTouch_ = t);
        }
        onTouchEnd_(e) {
          var t;
          const n =
              null !== (t = e.targetTouches.item(0)) && void 0 !== t
                ? t
                : this.lastTouch_,
            i = this.elem_.getBoundingClientRect();
          this.emitter.emit("up", {
            altKey: e.altKey,
            data: this.computePosition_(
              n ? { x: n.clientX - i.left, y: n.clientY - i.top } : void 0
            ),
            sender: this,
            shiftKey: e.shiftKey,
          });
        }
      }
      function jt(e, t, n, i, o) {
        return i + ((e - t) / (n - t)) * (o - i);
      }
      function Bt(e) {
        return String(e.toFixed(10)).split(".")[1].replace(/0+$/, "").length;
      }
      function Ut(e, t, n) {
        return Math.min(Math.max(e, t), n);
      }
      function Nt(e, t) {
        return ((e % t) + t) % t;
      }
      const Gt = m("txt");
      class Wt {
        constructor(e, t) {
          (this.onChange_ = this.onChange_.bind(this)),
            (this.props_ = t.props),
            this.props_.emitter.on("change", this.onChange_),
            (this.element = e.createElement("div")),
            this.element.classList.add(Gt(), Gt(void 0, "num")),
            t.arrayPosition &&
              this.element.classList.add(Gt(void 0, t.arrayPosition)),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("input");
          n.classList.add(Gt("i")),
            (n.type = "text"),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.inputElement = n),
            (this.onDraggingChange_ = this.onDraggingChange_.bind(this)),
            (this.dragging_ = t.dragging),
            this.dragging_.emitter.on("change", this.onDraggingChange_),
            this.element.classList.add(Gt()),
            this.inputElement.classList.add(Gt("i"));
          const i = e.createElement("div");
          i.classList.add(Gt("k")),
            this.element.appendChild(i),
            (this.knobElement = i);
          const o = e.createElementNS(L, "svg");
          o.classList.add(Gt("g")), this.knobElement.appendChild(o);
          const s = e.createElementNS(L, "path");
          s.classList.add(Gt("gb")),
            o.appendChild(s),
            (this.guideBodyElem_ = s);
          const r = e.createElementNS(L, "path");
          r.classList.add(Gt("gh")),
            o.appendChild(r),
            (this.guideHeadElem_ = r);
          const a = e.createElement("div");
          a.classList.add(m("tt")()),
            this.knobElement.appendChild(a),
            (this.tooltipElem_ = a),
            t.value.emitter.on("change", this.onChange_),
            (this.value = t.value),
            this.refresh();
        }
        onDraggingChange_(e) {
          if (null === e.rawValue)
            return void this.element.classList.remove(Gt(void 0, "drg"));
          this.element.classList.add(Gt(void 0, "drg"));
          const t = e.rawValue / this.props_.get("draggingScale"),
            n = t + (t > 0 ? -1 : t < 0 ? 1 : 0),
            i = Ut(-n, -4, 4);
          this.guideHeadElem_.setAttributeNS(
            null,
            "d",
            [`M ${n + i},0 L${n},4 L${n + i},8`, `M ${t},-1 L${t},9`].join(" ")
          ),
            this.guideBodyElem_.setAttributeNS(null, "d", `M 0,4 L${t},4`);
          const o = this.props_.get("formatter");
          (this.tooltipElem_.textContent = o(this.value.rawValue)),
            (this.tooltipElem_.style.left = t + "px");
        }
        refresh() {
          const e = this.props_.get("formatter");
          this.inputElement.value = e(this.value.rawValue);
        }
        onChange_() {
          this.refresh();
        }
      }
      class Yt {
        constructor(e, t) {
          var n;
          (this.originRawValue_ = 0),
            (this.onInputChange_ = this.onInputChange_.bind(this)),
            (this.onInputKeyDown_ = this.onInputKeyDown_.bind(this)),
            (this.onInputKeyUp_ = this.onInputKeyUp_.bind(this)),
            (this.onPointerDown_ = this.onPointerDown_.bind(this)),
            (this.onPointerMove_ = this.onPointerMove_.bind(this)),
            (this.onPointerUp_ = this.onPointerUp_.bind(this)),
            (this.baseStep_ = t.baseStep),
            (this.parser_ = t.parser),
            (this.props = t.props),
            (this.sliderProps_ =
              null !== (n = t.sliderProps) && void 0 !== n ? n : null),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.dragging_ = M(null)),
            (this.view = new Wt(e, {
              arrayPosition: t.arrayPosition,
              dragging: this.dragging_,
              props: this.props,
              value: this.value,
              viewProps: this.viewProps,
            })),
            this.view.inputElement.addEventListener(
              "change",
              this.onInputChange_
            ),
            this.view.inputElement.addEventListener(
              "keydown",
              this.onInputKeyDown_
            ),
            this.view.inputElement.addEventListener(
              "keyup",
              this.onInputKeyUp_
            );
          const i = new zt(this.view.knobElement);
          i.emitter.on("down", this.onPointerDown_),
            i.emitter.on("move", this.onPointerMove_),
            i.emitter.on("up", this.onPointerUp_);
        }
        constrainValue_(e) {
          var t, n;
          const i =
              null === (t = this.sliderProps_) || void 0 === t
                ? void 0
                : t.get("minValue"),
            o =
              null === (n = this.sliderProps_) || void 0 === n
                ? void 0
                : n.get("maxValue");
          let s = e;
          return (
            void 0 !== i && (s = Math.max(s, i)),
            void 0 !== o && (s = Math.min(s, o)),
            s
          );
        }
        onInputChange_(e) {
          const t = e.currentTarget.value,
            n = this.parser_(t);
          a(n) || (this.value.rawValue = this.constrainValue_(n)),
            this.view.refresh();
        }
        onInputKeyDown_(e) {
          const t = Ht(this.baseStep_, Lt(e));
          0 !== t &&
            this.value.setRawValue(
              this.constrainValue_(this.value.rawValue + t),
              { forceEmit: !1, last: !1 }
            );
        }
        onInputKeyUp_(e) {
          0 !== Ht(this.baseStep_, Lt(e)) &&
            this.value.setRawValue(this.value.rawValue, {
              forceEmit: !0,
              last: !0,
            });
        }
        onPointerDown_() {
          (this.originRawValue_ = this.value.rawValue),
            (this.dragging_.rawValue = 0);
        }
        computeDraggingValue_(e) {
          if (!e.point) return null;
          const t = e.point.x - e.bounds.width / 2;
          return this.constrainValue_(
            this.originRawValue_ + t * this.props.get("draggingScale")
          );
        }
        onPointerMove_(e) {
          const t = this.computeDraggingValue_(e.data);
          null !== t &&
            (this.value.setRawValue(t, { forceEmit: !1, last: !1 }),
            (this.dragging_.rawValue =
              this.value.rawValue - this.originRawValue_));
        }
        onPointerUp_(e) {
          const t = this.computeDraggingValue_(e.data);
          null !== t &&
            (this.value.setRawValue(t, { forceEmit: !0, last: !0 }),
            (this.dragging_.rawValue = null));
        }
      }
      const Kt = m("sld");
      class $t {
        constructor(e, t) {
          (this.onChange_ = this.onChange_.bind(this)),
            (this.props_ = t.props),
            this.props_.emitter.on("change", this.onChange_),
            (this.element = e.createElement("div")),
            this.element.classList.add(Kt()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("div");
          n.classList.add(Kt("t")),
            t.viewProps.bindTabIndex(n),
            this.element.appendChild(n),
            (this.trackElement = n);
          const i = e.createElement("div");
          i.classList.add(Kt("k")),
            this.trackElement.appendChild(i),
            (this.knobElement = i),
            t.value.emitter.on("change", this.onChange_),
            (this.value = t.value),
            this.update_();
        }
        update_() {
          const e = Ut(
            jt(
              this.value.rawValue,
              this.props_.get("minValue"),
              this.props_.get("maxValue"),
              0,
              100
            ),
            0,
            100
          );
          this.knobElement.style.width = e + "%";
        }
        onChange_() {
          this.update_();
        }
      }
      class Xt {
        constructor(e, t) {
          (this.onKeyDown_ = this.onKeyDown_.bind(this)),
            (this.onKeyUp_ = this.onKeyUp_.bind(this)),
            (this.onPointerDownOrMove_ = this.onPointerDownOrMove_.bind(this)),
            (this.onPointerUp_ = this.onPointerUp_.bind(this)),
            (this.baseStep_ = t.baseStep),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.props = t.props),
            (this.view = new $t(e, {
              props: this.props,
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.ptHandler_ = new zt(this.view.trackElement)),
            this.ptHandler_.emitter.on("down", this.onPointerDownOrMove_),
            this.ptHandler_.emitter.on("move", this.onPointerDownOrMove_),
            this.ptHandler_.emitter.on("up", this.onPointerUp_),
            this.view.trackElement.addEventListener("keydown", this.onKeyDown_),
            this.view.trackElement.addEventListener("keyup", this.onKeyUp_);
        }
        handlePointerEvent_(e, t) {
          e.point &&
            this.value.setRawValue(
              jt(
                Ut(e.point.x, 0, e.bounds.width),
                0,
                e.bounds.width,
                this.props.get("minValue"),
                this.props.get("maxValue")
              ),
              t
            );
        }
        onPointerDownOrMove_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerUp_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !0, last: !0 });
        }
        onKeyDown_(e) {
          const t = Ht(this.baseStep_, Ot(e));
          0 !== t &&
            this.value.setRawValue(this.value.rawValue + t, {
              forceEmit: !1,
              last: !1,
            });
        }
        onKeyUp_(e) {
          0 !== Ht(this.baseStep_, Ot(e)) &&
            this.value.setRawValue(this.value.rawValue, {
              forceEmit: !0,
              last: !0,
            });
        }
      }
      const qt = m("sldtxt");
      class Zt {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(qt());
          const n = e.createElement("div");
          n.classList.add(qt("s")),
            (this.sliderView_ = t.sliderView),
            n.appendChild(this.sliderView_.element),
            this.element.appendChild(n);
          const i = e.createElement("div");
          i.classList.add(qt("t")),
            (this.textView_ = t.textView),
            i.appendChild(this.textView_.element),
            this.element.appendChild(i);
        }
      }
      class Qt {
        constructor(e, t) {
          (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.sliderC_ = new Xt(e, {
              baseStep: t.baseStep,
              props: t.sliderProps,
              value: t.value,
              viewProps: this.viewProps,
            })),
            (this.textC_ = new Yt(e, {
              baseStep: t.baseStep,
              parser: t.parser,
              props: t.textProps,
              sliderProps: t.sliderProps,
              value: t.value,
              viewProps: t.viewProps,
            })),
            (this.view = new Zt(e, {
              sliderView: this.sliderC_.view,
              textView: this.textC_.view,
            }));
        }
        get sliderController() {
          return this.sliderC_;
        }
        get textController() {
          return this.textC_;
        }
      }
      function Jt(e, t) {
        e.write(t);
      }
      function en(e) {
        const t = A;
        return Array.isArray(e)
          ? t.required.array(
              t.required.object({
                text: t.required.string,
                value: t.required.raw,
              })
            )(e).value
          : "object" == typeof e
          ? t.required.raw(e).value
          : void 0;
      }
      function tn(e) {
        if ("inline" === e || "popup" === e) return e;
      }
      function nn(e) {
        const t = A;
        return t.required.object({
          max: t.optional.number,
          min: t.optional.number,
          step: t.optional.number,
        })(e).value;
      }
      function on(e) {
        if (Array.isArray(e)) return e;
        const t = [];
        return (
          Object.keys(e).forEach((n) => {
            t.push({ text: n, value: e[n] });
          }),
          t
        );
      }
      function sn(e) {
        return a(e) ? null : new We(on(e));
      }
      function rn(e) {
        const t = e ? Ge(e, We) : null;
        return t ? t.options : null;
      }
      function an(e, t) {
        const n = e && Ge(e, Ke);
        return n ? Bt(n.step) : Math.max(Bt(t), 2);
      }
      function ln(e) {
        const t = (function (e) {
          const t = e ? Ge(e, Ke) : null;
          return t ? t.step : null;
        })(e);
        return null != t ? t : 1;
      }
      function cn(e, t) {
        var n;
        const i = e && Ge(e, Ke),
          o = Math.abs(
            null !== (n = null == i ? void 0 : i.step) && void 0 !== n ? n : t
          );
        return 0 === o ? 0.1 : Math.pow(10, Math.floor(Math.log10(o)) - 1);
      }
      const hn = m("ckb");
      class un {
        constructor(e, t) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.element = e.createElement("div")),
            this.element.classList.add(hn()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("label");
          n.classList.add(hn("l")), this.element.appendChild(n);
          const i = e.createElement("input");
          i.classList.add(hn("i")),
            (i.type = "checkbox"),
            n.appendChild(i),
            (this.inputElement = i),
            t.viewProps.bindDisabled(this.inputElement);
          const o = e.createElement("div");
          o.classList.add(hn("w")), n.appendChild(o);
          const s = j(e, "check");
          o.appendChild(s),
            t.value.emitter.on("change", this.onValueChange_),
            (this.value = t.value),
            this.update_();
        }
        update_() {
          this.inputElement.checked = this.value.rawValue;
        }
        onValueChange_() {
          this.update_();
        }
      }
      class dn {
        constructor(e, t) {
          (this.onInputChange_ = this.onInputChange_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new un(e, {
              value: this.value,
              viewProps: this.viewProps,
            })),
            this.view.inputElement.addEventListener(
              "change",
              this.onInputChange_
            );
        }
        onInputChange_(e) {
          const t = e.currentTarget;
          this.value.rawValue = t.checked;
        }
      }
      const pn = {
          id: "input-bool",
          type: "input",
          accept: (e, t) => {
            if ("boolean" != typeof e) return null;
            const n = E(t, { options: A.optional.custom(en) });
            return n ? { initialValue: e, params: n } : null;
          },
          binding: {
            reader: (e) => it,
            constraint: (e) =>
              (function (e) {
                const t = [],
                  n = sn(e.options);
                return n && t.push(n), new Ne(t);
              })(e.params),
            writer: (e) => Jt,
          },
          controller: (e) => {
            var t;
            const n = e.document,
              i = e.value,
              o = e.constraint;
            return o && Ge(o, We)
              ? new qe(n, {
                  props: S.fromObject({
                    options: null !== (t = rn(o)) && void 0 !== t ? t : [],
                  }),
                  value: i,
                  viewProps: e.viewProps,
                })
              : new dn(n, { value: i, viewProps: e.viewProps });
          },
        },
        fn = m("col");
      class mn {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(fn()),
            t.foldable.bindExpandedClass(this.element, fn(void 0, "expanded")),
            y(t.foldable, "completed", b(this.element, fn(void 0, "cpl")));
          const n = e.createElement("div");
          n.classList.add(fn("h")), this.element.appendChild(n);
          const i = e.createElement("div");
          i.classList.add(fn("s")), n.appendChild(i), (this.swatchElement = i);
          const o = e.createElement("div");
          if (
            (o.classList.add(fn("t")),
            n.appendChild(o),
            (this.textElement = o),
            "inline" === t.pickerLayout)
          ) {
            const t = e.createElement("div");
            t.classList.add(fn("p")),
              this.element.appendChild(t),
              (this.pickerElement = t);
          } else this.pickerElement = null;
        }
      }
      function gn(e, t, n) {
        const i = Nt(e, 360),
          o = Ut(t / 100, 0, 1),
          s = Ut(n / 100, 0, 1),
          r = s * o,
          a = r * (1 - Math.abs(((i / 60) % 2) - 1)),
          l = s - r;
        let c, h, u;
        return (
          ([c, h, u] =
            i >= 0 && i < 60
              ? [r, a, 0]
              : i >= 60 && i < 120
              ? [a, r, 0]
              : i >= 120 && i < 180
              ? [0, r, a]
              : i >= 180 && i < 240
              ? [0, a, r]
              : i >= 240 && i < 300
              ? [a, 0, r]
              : [r, 0, a]),
          [255 * (c + l), 255 * (h + l), 255 * (u + l)]
        );
      }
      function vn(e) {
        return [e[0], e[1], e[2]];
      }
      function yn(e, t) {
        return [e[0], e[1], e[2], t];
      }
      const bn = {
        hsl: {
          hsl: (e, t, n) => [e, t, n],
          hsv: function (e, t, n) {
            const i = n + (t * (100 - Math.abs(2 * n - 100))) / 200;
            return [
              e,
              0 !== i ? (t * (100 - Math.abs(2 * n - 100))) / i : 0,
              n + (t * (100 - Math.abs(2 * n - 100))) / 200,
            ];
          },
          rgb: function (e, t, n) {
            const i = ((e % 360) + 360) % 360,
              o = Ut(t / 100, 0, 1),
              s = Ut(n / 100, 0, 1),
              r = (1 - Math.abs(2 * s - 1)) * o,
              a = r * (1 - Math.abs(((i / 60) % 2) - 1)),
              l = s - r / 2;
            let c, h, u;
            return (
              ([c, h, u] =
                i >= 0 && i < 60
                  ? [r, a, 0]
                  : i >= 60 && i < 120
                  ? [a, r, 0]
                  : i >= 120 && i < 180
                  ? [0, r, a]
                  : i >= 180 && i < 240
                  ? [0, a, r]
                  : i >= 240 && i < 300
                  ? [a, 0, r]
                  : [r, 0, a]),
              [255 * (c + l), 255 * (h + l), 255 * (u + l)]
            );
          },
        },
        hsv: {
          hsl: function (e, t, n) {
            const i = 100 - Math.abs((n * (200 - t)) / 100 - 100);
            return [e, 0 !== i ? (t * n) / i : 0, (n * (200 - t)) / 200];
          },
          hsv: (e, t, n) => [e, t, n],
          rgb: gn,
        },
        rgb: {
          hsl: function (e, t, n) {
            const i = Ut(e / 255, 0, 1),
              o = Ut(t / 255, 0, 1),
              s = Ut(n / 255, 0, 1),
              r = Math.max(i, o, s),
              a = Math.min(i, o, s),
              l = r - a;
            let c = 0,
              h = 0;
            const u = (a + r) / 2;
            return (
              0 !== l &&
                ((h = l / (1 - Math.abs(r + a - 1))),
                (c =
                  i === r
                    ? (o - s) / l
                    : o === r
                    ? 2 + (s - i) / l
                    : 4 + (i - o) / l),
                (c = c / 6 + (c < 0 ? 1 : 0))),
              [360 * c, 100 * h, 100 * u]
            );
          },
          hsv: function (e, t, n) {
            const i = Ut(e / 255, 0, 1),
              o = Ut(t / 255, 0, 1),
              s = Ut(n / 255, 0, 1),
              r = Math.max(i, o, s),
              a = r - Math.min(i, o, s);
            let l;
            return (
              (l =
                0 === a
                  ? 0
                  : r === i
                  ? (((((o - s) / a) % 6) + 6) % 6) * 60
                  : r === o
                  ? 60 * ((s - i) / a + 2)
                  : 60 * ((i - o) / a + 4)),
              [l, 100 * (0 === r ? 0 : a / r), 100 * r]
            );
          },
          rgb: (e, t, n) => [e, t, n],
        },
      };
      function xn(e, t) {
        return [
          "float" === t ? 1 : "rgb" === e ? 255 : 360,
          "float" === t ? 1 : "rgb" === e ? 255 : 100,
          "float" === t ? 1 : "rgb" === e ? 255 : 100,
        ];
      }
      function wn(e, t, n, i) {
        const o = xn(t, n),
          s = xn(t, i);
        return e.map((e, t) => (e / o[t]) * s[t]);
      }
      function Cn(e, t) {
        return (
          "object" == typeof e && !a(e) && t in e && "number" == typeof e[t]
        );
      }
      class Tn {
        constructor(e, t, n = "int") {
          (this.mode = t),
            (this.type = n),
            (this.comps_ = (function (e, t, n) {
              var i;
              const o = xn(t, n);
              return [
                "rgb" === t ? Ut(e[0], 0, o[0]) : Nt(e[0], o[0]),
                Ut(e[1], 0, o[1]),
                Ut(e[2], 0, o[2]),
                Ut(null !== (i = e[3]) && void 0 !== i ? i : 1, 0, 1),
              ];
            })(e, t, n));
        }
        static black(e = "int") {
          return new Tn([0, 0, 0], "rgb", e);
        }
        static fromObject(e, t = "int") {
          const n = "a" in e ? [e.r, e.g, e.b, e.a] : [e.r, e.g, e.b];
          return new Tn(n, "rgb", t);
        }
        static toRgbaObject(e, t = "int") {
          return e.toRgbaObject(t);
        }
        static isRgbColorObject(e) {
          return Cn(e, "r") && Cn(e, "g") && Cn(e, "b");
        }
        static isRgbaColorObject(e) {
          return this.isRgbColorObject(e) && Cn(e, "a");
        }
        static isColorObject(e) {
          return this.isRgbColorObject(e);
        }
        static equals(e, t) {
          if (e.mode !== t.mode) return !1;
          const n = e.comps_,
            i = t.comps_;
          for (let e = 0; e < n.length; e++) if (n[e] !== i[e]) return !1;
          return !0;
        }
        getComponents(e, t = "int") {
          return yn(
            (function (e, t, n) {
              const i = wn(e, t.mode, t.type, "int");
              return wn(bn[t.mode][n.mode](...i), n.mode, "int", n.type);
            })(
              vn(this.comps_),
              { mode: this.mode, type: this.type },
              { mode: null != e ? e : this.mode, type: t }
            ),
            this.comps_[3]
          );
        }
        toRgbaObject(e = "int") {
          const t = this.getComponents("rgb", e);
          return { r: t[0], g: t[1], b: t[2], a: t[3] };
        }
      }
      const _n = m("colp");
      class Dn {
        constructor(e, t) {
          (this.alphaViews_ = null),
            (this.element = e.createElement("div")),
            this.element.classList.add(_n());
          const n = e.createElement("div");
          n.classList.add(_n("hsv"));
          const i = e.createElement("div");
          i.classList.add(_n("sv")),
            (this.svPaletteView_ = t.svPaletteView),
            i.appendChild(this.svPaletteView_.element),
            n.appendChild(i);
          const o = e.createElement("div");
          o.classList.add(_n("h")),
            (this.hPaletteView_ = t.hPaletteView),
            o.appendChild(this.hPaletteView_.element),
            n.appendChild(o),
            this.element.appendChild(n);
          const s = e.createElement("div");
          if (
            (s.classList.add(_n("rgb")),
            (this.textView_ = t.textView),
            s.appendChild(this.textView_.element),
            this.element.appendChild(s),
            t.alphaViews)
          ) {
            this.alphaViews_ = {
              palette: t.alphaViews.palette,
              text: t.alphaViews.text,
            };
            const n = e.createElement("div");
            n.classList.add(_n("a"));
            const i = e.createElement("div");
            i.classList.add(_n("ap")),
              i.appendChild(this.alphaViews_.palette.element),
              n.appendChild(i);
            const o = e.createElement("div");
            o.classList.add(_n("at")),
              o.appendChild(this.alphaViews_.text.element),
              n.appendChild(o),
              this.element.appendChild(n);
          }
        }
        get allFocusableElements() {
          const e = [
            this.svPaletteView_.element,
            this.hPaletteView_.element,
            this.textView_.modeSelectElement,
            ...this.textView_.textViews.map((e) => e.inputElement),
          ];
          return (
            this.alphaViews_ &&
              e.push(
                this.alphaViews_.palette.element,
                this.alphaViews_.text.inputElement
              ),
            e
          );
        }
      }
      function Mn(e) {
        return "int" === e ? "int" : "float" === e ? "float" : void 0;
      }
      function Sn(e) {
        const t = A;
        return E(e, {
          alpha: t.optional.boolean,
          color: t.optional.object({
            alpha: t.optional.boolean,
            type: t.optional.custom(Mn),
          }),
          expanded: t.optional.boolean,
          picker: t.optional.custom(tn),
        });
      }
      function Pn(e) {
        return e ? 0.1 : 1;
      }
      function Rn(e) {
        var t;
        return null === (t = e.color) || void 0 === t ? void 0 : t.type;
      }
      function An(e, t) {
        const n = e.match(/^(.+)%$/);
        return n
          ? Math.min(0.01 * parseFloat(n[1]) * t, t)
          : Math.min(parseFloat(e), t);
      }
      const En = {
        deg: (e) => e,
        grad: (e) => (360 * e) / 400,
        rad: (e) => (360 * e) / (2 * Math.PI),
        turn: (e) => 360 * e,
      };
      function kn(e) {
        const t = e.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);
        if (!t) return parseFloat(e);
        const n = parseFloat(t[1]),
          i = t[2];
        return En[i](n);
      }
      function In(e) {
        const t = e.match(
          /^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/
        );
        if (!t) return null;
        const n = [An(t[1], 255), An(t[2], 255), An(t[3], 255)];
        return isNaN(n[0]) || isNaN(n[1]) || isNaN(n[2]) ? null : n;
      }
      function Hn(e) {
        return (t) => {
          const n = In(t);
          return n ? new Tn(n, "rgb", e) : null;
        };
      }
      function Ln(e) {
        const t = e.match(
          /^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/
        );
        if (!t) return null;
        const n = [An(t[1], 255), An(t[2], 255), An(t[3], 255), An(t[4], 1)];
        return isNaN(n[0]) || isNaN(n[1]) || isNaN(n[2]) || isNaN(n[3])
          ? null
          : n;
      }
      function On(e) {
        return (t) => {
          const n = Ln(t);
          return n ? new Tn(n, "rgb", e) : null;
        };
      }
      function Vn(e) {
        const t = e.match(
          /^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/
        );
        if (!t) return null;
        const n = [kn(t[1]), An(t[2], 100), An(t[3], 100)];
        return isNaN(n[0]) || isNaN(n[1]) || isNaN(n[2]) ? null : n;
      }
      function Fn(e) {
        return (t) => {
          const n = Vn(t);
          return n ? new Tn(n, "hsl", e) : null;
        };
      }
      function zn(e) {
        const t = e.match(
          /^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/
        );
        if (!t) return null;
        const n = [kn(t[1]), An(t[2], 100), An(t[3], 100), An(t[4], 1)];
        return isNaN(n[0]) || isNaN(n[1]) || isNaN(n[2]) || isNaN(n[3])
          ? null
          : n;
      }
      function jn(e) {
        return (t) => {
          const n = zn(t);
          return n ? new Tn(n, "hsl", e) : null;
        };
      }
      function Bn(e) {
        const t = e.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);
        if (t)
          return [
            parseInt(t[1] + t[1], 16),
            parseInt(t[2] + t[2], 16),
            parseInt(t[3] + t[3], 16),
          ];
        const n = e.match(
          /^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/
        );
        return n
          ? [parseInt(n[1], 16), parseInt(n[2], 16), parseInt(n[3], 16)]
          : null;
      }
      function Un(e) {
        const t = e.match(
          /^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/
        );
        if (t)
          return [
            parseInt(t[1] + t[1], 16),
            parseInt(t[2] + t[2], 16),
            parseInt(t[3] + t[3], 16),
            jt(parseInt(t[4] + t[4], 16), 0, 255, 0, 1),
          ];
        const n = e.match(
          /^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/
        );
        return n
          ? [
              parseInt(n[1], 16),
              parseInt(n[2], 16),
              parseInt(n[3], 16),
              jt(parseInt(n[4], 16), 0, 255, 0, 1),
            ]
          : null;
      }
      function Nn(e) {
        const t = e.match(
          /^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/
        );
        if (!t) return null;
        const n = [parseFloat(t[1]), parseFloat(t[2]), parseFloat(t[3])];
        return isNaN(n[0]) || isNaN(n[1]) || isNaN(n[2]) ? null : n;
      }
      function Gn(e) {
        return (t) => {
          const n = Nn(t);
          return n ? new Tn(n, "rgb", e) : null;
        };
      }
      function Wn(e) {
        const t = e.match(
          /^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/
        );
        if (!t) return null;
        const n = [
          parseFloat(t[1]),
          parseFloat(t[2]),
          parseFloat(t[3]),
          parseFloat(t[4]),
        ];
        return isNaN(n[0]) || isNaN(n[1]) || isNaN(n[2]) || isNaN(n[3])
          ? null
          : n;
      }
      function Yn(e) {
        return (t) => {
          const n = Wn(t);
          return n ? new Tn(n, "rgb", e) : null;
        };
      }
      const Kn = [
        { parser: Bn, result: { alpha: !1, mode: "rgb", notation: "hex" } },
        { parser: Un, result: { alpha: !0, mode: "rgb", notation: "hex" } },
        { parser: In, result: { alpha: !1, mode: "rgb", notation: "func" } },
        { parser: Ln, result: { alpha: !0, mode: "rgb", notation: "func" } },
        { parser: Vn, result: { alpha: !1, mode: "hsl", notation: "func" } },
        { parser: zn, result: { alpha: !0, mode: "hsl", notation: "func" } },
        { parser: Nn, result: { alpha: !1, mode: "rgb", notation: "object" } },
        { parser: Wn, result: { alpha: !0, mode: "rgb", notation: "object" } },
      ];
      function $n(e, t = "int") {
        const n = (function (e) {
          return Kn.reduce(
            (t, { parser: n, result: i }) => t || (n(e) ? i : null),
            null
          );
        })(e);
        return n
          ? "hex" === n.notation && "float" !== t
            ? Object.assign(Object.assign({}, n), { type: "int" })
            : "func" === n.notation
            ? Object.assign(Object.assign({}, n), { type: t })
            : null
          : null;
      }
      const Xn = {
        int: [
          function (e) {
            const t = Bn(e);
            return t ? new Tn(t, "rgb", "int") : null;
          },
          function (e) {
            const t = Un(e);
            return t ? new Tn(t, "rgb", "int") : null;
          },
          Hn("int"),
          On("int"),
          Fn("int"),
          jn("int"),
          Gn("int"),
          Yn("int"),
        ],
        float: [
          Hn("float"),
          On("float"),
          Fn("float"),
          jn("float"),
          Gn("float"),
          Yn("float"),
        ],
      };
      function qn(e) {
        const t = Xn[e];
        return (e) => t.reduce((t, n) => t || n(e), null);
      }
      function Zn(e) {
        const t = Ut(Math.floor(e), 0, 255).toString(16);
        return 1 === t.length ? "0" + t : t;
      }
      function Qn(e, t = "#") {
        return `${t}${vn(e.getComponents("rgb")).map(Zn).join("")}`;
      }
      function Jn(e, t = "#") {
        const n = e.getComponents("rgb");
        return `${t}${[n[0], n[1], n[2], 255 * n[3]].map(Zn).join("")}`;
      }
      function ei(e, t) {
        const n = Dt("float" === t ? 2 : 0);
        return `rgb(${vn(e.getComponents("rgb", t))
          .map((e) => n(e))
          .join(", ")})`;
      }
      function ti(e) {
        return (t) => ei(t, e);
      }
      function ni(e, t) {
        const n = Dt(2),
          i = Dt("float" === t ? 2 : 0);
        return `rgba(${e
          .getComponents("rgb", t)
          .map((e, t) => (3 === t ? n : i)(e))
          .join(", ")})`;
      }
      function ii(e) {
        return (t) => ni(t, e);
      }
      function oi(e, t) {
        const n = Dt("float" === t ? 2 : 0),
          i = ["r", "g", "b"];
        return `{${vn(e.getComponents("rgb", t))
          .map((e, t) => `${i[t]}: ${n(e)}`)
          .join(", ")}}`;
      }
      function si(e) {
        return (t) => oi(t, e);
      }
      function ri(e, t) {
        const n = Dt(2),
          i = Dt("float" === t ? 2 : 0),
          o = ["r", "g", "b", "a"];
        return `{${e
          .getComponents("rgb", t)
          .map((e, t) => `${o[t]}: ${(3 === t ? n : i)(e)}`)
          .join(", ")}}`;
      }
      function ai(e) {
        return (t) => ri(t, e);
      }
      const li = [
        {
          format: { alpha: !1, mode: "rgb", notation: "hex", type: "int" },
          stringifier: Qn,
        },
        {
          format: { alpha: !0, mode: "rgb", notation: "hex", type: "int" },
          stringifier: Jn,
        },
        {
          format: { alpha: !1, mode: "hsl", notation: "func", type: "int" },
          stringifier: function (e) {
            const t = [Dt(0), St, St];
            return `hsl(${vn(e.getComponents("hsl"))
              .map((e, n) => t[n](e))
              .join(", ")})`;
          },
        },
        {
          format: { alpha: !0, mode: "hsl", notation: "func", type: "int" },
          stringifier: function (e) {
            const t = [Dt(0), St, St, Dt(2)];
            return `hsla(${e
              .getComponents("hsl")
              .map((e, n) => t[n](e))
              .join(", ")})`;
          },
        },
        ...["int", "float"].reduce(
          (e, t) => [
            ...e,
            {
              format: { alpha: !1, mode: "rgb", notation: "func", type: t },
              stringifier: ti(t),
            },
            {
              format: { alpha: !0, mode: "rgb", notation: "func", type: t },
              stringifier: ii(t),
            },
            {
              format: { alpha: !1, mode: "rgb", notation: "object", type: t },
              stringifier: si(t),
            },
            {
              format: { alpha: !0, mode: "rgb", notation: "object", type: t },
              stringifier: ai(t),
            },
          ],
          []
        ),
      ];
      function ci(e) {
        return li.reduce((t, n) => {
          return (
            t ||
            ((i = n.format),
            (o = e),
            i.alpha === o.alpha &&
            i.mode === o.mode &&
            i.notation === o.notation &&
            i.type === o.type
              ? n.stringifier
              : null)
          );
          var i, o;
        }, null);
      }
      const hi = m("apl");
      class ui {
        constructor(e, t) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.value = t.value),
            this.value.emitter.on("change", this.onValueChange_),
            (this.element = e.createElement("div")),
            this.element.classList.add(hi()),
            t.viewProps.bindTabIndex(this.element);
          const n = e.createElement("div");
          n.classList.add(hi("b")), this.element.appendChild(n);
          const i = e.createElement("div");
          i.classList.add(hi("c")), n.appendChild(i), (this.colorElem_ = i);
          const o = e.createElement("div");
          o.classList.add(hi("m")),
            this.element.appendChild(o),
            (this.markerElem_ = o);
          const s = e.createElement("div");
          s.classList.add(hi("p")),
            this.markerElem_.appendChild(s),
            (this.previewElem_ = s),
            this.update_();
        }
        update_() {
          const e = this.value.rawValue,
            t = e.getComponents("rgb"),
            n = new Tn([t[0], t[1], t[2], 0], "rgb"),
            i = new Tn([t[0], t[1], t[2], 255], "rgb"),
            o = ["to right", ni(n), ni(i)];
          (this.colorElem_.style.background = `linear-gradient(${o.join(
            ","
          )})`),
            (this.previewElem_.style.backgroundColor = ni(e));
          const s = jt(t[3], 0, 1, 0, 100);
          this.markerElem_.style.left = s + "%";
        }
        onValueChange_() {
          this.update_();
        }
      }
      class di {
        constructor(e, t) {
          (this.onKeyDown_ = this.onKeyDown_.bind(this)),
            (this.onKeyUp_ = this.onKeyUp_.bind(this)),
            (this.onPointerDown_ = this.onPointerDown_.bind(this)),
            (this.onPointerMove_ = this.onPointerMove_.bind(this)),
            (this.onPointerUp_ = this.onPointerUp_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new ui(e, {
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.ptHandler_ = new zt(this.view.element)),
            this.ptHandler_.emitter.on("down", this.onPointerDown_),
            this.ptHandler_.emitter.on("move", this.onPointerMove_),
            this.ptHandler_.emitter.on("up", this.onPointerUp_),
            this.view.element.addEventListener("keydown", this.onKeyDown_),
            this.view.element.addEventListener("keyup", this.onKeyUp_);
        }
        handlePointerEvent_(e, t) {
          if (!e.point) return;
          const n = e.point.x / e.bounds.width,
            i = this.value.rawValue,
            [o, s, r] = i.getComponents("hsv");
          this.value.setRawValue(new Tn([o, s, r, n], "hsv"), t);
        }
        onPointerDown_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerMove_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerUp_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !0, last: !0 });
        }
        onKeyDown_(e) {
          const t = Ht(Pn(!0), Ot(e));
          if (0 === t) return;
          const n = this.value.rawValue,
            [i, o, s, r] = n.getComponents("hsv");
          this.value.setRawValue(new Tn([i, o, s, r + t], "hsv"), {
            forceEmit: !1,
            last: !1,
          });
        }
        onKeyUp_(e) {
          0 !== Ht(Pn(!0), Ot(e)) &&
            this.value.setRawValue(this.value.rawValue, {
              forceEmit: !0,
              last: !0,
            });
        }
      }
      const pi = m("coltxt");
      class fi {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(pi());
          const n = e.createElement("div");
          n.classList.add(pi("m")),
            (this.modeElem_ = (function (e) {
              const t = e.createElement("select");
              return (
                t.appendChild(
                  [
                    { text: "RGB", value: "rgb" },
                    { text: "HSL", value: "hsl" },
                    { text: "HSV", value: "hsv" },
                  ].reduce((t, n) => {
                    const i = e.createElement("option");
                    return (
                      (i.textContent = n.text),
                      (i.value = n.value),
                      t.appendChild(i),
                      t
                    );
                  }, e.createDocumentFragment())
                ),
                t
              );
            })(e)),
            this.modeElem_.classList.add(pi("ms")),
            n.appendChild(this.modeSelectElement);
          const i = e.createElement("div");
          i.classList.add(pi("mm")),
            i.appendChild(j(e, "dropdown")),
            n.appendChild(i),
            this.element.appendChild(n);
          const o = e.createElement("div");
          o.classList.add(pi("w")),
            this.element.appendChild(o),
            (this.textsElem_ = o),
            (this.textViews_ = t.textViews),
            this.applyTextViews_(),
            v(t.colorMode, (e) => {
              this.modeElem_.value = e;
            });
        }
        get modeSelectElement() {
          return this.modeElem_;
        }
        get textViews() {
          return this.textViews_;
        }
        set textViews(e) {
          (this.textViews_ = e), this.applyTextViews_();
        }
        applyTextViews_() {
          N(this.textsElem_);
          const e = this.element.ownerDocument;
          this.textViews_.forEach((t) => {
            const n = e.createElement("div");
            n.classList.add(pi("c")),
              n.appendChild(t.element),
              this.textsElem_.appendChild(n);
          });
        }
      }
      function mi(e) {
        return Dt("float" === e ? 2 : 0);
      }
      function gi(e, t, n) {
        const i = xn(e, t)[n];
        return new Ye({ min: 0, max: i });
      }
      function vi(e, t, n) {
        return new Yt(e, {
          arrayPosition: 0 === n ? "fst" : 2 === n ? "lst" : "mid",
          baseStep: Pn(!1),
          parser: t.parser,
          props: S.fromObject({
            draggingScale: "float" === t.colorType ? 0.01 : 1,
            formatter: mi(t.colorType),
          }),
          value: M(0, { constraint: gi(t.colorMode, t.colorType, n) }),
          viewProps: t.viewProps,
        });
      }
      class yi {
        constructor(e, t) {
          (this.onModeSelectChange_ = this.onModeSelectChange_.bind(this)),
            (this.colorType_ = t.colorType),
            (this.parser_ = t.parser),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.colorMode = M(this.value.rawValue.mode)),
            (this.ccs_ = this.createComponentControllers_(e)),
            (this.view = new fi(e, {
              colorMode: this.colorMode,
              textViews: [
                this.ccs_[0].view,
                this.ccs_[1].view,
                this.ccs_[2].view,
              ],
            })),
            this.view.modeSelectElement.addEventListener(
              "change",
              this.onModeSelectChange_
            );
        }
        createComponentControllers_(e) {
          const t = {
              colorMode: this.colorMode.rawValue,
              colorType: this.colorType_,
              parser: this.parser_,
              viewProps: this.viewProps,
            },
            n = [vi(e, t, 0), vi(e, t, 1), vi(e, t, 2)];
          return (
            n.forEach((e, t) => {
              It({
                primary: this.value,
                secondary: e.value,
                forward: (e) =>
                  e.rawValue.getComponents(
                    this.colorMode.rawValue,
                    this.colorType_
                  )[t],
                backward: (e, n) => {
                  const i = this.colorMode.rawValue,
                    o = e.rawValue.getComponents(i, this.colorType_);
                  return (
                    (o[t] = n.rawValue),
                    new Tn(yn(vn(o), o[3]), i, this.colorType_)
                  );
                },
              });
            }),
            n
          );
        }
        onModeSelectChange_(e) {
          const t = e.currentTarget;
          (this.colorMode.rawValue = t.value),
            (this.ccs_ = this.createComponentControllers_(
              this.view.element.ownerDocument
            )),
            (this.view.textViews = [
              this.ccs_[0].view,
              this.ccs_[1].view,
              this.ccs_[2].view,
            ]);
        }
      }
      const bi = m("hpl");
      class xi {
        constructor(e, t) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.value = t.value),
            this.value.emitter.on("change", this.onValueChange_),
            (this.element = e.createElement("div")),
            this.element.classList.add(bi()),
            t.viewProps.bindTabIndex(this.element);
          const n = e.createElement("div");
          n.classList.add(bi("c")), this.element.appendChild(n);
          const i = e.createElement("div");
          i.classList.add(bi("m")),
            this.element.appendChild(i),
            (this.markerElem_ = i),
            this.update_();
        }
        update_() {
          const e = this.value.rawValue,
            [t] = e.getComponents("hsv");
          this.markerElem_.style.backgroundColor = ei(
            new Tn([t, 100, 100], "hsv")
          );
          const n = jt(t, 0, 360, 0, 100);
          this.markerElem_.style.left = n + "%";
        }
        onValueChange_() {
          this.update_();
        }
      }
      class wi {
        constructor(e, t) {
          (this.onKeyDown_ = this.onKeyDown_.bind(this)),
            (this.onKeyUp_ = this.onKeyUp_.bind(this)),
            (this.onPointerDown_ = this.onPointerDown_.bind(this)),
            (this.onPointerMove_ = this.onPointerMove_.bind(this)),
            (this.onPointerUp_ = this.onPointerUp_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new xi(e, {
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.ptHandler_ = new zt(this.view.element)),
            this.ptHandler_.emitter.on("down", this.onPointerDown_),
            this.ptHandler_.emitter.on("move", this.onPointerMove_),
            this.ptHandler_.emitter.on("up", this.onPointerUp_),
            this.view.element.addEventListener("keydown", this.onKeyDown_),
            this.view.element.addEventListener("keyup", this.onKeyUp_);
        }
        handlePointerEvent_(e, t) {
          if (!e.point) return;
          const n = jt(
              Ut(e.point.x, 0, e.bounds.width),
              0,
              e.bounds.width,
              0,
              359
            ),
            i = this.value.rawValue,
            [, o, s, r] = i.getComponents("hsv");
          this.value.setRawValue(new Tn([n, o, s, r], "hsv"), t);
        }
        onPointerDown_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerMove_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerUp_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !0, last: !0 });
        }
        onKeyDown_(e) {
          const t = Ht(Pn(!1), Ot(e));
          if (0 === t) return;
          const n = this.value.rawValue,
            [i, o, s, r] = n.getComponents("hsv");
          this.value.setRawValue(new Tn([i + t, o, s, r], "hsv"), {
            forceEmit: !1,
            last: !1,
          });
        }
        onKeyUp_(e) {
          0 !== Ht(Pn(!1), Ot(e)) &&
            this.value.setRawValue(this.value.rawValue, {
              forceEmit: !0,
              last: !0,
            });
        }
      }
      const Ci = m("svp");
      class Ti {
        constructor(e, t) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.value = t.value),
            this.value.emitter.on("change", this.onValueChange_),
            (this.element = e.createElement("div")),
            this.element.classList.add(Ci()),
            t.viewProps.bindTabIndex(this.element);
          const n = e.createElement("canvas");
          (n.height = 64),
            (n.width = 64),
            n.classList.add(Ci("c")),
            this.element.appendChild(n),
            (this.canvasElement = n);
          const i = e.createElement("div");
          i.classList.add(Ci("m")),
            this.element.appendChild(i),
            (this.markerElem_ = i),
            this.update_();
        }
        update_() {
          const e = (function (e) {
            const t = e.ownerDocument.defaultView;
            return t && "document" in t ? e.getContext("2d") : null;
          })(this.canvasElement);
          if (!e) return;
          const t = this.value.rawValue.getComponents("hsv"),
            n = this.canvasElement.width,
            i = this.canvasElement.height,
            o = e.getImageData(0, 0, n, i),
            s = o.data;
          for (let e = 0; e < i; e++)
            for (let o = 0; o < n; o++) {
              const r = jt(o, 0, n, 0, 100),
                a = jt(e, 0, i, 100, 0),
                l = gn(t[0], r, a),
                c = 4 * (e * n + o);
              (s[c] = l[0]),
                (s[c + 1] = l[1]),
                (s[c + 2] = l[2]),
                (s[c + 3] = 255);
            }
          e.putImageData(o, 0, 0);
          const r = jt(t[1], 0, 100, 0, 100);
          this.markerElem_.style.left = r + "%";
          const a = jt(t[2], 0, 100, 100, 0);
          this.markerElem_.style.top = a + "%";
        }
        onValueChange_() {
          this.update_();
        }
      }
      class _i {
        constructor(e, t) {
          (this.onKeyDown_ = this.onKeyDown_.bind(this)),
            (this.onKeyUp_ = this.onKeyUp_.bind(this)),
            (this.onPointerDown_ = this.onPointerDown_.bind(this)),
            (this.onPointerMove_ = this.onPointerMove_.bind(this)),
            (this.onPointerUp_ = this.onPointerUp_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new Ti(e, {
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.ptHandler_ = new zt(this.view.element)),
            this.ptHandler_.emitter.on("down", this.onPointerDown_),
            this.ptHandler_.emitter.on("move", this.onPointerMove_),
            this.ptHandler_.emitter.on("up", this.onPointerUp_),
            this.view.element.addEventListener("keydown", this.onKeyDown_),
            this.view.element.addEventListener("keyup", this.onKeyUp_);
        }
        handlePointerEvent_(e, t) {
          if (!e.point) return;
          const n = jt(e.point.x, 0, e.bounds.width, 0, 100),
            i = jt(e.point.y, 0, e.bounds.height, 100, 0),
            [o, , , s] = this.value.rawValue.getComponents("hsv");
          this.value.setRawValue(new Tn([o, n, i, s], "hsv"), t);
        }
        onPointerDown_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerMove_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerUp_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !0, last: !0 });
        }
        onKeyDown_(e) {
          Vt(e.key) && e.preventDefault();
          const [t, n, i, o] = this.value.rawValue.getComponents("hsv"),
            s = Pn(!1),
            r = Ht(s, Ot(e)),
            a = Ht(s, Lt(e));
          (0 === r && 0 === a) ||
            this.value.setRawValue(new Tn([t, n + r, i + a, o], "hsv"), {
              forceEmit: !1,
              last: !1,
            });
        }
        onKeyUp_(e) {
          const t = Pn(!1),
            n = Ht(t, Ot(e)),
            i = Ht(t, Lt(e));
          (0 === n && 0 === i) ||
            this.value.setRawValue(this.value.rawValue, {
              forceEmit: !0,
              last: !0,
            });
        }
      }
      class Di {
        constructor(e, t) {
          (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.hPaletteC_ = new wi(e, {
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.svPaletteC_ = new _i(e, {
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.alphaIcs_ = t.supportsAlpha
              ? {
                  palette: new di(e, {
                    value: this.value,
                    viewProps: this.viewProps,
                  }),
                  text: new Yt(e, {
                    parser: Ct,
                    baseStep: 0.1,
                    props: S.fromObject({
                      draggingScale: 0.01,
                      formatter: Dt(2),
                    }),
                    value: M(0, { constraint: new Ye({ min: 0, max: 1 }) }),
                    viewProps: this.viewProps,
                  }),
                }
              : null),
            this.alphaIcs_ &&
              It({
                primary: this.value,
                secondary: this.alphaIcs_.text.value,
                forward: (e) => e.rawValue.getComponents()[3],
                backward: (e, t) => {
                  const n = e.rawValue.getComponents();
                  return (n[3] = t.rawValue), new Tn(n, e.rawValue.mode);
                },
              }),
            (this.textC_ = new yi(e, {
              colorType: t.colorType,
              parser: Ct,
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.view = new Dn(e, {
              alphaViews: this.alphaIcs_
                ? {
                    palette: this.alphaIcs_.palette.view,
                    text: this.alphaIcs_.text.view,
                  }
                : null,
              hPaletteView: this.hPaletteC_.view,
              supportsAlpha: t.supportsAlpha,
              svPaletteView: this.svPaletteC_.view,
              textView: this.textC_.view,
            }));
        }
        get textController() {
          return this.textC_;
        }
      }
      const Mi = m("colsw");
      class Si {
        constructor(e, t) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            t.value.emitter.on("change", this.onValueChange_),
            (this.value = t.value),
            (this.element = e.createElement("div")),
            this.element.classList.add(Mi()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("div");
          n.classList.add(Mi("sw")),
            this.element.appendChild(n),
            (this.swatchElem_ = n);
          const i = e.createElement("button");
          i.classList.add(Mi("b")),
            t.viewProps.bindDisabled(i),
            this.element.appendChild(i),
            (this.buttonElement = i),
            this.update_();
        }
        update_() {
          const e = this.value.rawValue;
          this.swatchElem_.style.backgroundColor = Jn(e);
        }
        onValueChange_() {
          this.update_();
        }
      }
      class Pi {
        constructor(e, t) {
          (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new Si(e, {
              value: this.value,
              viewProps: this.viewProps,
            }));
        }
      }
      class Ri {
        constructor(e, t) {
          (this.onButtonBlur_ = this.onButtonBlur_.bind(this)),
            (this.onButtonClick_ = this.onButtonClick_.bind(this)),
            (this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this)),
            (this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.foldable_ = Z.create(t.expanded)),
            (this.swatchC_ = new Pi(e, {
              value: this.value,
              viewProps: this.viewProps,
            }));
          const n = this.swatchC_.view.buttonElement;
          n.addEventListener("blur", this.onButtonBlur_),
            n.addEventListener("click", this.onButtonClick_),
            (this.textC_ = new nt(e, {
              parser: t.parser,
              props: S.fromObject({ formatter: t.formatter }),
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.view = new mn(e, {
              foldable: this.foldable_,
              pickerLayout: t.pickerLayout,
            })),
            this.view.swatchElement.appendChild(this.swatchC_.view.element),
            this.view.textElement.appendChild(this.textC_.view.element),
            (this.popC_ =
              "popup" === t.pickerLayout
                ? new Je(e, { viewProps: this.viewProps })
                : null);
          const i = new Di(e, {
            colorType: t.colorType,
            supportsAlpha: t.supportsAlpha,
            value: this.value,
            viewProps: this.viewProps,
          });
          i.view.allFocusableElements.forEach((e) => {
            e.addEventListener("blur", this.onPopupChildBlur_),
              e.addEventListener("keydown", this.onPopupChildKeydown_);
          }),
            (this.pickerC_ = i),
            this.popC_
              ? (this.view.element.appendChild(this.popC_.view.element),
                this.popC_.view.element.appendChild(i.view.element),
                It({
                  primary: this.foldable_.value("expanded"),
                  secondary: this.popC_.shows,
                  forward: (e) => e.rawValue,
                  backward: (e, t) => t.rawValue,
                }))
              : this.view.pickerElement &&
                (this.view.pickerElement.appendChild(
                  this.pickerC_.view.element
                ),
                J(this.foldable_, this.view.pickerElement));
        }
        get textController() {
          return this.textC_;
        }
        onButtonBlur_(e) {
          if (!this.popC_) return;
          const t = this.view.element,
            n = e.relatedTarget;
          (n && t.contains(n)) || (this.popC_.shows.rawValue = !1);
        }
        onButtonClick_() {
          this.foldable_.set("expanded", !this.foldable_.get("expanded")),
            this.foldable_.get("expanded") &&
              this.pickerC_.view.allFocusableElements[0].focus();
        }
        onPopupChildBlur_(e) {
          if (!this.popC_) return;
          const t = this.popC_.view.element,
            n = G(e);
          (n && t.contains(n)) ||
            (n &&
              n === this.swatchC_.view.buttonElement &&
              !V(t.ownerDocument)) ||
            (this.popC_.shows.rawValue = !1);
        }
        onPopupChildKeydown_(e) {
          this.popC_
            ? "Escape" === e.key && (this.popC_.shows.rawValue = !1)
            : this.view.pickerElement &&
              "Escape" === e.key &&
              this.swatchC_.view.buttonElement.focus();
        }
      }
      function Ai(e) {
        return vn(e.getComponents("rgb")).reduce(
          (e, t) => (e << 8) | (255 & Math.floor(t)),
          0
        );
      }
      function Ei(e) {
        return (
          e
            .getComponents("rgb")
            .reduce(
              (e, t, n) => (e << 8) | (255 & Math.floor(3 === n ? 255 * t : t)),
              0
            ) >>> 0
        );
      }
      function ki(e) {
        return "number" != typeof e
          ? Tn.black()
          : new Tn([((t = e) >> 16) & 255, (t >> 8) & 255, 255 & t], "rgb");
        var t;
      }
      function Ii(e) {
        return "number" != typeof e
          ? Tn.black()
          : new Tn(
              [
                ((t = e) >> 24) & 255,
                (t >> 16) & 255,
                (t >> 8) & 255,
                jt(255 & t, 0, 255, 0, 1),
              ],
              "rgb"
            );
        var t;
      }
      function Hi(e) {
        var t;
        return !(
          !(null == e ? void 0 : e.alpha) &&
          !(null === (t = null == e ? void 0 : e.color) || void 0 === t
            ? void 0
            : t.alpha)
        );
      }
      function Li(e) {
        return e ? (e) => Jn(e, "0x") : (e) => Qn(e, "0x");
      }
      const Oi = {
        id: "input-color-number",
        type: "input",
        accept: (e, t) => {
          if ("number" != typeof e) return null;
          if (
            !(function (e) {
              return "color" in e || ("view" in e && "color" === e.view);
            })(t)
          )
            return null;
          const n = Sn(t);
          return n ? { initialValue: e, params: n } : null;
        },
        binding: {
          reader: (e) => (Hi(e.params) ? Ii : ki),
          equals: Tn.equals,
          writer: (e) =>
            (function (e) {
              const t = e ? Ei : Ai;
              return (e, n) => {
                Jt(e, t(n));
              };
            })(Hi(e.params)),
        },
        controller: (e) => {
          const t = Hi(e.params),
            n = "expanded" in e.params ? e.params.expanded : void 0,
            i = "picker" in e.params ? e.params.picker : void 0;
          return new Ri(e.document, {
            colorType: "int",
            expanded: null != n && n,
            formatter: Li(t),
            parser: qn("int"),
            pickerLayout: null != i ? i : "popup",
            supportsAlpha: t,
            value: e.value,
            viewProps: e.viewProps,
          });
        },
      };
      function Vi(e) {
        return (t) =>
          (function (e, t) {
            return Tn.isColorObject(e) ? Tn.fromObject(e, t) : Tn.black(t);
          })(t, e);
      }
      function Fi(e, t) {
        return (n) => (e ? ri(n, t) : oi(n, t));
      }
      const zi = {
          id: "input-color-object",
          type: "input",
          accept: (e, t) => {
            if (!Tn.isColorObject(e)) return null;
            const n = Sn(t);
            return n ? { initialValue: e, params: n } : null;
          },
          binding: {
            reader: (e) => Vi(Rn(e.params)),
            equals: Tn.equals,
            writer: (e) => {
              return (
                (i = e.initialValue),
                (t = Tn.isRgbaColorObject(i)),
                (n = Rn(e.params)),
                (e, i) => {
                  t
                    ? (function (e, t, n) {
                        const i = t.toRgbaObject(n);
                        e.writeProperty("r", i.r),
                          e.writeProperty("g", i.g),
                          e.writeProperty("b", i.b),
                          e.writeProperty("a", i.a);
                      })(e, i, n)
                    : (function (e, t, n) {
                        const i = t.toRgbaObject(n);
                        e.writeProperty("r", i.r),
                          e.writeProperty("g", i.g),
                          e.writeProperty("b", i.b);
                      })(e, i, n);
                }
              );
              var t, n, i;
            },
          },
          controller: (e) => {
            var t;
            const n = Tn.isRgbaColorObject(e.initialValue),
              i = "expanded" in e.params ? e.params.expanded : void 0,
              o = "picker" in e.params ? e.params.picker : void 0,
              s = null !== (t = Rn(e.params)) && void 0 !== t ? t : "int";
            return new Ri(e.document, {
              colorType: s,
              expanded: null != i && i,
              formatter: Fi(n, s),
              parser: qn(s),
              pickerLayout: null != o ? o : "popup",
              supportsAlpha: n,
              value: e.value,
              viewProps: e.viewProps,
            });
          },
        },
        ji = {
          id: "input-color-string",
          type: "input",
          accept: (e, t) => {
            if ("string" != typeof e) return null;
            if ("view" in t && "text" === t.view) return null;
            const n = $n(e, Rn(t));
            if (!n) return null;
            if (!ci(n)) return null;
            const i = Sn(t);
            return i ? { initialValue: e, params: i } : null;
          },
          binding: {
            reader: (e) => {
              var t;
              return (function (e) {
                const t = Xn[e];
                return (n) => {
                  if ("string" != typeof n) return Tn.black(e);
                  const i = t.reduce((e, t) => e || t(n), null);
                  return null != i ? i : Tn.black(e);
                };
              })(null !== (t = Rn(e.params)) && void 0 !== t ? t : "int");
            },
            equals: Tn.equals,
            writer: (e) => {
              const t = $n(e.initialValue, Rn(e.params));
              if (!t) throw h.shouldNeverHappen();
              const n = (function (e) {
                const t = ci(e);
                return t
                  ? (e, n) => {
                      Jt(e, t(n));
                    }
                  : null;
              })(t);
              if (!n) throw h.notBindable();
              return n;
            },
          },
          controller: (e) => {
            const t = $n(e.initialValue, Rn(e.params));
            if (!t) throw h.shouldNeverHappen();
            const n = ci(t);
            if (!n) throw h.shouldNeverHappen();
            const i = "expanded" in e.params ? e.params.expanded : void 0,
              o = "picker" in e.params ? e.params.picker : void 0;
            return new Ri(e.document, {
              colorType: t.type,
              expanded: null != i && i,
              formatter: n,
              parser: qn(t.type),
              pickerLayout: null != o ? o : "popup",
              supportsAlpha: t.alpha,
              value: e.value,
              viewProps: e.viewProps,
            });
          },
        };
      class Bi {
        constructor(e) {
          (this.components = e.components), (this.asm_ = e.assembly);
        }
        constrain(e) {
          const t = this.asm_.toComponents(e).map((e, t) => {
            var n, i;
            return null !==
              (i =
                null === (n = this.components[t]) || void 0 === n
                  ? void 0
                  : n.constrain(e)) && void 0 !== i
              ? i
              : e;
          });
          return this.asm_.fromComponents(t);
        }
      }
      const Ui = m("pndtxt");
      class Ni {
        constructor(e, t) {
          (this.textViews = t.textViews),
            (this.element = e.createElement("div")),
            this.element.classList.add(Ui()),
            this.textViews.forEach((t) => {
              const n = e.createElement("div");
              n.classList.add(Ui("a")),
                n.appendChild(t.element),
                this.element.appendChild(n);
            });
        }
      }
      class Gi {
        constructor(e, t) {
          (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.acs_ = t.axes.map((n, i) =>
              (function (e, t, n) {
                return new Yt(e, {
                  arrayPosition:
                    0 === n ? "fst" : n === t.axes.length - 1 ? "lst" : "mid",
                  baseStep: t.axes[n].baseStep,
                  parser: t.parser,
                  props: t.axes[n].textProps,
                  value: M(0, { constraint: t.axes[n].constraint }),
                  viewProps: t.viewProps,
                });
              })(e, t, i)
            )),
            this.acs_.forEach((e, n) => {
              It({
                primary: this.value,
                secondary: e.value,
                forward: (e) => t.assembly.toComponents(e.rawValue)[n],
                backward: (e, i) => {
                  const o = t.assembly.toComponents(e.rawValue);
                  return (o[n] = i.rawValue), t.assembly.fromComponents(o);
                },
              });
            }),
            (this.view = new Ni(e, {
              textViews: this.acs_.map((e) => e.view),
            }));
        }
      }
      function Wi(e, t) {
        return "step" in e && !a(e.step) ? new Ke(e.step, t) : null;
      }
      function Yi(e) {
        return ("max" in e && !a(e.max)) || ("min" in e && !a(e.min))
          ? new Ye({ max: e.max, min: e.min })
          : null;
      }
      function Ki(e) {
        const [t, n] = (function (e) {
          const t = e ? Ge(e, Ye) : null;
          return t ? [t.minValue, t.maxValue] : [void 0, void 0];
        })(e);
        return [null != t ? t : 0, null != n ? n : 100];
      }
      const $i = {
        id: "input-number",
        type: "input",
        accept: (e, t) => {
          if ("number" != typeof e) return null;
          const n = A,
            i = E(t, {
              format: n.optional.function,
              max: n.optional.number,
              min: n.optional.number,
              options: n.optional.custom(en),
              step: n.optional.number,
            });
          return i ? { initialValue: e, params: i } : null;
        },
        binding: {
          reader: (e) => Tt,
          constraint: (e) =>
            (function (e, t) {
              const n = [],
                i = Wi(e, t);
              i && n.push(i);
              const o = Yi(e);
              o && n.push(o);
              const s = sn(e.options);
              return s && n.push(s), new Ne(n);
            })(e.params, e.initialValue),
          writer: (e) => Jt,
        },
        controller: (e) => {
          var t, n;
          const i = e.value,
            o = e.constraint;
          if (o && Ge(o, We))
            return new qe(e.document, {
              props: S.fromObject({
                options: null !== (t = rn(o)) && void 0 !== t ? t : [],
              }),
              value: i,
              viewProps: e.viewProps,
            });
          const s =
            null !== (n = "format" in e.params ? e.params.format : void 0) &&
            void 0 !== n
              ? n
              : Dt(an(o, i.rawValue));
          if (o && Ge(o, Ye)) {
            const [t, n] = Ki(o);
            return new Qt(e.document, {
              baseStep: ln(o),
              parser: Ct,
              sliderProps: S.fromObject({ maxValue: n, minValue: t }),
              textProps: S.fromObject({
                draggingScale: cn(o, i.rawValue),
                formatter: s,
              }),
              value: i,
              viewProps: e.viewProps,
            });
          }
          return new Yt(e.document, {
            baseStep: ln(o),
            parser: Ct,
            props: S.fromObject({
              draggingScale: cn(o, i.rawValue),
              formatter: s,
            }),
            value: i,
            viewProps: e.viewProps,
          });
        },
      };
      class Xi {
        constructor(e = 0, t = 0) {
          (this.x = e), (this.y = t);
        }
        getComponents() {
          return [this.x, this.y];
        }
        static isObject(e) {
          if (a(e)) return !1;
          const t = e.x,
            n = e.y;
          return "number" == typeof t && "number" == typeof n;
        }
        static equals(e, t) {
          return e.x === t.x && e.y === t.y;
        }
        toObject() {
          return { x: this.x, y: this.y };
        }
      }
      const qi = {
          toComponents: (e) => e.getComponents(),
          fromComponents: (e) => new Xi(...e),
        },
        Zi = m("p2d");
      class Qi {
        constructor(e, t) {
          (this.element = e.createElement("div")),
            this.element.classList.add(Zi()),
            t.viewProps.bindClassModifiers(this.element),
            v(t.expanded, b(this.element, Zi(void 0, "expanded")));
          const n = e.createElement("div");
          n.classList.add(Zi("h")), this.element.appendChild(n);
          const i = e.createElement("button");
          i.classList.add(Zi("b")),
            i.appendChild(j(e, "p2dpad")),
            t.viewProps.bindDisabled(i),
            n.appendChild(i),
            (this.buttonElement = i);
          const o = e.createElement("div");
          if (
            (o.classList.add(Zi("t")),
            n.appendChild(o),
            (this.textElement = o),
            "inline" === t.pickerLayout)
          ) {
            const t = e.createElement("div");
            t.classList.add(Zi("p")),
              this.element.appendChild(t),
              (this.pickerElement = t);
          } else this.pickerElement = null;
        }
      }
      const Ji = m("p2dp");
      class eo {
        constructor(e, t) {
          (this.onFoldableChange_ = this.onFoldableChange_.bind(this)),
            (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.invertsY_ = t.invertsY),
            (this.maxValue_ = t.maxValue),
            (this.element = e.createElement("div")),
            this.element.classList.add(Ji()),
            "popup" === t.layout && this.element.classList.add(Ji(void 0, "p"));
          const n = e.createElement("div");
          n.classList.add(Ji("p")),
            t.viewProps.bindTabIndex(n),
            this.element.appendChild(n),
            (this.padElement = n);
          const i = e.createElementNS(L, "svg");
          i.classList.add(Ji("g")),
            this.padElement.appendChild(i),
            (this.svgElem_ = i);
          const o = e.createElementNS(L, "line");
          o.classList.add(Ji("ax")),
            o.setAttributeNS(null, "x1", "0"),
            o.setAttributeNS(null, "y1", "50%"),
            o.setAttributeNS(null, "x2", "100%"),
            o.setAttributeNS(null, "y2", "50%"),
            this.svgElem_.appendChild(o);
          const s = e.createElementNS(L, "line");
          s.classList.add(Ji("ax")),
            s.setAttributeNS(null, "x1", "50%"),
            s.setAttributeNS(null, "y1", "0"),
            s.setAttributeNS(null, "x2", "50%"),
            s.setAttributeNS(null, "y2", "100%"),
            this.svgElem_.appendChild(s);
          const r = e.createElementNS(L, "line");
          r.classList.add(Ji("l")),
            r.setAttributeNS(null, "x1", "50%"),
            r.setAttributeNS(null, "y1", "50%"),
            this.svgElem_.appendChild(r),
            (this.lineElem_ = r);
          const a = e.createElement("div");
          a.classList.add(Ji("m")),
            this.padElement.appendChild(a),
            (this.markerElem_ = a),
            t.value.emitter.on("change", this.onValueChange_),
            (this.value = t.value),
            this.update_();
        }
        get allFocusableElements() {
          return [this.padElement];
        }
        update_() {
          const [e, t] = this.value.rawValue.getComponents(),
            n = this.maxValue_,
            i = jt(e, -n, +n, 0, 100),
            o = jt(t, -n, +n, 0, 100),
            s = this.invertsY_ ? 100 - o : o;
          this.lineElem_.setAttributeNS(null, "x2", i + "%"),
            this.lineElem_.setAttributeNS(null, "y2", s + "%"),
            (this.markerElem_.style.left = i + "%"),
            (this.markerElem_.style.top = s + "%");
        }
        onValueChange_() {
          this.update_();
        }
        onFoldableChange_() {
          this.update_();
        }
      }
      function to(e, t, n) {
        return [Ht(t[0], Ot(e)), Ht(t[1], Lt(e)) * (n ? 1 : -1)];
      }
      class no {
        constructor(e, t) {
          (this.onPadKeyDown_ = this.onPadKeyDown_.bind(this)),
            (this.onPadKeyUp_ = this.onPadKeyUp_.bind(this)),
            (this.onPointerDown_ = this.onPointerDown_.bind(this)),
            (this.onPointerMove_ = this.onPointerMove_.bind(this)),
            (this.onPointerUp_ = this.onPointerUp_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.baseSteps_ = t.baseSteps),
            (this.maxValue_ = t.maxValue),
            (this.invertsY_ = t.invertsY),
            (this.view = new eo(e, {
              invertsY: this.invertsY_,
              layout: t.layout,
              maxValue: this.maxValue_,
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.ptHandler_ = new zt(this.view.padElement)),
            this.ptHandler_.emitter.on("down", this.onPointerDown_),
            this.ptHandler_.emitter.on("move", this.onPointerMove_),
            this.ptHandler_.emitter.on("up", this.onPointerUp_),
            this.view.padElement.addEventListener(
              "keydown",
              this.onPadKeyDown_
            ),
            this.view.padElement.addEventListener("keyup", this.onPadKeyUp_);
        }
        handlePointerEvent_(e, t) {
          if (!e.point) return;
          const n = this.maxValue_,
            i = jt(e.point.x, 0, e.bounds.width, -n, +n),
            o = jt(
              this.invertsY_ ? e.bounds.height - e.point.y : e.point.y,
              0,
              e.bounds.height,
              -n,
              +n
            );
          this.value.setRawValue(new Xi(i, o), t);
        }
        onPointerDown_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerMove_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !1, last: !1 });
        }
        onPointerUp_(e) {
          this.handlePointerEvent_(e.data, { forceEmit: !0, last: !0 });
        }
        onPadKeyDown_(e) {
          Vt(e.key) && e.preventDefault();
          const [t, n] = to(e, this.baseSteps_, this.invertsY_);
          (0 === t && 0 === n) ||
            this.value.setRawValue(
              new Xi(this.value.rawValue.x + t, this.value.rawValue.y + n),
              { forceEmit: !1, last: !1 }
            );
        }
        onPadKeyUp_(e) {
          const [t, n] = to(e, this.baseSteps_, this.invertsY_);
          (0 === t && 0 === n) ||
            this.value.setRawValue(this.value.rawValue, {
              forceEmit: !0,
              last: !0,
            });
        }
      }
      class io {
        constructor(e, t) {
          var n, i;
          (this.onPopupChildBlur_ = this.onPopupChildBlur_.bind(this)),
            (this.onPopupChildKeydown_ = this.onPopupChildKeydown_.bind(this)),
            (this.onPadButtonBlur_ = this.onPadButtonBlur_.bind(this)),
            (this.onPadButtonClick_ = this.onPadButtonClick_.bind(this)),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.foldable_ = Z.create(t.expanded)),
            (this.popC_ =
              "popup" === t.pickerLayout
                ? new Je(e, { viewProps: this.viewProps })
                : null);
          const o = new no(e, {
            baseSteps: [t.axes[0].baseStep, t.axes[1].baseStep],
            invertsY: t.invertsY,
            layout: t.pickerLayout,
            maxValue: t.maxValue,
            value: this.value,
            viewProps: this.viewProps,
          });
          o.view.allFocusableElements.forEach((e) => {
            e.addEventListener("blur", this.onPopupChildBlur_),
              e.addEventListener("keydown", this.onPopupChildKeydown_);
          }),
            (this.pickerC_ = o),
            (this.textC_ = new Gi(e, {
              assembly: qi,
              axes: t.axes,
              parser: t.parser,
              value: this.value,
              viewProps: this.viewProps,
            })),
            (this.view = new Qi(e, {
              expanded: this.foldable_.value("expanded"),
              pickerLayout: t.pickerLayout,
              viewProps: this.viewProps,
            })),
            this.view.textElement.appendChild(this.textC_.view.element),
            null === (n = this.view.buttonElement) ||
              void 0 === n ||
              n.addEventListener("blur", this.onPadButtonBlur_),
            null === (i = this.view.buttonElement) ||
              void 0 === i ||
              i.addEventListener("click", this.onPadButtonClick_),
            this.popC_
              ? (this.view.element.appendChild(this.popC_.view.element),
                this.popC_.view.element.appendChild(this.pickerC_.view.element),
                It({
                  primary: this.foldable_.value("expanded"),
                  secondary: this.popC_.shows,
                  forward: (e) => e.rawValue,
                  backward: (e, t) => t.rawValue,
                }))
              : this.view.pickerElement &&
                (this.view.pickerElement.appendChild(
                  this.pickerC_.view.element
                ),
                J(this.foldable_, this.view.pickerElement));
        }
        onPadButtonBlur_(e) {
          if (!this.popC_) return;
          const t = this.view.element,
            n = e.relatedTarget;
          (n && t.contains(n)) || (this.popC_.shows.rawValue = !1);
        }
        onPadButtonClick_() {
          this.foldable_.set("expanded", !this.foldable_.get("expanded")),
            this.foldable_.get("expanded") &&
              this.pickerC_.view.allFocusableElements[0].focus();
        }
        onPopupChildBlur_(e) {
          if (!this.popC_) return;
          const t = this.popC_.view.element,
            n = G(e);
          (n && t.contains(n)) ||
            (n && n === this.view.buttonElement && !V(t.ownerDocument)) ||
            (this.popC_.shows.rawValue = !1);
        }
        onPopupChildKeydown_(e) {
          this.popC_
            ? "Escape" === e.key && (this.popC_.shows.rawValue = !1)
            : this.view.pickerElement &&
              "Escape" === e.key &&
              this.view.buttonElement.focus();
        }
      }
      function oo(e) {
        return Xi.isObject(e) ? new Xi(e.x, e.y) : new Xi();
      }
      function so(e, t) {
        e.writeProperty("x", t.x), e.writeProperty("y", t.y);
      }
      function ro(e, t) {
        if (!e) return;
        const n = [],
          i = Wi(e, t);
        i && n.push(i);
        const o = Yi(e);
        return o && n.push(o), new Ne(n);
      }
      function ao(e, t) {
        var n, i;
        const o = e && Ge(e, Ye);
        if (o)
          return Math.max(
            Math.abs(null !== (n = o.minValue) && void 0 !== n ? n : 0),
            Math.abs(null !== (i = o.maxValue) && void 0 !== i ? i : 0)
          );
        const s = ln(e);
        return Math.max(10 * Math.abs(s), 10 * Math.abs(t));
      }
      function lo(e, t) {
        const n = t instanceof Bi ? t.components[0] : void 0,
          i = t instanceof Bi ? t.components[1] : void 0,
          o = ao(n, e.x),
          s = ao(i, e.y);
        return Math.max(o, s);
      }
      function co(e, t) {
        return {
          baseStep: ln(t),
          constraint: t,
          textProps: S.fromObject({
            draggingScale: cn(t, e),
            formatter: Dt(an(t, e)),
          }),
        };
      }
      function ho(e) {
        if (!("y" in e)) return !1;
        const t = e.y;
        return !!t && "inverted" in t && !!t.inverted;
      }
      const uo = {
        id: "input-point2d",
        type: "input",
        accept: (e, t) => {
          if (!Xi.isObject(e)) return null;
          const n = A,
            i = E(t, {
              expanded: n.optional.boolean,
              picker: n.optional.custom(tn),
              x: n.optional.custom(nn),
              y: n.optional.object({
                inverted: n.optional.boolean,
                max: n.optional.number,
                min: n.optional.number,
                step: n.optional.number,
              }),
            });
          return i ? { initialValue: e, params: i } : null;
        },
        binding: {
          reader: (e) => oo,
          constraint: (e) => {
            return (
              (t = e.params),
              (n = e.initialValue),
              new Bi({
                assembly: qi,
                components: [
                  ro("x" in t ? t.x : void 0, n.x),
                  ro("y" in t ? t.y : void 0, n.y),
                ],
              })
            );
            var t, n;
          },
          equals: Xi.equals,
          writer: (e) => so,
        },
        controller: (e) => {
          const t = e.document,
            n = e.value,
            i = e.constraint;
          if (!(i instanceof Bi)) throw h.shouldNeverHappen();
          const o = "expanded" in e.params ? e.params.expanded : void 0,
            s = "picker" in e.params ? e.params.picker : void 0;
          return new io(t, {
            axes: [
              co(n.rawValue.x, i.components[0]),
              co(n.rawValue.y, i.components[1]),
            ],
            expanded: null != o && o,
            invertsY: ho(e.params),
            maxValue: lo(n.rawValue, i),
            parser: Ct,
            pickerLayout: null != s ? s : "popup",
            value: n,
            viewProps: e.viewProps,
          });
        },
      };
      class po {
        constructor(e = 0, t = 0, n = 0) {
          (this.x = e), (this.y = t), (this.z = n);
        }
        getComponents() {
          return [this.x, this.y, this.z];
        }
        static isObject(e) {
          if (a(e)) return !1;
          const t = e.x,
            n = e.y,
            i = e.z;
          return (
            "number" == typeof t && "number" == typeof n && "number" == typeof i
          );
        }
        static equals(e, t) {
          return e.x === t.x && e.y === t.y && e.z === t.z;
        }
        toObject() {
          return { x: this.x, y: this.y, z: this.z };
        }
      }
      const fo = {
        toComponents: (e) => e.getComponents(),
        fromComponents: (e) => new po(...e),
      };
      function mo(e) {
        return po.isObject(e) ? new po(e.x, e.y, e.z) : new po();
      }
      function go(e, t) {
        e.writeProperty("x", t.x),
          e.writeProperty("y", t.y),
          e.writeProperty("z", t.z);
      }
      function vo(e, t) {
        return {
          baseStep: ln(t),
          constraint: t,
          textProps: S.fromObject({
            draggingScale: cn(t, e),
            formatter: Dt(an(t, e)),
          }),
        };
      }
      const yo = {
        id: "input-point3d",
        type: "input",
        accept: (e, t) => {
          if (!po.isObject(e)) return null;
          const n = A,
            i = E(t, {
              x: n.optional.custom(nn),
              y: n.optional.custom(nn),
              z: n.optional.custom(nn),
            });
          return i ? { initialValue: e, params: i } : null;
        },
        binding: {
          reader: (e) => mo,
          constraint: (e) => {
            return (
              (t = e.params),
              (n = e.initialValue),
              new Bi({
                assembly: fo,
                components: [
                  ro("x" in t ? t.x : void 0, n.x),
                  ro("y" in t ? t.y : void 0, n.y),
                  ro("z" in t ? t.z : void 0, n.z),
                ],
              })
            );
            var t, n;
          },
          equals: po.equals,
          writer: (e) => go,
        },
        controller: (e) => {
          const t = e.value,
            n = e.constraint;
          if (!(n instanceof Bi)) throw h.shouldNeverHappen();
          return new Gi(e.document, {
            assembly: fo,
            axes: [
              vo(t.rawValue.x, n.components[0]),
              vo(t.rawValue.y, n.components[1]),
              vo(t.rawValue.z, n.components[2]),
            ],
            parser: Ct,
            value: t,
            viewProps: e.viewProps,
          });
        },
      };
      class bo {
        constructor(e = 0, t = 0, n = 0, i = 0) {
          (this.x = e), (this.y = t), (this.z = n), (this.w = i);
        }
        getComponents() {
          return [this.x, this.y, this.z, this.w];
        }
        static isObject(e) {
          if (a(e)) return !1;
          const t = e.x,
            n = e.y,
            i = e.z,
            o = e.w;
          return (
            "number" == typeof t &&
            "number" == typeof n &&
            "number" == typeof i &&
            "number" == typeof o
          );
        }
        static equals(e, t) {
          return e.x === t.x && e.y === t.y && e.z === t.z && e.w === t.w;
        }
        toObject() {
          return { x: this.x, y: this.y, z: this.z, w: this.w };
        }
      }
      const xo = {
        toComponents: (e) => e.getComponents(),
        fromComponents: (e) => new bo(...e),
      };
      function wo(e) {
        return bo.isObject(e) ? new bo(e.x, e.y, e.z, e.w) : new bo();
      }
      function Co(e, t) {
        e.writeProperty("x", t.x),
          e.writeProperty("y", t.y),
          e.writeProperty("z", t.z),
          e.writeProperty("w", t.w);
      }
      const To = {
          id: "input-point4d",
          type: "input",
          accept: (e, t) => {
            if (!bo.isObject(e)) return null;
            const n = A,
              i = E(t, {
                x: n.optional.custom(nn),
                y: n.optional.custom(nn),
                z: n.optional.custom(nn),
                w: n.optional.custom(nn),
              });
            return i ? { initialValue: e, params: i } : null;
          },
          binding: {
            reader: (e) => wo,
            constraint: (e) => {
              return (
                (t = e.params),
                (n = e.initialValue),
                new Bi({
                  assembly: xo,
                  components: [
                    ro("x" in t ? t.x : void 0, n.x),
                    ro("y" in t ? t.y : void 0, n.y),
                    ro("z" in t ? t.z : void 0, n.z),
                    ro("w" in t ? t.w : void 0, n.w),
                  ],
                })
              );
              var t, n;
            },
            equals: bo.equals,
            writer: (e) => Co,
          },
          controller: (e) => {
            const t = e.value,
              n = e.constraint;
            if (!(n instanceof Bi)) throw h.shouldNeverHappen();
            return new Gi(e.document, {
              assembly: xo,
              axes: t.rawValue.getComponents().map((e, t) => {
                return (
                  (i = e),
                  {
                    baseStep: ln((o = n.components[t])),
                    constraint: o,
                    textProps: S.fromObject({
                      draggingScale: cn(o, i),
                      formatter: Dt(an(o, i)),
                    }),
                  }
                );
                var i, o;
              }),
              parser: Ct,
              value: t,
              viewProps: e.viewProps,
            });
          },
        },
        _o = {
          id: "input-string",
          type: "input",
          accept: (e, t) => {
            if ("string" != typeof e) return null;
            const n = E(t, { options: A.optional.custom(en) });
            return n ? { initialValue: e, params: n } : null;
          },
          binding: {
            reader: (e) => Pt,
            constraint: (e) =>
              (function (e) {
                const t = [],
                  n = sn(e.options);
                return n && t.push(n), new Ne(t);
              })(e.params),
            writer: (e) => Jt,
          },
          controller: (e) => {
            var t;
            const n = e.document,
              i = e.value,
              o = e.constraint;
            return o && Ge(o, We)
              ? new qe(n, {
                  props: S.fromObject({
                    options: null !== (t = rn(o)) && void 0 !== t ? t : [],
                  }),
                  value: i,
                  viewProps: e.viewProps,
                })
              : new nt(n, {
                  parser: (e) => e,
                  props: S.fromObject({ formatter: Rt }),
                  value: i,
                  viewProps: e.viewProps,
                });
          },
        },
        Do = { defaultInterval: 200, defaultLineCount: 3 },
        Mo = m("mll");
      class So {
        constructor(e, t) {
          (this.onValueUpdate_ = this.onValueUpdate_.bind(this)),
            (this.formatter_ = t.formatter),
            (this.element = e.createElement("div")),
            this.element.classList.add(Mo()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("textarea");
          n.classList.add(Mo("i")),
            (n.style.height = `calc(var(--bld-us) * ${t.lineCount})`),
            (n.readOnly = !0),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.textareaElem_ = n),
            t.value.emitter.on("change", this.onValueUpdate_),
            (this.value = t.value),
            this.update_();
        }
        update_() {
          const e = this.textareaElem_,
            t = e.scrollTop === e.scrollHeight - e.clientHeight,
            n = [];
          this.value.rawValue.forEach((e) => {
            void 0 !== e && n.push(this.formatter_(e));
          }),
            (e.textContent = n.join("\n")),
            t && (e.scrollTop = e.scrollHeight);
        }
        onValueUpdate_() {
          this.update_();
        }
      }
      class Po {
        constructor(e, t) {
          (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new So(e, {
              formatter: t.formatter,
              lineCount: t.lineCount,
              value: this.value,
              viewProps: this.viewProps,
            }));
        }
      }
      const Ro = m("sgl");
      class Ao {
        constructor(e, t) {
          (this.onValueUpdate_ = this.onValueUpdate_.bind(this)),
            (this.formatter_ = t.formatter),
            (this.element = e.createElement("div")),
            this.element.classList.add(Ro()),
            t.viewProps.bindClassModifiers(this.element);
          const n = e.createElement("input");
          n.classList.add(Ro("i")),
            (n.readOnly = !0),
            (n.type = "text"),
            t.viewProps.bindDisabled(n),
            this.element.appendChild(n),
            (this.inputElement = n),
            t.value.emitter.on("change", this.onValueUpdate_),
            (this.value = t.value),
            this.update_();
        }
        update_() {
          const e = this.value.rawValue,
            t = e[e.length - 1];
          this.inputElement.value = void 0 !== t ? this.formatter_(t) : "";
        }
        onValueUpdate_() {
          this.update_();
        }
      }
      class Eo {
        constructor(e, t) {
          (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.view = new Ao(e, {
              formatter: t.formatter,
              value: this.value,
              viewProps: this.viewProps,
            }));
        }
      }
      const ko = {
          id: "monitor-bool",
          type: "monitor",
          accept: (e, t) => {
            if ("boolean" != typeof e) return null;
            const n = E(t, { lineCount: A.optional.number });
            return n ? { initialValue: e, params: n } : null;
          },
          binding: { reader: (e) => it },
          controller: (e) => {
            var t;
            return 1 === e.value.rawValue.length
              ? new Eo(e.document, {
                  formatter: ot,
                  value: e.value,
                  viewProps: e.viewProps,
                })
              : new Po(e.document, {
                  formatter: ot,
                  lineCount:
                    null !== (t = e.params.lineCount) && void 0 !== t
                      ? t
                      : Do.defaultLineCount,
                  value: e.value,
                  viewProps: e.viewProps,
                });
          },
        },
        Io = m("grl");
      class Ho {
        constructor(e, t) {
          (this.onCursorChange_ = this.onCursorChange_.bind(this)),
            (this.onValueUpdate_ = this.onValueUpdate_.bind(this)),
            (this.element = e.createElement("div")),
            this.element.classList.add(Io()),
            t.viewProps.bindClassModifiers(this.element),
            (this.formatter_ = t.formatter),
            (this.props_ = t.props),
            (this.cursor_ = t.cursor),
            this.cursor_.emitter.on("change", this.onCursorChange_);
          const n = e.createElementNS(L, "svg");
          n.classList.add(Io("g")),
            (n.style.height = `calc(var(--bld-us) * ${t.lineCount})`),
            this.element.appendChild(n),
            (this.svgElem_ = n);
          const i = e.createElementNS(L, "polyline");
          this.svgElem_.appendChild(i), (this.lineElem_ = i);
          const o = e.createElement("div");
          o.classList.add(Io("t"), m("tt")()),
            this.element.appendChild(o),
            (this.tooltipElem_ = o),
            t.value.emitter.on("change", this.onValueUpdate_),
            (this.value = t.value),
            this.update_();
        }
        get graphElement() {
          return this.svgElem_;
        }
        update_() {
          const e = this.svgElem_.getBoundingClientRect(),
            t = this.value.rawValue.length - 1,
            n = this.props_.get("minValue"),
            i = this.props_.get("maxValue"),
            o = [];
          this.value.rawValue.forEach((s, r) => {
            if (void 0 === s) return;
            const a = jt(r, 0, t, 0, e.width),
              l = jt(s, n, i, e.height, 0);
            o.push([a, l].join(","));
          }),
            this.lineElem_.setAttributeNS(null, "points", o.join(" "));
          const s = this.tooltipElem_,
            r = this.value.rawValue[this.cursor_.rawValue];
          if (void 0 === r) return void s.classList.remove(Io("t", "a"));
          const a = jt(this.cursor_.rawValue, 0, t, 0, e.width),
            l = jt(r, n, i, e.height, 0);
          (s.style.left = a + "px"),
            (s.style.top = l + "px"),
            (s.textContent = "" + this.formatter_(r)),
            s.classList.contains(Io("t", "a")) ||
              (s.classList.add(Io("t", "a"), Io("t", "in")),
              O(s),
              s.classList.remove(Io("t", "in")));
        }
        onValueUpdate_() {
          this.update_();
        }
        onCursorChange_() {
          this.update_();
        }
      }
      class Lo {
        constructor(e, t) {
          if (
            ((this.onGraphMouseMove_ = this.onGraphMouseMove_.bind(this)),
            (this.onGraphMouseLeave_ = this.onGraphMouseLeave_.bind(this)),
            (this.onGraphPointerDown_ = this.onGraphPointerDown_.bind(this)),
            (this.onGraphPointerMove_ = this.onGraphPointerMove_.bind(this)),
            (this.onGraphPointerUp_ = this.onGraphPointerUp_.bind(this)),
            (this.props_ = t.props),
            (this.value = t.value),
            (this.viewProps = t.viewProps),
            (this.cursor_ = M(-1)),
            (this.view = new Ho(e, {
              cursor: this.cursor_,
              formatter: t.formatter,
              lineCount: t.lineCount,
              props: this.props_,
              value: this.value,
              viewProps: this.viewProps,
            })),
            V(e))
          ) {
            const e = new zt(this.view.element);
            e.emitter.on("down", this.onGraphPointerDown_),
              e.emitter.on("move", this.onGraphPointerMove_),
              e.emitter.on("up", this.onGraphPointerUp_);
          } else
            this.view.element.addEventListener(
              "mousemove",
              this.onGraphMouseMove_
            ),
              this.view.element.addEventListener(
                "mouseleave",
                this.onGraphMouseLeave_
              );
        }
        onGraphMouseLeave_() {
          this.cursor_.rawValue = -1;
        }
        onGraphMouseMove_(e) {
          const t = this.view.element.getBoundingClientRect();
          this.cursor_.rawValue = Math.floor(
            jt(e.offsetX, 0, t.width, 0, this.value.rawValue.length)
          );
        }
        onGraphPointerDown_(e) {
          this.onGraphPointerMove_(e);
        }
        onGraphPointerMove_(e) {
          e.data.point
            ? (this.cursor_.rawValue = Math.floor(
                jt(
                  e.data.point.x,
                  0,
                  e.data.bounds.width,
                  0,
                  this.value.rawValue.length
                )
              ))
            : (this.cursor_.rawValue = -1);
        }
        onGraphPointerUp_() {
          this.cursor_.rawValue = -1;
        }
      }
      function Oo(e) {
        return "format" in e && !a(e.format) ? e.format : Dt(2);
      }
      function Vo(e) {
        return "view" in e && "graph" === e.view;
      }
      const Fo = {
          id: "monitor-number",
          type: "monitor",
          accept: (e, t) => {
            if ("number" != typeof e) return null;
            const n = A,
              i = E(t, {
                format: n.optional.function,
                lineCount: n.optional.number,
                max: n.optional.number,
                min: n.optional.number,
                view: n.optional.string,
              });
            return i ? { initialValue: e, params: i } : null;
          },
          binding: {
            defaultBufferSize: (e) => (Vo(e) ? 64 : 1),
            reader: (e) => Tt,
          },
          controller: (e) =>
            Vo(e.params)
              ? (function (e) {
                  var t, n, i;
                  return new Lo(e.document, {
                    formatter: Oo(e.params),
                    lineCount:
                      null !== (t = e.params.lineCount) && void 0 !== t
                        ? t
                        : Do.defaultLineCount,
                    props: S.fromObject({
                      maxValue:
                        null !==
                          (n = "max" in e.params ? e.params.max : null) &&
                        void 0 !== n
                          ? n
                          : 100,
                      minValue:
                        null !==
                          (i = "min" in e.params ? e.params.min : null) &&
                        void 0 !== i
                          ? i
                          : 0,
                    }),
                    value: e.value,
                    viewProps: e.viewProps,
                  });
                })(e)
              : (function (e) {
                  var t;
                  return 1 === e.value.rawValue.length
                    ? new Eo(e.document, {
                        formatter: Oo(e.params),
                        value: e.value,
                        viewProps: e.viewProps,
                      })
                    : new Po(e.document, {
                        formatter: Oo(e.params),
                        lineCount:
                          null !== (t = e.params.lineCount) && void 0 !== t
                            ? t
                            : Do.defaultLineCount,
                        value: e.value,
                        viewProps: e.viewProps,
                      });
                })(e),
        },
        zo = {
          id: "monitor-string",
          type: "monitor",
          accept: (e, t) => {
            if ("string" != typeof e) return null;
            const n = A,
              i = E(t, {
                lineCount: n.optional.number,
                multiline: n.optional.boolean,
              });
            return i ? { initialValue: e, params: i } : null;
          },
          binding: { reader: (e) => Pt },
          controller: (e) => {
            var t;
            const n = e.value;
            return n.rawValue.length > 1 ||
              ("multiline" in e.params && e.params.multiline)
              ? new Po(e.document, {
                  formatter: Rt,
                  lineCount:
                    null !== (t = e.params.lineCount) && void 0 !== t
                      ? t
                      : Do.defaultLineCount,
                  value: n,
                  viewProps: e.viewProps,
                })
              : new Eo(e.document, {
                  formatter: Rt,
                  value: n,
                  viewProps: e.viewProps,
                });
          },
        };
      class jo {
        constructor(e) {
          (this.onValueChange_ = this.onValueChange_.bind(this)),
            (this.reader = e.reader),
            (this.writer = e.writer),
            (this.emitter = new p()),
            (this.value = e.value),
            this.value.emitter.on("change", this.onValueChange_),
            (this.target = e.target),
            this.read();
        }
        read() {
          const e = this.target.read();
          void 0 !== e && (this.value.rawValue = this.reader(e));
        }
        write_(e) {
          this.writer(this.target, e);
        }
        onValueChange_(e) {
          this.write_(e.rawValue),
            this.emitter.emit("change", {
              options: e.options,
              rawValue: e.rawValue,
              sender: this,
            });
        }
      }
      class Bo {
        constructor(e) {
          (this.onTick_ = this.onTick_.bind(this)),
            (this.reader_ = e.reader),
            (this.target = e.target),
            (this.emitter = new p()),
            (this.value = e.value),
            (this.ticker = e.ticker),
            this.ticker.emitter.on("tick", this.onTick_),
            this.read();
        }
        dispose() {
          this.ticker.dispose();
        }
        read() {
          const e = this.target.read();
          if (void 0 === e) return;
          const t = this.value.rawValue,
            n = this.reader_(e);
          (this.value.rawValue = (function (e, t) {
            const n = [...kt(e), t];
            return (
              n.length > e.length
                ? n.splice(0, n.length - e.length)
                : At(n, e.length),
              n
            );
          })(t, n)),
            this.emitter.emit("update", { rawValue: n, sender: this });
        }
        onTick_(e) {
          this.read();
        }
      }
      function Uo(e, t) {
        return 0 === t
          ? new Be()
          : new Ue(e, null != t ? t : Do.defaultInterval);
      }
      class No {
        constructor() {
          this.pluginsMap_ = { blades: [], inputs: [], monitors: [] };
        }
        getAll() {
          return [
            ...this.pluginsMap_.blades,
            ...this.pluginsMap_.inputs,
            ...this.pluginsMap_.monitors,
          ];
        }
        register(e) {
          "blade" === e.type
            ? this.pluginsMap_.blades.unshift(e)
            : "input" === e.type
            ? this.pluginsMap_.inputs.unshift(e)
            : "monitor" === e.type && this.pluginsMap_.monitors.unshift(e);
        }
        createInput(e, t, n) {
          if (a(t.read()))
            throw new h({
              context: { key: t.key },
              type: "nomatchingcontroller",
            });
          const i = this.pluginsMap_.inputs.reduce(
            (i, o) =>
              null != i
                ? i
                : (function (e, t) {
                    const n = e.accept(t.target.read(), t.params);
                    if (a(n)) return null;
                    const i = A,
                      o = {
                        target: t.target,
                        initialValue: n.initialValue,
                        params: n.params,
                      },
                      s = e.binding.reader(o),
                      r = e.binding.constraint
                        ? e.binding.constraint(o)
                        : void 0,
                      l = M(s(n.initialValue), {
                        constraint: r,
                        equals: e.binding.equals,
                      }),
                      c = new jo({
                        reader: s,
                        target: t.target,
                        value: l,
                        writer: e.binding.writer(o),
                      }),
                      h = i.optional.boolean(t.params.disabled).value,
                      u = i.optional.boolean(t.params.hidden).value,
                      d = e.controller({
                        constraint: r,
                        document: t.document,
                        initialValue: n.initialValue,
                        params: n.params,
                        value: c.value,
                        viewProps: Re.create({ disabled: h, hidden: u }),
                      }),
                      p = i.optional.string(t.params.label).value;
                    return new ie(t.document, {
                      binding: c,
                      blade: q(),
                      props: S.fromObject({
                        label: null != p ? p : t.target.key,
                      }),
                      valueController: d,
                    });
                  })(o, { document: e, target: t, params: n }),
            null
          );
          if (i) return i;
          throw new h({
            context: { key: t.key },
            type: "nomatchingcontroller",
          });
        }
        createMonitor(e, t, n) {
          const i = this.pluginsMap_.monitors.reduce(
            (i, o) =>
              null != i
                ? i
                : (function (e, t) {
                    var n, i, o;
                    const s = A,
                      r = e.accept(t.target.read(), t.params);
                    if (a(r)) return null;
                    const l = {
                        target: t.target,
                        initialValue: r.initialValue,
                        params: r.params,
                      },
                      c = e.binding.reader(l),
                      h =
                        null !==
                          (i =
                            null !==
                              (n = s.optional.number(
                                t.params.bufferSize
                              ).value) && void 0 !== n
                              ? n
                              : e.binding.defaultBufferSize &&
                                e.binding.defaultBufferSize(r.params)) &&
                        void 0 !== i
                          ? i
                          : 1,
                      u = s.optional.number(t.params.interval).value,
                      d = new Bo({
                        reader: c,
                        target: t.target,
                        ticker: Uo(t.document, u),
                        value: Et(h),
                      }),
                      p = s.optional.boolean(t.params.disabled).value,
                      f = s.optional.boolean(t.params.hidden).value,
                      m = e.controller({
                        document: t.document,
                        params: r.params,
                        value: d.value,
                        viewProps: Re.create({ disabled: p, hidden: f }),
                      }),
                      g =
                        null !==
                          (o = s.optional.string(t.params.label).value) &&
                        void 0 !== o
                          ? o
                          : t.target.key;
                    return new se(t.document, {
                      binding: d,
                      blade: q(),
                      props: S.fromObject({ label: g }),
                      valueController: m,
                    });
                  })(o, { document: e, params: n, target: t }),
            null
          );
          if (i) return i;
          throw new h({
            context: { key: t.key },
            type: "nomatchingcontroller",
          });
        }
        createBlade(e, t) {
          const n = this.pluginsMap_.blades.reduce(
            (n, i) =>
              null != n
                ? n
                : (function (e, t) {
                    const n = e.accept(t.params);
                    if (!n) return null;
                    const i = A.optional.boolean(t.params.disabled).value,
                      o = A.optional.boolean(t.params.hidden).value;
                    return e.controller({
                      blade: q(),
                      document: t.document,
                      params: Object.assign(Object.assign({}, n.params), {
                        disabled: i,
                        hidden: o,
                      }),
                      viewProps: Re.create({ disabled: i, hidden: o }),
                    });
                  })(i, { document: e, params: t }),
            null
          );
          if (!n)
            throw new h({ type: "nomatchingview", context: { params: t } });
          return n;
        }
        createBladeApi(e) {
          if (e instanceof ie) return new ne(e);
          if (e instanceof se) return new oe(e);
          if (e instanceof ge) return new ce(e, this);
          const t = this.pluginsMap_.blades.reduce(
            (t, n) => (null != t ? t : n.api({ controller: e, pool: this })),
            null
          );
          if (!t) throw h.shouldNeverHappen();
          return t;
        }
      }
      class Go extends t {
        constructor(e) {
          super(e),
            (this.emitter_ = new p()),
            this.controller_.valueController.value.emitter.on("change", (e) => {
              this.emitter_.emit("change", { event: new i(this, e.rawValue) });
            });
        }
        get label() {
          return this.controller_.props.get("label");
        }
        set label(e) {
          this.controller_.props.set("label", e);
        }
        get options() {
          return this.controller_.valueController.props.get("options");
        }
        set options(e) {
          this.controller_.valueController.props.set("options", e);
        }
        get value() {
          return this.controller_.valueController.value.rawValue;
        }
        set value(e) {
          this.controller_.valueController.value.rawValue = e;
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
      }
      class Wo extends t {
        constructor(e) {
          super(e),
            (this.emitter_ = new p()),
            this.controller_.valueController.value.emitter.on("change", (e) => {
              this.emitter_.emit("change", { event: new i(this, e.rawValue) });
            });
        }
        get label() {
          return this.controller_.props.get("label");
        }
        set label(e) {
          this.controller_.props.set("label", e);
        }
        get maxValue() {
          return this.controller_.valueController.sliderController.props.get(
            "maxValue"
          );
        }
        set maxValue(e) {
          this.controller_.valueController.sliderController.props.set(
            "maxValue",
            e
          );
        }
        get minValue() {
          return this.controller_.valueController.sliderController.props.get(
            "minValue"
          );
        }
        set minValue(e) {
          this.controller_.valueController.sliderController.props.set(
            "minValue",
            e
          );
        }
        get value() {
          return this.controller_.valueController.value.rawValue;
        }
        set value(e) {
          this.controller_.valueController.value.rawValue = e;
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
      }
      class Yo extends t {
        constructor(e) {
          super(e),
            (this.emitter_ = new p()),
            this.controller_.valueController.value.emitter.on("change", (e) => {
              this.emitter_.emit("change", { event: new i(this, e.rawValue) });
            });
        }
        get label() {
          return this.controller_.props.get("label");
        }
        set label(e) {
          this.controller_.props.set("label", e);
        }
        get formatter() {
          return this.controller_.valueController.props.get("formatter");
        }
        set formatter(e) {
          this.controller_.valueController.props.set("formatter", e);
        }
        get value() {
          return this.controller_.valueController.value.rawValue;
        }
        set value(e) {
          this.controller_.valueController.value.rawValue = e;
        }
        on(e, t) {
          const n = t.bind(this);
          return (
            this.emitter_.on(e, (e) => {
              n(e.event);
            }),
            this
          );
        }
      }
      const Ko = {
        id: "list",
        type: "blade",
        accept(e) {
          const t = A,
            n = E(e, {
              options: t.required.custom(en),
              value: t.required.raw,
              view: t.required.constant("list"),
              label: t.optional.string,
            });
          return n ? { params: n } : null;
        },
        controller(e) {
          const t = new qe(e.document, {
            props: S.fromObject({ options: on(e.params.options) }),
            value: M(e.params.value),
            viewProps: e.viewProps,
          });
          return new we(e.document, {
            blade: e.blade,
            props: S.fromObject({ label: e.params.label }),
            valueController: t,
          });
        },
        api: (e) =>
          e.controller instanceof we &&
          e.controller.valueController instanceof qe
            ? new Go(e.controller)
            : null,
      };
      class $o extends he {
        constructor(e, t) {
          super(e, t);
        }
        get element() {
          return this.controller_.view.element;
        }
        importPreset(e) {
          !(function (e, t) {
            e.forEach((e) => {
              const n = t[e.presetKey];
              void 0 !== n && e.write(n);
            });
          })(
            this.controller_.rackController.rack
              .find(ie)
              .map((e) => e.binding.target),
            e
          ),
            this.refresh();
        }
        exportPreset() {
          return (function (e) {
            return e.reduce(
              (e, t) => Object.assign(e, { [t.presetKey]: t.read() }),
              {}
            );
          })(
            this.controller_.rackController.rack
              .find(ie)
              .map((e) => e.binding.target)
          );
        }
        refresh() {
          this.controller_.rackController.rack.find(ie).forEach((e) => {
            e.binding.read();
          }),
            this.controller_.rackController.rack.find(se).forEach((e) => {
              e.binding.read();
            });
        }
      }
      class Xo extends be {
        constructor(e, t) {
          super(e, {
            expanded: t.expanded,
            blade: t.blade,
            props: t.props,
            root: !0,
            viewProps: t.viewProps,
          });
        }
      }
      const qo = {
          id: "slider",
          type: "blade",
          accept(e) {
            const t = A,
              n = E(e, {
                max: t.required.number,
                min: t.required.number,
                view: t.required.constant("slider"),
                format: t.optional.function,
                label: t.optional.string,
                value: t.optional.number,
              });
            return n ? { params: n } : null;
          },
          controller(e) {
            var t, n;
            const i = null !== (t = e.params.value) && void 0 !== t ? t : 0,
              o = new Qt(e.document, {
                baseStep: 1,
                parser: Ct,
                sliderProps: S.fromObject({
                  maxValue: e.params.max,
                  minValue: e.params.min,
                }),
                textProps: S.fromObject({
                  draggingScale: cn(void 0, i),
                  formatter:
                    null !== (n = e.params.format) && void 0 !== n ? n : _t,
                }),
                value: M(i),
                viewProps: e.viewProps,
              });
            return new we(e.document, {
              blade: e.blade,
              props: S.fromObject({ label: e.params.label }),
              valueController: o,
            });
          },
          api: (e) =>
            e.controller instanceof we &&
            e.controller.valueController instanceof Qt
              ? new Wo(e.controller)
              : null,
        },
        Zo = {
          id: "text",
          type: "blade",
          accept(e) {
            const t = A,
              n = E(e, {
                parse: t.required.function,
                value: t.required.raw,
                view: t.required.constant("text"),
                format: t.optional.function,
                label: t.optional.string,
              });
            return n ? { params: n } : null;
          },
          controller(e) {
            var t;
            const n = new nt(e.document, {
              parser: e.params.parse,
              props: S.fromObject({
                formatter:
                  null !== (t = e.params.format) && void 0 !== t
                    ? t
                    : (e) => String(e),
              }),
              value: M(e.params.value),
              viewProps: e.viewProps,
            });
            return new we(e.document, {
              blade: e.blade,
              props: S.fromObject({ label: e.params.label }),
              valueController: n,
            });
          },
          api: (e) =>
            e.controller instanceof we &&
            e.controller.valueController instanceof nt
              ? new Yo(e.controller)
              : null,
        };
      function Qo(e, t, n) {
        if (e.querySelector(`style[data-tp-style=${t}]`)) return;
        const i = e.createElement("style");
        (i.dataset.tpStyle = t), (i.textContent = n), e.head.appendChild(i);
      }
      const Jo = new (class {
        constructor(e) {
          const [t, n] = e.split("-"),
            i = t.split(".");
          (this.major = parseInt(i[0], 10)),
            (this.minor = parseInt(i[1], 10)),
            (this.patch = parseInt(i[2], 10)),
            (this.prerelease = null != n ? n : null);
        }
        toString() {
          const e = [this.major, this.minor, this.patch].join(".");
          return null !== this.prerelease ? [e, this.prerelease].join("-") : e;
        }
      })("3.1.0");
      (e.BladeApi = t),
        (e.ButtonApi = d),
        (e.FolderApi = he),
        (e.InputBindingApi = ne),
        (e.ListApi = Go),
        (e.MonitorBindingApi = oe),
        (e.Pane = class extends $o {
          constructor(e) {
            var t, n;
            const i = null != e ? e : {},
              o = null !== (t = i.document) && void 0 !== t ? t : F(),
              s = (function () {
                const e = new No();
                return (
                  [
                    uo,
                    yo,
                    To,
                    _o,
                    $i,
                    ji,
                    zi,
                    Oi,
                    pn,
                    ko,
                    zo,
                    Fo,
                    $,
                    xe,
                    Me,
                    je,
                  ].forEach((t) => {
                    e.register(t);
                  }),
                  e
                );
              })();
            super(
              new Xo(o, {
                expanded: i.expanded,
                blade: q(),
                props: S.fromObject({ title: i.title }),
                viewProps: Re.create(),
              }),
              s
            ),
              (this.pool_ = s),
              (this.containerElem_ =
                null !== (n = i.container) && void 0 !== n
                  ? n
                  : (function (e) {
                      const t = e.createElement("div");
                      return (
                        t.classList.add(m("dfw")()),
                        e.body && e.body.appendChild(t),
                        t
                      );
                    })(o)),
              this.containerElem_.appendChild(this.element),
              (this.doc_ = o),
              (this.usesDefaultWrapper_ = !i.container),
              this.setUpDefaultPlugins_();
          }
          get document() {
            if (!this.doc_) throw h.alreadyDisposed();
            return this.doc_;
          }
          dispose() {
            const e = this.containerElem_;
            if (!e) throw h.alreadyDisposed();
            if (this.usesDefaultWrapper_) {
              const t = e.parentElement;
              t && t.removeChild(e);
            }
            (this.containerElem_ = null), (this.doc_ = null), super.dispose();
          }
          registerPlugin(e) {
            ("plugin" in e
              ? [e.plugin]
              : "plugins" in e
              ? e.plugins
              : []
            ).forEach((e) => {
              this.pool_.register(e), this.embedPluginStyle_(e);
            });
          }
          embedPluginStyle_(e) {
            e.css && Qo(this.document, "plugin-" + e.id, e.css);
          }
          setUpDefaultPlugins_() {
            Qo(
              this.document,
              "default",
              '.tp-tbiv_b,.tp-coltxtv_ms,.tp-ckbv_i,.tp-rotv_b,.tp-fldv_b,.tp-mllv_i,.tp-sglv_i,.tp-grlv_g,.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw,.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-p2dv_b:hover,.tp-btnv_b:hover,.tp-lstv_s:hover{background-color:var(--btn-bg-h)}.tp-p2dv_b:focus,.tp-btnv_b:focus,.tp-lstv_s:focus{background-color:var(--btn-bg-f)}.tp-p2dv_b:active,.tp-btnv_b:active,.tp-lstv_s:active{background-color:var(--btn-bg-a)}.tp-p2dv_b:disabled,.tp-btnv_b:disabled,.tp-lstv_s:disabled{opacity:.5}.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-txtv_i:hover,.tp-p2dpv_p:hover,.tp-colswv_sw:hover{background-color:var(--in-bg-h)}.tp-txtv_i:focus,.tp-p2dpv_p:focus,.tp-colswv_sw:focus{background-color:var(--in-bg-f)}.tp-txtv_i:active,.tp-p2dpv_p:active,.tp-colswv_sw:active{background-color:var(--in-bg-a)}.tp-txtv_i:disabled,.tp-p2dpv_p:disabled,.tp-colswv_sw:disabled{opacity:.5}.tp-mllv_i,.tp-sglv_i,.tp-grlv_g{background-color:var(--mo-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--mo-fg);height:var(--bld-us);scrollbar-color:currentColor transparent;scrollbar-width:thin;width:100%}.tp-mllv_i::-webkit-scrollbar,.tp-sglv_i::-webkit-scrollbar,.tp-grlv_g::-webkit-scrollbar{height:8px;width:8px}.tp-mllv_i::-webkit-scrollbar-corner,.tp-sglv_i::-webkit-scrollbar-corner,.tp-grlv_g::-webkit-scrollbar-corner{background-color:transparent}.tp-mllv_i::-webkit-scrollbar-thumb,.tp-sglv_i::-webkit-scrollbar-thumb,.tp-grlv_g::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:currentColor;border:transparent solid 2px;border-radius:4px}.tp-rotv{--font-family: var(--tp-font-family, Roboto Mono, Source Code Pro, Menlo, Courier, monospace);--bs-br: var(--tp-base-border-radius, 6px);--cnt-h-p: var(--tp-container-horizontal-padding, 4px);--cnt-v-p: var(--tp-container-vertical-padding, 4px);--elm-br: var(--tp-element-border-radius, 2px);--bld-s: var(--tp-blade-spacing, 4px);--bld-us: var(--tp-blade-unit-size, 20px);--bs-bg: var(--tp-base-background-color, #28292e);--bs-sh: var(--tp-base-shadow-color, rgba(0, 0, 0, 0.2));--btn-bg: var(--tp-button-background-color, #adafb8);--btn-bg-a: var(--tp-button-background-color-active, #d6d7db);--btn-bg-f: var(--tp-button-background-color-focus, #c8cad0);--btn-bg-h: var(--tp-button-background-color-hover, #bbbcc4);--btn-fg: var(--tp-button-foreground-color, #28292e);--cnt-bg: var(--tp-container-background-color, rgba(187, 188, 196, 0.1));--cnt-bg-a: var(--tp-container-background-color-active, rgba(187, 188, 196, 0.25));--cnt-bg-f: var(--tp-container-background-color-focus, rgba(187, 188, 196, 0.2));--cnt-bg-h: var(--tp-container-background-color-hover, rgba(187, 188, 196, 0.15));--cnt-fg: var(--tp-container-foreground-color, #bbbcc4);--in-bg: var(--tp-input-background-color, rgba(187, 188, 196, 0.1));--in-bg-a: var(--tp-input-background-color-active, rgba(187, 188, 196, 0.25));--in-bg-f: var(--tp-input-background-color-focus, rgba(187, 188, 196, 0.2));--in-bg-h: var(--tp-input-background-color-hover, rgba(187, 188, 196, 0.15));--in-fg: var(--tp-input-foreground-color, #bbbcc4);--lbl-fg: var(--tp-label-foreground-color, rgba(187, 188, 196, 0.7));--mo-bg: var(--tp-monitor-background-color, rgba(0, 0, 0, 0.2));--mo-fg: var(--tp-monitor-foreground-color, rgba(187, 188, 196, 0.7));--grv-fg: var(--tp-groove-foreground-color, rgba(187, 188, 196, 0.1))}.tp-rotv_c>.tp-cntv.tp-v-lst,.tp-tabv_c .tp-brkv>.tp-cntv.tp-v-lst,.tp-fldv_c>.tp-cntv.tp-v-lst{margin-bottom:calc(-1*var(--cnt-v-p))}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_c{border-bottom-left-radius:0}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_b{border-bottom-left-radius:0}.tp-rotv_c>*:not(.tp-v-fst),.tp-tabv_c .tp-brkv>*:not(.tp-v-fst),.tp-fldv_c>*:not(.tp-v-fst){margin-top:var(--bld-s)}.tp-rotv_c>.tp-sprv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-fst),.tp-fldv_c>.tp-sprv:not(.tp-v-fst),.tp-rotv_c>.tp-cntv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-fst),.tp-fldv_c>.tp-cntv:not(.tp-v-fst){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-sprv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-rotv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-cntv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-cntv+*:not(.tp-v-hidden){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-fldv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-rotv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-fldv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv{margin-top:0}.tp-tabv_c .tp-brkv>.tp-cntv,.tp-fldv_c>.tp-cntv{margin-left:4px}.tp-tabv_c .tp-brkv>.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-fldv>.tp-fldv_b{border-top-left-radius:var(--elm-br);border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-fldv.tp-fldv-expanded>.tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b{border-bottom-left-radius:0}.tp-tabv_c .tp-brkv .tp-fldv>.tp-fldv_c,.tp-fldv_c .tp-fldv>.tp-fldv_c{border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-tabv>.tp-tabv_i,.tp-fldv_c>.tp-tabv>.tp-tabv_i{border-top-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv .tp-tabv>.tp-tabv_c,.tp-fldv_c .tp-tabv>.tp-tabv_c{border-bottom-left-radius:var(--elm-br)}.tp-rotv_b,.tp-fldv_b{background-color:var(--cnt-bg);color:var(--cnt-fg);cursor:pointer;display:block;height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);overflow:hidden;padding-left:var(--cnt-h-p);padding-right:calc(4px + var(--bld-us) + var(--cnt-h-p));position:relative;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:border-radius .2s ease-in-out .2s}.tp-rotv_b:hover,.tp-fldv_b:hover{background-color:var(--cnt-bg-h)}.tp-rotv_b:focus,.tp-fldv_b:focus{background-color:var(--cnt-bg-f)}.tp-rotv_b:active,.tp-fldv_b:active{background-color:var(--cnt-bg-a)}.tp-rotv_b:disabled,.tp-fldv_b:disabled{opacity:.5}.tp-rotv_m,.tp-fldv_m{background:linear-gradient(to left, var(--cnt-fg), var(--cnt-fg) 2px, transparent 2px, transparent 4px, var(--cnt-fg) 4px);border-radius:2px;bottom:0;content:"";display:block;height:6px;right:calc(var(--cnt-h-p) + (var(--bld-us) + 4px - 6px)/2 - 2px);margin:auto;opacity:.5;position:absolute;top:0;transform:rotate(90deg);transition:transform .2s ease-in-out;width:6px}.tp-rotv.tp-rotv-expanded .tp-rotv_m,.tp-fldv.tp-fldv-expanded>.tp-fldv_b>.tp-fldv_m{transform:none}.tp-rotv_c,.tp-fldv_c{box-sizing:border-box;height:0;opacity:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;transition:height .2s ease-in-out,opacity .2s linear,padding .2s ease-in-out}.tp-rotv.tp-rotv-cpl:not(.tp-rotv-expanded) .tp-rotv_c,.tp-fldv.tp-fldv-cpl:not(.tp-fldv-expanded)>.tp-fldv_c{display:none}.tp-rotv.tp-rotv-expanded .tp-rotv_c,.tp-fldv.tp-fldv-expanded>.tp-fldv_c{opacity:1;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p);transform:none;overflow:visible;transition:height .2s ease-in-out,opacity .2s linear .2s,padding .2s ease-in-out}.tp-lstv,.tp-coltxtv_m{position:relative}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m,.tp-coltxtv_mm{bottom:0;margin:auto;pointer-events:none;position:absolute;right:2px;top:0}.tp-lstv_m svg,.tp-coltxtv_mm svg{bottom:0;height:16px;margin:auto;position:absolute;right:0;top:0;width:16px}.tp-lstv_m svg path,.tp-coltxtv_mm svg path{fill:currentColor}.tp-pndtxtv,.tp-coltxtv_w{display:flex}.tp-pndtxtv_a,.tp-coltxtv_c{width:100%}.tp-pndtxtv_a+.tp-pndtxtv_a,.tp-coltxtv_c+.tp-pndtxtv_a,.tp-pndtxtv_a+.tp-coltxtv_c,.tp-coltxtv_c+.tp-coltxtv_c{margin-left:2px}.tp-btnv_b{width:100%}.tp-btnv_t{text-align:center}.tp-ckbv_l{display:block;position:relative}.tp-ckbv_i{left:0;opacity:0;position:absolute;top:0}.tp-ckbv_w{background-color:var(--in-bg);border-radius:var(--elm-br);cursor:pointer;display:block;height:var(--bld-us);position:relative;width:var(--bld-us)}.tp-ckbv_w svg{bottom:0;display:block;height:16px;left:0;margin:auto;opacity:0;position:absolute;right:0;top:0;width:16px}.tp-ckbv_w svg path{fill:none;stroke:var(--in-fg);stroke-width:2}.tp-ckbv_i:hover+.tp-ckbv_w{background-color:var(--in-bg-h)}.tp-ckbv_i:focus+.tp-ckbv_w{background-color:var(--in-bg-f)}.tp-ckbv_i:active+.tp-ckbv_w{background-color:var(--in-bg-a)}.tp-ckbv_i:checked+.tp-ckbv_w svg{opacity:1}.tp-ckbv.tp-v-disabled .tp-ckbv_w{opacity:.5}.tp-colv{position:relative}.tp-colv_h{display:flex}.tp-colv_s{flex-grow:0;flex-shrink:0;width:var(--bld-us)}.tp-colv_t{flex:1;margin-left:4px}.tp-colv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-colv.tp-colv-cpl .tp-colv_p{overflow:visible}.tp-colv.tp-colv-expanded .tp-colv_p{margin-top:var(--bld-s);opacity:1}.tp-colv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-colpv_h,.tp-colpv_ap{margin-left:6px;margin-right:6px}.tp-colpv_h{margin-top:var(--bld-s)}.tp-colpv_rgb{display:flex;margin-top:var(--bld-s);width:100%}.tp-colpv_a{display:flex;margin-top:var(--cnt-v-p);padding-top:calc(var(--cnt-v-p) + 2px);position:relative}.tp-colpv_a:before{background-color:var(--grv-fg);content:"";height:2px;left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:0}.tp-colpv_ap{align-items:center;display:flex;flex:3}.tp-colpv_at{flex:1;margin-left:4px}.tp-svpv{border-radius:var(--elm-br);outline:none;overflow:hidden;position:relative}.tp-svpv_c{cursor:crosshair;display:block;height:calc(var(--bld-us)*4);width:100%}.tp-svpv_m{border-radius:100%;border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;filter:drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));height:12px;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;width:12px}.tp-svpv:focus .tp-svpv_m{border-color:#fff}.tp-hplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative}.tp-hplv_c{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAQ0lEQVQoU2P8z8Dwn0GCgQEDi2OK/RBgYHjBgIpfovFh8j8YBIgzFGQxuqEgPhaDOT5gOhPkdCxOZeBg+IDFZZiGAgCaSSMYtcRHLgAAAABJRU5ErkJggg==);background-position:left top;background-repeat:no-repeat;background-size:100% 100%;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;position:absolute;top:50%;width:100%}.tp-hplv_m{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-shadow:0 0 2px rgba(0,0,0,.1);box-sizing:border-box;height:12px;left:50%;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;top:50%;width:12px}.tp-hplv:focus .tp-hplv_m{border-color:#fff}.tp-aplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative;width:100%}.tp-aplv_b{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:4px 4px;background-position:0 0,2px 2px;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;overflow:hidden;position:absolute;top:50%;width:100%}.tp-aplv_c{bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv_m{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:12px 12px;background-position:0 0,6px 6px;border-radius:var(--elm-br);box-shadow:0 0 2px rgba(0,0,0,.1);height:12px;left:50%;margin-left:-6px;margin-top:-6px;overflow:hidden;pointer-events:none;position:absolute;top:50%;width:12px}.tp-aplv_p{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv:focus .tp-aplv_p{border-color:#fff}.tp-colswv{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:10px 10px;background-position:0 0,5px 5px;border-radius:var(--elm-br);overflow:hidden}.tp-colswv.tp-v-disabled{opacity:.5}.tp-colswv_sw{border-radius:0}.tp-colswv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border-width:0;cursor:pointer;display:block;height:var(--bld-us);left:0;margin:0;outline:none;padding:0;position:absolute;top:0;width:var(--bld-us)}.tp-colswv_b:focus::after{border:rgba(255,255,255,.75) solid 2px;border-radius:var(--elm-br);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.tp-coltxtv{display:flex;width:100%}.tp-coltxtv_m{margin-right:4px}.tp-coltxtv_ms{border-radius:var(--elm-br);color:var(--lbl-fg);cursor:pointer;height:var(--bld-us);line-height:var(--bld-us);padding:0 18px 0 4px}.tp-coltxtv_ms:hover{background-color:var(--in-bg-h)}.tp-coltxtv_ms:focus{background-color:var(--in-bg-f)}.tp-coltxtv_ms:active{background-color:var(--in-bg-a)}.tp-coltxtv_mm{color:var(--lbl-fg)}.tp-coltxtv_w{flex:1}.tp-dfwv{position:absolute;top:8px;right:8px;width:256px}.tp-fldv.tp-fldv-not .tp-fldv_b{display:none}.tp-fldv_t{padding-left:4px}.tp-fldv_c{border-left:var(--cnt-bg) solid 4px}.tp-fldv_b:hover+.tp-fldv_c{border-left-color:var(--cnt-bg-h)}.tp-fldv_b:focus+.tp-fldv_c{border-left-color:var(--cnt-bg-f)}.tp-fldv_b:active+.tp-fldv_c{border-left-color:var(--cnt-bg-a)}.tp-grlv{position:relative}.tp-grlv_g{display:block;height:calc(var(--bld-us)*3)}.tp-grlv_g polyline{fill:none;stroke:var(--mo-fg);stroke-linejoin:round}.tp-grlv_t{margin-top:-4px;transition:left .05s,top .05s;visibility:hidden}.tp-grlv_t.tp-grlv_t-a{visibility:visible}.tp-grlv_t.tp-grlv_t-in{transition:none}.tp-grlv.tp-v-disabled .tp-grlv_g{opacity:.5}.tp-grlv .tp-ttv{background-color:var(--mo-fg)}.tp-grlv .tp-ttv::before{border-top-color:var(--mo-fg)}.tp-lblv{align-items:center;display:flex;line-height:1.3;padding-left:var(--cnt-h-p);padding-right:var(--cnt-h-p)}.tp-lblv.tp-lblv-nol{display:block}.tp-lblv_l{color:var(--lbl-fg);flex:1;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;overflow:hidden;padding-left:4px;padding-right:16px}.tp-lblv.tp-v-disabled .tp-lblv_l{opacity:.5}.tp-lblv.tp-lblv-nol .tp-lblv_l{display:none}.tp-lblv_v{align-self:flex-start;flex-grow:0;flex-shrink:0;width:160px}.tp-lblv.tp-lblv-nol .tp-lblv_v{width:100%}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m{color:var(--btn-fg)}.tp-sglv_i{padding:0 4px}.tp-sglv.tp-v-disabled .tp-sglv_i{opacity:.5}.tp-mllv_i{display:block;height:calc(var(--bld-us)*3);line-height:var(--bld-us);padding:0 4px;resize:none;white-space:pre}.tp-mllv.tp-v-disabled .tp-mllv_i{opacity:.5}.tp-p2dv{position:relative}.tp-p2dv_h{display:flex}.tp-p2dv_b{height:var(--bld-us);margin-right:4px;position:relative;width:var(--bld-us)}.tp-p2dv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-p2dv_b svg path{stroke:currentColor;stroke-width:2}.tp-p2dv_b svg circle{fill:currentColor}.tp-p2dv_t{flex:1}.tp-p2dv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-p2dv.tp-p2dv-expanded .tp-p2dv_p{margin-top:var(--bld-s);opacity:1}.tp-p2dv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-p2dpv{padding-left:calc(var(--bld-us) + 4px)}.tp-p2dpv_p{cursor:crosshair;height:0;overflow:hidden;padding-bottom:100%;position:relative}.tp-p2dpv_g{display:block;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.tp-p2dpv_ax{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_l{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_m{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;position:absolute;width:4px}.tp-p2dpv_p:focus .tp-p2dpv_m{background-color:var(--in-fg);border-width:0}.tp-popv{background-color:var(--bs-bg);border-radius:6px;box-shadow:0 2px 4px var(--bs-sh);display:none;max-width:168px;padding:var(--cnt-v-p) var(--cnt-h-p);position:absolute;visibility:hidden;z-index:1000}.tp-popv.tp-popv-v{display:block;visibility:visible}.tp-sprv_r{background-color:var(--grv-fg);border-width:0;display:block;height:2px;margin:0;width:100%}.tp-sldv.tp-v-disabled{opacity:.5}.tp-sldv_t{box-sizing:border-box;cursor:pointer;height:var(--bld-us);margin:0 6px;outline:none;position:relative}.tp-sldv_t::before{background-color:var(--in-bg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin:auto;position:absolute;right:0;top:0}.tp-sldv_k{height:100%;left:0;position:absolute;top:0}.tp-sldv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin-bottom:auto;margin-top:auto;position:absolute;right:0;top:0}.tp-sldv_k::after{background-color:var(--btn-bg);border-radius:var(--elm-br);bottom:0;content:"";display:block;height:12px;margin-bottom:auto;margin-top:auto;position:absolute;right:-6px;top:0;width:12px}.tp-sldv_t:hover .tp-sldv_k::after{background-color:var(--btn-bg-h)}.tp-sldv_t:focus .tp-sldv_k::after{background-color:var(--btn-bg-f)}.tp-sldv_t:active .tp-sldv_k::after{background-color:var(--btn-bg-a)}.tp-sldtxtv{display:flex}.tp-sldtxtv_s{flex:2}.tp-sldtxtv_t{flex:1;margin-left:4px}.tp-tabv.tp-v-disabled{opacity:.5}.tp-tabv_i{align-items:flex-end;display:flex;overflow:hidden}.tp-tabv.tp-tabv-nop .tp-tabv_i{height:calc(var(--bld-us) + 4px);position:relative}.tp-tabv.tp-tabv-nop .tp-tabv_i::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:0;position:absolute;right:0}.tp-tabv_c{border-left:var(--cnt-bg) solid 4px;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p)}.tp-tbiv{flex:1;min-width:0;position:relative}.tp-tbiv+.tp-tbiv{margin-left:2px}.tp-tbiv+.tp-tbiv::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:-2px;position:absolute;width:2px}.tp-tbiv_b{background-color:var(--cnt-bg);display:block;padding-left:calc(var(--cnt-h-p) + 4px);padding-right:calc(var(--cnt-h-p) + 4px);width:100%}.tp-tbiv_b:hover{background-color:var(--cnt-bg-h)}.tp-tbiv_b:focus{background-color:var(--cnt-bg-f)}.tp-tbiv_b:active{background-color:var(--cnt-bg-a)}.tp-tbiv_b:disabled{opacity:.5}.tp-tbiv_t{color:var(--cnt-fg);height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);opacity:.5;overflow:hidden;text-overflow:ellipsis}.tp-tbiv.tp-tbiv-sel .tp-tbiv_t{opacity:1}.tp-txtv{position:relative}.tp-txtv_i{padding:0 4px}.tp-txtv.tp-txtv-fst .tp-txtv_i{border-bottom-right-radius:0;border-top-right-radius:0}.tp-txtv.tp-txtv-mid .tp-txtv_i{border-radius:0}.tp-txtv.tp-txtv-lst .tp-txtv_i{border-bottom-left-radius:0;border-top-left-radius:0}.tp-txtv.tp-txtv-num .tp-txtv_i{text-align:right}.tp-txtv.tp-txtv-drg .tp-txtv_i{opacity:.3}.tp-txtv_k{cursor:pointer;height:100%;left:-3px;position:absolute;top:0;width:12px}.tp-txtv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";height:calc(var(--bld-us) - 4px);left:50%;margin-bottom:auto;margin-left:-1px;margin-top:auto;opacity:.1;position:absolute;top:0;transition:border-radius .1s,height .1s,transform .1s,width .1s;width:2px}.tp-txtv_k:hover::before,.tp-txtv.tp-txtv-drg .tp-txtv_k::before{opacity:1}.tp-txtv.tp-txtv-drg .tp-txtv_k::before{border-radius:50%;height:4px;transform:translateX(-1px);width:4px}.tp-txtv_g{bottom:0;display:block;height:8px;left:50%;margin:auto;overflow:visible;pointer-events:none;position:absolute;top:0;visibility:hidden;width:100%}.tp-txtv.tp-txtv-drg .tp-txtv_g{visibility:visible}.tp-txtv_gb{fill:none;stroke:var(--in-fg);stroke-dasharray:1}.tp-txtv_gh{fill:none;stroke:var(--in-fg)}.tp-txtv .tp-ttv{margin-left:6px;visibility:hidden}.tp-txtv.tp-txtv-drg .tp-ttv{visibility:visible}.tp-ttv{background-color:var(--in-fg);border-radius:var(--elm-br);color:var(--bs-bg);padding:2px 4px;pointer-events:none;position:absolute;transform:translate(-50%, -100%)}.tp-ttv::before{border-color:var(--in-fg) transparent transparent transparent;border-style:solid;border-width:2px;box-sizing:border-box;content:"";font-size:.9em;height:4px;left:50%;margin-left:-2px;position:absolute;top:100%;width:4px}.tp-rotv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);font-family:var(--font-family);font-size:11px;font-weight:500;line-height:1;text-align:left}.tp-rotv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br);border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br);padding-left:calc(4px + var(--bld-us) + var(--cnt-h-p));text-align:center}.tp-rotv.tp-rotv-expanded .tp-rotv_b{border-bottom-left-radius:0;border-bottom-right-radius:0}.tp-rotv.tp-rotv-not .tp-rotv_b{display:none}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_c,.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c .tp-fldv.tp-v-vlst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst>.tp-fldv_b{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst>.tp-tabv_i{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-v-disabled,.tp-rotv .tp-v-disabled{pointer-events:none}.tp-rotv.tp-v-hidden,.tp-rotv .tp-v-hidden{display:none}'
            ),
              this.pool_.getAll().forEach((e) => {
                this.embedPluginStyle_(e);
              }),
              this.registerPlugin({ plugins: [qo, Ko, je, Zo] });
          }
        }),
        (e.SeparatorApi = Ce),
        (e.SliderApi = Wo),
        (e.TabApi = Le),
        (e.TabPageApi = He),
        (e.TextApi = Yo),
        (e.TpChangeEvent = i),
        (e.VERSION = Jo),
        Object.defineProperty(e, "__esModule", { value: !0 });
    })(t);
  },
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  ,
  function (e, t) {
    (e.exports = function (e, t) {
      return t.get ? t.get.call(e) : t.value;
    }),
      (e.exports.default = e.exports),
      (e.exports.__esModule = !0);
  },
  function (e, t) {
    (e.exports = function (e, t, n) {
      if (t.set) t.set.call(e, n);
      else {
        if (!t.writable)
          throw new TypeError("attempted to set read only private field");
        t.value = n;
      }
    }),
      (e.exports.default = e.exports),
      (e.exports.__esModule = !0);
  },
  function (e, t, n) {
    (function (i) {
      /*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.6.9
*/
      e.exports = (function () {
        var e = {},
          o = (function (e) {
            "use strict";
            var o;
            try {
              o = n(
                !(function () {
                  var e = new Error("Cannot find module 'worker_threads'");
                  throw ((e.code = "MODULE_NOT_FOUND"), e);
                })()
              ).Worker;
            } catch (o) {}
            return (
              (t.default = o
                ? function (e, t, n, i, s) {
                    var r = !1,
                      a = new o(
                        e +
                          ";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global",
                        { eval: !0 }
                      )
                        .on("error", function (e) {
                          return s(e, null);
                        })
                        .on("message", function (e) {
                          return s(null, e);
                        })
                        .on("exit", function (e) {
                          e && !r && s(Error("exited with code " + e), null);
                        });
                    return (
                      a.postMessage(n, i),
                      (a.terminate = function () {
                        return (r = !0), o.prototype.terminate.call(a);
                      }),
                      a
                    );
                  }
                : function (e, t, n, o, s) {
                    i(function () {
                      return s(
                        Error(
                          "async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"
                        ),
                        null
                      );
                    });
                    var r = function () {};
                    return { terminate: r, postMessage: r };
                  }),
              e
            );
          })({}),
          s = Uint8Array,
          r = Uint16Array,
          a = Uint32Array,
          l = new s([
            0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
            4, 5, 5, 5, 5, 0, 0, 0, 0,
          ]),
          c = new s([
            0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
            10, 10, 11, 11, 12, 12, 13, 13, 0, 0,
          ]),
          h = new s([
            16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
          ]),
          u = function (e, t) {
            for (var n = new r(31), i = 0; i < 31; ++i)
              n[i] = t += 1 << e[i - 1];
            var o = new a(n[30]);
            for (i = 1; i < 30; ++i)
              for (var s = n[i]; s < n[i + 1]; ++s)
                o[s] = ((s - n[i]) << 5) | i;
            return [n, o];
          },
          d = u(l, 2),
          p = d[0],
          f = d[1];
        (p[28] = 258), (f[258] = 28);
        for (
          var m = u(c, 0), g = m[0], v = m[1], y = new r(32768), b = 0;
          b < 32768;
          ++b
        ) {
          var x = ((43690 & b) >>> 1) | ((21845 & b) << 1);
          y[b] =
            (((65280 &
              (x =
                ((61680 & (x = ((52428 & x) >>> 2) | ((13107 & x) << 2))) >>>
                  4) |
                ((3855 & x) << 4))) >>>
              8) |
              ((255 & x) << 8)) >>>
            1;
        }
        var w = function (e, t, n) {
            for (var i = e.length, o = 0, s = new r(t); o < i; ++o)
              ++s[e[o] - 1];
            var a,
              l = new r(t);
            for (o = 0; o < t; ++o) l[o] = (l[o - 1] + s[o - 1]) << 1;
            if (n) {
              a = new r(1 << t);
              var c = 15 - t;
              for (o = 0; o < i; ++o)
                if (e[o])
                  for (
                    var h = (o << 4) | e[o],
                      u = t - e[o],
                      d = l[e[o] - 1]++ << u,
                      p = d | ((1 << u) - 1);
                    d <= p;
                    ++d
                  )
                    a[y[d] >>> c] = h;
            } else
              for (a = new r(i), o = 0; o < i; ++o)
                e[o] && (a[o] = y[l[e[o] - 1]++] >>> (15 - e[o]));
            return a;
          },
          C = new s(288);
        for (b = 0; b < 144; ++b) C[b] = 8;
        for (b = 144; b < 256; ++b) C[b] = 9;
        for (b = 256; b < 280; ++b) C[b] = 7;
        for (b = 280; b < 288; ++b) C[b] = 8;
        var T = new s(32);
        for (b = 0; b < 32; ++b) T[b] = 5;
        var _ = w(C, 9, 0),
          D = w(C, 9, 1),
          M = w(T, 5, 0),
          S = w(T, 5, 1),
          P = function (e) {
            for (var t = e[0], n = 1; n < e.length; ++n) e[n] > t && (t = e[n]);
            return t;
          },
          R = function (e, t, n) {
            var i = (t / 8) | 0;
            return ((e[i] | (e[i + 1] << 8)) >> (7 & t)) & n;
          },
          A = function (e, t) {
            var n = (t / 8) | 0;
            return (e[n] | (e[n + 1] << 8) | (e[n + 2] << 16)) >> (7 & t);
          },
          E = function (e) {
            return ((e / 8) | 0) + (7 & e && 1);
          },
          k = function (e, t, n) {
            (null == t || t < 0) && (t = 0),
              (null == n || n > e.length) && (n = e.length);
            var i = new (e instanceof r ? r : e instanceof a ? a : s)(n - t);
            return i.set(e.subarray(t, n)), i;
          },
          I = function (e, t, n) {
            var i = e.length;
            if (!i || (n && !n.l && i < 5)) return t || new s(0);
            var o = !t || n,
              r = !n || n.i;
            n || (n = {}), t || (t = new s(3 * i));
            var a = function (e) {
                var n = t.length;
                if (e > n) {
                  var i = new s(Math.max(2 * n, e));
                  i.set(t), (t = i);
                }
              },
              u = n.f || 0,
              d = n.p || 0,
              f = n.b || 0,
              m = n.l,
              v = n.d,
              y = n.m,
              b = n.n,
              x = 8 * i;
            do {
              if (!m) {
                n.f = u = R(e, d, 1);
                var C = R(e, d + 1, 3);
                if (((d += 3), !C)) {
                  var T = e[(B = E(d) + 4) - 4] | (e[B - 3] << 8),
                    _ = B + T;
                  if (_ > i) {
                    if (r) throw "unexpected EOF";
                    break;
                  }
                  o && a(f + T),
                    t.set(e.subarray(B, _), f),
                    (n.b = f += T),
                    (n.p = d = 8 * _);
                  continue;
                }
                if (1 == C) (m = D), (v = S), (y = 9), (b = 5);
                else {
                  if (2 != C) throw "invalid block type";
                  var M = R(e, d, 31) + 257,
                    I = R(e, d + 10, 15) + 4,
                    H = M + R(e, d + 5, 31) + 1;
                  d += 14;
                  for (var L = new s(H), O = new s(19), V = 0; V < I; ++V)
                    O[h[V]] = R(e, d + 3 * V, 7);
                  d += 3 * I;
                  var F = P(O),
                    z = (1 << F) - 1,
                    j = w(O, F, 1);
                  for (V = 0; V < H; ) {
                    var B,
                      U = j[R(e, d, z)];
                    if (((d += 15 & U), (B = U >>> 4) < 16)) L[V++] = B;
                    else {
                      var N = 0,
                        G = 0;
                      for (
                        16 == B
                          ? ((G = 3 + R(e, d, 3)), (d += 2), (N = L[V - 1]))
                          : 17 == B
                          ? ((G = 3 + R(e, d, 7)), (d += 3))
                          : 18 == B && ((G = 11 + R(e, d, 127)), (d += 7));
                        G--;

                      )
                        L[V++] = N;
                    }
                  }
                  var W = L.subarray(0, M),
                    Y = L.subarray(M);
                  (y = P(W)), (b = P(Y)), (m = w(W, y, 1)), (v = w(Y, b, 1));
                }
                if (d > x) {
                  if (r) throw "unexpected EOF";
                  break;
                }
              }
              o && a(f + 131072);
              for (var K = (1 << y) - 1, $ = (1 << b) - 1, X = d; ; X = d) {
                var q = (N = m[A(e, d) & K]) >>> 4;
                if ((d += 15 & N) > x) {
                  if (r) throw "unexpected EOF";
                  break;
                }
                if (!N) throw "invalid length/literal";
                if (q < 256) t[f++] = q;
                else {
                  if (256 == q) {
                    (X = d), (m = null);
                    break;
                  }
                  var Z = q - 254;
                  q > 264 &&
                    ((Z = R(e, d, (1 << (ee = l[(V = q - 257)])) - 1) + p[V]),
                    (d += ee));
                  var Q = v[A(e, d) & $],
                    J = Q >>> 4;
                  if (!Q) throw "invalid distance";
                  if (((d += 15 & Q), (Y = g[J]), J > 3)) {
                    var ee = c[J];
                    (Y += A(e, d) & ((1 << ee) - 1)), (d += ee);
                  }
                  if (d > x) {
                    if (r) throw "unexpected EOF";
                    break;
                  }
                  o && a(f + 131072);
                  for (var te = f + Z; f < te; f += 4)
                    (t[f] = t[f - Y]),
                      (t[f + 1] = t[f + 1 - Y]),
                      (t[f + 2] = t[f + 2 - Y]),
                      (t[f + 3] = t[f + 3 - Y]);
                  f = te;
                }
              }
              (n.l = m),
                (n.p = X),
                (n.b = f),
                m && ((u = 1), (n.m = y), (n.d = v), (n.n = b));
            } while (!u);
            return f == t.length ? t : k(t, 0, f);
          },
          H = function (e, t, n) {
            var i = (t / 8) | 0;
            (e[i] |= n <<= 7 & t), (e[i + 1] |= n >>> 8);
          },
          L = function (e, t, n) {
            var i = (t / 8) | 0;
            (e[i] |= n <<= 7 & t),
              (e[i + 1] |= n >>> 8),
              (e[i + 2] |= n >>> 16);
          },
          O = function (e, t) {
            for (var n = [], i = 0; i < e.length; ++i)
              e[i] && n.push({ s: i, f: e[i] });
            var o = n.length,
              a = n.slice();
            if (!o) return [N, 0];
            if (1 == o) {
              var l = new s(n[0].s + 1);
              return (l[n[0].s] = 1), [l, 1];
            }
            n.sort(function (e, t) {
              return e.f - t.f;
            }),
              n.push({ s: -1, f: 25001 });
            var c = n[0],
              h = n[1],
              u = 0,
              d = 1,
              p = 2;
            for (n[0] = { s: -1, f: c.f + h.f, l: c, r: h }; d != o - 1; )
              (c = n[n[u].f < n[p].f ? u++ : p++]),
                (h = n[u != d && n[u].f < n[p].f ? u++ : p++]),
                (n[d++] = { s: -1, f: c.f + h.f, l: c, r: h });
            var f = a[0].s;
            for (i = 1; i < o; ++i) a[i].s > f && (f = a[i].s);
            var m = new r(f + 1),
              g = V(n[d - 1], m, 0);
            if (g > t) {
              i = 0;
              var v = 0,
                y = g - t,
                b = 1 << y;
              for (
                a.sort(function (e, t) {
                  return m[t.s] - m[e.s] || e.f - t.f;
                });
                i < o;
                ++i
              ) {
                var x = a[i].s;
                if (!(m[x] > t)) break;
                (v += b - (1 << (g - m[x]))), (m[x] = t);
              }
              for (v >>>= y; v > 0; ) {
                var w = a[i].s;
                m[w] < t ? (v -= 1 << (t - m[w]++ - 1)) : ++i;
              }
              for (; i >= 0 && v; --i) {
                var C = a[i].s;
                m[C] == t && (--m[C], ++v);
              }
              g = t;
            }
            return [new s(m), g];
          },
          V = function (e, t, n) {
            return -1 == e.s
              ? Math.max(V(e.l, t, n + 1), V(e.r, t, n + 1))
              : (t[e.s] = n);
          },
          F = function (e) {
            for (var t = e.length; t && !e[--t]; );
            for (
              var n = new r(++t),
                i = 0,
                o = e[0],
                s = 1,
                a = function (e) {
                  n[i++] = e;
                },
                l = 1;
              l <= t;
              ++l
            )
              if (e[l] == o && l != t) ++s;
              else {
                if (!o && s > 2) {
                  for (; s > 138; s -= 138) a(32754);
                  s > 2 &&
                    (a(
                      s > 10 ? ((s - 11) << 5) | 28690 : ((s - 3) << 5) | 12305
                    ),
                    (s = 0));
                } else if (s > 3) {
                  for (a(o), --s; s > 6; s -= 6) a(8304);
                  s > 2 && (a(((s - 3) << 5) | 8208), (s = 0));
                }
                for (; s--; ) a(o);
                (s = 1), (o = e[l]);
              }
            return [n.subarray(0, i), t];
          },
          z = function (e, t) {
            for (var n = 0, i = 0; i < t.length; ++i) n += e[i] * t[i];
            return n;
          },
          j = function (e, t, n) {
            var i = n.length,
              o = E(t + 2);
            (e[o] = 255 & i),
              (e[o + 1] = i >>> 8),
              (e[o + 2] = 255 ^ e[o]),
              (e[o + 3] = 255 ^ e[o + 1]);
            for (var s = 0; s < i; ++s) e[o + s + 4] = n[s];
            return 8 * (o + 4 + i);
          },
          B = function (e, t, n, i, o, s, a, u, d, p, f) {
            H(t, f++, n), ++o[256];
            for (
              var m = O(o, 15),
                g = m[0],
                v = m[1],
                y = O(s, 15),
                b = y[0],
                x = y[1],
                D = F(g),
                S = D[0],
                P = D[1],
                R = F(b),
                A = R[0],
                E = R[1],
                k = new r(19),
                I = 0;
              I < S.length;
              ++I
            )
              k[31 & S[I]]++;
            for (I = 0; I < A.length; ++I) k[31 & A[I]]++;
            for (
              var V = O(k, 7), B = V[0], U = V[1], N = 19;
              N > 4 && !B[h[N - 1]];
              --N
            );
            var G,
              W,
              Y,
              K,
              $ = (p + 5) << 3,
              X = z(o, C) + z(s, T) + a,
              q =
                z(o, g) +
                z(s, b) +
                a +
                14 +
                3 * N +
                z(k, B) +
                (2 * k[16] + 3 * k[17] + 7 * k[18]);
            if ($ <= X && $ <= q) return j(t, f, e.subarray(d, d + p));
            if ((H(t, f, 1 + (q < X)), (f += 2), q < X)) {
              (G = w(g, v, 0)), (W = g), (Y = w(b, x, 0)), (K = b);
              var Z = w(B, U, 0);
              for (
                H(t, f, P - 257),
                  H(t, f + 5, E - 1),
                  H(t, f + 10, N - 4),
                  f += 14,
                  I = 0;
                I < N;
                ++I
              )
                H(t, f + 3 * I, B[h[I]]);
              f += 3 * N;
              for (var Q = [S, A], J = 0; J < 2; ++J) {
                var ee = Q[J];
                for (I = 0; I < ee.length; ++I)
                  H(t, f, Z[(te = 31 & ee[I])]),
                    (f += B[te]),
                    te > 15 &&
                      (H(t, f, (ee[I] >>> 5) & 127), (f += ee[I] >>> 12));
              }
            } else (G = _), (W = C), (Y = M), (K = T);
            for (I = 0; I < u; ++I)
              if (i[I] > 255) {
                var te;
                L(t, f, G[257 + (te = (i[I] >>> 18) & 31)]),
                  (f += W[te + 257]),
                  te > 7 && (H(t, f, (i[I] >>> 23) & 31), (f += l[te]));
                var ne = 31 & i[I];
                L(t, f, Y[ne]),
                  (f += K[ne]),
                  ne > 3 && (L(t, f, (i[I] >>> 5) & 8191), (f += c[ne]));
              } else L(t, f, G[i[I]]), (f += W[i[I]]);
            return L(t, f, G[256]), f + W[256];
          },
          U = new a([
            65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560,
            2117632,
          ]),
          N = new s(0),
          G = function (e, t, n, i, o, h) {
            var u = e.length,
              d = new s(i + u + 5 * (1 + Math.ceil(u / 7e3)) + o),
              p = d.subarray(i, d.length - o),
              m = 0;
            if (!t || u < 8)
              for (var g = 0; g <= u; g += 65535) {
                var y = g + 65535;
                y < u
                  ? (m = j(p, m, e.subarray(g, y)))
                  : ((p[g] = h), (m = j(p, m, e.subarray(g, u))));
              }
            else {
              for (
                var b = U[t - 1],
                  x = b >>> 13,
                  w = 8191 & b,
                  C = (1 << n) - 1,
                  T = new r(32768),
                  _ = new r(C + 1),
                  D = Math.ceil(n / 3),
                  M = 2 * D,
                  S = function (t) {
                    return (e[t] ^ (e[t + 1] << D) ^ (e[t + 2] << M)) & C;
                  },
                  P = new a(25e3),
                  R = new r(288),
                  A = new r(32),
                  I = 0,
                  H = 0,
                  L = ((g = 0), 0),
                  O = 0,
                  V = 0;
                g < u;
                ++g
              ) {
                var F = S(g),
                  z = 32767 & g,
                  G = _[F];
                if (((T[z] = G), (_[F] = z), O <= g)) {
                  var W = u - g;
                  if ((I > 7e3 || L > 24576) && W > 423) {
                    (m = B(e, p, 0, P, R, A, H, L, V, g - V, m)),
                      (L = I = H = 0),
                      (V = g);
                    for (var Y = 0; Y < 286; ++Y) R[Y] = 0;
                    for (Y = 0; Y < 30; ++Y) A[Y] = 0;
                  }
                  var K = 2,
                    $ = 0,
                    X = w,
                    q = (z - G) & 32767;
                  if (W > 2 && F == S(g - q))
                    for (
                      var Z = Math.min(x, W) - 1,
                        Q = Math.min(32767, g),
                        J = Math.min(258, W);
                      q <= Q && --X && z != G;

                    ) {
                      if (e[g + K] == e[g + K - q]) {
                        for (
                          var ee = 0;
                          ee < J && e[g + ee] == e[g + ee - q];
                          ++ee
                        );
                        if (ee > K) {
                          if (((K = ee), ($ = q), ee > Z)) break;
                          var te = Math.min(q, ee - 2),
                            ne = 0;
                          for (Y = 0; Y < te; ++Y) {
                            var ie = (g - q + Y + 32768) & 32767,
                              oe = (ie - T[ie] + 32768) & 32767;
                            oe > ne && ((ne = oe), (G = ie));
                          }
                        }
                      }
                      q += ((z = G) - (G = T[z]) + 32768) & 32767;
                    }
                  if ($) {
                    P[L++] = 268435456 | (f[K] << 18) | v[$];
                    var se = 31 & f[K],
                      re = 31 & v[$];
                    (H += l[se] + c[re]),
                      ++R[257 + se],
                      ++A[re],
                      (O = g + K),
                      ++I;
                  } else (P[L++] = e[g]), ++R[e[g]];
                }
              }
              (m = B(e, p, h, P, R, A, H, L, V, g - V, m)),
                !h && 7 & m && (m = j(p, m + 1, N));
            }
            return k(d, 0, i + E(m) + o);
          },
          W = (function () {
            for (var e = new a(256), t = 0; t < 256; ++t) {
              for (var n = t, i = 9; --i; )
                n = (1 & n && 3988292384) ^ (n >>> 1);
              e[t] = n;
            }
            return e;
          })(),
          Y = function () {
            var e = -1;
            return {
              p: function (t) {
                for (var n = e, i = 0; i < t.length; ++i)
                  n = W[(255 & n) ^ t[i]] ^ (n >>> 8);
                e = n;
              },
              d: function () {
                return ~e;
              },
            };
          },
          K = function () {
            var e = 1,
              t = 0;
            return {
              p: function (n) {
                for (var i = e, o = t, s = n.length, r = 0; r != s; ) {
                  for (var a = Math.min(r + 2655, s); r < a; ++r)
                    o += i += n[r];
                  (i = (65535 & i) + 15 * (i >> 16)),
                    (o = (65535 & o) + 15 * (o >> 16));
                }
                (e = i), (t = o);
              },
              d: function () {
                return (
                  ((255 & (e %= 65521)) << 24) |
                  ((e >>> 8) << 16) |
                  ((255 & (t %= 65521)) << 8) |
                  (t >>> 8)
                );
              },
            };
          },
          $ = function (e, t, n, i, o) {
            return G(
              e,
              null == t.level ? 6 : t.level,
              null == t.mem
                ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(e.length))))
                : 12 + t.mem,
              n,
              i,
              !o
            );
          },
          X = function (e, t) {
            var n = {};
            for (var i in e) n[i] = e[i];
            for (var i in t) n[i] = t[i];
            return n;
          },
          q = function (e, t, n) {
            for (
              var i = e(),
                o = "" + e,
                s = o
                  .slice(o.indexOf("[") + 1, o.lastIndexOf("]"))
                  .replace(/ /g, "")
                  .split(","),
                r = 0;
              r < i.length;
              ++r
            ) {
              var a = i[r],
                l = s[r];
              if ("function" == typeof a) {
                t += ";" + l + "=";
                var c = "" + a;
                if (a.prototype)
                  if (-1 != c.indexOf("[native code]")) {
                    var h = c.indexOf(" ", 8) + 1;
                    t += c.slice(h, c.indexOf("(", h));
                  } else
                    for (var u in ((t += c), a.prototype))
                      t += ";" + l + ".prototype." + u + "=" + a.prototype[u];
                else t += c;
              } else n[l] = a;
            }
            return [t, n];
          },
          Z = [],
          Q = function (e) {
            var t = [];
            for (var n in e)
              (e[n] instanceof s || e[n] instanceof r || e[n] instanceof a) &&
                t.push((e[n] = new e[n].constructor(e[n])).buffer);
            return t;
          },
          J = function (e, t, n, i) {
            var s;
            if (!Z[n]) {
              for (var r = "", a = {}, l = e.length - 1, c = 0; c < l; ++c)
                (r = (s = q(e[c], r, a))[0]), (a = s[1]);
              Z[n] = q(e[l], r, a);
            }
            var h = X({}, Z[n][1]);
            return o.default(
              Z[n][0] +
                ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" +
                t +
                "}",
              n,
              h,
              Q(h),
              i
            );
          },
          ee = function () {
            return [
              s,
              r,
              a,
              l,
              c,
              h,
              p,
              g,
              D,
              S,
              y,
              w,
              P,
              R,
              A,
              E,
              k,
              I,
              Re,
              re,
              ae,
            ];
          },
          te = function () {
            return [
              s,
              r,
              a,
              l,
              c,
              h,
              f,
              v,
              _,
              C,
              M,
              T,
              y,
              U,
              N,
              w,
              H,
              L,
              O,
              V,
              F,
              z,
              j,
              B,
              E,
              k,
              G,
              $,
              De,
              re,
            ];
          },
          ne = function () {
            return [me, ye, fe, Y, W];
          },
          ie = function () {
            return [ge, ve];
          },
          oe = function () {
            return [be, fe, K];
          },
          se = function () {
            return [xe];
          },
          re = function (e) {
            return postMessage(e, [e.buffer]);
          },
          ae = function (e) {
            return e && e.size && new s(e.size);
          },
          le = function (e, t, n, i, o, s) {
            var r = J(n, i, o, function (e, t) {
              r.terminate(), s(e, t);
            });
            return (
              r.postMessage([e, t], t.consume ? [e.buffer] : []),
              function () {
                r.terminate();
              }
            );
          },
          ce = function (e) {
            return (
              (e.ondata = function (e, t) {
                return postMessage([e, t], [e.buffer]);
              }),
              function (t) {
                return e.push(t.data[0], t.data[1]);
              }
            );
          },
          he = function (e, t, n, i, o) {
            var s,
              r = J(e, i, o, function (e, n) {
                e
                  ? (r.terminate(), t.ondata.call(t, e))
                  : (n[1] && r.terminate(), t.ondata.call(t, e, n[0], n[1]));
              });
            r.postMessage(n),
              (t.push = function (e, n) {
                if (s) throw "stream finished";
                if (!t.ondata) throw "no stream handler";
                r.postMessage([e, (s = n)], [e.buffer]);
              }),
              (t.terminate = function () {
                r.terminate();
              });
          },
          ue = function (e, t) {
            return e[t] | (e[t + 1] << 8);
          },
          de = function (e, t) {
            return (
              (e[t] | (e[t + 1] << 8) | (e[t + 2] << 16) | (e[t + 3] << 24)) >>>
              0
            );
          },
          pe = function (e, t) {
            return de(e, t) + 4294967296 * de(e, t + 4);
          },
          fe = function (e, t, n) {
            for (; n; ++t) (e[t] = n), (n >>>= 8);
          },
          me = function (e, t) {
            var n = t.filename;
            if (
              ((e[0] = 31),
              (e[1] = 139),
              (e[2] = 8),
              (e[8] = t.level < 2 ? 4 : 9 == t.level ? 2 : 0),
              (e[9] = 3),
              0 != t.mtime &&
                fe(e, 4, Math.floor(new Date(t.mtime || Date.now()) / 1e3)),
              n)
            ) {
              e[3] = 8;
              for (var i = 0; i <= n.length; ++i) e[i + 10] = n.charCodeAt(i);
            }
          },
          ge = function (e) {
            if (31 != e[0] || 139 != e[1] || 8 != e[2])
              throw "invalid gzip data";
            var t = e[3],
              n = 10;
            4 & t && (n += e[10] | (2 + (e[11] << 8)));
            for (var i = ((t >> 3) & 1) + ((t >> 4) & 1); i > 0; i -= !e[n++]);
            return n + (2 & t);
          },
          ve = function (e) {
            var t = e.length;
            return (
              (e[t - 4] |
                (e[t - 3] << 8) |
                (e[t - 2] << 16) |
                (e[t - 1] << 24)) >>>
              0
            );
          },
          ye = function (e) {
            return 10 + ((e.filename && e.filename.length + 1) || 0);
          },
          be = function (e, t) {
            var n = t.level,
              i = 0 == n ? 0 : n < 6 ? 1 : 9 == n ? 3 : 2;
            (e[0] = 120), (e[1] = (i << 6) | (i ? 32 - 2 * i : 1));
          },
          xe = function (e) {
            if (8 != (15 & e[0]) || e[0] >>> 4 > 7 || ((e[0] << 8) | e[1]) % 31)
              throw "invalid zlib data";
            if (32 & e[1])
              throw "invalid zlib data: preset dictionaries not supported";
          };
        function we(e, t) {
          return (
            t || "function" != typeof e || ((t = e), (e = {})),
            (this.ondata = t),
            e
          );
        }
        var Ce = (function () {
          function e(e, t) {
            t || "function" != typeof e || ((t = e), (e = {})),
              (this.ondata = t),
              (this.o = e || {});
          }
          return (
            (e.prototype.p = function (e, t) {
              this.ondata($(e, this.o, 0, 0, !t), t);
            }),
            (e.prototype.push = function (e, t) {
              if (this.d) throw "stream finished";
              if (!this.ondata) throw "no stream handler";
              (this.d = t), this.p(e, t || !1);
            }),
            e
          );
        })();
        e.Deflate = Ce;
        var Te = function (e, t) {
          he(
            [
              te,
              function () {
                return [ce, Ce];
              },
            ],
            this,
            we.call(this, e, t),
            function (e) {
              var t = new Ce(e.data);
              onmessage = ce(t);
            },
            6
          );
        };
        function _e(e, t, n) {
          if ((n || ((n = t), (t = {})), "function" != typeof n))
            throw "no callback";
          return le(
            e,
            t,
            [te],
            function (e) {
              return re(De(e.data[0], e.data[1]));
            },
            0,
            n
          );
        }
        function De(e, t) {
          return $(e, t || {}, 0, 0);
        }
        (e.AsyncDeflate = Te), (e.deflate = _e), (e.deflateSync = De);
        var Me = (function () {
          function e(e) {
            (this.s = {}), (this.p = new s(0)), (this.ondata = e);
          }
          return (
            (e.prototype.e = function (e) {
              if (this.d) throw "stream finished";
              if (!this.ondata) throw "no stream handler";
              var t = this.p.length,
                n = new s(t + e.length);
              n.set(this.p), n.set(e, t), (this.p = n);
            }),
            (e.prototype.c = function (e) {
              this.d = this.s.i = e || !1;
              var t = this.s.b,
                n = I(this.p, this.o, this.s);
              this.ondata(k(n, t, this.s.b), this.d),
                (this.o = k(n, this.s.b - 32768)),
                (this.s.b = this.o.length),
                (this.p = k(this.p, (this.s.p / 8) | 0)),
                (this.s.p &= 7);
            }),
            (e.prototype.push = function (e, t) {
              this.e(e), this.c(t);
            }),
            e
          );
        })();
        e.Inflate = Me;
        var Se = function (e) {
          (this.ondata = e),
            he(
              [
                ee,
                function () {
                  return [ce, Me];
                },
              ],
              this,
              0,
              function () {
                var e = new Me();
                onmessage = ce(e);
              },
              7
            );
        };
        function Pe(e, t, n) {
          if ((n || ((n = t), (t = {})), "function" != typeof n))
            throw "no callback";
          return le(
            e,
            t,
            [ee],
            function (e) {
              return re(Re(e.data[0], ae(e.data[1])));
            },
            1,
            n
          );
        }
        function Re(e, t) {
          return I(e, t);
        }
        (e.AsyncInflate = Se), (e.inflate = Pe), (e.inflateSync = Re);
        var Ae = (function () {
          function e(e, t) {
            (this.c = Y()), (this.l = 0), (this.v = 1), Ce.call(this, e, t);
          }
          return (
            (e.prototype.push = function (e, t) {
              Ce.prototype.push.call(this, e, t);
            }),
            (e.prototype.p = function (e, t) {
              this.c.p(e), (this.l += e.length);
              var n = $(e, this.o, this.v && ye(this.o), t && 8, !t);
              this.v && (me(n, this.o), (this.v = 0)),
                t &&
                  (fe(n, n.length - 8, this.c.d()),
                  fe(n, n.length - 4, this.l)),
                this.ondata(n, t);
            }),
            e
          );
        })();
        (e.Gzip = Ae), (e.Compress = Ae);
        var Ee = function (e, t) {
          he(
            [
              te,
              ne,
              function () {
                return [ce, Ce, Ae];
              },
            ],
            this,
            we.call(this, e, t),
            function (e) {
              var t = new Ae(e.data);
              onmessage = ce(t);
            },
            8
          );
        };
        function ke(e, t, n) {
          if ((n || ((n = t), (t = {})), "function" != typeof n))
            throw "no callback";
          return le(
            e,
            t,
            [
              te,
              ne,
              function () {
                return [Ie];
              },
            ],
            function (e) {
              return re(Ie(e.data[0], e.data[1]));
            },
            2,
            n
          );
        }
        function Ie(e, t) {
          t || (t = {});
          var n = Y(),
            i = e.length;
          n.p(e);
          var o = $(e, t, ye(t), 8),
            s = o.length;
          return me(o, t), fe(o, s - 8, n.d()), fe(o, s - 4, i), o;
        }
        (e.AsyncGzip = Ee),
          (e.AsyncCompress = Ee),
          (e.gzip = ke),
          (e.compress = ke),
          (e.gzipSync = Ie),
          (e.compressSync = Ie);
        var He = (function () {
          function e(e) {
            (this.v = 1), Me.call(this, e);
          }
          return (
            (e.prototype.push = function (e, t) {
              if ((Me.prototype.e.call(this, e), this.v)) {
                var n = this.p.length > 3 ? ge(this.p) : 4;
                if (n >= this.p.length && !t) return;
                (this.p = this.p.subarray(n)), (this.v = 0);
              }
              if (t) {
                if (this.p.length < 8) throw "invalid gzip stream";
                this.p = this.p.subarray(0, -8);
              }
              Me.prototype.c.call(this, t);
            }),
            e
          );
        })();
        e.Gunzip = He;
        var Le = function (e) {
          (this.ondata = e),
            he(
              [
                ee,
                ie,
                function () {
                  return [ce, Me, He];
                },
              ],
              this,
              0,
              function () {
                var e = new He();
                onmessage = ce(e);
              },
              9
            );
        };
        function Oe(e, t, n) {
          if ((n || ((n = t), (t = {})), "function" != typeof n))
            throw "no callback";
          return le(
            e,
            t,
            [
              ee,
              ie,
              function () {
                return [Ve];
              },
            ],
            function (e) {
              return re(Ve(e.data[0]));
            },
            3,
            n
          );
        }
        function Ve(e, t) {
          return I(e.subarray(ge(e), -8), t || new s(ve(e)));
        }
        (e.AsyncGunzip = Le), (e.gunzip = Oe), (e.gunzipSync = Ve);
        var Fe = (function () {
          function e(e, t) {
            (this.c = K()), (this.v = 1), Ce.call(this, e, t);
          }
          return (
            (e.prototype.push = function (e, t) {
              Ce.prototype.push.call(this, e, t);
            }),
            (e.prototype.p = function (e, t) {
              this.c.p(e);
              var n = $(e, this.o, this.v && 2, t && 4, !t);
              this.v && (be(n, this.o), (this.v = 0)),
                t && fe(n, n.length - 4, this.c.d()),
                this.ondata(n, t);
            }),
            e
          );
        })();
        e.Zlib = Fe;
        var ze = function (e, t) {
          he(
            [
              te,
              oe,
              function () {
                return [ce, Ce, Fe];
              },
            ],
            this,
            we.call(this, e, t),
            function (e) {
              var t = new Fe(e.data);
              onmessage = ce(t);
            },
            10
          );
        };
        function je(e, t) {
          t || (t = {});
          var n = K();
          n.p(e);
          var i = $(e, t, 2, 4);
          return be(i, t), fe(i, i.length - 4, n.d()), i;
        }
        (e.AsyncZlib = ze),
          (e.zlib = function (e, t, n) {
            if ((n || ((n = t), (t = {})), "function" != typeof n))
              throw "no callback";
            return le(
              e,
              t,
              [
                te,
                oe,
                function () {
                  return [je];
                },
              ],
              function (e) {
                return re(je(e.data[0], e.data[1]));
              },
              4,
              n
            );
          }),
          (e.zlibSync = je);
        var Be = (function () {
          function e(e) {
            (this.v = 1), Me.call(this, e);
          }
          return (
            (e.prototype.push = function (e, t) {
              if ((Me.prototype.e.call(this, e), this.v)) {
                if (this.p.length < 2 && !t) return;
                (this.p = this.p.subarray(2)), (this.v = 0);
              }
              if (t) {
                if (this.p.length < 4) throw "invalid zlib stream";
                this.p = this.p.subarray(0, -4);
              }
              Me.prototype.c.call(this, t);
            }),
            e
          );
        })();
        e.Unzlib = Be;
        var Ue = function (e) {
          (this.ondata = e),
            he(
              [
                ee,
                se,
                function () {
                  return [ce, Me, Be];
                },
              ],
              this,
              0,
              function () {
                var e = new Be();
                onmessage = ce(e);
              },
              11
            );
        };
        function Ne(e, t, n) {
          if ((n || ((n = t), (t = {})), "function" != typeof n))
            throw "no callback";
          return le(
            e,
            t,
            [
              ee,
              se,
              function () {
                return [Ge];
              },
            ],
            function (e) {
              return re(Ge(e.data[0], ae(e.data[1])));
            },
            5,
            n
          );
        }
        function Ge(e, t) {
          return I((xe(e), e.subarray(2, -4)), t);
        }
        (e.AsyncUnzlib = Ue), (e.unzlib = Ne), (e.unzlibSync = Ge);
        var We = (function () {
          function e(e) {
            (this.G = He), (this.I = Me), (this.Z = Be), (this.ondata = e);
          }
          return (
            (e.prototype.push = function (e, t) {
              if (!this.ondata) throw "no stream handler";
              if (this.s) this.s.push(e, t);
              else {
                if (this.p && this.p.length) {
                  var n = new s(this.p.length + e.length);
                  n.set(this.p), n.set(e, this.p.length);
                } else this.p = e;
                if (this.p.length > 2) {
                  var i = this,
                    o = function () {
                      i.ondata.apply(i, arguments);
                    };
                  (this.s =
                    31 == this.p[0] && 139 == this.p[1] && 8 == this.p[2]
                      ? new this.G(o)
                      : 8 != (15 & this.p[0]) ||
                        this.p[0] >> 4 > 7 ||
                        ((this.p[0] << 8) | this.p[1]) % 31
                      ? new this.I(o)
                      : new this.Z(o)),
                    this.s.push(this.p, t),
                    (this.p = null);
                }
              }
            }),
            e
          );
        })();
        e.Decompress = We;
        var Ye = (function () {
          function e(e) {
            (this.G = Le), (this.I = Se), (this.Z = Ue), (this.ondata = e);
          }
          return (
            (e.prototype.push = function (e, t) {
              We.prototype.push.call(this, e, t);
            }),
            e
          );
        })();
        (e.AsyncDecompress = Ye),
          (e.decompress = function (e, t, n) {
            if ((n || ((n = t), (t = {})), "function" != typeof n))
              throw "no callback";
            return 31 == e[0] && 139 == e[1] && 8 == e[2]
              ? Oe(e, t, n)
              : 8 != (15 & e[0]) || e[0] >> 4 > 7 || ((e[0] << 8) | e[1]) % 31
              ? Pe(e, t, n)
              : Ne(e, t, n);
          }),
          (e.decompressSync = function (e, t) {
            return 31 == e[0] && 139 == e[1] && 8 == e[2]
              ? Ve(e, t)
              : 8 != (15 & e[0]) || e[0] >> 4 > 7 || ((e[0] << 8) | e[1]) % 31
              ? Re(e, t)
              : Ge(e, t);
          });
        var Ke = function (e, t, n, i) {
            for (var o in e) {
              var r = e[o],
                a = t + o;
              r instanceof s
                ? (n[a] = [r, i])
                : Array.isArray(r)
                ? (n[a] = [r[0], X(i, r[1])])
                : Ke(r, a + "/", n, i);
            }
          },
          $e = "undefined" != typeof TextEncoder && new TextEncoder(),
          Xe = "undefined" != typeof TextDecoder && new TextDecoder(),
          qe = 0;
        try {
          Xe.decode(N, { stream: !0 }), (qe = 1);
        } catch (o) {}
        var Ze = function (e) {
            for (var t = "", n = 0; ; ) {
              var i = e[n++],
                o = (i > 127) + (i > 223) + (i > 239);
              if (n + o > e.length) return [t, k(e, n - 1)];
              o
                ? 3 == o
                  ? ((i =
                      (((15 & i) << 18) |
                        ((63 & e[n++]) << 12) |
                        ((63 & e[n++]) << 6) |
                        (63 & e[n++])) -
                      65536),
                    (t += String.fromCharCode(
                      55296 | (i >> 10),
                      56320 | (1023 & i)
                    )))
                  : (t += String.fromCharCode(
                      1 & o
                        ? ((31 & i) << 6) | (63 & e[n++])
                        : ((15 & i) << 12) |
                            ((63 & e[n++]) << 6) |
                            (63 & e[n++])
                    ))
                : (t += String.fromCharCode(i));
            }
          },
          Qe = (function () {
            function e(e) {
              (this.ondata = e),
                qe ? (this.t = new TextDecoder()) : (this.p = N);
            }
            return (
              (e.prototype.push = function (e, t) {
                if (!this.ondata) throw "no callback";
                if (((t = !!t), this.t)) {
                  if ((this.ondata(this.t.decode(e, { stream: !0 }), t), t)) {
                    if (this.t.decode().length) throw "invalid utf-8 data";
                    this.t = null;
                  }
                } else {
                  if (!this.p) throw "stream finished";
                  var n = new s(this.p.length + e.length);
                  n.set(this.p), n.set(e, this.p.length);
                  var i = Ze(n),
                    o = i[0],
                    r = i[1];
                  if (t) {
                    if (r.length) throw "invalid utf-8 data";
                    this.p = null;
                  } else this.p = r;
                  this.ondata(o, t);
                }
              }),
              e
            );
          })();
        e.DecodeUTF8 = Qe;
        var Je = (function () {
          function e(e) {
            this.ondata = e;
          }
          return (
            (e.prototype.push = function (e, t) {
              if (!this.ondata) throw "no callback";
              if (this.d) throw "stream finished";
              this.ondata(et(e), (this.d = t || !1));
            }),
            e
          );
        })();
        function et(e, t) {
          if (t) {
            for (var n = new s(e.length), i = 0; i < e.length; ++i)
              n[i] = e.charCodeAt(i);
            return n;
          }
          if ($e) return $e.encode(e);
          var o = e.length,
            r = new s(e.length + (e.length >> 1)),
            a = 0,
            l = function (e) {
              r[a++] = e;
            };
          for (i = 0; i < o; ++i) {
            if (a + 5 > r.length) {
              var c = new s(a + 8 + ((o - i) << 1));
              c.set(r), (r = c);
            }
            var h = e.charCodeAt(i);
            h < 128 || t
              ? l(h)
              : h < 2048
              ? (l(192 | (h >> 6)), l(128 | (63 & h)))
              : h > 55295 && h < 57344
              ? (l(
                  240 |
                    ((h =
                      (65536 + (1047552 & h)) | (1023 & e.charCodeAt(++i))) >>
                      18)
                ),
                l(128 | ((h >> 12) & 63)),
                l(128 | ((h >> 6) & 63)),
                l(128 | (63 & h)))
              : (l(224 | (h >> 12)),
                l(128 | ((h >> 6) & 63)),
                l(128 | (63 & h)));
          }
          return k(r, 0, a);
        }
        function tt(e, t) {
          if (t) {
            for (var n = "", i = 0; i < e.length; i += 16384)
              n += String.fromCharCode.apply(null, e.subarray(i, i + 16384));
            return n;
          }
          if (Xe) return Xe.decode(e);
          var o = Ze(e);
          if (o[1].length) throw "invalid utf-8 data";
          return o[0];
        }
        (e.EncodeUTF8 = Je), (e.strToU8 = et), (e.strFromU8 = tt);
        var nt = function (e) {
            return 1 == e ? 3 : e < 6 ? 2 : 9 == e ? 1 : 0;
          },
          it = function (e, t) {
            return t + 30 + ue(e, t + 26) + ue(e, t + 28);
          },
          ot = function (e, t, n) {
            var i = ue(e, t + 28),
              o = tt(e.subarray(t + 46, t + 46 + i), !(2048 & ue(e, t + 8))),
              s = t + 46 + i,
              r = de(e, t + 20),
              a =
                n && 4294967295 == r
                  ? st(e, s)
                  : [r, de(e, t + 24), de(e, t + 42)],
              l = a[0],
              c = a[1],
              h = a[2];
            return [
              ue(e, t + 10),
              l,
              c,
              o,
              s + ue(e, t + 30) + ue(e, t + 32),
              h,
            ];
          },
          st = function (e, t) {
            for (; 1 != ue(e, t); t += 4 + ue(e, t + 2));
            return [pe(e, t + 12), pe(e, t + 4), pe(e, t + 20)];
          },
          rt = function (e) {
            var t = 0;
            if (e)
              for (var n in e) {
                var i = e[n].length;
                if (i > 65535) throw "extra field too long";
                t += i + 4;
              }
            return t;
          },
          at = function (e, t, n, i, o, s, r, a) {
            var l = i.length,
              c = n.extra,
              h = a && a.length,
              u = rt(c);
            fe(e, t, null != r ? 33639248 : 67324752),
              (t += 4),
              null != r && ((e[t++] = 20), (e[t++] = n.os)),
              (e[t] = 20),
              (t += 2),
              (e[t++] = (n.flag << 1) | (null == s && 8)),
              (e[t++] = o && 8),
              (e[t++] = 255 & n.compression),
              (e[t++] = n.compression >> 8);
            var d = new Date(null == n.mtime ? Date.now() : n.mtime),
              p = d.getFullYear() - 1980;
            if (p < 0 || p > 119) throw "date not in range 1980-2099";
            if (
              (fe(
                e,
                t,
                (p << 25) |
                  ((d.getMonth() + 1) << 21) |
                  (d.getDate() << 16) |
                  (d.getHours() << 11) |
                  (d.getMinutes() << 5) |
                  (d.getSeconds() >>> 1)
              ),
              (t += 4),
              null != s &&
                (fe(e, t, n.crc), fe(e, t + 4, s), fe(e, t + 8, n.size)),
              fe(e, t + 12, l),
              fe(e, t + 14, u),
              (t += 16),
              null != r &&
                (fe(e, t, h),
                fe(e, t + 6, n.attrs),
                fe(e, t + 10, r),
                (t += 14)),
              e.set(i, t),
              (t += l),
              u)
            )
              for (var f in c) {
                var m = c[f],
                  g = m.length;
                fe(e, t, +f), fe(e, t + 2, g), e.set(m, t + 4), (t += 4 + g);
              }
            return h && (e.set(a, t), (t += h)), t;
          },
          lt = function (e, t, n, i, o) {
            fe(e, t, 101010256),
              fe(e, t + 8, n),
              fe(e, t + 10, n),
              fe(e, t + 12, i),
              fe(e, t + 16, o);
          },
          ct = (function () {
            function e(e) {
              (this.filename = e),
                (this.c = Y()),
                (this.size = 0),
                (this.compression = 0);
            }
            return (
              (e.prototype.process = function (e, t) {
                this.ondata(null, e, t);
              }),
              (e.prototype.push = function (e, t) {
                if (!this.ondata)
                  throw "no callback - add to ZIP archive before pushing";
                this.c.p(e),
                  (this.size += e.length),
                  t && (this.crc = this.c.d()),
                  this.process(e, t || !1);
              }),
              e
            );
          })();
        e.ZipPassThrough = ct;
        var ht = (function () {
          function e(e, t) {
            var n = this;
            t || (t = {}),
              ct.call(this, e),
              (this.d = new Ce(t, function (e, t) {
                n.ondata(null, e, t);
              })),
              (this.compression = 8),
              (this.flag = nt(t.level));
          }
          return (
            (e.prototype.process = function (e, t) {
              try {
                this.d.push(e, t);
              } catch (e) {
                this.ondata(e, null, t);
              }
            }),
            (e.prototype.push = function (e, t) {
              ct.prototype.push.call(this, e, t);
            }),
            e
          );
        })();
        e.ZipDeflate = ht;
        var ut = (function () {
          function e(e, t) {
            var n = this;
            t || (t = {}),
              ct.call(this, e),
              (this.d = new Te(t, function (e, t, i) {
                n.ondata(e, t, i);
              })),
              (this.compression = 8),
              (this.flag = nt(t.level)),
              (this.terminate = this.d.terminate);
          }
          return (
            (e.prototype.process = function (e, t) {
              this.d.push(e, t);
            }),
            (e.prototype.push = function (e, t) {
              ct.prototype.push.call(this, e, t);
            }),
            e
          );
        })();
        e.AsyncZipDeflate = ut;
        var dt = (function () {
          function e(e) {
            (this.ondata = e), (this.u = []), (this.d = 1);
          }
          return (
            (e.prototype.add = function (e) {
              var t = this;
              if (2 & this.d) throw "stream finished";
              var n = et(e.filename),
                i = n.length,
                o = e.comment,
                r = o && et(o),
                a = i != e.filename.length || (r && o.length != r.length),
                l = i + rt(e.extra) + 30;
              if (i > 65535) throw "filename too long";
              var c = new s(l);
              at(c, 0, e, n, a);
              var h = [c],
                u = function () {
                  for (var e = 0, n = h; e < n.length; e++)
                    t.ondata(null, n[e], !1);
                  h = [];
                },
                d = this.d;
              this.d = 0;
              var p = this.u.length,
                f = X(e, {
                  f: n,
                  u: a,
                  o: r,
                  t: function () {
                    e.terminate && e.terminate();
                  },
                  r: function () {
                    if ((u(), d)) {
                      var e = t.u[p + 1];
                      e ? e.r() : (t.d = 1);
                    }
                    d = 1;
                  },
                }),
                m = 0;
              (e.ondata = function (n, i, o) {
                if (n) t.ondata(n, i, o), t.terminate();
                else if (((m += i.length), h.push(i), o)) {
                  var r = new s(16);
                  fe(r, 0, 134695760),
                    fe(r, 4, e.crc),
                    fe(r, 8, m),
                    fe(r, 12, e.size),
                    h.push(r),
                    (f.c = m),
                    (f.b = l + m + 16),
                    (f.crc = e.crc),
                    (f.size = e.size),
                    d && f.r(),
                    (d = 1);
                } else d && u();
              }),
                this.u.push(f);
            }),
            (e.prototype.end = function () {
              var e = this;
              if (2 & this.d) {
                if (1 & this.d) throw "stream finishing";
                throw "stream finished";
              }
              this.d
                ? this.e()
                : this.u.push({
                    r: function () {
                      1 & e.d && (e.u.splice(-1, 1), e.e());
                    },
                    t: function () {},
                  }),
                (this.d = 3);
            }),
            (e.prototype.e = function () {
              for (
                var e = 0, t = 0, n = 0, i = 0, o = this.u;
                i < o.length;
                i++
              )
                n +=
                  46 +
                  (c = o[i]).f.length +
                  rt(c.extra) +
                  (c.o ? c.o.length : 0);
              for (
                var r = new s(n + 22), a = 0, l = this.u;
                a < l.length;
                a++
              ) {
                var c;
                at(r, e, (c = l[a]), c.f, c.u, c.c, t, c.o),
                  (e += 46 + c.f.length + rt(c.extra) + (c.o ? c.o.length : 0)),
                  (t += c.b);
              }
              lt(r, e, this.u.length, n, t),
                this.ondata(null, r, !0),
                (this.d = 2);
            }),
            (e.prototype.terminate = function () {
              for (var e = 0, t = this.u; e < t.length; e++) t[e].t();
              this.d = 2;
            }),
            e
          );
        })();
        (e.Zip = dt),
          (e.zip = function (e, t, n) {
            if ((n || ((n = t), (t = {})), "function" != typeof n))
              throw "no callback";
            var i = {};
            Ke(e, "", i, t);
            var o = Object.keys(i),
              r = o.length,
              a = 0,
              l = 0,
              c = r,
              h = Array(r),
              u = [],
              d = function () {
                for (var e = 0; e < u.length; ++e) u[e]();
              },
              p = function () {
                var e = new s(l + 22),
                  t = a,
                  i = l - a;
                l = 0;
                for (var o = 0; o < c; ++o) {
                  var r = h[o];
                  try {
                    var u = r.c.length;
                    at(e, l, r, r.f, r.u, u);
                    var d = 30 + r.f.length + rt(r.extra),
                      p = l + d;
                    e.set(r.c, p),
                      at(e, a, r, r.f, r.u, u, l, r.m),
                      (a += 16 + d + (r.m ? r.m.length : 0)),
                      (l = p + u);
                  } catch (e) {
                    return n(e, null);
                  }
                }
                lt(e, a, h.length, i, t), n(null, e);
              };
            r || p();
            for (
              var f = function (e) {
                  var t = o[e],
                    s = i[t],
                    c = s[0],
                    f = s[1],
                    m = Y(),
                    g = c.length;
                  m.p(c);
                  var v = et(t),
                    y = v.length,
                    b = f.comment,
                    x = b && et(b),
                    w = x && x.length,
                    C = rt(f.extra),
                    T = 0 == f.level ? 0 : 8,
                    _ = function (i, o) {
                      if (i) d(), n(i, null);
                      else {
                        var s = o.length;
                        (h[e] = X(f, {
                          size: g,
                          crc: m.d(),
                          c: o,
                          f: v,
                          m: x,
                          u: y != t.length || (x && b.length != w),
                          compression: T,
                        })),
                          (a += 30 + y + C + s),
                          (l += 76 + 2 * (y + C) + (w || 0) + s),
                          --r || p();
                      }
                    };
                  if ((y > 65535 && _("filename too long", null), T))
                    if (g < 16e4)
                      try {
                        _(null, De(c, f));
                      } catch (e) {
                        _(e, null);
                      }
                    else u.push(_e(c, f, _));
                  else _(null, c);
                },
                m = 0;
              m < c;
              ++m
            )
              f(m);
            return d;
          }),
          (e.zipSync = function (e, t) {
            t || (t = {});
            var n = {},
              i = [];
            Ke(e, "", n, t);
            var o = 0,
              r = 0;
            for (var a in n) {
              var l = n[a],
                c = l[0],
                h = l[1],
                u = 0 == h.level ? 0 : 8,
                d = (_ = et(a)).length,
                p = h.comment,
                f = p && et(p),
                m = f && f.length,
                g = rt(h.extra);
              if (d > 65535) throw "filename too long";
              var v = u ? De(c, h) : c,
                y = v.length,
                b = Y();
              b.p(c),
                i.push(
                  X(h, {
                    size: c.length,
                    crc: b.d(),
                    c: v,
                    f: _,
                    m: f,
                    u: d != a.length || (f && p.length != m),
                    o: o,
                    compression: u,
                  })
                ),
                (o += 30 + d + g + y),
                (r += 76 + 2 * (d + g) + (m || 0) + y);
            }
            for (
              var x = new s(r + 22), w = o, C = r - o, T = 0;
              T < i.length;
              ++T
            ) {
              var _;
              at(x, (_ = i[T]).o, _, _.f, _.u, _.c.length);
              var D = 30 + _.f.length + rt(_.extra);
              x.set(_.c, _.o + D),
                at(x, o, _, _.f, _.u, _.c.length, _.o, _.m),
                (o += 16 + D + (_.m ? _.m.length : 0));
            }
            return lt(x, o, i.length, C, w), x;
          });
        var pt = (function () {
          function e() {}
          return (
            (e.prototype.push = function (e, t) {
              this.ondata(null, e, t);
            }),
            (e.compression = 0),
            e
          );
        })();
        e.UnzipPassThrough = pt;
        var ft = (function () {
          function e() {
            var e = this;
            this.i = new Me(function (t, n) {
              e.ondata(null, t, n);
            });
          }
          return (
            (e.prototype.push = function (e, t) {
              try {
                this.i.push(e, t);
              } catch (n) {
                this.ondata(n, e, t);
              }
            }),
            (e.compression = 8),
            e
          );
        })();
        e.UnzipInflate = ft;
        var mt = (function () {
          function e(e, t) {
            var n = this;
            t < 32e4
              ? (this.i = new Me(function (e, t) {
                  n.ondata(null, e, t);
                }))
              : ((this.i = new Se(function (e, t, i) {
                  n.ondata(e, t, i);
                })),
                (this.terminate = this.i.terminate));
          }
          return (
            (e.prototype.push = function (e, t) {
              this.i.terminate && (e = k(e, 0)), this.i.push(e, t);
            }),
            (e.compression = 8),
            e
          );
        })();
        e.AsyncUnzipInflate = mt;
        var gt = (function () {
          function e(e) {
            (this.onfile = e),
              (this.k = []),
              (this.o = { 0: pt }),
              (this.p = N);
          }
          return (
            (e.prototype.push = function (e, t) {
              var n = this;
              if (!this.onfile) throw "no callback";
              if (!this.p) throw "stream finished";
              if (this.c > 0) {
                var i = Math.min(this.c, e.length),
                  o = e.subarray(0, i);
                if (
                  ((this.c -= i),
                  this.d ? this.d.push(o, !this.c) : this.k[0].push(o),
                  (e = e.subarray(i)).length)
                )
                  return this.push(e, t);
              } else {
                var r = 0,
                  a = 0,
                  l = void 0,
                  c = void 0;
                this.p.length
                  ? e.length
                    ? ((c = new s(this.p.length + e.length)).set(this.p),
                      c.set(e, this.p.length))
                    : (c = this.p)
                  : (c = e);
                for (
                  var h = c.length,
                    u = this.c,
                    d = u && this.d,
                    p = function () {
                      var e,
                        t = de(c, a);
                      if (67324752 == t) {
                        (r = 1), (l = a), (f.d = null), (f.c = 0);
                        var i = ue(c, a + 6),
                          o = ue(c, a + 8),
                          s = 2048 & i,
                          d = 8 & i,
                          p = ue(c, a + 26),
                          m = ue(c, a + 28);
                        if (h > a + 30 + p + m) {
                          var g = [];
                          f.k.unshift(g), (r = 2);
                          var v,
                            y = de(c, a + 18),
                            b = de(c, a + 22),
                            x = tt(c.subarray(a + 30, (a += 30 + p)), !s);
                          4294967295 == y
                            ? ((e = d ? [-2] : st(c, a)),
                              (y = e[0]),
                              (b = e[1]))
                            : d && (y = -1),
                            (a += m),
                            (f.c = y);
                          var w = {
                            name: x,
                            compression: o,
                            start: function () {
                              if (!w.ondata) throw "no callback";
                              if (y) {
                                var e = n.o[o];
                                if (!e) throw "unknown compression type " + o;
                                (v = y < 0 ? new e(x) : new e(x, y, b)).ondata =
                                  function (e, t, n) {
                                    w.ondata(e, t, n);
                                  };
                                for (var t = 0, i = g; t < i.length; t++)
                                  v.push(i[t], !1);
                                n.k[0] == g && n.c ? (n.d = v) : v.push(N, !0);
                              } else w.ondata(null, N, !0);
                            },
                            terminate: function () {
                              v && v.terminate && v.terminate();
                            },
                          };
                          y >= 0 && ((w.size = y), (w.originalSize = b)),
                            f.onfile(w);
                        }
                        return "break";
                      }
                      if (u) {
                        if (134695760 == t)
                          return (
                            (l = a += 12 + (-2 == u && 8)),
                            (r = 3),
                            (f.c = 0),
                            "break"
                          );
                        if (33639248 == t)
                          return (l = a -= 4), (r = 3), (f.c = 0), "break";
                      }
                    },
                    f = this;
                  a < h - 4 && "break" !== p();
                  ++a
                );
                if (((this.p = N), u < 0)) {
                  var m = c.subarray(
                    0,
                    r
                      ? l -
                          12 -
                          (-2 == u && 8) -
                          (134695760 == de(c, l - 16) && 4)
                      : a
                  );
                  d ? d.push(m, !!r) : this.k[+(2 == r)].push(m);
                }
                if (2 & r) return this.push(c.subarray(a), t);
                this.p = c.subarray(a);
              }
              if (t) {
                if (this.c) throw "invalid zip file";
                this.p = null;
              }
            }),
            (e.prototype.register = function (e) {
              this.o[e.compression] = e;
            }),
            e
          );
        })();
        return (
          (e.Unzip = gt),
          (e.unzip = function (e, t) {
            if ("function" != typeof t) throw "no callback";
            for (
              var n = [],
                i = function () {
                  for (var e = 0; e < n.length; ++e) n[e]();
                },
                o = {},
                r = e.length - 22;
              101010256 != de(e, r);
              --r
            )
              if (!r || e.length - r > 65558)
                return void t("invalid zip file", null);
            var a = ue(e, r + 8);
            a || t(null, {});
            var l = a,
              c = de(e, r + 16),
              h = 4294967295 == c;
            if (h) {
              if (((r = de(e, r - 12)), 101075792 != de(e, r)))
                return void t("invalid zip file", null);
              (l = a = de(e, r + 32)), (c = de(e, r + 48));
            }
            for (
              var u = function (r) {
                  var l = ot(e, c, h),
                    u = l[0],
                    d = l[1],
                    p = l[2],
                    f = l[3],
                    m = l[4],
                    g = it(e, l[5]);
                  c = m;
                  var v = function (e, n) {
                    e ? (i(), t(e, null)) : ((o[f] = n), --a || t(null, o));
                  };
                  if (u)
                    if (8 == u) {
                      var y = e.subarray(g, g + d);
                      if (d < 32e4)
                        try {
                          v(null, Re(y, new s(p)));
                        } catch (e) {
                          v(e, null);
                        }
                      else n.push(Pe(y, { size: p }, v));
                    } else v("unknown compression type " + u, null);
                  else v(null, k(e, g, g + d));
                },
                d = 0;
              d < l;
              ++d
            )
              u();
            return i;
          }),
          (e.unzipSync = function (e) {
            for (var t = {}, n = e.length - 22; 101010256 != de(e, n); --n)
              if (!n || e.length - n > 65558) throw "invalid zip file";
            var i = ue(e, n + 8);
            if (!i) return {};
            var o = de(e, n + 16),
              r = 4294967295 == o;
            if (r) {
              if (((n = de(e, n - 12)), 101075792 != de(e, n)))
                throw "invalid zip file";
              (i = de(e, n + 32)), (o = de(e, n + 48));
            }
            for (var a = 0; a < i; ++a) {
              var l = ot(e, o, r),
                c = l[0],
                h = l[1],
                u = l[2],
                d = l[3],
                p = l[4],
                f = it(e, l[5]);
              if (((o = p), c)) {
                if (8 != c) throw "unknown compression type " + c;
                t[d] = Re(e.subarray(f, f + h), new s(u));
              } else t[d] = k(e, f, f + h);
            }
            return t;
          }),
          e
        );
      })();
    }).call(this, n(22).setImmediate);
  },
  function (e, t, n) {
    (function (e) {
      var i =
          (void 0 !== e && e) || ("undefined" != typeof self && self) || window,
        o = Function.prototype.apply;
      function s(e, t) {
        (this._id = e), (this._clearFn = t);
      }
      (t.setTimeout = function () {
        return new s(o.call(setTimeout, i, arguments), clearTimeout);
      }),
        (t.setInterval = function () {
          return new s(o.call(setInterval, i, arguments), clearInterval);
        }),
        (t.clearTimeout = t.clearInterval =
          function (e) {
            e && e.close();
          }),
        (s.prototype.unref = s.prototype.ref = function () {}),
        (s.prototype.close = function () {
          this._clearFn.call(i, this._id);
        }),
        (t.enroll = function (e, t) {
          clearTimeout(e._idleTimeoutId), (e._idleTimeout = t);
        }),
        (t.unenroll = function (e) {
          clearTimeout(e._idleTimeoutId), (e._idleTimeout = -1);
        }),
        (t._unrefActive = t.active =
          function (e) {
            clearTimeout(e._idleTimeoutId);
            var t = e._idleTimeout;
            t >= 0 &&
              (e._idleTimeoutId = setTimeout(function () {
                e._onTimeout && e._onTimeout();
              }, t));
          }),
        n(23),
        (t.setImmediate =
          ("undefined" != typeof self && self.setImmediate) ||
          (void 0 !== e && e.setImmediate) ||
          (this && this.setImmediate)),
        (t.clearImmediate =
          ("undefined" != typeof self && self.clearImmediate) ||
          (void 0 !== e && e.clearImmediate) ||
          (this && this.clearImmediate));
    }).call(this, n(4));
  },
  function (e, t, n) {
    (function (e, t) {
      !(function (e, n) {
        "use strict";
        if (!e.setImmediate) {
          var i,
            o,
            s,
            r,
            a,
            l = 1,
            c = {},
            h = !1,
            u = e.document,
            d = Object.getPrototypeOf && Object.getPrototypeOf(e);
          (d = d && d.setTimeout ? d : e),
            "[object process]" === {}.toString.call(e.process)
              ? (i = function (e) {
                  t.nextTick(function () {
                    f(e);
                  });
                })
              : !(function () {
                  if (e.postMessage && !e.importScripts) {
                    var t = !0,
                      n = e.onmessage;
                    return (
                      (e.onmessage = function () {
                        t = !1;
                      }),
                      e.postMessage("", "*"),
                      (e.onmessage = n),
                      t
                    );
                  }
                })()
              ? e.MessageChannel
                ? (((s = new MessageChannel()).port1.onmessage = function (e) {
                    f(e.data);
                  }),
                  (i = function (e) {
                    s.port2.postMessage(e);
                  }))
                : u && "onreadystatechange" in u.createElement("script")
                ? ((o = u.documentElement),
                  (i = function (e) {
                    var t = u.createElement("script");
                    (t.onreadystatechange = function () {
                      f(e),
                        (t.onreadystatechange = null),
                        o.removeChild(t),
                        (t = null);
                    }),
                      o.appendChild(t);
                  }))
                : (i = function (e) {
                    setTimeout(f, 0, e);
                  })
              : ((r = "setImmediate$" + Math.random() + "$"),
                (a = function (t) {
                  t.source === e &&
                    "string" == typeof t.data &&
                    0 === t.data.indexOf(r) &&
                    f(+t.data.slice(r.length));
                }),
                e.addEventListener
                  ? e.addEventListener("message", a, !1)
                  : e.attachEvent("onmessage", a),
                (i = function (t) {
                  e.postMessage(r + t, "*");
                })),
            (d.setImmediate = function (e) {
              "function" != typeof e && (e = new Function("" + e));
              for (
                var t = new Array(arguments.length - 1), n = 0;
                n < t.length;
                n++
              )
                t[n] = arguments[n + 1];
              var o = { callback: e, args: t };
              return (c[l] = o), i(l), l++;
            }),
            (d.clearImmediate = p);
        }
        function p(e) {
          delete c[e];
        }
        function f(e) {
          if (h) setTimeout(f, 0, e);
          else {
            var t = c[e];
            if (t) {
              h = !0;
              try {
                !(function (e) {
                  var t = e.callback,
                    n = e.args;
                  switch (n.length) {
                    case 0:
                      t();
                      break;
                    case 1:
                      t(n[0]);
                      break;
                    case 2:
                      t(n[0], n[1]);
                      break;
                    case 3:
                      t(n[0], n[1], n[2]);
                      break;
                    default:
                      t.apply(void 0, n);
                  }
                })(t);
              } finally {
                p(e), (h = !1);
              }
            }
          }
        }
      })("undefined" == typeof self ? (void 0 === e ? this : e) : self);
    }).call(this, n(4), n(6));
  },
  function (e, t) {
    !(function () {
      class e extends THRDev3.DataTextureLoader {
        constructor(e) {
          super(e);
        }
        parse(e) {
          const t = 0,
            n = 1,
            i = 2,
            o = 3,
            s = 9,
            r = 10,
            a = 11,
            l = 48,
            c = 4,
            h = 0,
            u = 1,
            d = 2,
            p = 3;
          e.length < 19 &&
            console.error(
              "THRDev3.TGALoader: Not enough data to contain header."
            );
          let f = 0;
          const m = new Uint8Array(e),
            g = {
              id_length: m[f++],
              colormap_type: m[f++],
              image_type: m[f++],
              colormap_index: m[f++] | (m[f++] << 8),
              colormap_length: m[f++] | (m[f++] << 8),
              colormap_size: m[f++],
              origin: [m[f++] | (m[f++] << 8), m[f++] | (m[f++] << 8)],
              width: m[f++] | (m[f++] << 8),
              height: m[f++] | (m[f++] << 8),
              pixel_size: m[f++],
              flags: m[f++],
            };
          !(function (e) {
            switch (e.image_type) {
              case n:
              case s:
                (e.colormap_length > 256 ||
                  24 !== e.colormap_size ||
                  1 !== e.colormap_type) &&
                  console.error(
                    "THRDev3.TGALoader: Invalid type colormap data for indexed type."
                  );
                break;
              case i:
              case o:
              case r:
              case a:
                e.colormap_type &&
                  console.error(
                    "THRDev3.TGALoader: Invalid type colormap data for colormap type."
                  );
                break;
              case t:
                console.error("THRDev3.TGALoader: No data.");
              default:
                console.error(
                  'THRDev3.TGALoader: Invalid type "%s".',
                  e.image_type
                );
            }
            (e.width <= 0 || e.height <= 0) &&
              console.error("THRDev3.TGALoader: Invalid image size."),
              8 !== e.pixel_size &&
                16 !== e.pixel_size &&
                24 !== e.pixel_size &&
                32 !== e.pixel_size &&
                console.error(
                  'THRDev3.TGALoader: Invalid pixel size "%s".',
                  e.pixel_size
                );
          })(g),
            g.id_length + f > e.length &&
              console.error("THRDev3.TGALoader: No data."),
            (f += g.id_length);
          let v = !1,
            y = !1,
            b = !1;
          switch (g.image_type) {
            case s:
              (v = !0), (y = !0);
              break;
            case n:
              y = !0;
              break;
            case r:
              v = !0;
              break;
            case i:
              break;
            case a:
              (v = !0), (b = !0);
              break;
            case o:
              b = !0;
          }
          const x = new Uint8Array(g.width * g.height * 4),
            w = (function (e, t, n, i, o) {
              let s, r;
              const a = n.pixel_size >> 3,
                l = n.width * n.height * a;
              if (
                (t &&
                  (r = o.subarray(
                    i,
                    (i += n.colormap_length * (n.colormap_size >> 3))
                  )),
                e)
              ) {
                let e, t, n;
                s = new Uint8Array(l);
                let r = 0;
                const c = new Uint8Array(a);
                for (; r < l; )
                  if (((e = o[i++]), (t = 1 + (127 & e)), 128 & e)) {
                    for (n = 0; n < a; ++n) c[n] = o[i++];
                    for (n = 0; n < t; ++n) s.set(c, r + n * a);
                    r += a * t;
                  } else {
                    for (t *= a, n = 0; n < t; ++n) s[r + n] = o[i++];
                    r += t;
                  }
              } else s = o.subarray(i, (i += t ? n.width * n.height : l));
              return { pixel_data: s, palettes: r };
            })(v, y, g, f, m);
          return (
            (function (e, t, n, i, o) {
              let s, r, a, f, m, v;
              switch ((g.flags & l) >> c) {
                default:
                case d:
                  (s = 0), (a = 1), (m = t), (r = 0), (f = 1), (v = n);
                  break;
                case h:
                  (s = 0), (a = 1), (m = t), (r = n - 1), (f = -1), (v = -1);
                  break;
                case p:
                  (s = t - 1), (a = -1), (m = -1), (r = 0), (f = 1), (v = n);
                  break;
                case u:
                  (s = t - 1),
                    (a = -1),
                    (m = -1),
                    (r = n - 1),
                    (f = -1),
                    (v = -1);
              }
              if (b)
                switch (g.pixel_size) {
                  case 8:
                    !(function (e, t, n, i, o, s, r, a) {
                      let l,
                        c,
                        h,
                        u = 0;
                      const d = g.width;
                      for (h = t; h !== i; h += n)
                        for (c = o; c !== r; c += s, u++)
                          (l = a[u]),
                            (e[4 * (c + d * h) + 0] = l),
                            (e[4 * (c + d * h) + 1] = l),
                            (e[4 * (c + d * h) + 2] = l),
                            (e[4 * (c + d * h) + 3] = 255);
                    })(e, r, f, v, s, a, m, i);
                    break;
                  case 16:
                    !(function (e, t, n, i, o, s, r, a) {
                      let l,
                        c,
                        h = 0;
                      const u = g.width;
                      for (c = t; c !== i; c += n)
                        for (l = o; l !== r; l += s, h += 2)
                          (e[4 * (l + u * c) + 0] = a[h + 0]),
                            (e[4 * (l + u * c) + 1] = a[h + 0]),
                            (e[4 * (l + u * c) + 2] = a[h + 0]),
                            (e[4 * (l + u * c) + 3] = a[h + 1]);
                    })(e, r, f, v, s, a, m, i);
                    break;
                  default:
                    console.error("THRDev3.TGALoader: Format not supported.");
                }
              else
                switch (g.pixel_size) {
                  case 8:
                    !(function (e, t, n, i, o, s, r, a, l) {
                      const c = l;
                      let h,
                        u,
                        d,
                        p = 0;
                      const f = g.width;
                      for (d = t; d !== i; d += n)
                        for (u = o; u !== r; u += s, p++)
                          (h = a[p]),
                            (e[4 * (u + f * d) + 3] = 255),
                            (e[4 * (u + f * d) + 2] = c[3 * h + 0]),
                            (e[4 * (u + f * d) + 1] = c[3 * h + 1]),
                            (e[4 * (u + f * d) + 0] = c[3 * h + 2]);
                    })(e, r, f, v, s, a, m, i, o);
                    break;
                  case 16:
                    !(function (e, t, n, i, o, s, r, a) {
                      let l,
                        c,
                        h,
                        u = 0;
                      const d = g.width;
                      for (h = t; h !== i; h += n)
                        for (c = o; c !== r; c += s, u += 2)
                          (l = a[u + 0] + (a[u + 1] << 8)),
                            (e[4 * (c + d * h) + 0] = (31744 & l) >> 7),
                            (e[4 * (c + d * h) + 1] = (992 & l) >> 2),
                            (e[4 * (c + d * h) + 2] = (31 & l) << 3),
                            (e[4 * (c + d * h) + 3] = 32768 & l ? 0 : 255);
                    })(e, r, f, v, s, a, m, i);
                    break;
                  case 24:
                    !(function (e, t, n, i, o, s, r, a) {
                      let l,
                        c,
                        h = 0;
                      const u = g.width;
                      for (c = t; c !== i; c += n)
                        for (l = o; l !== r; l += s, h += 3)
                          (e[4 * (l + u * c) + 3] = 255),
                            (e[4 * (l + u * c) + 2] = a[h + 0]),
                            (e[4 * (l + u * c) + 1] = a[h + 1]),
                            (e[4 * (l + u * c) + 0] = a[h + 2]);
                    })(e, r, f, v, s, a, m, i);
                    break;
                  case 32:
                    !(function (e, t, n, i, o, s, r, a) {
                      let l,
                        c,
                        h = 0;
                      const u = g.width;
                      for (c = t; c !== i; c += n)
                        for (l = o; l !== r; l += s, h += 4)
                          (e[4 * (l + u * c) + 2] = a[h + 0]),
                            (e[4 * (l + u * c) + 1] = a[h + 1]),
                            (e[4 * (l + u * c) + 0] = a[h + 2]),
                            (e[4 * (l + u * c) + 3] = a[h + 3]);
                    })(e, r, f, v, s, a, m, i);
                    break;
                  default:
                    console.error("THRDev3.TGALoader: Format not supported.");
                }
            })(x, g.width, g.height, w.pixel_data, w.palettes),
            {
              data: x,
              width: g.width,
              height: g.height,
              flipY: !0,
              generateMipmaps: !0,
              minFilter: THRDev3.LinearMipmapLinearFilter,
            }
          );
        }
      }
      THRDev3.TGALoader = e;
    })();
  },
  function (e, t) {
    !(function () {
      let e, t, n;
      class i extends THRDev3.Loader {
        constructor(e) {
          super(e);
        }
        load(e, t, n, i) {
          const o = this,
            s = "" === o.path ? THRDev3.LoaderUtils.extractUrlBase(e) : o.path,
            r = new THRDev3.FileLoader(this.manager);
          r.setPath(o.path),
            r.setResponseType("arraybuffer"),
            r.setRequestHeader(o.requestHeader),
            r.setWithCredentials(o.withCredentials),
            r.load(
              e,
              function (n) {
                try {
                  t(o.parse(n, s));
                } catch (t) {
                  i ? i(t) : console.error(t), o.manager.itemError(e);
                }
              },
              n,
              i
            );
        }
        parse(t, n) {
          if (
            (function (e) {
              const t = "Kaydara FBX Binary  \0";
              return e.byteLength >= t.length && t === x(e, 0, t.length);
            })(t)
          )
            e = new l().parse(t);
          else {
            const n = x(t);
            if (
              !(function (e) {
                const t = [
                  "K",
                  "a",
                  "y",
                  "d",
                  "a",
                  "r",
                  "a",
                  "\\",
                  "F",
                  "B",
                  "X",
                  "\\",
                  "B",
                  "i",
                  "n",
                  "a",
                  "r",
                  "y",
                  "\\",
                  "\\",
                ];
                let n = 0;
                function i(t) {
                  const i = e[t - 1];
                  return (e = e.slice(n + t)), n++, i;
                }
                for (let e = 0; e < t.length; ++e) {
                  if (i(1) === t[e]) return !1;
                }
                return !0;
              })(n)
            )
              throw new Error("THRDev3.FBXLoader: Unknown format.");
            if (u(n) < 7e3)
              throw new Error(
                "THRDev3.FBXLoader: FBX version not supported, FileVersion: " +
                  u(n)
              );
            e = new a().parse(n);
          }
          const i = new THRDev3.TextureLoader(this.manager)
            .setPath(this.resourcePath || n)
            .setCrossOrigin(this.crossOrigin);
          return new o(i, this.manager).parse(e);
        }
      }
      class o {
        constructor(e, t) {
          (this.textureLoader = e), (this.manager = t);
        }
        parse() {
          t = this.parseConnections();
          const e = this.parseImages(),
            i = this.parseTextures(e),
            o = this.parseMaterials(i),
            r = this.parseDeformers(),
            a = new s().parse(r);
          return this.parseScene(r, a, o), n;
        }
        parseConnections() {
          const t = new Map();
          if ("Connections" in e) {
            e.Connections.connections.forEach(function (e) {
              const n = e[0],
                i = e[1],
                o = e[2];
              t.has(n) || t.set(n, { parents: [], children: [] });
              const s = { ID: i, relationship: o };
              t.get(n).parents.push(s),
                t.has(i) || t.set(i, { parents: [], children: [] });
              const r = { ID: n, relationship: o };
              t.get(i).children.push(r);
            });
          }
          return t;
        }
        parseImages() {
          const t = {},
            n = {};
          if ("Video" in e.Objects) {
            const i = e.Objects.Video;
            for (const e in i) {
              const o = i[e];
              if (
                ((t[parseInt(e)] = o.RelativeFilename || o.Filename),
                "Content" in o)
              ) {
                const t =
                    o.Content instanceof ArrayBuffer &&
                    o.Content.byteLength > 0,
                  s = "string" == typeof o.Content && "" !== o.Content;
                if (t || s) {
                  const t = this.parseImage(i[e]);
                  n[o.RelativeFilename || o.Filename] = t;
                }
              }
            }
          }
          for (const e in t) {
            const i = t[e];
            void 0 !== n[i] ? (t[e] = n[i]) : (t[e] = t[e].split("\\").pop());
          }
          return t;
        }
        parseImage(e) {
          const t = e.Content,
            n = e.RelativeFilename || e.Filename,
            i = n.slice(n.lastIndexOf(".") + 1).toLowerCase();
          let o;
          switch (i) {
            case "bmp":
              o = "image/bmp";
              break;
            case "jpg":
            case "jpeg":
              o = "image/jpeg";
              break;
            case "png":
              o = "image/png";
              break;
            case "tif":
              o = "image/tiff";
              break;
            case "tga":
              null === this.manager.getHandler(".tga") &&
                console.warn("FBXLoader: TGA loader not found, skipping ", n),
                (o = "image/tga");
              break;
            default:
              return void console.warn(
                'FBXLoader: Image type "' + i + '" is not supported.'
              );
          }
          if ("string" == typeof t) return "data:" + o + ";base64," + t;
          {
            const e = new Uint8Array(t);
            return window.URL.createObjectURL(new Blob([e], { type: o }));
          }
        }
        parseTextures(t) {
          const n = new Map();
          if ("Texture" in e.Objects) {
            const i = e.Objects.Texture;
            for (const e in i) {
              const o = this.parseTexture(i[e], t);
              n.set(parseInt(e), o);
            }
          }
          return n;
        }
        parseTexture(e, t) {
          const n = this.loadTexture(e, t);
          (n.ID = e.id), (n.name = e.attrName);
          const i = e.WrapModeU,
            o = e.WrapModeV,
            s = void 0 !== i ? i.value : 0,
            r = void 0 !== o ? o.value : 0;
          if (
            ((n.wrapS =
              0 === s ? THRDev3.RepeatWrapping : THRDev3.ClampToEdgeWrapping),
            (n.wrapT =
              0 === r ? THRDev3.RepeatWrapping : THRDev3.ClampToEdgeWrapping),
            "Scaling" in e)
          ) {
            const t = e.Scaling.value;
            (n.repeat.x = t[0]), (n.repeat.y = t[1]);
          }
          if ("Translation" in e) {
            const t = e.Translation.value;
            (n.offset.x = t[0]), (n.offset.y = t[1]);
          }
          return n;
        }
        loadTexture(e, n) {
          let i;
          const o = this.textureLoader.path,
            s = t.get(e.id).children;
          let r;
          void 0 !== s &&
            s.length > 0 &&
            void 0 !== n[s[0].ID] &&
            ((i = n[s[0].ID]),
            (0 !== i.indexOf("blob:") && 0 !== i.indexOf("data:")) ||
              this.textureLoader.setPath(void 0));
          const a = e.FileName.slice(-3).toLowerCase();
          if ("tga" === a) {
            const t = this.manager.getHandler(".tga");
            null === t
              ? (console.warn(
                  "FBXLoader: TGA loader not found, creating placeholder texture for",
                  e.RelativeFilename
                ),
                (r = new THRDev3.Texture()))
              : (t.setPath(this.textureLoader.path), (r = t.load(i)));
          } else
            "psd" === a
              ? (console.warn(
                  "FBXLoader: PSD textures are not supported, creating placeholder texture for",
                  e.RelativeFilename
                ),
                (r = new THRDev3.Texture()))
              : (r = this.textureLoader.load(i));
          return this.textureLoader.setPath(o), r;
        }
        parseMaterials(t) {
          const n = new Map();
          if ("Material" in e.Objects) {
            const i = e.Objects.Material;
            for (const e in i) {
              const o = this.parseMaterial(i[e], t);
              null !== o && n.set(parseInt(e), o);
            }
          }
          return n;
        }
        parseMaterial(e, n) {
          const i = e.id,
            o = e.attrName;
          let s = e.ShadingModel;
          if (("object" == typeof s && (s = s.value), !t.has(i))) return null;
          const r = this.parseParameters(e, n, i);
          let a;
          switch (s.toLowerCase()) {
            case "phong":
              a = new THRDev3.MeshPhongMaterial();
              break;
            case "lambert":
              a = new THRDev3.MeshLambertMaterial();
              break;
            default:
              console.warn(
                'THRDev3.FBXLoader: unknown material type "%s". Defaulting to THRDev3.MeshPhongMaterial.',
                s
              ),
                (a = new THRDev3.MeshPhongMaterial());
          }
          return a.setValues(r), (a.name = o), a;
        }
        parseParameters(e, n, i) {
          const o = {};
          e.BumpFactor && (o.bumpScale = e.BumpFactor.value),
            e.Diffuse
              ? (o.color = new THRDev3.Color().fromArray(e.Diffuse.value))
              : !e.DiffuseColor ||
                ("Color" !== e.DiffuseColor.type &&
                  "ColorRGB" !== e.DiffuseColor.type) ||
                (o.color = new THRDev3.Color().fromArray(e.DiffuseColor.value)),
            e.DisplacementFactor &&
              (o.displacementScale = e.DisplacementFactor.value),
            e.Emissive
              ? (o.emissive = new THRDev3.Color().fromArray(e.Emissive.value))
              : !e.EmissiveColor ||
                ("Color" !== e.EmissiveColor.type &&
                  "ColorRGB" !== e.EmissiveColor.type) ||
                (o.emissive = new THRDev3.Color().fromArray(
                  e.EmissiveColor.value
                )),
            e.EmissiveFactor &&
              (o.emissiveIntensity = parseFloat(e.EmissiveFactor.value)),
            e.Opacity && (o.opacity = parseFloat(e.Opacity.value)),
            o.opacity < 1 && (o.transparent = !0),
            e.ReflectionFactor && (o.reflectivity = e.ReflectionFactor.value),
            e.Shininess && (o.shininess = e.Shininess.value),
            e.Specular
              ? (o.specular = new THRDev3.Color().fromArray(e.Specular.value))
              : e.SpecularColor &&
                "Color" === e.SpecularColor.type &&
                (o.specular = new THRDev3.Color().fromArray(
                  e.SpecularColor.value
                ));
          const s = this;
          return (
            t.get(i).children.forEach(function (e) {
              const t = e.relationship;
              switch (t) {
                case "Bump":
                  o.bumpMap = s.getTexture(n, e.ID);
                  break;
                case "Maya|TEX_ao_map":
                  o.aoMap = s.getTexture(n, e.ID);
                  break;
                case "DiffuseColor":
                case "Maya|TEX_color_map":
                  (o.map = s.getTexture(n, e.ID)),
                    void 0 !== o.map && (o.map.encoding = THRDev3.sRGBEncoding);
                  break;
                case "DisplacementColor":
                  o.displacementMap = s.getTexture(n, e.ID);
                  break;
                case "EmissiveColor":
                  (o.emissiveMap = s.getTexture(n, e.ID)),
                    void 0 !== o.emissiveMap &&
                      (o.emissiveMap.encoding = THRDev3.sRGBEncoding);
                  break;
                case "NormalMap":
                case "Maya|TEX_normal_map":
                  o.normalMap = s.getTexture(n, e.ID);
                  break;
                case "ReflectionColor":
                  (o.envMap = s.getTexture(n, e.ID)),
                    void 0 !== o.envMap &&
                      ((o.envMap.mapping =
                        THRDev3.EquirectangularReflectionMapping),
                      (o.envMap.encoding = THRDev3.sRGBEncoding));
                  break;
                case "SpecularColor":
                  (o.specularMap = s.getTexture(n, e.ID)),
                    void 0 !== o.specularMap &&
                      (o.specularMap.encoding = THRDev3.sRGBEncoding);
                  break;
                case "TransparentColor":
                case "TransparencyFactor":
                  (o.alphaMap = s.getTexture(n, e.ID)), (o.transparent = !0);
                  break;
                case "AmbientColor":
                case "ShininessExponent":
                case "SpecularFactor":
                case "VectorDisplacementColor":
                default:
                  console.warn(
                    "THRDev3.FBXLoader: %s map is not supported in three.js, skipping texture.",
                    t
                  );
              }
            }),
            o
          );
        }
        getTexture(n, i) {
          return (
            "LayeredTexture" in e.Objects &&
              i in e.Objects.LayeredTexture &&
              (console.warn(
                "THRDev3.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."
              ),
              (i = t.get(i).children[0].ID)),
            n.get(i)
          );
        }
        parseDeformers() {
          const n = {},
            i = {};
          if ("Deformer" in e.Objects) {
            const o = e.Objects.Deformer;
            for (const e in o) {
              const s = o[e],
                r = t.get(parseInt(e));
              if ("Skin" === s.attrType) {
                const t = this.parseSkeleton(r, o);
                (t.ID = e),
                  r.parents.length > 1 &&
                    console.warn(
                      "THRDev3.FBXLoader: skeleton attached to more than one geometry is not supported."
                    ),
                  (t.geometryID = r.parents[0].ID),
                  (n[e] = t);
              } else if ("BlendShape" === s.attrType) {
                const t = { id: e };
                (t.rawTargets = this.parseMorphTargets(r, o)),
                  (t.id = e),
                  r.parents.length > 1 &&
                    console.warn(
                      "THRDev3.FBXLoader: morph target attached to more than one geometry is not supported."
                    ),
                  (i[e] = t);
              }
            }
          }
          return { skeletons: n, morphTargets: i };
        }
        parseSkeleton(e, t) {
          const n = [];
          return (
            e.children.forEach(function (e) {
              const i = t[e.ID];
              if ("Cluster" !== i.attrType) return;
              const o = {
                ID: e.ID,
                indices: [],
                weights: [],
                transformLink: new THRDev3.Matrix4().fromArray(
                  i.TransformLink.a
                ),
              };
              "Indexes" in i &&
                ((o.indices = i.Indexes.a), (o.weights = i.Weights.a)),
                n.push(o);
            }),
            { rawBones: n, bones: [] }
          );
        }
        parseMorphTargets(e, n) {
          const i = [];
          for (let o = 0; o < e.children.length; o++) {
            const s = e.children[o],
              r = n[s.ID],
              a = {
                name: r.attrName,
                initialWeight: r.DeformPercent,
                id: r.id,
                fullWeights: r.FullWeights.a,
              };
            if ("BlendShapeChannel" !== r.attrType) return;
            (a.geoID = t.get(parseInt(s.ID)).children.filter(function (e) {
              return void 0 === e.relationship;
            })[0].ID),
              i.push(a);
          }
          return i;
        }
        parseScene(i, o, s) {
          n = new THRDev3.Group();
          const a = this.parseModels(i.skeletons, o, s),
            l = e.Objects.Model,
            c = this;
          a.forEach(function (e) {
            const i = l[e.ID];
            c.setLookAtProperties(e, i);
            t.get(e.ID).parents.forEach(function (t) {
              const n = a.get(t.ID);
              void 0 !== n && n.add(e);
            }),
              null === e.parent && n.add(e);
          }),
            this.bindSkeleton(i.skeletons, o, a),
            this.createAmbientLight(),
            n.traverse(function (e) {
              if (e.userData.transformData) {
                e.parent &&
                  ((e.userData.transformData.parentMatrix = e.parent.matrix),
                  (e.userData.transformData.parentMatrixWorld =
                    e.parent.matrixWorld));
                const t = v(e.userData.transformData);
                e.applyMatrix4(t), e.updateWorldMatrix();
              }
            });
          const h = new r().parse();
          1 === n.children.length &&
            n.children[0].isGroup &&
            ((n.children[0].animations = h), (n = n.children[0])),
            (n.animations = h);
        }
        parseModels(n, i, o) {
          const s = new Map(),
            r = e.Objects.Model;
          for (const e in r) {
            const a = parseInt(e),
              l = r[e],
              c = t.get(a);
            let h = this.buildSkeleton(c, n, a, l.attrName);
            if (!h) {
              switch (l.attrType) {
                case "Camera":
                  h = this.createCamera(c);
                  break;
                case "Light":
                  h = this.createLight(c);
                  break;
                case "Mesh":
                  h = this.createMesh(c, i, o);
                  break;
                case "NurbsCurve":
                  h = this.createCurve(c, i);
                  break;
                case "LimbNode":
                case "Root":
                  h = new THRDev3.Bone();
                  break;
                case "Null":
                default:
                  h = new THRDev3.Group();
              }
              (h.name = l.attrName
                ? THRDev3.PropertyBinding.sanitizeNodeName(l.attrName)
                : ""),
                (h.ID = a);
            }
            this.getTransformData(h, l), s.set(a, h);
          }
          return s;
        }
        buildSkeleton(e, t, n, i) {
          let o = null;
          return (
            e.parents.forEach(function (e) {
              for (const s in t) {
                const r = t[s];
                r.rawBones.forEach(function (t, s) {
                  if (t.ID === e.ID) {
                    const e = o;
                    (o = new THRDev3.Bone()),
                      o.matrixWorld.copy(t.transformLink),
                      (o.name = i
                        ? THRDev3.PropertyBinding.sanitizeNodeName(i)
                        : ""),
                      (o.ID = n),
                      (r.bones[s] = o),
                      null !== e && o.add(e);
                  }
                });
              }
            }),
            o
          );
        }
        createCamera(t) {
          let n, i;
          if (
            (t.children.forEach(function (t) {
              const n = e.Objects.NodeAttribute[t.ID];
              void 0 !== n && (i = n);
            }),
            void 0 === i)
          )
            n = new THRDev3.Object3D();
          else {
            let e = 0;
            void 0 !== i.CameraProjectionType &&
              1 === i.CameraProjectionType.value &&
              (e = 1);
            let t = 1;
            void 0 !== i.NearPlane && (t = i.NearPlane.value / 1e3);
            let o = 1e3;
            void 0 !== i.FarPlane && (o = i.FarPlane.value / 1e3);
            let s = window.innerWidth,
              r = window.innerHeight;
            void 0 !== i.AspectWidth &&
              void 0 !== i.AspectHeight &&
              ((s = i.AspectWidth.value), (r = i.AspectHeight.value));
            const a = s / r;
            let l = 45;
            void 0 !== i.FieldOfView && (l = i.FieldOfView.value);
            const c = i.FocalLength ? i.FocalLength.value : null;
            switch (e) {
              case 0:
                (n = new THRDev3.PerspectiveCamera(l, a, t, o)),
                  null !== c && n.setFocalLength(c);
                break;
              case 1:
                n = new THRDev3.OrthographicCamera(
                  -s / 2,
                  s / 2,
                  r / 2,
                  -r / 2,
                  t,
                  o
                );
                break;
              default:
                console.warn(
                  "THRDev3.FBXLoader: Unknown camera type " + e + "."
                ),
                  (n = new THRDev3.Object3D());
            }
          }
          return n;
        }
        createLight(t) {
          let n, i;
          if (
            (t.children.forEach(function (t) {
              const n = e.Objects.NodeAttribute[t.ID];
              void 0 !== n && (i = n);
            }),
            void 0 === i)
          )
            n = new THRDev3.Object3D();
          else {
            let e;
            e = void 0 === i.LightType ? 0 : i.LightType.value;
            let t = 16777215;
            void 0 !== i.Color &&
              (t = new THRDev3.Color().fromArray(i.Color.value));
            let o = void 0 === i.Intensity ? 1 : i.Intensity.value / 100;
            void 0 !== i.CastLightOnObject &&
              0 === i.CastLightOnObject.value &&
              (o = 0);
            let s = 0;
            void 0 !== i.FarAttenuationEnd &&
              (s =
                void 0 !== i.EnableFarAttenuation &&
                0 === i.EnableFarAttenuation.value
                  ? 0
                  : i.FarAttenuationEnd.value);
            const r = 1;
            switch (e) {
              case 0:
                n = new THRDev3.PointLight(t, o, s, r);
                break;
              case 1:
                n = new THRDev3.DirectionalLight(t, o);
                break;
              case 2:
                let e = Math.PI / 3;
                void 0 !== i.InnerAngle &&
                  (e = THRDev3.MathUtils.degToRad(i.InnerAngle.value));
                let a = 0;
                void 0 !== i.OuterAngle &&
                  ((a = THRDev3.MathUtils.degToRad(i.OuterAngle.value)),
                  (a = Math.max(a, 1))),
                  (n = new THRDev3.SpotLight(t, o, s, e, a, r));
                break;
              default:
                console.warn(
                  "THRDev3.FBXLoader: Unknown light type " +
                    i.LightType.value +
                    ", defaulting to a THRDev3.PointLight."
                ),
                  (n = new THRDev3.PointLight(t, o));
            }
            void 0 !== i.CastShadows &&
              1 === i.CastShadows.value &&
              (n.castShadow = !0);
          }
          return n;
        }
        createMesh(e, t, n) {
          let i,
            o = null,
            s = null;
          const r = [];
          return (
            e.children.forEach(function (e) {
              t.has(e.ID) && (o = t.get(e.ID)),
                n.has(e.ID) && r.push(n.get(e.ID));
            }),
            r.length > 1
              ? (s = r)
              : r.length > 0
              ? (s = r[0])
              : ((s = new THRDev3.MeshPhongMaterial({ color: 13421772 })),
                r.push(s)),
            "color" in o.attributes &&
              r.forEach(function (e) {
                e.vertexColors = !0;
              }),
            o.FBX_Deformer
              ? ((i = new THRDev3.SkinnedMesh(o, s)), i.normalizeSkinWeights())
              : (i = new THRDev3.Mesh(o, s)),
            i
          );
        }
        createCurve(e, t) {
          const n = e.children.reduce(function (e, n) {
              return t.has(n.ID) && (e = t.get(n.ID)), e;
            }, null),
            i = new THRDev3.LineBasicMaterial({ color: 3342591, linewidth: 1 });
          return new THRDev3.Line(n, i);
        }
        getTransformData(e, t) {
          const n = {};
          "InheritType" in t && (n.inheritType = parseInt(t.InheritType.value)),
            (n.eulerOrder =
              "RotationOrder" in t ? y(t.RotationOrder.value) : "ZYX"),
            "Lcl_Translation" in t && (n.translation = t.Lcl_Translation.value),
            "PreRotation" in t && (n.preRotation = t.PreRotation.value),
            "Lcl_Rotation" in t && (n.rotation = t.Lcl_Rotation.value),
            "PostRotation" in t && (n.postRotation = t.PostRotation.value),
            "Lcl_Scaling" in t && (n.scale = t.Lcl_Scaling.value),
            "ScalingOffset" in t && (n.scalingOffset = t.ScalingOffset.value),
            "ScalingPivot" in t && (n.scalingPivot = t.ScalingPivot.value),
            "RotationOffset" in t &&
              (n.rotationOffset = t.RotationOffset.value),
            "RotationPivot" in t && (n.rotationPivot = t.RotationPivot.value),
            (e.userData.transformData = n);
        }
        setLookAtProperties(i, o) {
          if ("LookAtProperty" in o) {
            t.get(i.ID).children.forEach(function (t) {
              if ("LookAtProperty" === t.relationship) {
                const o = e.Objects.Model[t.ID];
                if ("Lcl_Translation" in o) {
                  const e = o.Lcl_Translation.value;
                  void 0 !== i.target
                    ? (i.target.position.fromArray(e), n.add(i.target))
                    : i.lookAt(new THRDev3.Vector3().fromArray(e));
                }
              }
            });
          }
        }
        bindSkeleton(e, n, i) {
          const o = this.parsePoseNodes();
          for (const s in e) {
            const r = e[s];
            t.get(parseInt(r.ID)).parents.forEach(function (e) {
              if (n.has(e.ID)) {
                const n = e.ID;
                t.get(n).parents.forEach(function (e) {
                  if (i.has(e.ID)) {
                    i.get(e.ID).bind(new THRDev3.Skeleton(r.bones), o[e.ID]);
                  }
                });
              }
            });
          }
        }
        parsePoseNodes() {
          const t = {};
          if ("Pose" in e.Objects) {
            const n = e.Objects.Pose;
            for (const e in n)
              if ("BindPose" === n[e].attrType && n[e].NbPoseNodes > 0) {
                const i = n[e].PoseNode;
                Array.isArray(i)
                  ? i.forEach(function (e) {
                      t[e.Node] = new THRDev3.Matrix4().fromArray(e.Matrix.a);
                    })
                  : (t[i.Node] = new THRDev3.Matrix4().fromArray(i.Matrix.a));
              }
          }
          return t;
        }
        createAmbientLight() {
          if ("GlobalSettings" in e && "AmbientColor" in e.GlobalSettings) {
            const t = e.GlobalSettings.AmbientColor.value,
              i = t[0],
              o = t[1],
              s = t[2];
            if (0 !== i || 0 !== o || 0 !== s) {
              const e = new THRDev3.Color(i, o, s);
              n.add(new THRDev3.AmbientLight(e, 1));
            }
          }
        }
      }
      class s {
        parse(n) {
          const i = new Map();
          if ("Geometry" in e.Objects) {
            const o = e.Objects.Geometry;
            for (const e in o) {
              const s = t.get(parseInt(e)),
                r = this.parseGeometry(s, o[e], n);
              i.set(parseInt(e), r);
            }
          }
          return i;
        }
        parseGeometry(e, t, n) {
          switch (t.attrType) {
            case "Mesh":
              return this.parseMeshGeometry(e, t, n);
            case "NurbsCurve":
              return this.parseNurbsGeometry(t);
          }
        }
        parseMeshGeometry(t, n, i) {
          const o = i.skeletons,
            s = [],
            r = t.parents.map(function (t) {
              return e.Objects.Model[t.ID];
            });
          if (0 === r.length) return;
          const a = t.children.reduce(function (e, t) {
            return void 0 !== o[t.ID] && (e = o[t.ID]), e;
          }, null);
          t.children.forEach(function (e) {
            void 0 !== i.morphTargets[e.ID] && s.push(i.morphTargets[e.ID]);
          });
          const l = r[0],
            c = {};
          "RotationOrder" in l && (c.eulerOrder = y(l.RotationOrder.value)),
            "InheritType" in l &&
              (c.inheritType = parseInt(l.InheritType.value)),
            "GeometricTranslation" in l &&
              (c.translation = l.GeometricTranslation.value),
            "GeometricRotation" in l &&
              (c.rotation = l.GeometricRotation.value),
            "GeometricScaling" in l && (c.scale = l.GeometricScaling.value);
          const h = v(c);
          return this.genGeometry(n, a, s, h);
        }
        genGeometry(e, t, n, i) {
          const o = new THRDev3.BufferGeometry();
          e.attrName && (o.name = e.attrName);
          const s = this.parseGeoNode(e, t),
            r = this.genBuffers(s),
            a = new THRDev3.Float32BufferAttribute(r.vertex, 3);
          if (
            (a.applyMatrix4(i),
            o.setAttribute("position", a),
            r.colors.length > 0 &&
              o.setAttribute(
                "color",
                new THRDev3.Float32BufferAttribute(r.colors, 3)
              ),
            t &&
              (o.setAttribute(
                "skinIndex",
                new THRDev3.Uint16BufferAttribute(r.weightsIndices, 4)
              ),
              o.setAttribute(
                "skinWeight",
                new THRDev3.Float32BufferAttribute(r.vertexWeights, 4)
              ),
              (o.FBX_Deformer = t)),
            r.normal.length > 0)
          ) {
            const e = new THRDev3.Matrix3().getNormalMatrix(i),
              t = new THRDev3.Float32BufferAttribute(r.normal, 3);
            t.applyNormalMatrix(e), o.setAttribute("normal", t);
          }
          if (
            (r.uvs.forEach(function (e, t) {
              let n = "uv" + (t + 1).toString();
              0 === t && (n = "uv"),
                o.setAttribute(
                  n,
                  new THRDev3.Float32BufferAttribute(r.uvs[t], 2)
                );
            }),
            s.material && "AllSame" !== s.material.mappingType)
          ) {
            let e = r.materialIndex[0],
              t = 0;
            if (
              (r.materialIndex.forEach(function (n, i) {
                n !== e && (o.addGroup(t, i - t, e), (e = n), (t = i));
              }),
              o.groups.length > 0)
            ) {
              const t = o.groups[o.groups.length - 1],
                n = t.start + t.count;
              n !== r.materialIndex.length &&
                o.addGroup(n, r.materialIndex.length - n, e);
            }
            0 === o.groups.length &&
              o.addGroup(0, r.materialIndex.length, r.materialIndex[0]);
          }
          return this.addMorphTargets(o, e, n, i), o;
        }
        parseGeoNode(e, t) {
          const n = {};
          if (
            ((n.vertexPositions = void 0 !== e.Vertices ? e.Vertices.a : []),
            (n.vertexIndices =
              void 0 !== e.PolygonVertexIndex ? e.PolygonVertexIndex.a : []),
            e.LayerElementColor &&
              (n.color = this.parseVertexColors(e.LayerElementColor[0])),
            e.LayerElementMaterial &&
              (n.material = this.parseMaterialIndices(
                e.LayerElementMaterial[0]
              )),
            e.LayerElementNormal &&
              (n.normal = this.parseNormals(e.LayerElementNormal[0])),
            e.LayerElementUV)
          ) {
            n.uv = [];
            let t = 0;
            for (; e.LayerElementUV[t]; )
              e.LayerElementUV[t].UV &&
                n.uv.push(this.parseUVs(e.LayerElementUV[t])),
                t++;
          }
          return (
            (n.weightTable = {}),
            null !== t &&
              ((n.skeleton = t),
              t.rawBones.forEach(function (e, t) {
                e.indices.forEach(function (i, o) {
                  void 0 === n.weightTable[i] && (n.weightTable[i] = []),
                    n.weightTable[i].push({ id: t, weight: e.weights[o] });
                });
              })),
            n
          );
        }
        genBuffers(e) {
          const t = {
            vertex: [],
            normal: [],
            colors: [],
            uvs: [],
            materialIndex: [],
            vertexWeights: [],
            weightsIndices: [],
          };
          let n = 0,
            i = 0,
            o = !1,
            s = [],
            r = [],
            a = [],
            l = [],
            c = [],
            h = [];
          const u = this;
          return (
            e.vertexIndices.forEach(function (d, p) {
              let m,
                g = !1;
              d < 0 && ((d ^= -1), (g = !0));
              let v = [],
                y = [];
              if ((s.push(3 * d, 3 * d + 1, 3 * d + 2), e.color)) {
                const t = f(p, n, d, e.color);
                a.push(t[0], t[1], t[2]);
              }
              if (e.skeleton) {
                if (
                  (void 0 !== e.weightTable[d] &&
                    e.weightTable[d].forEach(function (e) {
                      y.push(e.weight), v.push(e.id);
                    }),
                  y.length > 4)
                ) {
                  o ||
                    (console.warn(
                      "THRDev3.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."
                    ),
                    (o = !0));
                  const e = [0, 0, 0, 0],
                    t = [0, 0, 0, 0];
                  y.forEach(function (n, i) {
                    let o = n,
                      s = v[i];
                    t.forEach(function (t, n, i) {
                      if (o > t) {
                        (i[n] = o), (o = t);
                        const r = e[n];
                        (e[n] = s), (s = r);
                      }
                    });
                  }),
                    (v = e),
                    (y = t);
                }
                for (; y.length < 4; ) y.push(0), v.push(0);
                for (let e = 0; e < 4; ++e) c.push(y[e]), h.push(v[e]);
              }
              if (e.normal) {
                const t = f(p, n, d, e.normal);
                r.push(t[0], t[1], t[2]);
              }
              e.material &&
                "AllSame" !== e.material.mappingType &&
                (m = f(p, n, d, e.material)[0]),
                e.uv &&
                  e.uv.forEach(function (e, t) {
                    const i = f(p, n, d, e);
                    void 0 === l[t] && (l[t] = []),
                      l[t].push(i[0]),
                      l[t].push(i[1]);
                  }),
                i++,
                g &&
                  (u.genFace(t, e, s, m, r, a, l, c, h, i),
                  n++,
                  (i = 0),
                  (s = []),
                  (r = []),
                  (a = []),
                  (l = []),
                  (c = []),
                  (h = []));
            }),
            t
          );
        }
        genFace(e, t, n, i, o, s, r, a, l, c) {
          for (let h = 2; h < c; h++)
            e.vertex.push(t.vertexPositions[n[0]]),
              e.vertex.push(t.vertexPositions[n[1]]),
              e.vertex.push(t.vertexPositions[n[2]]),
              e.vertex.push(t.vertexPositions[n[3 * (h - 1)]]),
              e.vertex.push(t.vertexPositions[n[3 * (h - 1) + 1]]),
              e.vertex.push(t.vertexPositions[n[3 * (h - 1) + 2]]),
              e.vertex.push(t.vertexPositions[n[3 * h]]),
              e.vertex.push(t.vertexPositions[n[3 * h + 1]]),
              e.vertex.push(t.vertexPositions[n[3 * h + 2]]),
              t.skeleton &&
                (e.vertexWeights.push(a[0]),
                e.vertexWeights.push(a[1]),
                e.vertexWeights.push(a[2]),
                e.vertexWeights.push(a[3]),
                e.vertexWeights.push(a[4 * (h - 1)]),
                e.vertexWeights.push(a[4 * (h - 1) + 1]),
                e.vertexWeights.push(a[4 * (h - 1) + 2]),
                e.vertexWeights.push(a[4 * (h - 1) + 3]),
                e.vertexWeights.push(a[4 * h]),
                e.vertexWeights.push(a[4 * h + 1]),
                e.vertexWeights.push(a[4 * h + 2]),
                e.vertexWeights.push(a[4 * h + 3]),
                e.weightsIndices.push(l[0]),
                e.weightsIndices.push(l[1]),
                e.weightsIndices.push(l[2]),
                e.weightsIndices.push(l[3]),
                e.weightsIndices.push(l[4 * (h - 1)]),
                e.weightsIndices.push(l[4 * (h - 1) + 1]),
                e.weightsIndices.push(l[4 * (h - 1) + 2]),
                e.weightsIndices.push(l[4 * (h - 1) + 3]),
                e.weightsIndices.push(l[4 * h]),
                e.weightsIndices.push(l[4 * h + 1]),
                e.weightsIndices.push(l[4 * h + 2]),
                e.weightsIndices.push(l[4 * h + 3])),
              t.color &&
                (e.colors.push(s[0]),
                e.colors.push(s[1]),
                e.colors.push(s[2]),
                e.colors.push(s[3 * (h - 1)]),
                e.colors.push(s[3 * (h - 1) + 1]),
                e.colors.push(s[3 * (h - 1) + 2]),
                e.colors.push(s[3 * h]),
                e.colors.push(s[3 * h + 1]),
                e.colors.push(s[3 * h + 2])),
              t.material &&
                "AllSame" !== t.material.mappingType &&
                (e.materialIndex.push(i),
                e.materialIndex.push(i),
                e.materialIndex.push(i)),
              t.normal &&
                (e.normal.push(o[0]),
                e.normal.push(o[1]),
                e.normal.push(o[2]),
                e.normal.push(o[3 * (h - 1)]),
                e.normal.push(o[3 * (h - 1) + 1]),
                e.normal.push(o[3 * (h - 1) + 2]),
                e.normal.push(o[3 * h]),
                e.normal.push(o[3 * h + 1]),
                e.normal.push(o[3 * h + 2])),
              t.uv &&
                t.uv.forEach(function (t, n) {
                  void 0 === e.uvs[n] && (e.uvs[n] = []),
                    e.uvs[n].push(r[n][0]),
                    e.uvs[n].push(r[n][1]),
                    e.uvs[n].push(r[n][2 * (h - 1)]),
                    e.uvs[n].push(r[n][2 * (h - 1) + 1]),
                    e.uvs[n].push(r[n][2 * h]),
                    e.uvs[n].push(r[n][2 * h + 1]);
                });
        }
        addMorphTargets(t, n, i, o) {
          if (0 === i.length) return;
          (t.morphTargetsRelative = !0), (t.morphAttributes.position = []);
          const s = this;
          i.forEach(function (i) {
            i.rawTargets.forEach(function (i) {
              const r = e.Objects.Geometry[i.geoID];
              void 0 !== r && s.genMorphGeometry(t, n, r, o, i.name);
            });
          });
        }
        genMorphGeometry(e, t, n, i, o) {
          const s =
              void 0 !== t.PolygonVertexIndex ? t.PolygonVertexIndex.a : [],
            r = void 0 !== n.Vertices ? n.Vertices.a : [],
            a = void 0 !== n.Indexes ? n.Indexes.a : [],
            l = 3 * e.attributes.position.count,
            c = new Float32Array(l);
          for (let e = 0; e < a.length; e++) {
            const t = 3 * a[e];
            (c[t] = r[3 * e]),
              (c[t + 1] = r[3 * e + 1]),
              (c[t + 2] = r[3 * e + 2]);
          }
          const h = { vertexIndices: s, vertexPositions: c },
            u = this.genBuffers(h),
            d = new THRDev3.Float32BufferAttribute(u.vertex, 3);
          (d.name = o || n.attrName),
            d.applyMatrix4(i),
            e.morphAttributes.position.push(d);
        }
        parseNormals(e) {
          const t = e.MappingInformationType,
            n = e.ReferenceInformationType,
            i = e.Normals.a;
          let o = [];
          return (
            "IndexToDirect" === n &&
              ("NormalIndex" in e
                ? (o = e.NormalIndex.a)
                : "NormalsIndex" in e && (o = e.NormalsIndex.a)),
            {
              dataSize: 3,
              buffer: i,
              indices: o,
              mappingType: t,
              referenceType: n,
            }
          );
        }
        parseUVs(e) {
          const t = e.MappingInformationType,
            n = e.ReferenceInformationType,
            i = e.UV.a;
          let o = [];
          return (
            "IndexToDirect" === n && (o = e.UVIndex.a),
            {
              dataSize: 2,
              buffer: i,
              indices: o,
              mappingType: t,
              referenceType: n,
            }
          );
        }
        parseVertexColors(e) {
          const t = e.MappingInformationType,
            n = e.ReferenceInformationType,
            i = e.Colors.a;
          let o = [];
          return (
            "IndexToDirect" === n && (o = e.ColorIndex.a),
            {
              dataSize: 4,
              buffer: i,
              indices: o,
              mappingType: t,
              referenceType: n,
            }
          );
        }
        parseMaterialIndices(e) {
          const t = e.MappingInformationType,
            n = e.ReferenceInformationType;
          if ("NoMappingInformation" === t)
            return {
              dataSize: 1,
              buffer: [0],
              indices: [0],
              mappingType: "AllSame",
              referenceType: n,
            };
          const i = e.Materials.a,
            o = [];
          for (let e = 0; e < i.length; ++e) o.push(e);
          return {
            dataSize: 1,
            buffer: i,
            indices: o,
            mappingType: t,
            referenceType: n,
          };
        }
        parseNurbsGeometry(e) {
          if (void 0 === THRDev3.NURBSCurve)
            return (
              console.error(
                "THRDev3.FBXLoader: The loader relies on THRDev3.NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."
              ),
              new THRDev3.BufferGeometry()
            );
          const t = parseInt(e.Order);
          if (isNaN(t))
            return (
              console.error(
                "THRDev3.FBXLoader: Invalid Order %s given for geometry ID: %s",
                e.Order,
                e.id
              ),
              new THRDev3.BufferGeometry()
            );
          const n = t - 1,
            i = e.KnotVector.a,
            o = [],
            s = e.Points.a;
          for (let e = 0, t = s.length; e < t; e += 4)
            o.push(new THRDev3.Vector4().fromArray(s, e));
          let r, a;
          if ("Closed" === e.Form) o.push(o[0]);
          else if ("Periodic" === e.Form) {
            (r = n), (a = i.length - 1 - r);
            for (let e = 0; e < n; ++e) o.push(o[e]);
          }
          const l = new THRDev3.NURBSCurve(n, i, o, r, a).getPoints(
            12 * o.length
          );
          return new THRDev3.BufferGeometry().setFromPoints(l);
        }
      }
      class r {
        parse() {
          const e = [],
            t = this.parseClips();
          if (void 0 !== t)
            for (const n in t) {
              const i = t[n],
                o = this.addClip(i);
              e.push(o);
            }
          return e;
        }
        parseClips() {
          if (void 0 === e.Objects.AnimationCurve) return;
          const t = this.parseAnimationCurveNodes();
          this.parseAnimationCurves(t);
          const n = this.parseAnimationLayers(t);
          return this.parseAnimStacks(n);
        }
        parseAnimationCurveNodes() {
          const t = e.Objects.AnimationCurveNode,
            n = new Map();
          for (const e in t) {
            const i = t[e];
            if (null !== i.attrName.match(/S|R|T|DeformPercent/)) {
              const e = { id: i.id, attr: i.attrName, curves: {} };
              n.set(e.id, e);
            }
          }
          return n;
        }
        parseAnimationCurves(n) {
          const i = e.Objects.AnimationCurve;
          for (const e in i) {
            const o = {
                id: i[e].id,
                times: i[e].KeyTime.a.map(d),
                values: i[e].KeyValueFloat.a,
              },
              s = t.get(o.id);
            if (void 0 !== s) {
              const e = s.parents[0].ID,
                t = s.parents[0].relationship;
              t.match(/X/)
                ? (n.get(e).curves.x = o)
                : t.match(/Y/)
                ? (n.get(e).curves.y = o)
                : t.match(/Z/)
                ? (n.get(e).curves.z = o)
                : t.match(/d|DeformPercent/) &&
                  n.has(e) &&
                  (n.get(e).curves.morph = o);
            }
          }
        }
        parseAnimationLayers(i) {
          const o = e.Objects.AnimationLayer,
            s = new Map();
          for (const r in o) {
            const o = [],
              a = t.get(parseInt(r));
            if (void 0 !== a) {
              a.children.forEach(function (s, r) {
                if (i.has(s.ID)) {
                  const a = i.get(s.ID);
                  if (
                    void 0 !== a.curves.x ||
                    void 0 !== a.curves.y ||
                    void 0 !== a.curves.z
                  ) {
                    if (void 0 === o[r]) {
                      const i = t.get(s.ID).parents.filter(function (e) {
                        return void 0 !== e.relationship;
                      })[0].ID;
                      if (void 0 !== i) {
                        const t = e.Objects.Model[i.toString()];
                        if (void 0 === t)
                          return void console.warn(
                            "THRDev3.FBXLoader: Encountered a unused curve.",
                            s
                          );
                        const a = {
                          modelName: t.attrName
                            ? THRDev3.PropertyBinding.sanitizeNodeName(
                                t.attrName
                              )
                            : "",
                          ID: t.id,
                          initialPosition: [0, 0, 0],
                          initialRotation: [0, 0, 0],
                          initialScale: [1, 1, 1],
                        };
                        n.traverse(function (e) {
                          e.ID === t.id &&
                            ((a.transform = e.matrix),
                            e.userData.transformData &&
                              (a.eulerOrder =
                                e.userData.transformData.eulerOrder));
                        }),
                          a.transform || (a.transform = new THRDev3.Matrix4()),
                          "PreRotation" in t &&
                            (a.preRotation = t.PreRotation.value),
                          "PostRotation" in t &&
                            (a.postRotation = t.PostRotation.value),
                          (o[r] = a);
                      }
                    }
                    o[r] && (o[r][a.attr] = a);
                  } else if (void 0 !== a.curves.morph) {
                    if (void 0 === o[r]) {
                      const n = t.get(s.ID).parents.filter(function (e) {
                          return void 0 !== e.relationship;
                        })[0].ID,
                        i = t.get(n).parents[0].ID,
                        a = t.get(i).parents[0].ID,
                        l = t.get(a).parents[0].ID,
                        c = e.Objects.Model[l],
                        h = {
                          modelName: c.attrName
                            ? THRDev3.PropertyBinding.sanitizeNodeName(
                                c.attrName
                              )
                            : "",
                          morphName: e.Objects.Deformer[n].attrName,
                        };
                      o[r] = h;
                    }
                    o[r][a.attr] = a;
                  }
                }
              }),
                s.set(parseInt(r), o);
            }
          }
          return s;
        }
        parseAnimStacks(n) {
          const i = e.Objects.AnimationStack,
            o = {};
          for (const e in i) {
            const s = t.get(parseInt(e)).children;
            s.length > 1 &&
              console.warn(
                "THRDev3.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."
              );
            const r = n.get(s[0].ID);
            o[e] = { name: i[e].attrName, layer: r };
          }
          return o;
        }
        addClip(e) {
          let t = [];
          const n = this;
          return (
            e.layer.forEach(function (e) {
              t = t.concat(n.generateTracks(e));
            }),
            new THRDev3.AnimationClip(e.name, -1, t)
          );
        }
        generateTracks(e) {
          const t = [];
          let n = new THRDev3.Vector3(),
            i = new THRDev3.Quaternion(),
            o = new THRDev3.Vector3();
          if (
            (e.transform && e.transform.decompose(n, i, o),
            (n = n.toArray()),
            (i = new THRDev3.Euler()
              .setFromQuaternion(i, e.eulerOrder)
              .toArray()),
            (o = o.toArray()),
            void 0 !== e.T && Object.keys(e.T.curves).length > 0)
          ) {
            const i = this.generateVectorTrack(
              e.modelName,
              e.T.curves,
              n,
              "position"
            );
            void 0 !== i && t.push(i);
          }
          if (void 0 !== e.R && Object.keys(e.R.curves).length > 0) {
            const n = this.generateRotationTrack(
              e.modelName,
              e.R.curves,
              i,
              e.preRotation,
              e.postRotation,
              e.eulerOrder
            );
            void 0 !== n && t.push(n);
          }
          if (void 0 !== e.S && Object.keys(e.S.curves).length > 0) {
            const n = this.generateVectorTrack(
              e.modelName,
              e.S.curves,
              o,
              "scale"
            );
            void 0 !== n && t.push(n);
          }
          if (void 0 !== e.DeformPercent) {
            const n = this.generateMorphTrack(e);
            void 0 !== n && t.push(n);
          }
          return t;
        }
        generateVectorTrack(e, t, n, i) {
          const o = this.getTimesForAllAxes(t),
            s = this.getKeyframeTrackValues(o, t, n);
          return new THRDev3.VectorKeyframeTrack(e + "." + i, o, s);
        }
        generateRotationTrack(e, t, n, i, o, s) {
          void 0 !== t.x &&
            (this.interpolateRotations(t.x),
            (t.x.values = t.x.values.map(THRDev3.MathUtils.degToRad))),
            void 0 !== t.y &&
              (this.interpolateRotations(t.y),
              (t.y.values = t.y.values.map(THRDev3.MathUtils.degToRad))),
            void 0 !== t.z &&
              (this.interpolateRotations(t.z),
              (t.z.values = t.z.values.map(THRDev3.MathUtils.degToRad)));
          const r = this.getTimesForAllAxes(t),
            a = this.getKeyframeTrackValues(r, t, n);
          void 0 !== i &&
            ((i = i.map(THRDev3.MathUtils.degToRad)).push(s),
            (i = new THRDev3.Euler().fromArray(i)),
            (i = new THRDev3.Quaternion().setFromEuler(i))),
            void 0 !== o &&
              ((o = o.map(THRDev3.MathUtils.degToRad)).push(s),
              (o = new THRDev3.Euler().fromArray(o)),
              (o = new THRDev3.Quaternion().setFromEuler(o).invert()));
          const l = new THRDev3.Quaternion(),
            c = new THRDev3.Euler(),
            h = [];
          for (let e = 0; e < a.length; e += 3)
            c.set(a[e], a[e + 1], a[e + 2], s),
              l.setFromEuler(c),
              void 0 !== i && l.premultiply(i),
              void 0 !== o && l.multiply(o),
              l.toArray(h, (e / 3) * 4);
          return new THRDev3.QuaternionKeyframeTrack(e + ".quaternion", r, h);
        }
        generateMorphTrack(e) {
          const t = e.DeformPercent.curves.morph,
            i = t.values.map(function (e) {
              return e / 100;
            }),
            o = n.getObjectByName(e.modelName).morphTargetDictionary[
              e.morphName
            ];
          return new THRDev3.NumberKeyframeTrack(
            e.modelName + ".morphTargetInfluences[" + o + "]",
            t.times,
            i
          );
        }
        getTimesForAllAxes(e) {
          let t = [];
          if (
            (void 0 !== e.x && (t = t.concat(e.x.times)),
            void 0 !== e.y && (t = t.concat(e.y.times)),
            void 0 !== e.z && (t = t.concat(e.z.times)),
            (t = t.sort(function (e, t) {
              return e - t;
            })),
            t.length > 1)
          ) {
            let e = 1,
              n = t[0];
            for (let i = 1; i < t.length; i++) {
              const o = t[i];
              o !== n && ((t[e] = o), (n = o), e++);
            }
            t = t.slice(0, e);
          }
          return t;
        }
        getKeyframeTrackValues(e, t, n) {
          const i = n,
            o = [];
          let s = -1,
            r = -1,
            a = -1;
          return (
            e.forEach(function (e) {
              if (
                (t.x && (s = t.x.times.indexOf(e)),
                t.y && (r = t.y.times.indexOf(e)),
                t.z && (a = t.z.times.indexOf(e)),
                -1 !== s)
              ) {
                const e = t.x.values[s];
                o.push(e), (i[0] = e);
              } else o.push(i[0]);
              if (-1 !== r) {
                const e = t.y.values[r];
                o.push(e), (i[1] = e);
              } else o.push(i[1]);
              if (-1 !== a) {
                const e = t.z.values[a];
                o.push(e), (i[2] = e);
              } else o.push(i[2]);
            }),
            o
          );
        }
        interpolateRotations(e) {
          for (let t = 1; t < e.values.length; t++) {
            const n = e.values[t - 1],
              i = e.values[t] - n,
              o = Math.abs(i);
            if (o >= 180) {
              const s = o / 180,
                r = i / s;
              let a = n + r;
              const l = e.times[t - 1],
                c = (e.times[t] - l) / s;
              let h = l + c;
              const u = [],
                d = [];
              for (; h < e.times[t]; ) u.push(h), (h += c), d.push(a), (a += r);
              (e.times = w(e.times, t, u)), (e.values = w(e.values, t, d));
            }
          }
        }
      }
      class a {
        getPrevNode() {
          return this.nodeStack[this.currentIndent - 2];
        }
        getCurrentNode() {
          return this.nodeStack[this.currentIndent - 1];
        }
        getCurrentProp() {
          return this.currentProp;
        }
        pushStack(e) {
          this.nodeStack.push(e), (this.currentIndent += 1);
        }
        popStack() {
          this.nodeStack.pop(), (this.currentIndent -= 1);
        }
        setCurrentProp(e, t) {
          (this.currentProp = e), (this.currentPropName = t);
        }
        parse(e) {
          (this.currentIndent = 0),
            (this.allNodes = new h()),
            (this.nodeStack = []),
            (this.currentProp = []),
            (this.currentPropName = "");
          const t = this,
            n = e.split(/[\r\n]+/);
          return (
            n.forEach(function (e, i) {
              const o = e.match(/^[\s\t]*;/),
                s = e.match(/^[\s\t]*$/);
              if (o || s) return;
              const r = e.match(
                  "^\\t{" + t.currentIndent + "}(\\w+):(.*){",
                  ""
                ),
                a = e.match(
                  "^\\t{" + t.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"
                ),
                l = e.match("^\\t{" + (t.currentIndent - 1) + "}}");
              r
                ? t.parseNodeBegin(e, r)
                : a
                ? t.parseNodeProperty(e, a, n[++i])
                : l
                ? t.popStack()
                : e.match(/^[^\s\t}]/) && t.parseNodePropertyContinued(e);
            }),
            this.allNodes
          );
        }
        parseNodeBegin(e, t) {
          const n = t[1].trim().replace(/^"/, "").replace(/"$/, ""),
            i = t[2].split(",").map(function (e) {
              return e.trim().replace(/^"/, "").replace(/"$/, "");
            }),
            o = { name: n },
            s = this.parseNodeAttr(i),
            r = this.getCurrentNode();
          0 === this.currentIndent
            ? this.allNodes.add(n, o)
            : n in r
            ? ("PoseNode" === n
                ? r.PoseNode.push(o)
                : void 0 !== r[n].id && ((r[n] = {}), (r[n][r[n].id] = r[n])),
              "" !== s.id && (r[n][s.id] = o))
            : "number" == typeof s.id
            ? ((r[n] = {}), (r[n][s.id] = o))
            : "Properties70" !== n && (r[n] = "PoseNode" === n ? [o] : o),
            "number" == typeof s.id && (o.id = s.id),
            "" !== s.name && (o.attrName = s.name),
            "" !== s.type && (o.attrType = s.type),
            this.pushStack(o);
        }
        parseNodeAttr(e) {
          let t = e[0];
          "" !== e[0] && ((t = parseInt(e[0])), isNaN(t) && (t = e[0]));
          let n = "",
            i = "";
          return (
            e.length > 1 && ((n = e[1].replace(/^(\w+)::/, "")), (i = e[2])),
            { id: t, name: n, type: i }
          );
        }
        parseNodeProperty(e, t, n) {
          let i = t[1].replace(/^"/, "").replace(/"$/, "").trim(),
            o = t[2].replace(/^"/, "").replace(/"$/, "").trim();
          "Content" === i &&
            "," === o &&
            (o = n.replace(/"/g, "").replace(/,$/, "").trim());
          const s = this.getCurrentNode();
          if ("Properties70" !== s.name) {
            if ("C" === i) {
              const e = o.split(",").slice(1),
                t = parseInt(e[0]),
                n = parseInt(e[1]);
              let r = o.split(",").slice(3);
              (r = r.map(function (e) {
                return e.trim().replace(/^"/, "");
              })),
                (i = "connections"),
                (o = [t, n]),
                (function (e, t) {
                  for (let n = 0, i = e.length, o = t.length; n < o; n++, i++)
                    e[i] = t[n];
                })(o, r),
                void 0 === s[i] && (s[i] = []);
            }
            "Node" === i && (s.id = o),
              i in s && Array.isArray(s[i])
                ? s[i].push(o)
                : "a" !== i
                ? (s[i] = o)
                : (s.a = o),
              this.setCurrentProp(s, i),
              "a" === i && "," !== o.slice(-1) && (s.a = b(o));
          } else this.parseNodeSpecialProperty(e, i, o);
        }
        parseNodePropertyContinued(e) {
          const t = this.getCurrentNode();
          (t.a += e), "," !== e.slice(-1) && (t.a = b(t.a));
        }
        parseNodeSpecialProperty(e, t, n) {
          const i = n.split('",').map(function (e) {
              return e.trim().replace(/^\"/, "").replace(/\s/, "_");
            }),
            o = i[0],
            s = i[1],
            r = i[2],
            a = i[3];
          let l = i[4];
          switch (s) {
            case "int":
            case "enum":
            case "bool":
            case "ULongLong":
            case "double":
            case "Number":
            case "FieldOfView":
              l = parseFloat(l);
              break;
            case "Color":
            case "ColorRGB":
            case "Vector3D":
            case "Lcl_Translation":
            case "Lcl_Rotation":
            case "Lcl_Scaling":
              l = b(l);
          }
          (this.getPrevNode()[o] = { type: s, type2: r, flag: a, value: l }),
            this.setCurrentProp(this.getPrevNode(), o);
        }
      }
      class l {
        parse(e) {
          const t = new c(e);
          t.skip(23);
          const n = t.getUint32();
          if (n < 6400)
            throw new Error(
              "THRDev3.FBXLoader: FBX version not supported, FileVersion: " + n
            );
          const i = new h();
          for (; !this.endOfContent(t); ) {
            const e = this.parseNode(t, n);
            null !== e && i.add(e.name, e);
          }
          return i;
        }
        endOfContent(e) {
          return e.size() % 16 == 0
            ? ((e.getOffset() + 160 + 16) & -16) >= e.size()
            : e.getOffset() + 160 + 16 >= e.size();
        }
        parseNode(e, t) {
          const n = {},
            i = t >= 7500 ? e.getUint64() : e.getUint32(),
            o = t >= 7500 ? e.getUint64() : e.getUint32();
          t >= 7500 ? e.getUint64() : e.getUint32();
          const s = e.getUint8(),
            r = e.getString(s);
          if (0 === i) return null;
          const a = [];
          for (let t = 0; t < o; t++) a.push(this.parseProperty(e));
          const l = a.length > 0 ? a[0] : "",
            c = a.length > 1 ? a[1] : "",
            h = a.length > 2 ? a[2] : "";
          for (
            n.singleProperty = 1 === o && e.getOffset() === i;
            i > e.getOffset();

          ) {
            const i = this.parseNode(e, t);
            null !== i && this.parseSubNode(r, n, i);
          }
          return (
            (n.propertyList = a),
            "number" == typeof l && (n.id = l),
            "" !== c && (n.attrName = c),
            "" !== h && (n.attrType = h),
            "" !== r && (n.name = r),
            n
          );
        }
        parseSubNode(e, t, n) {
          if (!0 === n.singleProperty) {
            const e = n.propertyList[0];
            Array.isArray(e) ? ((t[n.name] = n), (n.a = e)) : (t[n.name] = e);
          } else if ("Connections" === e && "C" === n.name) {
            const e = [];
            n.propertyList.forEach(function (t, n) {
              0 !== n && e.push(t);
            }),
              void 0 === t.connections && (t.connections = []),
              t.connections.push(e);
          } else if ("Properties70" === n.name) {
            Object.keys(n).forEach(function (e) {
              t[e] = n[e];
            });
          } else if ("Properties70" === e && "P" === n.name) {
            let e = n.propertyList[0],
              i = n.propertyList[1];
            const o = n.propertyList[2],
              s = n.propertyList[3];
            let r;
            0 === e.indexOf("Lcl ") && (e = e.replace("Lcl ", "Lcl_")),
              0 === i.indexOf("Lcl ") && (i = i.replace("Lcl ", "Lcl_")),
              (r =
                "Color" === i ||
                "ColorRGB" === i ||
                "Vector" === i ||
                "Vector3D" === i ||
                0 === i.indexOf("Lcl_")
                  ? [n.propertyList[4], n.propertyList[5], n.propertyList[6]]
                  : n.propertyList[4]),
              (t[e] = { type: i, type2: o, flag: s, value: r });
          } else
            void 0 === t[n.name]
              ? "number" == typeof n.id
                ? ((t[n.name] = {}), (t[n.name][n.id] = n))
                : (t[n.name] = n)
              : "PoseNode" === n.name
              ? (Array.isArray(t[n.name]) || (t[n.name] = [t[n.name]]),
                t[n.name].push(n))
              : void 0 === t[n.name][n.id] && (t[n.name][n.id] = n);
        }
        parseProperty(e) {
          const t = e.getString(1);
          let n;
          switch (t) {
            case "C":
              return e.getBoolean();
            case "D":
              return e.getFloat64();
            case "F":
              return e.getFloat32();
            case "I":
              return e.getInt32();
            case "L":
              return e.getInt64();
            case "R":
              return (n = e.getUint32()), e.getArrayBuffer(n);
            case "S":
              return (n = e.getUint32()), e.getString(n);
            case "Y":
              return e.getInt16();
            case "b":
            case "c":
            case "d":
            case "f":
            case "i":
            case "l":
              const i = e.getUint32(),
                o = e.getUint32(),
                s = e.getUint32();
              if (0 === o)
                switch (t) {
                  case "b":
                  case "c":
                    return e.getBooleanArray(i);
                  case "d":
                    return e.getFloat64Array(i);
                  case "f":
                    return e.getFloat32Array(i);
                  case "i":
                    return e.getInt32Array(i);
                  case "l":
                    return e.getInt64Array(i);
                }
              "undefined" == typeof fflate &&
                console.error(
                  "THRDev3.FBXLoader: External library fflate.min.js required."
                );
              const r = fflate.unzlibSync(new Uint8Array(e.getArrayBuffer(s))),
                a = new c(r.buffer);
              switch (t) {
                case "b":
                case "c":
                  return a.getBooleanArray(i);
                case "d":
                  return a.getFloat64Array(i);
                case "f":
                  return a.getFloat32Array(i);
                case "i":
                  return a.getInt32Array(i);
                case "l":
                  return a.getInt64Array(i);
              }
              break;
            default:
              throw new Error("THRDev3.FBXLoader: Unknown property type " + t);
          }
        }
      }
      class c {
        constructor(e, t) {
          (this.dv = new DataView(e)),
            (this.offset = 0),
            (this.littleEndian = void 0 === t || t);
        }
        getOffset() {
          return this.offset;
        }
        size() {
          return this.dv.buffer.byteLength;
        }
        skip(e) {
          this.offset += e;
        }
        getBoolean() {
          return 1 == (1 & this.getUint8());
        }
        getBooleanArray(e) {
          const t = [];
          for (let n = 0; n < e; n++) t.push(this.getBoolean());
          return t;
        }
        getUint8() {
          const e = this.dv.getUint8(this.offset);
          return (this.offset += 1), e;
        }
        getInt16() {
          const e = this.dv.getInt16(this.offset, this.littleEndian);
          return (this.offset += 2), e;
        }
        getInt32() {
          const e = this.dv.getInt32(this.offset, this.littleEndian);
          return (this.offset += 4), e;
        }
        getInt32Array(e) {
          const t = [];
          for (let n = 0; n < e; n++) t.push(this.getInt32());
          return t;
        }
        getUint32() {
          const e = this.dv.getUint32(this.offset, this.littleEndian);
          return (this.offset += 4), e;
        }
        getInt64() {
          let e, t;
          return (
            this.littleEndian
              ? ((e = this.getUint32()), (t = this.getUint32()))
              : ((t = this.getUint32()), (e = this.getUint32())),
            2147483648 & t
              ? ((t = 4294967295 & ~t),
                (e = 4294967295 & ~e),
                4294967295 === e && (t = (t + 1) & 4294967295),
                (e = (e + 1) & 4294967295),
                -(4294967296 * t + e))
              : 4294967296 * t + e
          );
        }
        getInt64Array(e) {
          const t = [];
          for (let n = 0; n < e; n++) t.push(this.getInt64());
          return t;
        }
        getUint64() {
          let e, t;
          return (
            this.littleEndian
              ? ((e = this.getUint32()), (t = this.getUint32()))
              : ((t = this.getUint32()), (e = this.getUint32())),
            4294967296 * t + e
          );
        }
        getFloat32() {
          const e = this.dv.getFloat32(this.offset, this.littleEndian);
          return (this.offset += 4), e;
        }
        getFloat32Array(e) {
          const t = [];
          for (let n = 0; n < e; n++) t.push(this.getFloat32());
          return t;
        }
        getFloat64() {
          const e = this.dv.getFloat64(this.offset, this.littleEndian);
          return (this.offset += 8), e;
        }
        getFloat64Array(e) {
          const t = [];
          for (let n = 0; n < e; n++) t.push(this.getFloat64());
          return t;
        }
        getArrayBuffer(e) {
          const t = this.dv.buffer.slice(this.offset, this.offset + e);
          return (this.offset += e), t;
        }
        getString(e) {
          let t = [];
          for (let n = 0; n < e; n++) t[n] = this.getUint8();
          const n = t.indexOf(0);
          return (
            n >= 0 && (t = t.slice(0, n)),
            THRDev3.LoaderUtils.decodeText(new Uint8Array(t))
          );
        }
      }
      class h {
        add(e, t) {
          this[e] = t;
        }
      }
      function u(e) {
        const t = e.match(/FBXVersion: (\d+)/);
        if (t) {
          return parseInt(t[1]);
        }
        throw new Error(
          "THRDev3.FBXLoader: Cannot find the version number for the file given."
        );
      }
      function d(e) {
        return e / 46186158e3;
      }
      const p = [];
      function f(e, t, n, i) {
        let o;
        switch (i.mappingType) {
          case "ByPolygonVertex":
            o = e;
            break;
          case "ByPolygon":
            o = t;
            break;
          case "ByVertice":
            o = n;
            break;
          case "AllSame":
            o = i.indices[0];
            break;
          default:
            console.warn(
              "THRDev3.FBXLoader: unknown attribute mapping type " +
                i.mappingType
            );
        }
        "IndexToDirect" === i.referenceType && (o = i.indices[o]);
        const s = o * i.dataSize,
          r = s + i.dataSize;
        return (function (e, t, n, i) {
          for (let o = n, s = 0; o < i; o++, s++) e[s] = t[o];
          return e;
        })(p, i.buffer, s, r);
      }
      const m = new THRDev3.Euler(),
        g = new THRDev3.Vector3();
      function v(e) {
        const t = new THRDev3.Matrix4(),
          n = new THRDev3.Matrix4(),
          i = new THRDev3.Matrix4(),
          o = new THRDev3.Matrix4(),
          s = new THRDev3.Matrix4(),
          r = new THRDev3.Matrix4(),
          a = new THRDev3.Matrix4(),
          l = new THRDev3.Matrix4(),
          c = new THRDev3.Matrix4(),
          h = new THRDev3.Matrix4(),
          u = new THRDev3.Matrix4(),
          d = new THRDev3.Matrix4(),
          p = e.inheritType ? e.inheritType : 0;
        if (
          (e.translation && t.setPosition(g.fromArray(e.translation)),
          e.preRotation)
        ) {
          const t = e.preRotation.map(THRDev3.MathUtils.degToRad);
          t.push(e.eulerOrder), n.makeRotationFromEuler(m.fromArray(t));
        }
        if (e.rotation) {
          const t = e.rotation.map(THRDev3.MathUtils.degToRad);
          t.push(e.eulerOrder), i.makeRotationFromEuler(m.fromArray(t));
        }
        if (e.postRotation) {
          const t = e.postRotation.map(THRDev3.MathUtils.degToRad);
          t.push(e.eulerOrder),
            o.makeRotationFromEuler(m.fromArray(t)),
            o.invert();
        }
        e.scale && s.scale(g.fromArray(e.scale)),
          e.scalingOffset && a.setPosition(g.fromArray(e.scalingOffset)),
          e.scalingPivot && r.setPosition(g.fromArray(e.scalingPivot)),
          e.rotationOffset && l.setPosition(g.fromArray(e.rotationOffset)),
          e.rotationPivot && c.setPosition(g.fromArray(e.rotationPivot)),
          e.parentMatrixWorld &&
            (u.copy(e.parentMatrix), h.copy(e.parentMatrixWorld));
        const f = n.clone().multiply(i).multiply(o),
          v = new THRDev3.Matrix4();
        v.extractRotation(h);
        const y = new THRDev3.Matrix4();
        y.copyPosition(h);
        const b = y.clone().invert().multiply(h),
          x = v.clone().invert().multiply(b),
          w = s,
          C = new THRDev3.Matrix4();
        if (0 === p) C.copy(v).multiply(f).multiply(x).multiply(w);
        else if (1 === p) C.copy(v).multiply(x).multiply(f).multiply(w);
        else {
          const e = new THRDev3.Matrix4()
              .scale(new THRDev3.Vector3().setFromMatrixScale(u))
              .clone()
              .invert(),
            t = x.clone().multiply(e);
          C.copy(v).multiply(f).multiply(t).multiply(w);
        }
        const T = c.clone().invert(),
          _ = r.clone().invert();
        let D = t
          .clone()
          .multiply(l)
          .multiply(c)
          .multiply(n)
          .multiply(i)
          .multiply(o)
          .multiply(T)
          .multiply(a)
          .multiply(r)
          .multiply(s)
          .multiply(_);
        const M = new THRDev3.Matrix4().copyPosition(D),
          S = h.clone().multiply(M);
        return (
          d.copyPosition(S),
          (D = d.clone().multiply(C)),
          D.premultiply(h.invert()),
          D
        );
      }
      function y(e) {
        const t = ["ZYX", "YZX", "XZY", "ZXY", "YXZ", "XYZ"];
        return 6 === (e = e || 0)
          ? (console.warn(
              "THRDev3.FBXLoader: unsupported THRDev3.Euler Order: Spherical XYZ. Animations and rotations may be incorrect."
            ),
            t[0])
          : t[e];
      }
      function b(e) {
        return e.split(",").map(function (e) {
          return parseFloat(e);
        });
      }
      function x(e, t, n) {
        return (
          void 0 === t && (t = 0),
          void 0 === n && (n = e.byteLength),
          THRDev3.LoaderUtils.decodeText(new Uint8Array(e, t, n))
        );
      }
      function w(e, t, n) {
        return e.slice(0, t).concat(n).concat(e.slice(t));
      }
      THRDev3.FBXLoader = i;
    })();
  },
  function (e, t) {
    !(function () {
      class e extends THRDev3.Loader {
        constructor(e) {
          super(e),
            (this.dracoLoader = null),
            (this.ktx2Loader = null),
            (this.meshoptDecoder = null),
            (this.pluginCallbacks = []),
            this.register(function (e) {
              return new r(e);
            }),
            this.register(function (e) {
              return new p(e);
            }),
            this.register(function (e) {
              return new f(e);
            }),
            this.register(function (e) {
              return new l(e);
            }),
            this.register(function (e) {
              return new c(e);
            }),
            this.register(function (e) {
              return new h(e);
            }),
            this.register(function (e) {
              return new u(e);
            }),
            this.register(function (e) {
              return new s(e);
            }),
            this.register(function (e) {
              return new d(e);
            }),
            this.register(function (e) {
              return new a(e);
            }),
            this.register(function (e) {
              return new i(e);
            }),
            this.register(function (e) {
              return new m(e);
            });
        }
        load(e, t, n, i) {
          const o = this;
          let s;
          (s =
            "" !== this.resourcePath
              ? this.resourcePath
              : "" !== this.path
              ? this.path
              : THRDev3.LoaderUtils.extractUrlBase(e)),
            this.manager.itemStart(e);
          const r = function (t) {
              i ? i(t) : console.error(t),
                o.manager.itemError(e),
                o.manager.itemEnd(e);
            },
            a = new THRDev3.FileLoader(this.manager);
          a.setPath(this.path),
            a.setResponseType("arraybuffer"),
            a.setRequestHeader(this.requestHeader),
            a.setWithCredentials(this.withCredentials),
            a.load(
              e,
              function (n) {
                try {
                  o.parse(
                    n,
                    s,
                    function (n) {
                      t(n), o.manager.itemEnd(e);
                    },
                    r
                  );
                } catch (e) {
                  r(e);
                }
              },
              n,
              r
            );
        }
        setDRACOLoader(e) {
          return (this.dracoLoader = e), this;
        }
        setDDSLoader() {
          throw new Error(
            'THRDev3.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 (
            -1 === this.pluginCallbacks.indexOf(e) &&
              this.pluginCallbacks.push(e),
            this
          );
        }
        unregister(e) {
          return (
            -1 !== this.pluginCallbacks.indexOf(e) &&
              this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1),
            this
          );
        }
        parse(e, t, i, s) {
          let r;
          const a = {},
            l = {};
          if ("string" == typeof e) r = e;
          else {
            if (THRDev3.LoaderUtils.decodeText(new Uint8Array(e, 0, 4)) === g) {
              try {
                a[n.KHR_BINARY_GLTF] = new b(e);
              } catch (e) {
                return void (s && s(e));
              }
              r = a[n.KHR_BINARY_GLTF].content;
            } else r = THRDev3.LoaderUtils.decodeText(new Uint8Array(e));
          }
          const c = JSON.parse(r);
          if (void 0 === c.asset || c.asset.version[0] < 2)
            return void (
              s &&
              s(
                new Error(
                  "THRDev3.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."
                )
              )
            );
          const h = new Z(c, {
            path: t || this.resourcePath || "",
            crossOrigin: this.crossOrigin,
            requestHeader: this.requestHeader,
            manager: this.manager,
            ktx2Loader: this.ktx2Loader,
            meshoptDecoder: this.meshoptDecoder,
          });
          h.fileLoader.setRequestHeader(this.requestHeader);
          for (let e = 0; e < this.pluginCallbacks.length; e++) {
            const t = this.pluginCallbacks[e](h);
            (l[t.name] = t), (a[t.name] = !0);
          }
          if (c.extensionsUsed)
            for (let e = 0; e < c.extensionsUsed.length; ++e) {
              const t = c.extensionsUsed[e],
                i = c.extensionsRequired || [];
              switch (t) {
                case n.KHR_MATERIALS_UNLIT:
                  a[t] = new o();
                  break;
                case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
                  a[t] = new T();
                  break;
                case n.KHR_DRACO_MESH_COMPRESSION:
                  a[t] = new x(c, this.dracoLoader);
                  break;
                case n.KHR_TEXTURE_TRANSFORM:
                  a[t] = new w();
                  break;
                case n.KHR_MESH_QUANTIZATION:
                  a[t] = new _();
                  break;
                default:
                  i.indexOf(t) >= 0 &&
                    void 0 === l[t] &&
                    console.warn(
                      'THRDev3.GLTFLoader: Unknown extension "' + t + '".'
                    );
              }
            }
          h.setExtensions(a), h.setPlugins(l), h.parse(i, s);
        }
        parseAsync(e, t) {
          const n = this;
          return new Promise(function (i, o) {
            n.parse(e, t, i, o);
          });
        }
      }
      function t() {
        let e = {};
        return {
          get: function (t) {
            return e[t];
          },
          add: function (t, n) {
            e[t] = n;
          },
          remove: function (t) {
            delete e[t];
          },
          removeAll: function () {
            e = {};
          },
        };
      }
      const n = {
        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_IOR: "KHR_materials_ior",
        KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
          "KHR_materials_pbrSpecularGlossiness",
        KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
        KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
        KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
        KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
        KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
        KHR_MATERIALS_VOLUME: "KHR_materials_volume",
        KHR_TEXTURE_BASISU: "KHR_texture_basisu",
        KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
        KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
        KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
        EXT_TEXTURE_WEBP: "EXT_texture_webp",
        EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
      };
      class i {
        constructor(e) {
          (this.parser = e),
            (this.name = n.KHR_LIGHTS_PUNCTUAL),
            (this.cache = { refs: {}, uses: {} });
        }
        _markDefs() {
          const e = this.parser,
            t = this.parser.json.nodes || [];
          for (let n = 0, i = t.length; n < i; n++) {
            const i = t[n];
            i.extensions &&
              i.extensions[this.name] &&
              void 0 !== i.extensions[this.name].light &&
              e._addNodeRef(this.cache, i.extensions[this.name].light);
          }
        }
        _loadLight(e) {
          const t = this.parser,
            n = "light:" + e;
          let i = t.cache.get(n);
          if (i) return i;
          const o = t.json,
            s = (((o.extensions && o.extensions[this.name]) || {}).lights ||
              [])[e];
          let r;
          const a = new THRDev3.Color(16777215);
          void 0 !== s.color && a.fromArray(s.color);
          const l = void 0 !== s.range ? s.range : 0;
          switch (s.type) {
            case "directional":
              (r = new THRDev3.DirectionalLight(a)),
                r.target.position.set(0, 0, -1),
                r.add(r.target);
              break;
            case "point":
              (r = new THRDev3.PointLight(a)), (r.distance = l);
              break;
            case "spot":
              (r = new THRDev3.SpotLight(a)),
                (r.distance = l),
                (s.spot = s.spot || {}),
                (s.spot.innerConeAngle =
                  void 0 !== s.spot.innerConeAngle ? s.spot.innerConeAngle : 0),
                (s.spot.outerConeAngle =
                  void 0 !== s.spot.outerConeAngle
                    ? s.spot.outerConeAngle
                    : Math.PI / 4),
                (r.angle = s.spot.outerConeAngle),
                (r.penumbra =
                  1 - s.spot.innerConeAngle / s.spot.outerConeAngle),
                r.target.position.set(0, 0, -1),
                r.add(r.target);
              break;
            default:
              throw new Error(
                "THRDev3.GLTFLoader: Unexpected light type: " + s.type
              );
          }
          return (
            r.position.set(0, 0, 0),
            (r.decay = 2),
            void 0 !== s.intensity && (r.intensity = s.intensity),
            (r.name = t.createUniqueName(s.name || "light_" + e)),
            (i = Promise.resolve(r)),
            t.cache.add(n, i),
            i
          );
        }
        createNodeAttachment(e) {
          const t = this,
            n = this.parser,
            i = n.json.nodes[e],
            o = ((i.extensions && i.extensions[this.name]) || {}).light;
          return void 0 === o
            ? null
            : this._loadLight(o).then(function (e) {
                return n._getNodeRef(t.cache, o, e);
              });
        }
      }
      class o {
        constructor() {
          this.name = n.KHR_MATERIALS_UNLIT;
        }
        getMaterialType() {
          return THRDev3.MeshBasicMaterial;
        }
        extendParams(e, t, n) {
          const i = [];
          (e.color = new THRDev3.Color(1, 1, 1)), (e.opacity = 1);
          const o = t.pbrMetallicRoughness;
          if (o) {
            if (Array.isArray(o.baseColorFactor)) {
              const t = o.baseColorFactor;
              e.color.fromArray(t), (e.opacity = t[3]);
            }
            void 0 !== o.baseColorTexture &&
              i.push(
                n.assignTexture(
                  e,
                  "map",
                  o.baseColorTexture,
                  THRDev3.sRGBEncoding
                )
              );
          }
          return Promise.all(i);
        }
      }
      class s {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_EMISSIVE_STRENGTH);
        }
        extendMaterialParams(e, t) {
          const n = this.parser.json.materials[e];
          if (!n.extensions || !n.extensions[this.name])
            return Promise.resolve();
          const i = n.extensions[this.name].emissiveStrength;
          return void 0 !== i && (t.emissiveIntensity = i), Promise.resolve();
        }
      }
      class r {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_CLEARCOAT);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser,
            i = n.json.materials[e];
          if (!i.extensions || !i.extensions[this.name])
            return Promise.resolve();
          const o = [],
            s = i.extensions[this.name];
          if (
            (void 0 !== s.clearcoatFactor && (t.clearcoat = s.clearcoatFactor),
            void 0 !== s.clearcoatTexture &&
              o.push(n.assignTexture(t, "clearcoatMap", s.clearcoatTexture)),
            void 0 !== s.clearcoatRoughnessFactor &&
              (t.clearcoatRoughness = s.clearcoatRoughnessFactor),
            void 0 !== s.clearcoatRoughnessTexture &&
              o.push(
                n.assignTexture(
                  t,
                  "clearcoatRoughnessMap",
                  s.clearcoatRoughnessTexture
                )
              ),
            void 0 !== s.clearcoatNormalTexture &&
              (o.push(
                n.assignTexture(
                  t,
                  "clearcoatNormalMap",
                  s.clearcoatNormalTexture
                )
              ),
              void 0 !== s.clearcoatNormalTexture.scale))
          ) {
            const e = s.clearcoatNormalTexture.scale;
            t.clearcoatNormalScale = new THRDev3.Vector2(e, e);
          }
          return Promise.all(o);
        }
      }
      class a {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_IRIDESCENCE);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser,
            i = n.json.materials[e];
          if (!i.extensions || !i.extensions[this.name])
            return Promise.resolve();
          const o = [],
            s = i.extensions[this.name];
          return (
            void 0 !== s.iridescenceFactor &&
              (t.iridescence = s.iridescenceFactor),
            void 0 !== s.iridescenceTexture &&
              o.push(
                n.assignTexture(t, "iridescenceMap", s.iridescenceTexture)
              ),
            void 0 !== s.iridescenceIor &&
              (t.iridescenceIOR = s.iridescenceIor),
            void 0 === t.iridescenceThicknessRange &&
              (t.iridescenceThicknessRange = [100, 400]),
            void 0 !== s.iridescenceThicknessMinimum &&
              (t.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum),
            void 0 !== s.iridescenceThicknessMaximum &&
              (t.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum),
            void 0 !== s.iridescenceThicknessTexture &&
              o.push(
                n.assignTexture(
                  t,
                  "iridescenceThicknessMap",
                  s.iridescenceThicknessTexture
                )
              ),
            Promise.all(o)
          );
        }
      }
      class l {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_SHEEN);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser,
            i = n.json.materials[e];
          if (!i.extensions || !i.extensions[this.name])
            return Promise.resolve();
          const o = [];
          (t.sheenColor = new THRDev3.Color(0, 0, 0)),
            (t.sheenRoughness = 0),
            (t.sheen = 1);
          const s = i.extensions[this.name];
          return (
            void 0 !== s.sheenColorFactor &&
              t.sheenColor.fromArray(s.sheenColorFactor),
            void 0 !== s.sheenRoughnessFactor &&
              (t.sheenRoughness = s.sheenRoughnessFactor),
            void 0 !== s.sheenColorTexture &&
              o.push(
                n.assignTexture(
                  t,
                  "sheenColorMap",
                  s.sheenColorTexture,
                  THRDev3.sRGBEncoding
                )
              ),
            void 0 !== s.sheenRoughnessTexture &&
              o.push(
                n.assignTexture(t, "sheenRoughnessMap", s.sheenRoughnessTexture)
              ),
            Promise.all(o)
          );
        }
      }
      class c {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_TRANSMISSION);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser,
            i = n.json.materials[e];
          if (!i.extensions || !i.extensions[this.name])
            return Promise.resolve();
          const o = [],
            s = i.extensions[this.name];
          return (
            void 0 !== s.transmissionFactor &&
              (t.transmission = s.transmissionFactor),
            void 0 !== s.transmissionTexture &&
              o.push(
                n.assignTexture(t, "transmissionMap", s.transmissionTexture)
              ),
            Promise.all(o)
          );
        }
      }
      class h {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_VOLUME);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser,
            i = n.json.materials[e];
          if (!i.extensions || !i.extensions[this.name])
            return Promise.resolve();
          const o = [],
            s = i.extensions[this.name];
          (t.thickness = void 0 !== s.thicknessFactor ? s.thicknessFactor : 0),
            void 0 !== s.thicknessTexture &&
              o.push(n.assignTexture(t, "thicknessMap", s.thicknessTexture)),
            (t.attenuationDistance = s.attenuationDistance || 0);
          const r = s.attenuationColor || [1, 1, 1];
          return (
            (t.attenuationColor = new THRDev3.Color(r[0], r[1], r[2])),
            Promise.all(o)
          );
        }
      }
      class u {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_IOR);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser.json.materials[e];
          if (!n.extensions || !n.extensions[this.name])
            return Promise.resolve();
          const i = n.extensions[this.name];
          return (t.ior = void 0 !== i.ior ? i.ior : 1.5), Promise.resolve();
        }
      }
      class d {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_MATERIALS_SPECULAR);
        }
        getMaterialType(e) {
          const t = this.parser.json.materials[e];
          return t.extensions && t.extensions[this.name]
            ? THRDev3.MeshPhysicalMaterial
            : null;
        }
        extendMaterialParams(e, t) {
          const n = this.parser,
            i = n.json.materials[e];
          if (!i.extensions || !i.extensions[this.name])
            return Promise.resolve();
          const o = [],
            s = i.extensions[this.name];
          (t.specularIntensity =
            void 0 !== s.specularFactor ? s.specularFactor : 1),
            void 0 !== s.specularTexture &&
              o.push(
                n.assignTexture(t, "specularIntensityMap", s.specularTexture)
              );
          const r = s.specularColorFactor || [1, 1, 1];
          return (
            (t.specularColor = new THRDev3.Color(r[0], r[1], r[2])),
            void 0 !== s.specularColorTexture &&
              o.push(
                n.assignTexture(
                  t,
                  "specularColorMap",
                  s.specularColorTexture,
                  THRDev3.sRGBEncoding
                )
              ),
            Promise.all(o)
          );
        }
      }
      class p {
        constructor(e) {
          (this.parser = e), (this.name = n.KHR_TEXTURE_BASISU);
        }
        loadTexture(e) {
          const t = this.parser,
            n = t.json,
            i = n.textures[e];
          if (!i.extensions || !i.extensions[this.name]) return null;
          const o = i.extensions[this.name],
            s = t.options.ktx2Loader;
          if (!s) {
            if (
              n.extensionsRequired &&
              n.extensionsRequired.indexOf(this.name) >= 0
            )
              throw new Error(
                "THRDev3.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"
              );
            return null;
          }
          return t.loadTextureImage(e, o.source, s);
        }
      }
      class f {
        constructor(e) {
          (this.parser = e),
            (this.name = n.EXT_TEXTURE_WEBP),
            (this.isSupported = null);
        }
        loadTexture(e) {
          const t = this.name,
            n = this.parser,
            i = n.json,
            o = i.textures[e];
          if (!o.extensions || !o.extensions[t]) return null;
          const s = o.extensions[t],
            r = i.images[s.source];
          let a = n.textureLoader;
          if (r.uri) {
            const e = n.options.manager.getHandler(r.uri);
            null !== e && (a = e);
          }
          return this.detectSupport().then(function (o) {
            if (o) return n.loadTextureImage(e, s.source, a);
            if (i.extensionsRequired && i.extensionsRequired.indexOf(t) >= 0)
              throw new Error(
                "THRDev3.GLTFLoader: WebP required by asset but unsupported."
              );
            return n.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(1 === t.height);
                    });
              })),
            this.isSupported
          );
        }
      }
      class m {
        constructor(e) {
          (this.name = n.EXT_MESHOPT_COMPRESSION), (this.parser = e);
        }
        loadBufferView(e) {
          const t = this.parser.json,
            n = t.bufferViews[e];
          if (n.extensions && n.extensions[this.name]) {
            const e = n.extensions[this.name],
              i = this.parser.getDependency("buffer", e.buffer),
              o = this.parser.options.meshoptDecoder;
            if (!o || !o.supported) {
              if (
                t.extensionsRequired &&
                t.extensionsRequired.indexOf(this.name) >= 0
              )
                throw new Error(
                  "THRDev3.GLTFLoader: setMeshoptDecoder must be called before loading compressed files"
                );
              return null;
            }
            return Promise.all([i, o.ready]).then(function (t) {
              const n = e.byteOffset || 0,
                i = e.byteLength || 0,
                s = e.count,
                r = e.byteStride,
                a = new ArrayBuffer(s * r),
                l = new Uint8Array(t[0], n, i);
              return (
                o.decodeGltfBuffer(
                  new Uint8Array(a),
                  s,
                  r,
                  l,
                  e.mode,
                  e.filter
                ),
                a
              );
            });
          }
          return null;
        }
      }
      const g = "glTF",
        v = 1313821514,
        y = 5130562;
      class b {
        constructor(e) {
          (this.name = n.KHR_BINARY_GLTF),
            (this.content = null),
            (this.body = null);
          const t = new DataView(e, 0, 12);
          if (
            ((this.header = {
              magic: THRDev3.LoaderUtils.decodeText(
                new Uint8Array(e.slice(0, 4))
              ),
              version: t.getUint32(4, !0),
              length: t.getUint32(8, !0),
            }),
            this.header.magic !== g)
          )
            throw new Error(
              "THRDev3.GLTFLoader: Unsupported glTF-Binary header."
            );
          if (this.header.version < 2)
            throw new Error("THRDev3.GLTFLoader: Legacy binary file detected.");
          const i = this.header.length - 12,
            o = new DataView(e, 12);
          let s = 0;
          for (; s < i; ) {
            const t = o.getUint32(s, !0);
            s += 4;
            const n = o.getUint32(s, !0);
            if (((s += 4), n === v)) {
              const n = new Uint8Array(e, 12 + s, t);
              this.content = THRDev3.LoaderUtils.decodeText(n);
            } else if (n === y) {
              const n = 12 + s;
              this.body = e.slice(n, n + t);
            }
            s += t;
          }
          if (null === this.content)
            throw new Error("THRDev3.GLTFLoader: JSON content not found.");
        }
      }
      class x {
        constructor(e, t) {
          if (!t)
            throw new Error(
              "THRDev3.GLTFLoader: No DRACOLoader instance provided."
            );
          (this.name = n.KHR_DRACO_MESH_COMPRESSION),
            (this.json = e),
            (this.dracoLoader = t),
            this.dracoLoader.preload();
        }
        decodePrimitive(e, t) {
          const n = this.json,
            i = this.dracoLoader,
            o = e.extensions[this.name].bufferView,
            s = e.extensions[this.name].attributes,
            r = {},
            a = {},
            l = {};
          for (const e in s) {
            const t = z[e] || e.toLowerCase();
            r[t] = s[e];
          }
          for (const t in e.attributes) {
            const i = z[t] || t.toLowerCase();
            if (void 0 !== s[t]) {
              const o = n.accessors[e.attributes[t]],
                s = L[o.componentType];
              (l[i] = s), (a[i] = !0 === o.normalized);
            }
          }
          return t.getDependency("bufferView", o).then(function (e) {
            return new Promise(function (t) {
              i.decodeDracoFile(
                e,
                function (e) {
                  for (const t in e.attributes) {
                    const n = e.attributes[t],
                      i = a[t];
                    void 0 !== i && (n.normalized = i);
                  }
                  t(e);
                },
                r,
                l
              );
            });
          });
        }
      }
      class w {
        constructor() {
          this.name = n.KHR_TEXTURE_TRANSFORM;
        }
        extendTexture(e, t) {
          return (
            void 0 !== t.texCoord &&
              console.warn(
                'THRDev3.GLTFLoader: Custom UV sets in "' +
                  this.name +
                  '" extension not yet supported.'
              ),
            (void 0 === t.offset &&
              void 0 === t.rotation &&
              void 0 === t.scale) ||
              ((e = e.clone()),
              void 0 !== t.offset && e.offset.fromArray(t.offset),
              void 0 !== t.rotation && (e.rotation = t.rotation),
              void 0 !== t.scale && e.repeat.fromArray(t.scale),
              (e.needsUpdate = !0)),
            e
          );
        }
      }
      class C extends THRDev3.MeshStandardMaterial {
        constructor(e) {
          super(), (this.isGLTFSpecularGlossinessMaterial = !0);
          const t = [
              "#ifdef USE_SPECULARMAP",
              "\tuniform sampler2D specularMap;",
              "#endif",
            ].join("\n"),
            n = [
              "#ifdef USE_GLOSSINESSMAP",
              "\tuniform sampler2D glossinessMap;",
              "#endif",
            ].join("\n"),
            i = [
              "vec3 specularFactor = specular;",
              "#ifdef USE_SPECULARMAP",
              "\tvec4 texelSpecular = texture2D( specularMap, vUv );",
              "\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture",
              "\tspecularFactor *= texelSpecular.rgb;",
              "#endif",
            ].join("\n"),
            o = [
              "float glossinessFactor = glossiness;",
              "#ifdef USE_GLOSSINESSMAP",
              "\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );",
              "\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture",
              "\tglossinessFactor *= texelGlossiness.a;",
              "#endif",
            ].join("\n"),
            s = [
              "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.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.",
              "material.roughness += geometryRoughness;",
              "material.roughness = min( material.roughness, 1.0 );",
              "material.specularColor = specularFactor;",
            ].join("\n"),
            r = {
              specular: { value: new THRDev3.Color().setHex(16777215) },
              glossiness: { value: 1 },
              specularMap: { value: null },
              glossinessMap: { value: null },
            };
          (this._extraUniforms = r),
            (this.onBeforeCompile = function (e) {
              for (const t in r) e.uniforms[t] = r[t];
              e.fragmentShader = e.fragmentShader
                .replace("uniform float roughness;", "uniform vec3 specular;")
                .replace(
                  "uniform float metalness;",
                  "uniform float glossiness;"
                )
                .replace("#include <roughnessmap_pars_fragment>", t)
                .replace("#include <metalnessmap_pars_fragment>", n)
                .replace("#include <roughnessmap_fragment>", i)
                .replace("#include <metalnessmap_fragment>", o)
                .replace("#include <lights_physical_fragment>", s);
            }),
            Object.defineProperties(this, {
              specular: {
                get: function () {
                  return r.specular.value;
                },
                set: function (e) {
                  r.specular.value = e;
                },
              },
              specularMap: {
                get: function () {
                  return r.specularMap.value;
                },
                set: function (e) {
                  (r.specularMap.value = e),
                    e
                      ? (this.defines.USE_SPECULARMAP = "")
                      : delete this.defines.USE_SPECULARMAP;
                },
              },
              glossiness: {
                get: function () {
                  return r.glossiness.value;
                },
                set: function (e) {
                  r.glossiness.value = e;
                },
              },
              glossinessMap: {
                get: function () {
                  return r.glossinessMap.value;
                },
                set: function (e) {
                  (r.glossinessMap.value = e),
                    e
                      ? ((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 T {
        constructor() {
          (this.name = n.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",
            ]);
        }
        getMaterialType() {
          return C;
        }
        extendParams(e, t, n) {
          const i = t.extensions[this.name];
          (e.color = new THRDev3.Color(1, 1, 1)), (e.opacity = 1);
          const o = [];
          if (Array.isArray(i.diffuseFactor)) {
            const t = i.diffuseFactor;
            e.color.fromArray(t), (e.opacity = t[3]);
          }
          if (
            (void 0 !== i.diffuseTexture &&
              o.push(
                n.assignTexture(
                  e,
                  "map",
                  i.diffuseTexture,
                  THRDev3.sRGBEncoding
                )
              ),
            (e.emissive = new THRDev3.Color(0, 0, 0)),
            (e.glossiness =
              void 0 !== i.glossinessFactor ? i.glossinessFactor : 1),
            (e.specular = new THRDev3.Color(1, 1, 1)),
            Array.isArray(i.specularFactor) &&
              e.specular.fromArray(i.specularFactor),
            void 0 !== i.specularGlossinessTexture)
          ) {
            const t = i.specularGlossinessTexture;
            o.push(n.assignTexture(e, "glossinessMap", t)),
              o.push(
                n.assignTexture(e, "specularMap", t, THRDev3.sRGBEncoding)
              );
          }
          return Promise.all(o);
        }
        createMaterial(e) {
          const t = new C(e);
          return (
            (t.fog = !0),
            (t.color = e.color),
            (t.map = void 0 === e.map ? null : e.map),
            (t.lightMap = null),
            (t.lightMapIntensity = 1),
            (t.aoMap = void 0 === e.aoMap ? null : e.aoMap),
            (t.aoMapIntensity = 1),
            (t.emissive = e.emissive),
            (t.emissiveIntensity =
              void 0 === e.emissiveIntensity ? 1 : e.emissiveIntensity),
            (t.emissiveMap = void 0 === e.emissiveMap ? null : e.emissiveMap),
            (t.bumpMap = void 0 === e.bumpMap ? null : e.bumpMap),
            (t.bumpScale = 1),
            (t.normalMap = void 0 === e.normalMap ? null : e.normalMap),
            (t.normalMapType = THRDev3.TangentSpaceNormalMap),
            e.normalScale && (t.normalScale = e.normalScale),
            (t.displacementMap = null),
            (t.displacementScale = 1),
            (t.displacementBias = 0),
            (t.specularMap = void 0 === e.specularMap ? null : e.specularMap),
            (t.specular = e.specular),
            (t.glossinessMap =
              void 0 === e.glossinessMap ? null : e.glossinessMap),
            (t.glossiness = e.glossiness),
            (t.alphaMap = null),
            (t.envMap = void 0 === e.envMap ? null : e.envMap),
            (t.envMapIntensity = 1),
            t
          );
        }
      }
      class _ {
        constructor() {
          this.name = n.KHR_MESH_QUANTIZATION;
        }
      }
      class D extends THRDev3.Interpolant {
        constructor(e, t, n, i) {
          super(e, t, n, i);
        }
        copySampleValue_(e) {
          const t = this.resultBuffer,
            n = this.sampleValues,
            i = this.valueSize,
            o = e * i * 3 + i;
          for (let e = 0; e !== i; e++) t[e] = n[o + e];
          return t;
        }
        interpolate_(e, t, n, i) {
          const o = this.resultBuffer,
            s = this.sampleValues,
            r = this.valueSize,
            a = 2 * r,
            l = 3 * r,
            c = i - t,
            h = (n - t) / c,
            u = h * h,
            d = u * h,
            p = e * l,
            f = p - l,
            m = -2 * d + 3 * u,
            g = d - u,
            v = 1 - m,
            y = g - u + h;
          for (let e = 0; e !== r; e++) {
            const t = s[f + e + r],
              n = s[f + e + a] * c,
              i = s[p + e + r],
              l = s[p + e] * c;
            o[e] = v * t + y * n + m * i + g * l;
          }
          return o;
        }
      }
      const M = new THRDev3.Quaternion();
      class S extends D {
        interpolate_(e, t, n, i) {
          const o = super.interpolate_(e, t, n, i);
          return M.fromArray(o).normalize().toArray(o), o;
        }
      }
      const P = 0,
        R = 1,
        A = 2,
        E = 3,
        k = 4,
        I = 5,
        H = 6,
        L = {
          5120: Int8Array,
          5121: Uint8Array,
          5122: Int16Array,
          5123: Uint16Array,
          5125: Uint32Array,
          5126: Float32Array,
        },
        O = {
          9728: THRDev3.NearestFilter,
          9729: THRDev3.LinearFilter,
          9984: THRDev3.NearestMipmapNearestFilter,
          9985: THRDev3.LinearMipmapNearestFilter,
          9986: THRDev3.NearestMipmapLinearFilter,
          9987: THRDev3.LinearMipmapLinearFilter,
        },
        V = {
          33071: THRDev3.ClampToEdgeWrapping,
          33648: THRDev3.MirroredRepeatWrapping,
          10497: THRDev3.RepeatWrapping,
        },
        F = {
          SCALAR: 1,
          VEC2: 2,
          VEC3: 3,
          VEC4: 4,
          MAT2: 4,
          MAT3: 9,
          MAT4: 16,
        },
        z = {
          POSITION: "position",
          NORMAL: "normal",
          TANGENT: "tangent",
          TEXCOORD_0: "uv",
          TEXCOORD_1: "uv2",
          COLOR_0: "color",
          WEIGHTS_0: "skinWeight",
          JOINTS_0: "skinIndex",
        },
        j = {
          scale: "scale",
          translation: "position",
          rotation: "quaternion",
          weights: "morphTargetInfluences",
        },
        B = {
          CUBICSPLINE: void 0,
          LINEAR: THRDev3.InterpolateLinear,
          STEP: THRDev3.InterpolateDiscrete,
        },
        U = "OPAQUE",
        N = "MASK",
        G = "BLEND";
      function W(e, t, n) {
        for (const i in n.extensions)
          void 0 === e[i] &&
            ((t.userData.gltfExtensions = t.userData.gltfExtensions || {}),
            (t.userData.gltfExtensions[i] = n.extensions[i]));
      }
      function Y(e, t) {
        void 0 !== t.extras &&
          ("object" == typeof t.extras
            ? Object.assign(e.userData, t.extras)
            : console.warn(
                "THRDev3.GLTFLoader: Ignoring primitive type .extras, " +
                  t.extras
              ));
      }
      function K(e, t) {
        if ((e.updateMorphTargets(), void 0 !== t.weights))
          for (let n = 0, i = t.weights.length; n < i; n++)
            e.morphTargetInfluences[n] = t.weights[n];
        if (t.extras && Array.isArray(t.extras.targetNames)) {
          const n = t.extras.targetNames;
          if (e.morphTargetInfluences.length === n.length) {
            e.morphTargetDictionary = {};
            for (let t = 0, i = n.length; t < i; t++)
              e.morphTargetDictionary[n[t]] = t;
          } else
            console.warn(
              "THRDev3.GLTFLoader: Invalid extras.targetNames length. Ignoring names."
            );
        }
      }
      function $(e) {
        const t = e.extensions && e.extensions[n.KHR_DRACO_MESH_COMPRESSION];
        let i;
        return (
          (i = t
            ? "draco:" + t.bufferView + ":" + t.indices + ":" + X(t.attributes)
            : e.indices + ":" + X(e.attributes) + ":" + e.mode),
          i
        );
      }
      function X(e) {
        let t = "";
        const n = Object.keys(e).sort();
        for (let i = 0, o = n.length; i < o; i++)
          t += n[i] + ":" + e[n[i]] + ";";
        return t;
      }
      function q(e) {
        switch (e) {
          case Int8Array:
            return 1 / 127;
          case Uint8Array:
            return 1 / 255;
          case Int16Array:
            return 1 / 32767;
          case Uint16Array:
            return 1 / 65535;
          default:
            throw new Error(
              "THRDev3.GLTFLoader: Unsupported normalized accessor component type."
            );
        }
      }
      class Z {
        constructor(e = {}, n = {}) {
          (this.json = e),
            (this.extensions = {}),
            (this.plugins = {}),
            (this.options = n),
            (this.cache = new t()),
            (this.associations = new Map()),
            (this.primitiveCache = {}),
            (this.meshCache = { refs: {}, uses: {} }),
            (this.cameraCache = { refs: {}, uses: {} }),
            (this.lightCache = { refs: {}, uses: {} }),
            (this.sourceCache = {}),
            (this.textureCache = {}),
            (this.nodeNamesUsed = {});
          const i =
              !0 === /^((?!chrome|android).)*safari/i.test(navigator.userAgent),
            o = navigator.userAgent.indexOf("Firefox") > -1,
            s = o ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1;
          "undefined" == typeof createImageBitmap || i || (o && s < 98)
            ? (this.textureLoader = new THRDev3.TextureLoader(
                this.options.manager
              ))
            : (this.textureLoader = new THRDev3.ImageBitmapLoader(
                this.options.manager
              )),
            this.textureLoader.setCrossOrigin(this.options.crossOrigin),
            this.textureLoader.setRequestHeader(this.options.requestHeader),
            (this.fileLoader = new THRDev3.FileLoader(this.options.manager)),
            this.fileLoader.setResponseType("arraybuffer"),
            "use-credentials" === this.options.crossOrigin &&
              this.fileLoader.setWithCredentials(!0);
        }
        setExtensions(e) {
          this.extensions = e;
        }
        setPlugins(e) {
          this.plugins = e;
        }
        parse(e, t) {
          const n = this,
            i = this.json,
            o = this.extensions;
          this.cache.removeAll(),
            this._invokeAll(function (e) {
              return e._markDefs && e._markDefs();
            }),
            Promise.all(
              this._invokeAll(function (e) {
                return e.beforeRoot && e.beforeRoot();
              })
            )
              .then(function () {
                return Promise.all([
                  n.getDependencies("scene"),
                  n.getDependencies("animation"),
                  n.getDependencies("camera"),
                ]);
              })
              .then(function (t) {
                const s = {
                  scene: t[0][i.scene || 0],
                  scenes: t[0],
                  animations: t[1],
                  cameras: t[2],
                  asset: i.asset,
                  parser: n,
                  userData: {},
                };
                W(o, s, i),
                  Y(s, i),
                  Promise.all(
                    n._invokeAll(function (e) {
                      return e.afterRoot && e.afterRoot(s);
                    })
                  ).then(function () {
                    e(s);
                  });
              })
              .catch(t);
        }
        _markDefs() {
          const e = this.json.nodes || [],
            t = this.json.skins || [],
            n = this.json.meshes || [];
          for (let n = 0, i = t.length; n < i; n++) {
            const i = t[n].joints;
            for (let t = 0, n = i.length; t < n; t++) e[i[t]].isBone = !0;
          }
          for (let t = 0, i = e.length; t < i; t++) {
            const i = e[t];
            void 0 !== i.mesh &&
              (this._addNodeRef(this.meshCache, i.mesh),
              void 0 !== i.skin && (n[i.mesh].isSkinnedMesh = !0)),
              void 0 !== i.camera &&
                this._addNodeRef(this.cameraCache, i.camera);
          }
        }
        _addNodeRef(e, t) {
          void 0 !== t &&
            (void 0 === e.refs[t] && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
        }
        _getNodeRef(e, t, n) {
          if (e.refs[t] <= 1) return n;
          const i = n.clone(),
            o = (e, t) => {
              const n = this.associations.get(e);
              null != n && this.associations.set(t, n);
              for (const [n, i] of e.children.entries()) o(i, t.children[n]);
            };
          return o(n, i), (i.name += "_instance_" + e.uses[t]++), i;
        }
        _invokeOne(e) {
          const t = Object.values(this.plugins);
          t.push(this);
          for (let n = 0; n < t.length; n++) {
            const i = e(t[n]);
            if (i) return i;
          }
          return null;
        }
        _invokeAll(e) {
          const t = Object.values(this.plugins);
          t.unshift(this);
          const n = [];
          for (let i = 0; i < t.length; i++) {
            const o = e(t[i]);
            o && n.push(o);
          }
          return n;
        }
        getDependency(e, t) {
          const n = e + ":" + t;
          let i = this.cache.get(n);
          if (!i) {
            switch (e) {
              case "scene":
                i = this.loadScene(t);
                break;
              case "node":
                i = this.loadNode(t);
                break;
              case "mesh":
                i = this._invokeOne(function (e) {
                  return e.loadMesh && e.loadMesh(t);
                });
                break;
              case "accessor":
                i = this.loadAccessor(t);
                break;
              case "bufferView":
                i = this._invokeOne(function (e) {
                  return e.loadBufferView && e.loadBufferView(t);
                });
                break;
              case "buffer":
                i = this.loadBuffer(t);
                break;
              case "material":
                i = this._invokeOne(function (e) {
                  return e.loadMaterial && e.loadMaterial(t);
                });
                break;
              case "texture":
                i = this._invokeOne(function (e) {
                  return e.loadTexture && e.loadTexture(t);
                });
                break;
              case "skin":
                i = this.loadSkin(t);
                break;
              case "animation":
                i = this._invokeOne(function (e) {
                  return e.loadAnimation && e.loadAnimation(t);
                });
                break;
              case "camera":
                i = this.loadCamera(t);
                break;
              default:
                throw new Error("Unknown type: " + e);
            }
            this.cache.add(n, i);
          }
          return i;
        }
        getDependencies(e) {
          let t = this.cache.get(e);
          if (!t) {
            const n = this,
              i = this.json[e + ("mesh" === e ? "es" : "s")] || [];
            (t = Promise.all(
              i.map(function (t, i) {
                return n.getDependency(e, i);
              })
            )),
              this.cache.add(e, t);
          }
          return t;
        }
        loadBuffer(e) {
          const t = this.json.buffers[e],
            i = this.fileLoader;
          if (t.type && "arraybuffer" !== t.type)
            throw new Error(
              "THRDev3.GLTFLoader: " + t.type + " buffer type is not supported."
            );
          if (void 0 === t.uri && 0 === e)
            return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);
          const o = this.options;
          return new Promise(function (e, n) {
            i.load(
              THRDev3.LoaderUtils.resolveURL(t.uri, o.path),
              e,
              void 0,
              function () {
                n(
                  new Error(
                    'THRDev3.GLTFLoader: Failed to load buffer "' + t.uri + '".'
                  )
                );
              }
            );
          });
        }
        loadBufferView(e) {
          const t = this.json.bufferViews[e];
          return this.getDependency("buffer", t.buffer).then(function (e) {
            const n = t.byteLength || 0,
              i = t.byteOffset || 0;
            return e.slice(i, i + n);
          });
        }
        loadAccessor(e) {
          const t = this,
            n = this.json,
            i = this.json.accessors[e];
          if (void 0 === i.bufferView && void 0 === i.sparse)
            return Promise.resolve(null);
          const o = [];
          return (
            void 0 !== i.bufferView
              ? o.push(this.getDependency("bufferView", i.bufferView))
              : o.push(null),
            void 0 !== i.sparse &&
              (o.push(
                this.getDependency("bufferView", i.sparse.indices.bufferView)
              ),
              o.push(
                this.getDependency("bufferView", i.sparse.values.bufferView)
              )),
            Promise.all(o).then(function (e) {
              const o = e[0],
                s = F[i.type],
                r = L[i.componentType],
                a = r.BYTES_PER_ELEMENT,
                l = a * s,
                c = i.byteOffset || 0,
                h =
                  void 0 !== i.bufferView
                    ? n.bufferViews[i.bufferView].byteStride
                    : void 0,
                u = !0 === i.normalized;
              let d, p;
              if (h && h !== l) {
                const e = Math.floor(c / h),
                  n =
                    "InterleavedBuffer:" +
                    i.bufferView +
                    ":" +
                    i.componentType +
                    ":" +
                    e +
                    ":" +
                    i.count;
                let l = t.cache.get(n);
                l ||
                  ((d = new r(o, e * h, (i.count * h) / a)),
                  (l = new THRDev3.InterleavedBuffer(d, h / a)),
                  t.cache.add(n, l)),
                  (p = new THRDev3.InterleavedBufferAttribute(
                    l,
                    s,
                    (c % h) / a,
                    u
                  ));
              } else (d = null === o ? new r(i.count * s) : new r(o, c, i.count * s)), (p = new THRDev3.BufferAttribute(d, s, u));
              if (void 0 !== i.sparse) {
                const t = F.SCALAR,
                  n = L[i.sparse.indices.componentType],
                  a = i.sparse.indices.byteOffset || 0,
                  l = i.sparse.values.byteOffset || 0,
                  c = new n(e[1], a, i.sparse.count * t),
                  h = new r(e[2], l, i.sparse.count * s);
                null !== o &&
                  (p = new THRDev3.BufferAttribute(
                    p.array.slice(),
                    p.itemSize,
                    p.normalized
                  ));
                for (let e = 0, t = c.length; e < t; e++) {
                  const t = c[e];
                  if (
                    (p.setX(t, h[e * s]),
                    s >= 2 && p.setY(t, h[e * s + 1]),
                    s >= 3 && p.setZ(t, h[e * s + 2]),
                    s >= 4 && p.setW(t, h[e * s + 3]),
                    s >= 5)
                  )
                    throw new Error(
                      "THRDev3.GLTFLoader: Unsupported itemSize in sparse THRDev3.BufferAttribute."
                    );
                }
              }
              return p;
            })
          );
        }
        loadTexture(e) {
          const t = this.json,
            n = this.options,
            i = t.textures[e].source,
            o = t.images[i];
          let s = this.textureLoader;
          if (o.uri) {
            const e = n.manager.getHandler(o.uri);
            null !== e && (s = e);
          }
          return this.loadTextureImage(e, i, s);
        }
        loadTextureImage(e, t, n) {
          const i = this,
            o = this.json,
            s = o.textures[e],
            r = o.images[t],
            a = (r.uri || r.bufferView) + ":" + s.sampler;
          if (this.textureCache[a]) return this.textureCache[a];
          const l = this.loadImageSource(t, n)
            .then(function (t) {
              (t.flipY = !1), s.name && (t.name = s.name);
              const n = (o.samplers || {})[s.sampler] || {};
              return (
                (t.magFilter = O[n.magFilter] || THRDev3.LinearFilter),
                (t.minFilter =
                  O[n.minFilter] || THRDev3.LinearMipmapLinearFilter),
                (t.wrapS = V[n.wrapS] || THRDev3.RepeatWrapping),
                (t.wrapT = V[n.wrapT] || THRDev3.RepeatWrapping),
                i.associations.set(t, { textures: e }),
                t
              );
            })
            .catch(function () {
              return null;
            });
          return (this.textureCache[a] = l), l;
        }
        loadImageSource(e, t) {
          const n = this,
            i = this.json,
            o = this.options;
          if (void 0 !== this.sourceCache[e])
            return this.sourceCache[e].then((e) => e.clone());
          const s = i.images[e],
            r = self.URL || self.webkitURL;
          let a = s.uri || "",
            l = !1;
          if (void 0 !== s.bufferView)
            a = n.getDependency("bufferView", s.bufferView).then(function (e) {
              l = !0;
              const t = new Blob([e], { type: s.mimeType });
              return (a = r.createObjectURL(t)), a;
            });
          else if (void 0 === s.uri)
            throw new Error(
              "THRDev3.GLTFLoader: Image " +
                e +
                " is missing URI and bufferView"
            );
          const c = Promise.resolve(a)
            .then(function (e) {
              return new Promise(function (n, i) {
                let s = n;
                !0 === t.isImageBitmapLoader &&
                  (s = function (e) {
                    const t = new THRDev3.Texture(e);
                    (t.needsUpdate = !0), n(t);
                  }),
                  t.load(
                    THRDev3.LoaderUtils.resolveURL(e, o.path),
                    s,
                    void 0,
                    i
                  );
              });
            })
            .then(function (e) {
              var t;
              return (
                !0 === l && r.revokeObjectURL(a),
                (e.userData.mimeType =
                  s.mimeType ||
                  ((t = s.uri).search(/\.jpe?g($|\?)/i) > 0 ||
                  0 === t.search(/^data\:image\/jpeg/)
                    ? "image/jpeg"
                    : t.search(/\.webp($|\?)/i) > 0 ||
                      0 === t.search(/^data\:image\/webp/)
                    ? "image/webp"
                    : "image/png")),
                e
              );
            })
            .catch(function (e) {
              throw (
                (console.error("THRDev3.GLTFLoader: Couldn't load texture", a),
                e)
              );
            });
          return (this.sourceCache[e] = c), c;
        }
        assignTexture(e, t, i, o) {
          const s = this;
          return this.getDependency("texture", i.index).then(function (r) {
            if (
              (void 0 === i.texCoord ||
                0 == i.texCoord ||
                ("aoMap" === t && 1 == i.texCoord) ||
                console.warn(
                  "THRDev3.GLTFLoader: Custom UV set " +
                    i.texCoord +
                    " for texture " +
                    t +
                    " not yet supported."
                ),
              s.extensions[n.KHR_TEXTURE_TRANSFORM])
            ) {
              const e =
                void 0 !== i.extensions
                  ? i.extensions[n.KHR_TEXTURE_TRANSFORM]
                  : void 0;
              if (e) {
                const t = s.associations.get(r);
                (r = s.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(r, e)),
                  s.associations.set(r, t);
              }
            }
            return void 0 !== o && (r.encoding = o), (e[t] = r), r;
          });
        }
        assignFinalMaterial(e) {
          const t = e.geometry;
          let n = e.material;
          const i = void 0 === t.attributes.tangent,
            o = void 0 !== t.attributes.color,
            s = void 0 === t.attributes.normal;
          if (e.isPoints) {
            const e = "PointsMaterial:" + n.uuid;
            let t = this.cache.get(e);
            t ||
              ((t = new THRDev3.PointsMaterial()),
              THRDev3.Material.prototype.copy.call(t, n),
              t.color.copy(n.color),
              (t.map = n.map),
              (t.sizeAttenuation = !1),
              this.cache.add(e, t)),
              (n = t);
          } else if (e.isLine) {
            const e = "LineBasicMaterial:" + n.uuid;
            let t = this.cache.get(e);
            t ||
              ((t = new THRDev3.LineBasicMaterial()),
              THRDev3.Material.prototype.copy.call(t, n),
              t.color.copy(n.color),
              this.cache.add(e, t)),
              (n = t);
          }
          if (i || o || s) {
            let e = "ClonedMaterial:" + n.uuid + ":";
            n.isGLTFSpecularGlossinessMaterial && (e += "specular-glossiness:"),
              i && (e += "derivative-tangents:"),
              o && (e += "vertex-colors:"),
              s && (e += "flat-shading:");
            let t = this.cache.get(e);
            t ||
              ((t = n.clone()),
              o && (t.vertexColors = !0),
              s && (t.flatShading = !0),
              i &&
                (t.normalScale && (t.normalScale.y *= -1),
                t.clearcoatNormalScale && (t.clearcoatNormalScale.y *= -1)),
              this.cache.add(e, t),
              this.associations.set(t, this.associations.get(n))),
              (n = t);
          }
          n.aoMap &&
            void 0 === t.attributes.uv2 &&
            void 0 !== t.attributes.uv &&
            t.setAttribute("uv2", t.attributes.uv),
            (e.material = n);
        }
        getMaterialType() {
          return THRDev3.MeshStandardMaterial;
        }
        loadMaterial(e) {
          const t = this,
            i = this.json,
            o = this.extensions,
            s = i.materials[e];
          let r;
          const a = {},
            l = s.extensions || {},
            c = [];
          if (l[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
            const e = o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
            (r = e.getMaterialType()), c.push(e.extendParams(a, s, t));
          } else if (l[n.KHR_MATERIALS_UNLIT]) {
            const e = o[n.KHR_MATERIALS_UNLIT];
            (r = e.getMaterialType()), c.push(e.extendParams(a, s, t));
          } else {
            const n = s.pbrMetallicRoughness || {};
            if (
              ((a.color = new THRDev3.Color(1, 1, 1)),
              (a.opacity = 1),
              Array.isArray(n.baseColorFactor))
            ) {
              const e = n.baseColorFactor;
              a.color.fromArray(e), (a.opacity = e[3]);
            }
            void 0 !== n.baseColorTexture &&
              c.push(
                t.assignTexture(
                  a,
                  "map",
                  n.baseColorTexture,
                  THRDev3.sRGBEncoding
                )
              ),
              (a.metalness =
                void 0 !== n.metallicFactor ? n.metallicFactor : 1),
              (a.roughness =
                void 0 !== n.roughnessFactor ? n.roughnessFactor : 1),
              void 0 !== n.metallicRoughnessTexture &&
                (c.push(
                  t.assignTexture(a, "metalnessMap", n.metallicRoughnessTexture)
                ),
                c.push(
                  t.assignTexture(a, "roughnessMap", n.metallicRoughnessTexture)
                )),
              (r = this._invokeOne(function (t) {
                return t.getMaterialType && t.getMaterialType(e);
              })),
              c.push(
                Promise.all(
                  this._invokeAll(function (t) {
                    return (
                      t.extendMaterialParams && t.extendMaterialParams(e, a)
                    );
                  })
                )
              );
          }
          !0 === s.doubleSided && (a.side = THRDev3.DoubleSide);
          const h = s.alphaMode || U;
          if (
            (h === G
              ? ((a.transparent = !0), (a.depthWrite = !1))
              : ((a.transparent = !1),
                h === N &&
                  (a.alphaTest =
                    void 0 !== s.alphaCutoff ? s.alphaCutoff : 0.5)),
            void 0 !== s.normalTexture &&
              r !== THRDev3.MeshBasicMaterial &&
              (c.push(t.assignTexture(a, "normalMap", s.normalTexture)),
              (a.normalScale = new THRDev3.Vector2(1, 1)),
              void 0 !== s.normalTexture.scale))
          ) {
            const e = s.normalTexture.scale;
            a.normalScale.set(e, e);
          }
          return (
            void 0 !== s.occlusionTexture &&
              r !== THRDev3.MeshBasicMaterial &&
              (c.push(t.assignTexture(a, "aoMap", s.occlusionTexture)),
              void 0 !== s.occlusionTexture.strength &&
                (a.aoMapIntensity = s.occlusionTexture.strength)),
            void 0 !== s.emissiveFactor &&
              r !== THRDev3.MeshBasicMaterial &&
              (a.emissive = new THRDev3.Color().fromArray(s.emissiveFactor)),
            void 0 !== s.emissiveTexture &&
              r !== THRDev3.MeshBasicMaterial &&
              c.push(
                t.assignTexture(
                  a,
                  "emissiveMap",
                  s.emissiveTexture,
                  THRDev3.sRGBEncoding
                )
              ),
            Promise.all(c).then(function () {
              let i;
              return (
                (i =
                  r === C
                    ? o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(
                        a
                      )
                    : new r(a)),
                s.name && (i.name = s.name),
                Y(i, s),
                t.associations.set(i, { materials: e }),
                s.extensions && W(o, i, s),
                i
              );
            })
          );
        }
        createUniqueName(e) {
          const t = THRDev3.PropertyBinding.sanitizeNodeName(e || "");
          let n = t;
          for (let e = 1; this.nodeNamesUsed[n]; ++e) n = t + "_" + e;
          return (this.nodeNamesUsed[n] = !0), n;
        }
        loadGeometries(e) {
          const t = this,
            i = this.extensions,
            o = this.primitiveCache;
          function s(e) {
            return i[n.KHR_DRACO_MESH_COMPRESSION]
              .decodePrimitive(e, t)
              .then(function (n) {
                return J(n, e, t);
              });
          }
          const r = [];
          for (let i = 0, a = e.length; i < a; i++) {
            const a = e[i],
              l = $(a),
              c = o[l];
            if (c) r.push(c.promise);
            else {
              let e;
              (e =
                a.extensions && a.extensions[n.KHR_DRACO_MESH_COMPRESSION]
                  ? s(a)
                  : J(new THRDev3.BufferGeometry(), a, t)),
                (o[l] = { primitive: a, promise: e }),
                r.push(e);
            }
          }
          return Promise.all(r);
        }
        loadMesh(e) {
          const t = this,
            n = this.json,
            i = this.extensions,
            o = n.meshes[e],
            s = o.primitives,
            r = [];
          for (let e = 0, t = s.length; e < t; e++) {
            const t =
              void 0 === s[e].material
                ? (void 0 === (a = this.cache).DefaultMaterial &&
                    (a.DefaultMaterial = new THRDev3.MeshStandardMaterial({
                      color: 16777215,
                      emissive: 0,
                      metalness: 1,
                      roughness: 1,
                      transparent: !1,
                      depthTest: !0,
                      side: THRDev3.FrontSide,
                    })),
                  a.DefaultMaterial)
                : this.getDependency("material", s[e].material);
            r.push(t);
          }
          var a;
          return (
            r.push(t.loadGeometries(s)),
            Promise.all(r).then(function (n) {
              const r = n.slice(0, n.length - 1),
                a = n[n.length - 1],
                l = [];
              for (let n = 0, c = a.length; n < c; n++) {
                const c = a[n],
                  h = s[n];
                let u;
                const d = r[n];
                if (
                  h.mode === k ||
                  h.mode === I ||
                  h.mode === H ||
                  void 0 === h.mode
                )
                  (u =
                    !0 === o.isSkinnedMesh
                      ? new THRDev3.SkinnedMesh(c, d)
                      : new THRDev3.Mesh(c, d)),
                    !0 !== u.isSkinnedMesh ||
                      u.geometry.attributes.skinWeight.normalized ||
                      u.normalizeSkinWeights(),
                    h.mode === I
                      ? (u.geometry = ee(
                          u.geometry,
                          THRDev3.TriangleStripDrawMode
                        ))
                      : h.mode === H &&
                        (u.geometry = ee(
                          u.geometry,
                          THRDev3.TriangleFanDrawMode
                        ));
                else if (h.mode === R) u = new THRDev3.LineSegments(c, d);
                else if (h.mode === E) u = new THRDev3.Line(c, d);
                else if (h.mode === A) u = new THRDev3.LineLoop(c, d);
                else {
                  if (h.mode !== P)
                    throw new Error(
                      "THRDev3.GLTFLoader: Primitive mode unsupported: " +
                        h.mode
                    );
                  u = new THRDev3.Points(c, d);
                }
                Object.keys(u.geometry.morphAttributes).length > 0 && K(u, o),
                  (u.name = t.createUniqueName(o.name || "mesh_" + e)),
                  Y(u, o),
                  h.extensions && W(i, u, h),
                  t.assignFinalMaterial(u),
                  l.push(u);
              }
              for (let n = 0, i = l.length; n < i; n++)
                t.associations.set(l[n], { meshes: e, primitives: n });
              if (1 === l.length) return l[0];
              const c = new THRDev3.Group();
              t.associations.set(c, { meshes: e });
              for (let e = 0, t = l.length; e < t; e++) c.add(l[e]);
              return c;
            })
          );
        }
        loadCamera(e) {
          let t;
          const n = this.json.cameras[e],
            i = n[n.type];
          if (i)
            return (
              "perspective" === n.type
                ? (t = new THRDev3.PerspectiveCamera(
                    THRDev3.MathUtils.radToDeg(i.yfov),
                    i.aspectRatio || 1,
                    i.znear || 1,
                    i.zfar || 2e6
                  ))
                : "orthographic" === n.type &&
                  (t = new THRDev3.OrthographicCamera(
                    -i.xmag,
                    i.xmag,
                    i.ymag,
                    -i.ymag,
                    i.znear,
                    i.zfar
                  )),
              n.name && (t.name = this.createUniqueName(n.name)),
              Y(t, n),
              Promise.resolve(t)
            );
          console.warn("THRDev3.GLTFLoader: Missing camera parameters.");
        }
        loadSkin(e) {
          const t = this.json.skins[e],
            n = { joints: t.joints };
          return void 0 === t.inverseBindMatrices
            ? Promise.resolve(n)
            : this.getDependency("accessor", t.inverseBindMatrices).then(
                function (e) {
                  return (n.inverseBindMatrices = e), n;
                }
              );
        }
        loadAnimation(e) {
          const t = this.json.animations[e],
            n = [],
            i = [],
            o = [],
            s = [],
            r = [];
          for (let e = 0, a = t.channels.length; e < a; e++) {
            const a = t.channels[e],
              l = t.samplers[a.sampler],
              c = a.target,
              h = void 0 !== c.node ? c.node : c.id,
              u = void 0 !== t.parameters ? t.parameters[l.input] : l.input,
              d = void 0 !== t.parameters ? t.parameters[l.output] : l.output;
            n.push(this.getDependency("node", h)),
              i.push(this.getDependency("accessor", u)),
              o.push(this.getDependency("accessor", d)),
              s.push(l),
              r.push(c);
          }
          return Promise.all([
            Promise.all(n),
            Promise.all(i),
            Promise.all(o),
            Promise.all(s),
            Promise.all(r),
          ]).then(function (n) {
            const i = n[0],
              o = n[1],
              s = n[2],
              r = n[3],
              a = n[4],
              l = [];
            for (let e = 0, t = i.length; e < t; e++) {
              const t = i[e],
                n = o[e],
                c = s[e],
                h = r[e],
                u = a[e];
              if (void 0 === t) continue;
              let d;
              switch ((t.updateMatrix(), j[u.path])) {
                case j.weights:
                  d = THRDev3.NumberKeyframeTrack;
                  break;
                case j.rotation:
                  d = THRDev3.QuaternionKeyframeTrack;
                  break;
                case j.position:
                case j.scale:
                default:
                  d = THRDev3.VectorKeyframeTrack;
              }
              const p = t.name ? t.name : t.uuid,
                f =
                  void 0 !== h.interpolation
                    ? B[h.interpolation]
                    : THRDev3.InterpolateLinear,
                m = [];
              j[u.path] === j.weights
                ? t.traverse(function (e) {
                    e.morphTargetInfluences && m.push(e.name ? e.name : e.uuid);
                  })
                : m.push(p);
              let g = c.array;
              if (c.normalized) {
                const e = q(g.constructor),
                  t = new Float32Array(g.length);
                for (let n = 0, i = g.length; n < i; n++) t[n] = g[n] * e;
                g = t;
              }
              for (let e = 0, t = m.length; e < t; e++) {
                const t = new d(m[e] + "." + j[u.path], n.array, g, f);
                "CUBICSPLINE" === h.interpolation &&
                  ((t.createInterpolant = function (e) {
                    return new (
                      this instanceof THRDev3.QuaternionKeyframeTrack ? S : D
                    )(this.times, this.values, this.getValueSize() / 3, e);
                  }),
                  (t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline =
                    !0)),
                  l.push(t);
              }
            }
            const c = t.name ? t.name : "animation_" + e;
            return new THRDev3.AnimationClip(c, void 0, l);
          });
        }
        createNodeMesh(e) {
          const t = this.json,
            n = this,
            i = t.nodes[e];
          return void 0 === i.mesh
            ? null
            : n.getDependency("mesh", i.mesh).then(function (e) {
                const t = n._getNodeRef(n.meshCache, i.mesh, e);
                return (
                  void 0 !== i.weights &&
                    t.traverse(function (e) {
                      if (e.isMesh)
                        for (let t = 0, n = i.weights.length; t < n; t++)
                          e.morphTargetInfluences[t] = i.weights[t];
                    }),
                  t
                );
              });
        }
        loadNode(e) {
          const t = this.json,
            n = this.extensions,
            i = this,
            o = t.nodes[e],
            s = o.name ? i.createUniqueName(o.name) : "";
          return (function () {
            const t = [],
              n = i._invokeOne(function (t) {
                return t.createNodeMesh && t.createNodeMesh(e);
              });
            return (
              n && t.push(n),
              void 0 !== o.camera &&
                t.push(
                  i.getDependency("camera", o.camera).then(function (e) {
                    return i._getNodeRef(i.cameraCache, o.camera, e);
                  })
                ),
              i
                ._invokeAll(function (t) {
                  return t.createNodeAttachment && t.createNodeAttachment(e);
                })
                .forEach(function (e) {
                  t.push(e);
                }),
              Promise.all(t)
            );
          })().then(function (t) {
            let r;
            if (
              ((r =
                !0 === o.isBone
                  ? new THRDev3.Bone()
                  : t.length > 1
                  ? new THRDev3.Group()
                  : 1 === t.length
                  ? t[0]
                  : new THRDev3.Object3D()),
              r !== t[0])
            )
              for (let e = 0, n = t.length; e < n; e++) r.add(t[e]);
            if (
              (o.name && ((r.userData.name = o.name), (r.name = s)),
              Y(r, o),
              o.extensions && W(n, r, o),
              void 0 !== o.matrix)
            ) {
              const e = new THRDev3.Matrix4();
              e.fromArray(o.matrix), r.applyMatrix4(e);
            } else void 0 !== o.translation && r.position.fromArray(o.translation), void 0 !== o.rotation && r.quaternion.fromArray(o.rotation), void 0 !== o.scale && r.scale.fromArray(o.scale);
            return (
              i.associations.has(r) || i.associations.set(r, {}),
              (i.associations.get(r).nodes = e),
              r
            );
          });
        }
        loadScene(e) {
          const t = this.json,
            n = this.extensions,
            i = this.json.scenes[e],
            o = this,
            s = new THRDev3.Group();
          i.name && (s.name = o.createUniqueName(i.name)),
            Y(s, i),
            i.extensions && W(n, s, i);
          const r = i.nodes || [],
            a = [];
          for (let e = 0, n = r.length; e < n; e++) a.push(Q(r[e], s, t, o));
          return Promise.all(a).then(function () {
            return (
              (o.associations = ((e) => {
                const t = new Map();
                for (const [e, n] of o.associations)
                  (e instanceof THRDev3.Material ||
                    e instanceof THRDev3.Texture) &&
                    t.set(e, n);
                return (
                  e.traverse((e) => {
                    const n = o.associations.get(e);
                    null != n && t.set(e, n);
                  }),
                  t
                );
              })(s)),
              s
            );
          });
        }
      }
      function Q(e, t, n, i) {
        const o = n.nodes[e];
        return i
          .getDependency("node", e)
          .then(function (e) {
            if (void 0 === o.skin) return e;
            let t;
            return i
              .getDependency("skin", o.skin)
              .then(function (e) {
                t = e;
                const n = [];
                for (let e = 0, o = t.joints.length; e < o; e++)
                  n.push(i.getDependency("node", t.joints[e]));
                return Promise.all(n);
              })
              .then(function (n) {
                return (
                  e.traverse(function (e) {
                    if (!e.isMesh) return;
                    const i = [],
                      o = [];
                    for (let e = 0, s = n.length; e < s; e++) {
                      const s = n[e];
                      if (s) {
                        i.push(s);
                        const n = new THRDev3.Matrix4();
                        void 0 !== t.inverseBindMatrices &&
                          n.fromArray(t.inverseBindMatrices.array, 16 * e),
                          o.push(n);
                      } else
                        console.warn(
                          'THRDev3.GLTFLoader: Joint "%s" could not be found.',
                          t.joints[e]
                        );
                    }
                    e.bind(new THRDev3.Skeleton(i, o), e.matrixWorld);
                  }),
                  e
                );
              });
          })
          .then(function (e) {
            t.add(e);
            const s = [];
            if (o.children) {
              const t = o.children;
              for (let o = 0, r = t.length; o < r; o++) {
                const r = t[o];
                s.push(Q(r, e, n, i));
              }
            }
            return Promise.all(s);
          });
      }
      function J(e, t, n) {
        const i = t.attributes,
          o = [];
        function s(t, i) {
          return n.getDependency("accessor", t).then(function (t) {
            e.setAttribute(i, t);
          });
        }
        for (const t in i) {
          const n = z[t] || t.toLowerCase();
          n in e.attributes || o.push(s(i[t], n));
        }
        if (void 0 !== t.indices && !e.index) {
          const i = n.getDependency("accessor", t.indices).then(function (t) {
            e.setIndex(t);
          });
          o.push(i);
        }
        return (
          Y(e, t),
          (function (e, t, n) {
            const i = t.attributes,
              o = new THRDev3.Box3();
            if (void 0 === i.POSITION) return;
            {
              const e = n.json.accessors[i.POSITION],
                t = e.min,
                s = e.max;
              if (void 0 === t || void 0 === s)
                return void console.warn(
                  "THRDev3.GLTFLoader: Missing min/max properties for accessor POSITION."
                );
              if (
                (o.set(
                  new THRDev3.Vector3(t[0], t[1], t[2]),
                  new THRDev3.Vector3(s[0], s[1], s[2])
                ),
                e.normalized)
              ) {
                const t = q(L[e.componentType]);
                o.min.multiplyScalar(t), o.max.multiplyScalar(t);
              }
            }
            const s = t.targets;
            if (void 0 !== s) {
              const e = new THRDev3.Vector3(),
                t = new THRDev3.Vector3();
              for (let i = 0, o = s.length; i < o; i++) {
                const o = s[i];
                if (void 0 !== o.POSITION) {
                  const i = n.json.accessors[o.POSITION],
                    s = i.min,
                    r = i.max;
                  if (void 0 !== s && void 0 !== r) {
                    if (
                      (t.setX(Math.max(Math.abs(s[0]), Math.abs(r[0]))),
                      t.setY(Math.max(Math.abs(s[1]), Math.abs(r[1]))),
                      t.setZ(Math.max(Math.abs(s[2]), Math.abs(r[2]))),
                      i.normalized)
                    ) {
                      const e = q(L[i.componentType]);
                      t.multiplyScalar(e);
                    }
                    e.max(t);
                  } else
                    console.warn(
                      "THRDev3.GLTFLoader: Missing min/max properties for accessor POSITION."
                    );
                }
              }
              o.expandByVector(e);
            }
            e.boundingBox = o;
            const r = new THRDev3.Sphere();
            o.getCenter(r.center),
              (r.radius = o.min.distanceTo(o.max) / 2),
              (e.boundingSphere = r);
          })(e, t, n),
          Promise.all(o).then(function () {
            return void 0 !== t.targets
              ? (function (e, t, n) {
                  let i = !1,
                    o = !1,
                    s = !1;
                  for (let e = 0, n = t.length; e < n; e++) {
                    const n = t[e];
                    if (
                      (void 0 !== n.POSITION && (i = !0),
                      void 0 !== n.NORMAL && (o = !0),
                      void 0 !== n.COLOR_0 && (s = !0),
                      i && o && s)
                    )
                      break;
                  }
                  if (!i && !o && !s) return Promise.resolve(e);
                  const r = [],
                    a = [],
                    l = [];
                  for (let c = 0, h = t.length; c < h; c++) {
                    const h = t[c];
                    if (i) {
                      const t =
                        void 0 !== h.POSITION
                          ? n.getDependency("accessor", h.POSITION)
                          : e.attributes.position;
                      r.push(t);
                    }
                    if (o) {
                      const t =
                        void 0 !== h.NORMAL
                          ? n.getDependency("accessor", h.NORMAL)
                          : e.attributes.normal;
                      a.push(t);
                    }
                    if (s) {
                      const t =
                        void 0 !== h.COLOR_0
                          ? n.getDependency("accessor", h.COLOR_0)
                          : e.attributes.color;
                      l.push(t);
                    }
                  }
                  return Promise.all([
                    Promise.all(r),
                    Promise.all(a),
                    Promise.all(l),
                  ]).then(function (t) {
                    const n = t[0],
                      r = t[1],
                      a = t[2];
                    return (
                      i && (e.morphAttributes.position = n),
                      o && (e.morphAttributes.normal = r),
                      s && (e.morphAttributes.color = a),
                      (e.morphTargetsRelative = !0),
                      e
                    );
                  });
                })(e, t.targets, n)
              : e;
          })
        );
      }
      function ee(e, t) {
        let n = e.getIndex();
        if (null === n) {
          const t = [],
            i = e.getAttribute("position");
          if (void 0 === i)
            return (
              console.error(
                "THRDev3.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."
              ),
              e
            );
          for (let e = 0; e < i.count; e++) t.push(e);
          e.setIndex(t), (n = e.getIndex());
        }
        const i = n.count - 2,
          o = [];
        if (t === THRDev3.TriangleFanDrawMode)
          for (let e = 1; e <= i; e++)
            o.push(n.getX(0)), o.push(n.getX(e)), o.push(n.getX(e + 1));
        else
          for (let e = 0; e < i; e++)
            e % 2 == 0
              ? (o.push(n.getX(e)),
                o.push(n.getX(e + 1)),
                o.push(n.getX(e + 2)))
              : (o.push(n.getX(e + 2)),
                o.push(n.getX(e + 1)),
                o.push(n.getX(e)));
        o.length / 3 !== i &&
          console.error(
            "THRDev3.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."
          );
        const s = e.clone();
        return s.setIndex(o), s;
      }
      THRDev3.GLTFLoader = e;
    })();
  },
  function (e, t) {
    !(function () {
      const e = new WeakMap();
      class t extends THRDev3.Loader {
        constructor(e) {
          super(e),
            (this.decoderPath = ""),
            (this.decoderConfig = {}),
            (this.decoderBinary = null),
            (this.decoderPending = null),
            (this.workerLimit = 4),
            (this.workerPool = []),
            (this.workerNextTaskID = 1),
            (this.workerSourceURL = ""),
            (this.defaultAttributeIDs = {
              position: "POSITION",
              normal: "NORMAL",
              color: "COLOR",
              uv: "TEX_COORD",
            }),
            (this.defaultAttributeTypes = {
              position: "Float32Array",
              normal: "Float32Array",
              color: "Float32Array",
              uv: "Float32Array",
            });
        }
        setDecoderPath(e) {
          return (this.decoderPath = e), this;
        }
        setDecoderConfig(e) {
          return (this.decoderConfig = e), this;
        }
        setWorkerLimit(e) {
          return (this.workerLimit = e), this;
        }
        load(e, t, n, i) {
          const o = new THRDev3.FileLoader(this.manager);
          o.setPath(this.path),
            o.setResponseType("arraybuffer"),
            o.setRequestHeader(this.requestHeader),
            o.setWithCredentials(this.withCredentials),
            o.load(
              e,
              (e) => {
                const n = {
                  attributeIDs: this.defaultAttributeIDs,
                  attributeTypes: this.defaultAttributeTypes,
                  useUniqueIDs: !1,
                };
                this.decodeGeometry(e, n).then(t).catch(i);
              },
              n,
              i
            );
        }
        decodeDracoFile(e, t, n, i) {
          const o = {
            attributeIDs: n || this.defaultAttributeIDs,
            attributeTypes: i || this.defaultAttributeTypes,
            useUniqueIDs: !!n,
          };
          this.decodeGeometry(e, o).then(t);
        }
        decodeGeometry(t, n) {
          for (const e in n.attributeTypes) {
            const t = n.attributeTypes[e];
            void 0 !== t.BYTES_PER_ELEMENT && (n.attributeTypes[e] = t.name);
          }
          const i = JSON.stringify(n);
          if (e.has(t)) {
            const n = e.get(t);
            if (n.key === i) return n.promise;
            if (0 === t.byteLength)
              throw new Error(
                "THRDev3.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred."
              );
          }
          let o;
          const s = this.workerNextTaskID++,
            r = t.byteLength,
            a = this._getWorker(s, r)
              .then(
                (e) => (
                  (o = e),
                  new Promise((e, i) => {
                    (o._callbacks[s] = { resolve: e, reject: i }),
                      o.postMessage(
                        { type: "decode", id: s, taskConfig: n, buffer: t },
                        [t]
                      );
                  })
                )
              )
              .then((e) => this._createGeometry(e.geometry));
          return (
            a
              .catch(() => !0)
              .then(() => {
                o && s && this._releaseTask(o, s);
              }),
            e.set(t, { key: i, promise: a }),
            a
          );
        }
        _createGeometry(e) {
          const t = new THRDev3.BufferGeometry();
          e.index && t.setIndex(new THRDev3.BufferAttribute(e.index.array, 1));
          for (let n = 0; n < e.attributes.length; n++) {
            const i = e.attributes[n],
              o = i.name,
              s = i.array,
              r = i.itemSize;
            t.setAttribute(o, new THRDev3.BufferAttribute(s, r));
          }
          return t;
        }
        _loadLibrary(e, t) {
          const n = new THRDev3.FileLoader(this.manager);
          return (
            n.setPath(this.decoderPath),
            n.setResponseType(t),
            n.setWithCredentials(this.withCredentials),
            new Promise((t, i) => {
              n.load(e, t, void 0, i);
            })
          );
        }
        preload() {
          return this._initDecoder(), this;
        }
        _initDecoder() {
          if (this.decoderPending) return this.decoderPending;
          const e =
              "object" != typeof WebAssembly ||
              "js" === this.decoderConfig.type,
            t = [];
          return (
            e
              ? t.push(this._loadLibrary("draco_decoder.js", "text"))
              : (t.push(this._loadLibrary("draco_wasm_wrapper.js", "text")),
                t.push(this._loadLibrary("draco_decoder.wasm", "arraybuffer"))),
            (this.decoderPending = Promise.all(t).then((t) => {
              const i = t[0];
              e || (this.decoderConfig.wasmBinary = t[1]);
              const o = n.toString(),
                s = [
                  "/* draco decoder */",
                  i,
                  "",
                  "/* worker */",
                  o.substring(o.indexOf("{") + 1, o.lastIndexOf("}")),
                ].join("\n");
              this.workerSourceURL = URL.createObjectURL(new Blob([s]));
            })),
            this.decoderPending
          );
        }
        _getWorker(e, t) {
          return this._initDecoder().then(() => {
            if (this.workerPool.length < this.workerLimit) {
              const e = new Worker(this.workerSourceURL);
              (e._callbacks = {}),
                (e._taskCosts = {}),
                (e._taskLoad = 0),
                e.postMessage({
                  type: "init",
                  decoderConfig: this.decoderConfig,
                }),
                (e.onmessage = function (t) {
                  const n = t.data;
                  switch (n.type) {
                    case "decode":
                      e._callbacks[n.id].resolve(n);
                      break;
                    case "error":
                      e._callbacks[n.id].reject(n);
                      break;
                    default:
                      console.error(
                        'THRDev3.DRACOLoader: Unexpected message, "' +
                          n.type +
                          '"'
                      );
                  }
                }),
                this.workerPool.push(e);
            } else
              this.workerPool.sort(function (e, t) {
                return e._taskLoad > t._taskLoad ? -1 : 1;
              });
            const n = this.workerPool[this.workerPool.length - 1];
            return (n._taskCosts[e] = t), (n._taskLoad += t), n;
          });
        }
        _releaseTask(e, t) {
          (e._taskLoad -= e._taskCosts[t]),
            delete e._callbacks[t],
            delete e._taskCosts[t];
        }
        debug() {
          console.log(
            "Task load: ",
            this.workerPool.map((e) => e._taskLoad)
          );
        }
        dispose() {
          for (let e = 0; e < this.workerPool.length; ++e)
            this.workerPool[e].terminate();
          return (this.workerPool.length = 0), this;
        }
      }
      function n() {
        let e, t;
        function n(e, t, n, i, o, s) {
          const r = s.num_components(),
            a = n.num_points() * r,
            l = a * o.BYTES_PER_ELEMENT,
            c = (function (e, t) {
              switch (t) {
                case Float32Array:
                  return e.DT_FLOAT32;
                case Int8Array:
                  return e.DT_INT8;
                case Int16Array:
                  return e.DT_INT16;
                case Int32Array:
                  return e.DT_INT32;
                case Uint8Array:
                  return e.DT_UINT8;
                case Uint16Array:
                  return e.DT_UINT16;
                case Uint32Array:
                  return e.DT_UINT32;
              }
            })(e, o),
            h = e._malloc(l);
          t.GetAttributeDataArrayForAllPoints(n, s, c, l, h);
          const u = new o(e.HEAPF32.buffer, h, a).slice();
          return e._free(h), { name: i, array: u, itemSize: r };
        }
        onmessage = function (i) {
          const o = i.data;
          switch (o.type) {
            case "init":
              (e = o.decoderConfig),
                (t = new Promise(function (t) {
                  (e.onModuleLoaded = function (e) {
                    t({ draco: e });
                  }),
                    DracoDecoderModule(e);
                }));
              break;
            case "decode":
              const i = o.buffer,
                s = o.taskConfig;
              t.then((e) => {
                const t = e.draco,
                  r = new t.Decoder(),
                  a = new t.DecoderBuffer();
                a.Init(new Int8Array(i), i.byteLength);
                try {
                  const e = (function (e, t, i, o) {
                      const s = o.attributeIDs,
                        r = o.attributeTypes;
                      let a, l;
                      const c = t.GetEncodedGeometryType(i);
                      if (c === e.TRIANGULAR_MESH)
                        (a = new e.Mesh()), (l = t.DecodeBufferToMesh(i, a));
                      else {
                        if (c !== e.POINT_CLOUD)
                          throw new Error(
                            "THRDev3.DRACOLoader: Unexpected geometry type."
                          );
                        (a = new e.PointCloud()),
                          (l = t.DecodeBufferToPointCloud(i, a));
                      }
                      if (!l.ok() || 0 === a.ptr)
                        throw new Error(
                          "THRDev3.DRACOLoader: Decoding failed: " +
                            l.error_msg()
                        );
                      const h = { index: null, attributes: [] };
                      for (const i in s) {
                        const l = self[r[i]];
                        let c, u;
                        if (o.useUniqueIDs)
                          (u = s[i]), (c = t.GetAttributeByUniqueId(a, u));
                        else {
                          if (((u = t.GetAttributeId(a, e[s[i]])), -1 === u))
                            continue;
                          c = t.GetAttribute(a, u);
                        }
                        h.attributes.push(n(e, t, a, i, l, c));
                      }
                      c === e.TRIANGULAR_MESH &&
                        (h.index = (function (e, t, n) {
                          const i = 3 * n.num_faces(),
                            o = 4 * i,
                            s = e._malloc(o);
                          t.GetTrianglesUInt32Array(n, o, s);
                          const r = new Uint32Array(
                            e.HEAPF32.buffer,
                            s,
                            i
                          ).slice();
                          return e._free(s), { array: r, itemSize: 1 };
                        })(e, t, a));
                      return e.destroy(a), h;
                    })(t, r, a, s),
                    i = e.attributes.map((e) => e.array.buffer);
                  e.index && i.push(e.index.array.buffer),
                    self.postMessage(
                      { type: "decode", id: o.id, geometry: e },
                      i
                    );
                } catch (e) {
                  console.error(e),
                    self.postMessage({
                      type: "error",
                      id: o.id,
                      error: e.message,
                    });
                } finally {
                  t.destroy(a), t.destroy(r);
                }
              });
          }
        };
      }
      THRDev3.DRACOLoader = t;
    })();
  },
  function (e, t) {
    !(function () {
      const e = /^[og]\s*(.+)?/,
        t = /^mtllib /,
        n = /^usemtl /,
        i = /^usemap /,
        o = /\s+/,
        s = new THRDev3.Vector3(),
        r = new THRDev3.Vector3(),
        a = new THRDev3.Vector3(),
        l = new THRDev3.Vector3(),
        c = new THRDev3.Vector3(),
        h = new THRDev3.Color();
      function u() {
        const e = {
          objects: [],
          object: {},
          vertices: [],
          normals: [],
          colors: [],
          uvs: [],
          materials: {},
          materialLibraries: [],
          startObject: function (e, t) {
            if (this.object && !1 === this.object.fromDeclaration)
              return (
                (this.object.name = e),
                void (this.object.fromDeclaration = !1 !== t)
              );
            const n =
              this.object && "function" == typeof this.object.currentMaterial
                ? this.object.currentMaterial()
                : void 0;
            if (
              (this.object &&
                "function" == typeof this.object._finalize &&
                this.object._finalize(!0),
              (this.object = {
                name: e || "",
                fromDeclaration: !1 !== t,
                geometry: {
                  vertices: [],
                  normals: [],
                  colors: [],
                  uvs: [],
                  hasUVIndices: !1,
                },
                materials: [],
                smooth: !0,
                startMaterial: function (e, t) {
                  const n = this._finalize(!1);
                  n &&
                    (n.inherited || n.groupCount <= 0) &&
                    this.materials.splice(n.index, 1);
                  const i = {
                    index: this.materials.length,
                    name: e || "",
                    mtllib:
                      Array.isArray(t) && t.length > 0 ? t[t.length - 1] : "",
                    smooth: void 0 !== n ? n.smooth : this.smooth,
                    groupStart: void 0 !== n ? n.groupEnd : 0,
                    groupEnd: -1,
                    groupCount: -1,
                    inherited: !1,
                    clone: function (e) {
                      const t = {
                        index: "number" == typeof e ? e : this.index,
                        name: this.name,
                        mtllib: this.mtllib,
                        smooth: this.smooth,
                        groupStart: 0,
                        groupEnd: -1,
                        groupCount: -1,
                        inherited: !1,
                      };
                      return (t.clone = this.clone.bind(t)), t;
                    },
                  };
                  return this.materials.push(i), i;
                },
                currentMaterial: function () {
                  if (this.materials.length > 0)
                    return this.materials[this.materials.length - 1];
                },
                _finalize: function (e) {
                  const t = this.currentMaterial();
                  if (
                    (t &&
                      -1 === t.groupEnd &&
                      ((t.groupEnd = this.geometry.vertices.length / 3),
                      (t.groupCount = t.groupEnd - t.groupStart),
                      (t.inherited = !1)),
                    e && this.materials.length > 1)
                  )
                    for (let e = this.materials.length - 1; e >= 0; e--)
                      this.materials[e].groupCount <= 0 &&
                        this.materials.splice(e, 1);
                  return (
                    e &&
                      0 === this.materials.length &&
                      this.materials.push({ name: "", smooth: this.smooth }),
                    t
                  );
                },
              }),
              n && n.name && "function" == typeof n.clone)
            ) {
              const e = n.clone(0);
              (e.inherited = !0), this.object.materials.push(e);
            }
            this.objects.push(this.object);
          },
          finalize: function () {
            this.object &&
              "function" == typeof this.object._finalize &&
              this.object._finalize(!0);
          },
          parseVertexIndex: function (e, t) {
            const n = parseInt(e, 10);
            return 3 * (n >= 0 ? n - 1 : n + t / 3);
          },
          parseNormalIndex: function (e, t) {
            const n = parseInt(e, 10);
            return 3 * (n >= 0 ? n - 1 : n + t / 3);
          },
          parseUVIndex: function (e, t) {
            const n = parseInt(e, 10);
            return 2 * (n >= 0 ? n - 1 : n + t / 2);
          },
          addVertex: function (e, t, n) {
            const i = this.vertices,
              o = this.object.geometry.vertices;
            o.push(i[e + 0], i[e + 1], i[e + 2]),
              o.push(i[t + 0], i[t + 1], i[t + 2]),
              o.push(i[n + 0], i[n + 1], i[n + 2]);
          },
          addVertexPoint: function (e) {
            const t = this.vertices;
            this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]);
          },
          addVertexLine: function (e) {
            const t = this.vertices;
            this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]);
          },
          addNormal: function (e, t, n) {
            const i = this.normals,
              o = this.object.geometry.normals;
            o.push(i[e + 0], i[e + 1], i[e + 2]),
              o.push(i[t + 0], i[t + 1], i[t + 2]),
              o.push(i[n + 0], i[n + 1], i[n + 2]);
          },
          addFaceNormal: function (e, t, n) {
            const i = this.vertices,
              o = this.object.geometry.normals;
            s.fromArray(i, e),
              r.fromArray(i, t),
              a.fromArray(i, n),
              c.subVectors(a, r),
              l.subVectors(s, r),
              c.cross(l),
              c.normalize(),
              o.push(c.x, c.y, c.z),
              o.push(c.x, c.y, c.z),
              o.push(c.x, c.y, c.z);
          },
          addColor: function (e, t, n) {
            const i = this.colors,
              o = this.object.geometry.colors;
            void 0 !== i[e] && o.push(i[e + 0], i[e + 1], i[e + 2]),
              void 0 !== i[t] && o.push(i[t + 0], i[t + 1], i[t + 2]),
              void 0 !== i[n] && o.push(i[n + 0], i[n + 1], i[n + 2]);
          },
          addUV: function (e, t, n) {
            const i = this.uvs,
              o = this.object.geometry.uvs;
            o.push(i[e + 0], i[e + 1]),
              o.push(i[t + 0], i[t + 1]),
              o.push(i[n + 0], i[n + 1]);
          },
          addDefaultUV: function () {
            const e = this.object.geometry.uvs;
            e.push(0, 0), e.push(0, 0), e.push(0, 0);
          },
          addUVLine: function (e) {
            const t = this.uvs;
            this.object.geometry.uvs.push(t[e + 0], t[e + 1]);
          },
          addFace: function (e, t, n, i, o, s, r, a, l) {
            const c = this.vertices.length;
            let h = this.parseVertexIndex(e, c),
              u = this.parseVertexIndex(t, c),
              d = this.parseVertexIndex(n, c);
            if (
              (this.addVertex(h, u, d),
              this.addColor(h, u, d),
              void 0 !== r && "" !== r)
            ) {
              const e = this.normals.length;
              (h = this.parseNormalIndex(r, e)),
                (u = this.parseNormalIndex(a, e)),
                (d = this.parseNormalIndex(l, e)),
                this.addNormal(h, u, d);
            } else this.addFaceNormal(h, u, d);
            if (void 0 !== i && "" !== i) {
              const e = this.uvs.length;
              (h = this.parseUVIndex(i, e)),
                (u = this.parseUVIndex(o, e)),
                (d = this.parseUVIndex(s, e)),
                this.addUV(h, u, d),
                (this.object.geometry.hasUVIndices = !0);
            } else this.addDefaultUV();
          },
          addPointGeometry: function (e) {
            this.object.geometry.type = "Points";
            const t = this.vertices.length;
            for (let n = 0, i = e.length; n < i; n++) {
              const i = this.parseVertexIndex(e[n], t);
              this.addVertexPoint(i), this.addColor(i);
            }
          },
          addLineGeometry: function (e, t) {
            this.object.geometry.type = "Line";
            const n = this.vertices.length,
              i = this.uvs.length;
            for (let t = 0, i = e.length; t < i; t++)
              this.addVertexLine(this.parseVertexIndex(e[t], n));
            for (let e = 0, n = t.length; e < n; e++)
              this.addUVLine(this.parseUVIndex(t[e], i));
          },
        };
        return e.startObject("", !1), e;
      }
      class d extends THRDev3.Loader {
        constructor(e) {
          super(e), (this.materials = null);
        }
        load(e, t, n, i) {
          const o = this,
            s = new THRDev3.FileLoader(this.manager);
          s.setPath(this.path),
            s.setRequestHeader(this.requestHeader),
            s.setWithCredentials(this.withCredentials),
            s.load(
              e,
              function (n) {
                try {
                  t(o.parse(n));
                } catch (t) {
                  i ? i(t) : console.error(t), o.manager.itemError(e);
                }
              },
              n,
              i
            );
        }
        setMaterials(e) {
          return (this.materials = e), this;
        }
        parse(s) {
          const r = new u();
          -1 !== s.indexOf("\r\n") && (s = s.replace(/\r\n/g, "\n")),
            -1 !== s.indexOf("\\\n") && (s = s.replace(/\\\n/g, ""));
          const a = s.split("\n");
          let l = [];
          for (let s = 0, c = a.length; s < c; s++) {
            const c = a[s].trimStart();
            if (0 === c.length) continue;
            const u = c.charAt(0);
            if ("#" !== u)
              if ("v" === u) {
                const e = c.split(o);
                switch (e[0]) {
                  case "v":
                    r.vertices.push(
                      parseFloat(e[1]),
                      parseFloat(e[2]),
                      parseFloat(e[3])
                    ),
                      e.length >= 7
                        ? (h
                            .setRGB(
                              parseFloat(e[4]),
                              parseFloat(e[5]),
                              parseFloat(e[6])
                            )
                            .convertSRGBToLinear(),
                          r.colors.push(h.r, h.g, h.b))
                        : r.colors.push(void 0, void 0, void 0);
                    break;
                  case "vn":
                    r.normals.push(
                      parseFloat(e[1]),
                      parseFloat(e[2]),
                      parseFloat(e[3])
                    );
                    break;
                  case "vt":
                    r.uvs.push(parseFloat(e[1]), parseFloat(e[2]));
                }
              } else if ("f" === u) {
                const e = c.slice(1).trim().split(o),
                  t = [];
                for (let n = 0, i = e.length; n < i; n++) {
                  const i = e[n];
                  if (i.length > 0) {
                    const e = i.split("/");
                    t.push(e);
                  }
                }
                const n = t[0];
                for (let e = 1, i = t.length - 1; e < i; e++) {
                  const i = t[e],
                    o = t[e + 1];
                  r.addFace(
                    n[0],
                    i[0],
                    o[0],
                    n[1],
                    i[1],
                    o[1],
                    n[2],
                    i[2],
                    o[2]
                  );
                }
              } else if ("l" === u) {
                const e = c.substring(1).trim().split(" ");
                let t = [];
                const n = [];
                if (-1 === c.indexOf("/")) t = e;
                else
                  for (let i = 0, o = e.length; i < o; i++) {
                    const o = e[i].split("/");
                    "" !== o[0] && t.push(o[0]), "" !== o[1] && n.push(o[1]);
                  }
                r.addLineGeometry(t, n);
              } else if ("p" === u) {
                const e = c.slice(1).trim().split(" ");
                r.addPointGeometry(e);
              } else if (null !== (l = e.exec(c))) {
                const e = (" " + l[0].slice(1).trim()).slice(1);
                r.startObject(e);
              } else if (n.test(c))
                r.object.startMaterial(
                  c.substring(7).trim(),
                  r.materialLibraries
                );
              else if (t.test(c))
                r.materialLibraries.push(c.substring(7).trim());
              else if (i.test(c))
                console.warn(
                  'THRDev3.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'
                );
              else if ("s" === u) {
                if (((l = c.split(" ")), l.length > 1)) {
                  const e = l[1].trim().toLowerCase();
                  r.object.smooth = "0" !== e && "off" !== e;
                } else r.object.smooth = !0;
                const e = r.object.currentMaterial();
                e && (e.smooth = r.object.smooth);
              } else {
                if ("\0" === c) continue;
                console.warn('THRDev3.OBJLoader: Unexpected line: "' + c + '"');
              }
          }
          r.finalize();
          const c = new THRDev3.Group();
          c.materialLibraries = [].concat(r.materialLibraries);
          if (
            !0 ===
            !(
              1 === r.objects.length &&
              0 === r.objects[0].geometry.vertices.length
            )
          )
            for (let e = 0, t = r.objects.length; e < t; e++) {
              const t = r.objects[e],
                n = t.geometry,
                i = t.materials,
                o = "Line" === n.type,
                s = "Points" === n.type;
              let a = !1;
              if (0 === n.vertices.length) continue;
              const l = new THRDev3.BufferGeometry();
              l.setAttribute(
                "position",
                new THRDev3.Float32BufferAttribute(n.vertices, 3)
              ),
                n.normals.length > 0 &&
                  l.setAttribute(
                    "normal",
                    new THRDev3.Float32BufferAttribute(n.normals, 3)
                  ),
                n.colors.length > 0 &&
                  ((a = !0),
                  l.setAttribute(
                    "color",
                    new THRDev3.Float32BufferAttribute(n.colors, 3)
                  )),
                !0 === n.hasUVIndices &&
                  l.setAttribute(
                    "uv",
                    new THRDev3.Float32BufferAttribute(n.uvs, 2)
                  );
              const h = [];
              for (let e = 0, t = i.length; e < t; e++) {
                const t = i[e],
                  n = t.name + "_" + t.smooth + "_" + a;
                let l = r.materials[n];
                if (null !== this.materials)
                  if (
                    ((l = this.materials.create(t.name)),
                    !o || !l || l instanceof THRDev3.LineBasicMaterial)
                  ) {
                    if (s && l && !(l instanceof THRDev3.PointsMaterial)) {
                      const e = new THRDev3.PointsMaterial({
                        size: 10,
                        sizeAttenuation: !1,
                      });
                      THRDev3.Material.prototype.copy.call(e, l),
                        e.color.copy(l.color),
                        (e.map = l.map),
                        (l = e);
                    }
                  } else {
                    const e = new THRDev3.LineBasicMaterial();
                    THRDev3.Material.prototype.copy.call(e, l),
                      e.color.copy(l.color),
                      (l = e);
                  }
                void 0 === l &&
                  ((l = o
                    ? new THRDev3.LineBasicMaterial()
                    : s
                    ? new THRDev3.PointsMaterial({
                        size: 1,
                        sizeAttenuation: !1,
                      })
                    : new THRDev3.MeshPhongMaterial()),
                  (l.name = t.name),
                  (l.flatShading = !t.smooth),
                  (l.vertexColors = a),
                  (r.materials[n] = l)),
                  h.push(l);
              }
              let u;
              if (h.length > 1) {
                for (let e = 0, t = i.length; e < t; e++) {
                  const t = i[e];
                  l.addGroup(t.groupStart, t.groupCount, e);
                }
                u = o
                  ? new THRDev3.LineSegments(l, h)
                  : s
                  ? new THRDev3.Points(l, h)
                  : new THRDev3.Mesh(l, h);
              } else
                u = o
                  ? new THRDev3.LineSegments(l, h[0])
                  : s
                  ? new THRDev3.Points(l, h[0])
                  : new THRDev3.Mesh(l, h[0]);
              (u.name = t.name), c.add(u);
            }
          else if (r.vertices.length > 0) {
            const e = new THRDev3.PointsMaterial({
                size: 1,
                sizeAttenuation: !1,
              }),
              t = new THRDev3.BufferGeometry();
            t.setAttribute(
              "position",
              new THRDev3.Float32BufferAttribute(r.vertices, 3)
            ),
              r.colors.length > 0 &&
                void 0 !== r.colors[0] &&
                (t.setAttribute(
                  "color",
                  new THRDev3.Float32BufferAttribute(r.colors, 3)
                ),
                (e.vertexColors = !0));
            const n = new THRDev3.Points(t, e);
            c.add(n);
          }
          return c;
        }
      }
      THRDev3.OBJLoader = d;
    })();
  },
  function (e, t) {
    !(function () {
      class e extends THRDev3.Loader {
        constructor(e) {
          super(e);
        }
        load(e, t, n, i) {
          const o = this,
            s =
              "" === this.path
                ? THRDev3.LoaderUtils.extractUrlBase(e)
                : this.path,
            r = new THRDev3.FileLoader(this.manager);
          r.setPath(this.path),
            r.setRequestHeader(this.requestHeader),
            r.setWithCredentials(this.withCredentials),
            r.load(
              e,
              function (n) {
                try {
                  t(o.parse(n, s));
                } catch (t) {
                  i ? i(t) : console.error(t), o.manager.itemError(e);
                }
              },
              n,
              i
            );
        }
        setMaterialOptions(e) {
          return (this.materialOptions = e), this;
        }
        parse(e, n) {
          const i = e.split("\n");
          let o = {};
          const s = /\s+/,
            r = {};
          for (let e = 0; e < i.length; e++) {
            let t = i[e];
            if (((t = t.trim()), 0 === t.length || "#" === t.charAt(0)))
              continue;
            const n = t.indexOf(" ");
            let a = n >= 0 ? t.substring(0, n) : t;
            a = a.toLowerCase();
            let l = n >= 0 ? t.substring(n + 1) : "";
            if (((l = l.trim()), "newmtl" === a)) (o = { name: l }), (r[l] = o);
            else if ("ka" === a || "kd" === a || "ks" === a || "ke" === a) {
              const e = l.split(s, 3);
              o[a] = [parseFloat(e[0]), parseFloat(e[1]), parseFloat(e[2])];
            } else o[a] = l;
          }
          const a = new t(this.resourcePath || n, this.materialOptions);
          return (
            a.setCrossOrigin(this.crossOrigin),
            a.setManager(this.manager),
            a.setMaterials(r),
            a
          );
        }
      }
      class t {
        constructor(e = "", t = {}) {
          (this.baseUrl = e),
            (this.options = t),
            (this.materialsInfo = {}),
            (this.materials = {}),
            (this.materialsArray = []),
            (this.nameLookup = {}),
            (this.crossOrigin = "anonymous"),
            (this.side =
              void 0 !== this.options.side
                ? this.options.side
                : THRDev3.FrontSide),
            (this.wrap =
              void 0 !== this.options.wrap
                ? this.options.wrap
                : THRDev3.RepeatWrapping);
        }
        setCrossOrigin(e) {
          return (this.crossOrigin = e), this;
        }
        setManager(e) {
          this.manager = e;
        }
        setMaterials(e) {
          (this.materialsInfo = this.convert(e)),
            (this.materials = {}),
            (this.materialsArray = []),
            (this.nameLookup = {});
        }
        convert(e) {
          if (!this.options) return e;
          const t = {};
          for (const n in e) {
            const i = e[n],
              o = {};
            t[n] = o;
            for (const e in i) {
              let t = !0,
                n = i[e];
              const s = e.toLowerCase();
              switch (s) {
                case "kd":
                case "ka":
                case "ks":
                  this.options &&
                    this.options.normalizeRGB &&
                    (n = [n[0] / 255, n[1] / 255, n[2] / 255]),
                    this.options &&
                      this.options.ignoreZeroRGBs &&
                      0 === n[0] &&
                      0 === n[1] &&
                      0 === n[2] &&
                      (t = !1);
              }
              t && (o[s] = n);
            }
          }
          return t;
        }
        preload() {
          for (const e in this.materialsInfo) this.create(e);
        }
        getIndex(e) {
          return this.nameLookup[e];
        }
        getAsArray() {
          let e = 0;
          for (const t in this.materialsInfo)
            (this.materialsArray[e] = this.create(t)),
              (this.nameLookup[t] = e),
              e++;
          return this.materialsArray;
        }
        create(e) {
          return (
            void 0 === this.materials[e] && this.createMaterial_(e),
            this.materials[e]
          );
        }
        createMaterial_(e) {
          const t = this,
            n = this.materialsInfo[e],
            i = { name: e, side: this.side };
          function o(e, n) {
            if (i[e]) return;
            const o = t.getTextureParams(n, i),
              s = t.loadTexture(
                ((r = t.baseUrl),
                "string" != typeof (a = o.url) || "" === a
                  ? ""
                  : /^https?:\/\//i.test(a)
                  ? a
                  : r + a)
              );
            var r, a;
            s.repeat.copy(o.scale),
              s.offset.copy(o.offset),
              (s.wrapS = t.wrap),
              (s.wrapT = t.wrap),
              ("map" !== e && "emissiveMap" !== e) ||
                (s.encoding = THRDev3.sRGBEncoding),
              (i[e] = s);
          }
          for (const e in n) {
            const t = n[e];
            let s;
            if ("" !== t)
              switch (e.toLowerCase()) {
                case "kd":
                  i.color = new THRDev3.Color()
                    .fromArray(t)
                    .convertSRGBToLinear();
                  break;
                case "ks":
                  i.specular = new THRDev3.Color()
                    .fromArray(t)
                    .convertSRGBToLinear();
                  break;
                case "ke":
                  i.emissive = new THRDev3.Color()
                    .fromArray(t)
                    .convertSRGBToLinear();
                  break;
                case "map_kd":
                  o("map", t);
                  break;
                case "map_ks":
                  o("specularMap", t);
                  break;
                case "map_ke":
                  o("emissiveMap", t);
                  break;
                case "norm":
                  o("normalMap", t);
                  break;
                case "map_bump":
                case "bump":
                  o("bumpMap", t);
                  break;
                case "map_d":
                  o("alphaMap", t), (i.transparent = !0);
                  break;
                case "ns":
                  i.shininess = parseFloat(t);
                  break;
                case "d":
                  (s = parseFloat(t)),
                    s < 1 && ((i.opacity = s), (i.transparent = !0));
                  break;
                case "tr":
                  (s = parseFloat(t)),
                    this.options &&
                      this.options.invertTrProperty &&
                      (s = 1 - s),
                    s > 0 && ((i.opacity = 1 - s), (i.transparent = !0));
              }
          }
          return (
            (this.materials[e] = new THRDev3.MeshPhongMaterial(i)),
            this.materials[e]
          );
        }
        getTextureParams(e, t) {
          const n = {
              scale: new THRDev3.Vector2(1, 1),
              offset: new THRDev3.Vector2(0, 0),
            },
            i = e.split(/\s+/);
          let o;
          return (
            (o = i.indexOf("-bm")),
            o >= 0 && ((t.bumpScale = parseFloat(i[o + 1])), i.splice(o, 2)),
            (o = i.indexOf("-s")),
            o >= 0 &&
              (n.scale.set(parseFloat(i[o + 1]), parseFloat(i[o + 2])),
              i.splice(o, 4)),
            (o = i.indexOf("-o")),
            o >= 0 &&
              (n.offset.set(parseFloat(i[o + 1]), parseFloat(i[o + 2])),
              i.splice(o, 4)),
            (n.url = i.join(" ").trim()),
            n
          );
        }
        loadTexture(e, t, n, i, o) {
          const s =
            void 0 !== this.manager
              ? this.manager
              : THRDev3.DefaultLoadingManager;
          let r = s.getHandler(e);
          null === r && (r = new THRDev3.TextureLoader(s)),
            r.setCrossOrigin && r.setCrossOrigin(this.crossOrigin);
          const a = r.load(e, n, i, o);
          return void 0 !== t && (a.mapping = t), a;
        }
      }
      THRDev3.MTLLoader = e;
    })();
  },
  function (e, t) {
    !(function () {
      const e = new THRDev3.Raycaster(),
        t = new THRDev3.Vector3(),
        n = new THRDev3.Vector3(),
        i = new THRDev3.Quaternion(),
        o = {
          X: new THRDev3.Vector3(1, 0, 0),
          Y: new THRDev3.Vector3(0, 1, 0),
          Z: new THRDev3.Vector3(0, 0, 1),
        },
        s = { type: "change" },
        r = { type: "mouseDown" },
        a = { type: "mouseUp", mode: null },
        l = { type: "objectChange" };
      class c extends THRDev3.Object3D {
        constructor(e, t) {
          super(),
            void 0 === t &&
              (console.warn(
                'THRDev3.TransformControls: The second parameter "domElement" is now mandatory.'
              ),
              (t = document)),
            (this.isTransformControls = !0),
            (this.visible = !1),
            (this.domElement = t),
            (this.domElement.style.touchAction = "none");
          const n = new A();
          (this._gizmo = n), this.add(n);
          const i = new E();
          (this._plane = i), this.add(i);
          const o = this;
          function r(e, t) {
            let r = t;
            Object.defineProperty(o, e, {
              get: function () {
                return void 0 !== r ? r : t;
              },
              set: function (t) {
                r !== t &&
                  ((r = t),
                  (i[e] = t),
                  (n[e] = t),
                  o.dispatchEvent({ type: e + "-changed", value: t }),
                  o.dispatchEvent(s));
              },
            }),
              (o[e] = t),
              (i[e] = t),
              (n[e] = t);
          }
          r("camera", e),
            r("object", void 0),
            r("enabled", !0),
            r("axis", null),
            r("mode", "translate"),
            r("translationSnap", null),
            r("rotationSnap", null),
            r("scaleSnap", null),
            r("space", "world"),
            r("size", 1),
            r("dragging", !1),
            r("showX", !0),
            r("showY", !0),
            r("showZ", !0);
          const a = new THRDev3.Vector3(),
            l = new THRDev3.Vector3(),
            c = new THRDev3.Quaternion(),
            m = new THRDev3.Quaternion(),
            g = new THRDev3.Vector3(),
            v = new THRDev3.Quaternion(),
            y = new THRDev3.Vector3(),
            b = new THRDev3.Vector3(),
            x = new THRDev3.Vector3(),
            w = new THRDev3.Vector3();
          r("worldPosition", a),
            r("worldPositionStart", l),
            r("worldQuaternion", c),
            r("worldQuaternionStart", m),
            r("cameraPosition", g),
            r("cameraQuaternion", v),
            r("pointStart", y),
            r("pointEnd", b),
            r("rotationAxis", x),
            r("rotationAngle", 0),
            r("eye", w),
            (this._offset = new THRDev3.Vector3()),
            (this._startNorm = new THRDev3.Vector3()),
            (this._endNorm = new THRDev3.Vector3()),
            (this._cameraScale = new THRDev3.Vector3()),
            (this._parentPosition = new THRDev3.Vector3()),
            (this._parentQuaternion = new THRDev3.Quaternion()),
            (this._parentQuaternionInv = new THRDev3.Quaternion()),
            (this._parentScale = new THRDev3.Vector3()),
            (this._worldScaleStart = new THRDev3.Vector3()),
            (this._worldQuaternionInv = new THRDev3.Quaternion()),
            (this._worldScale = new THRDev3.Vector3()),
            (this._positionStart = new THRDev3.Vector3()),
            (this._quaternionStart = new THRDev3.Quaternion()),
            (this._scaleStart = new THRDev3.Vector3()),
            (this._getPointer = h.bind(this)),
            (this._onPointerDown = d.bind(this)),
            (this._onPointerHover = u.bind(this)),
            (this._onPointerMove = p.bind(this)),
            (this._onPointerUp = f.bind(this)),
            this.domElement.addEventListener(
              "pointerdown",
              this._onPointerDown
            ),
            this.domElement.addEventListener(
              "pointermove",
              this._onPointerHover
            ),
            this.domElement.addEventListener("pointerup", this._onPointerUp);
        }
        updateMatrixWorld() {
          void 0 !== this.object &&
            (this.object.updateMatrixWorld(),
            null === this.object.parent
              ? console.error(
                  "TransformControls: The attached 3D object must be a part of the scene graph."
                )
              : this.object.parent.matrixWorld.decompose(
                  this._parentPosition,
                  this._parentQuaternion,
                  this._parentScale
                ),
            this.object.matrixWorld.decompose(
              this.worldPosition,
              this.worldQuaternion,
              this._worldScale
            ),
            this._parentQuaternionInv.copy(this._parentQuaternion).invert(),
            this._worldQuaternionInv.copy(this.worldQuaternion).invert()),
            this.camera.updateMatrixWorld(),
            this.camera.matrixWorld.decompose(
              this.cameraPosition,
              this.cameraQuaternion,
              this._cameraScale
            ),
            this.camera.isOrthographicCamera
              ? this.camera.getWorldDirection(this.eye)
              : this.eye
                  .copy(this.cameraPosition)
                  .sub(this.worldPosition)
                  .normalize(),
            super.updateMatrixWorld(this);
        }
        pointerHover(t) {
          if (void 0 === this.object || !0 === this.dragging) return;
          e.setFromCamera(t, this.camera);
          const n = m(this._gizmo.picker[this.mode], e);
          this.axis = n ? n.object.name : null;
        }
        pointerDown(t) {
          if (
            void 0 !== this.object &&
            !0 !== this.dragging &&
            0 === t.button &&
            null !== this.axis
          ) {
            e.setFromCamera(t, this.camera);
            const n = m(this._plane, e, !0);
            n &&
              (this.object.updateMatrixWorld(),
              this.object.parent.updateMatrixWorld(),
              this._positionStart.copy(this.object.position),
              this._quaternionStart.copy(this.object.quaternion),
              this._scaleStart.copy(this.object.scale),
              this.object.matrixWorld.decompose(
                this.worldPositionStart,
                this.worldQuaternionStart,
                this._worldScaleStart
              ),
              this.pointStart.copy(n.point).sub(this.worldPositionStart)),
              (this.dragging = !0),
              (r.mode = this.mode),
              this.dispatchEvent(r);
          }
        }
        pointerMove(r) {
          const a = this.axis,
            c = this.mode,
            h = this.object;
          let u = this.space;
          if (
            ("scale" === c
              ? (u = "local")
              : ("E" !== a && "XYZE" !== a && "XYZ" !== a) || (u = "world"),
            void 0 === h ||
              null === a ||
              !1 === this.dragging ||
              -1 !== r.button)
          )
            return;
          e.setFromCamera(r, this.camera);
          const d = m(this._plane, e, !0);
          if (d) {
            if (
              (this.pointEnd.copy(d.point).sub(this.worldPositionStart),
              "translate" === c)
            )
              this._offset.copy(this.pointEnd).sub(this.pointStart),
                "local" === u &&
                  "XYZ" !== a &&
                  this._offset.applyQuaternion(this._worldQuaternionInv),
                -1 === a.indexOf("X") && (this._offset.x = 0),
                -1 === a.indexOf("Y") && (this._offset.y = 0),
                -1 === a.indexOf("Z") && (this._offset.z = 0),
                "local" === u && "XYZ" !== a
                  ? this._offset
                      .applyQuaternion(this._quaternionStart)
                      .divide(this._parentScale)
                  : this._offset
                      .applyQuaternion(this._parentQuaternionInv)
                      .divide(this._parentScale),
                h.position.copy(this._offset).add(this._positionStart),
                this.translationSnap &&
                  ("local" === u &&
                    (h.position.applyQuaternion(
                      i.copy(this._quaternionStart).invert()
                    ),
                    -1 !== a.search("X") &&
                      (h.position.x =
                        Math.round(h.position.x / this.translationSnap) *
                        this.translationSnap),
                    -1 !== a.search("Y") &&
                      (h.position.y =
                        Math.round(h.position.y / this.translationSnap) *
                        this.translationSnap),
                    -1 !== a.search("Z") &&
                      (h.position.z =
                        Math.round(h.position.z / this.translationSnap) *
                        this.translationSnap),
                    h.position.applyQuaternion(this._quaternionStart)),
                  "world" === u &&
                    (h.parent &&
                      h.position.add(
                        t.setFromMatrixPosition(h.parent.matrixWorld)
                      ),
                    -1 !== a.search("X") &&
                      (h.position.x =
                        Math.round(h.position.x / this.translationSnap) *
                        this.translationSnap),
                    -1 !== a.search("Y") &&
                      (h.position.y =
                        Math.round(h.position.y / this.translationSnap) *
                        this.translationSnap),
                    -1 !== a.search("Z") &&
                      (h.position.z =
                        Math.round(h.position.z / this.translationSnap) *
                        this.translationSnap),
                    h.parent &&
                      h.position.sub(
                        t.setFromMatrixPosition(h.parent.matrixWorld)
                      )));
            else if ("scale" === c) {
              if (-1 !== a.search("XYZ")) {
                let e = this.pointEnd.length() / this.pointStart.length();
                this.pointEnd.dot(this.pointStart) < 0 && (e *= -1),
                  n.set(e, e, e);
              } else
                t.copy(this.pointStart),
                  n.copy(this.pointEnd),
                  t.applyQuaternion(this._worldQuaternionInv),
                  n.applyQuaternion(this._worldQuaternionInv),
                  n.divide(t),
                  -1 === a.search("X") && (n.x = 1),
                  -1 === a.search("Y") && (n.y = 1),
                  -1 === a.search("Z") && (n.z = 1);
              h.scale.copy(this._scaleStart).multiply(n),
                this.scaleSnap &&
                  (-1 !== a.search("X") &&
                    (h.scale.x =
                      Math.round(h.scale.x / this.scaleSnap) * this.scaleSnap ||
                      this.scaleSnap),
                  -1 !== a.search("Y") &&
                    (h.scale.y =
                      Math.round(h.scale.y / this.scaleSnap) * this.scaleSnap ||
                      this.scaleSnap),
                  -1 !== a.search("Z") &&
                    (h.scale.z =
                      Math.round(h.scale.z / this.scaleSnap) * this.scaleSnap ||
                      this.scaleSnap));
            } else if ("rotate" === c) {
              this._offset.copy(this.pointEnd).sub(this.pointStart);
              const e =
                20 /
                this.worldPosition.distanceTo(
                  t.setFromMatrixPosition(this.camera.matrixWorld)
                );
              "E" === a
                ? (this.rotationAxis.copy(this.eye),
                  (this.rotationAngle = this.pointEnd.angleTo(this.pointStart)),
                  this._startNorm.copy(this.pointStart).normalize(),
                  this._endNorm.copy(this.pointEnd).normalize(),
                  (this.rotationAngle *=
                    this._endNorm.cross(this._startNorm).dot(this.eye) < 0
                      ? 1
                      : -1))
                : "XYZE" === a
                ? (this.rotationAxis
                    .copy(this._offset)
                    .cross(this.eye)
                    .normalize(),
                  (this.rotationAngle =
                    this._offset.dot(
                      t.copy(this.rotationAxis).cross(this.eye)
                    ) * e))
                : ("X" !== a && "Y" !== a && "Z" !== a) ||
                  (this.rotationAxis.copy(o[a]),
                  t.copy(o[a]),
                  "local" === u && t.applyQuaternion(this.worldQuaternion),
                  (this.rotationAngle =
                    this._offset.dot(t.cross(this.eye).normalize()) * e)),
                this.rotationSnap &&
                  (this.rotationAngle =
                    Math.round(this.rotationAngle / this.rotationSnap) *
                    this.rotationSnap),
                "local" === u && "E" !== a && "XYZE" !== a
                  ? (h.quaternion.copy(this._quaternionStart),
                    h.quaternion
                      .multiply(
                        i.setFromAxisAngle(
                          this.rotationAxis,
                          this.rotationAngle
                        )
                      )
                      .normalize())
                  : (this.rotationAxis.applyQuaternion(
                      this._parentQuaternionInv
                    ),
                    h.quaternion.copy(
                      i.setFromAxisAngle(this.rotationAxis, this.rotationAngle)
                    ),
                    h.quaternion.multiply(this._quaternionStart).normalize());
            }
            this.dispatchEvent(s), this.dispatchEvent(l);
          }
        }
        pointerUp(e) {
          0 === e.button &&
            (this.dragging &&
              null !== this.axis &&
              ((a.mode = this.mode), this.dispatchEvent(a)),
            (this.dragging = !1),
            (this.axis = null));
        }
        dispose() {
          this.domElement.removeEventListener(
            "pointerdown",
            this._onPointerDown
          ),
            this.domElement.removeEventListener(
              "pointermove",
              this._onPointerHover
            ),
            this.domElement.removeEventListener(
              "pointermove",
              this._onPointerMove
            ),
            this.domElement.removeEventListener("pointerup", this._onPointerUp),
            this.traverse(function (e) {
              e.geometry && e.geometry.dispose(),
                e.material && e.material.dispose();
            });
        }
        attach(e) {
          return (this.object = e), (this.visible = !0), this;
        }
        detach() {
          return (
            (this.object = void 0),
            (this.visible = !1),
            (this.axis = null),
            this
          );
        }
        reset() {
          this.enabled &&
            this.dragging &&
            (this.object.position.copy(this._positionStart),
            this.object.quaternion.copy(this._quaternionStart),
            this.object.scale.copy(this._scaleStart),
            this.dispatchEvent(s),
            this.dispatchEvent(l),
            this.pointStart.copy(this.pointEnd));
        }
        getRaycaster() {
          return e;
        }
        getMode() {
          return this.mode;
        }
        setMode(e) {
          this.mode = e;
        }
        setTranslationSnap(e) {
          this.translationSnap = e;
        }
        setRotationSnap(e) {
          this.rotationSnap = e;
        }
        setScaleSnap(e) {
          this.scaleSnap = e;
        }
        setSize(e) {
          this.size = e;
        }
        setSpace(e) {
          this.space = e;
        }
        update() {
          console.warn(
            "THRDev3.TransformControls: update function has no more functionality and therefore has been deprecated."
          );
        }
      }
      function h(e) {
        if (this.domElement.ownerDocument.pointerLockElement)
          return { x: 0, y: 0, button: e.button };
        {
          const t = this.domElement.getBoundingClientRect();
          return {
            x: ((e.clientX - t.left) / t.width) * 2 - 1,
            y: (-(e.clientY - t.top) / t.height) * 2 + 1,
            button: e.button,
          };
        }
      }
      function u(e) {
        if (this.enabled)
          switch (e.pointerType) {
            case "mouse":
            case "pen":
              this.pointerHover(this._getPointer(e));
          }
      }
      function d(e) {
        this.enabled &&
          (document.pointerLockElement ||
            this.domElement.setPointerCapture(e.pointerId),
          this.domElement.addEventListener("pointermove", this._onPointerMove),
          this.pointerHover(this._getPointer(e)),
          this.pointerDown(this._getPointer(e)));
      }
      function p(e) {
        this.enabled && this.pointerMove(this._getPointer(e));
      }
      function f(e) {
        this.enabled &&
          (this.domElement.releasePointerCapture(e.pointerId),
          this.domElement.removeEventListener(
            "pointermove",
            this._onPointerMove
          ),
          this.pointerUp(this._getPointer(e)));
      }
      function m(e, t, n) {
        const i = t.intersectObject(e, !0);
        for (let e = 0; e < i.length; e++)
          if (i[e].object.visible || n) return i[e];
        return !1;
      }
      const g = new THRDev3.Euler(),
        v = new THRDev3.Vector3(0, 1, 0),
        y = new THRDev3.Vector3(0, 0, 0),
        b = new THRDev3.Matrix4(),
        x = new THRDev3.Quaternion(),
        w = new THRDev3.Quaternion(),
        C = new THRDev3.Vector3(),
        T = new THRDev3.Matrix4(),
        _ = new THRDev3.Vector3(1, 0, 0),
        D = new THRDev3.Vector3(0, 1, 0),
        M = new THRDev3.Vector3(0, 0, 1),
        S = new THRDev3.Vector3(),
        P = new THRDev3.Vector3(),
        R = new THRDev3.Vector3();
      class A extends THRDev3.Object3D {
        constructor() {
          super(),
            (this.isTransformControlsGizmo = !0),
            (this.type = "TransformControlsGizmo");
          const e = new THRDev3.MeshBasicMaterial({
              depthTest: !1,
              depthWrite: !1,
              fog: !1,
              toneMapped: !1,
              transparent: !0,
            }),
            t = new THRDev3.LineBasicMaterial({
              depthTest: !1,
              depthWrite: !1,
              fog: !1,
              toneMapped: !1,
              transparent: !0,
            }),
            n = e.clone();
          n.opacity = 0.15;
          const i = t.clone();
          i.opacity = 0.5;
          const o = e.clone();
          o.color.setHex(16711680);
          const s = e.clone();
          s.color.setHex(65280);
          const r = e.clone();
          r.color.setHex(255);
          const a = e.clone();
          a.color.setHex(16711680), (a.opacity = 0.5);
          const l = e.clone();
          l.color.setHex(65280), (l.opacity = 0.5);
          const c = e.clone();
          c.color.setHex(255), (c.opacity = 0.5);
          const h = e.clone();
          h.opacity = 0.25;
          const u = e.clone();
          u.color.setHex(16776960), (u.opacity = 0.25);
          e.clone().color.setHex(16776960);
          const d = e.clone();
          d.color.setHex(7895160);
          const p = new THRDev3.CylinderGeometry(0, 0.04, 0.1, 12);
          p.translate(0, 0.05, 0);
          const f = new THRDev3.BoxGeometry(0.08, 0.08, 0.08);
          f.translate(0, 0.04, 0);
          const m = new THRDev3.BufferGeometry();
          m.setAttribute(
            "position",
            new THRDev3.Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3)
          );
          const g = new THRDev3.CylinderGeometry(0.0075, 0.0075, 0.5, 3);
          function v(e, t) {
            const n = new THRDev3.TorusGeometry(
              e,
              0.0075,
              3,
              64,
              t * Math.PI * 2
            );
            return n.rotateY(Math.PI / 2), n.rotateX(Math.PI / 2), n;
          }
          g.translate(0, 0.25, 0);
          const y = {
              X: [
                [new THRDev3.Mesh(p, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
                [new THRDev3.Mesh(p, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
                [new THRDev3.Mesh(g, o), [0, 0, 0], [0, 0, -Math.PI / 2]],
              ],
              Y: [
                [new THRDev3.Mesh(p, s), [0, 0.5, 0]],
                [new THRDev3.Mesh(p, s), [0, -0.5, 0], [Math.PI, 0, 0]],
                [new THRDev3.Mesh(g, s)],
              ],
              Z: [
                [new THRDev3.Mesh(p, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
                [new THRDev3.Mesh(p, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
                [new THRDev3.Mesh(g, r), null, [Math.PI / 2, 0, 0]],
              ],
              XYZ: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.OctahedronGeometry(0.1, 0),
                    h.clone()
                  ),
                  [0, 0, 0],
                ],
              ],
              XY: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.15, 0.15, 0.01),
                    c.clone()
                  ),
                  [0.15, 0.15, 0],
                ],
              ],
              YZ: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.15, 0.15, 0.01),
                    a.clone()
                  ),
                  [0, 0.15, 0.15],
                  [0, Math.PI / 2, 0],
                ],
              ],
              XZ: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.15, 0.15, 0.01),
                    l.clone()
                  ),
                  [0.15, 0, 0.15],
                  [-Math.PI / 2, 0, 0],
                ],
              ],
            },
            b = {
              X: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0.3, 0, 0],
                  [0, 0, -Math.PI / 2],
                ],
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [-0.3, 0, 0],
                  [0, 0, Math.PI / 2],
                ],
              ],
              Y: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, 0.3, 0],
                ],
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, -0.3, 0],
                  [0, 0, Math.PI],
                ],
              ],
              Z: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, 0, 0.3],
                  [Math.PI / 2, 0, 0],
                ],
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, 0, -0.3],
                  [-Math.PI / 2, 0, 0],
                ],
              ],
              XYZ: [
                [new THRDev3.Mesh(new THRDev3.OctahedronGeometry(0.2, 0), n)],
              ],
              XY: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.01), n),
                  [0.15, 0.15, 0],
                ],
              ],
              YZ: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.01), n),
                  [0, 0.15, 0.15],
                  [0, Math.PI / 2, 0],
                ],
              ],
              XZ: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.01), n),
                  [0.15, 0, 0.15],
                  [-Math.PI / 2, 0, 0],
                ],
              ],
            },
            x = {
              START: [
                [
                  new THRDev3.Mesh(new THRDev3.OctahedronGeometry(0.01, 2), i),
                  null,
                  null,
                  null,
                  "helper",
                ],
              ],
              END: [
                [
                  new THRDev3.Mesh(new THRDev3.OctahedronGeometry(0.01, 2), i),
                  null,
                  null,
                  null,
                  "helper",
                ],
              ],
              DELTA: [
                [
                  new THRDev3.Line(
                    (function () {
                      const e = new THRDev3.BufferGeometry();
                      return (
                        e.setAttribute(
                          "position",
                          new THRDev3.Float32BufferAttribute(
                            [0, 0, 0, 1, 1, 1],
                            3
                          )
                        ),
                        e
                      );
                    })(),
                    i
                  ),
                  null,
                  null,
                  null,
                  "helper",
                ],
              ],
              X: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [-1e3, 0, 0],
                  null,
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
              Y: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [0, -1e3, 0],
                  [0, 0, Math.PI / 2],
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
              Z: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [0, 0, -1e3],
                  [0, -Math.PI / 2, 0],
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
            },
            w = {
              XYZE: [
                [new THRDev3.Mesh(v(0.5, 1), d), null, [0, Math.PI / 2, 0]],
              ],
              X: [[new THRDev3.Mesh(v(0.5, 0.5), o)]],
              Y: [
                [new THRDev3.Mesh(v(0.5, 0.5), s), null, [0, 0, -Math.PI / 2]],
              ],
              Z: [
                [new THRDev3.Mesh(v(0.5, 0.5), r), null, [0, Math.PI / 2, 0]],
              ],
              E: [[new THRDev3.Mesh(v(0.75, 1), u), null, [0, Math.PI / 2, 0]]],
            },
            C = {
              AXIS: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [-1e3, 0, 0],
                  null,
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
            },
            T = {
              XYZE: [
                [new THRDev3.Mesh(new THRDev3.SphereGeometry(0.25, 10, 8), n)],
              ],
              X: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.TorusGeometry(0.5, 0.1, 4, 24),
                    n
                  ),
                  [0, 0, 0],
                  [0, -Math.PI / 2, -Math.PI / 2],
                ],
              ],
              Y: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.TorusGeometry(0.5, 0.1, 4, 24),
                    n
                  ),
                  [0, 0, 0],
                  [Math.PI / 2, 0, 0],
                ],
              ],
              Z: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.TorusGeometry(0.5, 0.1, 4, 24),
                    n
                  ),
                  [0, 0, 0],
                  [0, 0, -Math.PI / 2],
                ],
              ],
              E: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.TorusGeometry(0.75, 0.1, 2, 24),
                    n
                  ),
                ],
              ],
            },
            _ = {
              X: [
                [new THRDev3.Mesh(f, o), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
                [new THRDev3.Mesh(g, o), [0, 0, 0], [0, 0, -Math.PI / 2]],
                [new THRDev3.Mesh(f, o), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
              ],
              Y: [
                [new THRDev3.Mesh(f, s), [0, 0.5, 0]],
                [new THRDev3.Mesh(g, s)],
                [new THRDev3.Mesh(f, s), [0, -0.5, 0], [0, 0, Math.PI]],
              ],
              Z: [
                [new THRDev3.Mesh(f, r), [0, 0, 0.5], [Math.PI / 2, 0, 0]],
                [new THRDev3.Mesh(g, r), [0, 0, 0], [Math.PI / 2, 0, 0]],
                [new THRDev3.Mesh(f, r), [0, 0, -0.5], [-Math.PI / 2, 0, 0]],
              ],
              XY: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.15, 0.15, 0.01),
                    c
                  ),
                  [0.15, 0.15, 0],
                ],
              ],
              YZ: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.15, 0.15, 0.01),
                    a
                  ),
                  [0, 0.15, 0.15],
                  [0, Math.PI / 2, 0],
                ],
              ],
              XZ: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.15, 0.15, 0.01),
                    l
                  ),
                  [0.15, 0, 0.15],
                  [-Math.PI / 2, 0, 0],
                ],
              ],
              XYZ: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.BoxGeometry(0.1, 0.1, 0.1),
                    h.clone()
                  ),
                ],
              ],
            },
            D = {
              X: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0.3, 0, 0],
                  [0, 0, -Math.PI / 2],
                ],
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [-0.3, 0, 0],
                  [0, 0, Math.PI / 2],
                ],
              ],
              Y: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, 0.3, 0],
                ],
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, -0.3, 0],
                  [0, 0, Math.PI],
                ],
              ],
              Z: [
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, 0, 0.3],
                  [Math.PI / 2, 0, 0],
                ],
                [
                  new THRDev3.Mesh(
                    new THRDev3.CylinderGeometry(0.2, 0, 0.6, 4),
                    n
                  ),
                  [0, 0, -0.3],
                  [-Math.PI / 2, 0, 0],
                ],
              ],
              XY: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.01), n),
                  [0.15, 0.15, 0],
                ],
              ],
              YZ: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.01), n),
                  [0, 0.15, 0.15],
                  [0, Math.PI / 2, 0],
                ],
              ],
              XZ: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.01), n),
                  [0.15, 0, 0.15],
                  [-Math.PI / 2, 0, 0],
                ],
              ],
              XYZ: [
                [
                  new THRDev3.Mesh(new THRDev3.BoxGeometry(0.2, 0.2, 0.2), n),
                  [0, 0, 0],
                ],
              ],
            },
            M = {
              X: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [-1e3, 0, 0],
                  null,
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
              Y: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [0, -1e3, 0],
                  [0, 0, Math.PI / 2],
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
              Z: [
                [
                  new THRDev3.Line(m, i.clone()),
                  [0, 0, -1e3],
                  [0, -Math.PI / 2, 0],
                  [1e6, 1, 1],
                  "helper",
                ],
              ],
            };
          function S(e) {
            const t = new THRDev3.Object3D();
            for (const n in e)
              for (let i = e[n].length; i--; ) {
                const o = e[n][i][0].clone(),
                  s = e[n][i][1],
                  r = e[n][i][2],
                  a = e[n][i][3],
                  l = e[n][i][4];
                (o.name = n),
                  (o.tag = l),
                  s && o.position.set(s[0], s[1], s[2]),
                  r && o.rotation.set(r[0], r[1], r[2]),
                  a && o.scale.set(a[0], a[1], a[2]),
                  o.updateMatrix();
                const c = o.geometry.clone();
                c.applyMatrix4(o.matrix),
                  (o.geometry = c),
                  (o.renderOrder = 1 / 0),
                  o.position.set(0, 0, 0),
                  o.rotation.set(0, 0, 0),
                  o.scale.set(1, 1, 1),
                  t.add(o);
              }
            return t;
          }
          (this.gizmo = {}),
            (this.picker = {}),
            (this.helper = {}),
            this.add((this.gizmo.translate = S(y))),
            this.add((this.gizmo.rotate = S(w))),
            this.add((this.gizmo.scale = S(_))),
            this.add((this.picker.translate = S(b))),
            this.add((this.picker.rotate = S(T))),
            this.add((this.picker.scale = S(D))),
            this.add((this.helper.translate = S(x))),
            this.add((this.helper.rotate = S(C))),
            this.add((this.helper.scale = S(M))),
            (this.picker.translate.visible = !1),
            (this.picker.rotate.visible = !1),
            (this.picker.scale.visible = !1);
        }
        updateMatrixWorld(e) {
          const n =
            "local" === ("scale" === this.mode ? "local" : this.space)
              ? this.worldQuaternion
              : w;
          (this.gizmo.translate.visible = "translate" === this.mode),
            (this.gizmo.rotate.visible = "rotate" === this.mode),
            (this.gizmo.scale.visible = "scale" === this.mode),
            (this.helper.translate.visible = "translate" === this.mode),
            (this.helper.rotate.visible = "rotate" === this.mode),
            (this.helper.scale.visible = "scale" === this.mode);
          let o = [];
          (o = o.concat(this.picker[this.mode].children)),
            (o = o.concat(this.gizmo[this.mode].children)),
            (o = o.concat(this.helper[this.mode].children));
          for (let e = 0; e < o.length; e++) {
            const s = o[e];
            let r;
            if (
              ((s.visible = !0),
              s.rotation.set(0, 0, 0),
              s.position.copy(this.worldPosition),
              (r = this.camera.isOrthographicCamera
                ? (this.camera.top - this.camera.bottom) / this.camera.zoom
                : this.worldPosition.distanceTo(this.cameraPosition) *
                  Math.min(
                    (1.9 * Math.tan((Math.PI * this.camera.fov) / 360)) /
                      this.camera.zoom,
                    7
                  )),
              s.scale.set(1, 1, 1).multiplyScalar((r * this.size) / 4),
              "helper" !== s.tag)
            ) {
              if (
                (s.quaternion.copy(n),
                "translate" === this.mode || "scale" === this.mode)
              ) {
                const e = 0.99,
                  t = 0.2;
                "X" === s.name &&
                  Math.abs(v.copy(_).applyQuaternion(n).dot(this.eye)) > e &&
                  (s.scale.set(1e-10, 1e-10, 1e-10), (s.visible = !1)),
                  "Y" === s.name &&
                    Math.abs(v.copy(D).applyQuaternion(n).dot(this.eye)) > e &&
                    (s.scale.set(1e-10, 1e-10, 1e-10), (s.visible = !1)),
                  "Z" === s.name &&
                    Math.abs(v.copy(M).applyQuaternion(n).dot(this.eye)) > e &&
                    (s.scale.set(1e-10, 1e-10, 1e-10), (s.visible = !1)),
                  "XY" === s.name &&
                    Math.abs(v.copy(M).applyQuaternion(n).dot(this.eye)) < t &&
                    (s.scale.set(1e-10, 1e-10, 1e-10), (s.visible = !1)),
                  "YZ" === s.name &&
                    Math.abs(v.copy(_).applyQuaternion(n).dot(this.eye)) < t &&
                    (s.scale.set(1e-10, 1e-10, 1e-10), (s.visible = !1)),
                  "XZ" === s.name &&
                    Math.abs(v.copy(D).applyQuaternion(n).dot(this.eye)) < t &&
                    (s.scale.set(1e-10, 1e-10, 1e-10), (s.visible = !1));
              } else
                "rotate" === this.mode &&
                  (x.copy(n),
                  v.copy(this.eye).applyQuaternion(i.copy(n).invert()),
                  -1 !== s.name.search("E") &&
                    s.quaternion.setFromRotationMatrix(
                      b.lookAt(this.eye, y, D)
                    ),
                  "X" === s.name &&
                    (i.setFromAxisAngle(_, Math.atan2(-v.y, v.z)),
                    i.multiplyQuaternions(x, i),
                    s.quaternion.copy(i)),
                  "Y" === s.name &&
                    (i.setFromAxisAngle(D, Math.atan2(v.x, v.z)),
                    i.multiplyQuaternions(x, i),
                    s.quaternion.copy(i)),
                  "Z" === s.name &&
                    (i.setFromAxisAngle(M, Math.atan2(v.y, v.x)),
                    i.multiplyQuaternions(x, i),
                    s.quaternion.copy(i)));
              (s.visible =
                s.visible && (-1 === s.name.indexOf("X") || this.showX)),
                (s.visible =
                  s.visible && (-1 === s.name.indexOf("Y") || this.showY)),
                (s.visible =
                  s.visible && (-1 === s.name.indexOf("Z") || this.showZ)),
                (s.visible =
                  s.visible &&
                  (-1 === s.name.indexOf("E") ||
                    (this.showX && this.showY && this.showZ))),
                (s.material._color =
                  s.material._color || s.material.color.clone()),
                (s.material._opacity =
                  s.material._opacity || s.material.opacity),
                s.material.color.copy(s.material._color),
                (s.material.opacity = s.material._opacity),
                this.enabled &&
                  this.axis &&
                  (s.name === this.axis ||
                    this.axis.split("").some(function (e) {
                      return s.name === e;
                    })) &&
                  (s.material.color.setHex(16776960), (s.material.opacity = 1));
            } else
              (s.visible = !1),
                "AXIS" === s.name
                  ? (s.position.copy(this.worldPositionStart),
                    (s.visible = !!this.axis),
                    "X" === this.axis &&
                      (i.setFromEuler(g.set(0, 0, 0)),
                      s.quaternion.copy(n).multiply(i),
                      Math.abs(v.copy(_).applyQuaternion(n).dot(this.eye)) >
                        0.9 && (s.visible = !1)),
                    "Y" === this.axis &&
                      (i.setFromEuler(g.set(0, 0, Math.PI / 2)),
                      s.quaternion.copy(n).multiply(i),
                      Math.abs(v.copy(D).applyQuaternion(n).dot(this.eye)) >
                        0.9 && (s.visible = !1)),
                    "Z" === this.axis &&
                      (i.setFromEuler(g.set(0, Math.PI / 2, 0)),
                      s.quaternion.copy(n).multiply(i),
                      Math.abs(v.copy(M).applyQuaternion(n).dot(this.eye)) >
                        0.9 && (s.visible = !1)),
                    "XYZE" === this.axis &&
                      (i.setFromEuler(g.set(0, Math.PI / 2, 0)),
                      v.copy(this.rotationAxis),
                      s.quaternion.setFromRotationMatrix(b.lookAt(y, v, D)),
                      s.quaternion.multiply(i),
                      (s.visible = this.dragging)),
                    "E" === this.axis && (s.visible = !1))
                  : "START" === s.name
                  ? (s.position.copy(this.worldPositionStart),
                    (s.visible = this.dragging))
                  : "END" === s.name
                  ? (s.position.copy(this.worldPosition),
                    (s.visible = this.dragging))
                  : "DELTA" === s.name
                  ? (s.position.copy(this.worldPositionStart),
                    s.quaternion.copy(this.worldQuaternionStart),
                    t
                      .set(1e-10, 1e-10, 1e-10)
                      .add(this.worldPositionStart)
                      .sub(this.worldPosition)
                      .multiplyScalar(-1),
                    t.applyQuaternion(
                      this.worldQuaternionStart.clone().invert()
                    ),
                    s.scale.copy(t),
                    (s.visible = this.dragging))
                  : (s.quaternion.copy(n),
                    this.dragging
                      ? s.position.copy(this.worldPositionStart)
                      : s.position.copy(this.worldPosition),
                    this.axis && (s.visible = -1 !== this.axis.search(s.name)));
          }
          super.updateMatrixWorld(e);
        }
      }
      class E extends THRDev3.Mesh {
        constructor() {
          super(
            new THRDev3.PlaneGeometry(1e5, 1e5, 2, 2),
            new THRDev3.MeshBasicMaterial({
              visible: !1,
              wireframe: !0,
              side: THRDev3.DoubleSide,
              transparent: !0,
              opacity: 0.1,
              toneMapped: !1,
            })
          ),
            (this.isTransformControlsPlane = !0),
            (this.type = "TransformControlsPlane");
        }
        updateMatrixWorld(e) {
          let n = this.space;
          switch (
            (this.position.copy(this.worldPosition),
            "scale" === this.mode && (n = "local"),
            S.copy(_).applyQuaternion("local" === n ? this.worldQuaternion : w),
            P.copy(D).applyQuaternion("local" === n ? this.worldQuaternion : w),
            R.copy(M).applyQuaternion("local" === n ? this.worldQuaternion : w),
            v.copy(P),
            this.mode)
          ) {
            case "translate":
            case "scale":
              switch (this.axis) {
                case "X":
                  v.copy(this.eye).cross(S), C.copy(S).cross(v);
                  break;
                case "Y":
                  v.copy(this.eye).cross(P), C.copy(P).cross(v);
                  break;
                case "Z":
                  v.copy(this.eye).cross(R), C.copy(R).cross(v);
                  break;
                case "XY":
                  C.copy(R);
                  break;
                case "YZ":
                  C.copy(S);
                  break;
                case "XZ":
                  v.copy(R), C.copy(P);
                  break;
                case "XYZ":
                case "E":
                  C.set(0, 0, 0);
              }
              break;
            case "rotate":
            default:
              C.set(0, 0, 0);
          }
          0 === C.length()
            ? this.quaternion.copy(this.cameraQuaternion)
            : (T.lookAt(t.set(0, 0, 0), C, v),
              this.quaternion.setFromRotationMatrix(T)),
            super.updateMatrixWorld(e);
        }
      }
      (THRDev3.TransformControls = c),
        (THRDev3.TransformControlsGizmo = A),
        (THRDev3.TransformControlsPlane = E);
    })();
  },
  function (e, t) {
    !(function () {
      class e extends THRDev3.Mesh {
        constructor(e, t = {}) {
          super(e);
          const n = this,
            i = void 0 !== t.textureWidth ? t.textureWidth : 512,
            o = void 0 !== t.textureHeight ? t.textureHeight : 512,
            s = void 0 !== t.clipBias ? t.clipBias : 0,
            r = void 0 !== t.alpha ? t.alpha : 1,
            a = void 0 !== t.time ? t.time : 0,
            l = void 0 !== t.waterNormals ? t.waterNormals : null,
            c =
              void 0 !== t.sunDirection
                ? t.sunDirection
                : new THRDev3.Vector3(0.70707, 0.70707, 0),
            h = new THRDev3.Color(
              void 0 !== t.sunColor ? t.sunColor : 16777215
            ),
            u = new THRDev3.Color(
              void 0 !== t.waterColor ? t.waterColor : 8355711
            ),
            d = void 0 !== t.eye ? t.eye : new THRDev3.Vector3(0, 0, 0),
            p = void 0 !== t.distortionScale ? t.distortionScale : 20,
            f = void 0 !== t.side ? t.side : THRDev3.FrontSide,
            m = void 0 !== t.fog && t.fog,
            g = new THRDev3.Plane(),
            v = new THRDev3.Vector3(),
            y = new THRDev3.Vector3(),
            b = new THRDev3.Vector3(),
            x = new THRDev3.Matrix4(),
            w = new THRDev3.Vector3(0, 0, -1),
            C = new THRDev3.Vector4(),
            T = new THRDev3.Vector3(),
            _ = new THRDev3.Vector3(),
            D = new THRDev3.Vector4(),
            M = new THRDev3.Matrix4(),
            S = new THRDev3.PerspectiveCamera(),
            P = {
              minFilter: THRDev3.LinearFilter,
              magFilter: THRDev3.LinearFilter,
              format: THRDev3.RGBAFormat,
            },
            R = new THRDev3.WebGLRenderTarget(i, o, P);
          (THRDev3.MathUtils.isPowerOfTwo(i) &&
            THRDev3.MathUtils.isPowerOfTwo(o)) ||
            (R.texture.generateMipmaps = !1);
          const A = {
              uniforms: THRDev3.UniformsUtils.merge([
                THRDev3.UniformsLib.fog,
                THRDev3.UniformsLib.lights,
                {
                  normalSampler: { value: null },
                  mirrorSampler: { value: null },
                  alpha: { value: 1 },
                  time: { value: 0 },
                  size: { value: 1 },
                  distortionScale: { value: 20 },
                  textureMatrix: { value: new THRDev3.Matrix4() },
                  sunColor: { value: new THRDev3.Color(8355711) },
                  sunDirection: {
                    value: new THRDev3.Vector3(0.70707, 0.70707, 0),
                  },
                  eye: { value: new THRDev3.Vector3() },
                  waterColor: { value: new THRDev3.Color(5592405) },
                },
              ]),
              vertexShader:
                "\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition =  modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",
              fragmentShader:
                "\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat dist1 = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / dist1 ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.5, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n                    // vec3 albedo = ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask();\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <fog_fragment>\n\t\t\t\t}",
            },
            E = new THRDev3.ShaderMaterial({
              fragmentShader: A.fragmentShader,
              vertexShader: A.vertexShader,
              uniforms: THRDev3.UniformsUtils.clone(A.uniforms),
              lights: !0,
              side: f,
              fog: m,
            });
          (E.uniforms.mirrorSampler.value = R.texture),
            (E.uniforms.textureMatrix.value = M),
            (E.uniforms.alpha.value = r),
            (E.uniforms.time.value = a),
            (E.uniforms.normalSampler.value = l),
            (E.uniforms.sunColor.value = h),
            (E.uniforms.waterColor.value = u),
            (E.uniforms.sunDirection.value = c),
            (E.uniforms.distortionScale.value = p),
            (E.uniforms.eye.value = d),
            (n.material = E);
          const { Mirrorfilter: k } = t;
          n.onBeforeRender = function (e, t, i) {
            if (
              (y.setFromMatrixPosition(n.matrixWorld),
              b.setFromMatrixPosition(i.matrixWorld),
              x.extractRotation(n.matrixWorld),
              v.set(0, 0, 1),
              v.applyMatrix4(x),
              T.subVectors(y, b),
              T.dot(v) > 0)
            )
              return;
            T.reflect(v).negate(),
              T.add(y),
              x.extractRotation(i.matrixWorld),
              w.set(0, 0, -1),
              w.applyMatrix4(x),
              w.add(b),
              _.subVectors(y, w),
              _.reflect(v).negate(),
              _.add(y),
              S.position.copy(T),
              S.up.set(0, 1, 0),
              S.up.applyMatrix4(x),
              S.up.reflect(v),
              S.lookAt(_),
              (S.far = i.far),
              S.updateMatrixWorld(),
              S.projectionMatrix.copy(i.projectionMatrix),
              M.set(0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1),
              M.multiply(S.projectionMatrix),
              M.multiply(S.matrixWorldInverse),
              g.setFromNormalAndCoplanarPoint(v, y),
              g.applyMatrix4(S.matrixWorldInverse),
              C.set(g.normal.x, g.normal.y, g.normal.z, g.constant);
            const o = S.projectionMatrix;
            (D.x = (Math.sign(C.x) + o.elements[8]) / o.elements[0]),
              (D.y = (Math.sign(C.y) + o.elements[9]) / o.elements[5]),
              (D.z = -1),
              (D.w = (1 + o.elements[10]) / o.elements[14]),
              C.multiplyScalar(2 / C.dot(D)),
              (o.elements[2] = C.x),
              (o.elements[6] = C.y),
              (o.elements[10] = C.z + 1 - s),
              (o.elements[14] = C.w),
              d.setFromMatrixPosition(i.matrixWorld);
            const r = e.getRenderTarget(),
              a = e.xr.enabled,
              l = e.shadowMap.autoUpdate;
            (n.visible = !1),
              (e.xr.enabled = !1),
              (e.shadowMap.autoUpdate = !1),
              e.setRenderTarget(R),
              e.state.buffers.depth.setMask(!0),
              !1 === e.autoClear && e.clear(),
              t.traverse((e) => {
                k.includes(e.name) &&
                  ((e.userData._mirrorVisb = e.visible), (e.visible = !1)),
                  e.userData.config &&
                    ((e.userData._mirrorVisb = e.visible),
                    (e.visible = e.userData.config.isMirror));
              }),
              e.render(t, S),
              (n.visible = !0),
              (e.xr.enabled = a),
              (e.shadowMap.autoUpdate = l),
              e.setRenderTarget(r),
              t.traverse((e) => {
                (e.userData.config || k.includes(e.name)) &&
                  (e.visible = e.userData._mirrorVisb);
              });
            const c = i.viewport;
            void 0 !== c && e.state.viewport(c);
          };
        }
      }
      (e.prototype.isWater = !0), (THRDev3.Water = e);
    })();
  },
  function (e, t, n) {
    "use strict";
    n.r(t);
    var i = {};
    n.r(i),
      n.d(i, "noiseFunc", function () {
        return Ae;
      }),
      n.d(i, "colorFunc", function () {
        return Ee;
      }),
      n.d(i, "shapeFunc", function () {
        return ke;
      }),
      n.d(i, "motionFunc", function () {
        return Ie;
      }),
      n.d(i, "commonPart", function () {
        return He;
      });
    var o = {};
    n.r(o),
      n.d(o, "getVShaderDefine", function () {
        return ei;
      }),
      n.d(o, "getVShaderMain", function () {
        return ti;
      }),
      n.d(o, "getFShaderDefine", function () {
        return ni;
      }),
      n.d(o, "getFShaderMain", function () {
        return ii;
      });
    var s = {};
    n.r(s),
      n.d(s, "getVShaderDefine", function () {
        return oi;
      }),
      n.d(s, "getVShaderMain", function () {
        return si;
      }),
      n.d(s, "getFShaderDefine", function () {
        return ri;
      }),
      n.d(s, "getFShaderMain", function () {
        return ai;
      });
    var r = {};
    n.r(r),
      n.d(r, "getVShaderDefine", function () {
        return li;
      }),
      n.d(r, "getVShaderMain", function () {
        return ci;
      }),
      n.d(r, "getFShaderDefine", function () {
        return hi;
      }),
      n.d(r, "getFShaderMain", function () {
        return ui;
      });
    var a = {};
    n.r(a),
      n.d(a, "getVShaderDefine", function () {
        return di;
      }),
      n.d(a, "getVShaderMain", function () {
        return pi;
      }),
      n.d(a, "getFShaderDefine", function () {
        return fi;
      }),
      n.d(a, "getFShaderMain", function () {
        return mi;
      });
    var l = {};
    n.r(l),
      n.d(l, "getVShaderDefine", function () {
        return gi;
      }),
      n.d(l, "getVShaderMain", function () {
        return vi;
      }),
      n.d(l, "getFShaderDefine", function () {
        return yi;
      }),
      n.d(l, "getFShaderMain", function () {
        return bi;
      });
    var c = {};
    n.r(c),
      n.d(c, "getVShaderDefine", function () {
        return xi;
      }),
      n.d(c, "getVShaderMain", function () {
        return wi;
      }),
      n.d(c, "getFShaderDefine", function () {
        return Ci;
      }),
      n.d(c, "getFShaderMain", function () {
        return Ti;
      });
    var h = {};
    n.r(h),
      n.d(h, "getVShaderDefine", function () {
        return _i;
      }),
      n.d(h, "getVShaderMain", function () {
        return Di;
      }),
      n.d(h, "getFShaderDefine", function () {
        return Mi;
      }),
      n.d(h, "getFShaderMain", function () {
        return Si;
      });
    var u = {};
    n.r(u),
      n.d(u, "getVShaderDefine", function () {
        return Ai;
      }),
      n.d(u, "getVShaderMain", function () {
        return Ei;
      }),
      n.d(u, "getFShaderDefine", function () {
        return ki;
      }),
      n.d(u, "getFShaderMain", function () {
        return Ii;
      });
    var d = {};
    n.r(d),
      n.d(d, "getVShaderDefine", function () {
        return Li;
      }),
      n.d(d, "getVShaderMain", function () {
        return Oi;
      }),
      n.d(d, "getFShaderDefine", function () {
        return Vi;
      }),
      n.d(d, "getFShaderMain", function () {
        return Fi;
      });
    var p = {};
    n.r(p),
      n.d(p, "getVShaderDefine", function () {
        return ji;
      }),
      n.d(p, "getVShaderMain", function () {
        return Bi;
      }),
      n.d(p, "getFShaderDefine", function () {
        return Ui;
      }),
      n.d(p, "getFShaderMain", function () {
        return Ni;
      });
    var f = {};
    n.r(f),
      n.d(f, "getVShaderDefine", function () {
        return Wi;
      }),
      n.d(f, "getVShaderMain", function () {
        return Yi;
      }),
      n.d(f, "getFShaderDefine", function () {
        return Ki;
      }),
      n.d(f, "getFShaderMain", function () {
        return $i;
      });
    var m = {};
    n.r(m),
      n.d(m, "getVShaderDefine", function () {
        return Xi;
      }),
      n.d(m, "getVShaderMain", function () {
        return qi;
      }),
      n.d(m, "getFShaderDefine", function () {
        return Zi;
      }),
      n.d(m, "getFShaderMain", function () {
        return Qi;
      });
    var g = {};
    n.r(g),
      n.d(g, "getVShaderDefine", function () {
        return Ji;
      }),
      n.d(g, "getVShaderMain", function () {
        return eo;
      }),
      n.d(g, "getFShaderDefine", function () {
        return to;
      }),
      n.d(g, "getFShaderMain", function () {
        return no;
      });
    var v = {};
    n.r(v),
      n.d(v, "getVShaderDefine", function () {
        return io;
      }),
      n.d(v, "getVShaderMain", function () {
        return oo;
      }),
      n.d(v, "getFShaderDefine", function () {
        return so;
      }),
      n.d(v, "getFShaderMain", function () {
        return ro;
      });
    var y = {};
    n.r(y),
      n.d(y, "getVShaderDefine", function () {
        return ao;
      }),
      n.d(y, "getVShaderMain", function () {
        return lo;
      }),
      n.d(y, "getFShaderDefine", function () {
        return co;
      }),
      n.d(y, "getFShaderMain", function () {
        return ho;
      });
    var b = {};
    n.r(b),
      n.d(b, "getVShaderDefine", function () {
        return go;
      }),
      n.d(b, "getVShaderMain", function () {
        return vo;
      }),
      n.d(b, "getFShaderDefine", function () {
        return yo;
      }),
      n.d(b, "getFShaderMain", function () {
        return bo;
      });
    var x = {};
    n.r(x),
      n.d(x, "getVShaderDefine", function () {
        return Co;
      }),
      n.d(x, "getVShaderMain", function () {
        return To;
      }),
      n.d(x, "getFShaderDefine", function () {
        return _o;
      }),
      n.d(x, "getFShaderMain", function () {
        return Do;
      });
    var w = n(0),
      C = n.n(w),
      T = n(2),
      _ = n.n(T);
    const D = [
      Number,
      String,
      Date,
      RegExp,
      HTMLElement,
      NodeList,
      Boolean,
      Function,
    ];
    let M = 0;
    const S = {
      creatId(e = "ce") {
        M++;
        const [t, n, i] = [
          (Date.now() + M).toString(16),
          Math.random().toString().substring(2, 7),
          Math.random().toString(36).substring(2, 8),
        ];
        return `${e}_${i}${t.substr(t.length - 5)}${n}`;
      },
      isArray: (e) => "[object Array]" === Object.prototype.toString.call(e),
      isObject: (e) => "[object Object]" === Object.prototype.toString.call(e),
      isFunction: (e) =>
        "[object Function]" === Object.prototype.toString.call(e),
      isBoolean: (e) =>
        "[object Boolean]" === Object.prototype.toString.call(e),
      isMultiArr: (e = []) =>
        e.every((e) => "[object Array]" === Object.prototype.toString.call(e)),
      toFunction(e) {
        return this.isFunction(e) ? e : function () {};
      },
      exeFunction(e, t, ...n) {
        return !!this.isFunction(e) && e.call(t, ...n);
      },
      isDomElement: (e) =>
        !!(e instanceof HTMLElement) ||
        !(
          !e ||
          "object" != typeof e ||
          1 !== e.nodeType ||
          "string" != typeof e.nodeName
        ),
      clamp: (e, t, n, i) => (
        (e -= 0), Math.min(n, Math.max(t, Number.isNaN(e) ? i : e))
      ),
      lerp: (e, t, n) => e + (t - e) * n,
      limit: (e, t) => (-1 !== t.indexOf(e) ? e : t[0]),
      toNum: (e, t = 1) => ((e -= 0), Number.isNaN(e) ? t : e),
      greater: (e, t = 0.001) => (
        (e -= 0), Number.isNaN(e) ? t : Math.max(t, e)
      ),
      toFixed: (e, t) => +e.toFixed(t),
      padStart: (e, t, n) => e.padStart(t, n),
      padEnd: (e, t, n) => e.padEnd(t, n),
      pow: (e, t = 2) => e ** t,
      hasKey: (e, t) => Object.prototype.hasOwnProperty.call(e, t),
      initParams(e, t, n) {
        for (let i = 0; i < n.length; i++) {
          const o = n[i];
          this.hasKey(t, o) && (e[o] = t[o]);
        }
      },
      setObjParams(e, t = {}) {
        Object.keys(t).forEach((n) => {
          this.hasKey(e, n) && (e[n] = t[n]);
        });
      },
      initTWEEN(e) {
        this.TWEEN = e;
      },
      easing(e, t) {
        const n = this.isFunction(t) ? t : this.getEasing(t);
        return n && (e = e <= 0 ? 0 : e >= 1 ? 1 : n(e)), e;
      },
      getEasing(e) {
        return !!this.TWEEN && this.parseEaseNm(e);
      },
      setEasing(e, t) {
        return !(!this.TWEEN || !this.isFunction(t)) && this.parseEaseNm(e, t);
      },
      parseEaseNm(e, t) {
        if (!e) return !1;
        if (!this.TWEEN) return !1;
        const [n, i = n.length] = [e.split(".")];
        let [o, s] = [this.TWEEN.Easing, 0];
        for (; s < i; s++) {
          const e = n[s];
          if (
            (t && ((o[e] = o[e] ? o[e] : {}), s === i - 1 && (o[e] = t)),
            (o = o[e]),
            !o)
          )
            break;
        }
        return o;
      },
      checkStr: (e, t, n = 2) =>
        !(!e || !t) && (1 === n ? e === t : e.includes(t) || t.includes(e)),
      startsWith: (e, t) => e.startsWith(t),
      endsWith: (e, t) => e.endsWith(t),
      deepClone(e) {
        let t;
        const n = Object.prototype.toString.call(e);
        if ("[object Array]" === n) {
          if (((t = []), e.length > 0))
            for (let n = 0; n < e.length; n++) t.push(this.deepClone(e[n]));
        } else
          "[object Object]" === n
            ? ((t = {}),
              Object.keys(e).forEach((n) => {
                t[n] = this.deepClone(e[n]);
              }))
            : (t = e);
        return t;
      },
      removeArrItem(e, t) {
        for (let n = e.length - 1; n >= 0; n--)
          if (e[n] === t) {
            e.splice(n, 1);
            break;
          }
        return e;
      },
      removeArrItem2: (e, t) => e.filter((e) => e !== t),
      now: () => new Date().getTime(),
      throttle(e, t, n) {
        let i,
          o,
          s,
          r = null,
          a = 0;
        n || (n = {});
        const l = function () {
            (a = !1 === n.leading ? 0 : S.now()),
              (r = null),
              (s = e.apply(i, o)),
              r || ((o = null), (i = null));
          },
          c = function (...c) {
            const h = S.now();
            a || !1 !== n.leading || (a = h);
            const u = t - (h - a);
            return (
              (i = this),
              (o = c),
              u <= 0 || u > t
                ? (r && (clearTimeout(r), (r = null)),
                  (a = h),
                  (s = e.apply(i, o)),
                  r || ((o = null), (i = null)))
                : r || !1 === n.trailing || (r = setTimeout(l, u)),
              s
            );
          };
        return (
          (c.cancel = function () {
            clearTimeout(r), (a = 0), (o = null), (i = null), (r = null);
          }),
          c
        );
      },
      isSimpleObj(e) {
        const t = e && e.constructor === Proxy;
        return (
          t ||
          ("object" != typeof e && !t) ||
          null == e ||
          (!t && D.some((t) => e instanceof t))
        );
      },
      copy(e, t) {
        return (
          Object.keys(t).forEach((n) => {
            const i = t[n];
            this.isSimpleObj(i)
              ? (e[n] = i)
              : this.isSimpleObj(e[n])
              ? (e[n] = this.copy(i instanceof Array ? [] : {}, i))
              : (e[n] = this.copy(e[n], i));
          }),
          e
        );
      },
      extend(...e) {
        const t = Reflect.apply(Array.prototype.splice, e, [0]);
        if (t[0] instanceof Boolean || "boolean" == typeof t[0]) {
          if (t.splice(0, 1)[0]) {
            const e = t.splice(0, 1)[0];
            return t.forEach((t) => S.copy(e, t)), e;
          }
        }
        return Reflect.apply(Object.assign, Object, t);
      },
      loopObject(e, t = function () {}) {
        Object.keys(e || {}).forEach(t);
      },
      clearObject(e) {
        this.loopObject(e, (t) => {
          Reflect.deleteProperty(e, t);
        });
      },
      isEqual(e, t) {
        if (e === t) return !0;
        if (JSON.stringify(e) === JSON.stringify(t)) return !0;
        if (
          this.isSimpleObj(e) ||
          this.isSimpleObj(t) ||
          this.isArray(e) ||
          this.isArray(t)
        )
          return !1;
        const [n, i] = [
          Object.getOwnPropertyNames(e),
          Object.getOwnPropertyNames(t),
        ];
        if (n.length !== i.length) return !1;
        for (let i = 0; i < n.length; i++) {
          const o = n[i];
          if (this.hasKey(t, o)) return !1;
          const [s, r] = [e[o], t[o]];
          if ("object" == typeof s) {
            if (!this.isEqual(s, r)) return !1;
          } else if (s !== r) return !1;
        }
        return !0;
      },
      getMercator(e, t, n = 180) {
        let i = t;
        if (t < 87 && t > -87) {
          const e = 3.14159265;
          i = Math.log(Math.tan((90 + t) * (e / 360))) * (n / e);
        }
        return [(e * n) / 180, i];
      },
      getReMercator(e, t, n = 180) {
        let i = t;
        if (t < 87 && t > -87) {
          const e = 3.14159265;
          i = (360 * Math.atan(Math.exp((t * e) / 180))) / e - 90;
        }
        return [(e * n) / 180, i];
      },
      getSegPoint(e, t, n) {
        const i = {};
        return (
          Object.keys(e).forEach((o) => {
            i[o] = e[o] - e[o] * n + t[o] * n;
          }),
          i
        );
      },
      canvasToImg(e, t, n, i = "#24292D") {
        (t = this.toNum(t, 1)), (n = this.toNum(n, 1));
        let [o, s, r] = [];
        (s = document.createElementNS(
          "http://www.w3.org/1999/xhtml",
          "canvas"
        )),
          (r = s.getContext("2d")),
          (s.width = t),
          (s.height = n),
          (r.fillStyle = i),
          r.fillRect(0, 0, t, n),
          (r.imageSmoothingQuality = "high");
        const a = (function (e, t, n, i) {
          let [o, s, r, a] = [];
          const [l, c] = [e / n, t / i];
          return (
            l >= c
              ? ((o = 0), (r = n), (s = (i - t / l) / 2), (a = t / l))
              : ((o = (n - e / c) / 2), (r = e / c), (s = 0), (a = i)),
            { sx: o, sy: s, sw: r, sh: a }
          );
        })(t, n, e.width, e.height);
        return (
          r.drawImage(e, a.sx, a.sy, a.sw, a.sh, 0, 0, t, n),
          (o = s.toDataURL("image/png")),
          o
        );
      },
      setVals(e, t, n) {
        if (!e) return;
        const i = this.isObject(n);
        t.forEach((t, o) => {
          e[t] = i ? n[t] : n[o];
        });
      },
      creatCirclePath(e = [0, 0], t, n = 1, i, o = 0) {
        if (i < 1) return [];
        const s = [];
        for (let r = 0; r < i; r++) {
          const a = ((r / i) * 360 * Math.PI) / 180 + o,
            l = [t * Math.cos(a) + e[0], n * t * Math.sin(a) + e[1]];
          s.push({ position: l, radius: a });
        }
        return s;
      },
      traverseConfig(e, t = {}) {
        this.loopObject(e, (n) => {
          const i = e[n],
            o = t[n];
          void 0 !== i &&
            void 0 !== o &&
            (this.isObject(i) && this.isObject(o)
              ? this.traverseConfig(i, o)
              : (e[n] = o));
        });
      },
    };
    var P = S;
    window._isSupportWebGL = -1;
    const R = {
      mtl: {
        point: (e) => new THRDev3.PointsMaterial(e),
        sprite: (e) => new THRDev3.SpriteMaterial(e),
        line: (e) => new THRDev3.LineBasicMaterial(e),
        lineD: (e) => new THRDev3.LineDashedMaterial(e),
        shader: (e) => new THRDev3.ShaderMaterial(e),
        basic: (e) => new THRDev3.MeshBasicMaterial(e),
        phong: (e) => new THRDev3.MeshPhongMaterial(e),
        lambert: (e) => new THRDev3.MeshLambertMaterial(e),
        standard: (e) => new THRDev3.MeshStandardMaterial(e),
        physical: (e) => new THRDev3.MeshPhysicalMaterial(e),
      },
      geo: {
        geo() {
          return this.buf();
        },
        buf: () => new THRDev3.BufferGeometry(),
        insBuf: () => new THRDev3.InstancedBufferGeometry(),
        shape: (e, t) => new THRDev3.ShapeBufferGeometry(e, t),
        extrude: (e, t) => new THRDev3.ExtrudeBufferGeometry(e, t),
        plane: (e, t, n, i) => new THRDev3.PlaneBufferGeometry(e, t, n, i),
        circle: (e, t) => new THRDev3.CircleBufferGeometry(e, t),
        box: (e, t, n) => new THRDev3.BoxBufferGeometry(e, t, n),
        sphere: (e, t, n, i, o, s, r) =>
          new THRDev3.SphereBufferGeometry(e, t, n, i, o, s, r),
        torus: (e, t, n, i) => new THRDev3.TorusBufferGeometry(e, t, n, i),
        Icosah: (e, t) => new THRDev3.IcosahedronBufferGeometry(e, t),
        cylinder: (e, t, n, i, o, s, r) =>
          new THRDev3.CylinderBufferGeometry(e, t, n, i, 1, o, s, r),
      },
      PI: 3.1415926535898,
      M_PI: 6.2831853071796,
      M_PI2: 1.5707963267949,
      wh: 400,
      ER: 6378137,
      txueLoader: new THRDev3.TextureLoader(),
      obj(e = "object") {
        const t = new THRDev3.Object3D();
        return (t.name = e), (t.userData.describe = e), t;
      },
      group(e = "group") {
        const t = new THRDev3.Group();
        return (t.name = e), (t.userData.describe = e), t;
      },
      color: (e) => new THRDev3.Color(e),
      creatCGeo: (e) => new THRDev3.CurvePath().createGeometry(e),
      tgShape: (e, t) => THRDev3.ShapeUtils.triangulateShape(e, t),
      detector() {
        if (-1 !== window._isSupportWebGL) return window._isSupportWebGL;
        try {
          return (
            (window._isSupportWebGL =
              !!window.WebGLRenderingContext &&
              !!document.createElement("canvas").getContext("webgl")),
            window._isSupportWebGL
          );
        } catch (e) {
          return (window._isSupportWebGL = !1), window._isSupportWebGL;
        }
      },
      reverse(e) {
        THRDev3.ShapeUtils.isClockWise(e) || e.reverse();
      },
      holeReverse(e) {
        THRDev3.ShapeUtils.isClockWise(e) && e.reverse();
      },
      getColorArr(e, t) {
        function n(e) {
          return 1 === e.length ? "0" + e : "" + e;
        }
        if (P.isArray(e)) return e;
        let i = 1;
        const o = this.color(),
          s = ("" + e).toLowerCase().replace(/\s/g, "");
        if (/^((?:rgba)?)\(\s*([^)]*)/.test(s)) {
          const e = s.replace(/rgba\(|\)/gi, "").split(","),
            t = [
              n(Math.round(e[0] - 0 || 0).toString(16)),
              n(Math.round(e[1] - 0 || 0).toString(16)),
              n(Math.round(e[2] - 0 || 0).toString(16)),
            ];
          o.setStyle("#" + t.join("")),
            (i = Math.max(0, Math.min(5, e[3] - 0 || 0)));
        } else "transparent" === e ? (i = 0) : o.set(e);
        return t ? [o.r, o.g, o.b, i] : [o, i];
      },
      getRGBColor(e) {
        if (!this.isArray(e)) return e;
        if (!e[0].isColor) return e;
        const t = e[0].clone().multiplyScalar(255),
          n = Number.isNaN(e[1]) ? 1 : e[1];
        return `rgba(${0 | t.r},${0 | t.g},${0 | t.b},${n})`;
      },
      transCoord(e, t) {
        const [n, i] = [t.width / 2, t.height / 2],
          o = e.clone().applyMatrix4(t.scene.matrix).project(t.camera),
          [s, r] = [o.x * n + n, -o.y * i + i];
        return new THRDev3.Vector2(s, r);
      },
      transPosition(e, t, n, i = "y") {
        const [o, s] = [new THRDev3.Vector3(), new THRDev3.Vector3()];
        o.set((e.x / n.width) * 2 - 1, (-e.y / n.height) * 2 + 1, 0.5),
          o.unproject(n.camera),
          o.sub(n.camera.position).normalize();
        const r = (t - n.camera.position[i]) / o[i];
        return s.copy(n.camera.position).add(o.multiplyScalar(r)), s;
      },
      angle2Rad(e, t = 1) {
        return 1 === t
          ? (e * this.PI) / 180
          : new THRDev3.Vector3().copy(e).multiplyScalar(this.PI / 180);
      },
      rad2Angle(e, t = 1) {
        return 1 === t
          ? (180 * e) / this.PI
          : new THRDev3.Vector3().copy(e).multiplyScalar(180 / this.PI);
      },
      lonlat2Title(e, t, n) {
        const i = this.angle2Rad(t),
          o = 2 ** (n - 1),
          s = ((e + 180) / 360) * o * 2,
          r = (1 - Math.log(Math.tan(i) + 1 / Math.cos(i)) / this.PI) * o;
        return { tX: s, tY: r, mX: 0 | s, mY: 0 | r };
      },
      title2lonlat(e, t, n) {
        const i = 2 ** n,
          o = this.PI - (2 * this.PI * t) / i;
        return {
          lon: (e / i) * 360 - 180,
          lat: (180 / this.PI) * Math.atan(0.5 * (Math.exp(o) - Math.exp(-o))),
        };
      },
      spaceRatio(e, t) {
        return +((256 * this.pixelRatio(t)) / e).toFixed(6);
      },
      pixelRatio(e) {
        return (this.PI * this.ER) / 128 / 2 ** e;
      },
      havDistance(e, t, n, i) {
        const o = this.angle2Rad(t),
          s = this.angle2Rad(i),
          r = this.angle2Rad(n - e),
          a = Math.sin(r / 2) ** 2,
          l = this.angle2Rad(i - t),
          c = Math.sin(l / 2) ** 2,
          h = Math.cos(o) * Math.cos(s) * a + c,
          u = 2 * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h));
        return +(this.ER * u).toFixed(6);
      },
      dispoaeCSS(e) {
        e && "Scene" === e.type
          ? e.children.forEach((e) => {
              this.dispoaeCSSObj(e);
            })
          : this.dispoaeCSSObj(e);
      },
      dispoaeCSSObj(e) {
        e instanceof THRDev3.Object3D &&
          (this.objectTraverse(e, (e) => {
            if ((this.deleteUserData(e), e.parent)) {
              const t = e.parent.children.indexOf(e);
              e.parent.children.splice(t, 1), (e.parent = null);
            }
            e.element &&
              e.element instanceof Element &&
              null !== e.element.parentNode &&
              (e.element.parentNode.removeChild(e.element), (e.element = null)),
              (e = null);
          }),
          (e = null));
      },
      disposeArr(e) {
        Object.keys(e || {}).forEach((t) => {
          e[t] && (e[t].dispose && e[t].dispose(), delete e[t]);
        });
      },
      disposeArrAll(e) {
        if (!e) return;
        for (let t = e.length - 1; t >= 0; t--) this.disposeNode(e[t]);
      },
      disposeObj(e) {
        e &&
          "Scene" === e.type &&
          e.background &&
          (e.background.dispose(), (e.background = null)),
          e instanceof THRDev3.Object3D &&
            this.objectTraverse(e, R.disposeNode.bind(R));
      },
      disposeNode(e) {
        this.deleteGeometry(e),
          this.deleteMaterial(e),
          this.deleteUserData(e),
          e.dispose && "Scene" !== e.type && e.dispose(),
          e.parent && e.parent.remove(e),
          (e = null);
      },
      deleteUserData(e) {
        e &&
          e.userData &&
          Object.keys(e.userData).forEach((t) => {
            "ceId" !== t &&
              (e.userData[t] &&
                e.userData[t].dispose &&
                e.userData[t].dispose(),
              (e.userData[t] = null));
          });
      },
      deleteGeometry(e) {
        e.geometry &&
          e.geometry.dispose &&
          (e.geometry._bufferGeometry && e.geometry._bufferGeometry.dispose(),
          this.deleteUserData(e.geometry),
          e.geometry.dispose(),
          (e.geometry = null));
      },
      deleteMaterial(e) {
        this.eachMaterial(e.material, (e) => {
          this.deleteUserData(e), this.disposeMaterial(e);
        }),
          (e.material = null);
      },
      disposeMaterial(e) {
        Object.keys(e).forEach((t) => {
          (e[t] && P.isFunction(e[t].dispose)) || "uniforms" === t
            ? "uniforms" === t
              ? Object.keys(e.uniforms).forEach((t) => {
                  let n = e.__webglShader
                    ? e.__webglShader.uniforms[t]
                    : void 0;
                  n &&
                    n.value &&
                    (n.value.dispose && n.value.dispose(), (n.value = null)),
                    (n = e.uniforms[t]),
                    n.value &&
                      (n.value.dispose && n.value.dispose(), (n.value = null));
                })
              : (e[t].dispose(), (e[t] = null))
            : ("program" !== t &&
                "fragmentShader" !== t &&
                "vertexShader" !== t) ||
              (e[t] = null);
        }),
          e.dispose(),
          (e = null);
      },
      objectTraverse(e, t) {
        if (!P.isFunction(t)) return;
        const { children: n } = e;
        for (let e = n.length - 1; e >= 0; e--) this.objectTraverse(n[e], t);
        t(e);
      },
      eachMaterial: (e, t) =>
        !(!e || !t) &&
        (P.isArray(e)
          ? e.forEach((e, n) => {
              t && t(e, n);
            })
          : t && t(e, 0),
        !0),
      shaderMtlAddFog(e, t, n) {
        if (!t) return e;
        const { fog: i } = t;
        if (!e.isShaderMaterial || e.fog || !i) return e;
        const { uniforms: o, vertexShader: s, fragmentShader: r } = e;
        e.uniforms = {
          fogColor: { value: i.color.clone() },
          fogDensity: { value: i.userData.density },
          fogFar: { value: i.userData.far },
          fogNear: { value: i.userData.near },
          ...o,
        };
        const [a, l] = [
            "gl_FragColor.rgb *= 1. - fogFactor;",
            "gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);",
          ],
          [c, h, u] = [
            (e, t) => {
              const n = e.lastIndexOf("}");
              return n < 0 ? e : e.slice(0, n) + t + e.slice(n);
            },
            "\n            #ifdef USE_FOG\n                vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n                vFogDepth = - mvPosition.z;\n            #endif\n            ",
            `\n            #ifdef USE_FOG\n                #ifdef FOG_EXP2\n                    float fogFactor = 1.0 - exp(- fogDensity * fogDensity * vFogDepth * vFogDepth);\n                #else\n                    float fogFactor = smoothstep(fogNear, fogFar, vFogDepth);\n                #endif\n                ${
              n ? a : l
            }\n            #endif\n            `,
          ];
        return (
          (e.vertexShader = `\n            #ifdef USE_FOG\n                varying float vFogDepth;\n            #endif\n            ${c(
            s,
            h
          )}\n            `),
          (e.fragmentShader = `\n            #ifdef USE_FOG\n                uniform vec3 fogColor;\n                varying float vFogDepth;\n                #ifdef FOG_EXP2\n                    uniform float fogDensity;\n                #else\n                    uniform float fogNear;\n                    uniform float fogFar;\n                #endif\n            #endif\n            ${c(
            r,
            u
          )}\n            `),
          (e.fog = !0),
          e
        );
      },
      eachGroupMaterial(e, t = () => {}) {
        e.traverse((e) => {
          e.material &&
            this.eachMaterial(e.material, (e) => {
              t(e);
            });
        });
      },
    };
    var A = R;
    var E = {
      domToTexture(e, t, n = !0) {
        if (!e) return null;
        let i = this.domToImg(e, t, n);
        const o = new THRDev3.TextureLoader().load(i.img, () => {
          i = null;
        });
        return (
          (o._width = i.imgWidth),
          (o._height = i.imgHeight),
          (o._totalWidth = i.totalWidth),
          (o._totalHeight = i.totalWidth),
          o
        );
      },
      domToImg(e, t, n) {
        const i = (t && t.width) || e.offsetWidth,
          o = (t && t.height) || e.offsetHeight;
        let s = i,
          r = o;
        n &&
          ((s = THRDev3.MathUtils.ceilPowerOfTwo(i)),
          (r = THRDev3.MathUtils.ceilPowerOfTwo(o)));
        return {
          img: `data:image/svg+xml;charset=utf-8,\n        <svg xmlns="http://www.w3.org/2000/svg"\n            width="${s}"\n            height="${r}">\n            <foreignObject class="box-text" x="${
            n ? s / 2 - i / 2 : 0
          }"\n                y="${
            n ? o / 2 - t.height / 2 : 0
          }" width="${i}" height="${o}">\n                ${new XMLSerializer()
            .serializeToString(e)
            .replace(/#/g, "%23")
            .replace(/\n/g, "%0A")}\n            </foreignObject></svg>`,
          width: i,
          height: o,
          totalWidth: s,
          totalHeight: r,
        };
      },
      imgObjToBase64(e) {
        const t = document.createElementNS(
            "http://www.w3.org/1999/xhtml",
            "canvas"
          ),
          n = t.getContext("2d"),
          { width: i } = e,
          { height: o } = e;
        return (
          (t.width = i),
          (t.height = o),
          n.clearRect(0, 0, i, o),
          n.drawImage(e, 0, 0),
          t.toDataURL("image/png")
        );
      },
      strToDom(e) {
        const t = document.createElement("div");
        return (t.innerHTML = e), t.childNodes[0];
      },
    };
    var k = n(3),
      I = n.n(k);
    class H {
      constructor() {
        (this.mercatorRatio = [
          [0, 1, 0],
          [0, 0, 1],
        ]),
          (this.params = {}),
          (this.isMercator = !1);
      }
      transCoord(e, t, n = this.isMercator) {
        n && ([e, t] = P.getMercator(e - 0, t - 0)),
          (e = Math.max(Math.min(e - 0, 180), -180)),
          (t = Math.max(Math.min(t - 0, 180), -180));
        const i = this.mercatorRatio;
        return [
          i[0][0] + i[0][1] * e + i[0][2] * t,
          i[1][0] + i[1][1] * e + i[1][2] * t,
        ];
      }
      reTransCoord(e, t, n = this.isMercator) {
        const [i, o, s] = this.mercatorRatio[0],
          [r, a, l] = this.mercatorRatio[1],
          [c, h] = [o / a, s / l];
        let u = (e - h * t - i + h * r) / (o - h * a),
          d = (e - c * t - i + c * r) / (s - c * l);
        return n && ([u, d] = P.getReMercator(u, d)), [u, d];
      }
      init(e, t, n) {
        if (e.length < 3 || t.length < 3) return;
        const [i, o] = [[], []];
        for (let s = 0; s < 3; s++) {
          const [r, a] = [e[s][0] - 0, e[s][1] - 0],
            [l, c] = n ? P.getMercator(r, a) : [r, a];
          i.push({ W: l, T: c }), o.push({ X: t[s][0] - 0, Y: t[s][1] - 0 });
        }
        (this.params = { WT: i, XY: o }),
          (this.isMercator = n),
          this.initRelativeCoorRatio({ WT: i, XY: o });
      }
      initRelativeCoorRatio(e) {
        const { WT: t, XY: n } = e,
          [i, o, s, r, a, l] = [t[0].W, t[0].T, t[1].W, t[1].T, t[2].W, t[2].T];
        let [c, h] = [i - s, o - r];
        const u = h * (i - a) - c * (o - l);
        if (
          (0 === c && ((c = i - a), (h = o - l)),
          0 === c && ((c = s - a), (h = r - l)),
          0 === u || 0 === c)
        )
          return;
        const [d, p, f, m, g, v] = [
            n[0].X,
            n[0].Y,
            n[1].X,
            n[1].Y,
            n[2].X,
            n[2].Y,
          ],
          y = ((d - f) * (i - a) - (d - g) * (i - s)) / u,
          b = (d - f - y * h) / c,
          x = d - i * b - o * y,
          w = ((p - m) * (i - a) - (p - v) * (i - s)) / u,
          C = (p - m - w * h) / c,
          T = p - i * C - o * w;
        this.mercatorRatio = [
          [x, b, y],
          [T, C, w],
        ];
      }
    }
    const L = {};
    !(function (e) {
      var t = i,
        n = i;
      function i(e, t, n) {
        n = n || 2;
        var i,
          a,
          l,
          c,
          h,
          p,
          m,
          g = t && t.length,
          v = g ? t[0] * n : e.length,
          y = o(e, 0, v, n, !0),
          b = [];
        if (!y) return b;
        if (
          (g &&
            (y = (function (e, t, n, i) {
              var r,
                a,
                l,
                c,
                h,
                p = [];
              for (r = 0, a = t.length; r < a; r++)
                (l = t[r] * i),
                  (c = r < a - 1 ? t[r + 1] * i : e.length),
                  (h = o(e, l, c, i, !1)) === h.next && (h.steiner = !0),
                  p.push(f(h));
              for (p.sort(u), r = 0; r < p.length; r++)
                d(p[r], n), (n = s(n, n.next));
              return n;
            })(e, t, y, n)),
          e.length > 80 * n)
        ) {
          (i = l = e[0]), (a = c = e[1]);
          for (var x = n; x < v; x += n)
            (h = e[x]) < i && (i = h),
              (p = e[x + 1]) < a && (a = p),
              h > l && (l = h),
              p > c && (c = p);
          m = 0 !== (m = Math.max(l - i, c - a)) ? 1 / m : 0;
        }
        return r(y, b, n, i, a, m), b;
      }
      function o(e, t, n, i, o) {
        var s, r;
        if (o === D(e, t, n, i) > 0)
          for (s = t; s < n; s += i) r = C(s, e[s], e[s + 1], r);
        else for (s = n - i; s >= t; s -= i) r = C(s, e[s], e[s + 1], r);
        return r && y(r, r.next) && (T(r), (r = r.next)), r;
      }
      function s(e, t) {
        if (!e) return e;
        t || (t = e);
        var n,
          i = e;
        do {
          if (
            ((n = !1),
            i.steiner || (!y(i, i.next) && 0 !== v(i.prev, i, i.next)))
          )
            i = i.next;
          else {
            if ((T(i), (i = t = i.prev) === i.next)) break;
            n = !0;
          }
        } while (n || i !== t);
        return t;
      }
      function r(e, t, n, i, o, u, d) {
        if (e) {
          !d &&
            u &&
            (function (e, t, n, i) {
              var o = e;
              do {
                null === o.z && (o.z = p(o.x, o.y, t, n, i)),
                  (o.prevZ = o.prev),
                  (o.nextZ = o.next),
                  (o = o.next);
              } while (o !== e);
              (o.prevZ.nextZ = null),
                (o.prevZ = null),
                (function (e) {
                  var t,
                    n,
                    i,
                    o,
                    s,
                    r,
                    a,
                    l,
                    c = 1;
                  do {
                    for (n = e, e = null, s = null, r = 0; n; ) {
                      for (
                        r++, i = n, a = 0, t = 0;
                        t < c && (a++, (i = i.nextZ));
                        t++
                      );
                      for (l = c; a > 0 || (l > 0 && i); )
                        0 !== a && (0 === l || !i || n.z <= i.z)
                          ? ((o = n), (n = n.nextZ), a--)
                          : ((o = i), (i = i.nextZ), l--),
                          s ? (s.nextZ = o) : (e = o),
                          (o.prevZ = s),
                          (s = o);
                      n = i;
                    }
                    (s.nextZ = null), (c *= 2);
                  } while (r > 1);
                })(o);
            })(e, i, o, u);
          for (var f, m, g = e; e.prev !== e.next; )
            if (((f = e.prev), (m = e.next), u ? l(e, i, o, u) : a(e)))
              t.push(f.i / n),
                t.push(e.i / n),
                t.push(m.i / n),
                T(e),
                (e = m.next),
                (g = m.next);
            else if ((e = m) === g) {
              d
                ? 1 === d
                  ? r((e = c(e, t, n)), t, n, i, o, u, 2)
                  : 2 === d && h(e, t, n, i, o, u)
                : r(s(e), t, n, i, o, u, 1);
              break;
            }
        }
      }
      function a(e) {
        var t = e.prev,
          n = e,
          i = e.next;
        if (v(t, n, i) >= 0) return !1;
        for (var o = e.next.next; o !== e.prev; ) {
          if (
            m(t.x, t.y, n.x, n.y, i.x, i.y, o.x, o.y) &&
            v(o.prev, o, o.next) >= 0
          )
            return !1;
          o = o.next;
        }
        return !0;
      }
      function l(e, t, n, i) {
        var o = e.prev,
          s = e,
          r = e.next;
        if (v(o, s, r) >= 0) return !1;
        for (
          var a = o.x < s.x ? (o.x < r.x ? o.x : r.x) : s.x < r.x ? s.x : r.x,
            l = o.y < s.y ? (o.y < r.y ? o.y : r.y) : s.y < r.y ? s.y : r.y,
            c = o.x > s.x ? (o.x > r.x ? o.x : r.x) : s.x > r.x ? s.x : r.x,
            h = o.y > s.y ? (o.y > r.y ? o.y : r.y) : s.y > r.y ? s.y : r.y,
            u = p(a, l, t, n, i),
            d = p(c, h, t, n, i),
            f = e.prevZ,
            g = e.nextZ;
          f && f.z >= u && g && g.z <= d;

        ) {
          if (
            f !== e.prev &&
            f !== e.next &&
            m(o.x, o.y, s.x, s.y, r.x, r.y, f.x, f.y) &&
            v(f.prev, f, f.next) >= 0
          )
            return !1;
          if (
            ((f = f.prevZ),
            g !== e.prev &&
              g !== e.next &&
              m(o.x, o.y, s.x, s.y, r.x, r.y, g.x, g.y) &&
              v(g.prev, g, g.next) >= 0)
          )
            return !1;
          g = g.nextZ;
        }
        for (; f && f.z >= u; ) {
          if (
            f !== e.prev &&
            f !== e.next &&
            m(o.x, o.y, s.x, s.y, r.x, r.y, f.x, f.y) &&
            v(f.prev, f, f.next) >= 0
          )
            return !1;
          f = f.prevZ;
        }
        for (; g && g.z <= d; ) {
          if (
            g !== e.prev &&
            g !== e.next &&
            m(o.x, o.y, s.x, s.y, r.x, r.y, g.x, g.y) &&
            v(g.prev, g, g.next) >= 0
          )
            return !1;
          g = g.nextZ;
        }
        return !0;
      }
      function c(e, t, n) {
        var i = e;
        do {
          var o = i.prev,
            s = i.next.next;
          !y(o, s) &&
            b(o, i, i.next, s) &&
            x(o, s) &&
            x(s, o) &&
            (t.push(o.i / n),
            t.push(i.i / n),
            t.push(s.i / n),
            T(i),
            T(i.next),
            (i = e = s)),
            (i = i.next);
        } while (i !== e);
        return i;
      }
      function h(e, t, n, i, o, a) {
        var l = e;
        do {
          for (var c = l.next.next; c !== l.prev; ) {
            if (l.i !== c.i && g(l, c)) {
              var h = w(l, c);
              return (
                (l = s(l, l.next)),
                (h = s(h, h.next)),
                r(l, t, n, i, o, a),
                void r(h, t, n, i, o, a)
              );
            }
            c = c.next;
          }
          l = l.next;
        } while (l !== e);
      }
      function u(e, t) {
        return e.x - t.x;
      }
      function d(e, t) {
        if (
          (t = (function (e, t) {
            var n,
              i = t,
              o = e.x,
              s = e.y,
              r = -1 / 0;
            do {
              if (s <= i.y && s >= i.next.y && i.next.y !== i.y) {
                var a = i.x + ((s - i.y) * (i.next.x - i.x)) / (i.next.y - i.y);
                if (a <= o && a > r) {
                  if (((r = a), a === o)) {
                    if (s === i.y) return i;
                    if (s === i.next.y) return i.next;
                  }
                  n = i.x < i.next.x ? i : i.next;
                }
              }
              i = i.next;
            } while (i !== t);
            if (!n) return null;
            if (o === r) return n.prev;
            var l,
              c = n,
              h = n.x,
              u = n.y,
              d = 1 / 0;
            i = n.next;
            for (; i !== c; )
              o >= i.x &&
                i.x >= h &&
                o !== i.x &&
                m(s < u ? o : r, s, h, u, s < u ? r : o, s, i.x, i.y) &&
                ((l = Math.abs(s - i.y) / (o - i.x)) < d ||
                  (l === d && i.x > n.x)) &&
                x(i, e) &&
                ((n = i), (d = l)),
                (i = i.next);
            return n;
          })(e, t))
        ) {
          var n = w(t, e);
          s(n, n.next);
        }
      }
      function p(e, t, n, i, o) {
        return (
          (e =
            1431655765 &
            ((e =
              858993459 &
              ((e =
                252645135 &
                ((e = 16711935 & ((e = 32767 * (e - n) * o) | (e << 8))) |
                  (e << 4))) |
                (e << 2))) |
              (e << 1))) |
          ((t =
            1431655765 &
            ((t =
              858993459 &
              ((t =
                252645135 &
                ((t = 16711935 & ((t = 32767 * (t - i) * o) | (t << 8))) |
                  (t << 4))) |
                (t << 2))) |
              (t << 1))) <<
            1)
        );
      }
      function f(e) {
        var t = e,
          n = e;
        do {
          t.x < n.x && (n = t), (t = t.next);
        } while (t !== e);
        return n;
      }
      function m(e, t, n, i, o, s, r, a) {
        return (
          (o - r) * (t - a) - (e - r) * (s - a) >= 0 &&
          (e - r) * (i - a) - (n - r) * (t - a) >= 0 &&
          (n - r) * (s - a) - (o - r) * (i - a) >= 0
        );
      }
      function g(e, t) {
        return (
          e.next.i !== t.i &&
          e.prev.i !== t.i &&
          !(function (e, t) {
            var n = e;
            do {
              if (
                n.i !== e.i &&
                n.next.i !== e.i &&
                n.i !== t.i &&
                n.next.i !== t.i &&
                b(n, n.next, e, t)
              )
                return !0;
              n = n.next;
            } while (n !== e);
            return !1;
          })(e, t) &&
          x(e, t) &&
          x(t, e) &&
          (function (e, t) {
            var n = e,
              i = !1,
              o = (e.x + t.x) / 2,
              s = (e.y + t.y) / 2;
            do {
              n.y > s != n.next.y > s &&
                n.next.y !== n.y &&
                o < ((n.next.x - n.x) * (s - n.y)) / (n.next.y - n.y) + n.x &&
                (i = !i),
                (n = n.next);
            } while (n !== e);
            return i;
          })(e, t)
        );
      }
      function v(e, t, n) {
        return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);
      }
      function y(e, t) {
        return e.x === t.x && e.y === t.y;
      }
      function b(e, t, n, i) {
        return (
          !!((y(e, t) && y(n, i)) || (y(e, i) && y(n, t))) ||
          (v(e, t, n) > 0 != v(e, t, i) > 0 && v(n, i, e) > 0 != v(n, i, t) > 0)
        );
      }
      function x(e, t) {
        return v(e.prev, e, e.next) < 0
          ? v(e, t, e.next) >= 0 && v(e, e.prev, t) >= 0
          : v(e, t, e.prev) < 0 || v(e, e.next, t) < 0;
      }
      function w(e, t) {
        var n = new _(e.i, e.x, e.y),
          i = new _(t.i, t.x, t.y),
          o = e.next,
          s = t.prev;
        return (
          (e.next = t),
          (t.prev = e),
          (n.next = o),
          (o.prev = n),
          (i.next = n),
          (n.prev = i),
          (s.next = i),
          (i.prev = s),
          i
        );
      }
      function C(e, t, n, i) {
        var o = new _(e, t, n);
        return (
          i
            ? ((o.next = i.next), (o.prev = i), (i.next.prev = o), (i.next = o))
            : ((o.prev = o), (o.next = o)),
          o
        );
      }
      function T(e) {
        (e.next.prev = e.prev),
          (e.prev.next = e.next),
          e.prevZ && (e.prevZ.nextZ = e.nextZ),
          e.nextZ && (e.nextZ.prevZ = e.prevZ);
      }
      function _(e, t, n) {
        (this.i = e),
          (this.x = t),
          (this.y = n),
          (this.prev = null),
          (this.next = null),
          (this.z = null),
          (this.prevZ = null),
          (this.nextZ = null),
          (this.steiner = !1);
      }
      function D(e, t, n, i) {
        for (var o = 0, s = t, r = n - i; s < n; s += i)
          (o += (e[r] - e[s]) * (e[s + 1] + e[r + 1])), (r = s);
        return o;
      }
      function M(e, t) {
        return e[0] * t[0] + e[1] * t[1];
      }
      function S(e, t) {
        const n = t[0],
          i = t[1],
          o = Math.sqrt(n * n + i * i);
        return (e[0] = n / o), (e[1] = i / o), e;
      }
      function P(e, t, n) {
        return (e[0] = t[0] + n[0]), (e[1] = t[1] + n[1]), e;
      }
      (i.deviation = function (e, t, n, i) {
        var o = t && t.length,
          s = o ? t[0] * n : e.length,
          r = Math.abs(D(e, 0, s, n));
        if (o)
          for (var a = 0, l = t.length; a < l; a++) {
            var c = t[a] * n,
              h = a < l - 1 ? t[a + 1] * n : e.length;
            r -= Math.abs(D(e, c, h, n));
          }
        var u = 0;
        for (a = 0; a < i.length; a += 3) {
          var d = i[a] * n,
            p = i[a + 1] * n,
            f = i[a + 2] * n;
          u += Math.abs(
            (e[d] - e[f]) * (e[p + 1] - e[d + 1]) -
              (e[d] - e[p]) * (e[f + 1] - e[d + 1])
          );
        }
        return 0 === r && 0 === u ? 0 : Math.abs((u - r) / r);
      }),
        (i.flatten = function (e) {
          for (
            var t = e[0][0].length,
              n = { vertices: [], holes: [], dimensions: t },
              i = 0,
              o = 0;
            o < e.length;
            o++
          ) {
            for (var s = 0; s < e[o].length; s++)
              for (var r = 0; r < t; r++) n.vertices.push(e[o][s][r]);
            o > 0 && ((i += e[o - 1].length), n.holes.push(i));
          }
          return n;
        }),
        (t.default = n);
      const R = [],
        A = [],
        E = [];
      function k(e, t, n, i, o, s, r, a) {
        const l = null != r;
        let c = o,
          h = null;
        l && (h = new Uint32Array(i - n));
        for (let o = n; o < i; o++) {
          const u = o === i - 1 ? n : o + 1,
            d = o === n ? i - 1 : o - 1,
            p = e[2 * d],
            f = e[2 * d + 1],
            m = e[2 * o],
            g = e[2 * o + 1],
            v = e[2 * u],
            y = e[2 * u + 1];
          if (
            ((R[0] = m - p),
            (R[1] = g - f),
            (A[0] = v - m),
            (A[1] = y - g),
            S(R, R),
            S(A, A),
            l && (h[o] = c),
            a || o !== n)
          )
            if (a || o !== i - 1) {
              P(E, A, R);
              const e = E[1];
              (E[1] = -E[0]), (E[0] = e), S(E, E);
              const n = M(E, A),
                i = Math.sqrt(1 - n * n),
                o = s * Math.min(10, 1 / i),
                a = s * n < 0;
              if (l && 1 / i > r && a) {
                const e = m + E[0] * s,
                  n = g + E[1] * s,
                  o = Math.acos(i) / 2,
                  r = Math.tan(o) * Math.abs(s);
                (t[2 * c] = e + E[1] * r),
                  (t[2 * c + 1] = n - E[0] * r),
                  c++,
                  (t[2 * c] = e - E[1] * r),
                  (t[2 * c + 1] = n + E[0] * r),
                  c++;
              } else (t[2 * c] = E[0] * o), (t[2 * c + 1] = E[1] * o), c++;
            } else
              (E[0] = R[1]),
                (E[1] = -R[0]),
                S(E, E),
                (t[2 * c] = E[0] * s),
                (t[2 * c + 1] = E[1] * s),
                c++;
          else
            (E[0] = A[1]),
              (E[1] = -A[0]),
              S(E, E),
              (t[2 * c] = E[0] * s),
              (t[2 * c + 1] = E[1] * s),
              c++;
        }
        return h;
      }
      (e.flatten = function (e) {
        return t.flatten(e);
      }),
        (e.triangulate = function (e, n, i = 2) {
          return t(e, n, i);
        }),
        (e.offsetPolygon2 = function (e, t, n) {
          const i = [];
          if (
            (k(e, i, 0, t && t.length ? t[0] : e.length / 2, 0, 1, null, n), t)
          )
            for (let o = 0; o < t.length; o++) {
              const s = t[o];
              k(e, i, s, t[o + 1] || e.length / 2, s, 1, null, n);
            }
          return i;
        });
    })(L);
    var O = L,
      V = n(8),
      F = n(1),
      z = n.n(F);
    let j;
    const B = Symbol("COMPUTED");
    class U {
      constructor(e) {
        z()(this, "_createListener", function (e = {}, t = {}, n = {}, i = {}) {
          const [o, s, r, a, l, c, h] = [this, {}, {}, {}, {}, {}, {}];
          let [u, d, p, f] = [];
          function m(e) {
            return !(!r[e] && !s[e]);
          }
          function g() {
            o._listener.setListener(o._listenerList);
          }
          function v() {
            o._listener.setListener(s);
          }
          function y(e, t, n) {
            d ||
              ((d = !0),
              requestAnimationFrame(() => {
                (d = !1),
                  j.loopObject(l, (e) => {
                    v(),
                      o._listener.trigger(...l[e], e),
                      g(),
                      Reflect.deleteProperty(l, e);
                  });
              })),
              (l[e] = [e, u, t, n]);
          }
          function b() {
            j.clearObject(s),
              j.clearObject(r),
              j.clearObject(a),
              v(),
              (function e(t, n, i = []) {
                j.loopObject(t, (o) => {
                  const [s, r] = [i.slice(), t[o]];
                  s.push(o), n(r, s), j.isSimpleObj(r) || e(r, n, s);
                });
              })(t, (e, t) => {
                if (!(e instanceof Function)) return;
                let n = t[0];
                t.forEach((s, r) => {
                  r && (n += "." + s),
                    (function (e, t = function () {}) {
                      o._listener.bind(e, t);
                    })(
                      n,
                      ((e, t, n) => {
                        const o = e.filter((e, n) => n > t);
                        return function (e, t, s) {
                          o.length && o.some((t) => void 0 === (e = e[t])),
                            Reflect.apply(n, i, [e, t, s, this]);
                        };
                      })(t, r, e)
                    );
                });
              }),
              (o.computed = !0),
              j.loopObject(n, (e) => {
                (o.computedName = e),
                  (a[e] = Reflect.apply(n[e], u, [])),
                  Reflect.deleteProperty(o, "computedName");
              }),
              Reflect.deleteProperty(o, "computed"),
              g();
          }
          function x(e, t) {
            j.loopObject(e, (i) => {
              if (n[i]) {
                const e = a[i];
                a[i] = Reflect.apply(n[i], u, []);
                const s = a[i];
                if (!t && s === e) return;
                v(), o._listener.trigger(i, u, s, t ? void 0 : e, i), g();
              }
              Reflect.deleteProperty(e, i);
            });
          }
          function w(e) {
            p ||
              ((p = !0),
              requestAnimationFrame(() => {
                (p = !1), x(c);
              })),
              e.forEach((e) => {
                c[e] = !0;
              });
          }
          const C = (e = {}, t = {}, i = {}, l = "") => {
            function c(e) {
              return l
                ? `${l}.${"string" == typeof e ? e : "Symble---toString"}`
                : e;
            }
            return new Proxy(e, {
              ownKeys(e) {
                const t = Object.keys(e);
                return e instanceof Array && t.push("length"), t;
              },
              get(e, n, h) {
                if ("__getBase__" === n) return e;
                if ("constructor" === n) return Proxy;
                const u = c(n),
                  d = Reflect.get(e, n, h);
                if (o.computed) {
                  v(),
                    (r[u] = r[u] || new Set()),
                    r[u].add(o.computedName),
                    (s[u] = s[u] || []);
                  const e = s[u];
                  if (!e.some((e) => e.isComputed)) {
                    const t = w.bind(null, r[u]);
                    (t.isComputed = !0), e.push(t);
                  }
                  g();
                }
                return Array.isArray(e) && d instanceof Function
                  ? function (...n) {
                      const o = e.map((e, n) => {
                          const o = c(n);
                          return j.isSimpleObj(e) ? e : C(e, t[n], i, o);
                        }),
                        { length: s } = o,
                        r = Reflect.apply(d, o, n),
                        a = o.length;
                      let h;
                      return (
                        a !== s && (h = e.slice()),
                        e.splice(0),
                        o.forEach((t) => {
                          j.isSimpleObj(t) ? e.push(t) : e.push(t.__getBase__);
                        }),
                        a !== s && y(l, e.slice(), h),
                        r
                      );
                    }
                  : d === B
                  ? Reflect.get(a, n, h)
                  : m(u) && !j.isSimpleObj(d)
                  ? C(d, t[n], i, u)
                  : d;
              },
              set(e, t, i, o) {
                const s = c(t),
                  r = e[t];
                return r === B
                  ? (i instanceof Function
                      ? (n[t] = i)
                      : (Reflect.deleteProperty(n, t), Reflect.set(e, t, i, o)),
                    (function (e) {
                      f ||
                        ((f = !0),
                        requestAnimationFrame(() => {
                          requestAnimationFrame(() => {
                            b(), (f = !1), x(h, !0);
                          });
                        })),
                        (h[e] = !0);
                    })(t),
                    !0)
                  : (!j.isEqual(i, r) && m(s) && y(s, i, r),
                    Reflect.set(e, t, i, o));
              },
            });
          };
          return (u = C(e, t, n)), b(), u;
        }),
          z()(this, "_listenerList", {}),
          (j = e),
          (this._listener = new j.Listener()),
          (this.bind = function (e, t = function () {}) {
            j.loopObject(e.computed, (t) => {
              e.data[t] = B;
            });
            const n = this._createListener(e.data, e.watch, e.computed, e.bind);
            return t(n), n;
          }),
          (this.dispose = function (e) {
            this._listener.destroy(), e || (j.clearObject(this), (j = null));
          });
      }
    }
    A.detector(),
      P.initTWEEN(V.a),
      P.setEasing("Quadratic.OutIn", (e) =>
        (e *= 2) > 1 ? 0.5 * e * (e - 2) + 1 : 0.5 * e * (2 - e)
      ),
      P.setEasing("Cubic.OutIn", (e) => ((e *= 2), 0.5 * (--e * e * e + 1)));
    const N = {
      ...A,
      ...P,
      screenCut: E,
      Listener: class {
        constructor() {
          let e = {},
            t = !1;
          (this.bind = function (t, n, i) {
            const o = e[t] || [];
            e[t] || (e[t] = o), n && (n._triggerOnce = i), o.unshift(n);
          }),
            (this.unbind = function (t, n) {
              t ||
                Object.keys(e).forEach((t) => {
                  Reflect.deleteProperty(e, t);
                });
              const i = e[t];
              return (
                !i ||
                (i && !n
                  ? Reflect.deleteProperty(e, t)
                  : ((e[t] = i.filter((e) => e !== n)),
                    !!e[t].length || Reflect.deleteProperty(e, t)))
              );
            }),
            (this.getListener = function () {
              return e;
            }),
            (this.setListener = function (t) {
              e = t;
            }),
            (this.changeThis = function (e) {
              t = !!e;
            }),
            (this.trigger = function (n, i, ...o) {
              const s = e[n];
              if (!s) return !1;
              for (let e = s.length - 1; e >= 0; e--) {
                const n = s[e];
                t ? n(...o) : n.apply(i, o), n._triggerOnce && s.splice(e, 1);
              }
              return !0;
            }),
            (this.stream = function (n, i, ...o) {
              const s = e[n];
              if (!s) return;
              let r = -1;
              const a = (...e) => {
                const n = s[++r];
                n && (t ? n([a].concat(e)) : n.apply(i, [a].concat(e)));
              };
              a(...o);
            }),
            (this.destroy = function () {
              Object.keys(e).forEach((t) => {
                Reflect.deleteProperty(e, t);
              });
            });
        }
      },
      CdTransform: I.a,
      CoordTrans: H,
      geoEtds: O,
    };
    !(function (e) {
      const t = new U(e);
      (e._setDiff = function (e, n) {
        return t.bind(e, n);
      }),
        (e._disposeDiff = (e) => {
          t.dispose && t.dispose(e);
        });
    })(N),
      (N.browserType = (function () {
        const e = window.navigator.userAgent.toLowerCase(),
          [t, n, i, o, s, r] = [
            e.match(/opera.([\d.]+)/),
            e.match(/firefox\/([\d.]+)/),
            e.match(/version\/([\d.]+).*safari/),
            e.match(/chrome\/([\d.]+)/),
            e.indexOf("edge") > -1,
            window.document.documentMode,
          ];
        return t
          ? "Opera"
          : n
          ? "FF"
          : i
          ? "Safari"
          : o
          ? "Chrome"
          : s
          ? "Edge"
          : r
          ? "IE"
          : "";
      })());
    var G = N,
      W = {
        ajaxQuer(e, t) {
          if (!e) return;
          const n = new XMLHttpRequest();
          n.open("GET", e, !0),
            (n.onreadystatechange = function () {
              ((4 === n.readyState && 200 === n.status) || 304 === n.status) &&
                t.call(this, n.responseText);
            }),
            n.send();
        },
        getPathInfo(e, t = !1, n = !0, i = !1) {
          const [o, s = o.flatten(e)] = [G.geoEtds];
          return (
            t && (s.indices = o.triangulate(s.vertices, s.holes)),
            n && (s.beveling = o.offsetPolygon2(s.vertices, s.holes, i)),
            s
          );
        },
      };
    const Y = {
      isMercator: !1,
      dataTans: "plane",
      basic: {
        longLat: {
          vScale: { x: 4e4, y: 1, z: 4e4 },
          center: { x: 104.08195, y: 0, z: 30.64615 },
        },
        plane: { vScale: { x: 1, y: 1, z: 1 }, center: { x: 0, y: 0, z: 0 } },
      },
    };
    var K = {
      parseData() {},
      parseDataSource(e, t = [], n) {
        const [i, o] = [{}, []],
          { columns: s, data: r } = e;
        for (let e = 0; e < s.length; e++) i[s[e].caption] = e;
        for (let e = 0; e < r.length; e++) {
          const [s, a] = [r[e], {}];
          for (let e = 0; e < t.length; e++) {
            const [n, o = i[n]] = [t[e]];
            void 0 !== o && (a[n] = s[o]);
          }
          o.push(G.isFunction(n) ? n(a) : a);
        }
        return o;
      },
      c13(e, t) {
        if (!t || !t.data || !t.data.length) return [];
        const n = t.columns,
          i = t.data,
          o = new Map();
        for (let t = 0, i = e.length; t < i; t++)
          for (let i = 0, s = n.length; i < s; i++)
            if (n[i].name === e[t].colName || n[i].alias === e[t].colName) {
              const { key: n } = e[t];
              o.set(n.split("."), i);
              break;
            }
        const s = [];
        if (i && i.length)
          for (let e = 0; e < i.length; e++) {
            const t = i[e],
              n = {};
            for (const e of o) {
              const i = e[0],
                o = e[1];
              let s = 0,
                r = n;
              for (; void 0 !== i[s]; )
                void 0 === i[s + 1]
                  ? (r[i[s]] = t[o])
                  : r[i[s]] || (r[i[s]] = {}),
                  (r = r[i[s]]),
                  s++;
            }
            s.push(n);
          }
        return s;
      },
      c51(e, t) {
        if (!t) return [];
        const n = t.data;
        if (!(n && n.columns && n.dataList && n.dataList.length)) return [];
        const i = n.columns,
          o = n.dataList,
          s = new Map();
        for (let t = 0, n = e.length; t < n; t++)
          for (let n = 0, o = i.length; n < o; n++) {
            let o =
              "string" == typeof i[n].displayName &&
              0 === i[n].displayName.indexOf(e[t].colName + "@");
            if (
              ((o =
                o || (i[n].displayName && i[n].displayName === e[t].colName)),
              o)
            ) {
              const { key: i } = e[t];
              s.set(i.split("."), n);
              break;
            }
          }
        const r = [];
        if (o && o.length)
          for (let e = 0; e < o.length; e++) {
            const t = o[e],
              n = {};
            for (const e of s) {
              const i = e[0],
                o = e[1];
              let s = 0,
                r = n;
              for (; void 0 !== i[s]; )
                void 0 === i[s + 1]
                  ? (r[i[s]] = t[o])
                  : r[i[s]] || (r[i[s]] = {}),
                  (r = r[i[s]]),
                  s++;
            }
            r.push(n);
          }
        return r;
      },
      handleVec(e, t = {}) {
        const n = G.extend(!0, {}, Y, t),
          { isMercator: i, dataTans: o, basic: s } = n,
          [r, a] = [s[o].vScale, s[o].center];
        i &&
          "longLat" === o &&
          G.setVals(e, ["x", "z"], G.getMercator(e.x, e.z));
        const l = {};
        return (
          G.loopObject(e, (t) => {
            l[t] = (e[t] - G.toNum(a[t], 0)) * G.toNum(r[t], 1);
          }),
          l
        );
      },
    };
    var $ = {
      commonTools: W,
      convertData: K,
      PosTrans: class {
        constructor() {
          (this.CoordTrans = new H()), (this.config = { type: 0 });
        }
        init(e, t, n = 0) {
          if (((this.config.type = n), e.length < 3 || t.length < 3)) return;
          const i = [];
          for (let t = 0; t < 3; t++) {
            const [o, s] = this.lonlatToWgs84(e[t][0] - 0, e[t][1] - 0, n);
            i.push([o, s]);
          }
          this.CoordTrans.init(i, t, 4 !== n);
        }
        transData(e, t = 3, n) {
          n = null == n ? this.config.type : n;
          const i = [];
          for (let o = 0; o < e.length; o++) {
            const { beforePos: s } = e[o],
              [r, a] = this.lonlatToWgs84(s.x - 0, s.y - 0, n),
              [l, c] = this.transCoord(r, a, n),
              h = { ...e[o] };
            (h.pos = { x: l, y: t, z: c }), i.push(h);
          }
          return i;
        }
        transCoord(e, t, n) {
          4 !== n &&
            (([e, t] = P.getMercator(e - 0, t - 0)),
            (e = Math.max(Math.min(e - 0, 180), -180)),
            (t = Math.max(Math.min(t - 0, 180), -180)));
          const i = this.CoordTrans.mercatorRatio;
          return [
            i[0][0] + i[0][1] * e + i[0][2] * t,
            i[1][0] + i[1][1] * e + i[1][2] * t,
          ];
        }
        lonlatToWgs84(e, t, n = 0) {
          if (1 === n) {
            const [n, i] = I.a.bd09togcj02(e, t);
            [e, t] = I.a.gcj02towgs84(n, i);
          }
          return 2 === n && ([e, t] = I.a.gcj02towgs84(e, t)), [e, t];
        }
      },
      _utils: (function e(t) {
        return (
          Object.getOwnPropertyNames(t).forEach((n) => {
            const i = t[n];
            "object" == typeof i && null !== i && e(i);
          }),
          Object.freeze(t)
        );
      })(G.extend(!0, {}, G)),
    };
    function X(e, t, n) {
      !(function (e, t) {
        if (t.has(e))
          throw new TypeError(
            "Cannot initialize the same private elements twice on an object"
          );
      })(e, t),
        t.set(e, n);
    }
    const q = [
      "mounted",
      "update",
      "amtCallback",
      "endCallBack",
      "onError",
      "beforeRender",
      "afterRender",
      "onResize",
      "beforeInit",
      "afterInit",
      "beforeDispose",
      "afterDispose",
      "beforeData",
      "afterData",
      "beforeOption",
      "afterOption",
      "beforeAdd",
      "afterAdd",
      "beforeRemove",
      "afterRemove",
    ];
    var Z = new WeakMap(),
      Q = new WeakMap(),
      J = new WeakMap(),
      ee = new WeakMap();
    class te {
      constructor() {
        X(this, Z, { writable: !0, value: new G.Listener() }),
          X(this, Q, { writable: !0, value: new G.Listener() }),
          X(this, J, { writable: !0, value: null }),
          X(this, ee, { writable: !0, value: !1 }),
          (this.id = ""),
          (this.name = ""),
          (this.config = null),
          (this.infos = {}),
          (this.eventArr = []),
          (this._setting = { checkList: {}, callback: {} });
      }
      get POST_FIX() {
        return "GL_COMP_";
      }
      get _TWEEN() {
        return G.TWEEN;
      }
      get tweenTims() {
        return 0.5;
      }
      listener(e = "inner") {
        return "inner" === e
          ? C()(this, Z)
          : "outPut" === e
          ? C()(this, Q)
          : void 0;
      }
      changeListener(e) {
        C()(this, Z).changeThis(e), C()(this, Q).changeThis(e);
      }
      setLifecycle(e = {}) {
        this.changeListener(!e._isDebugger),
          G.loopObject(e, (t) => {
            q.includes(t) &&
              G.isFunction(e[t]) &&
              this.on(t, e[t], e[t].triggerOnce);
          });
      }
      on(e, t, n) {
        C()(this, Z).bind(e, t, n);
      }
      un(e, t) {
        C()(this, Z).unbind(e, t);
      }
      _triggerInnerEvent(e, ...t) {
        C()(this, Z).trigger(e, this, ...t);
      }
      bind(e, t, n) {
        C()(this, Q).bind(e, t, n);
      }
      unbind(e, t) {
        C()(this, Q).unbind(e, t);
      }
      _triggerOutEvent(e, ...t) {
        C()(this, Q).trigger(e, this, ...t);
      }
      _handleEventFn(e, ...t) {
        const n = this[e](...t);
        G.isArray(n) && this._triggerOutEvent(e, ...n);
      }
      disposeBase() {
        G._disposeDiff(!0),
          this._triggerInnerEvent("afterDispose"),
          C()(this, Q).destroy(),
          C()(this, Z).destroy(),
          _()(this, Q, null),
          _()(this, Z, null),
          _()(this, J, null),
          this.eventArr.splice(0, this.eventArr.length),
          (this.config = null),
          (this._setting = null);
      }
      setTweenTackl(e) {
        if (e) _()(this, ee, !1);
        else {
          if (C()(this, ee)) return !0;
          _()(this, ee, !0);
        }
        return !1;
      }
      show(e, t) {
        this.config.isShow ||
          ((this.config.isShow = !0),
          this.container &&
            (this.setTweenTackl() ||
              this.setTestTween(
                { k: 0 },
                { k: 1 },
                () => {
                  this.setTweenTackl(!0), G.isFunction(t) && t();
                },
                e,
                void 0,
                (e) => {
                  this.container.style.opacity = e;
                }
              )));
      }
      hide(e, t) {
        this.config.isShow &&
          (this.container
            ? this.setTweenTackl() ||
              this.setTestTween(
                { k: 0 },
                { k: 1 },
                () => {
                  this.setTweenTackl(!0),
                    (this.config.isShow = !1),
                    G.isFunction(t) && t();
                },
                e,
                void 0,
                (e) => {
                  this.container.style.opacity = 1 - e;
                }
              )
            : (this.config.isShow = !1));
      }
      setTestTween(e, t, n, i = this.tweenTims, o = "Quadratic.InOut", s) {
        new this._TWEEN.Tween(e)
          .to(t, 1e3 * i)
          .easing(G.getEasing(o))
          .start()
          .onUpdate((e) => {
            G.isFunction(s) && s(e);
          })
          .onComplete(() => {
            G.exeFunction(n, this);
          });
      }
      setOption(e, t) {
        if (t) return void (this.compUpdate && this.compUpdate());
        const n = G.extend(!0, {}, e);
        this._triggerInnerEvent("beforeOption", { option: n }),
          this.contrastedOpt(n, this._setting.checkList, C()(this, J)),
          this._triggerInnerEvent("afterOption", { option: n });
      }
      setConfigProxy(e) {
        if (!this.config.isProxy) return;
        const t = this.handleSetting(e.checkList, e.callback);
        _()(
          this,
          J,
          G._setDiff({ data: this.config, computed: {}, watch: t, bind: this })
        );
      }
      handleSetting(e, t) {
        const n = {};
        return (
          G.loopObject(e, (i) => {
            const o = e[i];
            "object" == typeof o
              ? (n[i] = this.handleSetting(o, t))
              : G.hasKey(t, o) && (n[i] = t[o]);
          }),
          n
        );
      }
      contrastedOpt(e, t, n) {
        n &&
          G.loopObject(e, (i) => {
            const [o, s] = [e[i], t[i]];
            "object" == typeof s ? this.contrastedOpt(o, s, n[i]) : (n[i] = o);
          });
      }
      typeConfig(e, t) {
        const n = G.extend(!0, {}, t);
        this.setDefaultConfig(n), (this.config = G.extend(!0, {}, n, e));
        const { name: i, id: o } = this.config;
        this.name = i;
        let s = !1;
        this.renderer &&
          this.renderer.subCompEffects[o] &&
          ((s = !0),
          (this.infos.oldId = o),
          (this.infos.idWarn = "Duplicate ID!")),
          (this.id = o && !s ? o + "" : G.creatId(this.compType || i));
      }
      setDefaultConfig() {}
      setConfig() {}
      getConfig() {
        return null;
      }
      onWheel(...e) {
        return [...e];
      }
      onKeyup(...e) {
        return [...e];
      }
      onKeydown(...e) {
        return [...e];
      }
      onMouseMove(...e) {
        return [...e];
      }
      onMouseOut(...e) {
        return [...e];
      }
      onMouseIn(...e) {
        return [...e];
      }
      onMouseUp(...e) {
        return [...e];
      }
      onMouseDown(...e) {
        return [...e];
      }
      onClick(...e) {
        return [...e];
      }
      onDblClick(...e) {
        return [...e];
      }
    }
    const ne = {
      id: "",
      type: "",
      preUrl: "",
      url: "",
      basisPath: "",
      isUpdate: !1,
      encoding: "",
      params: null,
      callback: null,
      isRepeat: !1,
      repeat: { x: 1, y: 1 },
    };
    class ie {
      constructor(e) {
        (this.Txues = {}), (this.testTxue = ne), (this.renderer = e);
      }
      init(e) {
        G.disposeArr(this.Txues),
          e.forEach((e) => {
            this.loadTexture(e);
          });
      }
      getTxue(e) {
        if (!e) return null;
        return this.Txues[e] ? this.Txues[e] : null;
      }
      removeTxue(e) {
        const t = this.Txues[e] ? this.Txues[e] : null;
        t && (t.dispose(), delete this.Txues[e]);
      }
      setTxue(e) {
        return this.loadTexture(e);
      }
      dispose() {
        G.disposeArr(this.Txues), (this.Txues = null), (this.renderer = null);
      }
      loadTexture(e = {}) {
        const { id: t, isUpdate: n = !1, url: i } = e;
        let o = this.Txues["" + t];
        if (((o = o || null), !n && o)) return o;
        if (
          (o &&
            ((o = null),
            this.Txues["" + t].dispose(),
            (this.Txues["" + t] = null)),
          i)
        )
          if (i.isTexture) (o = i), this.setTxueRepeat(o, e.isRepeat, e.repeat);
          else
            switch (e.type) {
              case "cube":
                o = this.loadCubeSky(e);
                break;
              case "basis":
                o = this.loadBasis(e);
                break;
              default:
                o = this.loadImage(e);
            }
        if (o) {
          const { encoding: t, params: n } = e;
          (o.encoding =
            THRDev3[G.limit(t, ["LinearEncoding", "sRGBEncoding"])]),
            n &&
              G.loopObject(n, (e) => {
                o[e] = n[e];
              });
        }
        return (this.Txues["" + t] = o), o;
      }
      setTxueRepeat(e, t, n) {
        t &&
          ((e.wrapS = THRDev3.RepeatWrapping),
          (e.wrapT = THRDev3.RepeatWrapping)),
          n && (e.repeat = new THRDev3.Vector2().copy(n));
      }
      loadImage(e = {}) {
        const { preUrl: t = "", url: n, isRepeat: i, repeat: o } = e,
          s = n.includes("blob:http"),
          r = s ? n : ("" + n).toLowerCase(),
          a = /^data:image\/([a-z]+);base64,/.test(n);
        if (!/\.(png|jpe?g)(\?.*)?$/.test(r) && !s && !a) return null;
        const l = G.txueLoader.setPath(t).load(n);
        return this.setTxueRepeat(l, i, o), l;
      }
      loadHdr(e = {}, t, n = this.renderer.renderer) {
        const { preUrl: i = "", url: o } = e,
          s = ("" + o).toLowerCase();
        if (!/\.(hdr)(\?.*)?$/.test(s)) return null;
        if (!n) return console.warn("render is inactivity!"), null;
        const r = new THRDev3.PMREMGenerator(n);
        return (
          r.compileEquirectangularShader(),
          new THRDev3.RGBELoader().load(`${i}${o}`, (n) => {
            const i = r.fromEquirectangular(n).texture;
            (this.Txues["" + e.id] = i),
              t && t(i),
              e.callback && e.callback(i),
              r.dispose();
          }),
          !0
        );
      }
      loadCubeSky(e = {}) {
        const { preUrl: t = "", url: n } = e;
        if (!(G.isArray(n) && n.length >= 6)) return null;
        return new THRDev3.CubeTextureLoader().setPath(t).load(e.url);
      }
      loadBasis(e = {}, t = this.renderer.renderer) {
        const n = ("" + e.url).toLowerCase();
        if (!/\.(basis|ktx2)(\?.*)?$/.test(n)) return null;
        if (!t) return console.warn("render is inactivity!"), null;
        const {
          preUrl: i = "",
          basisPath: o,
          url: s,
          isRepeat: r,
          repeat: a,
        } = e;
        if (!THRDev3.BasisTextureLoader) return null;
        const l = new THRDev3.BasisTextureLoader();
        l.setTranscoderPath(`${i}${o}`), l.detectSupport(t);
        const c = l.load(`${i}${s}`);
        return this.setTxueRepeat(c, r, a), c;
      }
    }
    class oe {
      constructor(e) {
        (this.renderer = e),
          (this.dblclickDelay = 200),
          (this.eventType = "offset"),
          (this.onMouseHover = !1),
          (this.eventDom = null),
          (this._ItdMesh = null),
          (this._Mouse = null),
          (this._Raycaster = null),
          (this._Intersects = []),
          (this._CurrentID = null);
        let t = 0,
          n = 0;
        const [i, o, s, r, a, l, c, h] = [
          (e) => {
            this._isIntercept(e) || this.setEvent(e, "onWheel");
          },
          (e) => {
            this._isIntercept(e, !0) || this.setEvent(e, "onKeyup");
          },
          (e) => {
            this._isIntercept(e, !0) || this.setEvent(e, "onKeydown");
          },
          (e) => {
            this._isIntercept(e) ||
              (clearTimeout(n),
              (n = setTimeout(() => {
                this.setEvent(e, ["onMouseUp", "onClick"]);
              }, this.dblclickDelay)));
          },
          (e) => {
            this._isIntercept(e) || this.setMouseOut(e);
          },
          (e) => {
            if (!this._isIntercept(e))
              if (
                (this.getIntersects(e, !0),
                this.setEvent(e, "onMouseMove"),
                this._Intersects.length)
              ) {
                const t = this._Intersects[0].object;
                t !== this._ItdMesh && this.setMouseOut(e, !0),
                  this.setMouseIn(e, t);
              } else this.setMouseOut(e);
          },
          (e) => {
            this._isIntercept(e) ||
              (clearTimeout(t),
              (t = setTimeout(() => {
                this.getIntersects(e), this.setEvent(e, "onMouseDown");
              }, this.dblclickDelay)));
          },
          (e) => {
            this._isIntercept(e) ||
              (this.clearAllDelay(),
              this.getIntersects(e),
              this.setEvent(e, ["onDblClick", "onMouseUp"]));
          },
        ];
        (this.handleEvent = (e, t) => {
          e &&
            (e[t + "EventListener"]("wheel", i, !1),
            document[t + "EventListener"]("keyup", o, !1),
            document[t + "EventListener"]("keydown", s, !1),
            e[t + "EventListener"]("mouseup", r, !1),
            e[t + "EventListener"]("mouseout", a, !1),
            e[t + "EventListener"]("mousemove", l, !1),
            e[t + "EventListener"]("mousedown", c, !1),
            e[t + "EventListener"]("dblclick", h, !1));
        }),
          (this.clearAllDelay = () => {
            clearTimeout(t), clearTimeout(n);
          });
      }
      init(e) {
        e &&
          ((this._Mouse = new THRDev3.Vector2()),
          (this._Mouse2 = new THRDev3.Vector2()),
          (this._Raycaster = new THRDev3.Raycaster()),
          (this.eventDom = this.renderer.container),
          this.handleEvent(this.eventDom, "add"));
      }
      dispose(e) {
        (this._ItdMesh = null),
          (this._Intersects = []),
          (this._CurrentID = null),
          this.clearAllDelay(),
          e ||
            ((this._Mouse = null),
            (this._Mouse2 = null),
            (this._Raycaster = null),
            this.handleEvent(this.eventDom, "remove"),
            (this.eventDom = null),
            (this.renderer = null));
      }
      setMouseOut(e, t) {
        this._ItdMesh &&
          ((this.eventDom.style.cursor = "auto"),
          (this._CurrentID = this._ItdMesh.userData.ceId),
          this.setEvent(e, "onMouseOut", t),
          (this._ItdMesh = null));
      }
      setMouseIn(e, t) {
        (this._ItdMesh = t),
          (this.eventDom.style.cursor = "pointer"),
          this.setEvent(e, "onMouseIn");
      }
      setEvent(e, t, n) {
        const i = this.renderer.subCompEffects[this._CurrentID];
        G.isArray(t)
          ? t.forEach((t) => {
              this.handoutEvent(e, t, i, n);
            })
          : this.handoutEvent(e, t, i, n);
      }
      handoutEvent(e, t, n, i) {
        this.renderer._handleEventFn(
          t,
          e,
          i ? [] : this._Intersects,
          n ? n.name : n
        ),
          n && n._handleEventFn(t, e, i ? [] : this._Intersects);
        const o = this.renderer.subCompEffectArr;
        for (let s = 0; s < o.length; s++) {
          const r = o[s];
          if ((n && r.id === n.id) || !r.config.isCompEvents) continue;
          const a = this._Intersects.filter(
            (e) => e.object.userData.ceId === r.id
          );
          ("onMouseIn" !== t || a.length) &&
            r._handleEventFn(t, e, i ? [] : a, !1);
        }
      }
      getIntersects(e, t) {
        let n;
        if (
          ((this._CurrentID = null),
          (this._Intersects = []),
          this.renderer.camera)
        )
          n = this.renderer;
        else {
          const [t, i] = [e.target.id, this.renderer.POST_FIX.length];
          if (t.slice(0, i) !== this.renderer.POST_FIX) return;
          (n = this.renderer.subCompEffects[t.slice(i)]),
            (this._CurrentID = t.slice(i));
        }
        if (!n || n.config.isStopEvents) return void (this._CurrentID = null);
        this.onMouseHover && n._triggerInnerEvent("onMouseHover", e);
        const i = this.getIntersectMeshs(e, null, t, n);
        i.length && (this._CurrentID = i[0].object.userData.ceId),
          (this._Intersects = i);
      }
      getIntersectMeshs(e, t, n = !1, i = this.renderer) {
        const o = void 0 !== this.eventType ? this.eventType : "offset";
        this._Mouse2.set(e[o + "X"], e[o + "Y"]),
          (this._Mouse.x = (e[o + "X"] / i.width) * 2 - 1),
          (this._Mouse.y = (-e[o + "Y"] / i.height) * 2 + 1);
        const { threshold: s, isRayRecur: r } = i.config;
        s && (this._Raycaster.params.Points.threshold = s),
          this._Raycaster.setFromCamera(this._Mouse, i.camera);
        const a = t || i[n ? "eventArr2" : "eventArr"];
        return this._Raycaster.intersectObjects(a, r);
      }
      _isIntercept(e, t) {
        t || e.preventDefault();
        const {
          isShow: n,
          isViewport: i,
          isStopEvents: o,
        } = this.renderer.config;
        return !(n && i && !o);
      }
    }
    const se = {
        initTypeTools(e, t) {
          (this.cameraNears = []),
            (this.eventArr2 = []),
            (this._Txues = new ie(e ? this : this.renderer)),
            this._Txues.init(t),
            (this.scene = new THRDev3.Scene());
          const {
            isCSSRender: n,
            sceneScale: i,
            loading: o,
            camera: s,
            controls: r,
            light: a,
            fog: l,
            sky: c,
            waterMark: h,
          } = this.config;
          this.addLoading(o),
            n &&
              ((this.scene2 = new THRDev3.Scene()),
              this.scene2.scale.setScalar(i),
              (this.renderer2 = this.css3DRender())),
            this.scene.scale.setScalar(i),
            (this.camera = this.creatCamera(s)),
            r.create &&
              (this.controls = new THRDev3.OrbitControls(
                this.camera,
                this.container
              )),
            this.setControls(r),
            this.setLight(a),
            this.setFog(l),
            this.addSkysEffect(c),
            this.setWaterMark(h);
        },
        disposeTools() {
          this._Txues.dispose(),
            this.eventArr2.splice(0, this.eventArr2.length),
            G.disposeObj(this.scene),
            this.controls && this.controls.dispose(),
            this.renderer2 &&
              (G.dispoaeCSS(this.scene2),
              this.renderer2.domElement.remove(),
              (this.renderer2 = null),
              (this.scene2 = null)),
            (this.scene = null),
            (this._Txues = null),
            (this.camera = null),
            (this.controls = null);
        },
        css3DRender() {
          const { width: e, height: t, container: n } = this,
            i = new THRDev3.CSS3DRenderer();
          return (
            i.setSize(e, t),
            (i.domElement.style.position = "absolute"),
            (i.domElement.style.top = 0),
            n.appendChild(i.domElement),
            i
          );
        },
        creatCamera(e) {
          const { width: t, height: n } = this,
            { near: i, far: o, ratio: s, isOrth: r } = e;
          let a;
          if (r) {
            const [e, r] = [s * t * 0.5, s * n * 0.5];
            a = new THRDev3.OrthographicCamera(-e, e, r, -r, i, o);
          } else a = new THRDev3.PerspectiveCamera(e.fov, t / n, i, o);
          return a.position.copy(e.position), a;
        },
        setControls(e = {}) {
          const { controls: t, camera: n } = this;
          if (!t) return;
          const {
            panRadius: i,
            target: o,
            params: s,
            enabled: r = !0,
            zoomNear: a,
          } = e;
          o && t.target.copy(o),
            G.setObjParams(t, s),
            t.update(),
            (t.panLimit = i),
            (n.userData.target = t.target.clone()),
            (t.enabled = !!r),
            this.initCameraNears(a),
            this.controls.addEventListener("zoomChange", () => {
              this.setCameraNear();
            });
        },
        initCameraNears(e) {
          const { isEnable: t, seg: n, range: i, ratio: o, power: s } = e;
          if (!t) return;
          const r = [];
          if (G.isArray(n)) {
            const e = n.length;
            for (let t = 0; t < e; t++) {
              const [e, i] = n[t],
                o = n[t - 1] ? n[t - 1][1] : 0;
              r.push({ ni: e, min: o, max: i });
            }
          } else {
            const e = G.toNum(n, 0),
              [t, a] = i,
              [l, c] = [this.controls.maxDistance, a - t];
            for (let n = 0; n <= e; n++) {
              const i = (t + (c * n) / e) / a,
                h = Math.max(t, (i ** s * a) | 0),
                u = ((l * o * h) / a) | 0,
                d = r[n - 1] ? r[n - 1].max : 0;
              r.push({ ni: h, min: d, max: u });
            }
          }
          return (this.cameraNears = r), r;
        },
        setCameraNear() {
          const { cameraNears: e = [] } = this;
          if (!e.length) return;
          const t = e.length - 1,
            n = this.distanceCm();
          let i = e[t].ni;
          for (let o = t; o >= 0; o--) {
            const { ni: t, min: s, max: r } = e[o];
            if (n >= s && n < r) {
              i = t;
              break;
            }
          }
          this.camera.near !== i &&
            ((this.camera.near = i),
            this.camera.updateProjectionMatrix(),
            this._triggerInnerEvent("nearChanges", i));
        },
        setLight(e) {
          if (!e) return;
          const { scene: t } = this,
            {
              Ambient: n,
              isHemisphere: i,
              hemisphere: o,
              isDirectional: s,
              directional: r,
            } = e;
          if (n) {
            const { color: e, strength: i } = n,
              o = new THRDev3.AmbientLight(e, i);
            (t.userData.ambient = o), t.add(o);
          }
          if (i && o) {
            const { color: e, groundColor: n, strength: i, position: s } = o,
              r = new THRDev3.HemisphereLight(e, n, i);
            r.position.copy(s), (t.userData.Hemisphere = r), t.add(r);
          }
          if (s && r) {
            const {
                color: e,
                strength: n,
                position: i,
                shadow: o,
                lightHelper: s,
              } = r,
              a = new THRDev3.DirectionalLight(e, n);
            if (
              (a.position.copy(i),
              (a.castShadow = o),
              (t.userData.directLight = a),
              t.add(a),
              s)
            ) {
              const e = new THRDev3.DirectionalLightHelper(a, 10);
              (e.dispose = () => {
                (e.lightPlane = null), (e.targetLine = null);
              }),
                t.add(e);
            }
            if (!o) return;
            const {
              mapSize: l = 2048,
              boxSize: c = 256,
              near: h = 0.1,
              far: u = 1e4,
              bias: d = -3e-5,
            } = r;
            (a.shadow.mapSize.width = l),
              (a.shadow.mapSize.height = l),
              (a.shadow.camera.left = -c),
              (a.shadow.camera.right = c),
              (a.shadow.camera.top = c),
              (a.shadow.camera.bottom = -c),
              (a.shadow.camera.near = h),
              (a.shadow.camera.far = u),
              (a.shadow.bias = d);
          }
        },
        setFog(e) {
          if (!e || !e.creat) return;
          const { color: t, isExp2: n, density: i, near: o, far: s } = e,
            r = G.getColorArr(t),
            [a, l] = [n ? "FogExp2" : "Fog", n ? i : o];
          (this.scene.fog = new THRDev3[a](r[0], l, s)),
            (this.scene.fog.userData = { ...e }),
            this.setFogDamping();
        },
        setFogDamping() {
          if (!this.controls) return;
          const { fog: e } = this.scene,
            {
              isExp2: t,
              far: n,
              density: i,
              damping: o,
              dampFactor: s,
              dampDistance: r,
            } = e.userData;
          let a = 0;
          const l = t ? Math.min(0.9999, o) : o;
          this.controls.addEventListener("zoomChange", () => {
            const o = this.distanceCm() - r;
            o < 0 ||
              ((a = o * s * 0.001),
              a > l || (t ? (e.density = i * (1 - a)) : (e.far = n * (1 + a))));
          });
        },
        distanceCm() {
          return this.camera && this.controls
            ? this.camera.position.distanceTo(this.controls.target)
            : -1;
        },
        addSkysEffect(e) {
          if (!e || !e.created) return;
          const t = () => {
            (this.scene.background = this.getTxue(e.currentSky)),
              (this.scene.environment = this.getTxue(e.environment));
          };
          let n = 0;
          e.hdr.forEach((i) => {
            let o = null;
            (e.currentSky !== i.id && e.environment !== i.id) || ((o = t), n++),
              this._Txues.loadHdr(i, o);
          }),
            0 === n && t();
        },
        setWaterMark(e) {
          if (!e) return;
          const { state: t, txue: n, width: i, height: o, opacity: s } = e;
          if (!t) return;
          const r = this._Txues.getTxue(n);
          if (!r) return;
          const a = new THRDev3.Mesh(
            G.geo.plane(2, 2),
            G.mtl.shader({
              uniforms: {
                map: { value: r },
                uOpacity: { value: s },
                uSize: { value: new THRDev3.Vector2(i, o) },
              },
              transparent: !0,
              depthWrite: !1,
              depthTest: !1,
              vertexShader:
                "void main() { gl_Position = vec4(position, 1.0); }",
              fragmentShader:
                "\n                uniform vec2 uSize;\n                uniform float uOpacity;\n                uniform sampler2D map;\n                void main() {\n                    vec4 col = texture2D(map, mod(gl_FragCoord.xy, uSize) / uSize);\n                    gl_FragColor = vec4(col.rgb, col.a * uOpacity);\n                }\n            ",
            })
          );
          (a.frustumCulled = !1), (a.name = "waterMark"), this.scene.add(a);
        },
        setCameraParams(e = {}) {
          const t = e.target;
          this.camera &&
            e.position &&
            (this.camera.position.copy(e.position),
            t &&
              (this.camera.lookAt(t.x, t.y, t.z),
              (this.camera.userData.target = t)),
            e.fov &&
              ((this.camera.fov = e.fov),
              this.camera.updateProjectionMatrix())),
            this.controls &&
              t &&
              (this.controls.target.copy(t), this.controls.update());
        },
        getCameraParams(e = !1) {
          if (e) {
            const t = this.camera ? { ...this.camera.position } : null,
              n = this.controls ? { ...this.controls.target } : null,
              i = (t) => {
                if (!t) return;
                const n = G.toNum(e, 2);
                (t.x = +t.x.toFixed(n)),
                  (t.y = +t.y.toFixed(n)),
                  (t.z = +t.z.toFixed(n));
              };
            return (
              i(t),
              i(n),
              {
                fov: this.camera ? this.camera.fov : null,
                position: t,
                target: n,
              }
            );
          }
          return {
            fov: this.camera ? this.camera.fov : null,
            position: this.camera ? { ...this.camera.position } : null,
            target: this.controls ? { ...this.controls.target } : null,
          };
        },
        restoreCamra(e, t) {
          const { camera: n, controls: i, config: o } = this,
            { fov: s, position: r } = o.camera;
          n.fov !== s &&
            this.setTestTween(n, { fov: s }, void 0, e, void 0, () => {
              n.updateProjectionMatrix();
            });
          let a = !0;
          const l = () => {
            a && ((a = !1), G.isFunction(t) && t());
          };
          let c = 0;
          if (i) {
            const { target: t } = o.controls;
            i.target.clone().sub(t).length() < 1e-6
              ? (c += 1)
              : this.setTestTween(
                  i.target,
                  t,
                  () => {
                    l();
                  },
                  e,
                  void 0,
                  () => {
                    this.setCameraNear();
                  }
                );
          } else c += 1;
          n.position.clone().sub(r).length() < 1e-6
            ? (c += 1)
            : this.setTestTween(
                n.position,
                r,
                () => {
                  l();
                },
                e,
                void 0,
                () => {
                  this.setCameraNear();
                }
              ),
            2 === c && l();
        },
        getTxue(e) {
          return this._Txues ? this._Txues.getTxue(e) : null;
        },
        setTxue(e) {
          return this._Txues ? this._Txues.setTxue(e) : null;
        },
        setLightOption(e) {
          G.loopObject(e, (t) => {
            if ("ambient" === t) {
              const { ambient: n } = this.scene.userData;
              void 0 !== e[t].color && n.color.setStyle(e[t].color),
                void 0 !== e[t].intensity && (n.intensity = e[t].intensity);
            }
          });
        },
        chgBackground(e) {
          this.scene.background = this.getTxue(e);
        },
        chgEnvironment(e) {
          this.scene.environment = this.getTxue(e);
        },
        addLoading(e) {
          if (!e || !e.created || !e.url) return;
          const { background: t = "#000" } = e,
            [n, i, o] = [
              document.createElement("div"),
              `position: absolute; inset: 0; z-index: 100; background: ${t}; width: 100%; height: 100%;`,
              "position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);\n            -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%);\n            -moz-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%);",
            ];
          (n.id = "loading_" + this.id),
            (n.style = e.style || i),
            (n.innerHTML = `<img src= "${e.url}" style="${e.imgStyle || o}">`),
            (this.loadingDom = n),
            this.container.insertBefore(n, this.container.firstChild);
        },
        removeLoading(e) {
          this.loadingDom
            ? ((this.loadingDom.style.opacity = 1),
              this.setTestTween(
                this.loadingDom.style,
                { opacity: 0 },
                () => {
                  G.exeFunction(e),
                    this._triggerInnerEvent("onRemoveLoading"),
                    this.loadingDom &&
                      (this.loadingDom.remove(), (this.loadingDom = null));
                },
                this.config.loading.hidden
              ))
            : window.requestAnimationFrame(() => {
                G.exeFunction(e), this._triggerInnerEvent("onRemoveLoading");
              });
        },
      },
      re = {
        initRenderTools() {
          (this.GId = ""),
            (this.width = 0.01),
            (this.height = 0.01),
            (this.isInit = !1),
            (this.clock = null),
            (this.renderer = null),
            (this.container = null),
            (this.subAnimateArr = []),
            (this.subCompEffects = {}),
            (this.subCompEffectArr = []),
            (this._Events = new oe(this));
        },
        dispose() {
          this.isInit &&
            this.testing() &&
            (this._triggerInnerEvent("beforeDispose"), (this.isInit = !1));
        },
        _getIns(e, t = "auto") {
          return "renderer" === e
            ? this
            : "auto" !== t
            ? this._getComp(e, t)
            : this._getComp(e, "name") || this._getComp(e, "id");
        },
        _getComp(e, t) {
          return this.subCompEffectArr.filter((n) => e === n[t])[0] || null;
        },
        _getTypeName(e) {
          return this.subCompEffectArr
            .filter((t) => e === t.compType)
            .map((e) => {
              const { name: t, id: n } = e;
              return { name: t, id: n };
            });
        },
        setRenderSize(e, t) {
          const { nw: n, nh: i, rs: o } = this.getWH(e, t);
          o &&
            (this.isInit && this.renderer.setSize(n, i),
            this.renderer2 && this.renderer2.setSize(n, i),
            this.camera &&
              ((this.camera.aspect = n / i),
              this.camera.updateProjectionMatrix()),
            this._triggerInnerEvent("onResize", n, i));
        },
        onAnimate(e) {
          G.isFunction(e) && this.subAnimateArr.push(e);
        },
        unAnimate(e) {
          G.removeArrItem(this.subAnimateArr, e);
        },
        initiate(e) {
          this.getWH(), (this.clock = new THRDev3.Clock());
          const { renderParams: t, isViewport: n } = this.config;
          (this.renderer = new THRDev3.WebGLRenderer({
            antialias: !0,
            alpha: !0,
          })),
            this.container.appendChild(this.renderer.domElement),
            this.setRenderer(this.renderer, t),
            e &&
              this.initTypeTools &&
              (this.initTypeTools(!0, e), this.dynChangeTone(this.renderer, t)),
            this._Events.init(n),
            this.setConfigProxy(this._setting),
            this.config.isResize &&
              ((this._resizeFn = () => {
                this.setRenderSize();
              }),
              window.addEventListener("resize", this._resizeFn)),
            (this.isInit = !0);
        },
        setRenderer(e, t) {
          const {
            shadow: n,
            devicePixelRatio: i,
            clearColor: o,
            clearOpacity: s,
            isScissor: r = !0,
          } = t;
          (e.autoClear = r),
            (e.shadowMap.enabled = n),
            e.setPixelRatio(i),
            e.setClearColor(G.getColorArr(o)[0], s),
            e.setSize(this.width, this.height),
            this.setRendererTone(e, t),
            this.setRendererEncoding(e, t);
        },
        setRendererTone(e, t) {
          const { toneMapping: n, toneMappingExposure: i } = t;
          (e.toneMapping = THRDev3[n]), (e.toneMappingExposure = i);
        },
        dynChangeTone(e, t) {
          const { toneMappingExposure: n, isToneChange: i, toneChange: o } = t;
          if (!this.controls || !e.toneMapping || !i) return;
          const { easeing: s, current: r, minExp: a, maxExp: l, factor: c } = o,
            [h, u] = [this.distanceCm(), l - a],
            d = G.clamp(G.toNum(r, n), a, l),
            p = a + u * G.easing((d - a) / u, s);
          (e.toneMappingExposure = p),
            this.controls.addEventListener("zoomChange", () => {
              const t = (this.distanceCm() - h) * c,
                n = G.clamp(d + t, a, l),
                i = a + u * G.easing((n - a) / u, s);
              e.toneMappingExposure = i;
            });
        },
        setRendererEncoding(e, t) {
          e.outputEncoding = THRDev3[t.outputEncoding];
        },
        clearECache(e) {
          e ? this._Events.dispose(!0) : (this._Events._ItdMesh = null);
        },
        _disposeRender() {
          this.renderer.dispose(),
            this.renderer.forceContextLoss(),
            (this.renderer.domElement = null),
            this._Events.dispose(),
            this.container.remove(),
            G.disposeArr(this.subCompEffects),
            (this.renderer = null),
            this.disposeTools && this.disposeTools(),
            this._disposeValue();
        },
        _disposeValue() {
          this._resizeFn &&
            window.removeEventListener("resize", this._resizeFn),
            this.subAnimateArr.splice(0, this.subAnimateArr.length),
            this.subCompEffectArr.splice(0, this.subCompEffectArr.length),
            (this._Events = null),
            (this._setting = null),
            (this.container = null),
            (this.parentCont = null),
            (this.clock = null),
            this._TWEEN.removeAll(),
            this.disposeBase();
        },
        testing() {
          return this.renderer instanceof THRDev3.WebGLRenderer;
        },
        getWH(e, t) {
          let [n, i] = [
            G.clamp(e, 0.01, 1 / 0, this.container.offsetWidth),
            G.clamp(t, 0.01, 1 / 0, this.container.offsetHeight),
          ];
          this.config.wh && ([n, i] = this.config.wh),
            this.config.whRatio && (i = n / this.config.whRatio);
          const o = !(this.width === n && this.height === i);
          return (
            o && ((this.width = n), (this.height = i)), { nw: n, nh: i, rs: o }
          );
        },
        parseCts(e) {
          if ("object" != typeof e) return document.getElementById(e);
          let t = G.isDomElement(e) ? e : e[0];
          return (t = G.isDomElement(t) ? t : null), t;
        },
        creatContainer(e) {
          const [t, n] = [
            document.createElement("div"),
            "width: 100%; height: 100%; overflow: hidden; position: relative !important; outline: none; opacity: 1;",
          ];
          return (t.id = e), (t.style = n), t;
        },
      },
      ae = {
        install(e) {
          this.renderer = e;
        },
        updateEventArr() {
          this.renderer.updateEventArr(this);
        },
        ajaxQuer(e, t) {
          if (!e) return;
          const n = new XMLHttpRequest();
          n.open("GET", e, !0),
            (n.onreadystatechange = function () {
              ((4 === n.readyState && 200 === n.status) || 304 === n.status) &&
                t.call(this, n.responseText);
            }),
            n.send();
        },
        getPathInfo(e, t = !1, n = !0, i = !1) {
          const [o, s = o.flatten(e)] = [G.geoEtds];
          return (
            t && (s.indices = o.triangulate(s.vertices, s.holes)),
            n && (s.beveling = o.offsetPolygon2(s.vertices, s.holes, i)),
            s
          );
        },
        sideIndices(e, t, n, i = 2) {
          const o = n + t * i;
          e.push(o + i, o, o + 1, o + 1, o + i + 1, o + i);
        },
        pushColor(e, ...t) {
          for (let n = 0, i = t.length; n < i; n++) {
            const i = t[n];
            e.push(i[0].r, i[0].g, i[0].b, i[1]);
          }
          return e;
        },
        handleColor(e) {
          const t = [];
          return (
            e.forEach((e) => {
              if (G.isArray(e)) {
                const n = [];
                e.forEach((e) => {
                  n.push(G.getColorArr(e));
                }),
                  t.push(n);
              } else t.push(G.getColorArr(e));
            }),
            t
          );
        },
        nodeAmtFunc(
          e,
          t,
          n = null,
          i = "_transTimes",
          o = "_perTimes",
          s = "uTime"
        ) {
          t[i] > t[o] ||
            ((t[i] += e),
            (t.material.uniforms[s].value = t[i] / t[o]),
            t[i] < t[o] || ((t[i] -= t[o]), G.exeFunction(n, this)));
        },
        handleVec3(e, t = this.config) {
          const [n, i, o, s = o[i].vScale, r = o[i].center] = [
            t.isMercator,
            t.dataTans,
            t.basic,
          ];
          if (n && "longLat" === i) {
            const { mx: t, my: n } = G.getMercator();
            (e[0] = t), (e[1] = n);
          }
          const [a, l, c] = [
            (e[0] - r[0]) * s,
            (e[1] - r[1]) * s,
            (e[2] - (r[2] || 0)) * s,
          ];
          return { vx: a, vy: l, vz: c };
        },
      },
      le = {
        cts: "",
        name: "",
        isShow: !0,
        isAnimate: !0,
        isViewport: !0,
        isReRender: !1,
        isDfEvent: !1,
        isStopEvents: !1,
        isProxy: !1,
        wh: null,
        whRatio: null,
        isResize: !1,
        frameLimit: 0.1,
        threshold: 1,
        isRayRecur: !0,
        renderParams: {
          shadow: !1,
          devicePixelRatio: 1,
          clearColor: "#ffffff",
          clearOpacity: 0,
          toneMapping: "NoToneMapping",
          toneMappingExposure: 1,
          isToneChange: !1,
          toneChange: {
            easeing: "Linear.None",
            current: 1,
            minExp: 0.8,
            maxExp: 1.8,
            factor: 0.001,
          },
          outputEncoding: "LinearEncoding",
        },
        loading: {
          created: !0,
          url: "",
          hidden: 0.6,
          background: "#000",
          style: null,
          imgStyle: null,
        },
        ...{
          isCSSRender: !1,
          sceneScale: 1,
          camera: {
            fov: 45,
            near: 0.1,
            far: 1e4,
            position: { x: 0, y: 512, z: 256 },
            ratio: 1,
            isOrth: !1,
          },
          controls: {
            create: !0,
            enabled: !0,
            target: { x: 0, y: 0, z: 0 },
            panRadius: 1 / 0,
            params: {
              enablePan: !0,
              enableZoom: !0,
              enableRotate: !0,
              enableDamping: !0,
              screenSpacePanning: !1,
              dampingFactor: 0.08,
              panSpeed: 0.5,
              zoomSpeed: 0.1,
              rotateSpeed: 0.08,
              minDistance: 100,
              maxDistance: 4e3,
              minPolarAngle: 0,
              maxPolarAngle: 1.5393803985,
              minAzimuthAngle: -1 / 0,
              maxAzimuthAngle: 1 / 0,
            },
            zoomNear: {
              isEnable: !1,
              range: [0.1, 50],
              seg: 3,
              ratio: 1,
              power: 2,
            },
          },
          light: {
            isHemisphere: !0,
            isDirectional: !1,
            Ambient: { color: "#BFBFBF", strength: 0.8 },
            hemisphere: {
              color: "#FAFEFF",
              groundColor: "#FFFEFA",
              strength: 0.5,
              position: { x: 0, y: 128, z: 0 },
            },
            directional: {
              color: "#FFFFFF",
              strength: 1,
              position: { x: 1, y: 1, z: 0 },
              lightHelper: !1,
              shadow: !1,
              mapSize: 2048,
              boxSize: 256,
              near: 0.1,
              far: 1e4,
              bias: -3e-5,
            },
          },
          waterMark: {
            state: !1,
            txue: "",
            width: 300,
            height: 300,
            opacity: 1,
          },
          fog: {
            creat: !1,
            color: "#A0A5B2",
            isExp2: !0,
            density: 0.0015,
            near: 1,
            far: 2e3,
            damping: 0.9,
            dampFactor: 0.9,
            dampDistance: 500,
          },
          sky: { created: !0, currentSky: "", environment: "", hdr: [] },
        },
      },
      ce = {
        sort: 0,
        name: "",
        isShow: !0,
        isAnimate: !0,
        isViewport: !0,
        isDfEvent: !1,
        isCompEvents: !1,
        isStopEvents: !1,
        isProxy: !1,
        gridHelper: !1,
        renderOrder: 1,
        guiConfig: {},
        title: "",
      };
    class he extends te {
      constructor() {
        super(),
          (this.isShift = !1),
          (this.isCtrl = !1),
          (this.isDown = !1),
          (this.renderState = !1),
          Object.assign(this.constructor.prototype, se),
          Object.assign(this.constructor.prototype, re);
      }
      init(e, t) {
        if ((this.setLifecycle(e), window._isSupportWebGL))
          if (((this.parentCont = this.parseCts(e.cts)), this.parentCont))
            try {
              (this.compType = "renderer"),
                this.initRenderTools(),
                this._triggerInnerEvent("beforeInit", e, t, this),
                (this.parentCont.innerHTML = ""),
                this.typeConfig(e, le),
                (this.GId = G.creatId(this.parentCont.id || "render")),
                (this.container = this.creatContainer(this.GId)),
                this.parentCont.appendChild(this.container),
                this.initiate(t),
                window.requestAnimationFrame(() => {
                  this._triggerInnerEvent("mounted", this.config),
                    this.renderers();
                }),
                this._triggerInnerEvent("afterInit", this.config, this);
            } catch (e) {
              this._triggerInnerEvent("onError", {
                type: 103,
                describe: "Initialization Error!",
              });
            }
          else
            this._triggerInnerEvent("onError", {
              type: 102,
              describe: "Container Error!",
            });
        else
          this._triggerInnerEvent("onError", {
            type: 101,
            describe: "Not Support WebGL!",
          });
      }
      animation(e) {
        if (
          this.config.isViewport &&
          (this.controls.enableDamping && this.controls.update(),
          this.config.isAnimate)
        ) {
          this._TWEEN && this._TWEEN.update();
          for (let t = 0; t < this.subAnimateArr.length; t++)
            this.subAnimateArr[t](e, this.clock);
        }
      }
      renderers() {
        let e = 0;
        const t = () => {
          if (this.isInit) {
            if (((e = window.requestAnimationFrame(t)), !this.config.isShow))
              return void (this.renderState = !1);
            const n = this.clock.getDelta();
            if (n > this.config.frameLimit) return void (this.renderState = !1);
            (this.renderState = !0), this.animation(n), this.renderMain(n);
          } else window.cancelAnimationFrame(e), this._disposeRender();
        };
        t();
      }
      renderMain(e) {
        const { isCSSRender: t, isReRender: n } = this.config;
        n
          ? (this._triggerInnerEvent("beforeRender", e, this.clock),
            this.reRender(e, this.renderer, this.scene, this.camera),
            this._triggerInnerEvent("afterRender", e, this.clock))
          : this.renderer.render(this.scene, this.camera),
          t &&
            this.renderer2 &&
            this.renderer2.render(this.scene2, this.camera);
      }
      setReRender(e, t, n = !0) {
        G.isFunction(e) &&
          (this.switchRender(n),
          (this.reRender = e),
          G.isFunction(t) && this.on("onResize", t));
      }
      switchRender(e) {
        this.config.isReRender = e;
      }
      reRender(e, t, n, i) {
        t.render(n, i);
      }
      addCompEft(e) {
        this._triggerInnerEvent("beforeAdd", e),
          e._triggerInnerEvent("beforeAdd"),
          G.exeFunction(e.install, e, this),
          (this.subCompEffects[e.id] = e),
          this.subCompEffectArr.push(e),
          this.updateEventArr(e),
          (e.config.isViewport = this.config.isViewport),
          (e.group.name += e.id),
          (e.group2.name += e.id),
          this.scene.add(e.group),
          this.scene2 && this.scene2.add(e.group2),
          this.onAnimate(e.animate),
          this._triggerInnerEvent("afterAdd", e),
          e._triggerInnerEvent("afterAdd");
      }
      removeCompEft(e, t) {
        this._triggerInnerEvent("beforeRemove", e),
          e._triggerInnerEvent("beforeRemove"),
          this._Events.dispose(!0),
          delete this.subCompEffects[e.id],
          G.removeArrItem(this.subCompEffectArr, e),
          (e.renderer = null),
          this.removeEventArr(e.id),
          this.scene.remove(e.group),
          this.scene2 && this.scene2.remove(e.group2),
          this.unAnimate(e.animate),
          this._triggerInnerEvent("afterRemove"),
          e._triggerInnerEvent("afterRemove"),
          t && e.dispose();
      }
      removeAll(e) {
        G.loopObject(this.subCompEffects, (t) => {
          this.removeCompEft(this.subCompEffects[t], e);
        });
      }
      updateEventArr(e) {
        const [t, n] = [e.id, e.eventArr];
        this.removeEventArr(t);
        for (let e = 0; e < n.length; e++) {
          const { _unMouseIn: i, _unEvent: o } = n[e];
          n[e].traverse((e) => {
            e.userData.ceId = t;
          }),
            o || (this.eventArr.push(n[e]), i || this.eventArr2.push(n[e]));
        }
      }
      setInsEventArr(e) {
        const t = this._getIns(e);
        t && this.updateEventArr(t);
      }
      removeEventArr(e) {
        const t = (t) => {
          for (let n = t.length - 1; n >= 0; n--)
            t[n].userData.ceId === e && t.splice(n, 1);
        };
        t(this.eventArr), t(this.eventArr2);
      }
      getImage(e = 200, t = 150, n = "#1E1F22") {
        return (
          this.renderer.render(this.scene, this.camera),
          G.canvasToImg(this.renderer.domElement, e, t, n)
        );
      }
      onKeyup(e, ...t) {
        return (
          "Shift" === e.key && (this.isShift = !1),
          "Control" === e.key && (this.isCtrl = !1),
          [e, ...t]
        );
      }
      onKeydown(e, ...t) {
        return (
          "Shift" === e.key && (this.isShift = !0),
          "Control" === e.key && (this.isCtrl = !0),
          [e, ...t]
        );
      }
      onMouseUp(e, ...t) {
        return (this.isDown = !1), [e, ...t];
      }
      onMouseDown(e, ...t) {
        return (this.isDown = !0), [e, ...t];
      }
      onDblClick(e, ...t) {
        return (
          this.config.isDfEvent && G.exeFunction(this.restoreCamra, this),
          [e, ...t]
        );
      }
      setConfig(e, t = {}) {
        switch (e) {
          case "show":
            this.show(t.time, t.callback);
            break;
          case "hide":
            this.hide(t.time, t.callback);
            break;
          case "restore":
            this.restoreCamra(t.time, t.callback);
            break;
          case "skyBox":
            this.chgBackground(t.name);
            break;
          case "environment":
            this.chgEnvironment(t.name);
            break;
          case "camera":
            this.setCameraParams(G.copy(this.config.camera, t));
            break;
          case "control":
            this.setControls(G.copy(this.config.controls, t));
            break;
          case "animate":
            this.onAnimate(t.callback);
            break;
          case "rendererTone":
            this.setRendererTone(this.renderer, t);
            break;
          case "rendererEncoding":
            this.setRendererEncoding(this.renderer, t);
            break;
          case "_reRender":
            this.setReRender(t.renderFun, t.resizeFun, t.isReRender);
            break;
          case "_switchRender":
            this.switchRender(t.isReRender);
            break;
          case "light":
            this.setLightOption(t);
            break;
          case "updateNear":
            this.setCameraNear();
            break;
          case "updateEvent":
            this.setInsEventArr(t.insName);
        }
      }
      getConfig(e, t = {}) {
        let n = null;
        switch (e) {
          case "camera":
            n = this.getCameraParams(t.fix);
            break;
          case "litImg":
            n = this.getImage(t.w, t.h, t.color);
            break;
          case "distance":
            n = this.distanceCm();
            break;
          case "renderState":
            n = this.renderState;
        }
        return n;
      }
    }
    var ue = {
      BmVShader:
        "\n        varying vec2 vUv;\n        varying vec3 vNormal;\n        varying vec3 vPNormal;\n\n        void main() {\n            vec4 mP = modelViewMatrix * vec4(position, 1.0);\n\n            vUv = uv;\n            vNormal = normalize(normalMatrix * normal);\n            vPNormal = normalize(mP.xyz);\n\n            gl_Position = projectionMatrix * mP;\n        }\n    ",
      BmFShader:
        "\n        uniform float uTime;\n        uniform vec4 uColor;\n        uniform vec3 uRatio;\n        uniform sampler2D uTxue;\n\n        varying vec2 vUv;\n        varying vec3 vNormal;\n        varying vec3 vPNormal;\n\n        void main() {\n            float k = uRatio.y * abs(dot(vNormal, vPNormal));\n            float a = .03 + .97 * pow(uRatio.x + k, uRatio.z);\n\n            float ky = vUv.y - mod(uTime * .1, 1.);\n            vec4 map = texture2D(uTxue, vec2(vUv.x, mod(ky, 1.)));\n\n            gl_FragColor = map * uColor;\n            gl_FragColor.w = .03 + gl_FragColor.w * a;\n        }\n    ",
    };
    class de extends te {
      constructor(e) {
        super(), Object.assign(this.constructor.prototype, ae), this.install(e);
      }
      init(e) {
        (e = G.extend(!0, {}, e)), this.setLifecycle(e);
        const { config: t, compType: n } = e;
        (this.compType = n),
          this._triggerInnerEvent("beforeInit", t, this),
          this.typeConfig(t, ce),
          (this.group = new THRDev3.Group()),
          (this.group2 = new THRDev3.Group()),
          (this.group.renderOrder = this.config.renderOrder || 1),
          this.config.gridHelper &&
            ((this.GridHelper = new THRDev3.GridHelper(
              500,
              20,
              1333901,
              4802889
            )),
            this.group.add(this.GridHelper)),
          this.setConfigProxy(this._setting),
          this.compEftInit(),
          this._triggerInnerEvent("afterInit", this.config, this);
      }
      compEftInit() {}
      animate() {}
      dispose() {
        this._triggerInnerEvent("beforeDispose"),
          (this.inAmtOpts = null),
          (this.GridHelper = null),
          this.renderer && this.renderer.removeCompEft
            ? this.renderer.removeCompEft(this)
            : (this.renderer = null),
          G.disposeObj(this.group),
          G.dispoaeCSSObj(this.group2),
          (this.group = null),
          (this.group2 = null),
          this.container && (this.container.remove(), (this.container = null)),
          this.disposeTools && this.disposeTools(),
          this.disposeCompEft(),
          this.disposeBase();
      }
      disposeCompEft() {}
    }
    var pe = {
        computeArea(e, t, n = 1) {
          let [i, o, s] = [0, 0, 0];
          const r = e.length / 3;
          for (let n = 0; n < r; n++) {
            const r = this.getVertexs(e, t, 3 * n),
              a = this.triangleArea(r),
              l = this.triangleCore(r);
            (o += l.x * a), (s += l.y * a), (i += Math.abs(a));
          }
          return (
            i > 0 && ((o /= i), (s /= i)),
            {
              areaVal: 1 * (i * n).toFixed(2),
              coreVec: r > 0 ? { x: o, y: s } : null,
            }
          );
        },
        getRdPoints(e, t, n = 1, i) {
          const [o, s] = [e.length / 3, []];
          if (o <= 0) return s;
          if (i) {
            let i = 0;
            const [r, a] = [[], []];
            for (let n = 0; n < o; n++) {
              const o = this.getVertexs(e, t, 3 * n),
                s = this.triangleArea(o);
              (i += Math.abs(s)), r.push(o), a.push(i);
            }
            const l = r.length;
            for (let e = 0; e < n; e++) {
              const e = Math.random() * i;
              let t = 0;
              for (let n = 0; n < l && ((t = n), !(e <= a[n])); n++);
              s.push(this.triangleRd(r[t]));
            }
          } else
            for (let i = 0; i < n; i++) {
              const n = (Math.random() * o) | 0,
                i = this.getVertexs(e, t, 3 * n);
              s.push(this.triangleRd(i));
            }
          return s;
        },
        isInPolygon(e, t = []) {
          const n = t.length;
          if (n < 3) return !1;
          let [i, o, s, r, a] = [0, 1, null];
          for ([r] = t; o <= n; o++)
            (a = t[o % n]),
              r.x !== a.x &&
                e.x > Math.min(r.x, a.x) &&
                e.x <= Math.max(r.x, a.x) &&
                e.y <= Math.max(r.y, a.y) &&
                ((s = ((e.x - r.x) * (a.y - r.y)) / (a.x - r.x) + r.y),
                (r.y === a.y || e.y <= s) && i++),
              (r = a);
          return !(i % 2 == 0);
        },
        isInPolygon2(e, t = []) {
          let [n, i, o, s] = [0, 0, 0, 0];
          const [r, a] = [[], t.length];
          if (a < 3) return !1;
          for (; n < a; n++) {
            const [i, o] = [t[n], t[(n + 1) % a]],
              s = this.calcCrossover(e, i, o);
            null !== s && r.push(s);
          }
          const l = r.length;
          for (; i < l; i++) {
            const t = r[i];
            if (t === e.x) return !1;
            e.x > t ? o++ : s++;
          }
          return o % 2 != 0 && s % 2 != 0;
        },
        calcCrossover(e, t, n) {
          if (e.y > Math.min(t.y, n.y) && e.y <= Math.max(t.y, n.y)) {
            const i = t.x - ((t.y - e.y) * (t.x - n.x)) / (t.y - n.y);
            if (i >= Math.min(t.x, n.x) && i <= Math.max(t.x, n.x)) return i;
          }
          return null;
        },
        getVertexs: (e, t, n) => [t[e[n]], t[e[n + 1]], t[e[n + 2]]],
        triangleArea(e) {
          const [t, n, i] = e;
          return (
            0.5 *
            (t.x * n.y +
              n.x * i.y +
              i.x * t.y -
              t.x * i.y -
              n.x * t.y -
              i.x * n.y)
          );
        },
        triangleCore(e) {
          const [t, n, i] = e;
          return { x: (t.x + n.x + i.x) / 3, y: (t.y + n.y + i.y) / 3 };
        },
        triangleRd(e) {
          const [t, n, i] = e,
            [o, s] = [Math.sqrt(Math.random()), Math.random()],
            [r, a, l] = [1 - o, o * (1 - s), o * s];
          return {
            x: r * t.x + a * n.x + l * i.x,
            y: r * t.y + a * n.y + l * i.y,
          };
        },
      },
      fe = {
        txuePms: {
          postfix: "㎡",
          scaleText: 1,
          sizeAttenuation: !0,
          offset: { x: 0, y: 0, z: 0 },
          center: { x: 0.5, y: 0.5 },
          color: ["#ffffff"],
          fontSize: [54],
          fontWeight: ["normal"],
          fontFamily: ["Arial"],
          fillTextH: [0.52, 0.55],
          padding: [8, 8],
          shadow: !0,
          shadowColor: "rgba(255, 255, 255, 0.2)",
          sdBlur: 1,
          lenLimit: 10,
          sizeScale: 0.95,
          background: !1,
          bgWidth: 1,
          bgColor: ["#6B6B6B"],
          bgRadius: 1,
          __test: !1,
        },
        initSprite(e = {}) {
          const t = this.handleOpts(e),
            n = new THRDev3.Sprite(
              G.mtl.sprite({
                transparent: !0,
                depthWrite: !1,
                sizeAttenuation: t.sizeAttenuation,
              })
            );
          return (
            n.center.copy(t.center),
            (n.visible = !1),
            (n.renderOrder = 10),
            (n.name = "area-text-sprite"),
            (n.userData.params = t),
            n
          );
        },
        handleOpts(e) {
          [
            "color",
            "fontSize",
            "fontWeight",
            "fontFamily",
            "fillTextH",
            "bgColor",
          ].forEach((t) => {
            void 0 === e[t] || G.isArray(e[t]) || (e[t] = [e[t]]);
          });
          return G.extend(!0, {}, this.txuePms, e);
        },
        dispose() {
          this.txuePms = null;
        },
        setTextSprite(e, t, n, i, o) {
          if (!e || !e.userData || !e.userData.params) return;
          const { params: s, divide: r } = e.userData;
          if (((e.visible = !!n), !n)) return;
          (t !== e.userData.text || o) && this.updateTxue(e, t, s),
            (e.userData.text = t),
            e.position.set(n.x, i, n.y).add(s.offset);
          const a = e.material.sizeAttenuation ? 0.1 : 0.001;
          e.scale.copy(e.userData._scale).multiplyScalar(a * s.scaleText),
            r && e.scale.divide(r);
        },
        updateTxue(e, t, n = {}) {
          const { map: i } = e.material;
          let o;
          i
            ? ((o = i.image), i.dispose())
            : (o = document.createElementNS(
                "http://www.w3.org/1999/xhtml",
                "canvas"
              ));
          const s = this.canvasTxue(o, t, n);
          (e.material.map = s), (e.userData._scale = s._scale);
        },
        getTextTxue(e, t = {}) {
          let n = document.createElementNS(
            "http://www.w3.org/1999/xhtml",
            "canvas"
          );
          const i = this.setCanvas(n, e, t),
            o = new THRDev3.CanvasTexture(n);
          return (o._scale = i), (n = null), o;
        },
        canvasTxue(e, t, n = {}) {
          const i = this.setCanvas(e, t, n),
            o = new THRDev3.CanvasTexture(e);
          return (o._scale = i), (e = null), o;
        },
        setCanvas(e, t, n = {}) {
          const i = this.handleOpts(n),
            {
              postfix: o,
              color: s,
              fillTextH: r,
              shadow: a,
              shadowColor: l,
              sdBlur: c,
              __test: h,
            } = i,
            u = e.getContext("2d"),
            {
              texts: d,
              tws: p,
              rows: f,
              pw: m,
              thi: g,
              th: v,
              w: y,
              h: b,
              font: x,
              pFont: w,
              mTw: C,
            } = this.getCvsInfo(u, t, i);
          if (
            ((e.width = y),
            (e.height = b),
            this.drawBackground(u, i, y, b, C, v),
            a && ((u.shadowBlur = c), (u.shadowColor = l)),
            f)
          ) {
            (u.font = x),
              (u.textAlign = "center"),
              (u.textBaseline = "middle"),
              (u.fillStyle = this.setlinearGrd(s, f, u, v, b));
            const e = 0.5 * (b - v);
            for (let t = 0; t < f; t++) {
              const n = 0.5 * (t === f - 1 ? y - m : y);
              u.fillText(d[t], n, e + g * (t + this.getVal(r))),
                t === f - 1 &&
                  m &&
                  ((u.font = w),
                  (u.fillStyle = this.setlinearGrd(s, f, u, v, b, 1)),
                  u.fillText(
                    o,
                    0.5 * (y + p[t]),
                    e + g * (t + this.getVal(r, 1))
                  ));
            }
          }
          return this.outLineTest(u, h, y, b, C, v), { x: y, y: b, z: 1 };
        },
        setlinearGrd(e, t, n, i, o, s = 0) {
          const r = this.getVal(e, s);
          if (G.isArray(r)) {
            const e = r.length;
            if (e <= 1) return r[0] || "";
            const s = 0.5 * (o - i),
              a = n.createLinearGradient(0, s, 0, s + i),
              [l, c] = [1 / t, 1 / (e - 1)];
            for (let n = 0; n < t; n++)
              for (let t = 0; t < e; t++)
                a.addColorStop(l * n + l * c * t, r[t]);
            return a;
          }
          return r;
        },
        getCvsInfo(e, t, n) {
          const {
              postfix: i,
              fontSize: o,
              fontWeight: s,
              fontFamily: r,
              padding: a = [8, 8],
              lenLimit: l,
              sizeScale: c,
            } = n,
            [h, u, d, p] = [("" + t).length, ("" + i).length, [], []],
            f = Math.ceil(h / l),
            m = f > 1 ? c ** f : 1,
            [g, v] = [this.getVal(o) * m, this.getVal(o, 1) * m],
            [y, b] = [this.getVal(r), this.getVal(r, 1)];
          let [x, w, C] = [0, 0, 0];
          if (
            (u &&
              ((e.font = `bold ${v}px ${b}`),
              (w = Math.ceil(e.measureText(i).width))),
            f)
          ) {
            const n = a[0] * m;
            for (let i = 0; i < f; i++) {
              e.font = `bold ${g}px ${y}`;
              const o = t.slice(i * l, (i + 1) * l),
                s = Math.ceil(e.measureText(o).width),
                r = s + a[1] * m;
              i === f - 1
                ? ((x = Math.max(x, r + w)), (C += Math.max(g, v) + n))
                : ((x = Math.max(x, r)), (C += g + 0.6 * n)),
                p.push(o),
                d.push(s);
            }
          }
          const [T, _, D, M] = [
              Math.max(2, THRDev3.MathUtils.ceilPowerOfTwo(x)),
              Math.max(2, THRDev3.MathUtils.ceilPowerOfTwo(C)),
              `${this.getVal(s)} ${g}px ${y}`,
              `${this.getVal(s, 1)} ${v}px ${b}`,
            ],
            S = Math.ceil(C / f);
          return (
            (C = S * f),
            {
              texts: p,
              tws: d,
              rows: f,
              pw: w,
              thi: S,
              th: C,
              w: T,
              h: _,
              font: D,
              pFont: M,
              mTw: x,
            }
          );
        },
        getVal: (e, t = 0) => (void 0 === e[t] ? e[0] : e[t]),
        drawBackground(e, t, n, i, o, s) {
          const { background: r, bgWidth: a, bgColor: l, bgRadius: c } = t;
          if (!r || !l[0]) return;
          (e.lineWidth = a), (e.strokeStyle = l[0]);
          const [h, u] = [0.5 * (n - o), 0.5 * (i - s)];
          this.drawRoundRect(e, h, u, o, s, c),
            l[1] && ((e.fillStyle = l[1]), e.fill()),
            e.stroke();
        },
        drawRoundRect(e, t, n, i, o, s) {
          e.beginPath(),
            e.arc(t + s, n + s, s, Math.PI, (3 * Math.PI) / 2),
            e.lineTo(i - s + t, n),
            e.arc(i - s + t, s + n, s, (3 * Math.PI) / 2, 2 * Math.PI),
            e.lineTo(i + t, o + n - s),
            e.arc(i - s + t, o - s + n, s, 0, (1 * Math.PI) / 2),
            e.lineTo(s + t, o + n),
            e.arc(s + t, o - s + n, s, (1 * Math.PI) / 2, Math.PI),
            e.closePath();
        },
        outLineTest(e, t, n, i, o, s) {
          t &&
            ((e.strokeStyle = "#000"),
            e.strokeRect(0.5 * (n - o), 0.5 * (i - s), o, s));
        },
      };
    const [me, ge, ve, ye, be, xe, we, Ce] = [
      new THRDev3.Euler(),
      new THRDev3.Vector3(),
      new THRDev3.Quaternion(),
      { x: 1, y: 0, z: 0 },
      { x: 0, y: 1, z: 0 },
      { x: 0, y: 0 },
      {
        side: 1,
        transparent: !0,
        depthWrite: !1,
        polygonOffset: !0,
        polygonOffsetFactor: -1,
        polygonOffsetUnits: 0,
      },
      { transparent: !0, depthWrite: !1 },
    ];
    var Te = {
      HTFunc: class extends de {
        constructor(e) {
          super(e),
            (this.CoordTrans = new G.CoordTrans()),
            (this.currentB = null),
            (this.historyB = null),
            (this.tBeamGeo = null),
            (this.HtIndex = null),
            (this.HtAttrPos = null),
            (this.CBeam = {
              length: 64.914,
              angle: 12,
              rotate: { x: 0, y: 0 },
              pos: { x: 0, y: 25.9656, z: 160 },
            }),
            (this.HBAmt = { start: !1, framei: 0, current: 0, total: 0 }),
            (this.TransC = {}),
            (this.ToolsG = null),
            (this.ToolVecs = { idx: 0 }),
            (this.Paths = null),
            (this.PDatas = {}),
            (this.PAmt = { start: !1, trans: 0, len: 0, viewTo: !0 }),
            (this.WShips = null),
            (this.WSData = {}),
            (this.animate = (e, t) => {
              this.config.isAnimate && this.beamAmt(e, t);
            });
        }
        setDefaultConfig(e) {
          G.copy(e, {
            trans: {
              ratio: 111.1111,
              sxy: 0.5,
              WT: [
                [111.551246, 23.034293],
                [112.931043, 20.508303],
                [116.527715, 22.522473],
              ],
              XY: [
                [298.59904, 136.98664],
                [697.8336, 919.48576],
                [1738.504, 296.6804],
              ],
            },
            bg: { txue: "bg", color: "#fff", width: 1024, height: 512 },
            beam: {
              icon: "icon01",
              iColor: "#fff",
              scale: 3,
              txue: "beams",
              color: "#fff",
              speed: 1,
              length: 25,
              angle: 12,
              rotate: { x: 0, y: 0 },
              height: 10,
              beamW: 114.05831,
              beamT: 20.79291,
            },
            toBeam: {
              seg: 20,
              height: 0.01,
              cColor: "rgba(201, 134, 13, 0.52)",
              hColor: "rgba(107, 128, 94, 0.30)",
              frame: 15,
              total: 300,
            },
            path: { speed: 1, viewTo: !0 },
            warship: { icon: "icon02", color: "#fff", scale: 5, height: 0.3 },
            tools: { hUnit: "m", dUnit: ["km", "海里"], aUnit: "°" },
          });
        }
        disposeCompEft() {
          (this.currentB = null),
            (this.historyB = null),
            (this.tBeamGeo = null),
            (this.HtIndex = null),
            (this.HtAttrPos = null),
            (this.ToolsG = null),
            (this.Paths = null),
            (this.PDatas = {}),
            (this.WShips = null),
            (this.WSData = {});
        }
        compEftInit() {
          console.log(this, G),
            this.initTransCoord(),
            this.creatTools(),
            this.creatBg(),
            this.creatBeam(),
            this.creatPath(window.HTData.paths),
            (this.WShips = G.group("warship_group")),
            this.group.add(this.WShips),
            this.creatWarship(window.HTData.points),
            this._triggerInnerEvent("mounted", { val: this.config.name });
        }
        creatBg() {
          const { txue: e, color: t, width: n, height: i } = this.config.bg,
            o = this.renderer.getTxue(e),
            s = new THRDev3.Mesh(
              G.geo.plane(n, i),
              G.mtl.standard({
                map: o,
                bumpMap: o,
                bumpScale: 2,
                color: G.getColorArr(t)[0],
              })
            );
          (s.name = "bg_plane"),
            (s.rotation.x = 0.5 * -Math.PI),
            (s._reVisible = !0),
            this.eventArr.push(s),
            this.group.add(s);
        }
        initTransCoord() {
          const { ratio: e, WT: t, XY: n } = this.config.trans;
          this.CoordTrans.init(t, n, !0);
          const { WT: i, XY: o } = this.CoordTrans.params,
            [s, r] = [i[0], i[2]],
            [a, l] = [o[0], o[2]],
            c = Math.abs(e / ((l.X - a.X) / (r.W - s.W))),
            h = Math.abs(e / ((l.Y - a.Y) / (r.T - s.T))),
            u = 0.5 * (c + h);
          this.TransC = { xr: c, yr: u, zr: h, wr: 1.852 };
        }
        transCoord(e, t, n = 0) {
          const { sxy: i } = this.config.trans,
            { width: o, height: s } = this.config.bg,
            [r, a] = this.CoordTrans.transCoord(e, t);
          return { x: r * i - 0.5 * o, y: n, z: a * i - 0.5 * s };
        }
        reTransCoord(e, t) {
          const { sxy: n } = this.config.trans,
            { width: i, height: o } = this.config.bg,
            [s, r] = this.CoordTrans.reTransCoord(i + e / n, o + t / n);
          return { w: s, t: r };
        }
        transDist(e, t) {
          const { xr: n, yr: i, zr: o, wr: s } = this.TransC,
            [r, a, l] = [(e.x - t.x) * n, (e.y - t.y) * i, (e.z - t.z) * o],
            c = +Math.sqrt(r * r + a * a + l * l).toFixed(3);
          return { dist: c, sMile: +(c / s).toFixed(3) };
        }
        transAngle(e) {
          const { position: t } = this.currentB;
          return +(
            (180 *
              ge.copy(e).sub(t).normalize().clone().angleTo(ge.set(0, -1, 0))) /
            G.PI
          ).toFixed(2);
        }
        creatTools() {
          const e = G.group("tools_group"),
            [t, n, i, o, s, r, a, l] = [
              this.toolsLine(15654400, 1),
              this.toolsLine(1306112, 2),
              this.toolsLine(1306112, 3),
              this.toolsLine(61150, 4),
              this.toolsLine(16711680, 5, !1),
              this.toolsLine(16711680, 6, !1),
              this.toolsLine(16711680, 7, !1),
              this.toolsLine(16711680, 8, !1),
            ],
            [c, h, u, d, p] = [
              this.toolsText(" 海里", ["#FFFFFF", "#FDF7F5"], 1),
              this.toolsText(" km", ["#000000", "#000000"], 2),
              this.toolsText(" km", ["#000000", "#000000"], 3),
              this.toolsText(" °", ["#000000", "#000000"], 4),
              this.toolsText(" °", ["#000000", "#000000"], 5),
            ];
          (e.visible = !1),
            (e.renderOrder = 9999),
            e.add(t, n, i, o, s, r, a, l),
            e.add(c, h, u, d, p),
            (this.ToolsG = e),
            this.group.add(e);
        }
        toolsLine(e, t, n = !0) {
          const i = G.geo.buf().setFromPoints([
            { x: 0, y: 0, z: 0 },
            { x: 0, y: 0, z: 0 },
          ]);
          let o;
          o = n
            ? G.mtl.lineD({ dashSize: 0.5, gapSize: 0.5, color: e })
            : G.mtl.line({ color: e });
          const s = new THRDev3.Line(i, o);
          return (
            n && s.computeLineDistances(),
            (s.name = "line_dist" + t),
            (s.frustumCulled = !1),
            (s.renderOrder = 9999),
            (s.visible = !1),
            (s._type = n),
            s
          );
        }
        toolsText(e, t, n) {
          const i = fe.initSprite({
            postfix: e,
            color: t,
            fontSize: [42, 32],
            shadow: !1,
          });
          return (i.renderOrder = 9999), (i.name += n), i;
        }
        updateTools() {
          if (this.PAmt.start) return;
          const [e, t, n, i, o, s, r, a, l, c, h, u, d] = this.ToolsG.children,
            { v1: p, v2: f } = this.ToolVecs,
            { position: m } = this.currentB;
          this.updateLine(e, p, f),
            this.updateLine(t, m, p),
            this.updateLine(n, m, f),
            this.updateLine(i, m, this.V3Y(m, -0.4)),
            this.updateLine(o, p, this.V3Y(p, 2)),
            this.updateLine(s, f, this.V3Y(f, 2)),
            this.updateDist(l, p, f, "sMile"),
            this.updateDist(c, m, p),
            this.updateDist(h, m, f);
          const [g, v] = this.updateAngle(u, p, m),
            [y, b] = this.updateAngle(d, f, m);
          this.updateLine(r, g, v), this.updateLine(a, y, b);
        }
        updateLine(e, t, n) {
          const { position: i } = e.geometry.attributes;
          this.setXYZ(i, 0, t),
            this.setXYZ(i, 1, n),
            (i.needsUpdate = !0),
            e._type && e.computeLineDistances(),
            (e.visible = !0);
        }
        setXYZ(e, t, n) {
          const { x: i, y: o, z: s } = n;
          e.setXYZ(t, i, o, s);
        }
        V3Y(e, t, n = 1) {
          const { x: i, y: o, z: s } = e;
          return { x: i, y: o + Math.max(o, n) * t, z: s };
        }
        updateDist(e, t, n, i = "dist") {
          const o = this.transDist(t, n),
            { vec2: s, h: r } = this.textVec(t, n);
          this.updateText(e, o[i], s, r + 1, 0.15);
        }
        updateAngle(e, t, n) {
          const i = this.transAngle(t),
            [o, s] = [
              { ...ge.copy(t).sub(n).normalize().multiplyScalar(3).add(n) },
              { x: n.x, y: n.y - 3, z: n.z },
            ],
            { vec3: r } = this.textVec(o, s),
            { x: a, y: l, z: c } = ge.copy(n).lerp(r, 1.5);
          return this.updateText(e, i, { x: a, y: c }, l, 0.12), [o, s];
        }
        textVec(e, t) {
          const n = { ...ge.copy(e).add(t).multiplyScalar(0.5) },
            { x: i, y: o, z: s } = n;
          return { vec3: n, vec2: { x: i, y: s }, h: o };
        }
        updateText(e, t, n, i, o = 0.15) {
          fe.setTextSprite(e, t + "", n, i),
            e.scale.multiplyScalar(o),
            (e.renderOrder = 9999);
        }
        beamAmt(e, t) {
          if (!this.currentB) return;
          const { speed: n } = this.config.beam,
            i = t.getElapsedTime();
          (this.currentB.material.uniforms.uTime.value = i * n),
            this.pathAmt(e),
            this.updateHtToBeam();
        }
        pathAmt(e) {
          const { length: t } = this.config.beam,
            { speed: n } = this.config.path,
            { start: i, trans: o, len: s, viewTo: r } = this.PAmt,
            { camera: a, controls: l } = this.renderer;
          if (!i) return;
          if (o >= s)
            return (
              (this.PAmt.trans = 0),
              (this.PAmt.start = !1),
              void (this.HBAmt.start = !1)
            );
          const { oVec3s: c, vVec3s: h, pVec3s: u } = this.PDatas,
            { x: d, y: p, z: f } = u[o],
            m = h[o],
            { x: g, y: v, z: y } = c[o];
          this._triggerInnerEvent("pathUpdate", {
            pos: { ...m },
            beamW: g,
            beamT: v,
            height: y,
            length: t,
            angle: d,
            rotateX: p,
            rotateY: f,
          }),
            this.setBeamPms(m, { angle: d, length: t, rotate: { x: p, y: f } }),
            this.updateCBeam(),
            (this.PAmt.trans += n),
            r &&
              (a.position.copy(m).add({ x: 0, y: 35, z: 100 }),
              l.target.copy(m));
        }
        creatPath(e) {
          const [t, n, i] = [[], [], []];
          for (let o = 0; o < e.length; o++) {
            const {
                x: s,
                y: r,
                height: a,
                angle: l,
                pitch: c,
                azimuth: h,
              } = e[o],
              u = ge.copy({ x: s, y: r, z: a }).clone(),
              d = ge.copy(this.transCoord(s, r, a / this.TransC.yr)).clone(),
              p = ge.copy({ x: l, y: c, z: h }).clone();
            t.push(u), n.push(d), i.push(p);
          }
          const [o, s, r] = [
              new THRDev3.CatmullRomCurve3(t),
              new THRDev3.CatmullRomCurve3(n),
              new THRDev3.CatmullRomCurve3(i),
            ],
            a = (10 * s.getLength()) | 0;
          (this.PAmt.len = a), (this.PAmt.viewTo = this.config.path.viewTo);
          const [l, c, h] = [
            o.getSpacedPoints(a),
            s.getSpacedPoints(a),
            r.getSpacedPoints(a),
          ];
          (this.PDatas = { _data: e, oVec3s: l, vVec3s: c, pVec3s: h }),
            this.pathLine(c);
          const u = [];
          c.forEach((e) => {
            u.push({ x: e.x, y: 1, z: e.z });
          }),
            this.pathLine(u, 6381661, "path_line2");
        }
        pathLine(e, t = 13110798, n = "path_line") {
          const i = G.geo.buf().setFromPoints(e),
            o = new THRDev3.Line(
              i,
              G.mtl.lineD({ color: t, dashSize: 1, gapSize: 1 })
            );
          o.computeLineDistances(),
            (o.name = n),
            (o.visible = !1),
            this.group.add(o);
        }
        creatWarship(e) {
          const { height: t } = this.config.warship;
          this.WSData = { _data: e };
          for (let n = 0; n < e.length; n++) {
            const { x: i, y: o } = e[n],
              s = this.transCoord(i, o, t);
            this.singleWShip(s, !0);
          }
        }
        singleWShip(e, t) {
          const { icon: n, color: i, scale: o } = this.config.warship,
            s = this.creatIcon(n, i, o);
          s.position.copy(e), (s._isDf = t), this.WShips.add(s);
        }
        transPos(e) {
          const { height: t } = this.config.warship;
          return G.transPosition(e, t, this.renderer);
        }
        addWShip(e, t, n) {
          const i = this.transPos(e);
          if ((this.singleWShip(i), t)) {
            const e = { ...ge.copy(i).add({ x: 0, y: 20, z: 50 }) };
            this.jumpCamera({ camera: e, target: { ...i }, time: 1 });
          }
          n &&
            requestAnimationFrame(() => {
              const { w: e, t: t } = this.reTransCoord(i.x, i.z);
              n({ w: +e.toFixed(5), t: +t.toFixed(5) }, { ...i });
            });
        }
        updateWShip(e, t) {
          const n = this.WShips.children.at(-1);
          if (!n || n._isDf) return;
          const { height: i } = this.config.warship,
            o = this.transCoord(e.x, e.y, i);
          n.position.copy(o), t && t({ ...o });
        }
        creatBeam() {
          this.dfBeamPms();
          const { BGeo: e, HGeo: t } = this.crtbeamGeo();
          this.currentBeam(e),
            this.crtToBeam(t),
            this.crtHtToBeam(),
            this.updateCBeam();
        }
        dfBeamPms() {
          const { beam: e } = this.config,
            { beamW: t, beamT: n, height: i } = e,
            o = this.transCoord(t, n, i / this.TransC.yr);
          this.setBeamPms(o, e);
        }
        setBeamPms(e, t) {
          const { angle: n, length: i, rotate: o } = t;
          (this.CBeam.length = G.clamp(i / this.TransC.yr, 5, 100, 25)),
            (this.CBeam.angle = G.clamp(n, 5, 15, 12)),
            (this.CBeam.rotate.x = G.clamp(o.x, -30, 30, 15)),
            (this.CBeam.rotate.y = G.toNum(o.y % 360, 90)),
            (this.CBeam.pos = { ...e });
        }
        crtbeamGeo() {
          const { seg: e } = this.config.toBeam,
            [t, n] = [G.geo.buf(), G.geo.buf()],
            [i, o, s, r] = [[], [0, 0, 0], [0, 1, 0], [0, 0]];
          for (let t = 0; t <= e; t++) {
            const n = (G.M_PI * t) / e,
              [a, l] = [Math.cos(n), Math.sin(n)];
            if ((o.push(a, -1, l), s.push(a, 0, l), r.push(t / e, 1), t === e))
              break;
            i.push(0, t + 1, t + 2);
          }
          return (
            t.setIndex(i),
            t.setAttribute("uv", new THRDev3.Float32BufferAttribute(r, 2)),
            t.setAttribute("normal", new THRDev3.Float32BufferAttribute(s, 3)),
            t.setAttribute(
              "position",
              new THRDev3.Float32BufferAttribute(o, 3)
            ),
            n.setIndex(i),
            n.setAttribute(
              "position",
              new THRDev3.Float32BufferAttribute(o, 3)
            ),
            (this.tBeamGeo = n),
            { BGeo: t, HGeo: n }
          );
        }
        currentBeam(e) {
          const {
              icon: t,
              iColor: n,
              scale: i,
              txue: o,
              color: s,
            } = this.config.beam,
            r = G.getColorArr(s, !0),
            a = new THRDev3.Mesh(
              e,
              G.mtl.shader({
                uniforms: {
                  uTime: { value: 0 },
                  uRatio: { value: new THRDev3.Vector3(1, -1, 7) },
                  uColor: { value: new THRDev3.Vector4().fromArray(r) },
                  uTxue: { value: this.renderer.getTxue(o) },
                },
                side: 2,
                ...Ce,
                vertexShader: ue.BmVShader,
                fragmentShader: ue.BmFShader,
              })
            );
          (a.name = "current_beam"),
            a.add(this.creatIcon(t, n, i)),
            a.add(
              fe.initSprite({
                postfix: " km",
                fontSize: [42, 32],
                color: ["#000000", "#000000"],
                shadow: !1,
              })
            ),
            a.add(
              fe.initSprite({
                postfix: " km²",
                fontSize: [42, 32],
                color: ["#FFFFFF", "#FDF7F5"],
                shadow: !1,
              })
            );
          const l = G.geo.buf().setFromPoints([
              { x: 0, y: 0, z: 0 },
              { x: 0, y: -1, z: 0 },
            ]),
            c = new THRDev3.Line(
              l,
              G.mtl.lineD({ dashSize: 0.005, gapSize: 0.005 })
            );
          c.computeLineDistances(),
            a.add(c),
            (a.renderOrder = 400),
            (this.currentB = a),
            this.group.add(a);
        }
        creatIcon(e, t, n, i = !1) {
          const o = G.getColorArr(t)[0],
            s = new THRDev3.Sprite(
              G.mtl.sprite({
                map: this.renderer.getTxue(e),
                color: o,
                ...Ce,
                depthTest: i,
              })
            );
          return (
            s.scale.setScalar(0.5 * n), (s.userData._scale = s.scale.clone()), s
          );
        }
        crtToBeam(e) {
          const { cColor: t } = this.config.toBeam,
            n = G.getColorArr(t),
            i = new THRDev3.Mesh(
              e,
              G.mtl.basic({ ...we, color: n[0], opacity: n[1] })
            );
          (i.name = "current_toBeam"),
            (i.frustumCulled = !1),
            (i.renderOrder = 300),
            this.group.add(i);
        }
        crtHtToBeam() {
          const e = this.crtHtBeamGeo(),
            { hColor: t } = this.config.toBeam,
            n = G.getColorArr(t),
            i = new THRDev3.Mesh(
              e,
              G.mtl.basic({
                ...we,
                color: n[0],
                opacity: n[1],
                transparent: !0,
              })
            );
          (i.name = "history_toBeam"),
            (i.frustumCulled = !1),
            (i.renderOrder = 100),
            (this.historyB = i),
            this.group.add(i);
        }
        crtHtBeamGeo() {
          const { seg: e, frame: t, total: n } = this.config.toBeam,
            i = G.geo.buf(),
            o = Math.round(60 / t) * n;
          this.HBAmt.total = o;
          const s = 3 * (e + 2);
          return (
            (this.HtIndex = new THRDev3.BufferAttribute(
              new Uint16Array(o * e * 3),
              1
            )),
            (this.HtAttrPos = new THRDev3.BufferAttribute(
              new Float32Array(o * s),
              3
            )),
            i.setIndex(this.HtIndex),
            i.setAttribute("position", this.HtAttrPos),
            i
          );
        }
        updateHtToBeam() {
          if (!this.HBAmt.start) return;
          const { seg: e, frame: t } = this.config.toBeam,
            { framei: n, current: i, total: o } = this.HBAmt;
          if ((this.HBAmt.framei++, n % t != 0)) return;
          const s = i % o;
          this.syncBuffer(this.HtIndex, this.tBeamGeo.index, s, s * (e + 2)),
            this.syncBuffer(
              this.HtAttrPos,
              this.tBeamGeo.attributes.position,
              s
            ),
            this.HBAmt.current++;
        }
        syncBuffer(e, t, n, i = 0) {
          const { array: o, count: s, itemSize: r } = t,
            a = s * r;
          for (let t = 0; t < a; t++) e.array[n * a + t] = o[t] + i;
          (e.needsUpdate = !0), (e._isUpdate = !0);
        }
        restorePos() {
          const e = this.HtAttrPos;
          if (!e._isUpdate) return;
          const { count: t } = e;
          for (let n = t - 1; n >= 0; n--) e.setXYZ(n, 0, 0, 0);
          e.needsUpdate = !0;
        }
        restoreView() {
          const { position: e } = this.renderer.config.camera,
            { target: t } = this.renderer.config.controls;
          this.jumpCamera({ camera: e, target: t, time: 1 });
        }
        updateCBeam() {
          if (!this.currentB) return;
          const { angle: e, length: t, rotate: n, pos: i } = this.CBeam,
            o = this.currentB,
            [s, r, a] = o.children,
            l = t * Math.tan(this.transRad(e)),
            c = { x: l, y: t, z: l };
          o.scale.copy(c),
            (s.renderOrder = 500),
            s.scale.copy(s.userData._scale).divide(c),
            o.position.copy(i),
            this.roateCBeam(o, n.x, n.y),
            o.updateMatrixWorld();
          const h = o.matrixWorld,
            u = { ...ge.set(0, -1, 0).applyMatrix4(h) },
            d = this.comptVec(i, u),
            p = this.transDist(i, d),
            f = ge.copy(i).distanceTo(d) / t;
          fe.setTextSprite(r, p.dist + "", xe, 0.6 * -f),
            (r.renderOrder = 9999),
            r.scale.divide(c).multiplyScalar(0.15);
          const { indexs: m, points: g } = this.handleTBGeo(h, u),
            { xr: v, zr: y } = this.TransC,
            { areaVal: b } = pe.computeArea(m, g, v * y),
            x = this.transRad(e),
            { height: w } = this.config.beam,
            C = this.compArea(x, Math.tan(x), n.x, w);
          console.log(b, C),
            fe.setTextSprite(a, b + "", xe, 0.97 * -f),
            (a.renderOrder = 9999),
            a.scale.divide(c).multiplyScalar(0.15);
        }
        compArea(e, t, n, i) {
          const o = Math.abs(G.angle2Rad(n)),
            [s, r] = [Math.tan(o + e), Math.tan(o - e)],
            a = i * (s - r) * 0.5,
            [l, c] = [Math.tan(o), G.M_PI2 - o],
            h = a - i * (l - r),
            [u, d] = [h * Math.sin(c), h * Math.cos(c)],
            p = (i / Math.cos(o) + d) * t,
            f = Math.sqrt(p * p + u * u);
          return Math.PI * a * f;
        }
        roateCBeam(e, t, n) {
          const [i, o] = [this.transRad(t), this.transRad(n)],
            s = ve.clone();
          ve.setFromAxisAngle(ye, i),
            s.premultiply(ve),
            ve.setFromAxisAngle(be, o),
            s.premultiply(ve),
            e.quaternion.copy(s);
        }
        handleTBGeo(e, t) {
          const { array: n } = this.currentB.geometry.attributes.position,
            { position: i } = this.tBeamGeo.attributes,
            { array: o, count: s } = i,
            r = [];
          let [a, l] = [{}, t];
          for (let t = 0; t < s; t++) {
            const i = 3 * t,
              [s, c, h] = [n[i], n[i + 1], n[i + 2]],
              u = ge.set(s, c, h).applyMatrix4(e);
            0 === t ? (a = { ...u }) : (l = { ...u });
            const { x: d, y: p, z: f } = this.comptVec(a, l);
            (o[i] = d), (o[i + 1] = p), (o[i + 2] = f), r.push({ x: d, y: f });
          }
          return (
            (i.needsUpdate = !0),
            { indexs: this.tBeamGeo.index.array, points: r }
          );
        }
        comptVec(e, t) {
          const { height: n } = this.config.toBeam,
            i = (n - e.y) / (t.y - e.y);
          return { x: e.x + (t.x - e.x) * i, y: n, z: e.z + (t.z - e.z) * i };
        }
        transRad(e) {
          return (e * G.PI) / 180;
        }
        jumpCamera(e) {
          const { camera: t, controls: n } = this.renderer,
            {
              camera: i,
              target: o,
              time: s = 1.5,
              easing: r = "Quadratic.InOut",
              callback: a,
            } = e;
          this._TWEEN.getAll().forEach((e) => {
            e._isChangeCamera && this._TWEEN.remove(e);
          });
          const l = new this._TWEEN.Tween({ index: 0 });
          l.to({ index: 1 }, 1e3 * s),
            l.easing(G.getEasing(r)),
            l.onUpdate((e) => {
              t.position.lerp(i, e),
                n.target.lerp(o, e),
                this.renderer.setCameraNear();
            }),
            l.onComplete(() => {
              a && a();
            }),
            l.start(),
            (l._isChangeCamera = !0);
        }
        onMouseIn(e, t) {
          const [n] = t;
          if (!n) return [];
          const { point: i } = n;
          if (this.renderer.isCtrl) {
            const { idx: e } = this.ToolVecs;
            e % 2 == 1 && ((this.ToolVecs.v2 = { ...i }), this.updateTools());
          }
          return [i];
        }
        onMouseDown(e, t) {
          const [n] = t;
          if (!n) return [];
          const { point: i } = n;
          if (this.renderer.isCtrl) {
            const { idx: e } = this.ToolVecs,
              t = (e % 2) + 1;
            (this.ToolVecs.v2 = { ...i }),
              (this.ToolVecs["v" + t] = { ...i }),
              this.updateTools(),
              this.ToolVecs.idx++;
          }
          return [i];
        }
        setTools(e) {
          const { key: t, value: n } = e,
            i = this.getNode("bg_plane");
          switch (t) {
            case "start":
              (i._reVisible = !1),
                (this.ToolsG.visible = !0),
                (this.ToolVecs.idx = 0);
              break;
            case "clear":
              (i._reVisible = !0),
                (this.ToolsG.visible = !1),
                this.ToolsG.children.forEach((e) => {
                  e.visible = !1;
                }),
                (this.ToolVecs.idx = 0);
              break;
            case "locate":
              const { v1: e, v2: t, idx: n } = this.ToolVecs;
              if (0 === n) return;
              const o = ge.copy(e).add(t).multiplyScalar(0.5).clone();
              o.y += 20;
              const { x: s, y: r, z: a } = this.currentB.position,
                l = { x: s, y: 0.5 * r, z: a },
                c = o.sub(l).normalize().multiplyScalar(130).add(l);
              this.jumpCamera({ camera: c, target: l, time: 1 });
          }
        }
        setBeam(e) {
          const { key: t, value: n } = e;
          switch (t) {
            case "color":
              const e = G.getColorArr(n, !0);
              this.currentB.material.uniforms.uColor.value.fromArray(e);
              break;
            case "speed":
              this.config.beam.speed = n;
              break;
            case "length":
              const t = n / this.TransC.yr;
              (this.CBeam.length = G.clamp(t, 5, 100, 25)), this.updateCBeam();
              break;
            case "angle":
              (this.CBeam.angle = G.clamp(n, 5, 15, 12)), this.updateCBeam();
              break;
            case "rotateX":
              (this.CBeam.rotate.x = G.clamp(n, -30, 30, 15)),
                this.updateCBeam();
              break;
            case "rotateY":
              (this.CBeam.rotate.y = G.toNum(n % 360, 90)), this.updateCBeam();
              break;
            case "position":
              const i = n.y / this.TransC.yr,
                o = this.transCoord(n.x, n.z, i);
              (this.CBeam.pos = { ...o }), this.updateCBeam();
          }
        }
        setToBeam(e) {
          const { key: t, value: n } = e,
            i = "cColor" === t ? "current_toBeam" : "history_toBeam",
            o = this.getNode(i),
            s = G.getColorArr(n);
          (o.material.color = s[0]), (o.material.opacity = s[1]);
        }
        getNode(e) {
          return this.group.getObjectByName(e);
        }
        setPath(e) {
          const { key: t, value: n } = e,
            i = this.getNode("path_line"),
            o = this.getNode("path_line2");
          switch (t) {
            case "speed":
              this.config.path.speed = n;
              break;
            case "viewTo":
              this.PAmt.viewTo = n;
              break;
            case "start":
              (i.visible = !0),
                (o.visible = !0),
                (this.PAmt.trans = 0),
                (this.PAmt.start = !0),
                (this.HBAmt.start = !0),
                this.restorePos();
              break;
            case "stop":
              (this.PAmt.start = !1), (this.HBAmt.start = !1);
              break;
            case "continue":
              (this.PAmt.start = !0), (this.HBAmt.start = !0);
              break;
            case "clear":
              (i.visible = !1),
                (o.visible = !1),
                (this.PAmt.trans = 0),
                (this.PAmt.start = !1),
                (this.HBAmt.start = !1),
                this.restorePos(),
                this.restoreView(),
                this.dfBeamPms(),
                this.updateCBeam();
          }
        }
        setConfig(e, t) {
          switch (e) {
            case "tools":
              this.setTools(t);
              break;
            case "beam":
              this.setBeam(t);
              break;
            case "toBeam":
              this.setToBeam(t);
              break;
            case "addPel":
              this.addWShip(t.vec2, t.changeView, t.callback);
              break;
            case "updatePel":
              this.updateWShip(t.vec2, t.callback);
              break;
            case "jumpTo":
              this.jumpCamera(t);
              break;
            case "path":
              this.setPath(t);
          }
        }
        getConfig(e, t) {
          let n = null;
          switch (e) {
            case "trans":
              n = this.transCoord(t.lng, t.lat, t.h);
              break;
            case "reTrans":
              n = this.reTransCoord(t.x, t.y);
              break;
            case "transPos":
              n = this.reTransCoord(t.vec2);
          }
          return n;
        }
      },
    };
    var _e = class {
      constructor() {
        this.manager = new THRDev3.LoadingManager();
      }
      setManagerCallback(e) {
        (this.manager.onStart = e.onStart || (() => {})),
          (this.manager.onLoad = e.onLoad || (() => {})),
          (this.manager.onProgress = e.onProgress || (() => {})),
          (this.manager.onError = e.onError || (() => {}));
      }
      getFileName(e) {
        const t = e.lastIndexOf("/"),
          n = e.lastIndexOf("\\"),
          i = Math.max(t, n);
        return i < 0 ? e : e.substring(i + 1);
      }
      setManager({ assets: e = {} }) {
        this.manager.setURLModifier(
          (t) => (e[this.getFileName(t)] || {}).url || t
        );
      }
    };
    (window.fflate = n(21)), n(24), n(25);
    var De = class extends _e {
      constructor(e = {}) {
        super(), (this.config = {}), this.setManagerCallback(e);
      }
      load(e, t) {
        (this.FBXLoader = new THRDev3.FBXLoader(this.manager)),
          this.FBXLoader.manager.addHandler(/\.tga$/i, new THRDev3.TGALoader()),
          this.FBXLoader.load(e, t);
      }
      dispose() {
        this.GLTFLoader.dispose && this.GLTFLoader.dispose();
      }
    };
    n(26), n(27);
    var Me = class extends _e {
      constructor(e = {}) {
        super(),
          (this.config = {}),
          (this.draco = null),
          this.setManagerCallback(e);
      }
      load(e, t) {
        (this.GLTFLoader = new THRDev3.GLTFLoader(this.manager).setCrossOrigin(
          "anonymous"
        )),
          this.draco && this.GLTFLoader.setDRACOLoader(this.draco),
          this.GLTFLoader.load(e, (e) => {
            const n = e.scene;
            (n.animations = e.animations),
              n.traverse((e) => {
                e.userData.modelType = "GLTF";
              }),
              t(n);
          });
      }
      setDraco(e) {
        this.DRACOLoader ||
          ((this.draco = new THRDev3.DRACOLoader()),
          this.draco.setDecoderPath(e));
      }
      dispose() {
        this.GLTFLoader.dispose && this.GLTFLoader.dispose();
      }
    };
    n(28), n(29);
    var Se = class extends _e {
      constructor(e = {}) {
        super(), (this.config = {}), this.setManagerCallback(e);
      }
      load(e, t = null, n) {
        const i = new THRDev3.OBJLoader(this.manager);
        if (t) {
          new THRDev3.MTLLoader(this.manager).load(t, (t) => {
            i.setMaterials(t), i.load(e, n);
          });
        } else i.load(e, n);
      }
    };
    var Pe = new (class {
      constructor() {
        (this.FBXLoader = null),
          (this.GLTFLoader = null),
          (this.DRACOLoader = null),
          (this.OBJMTLFLoader = null),
          (this.manager = null),
          (this.DracoStting = { state: !1, path: "" });
      }
      load(e, t = () => {}, n) {
        let i = null,
          o = e,
          s = {};
        switch (
          (e.constructor === Object
            ? ((i = e.type || i), (o = e.url), e.link && (s = e.link || {}))
            : (i = e.split(".").pop().toUpperCase()),
          (i = i.toUpperCase()),
          i)
        ) {
          case "FBX":
            this.loaderFBX({ url: o, callback: t, managers: n, assets: s });
            break;
          case "GLTF":
          case "GLB":
            this.loaderGLTF({ url: o, callback: t, managers: n, assets: s });
            break;
          case "OBJ":
            this.loaderObjMtl({ url: o, assets: s, callback: t, managers: n });
        }
      }
      loaderFBX({ url: e, callback: t = () => {}, managers: n, assets: i }) {
        const o = new De(n);
        i && o.setManager(i), o.load(e, t);
      }
      loaderGLTF({ url: e, callback: t = () => {}, managers: n, assets: i }) {
        const o = new Me(n);
        i && o.setManager(i),
          this.DracoStting.state && o.setDraco(this.DracoStting.path),
          o.load(e, t);
      }
      loaderObjMtl({ url: e, assets: t = {}, callback: n, managers: i }) {
        const { mtl: o } = t,
          s = new Se(i);
        t && s.setManager(t), s.load(e, o, n);
      }
      setDracoPath(e) {
        (this.DracoStting.state = e.state || !1),
          (this.DracoStting.path = e.path || "");
      }
      getFileName(e) {
        const t = e.lastIndexOf("/"),
          n = e.lastIndexOf("\\"),
          i = Math.max(t, n);
        return i < 0 ? e : e.substring(i + 1);
      }
    })();
    var Re = class extends de {
      constructor(e) {
        super(e),
          (this.ReplaceMtls = {}),
          (this.JInfo = {
            isInit: !1,
            base: null,
            FDoor: { idx: null, type: !1, amt: !1 },
            BDoor: { idx: null, type: !1, amt: !1 },
            covers: {},
            idsTo: {},
            datas: [],
            models: [],
          }),
          (this.SInfo = {
            isInit: !1,
            bases: {},
            layers: {},
            idsTo: {},
            datas: [],
            models: [],
          }),
          (this.CrtData = null),
          (this.Amts = {
            isPlay: !1,
            JAmt: [],
            SAmt: {},
            SNms: [],
            JIdx: 0,
            SIdx: 0,
            SAi: 0,
            type: 0,
            trans: 0,
            time: 1.6,
            camera: null,
            oldCamera: null,
          }),
          (this.animate = (e, t) => {
            this.config.isAnimate && this.playAmts(e, t);
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          speed: 1,
          JOffset: { x: 0, y: 3, z: 2.5 },
          SOffset: { x: 0, y: 0.7, z: 1.4 },
          rittal: {
            url: "",
            shadow: !0,
            replaceMtl: "",
            mtls: [],
            meshs: [],
            FDoor: "1号机柜前门",
            BDoor: "1号机柜后门",
            doorType: [!0, !1],
            covers: { proName: "1号机柜定位盖板_", min: 1, max: 42 },
            layerHt: 0.04507,
            firstPos: { x: -0.275, y: 0.0592, z: -0.53521 },
            basePos: { x: -2.266, y: 0, z: -3.59 },
          },
          device: {
            url: "",
            shadow: !0,
            replaceMtl: "",
            mtls: [],
            meshs: [],
            offset: { x: 0, y: 0, z: 1.07 },
            layers: {
              s01: 1,
              s02: 1,
              s03: 1,
              s04: 3,
              s05: 4,
              s06: 2,
              s07: 1,
              s08: 1,
              s09: 1,
            },
            devices: {
              s01: { name: "设备_01" },
              s02: { name: "设备_02" },
              s03: { name: "设备_03" },
              s04: { name: "设备_04" },
              s05: { name: "设备_05", offset: { x: -0.01, y: 0, z: 0 } },
              s06: { name: "设备_06", scale: { x: 1, y: 1, z: 0.984 } },
              s07: { name: "设备_07" },
              s08: { name: "设备_08" },
              s09: { name: "设备_09" },
            },
          },
        });
      }
      disposeCompEft() {
        (this.JInfo = null),
          (this.SInfo = null),
          (this.CrtData = null),
          (this.Amts = {}),
          (this.ReplaceMtls = {});
      }
      compEftInit() {
        console.log(this),
          this.on("updateDag", () => {
            this.updateDag();
          }),
          this.renderer.on("onRemoveLoading", () => {
            this.Amts.isPlay || this.startAmts();
          }),
          this.loadModel(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      loadModel() {
        const { rittal: e, device: t } = this.config,
          n = (e, t) => {
            e.traverse((e) => {
              e.isLight
                ? (e.visible = !1)
                : (t.shadow && ((e.castShadow = !0), (e.receiveShadow = !0)),
                  this.handleMesh(e, t.meshs),
                  e.material &&
                    G.eachMaterial(e.material, (n, i) => {
                      const o = this.replaceMtl(e, t.replaceMtl, n, i);
                      this.handleMtl(o, t.mtls);
                    }));
            });
          },
          i = () => {
            Pe.load(t.url, (e) => {
              n(e, t),
                this.handleSInfo(e, t),
                this._triggerInnerEvent("updateDag"),
                this.Amts.isPlay || this.startAmts(),
                this.eventArr.length && this.renderer.updateEventArr(this);
            });
          };
        Pe.load(e.url, (t) => {
          n(t.children[0], e), this.handleRInfo(t.children[0], e), i();
        });
      }
      replaceMtl(e, t, n, i) {
        if (!THRDev3[t]) return n;
        const { name: o, uuid: s } = n,
          r = s + "_" + o;
        let a = this.ReplaceMtls[r];
        if (!a) {
          (a = new THRDev3[t]()), (a.name = o), (this.ReplaceMtls[r] = a);
          const [e, i] = [{}, Object.keys(n)];
          Object.keys(a).forEach((t) => {
            i.includes(t) && "type" !== t && (e[t] = n[t]);
          }),
            a.setValues(e);
        }
        return (
          G.isArray(e.material) ? (e.material[i] = a) : (e.material = a), a
        );
      }
      handleMtl(e, t) {
        const n = t.find((t) => t.name === e.name || !0 === t.name);
        n &&
          G.loopObject(n, (t) => {
            if ("name" === t) return;
            const i = n[t];
            e[t].isColor
              ? e[t].set(i)
              : e[t].isVector3 || e[t].isVector2
              ? e[t].copy(i)
              : (e[t] = i);
          });
      }
      handleMesh(e, t) {
        const n = t.find((t) => t.name === e.name || !0 === t.name);
        n &&
          G.loopObject(n, (t) => {
            if ("name" === t) return;
            const i = n[t];
            e[t].isEuler
              ? e[t].setFromVector3(i)
              : nodemtl[t].isVector3 || e[t].isVector2
              ? e[t].copy(i)
              : (e[t] = i);
          });
      }
      findIdx(e, t) {
        return e.children.findIndex((e) => e.name === t);
      }
      handleRInfo(e, t) {
        const { FDoor: n, BDoor: i, doorType: o, covers: s, data: r = [] } = t;
        (this.JInfo.isInit = !0), (this.JInfo.base = e);
        const [a, l] = o;
        (this.JInfo.FDoor = { idx: this.findIdx(e, n), type: !1, amt: a }),
          (this.JInfo.BDoor = { idx: this.findIdx(e, i), type: !1, amt: l });
        const { proName: c, min: h, max: u } = s;
        for (let t = h; t <= u; t++) {
          const n = (t < 10 ? "0" : "") + t,
            i = this.findIdx(e, c + n);
          -1 !== i && (this.JInfo.covers["c_" + n] = i);
        }
        this.handleRData(r), this.handleRModel(r);
      }
      handleSInfo(e, t) {
        const { layers: n, devices: i, data: o = [] } = t;
        (this.SInfo.isInit = !0),
          G.loopObject(i, (t) => {
            const {
                name: n,
                scale: o = { x: 1, y: 1, z: 1 },
                offset: s = { x: 0, y: 0, z: 0 },
              } = i[t],
              r = e.getObjectByName(n);
            r &&
              r.isMesh &&
              (r.scale.multiply(o),
              (r.userData.type = t),
              (r.userData.offset = { ...s }),
              (this.SInfo.bases[t] = r));
          }),
          (this.SInfo.layers = { ...n });
        const s = this.handleDData(o);
        this.handleDModel(s);
      }
      updateData(e, t) {
        t && this.clearAll(), this.clearAmts();
        const { RData: n, DData: i } = e;
        (this.CrtData = { RData: n, DData: i }),
          this._triggerInnerEvent("updateDag");
      }
      clearAll() {
        (this.JInfo.idsTo = {}),
          (this.JInfo.datas = []),
          this.JInfo.models.forEach((e) => {
            e.removeFromParent(), (e = null);
          }),
          (this.JInfo.models = []),
          (this.SInfo.idsTo = {}),
          (this.SInfo.datas = []),
          this.SInfo.models.forEach((e) => {
            e.removeFromParent(), (e = null);
          }),
          (this.SInfo.models = []);
        const e = this.eventArr.length;
        (this.eventArr = []), e && this.renderer.updateEventArr(this);
      }
      updateDag() {
        if (
          (console.log("--机柜--", this.JInfo),
          console.log("--设备--", this.SInfo),
          console.log("--数据--", this.CrtData),
          !(this.JInfo.isInit && this.SInfo.isInit && this.CrtData))
        )
          return;
        const { RData: e = [], DData: t = [] } = this.CrtData;
        this.handleRData(e);
        const n = this.handleDData(t);
        this.handleRModel(e),
          this.handleDModel(n),
          this.startAmts(),
          this.eventArr.length && this.renderer.updateEventArr(this);
      }
      handleRData(e = []) {
        if (!e.length) return;
        const { base: t, covers: n } = this.JInfo;
        e.forEach((e) => {
          const { id: i } = e,
            o = this.JInfo.idsTo[i];
          if (void 0 !== o) this.JInfo.datas[o]._data = { ...e };
          else {
            const o = {};
            G.loopObject(n, (e) => {
              o[e] = !1;
            }),
              (this.JInfo.idsTo[i] = this.JInfo.datas.length),
              this.JInfo.datas.push({ id: i, holds: o, _data: { ...e } }),
              this.JInfo.models.push(t.clone());
          }
        });
      }
      handleDData(e = []) {
        const t = [];
        if (!e.length) return t;
        const { bases: n } = this.SInfo;
        return (
          e.forEach((e) => {
            const { id: i, RId: o, type: s } = e,
              { isBlank: r, layerNums: a, layerKeys: l } = this.testHolds(e);
            if (!n[s] || !r) return;
            const c = this.SInfo.idsTo[i];
            if (void 0 !== c) {
              (this.SInfo.datas[c]._data = { ...e }),
                (this.SInfo.datas[c].layerNums = [...a]),
                (this.SInfo.datas[c].layerKeys = [...l]);
              let t = this.SInfo.models[c];
              t.userData.type !== s &&
                ((this.SInfo.models[c] = n[s].clone()),
                t.removeFromParent(),
                (t = null));
            } else
              (this.SInfo.idsTo[i] = this.SInfo.datas.length),
                this.SInfo.datas.push({
                  id: i,
                  RId: o,
                  layerNums: a,
                  layerKeys: l,
                  _data: { ...e },
                }),
                this.SInfo.models.push(n[s].clone());
            t.push({ ...e });
          }),
          t
        );
      }
      testHolds(e) {
        const { RId: t, locate: n, layer: i, type: o } = e,
          { idsTo: s, datas: r } = this.JInfo,
          a = s[t];
        if (void 0 === a) return { isBlank: !1 };
        const { holds: l } = r[a],
          { layers: c } = this.SInfo,
          h = Math.max(c[o], i);
        let u = !0;
        const [d, p] = [[], []];
        for (let e = n; e > n - h; e--) {
          const t = "c_" + (e < 10 ? "0" : "") + e;
          (void 0 === l[t] || l[t]) && (u = !1), d.push(e), p.push(t);
        }
        return (
          u &&
            p.forEach((e) => {
              l[e] = !0;
            }),
          { isBlank: u, layerNums: d, layerKeys: p }
        );
      }
      handleRModel(e) {
        if (!e.length) return;
        const { basePos: t } = this.config.rittal,
          { covers: n, FDoor: i, idsTo: o, models: s } = this.JInfo,
          r = Object.keys(n);
        e.forEach((e) => {
          const { id: a, pos: l, scale: c = 1 } = e,
            h = o[a],
            u = s[h];
          (u.name += "-J-" + a),
            u.scale.multiplyScalar(c),
            u.position.copy(t).add(l),
            u.children.forEach((e) => {
              e.userData.id = a;
            });
          const d = u.children[i.idx],
            p = {};
          r.forEach((e) => {
            p[e] = u.children[n[e]];
          }),
            (u.visible = !1),
            (u.userData.id = a),
            (u.userData.door = d),
            (u.userData.mHolds = p),
            (u.userData.scale = u.scale.clone()),
            (u.userData.position = u.position.clone()),
            this.group.add(u),
            this.eventArr.push(d),
            this.Amts.JAmt.push({ id: a, group: u, door: d });
        });
      }
      handleDModel(e) {
        if (!e.length) return;
        const { idsTo: t, models: n } = this.SInfo;
        e.forEach((e) => {
          const { id: i, RId: o, locate: s, scale: r = 1 } = e,
            a = t[i],
            l = n[a];
          (l.name += "-S-" + i), l.scale.multiplyScalar(r);
          const c = this.compSPos(o, s);
          l.position.copy(c).add(l.userData.offset),
            (l.visible = !1),
            (l.userData.id = i),
            (l.userData.RId = o),
            (l.userData.locate = s),
            (l.userData.position = l.position.clone()),
            this.group.add(l),
            (l._reVisible = !0),
            this.eventArr.push(l);
          const { door: h, covers: u, position: d } = this.relatCov(o, a);
          this.Amts.SAmt[o] || (this.Amts.SAmt[o] = []),
            this.Amts.SAmt[o].push({
              id: i,
              RId: o,
              node: l,
              door: h,
              covers: u,
              position: d,
            });
        }),
          (this.Amts.SNms = Object.keys(this.Amts.SAmt));
      }
      compSPos(e, t) {
        const { offset: n } = this.config.device,
          { layerHt: i, firstPos: o, basePos: s } = this.config.rittal,
          { idsTo: r, datas: a } = this.JInfo,
          { pos: l } = a[r[e]]._data;
        return {
          x: s.x + l.x + o.x + n.x,
          y: s.y + l.y + o.y + n.y + (t - 1) * i,
          z: s.z + l.z + o.z + n.z,
        };
      }
      relatCov(e, t) {
        const { idsTo: n, models: i } = this.JInfo,
          { layerKeys: o } = this.SInfo.datas[t],
          { door: s, mHolds: r, position: a } = i[n[e]].userData,
          l = [];
        return (
          o.forEach((e) => {
            l.push(r[e]);
          }),
          { door: s, covers: l, position: a }
        );
      }
      startAmts() {
        console.log(this.Amts),
          this.Amts.JAmt.length &&
            ((this.Amts.isPlay = !0),
            (this.Amts.JIdx = 0),
            (this.Amts.SIdx = 0),
            (this.Amts.SAi = 0),
            (this.Amts.type = 0),
            (this.Amts.trans = 0),
            (this.Amts.time = 1.6));
      }
      clearAmts() {
        console.log("--动画--", this.Amts);
        const { isPlay: e, JAmt: t, SAmt: n } = this.Amts;
        this.Amts = {
          isPlay: !1,
          JAmt: [],
          SAmt: {},
          SNms: [],
          JIdx: 0,
          SIdx: 0,
          SAi: 0,
          type: 0,
          trans: 0,
          time: 1.6,
        };
      }
      playAmts(e) {
        const {
          isPlay: t,
          JAmt: n,
          SAmt: i,
          SNms: o,
          JIdx: s,
          SIdx: r,
          SAi: a,
          type: l,
          trans: c,
          time: h,
        } = this.Amts;
        if (t)
          switch (l) {
            case 0:
              this.amtType0(e, n[s], s === n.length - 1);
              break;
            case 1:
            case 2:
            case 3:
              const t = o[r];
              t ? this["amtType" + l](e, t) : (this.Amts.type = 5);
              break;
            case 4:
              this.amtCallback(0.8 * e, null, (e, t) => {
                this.updateCamera(t, "oldCamera");
              });
              break;
            case 5:
              this.Amts.isPlay = !1;
          }
      }
      amtType0(e, t, n) {
        this.amtCallback(
          0.9 * e,
          () => {
            this.setOldCamera(),
              this.setAmtCamera(t.group, "JOffset", { x: 0, y: 1, z: 0 }),
              (t.group.visible = !0),
              t.group.scale.setZ(0.001);
          },
          (e, n) => {
            this.updateCamera(n),
              t.group.scale.setZ(t.group.userData.scale.z * n);
          },
          () => {
            this.Amts.JIdx++, n || (this.Amts.type = 0);
          }
        );
      }
      amtType1(e, t) {
        const n = this.Amts.SAmt[t][0];
        this.amtCallback(
          e,
          () => {
            this.setAmtCamera(n, "JOffset", { x: 0, y: 1, z: 0 }),
              (n.door.rotation.z = 0);
          },
          (e, t) => {
            this.updateCamera(t), (n.door.rotation.z = 3 * t);
          }
        );
      }
      amtType2(e, t) {
        const n = this.Amts.SAmt[t],
          { covers: i, node: o } = n[this.Amts.SAi];
        this.amtCallback(
          0.8 * e,
          () => {
            this.setAmtCamera(o, "SOffset", { x: 0.275, y: 0, z: 0 }),
              i.forEach((e) => {
                e.visible = !1;
              }),
              (o.position.z += 0.4);
          },
          (e, t) => {
            const n = 1.5 * t;
            n <= 1 && this.updateCamera(n);
            const i = 1.5 * (1 - t);
            i > 1 ||
              (i > 0.9 && (o.visible = !0),
              (o.position.z = o.userData.position.z + 0.4 * i));
          },
          () => {
            n.length - 1 !== this.Amts.SAi && (this.Amts.type = 2),
              this.Amts.SAi++;
          }
        );
      }
      amtType3(e, t) {
        const n = this.Amts.SAmt[t][0];
        this.amtCallback(
          e,
          () => {
            this.setAmtCamera(n, "JOffset", { x: 0, y: 1, z: 0 }),
              (n.door.rotation.z = 3);
          },
          (e, t) => {
            this.updateCamera(t), (n.door.rotation.z = 3 * (1 - t));
          },
          () => {
            this.Amts.SNms.length - 1 !== this.Amts.SIdx &&
              (this.Amts.type = 1),
              this.Amts.SIdx++,
              (this.Amts.SAi = 0);
          }
        );
      }
      amtCallback(e, t, n, i) {
        const { type: o, trans: s, time: r } = this.Amts;
        if ((0 === s && t && t(o), n)) {
          const e = s / r;
          n(e, G.easing(e, "Quadratic.Out"), o);
        }
        (this.Amts.trans += e * this.config.speed),
          s >= r &&
            ((this.Amts.type += 1), (this.Amts.trans = 0), i && i(s, o));
      }
      setOldCamera() {
        if (this.Amts.oldCamera) return;
        const { camera: e, controls: t } = this.renderer;
        this.Amts.oldCamera = { pos: { ...e.position }, tgt: { ...t.target } };
      }
      setAmtCamera(e, t = "JOffset", n = { x: 0, y: 0, z: 0 }) {
        const { position: i } = e,
          o = this.config[t];
        let s = "SOffset" === t ? n.x : 0;
        const r = i.clone().add({ x: o.x + s, y: o.y, z: o.z });
        this.Amts.camera = { pos: { ...r }, tgt: { ...i.clone().add(n) } };
      }
      updateCamera(e, t = "camera") {
        const { pos: n, tgt: i } = this.Amts[t];
        this.renderer.camera.position.lerp(n, e),
          this.renderer.controls.target.lerp(i, e),
          this.renderer._triggerInnerEvent("updatePointSize"),
          this.renderer.setCameraNear();
      }
      onMouseOut(e) {
        return [e, null];
      }
      onMouseIn(e, t) {
        const [n] = t;
        if (!n) return [e, null];
        const { object: i } = n;
        return [e];
      }
      onMouseDown(e, t) {
        const [n] = t;
        return n ? [e] : [e, null];
      }
      setConfig(e, t) {}
      getConfig(e, t) {}
    };
    const Ae = {
        random: () =>
          "\n            float random(float x) {\n                return fract(sin(x * 1.57) * 100000.0);\n            }\n        ",
        rand2: () =>
          "\n            vec2 rand2(vec2 st) {\n                st = vec2(dot(st, vec2(127.1, 311.7)), dot(st, vec2(269.5, 183.3)));\n                return -1.0 + 2.0 * fract(sin(st) * 43758.5453123);\n            }\n        ",
        rand0: () =>
          "\n            float rand(float x) {\n                return fract(sin(x) * 75154.32912);\n            }\n        ",
        noise0: () =>
          "\n            float noise(float x) {\n                float i = floor(x);\n                return mix(rand(i), rand(i + 1.), x - i);\n            }\n        ",
        rand: () =>
          "\n            float rand(vec2 c){\n                return fract(sin(dot(c.xy, vec2(12.9898, 78.233))) * 43758.5453);\n            }\n        ",
        noise: () =>
          "\n            float noise(vec2 p) { // Value noise\n                vec2 f = smoothstep(0.0, 1.0, fract(p));\n                vec2 i = floor(p);\n                float a = rand(i);\n                float b = rand(i + vec2(1.0, 0.0));\n                float c = rand(i + vec2(0.0, 1.0));\n                float d = rand(i + vec2(1.0, 1.0));\n                return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n            }\n        ",
        noiseFbm: (e = 3) =>
          `\n            #define MAX_ITER ${e}\n\n            float fbm(vec2 p) { // Fractal noise\n                float r = 0.0, amp = 1.0, freq = 1.0;\n                for(int i = 0; i < MAX_ITER; i++) {\n                    r += amp * noise(freq * p);\n                    amp *= 0.5;\n                    freq *= 2.0;\n                }\n                return r;\n            }\n        `,
      },
      Ee = {
        rgb2hsl: () =>
          "\n            vec3 rgb2hsl(vec3 rgb) {\n                vec3 hsl = vec3(0.0);\n\n                float r = rgb.x, g = rgb.y, b = rgb.z;\n                float cma = max(max(r, g), b);\n                float cmi = min(min(r, g), b);\n                float dlt = cma - cmi;\n\n                float k = g < b ? 6.0 : 0.0;\n                float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n                float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n                float cL = (cma + cmi) * .5;\n                hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n                hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n                hsl.z = cL;\n\n                return hsl;\n            }\n        ",
        hsl2rgb: () =>
          "\n            float hue2rgb(float f1, float f2, float hue) {\n                if (hue < 0.0) hue += 1.0;\n                else if (hue > 1.0) hue -= 1.0;\n\n                float res = f1;\n                if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n                else if ((2.0 * hue) < 1.0) res = f2;\n                else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n                return res;\n            }\n\n            vec3 hsl2rgb(vec3 hsl) {\n                vec3 rgb;\n\n                float h = hsl.x, s = hsl.y, l = hsl.z;\n                if (s == 0.0) {\n                    rgb = vec3(l); // Luminance\n                } else {\n                    float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n                    float f1 = 2.0 * l - f2;\n\n                    rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n                    rgb.g = hue2rgb(f1, f2, h);\n                    rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n                }\n                return rgb;\n            }\n        ",
        colorMix: () =>
          "\n            vec4 colorMix(vec4 up, vec4 un) {\n                float o = up.w + (1. - up.w) * un.w;\n                return vec4(clamp((up.xyz * up.w + un.xyz * un.w * (1. - up.w)) / o, 0., 1.), o);\n            }\n        ",
        hslMix: () =>
          "\n            vec4 hslMix(vec4 up, vec4 un) {\n                vec3 pHSL = rgb2hsl(up.rgb);\n                vec3 nHSL = rgb2hsl(un.rgb);\n\n                float transY = pHSL.x > 0. ? nHSL.y : pHSL.y;\n                vec3 mixRGB = hsl2rgb(vec3(pHSL.x, transY, nHSL.z));\n\n                // mix opacity\n                float o = up.w + (1. - up.w) * un.w;\n                return vec4(mixRGB * up.w + un.rgb * (1. - up.w), o);\n            }\n        ",
      },
      ke = {
        circle: () =>
          "\n            float circle(vec2 pos, float radius, float glow) {\n                float sdf = length(pos);\n                sdf = smoothstep(radius - 0.7, radius, sdf);\n\n                float circles = 1.0 - smoothstep(0.0, 1.0, sdf * 10.28);\n                float glows = exp(-sdf * 4.496)  * (1.0 - circles);\n                return circles + glows;\n            }\n        ",
      },
      Ie = {
        rotate: () =>
          "\n            vec2 rotate(vec2 tRot, float rad) {\n                float cr = cos(rad), sr = sin(rad);\n                return vec2(tRot.x * cr - tRot.y * sr, tRot.y * cr + tRot.x * sr);\n            }\n        ",
      },
      He = {
        vtxTitle: () => "\n            varying vec2 vUv;\n        ",
        vtxMain: () =>
          "\n            vUv = uv;\n            gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n        ",
      };
    var Le = {
      MVShader: `\n        attribute float cMapIdx;\n        ${He.vtxTitle()}\n\n        varying float vMIdx;\n        void main() {\n            vMIdx = cMapIdx;\n            ${He.vtxMain()}\n        }\n    `,
      MFShader1: `\n        uniform float uMixK;\n        uniform vec4 uColor;\n        uniform sampler2D uTxue00;\n\n        varying vec2 vUv;\n        ${Ee.colorMix()}\n\n        void main() {\n            vec4 map = texture2D(uTxue00, vec2(vUv.x, 1. - vUv.y));\n            gl_FragColor = colorMix(vec4(uColor.xyz, uMixK), map);\n            gl_FragColor.w *= uColor.w;\n        }\n    `,
      MFShader2: `\n        uniform float uMixK;\n        uniform vec4 uColor;\n        uniform sampler2D uTxue00;\n        uniform sampler2D uTxue01;\n        uniform sampler2D uTxue10;\n        uniform sampler2D uTxue11;\n\n        varying vec2 vUv;\n        varying float vMIdx;\n        ${Ee.colorMix()}\n\n        void main() {\n            vec4 map;\n            vec2 nUv = vec2(vUv.x, 1. - vUv.y);\n\n            if (vMIdx > -.5 && vMIdx < 0.5) { map = texture2D(uTxue00, nUv); }\n            if (vMIdx > 0.5 && vMIdx < 1.5) { map = texture2D(uTxue01, nUv); }\n            if (vMIdx > 1.5 && vMIdx < 2.5) { map = texture2D(uTxue10, nUv); }\n            if (vMIdx > 2.5 && vMIdx < 3.5) { map = texture2D(uTxue11, nUv); }\n\n            gl_FragColor = colorMix(vec4(uColor.xyz, uMixK), map);\n            gl_FragColor.w *= uColor.w;\n        }\n    `,
      MFShader3: `\n        uniform float uMixK;\n        uniform vec4 uColor;\n        uniform sampler2D uTxue00;\n        uniform sampler2D uTxue01;\n        uniform sampler2D uTxue02;\n        uniform sampler2D uTxue10;\n        uniform sampler2D uTxue11;\n        uniform sampler2D uTxue12;\n        uniform sampler2D uTxue20;\n        uniform sampler2D uTxue21;\n        uniform sampler2D uTxue22;\n\n        varying vec2 vUv;\n        varying float vMIdx;\n        ${Ee.colorMix()}\n\n        void main() {\n            vec4 map;\n            vec2 nUv = vec2(vUv.x, 1. - vUv.y);\n\n            if (vMIdx > -.5 && vMIdx < 0.5) { map = texture2D(uTxue00, nUv); }\n            if (vMIdx > 0.5 && vMIdx < 1.5) { map = texture2D(uTxue01, nUv); }\n            if (vMIdx > 1.5 && vMIdx < 2.5) { map = texture2D(uTxue02, nUv); }\n            if (vMIdx > 2.5 && vMIdx < 3.5) { map = texture2D(uTxue10, nUv); }\n            if (vMIdx > 3.5 && vMIdx < 4.5) { map = texture2D(uTxue11, nUv); }\n            if (vMIdx > 4.5 && vMIdx < 5.5) { map = texture2D(uTxue12, nUv); }\n            if (vMIdx > 5.5 && vMIdx < 6.5) { map = texture2D(uTxue20, nUv); }\n            if (vMIdx > 6.5 && vMIdx < 7.5) { map = texture2D(uTxue21, nUv); }\n            if (vMIdx > 7.5 && vMIdx < 8.5) { map = texture2D(uTxue22, nUv); }\n\n            gl_FragColor = colorMix(vec4(uColor.xyz, uMixK), map);\n            gl_FragColor.w *= uColor.w;\n        }\n    `,
    };
    const [Oe] = [new THRDev3.Vector3()];
    var Ve = class extends de {
      constructor(e) {
        super(e),
          z()(this, "_setting", {
            callback: {
              setParams() {},
              setTitles() {
                this.renderer.clearECache(!0),
                  this.compTitles(),
                  this.loadMaps(),
                  this.renderer.updateEventArr(this);
              },
              setBasY(e) {
                (this.basY = e),
                  (this.TitleC.basY = e),
                  this.MNodes &&
                    this.MNodes.forEach((t) => {
                      t.position.y = e;
                    });
              },
              setColor(e) {
                if (!this.MNodes) return;
                const t = G.getColorArr(e, !0);
                this.MNodes.forEach((e) => {
                  e.material.uniforms.uColor.value.fromArray(t);
                });
              },
              setMixK(e) {
                this.MNodes &&
                  this.MNodes.forEach((t) => {
                    t.material.uniforms.uMixK.value = e;
                  });
              },
              setUnitS(e) {
                this.unitS = e;
              },
            },
            checkList: {
              dataAxes: "setParams",
              titleAxes: "setParams",
              center: "setTitles",
              level: "setTitles",
              path: "setParams",
              postfix: "setParams",
              wh: "setTitles",
              seg: "setTitles",
              count: "setTitles",
              color: "setColor",
              mixK: "setMixK",
              unitS: "setUnitS",
            },
          }),
          (this.renderer._mapIns = () => this),
          (this.TitleC = null),
          (this.MNodes = null),
          (this.basY = 0),
          (this.unitS = 1),
          (this.animate = (e, t) => {
            this.config.isAnimate;
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          isProxy: !0,
          basY: -1,
          dataAxes: "gcj02",
          titleAxes: "gcj02",
          center: { x: 0, y: 0 },
          level: 10,
          path: "",
          postfix: "png",
          wh: 120,
          seg: 2,
          count: 6,
          color: "rgba(0, 70, 200, 1)",
          mixK: 0.1,
          unitS: 1e3,
        });
      }
      disposeCompEft() {
        (this.TitleC = null),
          (this.MNodes = null),
          this.renderer && (this.renderer._mapIns = null);
      }
      compEftInit() {
        this.compTitles(),
          this.loadMaps(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      compTitles() {
        const {
          basY: e,
          center: t,
          level: n,
          wh: i,
          seg: o,
          unitS: s,
        } = this.config;
        (this.basY = e), (this.unitS = s);
        const r = 0 | G.clamp(o, 1, 3, 1);
        (this.config._S = r), (this.config._sWh = i / r);
        const { lon: a, lat: l } = this.coordAxes(t.x, t.y),
          { tX: c, tY: h } = G.lonlat2Title(a, l, n),
          u = (0.5 * (r - 1)) | 0,
          d = 0.5 * ((r % 2) - 1),
          p = G.spaceRatio(i / r, n);
        (this.TitleC = {
          center: t,
          level: n,
          tX: c,
          tY: h,
          mX: ((c + d) | 0) - u,
          mY: ((h + d) | 0) - u,
          SMete: p,
          basY: e,
        }),
          this.renderer._triggerInnerEvent("updTitle", this.TitleC);
      }
      loadMaps() {
        const { wh: e, count: t, _S: n } = this.config;
        (this.eventArr = []), G.disposeArrAll(this.MNodes), (this.MNodes = []);
        const i = 0 | G.clamp(t, 1, 9, 1),
          o = 2 * i + 1;
        this.config._C = o;
        const { mX: s, mY: r } = this.TitleC,
          a = this.creatMapGeo();
        for (let t = 0; t < o; t++) {
          const l = t - i,
            [c, h] = [e * l, s + n * l];
          for (let t = 0; t < o; t++) {
            const o = t - i,
              [s, l] = [e * o, r + n * o],
              u = new THRDev3.Mesh(a, this.creatMapMtl(h, l));
            (u.name = h + "_" + l),
              u.position.set(c, this.basY, s),
              (u.userData.mxi = h),
              (u.userData.myj = l),
              (u.userData.S = n),
              this.eventArr.push(u),
              this.MNodes.push(u),
              this.group.add(u);
          }
        }
      }
      creatMapMtl(e, t) {
        const {
            level: n,
            path: i,
            postfix: o,
            color: s,
            mixK: r,
            _S: a,
          } = this.config,
          l = G.getColorArr(s, !0),
          c = {
            uColor: { value: new THRDev3.Vector4().fromArray(l) },
            uMixK: { value: r },
          };
        for (let s = 0; s < a; s++)
          for (let r = 0; r < a; r++) {
            const [a, l] = [e + s, t + r],
              h = i + `${n}/${a}/${l}.${o}`,
              u = this.renderer.setTxue({ id: `mp_${a}_${l}`, url: h });
            c["uTxue" + s + r] = { value: u };
          }
        return G.mtl.shader({
          uniforms: c,
          transparent: !0,
          vertexShader: Le.MVShader,
          fragmentShader: Le["MFShader" + a],
        });
      }
      creatMapGeo() {
        const { wh: e, _S: t, _sWh: n } = this.config,
          i = G.geo.buf(),
          o = 0.5 * e;
        let s = 0;
        const [r, a, l, c] = [[], [], [], []];
        for (let e = 0; e < t; e++) {
          const i = e * n - o;
          for (let e = 0; e < t; e++) {
            const t = e * n - o;
            a.push(0, 0, 1, 0, 0, 1, 1, 1),
              l.push(s, s, s, s),
              c.push(i, 0, t, i + n, 0, t),
              c.push(i, 0, t + n, i + n, 0, t + n);
            const h = 4 * s;
            r.push(h, h + 2, h + 1, h + 2, h + 3, h + 1), s++;
          }
        }
        return (
          i.setIndex(r),
          i.setAttribute("uv", new THRDev3.Float32BufferAttribute(a, 2)),
          i.setAttribute("cMapIdx", new THRDev3.Float32BufferAttribute(l, 1)),
          i.setAttribute("position", new THRDev3.Float32BufferAttribute(c, 3)),
          i
        );
      }
      titles(e, t, n = this.TitleC.level) {
        return G.lonlat2Title(e, t, n);
      }
      reTitles(e, t, n = this.TitleC.level) {
        return G.title2lonlat(e, t, n);
      }
      coordAxes(e, t) {
        const { dataAxes: n, titleAxes: i } = this.config;
        if (n === i) return { lon: e, lat: t };
        const o = n + "to" + i,
          [s, r] = G.CdTransform[o](e, t);
        return { lon: s, lat: r };
      }
      vec2Coord(e) {
        const { _sWh: t, _S: n } = this.config,
          { mX: i, mY: o, level: s } = this.TitleC,
          { x: r, y: a, z: l } = e,
          c = 0.5 * n,
          h = i + c + r / t,
          u = o + c + l / t,
          { lon: d, lat: p } = G.title2lonlat(h, u, s);
        return { lon: d, lat: p, hY: this.transHY(a, !1) };
      }
      coord2Vec(e, t, n = 0) {
        const { _sWh: i, _S: o } = this.config,
          { mX: s, mY: r, level: a } = this.TitleC,
          l = 0.5 * o,
          { lon: c, lat: h } = this.coordAxes(e, t),
          { tX: u, tY: d } = G.lonlat2Title(c, h, a);
        return { x: (u - s - l) * i, y: this.transHY(n), z: (d - r - l) * i };
      }
      transHY(e, t = !0) {
        const { SMete: n } = this.TitleC;
        return t
          ? this.basY + (e * this.unitS) / n
          : ((e - this.basY) * n) / this.unitS;
      }
      lonlatDist(e, t) {
        return G.havDistance(e.lon, e.lat, t.lon, t.lat) / this.unitS;
      }
      vecDist(e, t) {
        const { D: n, hY: i } = this.getDAndHY(e, t);
        return Math.sqrt(i * i + n * n);
      }
      vecDist2(e, t) {
        return (Oe.copy(e).distanceTo(t) * this.TitleC.SMete) / this.unitS;
      }
      vecAngle(e, t) {
        const { D: n, hY: i } = this.getDAndHY(e, t);
        return G.rad2Angle(Math.atan(n / i));
      }
      getDAndHY(e, t) {
        const n = this.vec2Coord(e),
          i = this.vec2Coord(t),
          o = n.hY - i.hY;
        return { D: this.lonlatDist(n, i), hY: o };
      }
      onKeyup(e) {
        "Control" === e.key &&
          this.renderer._triggerInnerEvent("onMapEvent", { type: "onKeyup" });
      }
      onMouseIn(e, t) {
        const [n] = t;
        if (!n) return [];
        const { point: i, coord: o } = this.getCoord(n, "onMouseIn");
        return [e, i, o];
      }
      onMouseDown(e, t) {
        const [n] = t;
        if (!n) return [];
        const { point: i, coord: o } = this.getCoord(n, "onMouseDown");
        return [e, i, o];
      }
      getCoord(e, t) {
        const { point: n } = e;
        if (!this.renderer.isCtrl) return { point: n };
        const i = this.vec2Coord(n);
        return (
          this.renderer._triggerInnerEvent("onMapEvent", {
            type: t,
            point: n,
            coord: i,
          }),
          { point: n, coord: i }
        );
      }
      testing() {
        const e = new THRDev3.Mesh(
          this.creatMapGeo(),
          G.mtl.basic({ color: 14531154, transparent: !0, wireframe: !0 })
        );
        (e.position.y = this.basY), this.group.add(e);
        const t = G.geo.box(1, 0.5, 0.5),
          n = new THRDev3.Mesh(
            t,
            G.mtl.phong({ color: 14531154, transparent: !0, opacity: 1 })
          );
        (n.position.y = this.basY), this.group.add(n);
      }
      setConfig(e, t) {
        switch (e) {
          case "test":
            this.testing();
            break;
          case "option":
            this.setOption(t);
        }
      }
      getConfig(e, t) {
        let n = null;
        switch (e) {
          case "title":
            n = this.titles(t.lon, t.lat, t.level);
            break;
          case "reTitle":
            n = this.reTitles(t.tX, t.tY, t.level);
            break;
          case "coordAxes":
            n = this.coordAxes(t.lon, t.lat);
            break;
          case "vec2Coord":
            n = this.vec2Coord(t.vec);
            break;
          case "coord2Vec":
            n = this.coord2Vec(t.lon, t.lat, t.hY);
            break;
          case "transPos":
            n = G.transPosition(t.vec2, this.basY, this.renderer);
            break;
          case "pos2Coord":
            const e = G.transPosition(t.vec2, this.basY, this.renderer);
            n = this.vec2Coord(e);
            break;
          case "dist":
            n = this.lonlatDist(t.lonlat1, t.lonlat2);
            break;
          case "unitS":
            n = this.unitS;
        }
        return n;
      }
    };
    class Fe {
      constructor(e) {
        this.setDftConfig(e);
      }
      setDftConfig(e = {}) {
        this.config = G.copy(
          {
            padding: [32, 18],
            fontWeight: ["bold"],
            fontSize: [48, 36],
            sizeAttenuation: !1,
            scaleText: 0.25,
            background: !0,
            bgWidth: 1,
            bgColor: ["#373737", "rgba(255, 255, 255, 0.7)"],
            bgRadius: 8,
          },
          e
        );
      }
      create(e, t, n, i = { x: 0.5, y: 0 }) {
        const o = this.config,
          s = fe.initSprite({
            postfix: e,
            color: t,
            lenLimit: 999,
            shadow: !1,
            ...o,
            center: i,
          });
        return (s.name = "Text-" + n), (s.renderOrder = 999), s;
      }
      update(e, t, n, i) {
        fe.setTextSprite(e, t + "", n, i),
          (e.renderOrder = 999),
          (e.visible = !0);
      }
      toFix(e, t) {
        return +e.toFixed(t);
      }
    }
    const [ze, je, Be] = [
      new THRDev3.Euler(),
      new THRDev3.Vector3(),
      new THRDev3.Quaternion(),
    ];
    var Ue = class extends de {
        constructor(e) {
          super(e),
            (this.mapIns = null),
            (this.CText = null),
            (this.isStart = !1),
            (this.Points = []),
            (this.Coords = []),
            (this.Nodes = {}),
            (this.total = 0),
            (this.DistK = 0.6),
            (this.NAngK = 0.4),
            (this.animate = () => {
              this.config.isAnimate;
            });
        }
        setDefaultConfig(e) {
          G.copy(e, {
            renderOrder: 999,
            count: 10,
            nodeUpd: [!0, !0, !0],
            distColor: "#FF0000",
            distTab: "#E700D3",
            angNorth: "rgba(0, 23, 238, 0.5)",
            angLine: "rgba(231, 0, 211, 0.2)",
            tabLen: 1.2,
            ATabSeg: 7,
            isDashed: !0,
            gapSize: 0.15,
            textOftY: 0.1,
            textOpts: {},
            textUpd: [!0, !0, !0, !0],
            distText: ["#0C0719", "#0C0719"],
            angText: ["#000000", "#000000"],
            dUnit: "km",
            aUnit: "°",
            dFix: 2,
            aFix: 2,
          });
        }
        disposeCompEft() {
          (this.mapIns = null),
            (this.CText = null),
            (this.Points = null),
            (this.Coords = null),
            (this.Nodes = null),
            (this.FPoint = null);
        }
        compEftInit() {
          (this.CText = new Fe(this.config.textOpts)),
            (this.mapIns = this.renderer._mapIns()),
            this.onListen(),
            this.creatTools(),
            this._triggerInnerEvent("mounted", { val: this.config.name });
        }
        onListen() {
          this.renderer.on("onMapEvent", (e) => {
            if (!this.isStart || this.Points.length >= this.config.count)
              return;
            const { type: t, point: n, coord: i } = e;
            if ("onMouseDown" === t)
              this.Points.push(n), this.Coords.push(i), this.updateTools();
            else if ("onMouseIn" === t) {
              const e = [...this.Points, n],
                t = [...this.Coords, i];
              this.updateTools(e, t);
            } else this.updateTools();
          });
        }
        creatTools() {
          const {
            distColor: e,
            angNorth: t,
            distTab: n,
            angLine: i,
            isDashed: o,
            ATabSeg: s,
          } = this.config;
          this.config._ASeg = (1 + s) | 0;
          const r = this.creatLine(e, "dist", o),
            a = this.creatLine(n, "distTab", !1),
            l = this.creatLine(n, "aNorthLine", !1),
            c = this.creatLine(t, "angNorth", !1),
            h = this.creatAPlane(t, "angNPlane"),
            u = this.creatLine(i, "angLine", !1),
            d = this.creatAPlane(i, "angLPlane"),
            {
              count: p,
              distText: f,
              angText: m,
              dUnit: g,
              aUnit: v,
            } = this.config,
            [y, b] = [" " + g, " " + v];
          for (let e = 0; e < p; e++)
            r.add(this.CText.create(y, f, "dist-" + e)),
              a.add(this.CText.create(e > 0 ? y : "", f, "distAll-" + e)),
              c.add(this.CText.create(b, m, "aNorth-" + e)),
              u.add(this.CText.create(b, m, "aLine-" + e));
          this.group.add(r, a, l, c, h, u, d);
        }
        updateTools(e = this.Points, t = this.Coords) {
          const {
              dist: n,
              distTab: i,
              aNorthLine: o,
              angNorth: s,
              angNPlane: r,
              angLine: a,
              angLPlane: l,
            } = this.Nodes,
            [c, h, u] = this.config.nodeUpd,
            [d, p, f, m] = this.config.textUpd;
          (this.DistK = d && h ? 0.6 : 0.5),
            (this.NAngK = d && h ? 0.4 : 0.5),
            this.updateNode(n, e),
            this.updateNode(i, e),
            this.updateNode(o, h ? e : []),
            this.updateNode(s, h ? e : [], r),
            this.updateNode(a, u ? e : [], l),
            (this.total = 0),
            this.updateTNode(n, d ? e : [], t),
            this.updateTNode(i, p ? e : [], t),
            this.updateTNode(s, h && f ? e : [], t),
            this.updateTNode(a, u && m ? e : [], t);
        }
        clearAll() {
          (this.Points = []), (this.Coords = []);
          const {
            dist: e,
            distTab: t,
            aNorthLine: n,
            angNorth: i,
            angNPlane: o,
            angLine: s,
            angLPlane: r,
          } = this.Nodes;
          e.geometry.setDrawRange(0, 0),
            t.geometry.setDrawRange(0, 0),
            n.geometry.setDrawRange(0, 0),
            i.geometry.setDrawRange(0, 0),
            o.geometry.setDrawRange(0, 0),
            s.geometry.setDrawRange(0, 0),
            r.geometry.setDrawRange(0, 0);
          const a = e.children.length;
          for (let n = 0; n < a; n++)
            (e.children[n].visible = !1),
              (t.children[n].visible = !1),
              (i.children[n].visible = !1),
              (s.children[n].visible = !1);
        }
        creatLine(e, t, n = !0) {
          const { gapSize: i } = this.config,
            o = G.getColorArr(e),
            s = n
              ? G.mtl.lineD({ dashSize: i, gapSize: i, color: o[0] })
              : G.mtl.line({ color: o[0] }),
            r = new THRDev3.LineSegments(this.creatLineGeo(t), s);
          return (
            n && r.computeLineDistances(),
            (r.position.y = 0.01),
            (r.name = "line-" + t),
            (r.frustumCulled = !1),
            (r.renderOrder = 999),
            (r._isDashed = n),
            (r._type = t),
            (this.Nodes[t] = r),
            r
          );
        }
        creatLineGeo(e) {
          const { count: t, _ASeg: n } = this.config,
            i = G.geo.buf();
          let o = 2 * (t + 1);
          ("angLine" !== e && "angNorth" !== e) || (o = t * n * 2),
            "aNorthLine" === e && (o = 3 * t * 2);
          const s = new Float32Array(3 * o);
          return (
            i.setAttribute("position", new THRDev3.BufferAttribute(s, 3)),
            i.setDrawRange(0, 0),
            i
          );
        }
        creatAPlane(e, t) {
          const { count: n, _ASeg: i } = this.config,
            [o, s] = [G.geo.buf(), []];
          for (let e = 0; e < n; e++) {
            const t = e * (i + 2);
            for (let e = 0; e < i; e++) {
              const n = t + e + 1;
              s.push(t, n, n + 1);
            }
          }
          o.setIndex(s);
          const r = new Float32Array(n * (i + 2) * 3);
          o.setAttribute("position", new THRDev3.BufferAttribute(r, 3)),
            o.setDrawRange(0, 0);
          const [a, l] = G.getColorArr(e),
            c = new THRDev3.Mesh(
              o,
              G.mtl.basic({
                side: 2,
                color: a,
                opacity: 0.5 * l,
                transparent: !0,
                depthWrite: !1,
              })
            );
          return (
            (c.position.y = 0.01),
            (c.name = "tab-plane-" + t),
            (c.frustumCulled = !1),
            (c.renderOrder = 999),
            (this.Nodes[t] = c),
            c
          );
        }
        updateNode(e, t, n) {
          const { position: i } = e.geometry.attributes,
            o = t.length;
          let s = 0;
          const { _type: r } = e;
          switch (r) {
            case "dist":
              s = this.updateDistVecs(i, t, o);
              break;
            case "distTab":
              s = this.updateDTabVecs(i, t, o);
              break;
            case "aNorthLine":
              s = this.updateNLVecs(i, t, o);
              break;
            case "angNorth":
            case "angLine":
              const e = n.geometry.attributes.position,
                { LRang: a, PRang: l } = this.updateAngle(r, i, e, t, o);
              (s = a), (e.needsUpdate = !0), n.geometry.setDrawRange(0, l);
          }
          (i.needsUpdate = !0),
            e.geometry.setDrawRange(0, s),
            e._isDashed && e.computeLineDistances();
        }
        updateDistVecs(e, t, n) {
          for (let i = 0; i < n; i++) {
            const { x: n, y: o, z: s } = t[i],
              r = Math.max(i, 2 * (i - 1));
            if (r < 2) e.setXYZ(r, n, o, s);
            else {
              const a = t[i - 1];
              e.setXYZ(r, a.x, a.y, a.z), e.setXYZ(r + 1, n, o, s);
            }
          }
          return Math.max(n, 2 * (n - 1));
        }
        updateDTabVecs(e, t, n) {
          const { tabLen: i } = this.config;
          for (let o = 0; o < n; o++) {
            const { x: n, y: s, z: r } = t[o];
            e.setXYZ(2 * o, n, s + i, r), e.setXYZ(2 * o + 1, n, s, r);
          }
          return 2 * n;
        }
        updateNLVecs(e, t, n) {
          if (n < 2) return 0;
          const i = 3.5 * Math.max(this.config.tabLen, 1);
          for (let o = 0; o < n - 1; o++) {
            const {
              x: n,
              y: s,
              z: r,
            } = this.getMVec(t[o + 1], t[o], this.NAngK);
            e.setXYZ(6 * o, n, s, r + i),
              e.setXYZ(6 * o + 1, n, s, r - i),
              e.setXYZ(6 * o + 2, n - 0.15, s, r - i + 0.2),
              e.setXYZ(6 * o + 3, n, s, r - i),
              e.setXYZ(6 * o + 4, n + 0.15, s, r - i + 0.2),
              e.setXYZ(6 * o + 5, n, s, r - i);
          }
          return 6 * (n - 1);
        }
        updateAngle(e, t, n, i, o) {
          if (o < 2) return { LRang: 0, PRang: 0 };
          let [s, r, a, l] = [1, 1.2, null];
          "angLine" === e && ((s = 2), (r = 0.7));
          const c = this.config._ASeg;
          for (let h = 0; h < o - s; h++) {
            "angLine" === e
              ? ((a = i[h + 2]), (l = i[h + 1]))
              : (l = this.getMVec(i[h + 1], i[h], this.NAngK));
            const { x: o, y: s, z: u } = l,
              { sv: d, ev: p, R: f } = this.getTVec(i[h], l, r, a),
              m = h * (c + 2);
            n.setXYZ(m, o, s, u);
            for (let e = 0; e <= c; e++) {
              const i = h * c * 2 + 2 * e;
              let o, s;
              0 === e
                ? ((o = d), (s = i))
                : e === c
                ? ((o = p), (s = i - 1))
                : ((s = i),
                  (o = this.compRadVec(e / c, l, d, p, f)),
                  t.setXYZ(i - 1, o.x, o.y, o.z)),
                t.setXYZ(s, o.x, o.y, o.z);
              const r = m + e + 1;
              n.setXYZ(r, o.x, o.y, o.z);
            }
          }
          return { LRang: (o - s) * c * 2, PRang: (o - s) * c * 3 };
        }
        updateTNode(e, t, n) {
          const [i, o] = [e.children.length, t.length];
          for (let s = 0; s < i; s++) {
            const i = e.children[s];
            if (((i.visible = !1), !(s >= o)))
              switch (e._type) {
                case "dist":
                  this.updateDistText(i, t, n, s);
                  break;
                case "distTab":
                  this.updateDAllText(i, t, n, s);
                  break;
                case "angNorth":
                  this.updateANorthText(i, t, s);
                  break;
                case "angLine":
                  this.updateALineText(i, t, s, o);
              }
          }
        }
        updateDistText(e, t, n, i) {
          if (0 === i) return;
          const { vec2: o, h: s } = this.dTextVec(t[i], t[i - 1], this.DistK);
          this.CText.update(e, this.compDist(n[i], n[i - 1]), o, s);
        }
        updateDAllText(e, t, n, i) {
          i > 0 && (this.total += this.compDist(n[i], n[i - 1]));
          const o = i > 0 ? this.toFix(this.total) : "起点",
            { vec2: s, h: r } = this.dTextVec(t[i]);
          this.CText.update(e, o, s, r);
        }
        updateANorthText(e, t, n) {
          if (0 === n) return;
          const { textOftY: i } = this.config,
            [o, s] = [t[n - 1], t[n]],
            r = this.getMVec(s, o, this.NAngK),
            { sv: a, ev: l, R: c } = this.getTVec(o, r, 1.25),
            h = this.getMVec(a, l, 0.5),
            u = je.copy(r).sub(h).length(),
            { x: d, y: p, z: f } = je.copy(r).lerp(h, c / u + i);
          this.CText.update(e, this.compAngle(o, s), { x: d, y: f }, p);
        }
        updateALineText(e, t, n, i) {
          if (0 === n || n === i - 1) return;
          const { textOftY: o } = this.config,
            [s, r, a] = [t[n - 1], t[n], t[n + 1]],
            { sv: l, ev: c, R: h } = this.getTVec(s, r, 0.75, a),
            u = this.getMVec(l, c, 0.5),
            d = je.copy(r).sub(u).length(),
            { x: p, y: f, z: m } = je.copy(r).lerp(u, h / d + o);
          this.CText.update(e, this.compAngle(s, r, a), { x: p, y: m }, f);
        }
        getTVec(e, t, n = 1, i) {
          const o = this.config.tabLen * n;
          return {
            sv: i
              ? { ...je.copy(i).sub(t).normalize().multiplyScalar(o).add(t) }
              : { x: t.x, y: t.y, z: t.z - o },
            ev: { ...je.copy(e).sub(t).normalize().multiplyScalar(o).add(t) },
            R: o,
          };
        }
        compRadVec(e, t, n, i, o) {
          let s = 2 * e;
          const r = 0.5 * (--s * s * s + 1),
            a = { ...je.copy(n).lerp(i, r) },
            l = je.copy(a).sub(t).length();
          return { ...je.copy(t).lerp(a, o / l) };
        }
        compAngle(e, t, n) {
          const i = je.copy(e).sub(t).normalize().clone(),
            o = n ? je.copy(n).sub(t).normalize().clone() : je.set(0, 0, -1),
            s = G.rad2Angle(i.angleTo(o));
          return this.toFix(s, "aFix");
        }
        compDist(e, t) {
          const n = this.mapIns.lonlatDist(e, t);
          return this.toFix(n);
        }
        dTextVec(e, t, n) {
          const { tabLen: i, textOftY: o } = this.config,
            { x: s, y: r, z: a } = t ? this.getMVec(e, t, n) : { ...e };
          return { vec2: { x: s, y: a }, h: r + (t ? 0 : i) + (n ? o : 0) };
        }
        getMVec(e, t, n = 0.5) {
          return { ...je.copy(e).lerp(t, n) };
        }
        toFix(e, t = "dFix") {
          const n = this.config[t];
          return +e.toFixed(n);
        }
        setConfig(e, t) {
          switch (e) {
            case "start":
              this.isStart = t.start;
              break;
            case "clear":
              this.clearAll();
          }
        }
        getConfig(e, t) {
          let n = null;
          switch (e) {
            case "total":
              n = this.total;
              break;
            case "points":
              n = {
                points: G.extend(!0, [], this.Points),
                coords: G.extend(!0, [], this.Coords),
              };
          }
          return n;
        }
      },
      Ne = {
        BmVShader:
          "\n        varying vec2 vUv;\n        varying vec3 vNormal;\n        varying vec3 vPNormal;\n\n        void main() {\n            vec4 mP = modelViewMatrix * vec4(position, 1.0);\n\n            vUv = uv;\n            vNormal = normalize(normalMatrix * normal);\n            vPNormal = normalize(mP.xyz);\n\n            gl_Position = projectionMatrix * mP;\n        }\n    ",
        BmFShader:
          "\n        uniform float uTime;\n        uniform vec4 uColor;\n        uniform vec3 uRatio;\n        uniform sampler2D uTxue;\n\n        varying vec2 vUv;\n        varying vec3 vNormal;\n        varying vec3 vPNormal;\n\n        void main() {\n            float k = uRatio.y * abs(dot(vNormal, vPNormal));\n            float a = .03 + .97 * pow(uRatio.x + k, uRatio.z);\n\n            float ky = vUv.y - mod(uTime * .1, 1.);\n            vec4 map = texture2D(uTxue, vec2(vUv.x, mod(ky, 1.)));\n\n            gl_FragColor = map * uColor;\n            gl_FragColor.w = .03 + gl_FragColor.w * a;\n        }\n    ",
      };
    const [Ge, We, Ye, Ke, $e] = [
      new THRDev3.Vector3(),
      new THRDev3.Quaternion(),
      { x: 1, y: 0, z: 0 },
      { x: 0, y: 1, z: 0 },
      { x: 0, y: 0 },
    ];
    var Xe = class extends de {
      constructor(e) {
        super(e),
          z()(this, "_setting", {
            callback: {
              setParams() {},
              setBeamV(e) {
                (this.Beam.visible = e), this.updateBeams();
              },
              setBeamMtl(e, t, n) {
                const i = n.split(".").pop(),
                  { uniforms: o } = this.Beam.material;
                if ("txue" === i) o.uTxue.value = this.renderer.getTxue(e);
                else {
                  const t = G.getColorArr(e, !0);
                  o.uColor.value.fromArray(t);
                }
              },
              setBInfo(e, t, n) {
                const i = n.split(".").pop();
                this.updateInfo(i, e), this.updateBeams();
              },
              setCenterLine(e) {
                const t = this.Beam.children[2];
                t ? (t.visible = e) : e && this.Beam.add(this.creatCLine());
              },
              setOftY(e) {
                const [t, n, i, o, s] = this.group.children;
                (n.position.y = e),
                  (i.position.y = 0.8 * e),
                  (o.position.y = 1.2 * e),
                  (s.position.y = 1.2 * e);
              },
              setColor(e, t, n) {
                const i =
                    this.group.children[
                      { fColor: 1, hColor: 2, histLColor: 3, distColor: 4 }[
                        n.split(".").pop()
                      ]
                    ],
                  o = G.getColorArr(e);
                i.material.color.copy(o[0]), (i.material.opacity = o[1]);
              },
              setHistLine(e) {
                this.group.children[3].visible = e;
              },
              setDistLine(e) {
                this.group.children[4].visible = e;
              },
            },
            checkList: {
              visible: "setBeamV",
              txue: "setBeamMtl",
              color: "setBeamMtl",
              speed: "setParams",
              points: "setBInfo",
              length: "setBInfo",
              angle: "setBInfo",
              rotate: "setBInfo",
              centerLine: "setCenterLine",
              oftY: "setOftY",
              fColor: "setColor",
              hColor: "setColor",
              histLine: "setHistLine",
              histLColor: "setColor",
              textUpd: "setParams",
              distLine: "setDistLine",
              distLimit: "setParams",
              distColor: "setColor",
            },
          }),
          (this.mapIns = null),
          (this.CText = null),
          (this.Geos = null),
          (this.Beam = null),
          (this.FaceAttr = null),
          (this.BInfo = {
            type: !1,
            length: 0,
            angle: 0,
            rotate: { x: 0, y: 0 },
            hY: 0,
            pos: { x: 0, y: 0, z: 0 },
            beamComp: {},
          }),
          (this.HisAmt = {
            isUpdate: !0,
            framei: 0,
            order: 0,
            times: 0,
            seg: 0,
            range: 0,
            posAttr: null,
            lineOrder: 0,
          }),
          (this.vec2s = null),
          (this.CrossPels = {}),
          (this.animate = (e, t) => {
            this.config.isAnimate && this.beamAmt(e, t);
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          isProxy: !0,
          seg: 24,
          visible: !0,
          txue: "",
          color: "#fff",
          speed: 1,
          points: { lon: 0, lat: 0, hY: 0 },
          length: 50,
          angle: 10,
          rotate: { x: 50, y: 90 },
          centerLine: !0,
          oftY: 0.01,
          fColor: "rgba(201, 134, 13, 0.5)",
          hColor: "rgba(107, 128, 94, 0.4)",
          frame: 12,
          total: 10,
          histLine: !0,
          histLColor: "rgba(38, 25, 255, 1)",
          histCount: 100,
          textOftY: 0.02,
          textOpts: { scaleText: 0.23 },
          textUpd: [!0, !0],
          hyText: ["#0515AE", "#0515AE"],
          meaText: ["#AE0505", "#AE0505"],
          hUnit: "km",
          mUnit: "km²",
          hFix: 2,
          mFix: 2,
          distLine: !0,
          distLimit: 10,
          distColor: "rgba(59, 52, 0, 1)",
          distCount: 50,
        });
      }
      disposeCompEft() {
        (this.mapIns = null),
          (this.CText = null),
          (this.Geos = null),
          (this.Beam = null),
          (this.FaceAttr = null),
          (this.BInfo = null),
          (this.HisAmt = null);
      }
      compEftInit() {
        this.onListen(),
          (this.CText = new Fe(this.config.textOpts)),
          (this.mapIns = this.renderer._mapIns()),
          this.createGeos(),
          this.creatBeam(),
          this.creatBeamFace(),
          this.creatHistory(),
          this.creatHistLine(),
          this.creatDistLine(),
          this.initBInfo(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      onListen() {
        let e = -1;
        this.renderer.on("startAxis", (t) => {
          e !== t.time && this.clearHistory();
        }),
          this.renderer.on("pauseAxis", (t) => {
            e = t.time;
          }),
          this.renderer.on("updBeam", (e, t) => {
            (this.BInfo.type = !0),
              this.updateBeams(e),
              this.updateHistory(),
              this.updateCross(e, t);
          }),
          this.renderer.on("updBeamVisible", (e) => {
            this.Beam &&
              ((this.Beam.visible = e),
              (this.group.children[1].visible = e),
              e || this.clearHistory());
          }),
          this.renderer.on("updTitle", () => {
            this.updateInfo("points", this.config.points),
              this.updateBeams(),
              this.clearHistory();
          });
      }
      initBInfo() {
        const { points: e, length: t, angle: n, rotate: i } = this.config;
        this.updateInfo("points", e),
          this.updateInfo("length", t),
          this.updateInfo("angle", n),
          this.updateInfo("rotate", i),
          this.updateBeams();
      }
      updateInfo(e, t) {
        switch (e) {
          case "points":
            const { lon: e, lat: n, hY: i } = t;
            (this.BInfo.hY = +i),
              (this.BInfo.pos = this.mapIns.coord2Vec(e, n, +i));
            break;
          case "length":
            this.BInfo.length = this.mapIns.transHY(t);
            break;
          case "angle":
            this.BInfo.angle = G.clamp(Math.abs(t), 1, 179, 10);
            break;
          case "rotate":
            (this.BInfo.rotate.x = G.clamp(t.x, -89, 89, 0)),
              (this.BInfo.rotate.y = G.toNum(t.y % 360, 0));
        }
      }
      updateBeams(e = {}) {
        if (!this.Beam || !this.Beam.visible) return;
        const [t, n] = this.config.textUpd,
          {
            length: i,
            angle: o,
            rotate: s,
            hY: r,
            pos: a,
          } = G.copy(this.BInfo, e),
          [l, c = Math.tan(l)] = [G.angle2Rad(o)],
          h = this.Beam,
          [u, d, p] = h.children,
          f = i * c,
          m = { x: f, y: i, z: f };
        h.scale.copy(m),
          h.position.copy(a),
          this.setRoate(h, s.x, s.y),
          h.updateMatrixWorld();
        const g = h.matrixWorld,
          v = this.handleFace(g, a),
          y = { ...Ge.set(0, -1, 0).applyMatrix4(g) },
          b = this.getBVec(a, y, this.mapIns.basY),
          x = Ge.copy(a).distanceTo(b) / i;
        p && (p.scale.y = x);
        const w = this.mapIns.vecDist2(a, b);
        this.updateBText(t, u, this.toFix(w), 0.5 * x, m);
        const { ea2: C, eb2: T, area: _ } = this.compArea(l, c, s.x, r);
        this.updateBText(n, d, this.toFix(_, "mFix"), x, m),
          (this.BInfo.beamComp = {
            vec: { ...v },
            len: w,
            ea2: C,
            eb2: T,
            area: _,
            lVec: { ...b },
          });
      }
      updateCross(e, t) {
        if (!this.Beam || !this.Beam.visible) return;
        const { distLimit: n } = this.config,
          { vec: i } = this.BInfo.beamComp;
        let o = 0;
        const { position: s } = this.Geos.DGeo.attributes;
        for (let r = t.length - 1; r >= 0; r--) {
          const { pos: a, params: l } = t[r],
            c = this.mapIns.vecDist2(i, a);
          c > n ||
            (this.judgeCross(c, a, l, e),
            s.setXYZ(2 * o, i.x, i.y, i.z),
            s.setXYZ(2 * o + 1, a.x, a.y, a.z),
            o++);
        }
        (0 === o && 0 === this.Geos.DGeo.drawRange.count) ||
          ((s.needsUpdate = !0),
          this.Geos.DGeo.setDrawRange(0, 2 * o),
          this.group.children[4].computeLineDistances());
      }
      judgeCross(e, t, n, i) {
        const { ea2: o, eb2: s } = this.BInfo.beamComp;
        if (!this.vec2s || e > o + 0.5 || e < s - 0.3) return;
        const { x: r, y: a, z: l } = t,
          c = pe.isInPolygon({ x: r, y: l }, this.vec2s),
          { id: h } = n;
        c &&
          !this.CrossPels[h] &&
          ((this.CrossPels[h] = !0), this.crossListen("start", h, e, n, i)),
          this.CrossPels[h] &&
            !c &&
            (delete this.CrossPels[h], this.crossListen("end", h, e, n, i));
      }
      crossListen(e, t, n, i, o) {
        const s = {
          type: e,
          id: t,
          dist: n,
          axisTime: o.axisTime,
          pelInfo: G.extend(!0, {}, i),
          beamInfo: G.extend(!0, {}, o),
        };
        this.renderer._triggerInnerEvent("crossPels", s);
      }
      handleFace(e, t) {
        const { seg: n } = this.config,
          i = this.Beam.geometry.attributes.position.array,
          o = [];
        let [s, r] = [0, 0];
        for (let a = 0; a < n; a++) {
          const n = 3 * (a + 1),
            [l, c, h] = [i[n], i[n + 1], i[n + 2]],
            u = Ge.set(l, c, h).applyMatrix4(e),
            { x: d, y: p, z: f } = this.getBVec(t, u, this.mapIns.basY);
          this.FaceAttr.setXYZ(a, d, p, f),
            o.push({ x: d, y: f }),
            (s += d),
            (r += f);
        }
        return (
          (this.FaceAttr.needsUpdate = !0),
          (this.vec2s = o),
          { x: s / n, y: this.mapIns.basY, z: r / n }
        );
      }
      updateBText(e, t, n, i, o) {
        if (((t.visible = !1), !e)) return;
        const { textOftY: s } = this.config;
        (t.userData.divide = { ...o }),
          this.CText.update(t, n, $e, (s - 1) * i);
      }
      clearHistory() {
        (this.HisAmt.order = 0),
          (this.HisAmt.framei = 0),
          (this.HisAmt.lineOrder = 0),
          this.Geos.HGeo.setDrawRange(0, 0),
          this.Geos.LGeo.setDrawRange(0, 0),
          this.Geos.DGeo.setDrawRange(0, 0);
      }
      updateHistory() {
        if (!this.Beam || !this.Beam.visible || !this.HisAmt.isUpdate) return;
        this.updateHistLine();
        const { frame: e } = this.config,
          {
            framei: t,
            order: n,
            times: i,
            seg: o,
            range: s,
            posAttr: r,
          } = this.HisAmt;
        if ((this.HisAmt.framei++, t % e != 0)) return;
        const a = o * (n % i),
          { array: l } = this.FaceAttr;
        for (let e = 0; e < o; e++) {
          const t = 3 * e;
          r.setXYZ(a + e, l[t], l[t + 1], l[t + 2]);
        }
        (r.needsUpdate = !0),
          this.Geos.HGeo.setDrawRange(0, s * Math.min(n, i)),
          this.HisAmt.order++;
      }
      updateHistLine() {
        const { framei: e, lineOrder: t } = this.HisAmt;
        if (e % 20 != 0) return;
        const { x: n, y: i, z: o } = this.BInfo.beamComp.vec,
          { position: s } = this.Geos.LGeo.attributes;
        s.setXYZ(t, n, i, o),
          (s.needsUpdate = !0),
          this.Geos.LGeo.setDrawRange(0, t),
          this.group.children[3].computeLineDistances(),
          this.HisAmt.lineOrder++;
      }
      beamAmt(e, t) {
        if (!this.Beam || !this.Beam.visible) return;
        const n = t.getElapsedTime();
        this.Beam.material.uniforms.uTime.value = n * this.config.speed;
      }
      creatBeam() {
        const {
            visible: e,
            txue: t,
            color: n,
            centerLine: i,
            hyText: o,
            meaText: s,
            hUnit: r,
            mUnit: a,
          } = this.config,
          l = G.getColorArr(n, !0),
          c = new THRDev3.Mesh(
            this.Geos.BGeo,
            G.mtl.shader({
              uniforms: {
                uTime: { value: 0 },
                uRatio: { value: new THRDev3.Vector3(1, -1, 8) },
                uColor: { value: new THRDev3.Vector4().fromArray(l) },
                uTxue: { value: this.renderer.getTxue(t) },
              },
              side: 2,
              depthWrite: !1,
              transparent: !0,
              vertexShader: Ne.BmVShader,
              fragmentShader: Ne.BmFShader,
            })
          );
        (c.name = "current-beam"),
          (c.frustumCulled = !1),
          (c.renderOrder = 300),
          (c.visible = e),
          c.add(this.CText.create(" " + r, o, "highY")),
          c.add(this.CText.create(" " + a, s, "area")),
          i && c.add(this.creatCLine()),
          (this.Beam = c),
          this.group.add(c);
      }
      creatCLine() {
        const e = new THRDev3.Line(
          G.geo.buf().setFromPoints([
            { x: 0, y: 0, z: 0 },
            { x: 0, y: -1, z: 0 },
          ]),
          G.mtl.lineD({ dashSize: 0.004, gapSize: 0.004 })
        );
        return e.computeLineDistances(), (e.name = "beam-center-line"), e;
      }
      creatBeamFace() {
        const { oftY: e, fColor: t } = this.config,
          n = G.getColorArr(t),
          i = new THRDev3.Mesh(
            this.Geos.FGeo,
            G.mtl.basic({
              color: n[0],
              opacity: n[1],
              depthWrite: !1,
              transparent: !0,
            })
          );
        (i.name = "current-beam-face"),
          (i.frustumCulled = !1),
          (i.renderOrder = 200),
          (i.position.y = e),
          this.group.add(i);
      }
      creatHistory() {
        const { oftY: e, hColor: t } = this.config,
          n = G.getColorArr(t),
          i = new THRDev3.Mesh(
            this.Geos.HGeo,
            G.mtl.basic({
              color: n[0],
              opacity: n[1],
              depthWrite: !1,
              transparent: !0,
            })
          );
        (i.name = "beam-history"),
          (i.frustumCulled = !1),
          (i.renderOrder = 100),
          (i.position.y = 0.8 * e),
          this.group.add(i);
      }
      creatHistLine() {
        const { oftY: e, histLine: t, histLColor: n } = this.config,
          [i, o] = G.getColorArr(n),
          s = new THRDev3.Line(
            this.Geos.LGeo,
            G.mtl.lineD({
              dashSize: 1,
              gapSize: 1,
              color: i,
              opacity: o,
              transparent: !0,
            })
          );
        s.computeLineDistances(),
          (s.visible = t),
          (s.name = "beam-history-line"),
          (s.frustumCulled = !1),
          (s.renderOrder = 300),
          (s.position.y = 1.2 * e),
          this.group.add(s);
      }
      creatDistLine() {
        const { oftY: e, distLine: t, distColor: n } = this.config,
          [i, o] = G.getColorArr(n),
          s = new THRDev3.LineSegments(
            this.Geos.DGeo,
            G.mtl.lineD({
              dashSize: 1,
              gapSize: 1,
              color: i,
              opacity: o,
              transparent: !0,
            })
          );
        s.computeLineDistances(),
          (s.visible = t),
          (s.name = "beam-distance-line"),
          (s.frustumCulled = !1),
          (s.renderOrder = 300),
          (s.position.y = 1.2 * e),
          this.group.add(s);
      }
      createGeos() {
        const { seg: e, length: t } = this.config,
          [n, i] = [G.geo.buf(), G.geo.buf()],
          [o, s, r, a, l] = [[], [], [0, 0], [0, 0, 0], [0, 1, 0]],
          c = (1 + t / 20) | 0;
        for (let t = 0; t <= e; t++) {
          const { x: n, y: i } = this.getCircleV(t, e);
          r.push(t / e, c),
            a.push(n, -1, i),
            l.push(n, 0, i),
            t < e && o.push(0, t + 1, t + 2),
            t < e - 2 && s.push(0, t + 2, t + 1);
        }
        n.setIndex(o),
          n.setAttribute("uv", new THRDev3.Float32BufferAttribute(r, 2)),
          n.setAttribute("position", new THRDev3.Float32BufferAttribute(a, 3)),
          n.setAttribute("normal", new THRDev3.Float32BufferAttribute(l, 3)),
          i.setIndex(s);
        const h = new THRDev3.BufferAttribute(new Float32Array(3 * e), 3);
        i.setAttribute("position", h), (this.FaceAttr = h);
        const u = this.historyGeo(s),
          d = this.histLineGeo(),
          p = this.distLineGeo();
        this.Geos = { BGeo: n, FGeo: i, HGeo: u, LGeo: d, DGeo: p };
      }
      historyGeo(e) {
        const { seg: t, frame: n, total: i } = this.config,
          [o, s] = [G.geo.buf(), []],
          r = e.length,
          a = Math.round((3600 * i) / n);
        for (let n = 0; n < a; n++)
          for (let i = 0; i < r; i++) s.push(e[i] + n * t);
        o.setIndex(s);
        const l = new THRDev3.BufferAttribute(new Float32Array(a * t * 3), 3);
        return (
          o.setAttribute("position", l),
          o.setDrawRange(0, 0),
          (this.HisAmt.seg = t),
          (this.HisAmt.range = r),
          (this.HisAmt.times = a),
          (this.HisAmt.posAttr = l),
          o
        );
      }
      histLineGeo() {
        const { histCount: e } = this.config,
          t = G.geo.buf(),
          n = new Float32Array(60 * e * 3 * 3);
        return (
          t.setAttribute("position", new THRDev3.BufferAttribute(n, 3)),
          t.setDrawRange(0, 0),
          t
        );
      }
      distLineGeo() {
        const { distCount: e } = this.config,
          t = G.geo.buf(),
          n = new Float32Array(2 * e * 3);
        return (
          t.setAttribute("position", new THRDev3.BufferAttribute(n, 3)),
          t.setDrawRange(0, 0),
          t
        );
      }
      getCircleV(e, t) {
        const n = (G.M_PI * e) / t;
        return { x: Math.cos(n), y: Math.sin(n) };
      }
      compArea(e, t, n, i) {
        const o = Math.abs(G.angle2Rad(n)),
          [s, r] = [Math.tan(o + e), Math.tan(o - e)],
          a = i * (s - r) * 0.5,
          [l, c] = [Math.tan(o), G.M_PI2 - o],
          h = a - i * (l - r),
          [u, d] = [h * Math.sin(c), h * Math.cos(c)],
          p = (i / Math.cos(o) + d) * t,
          f = Math.sqrt(p * p + u * u);
        return { ea2: a, eb2: f, area: Math.PI * a * f };
      }
      setRoate(e, t, n) {
        const [i, o] = [G.angle2Rad(t), G.angle2Rad(n)],
          s = We.clone();
        We.setFromAxisAngle(Ye, i),
          s.premultiply(We),
          We.setFromAxisAngle(Ke, o),
          s.premultiply(We),
          e.quaternion.copy(s);
      }
      getBVec(e, t, n) {
        const i = (n - e.y) / (t.y - e.y);
        return { x: e.x + (t.x - e.x) * i, y: n, z: e.z + (t.z - e.z) * i };
      }
      getMVec(e, t, n = 0.5) {
        return { ...Ge.copy(e).lerp(t, n) };
      }
      toFix(e, t = "hFix") {
        const n = this.config[t];
        return +e.toFixed(n);
      }
      setConfig(e, t) {
        switch (e) {
          case "history":
            this.HisAmt.isUpdate = t.type;
            break;
          case "clear":
            this.clearHistory();
            break;
          case "option":
            this.setOption(t);
        }
      }
      getConfig(e, t) {
        let n = null;
        switch (e) {
          case "info":
            n = G.extend(!0, {}, this.BInfo);
        }
        return n;
      }
    };
    var qe = class extends de {
      constructor(e) {
        super(e),
          z()(this, "_setting", {
            callback: {
              setParams() {},
              setOftY(e, t) {
                const n = e - t;
                G.loopObject(this.Pels, (e) => {
                  const t = this.Pels[e];
                  (t.position.y += n), (t.userData.oldPos.y += n);
                  const i = { ...t.position };
                  t.userData.showTips &&
                    this.renderer._triggerInnerEvent("updTipPos", {
                      uuid: e,
                      pos: i,
                    }),
                    this.active === t && this.coordAxis.position.copy(i);
                });
              },
              setSizeA(e) {
                G.loopObject(this.Pels, (t) => {
                  const n = this.Pels[t],
                    { scale: i } = n.userData.opts;
                  n.scale.setScalar(this.getScale(i)),
                    (n.material.sizeAttenuation = e),
                    (n.material.needsUpdate = !0);
                });
              },
              setHover(e) {
                const [t, n] = G.getColorArr(e);
                G.loopObject(this.Pels, (e) => {
                  (this.Pels[e].userData.hColor = t),
                    (this.Pels[e].userData.hOpacity = n);
                });
              },
              setMtl(e, t, n) {
                const i = n.split(".").pop();
                G.loopObject(this.Pels, (t) => {
                  this.Pels[t].material[i] = e;
                });
              },
            },
            checkList: {
              pitchLen: "setParams",
              oftY: "setOftY",
              sizeAttenuation: "setSizeA",
              hover: "setHover",
              mtl: { depthTest: "setMtl", depthWrite: "setMtl" },
            },
          }),
          (this.mapIns = null),
          (this.Pels = {}),
          (this.PathTo = {}),
          (this.BeamId = null),
          (this.CurrentE = null),
          (this.active = null),
          (this.coordAxis = null),
          (this.activeTipId = null),
          (this.animate = () => {
            this.config.isAnimate;
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          isProxy: !0,
          isSelect: !0,
          axisLen: 6,
          axisColors: { x: "#FF0000", y: "#00FF00", z: "#0000FF" },
          pitchLen: 50,
          oftY: 0.1,
          sizeAttenuation: !0,
          hover: "#67C500",
          mtl: { depthTest: !1, depthWrite: !1 },
          pel: {
            type: 0,
            tipsType: 0,
            scale: 2,
            iconUrl: "",
            color: "#fff",
            beam: !1,
            pathId: null,
            visible: !0,
            renderOrder: 999,
          },
        });
      }
      disposeCompEft() {
        (this.mapIns = null),
          (this.Pels = {}),
          (this.PathTo = {}),
          (this.BeamId = null),
          (this.CurrentE = null),
          (this.active = null),
          (this.coordAxis = null);
      }
      compEftInit() {
        (this.mapIns = this.renderer._mapIns()),
          this.onListen(),
          this.creatAxes(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      onListen() {
        this.renderer.on("updPath", (e) => {
          const { id: t } = e;
          if ((this.updPel(t, e), this.BeamId === t)) {
            const n = [];
            G.loopObject(this.Pels, (e) => {
              const { dynPos: i, opts: o } = this.Pels[e].userData;
              o.pathId !== t && n.push({ pos: i, params: o });
            }),
              this.renderer._triggerInnerEvent("updBeam", e, n, t);
          }
        }),
          this.renderer.on("updTitle", () => {
            G.loopObject(this.Pels, (e) => {
              const t = this.Pels[e],
                { lon: n, lat: i, height: o } = t.userData.opts.point,
                s = this.mapIns.coord2Vec(n, i, o);
              (t.userData.dynPos = { ...s }),
                (s.y += this.config.oftY),
                (t.userData.oldPos = s),
                t.position.copy(s),
                t.userData.showTips &&
                  this.renderer._triggerInnerEvent("updTipPos", {
                    uuid: e,
                    pos: s,
                  }),
                this.active === t && this.coordAxis.position.copy(s);
            });
          }),
          this.renderer.bind("onMouseDown", (e, t, n) => {
            this.name !== n &&
              this.activeTipId &&
              (this.setTipType(this.activeTipId, 0, !1),
              (this.activeTipId = null));
          });
      }
      updPel(e, t) {
        const n = this.PathTo[e];
        if (!n) return;
        const i = this.Pels[n];
        if (!i) return;
        const { x: o, y: s, z: r } = t.pos;
        i.position.set(o, s + this.config.oftY, r),
          (i.userData.dynPos = { x: o, y: s, z: r });
        const a = { ...i.position };
        i.userData.showTips &&
          this.renderer._triggerInnerEvent("updTipPos", { uuid: n, pos: a }),
          this.active === i && this.coordAxis.position.copy(a);
      }
      setTipType(e, t, n) {
        const i = this.Pels[e];
        if (!i || i.userData.tipsType !== t) return;
        (i.userData.showTips = n),
          this.renderer._triggerInnerEvent("showTips", { uuid: e, type: n });
        const o = { ...i.position };
        n && this.renderer._triggerInnerEvent("updTipPos", { uuid: e, pos: o });
      }
      creatAxes() {
        const e = this.creatArrow(new THRDev3.Vector3().setX(1), "x"),
          t = this.creatArrow(new THRDev3.Vector3().setY(1), "y"),
          n = this.creatArrow(new THRDev3.Vector3().setZ(1), "z");
        (this.coordAxis = G.group("axis-helper")),
          (this.coordAxis.visible = !1),
          (this.coordAxis.renderOrder = 1e5),
          this.coordAxis.add(e, t, n),
          this.group.add(this.coordAxis);
      }
      creatArrow(e, t) {
        const { axisLen: n, axisColors: i } = this.config,
          [o, s, r = 0.4 * s] = [i[t], 0.1 * n],
          a = new THRDev3.ArrowHelper(e, new THRDev3.Vector3(), n, o, s, r);
        return (
          (a.name = `axis-${t}-helper`),
          (a.line.material.depthTest = !1),
          (a.line.material.depthWrite = !1),
          (a.line.material.transparent = !0),
          (a.cone.material.depthTest = !1),
          (a.cone.material.depthWrite = !1),
          (a.cone.material.transparent = !0),
          a
        );
      }
      select(e) {
        (this.active = null),
          (this.coordAxis.visible = !1),
          this.config.isSelect &&
            e &&
            ((this.active = e),
            this.coordAxis.position.copy(e.position),
            (this.coordAxis.visible = !0));
      }
      addPel(e) {
        const t = G.extend(!0, {}, this.config.pel, e),
          {
            id: n,
            iconUrl: i,
            point: o,
            tipsType: s,
            scale: r,
            beam: a,
            pathId: l,
            visible: c,
            renderOrder: h,
          } = t;
        if (!n || !i || this.Pels[n]) return;
        const { lon: u, lat: d, height: p } = o,
          f = this.mapIns.coord2Vec(u, d, p),
          m = this.creatPel(t);
        (m.userData.dynPos = { ...f }),
          (f.y += this.config.oftY),
          (m.userData.oldPos = f),
          (m.userData.opts = t),
          (m.userData.tipsType = s),
          (m.name = "peli-" + n),
          (m.renderOrder = h),
          (m.visible = c),
          m.position.copy(f),
          m.scale.setScalar(this.getScale(r)),
          (this.Pels[n] = m),
          l && (this.PathTo[l] = n),
          a && (this.BeamId = l);
      }
      chgPel(e, t, n) {
        const i = this.Pels[e];
        if (!i) return;
        const { material: o, userData: s } = i;
        switch (((s.opts[t] = n), t)) {
          case "point":
            const t = this.mapIns.coord2Vec(n.lon, n.lat, n.height);
            (t.y += this.config.oftY),
              (s.oldPos = t),
              i.position.copy(t),
              s.showTips &&
                this.renderer._triggerInnerEvent("updTipPos", {
                  uuid: e,
                  pos: t,
                }),
              this.active === i && this.coordAxis.position.copy(t);
            break;
          case "tipsType":
            s.tipsType = n;
            break;
          case "scale":
            i.scale.setScalar(this.getScale(+n));
            break;
          case "iconUrl":
            const r = this.renderer.setTxue({ id: e, url: n, isUpdate: !0 });
            o.map.dispose(), (o.map = r);
            break;
          case "color":
            const [a, l] = G.getColorArr(n);
            o.color.copy(a),
              (o.opacity = l),
              (i.userData.color = a),
              (i.userData.opacity = l);
            break;
          case "beam":
            const { pathId: c } = s.opts;
            n
              ? ((this.BeamId = c),
                this.renderer._triggerInnerEvent("updBeamVisible", !0))
              : this.BeamId === c &&
                ((this.BeamId = null),
                this.renderer._triggerInnerEvent("updBeamVisible", !1));
            break;
          case "pathId":
            this.delPathToPel(e), (this.PathTo[n] = e);
            break;
          case "visible":
            i.visible = n;
            break;
          case "renderOrder":
            i.renderOrder = +n;
        }
      }
      delPel(e) {
        const t = this.Pels[e];
        if (t) {
          (this.CurrentE = null),
            this.active === t &&
              ((this.coordAxis.visible = !1), (this.active = null)),
            this.BeamId === t.userData.opts.pathId &&
              ((this.BeamId = null),
              this.renderer._triggerInnerEvent("updBeamVisible", !1)),
            G.disposeNode(t),
            delete this.Pels[e],
            this.delPathToPel(e);
          for (let e = this.eventArr.length - 1; e >= 0; e--)
            this.eventArr[e].name === t.name && this.eventArr.splice(e, 1);
          this.renderer.updateEventArr(this);
        }
      }
      delPathToPel(e) {
        G.loopObject(this.PathTo, (t) => {
          this.PathTo[t] === e && delete this.PathTo[t];
        });
      }
      pitchPel(e) {
        const t = this.Pels[e];
        if (!t) return;
        const { pitchLen: n = 50 } = this.config,
          i = t.position,
          o = this.renderer.camera.position,
          s = new THRDev3.Vector3(),
          r = n / s.copy(o).distanceTo(i),
          a = { ...s.copy(i).lerp(o, r) };
        this.renderer._Busies("jumpTo", {
          camera: { x: a.x, y: a.y + 3, z: a.z },
          target: { x: i.x, y: i.y + 2, z: i.z },
          time: 1500,
        });
      }
      creatPel(e) {
        const { sizeAttenuation: t, hover: n, mtl: i } = this.config,
          { depthTest: o, depthWrite: s } = i,
          { id: r, iconUrl: a, color: l } = e,
          [c, h] = G.getColorArr(l),
          u = this.renderer.setTxue({ id: r, url: a }),
          d = new THRDev3.Sprite(
            G.mtl.sprite({
              map: u,
              color: c,
              opacity: h,
              depthTest: o,
              depthWrite: s,
              sizeAttenuation: t,
              transparent: !0,
            })
          ),
          [p, f] = G.getColorArr(n);
        return (
          (d.userData.hColor = p),
          (d.userData.hOpacity = f),
          (d.userData.color = c),
          (d.userData.opacity = h),
          this.group.add(d),
          this.eventArr.push(d),
          this.renderer.updateEventArr(this),
          d
        );
      }
      getScale(e) {
        const { sizeAttenuation: t } = this.config;
        return e * (t ? 2 : 0.03);
      }
      onMouseOut(e) {
        if (this.CurrentE) {
          const { opts: e, color: t, opacity: n } = this.CurrentE.userData;
          this.CurrentE.material.color.copy(t),
            (this.CurrentE.material.opacity = n),
            (this.CurrentE = null),
            this.setTipType(e.id, 1, !1);
        }
        return [e, null];
      }
      onMouseIn(e, t) {
        const [n] = t;
        if (!n) return [e, null];
        const { object: i } = n;
        if (i.userData.ceId !== this.id) return [e, null];
        const {
          opts: o,
          color: s,
          opacity: r,
          hColor: a,
          hOpacity: l,
        } = i.userData;
        return (
          this.CurrentE !== i &&
            (this.CurrentE &&
              (this.CurrentE.material.color.copy(s),
              (this.CurrentE.material.opacity = r)),
            i.material.color.copy(a),
            (i.material.opacity = l),
            (this.CurrentE = i),
            this.setTipType(o.id, 1, !0)),
          [e, o.id, G.extend(!0, {}, o), { ...i.position }]
        );
      }
      onMouseDown(e, t) {
        const [n] = t;
        if (!n) return [e, null];
        const { opts: i, ceId: o } = n.object.userData;
        return o !== this.id
          ? [e, null]
          : (this.activeTipId &&
              (this.setTipType(this.activeTipId, 0, !1),
              (this.activeTipId = null)),
            (this.activeTipId = i.id),
            this.setTipType(i.id, 0, !0),
            this.select(n.object),
            [e, i.id, G.extend(!0, {}, i), { ...n.object.position }]);
      }
      setConfig(e, t) {
        switch (e) {
          case "add":
            this.addPel(t);
            break;
          case "change":
            this.chgPel(t.id, t.key, t.val);
            break;
          case "delete":
            this.delPel(t.id);
            break;
          case "pitch":
            this.pitchPel(t.id);
            break;
          case "select":
            this.select(this.Pels[t.id]);
            break;
          case "option":
            this.setOption(t);
        }
      }
      getConfig(e, t) {
        let n = null;
        switch (e) {
          case "info":
            const e = this.Pels[t.id];
            if (e) {
              const { opts: t, oldPos: i, dynPos: o } = e.userData;
              n = {
                id: t.id,
                oldPos: { ...i },
                dynPos: { ...o },
                params: G.extend(!0, {}, t),
              };
            } else n = null;
            break;
          case "beamPath":
            n = this.BeamId;
            break;
          case "PathTo":
            n = G.extend(!0, {}, this.PathTo);
        }
        return n;
      }
    };
    const Ze = new THRDev3.Vector3();
    var Qe = class extends de {
        constructor(e) {
          super(e),
            (this.mapIns = null),
            (this.Paths = {}),
            (this.PathIds = []),
            (this.PLen = 0),
            (this.TimeAxis = {
              isStart: !1,
              time: 0,
              length: 0,
              start: 0,
              end: 0,
            }),
            (this.hasView = !1),
            (this.animate = (e, t) => {
              this.config.isAnimate && this.timeLine(e, t);
            });
        }
        setDefaultConfig(e) {
          G.copy(e, {
            seg: 1,
            oftY: 0.1,
            multi: 1,
            count: 100,
            path: {
              limit: [0, 0],
              viewTo: !1,
              viewOft: { x: 0, y: 60, z: 33 },
              gap: 1,
              lineColor: "#C53900",
              lineType: !0,
              projColor: "#3D3D3D",
              projType: !1,
              renderOrder: 99,
            },
          });
        }
        disposeCompEft() {
          (this.mapIns = null), (this.Paths = {}), (this.PathIds = []);
        }
        compEftInit() {
          (this.mapIns = this.renderer._mapIns()),
            this.onListen(),
            this._triggerInnerEvent("mounted", { val: this.config.name });
        }
        onListen() {
          this.renderer.on("updTitle", () => {
            G.loopObject(this.Paths, (e) => {
              const t = this.Paths[e],
                n = t.datas[0];
              this.clearPoints(t, !0), this.handlePath(t, n);
            });
          });
        }
        timeLine(e, t) {
          const {
            isStart: n,
            time: i,
            length: o,
            start: s,
            end: r,
          } = this.TimeAxis;
          if (
            n &&
            !(i >= o) &&
            ((this.TimeAxis.time += e * this.config.multi), !(i < s || i >= r))
          ) {
            this.renderer._triggerInnerEvent("updateAxis", {
              ...this.TimeAxis,
            });
            for (let n = this.PLen - 1; n >= 0; n--) {
              const o = this.Paths[this.PathIds[n]],
                [s, r] = o.limit;
              i < s || i > r || this.pathAmt(o, e, t);
            }
            (this.hasView = !1),
              this.TimeAxis.time >= r &&
                this.renderer._triggerInnerEvent("endAxis", {
                  ...this.TimeAxis,
                });
          }
        }
        pathAmt(e, t) {
          const { multi: n } = this.config,
            { view: i, isStart: o, trans: s, total: r } = e;
          if (!o || s >= r || 0 === r) return;
          const a = this.updatePath(e, 0 | s);
          this.renderer._triggerInnerEvent("updPath", a),
            this.viewTo(i, a.pos),
            (e.time += t * n),
            (e.trans += n),
            e.trans < r || this.renderer._triggerInnerEvent("endPath", a);
        }
        updatePath(e, t) {
          t = void 0 === t ? e._idx : t;
          const {
            id: n,
            limit: i,
            total: o,
            wths: s,
            beams: r,
            vec3s: a,
            time: l,
          } = e;
          if (t >= o || 0 === o) return {};
          const { x: c, y: h, z: u } = s[t],
            { x: d, y: p, z: f } = r[t],
            m = { ...a[t] },
            g = {
              id: n,
              limit: i,
              time: l,
              axisTime: this.TimeAxis.time,
              pos: m,
              angle: d,
              rotate: { x: p, y: f },
              hY: u,
              _data: {
                lon: c,
                lat: h,
                height: u,
                angle: d,
                pitch: p,
                azimuth: f,
              },
            };
          return (e._idx = t), (e._pathInfo = g), g;
        }
        viewTo(e, t) {
          const { viewTo: n, viewOft: i } = e;
          if (!n || this.hasView) return;
          const { camera: o, controls: s } = this.renderer;
          o.position.copy(t).add(i), s.target.copy(t), (this.hasView = !0);
        }
        updateAxis(e) {
          G.copy(this.TimeAxis, e);
          const {
            isStart: t,
            time: n,
            length: i,
            start: o,
            end: s,
          } = this.TimeAxis;
          (this.TimeAxis.start = Math.min(o, s - 0.1)),
            (this.TimeAxis.length = Math.max(s, i)),
            n >= s
              ? this.renderer._triggerInnerEvent("endAxis", {
                  ...this.TimeAxis,
                })
              : t
              ? this.renderer._triggerInnerEvent("startAxis", {
                  ...this.TimeAxis,
                })
              : this.renderer._triggerInnerEvent("pauseAxis", {
                  ...this.TimeAxis,
                }),
            G.loopObject(this.Paths, (e) => {
              const t = this.Paths[e];
              this.setPathInfo(t);
            });
        }
        setPathInfo(e) {
          const { time: t, start: n } = this.TimeAxis,
            i = e.limit[0];
          this.restInfo(e);
          const o = Math.max(t, n);
          if (o > i) {
            const t = o - i;
            (e.time = t), (e.trans = (e.total * t) / e.rang);
          }
          const s = this.updatePath(e, 0 | e.trans);
          e.isStart && this.renderer._triggerInnerEvent("startPath", s);
        }
        start(e) {
          this.setArray(e, (e) => {
            const { id: t } = e,
              n = this.Paths[t];
            n &&
              (G.loopObject(e, (n) => {
                "id" !== n && this.chgPath(t, n, e[n]);
              }),
              (n.isStart = !0),
              this.setPathInfo(n),
              this.renderer._triggerInnerEvent(
                "startPath",
                this.updatePath(n)
              ));
          });
        }
        pause(e) {
          this.setArray(e, (e) => {
            const t = this.Paths[e];
            t &&
              ((t.isStart = !1),
              this.renderer._triggerInnerEvent(
                "pausePath",
                this.updatePath(t)
              ));
          });
        }
        end(e) {
          this.setArray(e, (e) => {
            const t = this.Paths[e];
            t &&
              (this.renderer._triggerInnerEvent("endPath", this.updatePath(t)),
              (t.isStart = !1),
              this.restInfo(t));
          });
        }
        restInfo(e) {
          (e.time = 0), (e.trans = 0);
        }
        setArray(e, t) {
          G.isArray(e) ? e.forEach(t) : t(e);
        }
        addPath(e = {}) {
          const t = G.extend(!0, {}, this.config.path, e),
            { id: n, limit: i, viewTo: o, viewOft: s, points: r } = t;
          if (!n || this.Paths[n]) return;
          const a = {
            id: n,
            limit: i,
            view: { viewTo: o, viewOft: s },
            isStart: !1,
            time: 0,
            trans: 0,
            total: 0,
            wths: [],
            beams: [],
            vec3s: [],
            lVecs: [],
            order: 0,
            datas: [],
            line: this.creatLine(t, "line"),
            proj: this.creatLine(t, "proj"),
            _params: t,
            _idx: 0,
          };
          this.handlePath(a, r),
            (this.Paths[n] = a),
            this.PathIds.push(n),
            (this.PLen = this.PathIds.length);
        }
        addPoints(e, t) {
          const n = this.Paths[e];
          n && (this.clearPoints(n), this.handlePath(n, t));
        }
        clearPoints(e, t) {
          const { line: n, proj: i } = e;
          t || ((e.isStart = !1), (e.time = 0), (e.trans = 0), (e._idx = 0)),
            (e.total = 0),
            (e.wths = []),
            (e.beams = []),
            (e.vec3s = []),
            (e.lVecs = []),
            (e.datas = []),
            n && n.geometry.setDrawRange(0, 0),
            i && i.geometry.setDrawRange(0, 0);
        }
        chgPath(e, t, n) {
          const i = this.Paths[e];
          if (!i) return;
          i._params[t] = n;
          const { line: o, proj: s } = i;
          switch (t) {
            case "viewTo":
            case "viewOft":
              i.view[t] = n;
              break;
            case "lineType":
            case "projType":
              this.setLineType(i, t, n);
              break;
            case "lineColor":
            case "projColor":
              this.setLintMtl(i, t, n);
              break;
            case "renderOrder":
              o && (o.renderOrder = +n), s && (s.renderOrder = +n);
          }
        }
        delPath(e) {
          const t = this.Paths[e];
          if (!t) return;
          const { line: n, proj: i } = t;
          n && G.disposeNode(n),
            i && G.disposeNode(i),
            (t.isStart = !1),
            (t.wths = null),
            (t.beams = null),
            (t.vec3s = null),
            (t.lVecs = null),
            (t.datas = null),
            (t._params = null),
            delete this.Paths[e],
            G.removeArrItem(this.PathIds, e),
            (this.PLen = this.PathIds.length);
        }
        getInfo(e) {
          const t = this.Paths[e];
          if (!t) return null;
          const {
            limit: n,
            time: i,
            order: o,
            datas: s,
            _params: r,
            _pathInfo: a = {},
          } = t;
          return G.extend(
            !0,
            {},
            {
              id: e,
              limit: n,
              time: i,
              order: o,
              datas: s,
              _params: r,
              pathInfo: a,
            }
          );
        }
        handlePath(e, t = []) {
          if (t.length < 2) return;
          const { wths: n, beams: i, vec3s: o, lVecs: s, line: r, proj: a } = e,
            { wthArr: l, beamArr: c, vec3Arr: h } = this.pointArray(e, t),
            {
              wth: u,
              beam: d,
              vec3: p,
              lVec: f,
            } = this.spacePoints(e, l, c, h);
          (e.wths = n.concat(u)),
            (e.beams = i.concat(d)),
            (e.vec3s = o.concat(p)),
            (e.lVecs = s.concat(f)),
            (e.total = e.vec3s.length),
            e.datas.push(t),
            e.order++,
            this.updateLine(e, r),
            this.updateLine(e, a);
        }
        pointArray(e, t) {
          const [n, i, o] = [[], [], []],
            { total: s, wths: r, beams: a, vec3s: l } = e;
          s > 0 &&
            (n.push(r[s - 1].clone()),
            i.push(a[s - 1].clone()),
            o.push(l[s - 1].clone()));
          const c = t.length;
          for (let e = 0; e < c; e++) {
            const {
              lon: s,
              lat: r,
              height: a,
              angle: l,
              pitch: c,
              azimuth: h,
              length: u,
            } = t[e];
            n.push(Ze.set(s, r, a).clone()), i.push(Ze.set(l, c, h).clone());
            const d = this.mapIns.coord2Vec(s, r, a);
            o.push(Ze.copy(d).clone());
          }
          return { wthArr: n, beamArr: i, vec3Arr: o };
        }
        spacePoints(e, t, n, i) {
          const { seg: o } = this.config,
            [s, r] = e.limit,
            [a, l, c] = [
              new THRDev3.CatmullRomCurve3(t),
              new THRDev3.CatmullRomCurve3(n),
              new THRDev3.CatmullRomCurve3(i),
            ],
            h = Math.max(1, r - s),
            u = Math.ceil(h * o * 60);
          e.rang = h;
          const [d, p, f, m] = [
            a.getSpacedPoints(u),
            l.getSpacedPoints(u),
            c.getSpacedPoints(u),
            c.getSpacedPoints((u / 20) | 0),
          ];
          return { wth: d, beam: p, vec3: f, lVec: m, len: u };
        }
        setLineType(e, t, n) {
          const i = t.slice(0, 4),
            o = e[i];
          if (o) o.visible = n;
          else {
            const t = this.creatLine(e._params, i);
            this.updateLine(e, t), (e[i] = t);
          }
        }
        setLintMtl(e, t, n) {
          const i = e[t.slice(0, 4)];
          if (!i) return;
          const [o, s] = G.getColorArr(n);
          i.material.color.copy(o), (i.material.opacity = s);
        }
        updateLine(e, t) {
          const { lVecs: n } = e,
            i = n.length;
          if (!t || !i) return;
          const { _Type: o, _isDashed: s } = t,
            { count: r } = t.geometry.drawRange,
            { position: a } = t.geometry.attributes;
          for (let e = r; e < i; e++) {
            const { x: t, y: i, z: s } = n[e],
              r = "proj" === o ? this.mapIns.basY : i;
            a.setXYZ(e, t, r, s);
          }
          (a.needsUpdate = !0),
            t.geometry.setDrawRange(0, i),
            s && t.computeLineDistances();
        }
        creatLine(e, t) {
          const { oftY: n } = this.config,
            { id: i, gap: o, renderOrder: s } = e,
            [r, a] = [e[t + "Color"], e[t + "Type"]];
          if (!a) return null;
          const [l, c] = G.getColorArr(r),
            h = o
              ? G.mtl.lineD({
                  dashSize: o,
                  gapSize: o,
                  color: l,
                  opacity: c,
                  transparent: !0,
                })
              : G.mtl.line({ color: l, opacity: c, transparent: !0 }),
            u = new THRDev3.Line(this.creatLineGeo(), h);
          return (
            o && u.computeLineDistances(),
            (u.visible = a),
            (u.frustumCulled = !1),
            (u.renderOrder = s),
            (u.name = "line-" + t + "-" + i),
            (u.position.y = n * ("proj" === t ? 1 : 0.5)),
            (u._Type = t),
            (u._isDashed = !!o),
            this.group.add(u),
            u
          );
        }
        creatLineGeo() {
          const { count: e } = this.config,
            t = G.geo.buf(),
            n = new Float32Array(60 * e * 3 * 3);
          return (
            t.setAttribute("position", new THRDev3.BufferAttribute(n, 3)),
            t.setDrawRange(0, 0),
            t
          );
        }
        setConfig(e, t) {
          switch (e) {
            case "add":
              this.addPath(t);
              break;
            case "addPoints":
              this.addPoints(t.id, t.points);
              break;
            case "change":
              this.chgPath(t.id, t.key, t.val);
              break;
            case "delete":
              this.delPath(t.id);
              break;
            case "multi":
              this.config.multi = t.multi;
              break;
            case "timeAxis":
              this.updateAxis(t);
              break;
            case "start":
              this.start(t.infos, t.isNew);
              break;
            case "pause":
              this.pause(t.ids);
              break;
            case "end":
              this.end(t.ids);
          }
        }
        getConfig(e, t) {
          let n = null;
          switch (e) {
            case "info":
              n = this.getInfo(t.id);
              break;
            case "ids":
              n = [...this.PathIds];
          }
          return n;
        }
      },
      Je = {
        txuePms: {
          scale: 1,
          visible: !0,
          center: { x: 0.5, y: 0 },
          renderOrder: 999,
          colors: ["#D7AA00", "#FFFFFF", "#1CC515", "#C81700"],
          fontSize: [52, 48, 48, 38],
          fontWeight: ["normal", "normal", "normal"],
          fillTextH: [0.52, 0.52, 0.55],
          lineHeight: [1.6, 1.5],
          align: ["center", "left"],
          fontFamily: "Arial",
          padding: [28, 8],
          shadow: !1,
          shadowColor: "rgba(255, 255, 255, 0.4)",
          sdBlur: 1,
          background: !0,
          bgWidth: 1.3,
          bgColor: ["#09172A", "rgba(57, 99, 172, 0.8)"],
          bgRadius: 12,
          __test: !1,
        },
        handleOpts(e = {}) {
          return G.extend(!0, {}, this.txuePms, e);
        },
        dispose() {
          this.txuePms = null;
        },
        initSprite(e, t, n) {
          const i = this.handleOpts(e),
            { center: o } = i,
            { depthTest: s, depthWrite: r } = t,
            a = new THRDev3.Sprite(
              G.mtl.sprite({
                transparent: !0,
                depthTest: s,
                depthWrite: r,
                sizeAttenuation: n,
              })
            );
          return (a.userData.params = i), a.center.copy(o), (a.visible = !1), a;
        },
        updateTxue(e, t, n = 1) {
          const i = this.handleOpts(e.userData.params);
          if (((e.userData.params = i), !t || !t.length)) return;
          let o;
          e.userData._text = t;
          const { map: s } = e.material;
          s
            ? ((o = s.image), s.dispose())
            : (o = document.createElementNS(
                "http://www.w3.org/1999/xhtml",
                "canvas"
              ));
          const r = this.setCanvas(o, t, i),
            a = new THRDev3.CanvasTexture(o);
          (e.material.map = a),
            (e.userData._scale = r),
            (o = null),
            this.nodeCommon(e),
            this.nodeScale(e, n);
        },
        nodeCommon(e, t) {
          switch (t) {
            case "visible":
            case "renderOrder":
              e[t] = e.userData.params[t];
              break;
            case "center":
              e[t].copy(e.userData.params[t]);
              break;
            default:
              const {
                visible: n,
                center: i,
                renderOrder: o,
              } = e.userData.params;
              (e.visible = n), e.center.copy(i), (e.renderOrder = o);
          }
        },
        nodeScale(e, t = 1) {
          const { sizeAttenuation: n } = e.material,
            { _scale: i, params: o } = e.userData;
          if (!i) return;
          const s = n ? 0.02 : 2e-4;
          e.scale.copy(i).multiplyScalar(s * o.scale * t);
        },
        setCanvas(e, t, n) {
          const { shadow: i, shadowColor: o, sdBlur: s, __test: r } = n,
            a = e.getContext("2d"),
            {
              w: l,
              h: c,
              cw: h,
              ch: u,
              px: d,
              py: p,
              mkw: f,
              mvw: m,
              tInfo: g,
              rows: v,
            } = this.getCvsInfo(a, t, n);
          (e.width = l),
            (e.height = c),
            this.drawBackground(a, n, l, c, h, u),
            i && ((a.shadowBlur = s), (a.shadowColor = o)),
            (a.textBaseline = "middle");
          const y = 0.5 * (l - h) + d,
            b = 0.5 * (c - u) + p;
          return (
            this.fillTitle(a, g, l, b),
            (a.textAlign = v[0].rAligns),
            this.fillTexti(a, 0, v, y, b),
            this.fillTexti(a, 1, v, f + y, b),
            this.fillTexti(a, 2, v, f + y, b),
            this.outLineTest(a, r, l, c, h, u),
            { x: l, y: c, z: 1 }
          );
        },
        fillTitle(e, t, n, i) {
          if (!t) return;
          const {
            text: o,
            th: s,
            textAlign: r,
            fillStyle: a,
            font: l,
            fillH: c,
          } = t;
          (e.font = l),
            (e.textAlign = r),
            (e.fillStyle = a),
            e.fillText(o, 0.5 * n, i + s * c);
        },
        fillTexti(e, t, n, i, o) {
          const { rFont: s, rStyles: r } = n[0];
          s[t] !== e.font && (e.font = s[t]),
            r[t] !== e.fillStyle && (e.fillStyle = r[t]);
          const a = Math.min(1, t);
          for (let s = 0; s < n.length; s++) {
            const {
              texts: r,
              isFill: l,
              rws: c,
              rhs: h,
              sh: u,
              rFillH: d,
            } = n[s];
            if (!l || !r[a]) continue;
            const p = 2 == t ? c[1] + 8 : 0;
            e.fillText(r[t], i + p, o + u + h[a] * d[t]);
          }
        },
        getCvsInfo(e, t, n) {
          const [i, o] = n.padding;
          let [s, r, a, l] = [0, 0, 0, 0];
          const { title: c = "" } = t[0],
            h = this.titleInfo(e, c + "", n);
          h && ((a = Math.max(a, h.tw)), (l += h.th));
          const u = [];
          for (let i = 1; i < t.length; i++) {
            const o = this.rowsInfo(e, t[i], n),
              [a, c, h] = o.rws,
              [d, p, f] = o.rhs;
            (o.sh = l),
              (s = Math.max(s, a)),
              (r = Math.max(r, c + 8 + h)),
              (l += Math.max(d, p, f)),
              u.push(o);
          }
          (a = Math.max(a, s + r)), (a += 2 * i), (l += 2 * o);
          return {
            w: Math.max(2, THRDev3.MathUtils.ceilPowerOfTwo(a)),
            h: Math.max(2, THRDev3.MathUtils.ceilPowerOfTwo(l)),
            cw: a,
            ch: l,
            px: i,
            py: o,
            mkw: s,
            mvw: r,
            tInfo: h,
            rows: u,
          };
        },
        titleInfo(e, t, n) {
          if (!t.length) return null;
          const {
              colors: i,
              fontSize: o,
              fontWeight: s,
              fillTextH: r,
              lineHeight: a,
              align: l,
              fontFamily: c,
            } = n,
            h = this.getVal(o);
          e.font = `bold ${h}px ${c}`;
          return {
            text: t,
            tw: Math.ceil(e.measureText(t).width),
            th: this.getVal(a) * h,
            textAlign: this.getVal(l),
            fillStyle: this.getVal(i),
            fillH: this.getVal(r),
            font: `${this.getVal(s)} ${h}px ${c}`,
          };
        },
        rowsInfo(e, t, n) {
          const { colors: i, fillTextH: o, align: s } = n,
            { key: r = "", value: a = "", unit: l = "" } = t,
            [c, h, u] = this.handleTexti(e, r, 1, n),
            [d, p, f] = this.handleTexti(e, a, 2, n),
            [m, g, v] = this.handleTexti(e, l, 3, n),
            y = this.getVal(o, 1);
          return {
            texts: [r + "", a + "", l + ""],
            isFill: !(!c && !d),
            rws: [c, d, m],
            rhs: c || d ? [h, p, g] : [0, 0, 0],
            rAligns: this.getVal(s, 1),
            rStyles: [this.getVal(i, 1), this.getVal(i, 2), this.getVal(i, 3)],
            rFillH: [y, y, this.getVal(o, 2)],
            rFont: [u, f, v],
          };
        },
        handleTexti(e, t, n, i) {
          const {
              fontSize: o,
              fontWeight: s,
              lineHeight: r,
              fontFamily: a,
            } = i,
            l = this.getVal(o, n);
          e.font = `bold ${l}px ${a}`;
          return [
            e.measureText(t + "").width,
            this.getVal(r, 1) * l,
            `${this.getVal(s, n)} ${l}px ${a}`,
          ];
        },
        getVal: (e, t = 0) => (void 0 === e[t] ? e[t - 1] : e[t]),
        drawBackground(e, t, n, i, o, s) {
          const { background: r, bgWidth: a, bgColor: l, bgRadius: c } = t;
          if (!r || !l[0]) return;
          (e.lineWidth = a), (e.strokeStyle = l[0]);
          const [h, u] = [0.5 * (n - o), 0.5 * (i - s)];
          this.drawRoundRect(e, h, u, o, s, c),
            l[1] && ((e.fillStyle = l[1]), e.fill()),
            e.stroke();
        },
        drawRoundRect(e, t, n, i, o, s) {
          e.beginPath(),
            e.arc(t + s, n + s, s, Math.PI, (3 * Math.PI) / 2),
            e.lineTo(i - s + t, n),
            e.arc(i - s + t, s + n, s, (3 * Math.PI) / 2, 2 * Math.PI),
            e.lineTo(i + t, o + n - s),
            e.arc(i - s + t, o - s + n, s, 0, (1 * Math.PI) / 2),
            e.lineTo(s + t, o + n),
            e.arc(s + t, o - s + n, s, (1 * Math.PI) / 2, Math.PI),
            e.closePath();
        },
        outLineTest(e, t, n, i, o, s) {
          t && ((e.strokeStyle = "#000"), e.strokeRect(0, 0, n, i));
        },
      };
    var et = class extends de {
        constructor(e) {
          super(e),
            z()(this, "_setting", {
              callback: {
                setParams() {},
                setScale(e) {
                  G.loopObject(this.Tips, (t) => {
                    const n = this.Tips[t];
                    Je.nodeScale(n, e);
                  });
                },
                setOffset(e) {
                  G.loopObject(this.Tips, (t) => {
                    const n = this.Tips[t];
                    (n.userData.offset = e),
                      n.position.copy(n.userData.pos).add(e);
                  });
                },
                setSizeA(e) {
                  G.loopObject(this.Tips, (t) => {
                    const n = this.Tips[t];
                    (n.material.sizeAttenuation = e),
                      (n.material.needsUpdate = !0),
                      Je.nodeScale(n, this.config.scale);
                  });
                },
                setMtl(e, t, n) {
                  const i = n.split(".").pop();
                  G.loopObject(this.Tips, (t) => {
                    this.Tips[t].material[i] = e;
                  });
                },
              },
              checkList: {
                scale: "setScale",
                offset: "setOffset",
                sizeAttenuation: "setSizeA",
                mtl: { depthTest: "setMtl", depthWrite: "setMtl" },
              },
            }),
            (this.Tips = {}),
            (this.animate = () => {
              this.config.isAnimate;
            });
        }
        setDefaultConfig(e) {
          G.copy(e, {
            isProxy: !0,
            scale: 1.5,
            offset: { x: 0, y: 2, z: 0 },
            sizeAttenuation: !0,
            mtl: { depthTest: !0, depthWrite: !1 },
            tips: {
              scale: 1,
              visible: !1,
              center: { x: 0.5, y: 0 },
              renderOrder: 999,
              colors: ["#D7AA00", "#FFFFFF", "#1CC515", "#C81700"],
              fontSize: [52, 48, 48, 38],
              fontWeight: ["normal", "normal", "normal"],
              fillTextH: [0.52, 0.52, 0.55],
              lineHeight: [1.6, 1.5],
              align: ["center", "left"],
              fontFamily: "Arial",
              padding: [28, 8],
              shadow: !1,
              shadowColor: "rgba(255, 255, 255, 0.4)",
              sdBlur: 1,
              background: !0,
              bgWidth: 1.3,
              bgColor: ["#09172A", "rgba(57, 99, 172, 0.8)"],
              bgRadius: 12,
            },
          });
        }
        disposeCompEft() {
          this.Tips = {};
        }
        compEftInit() {
          this.onListen(),
            this._triggerInnerEvent("mounted", { val: this.config.name });
        }
        onListen() {
          this.renderer.on("showTips", (e) => {
            this.chgTip(e.uuid, "visible", e.type);
          }),
            this.renderer.on("updTipPos", (e) => {
              this.updatePos(e.uuid, e.pos);
            });
        }
        addTips(e) {
          const t = G.extend(!0, {}, this.config.tips, e),
            { uuid: n, pos: i, texts: o } = t;
          if (!n || this.Tips[n]) return;
          const {
              scale: s,
              offset: r,
              mtl: a,
              sizeAttenuation: l,
            } = this.config,
            c = Je.initSprite(t, a, l);
          (c.name = "tips-" + n),
            (c.userData.offset = r),
            o && Je.updateTxue(c, o, s),
            i && ((c.userData.pos = i), c.position.copy(i).add(r)),
            (this.Tips[n] = c),
            this.group.add(c);
        }
        updatePos(e, t) {
          const n = this.Tips[e];
          n &&
            ((n.userData.pos = t), n.position.copy(t).add(this.config.offset));
        }
        updateTexts(e, t) {
          const n = this.Tips[e];
          n && Je.updateTxue(n, t, this.config.scale);
        }
        chgTip(e, t, n) {
          const i = this.Tips[e];
          if (!i) return;
          const { scale: o } = this.config;
          switch (((i.userData.params[t] = n), t)) {
            case "scale":
              Je.nodeScale(i, o);
              break;
            case "visible":
            case "center":
            case "renderOrder":
              Je.nodeCommon(i, t);
              break;
            default:
              Je.updateTxue(i, i.userData._text, o);
          }
        }
        delTip(e) {
          const t = this.Tips[e];
          t && (G.disposeNode(t), delete this.Tips[e]);
        }
        setConfig(e, t) {
          switch (e) {
            case "add":
              this.addTips(t);
              break;
            case "pos":
              this.updatePos(t.uuid, t.pos);
              break;
            case "texts":
              this.updateTexts(t.uuid, t.texts);
              break;
            case "change":
              this.chgTip(t.uuid, t.key, t.val);
              break;
            case "delete":
              this.delTip(t.uuid);
              break;
            case "option":
              this.setOption(t);
          }
        }
        getConfig(e, t) {
          let n = null;
          switch (e) {
            case "info":
              const e = this.Tips[t.uuid];
              if (e) {
                const { _text: i, params: o } = e.userData;
                n = G.extend(!0, {}, { uuid: t.uuid, text: i, params: o });
              } else n = null;
          }
          return n;
        }
      },
      tt = {
        VShader:
          "\n        varying vec2 vUv;\n        void main() {\n            vUv = uv;\n            vec4 mP = modelViewMatrix * vec4(position, 1.0);\n            gl_Position = projectionMatrix * mP;\n        }\n    ",
        FShader:
          "\n        uniform float uTime;\n        uniform float uOpacity;\n        uniform vec3 uColor;\n\n        varying vec2 vUv;\n\n        const int NUM_STEPS = 32;\n        const float PI = 3.141592;\n        const float EPSILON\t= 1e-3;\n        #define EPSILON_NRM (0.1 / 1080.)\n\n        // sea\n        const int ITER_GEOMETRY = 3;\n        const int ITER_FRAGMENT = 5;\n        const float SEA_HEIGHT = 0.6;\n        const float SEA_CHOPPY = 4.0;\n        const float SEA_SPEED = 0.5;\n        const float SEA_FREQ = 0.16;\n        const vec3 SEA_BASE = vec3(0.0, 0.09, 0.18);\n        const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6) * 0.6;\n        #define SEA_TIME (1.0 + uTime * SEA_SPEED)\n        const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n\n        // math\n        mat3 fromEuler(vec3 ang) {\n            vec2 a1 = vec2(sin(ang.x), cos(ang.x));\n            vec2 a2 = vec2(sin(ang.y), cos(ang.y));\n            vec2 a3 = vec2(sin(ang.z), cos(ang.z));\n            mat3 m;\n            m[0] = vec3(a1.y*a3.y+a1.x*a2.x*a3.x,a1.y*a2.x*a3.x+a3.y*a1.x,-a2.y*a3.x);\n            m[1] = vec3(-a2.y*a1.x,a1.y*a2.y,a2.x);\n            m[2] = vec3(a3.y*a1.x*a2.x+a1.y*a3.x,a1.x*a3.x-a1.y*a3.y*a2.x,a2.y*a3.y);\n            return m;\n        }\n        float hash( vec2 p ) {\n            float h = dot(p,vec2(127.1,311.7));\n            return fract(sin(h)*43758.5453123);\n        }\n        float noise( in vec2 p ) {\n            vec2 i = floor( p );\n            vec2 f = fract( p );\n            vec2 u = f*f*(3.0-2.0*f);\n            return -1.0+2.0*mix( mix( hash( i + vec2(0.0,0.0) ),\n                            hash( i + vec2(1.0,0.0) ), u.x),\n                        mix( hash( i + vec2(0.0,1.0) ),\n                            hash( i + vec2(1.0,1.0) ), u.x), u.y);\n        }\n\n        // lighting\n        float diffuse(vec3 n,vec3 l,float p) {\n            return pow(dot(n,l) * 0.4 + 0.6,p);\n        }\n        float specular(vec3 n,vec3 l,vec3 e,float s) {\n            float nrm = (s + 8.0) / (PI * 8.0);\n            return pow(max(dot(reflect(e,n),l),0.0),s) * nrm;\n        }\n\n        // sky\n        vec3 getSkyColor(vec3 e) {\n            e.y = (max(e.y,0.0)*0.8+0.2)*0.8;\n            return vec3(pow(1.0-e.y,2.0), 1.0-e.y, 0.6+(1.0-e.y)*0.4) * 1.1;\n        }\n\n        // sea\n        float sea_octave(vec2 uv, float choppy) {\n            uv += noise(uv);\n            vec2 wv = 1.0-abs(sin(uv));\n            vec2 swv = abs(cos(uv));\n            wv = mix(wv,swv,wv);\n            return pow(1.0-pow(wv.x * wv.y,0.65),choppy);\n        }\n\n        float map(vec3 p) {\n            float freq = SEA_FREQ;\n            float amp = SEA_HEIGHT;\n            float choppy = SEA_CHOPPY;\n            vec2 uv = p.xz; uv.x *= 0.75;\n\n            float d, h = 0.0;\n            for(int i = 0; i < ITER_GEOMETRY; i++) {\n                d = sea_octave((uv+SEA_TIME)*freq,choppy);\n                d += sea_octave((uv-SEA_TIME)*freq,choppy);\n                h += d * amp;\n                uv *= octave_m; freq *= 1.9; amp *= 0.22;\n                choppy = mix(choppy,1.0,0.2);\n            }\n            return p.y - h;\n        }\n\n        float map_detailed(vec3 p) {\n            float freq = SEA_FREQ;\n            float amp = SEA_HEIGHT;\n            float choppy = SEA_CHOPPY;\n            vec2 uv = p.xz; uv.x *= 0.75;\n\n            float d, h = 0.0;\n            for(int i = 0; i < ITER_FRAGMENT; i++) {\n                d = sea_octave((uv+SEA_TIME)*freq,choppy);\n                d += sea_octave((uv-SEA_TIME)*freq,choppy);\n                h += d * amp;\n                uv *= octave_m; freq *= 1.9; amp *= 0.22;\n                choppy = mix(choppy,1.0,0.2);\n            }\n            return p.y - h;\n        }\n\n        vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n            float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n            fresnel = min(fresnel * fresnel * fresnel, 0.5);\n\n            vec3 reflected = getSkyColor(reflect(eye, n));\n            vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n\n            vec3 color = mix(refracted, reflected, fresnel);\n\n            float atten = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n            color += SEA_WATER_COLOR * (p.y - SEA_HEIGHT) * 0.18 * atten;\n\n            color += specular(n, l, eye, 60.0);\n\n            return color;\n        }\n\n        // tracing\n        vec3 getNormal(vec3 p, float eps) {\n            vec3 n;\n            n.y = map_detailed(p);\n            n.x = map_detailed(vec3(p.x+eps,p.y,p.z)) - n.y;\n            n.z = map_detailed(vec3(p.x,p.y,p.z+eps)) - n.y;\n            n.y = eps;\n            return normalize(n);\n        }\n\n        float heightMapTracing(vec3 ori, vec3 dir, out vec3 p) {\n            float tm = 0.0;\n            float tx = 1000.0;\n            float hx = map(ori + dir * tx);\n            if(hx > 0.0) {\n                p = ori + dir * tx;\n                return tx;\n            }\n            float hm = map(ori);\n            for(int i = 0; i < NUM_STEPS; i++) {\n                float tmid = mix(tm, tx, hm / (hm - hx));\n                p = ori + dir * tmid;\n                float hmid = map(p);\n                if(hmid < 0.0) {\n                    tx = tmid;\n                    hx = hmid;\n                } else {\n                    tm = tmid;\n                    hm = hmid;\n                }\n                if(abs(hmid) < EPSILON) break;\n            }\n            return mix(tm, tx, hm / (hm - hx));\n        }\n\n        vec3 getPixel(in vec2 uv, float time) {\n            uv = uv * 2.0 - 1.0;\n            uv.x *= 16. / 9.;\n\n            // ray\n            vec3 ang = vec3(.1, 1.5, .2);\n            vec3 ori = vec3(time * 0.3, 3.5, time);\n            vec3 dir = normalize(vec3(uv.xy,-2.0)); dir.z += length(uv) * 0.14;\n            dir = normalize(dir) * fromEuler(ang);\n\n            // tracing\n            vec3 p;\n            heightMapTracing(ori, dir, p);\n            vec3 dist = p - ori;\n            vec3 n = getNormal(p, dot(dist,dist) * EPSILON_NRM);\n            vec3 light = normalize(vec3(0.0,1.0,0.8));\n\n            // color\n            return mix(\n                getSkyColor(dir),\n                getSeaColor(p, n, light, dir, dist),\n                pow(smoothstep(0.0,-0.02,dir.y),0.2));\n        }\n\n        void main() {\n            vec3 color = getPixel(vUv, uTime * 0.4);\n            gl_FragColor = vec4(pow(color * uColor, vec3(0.45)), uOpacity);\n        }\n    ",
      };
    const nt = {
      scale: 1,
      color: "#ffffff",
      fontSize: 54,
      fontWeight: "normal",
      fontFamily: "Arial",
      padding: [8, 8],
      fillTextH: 0.52,
      shadow: !0,
      shadowBlur: 1,
      shadowColor: "#000",
      __test: !1,
    };
    class it {
      constructor(e = {}) {
        this.config = G.extend(!0, {}, nt, e);
      }
      getSprite(e = {}) {
        const {
            depthWrite: t = !0,
            sizeAttenuation: n = !0,
            opacity: i = 1,
            renderOrder: o = 10,
          } = e,
          s = new THRDev3.Sprite(
            G.mtl.sprite({
              transparent: !0,
              depthWrite: t,
              opacity: i,
              sizeAttenuation: n,
            })
          );
        return (
          (s.name = "area-text-sprite"),
          (s.renderOrder = o),
          (s.userData.params = e),
          s
        );
      }
      updateTxue(e, t, n = {}) {
        if (!e.material) return;
        let i;
        this.config = G.extend(!0, {}, this.config, n);
        const { map: o, sizeAttenuation: s } = e.material;
        o
          ? ((i = o.image), o.dispose())
          : (i = document.createElementNS(
              "http://www.w3.org/1999/xhtml",
              "canvas"
            ));
        const r = this.canvasTxue(i, t);
        e.material.map = r;
        const a = s ? 0.1 : 25e-5;
        e.scale.copy(r._scale).multiplyScalar(this.config.scale * a);
      }
      getTextTxue(e) {
        let t = document.createElementNS(
          "http://www.w3.org/1999/xhtml",
          "canvas"
        );
        const n = this.setCanvas(t, e),
          i = new THRDev3.Texture(t);
        return (i.needsUpdate = !0), (i._scale = n), (t = null), i;
      }
      canvasTxue(e, t) {
        const n = this.setCanvas(e, t),
          i = new THRDev3.CanvasTexture(e);
        return (i._scale = n), (e = null), i;
      }
      setCanvas(e, t) {
        const { ctx: n, cvsInfo: i, scale: o } = this.initContext(e, t);
        return (
          this.setShadow(n), this.setText(n, t, i), this.outLineTest(n, i), o
        );
      }
      initContext(e, t) {
        const n = e.getContext("2d"),
          i = this.getCvsInfo(n, t),
          { w: o, h: s } = i;
        (e.width = o), (e.height = s), n.clearRect(0, 0, o, s);
        return { ctx: n, cvsInfo: i, scale: { x: o, y: s, z: 1 } };
      }
      getCvsInfo(e, t) {
        if (!t) return { w: 1, h: 1 };
        const { fontSize: n, padding: i = [8, 8] } = this.config,
          o = `${n}px ${this.config.fontFamily}`;
        e.font = "bold " + o;
        const [s, r] = [e.measureText(t).width, n],
          [a, l] = [this.powerOfTwo(s + i[1]), this.powerOfTwo(r + i[0])];
        return {
          w: a,
          h: l,
          tw: s,
          th: r,
          font: `${this.config.fontWeight} ${o}`,
        };
      }
      setShadow(e) {
        const { shadow: t, shadowBlur: n, shadowColor: i } = this.config;
        t && ((e.shadowBlur = n), (e.shadowColor = i));
      }
      setText(e, t, n) {
        if (!t) return;
        const i = this.linearGradient(e, n);
        (e.font = n.font),
          (e.textAlign = "center"),
          (e.textBaseline = "middle"),
          (e.fillStyle = i),
          e.fillText(t, 0.5 * n.w, n.h * this.config.fillTextH);
      }
      linearGradient(e, t) {
        const { color: n } = this.config;
        if (!G.isArray(n)) return n;
        const i = n.length - 1;
        if (i <= 0) return n[0] || "#fff";
        const { h: o, th: s } = t,
          r = 0.5 * (o - s),
          a = e.createLinearGradient(0, r, 0, r + s);
        for (let e = 0; e <= i; e++) a.addColorStop(e / i, n[e]);
        return a;
      }
      outLineTest(e, t) {
        this.config.__test &&
          ((e.strokeStyle = "#000"), e.strokeRect(0, 0, t.w, t.h));
      }
      powerOfTwo(e) {
        return Math.max(1, THRDev3.MathUtils.ceilPowerOfTwo(e));
      }
    }
    const [ot, st, rt, at] = [
      new THRDev3.Color(),
      new THRDev3.Euler(),
      new THRDev3.Vector3(),
      new THRDev3.Quaternion(),
    ];
    var lt = {
        ...Te,
        ...{
          DARittal: Re,
          HTMap: Ve,
          HTMTool: Ue,
          HTBeam: Xe,
          HTPels: qe,
          HTPaths: Qe,
          HTTips: et,
          KJAxiss: class extends de {
            constructor(e) {
              super(e),
                z()(this, "_setting", {
                  callback: {
                    setParams() {},
                    setDistLine(e) {
                      this.group.children[4].visible = e;
                    },
                  },
                  checkList: {},
                }),
                (this.infos = { projs: {}, legends: {} }),
                (this.ballGeo = null),
                (this.planeGeo = null),
                (this.planeMtl = {}),
                (this.BaseEft = null),
                (this.textIns = new it()),
                (this.BallGrp = null),
                (this.ProjGrp = null),
                (this.LineGrp = null),
                (this.eventObj = null),
                (this.Amts = {}),
                (this.Datas = []),
                (this.animate = (e, t) => {
                  this.config.isAnimate && this.panelAmts(e, t);
                });
            }
            setDefaultConfig(e) {
              G.copy(e, {
                isProxy: !0,
                helper: !1,
                position: { x: 0, y: 0, z: 0 },
                rotation: { x: 0, y: 0, z: 0 },
                scale: { x: 1, y: 1, z: 1 },
                textOpts: {
                  scale: 0.6,
                  color: "#B5D1FF",
                  fontSize: 50,
                  fontWeight: "normal",
                  shadow: !0,
                  shadowBlur: 1,
                  shadowColor: "#B5D1FF",
                  oftY: 2,
                },
                xAxis: {
                  step: 10,
                  color: "#88F0EE",
                  count: 5,
                  texts: ["A", "B", "C", "D", "E"],
                  models: ["x01", "x02", "x03", "x04", "x05"],
                  modelSize: 1,
                  modelOftY: 1,
                },
                zAxis: {
                  step: 10,
                  color: "#F6B501",
                  count: 5,
                  texts: ["A", "B", "C", "D", "E"],
                  models: ["z01", "z02", "z03", "z04", "z05"],
                  modelSize: 1,
                  modelOftY: 1,
                },
                yAxis: { step: 10, color: "#D9EBFF", count: 4 },
                grid: { show: !0, color: "rgba(101, 146, 187, 0.8)" },
                legend: {
                  colors: [
                    "#DEDEDE",
                    "#13EBF0",
                    "#5201FC",
                    "#0585FE",
                    "#FFA000",
                  ],
                  visibls: [!0, !0, !0, !0, !0],
                },
                datas: [],
                base: {
                  oftY: -0.06,
                  color: "rgba(47, 123, 182, 0.65)",
                  lines: "rgba(118, 159, 196, 0.5)",
                  height: 3,
                  effect: !0,
                  speed: 1,
                },
                busi: {
                  ballSize: 1,
                  ballColor: "#6A6A6A",
                  ringSize: 1.1,
                  ringColor: "rgba(60, 80, 155, 0.3)",
                  lineGap: 0.5,
                  lineType: 0,
                  lineColor: "rgba(90, 86, 182, 0.6)",
                  planeTxue: "point2",
                  planeSize: 1,
                  projFace: "xy",
                  expandTime: 1.5,
                },
              });
            }
            disposeCompEft() {
              (this.infos = null),
                (this.ballGeo = null),
                (this.planeGeo = null),
                (this.planeMtl = null),
                (this.BaseEft = null),
                (this.Amts = null),
                (this.Datas = null),
                (this.textIns = null),
                (this.BallGrp = null),
                (this.ProjGrp = null),
                (this.LineGrp = null),
                (this.eventObj = null);
            }
            compEftInit() {
              const { position: e, rotation: t, scale: n } = this.config;
              this.group.scale.copy(n),
                this.group.position.copy(e),
                this.group.rotation.setFromVector3(t),
                (this.BallGrp = G.group("balls")),
                (this.ProjGrp = G.group("projBalls")),
                (this.LineGrp = G.group("lines")),
                this.group.add(this.BallGrp, this.ProjGrp, this.LineGrp),
                this.creatAxiss(),
                this.updateData(this.config.datas),
                this._triggerInnerEvent("mounted", { val: this.config.name });
            }
            clearBalls() {
              const [e, t] = [
                this.BallGrp.children.length,
                this.ProjGrp.children.length,
              ];
              for (let t = e - 1; t >= 0; t--) {
                const e = this.BallGrp.children[t];
                G.deleteMaterial(e),
                  G.deleteUserData(e),
                  G.deleteMaterial(e.children[0]),
                  e.clear(),
                  e.removeFromParent();
                const n = this.LineGrp.children[t];
                G.deleteGeometry(n),
                  G.deleteMaterial(n),
                  G.deleteUserData(n),
                  n.clear(),
                  n.removeFromParent();
              }
              for (let e = t - 1; e >= 0; e--) {
                const t = this.ProjGrp.children[e];
                G.deleteMaterial(t),
                  G.deleteUserData(t),
                  G.deleteMaterial(t.children[0]),
                  t.clear(),
                  t.removeFromParent();
              }
              (this.Datas = []),
                (this.eventArr = []),
                (this.infos.projs = {}),
                (this.infos.legends = {}),
                this.renderer.clearECache(!0);
            }
            updateData(e = []) {
              if ((this.clearBalls(), !e.length)) return;
              const t = {};
              e.forEach((e) => {
                const { pos: n, type: i } = e,
                  {
                    rx: o,
                    ry: s,
                    rz: r,
                    vec: a,
                    C: l,
                    V: c,
                  } = this.compVecCV(n, i),
                  h = o + "_" + s + "_" + r;
                if (t[h] || !a) return;
                (t[h] = !0), this.Datas.push(e);
                const u = this.creatBall(h, l, a, c, !1);
                (u.userData._data = e),
                  (u.userData.isBall = !0),
                  (u.userData.info = { rx: o, ry: s, rz: r }),
                  this.setInfoLeg(s, e, u, c);
                const d = this.creatLine(h, a, c, s);
                this.infos.legends[s].lines.push(d),
                  this.initProjs(o, s, r, i, u, d);
              }),
                this.handleProjes(),
                this.renderer.updateEventArr(this);
            }
            setInfoLeg(e, t, n, i) {
              const { legends: o } = this.infos;
              o[e] ||
                (o[e] = {
                  datas: [],
                  balls: [],
                  projs: [],
                  lines: [],
                  visible: !0,
                }),
                (o[e].visible = i),
                o[e].datas.push(t),
                o[e].balls.push(n);
            }
            initProjs(e, t, n, i, o, s) {
              let [r, a] = [null, null];
              switch (this.config.busi.projFace) {
                case "xy":
                  (r = e + "_" + t), (a = "z");
                  break;
                case "yz":
                  (r = t + "_" + n), (a = "x");
                  break;
                case "xz":
                  (r = e + "_" + n), (a = "y");
              }
              if (!r) return;
              const { projs: l } = this.infos;
              l[r] || (l[r] = []),
                l[r].push({
                  rx: e,
                  ry: t,
                  rz: n,
                  type: i,
                  K: r,
                  pt: a,
                  ball: o,
                  line: s,
                });
            }
            handleProjes() {
              const { projs: e } = this.infos;
              Object.keys(e).forEach((t) => {
                const { K: n, pt: i } = e[t][0],
                  { pos: o, T: s } = this.compProj(e[t]),
                  {
                    rx: r,
                    ry: a,
                    rz: l,
                    vec: c,
                    C: h,
                    V: u,
                  } = this.compVecCV(o, s),
                  d = this.creatBall(n, h, c, u, i);
                (d.userData.isProj = !0),
                  (d.userData.pt = i),
                  (d.userData.expand = !0),
                  (d.userData.info = { rx: r, ry: a, rz: l }),
                  (d.userData._data = { pos: o, T: s, K: n, pt: i }),
                  this.infos.legends[a].projs.push(d);
              });
            }
            compVecCV(e, t) {
              const {
                  XCot: n,
                  YCot: i,
                  ZCot: o,
                  XStp: s,
                  YStp: r,
                  ZStp: a,
                } = this.infos,
                [l, c, h] = [0 | e.x, 0 | e.y, 0 | e.z];
              if (l > n || c > i || h > o) return {};
              const u = rt.set(l, c, h).multiply({ x: s, y: r, z: a }),
                { C: d, V: p } = this.getCV(c, t);
              return { rx: l, ry: c, rz: h, vec: { ...u }, C: d, V: p };
            }
            getCV(e, t = !0) {
              const { colors: n, visibls: i } = this.config.legend;
              return { C: t ? n[e] : null, V: i[e] };
            }
            compProj(e) {
              let [t, n, i, o] = [0, 0, 0, !1];
              return (
                e.forEach((e) => {
                  (t = Math.max(t, e.rx)),
                    (n = e.ry),
                    (i = Math.max(i, e.rz)),
                    (o = o || e.type);
                }),
                { pos: { x: t, y: n, z: i }, T: o }
              );
            }
            creatBall(e, t, n, i, o) {
              const {
                ballSize: s,
                ballColor: r,
                ringSize: a,
                ringColor: l,
              } = this.config.busi;
              this.ballGeo || (this.ballGeo = G.geo.sphere(1, 32, 32));
              const c = G.getColorArr(t || r),
                h = new THRDev3.Mesh(
                  this.ballGeo,
                  G.mtl.phong({
                    transparent: !0,
                    specular: 16250871,
                    shininess: 600,
                    reflectivity: 0.9,
                    color: c[0],
                  })
                );
              (h.name = e),
                h.scale.setScalar(s),
                h.position.copy(n),
                (h.visible = i),
                (h._reVisible = !i),
                o && (h.position[o] = 0),
                (h.userData.opacity = 1),
                (h.userData.Sal = { ...h.scale }),
                (h.userData.pos = { ...h.position });
              const u = G.getColorArr(l),
                d = new THRDev3.Mesh(
                  this.ballGeo,
                  G.mtl.basic({
                    side: 1,
                    depthWrite: !1,
                    transparent: !0,
                    color: u[0],
                    opacity: u[1],
                  })
                );
              return (
                (h.userData.rOpacity = u[1]),
                d.scale.setScalar(1.5 * a),
                (d._reVisible = !0),
                h.add(d),
                this.eventArr.push(h),
                o ? this.ProjGrp.add(h) : this.BallGrp.add(h),
                h
              );
            }
            creatLine(e, t, n, i) {
              const { x: o, y: s, z: r } = t,
                { lineGap: a, lineType: l, lineColor: c } = this.config.busi,
                [h, u] = [G.geo.buf(), []];
              u.push(o, s, r, 0, s, r),
                u.push(o, s, r, o, 0, r),
                u.push(o, s, r, o, s, 0),
                h.setAttribute(
                  "position",
                  new THRDev3.Float32BufferAttribute(u, 3)
                );
              const d = G.getColorArr(c),
                p = {
                  color: d[0],
                  opacity: d[1],
                  transparent: !0,
                  depthWrite: !1,
                },
                f = l
                  ? G.mtl.line({ ...p })
                  : G.mtl.lineD({ dashSize: a, gapSize: a, ...p }),
                m = new THRDev3.LineSegments(h, f);
              return (
                l || m.computeLineDistances(),
                (m.name = e),
                (m.visible = n),
                this.LineGrp.add(m),
                this.creatLinePlane(m, e, t, i),
                m
              );
            }
            creatLinePlane(e, t, n, i) {
              this.initPlaneMtl(0), this.initPlaneMtl(i);
              const { planeSize: o } = this.config.busi;
              this.planeGeo || (this.planeGeo = G.geo.plane(2 * o, 2 * o));
              const s = new THRDev3.Mesh(this.planeGeo, this.planeMtl[i]),
                r = new THRDev3.Mesh(this.planeGeo, this.planeMtl[i]),
                a = new THRDev3.Mesh(this.planeGeo, this.planeMtl[0]),
                { x: l, y: c, z: h } = n;
              s.position.set(l, c, 0),
                r.position.set(0, c, h),
                a.position.set(l, 0, h),
                (r.rotation.y = G.M_PI2),
                (a.rotation.x = -G.M_PI2),
                (s.name = t + "_xy"),
                (r.name = t + "_yz"),
                (a.name = t + "_xz"),
                e.add(s, r, a);
            }
            initPlaneMtl(e) {
              if (this.planeMtl[e]) return;
              const { colors: t } = this.config.legend,
                n = G.getColorArr(t[e]);
              this.planeMtl[e] = G.mtl.basic({
                map: this.renderer.getTxue(this.config.busi.planeTxue),
                transparent: !0,
                depthWrite: !1,
                opacity: 0.5 * n[1],
                color: n[0],
              });
            }
            panelAmts(e, t) {
              if (this.BaseEft) {
                const e = t.getElapsedTime() * this.config.base.speed;
                this.BaseEft.material.uniforms.uTime.value = 0.3 * e;
              }
            }
            creatAxiss() {
              const { xAxis: e, zAxis: t, yAxis: n } = this.config,
                { step: i, count: o } = this.config.yAxis,
                s = i * o;
              this.creatAxis("X", e, s),
                this.creatAxis("Z", t, s),
                this.creatAxis("Y", n),
                this.creatGrid(),
                this.creatBase();
            }
            creatAxis(e = "X", t, n) {
              const { step: i, color: o, count: s, texts: r, models: a } = t,
                [l, c, h, u] = [rt.clone()["set" + e](1), rt.clone(), 1, 1],
                [d, p] = [i * (s + 0.75), G.getColorArr(o)[0]],
                f = new THRDev3.ArrowHelper(l, c, d, p, h, u);
              (f.name = e + "_Axis"),
                (f.renderOrder = 500),
                (f.children[0].material.depthWrite = !1),
                (this.infos[e + "Cot"] = s),
                (this.infos[e + "Stp"] = i),
                (this.infos[e + "Col"] = p),
                r && this.creatTexts(e, n, r, t),
                a && this.creatModels(e, a, t),
                this.group.add(f);
            }
            creatTexts(e, t, n, i) {
              const { step: o, count: s } = i,
                { textOpts: r } = this.config,
                a = G.group(e + "_AxisText");
              for (let i = 1; i <= s; i++) {
                const s = this.textIns.getSprite({ depthWrite: !1 });
                this.textIns.updateTxue(s, n[i - 1], r),
                  (s.position.x = "X" === e ? o * i : 0),
                  (s.position.y = t + r.oftY),
                  (s.position.z = "Z" === e ? o * i : 0),
                  a.add(s);
              }
              this.group.add(a);
            }
            creatModels(e, t, n) {
              const { step: i, count: o, modelSize: s, modelOftY: r } = n,
                a = G.group(e + "_AxisModel");
              for (let n = 1; n <= o; n++) {
                const o = this.renderer.getTxue(t[n - 1]),
                  l = new THRDev3.Sprite(
                    G.mtl.sprite({ transparent: !0, depthWrite: !1, map: o })
                  );
                (l.position.x = "X" === e ? i * n : 0),
                  (l.position.y = r),
                  (l.position.z = "Z" === e ? i * n : 0),
                  l.scale.setScalar(5 * s),
                  a.add(l);
              }
              (a.renderOrder = 400), this.group.add(a);
            }
            creatGrid() {
              const { show: e, color: t } = this.config.grid;
              if (!e) return;
              const {
                  XCot: n,
                  XStp: i,
                  XCol: o,
                  YCot: s,
                  YStp: r,
                  YCol: a,
                  ZCot: l,
                  ZStp: c,
                  ZCol: h,
                } = this.infos,
                [u, d, p] = [[], [], G.getColorArr(t)],
                [f, m, g] = [n * i, s * r, l * c];
              let v = 0;
              const y = (e, t, n, i) => {
                for (let o = 0, s = 0; o <= e; o++, s += t) {
                  i(s);
                  const e = 0 === o ? n : p[0];
                  e.toArray(d, v), (v += 3), e.toArray(d, v), (v += 3);
                }
              };
              y(n, i, a, (e) => {
                u.push(e, 0, 0, e, m, 0);
              }),
                y(s, r, o, (e) => {
                  u.push(0, e, 0, f, e, 0);
                }),
                y(s, r, h, (e) => {
                  u.push(0, e, 0, 0, e, g);
                }),
                y(l, c, a, (e) => {
                  u.push(0, 0, e, 0, m, e);
                }),
                y(l, c, o, (e) => {
                  u.push(0, 0, e, f, 0, e);
                }),
                y(n, i, h, (e) => {
                  u.push(e, 0, 0, e, 0, g);
                });
              const b = G.geo.buf();
              b.setAttribute("color", new THRDev3.Float32BufferAttribute(d, 3)),
                b.setAttribute(
                  "position",
                  new THRDev3.Float32BufferAttribute(u, 3)
                );
              const x = new THRDev3.LineSegments(
                b,
                G.mtl.line({
                  vertexColors: !0,
                  toneMapped: !1,
                  transparent: !0,
                  opacity: p[1],
                  depthWrite: !1,
                })
              );
              (x.name = "AxisGrid"), (x.renderOrder = 300), this.group.add(x);
            }
            creatBase() {
              const { oftY: e, lines: t, height: n } = this.config.base,
                { XCot: i, XStp: o, ZCot: s, ZStp: r } = this.infos,
                [a, l] = [i * o, s * r],
                c = G.group("AxisBase");
              (c.position.y = e), (c.renderOrder = 200), this.group.add(c);
              const [h, u, d, p] = [[], [], [], []];
              p.push(0, 0, 1, 0, 1, 1, 0, 1),
                d.push(0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0),
                u.push(0, 0, 0, a, 0, 0, a, 0, l, 0, 0, l);
              for (let e = 0; e < 4; e++)
                h.push(e % 3 ? a : 0, 0, e > 1 ? l : 0),
                  h.push(e % 3 ? a : 0, -n, e > 1 ? l : 0),
                  h.push(e < 2 ? a : 0, -n, e > 1 ? l : 0),
                  h.push(e % 3 ? a : 0, -n, e % 3 ? l : 0),
                  u.push(e % 3 ? a : 0, 0, e > 1 ? l : 0),
                  u.push(e % 3 ? a : 0, -n, e > 1 ? l : 0),
                  d.push(0, -1, 0, 0, -1, 0),
                  p.push(e % 2, 0, e % 2, 0.2);
              const f = G.geo.buf();
              f.setAttribute(
                "position",
                new THRDev3.Float32BufferAttribute(h, 3)
              );
              const m = G.getColorArr(t),
                g = new THRDev3.LineSegments(
                  f,
                  G.mtl.line({
                    toneMapped: !1,
                    transparent: !0,
                    color: m[0],
                    opacity: m[1],
                    depthWrite: !1,
                  })
                );
              (g.name = "AxisBase_line"),
                c.add(g),
                p.push(0, 0, 0, 0.2),
                d.push(0, -1, 0, 0, -1, 0),
                u.push(0, 0, 0, 0, -n, 0),
                this.creatEft(c, u, d, p);
            }
            creatEft(e, t, n, i) {
              const { color: o, effect: s } = this.config.base,
                r = G.geo.buf(),
                [a, l] = [[0, 3, 1, 1, 3, 2], 4];
              for (let e = 0; e < 4; e++) {
                const t = l + 2 * e + 1;
                a.push(t - 1, t, t + 1, t + 1, t, t + 2);
              }
              r.setIndex(a),
                r.setAttribute("uv", new THRDev3.Float32BufferAttribute(i, 2)),
                r.setAttribute(
                  "normal",
                  new THRDev3.Float32BufferAttribute(n, 3)
                ),
                r.setAttribute(
                  "position",
                  new THRDev3.Float32BufferAttribute(t, 3)
                );
              const c = G.getColorArr(o),
                h = { side: 2, depthWrite: !1, transparent: !0 },
                u = s
                  ? G.mtl.shader({
                      uniforms: {
                        uTime: { value: 0 },
                        uOpacity: { value: c[1] },
                        uColor: {
                          value: new THRDev3.Vector3(c[0].r, c[0].g, c[0].b),
                        },
                      },
                      ...h,
                      vertexShader: tt.VShader,
                      fragmentShader: tt.FShader,
                    })
                  : G.mtl.phong({ color: c[0], opacity: c[1], ...h }),
                d = new THRDev3.Mesh(r, u);
              (this.BaseEft = s ? d : null),
                (d.name = "AxisBase_eft"),
                e.add(d);
            }
            onMouseOut(e) {
              return (
                this.eventObj &&
                  this.eventObj.scale.copy(this.eventObj.userData.Sal),
                (this.eventObj = null),
                [e, null]
              );
            }
            onMouseIn(e, t) {
              const [n] = t;
              if (!n) return [e, null];
              const { object: i } = n;
              return (
                this.eventObj !== i &&
                  (this.eventObj &&
                    this.eventObj.scale.copy(this.eventObj.userData.Sal),
                  i.scale.copy(i.userData.Sal).multiplyScalar(1.1),
                  (this.eventObj = i)),
                [e, i.name, { ...i.userData._data }]
              );
            }
            onMouseDown(e, t) {
              const [n] = t;
              if (!n) return [e, null];
              const { object: i } = n;
              return i.userData.isProj
                ? (this.changeExpand(i.name, i), [e, null])
                : [e, i.name, { ...i.userData._data }];
            }
            changeExpand(e, t) {
              const { expandTime: n } = this.config.busi,
                i = this.infos.projs[e],
                { expand: o, pos: s, pt: r } = t.userData;
              t.userData.expand = !o;
              const a = this._TWEEN;
              a.getAll().forEach((e) => {
                e._isExpand && a.remove(e);
              });
              const l = new a.Tween({ idx: 0 })
                .to({ idx: 1 }, 1e3 * n)
                .easing(G.getEasing("Quadratic.InOut"))
                .onUpdate((e) => {
                  const t = o ? 1 - e : e ** 0.4;
                  i.forEach((n) => {
                    const { ball: i, line: a } = n,
                      l = o ? s : i.userData.pos;
                    (i._reVisible = o),
                      i.position.lerp(l, e),
                      (i.material.opacity = t * i.userData.opacity),
                      (i.children[0].material.opacity =
                        t * i.userData.rOpacity),
                      (a.scale[r] = i.position[r] / i.userData.pos[r]);
                  });
                })
                .onComplete(() => {});
              l.start(), (l._isExpand = !0);
            }
            changeLegend(e, t) {
              if (!this.infos.legends[e]) return;
              const { balls: n, projs: i, lines: o } = this.infos.legends[e];
              n.forEach((e, n) => {
                (e.visible = t), (e._reVisible = !t), (o[n].visible = t);
              }),
                i.forEach((e) => {
                  (e.visible = t), (e._reVisible = !t);
                }),
                (this.infos.legends[e].visible = t);
            }
            setConfig(e, t) {
              switch (e) {
                case "data":
                  this.updateData(t.datas);
                  break;
                case "legend":
                  this.changeLegend(t.idx, t.type);
                  break;
                case "option":
                  this.setOption(t);
              }
            }
            getConfig(e, t) {
              let n = null;
              switch (e) {
                case "info":
                  n = G.extend(!0, {}, this.Datas);
              }
              return n;
            }
          },
        },
      },
      ct = n(9);
    class ht {
      constructor(e = {}) {
        (this.pane = null),
          (this.config = null),
          this.setDftConfig(e),
          this.init();
      }
      setDftConfig(e) {
        this.config = G.copy(
          {
            creat: !1,
            document: null,
            title: null,
            expanded: !0,
            height: null,
          },
          e
        );
      }
      init() {
        const { creat: e, document: t, title: n, expanded: i } = this.config;
        e &&
          ((this.pane = new ct.Pane({ container: t, title: n, expanded: i })),
          this.createScrollStyle());
      }
      dispose() {
        this.pane && this.pane.dispose(), (this.pane = null);
      }
      refresh() {
        this.pane && this.pane.refresh();
      }
      add(e) {
        this.pane && this.pane.add(e);
      }
      addFolder(e) {
        return this.pane ? this.pane.addFolder(e) : null;
      }
      remove(e) {
        e && e.dispose && e.dispose();
      }
      removeAll() {
        this.pane &&
          this.pane.children.forEach((e) => {
            e.dispose();
          });
      }
      createScrollStyle() {
        const e = document.createElement("style");
        (e.innerHTML =
          "\n    ::-webkit-scrollbar {\n        z-index: 50;\n        width: 4px;\n        height: 3px;\n    }\n\n    ::-webkit-scrollbar-track {\n        background-color: rgba(0, 0, 0, 0);\n    }\n\n    ::-webkit-scrollbar-thumb {\n        -webkit-border-radius: 2px;\n        -moz-border-radius: 2px;\n        border-radius: 2px;\n        background-color: #00957b;\n        transition: all .2s;\n        height: 20px;\n        border: 1px solid #00957b;\n    }\n\n    :hover::-webkit-scrollbar-thumb {\n        transition: all .2s;\n    }\n\n    ::-webkit-scrollbar-button {\n        display: none;\n    }\n\n    ::-webkit-scrollbar-corner {\n        display: none;\n    }\n"),
          document.head.appendChild(e);
      }
    }
    let ut = 0;
    class dt extends de {
      constructor(e) {
        super(e), (this.PANE = null), (this.animate = () => {});
      }
      setDefaultConfig(e) {
        G.copy(e, {
          pane: {
            creat: !1,
            dom: null,
            domStyle: "",
            title: null,
            expanded: !0,
            height: null,
          },
          _ins: !1,
          _render: !1,
          _testing: !1,
        });
      }
      disposeCompEft() {
        this.PANE.dispose();
      }
      compEftInit() {
        this.testing(),
          this.initPane(),
          this.mountRender(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      testing() {
        if (!this.config._testing) return;
        const e = new THRDev3.Mesh(
          G.geo.box(10, 10, 10),
          G.mtl.phong({ color: 14531154, transparent: !0, opacity: 1 })
        );
        (e.castShadow = !0), (e.position.y = 20), this.group.add(e);
        const t = new THRDev3.Mesh(
          G.geo.plane(300, 300),
          G.mtl.phong({ color: 14606046 })
        );
        (t.receiveShadow = !0),
          (t.rotation.x = 0.5 * -Math.PI),
          (t.position.y = 1),
          this.group.add(t);
      }
      mountRender() {
        this.renderer._Busies = (e, t) => {
          let n = null;
          switch (e) {
            case "pane":
            case "singleLight":
              n = this.getConfig(e, t);
              break;
            case "busis":
              n = this;
              break;
            case "pointLight":
            case "spotLight":
            case "jumpTo":
              this.setConfig(e, t);
          }
          return n;
        };
      }
      initPane() {
        const { pane: e } = this.config,
          { dom: t, domStyle: n } = e;
        let i;
        if ("renderer" !== t) i = G.isDomElement(t) ? t : null;
        else {
          const e = "position: absolute; top: 6px; right: 6px; width: 280px;";
          (i = document.createElement("div")),
            (i.style = n || e),
            (i.id = "render_pane"),
            this.renderer.parentCont.appendChild(i);
        }
        (e.document = i), (this.PANE = new ht(e));
      }
      getPLight(e) {
        const {
            color: t,
            intensity: n,
            distance: i = 100,
            decay: o = 1.6,
            position: s,
            shadow: r,
            shadowPms: a = {},
            isHelper: l,
            sSize: c = 1,
          } = e,
          h = G.getColorArr(t),
          u = new THRDev3.PointLight(h[0], n, i, o);
        if ((u.position.copy(s), r)) {
          const { size: e = 1024, near: t = 1 } = a;
          (u.castShadow = r),
            u.shadow.mapSize.set(e, e),
            (u.shadow.camera.near = t),
            (u.shadow.camera.far = i);
        }
        if (((u.name = "Ani_pointLight_" + ut), this.group.add(u), l)) {
          const e = new THRDev3.PointLightHelper(u, c);
          (e.name = "Ani_pointLight_helper_" + ut),
            (u.userData.Helper = e),
            this.rwHelperDispose(e),
            this.group.add(e);
        }
        return ut++, u;
      }
      addPointLight(e) {
        const {
            color: t,
            intensity: n,
            distance: i = 100,
            decay: o = 1.6,
            positions: s = [],
            shadows: r = [],
            shadowPms: a = {},
            intensitys: l = [],
            isHelper: c,
            sSize: h = 1,
          } = e,
          u = G.getColorArr(t);
        s.forEach((e, t) => {
          const s = l[t] || n,
            d = new THRDev3.PointLight(u[0], s, i, o);
          d.position.copy(e);
          const p = r[t] || !1;
          if (p) {
            const { size: e = 1024, near: t = 1 } = a;
            (d.castShadow = p),
              d.shadow.mapSize.set(e, e),
              (d.shadow.camera.near = t),
              (d.shadow.camera.far = i);
          }
          if (((d.name = "PointLight_" + t), this.group.add(d), !c)) return;
          const f = new THRDev3.PointLightHelper(d, h);
          (f.name = "PointLight_helper_" + t),
            (d.userData.Helper = f),
            this.rwHelperDispose(f),
            this.group.add(f);
        });
      }
      addSpotLight(e) {
        const {
            color: t,
            intensity: n,
            distance: i = 100,
            angle: o = 0.5,
            penumbra: s = 0.2,
            decay: r = 1.6,
            positions: a = [],
            targets: l = [],
            shadows: c = [],
            shadowPms: h = {},
            intensitys: u = [],
            isHelper: d,
          } = e,
          p = G.getColorArr(t);
        a.forEach((e, t) => {
          const a = u[t] || n,
            f = new THRDev3.SpotLight(p[0], a, i, o, s, r);
          f.position.copy(e);
          const m = c[t] || !1;
          if (m) {
            const { size: e = 1024, near: t = 1, focus: n = 1 } = h;
            (f.castShadow = m),
              f.shadow.mapSize.set(e, e),
              (f.shadow.camera.near = t),
              (f.shadow.camera.far = i),
              (f.shadow.focus = n);
          }
          (f.name = "SpotLight_" + t), this.group.add(f);
          const g = new THRDev3.Object3D();
          g.name = "SpotLight_target_" + t;
          const v = l[t] || { x: e.x, y: 0, z: e.z };
          if ((g.position.copy(v), (f.target = g), this.group.add(g), !d))
            return;
          const y = new THRDev3.SpotLightHelper(f);
          (y.name = "SpotLight_helper_" + t),
            (f.userData.Helper = y),
            this.rwHelperDispose(y),
            this.group.add(y);
        });
      }
      rwHelperDispose(e) {
        e.dispose = () => {
          (e.light = null), (e.cone = null);
        };
      }
      jumpCamera(e) {
        const t = this._TWEEN,
          { camera: n, controls: i } = this.renderer,
          {
            camera: o,
            target: s,
            time: r = 1500,
            easing: a = "Quadratic.InOut",
            callback: l,
          } = e;
        if (!o || !s) return;
        t.getAll().forEach((e) => {
          e._isJump && t.remove(e);
        });
        const c = new t.Tween({ idx: 0 })
          .to({ idx: 1 }, r)
          .easing(G.getEasing(a))
          .onUpdate((e) => {
            n.position.lerp(o, e),
              i.target.lerp(s, e),
              this.renderer._triggerInnerEvent("updatePointSize"),
              this.renderer.setCameraNear();
          })
          .onComplete(() => {
            l && l();
          });
        c.start(), (c._isJump = !0);
      }
      getSceneImage(e) {
        const { scene: t, camera: n, renderer: i } = this.renderer;
        i.render(t, n);
        const o = i.domElement.toDataURL("image/png");
        return e
          ? (((e) => {
              const t = document.createElement("a");
              document.body.appendChild(t),
                (t.href = e),
                (t.download = "map.png"),
                t.click(),
                t.remove();
            })(o),
            null)
          : o;
      }
      setConfig(e, t) {
        switch (e) {
          case "pointLight":
            this.addPointLight(t);
            break;
          case "spotLight":
            this.addSpotLight(t);
            break;
          case "config":
            G.copy(this.config, t);
            break;
          case "jumpTo":
            this.jumpCamera(t);
        }
      }
      getConfig(e, t) {
        let n = null;
        switch (e) {
          case "transCoord":
            n = G.transCoord(_V3.clone().copy(t.pos), this.renderer);
            break;
          case "pane":
            n = this.PANE;
            break;
          case "singleLight":
            n = this.getPLight(t);
            break;
          case "sceneImg":
            n = this.getSceneImage(t.isDown);
            break;
          case "_ins":
            n = this.config._ins ? this : null;
            break;
          case "_render":
            n = this.config._render ? this.renderer : null;
            break;
          case "_getIns":
            n = this.config._render ? this.renderer._getIns(t.key) : null;
        }
        return n;
      }
    }
    dt.description = "业务功能 - 公共业务";
    var pt = dt;
    const [ft, mt, gt, vt, yt] = [
      new THRDev3.Euler(),
      new THRDev3.Vector3(),
      new THRDev3.Quaternion(),
      new THRDev3.Matrix4(),
      { x: 1, y: 0, z: 0 },
    ];
    var bt = class extends de {
      constructor(e) {
        super(e),
          (this.Paths = {}),
          (this.PathIds = []),
          (this.stopAll = !1),
          (this.testNode = null),
          (this.testHelper = null),
          (this.animate = (e, t) => {
            this.config.isAnimate && this.PathAmts(e, t);
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          common: { scale: 1, multi: 3, duration: 0.004 },
          base: {
            speed: 1,
            easing: "Linear.None",
            delay: 0,
            pause: 0,
            loop: 0,
            loopNext: !0,
            reverse: !1,
            dirGap: 5,
            offset: { x: 0, y: 0, z: 0 },
            rotate: { x: 0, y: 0, z: 0 },
          },
          links: { isLink: !1, speed: 5, delay: 0, easing: "Linear.None" },
          paths: [],
          helper: {
            create: !1,
            dashSize: 0.5,
            colors: ["#FF0000", "#0000FF", "#FF9500"],
            density: 1,
          },
          binds: {
            type: "other",
            node: null,
            offset: 0,
            exceed: 0,
            rotate: { x: 0, y: 0, z: 0 },
          },
          testing: {
            colors: ["#4AFF00", "#000FFF"],
            scale: { x: 1, y: 1, z: 1 },
          },
        });
      }
      disposeCompEft() {
        (this.Paths = null), (this.testNode = null), (this.testHelper = null);
      }
      compEftInit() {
        this.initTesting(),
          this.initPaths(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      initTesting() {
        const { colors: e, scale: t } = this.config.testing,
          n = this.renderer.camera.clone(),
          i = new THRDev3.CameraHelper(n);
        (i.name = "testing_camera_helper"),
          (i.visible = !1),
          (this.testHelper = i),
          this.group.add(i);
        const o = G.group("testing_group");
        o.scale.copy(t),
          (o.visible = !1),
          (this.testNode = o),
          this.group.add(o);
        const s = new THRDev3.LatheGeometry(void 0, 4),
          r = G.getColorArr(e[0]),
          a = new THRDev3.Mesh(
            s,
            G.mtl.basic({ color: r[0], opacity: 0.5 * r[1], transparent: !0 })
          );
        (a.rotation.x = 1.570796),
          a.scale.set(1, 10, 1),
          (a.renderOrder = 9999);
        const l = new THRDev3.WireframeGeometry(s);
        a.add(new THRDev3.LineSegments(l));
        const c = G.getColorArr(e[1])[0],
          h = new THRDev3.LineSegments(
            G.geo
              .buf()
              .setFromPoints([
                new THRDev3.Vector3(),
                new THRDev3.Vector3(0, 0, 500),
              ]),
            G.mtl.line({ color: c })
          );
        (h.renderOrder = 9999), o.add(a, h);
      }
      PathAmts(e) {
        this.stopAll ||
          this.PathIds.forEach((t) => {
            const n = this.Paths[t];
            switch (n.state) {
              case "run":
                this.setRunning(n, e);
                break;
              case "pause":
                this.setPause(n, e);
                break;
              case "stop":
                this.setStop(n);
                break;
              case "test":
                this.setTestAmt(n, e);
            }
          });
      }
      setRunning(e, t) {
        const { nodes: n, amt: i, params: o, time: s } = e;
      }
      setLinks(e) {}
      setPause(e, t) {}
      setStop(e) {}
      setTestAmt(e, t) {
        if (!this.testNode) return;
        const { amt: n, time: i, params: o } = e,
          { tr: s } = n;
        if (s > i) return;
        const { k: r, idx: a } = this.getKAndI(s, e),
          { pos: l, tgt: c } = this.getPosTgt(a, e);
        (this.testNode.visible = !0),
          this.setPosRot(this.testNode, l, c, e),
          (n.tr += t * o.base.speed),
          n.tr < i || console.log(e);
      }
      getKAndI(e, t) {
        const { time: n, count: i, params: o } = t,
          { easing: s, reverse: r } = o.base,
          a = e / n,
          l = G.easing(r ? 1 - a : a, s);
        return { k: l, idx: (l * i) | 0 };
      }
      getPosTgt(e, t) {
        const { vecs: n, targs: i, params: o } = t,
          { dirGap: s, offset: r } = o.base;
        return { pos: n[e].clone().add(r), tgt: this.getTargi(i, n, e, s) };
      }
      setPosRot(e, t, n, i) {
        e.position.copy(t), this.setRote(e, t, n, i);
      }
      setRote(e, t, n, i) {
        const { rotate: o } = i.params.base;
        vt.lookAt(n, t, e.up),
          gt.setFromEuler(ft.setFromVector3(o)),
          e.quaternion.setFromRotationMatrix(vt).multiply(gt);
      }
      initPaths() {
        const { paths: e } = this.config;
        e &&
          e.length &&
          e.forEach((e) => {
            this.addPath(e);
          });
      }
      addPath(e) {
        const t = this.handleOpts(e),
          { id: n, lineType: i, vectors: o, targets: s } = t;
        !n ||
          !o ||
          o.length < 2 ||
          ((this.Paths[n] = {
            params: t,
            state: "test",
            amt: { tr: 0, dtr: 0, ptr: 0, li: 0, ltr: 0, ai: 0 },
            nodes: null,
            _curve: null,
            _helper: null,
          }),
          (this.PathIds = Object.keys(this.Paths)),
          this.creatPath(o, s, i, n),
          console.log(this, this.Paths[n]));
      }
      handleOpts(e) {
        const { base: t, links: n } = this.config;
        return G.extend(!0, {}, e, {
          lineType: !0,
          base: t,
          links: n,
          vectors: [],
          targets: [],
        });
      }
      creatPath(e, t, n, i) {
        const { curve: o, Arr: s, len: r, time: a } = this.getCurve(e, n),
          { curve: l, Arr: c } = this.getCurve(t, n),
          h = o.getSpacedPoints(r),
          u = l ? l.getSpacedPoints(r) : c,
          [d, p] = [h.length - 1, Math.min(2, u.length)];
        this.setObjs(i, {
          vecs: h,
          targs: u,
          count: d,
          tType: p,
          time: a,
          _curve: { vCurve: o, tCurve: l },
        }),
          this.pathHelper(i, s, c);
      }
      getCurve(e, t) {
        const { scale: n, multi: i, duration: o } = this.config.common,
          [s, r] = [e.length, []];
        for (let t = 0; t < s; t++) r.push(mt.copy(e[t]).clone());
        if (s < 2) return { curve: null, Arr: r };
        const a = t ? "centripetal" : "catmullrom",
          l = new THRDev3.CatmullRomCurve3(r, !1, a, 0),
          c = ((Math.max(s, l.getLength()) * i) / n) | 0;
        return { curve: l, Arr: r, len: c, time: c * o };
      }
      pathHelper(e, t, n) {
        const { create: i, density: o } = this.config.helper;
        if (!i) return;
        const { vecs: s, targs: r, count: a } = this.Paths[e],
          l = G.group("path_helper_" + e);
        if (
          ((this.Paths[e]._helper = l),
          this.group.add(l),
          l.add(this.helperLine(t, "line", 0)),
          l.add(this.helperLine(s, "curve", 0)),
          r.length >= 2 &&
            (l.add(this.helperLine(n, "line", 1)),
            l.add(this.helperLine(r, "curve", 1))),
          !o)
        )
          return;
        const { dirGap: c } = this.Paths[e].params.base,
          [h, u] = [[], (10 / o) | 0];
        for (let e = 0; e <= a; e += u)
          h.push(s[e]), h.push(this.getTargi(r, s, e, c));
        (a / u) % 1 < 0.7 && (h.push(s[a]), h.push(this.getTargi(r, s, a, c))),
          l.add(this.helperLine(h, "linkLine", 2, "LineSegments"));
      }
      helperLine(e, t = "curve", n, i = "Line") {
        const o = G.geo.buf().setFromPoints(e),
          s = new THRDev3[i](o, this.helperMtl(t, n));
        return (s.name = "HP_" + t + "_" + n), s.computeLineDistances(), s;
      }
      helperMtl(e, t = 0) {
        const { dashSize: n, colors: i } = this.config.helper,
          o = G.getColorArr(i[t])[0];
        let s = n;
        return (
          "line" === e && ((s *= 0.5), o.addScalar(0.5)),
          G.mtl.lineD({ color: o, dashSize: s, gapSize: s })
        );
      }
      getAg(e, t) {
        return e.x === t.x && e.z === t.z
          ? 0
          : mt.copy(yt).angleTo(t.clone().sub(e));
      }
      setObjs(e, t) {
        const n = this.Paths[e];
        Object.keys(t).forEach((e) => {
          n[e] = t[e];
        });
      }
      getTargi(e, t, n, i) {
        let o = n + i;
        const s = e[n] || e[0] || t[o];
        if (s) return s;
        for (; o >= n && !t[o]; o--);
        return mt.clone().lerpVectors(t[o - 1], t[o], n + i - o);
      }
      binding(e, t) {}
      unBinding(e, t) {}
      unBindAll(e) {}
      setState(e, t) {}
      setTesting(e) {}
      setConfig(e, t) {
        switch (e) {
          case "add":
            this.addPath(t);
            break;
          case "binding":
            this.binding(t.id, t.binds);
            break;
          case "unBinding":
            this.unBinding(t.id, t.node);
            break;
          case "unBindAll":
            this.unBindAll(t.id);
            break;
          case "alls":
            this.stopAll = !t;
            break;
          case "start":
          case "stop":
          case "pause":
          case "play":
            this.setState(e, t);
            break;
          case "testing":
            this.setTesting(t.id, t.type);
        }
      }
      getConfig(e, t) {
        let n = null;
        switch (e) {
          case "alls":
            n = [...this.PathIds];
            break;
          case "option":
            const e = this.Paths[t.id];
            if (e) {
              const { count: t, time: i, params: o } = e;
              n = G.extend(!0, {}, { count: t, time: i, params: o });
            } else n = null;
        }
        return n;
      }
    };
    n(30);
    class xt {
      constructor(e, t) {
        const { scene: n, camera: i, container: o, controls: s } = e,
          {
            draggingFn: r,
            objChangeFn: a,
            changeFn: l,
            size: c,
            showY: h = !0,
            mode: u = "translate",
          } = t,
          d = new THRDev3.TransformControls(i, o);
        d.addEventListener("dragging-changed", (e) => {
          (s.enabled = !e.value), G.isFunction(r) && r(e.value);
        }),
          d.addEventListener("objectChange", () => {
            G.isFunction(a) && a();
          }),
          d.addEventListener("change", () => {
            G.isFunction(l) && l();
          }),
          G.setObjParams(d, { size: 0.75 * c, showY: h, mode: u }),
          n.add(d),
          (this.TransCtl = d);
      }
      dispose() {
        this.TransCtl.dispose(), (this.TransCtl = null);
      }
      detach() {
        this.TransCtl.detach();
      }
      attach(e) {
        this.TransCtl.attach(e);
      }
      setParams(e, t) {
        switch (type) {
          case "mode":
          case "size":
          case "showX":
          case "showY":
          case "showZ":
          case "enabled":
            this.TransCtl[e] = t;
        }
      }
    }
    class wt {
      constructor(e, t) {
        this.TransCtl = new xt(t, e);
        const n = new THRDev3.Sprite();
        (n.name = "transform-ctl-sprite"),
          n.scale.setScalar(1e-4),
          (this.CtlSprite = n),
          (this.CIdx = -1);
      }
      onMouseMove(e, t) {
        this.CIdx !== e && this.onMouseDown(e, t);
      }
      onMouseDown(e, t) {
        t &&
          ((this.CIdx = e),
          this.CtlSprite.position.copy(t),
          this.TransCtl.attach(this.CtlSprite));
      }
      detach() {
        (this.CIdx = -1), this.TransCtl.detach();
      }
      getInfo() {
        const { position: e } = this.CtlSprite;
        return { index: this.CIdx, vec: e.clone() };
      }
      setParams(e, t) {
        this.TransCtl.setParams(e, t);
      }
    }
    const [Ct, Tt, _t] = [
      new THRDev3.Vector3(),
      {
        add: "添加点: ",
        modify: "修改点: ",
        insert: "插入点: ",
        delt: "删除点: ",
      },
      {
        vtxShader:
          "\n            uniform float uSize;\n            void main() {\n                vec4 mP = modelViewMatrix * vec4(position, 1.0);\n                gl_PointSize = uSize * 500. / (-mP.z );\n                gl_Position = projectionMatrix * mP;\n            }\n        ",
        fgmShader:
          "\n            uniform vec4 uColor;\n            uniform sampler2D uTxue;\n            void main() {\n                vec4 tColor = texture2D(uTxue, gl_PointCoord);\n                gl_FragColor = vec4(uColor.xyz * tColor.xyz, uColor.w);\n            }\n        ",
      },
    ];
    class Dt {
      constructor(e, t, n) {
        (this.self = t),
          this.setDftConfig(e),
          (this.isEdit = n),
          (this.id = G.creatId("EP")),
          (this.Paths = null),
          (this.Point = null),
          (this.AttrPoint = null),
          (this.AttrCurve = null),
          (this.PDatas = null),
          (this.TS = null),
          (this.Info = {
            total: 0,
            move: null,
            points: [],
            history: [],
            length: 0,
            count: 0,
            maxCount: 0,
          }),
          this.init();
      }
      setDftConfig(e) {
        this.config = G.copy(
          {
            renderOrder: 999,
            eType: "offset",
            hY: 1,
            clamp: [-400, 400],
            curveRt: 8,
            count: 100,
            lineSeg: 1,
            vecSeg: 1,
            mtl: {
              gap: 2,
              colorL: "#FF0000",
              colorC: "#FF9500",
              pSize: 1,
              pTxue: "point",
              pColor: "#FFFFFF",
            },
            trans: { size: 1, showY: !0, mode: "translate" },
          },
          e
        );
      }
      dispose() {
        (this.self = null),
          (this.editG = null),
          (this.Paths = null),
          (this.Point = null),
          (this.AttrPoint = null),
          (this.AttrCurve = null),
          (this.PDatas = null),
          (this.Info = null);
      }
      init() {
        const e = G.group("EP_Group");
        (e.renderOrder = this.config.renderOrder), (this.Paths = e);
        const { pGeo: t, cGeo: n } = this.creatGeo();
        this.creatLine(t, "line"),
          this.creatLine(n, "curve"),
          this.creatKeyP(t),
          this.initTSprite();
      }
      creatGeo() {
        const { clamp: e, curveRt: t, count: n } = this.config,
          [i, o] = e,
          [s, r] = [G.geo.buf(), G.geo.buf()],
          a = (o - i) * t;
        return (
          (this.Info.maxCount = a),
          (this.AttrPoint = new THRDev3.BufferAttribute(
            new Float32Array(3 * n),
            3
          )),
          (this.AttrCurve = new THRDev3.BufferAttribute(
            new Float32Array(3 * a),
            3
          )),
          s.setAttribute("position", this.AttrPoint),
          r.setAttribute("position", this.AttrCurve),
          s.setDrawRange(0, 0),
          r.setDrawRange(0, 0),
          { pGeo: s, cGeo: r }
        );
      }
      creatLine(e, t) {
        const { mtl: n } = this.config,
          i = G.getColorArr(n["line" === t ? "colorL" : "colorC"])[0],
          o = new THRDev3.Line(e, this.getLineMtl(n.gap, i));
        n.gap && ((o._isDashed = !0), o.computeLineDistances()),
          (o.name = "path_" + t),
          (o.frustumCulled = !1),
          (o.renderOrder = 99),
          this.Paths.add(o);
      }
      getLineMtl(e, t) {
        if (e) return G.mtl.lineD({ dashSize: e, gapSize: e, color: t });
        G.mtl.line({ color: t });
      }
      creatKeyP(e) {
        if (!this.isEdit) return;
        const { pSize: t, pTxue: n, pColor: i } = this.config.mtl,
          o = G.getColorArr(i, !0),
          s = new THRDev3.Points(
            e,
            G.mtl.shader({
              uniforms: {
                uSize: { value: 4 * t },
                uColor: { value: new THRDev3.Vector4().fromArray(o) },
                uTxue: { value: this.self.renderer.getTxue(n) },
              },
              depthWrite: !1,
              transparent: !0,
              vertexShader: _t.vtxShader,
              fragmentShader: _t.fgmShader,
            })
          );
        (s.name = "point_key"),
          (s.frustumCulled = !1),
          (s.renderOrder = 100),
          (s._isKeyPoint = !0),
          (this.Point = s),
          this.Paths.add(s);
      }
      initTSprite() {
        if (!this.isEdit) return;
        const e = (e) => {
          const { index: t, vec: n } = this.TS.getInfo();
          this.modPoint(t, n, e);
        };
        (this.TS = new wt(
          {
            draggingFn: () => {
              e(!0);
            },
            objChangeFn: () => {
              e(!1);
            },
            ...this.config.trans,
          },
          this.self.renderer
        )),
          this.Paths.add(this.TS.CtlSprite);
      }
      onMouseMove(e) {
        if (!this.TS || !e.object._isKeyPoint) return;
        const { index: t } = e;
        this.TS.onMouseMove(t, this.Info.points[t]);
      }
      onKeydown(e) {
        this.TS && this.TS.detach(),
          ("z" !== e.key && "Z" !== e.key) || this.cancel();
      }
      handleMove() {
        const { move: e, points: t } = this.Info,
          n = [...t];
        n.push(e), this.handlePoints(n);
      }
      handlePoints(e = this.Info.points) {
        if (e.length < 2) return;
        const { maxCount: t } = this.Info,
          { lineSeg: n, vecSeg: i } = this.config,
          o = new THRDev3.CatmullRomCurve3(e),
          s = o.getLength(),
          r = G.clamp((s * n) | 0, 3, t);
        G.setVals(this.Info, ["length", "count"], [s, r]);
        const [a, l] = [
          o.getSpacedPoints(r - 1),
          o.getSpacedPoints((5 * s * i) | 0),
        ];
        (this.PDatas = { cPos: a, vecs: l }),
          this.updateGeoAttr(e, !0),
          this.updateGeoAttr(a, !1);
      }
      updateGeoAttr(e, t) {
        const n = this[t ? "AttrPoint" : "AttrCurve"],
          i = this.Paths.children[t ? 0 : 1],
          o = e.length;
        for (let t = 0; t < o; t++) {
          const { x: i, y: o, z: s } = e[t];
          n.setXYZ(t, i, o, s);
        }
        n.needsUpdate = !0;
        const { geometry: s } = i;
        s.setDrawRange(0, o),
          t && s.computeBoundingSphere(),
          i._isDashed && i.computeLineDistances();
      }
      setDatas(e) {
        const { count: t } = this.config,
          n = Math.min(t, e.length);
        for (let t = 0; t < n; t++) {
          const n = this.clampV(Ct.copy(e[t]));
          this.addPoint(n.clone());
        }
      }
      addPoint(e, t = !0) {
        const { total: n, points: i } = this.Info;
        n >= this.config.count ||
          (i.push(e),
          t && this.setHistory(n, e, "add"),
          this.Info.total++,
          this.handlePoints());
      }
      movePoint(e) {
        if (!e) {
          if (!this.Info.move) return;
          return this.handlePoints(), void (this.Info.move = null);
        }
        (this.Info.move = this.toVec3(e)), this.handleMove();
      }
      insPoint(e, t, n = !0) {
        const { points: i } = this.Info;
        i.splice(e, 0, t),
          n && this.setHistory(e + 1, t, "insert"),
          this.Info.total++,
          this.handlePoints();
      }
      modPoint(e, t, n = !0) {
        const { points: i } = this.Info;
        i.splice(e, 1, t),
          n && this.setHistory(e, t, "modify"),
          this.handlePoints();
      }
      delPoint(e, t = !0) {
        const { points: n } = this.Info,
          i = n.splice(e, 1);
        t && this.setHistory(e, i[0], "delt"),
          this.Info.total--,
          this.Info.total < 2
            ? ((this.PDatas = { cPos: [...n], vecs: [...n] }),
              this.updateGeoAttr(n, !0),
              this.updateGeoAttr(n, !1))
            : this.handlePoints();
      }
      setHistory(e, t, n) {
        const { history: i } = this.Info;
        if ("modify" === n) {
          const { idx: n, vec: o } = i[i.length - 1];
          if (n === e && Ct.copy(o).equals(t)) return;
        }
        i.push({ idx: e, vec: { ...t }, type: n, label: Tt[n] + e });
        const o = this.getPos();
        console.log(o, this.format(o));
      }
      format(e) {
        let t = JSON.stringify(e);
        return (
          (t = t.replaceAll('"', "")),
          (t = t.replaceAll(":", ": ")),
          (t = t.replaceAll(",", ", ")),
          (t = t.replaceAll("{", "{ ")),
          (t = t.replaceAll("}", " }")),
          t
        );
      }
      getPos(e = 3) {
        const { points: t } = this.Info,
          n = [];
        return (
          t.forEach((t) => {
            n.push({
              x: +t.x.toFixed(e),
              y: +t.y.toFixed(e),
              z: +t.z.toFixed(e),
            });
          }),
          n
        );
      }
      cancel() {
        const { total: e, history: t } = this.Info;
        if (!t.length) return;
        const { idx: n, type: i, vec: o } = t.pop();
        switch (i) {
          case "add":
          case "insert":
            this.delPoint(n, !1);
            break;
          case "delt":
            n >= e
              ? this.addPoint(this.toVec3(o), !1)
              : this.insPoint(n, this.toVec3(o), !1);
            break;
          case "modify":
            const i = t[t.length - 1];
            i.idx === n && this.modPoint(i.idx, this.toVec3(i.vec), !1);
        }
      }
      toVec3(e) {
        return e.isVector3 ? e : Ct.copy(e).clone();
      }
      getPointV(e) {
        const { eType: t, hY: n } = this.config,
          [i, o] = [e[t + "X"], e[t + "Y"]];
        return this.clampV(this.transPos({ x: i, y: o }, n));
      }
      transPos(e, t = 0) {
        return G.transPosition(e, t, this.self.renderer);
      }
      clampV(e) {
        const [t, n] = this.config.clamp;
        return e.clampScalar(t, n);
      }
    }
    class Mt {
      constructor(e, t) {
        (this.self = t),
          this.setDftConfig(e),
          (this.TransFnc = new G.CoordTrans()),
          (this.TransRt = { xr: 1, yr: 1, zr: 1, wr: 1 }),
          this.init();
      }
      setDftConfig(e) {
        this.config = G.copy(
          {
            type: !1,
            ratio: 111.1111,
            sxy: 1,
            width: 0,
            height: 0,
            WT: [],
            XY: [],
            mercator: !1,
          },
          e
        );
      }
      dispose() {
        this.self = null;
      }
      init() {
        const {
          type: e,
          ratio: t,
          sxy: n,
          WT: i,
          XY: o,
          mercator: s,
        } = this.config;
        if (!e) return;
        o.forEach((e) => {
          (e[0] *= n), (e[1] *= n);
        }),
          this.TransFnc.init(i, o, s);
        const { WT: r, XY: a } = this.TransFnc.params,
          [l, c, h, u] = [r[0], r[2], a[0], a[2]],
          d = Math.abs(t / ((u.X - h.X) / (c.W - l.W))),
          p = Math.abs(t / ((u.Y - h.Y) / (c.T - l.T))),
          f = 0.5 * (d + p);
        this.TransRt = { xr: d, yr: f, zr: p, wr: 1.852 };
      }
      transCoord(e, t, n = 0) {
        const { type: i, sxy: o, width: s, height: r } = this.config;
        if (!i) return { x: e, y: n, z: t };
        const a = 0.5 * o,
          [l, c] = this.TransFnc.transCoord(e, t);
        return { x: l - s * a, y: n * o, z: c - r * a };
      }
      reTransCoord(e, t) {
        const { type: n, sxy: i, width: o, height: s } = this.config;
        if (!n) return { w: e, t: t };
        const r = 0.5 * i,
          [a, l] = this.TransFnc.reTransCoord(o * r + e, s * r + t);
        return { w: a, t: l };
      }
      transPos(e, t = 0) {
        return G.transPosition(e, t, this.self.renderer);
      }
      compsDist(e, t) {
        const { xr: n, yr: i, zr: o, wr: s } = this.TransRt,
          [r, a, l] = [(e.x - t.x) * n, (e.y - t.y) * i, (e.z - t.z) * o],
          c = +Math.sqrt(r * r + a * a + l * l).toFixed(3);
        return { dist: c, sMile: +(c / s).toFixed(3) };
      }
      compsAngle(e, t) {
        const n = _V3.copy(e).sub(t).normalize().clone(),
          i = this.transAng(n.angleTo(_V3.set({ x: 0, y: 1, z: 0 })));
        return G.toFixed(i, 2);
      }
      transRad(e) {
        return (e * G.PI) / 180;
      }
      transAng(e) {
        return (180 * e) / G.PI;
      }
    }
    class St extends de {
      constructor(e) {
        super(e),
          (this.CAT = null),
          (this.EDPs = []),
          (this.CEDP = null),
          (this.CIdx = 0),
          (this.EDP = null),
          (this.animate = () => {
            this.config.isAnimate;
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          isCompEvents: !0,
          trans: {
            type: !1,
            ratio: 111.1111,
            sxy: 1,
            width: 0,
            height: 0,
            WT: [],
            XY: [],
            mercator: !1,
          },
          isEdit: !0,
          edit: {},
        });
      }
      disposeCompEft() {
        this.CAT.dispose(), this.EDP.dispose();
      }
      compEftInit() {
        const { name: e, trans: t, isEdit: n, edit: i } = this.config;
        (this.CAT = new Mt(t, this)),
          (this.EDP = new Dt(i, this, n)),
          this.group.add(this.EDP.Paths),
          this.eventArr.push(this.EDP.Point),
          this._triggerInnerEvent("mounted", { val: e });
      }
      createBox() {
        const { size: e, position: t, rotation: n } = this.config,
          i = G.geo.box(e, 1.5 * e, e),
          o = { color: 4621242 },
          s = new THRDev3.Mesh(i, G.mtl.phong(o));
        s.position.copy(t),
          s.rotation.setFromVector3(n),
          (s.name = "test-box"),
          (s.castShadow = !0),
          (s.receiveShadow = !0);
        const r = new THRDev3.Mesh(i, G.mtl.phong({ ...o, color: 12747805 }));
        return (
          s.add(r),
          r.position.set(0, -1.1, -4),
          r.scale.setScalar(0.5),
          (r.castShadow = !0),
          (r.receiveShadow = !0),
          s
        );
      }
      jumpCamera(e) {
        const { camera: t, controls: n } = this.renderer,
          {
            camera: i,
            target: o,
            time: s = 1.5,
            easing: r = "Quadratic.InOut",
            callback: a,
          } = e;
        this._TWEEN.getAll().forEach((e) => {
          e._isChangeCamera && this._TWEEN.remove(e);
        });
        const l = new this._TWEEN.Tween({ index: 0 });
        l.to({ index: 1 }, 1e3 * s),
          l.easing(G.getEasing(r)),
          l.onUpdate((e) => {
            t.position.lerp(i, e),
              n.target.lerp(o, e),
              this.renderer.setCameraNear();
          }),
          l.onComplete(() => {
            a && a();
          }),
          l.start(),
          (l._isChangeCamera = !0);
      }
      onMouseMove(e, t) {
        if (this.renderer.isCtrl) this.EDP.movePoint(this.EDP.getPointV(e));
        else {
          this.EDP.movePoint(null);
          const [e] = t;
          e && this.EDP.onMouseMove(e);
        }
        return [e];
      }
      onMouseDown(e) {
        return (
          this.renderer.isCtrl && this.EDP.addPoint(this.EDP.getPointV(e)), [e]
        );
      }
      onKeydown(e) {
        return this.renderer.isCtrl && this.EDP.onKeydown(e), [e];
      }
      setConfig(e, t) {
        switch (e) {
          case "jumpTo":
            this.jumpCamera(t);
        }
      }
      getConfig(e, t) {
        let n = null;
        switch (e) {
          case "trans":
            n = this.CAT.transCoord(t.lng, t.lat, t.h);
            break;
          case "reTrans":
            n = this.CAT.reTransCoord(t.x, t.y);
            break;
          case "transPos":
            n = this.CAT.transPos(t.vec2, t.hy);
        }
        return n;
      }
    }
    St.description = "业务功能 - 路径编辑";
    var Pt = { Business: pt, PathAmt: bt, PathEdit: St },
      Rt = {
        setConfig(e, t = {}) {
          switch (e) {
            case "start":
              this.startCamera(t);
              break;
            case "pause":
              this.setState(!1, t);
              break;
            case "play":
              this.setState(!0, t);
              break;
            case "update":
              this.update(t);
              break;
            case "add":
              this.create(t);
              break;
            case "startThird":
              this.startThird(t);
              break;
            case "stopThird":
              this.stopThird();
          }
          return null;
        },
        getConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "priority":
              n = this.tweenPriority;
              break;
            case "option":
              n = G.extend(!0, {}, this.config);
          }
          return n;
        },
        callback: {},
        checkList: { position: "setPosition" },
      };
    const At = new THRDev3.Vector3(),
      Et = (e, t) => {
        let n = 0;
        return (
          Object.keys(e).forEach((i) => {
            n += (e[i] - t[i]) ** 2;
          }),
          Math.sqrt(n)
        );
      };
    var kt = {
      getByIdOption(e) {
        const { data: t } = this.config,
          n = Array.isArray(e) ? e : [e],
          i = [];
        return (
          n.forEach((e) => {
            const n = t.find((t) => t.id === e);
            n && i.push(n);
          }),
          i
        );
      },
      getSpeedTime(e, t = 1) {
        let n = 0,
          i = 0;
        for (let t = 0; t < e.length - 1; t++)
          (n += Et(e[t].camera, e[t + 1].camera)),
            (i += Et(e[t].target, e[t + 1].target));
        const o = Math.max(n, i);
        return 100 * Math.ceil(o / t);
      },
      getCurveData({ data: e = [], closed: t = !1 }) {
        const n = [],
          i = [];
        e.forEach((e) => {
          n.push(At.clone().copy(e.camera)), i.push(At.clone().copy(e.target));
        });
        return {
          camera: new THRDev3.CatmullRomCurve3(n, t),
          target: new THRDev3.CatmullRomCurve3(i, t),
        };
      },
      getEasing(e) {
        const { Easing: t } = this._TWEEN,
          n = e.split(".");
        let i = t;
        return (
          n.forEach((e) => {
            i[e] && (i = i[e]);
          }),
          G.isFunction(i) ? i : t.Linear.None
        );
      },
    };
    const It = new THRDev3.Vector3();
    class Ht extends de {
      constructor(e) {
        super(e);
        const { camera: t, controls: n } = e;
        (this.camera = t),
          (this.controls = n),
          (this.tweens = null),
          (this.tweenPriority = -1),
          (this.tweenIndex = 0),
          (this.posCache = {
            camera: { x: 0, y: 0, z: 0 },
            target: { x: 0, y: 0, z: 0 },
          }),
          (this.animate = (e) => {
            if (this.thridMesh) {
              const { index: e } = this.thridMesh.userData;
              if (this.thridPositions[e - this.targetIndex]) {
                const t = this.thridPositions[e - this.targetIndex],
                  n = this.orThridPositions[e];
                this.camera.position.copy(t).add(this.thridOffset),
                  this.controls.target.copy(n),
                  this.camera.updateProjectionMatrix();
              }
            }
          }),
          this.initInterFace();
      }
      initInterFace() {
        Object.keys(Rt.callback).forEach((e) => {
          Rt.callback[e].bind(this);
        }),
          (this.Interface = Rt);
      }
      setDefaultConfig(e) {
        G.copy(e, { easing: "Quartic.Line", delay: 1, speed: 25, data: [] });
      }
      compEftInit() {
        this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      disposeCompEft() {
        this.tweens &&
          (this.tweens.forEach((e) => {
            this._TWEEN.remove(e);
          }),
          (this.tweens = null)),
          (this.thridMesh = null),
          (this.camera = null),
          (this.controls = null);
      }
      startCamera(e = {}) {
        const {
          ids: t = [],
          loop: n,
          priority: i = 0,
          isTest: o = !1,
          isFirstView: s = !1,
        } = e;
        if (i <= this.tweenPriority)
          return void this._triggerOutEvent("onAniFail", { ids: e.ids });
        this.thridMesh && this.stopThird();
        const r = [];
        ([this.loopOpt, this.tweenIndex, this.tweenPriority] = [
          n ? e : void 0,
          0,
          i,
        ]),
          t.forEach((e) => {
            const t = {
              ...this.config,
              isTest: o,
              isFirstView: s,
              ...kt.getByIdOption.call(this, e)[0],
            };
            if (t.cohesion) {
              const n = this.getCohesion(
                { ...t.cohesion, first: t.data[0] },
                this.tweenEnd
              );
              n && ((n._id = e), (n._type = "cohesion"), r.push(n));
            }
            const n = this.getCameraTween(t, this.tweenEnd);
            n && ((n._id = e), (n._type = "path"), r.push(n));
          }),
          (this.tweens = r),
          this.tweens.length &&
            (this.setContrilsEnabled(!1), this.tweens[0].start());
      }
      tweenEnd() {
        const e = this.tweens[this.tweenIndex];
        if (!e) return;
        this._triggerOutEvent("onAniEnd", { id: e._id, type: e._type }),
          this.tweenIndex++;
        const t = this.tweens[this.tweenIndex];
        t
          ? t.start()
          : this.loopOpt
          ? ((this.tweenPriority = -1), this.startCamera(this.loopOpt))
          : this.setContrilsEnabled(!0);
      }
      getCameraTween(e, t) {
        const [n, i, o, s, r] = [
          kt.getSpeedTime(e.data, e.speed, "camera"),
          kt.getCurveData(e),
          kt.getEasing.call(this, e.easing),
          { x: 0 },
          { x: 1 },
        ];
        if (i.camera.points.length <= 1) return !1;
        const a = new this._TWEEN.Tween(s)
          .to(r, n)
          .easing(o)
          .delay(1e3 * (e.delay || 0));
        return (
          a.onUpdate(() => {
            i.target.getPoint(s.x, this.controls.target),
              i.camera.getPoint(s.x, this.camera.position);
          }),
          a.onComplete(() => {
            t.call(this, "complete");
          }),
          a
        );
      }
      update(e) {
        if (!e.id) return;
        const t = this.config.data.find((t) => t.id === e.id);
        G.extend(!0, t, e);
      }
      create(e) {
        if (e.id) {
          for (let t = 0; t < this.config.data.length; t++) {
            if (this.config.data[t].id === e.id) return;
          }
          this.config.data.push(e);
        }
      }
      startThird(e) {
        const {
          mesh: t,
          offset: n = { x: 0, y: 0, z: 0 },
          ofty: i = 0,
          priority: o = 0,
          near: s = 1,
          positions: r,
          targetIndex: a,
        } = e;
        !t ||
          o <= this.tweenPriority ||
          ((this.tweenPriority = o),
          (this.orThridPositions = r.map((e) => ({ x: e.x, y: e.y, z: e.z }))),
          (this.thridPositions = this.handleTCameraPoints(i, r, a)),
          (this.thridMesh = t),
          (this.targetIndex = a),
          (this.thridOffset = n),
          this.setContrilsEnabled(!1),
          (this.camera.near = s),
          this.camera.updateProjectionMatrix());
      }
      handleTCameraPoints(e, t, n) {
        const i = [];
        for (let n = 0; n < t.length; n++) {
          const o = It.clone().copy(t[n]);
          (o.y += e), i.push(o);
        }
        const [o, s] = [i[0], i[1]];
        for (let e = 0; e <= n + 2; e++) {
          const t = It.clone().lerpVectors(s, o, e + 2);
          i.unshift(t);
        }
        return i;
      }
      stopThird() {
        if (!this.thridMesh) return;
        (this.thridMesh = null),
          (this.thridOffset = null),
          (this.targetIndex = null),
          (this.thridPositions = null),
          (this.orThridPositions = null),
          (this.thUps = null);
        const e = this.camera.getWorldPosition(It.clone());
        this.camera.position.copy(e), this.setContrilsEnabled(!0);
      }
      setContrilsEnabled(e) {
        (this.isRun = !e),
          e && (this.tweenPriority = -1),
          (this.controls.enabled = e);
      }
      getCohesion(e = {}, t) {
        const { speed: n = 1, easing: i = "Quartic.Line", first: o } = e,
          s = [
            {
              camera: this.camera.position.clone(),
              target: this.controls.target.clone(),
            },
            o,
          ];
        return this.getCameraTween({ data: s, speed: n, easing: i }, t);
      }
      setState(e, t) {
        if (!this.tweens) return;
        const n = this.tweens[this.tweenIndex];
        if (n && e !== this.isRun)
          if (e && -1 === this.tweenPriority) {
            if (t) {
              const {
                speed: e = 1,
                easing: i = "Quartic.Line",
                delay: o = 0,
              } = t;
              new Promise((t) => {
                this.getCameraTween(
                  {
                    data: [
                      {
                        camera: this.camera.position,
                        target: this.controls.target,
                      },
                      {
                        camera: this.posCache.camera,
                        target: this.posCache.target,
                      },
                    ],
                    speed: e,
                    easing: i,
                    delay: o,
                  },
                  (e) => {
                    "complete" === e && t();
                  }
                ).start();
              }).then(() => {
                n.start();
              });
            } else n.start();
            this.setContrilsEnabled(!1);
          } else
            e ||
              ((this.posCache.camera = this.camera.position.clone()),
              (this.posCache.target = this.controls.target.clone()),
              n.stop(),
              t &&
                t.time &&
                setTimeout(() => {
                  this.setState(!0);
                }, 1e3 * t.time),
              this.setContrilsEnabled(!0));
      }
      setConfig(e, t) {
        return Rt.setConfig.call(this, e, t);
      }
      getConfig(e, t) {
        return Rt.getConfig.call(this, e, t);
      }
    }
    Ht.description = "相机动画组件";
    var Lt = Ht;
    class Ot {
      uniforms(e = {}) {
        const {
          txue: t = null,
          showCloud: n = 1,
          hillTxue: i = null,
          showHill: o = 1,
          hillLayer: s = 2,
          hillFall: r = 0.5,
          hillPms: a = [-1, 0.2, 1, 1],
          hillColor: l = [0.3, 0.47, 0.6, 1],
          hillFarColor: c = [0.6, 0.62, 0.65, 1],
          sunCore: h = [1, 0.8, 0.6, 1],
          sunOuter: u = [1, 0.7, 0.4, 1],
          skyTop: d = [0.22, 0.55, 0.933, 1],
          skyDown: p = [0.6, 0.64, 0.72, 1],
          skyTone: f = [0.21, 0.71, 0.072, 1],
          clouds: m = [1, 0.95, 1, 1],
          floors: g = [0.27, 0.44, 0.68, 1],
          skylineMix: v = 1,
          otherPms: y = [0.23, 0.5, 1, 1],
          cloudPms: b = [0.5, 0.8, 1, 1],
          opacity: x = 1,
        } = e;
        return {
          uTime: { value: 0 },
          uTxue: { value: t },
          uShowCloud: { value: n },
          uHillTxue: { value: i },
          uShowHill: { value: o },
          uHillLayer: { value: s },
          uHillFall: { value: r },
          uHillPms: { value: new THRDev3.Vector4().fromArray(a) },
          uHillCol3: { value: new THRDev3.Vector3().fromArray(l) },
          uHillFarCol3: { value: new THRDev3.Vector3().fromArray(c) },
          uSunCoreCol3: { value: new THRDev3.Vector3().fromArray(h) },
          uSunOuterCol3: { value: new THRDev3.Vector3().fromArray(u) },
          uSkyTopCol3: { value: new THRDev3.Vector3().fromArray(d) },
          uSkyDownCol3: { value: new THRDev3.Vector3().fromArray(p) },
          uSkyToneCol3: { value: new THRDev3.Vector3().fromArray(f) },
          uCloudCol3: { value: new THRDev3.Vector3().fromArray(m) },
          uFloorCol3: { value: new THRDev3.Vector3().fromArray(g) },
          uSkyMix: { value: v },
          uOtherPms: { value: new THRDev3.Vector4().fromArray(y) },
          uCloudPms: { value: new THRDev3.Vector4().fromArray(b) },
          uOpacity: { value: x },
        };
      }
      vtxShader() {
        return `\n            ${He.vtxTitle()}\n            void main() {\n                ${He.vtxMain()}\n            }\n        `;
      }
      fgmShader() {
        return `\n            ${this.fgmTitle()}\n            ${this.cloud()}\n            ${this.distantHill()}\n            ${this.sunSky01()}\n            void main() {\n                ${this.fgmMain()}\n            }\n        `;
      }
      fgmTitle() {
        return "\n            uniform float uTime;\n            uniform sampler2D uTxue;\n            uniform float uShowCloud;\n\n            uniform sampler2D uHillTxue;\n            uniform float uShowHill;\n            uniform float uHillLayer;\n            uniform float uHillFall;\n            uniform vec4 uHillPms;\n            uniform vec3 uHillCol3;\n            uniform vec3 uHillFarCol3;\n\n            uniform vec3 uSunCoreCol3;\n            uniform vec3 uSunOuterCol3;\n\n            uniform vec3 uSkyTopCol3;\n            uniform vec3 uSkyDownCol3;\n            // uniform vec3 uSkyToneCol3;\n\n            uniform vec3 uCloudCol3;\n            uniform vec3 uFloorCol3;\n\n            uniform float uSkyMix;\n            uniform vec4 uOtherPms;\n            uniform vec4 uCloudPms;\n\n            uniform float uOpacity;\n\n            varying vec2 vUv;\n            #define PI 3.14159265\n        ";
      }
      fgmMain() {
        return "\n            vec3 col = sunSky01(vUv);\n\n            gl_FragDepth = gl_FragCoord.z + 10. * uOtherPms.w;\n            gl_FragColor = vec4(col, uOpacity);\n        ";
      }
      cloud() {
        return "\n            vec3 Cloud(vec3 bgCol, vec2 uv, float t) {\n                mat2 m2 = mat2(1., -1., 1., 1.);\n                float sy = sin(uv.y * PI * .5) + .11 - uOtherPms.x * .6; // 云层跟随天际线\n                vec2 p = vec2(uv.x, .1 / pow(sy, .75 + sy + sy * sy * 3.));\n\n                float f = 0., sum = 0., s = .5;\n                for (int i = 0; i < 2 + int(uCloudPms.w); i++) {\n                    sum += s; p += vec2(t, t * .6);\n                    f += s * textureLod(uTxue, p, 0.).x;\n                    p *= m2; s *= 0.6; t *= 1.4;\n                }\n                float val = smoothstep(uCloudPms.x, uCloudPms.y, f / sum);\n                val *= 1.2 * smoothstep(0., 1., pow(sy, .75));\n                vec3 col = mix(bgCol, uCloudCol3, val); // cloud颜色 #FFF2FF mix\n                return col;\n            }\n        ";
      }
      mountain() {
        return `\n            ${Ae.rand0()}\n            ${Ae.noise0()}\n\n            float perlin(float x, int iter) {\n                float r = 0., s = 1., w = 1.;\n                for (int i = 0; i < iter; i++) {\n                    s *= 2.0; w *= 0.5; r += w * noise(s * x);\n                }\n                return r;\n            }\n\n            // 倍数，偏移 [14, 16, 19., 23., 27.], [.505, .733, .569, .668, .658]\n            float mountain(vec2 uv, float hMin, float hMax, vec4 hsf) {\n                float h = hMin + perlin(uv.x * hsf.x + hsf.y, int(hsf.w)) * (hMax - hMin);\n                return smoothstep(h, h + hsf.z * .0035, uv.y);\n            }\n        `;
      }
      hillType2() {
        return `\n            ${this.mountain()}\n\n            // 倍数，偏移 [14, 16, 19., 23., 27.], [.505, .733, .569, .668, .658]\n            vec3 hillType2(vec3 col, vec2 uv, float skyline, float optK) {\n                vec4 sf[5]; // 由近到远\n                sf[0] = vec4(27., .658, 1., 6.);\n                sf[1] = vec4(23., .668, 3., 4.);\n                sf[2] = vec4(19., .569, 4.5, 3.);\n                sf[3] = vec4(16., .733, 5.5, 3.);\n                sf[4] = vec4(14., .505, 6., 2.);\n\n                float hMax = uHillPms.y + sin(skyline * PI) * .7; // 山高度 + 跟随天际线\n                vec3 hc3; float hMin = hMax - .4 * uHillFall, hLy = uHillLayer - 1.;\n                if (uHillLayer > 1.5) { // 2~5层\n                    vec3 segC = uHillCol3 - uHillFarCol3;\n                    for (float i = hLy; i > -.5; i -= 1.) {\n                        float k = pow(i / hLy, .65);\n                        float mtp = (1. - mountain(uv, hMin + .2 * uHillFall * k, hMax, sf[int(i)]));\n\n                        vec3 bgCol3 = i > hLy - .5 ? col : hc3; // 混合底色\n                        hc3 = colorMix(vec4(uHillCol3 - segC * k, mtp * optK), vec4(bgCol3, 1.)).xyz;\n                    }\n                } else { // 单层\n                    float mtp0 = (1. - mountain(uv, hMin, hMax, sf[0]));\n                    hc3 = colorMix(vec4(uHillCol3, mtp0 * optK), vec4(col, 1.)).xyz;\n                }\n                return hc3;\n            }\n        `;
      }
      distantHill() {
        return `\n            ${Ee.rgb2hsl()}\n            ${Ee.hsl2rgb()}\n            ${Ee.colorMix()}\n\n            // 颜色混合，色调混合\n            vec3 hslMix(vec3 up, vec3 un) {\n                vec3 pHSL = rgb2hsl(up);\n                vec3 nHSL = rgb2hsl(un);\n                float transY = pHSL.x > 0. ? nHSL.y : pHSL.y;\n                return hsl2rgb(vec3(pHSL.x, transY, nHSL.z));\n            }\n            ${this.hillType2()}\n\n            vec3 DistHill(vec3 col, vec2 uv) {\n                if (uShowHill < 0.) return col;\n\n                float sklh = pow(uOtherPms.x, 1. + 2. * uOtherPms.x) * .5; // 天际线变化\n                float optK = pow(1. - uv.y, uHillPms.z); // 纵向混合比例变化\n                if (uHillPms.w < 0.) { // 基于纹理\n                    float uy = (uv.y - sin(sklh * PI) * .7) / uHillPms.y; // 山高度 + 跟随天际线\n                    vec3 hc3; float hLy = uHillLayer - 1.;\n                    if (uHillLayer > 1.5) { // 2~5层\n                        vec3 segC = uHillCol3 - uHillFarCol3;\n                        for (float i = hLy; i > -.5; i -= 1.) {\n                            float k = pow(i / hLy, .65);\n                            float ux = uv.x * floor(4. - 3. * k) + k * .5;\n\n                            vec4 ihc4 = textureLod(uHillTxue, vec2(ux, uy), 0.);\n                            ihc4 = vec4(hslMix(uHillCol3 - segC * k, ihc4.rgb), ihc4.w * optK * (1. - k * .5));\n\n                            hc3 = colorMix(ihc4, vec4(i > hLy - .5 ? col : hc3, 1.)).xyz; // 混合底色\n                        }\n                    } else { // 单层\n                        vec4 hc4 = textureLod(uHillTxue, vec2(uv.x * 4., uy), 0.);\n                        hc4 = vec4(hslMix(uHillCol3, hc4.rgb), hc4.w * optK);\n                        hc3 = colorMix(hc4, vec4(col, 1.)).xyz;\n                    }\n                    return hc3;\n                } else {\n                    return hillType2(col, uv, sklh, optK);\n                }\n            }\n        `;
      }
      sunSky01() {
        return "\n            vec3 sunSky01(vec2 uv) {\n                vec2 p = 2. * (uv - .5) * vec2(3.6, 1.);\n\n                // compute\n                vec3 rightdir = vec3(0., 0., 1.);\n                vec3 eyedir = normalize(vec3(.5, 1. - uOtherPms.x, 0.)); // 天际线高度\n                vec3 updir = normalize(cross(rightdir, eyedir));\n                vec3 rd = normalize((p.x * rightdir + p.y * updir) * 2. + eyedir);\n                float rdy = 1. - max(rd.y, 0.); // 反转\n\n                // position\n                float sy = uOtherPms.y * 3.3;\n                vec3 lightDir = normalize(vec3(.1, pow(uOtherPms.y, 1.5 + sy) * .5, 0.)); // sun高度位置\n                float sundot = clamp(dot(rd, lightDir), 0., 1.);\n\n                // sky\n                vec3 col = uSkyTopCol3 - rd.y * rd.y * .5; // sky顶部颜色 #388CEE\n                col = mix(col, uSkyDownCol3, pow(rdy, 4.)); // sky底部颜色 #99A3B8\n\n                // sun\n                float scl = .5 / uOtherPms.z; // sun大小\n                float sscal1 = uOtherPms.y * 0.24 + 0.01; // 根据高度调节大小\n                float sscal2 = 3. - uOtherPms.y * 2.; // 根据高度调节大小\n                col += sscal1 * uSunOuterCol3 * pow(sundot, 5. * scl); // sun外层颜色 #FFB366\n                col += sscal1 * uSunCoreCol3 * pow(sundot, 64. * scl); // sun内层颜色 #FFCC99\n                col += (sscal1 + 1.) * uSunCoreCol3 * pow(sundot, 512. * scl * sscal2);\n\n                // hill\n                if (uHillPms.x < 0.) col = DistHill(col, uv); // 云前渲染\n\n                if (uShowCloud < 0.) return col; // 不渲染云\n\n                // clouds\n                col = Cloud(col, uv, uTime * .003 * uCloudPms.z);\n                col = mix(col, uFloorCol3, pow(rdy, 16. * uSkyMix)); // floor颜色 #4570AD\n\n                if (uHillPms.x > 0.) col = DistHill(col, uv); // 云后渲染\n                return col;\n            }\n        ";
      }
    }
    class Vt {
      uniforms(e = {}) {
        const {
          txue: t = null,
          showCloud: n = 1,
          hillTxue: i = null,
          showHill: o = 1,
          hillLayer: s = 2,
          hillFall: r = 0.5,
          hillPms: a = [-1, 0.2, 1, 1],
          hillColor: l = [0.3, 0.47, 0.6, 1],
          hillFarColor: c = [0.6, 0.62, 0.65, 1],
          sunCore: h = [1, 0.8, 0.6, 1],
          sunOuter: u = [1, 0.7, 0.4, 1],
          skyTop: d = [0.22, 0.55, 0.933, 1],
          skyDown: p = [0.6, 0.64, 0.72, 1],
          skyTone: f = [0.21, 0.71, 0.072, 1],
          clouds: m = [1, 0.95, 1, 1],
          floors: g = [0.27, 0.44, 0.68, 1],
          skylineMix: v = 1,
          otherPms: y = [0.23, 0.5, 1, 1],
          cloudPms: b = [0.5, 0.8, 1, 1],
          opacity: x = 1,
        } = e;
        return {
          uTime: { value: 0 },
          uTxue: { value: t },
          uShowCloud: { value: n },
          uHillTxue: { value: i },
          uShowHill: { value: o },
          uHillLayer: { value: s },
          uHillFall: { value: r },
          uHillPms: { value: new THRDev3.Vector4().fromArray(a) },
          uHillCol3: { value: new THRDev3.Vector3().fromArray(l) },
          uHillFarCol3: { value: new THRDev3.Vector3().fromArray(c) },
          uSunCoreCol3: { value: new THRDev3.Vector3().fromArray(h) },
          uSunOuterCol3: { value: new THRDev3.Vector3().fromArray(u) },
          uSkyTopCol3: { value: new THRDev3.Vector3().fromArray(d) },
          uSkyDownCol3: { value: new THRDev3.Vector3().fromArray(p) },
          uSkyToneCol3: { value: new THRDev3.Vector3().fromArray(f) },
          uCloudCol3: { value: new THRDev3.Vector3().fromArray(m) },
          uFloorCol3: { value: new THRDev3.Vector3().fromArray(g) },
          uSkyMix: { value: v },
          uOtherPms: { value: new THRDev3.Vector4().fromArray(y) },
          uCloudPms: { value: new THRDev3.Vector4().fromArray(b) },
          uOpacity: { value: x },
        };
      }
      vtxShader() {
        return `\n            ${He.vtxTitle()}\n            void main() {\n                ${He.vtxMain()}\n            }\n        `;
      }
      fgmShader() {
        return `\n            ${this.fgmTitle()}\n            ${this.cloud()}\n            ${this.distantHill()}\n            ${this.sunSky02()}\n            void main() {\n                ${this.fgmMain()}\n            }\n        `;
      }
      fgmTitle() {
        return "\n            uniform float uTime;\n            uniform sampler2D uTxue;\n            uniform float uShowCloud;\n\n            uniform sampler2D uHillTxue;\n            uniform float uShowHill;\n            uniform float uHillLayer;\n            uniform float uHillFall;\n            uniform vec4 uHillPms;\n            uniform vec3 uHillCol3;\n            uniform vec3 uHillFarCol3;\n\n            uniform vec3 uSunCoreCol3;\n            uniform vec3 uSunOuterCol3;\n\n            uniform vec3 uSkyTopCol3;\n            uniform vec3 uSkyDownCol3;\n            uniform vec3 uSkyToneCol3;\n\n            uniform vec3 uCloudCol3;\n            uniform vec3 uFloorCol3;\n\n            uniform float uSkyMix;\n            uniform vec4 uOtherPms;\n            uniform vec4 uCloudPms;\n\n            uniform float uOpacity;\n\n            varying vec2 vUv;\n            #define PI 3.14159265\n        ";
      }
      fgmMain() {
        return "\n            vec3 col = sunSky02(vUv);\n\n            gl_FragDepth = gl_FragCoord.z + 10. * uOtherPms.w;\n            gl_FragColor = vec4(col, uOpacity);\n        ";
      }
      cloud() {
        return "\n            vec3 Cloud(vec3 bgCol, vec2 uv, float t) {\n                mat2 m2 = mat2(1., -1., 1., 1.);\n                float sy = sin(uv.y * PI * .5) + .11 - uOtherPms.x * .6; // 云层跟随天际线\n                vec2 p = vec2(uv.x, .1 / pow(sy, .75 + sy + sy * sy * 3.));\n\n                float f = 0., sum = 0., s = .5;\n                for (int i = 0; i < 2 + int(uCloudPms.w); i++) {\n                    sum += s; p += vec2(t, t * .6);\n                    f += s * textureLod(uTxue, p, 0.).x;\n                    p *= m2; s *= 0.6; t *= 1.4;\n                }\n                float val = smoothstep(uCloudPms.x, uCloudPms.y, f / sum);\n                val *= 1.2 * smoothstep(0., 1., pow(sy, .75));\n                vec3 col = mix(bgCol, uCloudCol3, val); // cloud颜色 #FFF2FF mix\n                return col;\n            }\n        ";
      }
      mountain() {
        return `\n            ${Ae.rand0()}\n            ${Ae.noise0()}\n\n            float perlin(float x, int iter) {\n                float r = 0., s = 1., w = 1.;\n                for (int i = 0; i < iter; i++) {\n                    s *= 2.0; w *= 0.5; r += w * noise(s * x);\n                }\n                return r;\n            }\n\n            // 倍数，偏移 [14, 16, 19., 23., 27.], [.505, .733, .569, .668, .658]\n            float mountain(vec2 uv, float hMin, float hMax, vec4 hsf) {\n                float h = hMin + perlin(uv.x * hsf.x + hsf.y, int(hsf.w)) * (hMax - hMin);\n                return smoothstep(h, h + hsf.z * .0035, uv.y);\n            }\n        `;
      }
      hillType2() {
        return `\n            ${this.mountain()}\n\n            // 倍数，偏移 [14, 16, 19., 23., 27.], [.505, .733, .569, .668, .658]\n            vec3 hillType2(vec3 col, vec2 uv, float skyline, float optK) {\n                vec4 sf[5]; // 由近到远\n                sf[0] = vec4(27., .658, 1., 6.);\n                sf[1] = vec4(23., .668, 3., 4.);\n                sf[2] = vec4(19., .569, 4.5, 3.);\n                sf[3] = vec4(16., .733, 5.5, 3.);\n                sf[4] = vec4(14., .505, 6., 2.);\n\n                float hMax = uHillPms.y + sin(skyline * PI) * .7; // 山高度 + 跟随天际线\n                vec3 hc3; float hMin = hMax - .4 * uHillFall, hLy = uHillLayer - 1.;\n                if (uHillLayer > 1.5) { // 2~5层\n                    vec3 segC = uHillCol3 - uHillFarCol3;\n                    for (float i = hLy; i > -.5; i -= 1.) {\n                        float k = pow(i / hLy, .65);\n                        float mtp = (1. - mountain(uv, hMin + .2 * uHillFall * k, hMax, sf[int(i)]));\n\n                        vec3 bgCol3 = i > hLy - .5 ? col : hc3; // 混合底色\n                        hc3 = colorMix(vec4(uHillCol3 - segC * k, mtp * optK), vec4(bgCol3, 1.)).xyz;\n                    }\n                } else { // 单层\n                    float mtp0 = (1. - mountain(uv, hMin, hMax, sf[0]));\n                    hc3 = colorMix(vec4(uHillCol3, mtp0 * optK), vec4(col, 1.)).xyz;\n                }\n                return hc3;\n            }\n        `;
      }
      distantHill() {
        return `\n            ${Ee.rgb2hsl()}\n            ${Ee.hsl2rgb()}\n            ${Ee.colorMix()}\n\n            // 颜色混合，色调混合\n            vec3 hslMix(vec3 up, vec3 un) {\n                vec3 pHSL = rgb2hsl(up);\n                vec3 nHSL = rgb2hsl(un);\n                float transY = pHSL.x > 0. ? nHSL.y : pHSL.y;\n                return hsl2rgb(vec3(pHSL.x, transY, nHSL.z));\n            }\n            ${this.hillType2()}\n\n            vec3 DistHill(vec3 col, vec2 uv) {\n                if (uShowHill < 0.) return col;\n\n                float sklh = pow(uOtherPms.x, 1. + 2. * uOtherPms.x) * .5; // 天际线变化\n                float optK = pow(1. - uv.y, uHillPms.z); // 纵向混合比例变化\n                if (uHillPms.w < 0.) { // 基于纹理\n                    float uy = (uv.y - sin(sklh * PI) * .7) / uHillPms.y; // 山高度 + 跟随天际线\n                    vec3 hc3; float hLy = uHillLayer - 1.;\n                    if (uHillLayer > 1.5) { // 2~5层\n                        vec3 segC = uHillCol3 - uHillFarCol3;\n                        for (float i = hLy; i > -.5; i -= 1.) {\n                            float k = pow(i / hLy, .65);\n                            float ux = uv.x * floor(4. - 3. * k) + k * .5;\n\n                            vec4 ihc4 = textureLod(uHillTxue, vec2(ux, uy), 0.);\n                            ihc4 = vec4(hslMix(uHillCol3 - segC * k, ihc4.rgb), ihc4.w * optK * (1. - k * .5));\n\n                            hc3 = colorMix(ihc4, vec4(i > hLy - .5 ? col : hc3, 1.)).xyz; // 混合底色\n                        }\n                    } else { // 单层\n                        vec4 hc4 = textureLod(uHillTxue, vec2(uv.x * 4., uy), 0.);\n                        hc4 = vec4(hslMix(uHillCol3, hc4.rgb), hc4.w * optK);\n                        hc3 = colorMix(hc4, vec4(col, 1.)).xyz;\n                    }\n                    return hc3;\n                } else {\n                    return hillType2(col, uv, sklh, optK);\n                }\n            }\n        `;
      }
      sunSky02() {
        return "\n            vec3 sunSky02(vec2 uv) {\n                float skyLh = .5 - uOtherPms.x * .5; // 天际线高度\n                vec2 p = (uv - .5) * vec2(4.6, 1.); // 长宽比\n                vec2 lp = vec2(0., uOtherPms.y * .5 - skyLh); // sun高度位置\n                float dist = distance(p, lp); // 相对距离\n\n                float dLpy = lp.y + skyLh + .1;\n                float hDstyP = .7 / pow(max(p.y + skyLh, .0035), .75); // uv密度计算\n                float eDp = 1. - exp2(-hDstyP); // 指数反转\n\n                // sky\n                vec3 absorb = exp2(-uSkyTopCol3 * hDstyP) * 2.; // uv颜色吸收 absorb 变化\n                float rayMult = pow(1. - clamp(dist, 0., 1.), 2.4); // 范围发光强度 rayleigh\n                float sunDstLp = clamp(max(dLpy, 0.), 0., 1.); // sun距离系数\n\n                vec3 col = uSkyTopCol3 * hDstyP * (1.0 + rayMult * 1.57); // sky颜色 #6391FF\n                col = mix(col, uSkyDownCol3, pow(eDp, 4.)); // sky底部颜色 #99A3B8\n                col = mix(col * absorb, col / (col + 0.5), sunDstLp);\n\n                // sun\n                float disk = clamp(1. - pow(dist, 0.1), 0.0, 1.0);\n                float mieMult = disk * disk * (3.0 - 2.0 * disk) * 6.28; // sun照射系数\n\n                float scl = 0.03 * uOtherPms.z; // sun大小\n                float sunMult = smoothstep(scl, scl - 0.004, dist) * 50.0; // sun系数\n\n                float hDstyLp = .7 / pow(max(dLpy, .0035), .75); // sun密度计算\n                vec3 sunAbsorb = exp2(-uSkyTopCol3 * hDstyLp) * 2.; // sun颜色吸收 absorb 变化\n\n                col += mieMult * uSunOuterCol3 * sunAbsorb; // sun外层颜色 #FFB366\n                col += sunMult * uSunCoreCol3 * absorb; // sun内层颜色 #FFCC99\n\n                // mix & tonemap 色调映射\n                col *= (sunAbsorb * 0.5 + 0.5 * length(sunAbsorb)) * PI;\n                vec3 tc = col / (col + 1.0);\n                col = pow(mix(col / (dot(col, uSkyToneCol3) + 1.0), tc, tc), vec3(2.2)); // tonemap颜色 #36B612\n\n                // hill\n                if (uHillPms.x < 0.) col = DistHill(col, uv); // 云前渲染\n\n                if (uShowCloud < 0.) return col; // 不渲染云\n\n                // cloud\n                vec3 cCol = Cloud(col, vec2(uv.x, uv.y), uTime * .003 * uCloudPms.z);\n                col = mix(cCol, mix(col, uFloorCol3, sunDstLp), pow(eDp, 16. * uSkyMix)); // floor颜色 #4570AD\n\n                if (uHillPms.x > 0.) col = DistHill(col, uv); // 云后渲染\n                return col;\n            }\n        ";
      }
    }
    class Ft extends de {
      constructor(e) {
        super(e),
          (this.amtMtl = null),
          (this.mainSph = null),
          (this.isDynSkyComp = !0),
          (this.animate = (e, t) => {
            this.config.isAnimate && this.setAnimate(e, t);
          });
      }
      setDefaultConfig(e) {
        G.copy(e, {
          type: 1,
          txue: "",
          showCloud: !0,
          hillTxue: "",
          showHill: !0,
          hillLayer: 3,
          hillFall: 0.5,
          hillType: 1,
          hillHt: 0.2,
          hillDim: 1,
          hillTuType: 1,
          hillColor: "#51709B",
          hillFarColor: "#9A9EA6",
          sunCore: "#FFCC99",
          sunOuter: "#FFB366",
          skyTop: "#388CEE",
          skyDown: "#99A3B8",
          skyTone: "#36B612",
          clouds: "#FFF2FF",
          floors: "#4570AD",
          skyline: 0.23,
          skylineMix: 1,
          sunPos: { x: 0.1, y: 0.6 },
          sunScale: 1,
          cloudDensity: { x: 0.5, y: 0.8 },
          cloudSpeed: 1,
          cloudCount: 1,
          skyRadius: 100,
          depthZ: 1,
          opacity: 1,
        });
      }
      disposeCompEft() {
        (this.amtMtl = null), (this.mainSph = null);
      }
      setAnimate(e, t) {
        this.amtMtl &&
          this.config.showCloud &&
          (this.amtMtl.uniforms.uTime.value = t.getElapsedTime());
      }
      compEftInit() {
        this.creatMain(),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      creatMain() {
        const e = this.getDynShader();
        if (!e) return;
        (this.amtMtl = G.mtl.shader({
          fog: !1,
          transparent: !0,
          side: THRDev3.BackSide,
          uniforms: e.uniforms(this.creatUniforms()),
          vertexShader: e.vtxShader(),
          fragmentShader: e.fgmShader(),
        })),
          G.shaderMtlAddFog(this.amtMtl, this.renderer.scene);
        const { skyRadius: t } = this.config,
          { fog: n } = this.renderer.scene;
        n && (this.amtMtl.fog = !!(t > n.userData.near));
        const i = new THRDev3.Mesh(this.creatMainGeo(), this.amtMtl);
        (i.onBeforeRender = function (e, t, n) {
          this.matrixWorld.copyPosition(n.matrixWorld);
        }),
          (i.frustumCulled = !1),
          (i.rotation.y = this.config.sunPos.x * G.PI),
          (this.mainSph = i),
          (this.group.renderOrder = -999),
          this.group.add(i);
      }
      getDynShader() {
        let e = null;
        const { type: t } = this.config;
        return 1 * t == 1 && (e = new Ot()), 1 * t == 2 && (e = new Vt()), e;
      }
      creatUniforms() {
        const {
            showHill: e,
            hillLayer: t,
            hillFall: n,
            hillType: i,
            hillHt: o,
            hillDim: s,
            hillTuType: r,
            hillColor: a,
            hillFarColor: l,
          } = this.config,
          {
            showCloud: c,
            sunCore: h,
            sunOuter: u,
            skyTop: d,
            skyDown: p,
            skyTone: f,
            clouds: m,
            floors: g,
          } = this.config,
          {
            skyline: v,
            skylineMix: y,
            sunPos: b,
            sunScale: x,
            cloudDensity: w,
            cloudSpeed: C,
            cloudCount: T,
            depthZ: _,
            opacity: D,
          } = this.config,
          [M, S] = [
            this.renderer.getTxue(this.config.txue),
            1 === r ? this.renderer.getTxue(this.config.hillTxue) : null,
          ],
          P = 1 === r ? e && S : e;
        return {
          txue: this.setWarp(M, 0),
          showCloud: c && M ? 1 : -1,
          hillTxue: this.setWarp(S, 1),
          showHill: P ? 1 : -1,
          hillLayer: Math.min(Math.max(t, 1), 5),
          hillFall: Math.min(Math.max(n, 0.1), 1),
          hillPms: [2 * i - 3, Math.max(o, 0.001), s, 2 * r - 3],
          hillColor: G.getColorArr(a, !0),
          hillFarColor: G.getColorArr(l, !0),
          sunCore: G.getColorArr(h, !0),
          sunOuter: G.getColorArr(u, !0),
          skyTop: G.getColorArr(d, !0),
          skyDown: G.getColorArr(p, !0),
          skyTone: G.getColorArr(f, !0),
          clouds: G.getColorArr(m, !0),
          floors: G.getColorArr(g, !0),
          skylineMix: y,
          otherPms: [v, b.y, x, _],
          cloudPms: [w.x, w.y, C, T],
          opacity: D,
        };
      }
      setWarp(e, t = 0) {
        return e
          ? ((e.wrapS = THRDev3.RepeatWrapping),
            (e.wrapT =
              0 === t ? THRDev3.RepeatWrapping : THRDev3.ClampToEdgeWrapping),
            e)
          : e;
      }
      creatMainGeo() {
        const { PI: e } = G,
          { skyRadius: t } = this.config,
          { near: n } = this.renderer.camera,
          [i, o, s, r, a, l, c] = [n + t, 38, 12, 0, 2 * e, 0.16 * e, 0.42 * e],
          [h, u, d, p] = [G.geo.buf(), [], [], []],
          [f, m] = [Math.min(l + c, e), []];
        let g = 0;
        for (let e = 0; e <= s; e++) {
          const [t, n] = [[], e / s];
          for (let e = 0; e <= o; e++) {
            const s = e / o;
            d.push(s, 1 - n);
            const [h, u, f = Math.sin(u)] = [r + s * a, l + n * c];
            p.push(-i * Math.cos(h) * f, i * Math.cos(u), i * Math.sin(h) * f),
              t.push(g++);
          }
          m.push(t);
        }
        p.push(0, 0.7 * -i, 0), d.push(0.5, 0);
        for (let t = 0; t < s; t++)
          for (let n = 0; n < o; n++) {
            const [i, o, r, a] = [
              m[t][n + 1],
              m[t][n],
              m[t + 1][n],
              m[t + 1][n + 1],
            ];
            (0 !== t || l > 0) && u.push(i, o, a),
              (t !== s - 1 || f < e) && u.push(o, r, a),
              t === s - 1 && u.push(g, a, r);
          }
        return (
          h.setIndex(u),
          h.setAttribute("uv", new THRDev3.Float32BufferAttribute(d, 2)),
          h.setAttribute("position", new THRDev3.Float32BufferAttribute(p, 3)),
          h
        );
      }
      changeParams(e) {
        const { key: t, value: n } = e;
        this.config[t] = n;
        const i = {
          txue: "uTxue",
          showCloud: "uShowCloud",
          hillTxue: "uHillTxue",
          hillLayer: "uHillLayer",
          hillFall: "uHillFall",
          showHill: "uShowHill",
          hillColor: "uHillCol3",
          hillFarColor: "uHillFarCol3",
          sunCore: "uSunCoreCol3",
          sunOuter: "uSunOuterCol3",
          skyTop: "uSkyTopCol3",
          skyDown: "uSkyDownCol3",
          skyTone: "uSkyToneCol3",
          clouds: "uCloudCol3",
          floors: "uFloorCol3",
          skylineMix: "uSkyMix",
          opacity: "uOpacity",
        };
        switch (t) {
          case "type":
            {
              const e = this.getDynShader();
              (this.amtMtl.fragmentShader = e.fgmShader()),
                (this.amtMtl.needsUpdate = !0);
            }
            break;
          case "txue":
            this.amtMtl.uniforms[i[t]].value = this.setWarp(
              this.renderer.getTxue(n)
            );
            break;
          case "showCloud":
            {
              const e = this.renderer.getTxue(this.config.txue);
              this.amtMtl.uniforms[i[t]].value = n && e ? 1 : -1;
            }
            break;
          case "hillTxue":
            {
              const e =
                1 === this.config.hillTuType ? this.renderer.getTxue(n) : null;
              this.amtMtl.uniforms[i[t]].value = this.setWarp(e, 1);
            }
            break;
          case "showHill":
            {
              const e = this.renderer.getTxue(this.config.hillTxue),
                o = 1 === this.config.hillTuType ? n && e : n;
              this.amtMtl.uniforms[i[t]].value = o ? 1 : -1;
            }
            break;
          case "hillLayer":
          case "hillFall":
          case "skylineMix":
          case "opacity":
            this.amtMtl.uniforms[i[t]].value = n;
            break;
          case "hillType":
            this.amtMtl.uniforms.uHillPms.value.setX(2 * n - 3);
            break;
          case "hillHt":
            this.amtMtl.uniforms.uHillPms.value.setY(Math.max(n, 0.001));
            break;
          case "hillDim":
            this.amtMtl.uniforms.uHillPms.value.setZ(n);
            break;
          case "hillTuType":
            if (
              (this.amtMtl.uniforms.uHillPms.value.setW(2 * n - 3), 1 === n)
            ) {
              const e = this.renderer.getTxue(this.config.hillTxue);
              this.amtMtl.uniforms.uHillTxue.value = this.setWarp(e, 1);
            } else this.amtMtl.uniforms.uHillTxue.value = null;
            break;
          case "hillColor":
          case "hillFarColor":
          case "sunCore":
          case "sunOuter":
          case "skyTop":
          case "skyDown":
          case "skyTone":
          case "clouds":
          case "floors":
            this.amtMtl.uniforms[i[t]].value.fromArray(G.getColorArr(n, !0));
            break;
          case "skyline":
            this.amtMtl.uniforms.uOtherPms.value.setX(n);
            break;
          case "sunPos":
            (this.mainSph.rotation.y = n.x * G.PI),
              this.amtMtl.uniforms.uOtherPms.value.setY(n.y);
            break;
          case "sunScale":
            this.amtMtl.uniforms.uOtherPms.value.setZ(n);
            break;
          case "cloudDensity":
            this.amtMtl.uniforms.uCloudPms.value.setX(n.x),
              this.amtMtl.uniforms.uCloudPms.value.setY(n.y);
            break;
          case "cloudSpeed":
            this.amtMtl.uniforms.uCloudPms.value.setZ(n);
            break;
          case "cloudCount":
            this.amtMtl.uniforms.uCloudPms.value.setW(n);
        }
      }
      getSunPosRefer() {
        const { sunPos: e, skyline: t } = this.config;
        return {
          x: 1 * (-Math.sin((e.x - 0.5) * G.PI)).toFixed(3),
          y: 1 * (0.55 * t + 0.76 * e.y - 0.25).toFixed(3),
          z: 1 * (-Math.cos((e.x - 0.5) * G.PI)).toFixed(3),
        };
      }
      setConfig(e, t = {}) {
        switch (e) {
          case "params":
            this.changeParams(t);
        }
      }
      getConfig(e) {
        let t = null;
        switch (e) {
          case "params":
            (t = {}),
              G.initParams(t, this.config, [
                "type",
                "txue",
                "showCloud",
                "hillTxue",
                "showHill",
                "hillLayer",
                "hillFall",
                "hillType",
                "hillHt",
                "hillDim",
                "hillTuType",
                "hillColor",
                "hillFarColor",
                "sunCore",
                "sunOuter",
                "skyTop",
                "skyDown",
                "skyTone",
                "clouds",
                "floors",
                "skyline",
                "skylineMix",
                "sunPos",
                "sunScale",
                "cloudDensity",
                "cloudSpeed",
                "cloudCount",
              ]),
              (t = JSON.stringify(t, null, 4));
            break;
          case "sunPosRefer":
            t = this.getSunPosRefer();
        }
        return t;
      }
    }
    Ft.description = "动态天空盒：构建包含天空，太阳，云，远山的天空盒。";
    var zt = Ft;
    const jt = (e, { model: t }) =>
      !0 === t ? e : e.children.find((e) => e.userData.id === t);
    var Bt = (e, t = [], n) => {
        const i = ["visible", "castShadow", "receiveShadow", "layers"];
        e.traverse((e) => {
          const o = t.find((t) => t.name === e.name || !0 === t.name);
          if (o) {
            const { position: t, scale: n, rotation: s } = o;
            n && e.scale.set(n.x, n.y, n.z),
              t && e.position.set(t.x, t.y, t.z),
              s && e.rotation.set(s.x, s.y, s.z),
              i.forEach((t) => {
                void 0 !== o[t] && (e[t] = o[t]);
              });
            const { userData: r } = o;
            r && G.isObject(r) && (e.userData = { ...e.userData, ...r });
          }
          n(e);
        });
      },
      Ut = jt,
      Nt = (e, { model: t, name: n }) => {
        const i = jt(e, { model: t });
        return i ? i.getObjectByName(n) : i;
      },
      Gt = {
        setEditor(e, t) {
          const { model: n } = e.config,
            { state: i } = t;
          (e.eventArr = []),
            i &&
              e.group.children.forEach((t) => {
                e.eventArr.push(t);
              }),
            e.updateMeshEvent();
        },
      },
      Wt = {
        setConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "listener":
              this.on(t.name, t.callback, t.triggerOnce);
              break;
            case "event":
              this.bind(t.name, t.callback, t.triggerOnce);
              break;
            case "option":
              this.isAfterData && (n = this.setOption(t));
              break;
            case "loadModel":
              this.config.model.push(...t.model),
                this.loaderModels(t.model, t.callback);
              break;
            case "editor":
              Gt.setEditor(this, t);
              break;
            case "effect":
              this.EffectMange.setConfig("add", {
                object: t.object,
                config: t.config,
              }),
                t.object.traverse((e) => {
                  e.isMesh &&
                    e.material &&
                    G.eachMaterial(e.material, (e) => {
                      this.MaterialMange.setConfig("compile", { material: e });
                    });
                });
              break;
            case "editEffect":
              t.object.traverse((e) => {
                this.EffectMange.setConfig("edit", {
                  object: e,
                  config: t.config,
                });
              });
              break;
            case "objectMaterial":
              this.setObjectMaterial(t);
          }
          return n;
        },
        getConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "option":
              n = G.extend(!0, {}, this.config);
              break;
            case "box":
              n = G.extend(t.object);
              break;
            case "model":
              n = Ut(this.group, t);
              break;
            case "object":
              n = Nt(this.group, t);
              break;
            case "scene":
              n = this.group;
          }
          return n;
        },
        callback: {},
        checkList: { position: "setPosition" },
      };
    var Yt = class {
      constructor(e) {
        this.initConfig(e), this.setDefaultConfig(this.config);
      }
      initConfig(e) {
        (this.db = null),
          (this.table = null),
          (this.storeName = "w3d-three-store"),
          (this.config = e);
      }
      setDefaultConfig(e = {}) {
        this.config = {
          version: 1,
          name: "w3d",
          id: "id",
          state: !0,
          table: {
            name: "LoaderModel",
            indexName: "model",
            keyName: "name",
            valueName: "value",
          },
          ...e,
        };
      }
      init() {
        const { config: e } = this;
        this.isEqualVersion() && window.indexedDB.deleteDatabase(e.name);
        const t = window.indexedDB.open(e.name, e.version);
        return new Promise((n) => {
          (t.onsuccess = () => {
            (this.db = t.result), n(!0);
          }),
            (t.onerror = (e) => {
              console.error("打开数据库失败", e), n("error");
            }),
            (t.onupgradeneeded = (t) => {
              this.upgradeneeded(t, e.table);
            });
        }).catch((e) => {
          console.error("打开数据库失败", e);
        });
      }
      upgradeneeded(e, t) {
        this.db = e.target.result;
        const { name: n, indexName: i, keyName: o, valueName: s } = t;
        this.db
          .createObjectStore(n, { keyPath: "key", autoIncrement: !1 })
          .createIndex(i, o, { unique: !1, multiEntry: !1 });
      }
      insertData(e) {
        if (!this.db) return;
        const { table: t } = this.config,
          n = this.db.transaction([t.name], "readwrite");
        (n.oncomplete = function () {
          console.log("写入数据成功");
        }),
          (n.onabort = function () {
            console.log("保存数据失败");
          });
        n.objectStore(t.name).add(e);
      }
      deleteData(e) {
        const t = this.getStore("readwrite").delete(e);
        return new Promise((e) => {
          t.onsuccess = function () {
            e("删除成功");
          };
        });
      }
      readData(e = !0) {
        const { table: t } = this.config,
          n = this.getStore("readonly").index(t.indexName),
          i = !0 === e ? n.getAll() : n.get(e);
        return new Promise((e) => {
          i.onsuccess = function () {
            e(this.result);
          };
        });
      }
      updateData(e) {
        const { key: t, name: n, value: i } = e;
        if (void 0 === t || void 0 === n || void 0 === i) return !1;
        return this.getStore("readwrite").put(e), !0;
      }
      insertModelData(e, t) {
        const n = e.split("/").pop();
        this.insertData({ key: n, name: n, value: t });
      }
      getData(e) {
        const t = e.split("/").pop();
        return this.readData(t);
      }
      getStore(e = "readwrite") {
        const { table: t } = this.config;
        return this.db.transaction([t.name], e).objectStore(t.name);
      }
      isEqualVersion() {
        const { id: e } = this.config,
          t = window.localStorage.getItem(this.storeName);
        return window.localStorage.setItem(this.storeName, e), t !== e;
      }
    };
    let Kt = null;
    const $t = (e, t) => {
      (e.userData.config = t.model),
        (e.userData.index = t.index),
        (e.userData.id = t.id),
        t.callback(t.scene, t.model),
        t.loadTotal === t.total && t.endCallback();
    };
    var Xt = (e, t, n) => {
        let i = 0;
        e.forEach((o, s) => {
          const { url: r } = o;
          ((e) =>
            Kt
              ? Kt.getData(e)
              : new Promise((e) => {
                  e(!1);
                }))(r).then((a) => {
            if (a) {
              const r = a.value,
                l = new THRDev3.ObjectLoader().parse(r);
              $t(l, {
                scene: l,
                model: o,
                callback: t,
                endCallback: n,
                index: s,
                id: o.id,
                total: e.length,
                loadTotal: ++i,
              });
            } else
              Pe.load(r, (r) => {
                $t(r, {
                  scene: r,
                  model: o,
                  callback: t,
                  endCallback: n,
                  index: s,
                  id: o.id,
                  total: e.length,
                  loadTotal: ++i,
                });
              });
          });
        }),
          0 === e.length && n();
      },
      qt = (e = {}) => {
        Pe.setDracoPath(e);
      },
      Zt = (e) => (
        e && e.state && (Kt = new Yt(e)),
        new Promise((e) => {
          Kt
            ? Kt.init().then(() => {
                e(Kt);
              })
            : e(Kt);
        })
      );
    var Qt = {
        getBakeConfig: function (e) {
          const t = { ...e };
          return (
            G.loopObject(e, (n) => {
              n.includes("uv") &&
                ((t[n] = this.renderer.getTxue(e[n])),
                void 0 !== e.flip && t[n] && (t[n].flipY = e.flip));
            }),
            t
          );
        },
      },
      Jt = {
        setConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "listener":
              this.on(t.name, t.callback, t.triggerOnce);
              break;
            case "event":
              this.bind(t.name, t.callback, t.triggerOnce);
              break;
            case "option":
              this.isAfterData && (n = this.setOption(t));
              break;
            case "effect":
              this.setMeshEffect(t);
              break;
            case "replace":
              this.replaceMeshEffect(t);
              break;
            case "uniform":
              this.setUniformsConfig(t);
              break;
            case "dispose":
              this.disposeCompEft();
              break;
            case "add":
              this.addObjectEffect(t);
              break;
            case "edit":
              this.editObjectEffect(t);
          }
          return n;
        },
        getConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "option":
              n = G.extend(!0, {}, this.config);
              break;
            case "box":
              n = G.extend(t.object);
          }
          return n;
        },
        callback: {},
        checkList: { position: "setPosition" },
      };
    var en = (e, { filter: t, config: n }) => {
      G.eachMaterial(e, (e) => {
        const { modelEffect: i = [] } = e.userData;
        !!i.find((e) => e.type === n.type) ||
          ((!0 === t || (Array.isArray(t) && t.includes(e.name))) &&
            i.unshift(n));
      });
    };
    var tn = {
      grassland: {
        create: (e, { config: t = {}, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = {
            uniforms: {
              ...i,
              uGrassColor: { value: new THRDev3.Color(t.color) },
              uGrassTextureColor: { value: new THRDev3.Color(t.textureColor) },
              uGrassTexture: { value: t.texture },
              uGrassScale: { value: t.scale },
            },
            vextrerBefore: "",
            vextrerAfter: "",
            framentFunc: [
              { type: "noise" },
              {
                func: "\n            #define OCTAVES 6\n            float grassFbm (in vec2 st) {\n                // Initial values\n                float value = 0.0;\n                float amplitude = .5;\n                float frequency = 0.;\n                //\n                // Loop of octaves\n                for (int i = 0; i < OCTAVES; i++) {\n                    value += amplitude * noise(st);\n                    st *= 2.;\n                    amplitude *= .6;\n                }\n                return value;\n            }",
              },
            ],
            framentBefore:
              "\n    uniform sampler2D uGrassTexture;\n    uniform float uGrassScale;\n    uniform vec3 uGrassTextureColor;",
            framentAfter:
              "\n    vec3 grassCol = texture2D(uGrassTexture, vUv1).rgb * uGrassTextureColor;\n    vec3 grassCol1 = vec3(0.1);\n    grassCol1 += grassFbm(vUv1 * uGrassScale);\n    outgoingLight = mix(grassCol, outgoingLight, clamp(grassCol1.g * 1.5, 0.0, 1.0));",
            type: "grassLand",
          };
          en(e.material, { config: o, filter: n });
        },
        edit: (e) => {
          G.loopObject(e, (t) => {
            e[t];
          });
        },
      },
      grow: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = {
            uniforms: {
              ...i,
              uGrowColor: { value: new THRDev3.Color(t.color || "#ffffff") },
              uGrowLightRate: { value: t.lightRate || 1.02 },
              uGrowRatio: { value: t.ratio || 2 },
              uGrowSpeed: { value: t.speed || 0.1 },
              uGrowRangeY: {
                value: new THRDev3.Vector2(t.rangeY[0] || 0, t.rangeY[1]),
              },
              uGrowMatrix: { value: e.matrix },
            },
            vextrerBefore:
              "\n    varying vec3 vgPosition;\n    uniform mat4 uGrowMatrix;\n    ",
            vextrerAfter:
              "\n    vgPosition = (uGrowMatrix * vec4(position, 1.0)).xyz;;\n    #ifdef USE_INSTANCING\n        vgPosition = (instanceMatrix * (uGrowMatrix * vec4(position, 1.0))).rgb;\n    #endif\n    ",
            framentFunc: [],
            framentBefore:
              "\n\n    uniform vec2 uGrowRangeY;\n    uniform float uGrowSpeed;\n    uniform vec3 uGrowColor;\n    uniform float uGrowRatio;\n    uniform float uGrowLightRate;\n    varying vec3 vgPosition;\n    \n    float random3(vec2 p){\n        return fract(sin(dot(p.xy, vec2(12.9898, 78.233))) * 43758.5453123);\n    }\n\n    float changePointVal(vec2 p, vec2 offset, float time) {\n        float aBefore = random3(p + floor(time) * 1000.0 + offset);\n        float aNext = random3(p + floor(time) * 1000.0 + offset + 1000.0);\n        float timeF = fract(time);\n        float timeU = timeF*timeF*timeF*(timeF*(timeF*6.-15.)+10.);\n        float a = mix(aBefore, aNext, timeF);\n        return a;\n    }\n    float dynamicGrowth(vec2 st, float uTime) {\n        vec2 i = floor(st);\n        vec2 f = fract(st);\n        float time = uTime * 1.0;\n        float a = changePointVal(i, vec2(0.0, 0.0), time);\n        float b = changePointVal(i, vec2(1.0, 0.0), time);\n        float c = changePointVal(i, vec2(0.0, 1.0), time);\n        float d = changePointVal(i, vec2(1.0, 1.0), time);\n\n        //float b = random3(i + vec2(1.0, 0.0) + floor(uTime));\n        //float c = random3(i + vec2(0.0, 1.0) + floor(uTime));\n        //float d = random3(i + vec2(1.0, 1.0) + floor(uTime));\n\n        // vec2 u = f * f * (3.0 - 2.0 * f); // 多项式插值\n        vec2 u = f*f*f*(f*(f*6.-15.)+10.);\n\n        float n = mix(a, b, u.x) + (c - a) * (1.0 - u.x) * u.y + (d - b) * u.x * u.y;\n        return n;\n    }",
            framentAfter:
              "\n    // 物体按高度逐步显示\n    float dist = uTime * uGrowSpeed;\n    if (vgPosition.y >= uGrowRangeY.x + dist) {\n        vec2 st = vec2(vgPosition.y / uGrowRatio, vgPosition.x / uGrowRatio);\n        float df = 1.0 - (vgPosition.y - uGrowRangeY.x) / (uGrowRangeY.y - uGrowRangeY.x);\n        df += uTime * uGrowSpeed - 0.35;\n        df += dynamicGrowth(st, uTime) * 0.05;\n        vec2 st2 = vec2(vgPosition.y / uGrowRatio, vgPosition.z / uGrowRatio);\n        df += dynamicGrowth(st2, uTime) * 0.05;\n    \n        float thld = 0.7;\n        if (step(df, thld) > 0.5) { // 小于thld(0.7)不显示\n            discard;\n        }\n        outgoingLight = mix(uGrowColor, outgoingLight, smoothstep(thld, thld * uGrowLightRate, df));\n    }\n    \n\n    ",
            type: "grow",
          };
          en(e.material, { config: o, filter: n });
        },
        edit: (e = {}, { config: t }) => {
          e.material &&
            G.eachMaterial(e.material, (e) => {
              const n = e.uniforms || (e.shader && e.shader.uniforms);
              n &&
                G.loopObject(t, (e) => {
                  const i = t[e];
                  switch (e) {
                    case "uTime":
                      if (!n.uTime) return;
                      n.uTime.value = i;
                      break;
                    case "speed":
                      if (!n.uGrowSpeed) return;
                      n.uGrowSpeed.value = i;
                      break;
                    case "ratio":
                      if (!n.uGrowRatio) return;
                      n.uGrowRatio.value = i;
                      break;
                    case "color":
                      if (!n.uGrowColor) return;
                      n.uGrowColor.value = new THRDev3.Color(i);
                      break;
                    case "rangeY":
                      if (!n.uGrowRangeY) return;
                      n.uGrowRangeY.value = new THRDev3.Vector2(i[0], i[1]);
                  }
                });
            });
        },
      },
      diffuse: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = t.position || new THRDev3.Vector3(),
            s = {
              uniforms: {
                ...i,
                uDiffColor: { value: new THRDev3.Color(t.color) },
                uDiffSpeed: { value: t.speed },
                uDiffRange: { value: t.range },
                uDiffRatio: { value: t.ratio },
                uDiffViewRnage: { value: t.viewRnage || 0 },
                uDiffPosition: { value: new THRDev3.Vector3().copy(o) },
                uDiffMatrix: { value: e.matrix },
              },
              vextrerBefore:
                "\n    varying vec3 vgPosition;\n    uniform mat4 uDiffMatrix;\n    ",
              vextrerAfter:
                "\n    vgPosition = (uDiffMatrix * vec4(position, 1.0)).xyz;;\n    #ifdef USE_INSTANCING\n        vgPosition = (instanceMatrix * (uDiffMatrix * vec4(position, 1.0))).rgb;\n    #endif\n    ",
              framentFunc: [],
              framentBefore:
                "\n    uniform vec3 uDiffPosition;\n    uniform vec3 uDiffColor;\n\n    uniform float uDiffRatio;\n    uniform float uDiffRange;\n    uniform float uDiffSpeed;\n    uniform float uDiffViewRnage;\n    varying vec3 vgPosition;",
              framentAfter:
                "\n    // 计算扩散范围\n    float cTime = uTime * uDiffSpeed;\n    float diffLen = distance(vgPosition, uDiffPosition);\n    if (diffLen < uDiffRange) {\n        float vgTime = 1.0 - fract(uTime * uDiffSpeed);\n        float lenIndex = fract(diffLen / uDiffRange + vgTime);\n        if (uDiffViewRnage > 0.0) {\n            if (lenIndex < uDiffViewRnage) {\n                lenIndex = lenIndex / uDiffViewRnage;\n            } else {\n                lenIndex = 0.0;\n            }\n        }\n        float ratio = uDiffRatio * (1.0 - diffLen / uDiffRange);\n        outgoingLight = mix(outgoingLight, uDiffColor, lenIndex * ratio);\n    }",
              type: "diffuse",
            };
          en(e.material, { config: s, filter: n });
        },
        edit: (e = {}, { config: t }) => {
          e.material &&
            G.eachMaterial(e.material, (e) => {
              const n = e.uniforms || (e.shader && e.shader.uniforms);
              n &&
                G.loopObject(t, (e) => {
                  const i = t[e];
                  switch (e) {
                    case "color":
                      if (!n.uDiffColor) return;
                      n.uDiffColor.value = new THRDev3.Color(i);
                      break;
                    case "speed":
                      if (!n.uDiffSpeed) return;
                      n.uDiffSpeed.value = i;
                      break;
                    case "range":
                      if (!n.uDiffRange) return;
                      n.uDiffRange.value = i;
                      break;
                    case "ratio":
                      if (!n.uDiffRatio) return;
                      n.uDiffRatio.value = i;
                      break;
                    case "viewRnage":
                      if (!n.uDiffViewRnage) return;
                      n.uDiffViewRnage.value = i;
                      break;
                    case "position":
                      if (!n.uDiffPosition) return;
                      n.uDiffPosition.value = new THRDev3.Vector3().copy(
                        i || new THRDev3.Vector3()
                      );
                  }
                });
            });
        },
      },
      diffuse2: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = t.position || new THRDev3.Vector3(),
            s = {
              uniforms: {
                ...i,
                uDiffColor: {
                  value: new THRDev3.Vector4().fromArray(
                    G.getColorArr(t.color, !0)
                  ),
                },
                uDiffSpeed: { value: t.speed },
                uDiffRange: { value: t.range },
                uDiffRatio: { value: t.ratio },
                uDiffViewRnage: { value: t.viewRnage || 0 },
                uDiffPosition: { value: new THRDev3.Vector3().copy(o) },
                uDiffMatrix: { value: e.matrix },
              },
              vextrerBefore:
                "\n    varying vec3 vgPosition;\n    uniform mat4 uDiffMatrix;\n    ",
              vextrerAfter:
                "\n    vgPosition = (uDiffMatrix * vec4(position, 1.0)).xyz;;\n    #ifdef USE_INSTANCING\n        vgPosition = (instanceMatrix * (uDiffMatrix * vec4(position, 1.0))).rgb;\n    #endif\n    ",
              framentFunc: [],
              framentBefore:
                "\n    uniform vec3 uDiffPosition;\n    uniform vec4 uDiffColor;\n\n    uniform float uDiffRatio;\n    uniform float uDiffRange;\n    uniform float uDiffSpeed;\n    uniform float uDiffViewRnage;\n    varying vec3 vgPosition;\n    \n    vec4 colorMix(vec4 up, vec4 un) {\n        float o = up.w + (1. - up.w) * un.w;\n        return vec4(clamp((up.xyz * up.w + un.xyz * un.w * (1. - up.w)) / o, 0., 1.), o);\n    }\n    ",
              outputAfter:
                "\n    // 计算扩散范围\n    float cTime = uTime * uDiffSpeed;\n    float diffLen = distance(vgPosition, uDiffPosition);\n    if (diffLen < uDiffRange) {\n        float vgTime = 1.0 - fract(uTime * uDiffSpeed);\n        float lenIndex = fract(diffLen / uDiffRange + vgTime);\n        if (uDiffViewRnage > 0.0) {\n            if (lenIndex < uDiffViewRnage) {\n                lenIndex = lenIndex / uDiffViewRnage;\n            } else {\n                lenIndex = 0.0;\n            }\n        }\n        float ratio = uDiffRatio * (1.0 - diffLen / uDiffRange);\n\n        vec4 upColor = vec4(uDiffColor.xyz, uDiffColor.w * lenIndex * ratio);\n        gl_FragColor = colorMix(upColor, gl_FragColor);\n    }",
              type: "diffuse",
            };
          en(e.material, { config: s, filter: n });
        },
        edit: (e = {}, { config: t }) => {
          e.material &&
            G.eachMaterial(e.material, (e) => {
              const n = e.uniforms || (e.shader && e.shader.uniforms);
              n &&
                G.loopObject(t, (e) => {
                  const i = t[e];
                  switch (e) {
                    case "color":
                      if (!n.uDiffColor) return;
                      n.uDiffColor.value = new THRDev3.Vector4().fromArray(
                        G.getColorArr(t.color, !0)
                      );
                      break;
                    case "speed":
                      if (!n.uDiffSpeed) return;
                      n.uDiffSpeed.value = i;
                      break;
                    case "range":
                      if (!n.uDiffRange) return;
                      n.uDiffRange.value = i;
                      break;
                    case "ratio":
                      if (!n.uDiffRatio) return;
                      n.uDiffRatio.value = i;
                      break;
                    case "viewRnage":
                      if (!n.uDiffViewRnage) return;
                      n.uDiffViewRnage.value = i;
                      break;
                    case "position":
                      if (!n.uDiffPosition) return;
                      n.uDiffPosition.value = new THRDev3.Vector3().copy(
                        i || new THRDev3.Vector3()
                      );
                  }
                });
            });
        },
      },
      instanceFbm: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = {
            uniforms: {
              ...i,
              uGrassColor: { value: new THRDev3.Color(t.color) },
              uGrassTextureColor: { value: new THRDev3.Color(t.textureColor) },
              uGrassTexture: { value: t.texture },
              uGrassScale: { value: t.scale },
              uGrassRotio: { value: new THRDev3.Vector2().copy(t.rotio) },
              uGrassPosition: {
                value: new THRDev3.Vector3().copy(t.lightPosition),
              },
            },
            vextrerBefore: "",
            vextrerAfter: "",
            framentFunc: [
              { type: "noise" },
              {
                func: "\n            #define OCTAVES 6\n            float grassFbm (in vec2 st) {\n                // Initial values\n                float value = 0.0;\n                float amplitude = .5;\n                float frequency = 0.;\n                //\n                // Loop of octaves\n                for (int i = 0; i < OCTAVES; i++) {\n                    value += amplitude * noise(st);\n                    st *= 2.;\n                    amplitude *= .6;\n                }\n                return value;\n            }",
              },
            ],
            framentBefore:
              "\n    uniform sampler2D uGrassTexture;\n    uniform float uGrassScale;\n    uniform vec2 uGrassRotio;\n    uniform vec3 uGrassPosition;\n    uniform vec3 uGrassTextureColor;",
            framentAfter:
              "\n    vec3 grassCol = texture2D(uGrassTexture, vUv1).rgb * uGrassTextureColor;\n    vec3 grassCol1 = vec3(0.1);\n\n    vec3 L = normalize(uGrassPosition);\n    float Kd =  max(uGrassRotio.y *  2.5 * dot(L, vNormal), uGrassRotio.x);\n\n    grassCol1 += grassFbm(vUv1 * uGrassScale);\n\n    outgoingLight = mix(grassCol, outgoingLight * Kd, clamp(grassCol1.g * 1.5, 0.0, 1.0));",
            type: "grassLand",
          };
          en(e.material, { config: o, filter: n });
        },
        edit: (e) => {
          G.loopObject(e, (t) => {
            e[t];
          });
        },
      },
      viewGradient: {
        create: (e, { config: t, filter: n = !0 }) => {
          if (!e.material) return;
          const i = {
            uniforms: {
              uVgColor: { value: new THRDev3.Color(t.color) },
              uVgStrength: { value: t.strength || 0.5 },
              uVgRange: { value: t.range || 100 },
            },
            vextrerBefore: "",
            vextrerAfter: "",
            framentFunc: [{ type: "distanceTo" }],
            framentBefore:
              "\n    uniform vec3 uVgColor;\n    uniform float uVgRange;\n    uniform float uVgStrength;",
            framentAfter:
              "\n    // 计算扩散范围\n    float vgLen = distanceTo(vec3(0.0), vViewPosition);\n    if (vgLen < uVgRange) {\n        float vgIndex = pow(1.0 - vgLen / uVgRange, 1.5);\n        vec3 vgCol = mix(outgoingLight, uVgColor, uVgStrength);\n        outgoingLight = mix(outgoingLight, vgCol, vgIndex);\n    }",
            type: "diffuse",
          };
          en(e.material, { config: i, filter: n });
        },
        edit: (e) => {
          G.loopObject(e, (t) => {
            e[t];
          });
        },
      },
      diffuseRect: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = {
            uniforms: {
              uDrMatrix: { value: e.matrix },
              uDrColor: { value: new THRDev3.Color(t.color) },
              uDrSpeed: { value: t.speed },
              uDrWidth: { value: t.width },
              uDrRange: { value: t.range },
              uDrMaxRange: { value: t.maxRange },
              uDrTime: i.uTime,
            },
            vextrerBefore:
              "\n    varying vec3 vdPosition;\n    uniform mat4 uDrMatrix;\n    ",
            vextrerAfter:
              "\n    vdPosition = (uDrMatrix * vec4(position, 1.0)).xyz;;\n    #ifdef USE_INSTANCING\n        vdPosition = (instanceMatrix * (uDrMatrix * vec4(position, 1.0))).rgb;\n    #endif\n    ",
            framentFunc: [],
            framentBefore:
              "\n    uniform vec3 uDrColor;\n    uniform float uDrSpeed;\n    uniform float uDrTime;\n    uniform float uDrRange;\n    uniform float uDrWidth;\n    uniform float uDrMaxRange;\n    varying vec3 vdPosition;\n",
            framentAfter:
              "\n    float drTime = uDrTime;\n    float drX = mod(vdPosition.x, uDrRange);\n    float drZ = mod(vdPosition.z, uDrRange);\n    float drY = mod(vdPosition.y, uDrRange);\n\n    float drLen = distance(vec2(vdPosition.x, vdPosition.z), vec2(.0));\n    // 动态距离\n    float l = mod( drTime * uDrSpeed, uDrMaxRange);\n\n    // 边缘\n    if (l > drLen - 20.0 && l < drLen) {\n        float i = (l - drLen) / 20.0;\n        outgoingLight = mix(uDrColor, outgoingLight, i);\n    }\n\n    // 画格子\n    if (drX < uDrWidth || drZ < uDrWidth || drY < uDrWidth) {\n        if (l > drLen) {\n            outgoingLight += uDrColor;\n        }\n    }\n    outgoingLight = outgoingLight;",
            type: "waterSimple",
          };
          en(e.material, { config: o, filter: n });
        },
        edit: (e) => {
          G.loopObject(e, (t) => {
            e[t];
          });
        },
      },
      contrast: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = G.getColorArr(t.rangeColor.min, !0),
            s = G.getColorArr(t.rangeColor.max, !0);
          G.eachMaterial(e.material, (e) => {
            e.transparent = t.transparent;
          });
          const r = {
            uniforms: {
              ...i,
              uCtRangeMax: { value: t.range.max },
              uCtRangeMin: { value: t.range.min },
              uCtRatio: { value: new THRDev3.Vector2(t.ratio.x, t.ratio.y) },
              uRangeColorMin: { value: new THRDev3.Vector4(...o) },
              uRangeColorMax: { value: new THRDev3.Vector4(...s) },
              uCtPosition: { value: t.position },
              uCtMatrix: { value: e.matrix },
            },
            vextrerBefore:
              "\n    uniform mat4 uCtMatrix;\n    varying vec3 ctPosition;\n    varying float ctLength;\n    ",
            vextrerAfter:
              "\n    ctPosition = (uCtMatrix * vec4(position, 1.0)).xyz;\n    #ifdef USE_INSTANCING\n        ctPosition = (instanceMatrix * (uCtMatrix * vec4(position, 1.0))).rgb;\n    #endif\n    ",
            framentFunc: [
              {
                func: "\n        float easeVal(float x) {\n            return  x < 0.5 ? 2. * x * x : 1. - pow(-2. * x + 2., 2.) / 2.;\n        }",
              },
            ],
            framentBefore:
              "\n    uniform float uCtRangeMax;\n    uniform float uCtRangeMin;\n    uniform vec2 uCtRatio;\n    uniform vec3 uCtPosition;\n    uniform vec4 uRangeColorMax;\n    uniform vec4 uRangeColorMin;\n    varying vec3 ctPosition;",
            framentAfter:
              "\n    float ctLength = distance(uCtPosition, ctPosition);\n    float ctIndex = uCtRatio.y;\n    if (ctLength > uCtRangeMin) {\n        float ctLen = clamp(ctLength, uCtRangeMin, uCtRangeMax) - uCtRangeMin;\n        float t = easeVal(1.0 - ctLen / (uCtRangeMax - uCtRangeMin));\n\n        ctIndex = mix(uCtRatio.x, uCtRatio.y, t);\n        diffuseColor.a *= mix(uRangeColorMax.a, uRangeColorMin.a, t);\n        outgoingLight *= mix(uRangeColorMax.rgb, uRangeColorMin.rgb, t);\n    }\n    outgoingLight = outgoingLight * ctIndex;\n",
            type: "contrast",
          };
          en(e.material, { config: r, filter: n });
        },
        edit: (e = {}, t) => {
          const { uniforms: n } = e;
          G.loopObject(t, (e) => {
            const i = t[e];
            switch (e) {
              case "range":
                (n.uCtRangeMin.value = i.x), (n.uCtRangeMax.value = i.y);
                break;
              case "rangeColor":
                {
                  const e = G.getColorArr(i.min, !0),
                    t = G.getColorArr(i.max, !0);
                  (n.uRangeColorMin.value = new THRDev3.Vector4(...e)),
                    (n.uRangeColorMax.value = new THRDev3.Vector4(...t));
                }
                break;
              case "position":
                n.uCtPosition.value = i;
                break;
              case "ratio":
                n.uCtRatio.value = i;
            }
          });
        },
      },
      ocean: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = {
            uOcTexture1: { value: t.texture1 },
            uOcTexture2: { value: t.texture2 },
            uOcTextureNoise: { value: t.textureNoise },
            uOcTextureMap: { value: t.textureMap },
            uOcJbColor: { value: new THRDev3.Color(t.sideColor) },
            uOcTime: i.uTime,
          };
          window.editColor = o.uOcJbColor.value;
          const s = {
            uniforms: o,
            vextrerBefore: "",
            vextrerAfter: "",
            framentFunc: [],
            framentBefore:
              "\n    uniform sampler2D uOcTextureNoise;\n    uniform sampler2D uOcTexture1;\n    uniform sampler2D uOcTexture2;\n    uniform sampler2D uOcTextureMap;\n    uniform float uOcTime;\n    uniform vec3 uOcJbColor;\n\n    float coast2water_fadedepth = 0.10;\n    float large_waveheight      = 0.50; // change to adjust the \"heavy\" waves\n    float large_wavesize        = 2.;  // factor to adjust the large wave size\n    float small_waveheight      = .6;  // change to adjust the small random waves\n    float small_wavesize        = .5;   // factor to ajust the small wave size\n    float water_softlight_fact  = 15.;  // range [1..200] (should be << smaller than glossy-fact)\n    float water_glossylight_fact= 66.; // range [1..200]\n    float particle_amount       = 70.;\n    vec3 watercolor             = vec3(0.43, 0.60, 0.66); // 'transparent' low-water color (RGB)\n    vec3 watercolor2            = vec3(0.06, 0.14, 0.17); // deep-water color (RGB, should be darker than the low-water color)\n    vec3 water_specularcolor    = vec3(1.3, 1.3, 0.9);    // specular Color (RGB) of the water-highlights\n    vec3 light;\n\n\n\n    #define USETEXTUREHEIGHT 0\n\n    float hash( float n ){\n        return fract(sin(n)*43758.5453123);\n    }\n\n    // 2d noise function\n    float noise1( in vec2 x ){\n    vec2 p  = floor(x);\n    vec2 f  = smoothstep(0.0, 1.0, fract(x));\n    float n = p.x + p.y*57.0;\n    return mix(mix( hash(n+  0.0), hash(n+  1.0),f.x),\n        mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);\n    }\n\n    float noise(vec2 p){\n    return texture2D(uOcTextureNoise,p*vec2(1./256.),0.0).x;\n    }\n\n    float height_map( vec2 p ){\n    #if USETEXTUREHEIGHT\n    float f = 0.15+texture2D(uOcTexture1, p*0.6, 0.0).r*2.;\n    #else\n    mat2 m = mat2( 0.9563*1.4,  -0.2924*1.4,  0.2924*1.4,  0.9563*1.4 );\n    p = p*6.;\n    float f = 0.6000*noise1( p ); p = m*p*1.1;\n    f += 0.2500*noise1( p ); p = m*p*1.32;\n    f += 0.1666*noise1( p ); p = m*p*1.11;\n    f += 0.0834*noise( p ); p = m*p*1.12;\n    f += 0.0634*noise( p ); p = m*p*1.13;\n    f += 0.0444*noise( p ); p = m*p*1.14;\n    f += 0.0274*noise( p ); p = m*p*1.15;\n    f += 0.0134*noise( p ); p = m*p*1.16;\n    f += 0.0104*noise( p ); p = m*p*1.17;\n    f += 0.0084*noise( p );\n    const float FLAT_LEVEL = 0.525;\n    if (f<FLAT_LEVEL)\n        f = f;\n    else\n        f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase\n    #endif\n    return clamp(f, 0., 10.);\n    }\n\n    vec3 terrain_map( vec2 p ){\n        return vec3(0.7, .55, .4) + texture2D(uOcTexture1, p*2.).rgb*.5;\n    }\n\n    const mat2 m = mat2( 0.72, -1.60,  1.60,  0.72 );\n\n    float water_map( vec2 p, float height ){\n    vec2 p2 = p*large_wavesize;\n    vec2 shift1 = 0.001 * vec2( uOcTime * 160.0* 2.0, uOcTime * 120.0 * 2.0 );\n    vec2 shift2 = 0.001 * vec2( uOcTime * 190.0*2.0, -uOcTime * 130.0 * 2.0 );\n\n    // coarse crossing 'ocean' waves...\n    float f = 0.6000*noise( p );\n    f += 0.2500*noise( p*m );\n    f += 0.1666*noise( p*m*m );\n    float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;\n\n    p *= small_wavesize;\n    f = 0.;\n    float amp = 1.0, s = .5;\n    for (int i=0; i<9; i++)\n    { p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }\n\n    return wave+f*small_waveheight;\n    }\n\n    float nautic(vec2 p){\n    p *= 18.;\n    float f = 0.;\n    float amp = 1.0, s = .5;\n    for (int i=0; i<3; i++)\n    { p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+uOcTime*s ))-.5); amp = amp*.5; s*=-1.227; }\n    return pow(1.-f, 5.);\n    }\n\n    float particles(vec2 p){\n    p *= 200.;\n    float f = 0.;\n    float amp = 1.0, s = 1.5;\n    for (int i=0; i<3; i++)\n    { p = m*p*1.2; f += amp*noise( p+uOcTime*s ); amp = amp*.5; s*=-1.227; }\n    return pow(f*.35, 7.)*particle_amount;\n    }\n\n\n    float test_shadow( vec2 xy, float height){\n        vec3 rs = vec3(xy, height);\n        vec3 rd = normalize( light - rs );\n\n        float hit = 1.0;\n        float t   = 0.001;\n        for (int j=1; j<25; j++)\n        {\n            vec3 p = rs + t *rd;\n            float h = height_map( p.xy );\n            float height_diff = p.z - h;\n            if (height_diff<0.0)\n            {\n                return 0.0;\n            }\n            t += 0.01+height_diff*.02;\n            hit = min(hit, 2.*height_diff/t); // soft shaddow\n        }\n        return hit;\n    }\n\n    vec3 CalcTerrain(vec2 uv, float height){\n        vec3 col = terrain_map( uv );\n        float h1 = height_map(uv-vec2(0., 0.01));\n        float h2 = height_map(uv+vec2(0., 0.01));\n        float h3 = height_map(uv-vec2(0.01, 0.));\n        float h4 = height_map(uv+vec2(0.01, 0.));\n        vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));\n        vec3 rs = vec3(uv, height);\n        vec3 rd = normalize( light - rs );\n        float grad = dot(norm, rd);\n        col *= grad+pow(grad, 8.);\n        float terrainshade = test_shadow( uv, height );\n        col = mix(col*.25, col, terrainshade);\n        return col;\n    }\n\n\n    ",
            framentAfter:
              "\n    vec2 ocUv = vUv * 3.0;\n    light = vec3(0.6, 0.6, 2.8); // position of the sun\n\n    float WATER_LEVEL = 2.0; // Water level (range: 0.0 - 2.0)\n    float deepwater_fadedepth = 0.5 + coast2water_fadedepth;\n\n    float height = height_map( ocUv );\n    vec3 col;\n\n    float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);\n    float level = WATER_LEVEL + .2*water_map(ocUv*15. + vec2(uOcTime*.1), waveheight);\n    if (height > level)\n    {\n        col = CalcTerrain(ocUv, height);\n    }\n    if (height <= level)\n    {\n        vec2 dif = vec2(.0, .01);\n        vec2 pos = ocUv*15. + vec2(uOcTime*.01);\n        float h1 = water_map(pos-dif,waveheight);\n        float h2 = water_map(pos+dif,waveheight);\n        float h3 = water_map(pos-dif.yx,waveheight);\n        float h4 = water_map(pos+dif.yx,waveheight);\n        vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane\n        ocUv += normwater.xy*.002*(level-height);\n\n        col = CalcTerrain(ocUv, height);\n\n        float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);\n        float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);\n        float intensity = col.r*.2126+col.g*.7152+col.b*.0722;\n        watercolor = mix(watercolor*intensity, watercolor2 * 1.1, smoothstep(0., 1., coastfade2));\n\n        vec3 rs = vec3(ocUv, WATER_LEVEL);\n        vec3 rd = normalize( light - rs ); // ray-direction to the light from water-position\n        float grad     = dot(normwater, rd); // dot-product of norm-vector and light-direction\n        float specular = pow(grad, water_softlight_fact);  // used for soft highlights\n        float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights\n        float gradpos  = dot(vec3(0., 0., 1.), rd);\n        // used for diffusity (some darker corona around light's specular reflections...)\n        float specular1= smoothstep(0., 1., pow(gradpos, 5.));\n        float watershade  = test_shadow(ocUv, level );\n        watercolor *= 2.2+watershade;\n        watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;\n        watercolor /= (1.+specular1*1.25);\n        watercolor += watershade*specular2*water_specularcolor;\n        watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(ocUv)+vec3(1., 1., 1.)*particles(ocUv));\n\n        col = mix(col, watercolor, coastfade);\n    }\n    vec4 uDuOcTextureMap = texture2D(uOcTextureMap, vec2(vUv.x, 1.0 - vUv.y)) ;\n    // vec3 uDuColor = mix(vec3(0.537254, 0.51764, 0.4588), vec3(), uDuOcTextureMap.r);\n    outgoingLight = mix(col, uOcJbColor, uDuOcTextureMap.a) * outgoingLight * 0.5;",
            type: "ocean",
          };
          en(e.material, { config: s, filter: n });
        },
        edit: (e) => {
          G.loopObject(e, (t) => {
            e[t];
          });
        },
      },
      uv: {
        create: function (e, t) {
          G.eachMaterial(e.material, (e) => {
            t.map && (e.map = t.map),
              e.map && t.offset && G.loopObject(t, (e) => {});
          });
        },
        update: function (e, t) {
          G.eachMaterial(e.material, (e) => {
            e.map && t.offset && e.map.offset.add(t.offset);
          });
        },
      },
      waterSimple: {
        create: (e, { config: t, filter: n = !0 }, i) => {
          if (!e.material) return;
          const o = {
            uniforms: {
              ...i,
              uWsColor: { value: new THRDev3.Color(t.color) },
              uWsTxueColor: { value: new THRDev3.Color(t.textureColor) },
              uWsSpeed: { value: t.speed },
              uWsScale: { value: t.scale },
              uWsRotate: { value: THRDev3.MathUtils.degToRad(t.rotate) },
            },
            vextrerBefore: "",
            vextrerAfter: "",
            framentFunc: [
              { type: "rotate2d" },
              { type: "hash" },
              { type: "hash2" },
              { type: "noise2" },
              { type: "noise2b" },
              { type: "fbm2" },
              { type: "water" },
            ],
            framentBefore:
              "\n    uniform float uWsScale;\n    uniform float uWsSpeed;\n    uniform float uWsRotate;\n    uniform vec3 uWsColor;\n    uniform vec3 uWsTxueColor;",
            framentAfter:
              "\n    float iTime = uWsSpeed * uTime;\n    vec2 uv = (rotate2d(uWsRotate) * vUv - 0.5) * uWsScale;\n    float t = 1.5 * iTime;\n    float st = sin(t), ct = cos(t);\n    m2 = mat2(ct, st, -st, ct);\n    vec2 p = water(uv + 2.* iTime) + 2.;\n    float c = length(p) / 7.;\n    c = clamp(pow(c, 3.), 0., 1.);\n    vec3 col = texture2D(map, uv / 20. + p / 45.).rgb * mix(uWsTxueColor, outgoingLight, 0.5);\n    outgoingLight = mix(col, uWsColor, c);",
            type: "waterSimple",
          };
          en(e.material, { config: o, filter: n });
        },
        edit: (e) => {
          G.loopObject(e, (t) => {
            e[t];
          });
        },
      },
    };
    class nn extends de {
      constructor(e) {
        super(e),
          z()(this, "animate", (e) => {
            (this.time.value += e),
              this.animateCallbacks.forEach((e) => {
                e.callback && e.callback(e.object, e.config);
              });
          }),
          (this.animateCallbacks = []),
          (this.time = { value: 0 }),
          this.initInterFace();
      }
      initInterFace() {
        Object.keys(Jt.callback).forEach((e) => {
          Jt.callback[e].bind(this);
        }),
          (this.Interface = Jt);
      }
      setDefaultConfig(e) {
        G.copy(e, { draco: null });
      }
      compEftInit() {
        this._triggerInnerEvent("mounted", { val: this.group });
      }
      disposeCompEft() {
        this.animateCallbacks.forEach((e) => {
          (e.object = null), (e.callback = null);
        }),
          (this.animateCallbacks = []);
      }
      getEffectConfig(e) {
        const { config: t } = e,
          n = { ...t };
        return (
          G.loopObject(t, (e) => {
            if (e.includes("texture") || e.includes("map")) {
              if ("string" != typeof t[e]) return;
              const i = this.renderer.getTxue(t[e]);
              i &&
                ((n[e] = i),
                (i.wrapS = THRDev3.RepeatWrapping),
                (i.wrapT = THRDev3.RepeatWrapping));
            }
          }),
          { ...e, config: n }
        );
      }
      setMeshEffect(e) {
        const { object: t, config: n } = e,
          { type: i } = n,
          o = { uTime: this.time },
          s = this.getEffectConfig(n);
        switch (i) {
          case "uv":
            tn.uv.create(t, s.config),
              this.animateCallbacks.push({
                type: "uv",
                config: s.config,
                object: t,
                callback: tn.uv.update,
              });
            break;
          default: {
            const e = tn[i];
            e && e.create(t, s, o);
          }
        }
      }
      addObjectEffect(e) {
        const { object: t } = e;
        this.setMeshEffect(e);
      }
      editObjectEffect(e) {
        const { object: t, config: n } = e,
          { type: i } = n,
          o = this.getEffectConfig(n);
        {
          const e = tn[i];
          e && e.edit(t, o);
        }
      }
      setUniformsConfig(e) {
        const { option: t, config: n } = e,
          i = tn[n.type];
        i && i.edit(t, n.config);
      }
      replaceMeshEffect(e) {
        const { config: t } = e,
          { type: n } = t;
      }
      setConfig(e, t) {
        return Jt.setConfig.call(this, e, t);
      }
      getConfig(e, t) {
        return Jt.getConfig.call(this, e, t);
      }
    }
    nn.description = "模型效果组件";
    var on = nn;
    var sn = (e, t) => {
        e.material &&
          G.eachMaterial(e.material, (e) => {
            e.userData.bake = t;
          });
      },
      rn = (e) => {
        let t = "",
          n = "",
          i = "",
          o = "";
        return (
          e &&
            ((t =
              "\n            attribute vec2 uv2;\n            varying vec2 vUv2;"),
            (n = "vUv2 = uv2;"),
            (i =
              "varying vec2 vUv2;\n            uniform sampler2D uBkaeMap2;\n            uniform float uBakeScale;"),
            (o =
              "vec3 bakeCol = texture2D(uBkaeMap2, vUv2).rgb;\n            bakeCol.x = pow(bakeCol.x, uBakeScale);\n            bakeCol.y = pow(bakeCol.y, uBakeScale);\n            bakeCol.z = pow(bakeCol.z, uBakeScale);\n\n            outgoingLight *= bakeCol;\n\n            gl_FragColor = vec4( outgoingLight, diffuseColor.a );")),
          {
            vextrerBefore: t,
            framentBefore: i,
            framentAfter: o,
            vextrerAfter: n,
          }
        );
      };
    var an = {
      hash: () =>
        "\nfloat hash( in vec2 p )  {\n    return fract(sin(p.x*15.32+p.y*35.78) * 43758.23);\n}",
      hash2: () =>
        "\nvec2 hash2(vec2 p) {\n    return vec2(hash(p*.754),hash(1.5743*p.yx+4.5891))-.5;\n}",
      noise2: () =>
        "\nvec2 noise2(vec2 x) {\n    vec2 add = vec2(1.0, 0.0);\n    vec2 p = floor(x);\n    vec2 f = fract(x);\n    f = f*f*(3.0-2.0*f);\n    \n    vec2 res = mix(mix( hash2(p),hash2(p + add.xy),f.x),\n                mix( hash2(p + add.yx), hash2(p + add.xx),f.x),f.y);\n    return res;\n}",
      noise2b: () =>
        "\n// Simplex Noise from IQ\nvec2 noise2b( in vec2 p ) {\n    const float K1 = 0.366025404; // (sqrt(3)-1)/2;\n    const float K2 = 0.211324865; // (3-sqrt(3))/6;\n    p /=2.;\n    vec2 i = floor( p + (p.x+p.y)*K1 );\n    \n    vec2 a = p - i + (i.x+i.y)*K2;\n    vec2 o = (a.x>a.y) ? vec2(1.0,0.0) : vec2(0.0,1.0); //vec2 of = 0.5 + 0.5*vec2(sign(a.x-a.y), sign(a.y-a.x));\n    vec2 b = a - o + K2;\n    vec2 c = a - 1.0 + 2.0*K2;\n\n    vec3 h = max( 0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );\n\n    vec3 nx = h*h*h*h*vec3( dot(a,hash2(i+0.0)), dot(b,hash2(i+o)), dot(c,hash2(i+1.0)));\n    vec3 ny = h*h*h*h*vec3( dot(a,hash2(i+4.5)), dot(b,hash2(i+o+4.5)), dot(c,hash2(i+1.0+4.5)));\n\n    return vec2(dot( nx, vec3(70.0) ),dot( ny, vec3(70.0) ));\n}",
      rotate2d: () =>
        "\nmat2 rotate2d(float _angle){\n    return mat2(cos(_angle),-sin(_angle),\n            sin(_angle),cos(_angle));}",
      fbm2: () =>
        "\nmat2 m2;\nvec2 fbm2(vec2 x) {\n    vec2 r = vec2(1.0);\n    float a = 0.7;\n    \n    for (int i = 0; i < 5; i++) {\n        r += m2*noise2b(x+r)*a; \n        x +=.2*r+.4;\n    }     \n    return r;\n}",
      water: () =>
        "\nvec2 water(vec2 x) {\n    x=fbm2(x);\n    x=abs(x)/dot(x,x)-1.;\n    return abs(x)/dot(x,x)-1.;\n}",
      easeOutSine: () =>
        "\nfloat easeOutSine (float x) {\n    return sin((x * 3.14159265) / 2.);\n}",
      distanceTo: () =>
        "\nfloat distanceToSquared(vec3 sv, vec3 tv) {\n    float dx = sv.x - tv.x;\n    float dy = sv.y - tv.y;\n    float dz = sv.z - tv.z;\n\n    return dx * dx + dy * dy + dz * dz;\n}  \nfloat distanceTo(vec3 sv, vec3 tv) {\n    float val = distanceToSquared(sv, tv);\n    return sqrt(val);\n}",
    };
    var ln = (e) => {
      let t = "";
      return (
        e.forEach((e) => {
          const { type: n, value: o, func: s } = e;
          if (s) t += s;
          else {
            const e = ((e, t) => {
              let n = "";
              return (
                G.loopObject(i, (o) => {
                  i[o][e] && (n = i[o][e](t));
                }),
                n || (an[e] && (n = an[e]())),
                n
              );
            })(n, o);
            t += e;
          }
        }),
        t
      );
    };
    var cn = (e) => {
        const { bake: t = {}, modelEffect: n = [] } = e.userData;
        if (0 === n.length && 0 === Object.values(t).length) return;
        const i = t.uv2 ? "bake" : "",
          o = ((e) => {
            let t = "",
              n = "",
              i = "",
              o = "",
              s = "",
              r = "",
              a = {};
            0 !== e.length && (i += "\n        uniform float uTime;");
            const l = [];
            e.forEach((e) => {
              l.find((t) => t.type === e.type) || l.push(e);
            });
            const c = [];
            return (
              l.forEach((e) => {
                (t += e.vextrerBefore),
                  (n += e.vextrerAfter),
                  (o += e.framentBefore),
                  (s += e.framentAfter || ""),
                  (r += e.outputAfter || ""),
                  (a = { ...a, ...e.uniforms }),
                  e.framentFunc.forEach((e) => {
                    c.find((t) => t.type === e.type)
                      ? e.func && c.push(e)
                      : c.push(e);
                  });
              }),
              (i += ln(c)),
              {
                vextrerBefore: t,
                vextrerAfter: n,
                framentFunc: i,
                framentBefore: o,
                framentAfter: s,
                outputAfter: r,
                uniforms: a,
              }
            );
          })(n);
        e.customProgramCacheKey = () => n.map((e) => e.type).toString() + i;
        const s = rn(!!t.uv2),
          r = (e) => {
            G.loopObject(o.uniforms, (t) => {
              e.uniforms[t] = o.uniforms[t];
            }),
              t.uv2 &&
                ((e.uniforms.uBkaeMap2 = { value: t.uv2 }),
                (e.uniforms.uBakeScale = { value: t.bakeScale }));
            const n = `\n            ${s.vextrerBefore}\n            ${o.vextrerBefore}\n            varying vec2 vUv1;\n            void main() {\n                vUv1 = uv;\n                ${o.vextrerAfter}\n                ${s.vextrerAfter}\n        `;
            e.vertexShader = e.vertexShader.replace("void main() {", n);
            const i = `\n            varying vec2 vUv1;\n            ${o.framentBefore}\n            ${s.framentBefore}\n            ${o.framentFunc}\n            void main() {\n        `;
            e.fragmentShader = e.fragmentShader.replace("void main() {", i);
          };
        if ("ShaderMaterial" === e.type && "contrast" === n[0].type) {
          r(e);
          const t = `\n            float opt1 = 1.0;\n            ${(
            o.framentAfter || ""
          ).replace(
            "diffuseColor.a",
            "opt1"
          )}\n            gl_FragColor = vec4( outgoingLight, opt1 * alpha );\n            ${
            o.outputAfter || ""
          }\n            ${s.framentAfter}\n        `;
          e.fragmentShader = e.fragmentShader.replace(
            "gl_FragColor = vec4( outgoingLight, alpha );",
            t
          );
        } else
          e.onBeforeCompile = (t) => {
            r(t);
            const n = `\n                ${
              o.framentAfter || ""
            }\n                #include <output_fragment>\n                ${
              o.outputAfter || ""
            }\n                ${s.framentAfter}\n            `;
            (t.fragmentShader = t.fragmentShader.replace(
              "#include <output_fragment>",
              n
            )),
              (e.shader = t),
              (e.needsUpdate = !0);
          };
        e.needsUpdate = !0;
      },
      hn = {
        setConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "listener":
              this.on(t.name, t.callback, t.triggerOnce);
              break;
            case "event":
              this.bind(t.name, t.callback, t.triggerOnce);
              break;
            case "option":
              this.isAfterData && (n = this.setOption(t));
              break;
            case "sceneMaterial":
              this.setSceneMaterial(t);
              break;
            case "values":
              this.setMaterialValues(t.material, t.config);
              break;
            case "bake":
              this.setBake(t);
              break;
            case "pbrConfig":
              this.setPbrConfig(t);
              break;
            case "compile":
              this.compileMaterial(t.material);
              break;
            case "dispose":
              this.disposeCompEft();
          }
          return n;
        },
        getConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "option":
              n = G.extend(!0, {}, this.config);
              break;
            case "box":
              n = G.extend(t.object);
          }
          return n;
        },
        callback: {},
        checkList: { position: "setPosition" },
      };
    const un = {};
    var dn = (e, t, n) => {
      let i = [];
      un[e.type]
        ? (i = un[e.type])
        : (G.loopObject(e, (t) => {
            e[t] && e[t].isColor && i.push(t);
          }),
          (un[e.type] = i));
      const o = ["name"];
      G.loopObject(t, (s) => {
        o.includes(s) ||
          ("map" === s
            ? ((e[s] = n.renderer.getTxue(t[s])),
              void 0 !== t.mapEncoding && (e[s].encoding = t.mapEncoding),
              (e[s].needsUpdate = !0))
            : "mapEncoding" === s
            ? e.map &&
              ((e.map.encoding = t.mapEncoding), (e.map.needsUpdate = !0))
            : i.includes(s) && e[s].isColor
            ? e[s].setStyle(t[s])
            : (e[s] = t[s]));
      });
    };
    var pn = {
      transVal: function (e) {
        const t = { ...e };
        return (
          G.loopObject(e, (n) => {
            const i = e[n];
            (!n.includes("Map") && "map" !== n) ||
              "string" != typeof i ||
              (t[n] = this.renderer.getTxue(i));
          }),
          delete t.id,
          t
        );
      },
    };
    class fn extends de {
      constructor(e) {
        super(e),
          (this.keyObjs = {}),
          (this.replaceObjs = {}),
          (this.pbrConfig = {}),
          this.initInterFace();
      }
      initInterFace() {
        Object.keys(hn.callback).forEach((e) => {
          hn.callback[e].bind(this);
        }),
          (this.Interface = hn);
      }
      setDefaultConfig(e) {
        G.copy(e, { draco: null });
      }
      compEftInit() {
        this._triggerInnerEvent("mounted", { val: this.group });
      }
      disposeCompEft() {}
      setMaterialValues(e, t) {
        dn(e, t, this);
      }
      setReplaceMaterialValue(e, t) {
        if (this.keyObjs[t.uuid]) e.setValues(this.keyObjs[t.uuid]);
        else {
          const n = Object.keys(e),
            i = Object.keys(t),
            o = {},
            s = ["type", "pbr", "config"];
          n.forEach((e) => {
            i.includes(e) && !s.includes(e) && (o[e] = t[e]);
          }),
            e.setValues(o),
            (this.keyObjs[e.uuid] = o);
        }
      }
      replaceMaterial(e, t) {
        G.eachMaterial(e.material, (n, i) => {
          const { name: o } = n;
          let s = null;
          this.replaceObjs[o]
            ? (s = this.replaceObjs[o])
            : ((s = new THRDev3[t]()),
              (this.replaceObjs[o] = s),
              (this.replaceObjs[o].name = n.name),
              this.setReplaceMaterialValue(s, n)),
            Array.isArray(e.material) ? (e.material[i] = s) : (e.material = s);
        });
      }
      setAloneMaterial(e) {
        if (!e.material) return;
        const t = Array.isArray(e.material);
        G.eachMaterial(e.material, (n, i) => {
          n._alone
            ? t
              ? (e.material[i] = n.clone())
              : (e.material = n.clone())
            : (n._alone = !0);
        });
      }
      setMaterialInitData(e) {
        e.isMaterial && ((e.userData.bake = {}), (e.userData.modelEffect = []));
      }
      setSceneMaterial({
        scene: e,
        material: t,
        replaceMaterial: n,
        isAloneReplace: i = !1,
        pbr: o = [],
      }) {
        e.isObject3D &&
          ((this.replaceObjs = {}),
          e.traverse((e) => {
            e.isMesh &&
              e.material &&
              (THRDev3[n] && this.replaceMaterial(e, n),
              i && this.setAloneMaterial(e),
              G.eachMaterial(e.material, (e) => {
                if ((this.setMaterialInitData(e), G.isArray(t))) {
                  const n = t.filter((t) => t.name === e.name || !0 === t.name),
                    i = t.find((t) => t.name === e.name && t.pbr);
                  if (
                    (n.length > 0 &&
                      n.forEach((t) => {
                        this.setMaterialValues(e, t);
                      }),
                    i)
                  ) {
                    const t = o.find((e) => e.id === i.pbr);
                    t && this.setPBR(e, t);
                  }
                } else G.isObject(t) && this.setMaterialValues(e, t);
              }));
          }));
      }
      setBake({ object: e, config: t }) {
        e.isMesh
          ? sn(e, t)
          : e.isGroup &&
            0 !== e.children.length &&
            e.children.forEach((e) => {
              e.isMesh && sn(e, t);
            });
      }
      setPbrConfig(e) {
        if (!e) return;
        const { preUrl: t } = e;
        this.pbrConfig.preUrl = t;
      }
      setPBR(e, t) {
        const n = pn.transVal.call(this, t);
        e.isMaterial && e.setValues(n);
      }
      setPbrMaterial() {}
      compileMaterial(e) {
        cn(e);
      }
      setConfig(e, t) {
        return hn.setConfig.call(this, e, t);
      }
      getConfig(e, t) {
        return hn.getConfig.call(this, e, t);
      }
    }
    fn.description = "模型材质组件";
    var mn = fn;
    n(31);
    var gn = class {
      constructor(e) {
        this.config = e;
      }
      getOption(e) {
        return {
          textureWidth: e.textureWidth || 512,
          textureHeight: e.textureHeight || 512,
          waterNormals: e.normal,
          sunDirection: new THRDev3.Vector3(),
          sunColor: new THRDev3.Color(e.sunColor),
          waterColor: new THRDev3.Color(e.waterColor),
          distortionScale: e.distortionScale,
          fog: e.fog,
          alpha: e.alpha || 1,
          clipBias: e.clipBias || 0,
          Mirrorfilter: e.Mirrorfilter || [],
        };
      }
      init() {
        const { object: e, option: t } = this.config,
          { geometry: n, parent: i } = e,
          o = new THRDev3.Water(n, this.getOption(t));
        i.add(o),
          o.position.copy(e.position),
          o.rotation.copy(e.rotation),
          o.scale.copy(e.scale),
          (o.isFilter = !0),
          (e.visible = !1),
          (this.mesh = o);
      }
      render() {
        this.init();
      }
    };
    var vn = class {
      constructor(e) {
        this.config = e;
      }
      getVertexs() {
        return "\n        varying vec3 vPosition;\n        varying vec2 vUv;\n        uniform float time; \n        #include <fog_pars_vertex>\n        // 整体旋转\n        mat2 rotate2d(float _angle){\n            return mat2(cos(_angle),-sin(_angle),\n                        sin(_angle),cos(_angle));\n        }\n        // 旋转角度\n        float r = float(ROTATE);\n        void main() { \n            vUv = rotate2d( r ) * uv;; \n            \n            vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n            gl_Position = projectionMatrix * mvPosition;\n            #include <fog_vertex>\n        }";
      }
      getFragment() {
        return "\n        uniform float time; \n        uniform float uScale; \n        uniform float uSpeed; \n        uniform vec3 uColor; \n        uniform vec3 uTextureColor; \n        varying vec2 vUv;  \n        uniform sampler2D uMap;\n        #include <fog_pars_fragment>\n        float hash( in vec2 p )  {\n            return fract(sin(p.x*15.32+p.y*35.78) * 43758.23);\n        }\n    \n        vec2 hash2(vec2 p) {\n            return vec2(hash(p*.754),hash(1.5743*p.yx+4.5891))-.5;\n        }\n\n        vec2 add = vec2(1.0, 0.0);\n    \n        vec2 noise2(vec2 x) {\n            vec2 p = floor(x);\n            vec2 f = fract(x);\n            f = f*f*(3.0-2.0*f);\n            \n            vec2 res = mix(mix( hash2(p),          hash2(p + add.xy),f.x),\n                            mix( hash2(p + add.yx), hash2(p + add.xx),f.x),f.y);\n            return res;\n        }\n    \n        // Simplex Noise from IQ\n        vec2 noise2b( in vec2 p ) {\n            const float K1 = 0.366025404; // (sqrt(3)-1)/2;\n            const float K2 = 0.211324865; // (3-sqrt(3))/6;\n            p /=2.;\n            vec2 i = floor( p + (p.x+p.y)*K1 );\n            \n            vec2 a = p - i + (i.x+i.y)*K2;\n            vec2 o = (a.x>a.y) ? vec2(1.0,0.0) : vec2(0.0,1.0); //vec2 of = 0.5 + 0.5*vec2(sign(a.x-a.y), sign(a.y-a.x));\n            vec2 b = a - o + K2;\n            vec2 c = a - 1.0 + 2.0*K2;\n    \n            vec3 h = max( 0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );\n    \n            vec3 nx = h*h*h*h*vec3( dot(a,hash2(i+0.0)), dot(b,hash2(i+o)), dot(c,hash2(i+1.0)));\n            vec3 ny = h*h*h*h*vec3( dot(a,hash2(i+4.5)), dot(b,hash2(i+o+4.5)), dot(c,hash2(i+1.0+4.5)));\n    \n            return vec2(dot( nx, vec3(70.0) ),dot( ny, vec3(70.0) ));\n            \n        }\n    \n    \n        mat2 m2;\n    \n        vec2 fbm2(vec2 x) {\n            vec2 r = vec2(1.0);\n            float a = 0.7;\n            \n            for (int i = 0; i < 5; i++) {\n                r += m2*noise2b(x+r)*a; \n                x +=.2*r+.4;\n            }     \n            return r;\n        }\n    \n    \n        vec2 water(vec2 x) {\n            x=fbm2(x);\n            x=abs(x)/dot(x,x)-1.;\n            return abs(x)/dot(x,x)-1.;\n        }\n     \n        void main(void) {\n            float iTime = uSpeed * time;\n            vec2 uv = (vUv - 0.5) * uScale; \n    \n            float t = 1.5 * iTime;\n            float st = sin(t), ct = cos(t);\n            m2 = mat2(ct, st, -st, ct);\n            vec2 p = water(uv + 2.* iTime) + 2.;\n            float c = length(p) / 7.;\n            c = clamp(pow(c, 3.), 0., 1.);\n            vec3 col = texture2D(uMap, uv / 20. + p / 45.).rgb * uTextureColor;    \n            col = mix(col, uColor, c);\n            gl_FragColor = vec4(col, 1.0);\n    \n            #include <fog_fragment>\n        }\n        ";
      }
      getUniforms({ time: e, map: t }, n) {
        const { speed: i, color: o, scale: s, textureColor: r } = n;
        return {
          ...THRDev3.UniformsLib.fog,
          time: e,
          uColor: { value: new THRDev3.Color(o) },
          uTextureColor: { value: new THRDev3.Color(r) },
          uSpeed: { value: i },
          uScale: { value: s },
          uMap: { value: t },
        };
      }
      render() {
        const { object: e, option: t, time: n, renderer: i } = this.config,
          { texture: o, rotate: s } = t,
          r = i.getTxue(o),
          a = new THRDev3.ShaderMaterial({
            vertexShader: this.getVertexs(),
            fragmentShader: this.getFragment(),
            defines: { ROTATE: THRDev3.MathUtils.degToRad(s) },
            uniforms: this.getUniforms({ time: n, map: r }, t),
            fog: !!i.scene.fog,
          });
        e.material.dispose(), (e.material = a);
      }
    };
    var yn = class {
      constructor(e) {
        this.config = e;
      }
      getVertexs() {
        return "\n        varying vec3 vPosition;\n        varying vec2 vUv;\n        uniform float uTime; \n        #include <fog_pars_vertex>\n        // 整体旋转\n        mat2 rotate2d(float _angle){\n            return mat2(cos(_angle),-sin(_angle),\n                        sin(_angle),cos(_angle));\n        }\n        // 旋转角度\n        // float r = float(ROTATE);\n        void main() { \n            // vUv = rotate2d( r ) * uv; \n            vUv = uv;\n            \n            vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n            gl_Position = projectionMatrix * mvPosition;\n            #include <fog_vertex>\n        }";
      }
      getFragment() {
        return "\n        uniform float uTime; \n        uniform float uSpeed; \n        uniform vec3 uColor; \n        varying vec2 vUv;  \n        uniform sampler2D uMap;\n\n        #define MOD2 vec2(4.438975,3.972973)\n        const int k_fmbWaterSteps = 4;\n        float Hash( float p ) \n        {\n            // https://www.shadertoy.com/view/4djSRW - Dave Hoskins\n            vec2 p2 = fract(vec2(p) * MOD2);\n            p2 += dot(p2.yx, p2.xy+19.19);\n            return fract(p2.x * p2.y);    \n            //return fract(sin(n)*43758.5453);\n        }\n\n        vec2 Hash2( float p ) \n        {\n            // https://www.shadertoy.com/view/4djSRW - Dave Hoskins\n            vec3 p3 = fract(vec3(p) * vec3(.1031, .1030, .0973));\n            p3 += dot(p3, p3.yzx + 19.19);\n            return fract((p3.xx+p3.yz)*p3.zy);\n        }\n\n        vec3 SmoothNoise_DXY(in vec2 o) \n        {\n            vec2 p = floor(o);\n            vec2 f = fract(o);\n                \n            float n = p.x + p.y*57.0;\n\n            float a = Hash(n+  0.0);\n            float b = Hash(n+  1.0);\n            float c = Hash(n+ 57.0);\n            float d = Hash(n+ 58.0);\n            \n            vec2 f2 = f * f;\n            vec2 f3 = f2 * f;\n            \n            vec2 t = 3.0 * f2 - 2.0 * f3;\n            vec2 dt = 6.0 * f - 6.0 * f2;\n            \n            float u = t.x;\n            float v = t.y;\n            float du = dt.x;\t\n            float dv = dt.y;\t\n\n            float res = a + (b-a)*u +(c-a)*v + (a-b+d-c)*u*v;\n            \n            float dx = (b-a)*du + (a-b+d-c)*du*v;\n            float dy = (c-a)*dv + (a-b+d-c)*u*dv;    \n            \n            return vec3(dx, dy, res);\n        }\n\n        vec3 FBM_DXY( vec2 p, vec2 flow, float ps, float df ) {\n            vec3 f = vec3(0.0);\n            float tot = 0.0;\n            float a = 1.0;\n            //flow *= 0.6;\n            for( int i=0; i<k_fmbWaterSteps; i++)\n            {\n                p += flow;\n                flow *= -0.75; // modify flow for each octave - negating this is fun\n                vec3 v = SmoothNoise_DXY( p );\n                f += v * a;\n                p += v.xy * df;\n                p *= 2.0;\n                tot += a;\n                a *= ps;\n            }\n            return f / tot;\n        }\n\n        vec4 SampleWaterNormal( vec2 vUV, vec2 vFlowOffset, float fMag, float fFoam )\n        {    \n            vec2 vFilterWidth = max(abs(dFdx(vUV)), abs(dFdy(vUV)));\n            float fFilterWidth= max(vFilterWidth.x, vFilterWidth.y);\n            \n            float fScale = (1.0 / (1.0 + fFilterWidth * fFilterWidth * 2000.0));\n            float fGradientAscent = 0.25 + (fFoam * -1.5);\n            vec3 dxy = FBM_DXY(vUV * 20.0, vFlowOffset * 20.0, 0.75 + fFoam * 0.25, fGradientAscent);\n            fScale *= max(0.25, 1.0 - fFoam * 5.0); // flatten normal in foam\n            vec3 vBlended = mix( vec3(0.0, 1.0, 0.0), normalize( vec3(dxy.x, fMag, dxy.y) ), fScale );\n            return vec4( normalize( vBlended ), dxy.z * fScale );\n        }\n\n        float SampleWaterFoam( vec2 vUV, vec2 vFlowOffset, float fFoam )\n        {\n            float f =  FBM_DXY(vUV * 30.0, vFlowOffset * 50.0, 0.8, -0.5 ).z;\n            float fAmount = 0.2;\n            f = max( 0.0, (f - fAmount) / fAmount );\n            return pow( 0.5, f );\n        }\n\n        vec3 GetWaterExtinction( float dist )\n        {\n            float fOpticalDepth = dist * 6.0;\n\n            vec3 vExtinctCol = 1.0 - vec3(0.5, 0.4, 0.1);           \n            vec3 vExtinction = exp2( -fOpticalDepth * vExtinctCol );\n            \n            return vExtinction;\n        }\n\n        vec4 SampleFlowingNormal( const vec2 vUV, const vec2 vFlowRate, const float fFoam, const float time, out float fOutFoamTex )\n        {\n            float fMag = 2.5 / (1.0 + dot( vFlowRate, vFlowRate ) * 5.0);\n            float t0 = fract( time );\n            float t1 = fract( time + 0.5 );\n            \n            float i0 = floor( time );\n            float i1 = floor( time + 0.5 );\n            \n            float o0 = t0 - 0.5;\n            float o1 = t1 - 0.5;\n            \n            vec2 vUV0 = vUV + Hash2(i0);\n            vec2 vUV1 = vUV + Hash2(i1);\n            \n            vec4 sample0 = SampleWaterNormal( vUV0, vFlowRate * o0, fMag, fFoam );\n            vec4 sample1 = SampleWaterNormal( vUV1, vFlowRate * o1, fMag, fFoam );\n\n            float weight = abs( t0 - 0.5 ) * 2.0;\n            //weight = smoothstep( 0.0, 1.0, weight );\n\n            float foam0 = SampleWaterFoam( vUV0, vFlowRate * o0 * 0.25, fFoam );\n            float foam1 = SampleWaterFoam( vUV1, vFlowRate * o1 * 0.25, fFoam );\n            \n            vec4 result=  mix( sample0, sample1, weight );\n            result.xyz = normalize(result.xyz);\n\n            fOutFoamTex = mix( foam0, foam1, weight );\n\n            return result;\n        }\n\n        /**\n         * 将任意范围的值映射到另一个范围, 即将beforeStart~beforeEnd范围的值映射到start~end\n         * @param beforeStart   要映射前的开始值\n         * @param beforeEnd     要映射前的结束值\n         * @param start   要映射范围的开始值\n         * @param end   要映射范围的结束值\n         * @param curVal   要映射的值\n         * return   映射后的值\n         **/\n        vec4 colorMix(vec4 upper, vec4 under) {\n            float opt = upper.w + (1. - upper.w) * under.w;\n            upper = vec4(clamp((upper.xyz * upper.w + under.xyz * under.w * (1. - upper.w)) / opt, 0.0, 1.0), opt);\n            return upper;\n        }\n        #include <fog_pars_fragment>\n        \n        void main(void) {\n            \n            vec2 useUv = vec2(vUv.y, vUv.x) * vec2(10.0, 10.0);\n            float fFoam = 0.0;           \n            float fWaterFoamTex = 1.0;\n            vec3 vCameraPos = vec3(100.0, 100.0, 0.0);\n            vec3 vCameraTarget = vec3(0.0, 0, 0.0);\n            vec4 vWaterNormalAndHeight = SampleFlowingNormal( useUv, vec2(1.0, 1.0), fFoam, uTime * 0.1, fWaterFoamTex );\n            // 已知法线和底图颜色, 计算折射后的实际颜色\n            vec3 vRayDir = normalize(vCameraTarget - vCameraPos);\n            vec3 vRefractRayDir = refract( vRayDir, vWaterNormalAndHeight.xyz, 1.0 / 1.3333 ); // 1.0 / 1.3333\n            float baseDepth = 0.01;\n            float depthDiff = 0.03;\n            vec2 dist = baseDepth + vec2(sin(useUv.x) * depthDiff, sin(useUv.y) * depthDiff);\n            vec4 refractColor = texture2D(uMap, useUv + vRefractRayDir.xy * dist);\n            vec3 vExtinction = GetWaterExtinction( length(dist)); // 越深的地方颜色值越小\n            refractColor.xyz = refractColor.xyz * vExtinction;\n\n            vec3 vReflectRayDir = reflect( vRayDir, vWaterNormalAndHeight.xyz );\n            vec4 reflectColor = vec4(1.0);\n            float reflectivity = 1.0;\n            float theta = max( dot( -vRayDir, vWaterNormalAndHeight.xyz ), 0.0 ); \n            float reflectance = reflectivity * pow( theta, 30.0 );\n            vec4 topColor = reflectColor * reflectance;\n            gl_FragColor = colorMix(topColor, refractColor);\n    \n            #include <fog_fragment>\n        }\n        ";
      }
      getUniforms({ time: e, map: t }, n) {
        const { speed: i, color: o, scale: s, textureColor: r } = n;
        return (
          console.log(e, 111),
          {
            ...THRDev3.UniformsLib.fog,
            uTime: e,
            uColor: { value: new THRDev3.Color(o) },
            uTextureColor: { value: new THRDev3.Color(r) },
            uSpeed: { value: i },
            uScale: { value: s },
            uMap: { value: t },
          }
        );
      }
      render() {
        const { object: e, option: t, time: n, renderer: i } = this.config,
          { texture: o, rotate: s } = t,
          r = i.getTxue(o),
          a = new THRDev3.ShaderMaterial({
            vertexShader: this.getVertexs(),
            fragmentShader: this.getFragment(),
            defines: { ROTATE: THRDev3.MathUtils.degToRad(s) },
            uniforms: this.getUniforms({ time: n, map: r }, t),
            fog: !!i.scene.fog,
          });
        e.material.dispose(), (e.material = a);
      }
    };
    var bn = class {
      constructor(e) {
        this.config = e;
      }
      createVideo(e, t) {
        const n = "video_" + t,
          i = document.createElement("video"),
          o = document.createElement("source");
        return (
          (i.loop = !0),
          (i.autoplay = "autoplay"),
          (i.id = n),
          (i.volume = 0),
          (i.style.display = "none"),
          (o.src = e),
          (o.type = "video/mp4"),
          i.appendChild(o),
          document.querySelector("body").appendChild(i),
          n
        );
      }
      init(e) {
        const { object: t, option: n } = e,
          { repeat: i = { x: 1, y: 1 }, video: o } = n,
          s = THRDev3.MathUtils.generateUUID(),
          r = this.createVideo(o, s),
          a = document.querySelector("#" + r),
          l = new THRDev3.VideoTexture(a);
        (l.wrapS = THRDev3.RepeatWrapping),
          (l.repeat.x = i.x),
          (l.repeat.y = i.y),
          a.play(),
          G.eachMaterial(t.material, (e) => {
            e.map && e.dispose(), (e.map = l), (e.dithering = !0);
          });
      }
      render() {
        this.init(this.config);
      }
    };
    var xn = class {
      constructor(e) {
        this.config = e;
      }
      getVertex() {
        return "\n        varying vec3 vPosition;\n        void main() {\n            vPosition = position;\n            vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n            gl_Position = projectionMatrix * mvPosition;\n        }\n        ";
      }
      getFragment() {
        return "\n            varying vec3 vPosition;\n            uniform float time;\n            uniform vec3 uColor;\n            uniform vec2 uHeight;\n            uniform vec3 uLineColor;\n            void main(void) {\n                // 计算高度比例\n                float i = (vPosition.y - uHeight.x) / (uHeight.y - uHeight.x);\n                float r = 1.0;\n                float my = mod(vPosition.y - time, r);\n                vec3 col = uColor;\n                // 判断高度\n                if (my < r / 2.0) {\n                    col = uLineColor;\n                    i *= 1.2;\n                }\n                gl_FragColor = vec4(col, 1.0 - i);\n    \n            }";
      }
      getUniforms(e, t, { max: n, min: i }) {
        return {
          time: t,
          uColor: { value: new THRDev3.Color(e.color) },
          uLineColor: { value: new THRDev3.Color(e.line) },
          uHeight: { value: new THRDev3.Vector2(i.y, n.y) },
        };
      }
      init() {
        const { object: e, option: t, time: n } = this.config;
        e.geometry.computeBoundingBox();
        const i = new THRDev3.ShaderMaterial({
          uniforms: this.getUniforms(t, n, e.geometry.boundingBox),
          transparent: !0,
          depthWrite: !1,
          vertexShader: this.getVertex(),
          fragmentShader: this.getFragment(),
        });
        e.material = i;
      }
      render() {
        this.init();
      }
    };
    var wn = (e = !1, t, n) => {
      const i = {
        vertex_basc: `\n        varying vec3 cPosition;\n        varying vec2 cUv;\n        uniform vec3 uHeight;\n        ${
          e ? "" : "\n    #include <fog_pars_vertex>"
        }\n        `,
        vertex: "",
        vertex_pars: "",
        fragment_basc: `varying vec3 cPosition;\n        varying vec2 cUv;\n        uniform float time;\n        uniform float uSpeed;\n        uniform float uGap;\n        uniform float uLineHeight;\n        uniform float resolution;\n    \n        uniform vec4 uColor;\n        uniform vec4 uTopColor;\n        uniform vec4 uHighColor;\n        uniform vec3 uHeight;\n        ${
          e
            ? ""
            : "\n    float PI = 3.14159265;\n    float PI2 = 6.28318530718;\n\n    #include <fog_pars_fragment>"
        }\n        `,
        fragment: "",
        fragment_pars: "",
      };
      switch (t) {
        case "effect1":
          i.fragment = `\n            float h = cPosition.${n} + abs(uHeight.x);\n            float i = h / uHeight.z;\n            cols = mix(uColor, uTopColor, i);\n    \n            float basicHeight = uHeight.z * (uGap + uLineHeight);\n            float mh = mod(cPosition.${n} - iTime, basicHeight);\n            float lh = uLineHeight * uHeight.z;\n            if (mh < lh) {\n                cols.rgb = mix(uHighColor, cols, cos(mh / lh * PI2)).rgb;\n            }`;
          break;
        case "effect2":
          (i.fragment_pars =
            "vec3 rgb2hsv(vec3 c)\n            {\n                vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n                vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n                vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n            \n                float d = q.x - min(q.w, q.y);\n                float e = 1.0e-10;\n                return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n            }\n            \n            vec3 hsv2rgb(vec3 c)\n            {\n                vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n                vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n                return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n            }\n            \n            float randTd(vec2 n) {\n                return fract(sin(cos(dot(n, vec2(12.9898,12.1414)))) * 83758.5453);\n            }\n            \n            float noise(vec2 n) {\n                const vec2 d = vec2(0.0, 1.0);\n                vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n                return mix(mix(randTd(b), randTd(b + d.yx), f.x), mix(randTd(b + d.xy), randTd(b + d.yy), f.x), f.y);\n            }\n            \n            float fbm(vec2 n) {\n                float total = 0.0, amplitude = 1.0;\n                for (int i = 0; i <5; i++) {\n                    total += noise(n) * amplitude;\n                    n += n*1.5;\n                    amplitude *= 0.47;\n                }\n                return total;\n            }"),
            (i.fragment =
              "\n            iTime = iTime * 0.1;\n            const vec3 c1 = vec3(0.5, 0.0, 0.1);\n            const vec3 c2 = vec3(0.9, 0.1, 0.0);\n            const vec3 c3 = vec3(0.2, 0.1, 0.7);\n            const vec3 c4 = vec3(1.0, 0.9, 0.1);\n            const vec3 c5 = vec3(0.1);\n            const vec3 c6 = vec3(0.9);\n    \n            vec2 speed = vec2(1.3, 0.1);\n            float shift = 1.77+sin(iTime*2.0)/10.0;\n            float alpha = 1.0;\n            float dist = 6.0 + sin(iTime*0.4)/.6;\n            vec2 p = vec2(1.0 - cUv);\n            p.x -= iTime/1.1;\n            float q = fbm(p - iTime * 0.01+1.0*sin(iTime)/10.0);\n            float qb = fbm(p - iTime * 0.002+0.1*cos(iTime)/5.0);\n            float q2 = fbm(p - iTime * 0.44 - 5.0*cos(iTime)/7.0) - 6.0;\n            float q3 = fbm(p - iTime * 0.9 - 10.0*cos(iTime)/30.0)-4.0;\n            float q4 = fbm(p - iTime * 2.0 - 20.0*sin(iTime)/20.0)+2.0;\n            q = (q + qb - q2 -q3  + q4)/3.8;\n            vec2 r = vec2(fbm(p + q /2.0 + iTime * speed.x - p.x - p.y), fbm(p + q - iTime * speed.y));\n            vec3 c = mix(c1, c2, fbm(p + r)) + mix(c3, c4, r.x) - mix(c5, c6, r.y);\n            vec3 color = vec3(c * cos(shift * p.y));\n            color -= .25;\n            color.r *= 1.02;\n            vec3 hsv = rgb2hsv(color);\n            hsv.y *= hsv.z  * 0.8;\n            hsv.z *= hsv.y * 1.3;\n            color = hsv2rgb(hsv);\n            cols = vec4(color.x, color.y, color.z, color.x);");
          break;
        case "effect3":
          (i.fragment_pars =
            "\n            #define cc vec2(0.5,0.5)\n            #define smoothness 1.0 \n            #define N_LAYERS 6.0\n            #define SNOW_ALPHA 1.0\n            #define SPEED 0.3\n            #define bg vec4(0.8,0.8,0.9,0.0)\n    \n            float smoothCircle(vec2 position,float relativeSize){\n                float d = distance(cc,position)*2./relativeSize;\n                if (d > 1.0){\n                    return 0.0;\n                }\n                else{\n                    return clamp(smoothness/d-smoothness,-1.0,1.0);\n                }\n            }\n     \n            float randF(float n){\n                return fract(sin(n) * 43758.5453123);\n            }\n    \n            // used to determine whether to draw a flake in the grid\n            // the magic number is just me mashing the keyboard\n            bool rand2d(float i, float j, float probability){\n                return  (randF(i + j*7.8124861) > probability);\n            }\n    \n     \n            float circleGrid(vec2 position, float spacing, float dotSize){\n                \n                // idx => which dot we are showing in the grid.\n                \n                // check x and y index to see if we should draw it or not.\n                float idx = floor(1./spacing * position.x);\n                float yIdx = floor(1./spacing * position.y);\n    \n                // much higher than .06 causes the grid to be obvious\n                if (rand2d(idx,yIdx,0.06)){\n                    return 0.0;\n                }\n                \n                // modify the size of the flake a bit\n                float relativeSize = (0.5 + 0.5*randF(yIdx))*dotSize / spacing;\n                \n                return smoothCircle(vec2(\n                    fract(1./spacing*position.x),\n                    fract(1./spacing*position.y + yIdx)\n                ),relativeSize);\n            }\n    \n            "),
            (i.fragment =
              '\n            vec2 uv = cUv;\n            vec2 uvsq = vec2(uv.x, uv.y);\n            float amnt = 0.0;\n            \n            float rotX = 0.0;\n            float rotY = 0.0;\n            rotX = -2.0 ;\n            rotY = -2.0 ;\n            \n            \n            for (float i = 0.0; i < N_LAYERS; i ++){\n                float p = 0.5 + ((i+1.) / N_LAYERS)*0.4;\n                // small flakes in bg drawn first with lower speed\n                \n                // the only reason we add "i" is so it tweaks the noise called on this position later.\n                vec2 fallPosition = vec2(\n                    rotX * (1.0-p) + uvsq.x + i + p*sin(iTime/2.+i)/4.*SPEED,\n                    rotY * (1.0-p) + i * 3.0 + uvsq.y + iTime*p/1.*SPEED\n                );\n                amnt = amnt + SNOW_ALPHA * circleGrid(fallPosition, 0.06* p, 0.04* p*p); \n            }\n            vec4 tColor = mix(uColor, uTopColor, 1.0 - uv.y);\n            cols = mix(tColor,bg,1.0-amnt);\n           ');
          break;
        case "effect4":
          (i.fragment_pars =
            "\n            #define Hash(x) fract(sin(x) * 34214.0)\n    \n            "),
            (i.fragment =
              "\n            vec2 uv = cUv / 2.0;\n            float sp = Hash(floor(uv.x * 64.));\n            uv.y += sp * iTime;\n            float x_s = fract(uv.x * 64.);\n            float y_s = fract(uv.y * 18.);\n         \n            float g = Hash(floor(uv.x * 410.) + Hash(floor(uv.y * 140.)));\n            \n            g = smoothstep(abs(g - 0.5), 0.2, 0.5);\n            g *= step(x_s, 0.6) * step(y_s, 0.8) * step(Hash(floor(uv.y * 18.)) + Hash(floor(uv.x * 64.)), 1.0);\n            \n            g *= (1. - sp * 0.5);\n            \n            cols = vec4(uColor.rgb, g);\n           ");
          break;
        default:
          i.fragment = `\n            float i = (cPosition.${n} + abs(uHeight.x)) / uHeight.z;\n            cols = mix(uColor, uTopColor, i);\n            `;
      }
      return i;
    };
    var Cn = (e, t) => {
      const n = wn(!1, e, t);
      return {
        vertexShader: `\n    ${n.vertex_basc}\n    ${n.vertex_pars}\n    void main() {\n        cPosition = position;\n        cUv = uv;\n        ${n.vertex}\n        vec4 mcPosition = modelViewMatrix * vec4(position, 1.0);\n        gl_Position = projectionMatrix * mcPosition;\n\n        #include <fog_vertex>\n    }\n    `,
        fragmentShader: `\n    ${n.fragment_basc}\n    ${n.fragment_pars}\n    void main(void) {\n        vec4 cols = uColor;\n        float iTime = uSpeed * time;\n        ${n.fragment}\n        cols.a *= clamp(iTime, .0, 1.);\n        gl_FragColor = cols;\n\n        #include <fog_fragment>\n    }`,
      };
    };
    var Tn = (e, t, n) => {
      const i = wn(!0);
      switch (t) {
        case "effect1":
          i.fragment = `\n            float h = cPosition.${n} + abs(uHeight.x);\n            float i = h / uHeight.z;\n            cols = mix(uColor, uTopColor, i);\n    \n            float basicHeight = uHeight.z * (uGap + uLineHeight);\n            float mh = mod(cPosition.${n} - iTime, basicHeight);\n            float lh = uLineHeight * uHeight.z;\n            if (mh < lh) {\n                cols.rgb = mix(uHighColor, cols, cos(mh / lh * PI2)).rgb;\n            }`;
          break;
        case "effect2":
          (i.fragment_pars =
            "vec3 rgb2hsv(vec3 c)\n            {\n                vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n                vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n                vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n            \n                float d = q.x - min(q.w, q.y);\n                float e = 1.0e-10;\n                return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n            }\n            \n            vec3 hsv2rgb(vec3 c)\n            {\n                vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n                vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n                return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n            }\n            \n            float randTd(vec2 n) {\n                return fract(sin(cos(dot(n, vec2(12.9898,12.1414)))) * 83758.5453);\n            }\n            \n            float noise(vec2 n) {\n                const vec2 d = vec2(0.0, 1.0);\n                vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n                return mix(mix(randTd(b), randTd(b + d.yx), f.x), mix(randTd(b + d.xy), randTd(b + d.yy), f.x), f.y);\n            }\n            \n            float fbm(vec2 n) {\n                float total = 0.0, amplitude = 1.0;\n                for (int i = 0; i <5; i++) {\n                    total += noise(n) * amplitude;\n                    n += n*1.5;\n                    amplitude *= 0.47;\n                }\n                return total;\n            }"),
            (i.fragment =
              "\n            iTime = iTime * 0.1;\n            const vec3 c1 = vec3(0.5, 0.0, 0.1);\n            const vec3 c2 = vec3(0.9, 0.1, 0.0);\n            const vec3 c3 = vec3(0.2, 0.1, 0.7);\n            const vec3 c4 = vec3(1.0, 0.9, 0.1);\n            const vec3 c5 = vec3(0.1);\n            const vec3 c6 = vec3(0.9);\n    \n            vec2 speed = vec2(1.3, 0.1);\n            float shift = 1.77+sin(iTime*2.0)/10.0;\n            float alpha = 1.0;\n            float dist = 6.0 + sin(iTime*0.4)/.6;\n            vec2 p = vec2(1.0 - cUv);\n            p.x -= iTime/1.1;\n            float q = fbm(p - iTime * 0.01+1.0*sin(iTime)/10.0);\n            float qb = fbm(p - iTime * 0.002+0.1*cos(iTime)/5.0);\n            float q2 = fbm(p - iTime * 0.44 - 5.0*cos(iTime)/7.0) - 6.0;\n            float q3 = fbm(p - iTime * 0.9 - 10.0*cos(iTime)/30.0)-4.0;\n            float q4 = fbm(p - iTime * 2.0 - 20.0*sin(iTime)/20.0)+2.0;\n            q = (q + qb - q2 -q3  + q4)/3.8;\n            vec2 r = vec2(fbm(p + q /2.0 + iTime * speed.x - p.x - p.y), fbm(p + q - iTime * speed.y));\n            vec3 c = mix(c1, c2, fbm(p + r)) + mix(c3, c4, r.x) - mix(c5, c6, r.y);\n            vec3 color = vec3(c * cos(shift * p.y));\n            color -= .25;\n            color.r *= 1.02;\n            vec3 hsv = rgb2hsv(color);\n            hsv.y *= hsv.z  * 0.8;\n            hsv.z *= hsv.y * 1.3;\n            color = hsv2rgb(hsv);\n            cols = vec4(color.x, color.y, color.z, color.x);");
          break;
        case "effect3":
          (i.fragment_pars =
            "\n            #define cc vec2(0.5,0.5)\n            #define smoothness 1.0 \n            #define N_LAYERS 6.0\n            #define SNOW_ALPHA 1.0\n            #define SPEED 0.3\n            #define bg vec4(0.8,0.8,0.9,0.0)\n    \n            float smoothCircle(vec2 position,float relativeSize){\n                float d = distance(cc,position)*2./relativeSize;\n                if (d > 1.0){\n                    return 0.0;\n                }\n                else{\n                    return clamp(smoothness/d-smoothness,-1.0,1.0);\n                }\n            }\n     \n            float randF(float n){\n                return fract(sin(n) * 43758.5453123);\n            }\n    \n            // used to determine whether to draw a flake in the grid\n            // the magic number is just me mashing the keyboard\n            bool rand2d(float i, float j, float probability){\n                return  (randF(i + j*7.8124861) > probability);\n            }\n    \n     \n            float circleGrid(vec2 position, float spacing, float dotSize){\n                \n                // idx => which dot we are showing in the grid.\n                \n                // check x and y index to see if we should draw it or not.\n                float idx = floor(1./spacing * position.x);\n                float yIdx = floor(1./spacing * position.y);\n    \n                // much higher than .06 causes the grid to be obvious\n                if (rand2d(idx,yIdx,0.06)){\n                    return 0.0;\n                }\n                \n                // modify the size of the flake a bit\n                float relativeSize = (0.5 + 0.5*randF(yIdx))*dotSize / spacing;\n                \n                return smoothCircle(vec2(\n                    fract(1./spacing*position.x),\n                    fract(1./spacing*position.y + yIdx)\n                ),relativeSize);\n            }\n    \n            "),
            (i.fragment =
              '\n            vec2 uv = cUv;\n            vec2 uvsq = vec2(uv.x, uv.y);\n            float amnt = 0.0;\n            \n            float rotX = 0.0;\n            float rotY = 0.0;\n            rotX = -2.0 ;\n            rotY = -2.0 ;\n            \n            \n            for (float i = 0.0; i < N_LAYERS; i ++){\n                float p = 0.5 + ((i+1.) / N_LAYERS)*0.4;\n                // small flakes in bg drawn first with lower speed\n                \n                // the only reason we add "i" is so it tweaks the noise called on this position later.\n                vec2 fallPosition = vec2(\n                    rotX * (1.0-p) + uvsq.x + i + p*sin(iTime/2.+i)/4.*SPEED,\n                    rotY * (1.0-p) + i * 3.0 + uvsq.y + iTime*p/1.*SPEED\n                );\n                amnt = amnt + SNOW_ALPHA * circleGrid(fallPosition, 0.06* p, 0.04* p*p); \n            }\n            vec4 tColor = mix(uColor, uTopColor, 1.0 - uv.y);\n            cols = mix(tColor,bg,1.0-amnt);\n           ');
          break;
        case "effect4":
          (i.fragment_pars =
            "\n            #define Hash(x) fract(sin(x) * 34214.0)\n    \n            "),
            (i.fragment =
              "\n            vec2 uv = cUv / 2.0;\n            float sp = Hash(floor(uv.x * 64.));\n            uv.y += sp * iTime;\n            float x_s = fract(uv.x * 64.);\n            float y_s = fract(uv.y * 18.);\n         \n            float g = Hash(floor(uv.x * 410.) + Hash(floor(uv.y * 140.)));\n            \n            g = smoothstep(abs(g - 0.5), 0.2, 0.5);\n            g *= step(x_s, 0.6) * step(y_s, 0.8) * step(Hash(floor(uv.y * 18.)) + Hash(floor(uv.x * 64.)), 1.0);\n            \n            g *= (1. - sp * 0.5);\n            \n            cols = vec4(uColor.rgb, g);\n           ");
          break;
        default:
          i.fragment = `\n            float i = (cPosition.${n} + abs(uHeight.x)) / uHeight.z;\n            cols = mix(uColor, uTopColor, i);\n            `;
      }
      const o = `${i.vertex_basc}\n        ${i.vertex_pars}\n        void main() {\n            cPosition = position;\n            cUv = uv;\n            ${i.vertex}\n        `;
      e.vertexShader = e.vertexShader.replace("void main() {", o);
      const s = `${i.fragment_basc}\n        ${i.fragment_pars}\n        void main() {\n        `;
      e.fragmentShader = e.fragmentShader.replace("void main() {", s);
      const r = `\n        vec4 cols = vec4(1.0);\n        float iTime = uSpeed * time;\n        ${i.fragment}\n        gl_FragColor = vec4( mix(cols.rgb, outgoingLight, 0.5), diffuseColor.a );;\n        `;
      e.fragmentShader = e.fragmentShader.replace(
        "gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
        r
      );
    };
    var _n = class {
      constructor(e) {
        z()(this, "getHeight", (e, t, n) => {
          e.geometry.computeBoundingBox();
          const { min: i, max: o } = e.geometry.boundingBox;
          let s = t;
          return "auto" === t && (s = o[n] - i[n]), [i[n], o[n], s];
        }),
          (this.config = e),
          this.setUniforms(this.config);
      }
      setUniforms(e) {
        const { object: t, option: n, time: i, renderer: o } = e,
          { direction: s, gap: r, lineHeight: a } = n,
          l = s.toLowerCase(),
          c = this.getColor(n.color),
          h = this.getColor(n.topColor),
          u = this.getColor(n.highColor),
          d = n.speed || 1,
          p = this.getHeight(t, n.height, l),
          { width: f, height: m } = o;
        this.uniforms = {
          time: i,
          uColor: { value: c },
          uGap: { value: r },
          uTopColor: { value: h },
          uLineHeight: { value: a },
          uHighColor: { value: u },
          uSpeed: { value: d },
          uHeight: { value: new THRDev3.Vector3(...p) },
          resolution: { value: new THRDev3.Vector2(f, m) },
        };
      }
      getColor(e) {
        return new THRDev3.Vector4(...G.getColorArr(e, !0));
      }
      createShader(e) {
        const {
            direction: t,
            category: n,
            side: i = 2,
            materialConfig: o = {},
          } = e,
          s = t.toLowerCase();
        new THRDev3.ShaderMaterial({
          side: i,
          transparent: !0,
          uniforms: this.uniforms,
          ...Cn(n, s),
        }).setValues(o);
      }
      editMaterial(e, t) {
        const { direction: n, category: i, materialConfig: o = {} } = t,
          s = n.toLowerCase();
        (e.material.onBeforeCompile = (t) => {
          (t.uniforms = { ...t.uniforms, ...this.uniforms }),
            e.material.replaceFoo && e.material.replaceFoo(t, 1),
            Tn(t, i, s);
        }),
          e.material.setValues(o);
      }
      render() {
        const { option: e, object: t } = this.config,
          { material: n } = e;
        if (n) this.editMaterial(t, e);
        else {
          const n = this.createShader(e);
          t.material.dispose(), (t.material = n);
        }
      }
    };
    var Dn = class {
      constructor(e) {
        this.config = e;
      }
      setShader(e, t, n) {
        (e.uniforms = { ...e.uniforms, ...n }),
          t.replaceFoo && t.replaceFoo(e, 1),
          this.setVertex(e),
          this.setFragment(e);
      }
      setVertex(e) {
        e.vertexShader = e.vertexShader.replace(
          "void main() {",
          "\n        varying vec2 cUv;\n        void main() {\n            cUv = uv;\n        "
        );
      }
      setFragment(e) {
        e.fragmentShader = e.fragmentShader.replace(
          "void main() {",
          "\n        #define OCTAVES 6\n\n        // 引入\n        varying vec2 cUv;\n        uniform sampler2D uMap;\n        // 纹理随机性\n        float random (in vec2 st) {\n            return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n        }\n\n        // 噪音\n        float noise (in vec2 st) {\n            vec2 i = floor(st);\n            vec2 f = fract(st);\n    \n            // Four corners in 2D of a tile\n            float a = random(i);\n            float b = random(i + vec2(1.0, 0.0));\n            float c = random(i + vec2(0.0, 1.0));\n            float d = random(i + vec2(1.0, 1.0));\n    \n            vec2 u = f * f * (3.0 - 2.0 * f);\n    \n            return mix(a, b, u.x) +\n                    (c - a)* u.y * (1.0 - u.x) +\n                    (d - b) * u.x * u.y;\n        }\n     \n        float fbm (in vec2 st) {\n            // Initial values\n            float value = 0.0;\n            float amplitude = .5;\n            float frequency = 0.;\n            //\n            // Loop of octaves\n            for (int i = 0; i < OCTAVES; i++) {\n                value += amplitude * noise(st);\n                st *= 2.;\n                amplitude *= .6;\n            }\n            return value;\n        }\n        void main() {\n        "
        );
        e.fragmentShader = e.fragmentShader.replace(
          "gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
          "\n        vec3 c = texture2D(uMap, cUv).rgb;\n        vec2 st = cUv;\n    \n        vec3 colorn = vec3(0.1);\n        colorn += fbm(st * 1.0);\n    \n        gl_FragColor = vec4(mix(c, outgoingLight, clamp(colorn.g * 1.4, 0.0, 1.0)), diffuseColor.a );;\n        "
        );
      }
      getTexture(e, t) {
        const n = e.getTxue(t);
        return (
          (n.wrapS = THRDev3.RepeatWrapping),
          (n.wrapT = THRDev3.RepeatWrapping),
          n.repeat.set(1, 1),
          n
        );
      }
      init() {
        const { object: e, option: t, renderer: n } = this.config,
          { texture: i, material: o } = t,
          s = { uMap: { value: this.getTexture(n, i) } };
        Array.isArray(o) && Array.isArray(e.material)
          ? e.material.forEach((e) => {
              o.includes(e.name) &&
                (e.onBeforeCompile = (t) => {
                  this.setShader(t, e, s);
                });
            })
          : G.eachMaterial(e.material, (e) => {
              e.onBeforeCompile = (t) => {
                this.setShader(t, e, s);
              };
            });
      }
      render() {
        this.init();
      }
    };
    var Mn = {
      water: gn,
      water2: vn,
      water3: yn,
      video: bn,
      fence: xn,
      wall: _n,
      grassland: Dn,
      diffusion: class {
        constructor(e) {
          const { option: t, time: n, object: i } = e;
          (this.config = { time: n, object: i, direction: t.direction || "z" }),
            this.init(t);
        }
        init(e) {
          const {
            speed: t = 1,
            color: n = "#fff",
            width: i = 30,
            center: o = [0, 0],
            maxLength: s,
          } = e;
          this.uniforms = {
            time: this.config.time,
            uSpeed: { value: t },
            uColor: { value: new THRDev3.Color(n) },
            uWidth: { value: i },
            uMax: { value: s },
            uCenter: { value: new THRDev3.Vector2(o[0], o[1]) },
          };
        }
        setMaterial(e) {
          G.eachMaterial(e.material, (e) => {
            this.setMaterialShader(e, this.uniforms);
          });
        }
        setVertexs(e) {
          e.vertexShader = e.vertexShader.replace(
            "void main() {",
            "\n        varying vec3 vPosition;\n        void main() {\n            vPosition = position;\n        "
          );
        }
        setFragment(e) {
          const t = `\n        float iTime = mod(time * uSpeed, uMax);\n        vec4 col = vec4( outgoingLight, diffuseColor.a );;\n        // 计算离定中心点的位置距离\n        float centerLength = distance(uCenter, vec2(vPosition.x, vPosition.${this.config.direction}));\n        float currentIndex = iTime / uMax;\n        float tTime = iTime * currentIndex;\n\n\n        // 计算扩散范围 及渐变\n        if (tTime < centerLength && tTime > centerLength - uWidth) {\n            float i = (centerLength - tTime) / uWidth;\n\n            float l = pcurve(i, 3.0, 1.);\n\n            float iTou = 1.0 - clamp(currentIndex, .0, .5) / .5;\n            col.rgb = mix(col.rgb, uColor, clamp(l - iTou, .0, 1.0));\n\n            col.rgb += l * 0.4;\n        }\n\n        gl_FragColor = col;\n        `;
          e.fragmentShader = e.fragmentShader.replace(
            "void main() {",
            "\n        varying vec3 vPosition;\n\n        uniform float time;\n        uniform float uMax;\n        uniform float uSpeed;\n        uniform float uWidth;\n        uniform vec2 uCenter;\n        uniform vec3 uColor;\n\n        float pcurve( float x, float a, float b ){\n            float k = pow(a+b,a+b) / (pow(a,a)*pow(b,b));\n            return k * pow( x, a ) * pow( 1.0-x, b );\n        }\n\n\n        void main() {\n        "
          );
          const n = "gl_FragColor = vec4( outgoingLight, diffuseColor.a );";
          -1 !== e.fragmentShader.indexOf(n)
            ? (e.fragmentShader = e.fragmentShader.replace(n, t))
            : (e.fragmentShader = e.fragmentShader.replace(
                "#include <output_fragment>",
                "#include <output_fragment>" + t
              ));
        }
        setMaterialShader(e, t) {
          (e.onBeforeCompile = (n) => {
            (n.uniforms = { ...n.uniforms, ...t }),
              e.replaceFoo && e.replaceFoo(n, 1),
              this.setVertexs(n),
              this.setFragment(n);
          }),
            (e.needsUpdate = !0);
        }
        render() {
          this.setMaterial(this.config.object);
        }
      },
    };
    class Sn extends de {
      constructor(e) {
        super(e),
          z()(this, "animate", (e) => {
            (this.time.value += e),
              this.EffectMange.animate(e),
              this.animateArray.forEach((e) => {
                e.material.uniforms.time.value = this.time.value * e._speed;
              });
          }),
          (this.db = null),
          (this.time = { value: 0 }),
          (this.animateArray = []),
          (this.EffectMange = new on(this.renderer)),
          (this.MaterialMange = new mn(this.renderer)),
          this.initInterFace();
      }
      initInterFace() {
        Object.keys(Wt.callback).forEach((e) => {
          Wt.callback[e].bind(this);
        }),
          (this.Interface = Wt);
      }
      setDefaultConfig(e) {
        G.copy(e, {
          group: {
            scale: { x: 1, y: 1, z: 1 },
            position: { x: 0, y: 0, z: 0 },
            rotation: { x: 0, y: 0, z: 0 },
          },
          indexDB: {
            version: 1,
            id: "2",
            name: "w3d",
            state: !1,
            table: {
              name: "LoaderModel",
              indexName: "model",
              keyName: "name",
              valueName: "value",
            },
          },
          draco: null,
          isMounted: !1,
          isDev: !1,
        });
      }
      compEftInit() {
        this.config.draco && qt(this.config.draco),
          (this.group.isModelScene = !0);
        const { scale: e, position: t, rotation: n } = this.config.group;
        this.group.scale.copy(e),
          this.group.position.copy(t),
          this.group.rotation.setFromVector3(n),
          Zt(this.config.indexDB).then((e) => {
            (this.db = e), this.loaderInit();
          });
      }
      disposeCompEft() {
        this.EffectMange.setConfig("dispose"),
          this.MaterialMange.setConfig("dispose"),
          (this.EffectMange = null),
          (this.MaterialMange = null),
          (this.animateArray = []);
      }
      loaderInit() {
        this.loaderModels(this.config.model, () => {
          this.config.isMounted &&
            this._triggerInnerEvent("mounted", { scene: this.group });
        }),
          this.config.isMounted ||
            this._triggerInnerEvent("mounted", { scene: this.group });
      }
      loaderModels(e, t) {
        Xt(
          e,
          (e, t) => {
            this.handelModel(e, t);
          },
          () => {
            requestAnimationFrame(() => {
              this._triggerInnerEvent("endCallBack", { scene: this.group }),
                this.updateMeshEvent(),
                t && t();
            });
          }
        );
      }
      handelModel(e, t) {
        const {
          bake: n = [],
          effect: i = [],
          pick: o = [],
          mesh: s = [],
          pbr: r,
          renderOrder: a = 0,
          visible: l = !0,
        } = t;
        (e.visible = l), (e.renderOrder = a);
        const {
          scale: c = { x: 1, y: 1, z: 1 },
          position: h = { x: 0, y: 0, z: 0 },
          rotation: u = { x: 0, y: 0, z: 0 },
        } = t;
        e.scale.multiply(c), e.position.add(h);
        const { _x: d, _y: p, _z: f } = e.rotation;
        e.rotation.set(u.x + d, u.y + p, u.z + f),
          this.MaterialMange.setConfig("sceneMaterial", {
            scene: e,
            material: t.material,
            replaceMaterial: t.replaceMaterial,
            isAloneReplace: t.isAloneReplace,
            pbr: t.pbr,
          }),
          this.MaterialMange.setConfig("pbrConfig", r);
        const m = !0 === o || "all" === o;
        m && this.eventArr.push(e);
        const g = ["AmbientLight", "PointLight", "DirectionalLight"];
        Bt(e, t.mesh, (e) => {
          if (g.includes(e.type)) return void (e.visible = !1);
          t.shadow && ((e.castShadow = !0), (e.receiveShadow = !0));
          const r = n.find((t) => t.name === e.name);
          if (r) {
            const t = Qt.getBakeConfig.call(this, r);
            this.MaterialMange.setConfig("bake", { object: e, config: t });
          }
          const a = s.find((t) => t.name === e.name || !0 === t.name);
          a &&
            (G.loopObject(a, (t) => {
              "name" !== t &&
                (e[t] && (e[t].isVector3 || e[t].isVector2)
                  ? e[t].copy(a[t])
                  : e[t] && e[t].isEuler
                  ? ((e[t].x = a[t].x), (e[t].y = a[t].y), (e[t].z = a[t].z))
                  : (e[t] = a[t]));
            }),
            this.setModelEffect(e, a.effect, i));
          const l = i.filter((t) => t.name === e.name || !0 === t.name);
          l.length >= 0 &&
            l.forEach((t) => {
              e.isGroup
                ? e.traverse((e) => {
                    this.EffectMange.setConfig("effect", {
                      object: e,
                      config: t,
                    });
                  })
                : this.EffectMange.setConfig("effect", {
                    object: e,
                    config: t,
                  });
            }),
            e.material &&
              G.eachMaterial(e.material, (e) => {
                this.MaterialMange.setConfig("compile", { material: e });
              }),
            !m && o && o.includes(e.name) && this.eventArr.push(e),
            (e.userData.modelName = t.id);
        }),
          this.group.add(e);
      }
      setModelEffect(e, t, n) {
        if (!t || !e || !e.isObject3D) return;
        const { type: i } = t;
        switch (i) {
          case "water": {
            const i = this.renderer.getTxue(t.normal),
              o = new Mn.water({
                object: e,
                option: {
                  time: this.time,
                  normal: i,
                  waterColor: t.waterColor || "#6A715E",
                  sunColor: t.sunColor || "#fff",
                  textureWidth: t.textureWidth || 512,
                  textureHeight: t.textureHeight || 512,
                  distortionScale: t.distortionScale || 3.7,
                  fog: t.fog || !1,
                  alpha: t.alpha || 1,
                  clipBias: t.clipBias || 0,
                  Mirrorfilter: t.Mirrorfilter || [],
                },
              });
            o.render(),
              (o.mesh._speed = t.speed || 1),
              this.animateArray.push(o.mesh);
            const { material: s } = o.mesh;
            s.userData.modelEffect = [];
            n
              .filter((t) => t.name === e.name)
              .forEach((e) => {
                this.EffectMange.setConfig("effect", {
                  object: o.mesh,
                  config: e,
                });
              }),
              this.MaterialMange.setConfig("compile", { material: s });
          }
        }
      }
      updateMeshEvent() {
        this.renderer.updateEventArr(this);
      }
      getMouseData(e, t, n) {
        let i = null;
        if (0 === n.length) i = [t, []];
        else {
          i = [
            t,
            n.map((e) => {
              const t =
                "GLTF" === e.object.userData.modelType
                  ? e.object.parent
                  : e.object;
              return { ...e, object: t.name, userData: t.userData };
            }),
          ];
        }
        return (
          this._triggerInnerEvent(e, { event: t, objects: n }),
          this.config.isDev ? [t, n] : i
        );
      }
      setObjectMaterial({ objects: e, names: t = !0, config: n }) {
        Object.keys(e).forEach((i) => {
          const o = e[i];
          let s = [];
          !0 === t
            ? s.push(o)
            : t.forEach((e) => {
                const t = o.getObjectByName(e);
                t && s.push(t);
              }),
            s.forEach((e) => {
              e.traverse((e) => {
                G.eachMaterial(e.material, (e) => {
                  this.MaterialMange.setConfig("values", {
                    material: e,
                    config: n,
                  }),
                    (e.needsUpdate = !0);
                });
              });
            });
        });
      }
      onMouseDown(e, t) {
        return this.getMouseData("mouseDown", e, t);
      }
      onMouseIn(e, t) {
        return this.getMouseData("mouseIn", e, t);
      }
      onDblClick(e, t) {
        return this.getMouseData("dblClick", e, t);
      }
      onMouseOut(e) {
        return this.getMouseData("mouseOut", e, []);
      }
      setConfig(e, t) {
        return Wt.setConfig.call(this, e, t);
      }
      getConfig(e, t) {
        return Wt.getConfig.call(this, e, t);
      }
    }
    Sn.description = "模型加载组件";
    var Pn = Sn,
      Rn = {
        setConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "option":
              this.isAfterData && (n = this.setOption(t));
              break;
            case "visible":
              this.group.visible = t.visible;
              break;
            case "material":
              this.setInstancedMaterial(t);
              break;
            case "add":
              this.loadScene(t.data, t.callback);
              break;
            case "visibleIns":
              this.setInstancedVisible(t.name, t.visible);
          }
          return n;
        },
        getConfig(e, t = {}) {
          let n = null;
          switch (e) {
            case "option":
              n = G.extend(!0, {}, this.config);
          }
          return n;
        },
      };
    var An = (e, t, n) => {
        let i = 0;
        e.forEach((o, s) => {
          const { url: r } = o.model;
          Pe.load(r, (r) => {
            (r.userData.config = o),
              (r.userData.modelIndex = s),
              t(r, o),
              i++,
              i === e.length && n();
          });
        });
      },
      En = (e = {}) => {
        Pe.setDracoPath(e);
      };
    class kn extends de {
      constructor(e) {
        super(e),
          z()(this, "animate", (e) => {
            this.EffectMange.animate(e);
          }),
          (this.object3d = new THRDev3.Object3D()),
          (this.dummy = new THRDev3.Object3D()),
          (this.EffectMange = new on(this.renderer)),
          (this.MaterialMange = new mn(this.renderer)),
          (this.dfInsMesh = new THRDev3.InstancedMesh(
            new THRDev3.BufferGeometry(),
            new THRDev3.MeshBasicMaterial({ color: 16711680 }),
            5
          )),
          this.initInterFace();
      }
      initInterFace() {
        this.Interface = Rn;
      }
      setDefaultConfig(e) {
        G.copy(e, { draco: null, data: [], material: {} });
      }
      compEftInit() {
        this.config.draco && En(this.config.draco);
        const {
          position: e = { x: 0, y: 0, z: 0 },
          rotation: t = { x: 0, y: 0, z: 0 },
          scale: n = { x: 1, y: 1, z: 1 },
        } = this.config;
        this.group.position.copy(e),
          this.group.rotation.set(t.x, t.y, t.z),
          this.group.scale.copy(n),
          this.loadScene(this.config.data, () => {
            this._triggerInnerEvent("endCallBack", this.group);
          }),
          this._triggerInnerEvent("mounted", { val: this.group });
      }
      disposeCompEft() {
        (this.EffectMange = null), (this.MaterialMange = null);
      }
      loadScene(e, t = () => {}) {
        if (0 === e.length) return this.updateMeshEvent(), void t();
        An(
          e,
          (e, t) => {
            this.createInstance(t, e, e.userData.modelIndex);
          },
          () => {
            this.updateMeshEvent(), t();
          }
        );
      }
      createInstance(e, t, n) {
        const {
            meshData: i,
            renderOrder: o,
            shadow: s = !1,
            position: r = { x: 0, y: 0, z: 0 },
            rotation: a = { x: 0, y: 0, z: 0 },
            scale: l = { x: 1, y: 1, z: 1 },
            Sscale: c = { x: 1, y: 1, z: 1 },
            colors: h = ["#ffffff"],
            name: u = "",
            visible: d = !0,
          } = e,
          p = i.data ? i.data.length : 0,
          f = e.effect || this.config.effect,
          m = this.dfInsMesh,
          g = h.map((e) => new THRDev3.Color(e)),
          { data: v } = i;
        t.traverse((t) => {
          if (
            (t.position.copy(r),
            t.rotation.set(a.x, a.y, a.z),
            t.scale.copy(l),
            t.isLight)
          )
            return void t.removeFromParent();
          if (!t.isMesh) return;
          t.frustumCulled = !1;
          const h = new THRDev3.InstancedBufferAttribute(
              new Float32Array(16 * p),
              16
            ),
            u = new THRDev3.InstancedBufferAttribute(
              new Float32Array(3 * p),
              3
            );
          (t.isInstancedMesh = !0),
            (t.instanceMatrix = h),
            (t.instanceColor = u),
            (t.count = p),
            (t.boundingBox = null),
            (t.boundingSphere = null),
            (t.userData.index = n),
            (t.renderOrder = o),
            (t.castShadow = s),
            (t.receiveShadow = s);
          for (let e = 0; e < p; e++) {
            const n = g[e % g.length],
              i = v[e];
            (this.dummy.position.x = i.position.x),
              (this.dummy.position.y = i.position.y),
              (this.dummy.position.z = i.position.z),
              (this.dummy.scale.x = i.scale.x * c.x),
              (this.dummy.scale.y = i.scale.y * c.y),
              (this.dummy.scale.z = i.scale.z * c.z),
              (this.dummy.rotation.x = i.rotation.x),
              (this.dummy.rotation.y = i.rotation.y),
              (this.dummy.rotation.z = i.rotation.z),
              this.dummy.updateMatrix(),
              this.dummy.matrix.toArray(t.instanceMatrix.array, 16 * e),
              u.setXYZ(e, n.r, n.g, n.b);
          }
          (t.instanceMatrix.needsUpdate = !0),
            (t.instanceColor.needsUpdate = !0),
            (t.computeBoundingBox = m.computeBoundingBox),
            (t.computeBoundingSphere = m.computeBoundingSphere),
            (t.raycast = m.raycast),
            (t.getColorAt = m.getColorAt),
            (t.getMatrixAt = m.getMatrixAt),
            (t.setColorAt = m.setColorAt),
            (t.setMatrixAt = m.setMatrixAt),
            (t.userData.data = i.data),
            t.computeBoundingBox && t.computeBoundingBox(),
            t.computeBoundingSphere && t.computeBoundingSphere(),
            this.handleMaterial(t, e.material),
            this.handleEffect(t, f);
        }),
          (e.isEvent || this.config.isEvent) && this.eventArr.push(t),
          (t.name = u),
          (t.visible = d),
          this.group.add(t);
      }
      handleMeshData(e, t) {
        const { type: n } = e;
        "data" === n && t(e.data);
      }
      handleMaterial(e, t) {
        const n = t || this.config.material;
        this.MaterialMange.setConfig("sceneMaterial", {
          scene: e,
          material: n,
          replaceMaterial: this.config.replaceMaterial,
          isAloneReplace: this.config.isAloneReplace,
        });
      }
      handleEffect(e, t) {
        t &&
          (t.forEach((t) => {
            this.EffectMange.setConfig("effect", { object: e, config: t });
          }),
          G.eachMaterial(e.material, (e) => {
            this.MaterialMange.setConfig("compile", { material: e });
          }));
      }
      setInstancedMaterial(e = {}) {
        e.color && !e.isColor && (e.color = new THRDev3.Color(e.color)),
          this.group.traverse((t) => {
            t.material &&
              G.eachMaterial(t.material, (t) => {
                t.setValues(e);
              });
          });
      }
      setInstancedVisible(e, t) {
        this.group.children.forEach((n) => {
          (n.name !== e && !0 !== e) || (n.visible = t);
        });
      }
      updateMeshEvent() {
        this.renderer.updateEventArr(this);
      }
      onMouseDown(e, t) {
        if (0 === t.length) return [e, !1, t];
        const n = t[0],
          { instanceId: i, point: o, object: s } = n;
        return "number" != typeof i
          ? [e, !1, t]
          : [
              e,
              {
                instanceId: i,
                point: o,
                modelIndex: s.userData.index,
                data: s.userData.data[i],
              },
            ];
      }
      setConfig(e, t) {
        return Rn.setConfig.call(this, e, t);
      }
      getConfig(e, t) {
        return Rn.getConfig.call(this, e, t);
      }
    }
    kn.description = "实例化模型组件";
    var In = kn;
    function Hn(e, t) {
      if (G.isSimpleObj(e) || G.isSimpleObj(t)) return e !== t ? e : void 0;
      let n,
        i = !1;
      if (G.isArray(e)) {
        if (G.isArray(t) && e.length !== t.length) return [...e];
        n = [];
      } else G.isObject(e) && (n = {});
      return (
        Object.keys(e).forEach((o) => {
          const s = Hn(e[o], t[o]);
          void 0 !== s && ((i = !0), (n[o] = s));
        }),
        i ? n : void 0
      );
    }
    var Ln = {
        setPosOffset: function (e, t) {
          const { x: n, y: i, z: o } = t;
          null != n && (e.position.x = n),
            null != i && (e.position.y = i),
            null != o && (e.position.z = o);
        },
        setGroupShow: function (e, t) {
          t
            ? ((e.visible = !0), e.scale.set(1, 1, 1))
            : ((e.visible = !1), e.scale.set(0, 0, 0));
        },
        getUseDataObj: function (e, t, n) {
          const i = {};
          return e && e.length
            ? (e.forEach((e, o) => {
                const s = (function (e, t) {
                  return t && void 0 !== e[t]
                    ? e[t]
                    : void 0 !== e._uid && null !== e._uid
                    ? e._uid
                    : G.creatId("uid_");
                })(e, t);
                i[s] = {
                  seq: o + n,
                  data: e,
                  noise: Math.floor(5 * Math.random()) / 5,
                  blockName: e.blockName,
                };
              }),
              i)
            : i;
        },
        handlePos: function (e, t) {
          const n = Object.keys(e);
          if (!n.length) return;
          void 0 !== e[n[0]].data.longi &&
            void 0 !== e[n[0]].data.lati &&
            n.forEach((n) => {
              const i = { x: e[n].data.longi, y: 0, z: e[n].data.lati },
                o = $.convertData.handleVec(i, t);
              e[n].data.pos = o;
            });
        },
        convertToStr: function (e) {
          return e ? (e.length ? (e = e.map((e) => "" + e)) : "" + e) : e;
        },
        getChangeObj: Hn,
        getDiffConf: function (e, t) {
          if (!e) return e;
          const n = Hn(e, t.config);
          return n
            ? (Object.keys(n).forEach((t) => {
                G.isArray(n[t]) && (n[t] = G.copy([], e[t]));
              }),
              n)
            : n;
        },
      },
      On = {
        setConfig(e, t = {}) {
          switch (e) {
            case "listener":
              this.on(t.name, t.callback, t.triggerOnce);
              break;
            case "event":
              this.bind(t.name, t.callback, t.triggerOnce);
              break;
            case "option":
              this.setOption(t);
              break;
            case "show":
              this.show(t && t.time, !0, t && t.callback, t && t.uids);
              break;
            case "hide":
              this.show(t && t.time, !1, t && t.callback, t && t.uids);
              break;
            case "startAni":
              this.uGlobalTime = 0;
              break;
            case "updateStyle":
              this.updateStyle(t.datas);
              break;
            case "refresh":
              "refresh" === t.type
                ? this.refresh(t.datas)
                : this.setData(t.datas);
              break;
            case "del":
              this.dels(t.uids);
              break;
            case "choice":
              this.choice(t.uids, !0);
              break;
            case "unChoice":
              this.choice(t.uids, !1);
              break;
            case "choiceAll":
              this.choiceAll(!0);
              break;
            case "unChoiceAll":
              this.choiceAll(!1);
              break;
            case "size":
              (this.config.size = t),
                this.markIns.updateConfig("size", t),
                this.setConfig("labelConfig", { parentSize: t });
              break;
            case "addComp":
              this.markIns.addComp(t, !0, !1);
              break;
            case "removeComp":
              this.markIns.removeComp(t);
              break;
            case "removeAll":
              this.markIns.removeAll();
              break;
            case "updateEvent":
              this.markIns.handleEventArr();
              break;
            case "labelConfig":
              this.markIns.updateSingleComp(t);
          }
        },
        getConfig(e, t = {}) {
          let n;
          switch (e) {
            case "option":
              n = G.extend(!0, {}, this.config);
              break;
            case "labelConfig":
              if (!t.name)
                return (
                  this.errorNotice("请传递子组件名称name"),
                  "请传递子组件名称name"
                );
              n = this.markIns.labelConfig(t);
              break;
            case "distInfo":
              {
                const {
                  maximum: e,
                  minimum: t,
                  sections: i,
                  total: o,
                } = this.distMap;
                n = G.extend(
                  !0,
                  {},
                  {
                    maximum: e,
                    minimum: t,
                    sections: i,
                    total: o,
                    type: this.distMap.type,
                  }
                );
              }
              break;
            case "useDatas":
              n = G.copy({}, this.markIns.useDataObj);
              break;
            case "useData":
              n = G.copy({}, this.markIns.useDataObj[t.uid]);
              break;
            case "config":
            default:
              n = G.copy({}, this.config);
          }
          return n;
        },
        callback: {
          setSize(e) {
            this.setConfig("size", e);
          },
          setHover(e) {
            this.config.hover = e;
          },
          setLabelComp(e, t) {
            this.markIns.updateSpecialComp(e, t, "Label");
          },
          setLargeMode(e) {
            (this.config.largeMode = e),
              e && this.setCarouselEffect(this.carousel.curIdx, !1),
              this.markIns.setLargeMode(e);
          },
          setEventComp(e, t) {
            this.markIns.updateSpecialComp(e, t, "EventComp");
          },
          setOffsetPosition(e) {
            (this.config.offsetPosition = {
              ...this.config.offsetPosition,
              ...e,
            }),
              Ln.setPosOffset(this.group, this.config.offsetPosition);
          },
          setChoice(e) {
            this.config.choice = e;
          },
          setRenderOrder(e) {
            this.group.renderOrder = e;
          },
          setCarousel(e) {
            (this.config.carousel = e),
              this.reCalCarouselTime(),
              this.setCarouselEffect(this.carousel.curIdx, !1);
          },
          setCarouselTime(e) {
            (this.config.carouselTime = e), this.reCalCarouselTime();
          },
          setShowAniTime(e) {
            this.config.showAniTime = e;
          },
          setIsShow(e) {
            (this.config.isShow = e), this.markIns.updateConfig("isShow", e);
          },
          setDatas(e) {
            this.setData(e);
          },
          setChildren(e, t) {
            this.markIns.distribConf(e, t);
          },
        },
        checkList: {
          size: "setSize",
          hover: "setHover",
          choice: "setChoice",
          label: "setLabelComp",
          largeMode: "setLargeMode",
          eventComp: "setEventComp",
          offsetPosition: "setOffsetPosition",
          renderOrder: "setRenderOrder",
          carousel: "setCarousel",
          carouselTime: "setCarouselTime",
          isShow: "setIsShow",
          showAniTime: "setShowAniTime",
          children: "setChildren",
        },
      };
    var Vn = class {
      handleCondition(e) {
        const {
          condIdxObj: t,
          condition: n,
          useDataObj: i,
          comps: o,
          originCacheUids: s,
        } = e;
        t &&
          Object.keys(t).length &&
          s.length &&
          Object.keys(t)
            .sort()
            .forEach((e) => {
              const r = t[e],
                a = n ? n[e] : null;
              if (!a) return;
              const l = this.getWaveImg(o);
              r.indexes.forEach((e) => {
                const t = s[e];
                if (void 0 === t) return;
                const n = i[t].data,
                  o = {};
                a.children &&
                  a.children.length &&
                  a.children.forEach((e) => {
                    e &&
                      ((o[e.name] = {}),
                      Object.keys(e).forEach((t) => {
                        "name" !== t && "type" !== t && (o[e.name][t] = e[t]);
                      }),
                      "Wave" === e.type &&
                        e.imgs &&
                        e.imgs[0] &&
                        l[e.name] &&
                        (o[e.name].imgIdx = l[e.name].imgObj[e.imgs[0]]));
                  }),
                  Object.keys(o).length &&
                    (n.exConfig ? G.copy(n.exConfig, o) : (n.exConfig = o));
              });
            });
      }
      getWaveImg(e) {
        const t = {};
        return (
          e.forEach((e) => {
            "Wave" === e.type &&
              e.imgs &&
              e.imgs[0] &&
              ((t[e.name] = { imgObj: {}, imgs: [] }),
              e.imgs.forEach((n, i) => {
                t[e.name].imgs.push(n), (t[e.name].imgObj[n] = i);
              }));
          }),
          t
        );
      }
      dispose() {}
    };
    var Fn = {
      setListener() {},
      stopCarousel(e) {
        (this.carousel.isPause = e),
          e
            ? this.setCarouselEffect(this.carousel.curIdx, !1)
            : this.reCalCarouselTime();
      },
      hover(e, t) {
        this.markIns.hover(e, t);
      },
      handleCarousel(e) {
        if (!this.config.carousel) return;
        if (this.config.largeMode) return;
        if (this.carousel.isPause) return;
        this.carousel.totalTime += e;
        const t =
          this.config.carouselTime -
          (this.carousel.totalTime % this.config.carouselTime);
        t < 0.05 ||
          (t > this.carousel.triggerDiff &&
            (this.setCarouselEffect(this.carousel.curIdx, !1),
            (this.carousel.curIdx += 1),
            this.carousel.curIdx >= this.cacheUids.length &&
              (this.carousel.curIdx = 0),
            this.setCarouselEffect(this.carousel.curIdx, !0)),
          (this.carousel.triggerDiff = t));
      },
      setCarouselEffect(e, t) {
        const n = this.cacheUids[e];
        if (!n) return;
        const i = this.markIns.useDataObj[n];
        if (((i.isCarousel = t), this.hover(n, t), !t)) return;
        const { pos: o } = i.data,
          s = this.getCoord(o);
        this.triggerEvent("onCarousel", "out", this.getOutEventData(n, s));
      },
      getOutEventData(e, t) {
        let n = e;
        if (G.isArray(e)) {
          if (1 !== e.length)
            return {
              uid: e,
              ceId: this.config.ceId,
              layerName: this.config.name,
              data: e.map((e) => G.copy({}, this.markIns.useDataObj[e].data)),
              ...t,
            };
          [n] = e;
        }
        return {
          uid: n,
          ceId: this.config.ceId,
          layerName: this.config.name,
          data: G.copy({}, this.markIns.useDataObj[n].data),
          ...t,
        };
      },
      choice(e, t, n) {
        if (!e || !e.length) return;
        e = (e = Ln.convertToStr(e)).filter((e) => this.markIns.useDataObj[e]);
        const i = this.markIns.choice(e, t);
        if (t)
          if (e && 1 === e.length) {
            const { pos: t } = i.data,
              o = this.getCoord(t);
            this.triggerEvent(
              "onSelected",
              "out",
              this.getOutEventData(e, o),
              n
            );
          } else
            this.triggerEvent("onSelected", "out", this.getOutEventData(e), n);
        else this.triggerEvent("unSelected", "out", this.getOutEventData(e), n);
      },
      getCoord(e) {
        this.group.updateWorldMatrix(),
          this.tempV3.copy(e),
          this.tempV3.applyMatrix4(this.group.matrixWorld);
        return G.transCoord(this.tempV3, this.renderer);
      },
      choiceAll(e) {
        const t = [];
        Object.keys(this.markIns.useDataObj).forEach((n) => {
          !!this.markIns.useDataObj[n].isChoice != !!e && t.push(n);
        }),
          this.choice(t, e);
      },
      onMouseOut(...e) {
        if (this.curHoverUid) {
          const t = this.curHoverUid;
          return (
            this.curClickUid || this.stopCarousel(!1, 0),
            this.config.hover && this.hover(t, !1),
            (this.curHoverUid = null),
            [e[0], this.getOutEventData(t)]
          );
        }
        return e;
      },
      onMouseIn(...e) {
        const t = this.commonEventHandle(...e);
        if (this.config.hover && t && t[1] && t[1].ceId === this.config.ceId) {
          const e = t[1].uid;
          this.curHoverUid &&
            e !== this.curHoverUid &&
            this.hover(this.curHoverUid, !1),
            (this.curHoverUid = e),
            this.markIns.useDataObj[e].isHover ||
              (this.stopCarousel(!0, 0), this.hover(this.curHoverUid, !0));
        }
        return t;
      },
      onClick(...e) {
        return this.commonEventHandle(...e);
      },
      onDblClick(...e) {
        return this.commonEventHandle(...e);
      },
      onMouseDown(...e) {
        const t = this.commonEventHandle(...e);
        if (this.config.choice)
          if (t && t[1] && t[1].ceId === this.config.ceId) {
            const n = this.getCoord(t[1].point);
            t[1].coord = { ...n };
            const { uid: i } = t[1];
            this.markIns.useDataObj[i].isChoice
              ? (this.curHoverUid &&
                  this.markIns.useDataObj[this.curHoverUid].isHover &&
                  this.hover(this.curHoverUid, !1),
                (this.curHoverUid = null),
                this.stopCarousel(!1, 1),
                this.choice([i], !1, e[0]),
                (this.curClickUid = null))
              : (this.stopCarousel(!0, 1),
                this.curClickUid && this.choice([this.curClickUid], !1, e[0]),
                (this.curClickUid = i),
                this.choice([i], !0, e[0]));
          } else
            this.curClickUid &&
              (this.choice([this.curClickUid], !1, e[0]),
              (this.curClickUid = null)),
              this.stopCarousel(!1, 1);
        return t;
      },
      commonEventHandle(...e) {
        const t = this.getTriggerCompName(...e);
        if (!t) return e;
        const n = this.getTriggerDataKey(t, e[1][0]),
          i = this.getOutEventData(n);
        return (i.point = { ...e[1][0].point }), [e[0], i];
      },
      getTriggerCompName(...e) {
        if (!e[1] || !e[1].length) return "";
        const t = e[1][0];
        return t && t.object
          ? t.object.userData.ceId !== this.config.ceId
            ? ""
            : t.object.userData && t.object.userData._compName
            ? t.object.userData._compName
            : ""
          : "";
      },
      getTriggerDataKey(e, t) {
        return this.markIns.getTriggerDataKey(e, t);
      },
    };
    var zn = class {
      load(e, t, n, i) {
        cancelAnimationFrame(this.batchTimmer);
        if (Object.keys(e).length <= n) {
          if (
            (t.forEach((t) => {
              t.reloadData && t.reloadData(e);
            }),
            !i)
          )
            return;
          return void i();
        }
        const o = this.getBathArr(e, n),
          s = o.shift();
        t.forEach((e) => {
          e.reloadData && e.reloadData(s);
        }),
          this.delayLoad(t, o, i);
      }
      getBathArr(e, t) {
        const n = [],
          i = Object.keys(e);
        let o = 0,
          s = {};
        return (
          i.forEach((i) => {
            o < t
              ? ((s[i] = e[i]), (o += 1))
              : o >= t && (n.push(s), (s = {}), (s[i] = e[i]), (o = 1));
          }),
          n.push(s),
          n
        );
      }
      delayLoad(e, t, n) {
        const i = t.shift();
        if (i)
          this.batchTimmer = requestAnimationFrame(() => {
            e.forEach((e) => {
              e.refresh && e.refresh(i);
            }),
              this.delayLoad(e, t, n);
          });
        else {
          if (!n) return;
          n();
        }
      }
      dispose() {
        cancelAnimationFrame(this.batchTimmer);
      }
    };
    function jn(e, t) {
      if (e instanceof Array && t instanceof Array) {
        if (e.length !== t.length) return !1;
        let n = !0;
        const i = e.length;
        for (let o = 0; o < i; o++)
          if (e[o] !== t[o]) {
            n = !1;
            break;
          }
        return n;
      }
      return e === t;
    }
    function Bn(e, t, n, i, o) {
      return "line" === o
        ? e && Math.abs(t) > i - n
          ? i
          : t + n
        : e && Math.abs(t) > i - n
        ? Math.sin(6.28 * i)
        : Math.sin(6.28 * (t + n));
    }
    function Un(e, t, n) {
      return ((e + 1) / 2) * (n - t) + t;
    }
    function Nn(e) {
      if (!e) return "";
      const t = [];
      return (
        Object.keys(e).forEach((n) => {
          const i = e[n];
          t.push(`uniform ${i.type} ${n};`);
        }),
        t.join("")
      );
    }
    function Gn(e, t, n) {
      return `\n        #ifdef GL_ES\n            precision mediump float;\n        #endif\n        ${
        e || ""
      }\n        uniform float uOpacity;\n        ${
        t || ""
      }\n        void main() {\n            ${n || ""}\n        }\n    `;
    }
    function Wn(e, t, n) {
      return `\n        #ifdef GL_ES\n            precision mediump float;\n        #endif\n        ${e}\n        uniform float uOpacity;\n        ${
        t || ""
      }\n        void main() {\n            ${
        n || ""
      }\n            gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.w * uOpacity);\n        }\n    `;
    }
    function Yn(e) {
      const t = {};
      return (
        e &&
          Object.keys(e).forEach((n) => {
            t[n] = { value: e[n].value };
          }),
        t
      );
    }
    function Kn(e) {
      return new THRDev3.Vector4().fromArray(G.getColorArr(e, !0));
    }
    var $n = class {
      constructor(e, t) {
        (this.config = G.copy(this.getDefaultOpt(), e)),
          void 0 === this.config.showName &&
            (this.config.showName = this.config.name),
          (this.parentIns = t),
          (this.renderer = t.renderer),
          (this.eventArr = []),
          (this.group = G.group(G.creatId(this.config.name))),
          t.group.add(this.group),
          void 0 !== this.config.renderOrder &&
            (this.group.renderOrder = this.config.renderOrder),
          (this.cacheColor = {}),
          (this.txueObj = {});
      }
      errorNotice(e) {
        const t = `${this.config.type}_${this.config.name}: ${e}`;
        this.parentIns._triggerInnerEvent("onError", { describe: t });
      }
      setGroupShow(e) {
        e
          ? ((this.group.visible = !0), this.group.scale.set(1, 1, 1))
          : ((this.group.visible = !1), this.group.scale.set(0, 0, 0));
      }
      warnNotice(e) {}
      getDefaultOpt() {
        return {
          sort: null,
          renderOrder: void 0,
          groupOffset: { x: 0, y: 0, z: 0 },
          showName: void 0,
        };
      }
      getColor(e, t) {
        if ("object" == typeof e) return e;
        if (this.cacheColor[e]) return this.cacheColor[e];
        const n = G.getColorArr(e, !0);
        return "arr" === t
          ? ((this.cacheColor[e] = n), n)
          : ((this.cacheColor[e] = new THRDev3.Vector4(n[0], n[1], n[2], n[3])),
            this.cacheColor[e]);
      }
      getTxue(e) {
        return (
          this.txueObj[e] ||
            (this.txueObj[e] = this.renderer.setTxue({
              id: this.getTxueId(e),
              url: e,
              isRepeat: !1,
            })),
          this.txueObj[e]
        );
      }
      getTxueId(e) {
        return `${this.config.name}${e}`;
      }
      animate() {}
      getTriggerKey() {}
      reloadData(e) {
        (this.cacheColor = {}), this.disposeTxueObj(e), (this.txueObj = {});
      }
      getUseImgs(e) {
        if (!e) return {};
        const t = {};
        return (
          this.config.imgUrl && (t[this.config.imgUrl] = !0),
          this.config.imgs &&
            this.config.imgs.length &&
            this.config.imgs.forEach((e) => {
              t[e] = !0;
            }),
          void 0 === this.config.imgUrl ||
            Object.keys(e).forEach((n) => {
              const { data: i } = e[n];
              if (!i.exConfig || !i.exConfig[this.config.name]) return;
              const o = i.exConfig[this.config.name],
                { imgUrl: s } = this.getCurConfig(["imgUrl"], o);
              t[s] = !0;
            }),
          t
        );
      }
      disposeTxueObj(e) {
        if (!this.txueObj) return;
        const t = this.getUseImgs(e);
        Object.keys(this.txueObj).forEach((e) => {
          t[e] ||
            (this.renderer &&
              this.renderer._Txues &&
              this.renderer._Txues.removeTxue(this.getTxueId(e)));
        }),
          (this.txueObj = {});
      }
      refresh() {}
      choice(e, t) {
        e &&
          e.length &&
          e.forEach((e) => {
            ("Label" !== this.config.type && this.isHover(e)) ||
              this.handleHover(e, t);
          });
      }
      hover(e, t) {
        ("Label" !== this.config.type && this.isChoice(e)) ||
          this.handleHover(e, t);
      }
      handleHover() {}
      isChoice(e) {
        const t = this.parentIns.useDataObj[e];
        return !(!t || !t.isChoice);
      }
      isCarousel(e) {
        const t = this.parentIns.useDataObj[e];
        return !(!t || !t.isCarousel);
      }
      isHover(e) {
        const t = this.parentIns.useDataObj[e];
        return !(!t || !t.isHover);
      }
      getRotateRatio(e, t, n) {
        return Bn(n, e, t, n, "line");
      }
      isAniContinue(e, t) {
        return !e || !(t > e + 1.5);
      }
      getFlickerInfo(e, t, n) {
        const i = Bn(n, e, t, n + 1.25);
        return {
          opRatio: Un(i, 0.1, 1.001),
          sizeRatio: Un(i, 1.01, 1.001),
          yRatio: Un(i, -1, 0),
        };
      }
      floatRatio(e, t, n) {
        return Bn(n, e, t, n + 1.5);
      }
      dels() {}
      dispose() {
        (this.cacheColor = null),
          G.disposeObj(this.group),
          this.disposeTxueObj(),
          (this.eventArr = []),
          (this.group = null),
          (this.config = null),
          (this.parentIns = null),
          (this.renderer = null);
      }
      setConfig(e, t) {
        t &&
          t.groupOffset &&
          (G.copy(this.config.groupOffset, t.groupOffset),
          this.setGroupOffset());
      }
      setGroupOffset() {
        const { groupOffset: e } = this.config,
          { parentSize: t } = this.config;
        void 0 !== e.x && (this.group.position.x = e.x * t),
          void 0 !== e.y && (this.group.position.y = e.y * t),
          void 0 !== e.z && (this.group.position.z = e.z * t);
      }
      getCurConfig(e, t) {
        const n = {};
        return (
          e.forEach((e) => {
            t && void 0 !== t[e]
              ? t[e] instanceof Array
                ? (n[e] = G.copy([], t[e]))
                : t[e] && "object" == typeof t[e]
                ? (n[e] = G.copy({}, t[e]))
                : (n[e] = t[e])
              : (n[e] = this.config[e]);
          }),
          n
        );
      }
      getConfig(e, t) {
        let n;
        switch (e) {
          case "config":
            (n = this.config[t.configName]),
              G.isObject(n)
                ? (n = G.copy({}, n))
                : G.isArray(n) && (n = G.copy([], n));
            break;
          case void 0:
          case null:
          case "":
          case "allConfig":
            n = G.copy({}, this.config);
        }
        return n;
      }
    };
    const Xn = function (e, t, n, i) {
        return {
          vDefine:
            "\n        varying float vAniOp;\n        \n    uniform float uAniTimes;\n    float aniRatio(float time, float noiseVal, float maxVal) {\n        if (bool(uAniTimes)) {\n            if (time + noiseVal > maxVal) {\n                return sin(maxVal * 6.28);\n            }\n        }\n        return sin((time + noiseVal) * 6.28);\n    }\n    float reMap(float val, float min, float max) {\n        return (val + 1.0) / 2.0 * (max - min) + min;\n    }\n    vec4 getFlickerInfo(float time, vec3 pos, vec3 center, float noiseVal) {\n        float ratio = aniRatio(time, noiseVal, uAniTimes + 1.25);\n        float op = reMap(ratio, 0.1, 1.001);\n        float posRatio = reMap(ratio, 1.01, 1.001);\n        return vec4(mix(center, pos, posRatio), op);\n    }\n    ",
          vMain: `vec4 flickInfo = getFlickerInfo(${e}, newPos, ${t}, ${i});\n        newPos = flickInfo.xyz;\n        vAniOp = flickInfo.w;`,
          fDefine: "varying float vAniOp;",
          fMain:
            "gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.w * vAniOp);",
        };
      },
      qn = function (e, t, n, i) {
        return {
          vDefine:
            "\n            varying float vAniOp;\n            \n    uniform float uMoveY;\n    uniform float uAniTimes;\n    float aniRatio(float time, float noiseVal, float maxVal) {\n        if (bool(uAniTimes)) {\n            if (time + noiseVal > maxVal) {\n                return sin(maxVal * 6.28);\n            }\n        }\n        return sin((time + noiseVal) * 6.28);\n    }\n    float reMap(float val, float min, float max) {\n        return (val + 1.0) / 2.0 * (max - min) + min;\n    }\n    vec4 getFlickerYInfo(float time, vec3 pos, vec3 center, float scaleVal, float noiseVal) {\n        float ratio = aniRatio(time, noiseVal, uAniTimes + 1.25);\n        float op = reMap(ratio, 0.1, 1.001);\n        float posRatio = reMap(ratio, 1.01, 1.001);\n        vec3 retPos = mix(center, pos, posRatio);\n        float yRatio = reMap(ratio, -1.0, 0.0);\n        retPos.y = retPos.y + yRatio * uMoveY * scaleVal;\n        return vec4(retPos, op);\n    }\n        ",
          vMain: `\n            vec4 flickInfoY = getFlickerYInfo(${e}, newPos, ${t}, ${
            n || "1.0"
          }, ${i});\n            newPos = flickInfoY.xyz;\n            vAniOp = flickInfoY.w;`,
          fDefine: "varying float vAniOp;",
          fMain:
            "gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.w * vAniOp);",
        };
      },
      Zn = function (e, t, n, i) {
        return {
          vDefine:
            "\n    uniform float uMoveY;\n        uniform float uAniTimes;\n\n        float aniRatio(float time, float noiseVal, float maxVal) {\n        if (bool(uAniTimes)) {\n            if (time + noiseVal > maxVal) {\n                return sin(maxVal * 6.28);\n            }\n        }\n        return sin((time + noiseVal) * 6.28);\n    }\n    vec3 getFloatAniInfo(float time, vec3 pos, float scaleVal, float noiseVal) {\n        vec3 retPos = pos;\n        float ratio = aniRatio(time, noiseVal, uAniTimes + 1.5); // 位置在\n        retPos.y = retPos.y + ratio * uMoveY * scaleVal;\n        return retPos;\n    }\n    ",
          vMain: `newPos = getFloatAniInfo(${e}, newPos, ${n || "1.0"}, ${i});`,
          fDefine: "",
          fMain: "",
        };
      },
      Qn = {
        1: Zn("uTime", 0, "", "uNoiseVal"),
        2: Xn("uTime", "center", 0, "uNoiseVal"),
        3: qn("uTime", "center", "", "uNoiseVal"),
      },
      Jn = {
        1: Zn("uGlobalTime", 0, "aScaleVal", "vNoise"),
        2: Xn("uGlobalTime", "aCenter", 0, "vNoise"),
        3: qn("uGlobalTime", "aCenter", "aScaleVal", "vNoise"),
      };
    function ei(e) {
      return `\n    attribute vec3 aCenter;\n    attribute float aScaleVal;\n    ${
        Qn[e] ? Qn[e].vDefine : ""
      }\n    `;
    }
    function ti(e) {
      return `\n    vec3 newPos = position;\n    ${
        Qn[e] ? Qn[e].vMain : ""
      }\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function ni(e) {
      return `\n    ${Qn[e] ? Qn[e].fDefine : ""}\n    `;
    }
    function ii(e) {
      return `\n        vec2 center = vec2(0.5);\n        float dist = distance(vUv, center);\n        float stepNum = step(dist, 0.5); // 大于0.5设置为透明\n        float grd = stepNum * (1.0 - dist * 2.0);\n        dist = dist * 2.0;// 转换成0~1\n        dist = fract(dist * 3.0); // 重复3倍\n        dist = fract(dist - uTime + vNoise); // 动画\n        float opacity = dist;\n        gl_FragColor = vec4(vColor.xyz, opacity * grd * vColor.w);\n        ${
        Qn[e] ? Qn[e].fMain : ""
      }\n    `;
    }
    function oi(e) {
      return `\n    attribute vec3 aCenter;\n    attribute float aScaleVal;\n    ${
        Qn[e] ? Qn[e].vDefine : ""
      }\n    `;
    }
    function si(e) {
      return `\n    vec3 newPos = position;\n    ${
        Qn[e] ? Qn[e].vMain : ""
      }\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function ri(e) {
      return `\n    float drawCircle(float r, float w, float dist, float edge) {\n        float innerR = r - w;\n        float outR = r + w;\n        return smoothstep(innerR - edge, innerR, dist) * smoothstep(outR + edge, outR, dist);\n    }\n    ${
        Qn[e] ? Qn[e].fDefine : ""
      }\n    `;
    }
    function ai(e) {
      return `\n        vec2 center = vec2(0.5);\n        float dist = distance(vUv, center);\n        float stepNum = step(dist, 0.5); // 大于0.5设置为透明\n        dist = dist * 2.0;\n        float grd = stepNum * (1.0 - dist);\n        dist = fract(dist * 3.0); // 重复3倍\n        float r = fract(uTime + vNoise);\n        float w = 0.03;\n        float edge = 0.03;\n        float opacity = drawCircle(r, w, dist, edge);\n        if (r < edge + w / 2.0) { // r太小时, 叠加外圈使动画重合\n            float r2 = 1.0 + r;\n            opacity += drawCircle(r2, w, dist, edge);\n        }\n        if (r > 1.0 - edge  - w / 2.0) { // r太大时, 叠加内圈使动画重合\n            float r3 =  r - 1.0;\n            opacity += drawCircle(r3, w, dist, edge);\n        }\n        gl_FragColor = vec4(vColor.xyz, grd * opacity * vColor.w);\n        ${
        Qn[e] ? Qn[e].fMain : ""
      }\n    `;
    }
    function li(e) {
      return `\n    attribute vec3 aCenter;\n    attribute float aScaleVal;s\n    attribute vec3 aNormal;\n    ${
        Qn[e] ? Qn[e].vDefine : ""
      }\n    `;
    }
    function ci(e) {
      return `\n        vec3 newPos = position - aCenter;\n\n        // 绕法线旋转动画\n        float angle = uTime; // 旋转, 反向使用-uTime\n        float cosAngle = cos(angle);\n        float sinAngle = sin(angle);\n        // 旋转angle\n        float _Val = 1.0 - cosAngle;\n        newPos = newPos * mat3(aNormal.x * aNormal.x * _Val + cosAngle, \n            aNormal.x * aNormal.y * _Val + aNormal.z * sinAngle,\n            aNormal.x * aNormal.z * _Val - aNormal.y * sinAngle,\n            aNormal.x * aNormal.y * _Val - aNormal.z * sinAngle,\n            aNormal.y * aNormal.y * _Val + cosAngle,\n            aNormal.y * aNormal.z * _Val + aNormal.x * sinAngle,\n            aNormal.x * aNormal.z * _Val + aNormal.y * sinAngle,\n            aNormal.y * aNormal.z * _Val - aNormal.x * sinAngle,\n            aNormal.z * aNormal.z * _Val + cosAngle\n            );\n\n        newPos = newPos + aCenter;\n        ${
        Qn[e] ? Qn[e].vMain : ""
      }\n        gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function hi(e) {
      return `\n    ${Qn[e] ? Qn[e].fDefine : ""}\n    `;
    }
    function ui(e) {
      return `\n        vec4 imgColor = getImgColor(vImgIdx, vUv);\n        gl_FragColor = vec4(imgColor.xyz * vColor.xyz, imgColor.w * vColor.w);\n        ${
        Qn[e] ? Qn[e].fMain : ""
      }\n    `;
    }
    function di(e) {
      return `\n        attribute vec3 aCenter;\n        attribute float aScaleVal;\n        ${
        Qn[e] ? Qn[e].vDefine : ""
      }\n    `;
    }
    function pi(e) {
      return `\n    vec3 newPos = position;\n    ${
        Qn[e] ? Qn[e].vMain : ""
      }\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function fi(e) {
      return `\n    ${Qn[e] ? Qn[e].fDefine : ""}\n    `;
    }
    function mi(e) {
      return `vec4 imgColor = getImgColor(vImgIdx, vUv);\n        gl_FragColor = vec4(imgColor.xyz * vColor.xyz, imgColor.w * vColor.w);\n        ${
        Qn[e] ? Qn[e].fMain : ""
      }\n    `;
    }
    function gi(e) {
      return `\n    uniform vec2 uCameraDirect;\n    uniform vec3 uCameraPos;\n    const float PI = 6.2831853072;\n    attribute vec3 aNormal;\n    attribute vec3 aCenter;\n    attribute float aScaleVal;\n    ${
        Qn[e] ? Qn[e].vDefine : ""
      }\n    mat2 getMat2(float rad) {\n        float c = cos(rad), s = sin(rad);\n        return mat2(c, -s, s, c);\n    }\n    float getVectorAngle(vec2 v1, vec2 v2) {\n        vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n        vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n        vec3 crossV = cross(nV1, nV2);\n        float dotVal = dot(nV1, nV2);\n        float rad = acos(dotVal);\n        if (crossV.z > 0.0) {\n            rad = 6.2831853072 - rad;\n        }\n        return rad;\n    }\n    `;
    }
    function vi(e) {
      return `\n    vec3 newPos = position;\n    ${
        Qn[e] ? Qn[e].vMain : ""
      }\n    vec3 pp = newPos - aCenter;\n    float rad = getVectorAngle(uCameraPos.xz - aCenter.xz, aNormal.xz);\n    vec2 posXZ = pp.xz * getMat2(rad);\n    vec3 vPos = vec3(posXZ.x, pp.y, posXZ.y);\n    vPos += aCenter;\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(vPos, 1.0));\n    `;
    }
    function yi(e) {
      return `\n    ${Qn[e] ? Qn[e].fDefine : ""}\n    `;
    }
    function bi(e) {
      return `\n    vec2 rUv = vUv;\n    float thold = 0.2;\n    float op = 1.0;\n    if (rUv.y < thold) {\n        op = rUv.y / thold;\n    }\n    if (rUv.y > 1.0 - thold) {\n        op = (1.0 - rUv.y) / thold;\n    }\n    rUv.y = mod(vUv.y - uTime, 1.0);\n    vec4 imgColor = getImgColor(vImgIdx, rUv);\n    gl_FragColor = vec4(imgColor.xyz * vColor.xyz, imgColor.w * op * vColor.w);\n    ${
        Qn[e] ? Qn[e].fMain : ""
      }\n    `;
    }
    function xi(e) {
      return `\n        attribute vec3 aCenter;\n        attribute float aScaleVal;\n        attribute float aFaceIndex;\n        ${
        Jn[e] ? Jn[e].vDefine : ""
      }\n        varying float vOp;\n        mat3 getScale3(float scale) {\n            return mat3(scale, 0.0, 0.0, 0.0, scale, 0.0, 0.0, 0.0, scale);\n        }\n        \n    `;
    }
    function wi(e) {
      return `\n    vec3 newPos = position;\n    ${
        Jn[e] ? Jn[e].vMain : ""
      }\n    newPos = newPos - aCenter;\n    float scale = mod(uTime + vNoise + (aFaceIndex / uWaveNum), 1.0);\n    vOp = 1.0 - scale;\n    newPos = newPos * getScale3(scale);\n    newPos = newPos + aCenter;\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function Ci(e) {
      return `\n    uniform bool uHasImg;\n    varying float vOp;\n    ${
        Jn[e] ? Jn[e].fDefine : ""
      }\n    vec4 getShaderColor() {\n        vec4 imgColor = getImgColor(vImgIdx, vUv);\n        return imgColor;\n    } \n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        // 1 颜色和图片融合, 2, 使用图片颜色 3. 颜色和图片相乘叠加\n        if (uHasImg && vImgIdx > -0.5) {\n            vec4 _shaderColor = getShaderColor();\n            if (vColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else if (vColorType < 2.5) {\n                retColor  = _shaderColor;\n            } else {\n                retColor = _shaderColor * mC4;\n            }\n        } else {\n            if (vColorType > 1.5 && vColorType < 2.5) {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            } else {\n                retColor = mC4;\n            }\n        }\n        return retColor;\n    }\n    `;
    }
    function Ti(e) {
      return `\n    vec4 c = getBlendingColor(vColor);\n    gl_FragColor = vec4(c.xyz, c.w * vOp);\n    // gl_FragColor = vec4(imgColor.xyz * vColor.xyz, imgColor.w * vColor.w);\n    ${
        Jn[e] ? Jn[e].fMain : ""
      }\n    `;
    }
    function _i(e) {
      return `\n        attribute vec3 aCenter;\n        ${
        Jn[e] ? Jn[e].vDefine : ""
      }\n        \n    `;
    }
    function Di(e) {
      return `\n    vec3 newPos = position;\n    ${
        Jn[e] ? Jn[e].vMain : ""
      }\n\n    float rotation = 0.0;\n    vec2 center = vec2( 0.5 );\n\n    vec4 mvPosition = viewMatrix * modelMatrix * vec4( aCenter, 1.0 );\n\n    vec2 scale;\n    scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n    scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n    vec2 alignedPosition = ( (newPos.xy - aCenter.xy) - ( center - vec2( 0.5 ) ) ) * scale;\n\n    vec2 rotatedPosition;\n    rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n    rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n    mvPosition.xy += alignedPosition;\n\n    gl_Position = projectionMatrix * mvPosition;\n    `;
    }
    function Mi(e) {
      return `\n    uniform bool uHasImg;\n    ${
        Jn[e] ? Jn[e].fDefine : ""
      }\n    vec4 getShaderColor() {\n        vec4 imgColor = getImgColor(vImgIdx, vUv);\n        return imgColor;\n    } \n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        // 1 颜色和图片融合, 2, 使用图片颜色 3. 颜色和图片相乘叠加\n        if (uHasImg && vImgIdx > -0.5) {\n            vec4 _shaderColor = getShaderColor();\n            if (vColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else if (vColorType < 2.5) {\n                retColor  = _shaderColor;\n            } else {\n                retColor = _shaderColor * mC4;\n            }\n        } else {\n            if (vColorType > 1.5 && vColorType < 2.5) {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            } else {\n                retColor = mC4;\n            }\n        }\n        return retColor;\n    }\n    `;
    }
    function Si(e) {
      return `\n    vec4 c = getBlendingColor(vColor);\n    gl_FragColor = vec4(c.xyz, c.w);\n    // gl_FragColor = vec4(imgColor.xyz * vColor.xyz, imgColor.w * vColor.w);\n    ${
        Jn[e] ? Jn[e].fMain : ""
      }\n    `;
    }
    var Pi = {
      type1: o,
      type2: s,
      type3: r,
      type4: a,
      type6: l,
      type8: c,
      type9: h,
    };
    var Ri = class extends $n {
      constructor(e, t) {
        super(e, t),
          (this.config.txues = []),
          (this.useConfObj = {}),
          (this.curTotalCount = 0),
          (this.posBufferArr = null),
          (this.useShaderTypes = []),
          (this.geoUpdateObj = {
            idxArr: [],
            needUpdateAShaderType: !1,
            needUpdateAImgIdx: !1,
            needUpdateANoise: !1,
            needUpdateAColor: !1,
            needUpdateACenter: !1,
            needUpdateAScaleVal: !1,
            needUpdateAColorType: !1,
            needUpdatePosition: !1,
            needUpdateAUOpacity: !1,
          }),
          this.setTxues(this.config.imgs);
      }
      setTxues(e) {
        (this.config.txues = []),
          e &&
            e.length &&
            (e.length > 8 &&
              this.errorNotice("图片纹理超过8张, 可能存在兼容性问题"),
            e.forEach((e) => {
              const t = this.getTxue(e);
              this.config.txues.push(t);
            }));
      }
      init(e) {
        this.setGroupOffset(), this.create(e);
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          name: "",
          showName: void 0,
          isAnimate: !0,
          color: "rgba(255, 255, 255, 1)",
          aniSpeed: 0.5,
          center: { x: 0.5, y: 0.5 },
          mtlOpt: { depthWrite: !0, transparent: !0, depthTest: !1 },
          offsetPosition: { x: 0, y: 0, z: 0 },
          rotation: { x: 0, y: 0, z: 0 },
          moveY: 1,
          aniType: 0,
          aniTimes: 0,
          shaderType: 3,
          width: 5,
          scaleVal: 1,
          imgIdx: 0,
          parentSize: 1,
          uOpacity: 1,
        };
      }
      refreshShaderTypes(e, t) {
        if (void 0 !== t) return void (this.useShaderTypes = t);
        const n = {};
        Object.keys(this.useConfObj).forEach((e) => {
          void 0 !== this.useConfObj[e]._exConfig.shaderType
            ? (n[this.useConfObj[e]._exConfig.shaderType] = !0)
            : (n[this.config.shaderType] = !0);
        }),
          e &&
            Object.keys(e).forEach((t) => {
              const i = this.getExConf(e[t].data);
              i && void 0 !== i.shaderType
                ? (n[i.shaderType] = !0)
                : (n[this.config.shaderType] = !0);
            }),
          (this.useShaderTypes = []);
        Object.keys(n).forEach((e) => {
          this.useShaderTypes.push(1 * e);
        });
      }
      getGeo() {
        const { width: e, height: t, rotation: n, center: i } = this.config,
          o = void 0 === t ? e : t,
          s = new THRDev3.PlaneGeometry(e, o);
        s.translate((0.5 - i.x) * e, (0.5 - i.y) * o, 0);
        const r = new THRDev3.Matrix4();
        r.identity();
        const a = new THRDev3.Euler(n.x, n.y, n.z, "XYZ");
        return r.makeRotationFromEuler(a), s.applyMatrix4(r), s;
      }
      getGeoInfor() {
        const e = this.useConfObj,
          t = this.getGeo();
        this.preGeo = t;
        const n = [],
          i = [],
          o = [];
        this.posBufferArr = t.attributes.position.array;
        const s = this.posBufferArr.length,
          r = [],
          a = [],
          l = [],
          c = [],
          h = [],
          u = [],
          d = [];
        this.setSingleInfor(s, t.index ? t.index.array.length : 0),
          Object.keys(e).forEach((t, p) => {
            const f = e[t];
            this.useConfObj[t].useIdx = p;
            const { pos: m } = f,
              {
                parentSize: g,
                color: v,
                offsetPosition: y,
                imgIdx: b = 0,
                scaleVal: x,
                shaderType: w,
                colorType: C,
              } = this.getCurConfig(
                [
                  "parentSize",
                  "color",
                  "imgIdx",
                  "shaderType",
                  "offsetPosition",
                  "scaleVal",
                  "colorType",
                ],
                f._exConfig
              ),
              T = this.getColor(v),
              _ = { x: m.x + y.x * g, y: m.y + y.y * g, z: m.z + y.z * g };
            for (let e = 0; e < s; e++)
              e % 3 == 0
                ? (r.push(T.x, T.y, T.z, T.w),
                  a.push(w),
                  l.push(1),
                  c.push(C),
                  o.push(p),
                  h.push(b),
                  d.push(f.noise),
                  u.push(x),
                  n.push(this.posBufferArr[e] * g * x + _.x),
                  i.push(_.x))
                : e % 3 == 1
                ? (n.push(this.posBufferArr[e] * g * x + _.y), i.push(_.y))
                : (n.push(this.posBufferArr[e] * g * x + _.z), i.push(_.z));
          });
        for (let t = Object.keys(e).length; t < this.curTotalCount; t++)
          for (let e = 0; e < s; e++)
            e % 3 == 0 &&
              (r.push(0, 0, 0, 0),
              a.push(9999),
              l.push(1),
              c.push(9999),
              o.push(t),
              d.push(0),
              u.push(1),
              h.push(this.config.imgIdx)),
              i.push(0),
              n.push(0);
        return {
          positions: n,
          centers: i,
          numIndexes: o,
          shaderTypes: a,
          uOpacitys: l,
          colorTypes: c,
          colorOpacitys: r,
          imgIdxs: h,
          noises: d,
          scaleVals: u,
          ...this.getFixAttribute(t),
        };
      }
      getFixAttribute(e) {
        const t = this.getArrFromBuffer(e.index),
          n = this.getArrFromBuffer(e.attributes.uv),
          i = this.getArrFromBuffer(e.attributes.normal),
          o = [],
          s = [],
          r = [];
        for (let e = 0; e < this.curTotalCount; e++)
          o.push(...n),
            s.push(...i),
            t.forEach((t) => {
              r.push(t + this.singleInfor.numIndexeNum * e);
            });
        return { uvs: o, faceIndexs: r, normals: s };
      }
      setSingleInfor(e, t) {
        const n = e / 3;
        this.singleInfor = {
          positionNum: e,
          centerNum: e,
          scaleValNum: n,
          numIndexeNum: n,
          imgIdxNum: n,
          noiseNum: n,
          faceIndexNum: t,
          shaderTypeNum: n,
          uOpacityNum: n,
          colorTypeNum: n,
          colorNum: 4 * n,
        };
      }
      getArrFromBuffer(e) {
        const t = [];
        if (e && e.array && e.array.length) {
          const n = e.array.length;
          for (let i = 0; i < n; i++) t.push(e.array[i]);
        }
        return t;
      }
      addToArray(e, t) {
        if (!t || !t.array) return e;
        for (let n = 0; n < t.array.length; n++) e.push(t.array[n]);
        return e;
      }
      getUniformDefine() {
        if (!this.config.exUniform) return "";
        const e = [];
        return (
          Object.keys(this.config.exUniform).forEach((t) => {
            const n = this.config.exUniform[t];
            e.push(`uniform ${n.type} ${t};`);
          }),
          e.join("")
        );
      }
      getVertexShader() {
        return `\n            #ifdef GL_ES\n                precision mediump float;\n            #endif\n            uniform float uTime;\n            uniform float uOpacity;\n            uniform float uGlobalTime;\n            ${this.getUniformDefine()}\n\n            attribute float aShaderType;\n            attribute float aUOpacity;\n            attribute float aColorType;\n            attribute vec4 aColor;\n            attribute float aImgIdx;\n            attribute float aNoise;\n\n            varying vec2 vUv;\n            varying vec4 vColor;\n            varying float vShaderType;\n            varying float vUOpacity;\n            varying float vColorType;\n            varying float vImgIdx;\n            varying float vNoise;\n            float noise(vec2 p) {\n                return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453123);\n            }\n            ${this.getVShaderMain()}\n        `;
      }
      getShaderDefine(e) {
        return Pi["type" + e];
      }
      getVShaderMain() {
        const e = [],
          t = [];
        return (
          this.useShaderTypes.forEach((n) => {
            const i = this.getShaderDefine(n),
              { aniType: o } = this.config;
            if (i) {
              if (
                (i.getVShaderDefine && e.push(i.getVShaderDefine(o, this)),
                i && i.getVShaderMain)
              ) {
                if (0 === t.length)
                  return void t.push(i.getVShaderMain(o, this));
                1 === t.length &&
                  (t[0] = `if (vShaderType - ${this.useShaderTypes[0]}.0 < 0.001) {\n                        ${t[0]}\n                    }`),
                  t.length === this.useShaderTypes.length - 1
                    ? t.push(
                        `else {\n                        ${i.getVShaderMain(
                          o,
                          this
                        )}\n                    }`
                      )
                    : t.push(
                        `else if (vShaderType - ${n}.0 < 0.001) {\n                        ${i.getVShaderMain(
                          o,
                          this
                        )}\n                    }`
                      );
              }
            } else this.errorNotice(`未获取到shaderType为${n}的shader定义`);
          }),
          t.length ||
            this.errorNotice("shaderType有误, 无法获取到顶点shader字符串"),
          `${e.join(
            ""
          )}\n        void main() {\n            vUv = uv;\n            vColor = aColor;\n            vShaderType = aShaderType;\n            vUOpacity = aUOpacity;\n            vColorType = aColorType;\n            vImgIdx = aImgIdx;\n            vNoise = aNoise;\n            ${t.join(
            ""
          )}\n        }`
        );
      }
      getUmapStr() {
        let e = "";
        const t = this.config.txues.length;
        return (
          (e += "vec4 getImgColor(float idx, vec2 curUv) { vec4 c;"),
          t
            ? 1 === t
              ? ((e += "return texture2D(uMaps[0], curUv);"), (e += "}"), e)
              : (this.config.txues.forEach((t, n) => {
                  e +=
                    0 === n
                      ? "if (idx < 0.5) {\n                    c = texture2D(uMaps[0], curUv);\n                }"
                      : `else if (idx < ${
                          n + 0.5
                        }) {\n                    c = texture2D(uMaps[${n}], curUv);\n                }`;
                }),
                (e += "return c;}"),
                e)
            : ((e += "return vec4(1.0);"), (e += "}"), e)
        );
      }
      getFragmentShader() {
        return `\n            #ifdef GL_ES\n                precision mediump float;\n            #endif\n            uniform float uTime;\n            uniform float uGlobalTime;\n            uniform float uOpacity;\n            ${this.getUniformDefine()}\n            ${
          this.config.txues.length
            ? `uniform sampler2D uMaps[${this.config.txues.length}];`
            : ""
        }\n\n            varying vec2 vUv;\n            varying vec4 vColor;\n            varying float vShaderType;\n            varying float vUOpacity;\n            varying float vColorType;\n            varying float vImgIdx;\n            varying float vNoise;\n            ${this.getUmapStr()}\n\n            float noise(vec2 p) {\n                return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453123);\n            }\n            ${this.getFShaderMain()}\n            `;
      }
      getFShaderMain() {
        const e = [],
          t = [];
        return (
          this.useShaderTypes.forEach((n) => {
            const { aniType: i } = this.config,
              o = this.getShaderDefine(n);
            if (o) {
              if (
                (o.getFShaderDefine && e.push(o.getFShaderDefine(i, this)),
                o && o.getFShaderMain)
              ) {
                if (0 === t.length)
                  return void t.push(o.getFShaderMain(i, this));
                1 === t.length &&
                  (t[0] = `if (vShaderType - ${this.useShaderTypes[0]}.0 < 0.001) {\n                        ${t[0]}\n                    }`),
                  t.length === this.useShaderTypes.length - 1
                    ? t.push(
                        `else {\n                        ${o.getFShaderMain(
                          i,
                          this
                        )}\n                    }`
                      )
                    : t.push(
                        `else if (vShaderType - ${n}.0 < 0.001) {\n                        ${o.getFShaderMain(
                          i,
                          this
                        )}\n                    }`
                      );
              }
            } else this.errorNotice(`未获取到shaderType为${n}的shader定义`);
          }),
          t.length ||
            this.errorNotice("shaderType有误, 无法获取到面shader字符串"),
          `${e.join("")}\n        void main() {\n            ${t.join(
            ""
          )}\n            gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.w * vUOpacity);\n        }`
        );
      }
      getMtl() {
        const e = {};
        this.config.exUniform &&
          Object.keys(this.config.exUniform).forEach((t) => {
            e[t] = { value: this.config.exUniform[t].value };
          });
        const t = {
            uniforms: {
              uTime: { value: 0 },
              uGlobalTime: { value: 0 },
              uHasImg: { value: 0 !== this.config.txues.length },
              uImgIdx: { value: 0 },
              uMoveY: { value: this.config.moveY },
              uAniTimes: { value: this.config.aniTimes || 0 },
              uMaps: { value: this.config.txues },
              uResolution: {
                value: new THRDev3.Vector2(
                  this.renderer.width,
                  this.renderer.height
                ),
              },
              ...e,
            },
            vertexShader: this.getVertexShader(),
            fragmentShader: this.getFragmentShader(),
            ...this.config.mtlOpt,
          },
          n = G.mtl.shader(t);
        return G.shaderMtlAddFog(n, this.renderer.scene), n;
      }
      extendAttribute() {}
      createBufferMesh() {
        this.curTotalCount = Object.keys(this.useConfObj).length + 100;
        const e = G.geo.buf(),
          t = this.getGeoInfor(),
          n = this.getMtl();
        e.setAttribute(
          "position",
          new THRDev3.Float32BufferAttribute(t.positions, 3)
        ),
          e.setAttribute(
            "aShaderType",
            new THRDev3.Float32BufferAttribute(t.shaderTypes, 1)
          ),
          e.setAttribute(
            "aUOpacity",
            new THRDev3.Float32BufferAttribute(t.uOpacitys, 1)
          ),
          e.setAttribute(
            "aColorType",
            new THRDev3.Float32BufferAttribute(t.colorTypes, 1)
          ),
          e.setAttribute(
            "aColor",
            new THRDev3.Float32BufferAttribute(t.colorOpacitys, 4)
          ),
          e.setAttribute("uv", new THRDev3.Float32BufferAttribute(t.uvs, 2)),
          e.setAttribute(
            "aImgIdx",
            new THRDev3.Float32BufferAttribute(t.imgIdxs, 1)
          ),
          e.setAttribute(
            "aNoise",
            new THRDev3.Float32BufferAttribute(t.noises, 1)
          ),
          this.extendAttribute(e, t),
          this.setOptinalAttribute(e, n.vertexShader, t),
          t.faceIndexs.length &&
            e.setIndex(new THRDev3.Uint16BufferAttribute(t.faceIndexs, 1)),
          (this.mesh = new THRDev3.Mesh(e, n)),
          this.setBeforRender(),
          (this.mesh.userData._type = this.config.type),
          (this.mesh.userData._compName = this.group.name),
          this.group.add(this.mesh),
          this.config.isCompEvents && (this.eventArr = [this.mesh]);
      }
      setBeforRender() {}
      setOptinalAttribute(e, t, n) {
        n || (n = this.getGeoInfor());
        const i = this.canSetAttribute(
            n.normals,
            "aNormal",
            e,
            t,
            new RegExp("vec3\\s+aNormal\\s*;")
          ),
          o = this.canSetAttribute(
            n.numIndexes,
            "aNumIndex",
            e,
            t,
            new RegExp("float\\s+aNumIndex\\s*;")
          ),
          s = this.canSetAttribute(
            n.centers,
            "aCenter",
            e,
            t,
            new RegExp("vec3\\s+aCenter\\s*;")
          ),
          r = this.canSetAttribute(
            n.scaleVals,
            "aScaleVal",
            e,
            t,
            new RegExp("float\\s+aScaleVal\\s*;")
          );
        n || ((i || o || s || r) && (n = this.getGeoInfor())),
          i &&
            e.setAttribute(
              "aNormal",
              new THRDev3.Float32BufferAttribute(n.normals, 3)
            ),
          o &&
            e.setAttribute(
              "aNumIndex",
              new THRDev3.Float32BufferAttribute(n.numIndexes, 1)
            ),
          s &&
            e.setAttribute(
              "aCenter",
              new THRDev3.Float32BufferAttribute(n.centers, 3)
            ),
          r &&
            e.setAttribute(
              "aScaleVal",
              new THRDev3.Float32BufferAttribute(n.scaleVals, 1)
            );
      }
      canSetAttribute(e, t, n, i, o) {
        return (
          (!n.attributes || !n.attributes[t]) &&
          !(!e || !e.length) &&
          !!o.test(i)
        );
      }
      updateBufferAttribute() {
        this.geoUpdateObj.needUpdateAShaderType &&
          ((this.mesh.geometry.attributes.aShaderType.needsUpdate = !0),
          (this.geoUpdateObj.needUpdateAShaderType = !1)),
          this.geoUpdateObj.needUpdateAImgIdx &&
            ((this.mesh.geometry.attributes.aImgIdx.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateAImgIdx = !1)),
          this.geoUpdateObj.needUpdateANoise &&
            ((this.mesh.geometry.attributes.aNoise.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateANoise = !1)),
          this.geoUpdateObj.needUpdateAColor &&
            ((this.mesh.geometry.attributes.aColor.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateAColor = !1)),
          this.geoUpdateObj.needUpdateACenter &&
            ((this.mesh.geometry.attributes.aCenter.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateACenter = !1)),
          this.geoUpdateObj.needUpdateAScaleVal &&
            ((this.mesh.geometry.attributes.aScaleVal.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateAScaleVal = !1)),
          this.geoUpdateObj.needUpdateAColorType &&
            ((this.mesh.geometry.attributes.aColorType.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateAColorType = !1)),
          this.geoUpdateObj.needUpdateAUOpacity &&
            ((this.mesh.geometry.attributes.aUOpacity.needsUpdate = !0),
            (this.geoUpdateObj.needUpdateAUOpacity = !1)),
          this.geoUpdateObj.needUpdatePosition &&
            ((this.mesh.geometry.attributes.position.needsUpdate = !0),
            (this.geoUpdateObj.needUpdatePosition = !1),
            this.mesh.geometry.computeBoundingSphere());
      }
      updateBufferMesh(e, t, n) {
        this.refreshShaderTypes(e);
        !jn(n, this.useShaderTypes) && this.updateMaterialShader();
        let i = t;
        (this.geoUpdateObj.idxArr = []),
          Object.keys(e).forEach((t) => {
            this.useConfObj[t]
              ? this.geoUpdateObj.idxArr.push(this.useConfObj[t].useIdx)
              : (this.geoUpdateObj.idxArr.push(i), (i += 1)),
              this.updateSingle({ uid: t, value: e[t], maxIdx: i - 1 });
          }),
          this.updateBufferAttribute();
      }
      updateSingle(e) {
        let t = e.maxIdx;
        const n = e.value,
          i = e.uid,
          { data: o, noise: s } = n;
        if (!o) return;
        const r = this.getExConf(o) || {};
        if (!this.useConfObj[i]) return void this.setNewSingle(r, i, t, o, s);
        if (void 0 !== n.useIdx && this.useConfObj[i].useIdx !== n.useIdx)
          return void this.setNewSingle(r, i, n.useIdx, o, s);
        t = this.useConfObj[i].useIdx;
        let a = !1;
        const l = { ...this.useConfObj[i]._exConfig, ...r },
          c = G.copy({}, this.useConfObj[i]._exConfig);
        G.copy(this.useConfObj[i]._exConfig, r),
          Object.keys(l).forEach((e) => {
            if (!G.isEqual(c[e], r[e])) {
              switch (e) {
                case "color":
                  return void this.changeBufferArray({
                    prop: e,
                    value: this.getColor(r[e]),
                    useIdx: t,
                    uid: i,
                  });
                case "highColor":
                  return;
                case "scaleVal":
                case "parentSize":
                case "offsetPosition":
                case "center":
                  return void (a = !0);
              }
              this.changeBufferArray({
                prop: e,
                value: r[e],
                useIdx: t,
                uid: i,
              });
            }
          });
        const { pos: h } = o;
        h &&
          ((h.x === this.useConfObj[i].pos.x &&
            h.y === this.useConfObj[i].pos.y &&
            h.z === this.useConfObj[i].pos.z) ||
            (this.savePos(i, o), (a = !0))),
          a && this.changeBufferArray({ prop: "pos", useIdx: t, uid: i });
      }
      setNewSingle(e, t, n, i, o) {
        (this.useConfObj[t] = { _exConfig: {} }),
          e && G.copy(this.useConfObj[t]._exConfig, e),
          this.savePos(t, i),
          (this.useConfObj[t].useIdx = n);
        const {
          shaderType: s,
          imgIdx: r,
          colorType: a,
          color: l,
        } = this.getCurConfig(
          ["shaderType", "color", "colorType", "imgIdx"],
          e
        );
        this.changeBufferArray({ prop: "pos", useIdx: n, uid: t }),
          this.changeBufferArray({
            prop: "imgIdx",
            value: r,
            useIdx: n,
            uid: t,
          }),
          this.changeBufferArray({
            prop: "noise",
            value: o,
            useIdx: n,
            uid: t,
          }),
          this.changeBufferArray({
            prop: "shaderType",
            value: s,
            useIdx: n,
            uid: t,
          }),
          this.changeBufferArray({
            prop: "colorType",
            value: a,
            useIdx: n,
            uid: t,
          }),
          this.changeBufferArray({
            prop: "color",
            value: this.getColor(l),
            useIdx: n,
            uid: t,
          });
      }
      changeBufferArray(e) {
        const { prop: t, value: n, useIdx: i, uid: o } = e,
          s = this.mesh.geometry.attributes;
        let r;
        const a = [];
        switch (t) {
          case "pos":
          case "parentSize":
          case "offsetPosition":
            this.assignPosAndCenterBuffer(s, o, i);
            break;
          case "scaleVal":
            if ((this.assignPosAndCenterBuffer(s, o, i), !s.aScaleVal)) return;
            const { scaleVal: e } = this.getCurConfig(
              ["scaleVal"],
              this.useConfObj[o]._exConfig
            );
            a.push(e),
              (this.geoUpdateObj.needUpdateAScaleVal = !0),
              this.assignBufferArr(
                a,
                s.aScaleVal,
                this.singleInfor.scaleValNum,
                i
              );
            break;
          case "colorType":
            (r = this.singleInfor.colorTypeNum),
              a.push(n),
              (this.geoUpdateObj.needUpdateAColorType = !0),
              this.assignBufferArr(a, s.aColorType, r, i);
            break;
          case "shaderType":
            (r = this.singleInfor.shaderTypeNum),
              a.push(n),
              (this.geoUpdateObj.needUpdateAShaderType = !0),
              this.assignBufferArr(a, s.aShaderType, r, i);
            break;
          case "uOpacity":
            (r = this.singleInfor.uOpacityNum),
              a.push(n),
              (this.geoUpdateObj.needUpdateAUOpacity = !0),
              this.assignBufferArr(a, s.aUOpacity, r, i);
            break;
          case "imgIdx":
            (r = this.singleInfor.imgIdxNum),
              a.push(n),
              (this.geoUpdateObj.needUpdateAImgIdx = !0),
              this.assignBufferArr(a, s.aImgIdx, r, i);
            break;
          case "noise":
            (r = this.singleInfor.noiseNum),
              a.push(n),
              (this.geoUpdateObj.needUpdateANoise = !0),
              this.assignBufferArr(a, s.aNoise, r, i);
            break;
          case "color":
            (r = this.singleInfor.colorNum),
              a.push(n.x, n.y, n.z, n.w),
              (this.geoUpdateObj.needUpdateAColor = !0),
              this.assignBufferArr(a, s.aColor, r, i);
            break;
          default:
            this.warnNotice(t + "属性,不支持单个修改");
        }
      }
      assignPosAndCenterBuffer(e, t, n) {
        const { pos: i } = this.useConfObj[t],
          o = this.getCurConfig(
            ["parentSize", "offsetPosition", "scaleVal"],
            this.useConfObj[t]._exConfig
          ),
          { parentSize: s, offsetPosition: r, scaleVal: a } = o,
          l = this.singleInfor.positionNum,
          c = this.posBufferArr.length,
          h = [],
          u = { x: i.x + r.x * s, y: i.y + r.y * s, z: i.z + r.z * s };
        for (let e = 0; e < c; e++)
          e % 3 == 0
            ? h.push(this.posBufferArr[e] * s * a + u.x)
            : e % 3 == 1
            ? h.push(this.posBufferArr[e] * s * a + u.y)
            : h.push(this.posBufferArr[e] * s * a + u.z);
        if (
          (this.assignBufferArr(h, e.position, l, n),
          (this.geoUpdateObj.needUpdatePosition = !0),
          !e.aCenter)
        )
          return;
        const d = [];
        d.push(u.x, u.y, u.z),
          (this.geoUpdateObj.needUpdateACenter = !0),
          this.assignBufferArr(d, e.aCenter, this.singleInfor.centerNum, n);
      }
      assignBufferArr(e, t, n, i) {
        if (!t || !t.array) return;
        const o = t.array,
          s = (i + 1) * n;
        let r = 0;
        for (let t = i * n; t < s; t++) {
          r >= e.length && (r = 0);
          const n = e[r];
          (r += 1), (o[t] = n);
        }
      }
      getExConf(e) {
        let t;
        return (
          e &&
            e.exConfig &&
            e.exConfig[this.config.name] &&
            (t = e.exConfig[this.config.name]),
          t
        );
      }
      refreshUseConfObj(e) {
        Object.keys(e).forEach((t) => {
          const n = e[t];
          this.useConfObj[t] ||
            (this.useConfObj[t] = { _exConfig: {}, noise: n.noise });
          const i = n.data;
          if (!i) return;
          const o = this.getExConf(i);
          o && G.copy(this.useConfObj[t]._exConfig, o), this.savePos(t, i);
        });
      }
      savePos(e, t) {
        t &&
          t.pos &&
          (this.useConfObj[e].pos || (this.useConfObj[e].pos = {}),
          (void 0 === t.pos.x && null === t.pos.x) ||
            (this.useConfObj[e].pos.x = t.pos.x),
          (void 0 === t.pos.y && null === t.pos.y) ||
            (this.useConfObj[e].pos.y = t.pos.y),
          (void 0 === t.pos.z && null === t.pos.z) ||
            (this.useConfObj[e].pos.z = t.pos.z));
      }
      getAllLenth(e) {
        if (!e) return Object.keys(this.useConfObj).length;
        const t = {};
        return (
          Object.keys(e).forEach((e) => {
            t[e] || (t[e] = !0);
          }),
          Object.keys(this.useConfObj).forEach((e) => {
            t[e] || (t[e] = !0);
          }),
          Object.keys(t).length
        );
      }
      create(e) {
        if (!e || !Object.keys(e).length)
          return void (
            this.mesh &&
            this.mesh.geometry.setDrawRange(
              0,
              Object.keys(this.useConfObj).length *
                this.singleInfor.faceIndexNum
            )
          );
        const t = Object.keys(this.useConfObj).length,
          n = G.copy([], this.useShaderTypes),
          i = this.getAllLenth(e);
        this.mesh
          ? i > this.curTotalCount
            ? (this.group.remove(this.mesh),
              G.disposeObj(this.mesh),
              (this.mesh = null),
              this.refreshUseConfObj(e),
              this.refreshShaderTypes(),
              this.createBufferMesh(),
              this.config.isCompEvents && (this.eventArr = [this.mesh]))
            : this.updateBufferMesh(e, t, n)
          : (this.refreshUseConfObj(e),
            this.refreshShaderTypes(),
            this.createBufferMesh(),
            this.config.isCompEvents && (this.eventArr = [this.mesh])),
          this.mesh.geometry.setDrawRange(
            0,
            Object.keys(this.useConfObj).length * this.singleInfor.faceIndexNum
          ),
          this.mesh.geometry.computeBoundingSphere();
      }
      animate(e, t) {
        (this.config.isAnimate || void 0 === this.config.isAnimate) &&
          this.mesh &&
          (void 0 !== this.config.globalAniSpeed
            ? (this.mesh.material.uniforms.uGlobalTime.value +=
                t * this.config.globalAniSpeed)
            : (this.mesh.material.uniforms.uGlobalTime.value = e),
          (this.mesh.material.uniforms.uTime.value +=
            t * this.config.aniSpeed));
      }
      getTriggerKey(e) {
        const t = e.faceIndex,
          n = Math.floor(t / 2);
        return Object.keys(this.useConfObj).find(
          (e) => this.useConfObj[e].useIdx === n
        );
      }
      handleHover(e, t) {
        if (!this.useConfObj[e]) return;
        const { color: n, highColor: i } = this.getCurConfig(
          ["color", "highColor"],
          this.useConfObj[e]._exConfig
        );
        if (void 0 !== i) {
          if (void 0 !== i) {
            const o = t ? i : n;
            this.changeBufferArray({
              prop: "color",
              value: this.getColor(o),
              useIdx: this.useConfObj[e].useIdx,
              uid: e,
            });
          }
          this.updateBufferAttribute();
        }
      }
      reloadData(e) {
        super.reloadData(),
          (this.useConfObj = {}),
          (this.geoUpdateObj.idxArr = []),
          this.create(e);
      }
      refresh(e) {
        Object.keys(e).length && this.create(e);
      }
      dels(e) {
        if (!e || !e.length) return;
        const t = Object.keys(this.useConfObj).length,
          n = e.length,
          i = [];
        e.forEach((e) => {
          this.useConfObj[e].useIdx < t - n &&
            i.push(this.useConfObj[e].useIdx),
            delete this.useConfObj[e];
        });
        const o = {};
        Object.keys(this.useConfObj).forEach((e) => {
          if (this.useConfObj[e].useIdx < t - n) return;
          const s = i.pop();
          o[e] = { ...this.useConfObj[e], useIdx: s };
          const r = {};
          (r[this.config.name] = this.useConfObj[e]._exConfig),
            (o[e].data = { pos: this.useConfObj[e].pos, exConfig: r });
        }),
          this.create(o);
      }
      updateWholeConfig(e) {
        let t = !1;
        return (
          Object.keys(e).forEach((n) => {
            switch (
              (G.isObject(e[n])
                ? G.copy(this.config[n], e[n])
                : (this.config[n] = e[n]),
              n)
            ) {
              case "renderOrder":
                this.group.renderOrder = this.config.renderOrder;
                break;
              case "aniSpeed":
              case "globalAniSpeed":
                break;
              case "aniType":
                if (!this.mesh) return;
                this.mesh.material.uniforms.uGlobalTime.value = 0;
                break;
              case "mtlOpt":
                if (!this.mesh) return;
                const { mtlOpt: e } = this.config;
                Object.keys(e).forEach((t) => {
                  this.mesh.material[t] = e[t];
                });
                break;
              case "highColor":
                break;
              case "rotation":
              case "width":
              case "height":
              case "center":
                t = !0;
                break;
              case "moveY":
                if (!this.mesh) return;
                this.mesh.material.uniforms.uMoveY.value = this.config.moveY;
                break;
              case "aniTimes":
                if (!this.mesh) return;
                (this.mesh.material.uniforms.uGlobalTime.value = 0),
                  (this.mesh.material.uniforms.uAniTimes.value =
                    this.config.aniTimes || 0);
                break;
              case "imgs":
                if (
                  (this.disposeTxueObj(),
                  this.setTxues(this.config.imgs),
                  !this.mesh)
                )
                  return;
                (this.mesh.material.uniforms.uMaps.value = this.config.txues),
                  (this.mesh.material.uniforms.uHasImg.value =
                    0 !== this.config.txues.length);
            }
          }),
          t &&
            (this.preGeo && G.disposeObj(this.preGeo),
            (this.preGeo = this.getGeo()),
            (this.posBufferArr = this.preGeo.attributes.position.array)),
          t
        );
      }
      updateMaterialShader() {
        this.mesh &&
          ((this.mesh.material.vertexShader = this.getVertexShader()),
          (this.mesh.material.fragmentShader = this.getFragmentShader()),
          (this.mesh.material.userData.isAddFog = !1),
          G.shaderMtlAddFog(this.mesh.material, this.renderer.scene),
          (this.mesh.material.needsUpdate = !0),
          this.setOptinalAttribute(
            this.mesh.geometry,
            this.mesh.material.vertexShader
          ));
      }
      dispose() {
        (this.useShaderTypes = []),
          (this.geoUpdateObj = null),
          (this.posBufferArr = null),
          (this.curTotalCount = 0),
          (this.useConfObj = null),
          (this.config.txues = []),
          super.dispose();
      }
      addShaderType(e, t) {
        const n = "type" + e;
        Pi[n]
          ? this.errorNotice(`shaderType ${e} 已定义, 请更换type`)
          : (t.getVShaderMain ||
              this.warnNotice(
                "未检测到getVShaderMain, 该shaderType定义可能无法正常运行"
              ),
            t.getFShaderMain ||
              this.warnNotice(
                "未检测到getFShaderMain, 该shaderType定义可能无法正常运行"
              ),
            (Pi[n] = t));
      }
      isUpdateShader(e) {
        if (void 0 !== e.aniType && this.config.aniType !== e.aniType)
          return !0;
        if (void 0 !== e.imgs && this.config.imgs.length !== e.imgs.length)
          return !0;
        if (void 0 !== e.shaderType) {
          const t = G.copy([], this.useShaderTypes);
          this.refreshShaderTypes({}, [e.shaderType]);
          return !jn(t, this.useShaderTypes);
        }
        return !1;
      }
      setConfig(e, t) {
        if ((super.setConfig(e, t), !t)) return;
        switch (e) {
          case "addShaderType":
            return void this.addShaderType(t.shaderType, t);
        }
        const n = this.isUpdateShader(t);
        let i = !1;
        (i = this.updateWholeConfig(t)),
          n && this.updateMaterialShader(),
          this.mesh &&
            (Object.keys(this.useConfObj).forEach((e) => {
              Object.keys(t).forEach((n) => {
                switch (n) {
                  case "parentSize":
                  case "offsetPosition":
                    i = !0;
                    break;
                  case "uOpacity":
                  case "shaderType":
                  case "scaleVal":
                  case "noise":
                    this.changeBufferArray({
                      prop: n,
                      value: t[n],
                      useIdx: this.useConfObj[e].useIdx,
                      uid: e,
                    });
                    break;
                  case "colorType":
                    const { colorType: o } = this.getCurConfig(
                      ["colorType"],
                      this.useConfObj[e]._exConfig
                    );
                    this.changeBufferArray({
                      prop: n,
                      value: o,
                      useIdx: this.useConfObj[e].useIdx,
                      uid: e,
                    });
                    break;
                  case "imgIdx":
                    const { imgIdx: s } = this.getCurConfig(
                      ["imgIdx"],
                      this.useConfObj[e]._exConfig
                    );
                    this.changeBufferArray({
                      prop: n,
                      value: s,
                      useIdx: this.useConfObj[e].useIdx,
                      uid: e,
                    });
                    break;
                  case "highColor":
                  case "color":
                    const { color: r, highColor: a } = this.getCurConfig(
                      ["color", "highColor"],
                      this.useConfObj[e]._exConfig
                    );
                    let l = r;
                    a && (this.isHover(e) || this.isChoice(e)) && (l = a),
                      this.changeBufferArray({
                        prop: "color",
                        value: this.getColor(l),
                        useIdx: this.useConfObj[e].useIdx,
                        uid: e,
                      });
                }
              }),
                i &&
                  this.changeBufferArray({
                    prop: "pos",
                    useIdx: this.useConfObj[e].useIdx,
                    uid: e,
                  });
            }),
            this.updateBufferAttribute());
      }
      getConfig(e, t) {
        let n;
        switch (e) {
          case "shaderTypeStandard":
            n =
              "{\n                shaderType: 100,\n                getVShaderDefine() { // 顶点shader扩展定义\n                    return '';\n                },\n                getVShaderMain() { // 顶点shader main函数\n                    return '';\n                },\n                getFShaderDefine() { // 面shader扩展定义\n                    return '';\n                },\n                getFShaderMain() { // 面shader main函数\n                    return '';\n                }\n            }";
            break;
          case "vertexShader":
            n = this.mesh ? this.mesh.material.vertexShader : "";
            break;
          case "fragmentShader":
            n = this.mesh ? this.mesh.material.fragmentShader : "";
            break;
          case "shaderTypeDefine":
            {
              const e = this.getShaderDefine(t.shaderType);
              n = e
                ? {
                    vShaderDefine: e.getVShaderDefine(this),
                    vShaderMain: e.getVShaderMain(this),
                    fShaderDefine: e.getFShaderDefine(this),
                    fShaderMain: e.getFShaderMain(this),
                  }
                : {};
            }
            break;
          default:
            n = super.getConfig(e, t);
        }
        return n;
      }
    };
    function Ai() {
      return "\n        varying vec2 vUv;\n    ";
    }
    function Ei() {
      return "\n    vUv = uv;\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(position, 1.0));\n    ";
    }
    function ki() {
      return "\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    varying vec2 vUv;\n    vec4 getShaderColor() {\n        return texture2D(uMap, vUv);\n    } \n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        if (uHasImg) {\n            vec4 _shaderColor = getShaderColor();\n            if (uColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else {\n                retColor  = _shaderColor;\n            }\n        } else {\n            if (uColorType < 1.5) {\n                retColor = mC4;\n            } else {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            }\n        }\n        return retColor;\n    }\n    ";
    }
    function Ii() {
      return "\n    gl_FragColor = getBlendingColor(uColor);\n    //gl_FragColor = vec4(imgColor2.xyz * uColor.xyz, imgColor2.w * uColor.w);\n    ";
    }
    var Hi = class extends $n {
      constructor(e, t) {
        super(e, t),
          (this.eventArr = []),
          (this.uTime = 0),
          (this.posV3 = new THRDev3.Vector3()),
          (this.compUseObj = {}),
          (this.cacheMtl = {});
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          name: "",
          showName: void 0,
          isAnimate: !0,
          mtlOpt: { depthWrite: !0, transparent: !0, depthTest: !1 },
          colorType: 1,
          color: "rgba(255, 255, 255, 1)",
          imgUrl: "",
          center: { x: 0.5, y: 0.5 },
          offsetPosition: { x: 0, y: 0, z: 0 },
          width: 1,
          height: 1,
          scaleVal: 1,
          parentSize: 1,
          uOpacity: 1,
        };
      }
      init(e) {
        (this.config.height =
          void 0 === this.config.height
            ? this.config.width
            : this.config.height),
          this.setGroupOffset(),
          this.readyGeo(),
          this.create(e);
      }
      readyGeo() {
        const e = G.geo.plane(1, 1),
          { center: t } = this.config;
        e.translate(0.5 - t.x, 0.5 - t.y, 0), (this.geo = e);
      }
      create(e) {
        Object.keys(e).length &&
          Object.keys(e).forEach((t) => {
            this.compUseObj[t] && this.compUseObj[t].hasCreate
              ? this.updateSingle(t, e[t])
              : (this.createSingle(t, e[t]),
                (this.compUseObj[t] = { hasCreate: !0 }));
          });
      }
      updateSingle(e, t) {
        const { data: n } = t,
          { pos: i } = n,
          o = this.group.getObjectByName(e);
        let s = !1,
          r = !1,
          a = !1;
        if (n.exConfig) {
          const e = n.exConfig[this.config.name];
          if (e) {
            const t = G.copy({}, o.userData._exConfig);
            G.copy(o.userData._exConfig, e),
              Object.keys(e).forEach((n) => {
                if (!G.isEqual(t[n], e[n]))
                  switch (n) {
                    case "offsetPosition":
                    case "pos":
                      r = !0;
                      break;
                    case "width":
                    case "height":
                    case "scaleVal":
                      s = !0;
                      break;
                    case "parentSize":
                      (s = !0), (r = !0);
                      break;
                    case "color":
                    case "highColor":
                      a = !0;
                      break;
                    case "imgUrl":
                    case "uOpacity":
                    default:
                      this.setSingleConfig(n, o);
                  }
              });
          }
        }
        const l = o.userData._exConfig.pos;
        if ((i && (G.isEqual(l, i) || (r = !0)), r)) {
          const e = G.copy(l, i);
          (o.userData._exConfig.pos = e), this.setSingleConfig("pos", o);
        }
        s && this.setSingleConfig("width", o),
          a && this.setSingleConfig("color", o),
          (o.material.needsUpdate = !0);
      }
      getShaderDefine() {
        return u;
      }
      getVertexShader(e) {
        const t = Nn(this.config.exUniform),
          n = this.getShaderDefine(e);
        return Gn(t, n.getVShaderDefine(this, e), n.getVShaderMain(this, e));
      }
      getFragmentShader(e) {
        const t = Nn(this.config.exUniform),
          n = this.getShaderDefine(e);
        return Wn(t, n.getFShaderDefine(this, e), n.getFShaderMain(this, e));
      }
      getMtlId(e, t, n, i) {
        const { colorType: o } = this.getCurConfig(["colorType"], i);
        return "object" == typeof e
          ? t +
              Math.floor(255 * e.x) +
              Math.floor(255 * e.y) +
              Math.floor(255 * e.z) +
              e.w.toFixed(2) +
              n +
              o
          : t + e + n + o;
      }
      getMtl(e, t, n, i) {
        const o = this.getMtlId(e, t, n, i);
        if (this.cacheMtl[o]) return this.cacheMtl[o];
        const { colorType: s } = this.getCurConfig(["colorType"], i),
          r = G.mtl.shader({
            uniforms: {
              uTime: { value: 0 },
              uMap: { value: this.getTxue(t) },
              uHasImg: { value: !!t },
              uColorType: { value: s },
              uColor: { value: this.getColor(e) },
              uOpacity: { value: this.config.uOpacity },
              uNoise: { value: n },
              ...Yn(this.config.exUniform),
            },
            vertexShader: this.getVertexShader(i),
            fragmentShader: this.getFragmentShader(i),
            ...this.config.mtlOpt,
          });
        return (
          G.shaderMtlAddFog(r, this.renderer.scene), (this.cacheMtl[o] = r), r
        );
      }
      setAllMtlsProp(e, t, n) {
        Object.keys(this.cacheMtl).forEach((i) => {
          const o = this.cacheMtl[i];
          "uniform" === n ? (o.uniforms[e].value = t) : (o[e] = t);
        });
      }
      createSingle(e, t) {
        const { data: n, noise: i } = t,
          o = n.pos;
        let s;
        n.exConfig &&
          n.exConfig[this.config.name] &&
          (s = n.exConfig[this.config.name]);
        const { imgUrl: r, color: a } = this.getCurConfig(
            ["imgUrl", "color"],
            s
          ),
          l = this.getMtl(a, r, i, s),
          c = new THRDev3.Mesh(this.geo, l);
        this.setBeforRender(c),
          (c.userData._exConfig = { pos: G.copy({}, o) }),
          s && G.copy(c.userData._exConfig, s),
          (c.userData._type = this.config.type),
          (c.userData._compName = this.group.name),
          (c.userData._noise = i),
          this.config.isCompEvents && this.eventArr.push(c),
          (c.name = e),
          this.setSingleConfig("center", c),
          this.setSingleConfig("width", c),
          this.setSingleConfig("pos", c),
          this.group.add(c);
      }
      setBeforRender() {}
      animate(e, t) {
        if (!this.config.isAnimate && void 0 !== this.config.isAnimate) return;
        let n = e;
        void 0 !== this.config.aniSpeed &&
          ((this.uTime += this.config.aniSpeed * t), (n = this.uTime)),
          this.setAllMtlsProp("uTime", n, "uniform");
      }
      getTriggerKey(e) {
        return e.object.name;
      }
      handleHover(e) {
        const t = this.group.getObjectByName(e);
        t
          ? this.setSingleConfig("highColor", t)
          : this.errorNotice("移入移出传入的uid有问题");
      }
      reloadData(e) {
        super.reloadData(), (this.compUseObj = {});
        const t = this.group.children;
        (this.eventArr = []),
          t.forEach((e) => {
            this.disposeSprite(e);
          }),
          (this.group.children = []),
          this.disposeCacheMtl(),
          this.create(e);
      }
      refresh(e) {
        e && this.create(e);
      }
      dels(e) {
        e && e.length
          ? e.forEach((e) => {
              this.disposeByName(e);
            })
          : this.disposeByName(e);
      }
      disposeByName(e) {
        let t = this.group.getObjectByName(e);
        delete this.compUseObj[e], this.group.remove(t);
        const n = this.eventArr.indexOf(t);
        -1 !== n && this.eventArr.splice(n, 1),
          this.disposeSprite(t),
          (t = null);
      }
      disposeSprite(e) {
        e && G.disposeObj(e);
      }
      disposeCacheMtl() {
        Object.keys(this.cacheMtl).forEach((e) => {
          this.cacheMtl[e].dispose();
        }),
          (this.cacheMtl = {});
      }
      dispose() {
        (this.compUseObj = null),
          this.disposeCacheMtl(),
          (this.posV3 = null),
          super.dispose();
      }
      setHeight(e, t) {
        const {
            parentSize: n,
            width: i,
            scaleVal: o,
            height: s,
          } = this.getCurConfig(
            ["parentSize", "height", "width", "scaleVal"],
            e
          ),
          r = n * i * o,
          a = n * s * o;
        (t.scale.x = r), (t.scale.y = a), (t.scale.z = r);
      }
      setSingleConfig(e, t) {
        if (!t || !t.userData) return;
        const n = t.userData._exConfig;
        switch (e) {
          case "width":
            (this.config.height =
              void 0 === this.config.height
                ? this.config.width
                : this.config.height),
              this.setSingleConfig("height", t);
            break;
          case "height":
          case "scaleVal":
            this.setHeight(n, t);
            break;
          case "parentSize":
            this.setSingleConfig("height", t), this.setSingleConfig("pos", t);
            break;
          case "pos":
          case "offsetPosition":
            {
              const { pos: e } = n,
                { parentSize: i, offsetPosition: o } = this.getCurConfig(
                  ["parentSize", "offsetPosition"],
                  n
                ),
                s = { x: e.x + o.x * i, y: e.y + o.y * i, z: e.z + o.z * i };
              t.position.set(s.x, s.y, s.z);
            }
            break;
          case "uOpacity":
            {
              const { uOpacity: e } = this.getCurConfig(["uOpacity"], n);
              t.material.uniforms.uOpacity.value = e;
            }
            break;
          case "refreshMtl":
          case "color":
          case "highColor":
          case "colorType":
          case "imgUrl":
            {
              const {
                color: e,
                highColor: i,
                imgUrl: o,
              } = this.getCurConfig(["color", "highColor", "imgUrl"], n);
              let s = e;
              i && (this.isHover(t.name) || this.isChoice(t.name)) && (s = i);
              const r = t.userData._noise,
                a = this.getMtl(s, o, r, n);
              t.material = a;
            }
            break;
          case "center":
            t.geometry = this.geo;
        }
      }
      updateConfig(e) {
        Object.keys(e).forEach((t) => {
          G.isObject(e[t]) || G.isArray(e[t])
            ? G.copy(this.config[t], e[t])
            : (this.config[t] = e[t]);
        });
      }
      setConfig(e, t) {
        super.setConfig(e, t),
          this.updateConfig(t),
          Object.keys(t).forEach((e) => {
            switch (e) {
              case "aniSpeed":
              case "globalAniSpeed":
                this.uTime = 0;
                break;
              case "offsetPosition":
              case "parentSize":
              case "color":
              case "highColor":
              case "width":
              case "height":
              case "imgUrl":
              case "scaleVal":
              case "colorType":
                this.group.children.forEach((t) => {
                  this.setSingleConfig(e, t);
                });
                break;
              case "uOpacity":
                this.setAllMtlsProp(
                  "uOpacity",
                  this.config.uOpacity,
                  "uniform"
                );
                break;
              case "mtlOpt":
                const { mtlOpt: t } = this.config;
                Object.keys(t).forEach((e) => {
                  this.setAllMtlsProp(e, t[e]);
                });
                break;
              case "center":
                this.readyGeo(),
                  this.group.children.forEach((t) => {
                    this.setSingleConfig(e, t);
                  });
                break;
              case "showName":
                break;
              default:
                this.warnNotice("无法更新属性" + e);
            }
          });
      }
    };
    function Li(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n        uniform float uScaleVal;\n        uniform float uNoiseVal;\n        uniform vec3 uCameraPos;\n        uniform vec3 uTargetPos;\n        uniform float uTime;\n        varying vec2 vUv;\n        ${
        Qn[n] ? Qn[n].vDefine : ""
      }\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    `;
    }
    function Oi(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 newPos = position;\n    newPos = getHorTowardPos(newPos, center, uCameraPos, uTargetPos, normal);\n    ${
        Qn[n] ? Qn[n].vMain : ""
      }\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function Vi(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    varying vec2 vUv;\n    ${
        Qn[n] ? Qn[n].fDefine : ""
      }\n    vec4 getShaderColor() {\n        return texture2D(uMap, vUv);\n    } \n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        if (uHasImg) {\n            vec4 _shaderColor = getShaderColor();\n            if (uColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else {\n                retColor  = _shaderColor;\n            }\n        } else {\n            if (uColorType < 1.5) {\n                retColor = mC4;\n            } else {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            }\n        }\n        return retColor;\n    }\n    `;
    }
    function Fi(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    gl_FragColor = getBlendingColor(uColor);\n    //gl_FragColor = vec4(imgColor2.xyz * uColor.xyz, imgColor2.w * uColor.w);\n    ${
        Qn[n] ? Qn[n].fMain : ""
      }\n    `;
    }
    var zi = class extends Hi {
      constructor(e, t) {
        super(e, t),
          (this.eventArr = []),
          (this.cPosVector = new THRDev3.Vector3(0, 0, 0)),
          (this.tPosVector = new THRDev3.Vector3(0, 0, 0));
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          moveY: 0.5,
          aniSpeed: 1,
          aniTimes: 0,
          aniType: 0,
          rotation: { x: 0, y: 0, z: 0 },
        };
      }
      getShaderDefine() {
        return d;
      }
      getMtlId(e, t, n, i) {
        const {
          scaleVal: o,
          aniType: s,
          colorType: r,
        } = this.getCurConfig(["scaleVal", "aniType", "colorType"], i);
        return "object" == typeof e
          ? t +
              Math.floor(255 * e.x) +
              Math.floor(255 * e.y) +
              Math.floor(255 * e.z) +
              e.w.toFixed(2) +
              n +
              o +
              s +
              r
          : t + e + n + o + s + r;
      }
      getMtl(e, t, n, i) {
        const o = super.getMtl(e, t, n, i),
          { scaleVal: s } = this.getCurConfig(["scaleVal"], i);
        return (
          (o.uniforms.uScaleVal = { value: s }),
          (o.uniforms.uNoiseVal = { value: n }),
          (o.uniforms.uCameraPos = { value: this.cPosVector }),
          (o.uniforms.uTargetPos = { value: this.tPosVector }),
          (o.uniforms.uAniTimes = { value: this.config.aniTimes }),
          (o.uniforms.uMoveY = { value: this.config.moveY }),
          o
        );
      }
      setBeforRender(e) {
        const t = this;
        e.onBeforeRender = function (e, n, i) {
          const o = i.position;
          (this.material.uniforms.uTargetPos.value = t.tPosVector.copy(
            t.renderer.controls.target
          )),
            (this.material.uniforms.uCameraPos.value = t.cPosVector.copy(o));
        };
      }
      setSingleConfig(e, t) {
        switch ((super.setSingleConfig(e, t), e)) {
          case "scaleVal":
          case "aniType":
            this.setSingleConfig("refreshMtl", t);
        }
      }
      setConfig(e, t) {
        super.setConfig(e, t),
          Object.keys(t).forEach((e) => {
            switch (e) {
              case "aniType":
                (this.uTime = 0),
                  this.group.children.forEach((t) => {
                    this.setSingleConfig(e, t);
                  });
                break;
              case "moveY":
                this.setAllMtlsProp("uMoveY", this.config.moveY, "uniform");
                break;
              case "aniTimes":
                (this.uTime = 0),
                  this.setAllMtlsProp(
                    "uAniTimes",
                    this.config.aniTimes || 0,
                    "uniform"
                  );
            }
          });
      }
    };
    function ji(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n        uniform float uScaleVal;\n        uniform float uNoiseVal;\n        uniform vec3 uCameraPos;\n        uniform vec3 uTargetPos;\n        uniform float uTime;\n        varying vec2 vUv;\n        ${
        Qn[n] ? Qn[n].vDefine : ""
      }\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    `;
    }
    function Bi(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 newPos = position;\n    // newPos = getHorTowardPos(newPos, center, uCameraPos, uTargetPos, normal);\n    \n    ${
        Qn[n] ? Qn[n].vMain : ""
      }\n    vec4 spriteMvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n    vec2 scale;\n    vec2 spriteCenter = vec2(0.5);\n    scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n    scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n    vec2 alignedPosition = ( position.xy - ( spriteCenter - vec2( 0.5 ) ) ) * scale;\n\n    vec2 rotatedPosition;\n    rotatedPosition.x = cos( 0. ) * alignedPosition.x - sin( 0. ) * alignedPosition.y;\n    rotatedPosition.y = sin( 0. ) * alignedPosition.x + cos( 0. ) * alignedPosition.y;\n    spriteMvPosition.xy += rotatedPosition;\n\n    gl_Position = projectionMatrix * spriteMvPosition;\n    // gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));\n    `;
    }
    function Ui(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    varying vec2 vUv;\n    ${
        Qn[n] ? Qn[n].fDefine : ""
      }\n    vec4 getShaderColor() {\n        return texture2D(uMap, vUv);\n    } \n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        if (uHasImg) {\n            vec4 _shaderColor = getShaderColor();\n            if (uColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else {\n                retColor  = _shaderColor;\n            }\n        } else {\n            if (uColorType < 1.5) {\n                retColor = mC4;\n            } else {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            }\n        }\n        return retColor;\n    }\n    `;
    }
    function Ni(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    gl_FragColor = getBlendingColor(uColor);\n    //gl_FragColor = vec4(imgColor2.xyz * uColor.xyz, imgColor2.w * uColor.w);\n    ${
        Qn[n] ? Qn[n].fMain : ""
      }\n    `;
    }
    var Gi = class extends Hi {
      constructor(e, t) {
        super(e, t),
          (this.eventArr = []),
          (this.cPosVector = new THRDev3.Vector3(0, 0, 0)),
          (this.tPosVector = new THRDev3.Vector3(0, 0, 0));
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          moveY: 0.5,
          aniSpeed: 1,
          aniTimes: 0,
          aniType: 0,
          rotation: { x: 0, y: 0, z: 0 },
        };
      }
      getShaderDefine() {
        return p;
      }
      getMtlId(e, t, n, i) {
        const {
          scaleVal: o,
          aniType: s,
          colorType: r,
        } = this.getCurConfig(["scaleVal", "aniType", "colorType"], i);
        return (
          i.imgUrl && (t = i.imgUrl),
          "object" == typeof e
            ? t +
              Math.floor(255 * e.x) +
              Math.floor(255 * e.y) +
              Math.floor(255 * e.z) +
              e.w.toFixed(2) +
              n +
              o +
              s +
              r
            : t + e + n + o + s + r
        );
      }
      getMtl(e, t, n, i) {
        const o = super.getMtl(e, t, n, i),
          { scaleVal: s } = this.getCurConfig(["scaleVal"], i);
        return (
          (o.uniforms.uScaleVal = { value: s }),
          (o.uniforms.uNoiseVal = { value: n }),
          (o.uniforms.uCameraPos = { value: this.cPosVector }),
          (o.uniforms.uTargetPos = { value: this.tPosVector }),
          (o.uniforms.uAniTimes = { value: this.config.aniTimes }),
          (o.uniforms.uMoveY = { value: this.config.moveY }),
          o
        );
      }
      setBeforRender(e) {
        const t = this;
        e.onBeforeRender = function (e, n, i) {
          const o = i.position;
          (this.material.uniforms.uTargetPos.value = t.tPosVector.copy(
            t.renderer.controls.target
          )),
            (this.material.uniforms.uCameraPos.value = t.cPosVector.copy(o));
        };
      }
      setSingleConfig(e, t) {
        switch ((super.setSingleConfig(e, t), e)) {
          case "scaleVal":
          case "aniType":
            this.setSingleConfig("refreshMtl", t);
        }
      }
      setConfig(e, t) {
        super.setConfig(e, t),
          Object.keys(t).forEach((e) => {
            switch (e) {
              case "aniType":
                (this.uTime = 0),
                  this.group.children.forEach((t) => {
                    this.setSingleConfig(e, t);
                  });
                break;
              case "moveY":
                this.setAllMtlsProp("uMoveY", this.config.moveY, "uniform");
                break;
              case "aniTimes":
                (this.uTime = 0),
                  this.setAllMtlsProp(
                    "uAniTimes",
                    this.config.aniTimes || 0,
                    "uniform"
                  );
            }
          });
      }
    };
    function Wi() {
      return "\n        varying vec2 vUv;\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    ";
    }
    function Yi() {
      return "\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 vPos = getHorTowardPos(position, center, uCameraPos, uTargetPos, normal);\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(vPos, 1.0));\n    ";
    }
    function Ki() {
      return "\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    uniform float uTime;\n    uniform float uNoise;\n    uniform float uParticleSize;\n    uniform float uWHRate;\n    varying vec2 vUv;\n    const float PI = 3.14159265;\n    const float PI_TWO = 6.2831853072;\n\n    #define BLADES 4.0\n    #define BIAS 0.1\n    #define SHARPNESS 3.0\n\n    float valueRandom2(vec2 st){\n        st = vec2( dot(st,vec2(127.1,311.7)),\n                  dot(st,vec2(269.5,183.3)) );\n        \n        return fract( sin( dot( st.xy, vec2(12.9898,78.233) ) ) * 43758.5453123);\n    }\n    float star(vec2 position, float size) {\n        position = position / size;\n        float blade = clamp(pow(sin(atan(position.y, position.x )*BLADES)+BIAS, SHARPNESS), 0.0, 1.0);\n        float v = 1.0 / distance(vec2(0.0), position) * 0.075;\n        return min(1.0, blade *0.7) * v + v - 0.25 - 0.1; // (position.y + 1.0) * 0.25\n    }\n    float stars(vec2 st, float scale, float size, float speed) {\n        float rate = 1.0 / st.y;\n        // st.y = mod(st.y - speed * uTime, 1.0);\n        st = st * scale;\n        st.y += uNoise;\n        vec2 i = floor(st);\n        float n2 = valueRandom2(vec2(i.x, uNoise)) * 0.7 + 0.3;\n        st.y = st.y - n2 * speed * uTime; \n        vec2 f = fract(st);\n        i = floor(st);\n        float noise = valueRandom2(i * scale);\n    \n        f = f - 0.5;\n        f = f - 0.2 + noise * 0.4;\n        f.y = rate * f.y;\n        float cs = cos(uTime * noise / 3.0);\n        float sn = sin(uTime * noise / 3.0);\n        f = f * mat2(cs, sn, -sn, cs);\n        float w = star(f, size);\n        float op = abs(sin(uTime + noise));\n        return w * op;\n    }\n    float point(vec2 position, float size) {\n        float dist  = length(position);\n        float k = size / length(position);\n        return k * k - 0.1;\n    }\n    float points(vec2 st, vec2 scale, float size, float speed, float correctScale) {\n        st = st * scale;\n        float rate = correctScale / st.y;\n        st.y += uNoise;\n        vec2 i = floor(st);\n        float n2 = valueRandom2(vec2(i.x, uNoise)) * 0.7 + 0.3;\n        st.y = st.y - n2 * speed * uTime; \n        vec2 f = fract(st);\n        i = floor(st);\n        float noise = valueRandom2(i * scale);\n    \n        f = f - 0.5;\n        f = f - 0.1 + noise * 0.2;\n        f.y = f.y * rate;\n        \n        float pointWeight = point(f, size);\n        float rOp = 0.5 + noise * 0.5;\n        return pointWeight * rOp;\n    }\n    ";
    }
    function $i() {
      return "\n    \n    vec2 cUv = vUv;\n    float thold = 0.2;\n    float op = 1.0;\n    op *= smoothstep(0.0, thold, cUv.y);\n    op *= 1.0 - smoothstep(1.0 - thold - 0.1, 1.0, cUv.y);\n    op *= smoothstep(0.0, 0.2, cUv.x);\n    op *= 1.0 - smoothstep(0.8, 1.0, cUv.x);\n    \n    // (gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n\n    cUv = cUv - vec2(0.5, 0);\n    cUv.y = cUv.y / uWHRate;\n    float angle = atan(cUv.x, cUv.y);\n    float tAgle = PI / 3.0;\n    float rangeOp = smoothstep(-tAgle, -tAgle * 0.8, angle);\n    rangeOp = rangeOp * (1.0 - smoothstep(tAgle * 0.8, tAgle, angle));\n\n    vec2 coord = vec2(angle, length(cUv));\n    float weight = 0.0;\n    weight += max(0.0, points(coord, vec2(5.0, 2.0), 0.08 * uParticleSize, 1.5, 5.0));\n    weight += max(0.0, stars(coord, 2.0,0.6 * uParticleSize, 0.4));\n    weight += max(0.0, stars(coord, 3.0,0.9 * uParticleSize, 0.6));\n\n    gl_FragColor = vec4(uColor.xyz, uColor.w * weight * op * rangeOp);\n    ";
    }
    function Xi() {
      return "\n        const float PI = 6.2831853072;\n        varying vec2 vUv;\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    ";
    }
    function qi() {
      return "\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 vPos = getHorTowardPos(position, center, uCameraPos, uTargetPos, normal);\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(vPos, 1.0));\n    ";
    }
    function Zi() {
      return "\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    uniform float uTime;\n    uniform float uNoise;\n    uniform float uParticleSize;\n    uniform float uWHRate;\n    varying vec2 vUv;\n\n    #define BLADES 4.0\n    #define BIAS 0.1\n    #define SHARPNESS 3.0\n\n    float valueRandom2(vec2 st){\n        st = vec2( dot(st,vec2(127.1,311.7)),\n                  dot(st,vec2(269.5,183.3)) );\n        \n        return fract( sin( dot( st.xy, vec2(12.9898,78.233) ) ) * 43758.5453123);\n    }\n    float star(vec2 position, float size) {\n        position = position / size;\n        float blade = clamp(pow(sin(atan(position.y,position.x )*BLADES)+BIAS, SHARPNESS), 0.0, 1.0);\n        float v = 1.0 / distance(vec2(0.0), position) * 0.075;\n        return min(1.0, blade *0.7) * v + v - 0.25 - 0.1; // (position.y + 1.0) * 0.25\n    }\n    float stars(vec2 st, float scale, float size, float speed) {\n        // st.y = mod(st.y - speed * uTime, 1.0);\n        st = st * scale;\n        st.y += uNoise;\n        vec2 i = floor(st);\n        float n2 = valueRandom2(vec2(i.x, uNoise)) * 0.7 + 0.3;\n        st.y = st.y - n2 * speed * uTime; \n        vec2 f = fract(st);\n        i = floor(st);\n        float noise = valueRandom2(i * scale);\n    \n        f = f - 0.5;\n        f = f - 0.2 + noise * 0.4;\n        float cs = cos(uTime * noise / 3.0);\n        float sn = sin(uTime * noise / 3.0);\n        f = f * mat2(cs, sn, -sn, cs);\n        float w = star(f, size);\n        float op = abs(sin(uTime + noise));\n        return w * op;\n    }\n    float point(vec2 position, float size) {\n        float dist  = length(position);\n        float k = size / length(position);\n        return k * k - 0.1;\n    }\n    float points(vec2 st, vec2 scale, float size, float speed) {\n        st = st * scale;\n        st.y += uNoise;\n        vec2 i = floor(st);\n        float n2 = valueRandom2(vec2(i.x, uNoise)) * 0.7 + 0.3;\n        st.y = st.y - n2 * speed * uTime; \n        vec2 f = fract(st);\n        i = floor(st);\n        float noise = valueRandom2(i * scale);\n    \n        f = f - 0.5;\n        f = f - 0.3 + noise * 0.6;\n\n        float pointWeight = point(f, size);\n        float rOp = 0.3 + noise;\n        pointWeight = clamp(0.0, 1.0, pointWeight);\n        rOp = abs(sin(uTime + noise));\n        return pointWeight * rOp;\n    }\n    ";
    }
    function Qi() {
      return "\n    vec2 cUv = vUv;\n    float thold = 0.3;\n    float op = 1.0;\n    op *= smoothstep(0.0, thold, cUv.y);\n    op *= 1.0 - smoothstep(1.0 - thold, 1.0, cUv.y);\n\n    float weight = 0.0;\n    cUv.y = cUv.y / uWHRate;\n    weight += points(cUv, vec2(6.0), 0.03 * uParticleSize, 2.5);\n    weight += stars(cUv, 2.0, 0.55 * uParticleSize, 0.8);\n    weight += stars(cUv, 4.0, 0.8 * uParticleSize, 1.2);\n    gl_FragColor = vec4(uColor.xyz, uColor.w * weight * op);\n    ";
    }
    function Ji() {
      return "\n        const float PI = 6.2831853072;\n        varying vec2 vUv;\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    ";
    }
    function eo() {
      return "\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 vPos = getHorTowardPos(position, center, uCameraPos, uTargetPos, normal);\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(vPos, 1.0));\n    ";
    }
    function to() {
      return "\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    uniform float uTime;\n    uniform float uParticleSize;\n    uniform float uWHRate;\n    varying vec2 vUv;\n    \n    #define BLADES 6.0\n    #define BIAS 0.1\n    #define SHARPNESS 3.0\n    #define PI 3.1415926\n    float reMap(float beforeStart, float beforeEnd, float start, float end, float curVal) {\n        float rate = (curVal - beforeStart) / (beforeEnd - beforeStart);\n        return rate * (end - start) + start;\n    }\n    float star(vec2 position, float size) {\n        position = position / size;\n        float blade = clamp(pow(sin(atan(position.y,position.x )*BLADES)+BIAS, SHARPNESS), 0.0, 1.0);\n        float v = 1.0 / distance(vec2(0.0), position) * 0.075;\n        return min(1.0, blade *0.7) * v + v - 0.25; // (position.y + 1.0) * 0.25\n    }\n    float hash( float n ) { return fract(sin(n)*43758.5453); }\n\n    float noise( in vec2 x )\n    {\n        vec2 p = floor(x);\n        vec2 f = fract(x);\n        f = f*f*(3.0-2.0*f);\n        float n = p.x + p.y*57.0;\n        float res = mix(mix(hash(n+0.0), hash(n+1.0),f.x), mix(hash(n+57.0), hash(n+58.0),f.x),f.y);\n        return res;\n    }\n\n    const float LAYERS = 4.0;\n    const float SPEED = 0.005;\n    const float SCALE = 80.0;\n    const float DENSITY = 1.5;\n    const float BRIGHTNESS = 10.0;\n\n    float rand(vec2 co){ return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); }\n    ";
    }
    function no() {
      return "\n    vec2 totalUv = vec2(1.0);\n    vec2 pos = vUv.xy - 0.5;\n    pos.y = pos.y / uWHRate;\n    float op = 1.0;\n    float d = length(pos);\n    if (d > 0.4) {\n        op = reMap(0.4, 0.6, 1.0, 0.0, d);\n        // op = smoothstep(1.0, 0, )\n    }\n    float dist = length(pos) / totalUv.y;\n    vec2 coord = vec2(pow(dist, 0.1), atan(pos.x, pos.y) / (PI*2.0));\n    \n    float a = pow((1.0-dist),20.0);\n    float i, t, r, c, m;\n    vec2  p;\n    vec2 uv;\n\n    float weight = 0.0;\n    for (int j = 4; j < 6; j++) {\n        i = float(j);\n        t = i*10.0 + uTime*i*i;\n        r = coord.x - (t*SPEED);\n        coord.y = coord.y - uTime * 0.1;\n        c = fract(a+coord.y + i*.543);\n        p = vec2(r, c*.5)*SCALE*(LAYERS/(i*i));\n        uv = fract(p)*2.0-1.0;\n        m = clamp((rand(floor(p))-DENSITY/i)*BRIGHTNESS, 0.0, 1.0);\n        weight +=  clamp(star(uv*0.5, 0.8 * uParticleSize)*m*dist, 0.0, 1.0);\n    }\n    vec3 color = uColor.xyz;\n    if (weight > 1.0) {\n        color = color * pow(weight, 3.0);\n    }\n    gl_FragColor = vec4(color, uColor.w * weight * op);\n    ";
    }
    function io() {
      return "\n        varying vec2 vUv;\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    ";
    }
    function oo() {
      return "\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 vPos = getHorTowardPos(position, center, uCameraPos, uTargetPos, normal);\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(vPos, 1.0));\n    ";
    }
    function so() {
      return "\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform bool uHasImg;\n    uniform float uTime;\n    uniform float uNoise;\n    uniform float uParticleSize;\n    uniform float uWHRate;\n    varying vec2 vUv;\n\n    #define PI 3.1415926\n    float valueRandom2(vec2 st){\n        st = vec2( dot(st,vec2(127.1,311.7)),\n                  dot(st,vec2(269.5,183.3)) );\n        \n        return -1.0 + 2.0 * fract( sin( dot( st.xy, vec2(12.9898,78.233) ) ) * 43758.5453123);\n    }\n    float reMap(float beforeStart, float beforeEnd, float start, float end, float curVal) {\n        float rate = (curVal - beforeStart) / (beforeEnd - beforeStart);\n        return rate * (end - start) + start;\n    }\n    float VDrop2(vec2 uv, float size)\n    {\n        float newSize = clamp(0.0, 2.0, size);\n        newSize = reMap(0.0, 2.0, 6.0, 0.8, newSize);\n        uv.x *= sin(1.)* 0.12 * newSize; // ADJUST PERSP\n        float t = uTime*0.4;\n        uv.x = uv.x*64.0; // H-Count\n        vec2 i = vec2(floor(uv.x));\n        float n = valueRandom2(i);\n        float dx = fract(uv.x);\n        uv.x = floor(uv.x);\n        \n        uv.y *= -0.15; // stretch\n        float o=sin(uv.x*215.4); // offset\n        float s=cos(uv.x*33.1)*.3 +.7; // speed\n        float trail = mix(145.0,15.0,s); // trail length\n\n        float yv = 1.0/(fract(uv.y + t*s + o) * trail);\n        yv = smoothstep(0.0,1.0,yv*yv);\n        yv = sin(yv*PI)*(s*5.0);\n        float d = sin(dx*PI);\n        return yv*(d*d) * (0.2 + n * 0.8) * clamp(0.0, 1.0, size);\n    }\n    ";
    }
    function ro() {
      return "\n    float thold = 0.2;\n    float op = 1.0;\n    vec2 cUv = vUv;\n    op *= smoothstep(0.0, thold, cUv.y);\n    op *= 1.0 - smoothstep(1.0 - thold, 1.0, cUv.y);\n\n    cUv = cUv * 2.0 - 1.0;\n    cUv.y = cUv.y / uWHRate;\n    cUv.y += uNoise;\n    float weight = VDrop2(cUv, uParticleSize);\n    gl_FragColor=vec4(uColor.xyz, uColor.w * weight * op);\n    ";
    }
    function ao() {
      return "\n        varying vec2 vUv;\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    ";
    }
    function lo() {
      return "\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 vPos = getHorTowardPos(position, center, uCameraPos, uTargetPos, normal);\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(vPos, 1.0));\n    ";
    }
    function co() {
      return "\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    uniform float uTime;\n    uniform float uNoise;\n    uniform float uParticleSize;\n    uniform float uWHRate;\n    varying vec2 vUv;\n\n    // hash functions from https://www.shadertoy.com/view/4djSRW\n    vec2 hash21(float p) {\n        vec3 p3 = fract(vec3(p) * vec3(.1031, .1030, .0973));\n        p3 += dot(p3, p3.yzx + 33.33);\n        return fract((p3.xx+p3.yz)*p3.zy);\n    }\n\n    float hash11(float p) {\n        p = fract(p * .1031);\n        p *= p + 33.33;\n        p *= p + p;\n        return fract(p);\n    }\n    // ------------------------------------------------------------------------\n\n    vec3 color(float t) {\n        // from IQ's color pattern formula\n        return .3 + .7 * cos(6.283 * (vec3(1., .5, .0) * (1. - t) + vec3(.7, .75, .3)));\n    }\n    ";
    }
    function ho() {
      return "\n    float thold = 0.2;\n    float op = 1.0;\n    vec2 cUv = vUv;\n    op *= smoothstep(0.0, thold, cUv.y);\n    op *= 1.0 - smoothstep(1.0 - thold, 1.0, cUv.y);\n\n    // vec2 uv = (2. * fragCoord.xy - iResolution.xy) / iResolution.y;\n    // uv.y += .9;\n    cUv = 2.0 * cUv - 1.0;\n    cUv.y += 0.9;\n    cUv.y = cUv.y / uWHRate;\n\n    vec3 col = vec3(0.);\n    float time = uTime * .5;\n    float weight = 0.0;\n    for (int i = 0; i < 30; i++) {\n        float sd = time + float(i) * 3303.1031;\n        float id = floor(sd);\n        float t = sd - id;\n        \n        float rnd = hash11(id);\n        vec2 p = hash21(id);\n        \n        p.y *= -t * (rnd + .5) - .5;\n        p.x *= rnd > .5 ? -1. : 1.;\n        \n        float size = (rnd * .0075 + .00025) * uParticleSize;\n        float flicker = hash11(t * .5) * .0015;\n        \n        float cycle = rnd * 8.;\n        float w = p.x * .3 - p.x * p.y * .45;\n        float d = (size + flicker * clamp(0.0, 1.0, uParticleSize)) / length(cUv + vec2(cos(sd * cycle - abs(t) * 2.) * w, p.y));\n\n        weight += d;\n    }\n    \n    weight = pow(weight, 1.9);\n    gl_FragColor=vec4(uColor.xyz * weight, uColor.w * weight * op);\n    // gl_FragColor=vec4(uColor.xyz, uColor.w * weight * op);\n    ";
    }
    var uo = { type1: f, type2: m, type3: g, type4: v, type5: y };
    var po = class extends Hi {
      constructor(e, t) {
        super(e, t),
          (this.eventArr = []),
          (this.cPosVector = new THRDev3.Vector3(0, 0, 0)),
          (this.tPosVector = new THRDev3.Vector3(0, 0, 0));
      }
      getDefaultOpt() {
        const e = {
          ...super.getDefaultOpt(),
          aniSpeed: 1,
          shaderType: 4,
          particleSize: 1,
          rotation: { x: 0, y: 0, z: 0 },
        };
        return (
          e.exUniform || (e.exUniform = {}),
          (e.exUniform.uCameraPos = { type: "vec3", value: this.cPosVector }),
          (e.exUniform.uTargetPos = { type: "vec3", value: this.tPosVector }),
          e
        );
      }
      getShaderDefine(e) {
        const { shaderType: t } = this.getCurConfig(["shaderType"], e);
        return uo["type" + (t || 1)];
      }
      addShaderType(e, t) {
        if (!t) return;
        const n = "type" + e;
        if (uo[n])
          return void this.errorNotice(`shaderType ${e} 已定义, 请更换type`);
        const i = uo.type1;
        uo[n] = { ...i, ...t };
      }
      setBeforRender(e) {
        const t = this;
        e.onBeforeRender = function (e, n, i) {
          const o = i.position;
          (this.material.uniforms.uTargetPos.value = t.tPosVector.copy(
            t.renderer.controls.target
          )),
            (this.material.uniforms.uCameraPos.value = t.cPosVector.copy(o));
        };
      }
      getMtlId(e, t, n, i) {
        const {
          width: o,
          height: s,
          shaderType: r,
        } = this.getCurConfig(["height", "width", "shaderType"], i);
        return "object" == typeof e
          ? t +
              Math.floor(255 * e.x) +
              Math.floor(255 * e.y) +
              Math.floor(255 * e.z) +
              e.w.toFixed(2) +
              n +
              o +
              s +
              r
          : t + e + n + o + s + r;
      }
      getMtl(e, t, n, i) {
        const { width: o, height: s } = this.getCurConfig(
            ["height", "width"],
            i
          ),
          r = super.getMtl(e, t, n, i);
        return (
          (r.uniforms.uParticleSize = { value: this.config.particleSize }),
          (r.uniforms.uWHRate = { value: o / s }),
          r
        );
      }
      getTxue(e) {
        return (
          this.txueObj[e] ||
            (this.txueObj[e] = this.renderer.setTxue({
              id: this.getTxueId(e),
              url: e,
              isRepeat: !0,
            })),
          this.txueObj[e]
        );
      }
      setSingleConfig(e, t) {
        switch ((super.setSingleConfig(e, t), e)) {
          case "height":
            this.setSingleConfig("refreshMtl", t);
            break;
          case "shaderType":
            const e = this.getVertexShader({}),
              n = this.getFragmentShader({});
            this.setAllMtlsProp("vertexShader", e),
              this.setAllMtlsProp("fragmentShader", n),
              this.setAllMtlsProp("needsUpdate", !0);
        }
      }
      setConfig(e, t) {
        "addShaderType" !== e
          ? (super.setConfig(e, t),
            Object.keys(t).forEach((e) => {
              switch (e) {
                case "aniSpeed":
                case "globalAniSpeed":
                  this.uTime = 0;
                  break;
                case "particleSize":
                  this.setAllMtlsProp(
                    "uParticleSize",
                    this.config.particleSize,
                    "uniform"
                  );
                  break;
                case "shaderType":
                  this.group.children.forEach((t) => {
                    this.setSingleConfig(e, t);
                  });
              }
            }))
          : this.addShaderType(t.shaderType, t);
      }
      getConfig(e, t) {
        let n;
        switch (e) {
          case "shaderTypeStandard":
            n =
              "{\n                shaderType: 100,\n                getVShaderDefine() { // 顶点shader扩展定义\n                    return '';\n                },\n                getVShaderMain() { // 顶点shader main函数\n                    return '';\n                },\n                getFShaderDefine() { // 面shader扩展定义\n                    return '';\n                },\n                getFShaderMain() { // 面shader main函数\n                    return '';\n                }\n            }";
            break;
          case "shaderTypeDefine":
            {
              const e = "type" + t.shaderType,
                i = uo[e];
              n = i
                ? {
                    vShaderDefine: i.getVShaderDefine(this),
                    vShaderMain: i.getVShaderMain(this),
                    fShaderDefine: i.getFShaderDefine(this),
                    fShaderMain: i.getFShaderMain(this),
                  }
                : {};
            }
            break;
          case "vertexShader":
            n = this.group.children[0]
              ? this.group.children[0].material.vertexShader
              : "";
            break;
          case "fragmentShader":
            n = this.group.children[0]
              ? this.group.children[0].material.fragmentShader
              : "";
            break;
          default:
            n = super.getConfig(e, t);
        }
        return n;
      }
    };
    var fo = class extends Ri {
      constructor(e, t) {
        super(e, t), (this.eventArr = []);
      }
      init(e) {
        this.config.exUniform || (this.config.exUniform = {}),
          (this.config.exUniform.uWaveNum = {
            type: "float",
            value: this.config.uWaveNum,
          }),
          super.init(e);
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          uWaveNum: 3,
          shaderType: 8,
          rotation: { x: -1.6, y: 0, z: 0 },
        };
      }
      getGeo() {
        const {
            width: e,
            height: t,
            rotation: n,
            uWaveNum: i,
            center: o,
          } = this.config,
          s = void 0 === t ? e : t,
          r = new THRDev3.PlaneGeometry(e, s),
          a = [],
          l = [],
          c = [],
          h = r.index.array;
        for (let e = 0; e < i; e++) {
          l.push(...r.attributes.position.array),
            a.push(...r.attributes.uv.array);
          for (let t = 0, n = h.length; t < n; t++) c.push(h[t] + 4 * e);
        }
        const u = G.geo.buf();
        u.setAttribute("position", new THRDev3.Float32BufferAttribute(l, 3)),
          u.setAttribute("uv", new THRDev3.Float32BufferAttribute(a, 2)),
          u.setIndex(new THRDev3.Uint16BufferAttribute(c, 1)),
          u.translate((0.5 - o.x) * e, (0.5 - o.y) * s, 0);
        const d = new THRDev3.Matrix4();
        d.identity();
        const p = new THRDev3.Euler(n.x, n.y, n.z, "XYZ");
        return d.makeRotationFromEuler(p), u.applyMatrix4(d), u;
      }
      getTriggerKey(e) {
        const t = e.faceIndex,
          n = Math.floor(t / (2 * this.config.uWaveNum));
        return Object.keys(this.useConfObj).find(
          (e) => this.useConfObj[e].useIdx === n
        );
      }
      extendAttribute(e, t) {
        const n = [];
        for (let e = 0, i = t.shaderTypes.length; e < i; e++) {
          const t = e % (4 * this.config.uWaveNum);
          n.push(Math.floor(t / 4));
        }
        e.setAttribute("aFaceIndex", new THRDev3.Float32BufferAttribute(n, 1));
      }
    };
    var mo = class extends $n {
      constructor(e, t) {
        super(e, t),
          (this.eventArr = []),
          (this.uTime = 0),
          (this.cacheMtl = {}),
          (this.compUseObj = {});
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          name: "Cylinder",
          showName: void 0,
          isAnimate: !0,
          mtlOpt: { depthWrite: !0, transparent: !0, depthTest: !1 },
          moveY: 2,
          aniSpeed: 1,
          aniTimes: 0,
          aniType: 4,
          colorType: 1,
          color: "rgba(255, 255, 255, 1)",
          faceNum: 16,
          rotation: { x: 0, y: 0, z: 0 },
          imgUrl: "",
          centerY: 0.5,
          offsetPosition: { x: 0, y: 0, z: 0 },
          width: 6,
          scaleVal: 1,
          parentSize: 1,
          uOpacity: 1,
        };
      }
      init(e) {
        (this.config.height =
          void 0 === this.config.height
            ? this.config.width
            : this.config.height),
          this.setGroupOffset(),
          this.create(e);
      }
      setPlaneGeo() {
        const e = G.geo.plane(
            this.circleInfors.baseWidth,
            this.circleInfors.baseHeight
          ),
          { centerY: t } = this.config;
        e.translate(0, (0.5 - t) * this.circleInfors.baseHeight, 0),
          (this.planeGeo = e);
      }
      getMtlUid(e, t, n) {
        return e + t + n;
      }
      getPlaneMtls(e, t, n, i, o) {
        const s = this.getMtlUid(e, t, n);
        if (this.cacheMtl[s]) return this.cacheMtl[s];
        const { mtlOpt: r } = this.getCurConfig(["mtlOpt"], o),
          a = this.getColor(e),
          l = this.getTxue(t),
          c = [],
          h = Nn(this.config.exUniform),
          u = Gn(
            h,
            "\n    varying vec2 vUv;\n    ",
            "\n    vUv = uv;\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(position, 1.0));\n    "
          ),
          d = Wn(
            h,
            "\n    uniform float uRange[2];\n    uniform float uColorType;\n    uniform bool uHasImg;\n    uniform vec4 uColor;\n    uniform sampler2D uMap;\n    varying vec2 vUv;\n    vec4 getShaderColor() {\n        vec2 useUv = vUv;\n        useUv.x = uRange[0] + (uRange[1] - uRange[0]) * vUv.x;\n        return texture2D(uMap, useUv);\n    } \n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        if (uHasImg) {\n            vec4 _shaderColor = getShaderColor();\n            if (uColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else {\n                retColor  = _shaderColor;\n            }\n        } else {\n            if (uColorType < 1.5) {\n                retColor = mC4;\n            } else {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            }\n        }\n        return retColor;\n    }\n    ",
            "\n        gl_FragColor = getBlendingColor(uColor);\n        // gl_FragColor = vec4(uColor.xyz * imgColor2.xyz, imgColor2.w  * uColor.w);\n        "
          );
        return (
          this.circleInfors.planes.forEach((e) => {
            const i = G.mtl.shader({
              uniforms: {
                uMap: { value: l },
                uHasImg: { value: !!t },
                uColorType: { value: n },
                uOpacity: { value: this.config.uOpacity },
                uColor: { value: a },
                uRange: { value: e.uRange },
                ...Yn(this.config.exUniform),
              },
              side: THRDev3.DoubleSide,
              vertexShader: u,
              fragmentShader: d,
              ...r,
            });
            c.push(i);
          }),
          (this.cacheMtl[s] = c),
          c
        );
      }
      setAllMtlsProp(e, t, n) {
        Object.keys(this.cacheMtl).forEach((i) => {
          this.cacheMtl[i].forEach((i) => {
            "uniform" === n ? (i.uniforms[e].value = t) : (i[e] = t);
          });
        });
      }
      setCircleInfor() {
        const { faceNum: e } = this.config,
          t = (2 * Math.PI) / e,
          n = 0.5 * Math.sin(t / 2) * 2,
          i = 0.5 * Math.cos(t / 2),
          o = [],
          s = 1 / e;
        for (let n = 0; n < e; n++) {
          const e = {};
          e.rotate = n * t;
          const r = n * t;
          (e.position = { x: Math.sin(r) * i, y: 0, z: Math.cos(r) * i }),
            (e.uRange = [n * s, (n + 1) * s]),
            o.push(e);
        }
        this.circleInfors = {
          perAngle: t,
          baseWidth: n,
          baseHeight: 1,
          raduis: 0.5,
          innerR: i,
          planes: o,
        };
      }
      create(e) {
        Object.keys(e).length &&
          (this.setCircleInfor(),
          this.setPlaneGeo(),
          Object.keys(e).forEach((t) => {
            this.compUseObj[t] && this.compUseObj[t].hasCreate
              ? this.updateSingle(t, e[t])
              : (this.createCylinder(t, e[t]),
                (this.compUseObj[t] = { hasCreate: !0 }));
          }));
      }
      updateSingle(e, t) {
        const { data: n } = t,
          { pos: i } = n,
          o = this.group.getObjectByName(e);
        if (n.exConfig) {
          const e = n.exConfig[this.config.name];
          if (e) {
            const t = G.copy({}, o.userData._exConfig);
            G.copy(o.userData._exConfig, e);
            let n = !1;
            Object.keys(e).forEach((i) => {
              if (!G.isEqual(t[i], e[i])) {
                switch (i) {
                  case "offsetPosition":
                  case "pos":
                    return;
                  case "width":
                  case "height":
                  case "scaleVal":
                  case "parentSize":
                    return void (n = !0);
                }
                this.setSingleConfig(i, o);
              }
            }),
              n && this.setSingleConfig("width", o);
          }
        }
        i && (o.userData._exConfig.pos = G.copy({}, i)),
          this.setSingleConfig("pos", o),
          o.children.forEach((e) => {
            e.material.needsUpdate = !0;
          });
      }
      createCylinder(e, t) {
        const { data: n, noise: i } = t,
          o = n.pos;
        let s;
        n.exConfig &&
          n.exConfig[this.config.name] &&
          (s = n.exConfig[this.config.name]);
        const r = G.obj(e),
          {
            color: a,
            imgUrl: l,
            colorType: c,
          } = this.getCurConfig(["color", "imgUrl", "colorType"], s),
          h = this.getPlaneMtls(a, l, c, n, s);
        this.circleInfors.planes.forEach((e, t) => {
          const n = new THRDev3.Mesh(this.planeGeo, h[t]);
          n.position.copy(e.position), (n.rotation.y = e.rotate), r.add(n);
        }),
          (r.userData._exConfig = { pos: G.copy({}, o) }),
          s && G.copy(r.userData._exConfig, s),
          (r.userData._type = this.config.type),
          (r.userData._compName = this.group.name),
          (r.userData._noise = i),
          this.config.isCompEvents && this.eventArr.push(r),
          (r.name = e),
          this.setSingleConfig("width", r),
          this.setSingleConfig("pos", r),
          this.setSingleConfig("rotation", r),
          this.group.add(r);
      }
      animate(e, t) {
        if (!this.config.isAnimate && void 0 !== this.config.isAnimate) return;
        if (!this.config.aniType) return;
        const { aniTimes: n, moveY: i } = this.config;
        let o,
          s = e;
        void 0 !== this.config.aniSpeed &&
          ((this.uTime += this.config.aniSpeed * t), (s = this.uTime)),
          this.isAniContinue(this.config.aniTimes, s) &&
            (4 === this.config.aniType &&
              (o = this.getRotateRatio(s, 0, n) * Math.PI * 2),
            this.group.children.forEach((e) => {
              const t = e.userData,
                { parentSize: r } = this.getCurConfig(
                  ["parentSize"],
                  t._exConfig
                );
              switch (this.config.aniType) {
                case 1:
                  {
                    const o = this.floatRatio(s, t._noise, n);
                    (t._aniPosY = o * i * r),
                      this.setSingleConfig("_aniPosY", e);
                  }
                  break;
                case 2:
                  {
                    const i = this.getFlickerInfo(s, t._noise, n);
                    (t._aniOpacity = i.opRatio),
                      (t._aniSize = i.sizeRatio),
                      this.setSingleConfig("_aniOpacity", e),
                      this.setSingleConfig("_aniSize", e);
                  }
                  break;
                case 3:
                  {
                    const o = this.getFlickerInfo(s, t._noise, n);
                    (t._aniOpacity = o.opRatio),
                      (t._aniSize = o.sizeRatio),
                      (t._aniPosY = o.yRatio * i * r),
                      this.setSingleConfig("_aniOpacity", e),
                      this.setSingleConfig("_aniSize", e),
                      this.setSingleConfig("_aniPosY", e);
                  }
                  break;
                case 4:
                  (t._aniRotationY = o),
                    this.setSingleConfig("_aniRotationY", e);
              }
            }));
      }
      getTriggerKey(e) {
        return e.object.name;
      }
      handleHover(e) {
        const t = this.group.getObjectByName(e);
        t
          ? this.setSingleConfig("highColor", t)
          : this.errorNotice("移入移出传入的uid有问题");
      }
      reloadData(e) {
        const t = this.group.children;
        (this.eventArr = []),
          (this.compUseObj = {}),
          t.forEach((e) => {
            this.disposeSprite(e);
          }),
          this.disposeCacheMtl(),
          (this.group.children = []),
          this.create(e);
      }
      disposeCacheMtl() {
        Object.keys(this.cacheMtl).forEach((e) => {
          this.cacheMtl[e].forEach((e) => {
            e.dispose();
          });
        }),
          (this.cacheMtl = {});
      }
      refresh(e) {
        e && this.create(e);
      }
      dels(e) {
        e && e.length
          ? e.forEach((e) => {
              this.disposeByName(e);
            })
          : this.disposeByName(e);
      }
      disposeByName(e) {
        let t = this.group.getObjectByName(e);
        delete this.compUseObj[e],
          this.group.remove(t),
          t.children.forEach((e) => {
            e.material = null;
          });
        const n = this.eventArr.indexOf(t);
        -1 !== n && this.eventArr.splice(n, 1),
          this.disposeSprite(t),
          (t = null);
      }
      disposeSprite(e) {
        e && G.disposeObj(e);
      }
      dispose() {
        (this.compUseObj = null), this.disposeCacheMtl(), super.dispose();
      }
      setSingleConfig(e, t) {
        if (!t || !t.userData) return;
        const n = t.userData._exConfig;
        switch (e) {
          case "width":
          case "height":
          case "scaleVal":
            {
              const {
                  parentSize: e,
                  width: i,
                  height: o,
                  scaleVal: s,
                } = this.getCurConfig(
                  ["parentSize", "height", "width", "scaleVal"],
                  n
                ),
                r = e * i * s,
                a = e * o * s;
              if (
                (t.userData._preScale || (t.userData._preScale = {}),
                (t.userData._preScale.x = r),
                (t.userData._preScale.y = a),
                (t.userData._preScale.z = r),
                void 0 === t.userData._aniSize)
              ) {
                (t.scale.x = r), (t.scale.y = a), (t.scale.z = r);
                break;
              }
              this.setSingleConfig("_aniSize", t);
            }
            break;
          case "parentSize":
            this.setSingleConfig("width", t), this.setSingleConfig("pos", t);
            break;
          case "_aniSize":
            {
              const { _preScale: e, _aniSize: n } = t.userData;
              t.scale.set(e.x * n, e.y * n, e.z * n);
            }
            break;
          case "pos":
          case "offsetPosition":
            {
              const { pos: e } = n,
                { parentSize: i, offsetPosition: o } = this.getCurConfig(
                  ["parentSize", "offsetPosition"],
                  n
                ),
                s = { x: e.x + o.x * i, y: e.y + o.y * i, z: e.z + o.z * i };
              if (
                (t.position.set(s.x, s.y, s.z),
                (t.userData._prePos = s),
                void 0 === t.userData._aniPosY)
              )
                break;
              this.setSingleConfig("_aniPosY", t);
            }
            break;
          case "_aniPosY":
            t.position.y = t.userData._prePos.y + t.userData._aniPosY;
            break;
          case "imgUrl":
          case "color":
          case "highColor":
          case "colorType":
            {
              const {
                color: e,
                highColor: i,
                imgUrl: o,
                colorType: s,
              } = this.getCurConfig(
                ["color", "highColor", "imgUrl", "colorType"],
                n
              );
              let r = e;
              i && (this.isHover(t.name) || this.isChoice(t.name)) && (r = i);
              const a = this.getPlaneMtls(r, o, s, {}, n);
              t.children.forEach((e, t) => {
                e.material = a[t];
              });
            }
            break;
          case "_aniOpacity":
            t.children.forEach((e) => {
              e.material.uniforms.uOpacity.value =
                this.config.uOpacity * t.userData._aniOpacity;
            });
            break;
          case "rotation":
            {
              const { rotation: e } = this.getCurConfig(["rotation"], n);
              if (
                ((t.userData._preRotation = e),
                void 0 === t.userData._aniRotationY)
              ) {
                t.rotation.set(e.x, e.y, e.z);
                break;
              }
              this.setSingleConfig("_aniRotationY", t);
            }
            break;
          case "_aniRotationY":
            t.rotation.y = t.userData._preRotation.y + t.userData._aniRotationY;
            break;
          case "centerY":
            t.children.forEach((e) => {
              e.geometry = this.planeGeo;
            });
            break;
          case "mtlOpt":
            const { mtlOpt: e } = this.getCurConfig(["mtlOpt"], n);
            Object.keys(e).forEach((t) => {
              this.setAllMtlsProp(t, e[t]);
            });
        }
      }
      setConfig(e, t) {
        super.setConfig(e, t),
          Object.keys(t).forEach((e) => {
            switch (
              (G.isObject(t[e])
                ? G.copy(this.config[e], t[e])
                : (this.config[e] = t[e]),
              e)
            ) {
              case "offsetPosition":
              case "parentSize":
              case "color":
              case "highColor":
              case "mtlOpt":
              case "bgImgIdx":
              case "scaleVal":
              case "rotation":
              case "width":
              case "height":
              case "imgUrl":
              case "colorType":
                this.group.children.forEach((t) => {
                  this.setSingleConfig(e, t);
                });
                break;
              case "centerY":
                this.setPlaneGeo(),
                  this.group.children.forEach((t) => {
                    this.setSingleConfig(e, t);
                  });
                break;
              case "aniTimes":
              case "aniSpeed":
                this.uTime = 0;
                break;
              case "aniType":
                (this.uTime = 0),
                  this.group.children.forEach((e) => {
                    const t = e.userData;
                    (t._aniPosY = 0),
                      (t._aniSize = 1),
                      (t._aniOpacity = 1),
                      (t._aniRotationY = 0),
                      this.setSingleConfig("_aniOpacity", e),
                      this.setSingleConfig("_aniSize", e),
                      this.setSingleConfig("_aniPosY", e),
                      this.setSingleConfig("_aniRotationY", e);
                  });
                break;
              case "uOpacity":
                this.group.children.forEach((e) => {
                  (e.userData._aniOpacity = 1),
                    this.setSingleConfig("_aniOpacity", e);
                });
                break;
              case "moveY":
              case "showName":
                break;
              default:
                this.warnNotice("无法更新属性" + e);
            }
          });
      }
    };
    function go() {
      return "\n    ";
    }
    function vo() {
      return "\n    gl_Position = projectionMatrix * (modelViewMatrix * vec4(position, 1.0));\n    ";
    }
    function yo() {
      return "\n    ";
    }
    function bo() {
      return "\n        gl_FragColor = vec4(vColor.xyz, vColor.w);\n    ";
    }
    var xo = class extends Ri {
      constructor(e, t) {
        super(e, t), (this.eventArr = []);
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          mtlOpt: {
            depthWrite: !0,
            transparent: !0,
            depthTest: !1,
            side: THRDev3.DoubleSide,
          },
          name: "EventComp",
          color: "rgba(255, 255, 255, 0)",
          isCompEvents: !0,
          hover: !0,
          center: { x: 0.5, y: 0 },
          offsetPosition: { x: 0, y: 0, z: 0 },
          scaleVal: 1,
          width: 10,
          shaderType: -1,
          globalAniSpeed: 1,
        };
      }
      getShaderDefine() {
        return b;
      }
      init(e) {
        (this.config.globalAniSpeed = this.config.aniSpeed), super.init(e);
      }
      getGeo() {
        const { width: e, height: t, center: n, rotation: i } = this.config,
          o = G.geo.buf(),
          s = void 0 === t ? e : t,
          r = new THRDev3.PlaneGeometry(e, s),
          a = r.index.array,
          l = [];
        for (let e = 0, t = a.length; e < 3 * t; e++)
          if (e < t) l.push(a[e]);
          else {
            const n = Math.floor(e / t);
            l.push(a[e - 6 * n] + 4 * n);
          }
        const c = [],
          h = [],
          u = r.clone();
        c.push(...this.getArrFromBuffer(r.attributes.position)),
          h.push(...this.getArrFromBuffer(r.attributes.uv)),
          r.rotateY(Math.PI / 2),
          c.push(...this.getArrFromBuffer(r.attributes.position)),
          h.push(...this.getArrFromBuffer(r.attributes.uv)),
          u.rotateX(Math.PI / 2),
          c.push(...this.getArrFromBuffer(u.attributes.position)),
          h.push(...this.getArrFromBuffer(u.attributes.uv)),
          o.setAttribute("position", new THRDev3.Float32BufferAttribute(c, 3)),
          o.setAttribute("uv", new THRDev3.Float32BufferAttribute(h, 2)),
          o.setIndex(new THRDev3.Uint16BufferAttribute(l, 1));
        const d = new THRDev3.Matrix4();
        d.identity();
        const p = new THRDev3.Euler(i.x, i.y, i.z, "XYZ");
        return (
          d.makeRotationFromEuler(p),
          o.applyMatrix4(d),
          o.translate((0.5 - n.x) * e, (0.5 - n.y) * s, 0),
          o
        );
      }
      getTriggerKey(e) {
        const t = e.faceIndex,
          n = Math.floor(t / 6);
        return Object.keys(this.useConfObj).find(
          (e) => this.useConfObj[e].useIdx === n
        );
      }
      handleHover() {}
      setConfig(e, t) {
        if (!t) return;
        const n = {};
        let i = !1;
        Object.keys(t).forEach((e) => {
          switch (e) {
            case "color":
            case "isCompEvents":
            case "hover":
            case "center":
            case "parentSize":
            case "scaleVal":
            case "rotation":
            case "offsetPosition":
            case "width":
            case "height":
            case "showName":
              (n[e] = t[e]), (i = !0);
          }
        }),
          i && super.setConfig(e, n);
      }
    };
    class wo {
      constructor(e = {}) {
        (this.comCvs = document.createElement("canvas")),
          (this.comCtx = this.comCvs.getContext("2d")),
          this.setConfigToDefault(),
          this.setConfig(e),
          (this.useConfig = this.config);
      }
      setConfigToDefault() {
        this.config = {
          omitStr: "...",
          textPadding: [0, 0, 0, 0],
          rowDefault: {
            align: "left",
            paddingLeft: 0,
            paddingRight: 0,
            paddingTop: 0,
            paddingBottom: 0,
            lineHeight: 1.2,
            overflow: "omit",
          },
          textDefault: {
            color: ["#ffffff"],
            fontSize: 54,
            fontWeight: "normal",
            fontFamily: "Arial",
            fontStyle: "normal",
            shadow: !1,
            shadowBlur: 5,
            shadowColor: "#000",
            field: "",
            text: "",
            width: null,
            overflow: "omit",
            paddingLeft: 0,
            paddingRight: 0,
            align: "left",
            rectRound: 0,
            bgType: 0,
            backgroundColor: null,
            circleOffsetY: 10,
            radius: 60,
          },
          texts: [],
        };
      }
      getTextTxue(e, t) {
        if (!this.config.texts || !this.config.texts.length) return null;
        this.setUseConf(e, t);
        const n = this.getDrawInfo(e);
        let i = document.createElementNS(
          "http://www.w3.org/1999/xhtml",
          "canvas"
        );
        const o = this.setCanvas(i, n),
          s = new THRDev3.Texture(i);
        return (s.needsUpdate = !0), (s._scale = o), (i = null), s;
      }
      getDrawInfo(e) {
        const t = this.useConfig.texts,
          n = this.getTotalWidth(e),
          i = { confRows: [], width: n, height: 0 };
        return (
          t.forEach((t) => {
            const o = {
              type: "configRow",
              maxHeight: 0,
              maxFontSize: 0,
              contentWidth:
                n -
                t.paddingLeft -
                t.paddingRight -
                this.useConfig.textPadding[3] -
                this.useConfig.textPadding[1],
              ...t,
              children: [],
            };
            t.children &&
              t.children.length &&
              (o.contentWidth <= 0
                ? console.warn("行边距超过行宽度, 跳过文字绘制")
                : (this.setLogicalRow(e, t, o), i.confRows.push(o)));
          }),
          this.additionPos(i),
          this.handleRowAlign(i),
          i
        );
      }
      setLogicalRow(e, t, n) {
        let i = 0,
          o = [];
        for (let s = 0; s < t.children.length; s++) {
          const r = t.children[s];
          if (n.contentWidth <= r.paddingLeft) {
            console.warn("文字边距超过行内容宽度, 跳过文字绘制");
            continue;
          }
          (n.maxFontSize = Math.max(n.maxFontSize, r.fontSize)),
            (n.maxHeight = Math.max(n.maxHeight, r.fontSize * t.lineHeight)),
            (i += r.paddingLeft);
          const a = this.useConfig.width && "omit" === t.overflow,
            l = this.measureText(r, this.useConfig.omitStr),
            c = this.getText(r, e),
            h = n.contentWidth - i,
            u = this.measureText(r, c);
          if (u > h) {
            if (a && i >= n.contentWidth - l) {
              o.push(
                this.getBaseTextConf(
                  this.useConfig.omitStr,
                  { ...r, align: "left" },
                  i,
                  l
                )
              );
              break;
            }
            i >= n.contentWidth - 0.8 * r.fontSize &&
              ((i = r.paddingLeft), n.children.push(o), (o = []));
          }
          const d = r.width && "omit" === r.overflow,
            p = a && !r.width,
            f =
              a && r.width && "omit" !== r.overflow && Math.min(u, r.width) > h;
          if (p || d || f) {
            let e = h;
            r.width && a
              ? (e = Math.min(e, r.width))
              : r.width && (e = r.width);
            const t = this.getOmitStr(r, c, e);
            let n;
            if (
              ((n =
                t.hasOmit && a && r.width
                  ? this.getBaseTextConf(
                      t.text,
                      { ...r, align: "left" },
                      i,
                      t.width
                    )
                  : this.getBaseTextConf(t.text, r, i, t.width)),
              o.push(n),
              r.width ? (i += r.width) : (i += t.width),
              (i += r.paddingRight),
              a && t.hasOmit && e === h)
            )
              break;
          } else if (r.width) {
            const e = this.divideText(r, c, r.width).map((e) =>
              this.getBaseTextConf(e.text, r, i)
            );
            (i += r.width),
              (i += r.paddingRight),
              o.push({ type: "wrapText", children: e });
          } else if (i + u < n.contentWidth)
            o.push(this.getBaseTextConf(c, r, i, u)),
              (i += u),
              (i += r.paddingRight);
          else {
            this.comCtx.font = this.getCvsFont(r);
            const e = n.contentWidth - i,
              t = [...c],
              s = this.getTextFromWidth(t, e, 0);
            o.push(this.getBaseTextConf(s.text, r, i, s.width));
            const a = c.substr(s.seq);
            if (!a) {
              (i += e), (i += r.paddingRight);
              continue;
            }
            this.divideText(r, a, n.contentWidth).forEach((e) => {
              (i = 0),
                n.children.push(o),
                (o = []),
                o.push(this.getBaseTextConf(e.text, r, i, e.width)),
                (i += e.width);
            }),
              (i += r.paddingRight);
          }
        }
        n.children.push(o);
      }
      setUseConf(e, t) {
        t && Object.keys(t).length
          ? ((this.useConfig = G.extend(!0, {}, this.config, t)),
            this.assginColor(this.useConfig.texts, t.texts))
          : (this.useConfig = this.config);
      }
      setConfig(e) {
        e.common && G.copy(this.config, e.common),
          e.rowDefault && G.copy(this.config.rowDefault, e.rowDefault),
          e.textDefault && G.copy(this.config.textDefault, e.textDefault),
          this.config.texts || (this.config.texts = []),
          e.texts &&
            e.texts.length &&
            e.texts.forEach((e, t) => {
              const n = this.config.texts[t] && this.config.texts[t].children;
              (this.config.texts[t] = {
                ...this.config.rowDefault,
                ...this.config.texts[t],
                ...e,
              }),
                this.config.texts[t].children &&
                  (this.config.texts[t].children = this.config.texts[
                    t
                  ].children.map((e, t) => {
                    const i = n && n[t],
                      o = { ...this.config.textDefault, ...i, ...e };
                    return (
                      e && e.color
                        ? (o.color = [...e.color])
                        : n[t] && n[t].color
                        ? (o.color = [...n[t].color])
                        : (o.color = [...this.config.textDefault.color]),
                      o
                    );
                  }));
            });
      }
      getTotalWidth(e) {
        const { width: t = 0, textPadding: n = [] } = this.useConfig;
        if (t) return t;
        const i = this.useConfig.texts;
        let o = 0;
        return (
          i.forEach((t) => {
            let n = 0;
            (n += t.paddingLeft + t.paddingRight),
              t.children &&
                (t.children.forEach((t) => {
                  n += this.getTextWidth(t, e);
                }),
                (o = Math.max(o, n)));
          }),
          (o += (n[1] || 0) + (n[3] || 0)),
          t || o
        );
      }
      getTextWidth(e, t) {
        const { paddingLeft: n, paddingRight: i } = e;
        if (e.width) return n + e.width + i;
        const o = this.getText(e, t);
        return n + this.measureText(e, o) + i;
      }
      measureText(e, t) {
        const n = this.getCvsFont(e);
        this.comCtx.font = n;
        return this.comCtx.measureText(t).width;
      }
      getText(e, t) {
        let { text: n } = e;
        return (
          e.field && void 0 !== t[e.field] && (n = t[e.field]), "" + n || ""
        );
      }
      getCvsFont(e) {
        const { fontStyle: t, fontWeight: n, fontSize: i, fontFamily: o } = e;
        return `${t} ${n} ${i}px ${o}`;
      }
      handleRowAlign(e) {
        e.confRows.forEach((e) => {
          if (!e.align || "left" === e.align) return;
          if (!e.children || !e.children.length) return;
          const t = e.children[e.children.length - 1];
          if (!t.length) return;
          let n = t[t.length - 1];
          n.children && n.children.length && ([n] = n.children);
          const i = n.tConf.width ? n.tConf.width : n.textWidth,
            o = e.contentWidth - n.startX - i - n.tConf.paddingRight;
          if (o < 0) return;
          let s = 0;
          switch (e.align) {
            case "right":
              s = o;
              break;
            case "center":
            default:
              s = o / 2;
          }
          t.forEach((e) => {
            e.children
              ? e.children.forEach((e) => {
                  e.x += s;
                })
              : (e.x += s);
          });
        });
      }
      getBaseTextConf(e, t, n, i) {
        const o = this.useConfig.width;
        if (t.width) {
          const i = {
            tConf: t,
            overTotalWidth: o && o < n + t.width,
            type: "text",
            text: e,
            startX: n - t.paddingLeft,
            realTextWidth: t.width,
            textAlign: t.align,
          };
          switch (t.align) {
            case "left":
              i.x = n;
              break;
            case "right":
              i.x = n + t.width;
              break;
            case "center":
            default:
              i.x = n + t.width / 2;
          }
          return i;
        }
        return {
          tConf: t,
          type: "text",
          text: e,
          textAlign: "left",
          x: n,
          startX: n - t.paddingLeft,
          textWidth: i,
          realTextWidth: i ? i + t.paddingLeft + t.paddingRight : t.width,
        };
      }
      getOmitStr(e, t, n) {
        const i = this.measureText(e, t);
        if (i <= n) return { width: i, hasOmit: !1, text: t };
        const o = this.measureText(e, this.useConfig.omitStr),
          s = n - o;
        if (s <= 0)
          return { width: o, hasOmit: !0, text: this.useConfig.omitStr };
        const r = this.getTextFromWidth([...t], s, 0);
        return (
          (r.text += this.useConfig.omitStr),
          (r.hasOmit = !0),
          (r.width += o),
          r
        );
      }
      additionPos(e) {
        let t = 0;
        const [n, , i, o] = this.useConfig.textPadding;
        t += n;
        const s = this.useConfig.height;
        e.confRows.forEach((e) => {
          t += e.paddingTop;
          const n = e.maxHeight;
          let i = 0;
          const r = e.maxHeight / 2 + e.maxFontSize / 2 - 0.15 * e.maxFontSize;
          e.children.forEach((a) => {
            let l = 0;
            a.forEach((a) => {
              a.children
                ? ((l = Math.max(l, a.children.length)),
                  a.children.forEach((a, l) => {
                    (a.startX += o + e.paddingLeft),
                      (a.x += o + e.paddingLeft),
                      (a.y = t + (i + l) * n + r),
                      (a.startY =
                        a.y -
                        0.9 * a.tConf.fontSize * (e.lineHeight / 2 + 0.5)),
                      (a.realTextHeight = a.tConf.fontSize * e.lineHeight),
                      (a.overTotalHeight = s && t > s);
                  }))
                : ((l = Math.max(l, 1)),
                  (a.startX += o + e.paddingLeft),
                  (a.x += o + e.paddingLeft),
                  (a.y = t + n * i + r),
                  (a.startY =
                    a.y - 0.9 * a.tConf.fontSize * (e.lineHeight / 2 + 0.5)),
                  (a.realTextHeight = a.tConf.fontSize * e.lineHeight),
                  (a.overTotalHeight = s && t > s));
            }),
              (i += l);
          }),
            (t += n * i + e.paddingBottom);
        }),
          this.useConfig.height
            ? (e.height = this.useConfig.height)
            : (e.height = t + i);
      }
      divideText(e, t, n) {
        this.comCtx.font = this.getCvsFont(e);
        const i = this.comCtx.measureText(t).width,
          o = t.length,
          s = [];
        if (i <= n || o <= 1) s.push({ text: t, width: i });
        else {
          this.comCtx.font = this.getCvsFont(e);
          const i = [...t];
          let r = 0;
          do {
            const e = this.getTextFromWidth(i, n, r);
            (r = e.seq), s.push({ text: e.text, width: e.width });
          } while (r < o);
        }
        return s;
      }
      getTextFromWidth(e, t, n) {
        let i,
          o = n,
          s = "",
          r = 0,
          a = 0;
        for (;;) {
          if (((i = s), (r = a), !e[o])) break;
          if (((s += e[o]), (a = this.comCtx.measureText(s).width), a > t)) {
            o === n && ((i = s), (r = a), o++);
            break;
          }
          o++;
        }
        return { text: i, width: r, seq: o };
      }
      setCanvas(e, t) {
        const { width: n, height: i } = t,
          o = { x: n, y: i, z: 1 };
        (e.width = o.x), (e.height = o.y);
        const s = e.getContext("2d");
        return s.clearRect(0, 0, o.x, o.y), this.fillTexts(s, t), o;
      }
      setShadow(e, t) {
        const { shadow: n, shadowBlur: i, shadowColor: o } = t.tConf;
        n
          ? ((e.shadowOffsetX = 0),
            (e.shadowOffsetY = 0),
            (e.shadowBlur = i),
            (e.shadowColor = o))
          : (e.shadowBlur = 0);
      }
      fillTexts(e, t) {
        t &&
          t.confRows &&
          t.confRows.length &&
          t.confRows.forEach((t) => {
            t.children.forEach((t) => {
              t.forEach((t) => {
                t.children
                  ? t.children.forEach((t) => {
                      this.fillSingleText(e, t);
                    })
                  : this.fillSingleText(e, t);
              });
            });
          });
      }
      fillSingleText(e, t) {
        if (t.overTotalHeight) return;
        t.tConf.bgType &&
          t.tConf.backgroundColor &&
          (1 === t.tConf.bgType
            ? ((e.fillStyle = t.tConf.backgroundColor),
              (e.strokeStyle = "transparent"),
              (e.lineWidth = 0.01),
              this.drawArcRect(
                {
                  x: t.startX,
                  y: t.startY,
                  offsetY: t.tConf.circleOffsetY,
                  radius: t.tConf.radius,
                  width: t.realTextWidth,
                  height: t.realTextHeight,
                },
                t.tConf.rectRound,
                e
              ))
            : ((e.fillStyle = t.tConf.backgroundColor),
              (e.strokeStyle = "transparent"),
              (e.lineWidth = 0.01),
              this.drawRoundedRect(
                {
                  x: t.startX,
                  y: t.startY,
                  width: t.realTextWidth,
                  height: t.realTextHeight,
                },
                t.tConf.rectRound,
                e
              )));
        const n = this.linearGradient(e, t);
        (e.font = this.getCvsFont(t.tConf)),
          (e.textAlign = t.textAlign),
          (e.fillStyle = n),
          this.setShadow(e, t),
          e.fillText(t.text, t.x, t.y);
      }
      drawArcRect(e, t, n) {
        const i = { x: e.x - e.radius, y: e.y + e.height / 2 + e.offsetY },
          o = -Math.asin((e.height / 2 + e.offsetY) / e.radius),
          s = Math.asin((e.height / 2 - e.offsetY) / e.radius),
          r = {
            x: i.x + Math.sqrt(e.radius ** 2 - (e.height / 2 + e.offsetY) ** 2),
            y: e.y,
          },
          a = {
            x: i.x + Math.sqrt(e.radius ** 2 - (e.height / 2 - e.offsetY) ** 2),
            y: e.y + e.height,
          },
          l = { x: e.x + e.width, y: e.y },
          c = { x: e.x + e.width, y: e.y + e.height };
        n.beginPath(),
          n.moveTo(r.x, r.y),
          n.arcTo(l.x, l.y, c.x, c.y, t),
          n.arcTo(c.x, c.y, a.x, a.y, t),
          n.arc(i.x, i.y, e.radius, s, o, !0),
          n.closePath(),
          n.fill(),
          n.stroke();
      }
      drawRoundedRect(e, t, n) {
        let i = t,
          o = t,
          s = t,
          r = t;
        G.isArray(t) && ([i, o, s, r] = t);
        const a = { x: e.x + i, y: e.y },
          l = { x: e.x + e.width, y: e.y },
          c = { x: e.x + e.width, y: e.y + e.height },
          h = { x: e.x, y: e.y + e.height },
          u = { x: e.x, y: e.y };
        n.beginPath(),
          n.moveTo(a.x, a.y),
          n.arcTo(l.x, l.y, c.x, c.y, o),
          n.arcTo(c.x, c.y, h.x, h.y, s),
          n.arcTo(h.x, h.y, u.x, u.y, r),
          n.arcTo(u.x, u.y, a.x, a.y, i),
          n.closePath(),
          n.fill(),
          n.stroke();
      }
      linearGradient(e, t) {
        const { color: n } = t.tConf;
        if (!G.isArray(n)) return n;
        const i = n.length - 1;
        if (i <= 0) return n[0] || "#fff";
        const { x: o, y: s } = t,
          { fontSize: r } = t.tConf,
          a = e.createLinearGradient(o, s - r, o, s);
        for (let e = 0; e <= i; e++) a.addColorStop(e / i, n[e]);
        return a;
      }
      powerOfTwo(e) {
        return Math.max(1, THRDev3.MathUtils.ceilPowerOfTwo(e));
      }
      assginColor(e, t) {
        t &&
          t.length &&
          t.forEach((t, n) => {
            t.children &&
              t.children.length &&
              t.children.forEach((t, i) => {
                t && t.color && (e[n].children[i].color = t.color);
              });
          });
      }
      dispose() {
        (this.comCvs = null),
          (this.comCtx = null),
          (this.config = null),
          (this.useConfig = null);
      }
    }
    function Co(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n        uniform float uScaleVal;\n        uniform float uNoiseVal;\n        uniform vec3 uCameraPos;\n        uniform vec3 uTargetPos;\n        uniform float uTime;\n        uniform float uRotation;\n        varying vec2 vUv;\n        ${
        Qn[n] ? Qn[n].vDefine : ""
      }\n        mat2 getMat2(float rad) {\n            float c = cos(rad), s = sin(rad);\n            return mat2(c, -s, s, c);\n        }\n        float getVectorAngle(vec2 v1, vec2 v2) {\n            vec3 nV1 = normalize(vec3(v1.xy, 0.0));\n            vec3 nV2 = normalize(vec3(v2.xy, 0.0));\n            // 方向相同, 返回0.0\n            if (distance(nV1, nV2) < 0.001) {\n                return 0.0;\n            }\n            vec3 crossV = cross(nV1, nV2);\n            float dotVal = dot(nV1, nV2);\n            float rad = acos(dotVal);\n            if (crossV.z > 0.0) {\n                rad = 6.2831853072 - rad;\n            }\n            return rad;\n        }\n        vec3 getHorTowardPos(vec3 curPos, vec3 center, vec3 cameraPos, vec3 targetPos, vec3 norm) {\n            vec3 retPos = curPos;\n            retPos = retPos - center;\n            vec2 cDirect = cameraPos.xz - targetPos.xz;\n\n            float dotVal = dot(cameraPos.xz - center.xz, cDirect.xy);\n            float rad;\n            // if (dotVal >= 0.) {\n                rad = getVectorAngle(cDirect.xy, norm.xz);\n            // } else {\n            //     rad = getVectorAngle(-cDirect.xy, norm.xz);\n            // }\n            vec2 posXZ = retPos.xz * getMat2(rad);\n            retPos = vec3(posXZ.x, retPos.y, posXZ.y);\n            retPos += center;\n            return retPos;\n        }\n    `;
    }
    function To(e, t) {
      const { aniType: n, direction: i } = e.getCurConfig(
          ["aniType", "direction"],
          t
        ),
        o = Qn[n] ? Qn[n].vMain : "";
      let s = "";
      switch (i) {
        case 1:
          s =
            "newPos = getHorTowardPos(newPos, center, uCameraPos, uTargetPos, normal);\n            gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));";
          break;
        case 2:
          s =
            "\n        vec4 spriteMvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n        vec2 scale;\n        vec2 spriteCenter = vec2(0.5);\n        scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n        scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n        vec2 alignedPosition = ( position.xy - ( spriteCenter - vec2( 0.5 ) ) ) * scale;\n\n        vec2 rotatedPosition;\n        rotatedPosition.x = cos( uRotation ) * alignedPosition.x - sin( uRotation ) * alignedPosition.y;\n        rotatedPosition.y = sin( uRotation ) * alignedPosition.x + cos( uRotation ) * alignedPosition.y;\n        spriteMvPosition.xy += rotatedPosition;\n\n        gl_Position = projectionMatrix * spriteMvPosition;\n\n        ";
          break;
        case 0:
        default:
          s =
            "gl_Position = projectionMatrix * (modelViewMatrix * vec4(newPos, 1.0));";
      }
      return `\n    vUv = uv;\n    vec3 center = vec3(0.0);\n    vec3 newPos = position;\n\n    ${o}\n    ${s}\n    `;
    }
    function _o(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t),
        i = Qn[n] ? Qn[n].fDefine : "",
        o = e.imgsNum;
      let s = "vec4 mergeColor = vec4(0.0);",
        r = "";
      if (o) {
        (r = `uniform drawRange uImgsRang[${o}];\n            uniform sampler2D uImgsMap[${o}];\n            uniform vec4 uImgsColor[${o}];`),
          (s += "vec4 imgColor = vec4(0.0);");
        for (let e = 0; e < o; e++)
          s += `imgColor = getMergeImageColor(vUv, uImgsRang[${e}].x, uImgsRang[${e}].y, uImgsMap[${e}]);\n            imgColor = imgColor * uImgsColor[${e}];\n            mergeColor = colorMix(imgColor, mergeColor);`;
      }
      return (
        e.config.texts && e.config.texts.length
          ? (s +=
              "vec4 textColor = texture2D(uTextMap, vUv);\n            textColor = uWholeTextColor * textColor;\n            return colorMix(textColor, mergeColor);")
          : (s += "return mergeColor;"),
        `\n    uniform float uColorType;\n    uniform vec4 uColor;\n    uniform sampler2D uTextMap;\n    uniform vec4 uWholeTextColor;\n    uniform bool uHasImg;\n    struct drawRange{\n        float x[2];\n        float y[2];\n    };\n\n    ${r}\n    varying vec2 vUv;\n    ${i}\n    ${Ee.colorMix()}\n    vec4 getMergeImageColor(vec2 realUv, float rangeX[2], float rangeY[2], sampler2D map) {\n        float op = step(rangeX[0], realUv.x) * (1.0 - step(rangeX[1], realUv.x));\n        op *= step(rangeY[0], realUv.y) * (1.0 - step(rangeY[1], realUv.y));\n\n        vec2 aUv = realUv;\n        aUv.y = (aUv.y - rangeY[0]) / (rangeY[1] - rangeY[0]);\n        aUv.x = (aUv.x - rangeX[0]) / (rangeX[1] - rangeX[0]);\n        vec4 color = texture2D(map, aUv);\n        return vec4(color.xyz, color.w * op);\n    }\n    vec4 getShaderColor() {\n        ${s}\n    }\n     vec3 rgb2hsl(vec3 rgb) {\n        vec3 hsl = vec3(0.0);\n\n        float r = rgb.x, g = rgb.y, b = rgb.z;\n        float cma = max(max(r, g), b);\n        float cmi = min(min(r, g), b);\n        float dlt = cma - cmi;\n\n        float k = g < b ? 6.0 : 0.0;\n        float k1 = cma == r ? g - b : (cma == g ? b - r : r - g);\n        float k2 = cma == r ? k : (cma == g ? 2.0 : 4.0);\n\n        float cL = (cma + cmi) * .5;\n        hsl.x = dlt > 0. ? (k1 / dlt + k2) / 6. : 0.;\n        hsl.y = dlt > 0. ? dlt / (2. * (cL <= .5 ? cL : 1. - cL)) : 0.;\n        hsl.z = cL;\n\n        return hsl;\n    }\n    float hue2rgb(float f1, float f2, float hue) {\n        if (hue < 0.0) hue += 1.0;\n        else if (hue > 1.0) hue -= 1.0;\n\n        float res = f1;\n        if ((6.0 * hue) < 1.0) res = f1 + (f2 - f1) * 6.0 * hue;\n        else if ((2.0 * hue) < 1.0) res = f2;\n        else if ((3.0 * hue) < 2.0) res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;\n\n        return res;\n    }\n    vec3 hsl2rgb(vec3 hsl) {\n        vec3 rgb;\n\n        float h = hsl.x, s = hsl.y, l = hsl.z;\n        if (s == 0.0) {\n            rgb = vec3(l); // Luminance\n        } else {\n            float f2 = l < 0.5 ? l * (1.0 + s) : l + s - s * l;\n            float f1 = 2.0 * l - f2;\n\n            rgb.r = hue2rgb(f1, f2, h + (1.0 / 3.0));\n            rgb.g = hue2rgb(f1, f2, h);\n            rgb.b = hue2rgb(f1, f2, h - (1.0 / 3.0));\n        }\n        return rgb;\n    }\n    vec4 hslMix(vec4 mC4, vec4 mT4) {\n        vec3 cHSL = rgb2hsl(mC4.rgb);\n        vec3 mHSL = rgb2hsl(mT4.rgb);\n        float comby = cHSL.x > 0. ? mHSL.y : cHSL.y;\n\n        // hsl to rgb\n        // float cmOpt = mC4.w + (1. - mC4.w) * mT4.w;\n        return vec4(hsl2rgb(vec3(cHSL.x, comby, mHSL.z)), mT4.w * mC4.w);\n    }\n    vec4 getBlendingColor(vec4 mC4) {\n        vec4 retColor;\n        if (uHasImg) {\n            vec4 _shaderColor = getShaderColor();\n            if (uColorType < 1.5) {\n                retColor = hslMix(mC4, _shaderColor);\n            } else {\n                retColor  = _shaderColor;\n            }\n        } else {\n            if (uColorType < 1.5) {\n                retColor = mC4;\n            } else {\n                retColor = vec4(1.0, 1.0, 1.0, 1.0);\n            }\n        }\n        return retColor;\n    }\n    `
      );
    }
    function Do(e, t) {
      const { aniType: n } = e.getCurConfig(["aniType"], t);
      return `\n    gl_FragColor = getBlendingColor(uColor);\n    //gl_FragColor = vec4(imgColor2.xyz * uColor.xyz, imgColor2.w * uColor.w);\n    ${
        Qn[n] ? Qn[n].fMain : ""
      }\n    `;
    }
    var Mo = class {
      constructor(e) {
        this.setConfigToDefault(),
          e && this.setConfig(e),
          (this.useConfig = this.config);
      }
      setConfigToDefault() {
        this.config = {
          bg: {
            paddingLeft: 0,
            paddingRight: 0,
            paddingTop: 0,
            paddingBottom: 0,
            color: "#ffffff",
            url: "",
            hover: {},
          },
          defaultImg: {
            align: "left",
            vAlign: "middle",
            paddingLeft: 0,
            paddingRight: 0,
            paddingTop: 0,
            paddingBottom: 0,
            width: 10,
            height: 10,
            color: "#ffffff",
            field: "",
            url: "",
            hover: {},
          },
          imgs: [],
        };
      }
      getDefaultSize(e) {
        if (
          (e || (e = { totalWidth: 0, totalHeight: 0, z: 1 }),
          !this.useConfig.imgs || !this.useConfig.imgs.length)
        )
          return e;
        const t = this.useConfig.imgs[0];
        return (
          e.totalWidth ||
            (e.totalWidth = t.paddingLeft + t.width + t.paddingRight),
          e.totalHeight ||
            (e.totalHeight = t.paddingTop + t.height + t.paddingBottom),
          e
        );
      }
      setConfig(e) {
        e &&
          (e.bg && (this.config.bg = G.copy(this.config.bg, e.bg)),
          e.defaultImg &&
            (this.config.defaultImg = G.extend(
              !0,
              {},
              this.config.defaultImg,
              e.defaultImg
            )),
          e.imgs &&
            e.imgs.length &&
            ((this.config.imgs.length = e.imgs.length),
            e.imgs.forEach((e, t) => {
              this.config.imgs[t] = G.extend(
                !0,
                {},
                this.config.defaultImg,
                this.config.imgs[t] || {},
                e
              );
            })));
      }
      getImgUrl(e, t) {
        let n = "";
        return (n = e && t.field && e[t.field] ? e[t.field] : t.url), n || "";
      }
      getBgRange(e) {
        const { totalWidth: t, totalHeight: n } = e,
          {
            paddingLeft: i,
            paddingRight: o,
            paddingTop: s,
            paddingBottom: r,
          } = this.useConfig.bg;
        return { x: [i / t, (t - o) / t], y: [(n - (n - r)) / n, (n - s) / n] };
      }
      getImgNum() {
        let e = 0;
        return (
          this.useConfig.bg && this.useConfig.bg.url && (e = 1),
          this.useConfig.imgs &&
            this.useConfig.imgs.length &&
            (e += this.useConfig.imgs.length),
          e
        );
      }
      setUseConf(e, t) {
        t && Object.keys(t).length
          ? (this.useConfig = G.extend(!0, {}, this.config, t))
          : (this.useConfig = this.config);
      }
      getImgsInfor(e, t, n) {
        this.setUseConf(e, n);
        const i = this.useConfig.imgs,
          o = {
            urls: [],
            ranges: [],
            colors: [],
            hoverUrls: [],
            hoverColors: [],
          };
        if (
          ((t && t.totalWidth && t.totalHeight) ||
            ((t = this.getDefaultSize(t)),
            (o.size = { x: t.totalWidth, y: t.totalHeight, z: 1 })),
          this.useConfig.bg && this.useConfig.bg.url)
        ) {
          const e = this.getBgRange(t);
          o.urls.push(this.useConfig.bg.url),
            o.ranges.push(e),
            o.colors.push(Kn(this.useConfig.bg.color));
          const n = this.useConfig.bg.hover && this.useConfig.bg.hover.color;
          o.hoverColors.push(n ? Kn(n) : void 0),
            o.hoverUrls.push(this.useConfig.bg.hover.url);
        }
        return (
          i.forEach((n) => {
            const i = this.getImgUrl(e, n);
            o.urls.push(i),
              o.ranges.push(this.getImgRange(n, t)),
              o.colors.push(Kn(n.color));
            const s = n.hover && n.hover.color;
            o.hoverColors.push(s ? Kn(s) : void 0),
              o.hoverUrls.push(this.getImgUrl(e, n.hover));
          }),
          o
        );
      }
      getImgRange(e, t) {
        const { totalWidth: n, totalHeight: i } = t,
          {
            paddingLeft: o,
            paddingRight: s,
            paddingTop: r,
            paddingBottom: a,
            width: l,
            height: c,
          } = e;
        let h = 0;
        switch (e.align) {
          case "center":
            h = n / 2 - (o + l + s) / 2 + o;
            break;
          case "right":
            h = n - s - l;
            break;
          case "left":
          default:
            h = o;
        }
        const u = h + l;
        let d = 0;
        switch (e.vAlign) {
          case "top":
            d = r;
            break;
          case "bottom":
            d = i - a - c;
            break;
          case "middle":
          default:
            d = i / 2 - (r + c + a) / 2 + r;
        }
        return { x: [h / n, u / n], y: [(i - (d + c)) / i, (i - d) / i] };
      }
      dispose() {
        (this.config = null), (this.useConfig = null);
      }
    };
    var So = class extends Hi {
      constructor(e, t) {
        super(e, t),
          (this.mulTextIns = new wo({
            common: {
              textPadding: this.config.textPadding,
              width: this.config.width,
              height: this.config.height,
            },
            texts: this.config.texts,
          })),
          (this.imgIns = new Mo({
            imgs: this.config.imgs,
            bg: this.config.bg,
          })),
          (this.imgsNum = this.imgIns.getImgNum()),
          (this.eventArr = []),
          (this.cPosVector = new THRDev3.Vector3(0, 0, 0)),
          (this.tPosVector = new THRDev3.Vector3(0, 0, 0));
      }
      getDefaultOpt() {
        return (
          (e = super.getDefaultOpt()),
          {
            ...e,
            width: null,
            height: null,
            scale: { x: 0.1, y: 0.1 },
            center: { x: 0.5, y: 0.5 },
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            scaleVal: 1,
            colorType: 2,
            texts: [],
            textPadding: [0, 0, 0, 0],
            wholeTextColor: "#ffffff",
            imgs: [],
            bg: {},
          }
        );
        var e;
      }
      dispose() {
        super.dispose(),
          this.mulTextIns.dispose(),
          (this.mulTextIns = null),
          this.imgIns.dispose(),
          (this.imgIms = null),
          (this.eventArr = []),
          (this.cPosVector = null),
          (this.tPosVector = null);
      }
      getShaderDefine() {
        return x;
      }
      createSingle(e, t) {
        const { data: n, noise: i } = t,
          o = n.pos;
        let s;
        n.exConfig &&
          n.exConfig[this.config.name] &&
          (s = n.exConfig[this.config.name]);
        const r = this.getMtl(n, i, s),
          a = new THRDev3.Mesh(this.geo, r);
        this.setBeforRender(a, s),
          (a.userData._exConfig = { pos: G.copy({}, o) }),
          s && G.copy(a.userData._exConfig, s),
          (a.userData._data = n),
          (a.userData._type = this.config.type),
          (a.userData._compName = this.group.name),
          (a.userData._noise = i),
          this.config.isCompEvents && this.eventArr.push(a),
          (a.name = e),
          this.setSingleConfig("center", a),
          this.setSingleConfig("scaleVal", a),
          this.setSingleConfig("pos", a),
          this.group.add(a);
      }
      getMtl(e, t, n) {
        const {
            color: i,
            colorType: o,
            width: s,
            height: r,
          } = this.getCurConfig(
            ["colorType", "color", "width", "height", "direction"],
            n
          ),
          a = G.mtl.shader({
            uniforms: {
              uTime: { value: 0 },
              uRotation: { value: 0 },
              uHasImg: { value: !0 },
              uColorType: { value: o },
              uColor: { value: Kn(i) },
              uOpacity: { value: this.config.uOpacity },
              uNoise: { value: t },
              ...Yn(this.config.exUniform),
            },
            side: THRDev3.DoubleSide,
            vertexShader: this.getVertexShader(n),
            fragmentShader: this.getFragmentShader(n),
            ...this.config.mtlOpt,
          });
        let l = { x: s, y: r, z: 1 };
        a.userData._hover = {};
        const c = this.handleText(a, e, n);
        c && c.size && (l = c.size);
        const h = this.handleMtlImg(a, e, l, n);
        (l.x && l.y) || (l = h && h.size),
          (a.userData._scale = { ...l }),
          G.shaderMtlAddFog(a, this.renderer.scene);
        const { scaleVal: u } = this.getCurConfig(["scaleVal"], n);
        return (
          (a.uniforms.uScaleVal = { value: u }),
          (a.uniforms.uNoiseVal = { value: t }),
          (a.uniforms.uCameraPos = { value: this.cPosVector }),
          (a.uniforms.uTargetPos = { value: this.tPosVector }),
          (a.uniforms.uAniTimes = { value: this.config.aniTimes }),
          (a.uniforms.uMoveY = { value: this.config.moveY }),
          a
        );
      }
      handleText(e, t, n) {
        if (!this.config.texts || !this.config.texts.length) return {};
        const { wholeTextColor: i, wholeTextHover: o } = this.getCurConfig(
            ["wholeTextColor", "wholeTextHover"],
            n
          ),
          s = Kn(i);
        let r = null;
        n &&
          ((r = {}),
          G.initParams(r, n, ["textPadding", "width", "height", "texts"]));
        const a = this.mulTextIns.getTextTxue(t, r);
        (e.uniforms.uTextMap = { value: a }),
          (e.uniforms.uWholeTextColor = { value: s });
        const l = a._scale;
        return (
          (e.userData._hover.wholeTextColor = s),
          (e.userData._hover.wholeTextHover = Kn(o)),
          { size: l }
        );
      }
      handleMtlImg(e, t, n, i) {
        const o = { size: null };
        if (this.config.bg || (this.config.imgs && this.config.imgs.length)) {
          let s = null;
          i && ((s = {}), G.initParams(s, i, ["bg", "imgs"]));
          const r = this.imgIns.getImgsInfor(
              t,
              { totalWidth: n && n.x, totalHeight: n && n.y },
              s
            ),
            a = r.urls.map((e) => this.getTxue(e));
          (e.uniforms.uImgsMap = { value: [...a] }),
            (e.uniforms.uImgsRang = { value: [...r.ranges] }),
            (e.uniforms.uImgsColor = { value: [...r.colors] }),
            (e.userData._hover.imgsInfor = r),
            r.size && (o.size = r.size);
        }
        return o;
      }
      setBeforRender(e, t) {
        const { direction: n } = this.getCurConfig(["direction"], t);
        if (1 !== n) return;
        const i = this;
        e.onBeforeRender = function (e, t, n) {
          const o = n.position;
          (this.material.uniforms.uTargetPos.value = i.tPosVector.copy(
            i.renderer.controls.target
          )),
            (this.material.uniforms.uCameraPos.value = i.cPosVector.copy(o));
        };
      }
      handleHover(e, t) {
        const n = this.group.getObjectByName(e);
        if (!n) return void this.errorNotice("移入移出传入的uid有问题");
        const i = n.material.userData._hover;
        if (i) {
          if (i.wholeTextHover) {
            const e = t ? i.wholeTextHover : i.wholeTextColor;
            n.material.uniforms.uWholeTextColor.value = e;
          }
          i.imgsInfor &&
            (i.imgsInfor.hoverColors.forEach((e, o) => {
              if (!e) return;
              const s = t ? e : i.imgsInfor.colors[o];
              n.material.uniforms.uImgsColor.value[o] = s;
            }),
            i.imgsInfor.hoverUrls.forEach((e, o) => {
              if (!e) return;
              const s = t ? e : i.imgsInfor.urls[o];
              n.material.uniforms.uImgsMap.value[o] = this.getTxue(s);
            }));
        }
      }
      setHeight(e, t) {
        const {
            parentSize: n,
            scaleVal: i,
            scale: o,
          } = this.getCurConfig(["parentSize", "scaleVal", "scale"], e),
          s = t.material.userData._scale,
          r = s.x * o.x,
          a = s.y * o.y;
        (t.scale.x = n * r * i),
          (t.scale.y = n * a * i),
          (t.scale.z = t.scale.x);
      }
      updateAllMeshProp(e) {
        this.group.children.forEach((t) => {
          this.setSingleConfig(e, t);
        });
      }
      updateInsConfig(e) {
        if (
          void 0 !== e.width ||
          void 0 !== e.height ||
          void 0 !== e.textPadding ||
          void 0 !== e.texts
        ) {
          const t = {
            common: {
              textPadding: this.config.textPadding,
              width: this.config.width,
              height: this.config.height,
            },
          };
          e.texts && (t.texts = this.config.texts),
            this.mulTextIns.setConfig(t);
        }
        (e.imgs || e.bg) &&
          this.imgIns.setConfig({ imgs: this.config.imgs, bg: this.config.bg });
      }
      updateConfig(e) {
        if ((super.updateConfig(e), e.texts)) {
          const { texts: t } = e;
          (t || t.length) &&
            t.forEach((e, t) => {
              e.children &&
                e.children.length &&
                e.children.forEach((e, n) => {
                  e &&
                    e.color &&
                    (this.config.texts[t].children[n].color = e.color);
                });
            });
        }
        this.updateInsConfig(e);
      }
      setAllMtlsProp(e, t, n) {
        this.group.children.forEach((i) => {
          "uniform" === n
            ? (i.material.uniforms[e].value = t)
            : (i.material[e] = t);
        });
      }
      setSingleConfig(e, t) {
        const n = t.userData._exConfig;
        switch (e) {
          case "refreshMtl":
            {
              const e = t.userData._data,
                i = t.userData._noise,
                o = this.getMtl(e, i, n);
              t.material.dispose(), (t.material = o), this.setHeight(n, t);
            }
            return;
          case "wholeTextColor":
            {
              const { wholeTextColor: e } = this.getCurConfig(
                  ["wholeTextColor"],
                  n
                ),
                i = Kn(e);
              (t.material.userData._hover.wholeTextColor = i),
                this.isHover(t.name) ||
                  this.isChoice(t.name) ||
                  (t.material.uniforms.uWholeTextColor = { value: i });
            }
            return;
          case "wholeTextHover":
            {
              const { wholeTextHover: e } = this.getCurConfig(
                  ["wholeTextHover"],
                  n
                ),
                i = Kn(e);
              (t.material.userData._hover.wholeTextHover = i),
                (this.isHover(t.name) || this.isChoice(t.name)) &&
                  (t.material.uniforms.uWholeTextColor = { value: i });
            }
            return;
          case "width":
          case "height":
            this.setSingleConfig("refreshMtl", t);
            break;
          case "parentSize":
            return (
              this.setSingleConfig("scaleVal", t),
              void this.setSingleConfig("pos", t)
            );
          case "scaleVal":
          case "scale":
            return void this.setHeight(n, t);
          case "direction":
            return (
              (t.material.vertexShader = this.getVertexShader(n)),
              (t.material.fragmentShader = this.getFragmentShader(n)),
              this.setBeforRender(t, n),
              void (t.material.needsUpdate = !0)
            );
          case "imgs":
          case "bg":
            {
              const e = t.userData._data,
                i = t.material.userData._scale;
              this.handleMtlImg(t.material, e, i, n);
            }
            return;
          case "moveY":
            return void (t.material.uniforms.uMoveY.value = this.config.moveY);
          case "aniTimes":
            return void (t.material.uniforms.uAniTimes.value =
              this.config.aniTimes);
          case "uOpacity":
            {
              const { uOpacity: e } = this.getCurConfig(["uOpacity"], n);
              t.material.uniforms.uOpacity.value = e;
            }
            return;
          case "mtlOpt":
            {
              const { mtlOpt: e } = this.config;
              Object.keys(e).forEach((n) => {
                t.material[n] = e[n];
              });
            }
            return;
        }
        super.setSingleConfig(e, t);
      }
      setConfig(e, t) {
        this.updateConfig(t), this.setGroupOffset();
        let n = !1;
        const i = ["width", "height", "texts", "textPadding", "aniType"];
        i.find((e) => !!t[e] && ((n = !0), !0));
        const o = this.config.texts && this.config.texts.length,
          { imgs: s } = t;
        !o && s && s[0] && (s[0].width || s[0].height) && (n = !0),
          n &&
            (void 0 !== t.aniType && (this.uTime = 0),
            this.updateAllMeshProp("refreshMtl")),
          Object.keys(t).forEach((e) => {
            if (-1 === i.indexOf(e))
              switch (e) {
                case "wholeTextColor":
                case "wholeTextHover":
                case "scaleVal":
                case "scale":
                case "imgs":
                case "bg":
                  n || this.updateAllMeshProp(e);
                  break;
                case "direction":
                  n
                    ? this.group.children.forEach((e) => {
                        const t = e.userData._exConfig;
                        this.setBeforRender(e, t);
                      })
                    : this.updateAllMeshProp(e);
                  break;
                case "aniSpeed":
                case "globalAniSpeed":
                  this.uTime = 0;
                  break;
                case "aniTimes":
                  (this.uTime = 0), this.updateAllMeshProp(e);
                  break;
                case "offsetPosition":
                case "parentSize":
                case "color":
                case "highColor":
                case "imgUrl":
                case "colorType":
                case "uOpacity":
                case "mtlOpt":
                case "moveY":
                  this.updateAllMeshProp(e);
                  break;
                case "center":
                  this.readyGeo(), this.updateAllMeshProp(e);
                  break;
                case "showName":
                  break;
                default:
                  this.warnNotice("无法更新属性" + e);
              }
          });
      }
    };
    var Po = class extends Ri {
      constructor(e, t) {
        super(e, t), (this.eventArr = []);
      }
      init(e) {
        this.config.exUniform || (this.config.exUniform = {}), super.init(e);
      }
      getDefaultOpt() {
        return {
          ...super.getDefaultOpt(),
          shaderType: 9,
          rotation: { x: 0, y: 0, z: 0 },
        };
      }
      getTriggerKey(e) {
        const t = e.faceIndex,
          n = Math.floor(t / 2);
        return Object.keys(this.useConfObj).find(
          (e) => this.useConfObj[e].useIdx === n
        );
      }
    };
    var Ro = {
      NormalShader: Ri,
      Particle: po,
      VerImgAlone: zi,
      VerImgAlone2: Gi,
      Wave: fo,
      Cylinder: mo,
      EventComp: xo,
      MulText: So,
      MockSprite: Po,
      Sprite: class extends $n {
        constructor(e, t) {
          super(e, t),
            (this.eventArr = []),
            (this.uTime = 0),
            (this.posV3 = new THRDev3.Vector3()),
            (this.compUseObj = {}),
            (this.cacheMtl = {});
        }
        getDefaultOpt() {
          return {
            ...super.getDefaultOpt(),
            name: "",
            showName: void 0,
            isAnimate: !0,
            mtlOpt: { depthWrite: !0, transparent: !0, depthTest: !1 },
            color: "rgba(255, 255, 255, 1)",
            imgUrl: "",
            center: { x: 0.5, y: 0.5 },
            offsetPosition: { x: 0, y: 0, z: 0 },
            width: 1,
            height: 1,
            scaleVal: 1,
            parentSize: 1,
            uOpacity: 1,
          };
        }
        init(e) {
          (this.config.height =
            void 0 === this.config.height
              ? this.config.width
              : this.config.height),
            this.setGroupOffset(),
            this.create(e);
        }
        create(e) {
          Object.keys(e).length &&
            Object.keys(e).forEach((t) => {
              this.compUseObj[t] && this.compUseObj[t].hasCreate
                ? this.updateSingle(t, e[t])
                : (this.createSingle(t, e[t]),
                  (this.compUseObj[t] = { hasCreate: !0 }));
            });
        }
        updateSingle(e, t) {
          const { data: n } = t,
            { pos: i } = n,
            o = this.group.getObjectByName(e);
          let s = !1,
            r = !1,
            a = !1;
          if (n.exConfig) {
            const e = n.exConfig[this.config.name];
            if (e) {
              const t = G.copy({}, o.userData._exConfig);
              G.copy(o.userData._exConfig, e),
                Object.keys(e).forEach((n) => {
                  if (!G.isEqual(t[n], e[n]))
                    switch (n) {
                      case "offsetPosition":
                      case "pos":
                        r = !0;
                        break;
                      case "width":
                      case "height":
                      case "scaleVal":
                        s = !0;
                        break;
                      case "parentSize":
                        (s = !0), (r = !0);
                        break;
                      case "color":
                      case "highColor":
                        a = !0;
                        break;
                      case "imgUrl":
                      case "uOpacity":
                      default:
                        this.setSingleConfig(n, o);
                    }
                });
            }
          }
          const l = o.userData._exConfig.pos;
          if ((i && (G.isEqual(l, i) || (r = !0)), r)) {
            const e = G.copy(l, i);
            (o.userData._exConfig.pos = e), this.setSingleConfig("pos", o);
          }
          s && this.setSingleConfig("width", o),
            a && this.setSingleConfig("color", o),
            (o.material.needsUpdate = !0);
        }
        getMtlId(e, t) {
          return "object" == typeof e
            ? t +
                Math.floor(255 * e.x) +
                Math.floor(255 * e.y) +
                Math.floor(255 * e.z) +
                e.w.toFixed(2)
            : t + e;
        }
        getMtl(e, t) {
          const n = this.getMtlId(e, t);
          if (this.cacheMtl[n]) return this.cacheMtl[n];
          const i = this.getColor(e, "arr"),
            o = G.mtl.sprite({
              map: this.getTxue(t),
              color: new THRDev3.Color(i[0], i[1], i[2]),
              opacity: i[3],
              ...this.config.mtlOpt,
            });
          return (
            (o._preOpacity = i[3]),
            G.shaderMtlAddFog(o, this.renderer.scene),
            (this.cacheMtl[n] = o),
            o
          );
        }
        setAllMtlsProp(e, t) {
          Object.keys(this.cacheMtl).forEach((n) => {
            const i = this.cacheMtl[n];
            "uOpacity" === e ? (i.opacity = t * i._preOpacity) : (i[e] = t);
          });
        }
        createSingle(e, t) {
          const { data: n, noise: i } = t,
            o = n.pos;
          let s;
          n.exConfig &&
            n.exConfig[this.config.name] &&
            (s = n.exConfig[this.config.name]);
          const { imgUrl: r, color: a } = this.getCurConfig(
              ["imgUrl", "color"],
              s
            ),
            l = this.getMtl(a, r),
            c = new THRDev3.Sprite(l);
          this.setBeforRender(c),
            (c.userData._exConfig = { pos: G.copy({}, o) }),
            s && G.copy(c.userData._exConfig, s),
            (c.userData._type = this.config.type),
            (c.userData._compName = this.group.name),
            this.config.isCompEvents && this.eventArr.push(c),
            (c.name = e),
            this.setSingleConfig("center", c),
            this.setSingleConfig("width", c),
            this.setSingleConfig("pos", c),
            this.group.add(c);
        }
        setBeforRender() {}
        animate(e, t) {
          this.config.isAnimate || this.config.isAnimate;
        }
        getTriggerKey(e) {
          return e.object.name;
        }
        handleHover(e) {
          const t = this.group.getObjectByName(e);
          t
            ? this.setSingleConfig("highColor", t)
            : this.errorNotice("移入移出传入的uid有问题");
        }
        reloadData(e) {
          super.reloadData(), (this.compUseObj = {});
          const t = this.group.children;
          (this.eventArr = []),
            t.forEach((e) => {
              this.disposeSprite(e);
            }),
            (this.group.children = []),
            this.disposeCacheMtl(),
            this.create(e);
        }
        refresh(e) {
          e && this.create(e);
        }
        dels(e) {
          e && e.length
            ? e.forEach((e) => {
                this.disposeByName(e);
              })
            : this.disposeByName(e);
        }
        disposeByName(e) {
          let t = this.group.getObjectByName(e);
          delete this.compUseObj[e], this.group.remove(t);
          const n = this.eventArr.indexOf(t);
          -1 !== n && this.eventArr.splice(n, 1),
            this.disposeSprite(t),
            (t = null);
        }
        disposeSprite(e) {
          e && G.disposeObj(e);
        }
        disposeCacheMtl() {
          Object.keys(this.cacheMtl).forEach((e) => {
            this.cacheMtl[e].dispose();
          }),
            (this.cacheMtl = {});
        }
        dispose() {
          (this.compUseObj = null),
            this.disposeCacheMtl(),
            (this.posV3 = null),
            super.dispose();
        }
        setHeight(e, t) {
          const {
              parentSize: n,
              width: i,
              scaleVal: o,
              height: s,
            } = this.getCurConfig(
              ["parentSize", "height", "width", "scaleVal"],
              e
            ),
            r = n * i * o,
            a = n * s * o;
          (t.scale.x = r), (t.scale.y = a), (t.scale.z = r);
        }
        setSingleConfig(e, t) {
          if (!t || !t.userData) return;
          const n = t.userData._exConfig;
          switch (e) {
            case "width":
              (this.config.height =
                void 0 === this.config.height
                  ? this.config.width
                  : this.config.height),
                this.setSingleConfig("height", t);
              break;
            case "height":
            case "scaleVal":
              this.setHeight(n, t);
              break;
            case "parentSize":
              this.setSingleConfig("height", t), this.setSingleConfig("pos", t);
              break;
            case "pos":
            case "offsetPosition":
              {
                const { pos: e } = n,
                  { parentSize: i, offsetPosition: o } = this.getCurConfig(
                    ["parentSize", "offsetPosition"],
                    n
                  ),
                  s = { x: e.x + o.x * i, y: e.y + o.y * i, z: e.z + o.z * i };
                t.position.set(s.x, s.y, s.z);
              }
              break;
            case "uOpacity":
              {
                const { uOpacity: e } = this.getCurConfig(["uOpacity"], n);
                t.material.opacity = e * t.material._preOpacity;
              }
              break;
            case "refreshMtl":
            case "color":
            case "highColor":
            case "imgUrl":
              {
                const {
                  color: e,
                  highColor: i,
                  imgUrl: o,
                } = this.getCurConfig(["color", "highColor", "imgUrl"], n);
                let s = e;
                i && (this.isHover(t.name) || this.isChoice(t.name)) && (s = i);
                const r = this.getMtl(s, o);
                t.material = r;
              }
              break;
            case "center":
              const { center: e } = this.getCurConfig(["center"], n);
              t.center.set(e.x, e.y);
          }
        }
        updateConfig(e) {
          Object.keys(e).forEach((t) => {
            G.isObject(e[t]) || G.isArray(e[t])
              ? G.copy(this.config[t], e[t])
              : (this.config[t] = e[t]);
          });
        }
        setConfig(e, t) {
          super.setConfig(e, t),
            this.updateConfig(t),
            Object.keys(t).forEach((e) => {
              switch (e) {
                case "aniSpeed":
                case "globalAniSpeed":
                  this.uTime = 0;
                  break;
                case "offsetPosition":
                case "parentSize":
                case "color":
                case "highColor":
                case "width":
                case "height":
                case "imgUrl":
                case "scaleVal":
                case "uOpacity":
                  this.setAllMtlsProp("uOpacity", this.config.uOpacity);
                  break;
                case "mtlOpt":
                  const { mtlOpt: t } = this.config;
                  Object.keys(t).forEach((e) => {
                    this.setAllMtlsProp(e, t[e]);
                  });
                  break;
                case "center":
                  this.group.children.forEach((t) => {
                    this.setSingleConfig(e, t);
                  });
                  break;
                case "showName":
                  break;
                default:
                  this.warnNotice("无法更新属性" + e);
              }
            });
        }
      },
    };
    var Ao = class {
      constructor(e) {
        (this.config = {}),
          (this.config.uidKey = e.uidKey),
          (this.config.perBatchNum = e.perBatchNum),
          (this.config.largeMode = e.largeMode),
          (this.config.isShow = e.isShow),
          (this.config.size = e.size),
          (this.config.children = e.children),
          (this.config.eventComp = e.eventComp),
          (this.config.label = e.label),
          (this.renderer = e.renderer),
          (this.group = e.group),
          (this._triggerInnerEvent = e._triggerInnerEvent),
          (this.largeNoComps = e.largeNoComps),
          (this.beforeAdd = e.beforeAdd),
          (this.eventArrChange = e.eventArrChange),
          (this.setTestTween = e.setTestTween),
          (this.insChildren = []),
          (this.useDataObj = {}),
          (this.batchLoad = null),
          (this.eventArr = []);
      }
      init() {
        Ln.setGroupShow(this.group, this.config.isShow),
          (this.batchLoad = new zn()),
          this.create();
      }
      create() {
        this.config.label &&
          this.config.label.load &&
          this.addComp(this.config.label, !1, !0),
          this.config.eventComp &&
            this.config.eventComp.load &&
            this.addComp(this.config.eventComp, !1, !0);
        const e = this.config.children || [];
        e &&
          e.length &&
          e.forEach((e) => {
            this.addComp(e, !1, !0);
          });
      }
      choice(e, t) {
        return e && e.length
          ? (e.forEach((e) => {
              this.useDataObj[e] && (this.useDataObj[e].isChoice = t);
            }),
            this.insChildren.forEach((n) => {
              n.choice && n.choice(e, t);
            }),
            this.useDataObj[e[0]])
          : null;
      }
      hover(e, t) {
        (this.useDataObj[e].isHover = t),
          this.insChildren.forEach((n) => {
            n.hover && n.hover(e, t);
          });
      }
      getTriggerDataKey(e, t) {
        return this.insChildren
          .find((t) => t.group.name === e)
          .getTriggerKey(t);
      }
      reloadData(e, t) {
        (this.useDataObj = Ln.getUseDataObj(e, this.config.uidKey, 0)),
          t && t(this.useDataObj),
          this.batchLoad.load(
            this.useDataObj,
            this.insChildren,
            this.config.perBatchNum,
            () => {
              this.handleEventArr();
            }
          );
      }
      refresh(e, t = [], n) {
        const i = Ln.getUseDataObj(e, this.config.uidKey, t.length);
        Object.keys(i).forEach((e) => {
          this.useDataObj[e]
            ? ((this.useDataObj[e] = G.copy(this.useDataObj[e], i[e])),
              (i[e] = this.useDataObj[e]))
            : (this.useDataObj[e] = i[e]);
        }),
          n && n(i),
          this.insChildren.forEach((e) => {
            e.refresh && e.refresh(i, this.useDataObj);
          }),
          this.handleEventArr();
      }
      isLargeModeLoad(e) {
        const { largeMode: t } = this.config;
        return !t || -1 === this.largeNoComps.indexOf(e.type);
      }
      handleCompConf(e) {
        (e.uidKey = this.config.uidKey), (e.parentSize = this.config.size || 1);
      }
      updateSingleComp(e) {
        this.isLargeModeLoad(e) &&
          (e.name
            ? this.insChildren.forEach((t) => {
                if (t.config.name === e.name)
                  if (t.setConfig)
                    if (!e.type || Ro[e.type]) {
                      const n = Ln.getDiffConf(e, t);
                      n && t.setConfig(e.type, n);
                    } else t.setConfig(e.type, e);
                  else
                    this.errorNotice(
                      `子组件${t.config.name} 没有setConfig方法, 无法更新子组件配置`
                    );
              })
            : this.insChildren.forEach((t) => {
                t.setConfig
                  ? t.setConfig(e.type, e)
                  : this.errorNotice(
                      `子组件${t.config.name} 没有setConfig方法, 无法更新子组件配置`
                    );
              }));
      }
      removeComp(e) {
        this._triggerInnerEvent("beforeDelComp", e);
        let t = null;
        this.config.children.forEach((n, i) => {
          n.name === e && (t = i);
        }),
          null !== t && this.config.children.splice(t, 1);
        for (let t = this.insChildren.length - 1; t >= 0; t--) {
          let n = this.insChildren[t];
          n.config.name === e &&
            (this.insChildren.splice(t, 1),
            this.handleEventArr(),
            this.group.remove(n.group),
            n.dispose(),
            (n = null));
        }
        this._triggerInnerEvent("afterDelComp", e);
      }
      addComp(e, t, n) {
        if ((this._triggerInnerEvent("beforeAddComp", e), !Ro[e.type]))
          return this.errorNotice(`标注系统找不到组件 ${e.type}!`), !1;
        const i = this.config.children.find((t) => t.name === e.name);
        if (
          (t && !i && this.config.children.push(e),
          this.handleCompConf(e),
          !this.isLargeModeLoad(e))
        )
          return !1;
        this.beforeAdd &&
          (this.useDataObj =
            this.beforeAdd(e, this.useDataObj, n) || this.useDataObj);
        const o = new Ro[e.type](e, this);
        return (
          o.init(this.useDataObj),
          this.insChildren.push(o),
          this.handleEventArr(o, "add"),
          this._triggerInnerEvent("afterAddComp", e),
          !0
        );
      }
      removeAll() {
        this.config.children.forEach((e) => {
          this.removeComp(e.name);
        });
      }
      setLargeMode(e) {
        (this.config.largeMode = e),
          e
            ? (this.config.label &&
                this.config.label.load &&
                this.removeComp(this.config.label.name),
              this.config.eventComp &&
                this.config.eventComp.load &&
                this.removeComp(this.config.eventComp.name),
              this.config.children.forEach((e) => {
                this.isLargeModeLoad(e) || this.removeComp(e.name);
              }))
            : (this.config.label &&
                this.config.label.load &&
                this.addComp(this.config.label, !1, !1),
              this.config.eventComp &&
                this.config.eventComp.load &&
                this.addComp(this.config.eventComp, !1, !1),
              this.config.children.forEach((e) => {
                -1 !== this.largeNoComps.indexOf(e.type) &&
                  this.addComp(e, !1, !1);
              }));
      }
      labelConfig(e) {
        let t;
        return (
          this.insChildren.forEach((n) => {
            n.config.name === e.name &&
              (n.getConfig
                ? (t = n.getConfig(e.type, e))
                : this.errorNotice(
                    `子组件${n.config.name} 没有getConfig方法, 无法获取子组件配置`
                  ));
          }),
          t
        );
      }
      dels(e, t) {
        const n = [];
        if (e && e.length)
          e.forEach((e) => {
            this.useDataObj[e] && (delete this.useDataObj[e], n.push(e));
          });
        else {
          if (!this.useDataObj[e]) return !1;
          delete this.useDataObj[e], n.push(e);
        }
        return n.length
          ? (t && t(),
            this.insChildren.forEach((e) => {
              e.dels && e.dels(n, this.useDataObj);
            }),
            this.handleEventArr(),
            !0)
          : (this.config.uidKey, !1);
      }
      show(e, t, n, i) {
        this.updateConfig("isShow", t);
        let o = i;
        const s = {};
        (i && i.length) || (o = Object.keys(this.useDataObj)),
          o.forEach((e) => {
            this.useDataObj[e] && (s[e] = { data: { exConfig: {} } });
          }),
          (o = Object.keys(s)),
          !i && t && Ln.setGroupShow(this.group, t);
        const r = t ? 1 : 0,
          a = { opacity: t ? 0 : 1 };
        this.setTestTween(
          a,
          { opacity: r },
          () => {
            n && n(),
              this.config.isShow === t &&
                (i || t || Ln.setGroupShow(this.group, t));
          },
          e,
          "Quadratic.InOut",
          () => {
            this.config.isShow === t &&
              this.insChildren.forEach((e) => {
                e.setConfig &&
                  (o.forEach((t) => {
                    s[t].data.exConfig[e.config.name] = { uOpacity: a.opacity };
                  }),
                  e.refresh(s));
              });
          }
        );
      }
      animate(e, t, n) {
        this.insChildren.forEach((i) => {
          i.animate && i.animate(n, e, t);
        });
      }
      handleEventArr(e, t) {
        "add" !== t
          ? ((this.eventArr = []),
            this.insChildren.forEach((e) => {
              e.eventArr &&
                e.eventArr.length &&
                e.config.isCompEvents &&
                this.eventArr.push(...e.eventArr);
            }),
            this.eventArrChange && this.eventArrChange())
          : this.eventArr.push(...e.eventArr);
      }
      distribConf(e = [], t = []) {
        this.config.children = e;
        const n = [];
        e.forEach((e) => {
          let i = !1;
          t.forEach((t) => {
            t.name === e.name && ((i = !0), this.updateSingleComp(e));
          }),
            i || n.push(e);
        }),
          n.forEach((e) => {
            this.addComp(e, !1, !1);
          }),
          t.forEach((t) => {
            e.find((e) => t.name === e.name) || this.removeComp(t.name);
          });
      }
      updateSpecialComp(e, t, n) {
        "EventComp" === n
          ? (this.config.eventComp = e)
          : "Label" === n && (this.config.label = e);
        const i = this.insChildren.find((t) => t.config.name === e.name);
        e.load && i
          ? this.updateSingleComp(e)
          : !e.load && i
          ? this.removeComp(e.name)
          : e.load && !i && (e.type || (e.type = n), this.addComp(e, !1, !1));
      }
      updateStyle(e) {
        e &&
          Object.keys(e).length &&
          (Object.keys(e).forEach((t) => {
            this.useDataObj[t] &&
              ((this.useDataObj[t] = G.copy(this.useDataObj[t], e[t])),
              (e[t] = this.useDataObj[t]));
          }),
          this.insChildren.forEach((t) => {
            t.refresh && t.refresh(e, this.useDataObj);
          }));
      }
      errorNotice(e) {
        this._triggerInnerEvent("onError", { describe: e });
      }
      updateConfig(e, t) {
        this.config[e] = t;
      }
      disposeCompEft() {
        this.batchLoad.dispose(),
          (this.batchLoad = null),
          this.insChildren.forEach((e) => {
            e.dispose && (e.dispose(), (e = null));
          }),
          (this.insChildren = []),
          (this.config = null),
          (this.renderer = null),
          (this.group = null),
          (this._triggerInnerEvent = null),
          (this.largeNoComps = null),
          (this.beforeAdd = null),
          (this.eventArrChange = null),
          (this.useDataObj = null),
          (this.setTestTween = null),
          (this.eventArr = null);
      }
    };
    class Eo extends de {
      constructor(e) {
        super(e),
          z()(this, "_setting", {
            callback: On.callback,
            checkList: On.checkList,
          }),
          (this.eventArr = []),
          (this.LayerData = []),
          (this.curHoverUid = null),
          (this.uGlobalTime = 0),
          (this.condIdxObj = {}),
          (this.markIns = null),
          (this.condRder = null),
          (this.carousel = {
            totalTime: 0,
            curIdx: -1,
            isPause: !1,
            triggerDiff: 0,
          }),
          (this.perBatchNum = 20),
          (this.originCacheUids = []),
          (this.cacheUids = []),
          (this.largeNoComps = ["Cylinder", "EventComp"]),
          (this.tempV3 = new THRDev3.Vector3()),
          this.initInterFace();
      }
      initInterFace() {
        Object.keys(On.callback).forEach((e) => {
          On.callback[e].bind(this);
        }),
          (this.Interface = On);
      }
      setDefaultConfig(e) {
        G.copy(e, {
          name: "",
          trigger: !0,
          isAnimate: !0,
          hover: !0,
          choice: !0,
          isShow: !0,
          showAniTime: 1,
          size: 1,
          largeMode: !1,
          globalAniSpeed: 1,
          carousel: !1,
          carouselTime: 3,
          uidKey: void 0,
          offsetPosition: { x: 0, y: 0, z: 0 },
          isProxy: !0,
          initData: null,
          eventComp: { type: "EventComp", name: "EventComp", load: !0 },
          children: [],
        });
      }
      disposeCompEft() {
        (this.LayerData = null),
          (this.Interface = null),
          (this.condIdxObj = null),
          (this.originCacheUids = []),
          this.condRder.dispose(),
          (this.condRder = null),
          this.markIns.disposeCompEft(),
          (this.markIns = null),
          (this.tempV3 = null),
          (this.cacheUids = null),
          (this.carousel = null);
      }
      setData(e) {
        (this.LayerData = G.extend(!0, {}, e)),
          (this.condIdxObj = this.LayerData.condition),
          this.reloadData(e);
      }
      initOption(e, t) {
        G.copy(this.config, t), this.setConfig(e, t);
      }
      compEftInit() {
        (this.config.ceId = this.id),
          (this.condRder = new Vn()),
          (this.markIns = new Ao({
            uidKey: this.config.uidKey,
            perBatchNum: this.perBatchNum,
            largeMode: this.config.largeMode,
            largeNoComps: this.largeNoComps,
            eventComp: this.config.eventComp,
            isShow: this.config.isShow,
            children: this.config.children,
            size: this.config.size,
            renderer: this.renderer,
            group: this.group,
            setTestTween: this.setTestTween.bind(this),
            _triggerInnerEvent: this._triggerInnerEvent.bind(this),
            eventArrChange: () => {
              (this.eventArr = this.markIns.eventArr),
                this.renderer.updateEventArr(this);
            },
            beforeAdd: (e, t, n) => (
              "EventComp" === e.type ||
                n ||
                this.condRder.handleCondition({
                  condIdxObj: this.condIdxObj,
                  condition: this.config.condition,
                  useDataObj: t,
                  comps: this.markIns.config.children,
                  originCacheUids: this.originCacheUids,
                }),
              t
            ),
          })),
          this.markIns.init(),
          this.config.initData && this.setData(this.config.initData),
          Ln.setPosOffset(this.group, this.config.offsetPosition),
          this.setListener(),
          (this.animate = (e, t) => {
            this.handleCarousel(e),
              (this.config.isAnimate || void 0 === this.config.isAnimate) &&
                ((this.uGlobalTime += e * this.config.globalAniSpeed),
                this.markIns.animate(e, t, this.uGlobalTime));
          }),
          this._triggerInnerEvent("mounted", { val: this.config.name });
      }
      tempEmptyEventArray() {
        this.eventArr.length &&
          ((this.eventArr = []), this.renderer.updateEventArr(this));
      }
      readyData(e) {
        this.updateCacheUids(),
          this.condRder.handleCondition({
            condIdxObj: this.condIdxObj,
            condition: this.config.condition,
            useDataObj: e,
            comps: this.markIns.config.children,
            originCacheUids: this.originCacheUids,
          });
      }
      reloadData(e) {
        this.setCarouselEffect(this.carousel.curIdx, !1),
          this.reCalCarouselTime(),
          this.renderer.clearEvent && this.renderer.clearEvent(),
          (this.curHoverUid = null),
          (this.curClickUid = null),
          this.markIns.reloadData(e, (e) => {
            this.readyData(e), this.tempEmptyEventArray();
          });
      }
      updateStyle(e) {
        this.markIns.updateStyle(e);
      }
      refresh(e) {
        e &&
          e.length &&
          this.markIns.refresh(e, this.originCacheUids, (e) => {
            this.readyData(e), this.tempEmptyEventArray();
          });
      }
      dels(e) {
        e = Ln.convertToStr(e);
        this.markIns.dels(e, () => {
          this.tempEmptyEventArray();
        }) && this.updateCacheUids();
      }
      updateCacheUids() {
        (this.originCacheUids = []),
          Object.keys(this.markIns.useDataObj).forEach((e) => {
            const { seq: t } = this.markIns.useDataObj[e];
            this.originCacheUids[+t] = e;
          }),
          (this.cacheUids = []),
          this.originCacheUids.forEach((e) => {
            void 0 !== e && this.cacheUids.push(e);
          });
      }
      show(e, t, n, i) {
        null == e && (e = this.config.showAniTime),
          this.markIns.show(e, t, n, i);
      }
      warnNotice(e) {}
      errorNotice(e) {
        this.triggerEvent("onError", "inner", { describe: e });
      }
      reCalCarouselTime() {
        (this.carousel.totalTime = 0),
          (this.carousel.triggerDiff = this.config.carouselTime);
      }
      triggerEvent(e, t, n, i) {
        this.config.trigger &&
          ("out" === t
            ? this._triggerOutEvent(e, n, i)
            : this._triggerInnerEvent(e, n));
      }
      setConfig(e, t) {
        return On.setConfig.call(this, e, t);
      }
      getConfig(e, t) {
        return On.getConfig.call(this, e, t);
      }
    }
    Object.keys(Fn).forEach((e) => {
      Eo.prototype[e] = Fn[e];
    }),
      (Eo.description =
        "通过小组件拼合的方式合成标注, 目前支持的小组件有, 立放图片, 底盘, 粒子, 多行文字, 圆柱");
    var ko = Eo;
    var Io = {
      1: function () {
        return {
          main: {
            direction: 2,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            iconImg: {
              align: "left",
              vAlign: "middle",
              width: 200,
              height: 200,
              field: "iconImg",
              url: "smartFactory/markPoint/top1.png",
              hover: { field: "hoverIconImg" },
            },
          },
        };
      },
      2: function () {
        return {
          main: {
            width: 300,
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            texts: [
              {
                align: "center",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
            ],
          },
        };
      },
      3: function () {
        return {
          main: {
            width: 400,
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            iconImg: {
              align: "left",
              vAlign: "middle",
              width: 80,
              paddingLeft: 10,
              height: 80,
              field: "iconImg",
              url: "smartFactory/markPoint/top1.png",
              hover: { field: "hoverIconImg" },
            },
            textPadding: [30, 0, 30, 100],
            texts: [
              {
                align: "left",
                overflow: "wrap",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
            ],
          },
        };
      },
      4: function () {
        return {
          main: {
            width: 300,
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            iconImg: {
              align: "center",
              vAlign: "top",
              width: 80,
              paddingTop: 15,
              height: 80,
              field: "iconImg",
              url: "smartFactory/markPoint/top1.png",
              hover: { field: "hoverIconImg" },
            },
            textPadding: [100, 20, 20, 20],
            texts: [
              {
                align: "center",
                overflow: "wrap",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
            ],
          },
        };
      },
      5: function () {
        return {
          main: {
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            textPadding: [0, 20, 0, 20],
            texts: [
              {
                align: "center",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
              {
                align: "center",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                  {
                    color: ["#ffffff"],
                    fontSize: 30,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                ],
              },
            ],
          },
        };
      },
      6: function () {
        return {
          main: {
            moveY: 0.1,
            aniSpeed: 1,
            aniType: 2,
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            iconImg: {
              align: "left",
              vAlign: "middle",
              width: 200,
              height: 200,
              field: "iconImg",
              url: "smartFactory/markPoint/top1.png",
              hover: { field: "hoverIconImg" },
            },
          },
          decor: {
            name: "Wave",
            colorType: 1,
            color: "rgba(255, 255, 0, 1)",
            aniSpeed: 0.5,
            scaleVal: 1,
            offsetPosition: { x: 0, y: -0.1, z: 0 },
            uWaveNum: 3,
            width: 10,
            imgs: ["smartFactory/markPoint/btm1.png"],
          },
        };
      },
      7: function () {
        return {
          main: {
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            iconImg: {
              align: "left",
              vAlign: "top",
              width: 80,
              paddingTop: 20,
              paddingLeft: 10,
              height: 80,
              field: "iconImg",
              url: "smartFactory/markPoint/top1.png",
              hover: { field: "hoverIconImg" },
            },
            lineImg: {
              align: "center",
              vAlign: "bottom",
              width: 10,
              height: 150,
              field: "lineImg",
              url: "smartFactory/markPoint/cylinder1.png",
              hover: { field: "hoverLineImg" },
            },
            textPadding: [30, 20, 160, 100],
            texts: [
              {
                align: "left",
                overflow: "wrap",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
            ],
          },
        };
      },
      8: function () {
        return {
          main: {
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            iconImg: {
              align: "left",
              vAlign: "top",
              width: 80,
              paddingTop: 20,
              paddingLeft: 10,
              height: 80,
              field: "iconImg",
              url: "smartFactory/markPoint/top1.png",
              hover: { field: "hoverIconImg" },
            },
            lineImg: {
              align: "center",
              vAlign: "bottom",
              width: 10,
              height: 150,
              field: "lineImg",
              url: "smartFactory/markPoint/cylinder1.png",
              hover: { field: "hoverLineImg" },
            },
            textPadding: [30, 20, 160, 100],
            texts: [
              {
                align: "left",
                overflow: "wrap",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
            ],
          },
          decor: {
            name: "Wave",
            colorType: 1,
            color: "rgba(255, 255, 0, 1)",
            aniSpeed: 0.5,
            scaleVal: 1,
            offsetPosition: { x: 0, y: -0.1, z: 0 },
            uWaveNum: 3,
            width: 10,
            imgs: ["smartFactory/markPoint/btm1.png"],
          },
        };
      },
      9: function () {
        return {
          main: {
            width: 400,
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            textPadding: [20, 20, 20, 20],
            texts: [
              {
                align: "left",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    width: 150,
                    align: "right",
                    overflow: "omit",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 25,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                ],
              },
              {
                align: "left",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    width: 150,
                    align: "right",
                    overflow: "omit",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 25,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                ],
              },
            ],
            bg: { url: "smartFactory/markPoint/bg1.png", hover: {} },
          },
        };
      },
      10: function () {
        return {
          main: {
            width: 400,
            direction: 1,
            offsetPosition: { x: 0, y: 0, z: 0 },
            center: { x: 0.5, y: 0 },
            textPadding: [20, 20, 20, 20],
            texts: [
              {
                align: "center",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 50,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                ],
              },
              {
                align: "left",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    width: 150,
                    align: "right",
                    overflow: "omit",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 25,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                ],
              },
              {
                align: "left",
                overflow: "omit",
                children: [
                  {
                    color: ["#ffffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    width: 150,
                    align: "right",
                    overflow: "omit",
                    text: "",
                    paddingLeft: 0,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 40,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                  {
                    color: ["#00ffff"],
                    fontSize: 25,
                    fontWeight: "normal",
                    fontFamily: "Arial",
                    fontStyle: "normal",
                    shadow: !1,
                    shadowBlur: 5,
                    shadowColor: "#000",
                    text: "",
                    paddingLeft: 10,
                    paddingRight: 0,
                  },
                ],
              },
            ],
            bg: { url: "smartFactory/markPoint/bg1.png", hover: {} },
          },
        };
      },
    };
    class Ho extends ko {
      constructor(e) {
        super(e),
          (this.cameraLookUid = null),
          (this.temp1V3 = new THRDev3.Vector3()),
          (this.animate = () => {
            this.config.isAnimate;
          });
      }
      typeConfig(e, t) {
        const n = G.extend(!0, {}, t);
        var i, o;
        this.setDefaultConfig(n, e),
          (this.config = G.extend(!0, {}, n, e)),
          e.main &&
            e.main.texts &&
            ((i = this.config.main.texts),
            (o = e.main.texts) &&
              o.length &&
              o.forEach((e, t) => {
                e.children &&
                  e.children.length &&
                  e.children.forEach((e, n) => {
                    e && e.color && (i[t].children[n].color = e.color);
                  });
              })),
          (this.name = this.config.name),
          (this.id = G.creatId(this.name || this.config.sort || void 0));
      }
      setDefaultConfig(e, t) {
        super.setDefaultConfig(e),
          G.copy(e, {
            hover: !0,
            choice: !0,
            isShow: !0,
            carousel: !1,
            carouselTime: 3,
            uidKey: void 0,
            offsetPosition: { x: 0, y: 0, z: 0 },
            size: 1,
            eventThrough: !1,
            sizeAttenuation: 0,
            camera: { clickMove: !0, time: 1, distance: 300, angle: 35 },
          });
        const n = t.style,
          i = Io[n] && Io[n]();
        i &&
          (i.decor || t.decor) &&
          (e.decor = {
            type: "Wave",
            name: "",
            showName: "",
            colorType: 2,
            color: "rgba(255, 255, 0, 1)",
            aniSpeed: 0.5,
            scaleVal: 1,
            offsetPosition: { x: 0, y: -0.1, z: 0 },
            uWaveNum: 3,
            width: 48,
          }),
          i && G.copy(e, i);
      }
      disposeCompEft() {}
      initTransformConfig() {
        if (((this.config.children = []), this.config.main)) {
          const e = {
              ...this.config.main,
              type: "MulText",
              name: "MulText",
              imgs: [],
            },
            { iconImg: t, lineImg: n } = this.config.main;
          n &&
            (n.field || (n.field = "lineImg"),
            n.hover && !n.hover.field && (n.hover.field = "hoverLineImg"),
            e.imgs.push(n)),
            t &&
              (t.field || (t.field = "iconImg"),
              t.hover && !t.hover.field && (t.hover.field = "hoverIconImg"),
              e.imgs.push(t));
          const { texts: i, quickTexts: o } = this.config.main;
          if (i && i.length) {
            let e = -1;
            i.forEach((t) => {
              t &&
                t.children &&
                t.children.length &&
                t.children.forEach((n, i) => {
                  (e += 1),
                    o && o[e]
                      ? ((t.children[i] = { ...n, ...o[e] }),
                        t.children[i].field ||
                          (t.children[i].field = "text" + e))
                      : t.children[i].field ||
                        (t.children[i].field = "text" + e);
                });
            });
          }
          this.config.children.push(e);
        }
        this.config.decor &&
          ((this.config.decor.type = "Wave"),
          this.config.decor.name || (this.config.decor.name = "Wave"),
          this.config.children.push(this.config.decor)),
          this.config.others &&
            this.config.children.push(...this.config.others),
          this.handleCondition();
      }
      handleCondition() {
        const { condition: e } = this.config;
        e &&
          Object.keys(e).forEach((t) => {
            (e[t].main || e[t].decor || e[t].others) &&
              (e[t].children = this.getchildrenConf(e[t]));
          });
      }
      compEftInit() {
        this.initTransformConfig(),
          super.compEftInit(),
          this.config.sizeAttenuation &&
            (this.renderer.controls.addEventListener("zoomChange", () => {
              this.handleSizeAttenuation();
            }),
            this.renderer.on("updatePointSize", () => {
              this.handleSizeAttenuation();
            }));
      }
      handleSizeAttenuation() {
        if (!this.config.sizeAttenuation) return;
        const e = this.renderer.distanceCm();
        this.markIns.insChildren.forEach((t) => {
          const n = (e * this.config.sizeAttenuation) ** 0.5;
          t.setConfig("", { width: n, height: n });
        });
      }
      getchildrenConf(e) {
        const t = [];
        if (e.main) {
          const n = { ...e.main, type: "MulText", name: "MulText" },
            { iconImg: i, lineImg: o } = e.main;
          (i || o) && (n.imgs = []),
            i && n.imgs.push(i),
            o && n.imgs.push(o),
            t.push(n);
        }
        return (
          e.decor &&
            (e.decor.name || (e.decor.name = "Wave"),
            (e.decor.type = "Wave"),
            t.push(e.decor)),
          e.others && t.push(...e.others),
          t
        );
      }
      getTransConfig(e) {
        if (!e.main && !e.decor && !e.others) return e;
        let t = { ...this.config };
        return (
          Reflect.deleteProperty(t, "children"),
          (t = G.extend(!0, {}, t, e)),
          (t.children = this.getchildrenConf(t)),
          t
        );
      }
      handleHover(e, t) {
        if (this.cameraLookUid && this.cameraLookUid !== e) {
          const e = this.cameraLookUid;
          (this.cameraLookUid = null), this.hover(e, !1);
        }
        this.hover(e, t);
      }
      setMoveCamera(e) {
        if (!this.markIns.useDataObj[e]) return;
        this.handleHover(e, !0), (this.cameraLookUid = e);
        const { pos: t } = this.markIns.useDataObj[e].data,
          { distance: n, angle: i } = this.config.camera;
        this.moveCamera(t, n, i);
      }
      getTranslateCameraParam(e, t, n = 45) {
        const i = THRDev3.MathUtils.degToRad(n),
          { x: o = 0, y: s = 0, z: r = 0 } = e,
          { camera: a, controls: l } = this.renderer,
          c = a.position.clone().sub(l.target),
          h = Math.cos(i) * t,
          u = Math.sin(i) * t,
          d = new THRDev3.Vector2(c.x, c.z).normalize().multiplyScalar(h);
        return {
          target: { x: o, y: s, z: r },
          position: { x: o + d.x, y: s + u, z: r + d.y },
        };
      }
      moveCamera(e, t = 100, n = 45, i = 1, o) {
        const s = this.getTranslateCameraParam(e, t, n);
        this.cameraAni(s, i, o);
      }
      cameraAni(e, t, n) {
        const { camera: i, controls: o } = this.renderer;
        t = t || this.config.camera.time;
        const s = o.target.clone(),
          r = new THRDev3.Vector3().copy(e.target);
        if (t < 0.02)
          return i.position.copy(e.position), void o.target.copy(e.target);
        this.setTestTween(
          i.position,
          e.position,
          () => {
            n && n();
          },
          t,
          "Quadratic.InOut",
          (e) => {
            this.temp1V3.lerpVectors(s, r, e), o.target.copy(this.temp1V3);
          }
        );
      }
      getTriggerCompName(...e) {
        if (!this.config.eventThrough) return super.getTriggerCompName(...e);
        if (!e[1] || !e[1].length) return "";
        for (let t = 0; t < e[1].length; t++) {
          const n = e[1][t];
          if (
            n &&
            n.object &&
            n.object.userData.ceId === this.config.ceId &&
            n.object.userData &&
            n.object.userData._compName
          )
            return n;
        }
        return "";
      }
      commonEventHandle(...e) {
        if (!this.config.eventThrough) return super.commonEventHandle(...e);
        const t = this.getTriggerCompName(...e);
        if (!t) return e;
        const n = t.object.userData._compName,
          i = this.getTriggerDataKey(n, t),
          o = this.getOutEventData(i);
        return (o.point = { ...t.point }), [e[0], o];
      }
      onClick(...e) {
        const t = super.onClick(...e);
        if (
          this.config.camera.clickMove &&
          t &&
          t[1] &&
          t[1].ceId &&
          t[1].ceId === this.config.ceId
        ) {
          const { distance: e, angle: n } = this.config.camera;
          this.moveCamera(t[1].data.pos, e, n, 1, () => {
            this.handleSizeAttenuation();
          });
        }
        return t;
      }
      onMouseDown(...e) {
        return super.onMouseDown(...e);
      }
      onMouseIn(...e) {
        return super.onMouseIn(...e);
      }
      setConfig(e, t) {
        switch (e) {
          case "option":
            super.setConfig(e, this.getTransConfig(t));
            break;
          case "moveCamera":
            this.setMoveCamera(t.uid);
            break;
          case "moveCameraToPos":
            this.moveCamera(t.pos, t.distance, t.angle, t.time, t.cb);
        }
        return super.setConfig(e, t);
      }
      getConfig(e, t) {
        return super.getConfig(e, t);
      }
    }
    Ho.description =
      "标注效果, 可配置背景图片, icon图片, 竖线图片, 底盘, 多行文字";
    var Lo = {
      ...lt,
      ...{
        ...Pt,
        ...{
          Camera: Lt,
          DynSky: zt,
          LoaderModel: Pn,
          Instance: In,
          MarkPoint: Ho,
        },
      },
    };
    var Oo = class {
      constructor() {
        this.deps = [];
      }
      add(e) {
        this.deps.push(e);
      }
      notify() {
        for (let e = 0; e < this.deps.length; e++) this.deps[e]();
        this.deps.length = 0;
      }
    };
    function Vo(e = "") {
      throw new Error("idb-js：" + e);
    }
    const Fo =
        window.indexedDB ||
        window.mozIndexedDB ||
        window.webkitIndexedDB ||
        window.msIndexedDB,
      zo =
        (window.IDBTransaction ||
          window.webkitIDBTransaction ||
          window.msIDBTransaction,
        window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange,
        (e) => "[object Array]" === Object.prototype.toString.call(e));
    var jo = class {
      constructor({ dbName: e, version: t, dbId: n }) {
        (this.dbName = e),
          (this.version = t),
          (this.dbId = n),
          (this.db = null),
          (this.idb = null),
          (this.table = []),
          (this._status = !1),
          (this._dep_ = new Oo());
        const i = `db_${e}_${t}`;
        window.localStorage.getItem(i) !== n &&
          (this.delete_db(e), window.localStorage.setItem(i, n));
      }
      open(e) {
        let t = () => {},
          n = () => {};
        if (
          (e && ((t = e.success ? e.success : t), (n = e.error ? e.error : n)),
          0 == this.table.length && !this._status)
        )
          return void Vo("打开前要先用add_table添加表");
        if ("function" != typeof t)
          return void Vo("open中success必须是一个function类型");
        const i = Fo.open(this.dbName, this.version);
        (i.onerror = (e) => {
          n(e.currentTarget.error.message);
        }),
          (i.onsuccess = (e) => {
            (this.db = e.target.result), t(this.db), this._dep_.notify();
          }),
          (i.onupgradeneeded = (e) => {
            this.idb = e.target.result;
            for (let e = 0; e < this.table.length; e++)
              this.__create_table(this.idb, this.table[e]);
          });
      }
      close_db() {
        this.__action(() => {
          this.db.close();
        });
      }
      delete_db(e) {
        Fo.deleteDatabase(e);
      }
      clear_table({ tableName: e }) {
        this.__action(() => this.__create_transaction(e, "readwrite").clear());
      }
      add_table(e = {}) {
        (this._status = !1), this.table.push(e);
      }
      queryAll({ tableName: e, success: t = () => {} }) {
        if ("function" != typeof t)
          return void Vo("queryAll方法中success必须是一个Function类型");
        this.__action(() => {
          const n = [];
          this.__create_transaction(e, "readonly").openCursor().onsuccess = (
            e
          ) =>
            this.__cursor_success(e, {
              condition: () => !0,
              handler: ({ currentValue: e }) => n.push(e),
              over: () => t(n),
            });
        });
      }
      query({ tableName: e, condition: t, success: n = () => {} }) {
        if ("function" != typeof n)
          return void Vo("query方法中success必须是一个Function类型");
        if ("function" != typeof t)
          return void Vo("in query,condition is required,and type is function");
        this.__action(() => {
          let i = [];
          this.__create_transaction(e, "readonly").openCursor().onsuccess = (
            e
          ) =>
            this.__cursor_success(e, {
              condition: t,
              handler: ({ currentValue: e }) => i.push(e),
              over: () => n(i),
            });
        });
      }
      insert({ tableName: e, data: t, success: n = () => {} }) {
        zo(t) ||
        ((e) => "[object Object]" === Object.prototype.toString.call(e))(t)
          ? "function" == typeof n
            ? this.__action(() => {
                const i = this.__create_transaction(e, "readwrite");
                zo(t) ? t.forEach((e) => i.put(e)) : i.put(t), n();
              })
            : Vo("insert方法中success必须是一个Function类型")
          : Vo("in insert，data type is Object or Array");
      }
      delete({ tableName: e, condition: t, success: n = () => {} }) {
        if ("function" != typeof n)
          return void Vo("delete方法中success必须是一个Function类型");
        if ("function" != typeof t)
          return void Vo(
            "in delete,condition is required,and type is function"
          );
        this.__action(() => {
          let i = [];
          this.__create_transaction(e, "readwrite").openCursor().onsuccess = (
            e
          ) =>
            this.__cursor_success(e, {
              condition: t,
              handler: ({ currentValue: e, cursor: t }) => {
                i.push(e), t.delete();
              },
              over: () => {
                0 != i.length
                  ? n(i)
                  : Vo("in delete ,数据库中没有任何符合condition的元素");
              },
            });
        });
      }
      delete_by_primaryKey({
        tableName: e,
        target: t,
        success: n = () => {},
        error: i = () => {},
      }) {
        "function" == typeof n
          ? this.__action(() => {
              const o = this.__create_transaction(e, "readwrite").delete(t);
              (o.onsuccess = () => n()), (o.onerror = () => i());
            })
          : Vo("in delete_by_primaryKey，success必须是一个Function类型");
      }
      update_by_primaryKey({
        tableName: e,
        target: t,
        success: n = () => {},
        handle: i,
      }) {
        "function" == typeof n
          ? "function" == typeof i
            ? this.__action(() => {
                const o = this.__create_transaction(e, "readwrite");
                o.get(t).onsuccess = (e) => {
                  const t = e.target.result;
                  i(t), o.put(t), n(t);
                };
              })
            : Vo("in update_by_primaryKey，handle必须是一个Function类型")
          : Vo("in update_by_primaryKey，success必须是一个Function类型");
      }
      update({ tableName: e, condition: t, handle: n, success: i = () => {} }) {
        if ("function" != typeof n)
          return void Vo("in update,handle必须是一个function类型");
        if ("function" != typeof i)
          return void Vo("in update,success必须是一个function类型");
        if ("function" != typeof t)
          return void Vo(
            "in update,condition is required,and type is function"
          );
        this.__action(() => {
          let o = [];
          this.__create_transaction(e, "readwrite").openCursor().onsuccess = (
            e
          ) =>
            this.__cursor_success(e, {
              condition: t,
              handler: ({ currentValue: e, cursor: t }) => {
                n(e), o.push(e), t.update(e);
              },
              over: () => {
                0 != o.length
                  ? i(o)
                  : Vo("in update ,数据库中没有任何符合condition的元素");
              },
            });
        });
      }
      query_by_primaryKey({ tableName: e, target: t, success: n = () => {} }) {
        if ("function" != typeof n)
          return void Vo(
            "in query_by_primaryKey,success必须是一个Function类型"
          );
        this.__action(() => {
          this.__create_transaction(e, "readonly").get(t).onsuccess = (e) => {
            const t = e.target.result;
            n(t || null);
          };
        });
      }
      query_by_index({
        tableName: e,
        indexName: t,
        target: n,
        success: i = () => {},
      }) {
        if ("function" != typeof i)
          return void Vo("in query_by_index,success必须是一个Function类型");
        this.__action(() => {
          this.__create_transaction(e, "readonly").index(t).get(n).onsuccess = (
            e
          ) => {
            const t = e.target.result;
            i(t || null);
          };
        });
      }
      __cursor_success(e, { condition: t, handler: n, over: i }) {
        const o = e.target.result;
        if (o) {
          const e = o.value;
          t(e) && n({ cursor: o, currentValue: e }), o.continue();
        } else i();
      }
      __create_transaction(e, t = "readwrite") {
        if (!e || !t)
          throw new Error(
            "in __create_transaction,tableName and mode is required"
          );
        return this.db.transaction(e, t).objectStore(e);
      }
      __action(e) {
        const t = () => {
          e();
        };
        this.db ? t() : this._dep_.add(t);
      }
      __create_table(e, { tableName: t, option: n, indexs: i = [] }) {
        if (!e.objectStoreNames.contains(t)) {
          let o = e.createObjectStore(t, n);
          for (let e of i) this.__create_index(o, e);
        }
      }
      __create_index(e, { key: t, option: n }) {
        e.createIndex(t, t, n);
      }
    };
    var Bo = function ({
      dbName: e,
      version: t = new Date().getTime(),
      dbId: n,
      tables: i = [],
    }) {
      const o = new jo({ dbName: e, version: t, dbId: n });
      for (let e of i) o.add_table(e);
      return new Promise((e, t) => {
        o.open({
          success: () => {
            e(o);
          },
          error: (e) => {
            t(e);
          },
        });
      });
    };
    const Uo = {
      dbName: "w3d-model",
      version: 12,
      dbId: "w3d",
      tables: [
        {
          tableName: "model",
          option: { keyPath: "id" },
          indexs: [{ key: "url" }, { key: "assets" }],
        },
      ],
    };
    var No = (e = Uo) => {
      e.tables = [e.table];
      const t = {};
      let n = null;
      return (
        (THRDev3.FileLoader.prototype.load = function (i, o, s, r) {
          void 0 === i && (i = ""),
            void 0 !== this.path && (i = this.path + i),
            (i = this.manager.resolveURL(i));
          const a = THRDev3.Cache.get(i);
          if (void 0 !== a)
            return (
              this.manager.itemStart(i),
              setTimeout(() => {
                o && o(a), this.manager.itemEnd(i);
              }, 0),
              a
            );
          (t[i] = []), t[i].push({ onLoad: o, onProgress: s, onError: r });
          const l = new Request(i, {
              headers: new Headers(this.requestHeader),
              credentials: this.withCredentials ? "include" : "same-origin",
            }),
            { mimeType: c } = this,
            { responseType: h } = this;
          (function (t) {
            return new Promise((i, o) => {
              n.query({
                tableName: e.table.tableName,
                condition: (e) => e.url == t,
                success: (e) => {
                  i(e);
                },
              });
            });
          })(i)
            .then((e) => e)
            .then((e) => (0 === e.length ? fetch(l) : (o(e[0].assets), !1)))
            .then((e) => {
              if (!e) return !1;
              if (200 === e.status || 0 === e.status) {
                if (
                  (0 === e.status &&
                    console.warn("THRDev3.FileLoader: HTTP Status 0 received."),
                  "undefined" == typeof ReadableStream ||
                    void 0 === e.body ||
                    void 0 === e.body.getReader)
                )
                  return e;
                const n = t[i],
                  o = e.body.getReader(),
                  s = e.headers.get("Content-Length"),
                  r = s ? parseInt(s) : 0,
                  a = 0 !== r;
                let l = 0;
                const c = new ReadableStream({
                  start(e) {
                    !(function t() {
                      o.read().then(({ done: i, value: o }) => {
                        if (i) e.close();
                        else {
                          l += o.byteLength;
                          const i = new ProgressEvent("progress", {
                            lengthComputable: a,
                            loaded: l,
                            total: r,
                          });
                          for (let e = 0, t = n.length; e < t; e++) {
                            const t = n[e];
                            t.onProgress && t.onProgress(i);
                          }
                          e.enqueue(o), t();
                        }
                      });
                    })();
                  },
                });
                return new Response(c);
              }
              throw new HttpError(
                `fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,
                e
              );
            })
            .then((e) => {
              if (!e) return !1;
              switch (h) {
                case "arraybuffer":
                  return e.arrayBuffer();
                case "blob":
                  return e.blob();
                case "document":
                  return e
                    .text()
                    .then((e) => new DOMParser().parseFromString(e, c));
                case "json":
                  return e.json();
                default:
                  if (void 0 === c) return e.text();
                  const t = /charset="?([^;"\s]*)"?/i.exec(c),
                    n = t && t[1] ? t[1].toLowerCase() : void 0,
                    i = new TextDecoder(n);
                  return e.arrayBuffer().then((e) => i.decode(e));
              }
            })
            .then((e) => {
              if (!e) return !1;
              THRDev3.Cache.add(i, e);
              const o = t[i];
              delete t[i];
              for (let t = 0, s = o.length; t < s; t++) {
                const s = o[t];
                s.onLoad && s.onLoad(e),
                  n.insert({
                    tableName: "model",
                    data: { id: i, url: i, assets: e },
                    success: () => {},
                  });
              }
            })
            .catch((e) => {
              const n = t[i];
              if (void 0 === n) throw (this.manager.itemError(i), e);
              delete t[i];
              for (let t = 0, i = n.length; t < i; t++) {
                const i = n[t];
                i.onError && i.onError(e);
              }
              this.manager.itemError(i);
            })
            .finally(() => {
              this.manager.itemEnd(i);
            }),
            this.manager.itemStart(i);
        }),
        Bo(e).then((e) => ((n = e), n))
      );
    };
    function Go(e, t, n) {
      !(function (e, t) {
        if (t.has(e))
          throw new TypeError(
            "Cannot initialize the same private elements twice on an object"
          );
      })(e, t),
        t.set(e, n);
    }
    const Wo = {
      getInfo(e) {
        const { description: t = "" } = Lo[e];
        return { name: e, description: t };
      },
      getAllInfo() {
        const e = [];
        return (
          Object.keys(Lo).forEach((t) => {
            e.push(Wo.getInfo(t));
          }),
          e
        );
      },
      getCompTypeName: (e) => (Lo[e] ? Wo.getInfo(e) : Wo.getAllInfo()),
      getModul(e) {
        const t = Lo[e];
        return t || console.warn(`not find component: ${e}!`), t;
      },
      onModulMounted(e, t, n) {
        if (!G.isFunction(n)) return;
        const i = (e) => {
          e._triggerInnerEvent("beforeRender"),
            window.requestAnimationFrame(() => {
              n(), e._triggerInnerEvent("afterRender");
            });
        };
        t < 0
          ? i(e)
          : e.on(
              "mounted",
              () => {
                i(e);
              },
              !0
            );
      },
      runnerEnvi() {
        const e = window.SF;
        return e && e.store;
      },
    };
    var Yo = new WeakMap(),
      Ko = new WeakMap(),
      $o = new WeakMap();
    class Xo {
      constructor() {
        Go(this, Yo, { writable: !0, value: null }),
          Go(this, Ko, { writable: !0, value: !1 }),
          Go(this, $o, { writable: !0, value: null }),
          _()(this, Yo, (e) => C()(this, $o)._getIns(e)),
          (this.outUtils = $);
      }
      getCompTypeName(e) {
        return Wo.getCompTypeName(e);
      }
      static getCompTypeName(e) {
        return Wo.getCompTypeName(e);
      }
      dispose() {
        C()(this, $o) && (C()(this, $o).dispose(), _()(this, $o, null));
      }
      init(e) {
        this.dispose(), _()(this, $o, new he());
        const {
          render: t,
          sort: n = !0,
          textures: i = [],
          components: o = [],
          endCallBack: s = null,
          indexDB: r,
        } = e;
        if (!t) return;
        (t._isDebugger = C()(this, Ko)), C()(this, $o).init(t, i);
        const a = o.filter((e) => !!Wo.getModul(e.compType));
        n && a.sort((e, t) => (e.config.sort || 0) - (t.config.sort || 0)),
          r && r.state
            ? No(r).then(() => {
                this.initCompEfts(a, s);
              })
            : this.initCompEfts(a, s);
      }
      initCompEfts(e, t) {
        let n = 0;
        const i = (e) =>
            !e &&
            (n
              ? C()(this, $o).removeLoading(t)
              : C()(this, $o).on(
                  "mounted",
                  () => {
                    C()(this, $o).removeLoading(t);
                  },
                  !0
                ),
            !0),
          o = () => {
            i(e[n]) || (this.add(e[n], o), n++);
          };
        o();
      }
      add(e, t) {
        const n = Wo.getModul(e.compType);
        if (!C()(this, $o) || !n) return;
        const i = new n(C()(this, $o));
        Wo.onModulMounted(i, e.config.sort, t),
          (e._isDebugger = C()(this, Ko)),
          i.init(e),
          C()(this, $o).addCompEft(i);
      }
      remove(e) {
        const t = C()(this, Yo).call(this, e);
        t && C()(this, $o).removeCompEft(t, !0);
      }
      removeAll() {
        C()(this, $o).removeAll(!0);
      }
      on(e, t, n, i) {
        const o = C()(this, Yo).call(this, e);
        o && o.bind(t, n, i);
      }
      un(e, t, n) {
        const i = C()(this, Yo).call(this, e);
        i && i.unbind(t, n);
      }
      setOption(e, t, n) {
        const i = C()(this, Yo).call(this, e);
        let o = null;
        if (!i) return o;
        switch (t) {
          case "listener":
            o = i.on(n.name, n.cycleFun, n.triggerOnce);
            break;
          case "dispose":
            o = i.dispose();
            break;
          default:
            o = i.setConfig(t, n);
        }
        return o;
      }
      getOption(e, t, n) {
        const i = C()(this, Yo).call(this, e);
        return i ? i.getConfig(t, n) : null;
      }
      trans(e, t) {
        if (!C()(this, $o)) return null;
        return {
          ...(void 0 !== t
            ? G.transPosition(e, t, C()(this, $o))
            : G.transCoord(new THRDev3.Vector3().copy(e), C()(this, $o))),
        };
      }
      setSize(e, t) {
        C()(this, $o) && C()(this, $o).setRenderSize(e, t);
      }
    }
    window.glInstance = Xo;
  },
]);
