(self.webpackChunkRemoteClient = self.webpackChunkRemoteClient || []).push([
  [3283],
  {
    15215: (e, t, r) => {
      'use strict';
      r.d(t, { n: () => s });
      var i = r(40167),
        o = r(27726);
      class n {
        constructor(e, t) {
          (this.layout = e),
            (this.buffer = 'number' == typeof t ? new ArrayBuffer(t * e.stride) : t);
          for (const t of e.fieldNames) {
            const r = e.fields.get(t);
            this[t] = new r.constructor(this.buffer, r.offset, this.stride);
          }
        }
        get stride() {
          return this.layout.stride;
        }
        get count() {
          return this.buffer.byteLength / this.stride;
        }
        get byteLength() {
          return this.buffer.byteLength;
        }
        getField(e, t) {
          const r = this[e];
          return r && r.elementCount === t.ElementCount && r.elementType === t.ElementType
            ? r
            : null;
        }
        slice(e, t) {
          return new n(this.layout, this.buffer.slice(e * this.stride, t * this.stride));
        }
        copyFrom(e, t, r, i) {
          const o = this.stride;
          if (o % 4 == 0) {
            const n = new Uint32Array(e.buffer, t * o, (i * o) / 4);
            new Uint32Array(this.buffer, r * o, (i * o) / 4).set(n);
          } else {
            const n = new Uint8Array(e.buffer, t * o, i * o);
            new Uint8Array(this.buffer, r * o, i * o).set(n);
          }
        }
      }
      class a {
        constructor() {
          (this.stride = 0), (this.fields = new Map()), (this.fieldNames = []);
        }
        vec2f(e, t) {
          return this.appendField(e, i.e, t), this;
        }
        vec2f64(e, t) {
          return this.appendField(e, i.t, t), this;
        }
        vec3f(e, t) {
          return this.appendField(e, i.a, t), this;
        }
        vec3f64(e, t) {
          return this.appendField(e, i.B, t), this;
        }
        vec4f(e, t) {
          return this.appendField(e, i.g, t), this;
        }
        vec4f64(e, t) {
          return this.appendField(e, i.f, t), this;
        }
        mat3f(e, t) {
          return this.appendField(e, i.d, t), this;
        }
        mat3f64(e, t) {
          return this.appendField(e, i.i, t), this;
        }
        mat4f(e, t) {
          return this.appendField(e, i.u, t), this;
        }
        mat4f64(e, t) {
          return this.appendField(e, i.c, t), this;
        }
        vec4u8(e, t) {
          return this.appendField(e, i.b, t), this;
        }
        f32(e, t) {
          return this.appendField(e, i.v, t), this;
        }
        f64(e, t) {
          return this.appendField(e, i.w, t), this;
        }
        u8(e, t) {
          return this.appendField(e, i.h, t), this;
        }
        u16(e, t) {
          return this.appendField(e, i.k, t), this;
        }
        i8(e, t) {
          return this.appendField(e, i.x, t), this;
        }
        vec2i8(e, t) {
          return this.appendField(e, i.s, t), this;
        }
        vec2i16(e, t) {
          return this.appendField(e, i.q, t), this;
        }
        vec2u8(e, t) {
          return this.appendField(e, i.r, t), this;
        }
        vec4u16(e, t) {
          return this.appendField(e, i.l, t), this;
        }
        u32(e, t) {
          return this.appendField(e, i.j, t), this;
        }
        appendField(e, t, r) {
          const i = t.ElementCount * (0, o.e)(t.ElementType),
            n = this.stride;
          this.fields.set(e, { size: i, constructor: t, offset: n, optional: r }),
            (this.stride += i),
            this.fieldNames.push(e);
        }
        alignTo(e) {
          return (this.stride = Math.floor((this.stride + e - 1) / e) * e), this;
        }
        hasField(e) {
          return this.fieldNames.indexOf(e) >= 0;
        }
        createBuffer(e) {
          return new n(this, e);
        }
        createView(e) {
          return new n(this, e);
        }
        clone() {
          const e = new a();
          return (
            (e.stride = this.stride),
            (e.fields = new Map()),
            this.fields.forEach((t, r) => e.fields.set(r, t)),
            (e.fieldNames = this.fieldNames.slice()),
            (e.BufferType = this.BufferType),
            e
          );
        }
      }
      function s() {
        return new a();
      }
    },
    10638: (e, t, r) => {
      'use strict';
      r.d(t, { R: () => i, T: () => l, i: () => s });
      var i,
        o,
        n = r(82426),
        a = r(76506);
      function s(e) {
        return window.WebGL2RenderingContext && e instanceof window.WebGL2RenderingContext;
      }
      ((o = i || (i = {}))[(o.Texture = 0)] = 'Texture'),
        (o[(o.Buffer = 1)] = 'Buffer'),
        (o[(o.VAO = 2)] = 'VAO'),
        (o[(o.Program = 3)] = 'Program'),
        (o[(o.Framebuffer = 4)] = 'Framebuffer'),
        (o[(o.Renderbuffer = 5)] = 'Renderbuffer'),
        (o[(o.COUNT = 6)] = 'COUNT');
      class l {
        constructor(e, t, r = null) {
          (this._context = e),
            (this.type = 'texture'),
            (this._glName = null),
            (this._descriptor = void 0),
            (this._samplingModeDirty = !1),
            (this._wrapModeDirty = !1),
            e.instanceCounter.increment(i.Texture, this),
            (this._descriptor = {
              target: 3553,
              samplingMode: 9729,
              wrapMode: 10497,
              flipped: !1,
              hasMipmap: !1,
              isOpaque: !1,
              unpackAlignment: 4,
              preMultiplyAlpha: !1,
              ...t,
            }),
            this.setData(r);
        }
        get glName() {
          return this._glName;
        }
        get descriptor() {
          return this._descriptor;
        }
        dispose() {
          this._context.gl &&
            this._glName &&
            (this._context.unbindTextureAllUnits(this),
            this._context.gl.deleteTexture(this._glName),
            (this._glName = null),
            this._context.instanceCounter.decrement(i.Texture, this));
        }
        release() {
          this.dispose();
        }
        resize(e, t) {
          const r = this._descriptor;
          (r.width === e && r.height === t) || ((r.width = e), (r.height = t), this.setData(null));
        }
        setData(e) {
          if (!this._context || !this._context.gl) return;
          const t = this._context.gl;
          this._glName || (this._glName = t.createTexture()),
            void 0 === e && (e = null),
            null === e &&
              ((this._descriptor.width = this._descriptor.width || 4),
              (this._descriptor.height = this._descriptor.height || 4));
          const r = this._context.bindTexture(this, l.TEXTURE_UNIT_FOR_UPDATES),
            i = this._descriptor;
          l._validateTexture(this._context, i),
            t.pixelStorei(t.UNPACK_ALIGNMENT, i.unpackAlignment),
            t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, i.flipped ? 1 : 0),
            t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, i.preMultiplyAlpha ? 1 : 0);
          const o = i.pixelFormat;
          let n = i.internalFormat ? i.internalFormat : o;
          if (
            e instanceof ImageData ||
            e instanceof HTMLImageElement ||
            e instanceof HTMLCanvasElement ||
            e instanceof HTMLVideoElement
          ) {
            let r = e.width,
              a = e.height;
            e instanceof HTMLVideoElement && ((r = e.videoWidth), (a = e.videoHeight)),
              i.width && i.height,
              t.texImage2D(t.TEXTURE_2D, 0, n, o, i.dataType, e),
              i.hasMipmap && this.generateMipmap(),
              void 0 === i.width && (i.width = r),
              void 0 === i.height && (i.height = a);
          } else {
            (null != i.width && null != i.height) ||
              console.error('Width and height must be specified!'),
              t.DEPTH24_STENCIL8 && n === t.DEPTH_STENCIL && (n = t.DEPTH24_STENCIL8);
            let r = i.width,
              s = i.height;
            if (
              (function (e) {
                return (0, a.i)(e) && 'type' in e && 'compressed' === e.type;
              })(e)
            ) {
              const o = Math.round(Math.log(Math.max(r, s)) / Math.LN2) + 1;
              i.hasMipmap = i.hasMipmap && o === e.levels.length;
              for (let o = 0; ; ++o) {
                const a = e.levels[Math.min(o, e.levels.length - 1)];
                if (
                  (t.compressedTexImage2D(t.TEXTURE_2D, o, n, r, s, 0, a),
                  (1 === r && 1 === s) || !i.hasMipmap)
                )
                  break;
                (r = Math.max(1, r >> 1)), (s = Math.max(1, s >> 1));
              }
            } else if ((0, a.i)(e))
              t.texImage2D(t.TEXTURE_2D, 0, n, r, s, 0, o, i.dataType, e),
                i.hasMipmap && this.generateMipmap();
            else
              for (
                let e = 0;
                t.texImage2D(t.TEXTURE_2D, e, n, r, s, 0, o, i.dataType, null),
                  (1 !== r || 1 !== s) && i.hasMipmap;
                ++e
              )
                (r = Math.max(1, r >> 1)), (s = Math.max(1, s >> 1));
          }
          l._applySamplingMode(t, this._descriptor),
            l._applyWrapMode(t, this._descriptor),
            l._applyAnisotropicFilteringParameters(this._context, this._descriptor),
            this._context.bindTexture(r, l.TEXTURE_UNIT_FOR_UPDATES);
        }
        updateData(e, t, r, i, o, n) {
          n || console.error('An attempt to use uninitialized data!'),
            this._glName || console.error('An attempt to update uninitialized texture!');
          const a = this._context.gl,
            s = this._descriptor,
            c = this._context.bindTexture(this, l.TEXTURE_UNIT_FOR_UPDATES);
          (t < 0 || r < 0 || i > s.width || o > s.height || t + i > s.width || r + o > s.height) &&
            console.error('An attempt to update out of bounds of the texture!'),
            a.pixelStorei(a.UNPACK_ALIGNMENT, s.unpackAlignment),
            a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, s.flipped ? 1 : 0),
            a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL, s.preMultiplyAlpha ? 1 : 0),
            n instanceof ImageData ||
            n instanceof HTMLImageElement ||
            n instanceof HTMLCanvasElement ||
            n instanceof HTMLVideoElement
              ? a.texSubImage2D(a.TEXTURE_2D, e, t, r, s.pixelFormat, s.dataType, n)
              : a.texSubImage2D(a.TEXTURE_2D, e, t, r, i, o, s.pixelFormat, s.dataType, n),
            this._context.bindTexture(c, l.TEXTURE_UNIT_FOR_UPDATES);
        }
        generateMipmap() {
          const e = this._descriptor;
          e.hasMipmap ||
            ((e.hasMipmap = !0),
            (this._samplingModeDirty = !0),
            l._validateTexture(this._context, e)),
            9729 === e.samplingMode
              ? ((this._samplingModeDirty = !0), (e.samplingMode = 9985))
              : 9728 === e.samplingMode &&
                ((this._samplingModeDirty = !0), (e.samplingMode = 9984));
          const t = this._context.bindTexture(this, l.TEXTURE_UNIT_FOR_UPDATES),
            r = this._context.gl;
          r.generateMipmap(r.TEXTURE_2D), this._context.bindTexture(t, l.TEXTURE_UNIT_FOR_UPDATES);
        }
        setSamplingMode(e) {
          e !== this._descriptor.samplingMode &&
            ((this._descriptor.samplingMode = e), (this._samplingModeDirty = !0));
        }
        setWrapMode(e) {
          e !== this._descriptor.wrapMode &&
            ((this._descriptor.wrapMode = e),
            l._validateTexture(this._context, this._descriptor),
            (this._wrapModeDirty = !0));
        }
        applyChanges() {
          const e = this._context.gl,
            t = this._descriptor;
          this._samplingModeDirty && (l._applySamplingMode(e, t), (this._samplingModeDirty = !1)),
            this._wrapModeDirty && (l._applyWrapMode(e, t), (this._wrapModeDirty = !1));
        }
        static _validateTexture(e, t) {
          (t.width < 0 || t.height < 0) &&
            console.error('Negative dimension parameters are not allowed!');
          const r = (0, n.a6)(t.width) && (0, n.a6)(t.height);
          s(e.gl) ||
            r ||
            ('number' == typeof t.wrapMode
              ? 33071 !== t.wrapMode &&
                console.error('Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!')
              : (33071 === t.wrapMode.s && 33071 === t.wrapMode.t) ||
                console.error('Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!'),
            t.hasMipmap && console.error('Mipmapping requires power-of-two textures!'));
        }
        static _applySamplingMode(e, t) {
          let r = t.samplingMode,
            i = t.samplingMode;
          9985 === r || 9987 === r
            ? ((r = 9729), t.hasMipmap || (i = 9729))
            : (9984 !== r && 9986 !== r) || ((r = 9728), t.hasMipmap || (i = 9728)),
            e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, r),
            e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, i);
        }
        static _applyWrapMode(e, t) {
          'number' == typeof t.wrapMode
            ? (e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, t.wrapMode),
              e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, t.wrapMode))
            : (e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, t.wrapMode.s),
              e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, t.wrapMode.t));
        }
        static _applyAnisotropicFilteringParameters(e, t) {
          var r;
          const i = e.capabilities.textureFilterAnisotropic;
          if (!i) return;
          const o = e.gl;
          o.texParameterf(
            o.TEXTURE_2D,
            i.TEXTURE_MAX_ANISOTROPY,
            null != (r = t.maxAnisotropy) ? r : 1,
          );
        }
      }
      l.TEXTURE_UNIT_FOR_UPDATES = 0;
    },
    73173: (e, t, r) => {
      'use strict';
      r.d(t, { g: () => l });
      var i = r(31450),
        o = (r(82058), r(60991)),
        n = r(92143),
        a = r(32101);
      const s = n.L.getLogger('esri.assets');
      function l(e) {
        if (!i.Z.assetsPath)
          throw (
            (s.errorOnce(
              'The API assets location needs to be set using config.assetsPath. More information: https://arcg.is/1OzLe50',
            ),
            new o.Z('assets:path-not-set', 'config.assetsPath is not set'))
          );
        return (0, a.v_)(i.Z.assetsPath, e);
      }
    },
    41864: (e, t, r) => {
      'use strict';
      r.d(t, { a: () => l, f: () => n, m: () => a, r: () => s });
      var i = r(76506),
        o = r(50406);
      function n(e, t, r) {
        return (0, o.as)(e.map((e, i) => t.apply(r, [e, i])));
      }
      function a(e, t, r) {
        return (0, o.as)(e.map((e, i) => t.apply(r, [e, i]))).then((e) => e.map((e) => e.value));
      }
      function s(e) {
        return (0, i.b)(e)
          ? (0, o.DB)()
          : e.then((e) => ({ ok: !0, value: e })).catch((e) => ({ ok: !1, error: e }));
      }
      function l(e) {
        return e
          .then((e) => ({ ok: !0, value: e }))
          .catch((e) => ((0, o.r9)(e), { ok: !1, error: e }));
      }
    },
    26923: (e, t, r) => {
      'use strict';
      r.d(t, { a: () => a, f: () => o, i: () => s, t: () => n });
      var i = r(82426);
      function o(e, t) {
        return (
          (e[0] = t[0]),
          (e[1] = t[1]),
          (e[2] = t[2]),
          (e[3] = t[4]),
          (e[4] = t[5]),
          (e[5] = t[6]),
          (e[6] = t[8]),
          (e[7] = t[9]),
          (e[8] = t[10]),
          e
        );
      }
      function n(e, t) {
        if (e === t) {
          const r = t[1],
            i = t[2],
            o = t[5];
          (e[1] = t[3]), (e[2] = t[6]), (e[3] = r), (e[5] = t[7]), (e[6] = i), (e[7] = o);
        } else
          (e[0] = t[0]),
            (e[1] = t[3]),
            (e[2] = t[6]),
            (e[3] = t[1]),
            (e[4] = t[4]),
            (e[5] = t[7]),
            (e[6] = t[2]),
            (e[7] = t[5]),
            (e[8] = t[8]);
        return e;
      }
      function a(e, t) {
        const r = t[0],
          i = t[1],
          o = t[2],
          n = t[3],
          a = t[4],
          s = t[5],
          l = t[6],
          c = t[7],
          d = t[8],
          u = t[9],
          h = t[10],
          f = t[11],
          m = t[12],
          p = t[13],
          g = t[14],
          v = t[15],
          x = r * s - i * a,
          b = r * l - o * a,
          _ = r * c - n * a,
          T = i * l - o * s,
          y = i * c - n * s,
          M = o * c - n * l,
          w = d * p - u * m,
          A = d * g - h * m,
          S = d * v - f * m,
          C = u * g - h * p,
          E = u * v - f * p,
          P = h * v - f * g;
        let F = x * P - b * E + _ * C + T * S - y * A + M * w;
        return F
          ? ((F = 1 / F),
            (e[0] = (s * P - l * E + c * C) * F),
            (e[1] = (l * S - a * P - c * A) * F),
            (e[2] = (a * E - s * S + c * w) * F),
            (e[3] = (o * E - i * P - n * C) * F),
            (e[4] = (r * P - o * S + n * A) * F),
            (e[5] = (i * S - r * E - n * w) * F),
            (e[6] = (p * M - g * y + v * T) * F),
            (e[7] = (g * _ - m * M - v * b) * F),
            (e[8] = (m * y - p * _ + v * x) * F),
            e)
          : null;
      }
      function s(e) {
        const t = i.E,
          r = e[0],
          o = e[1],
          n = e[2],
          a = e[3],
          s = e[4],
          l = e[5],
          c = e[6],
          d = e[7],
          u = e[8];
        return (
          Math.abs(1 - (r * r + a * a + c * c)) <= t &&
          Math.abs(1 - (o * o + s * s + d * d)) <= t &&
          Math.abs(1 - (n * n + l * l + u * u)) <= t
        );
      }
    },
    65775: (e, t, r) => {
      'use strict';
      r.d(t, {
        b: () => c,
        c: () => n,
        f: () => h,
        g: () => u,
        i: () => o,
        m: () => a,
        n: () => d,
        q: () => f,
        s: () => l,
        t: () => s,
      });
      var i = r(82426);
      function o(e) {
        return (
          (e[0] = 1),
          (e[1] = 0),
          (e[2] = 0),
          (e[3] = 0),
          (e[4] = 0),
          (e[5] = 1),
          (e[6] = 0),
          (e[7] = 0),
          (e[8] = 0),
          (e[9] = 0),
          (e[10] = 1),
          (e[11] = 0),
          (e[12] = 0),
          (e[13] = 0),
          (e[14] = 0),
          (e[15] = 1),
          e
        );
      }
      function n(e, t) {
        const r = t[0],
          i = t[1],
          o = t[2],
          n = t[3],
          a = t[4],
          s = t[5],
          l = t[6],
          c = t[7],
          d = t[8],
          u = t[9],
          h = t[10],
          f = t[11],
          m = t[12],
          p = t[13],
          g = t[14],
          v = t[15],
          x = r * s - i * a,
          b = r * l - o * a,
          _ = r * c - n * a,
          T = i * l - o * s,
          y = i * c - n * s,
          M = o * c - n * l,
          w = d * p - u * m,
          A = d * g - h * m,
          S = d * v - f * m,
          C = u * g - h * p,
          E = u * v - f * p,
          P = h * v - f * g;
        let F = x * P - b * E + _ * C + T * S - y * A + M * w;
        return F
          ? ((F = 1 / F),
            (e[0] = (s * P - l * E + c * C) * F),
            (e[1] = (o * E - i * P - n * C) * F),
            (e[2] = (p * M - g * y + v * T) * F),
            (e[3] = (h * y - u * M - f * T) * F),
            (e[4] = (l * S - a * P - c * A) * F),
            (e[5] = (r * P - o * S + n * A) * F),
            (e[6] = (g * _ - m * M - v * b) * F),
            (e[7] = (d * M - h * _ + f * b) * F),
            (e[8] = (a * E - s * S + c * w) * F),
            (e[9] = (i * S - r * E - n * w) * F),
            (e[10] = (m * y - p * _ + v * x) * F),
            (e[11] = (u * _ - d * y - f * x) * F),
            (e[12] = (s * A - a * C - l * w) * F),
            (e[13] = (r * C - i * A + o * w) * F),
            (e[14] = (p * b - m * T - g * x) * F),
            (e[15] = (d * T - u * b + h * x) * F),
            e)
          : null;
      }
      function a(e, t, r) {
        const i = t[0],
          o = t[1],
          n = t[2],
          a = t[3],
          s = t[4],
          l = t[5],
          c = t[6],
          d = t[7],
          u = t[8],
          h = t[9],
          f = t[10],
          m = t[11],
          p = t[12],
          g = t[13],
          v = t[14],
          x = t[15];
        let b = r[0],
          _ = r[1],
          T = r[2],
          y = r[3];
        return (
          (e[0] = b * i + _ * s + T * u + y * p),
          (e[1] = b * o + _ * l + T * h + y * g),
          (e[2] = b * n + _ * c + T * f + y * v),
          (e[3] = b * a + _ * d + T * m + y * x),
          (b = r[4]),
          (_ = r[5]),
          (T = r[6]),
          (y = r[7]),
          (e[4] = b * i + _ * s + T * u + y * p),
          (e[5] = b * o + _ * l + T * h + y * g),
          (e[6] = b * n + _ * c + T * f + y * v),
          (e[7] = b * a + _ * d + T * m + y * x),
          (b = r[8]),
          (_ = r[9]),
          (T = r[10]),
          (y = r[11]),
          (e[8] = b * i + _ * s + T * u + y * p),
          (e[9] = b * o + _ * l + T * h + y * g),
          (e[10] = b * n + _ * c + T * f + y * v),
          (e[11] = b * a + _ * d + T * m + y * x),
          (b = r[12]),
          (_ = r[13]),
          (T = r[14]),
          (y = r[15]),
          (e[12] = b * i + _ * s + T * u + y * p),
          (e[13] = b * o + _ * l + T * h + y * g),
          (e[14] = b * n + _ * c + T * f + y * v),
          (e[15] = b * a + _ * d + T * m + y * x),
          e
        );
      }
      function s(e, t, r) {
        const i = r[0],
          o = r[1],
          n = r[2];
        let a, s, l, c, d, u, h, f, m, p, g, v;
        return (
          t === e
            ? ((e[12] = t[0] * i + t[4] * o + t[8] * n + t[12]),
              (e[13] = t[1] * i + t[5] * o + t[9] * n + t[13]),
              (e[14] = t[2] * i + t[6] * o + t[10] * n + t[14]),
              (e[15] = t[3] * i + t[7] * o + t[11] * n + t[15]))
            : ((a = t[0]),
              (s = t[1]),
              (l = t[2]),
              (c = t[3]),
              (d = t[4]),
              (u = t[5]),
              (h = t[6]),
              (f = t[7]),
              (m = t[8]),
              (p = t[9]),
              (g = t[10]),
              (v = t[11]),
              (e[0] = a),
              (e[1] = s),
              (e[2] = l),
              (e[3] = c),
              (e[4] = d),
              (e[5] = u),
              (e[6] = h),
              (e[7] = f),
              (e[8] = m),
              (e[9] = p),
              (e[10] = g),
              (e[11] = v),
              (e[12] = a * i + d * o + m * n + t[12]),
              (e[13] = s * i + u * o + p * n + t[13]),
              (e[14] = l * i + h * o + g * n + t[14]),
              (e[15] = c * i + f * o + v * n + t[15])),
          e
        );
      }
      function l(e, t, r) {
        const i = r[0],
          o = r[1],
          n = r[2];
        return (
          (e[0] = t[0] * i),
          (e[1] = t[1] * i),
          (e[2] = t[2] * i),
          (e[3] = t[3] * i),
          (e[4] = t[4] * o),
          (e[5] = t[5] * o),
          (e[6] = t[6] * o),
          (e[7] = t[7] * o),
          (e[8] = t[8] * n),
          (e[9] = t[9] * n),
          (e[10] = t[10] * n),
          (e[11] = t[11] * n),
          (e[12] = t[12]),
          (e[13] = t[13]),
          (e[14] = t[14]),
          (e[15] = t[15]),
          e
        );
      }
      function c(e, t, r, o) {
        let n,
          a,
          s,
          l,
          c,
          d,
          u,
          h,
          f,
          m,
          p,
          g,
          v,
          x,
          b,
          _,
          T,
          y,
          M,
          w,
          A,
          S,
          C,
          E,
          P = o[0],
          F = o[1],
          D = o[2],
          R = Math.sqrt(P * P + F * F + D * D);
        return R < i.E
          ? null
          : ((R = 1 / R),
            (P *= R),
            (F *= R),
            (D *= R),
            (n = Math.sin(r)),
            (a = Math.cos(r)),
            (s = 1 - a),
            (l = t[0]),
            (c = t[1]),
            (d = t[2]),
            (u = t[3]),
            (h = t[4]),
            (f = t[5]),
            (m = t[6]),
            (p = t[7]),
            (g = t[8]),
            (v = t[9]),
            (x = t[10]),
            (b = t[11]),
            (_ = P * P * s + a),
            (T = F * P * s + D * n),
            (y = D * P * s - F * n),
            (M = P * F * s - D * n),
            (w = F * F * s + a),
            (A = D * F * s + P * n),
            (S = P * D * s + F * n),
            (C = F * D * s - P * n),
            (E = D * D * s + a),
            (e[0] = l * _ + h * T + g * y),
            (e[1] = c * _ + f * T + v * y),
            (e[2] = d * _ + m * T + x * y),
            (e[3] = u * _ + p * T + b * y),
            (e[4] = l * M + h * w + g * A),
            (e[5] = c * M + f * w + v * A),
            (e[6] = d * M + m * w + x * A),
            (e[7] = u * M + p * w + b * A),
            (e[8] = l * S + h * C + g * E),
            (e[9] = c * S + f * C + v * E),
            (e[10] = d * S + m * C + x * E),
            (e[11] = u * S + p * C + b * E),
            t !== e && ((e[12] = t[12]), (e[13] = t[13]), (e[14] = t[14]), (e[15] = t[15])),
            e);
      }
      function d(e, t) {
        const r = Math.sin(t),
          i = Math.cos(t);
        return (
          (e[0] = 1),
          (e[1] = 0),
          (e[2] = 0),
          (e[3] = 0),
          (e[4] = 0),
          (e[5] = i),
          (e[6] = r),
          (e[7] = 0),
          (e[8] = 0),
          (e[9] = -r),
          (e[10] = i),
          (e[11] = 0),
          (e[12] = 0),
          (e[13] = 0),
          (e[14] = 0),
          (e[15] = 1),
          e
        );
      }
      function u(e, t) {
        return (
          e[0] === t[0] &&
          e[1] === t[1] &&
          e[2] === t[2] &&
          e[3] === t[3] &&
          e[4] === t[4] &&
          e[5] === t[5] &&
          e[6] === t[6] &&
          e[7] === t[7] &&
          e[8] === t[8] &&
          e[9] === t[9] &&
          e[10] === t[10] &&
          e[11] === t[11] &&
          e[12] === t[12] &&
          e[13] === t[13] &&
          e[14] === t[14] &&
          e[15] === t[15]
        );
      }
      function h(e, t) {
        const r = e[0],
          o = e[1],
          n = e[2],
          a = e[3],
          s = e[4],
          l = e[5],
          c = e[6],
          d = e[7],
          u = e[8],
          h = e[9],
          f = e[10],
          m = e[11],
          p = e[12],
          g = e[13],
          v = e[14],
          x = e[15],
          b = t[0],
          _ = t[1],
          T = t[2],
          y = t[3],
          M = t[4],
          w = t[5],
          A = t[6],
          S = t[7],
          C = t[8],
          E = t[9],
          P = t[10],
          F = t[11],
          D = t[12],
          R = t[13],
          O = t[14],
          L = t[15];
        return (
          Math.abs(r - b) <= i.E * Math.max(1, Math.abs(r), Math.abs(b)) &&
          Math.abs(o - _) <= i.E * Math.max(1, Math.abs(o), Math.abs(_)) &&
          Math.abs(n - T) <= i.E * Math.max(1, Math.abs(n), Math.abs(T)) &&
          Math.abs(a - y) <= i.E * Math.max(1, Math.abs(a), Math.abs(y)) &&
          Math.abs(s - M) <= i.E * Math.max(1, Math.abs(s), Math.abs(M)) &&
          Math.abs(l - w) <= i.E * Math.max(1, Math.abs(l), Math.abs(w)) &&
          Math.abs(c - A) <= i.E * Math.max(1, Math.abs(c), Math.abs(A)) &&
          Math.abs(d - S) <= i.E * Math.max(1, Math.abs(d), Math.abs(S)) &&
          Math.abs(u - C) <= i.E * Math.max(1, Math.abs(u), Math.abs(C)) &&
          Math.abs(h - E) <= i.E * Math.max(1, Math.abs(h), Math.abs(E)) &&
          Math.abs(f - P) <= i.E * Math.max(1, Math.abs(f), Math.abs(P)) &&
          Math.abs(m - F) <= i.E * Math.max(1, Math.abs(m), Math.abs(F)) &&
          Math.abs(p - D) <= i.E * Math.max(1, Math.abs(p), Math.abs(D)) &&
          Math.abs(g - R) <= i.E * Math.max(1, Math.abs(g), Math.abs(R)) &&
          Math.abs(v - O) <= i.E * Math.max(1, Math.abs(v), Math.abs(O)) &&
          Math.abs(x - L) <= i.E * Math.max(1, Math.abs(x), Math.abs(L))
        );
      }
      function f(e) {
        const t = i.E,
          r = e[0],
          o = e[1],
          n = e[2],
          a = e[4],
          s = e[5],
          l = e[6],
          c = e[8],
          d = e[9],
          u = e[10];
        return (
          Math.abs(1 - (r * r + a * a + c * c)) <= t &&
          Math.abs(1 - (o * o + s * s + d * d)) <= t &&
          Math.abs(1 - (n * n + l * l + u * u)) <= t
        );
      }
    },
    57532: (e, t, r) => {
      'use strict';
      function i() {
        return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
      }
      function o(e) {
        return [
          e[0],
          e[1],
          e[2],
          e[3],
          e[4],
          e[5],
          e[6],
          e[7],
          e[8],
          e[9],
          e[10],
          e[11],
          e[12],
          e[13],
          e[14],
          e[15],
        ];
      }
      function n(e, t) {
        return new Float64Array(e, t, 16);
      }
      r.d(t, { I: () => a, a: () => n, b: () => o, c: () => i });
      const a = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
    },
    83283: (e, t, r) => {
      'use strict';
      r.r(t),
        r.d(t, {
          C: () => Ui,
          D: () => Li,
          E: () => ki,
          H: () => qi,
          M: () => $i,
          N: () => Wi,
          P: () => Ei,
          T: () => Ai,
          V: () => Ii,
          a: () => Gi,
          b: () => Ni,
          c: () => Si,
          d: () => wi,
          e: () => Pi,
          f: () => _i,
          g: () => bi,
          h: () => vi,
          i: () => Ji,
          j: () => bo,
          k: () => Oi,
          l: () => ho,
          m: () => Vi,
          n: () => Ci,
          o: () => Mo,
          t: () => gi,
        });
      var i = r(49500),
        o = r(76506),
        n = r(26923),
        a = r(45087),
        s = r(65775),
        l = r(57532),
        c = r(82426),
        d = r(53326),
        u = r(40167),
        h = r(72836),
        f = r(90779),
        m = r(82058),
        p = r(41864),
        g = r(60991),
        v = r(92143),
        x = r(50406),
        b = r(10738);
      async function _(e, t) {
        const { data: r } = await (0, m.default)(e, { responseType: 'image', ...t });
        return r;
      }
      var T = r(6906),
        y = r(10638);
      function M(e, t, r = 32774, i = [0, 0, 0, 0]) {
        return {
          srcRgb: e,
          srcAlpha: e,
          dstRgb: t,
          dstAlpha: t,
          opRgb: r,
          opAlpha: r,
          color: { r: i[0], g: i[1], b: i[2], a: i[3] },
        };
      }
      const w = { face: 1029, mode: 2305 },
        A = { face: 1028, mode: 2305 },
        S = (e) => (2 === e ? w : 1 === e ? A : null),
        C = { zNear: 0, zFar: 1 },
        E = { r: !0, g: !0, b: !0, a: !0 };
      function P(e) {
        return U.intern(e);
      }
      function F(e) {
        return H.intern(e);
      }
      function D(e) {
        return G.intern(e);
      }
      function R(e) {
        return q.intern(e);
      }
      function O(e) {
        return j.intern(e);
      }
      function L(e) {
        return K.intern(e);
      }
      function z(e) {
        return Y.intern(e);
      }
      function I(e) {
        return J.intern(e);
      }
      class N {
        constructor(e, t) {
          (this.makeKey = e), (this.makeRef = t), (this.interns = new Map());
        }
        intern(e) {
          if (!e) return null;
          const t = this.makeKey(e),
            r = this.interns;
          return r.has(t) || r.set(t, this.makeRef(e)), r.get(t);
        }
      }
      function B(e) {
        return '[' + e.join(',') + ']';
      }
      const U = new N(V, (e) => ({ __tag: 'Blending', ...e }));
      function V(e) {
        return e
          ? B([
              e.srcRgb,
              e.srcAlpha,
              e.dstRgb,
              e.dstAlpha,
              e.opRgb,
              e.opAlpha,
              e.color.r,
              e.color.g,
              e.color.b,
              e.color.a,
            ])
          : null;
      }
      const H = new N(k, (e) => ({ __tag: 'Culling', ...e }));
      function k(e) {
        return e ? B([e.face, e.mode]) : null;
      }
      const G = new N(W, (e) => ({ __tag: 'PolygonOffset', ...e }));
      function W(e) {
        return e ? B([e.factor, e.units]) : null;
      }
      const q = new N($, (e) => ({ __tag: 'DepthTest', ...e }));
      function $(e) {
        return e ? B([e.func]) : null;
      }
      const j = new N(X, (e) => ({ __tag: 'StencilTest', ...e }));
      function X(e) {
        return e
          ? B([
              e.function.func,
              e.function.ref,
              e.function.mask,
              e.operation.fail,
              e.operation.zFail,
              e.operation.zPass,
            ])
          : null;
      }
      const K = new N(Z, (e) => ({ __tag: 'DepthWrite', ...e }));
      function Z(e) {
        return e ? B([e.zNear, e.zFar]) : null;
      }
      const Y = new N(Q, (e) => ({ __tag: 'ColorWrite', ...e }));
      function Q(e) {
        return e ? B([e.r, e.g, e.b, e.a]) : null;
      }
      const J = new N(ee, (e) => ({ __tag: 'StencilWrite', ...e }));
      function ee(e) {
        return e ? B([e.mask]) : null;
      }
      const te = new N(
          function (e) {
            return e
              ? B([
                  V(e.blending),
                  k(e.culling),
                  W(e.polygonOffset),
                  $(e.depthTest),
                  X(e.stencilTest),
                  Z(e.depthWrite),
                  Q(e.colorWrite),
                  ee(e.stencilWrite),
                ])
              : null;
          },
          (e) => ({
            blending: P(e.blending),
            culling: F(e.culling),
            polygonOffset: D(e.polygonOffset),
            depthTest: R(e.depthTest),
            stencilTest: O(e.stencilTest),
            depthWrite: L(e.depthWrite),
            colorWrite: z(e.colorWrite),
            stencilWrite: I(e.stencilWrite),
          }),
        ),
        re = !!(0, o.h)('enable-feature:webgl-debug');
      function ie() {
        return re;
      }
      function oe() {
        return re;
      }
      var ne,
        ae = { exports: {} };
      void 0 !==
        (ne = [
          'precision',
          'highp',
          'mediump',
          'lowp',
          'attribute',
          'const',
          'uniform',
          'varying',
          'break',
          'continue',
          'do',
          'for',
          'while',
          'if',
          'else',
          'in',
          'out',
          'inout',
          'float',
          'int',
          'void',
          'bool',
          'true',
          'false',
          'discard',
          'return',
          'mat2',
          'mat3',
          'mat4',
          'vec2',
          'vec3',
          'vec4',
          'ivec2',
          'ivec3',
          'ivec4',
          'bvec2',
          'bvec3',
          'bvec4',
          'sampler1D',
          'sampler2D',
          'sampler3D',
          'samplerCube',
          'sampler1DShadow',
          'sampler2DShadow',
          'struct',
          'asm',
          'class',
          'union',
          'enum',
          'typedef',
          'template',
          'this',
          'packed',
          'goto',
          'switch',
          'default',
          'inline',
          'noinline',
          'volatile',
          'public',
          'static',
          'extern',
          'external',
          'interface',
          'long',
          'short',
          'double',
          'half',
          'fixed',
          'unsigned',
          'input',
          'output',
          'hvec2',
          'hvec3',
          'hvec4',
          'dvec2',
          'dvec3',
          'dvec4',
          'fvec2',
          'fvec3',
          'fvec4',
          'sampler2DRect',
          'sampler3DRect',
          'sampler2DRectShadow',
          'sizeof',
          'cast',
          'namespace',
          'using',
        ]) && (ae.exports = ne);
      var se,
        le = ae.exports,
        ce = { exports: {} };
      void 0 !==
        (se = [
          '<<=',
          '>>=',
          '++',
          '--',
          '<<',
          '>>',
          '<=',
          '>=',
          '==',
          '!=',
          '&&',
          '||',
          '+=',
          '-=',
          '*=',
          '/=',
          '%=',
          '&=',
          '^^',
          '^=',
          '|=',
          '(',
          ')',
          '[',
          ']',
          '.',
          '!',
          '~',
          '*',
          '/',
          '%',
          '+',
          '-',
          '<',
          '>',
          '&',
          '^',
          '|',
          '?',
          ':',
          '=',
          ',',
          ';',
          '{',
          '}',
        ]) && (ce.exports = se);
      var de,
        ue,
        he = ce.exports,
        fe = { exports: {} };
      (de = fe),
        void 0 !==
          (ue = [
            'abs',
            'acos',
            'all',
            'any',
            'asin',
            'atan',
            'ceil',
            'clamp',
            'cos',
            'cross',
            'dFdx',
            'dFdy',
            'degrees',
            'distance',
            'dot',
            'equal',
            'exp',
            'exp2',
            'faceforward',
            'floor',
            'fract',
            'gl_BackColor',
            'gl_BackLightModelProduct',
            'gl_BackLightProduct',
            'gl_BackMaterial',
            'gl_BackSecondaryColor',
            'gl_ClipPlane',
            'gl_ClipVertex',
            'gl_Color',
            'gl_DepthRange',
            'gl_DepthRangeParameters',
            'gl_EyePlaneQ',
            'gl_EyePlaneR',
            'gl_EyePlaneS',
            'gl_EyePlaneT',
            'gl_Fog',
            'gl_FogCoord',
            'gl_FogFragCoord',
            'gl_FogParameters',
            'gl_FragColor',
            'gl_FragCoord',
            'gl_FragData',
            'gl_FragDepth',
            'gl_FragDepthEXT',
            'gl_FrontColor',
            'gl_FrontFacing',
            'gl_FrontLightModelProduct',
            'gl_FrontLightProduct',
            'gl_FrontMaterial',
            'gl_FrontSecondaryColor',
            'gl_LightModel',
            'gl_LightModelParameters',
            'gl_LightModelProducts',
            'gl_LightProducts',
            'gl_LightSource',
            'gl_LightSourceParameters',
            'gl_MaterialParameters',
            'gl_MaxClipPlanes',
            'gl_MaxCombinedTextureImageUnits',
            'gl_MaxDrawBuffers',
            'gl_MaxFragmentUniformComponents',
            'gl_MaxLights',
            'gl_MaxTextureCoords',
            'gl_MaxTextureImageUnits',
            'gl_MaxTextureUnits',
            'gl_MaxVaryingFloats',
            'gl_MaxVertexAttribs',
            'gl_MaxVertexTextureImageUnits',
            'gl_MaxVertexUniformComponents',
            'gl_ModelViewMatrix',
            'gl_ModelViewMatrixInverse',
            'gl_ModelViewMatrixInverseTranspose',
            'gl_ModelViewMatrixTranspose',
            'gl_ModelViewProjectionMatrix',
            'gl_ModelViewProjectionMatrixInverse',
            'gl_ModelViewProjectionMatrixInverseTranspose',
            'gl_ModelViewProjectionMatrixTranspose',
            'gl_MultiTexCoord0',
            'gl_MultiTexCoord1',
            'gl_MultiTexCoord2',
            'gl_MultiTexCoord3',
            'gl_MultiTexCoord4',
            'gl_MultiTexCoord5',
            'gl_MultiTexCoord6',
            'gl_MultiTexCoord7',
            'gl_Normal',
            'gl_NormalMatrix',
            'gl_NormalScale',
            'gl_ObjectPlaneQ',
            'gl_ObjectPlaneR',
            'gl_ObjectPlaneS',
            'gl_ObjectPlaneT',
            'gl_Point',
            'gl_PointCoord',
            'gl_PointParameters',
            'gl_PointSize',
            'gl_Position',
            'gl_ProjectionMatrix',
            'gl_ProjectionMatrixInverse',
            'gl_ProjectionMatrixInverseTranspose',
            'gl_ProjectionMatrixTranspose',
            'gl_SecondaryColor',
            'gl_TexCoord',
            'gl_TextureEnvColor',
            'gl_TextureMatrix',
            'gl_TextureMatrixInverse',
            'gl_TextureMatrixInverseTranspose',
            'gl_TextureMatrixTranspose',
            'gl_Vertex',
            'greaterThan',
            'greaterThanEqual',
            'inversesqrt',
            'length',
            'lessThan',
            'lessThanEqual',
            'log',
            'log2',
            'matrixCompMult',
            'max',
            'min',
            'mix',
            'mod',
            'normalize',
            'not',
            'notEqual',
            'pow',
            'radians',
            'reflect',
            'refract',
            'sign',
            'sin',
            'smoothstep',
            'sqrt',
            'step',
            'tan',
            'texture2D',
            'texture2DLod',
            'texture2DProj',
            'texture2DProjLod',
            'textureCube',
            'textureCubeLod',
            'texture2DLodEXT',
            'texture2DProjLodEXT',
            'textureCubeLodEXT',
            'texture2DGradEXT',
            'texture2DProjGradEXT',
            'textureCubeGradEXT',
          ]) && (de.exports = ue);
      var me = fe.exports;
      const pe = v.L.getLogger('esri/views/webgl');
      function ge(e) {
        if (ie()) {
          const t = e.getError();
          if (t) {
            const r = (function (e, t) {
                switch (t) {
                  case e.INVALID_ENUM:
                    return 'Invalid Enum. An unacceptable value has been specified for an enumerated argument.';
                  case e.INVALID_VALUE:
                    return 'Invalid Value. A numeric argument is out of range.';
                  case e.INVALID_OPERATION:
                    return 'Invalid Operation. The specified command is not allowed for the current state.';
                  case e.INVALID_FRAMEBUFFER_OPERATION:
                    return 'Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.';
                  case e.OUT_OF_MEMORY:
                    return 'Out of memory. Not enough memory is left to execute the command.';
                  case e.CONTEXT_LOST_WEBGL:
                    return 'WebGL context has been lost';
                  default:
                    return 'Unknown error';
                }
              })(e, t),
              i = new Error().stack;
            pe.error(new g.Z('webgl-error', 'WebGL error occured', { message: r, stack: i }));
          }
        }
      }
      const ve = v.L.getLogger('esri.views.webgl.BufferObject');
      class xe {
        constructor(e, t, r, i, o) {
          (this._context = e),
            (this.bufferType = t),
            (this.usage = r),
            (this._glName = null),
            (this._size = -1),
            (this._indexType = void 0),
            e.instanceCounter.increment(y.R.Buffer, this),
            (this._glName = this._context.gl.createBuffer()),
            ge(this._context.gl),
            i && this.setData(i, o);
        }
        static createIndex(e, t, r, i) {
          return new xe(e, 34963, t, r, i);
        }
        static createVertex(e, t, r) {
          return new xe(e, 34962, t, r);
        }
        get glName() {
          return this._glName;
        }
        get size() {
          return this._size;
        }
        get indexType() {
          return this._indexType;
        }
        get byteSize() {
          return 34962 === this.bufferType
            ? this._size
            : 5125 === this._indexType
            ? 4 * this._size
            : 2 * this._size;
        }
        dispose() {
          var e;
          null != (e = this._context) && e.gl
            ? (this._glName && (this._context.gl.deleteBuffer(this._glName), (this._glName = null)),
              this._context.instanceCounter.decrement(y.R.Buffer, this),
              (this._context = null))
            : this._glName && ve.warn('Leaked WebGL buffer object');
        }
        setData(e, t) {
          if (!e) return;
          if ('number' == typeof e) {
            if (
              (e < 0 && ve.error('Buffer size cannot be negative!'), 34963 === this.bufferType && t)
            )
              switch (((this._indexType = t), (this._size = e), t)) {
                case 5123:
                  e *= 2;
                  break;
                case 5125:
                  e *= 4;
              }
          } else {
            let t = e.byteLength;
            (0, o.q)(e) && ((t /= 2), (this._indexType = 5123)),
              (0, o.p)(e) && ((t /= 4), (this._indexType = 5125)),
              (this._size = t);
          }
          const r = this._context.getBoundVAO();
          this._context.bindVAO(null), this._context.bindBuffer(this);
          const i = this._context.gl;
          i.bufferData(this.bufferType, e, this.usage), ge(i), this._context.bindVAO(r);
        }
        setSubData(e, t = 0, r = 0, i = e.byteLength) {
          if (!e) return;
          (t < 0 || t >= this._size) && ve.error('offset is out of range!');
          let n = t,
            a = r,
            s = i,
            l = e.byteLength;
          (0, o.q)(e) && ((l /= 2), (n *= 2), (a *= 2), (s *= 2)),
            (0, o.p)(e) && ((l /= 4), (n *= 4), (a *= 4), (s *= 4)),
            void 0 === i && (i = l - 1),
            r >= i && ve.error('end must be bigger than start!'),
            t + r - i > this._size && ve.error('An attempt to write beyond the end of the buffer!');
          const c = this._context.getBoundVAO();
          this._context.bindVAO(null), this._context.bindBuffer(this);
          const d = this._context.gl,
            u = ArrayBuffer.isView(e) ? e.buffer : e,
            h = 0 === a && s === e.byteLength ? u : u.slice(a, s);
          d.bufferSubData(this.bufferType, n, h), ge(d), this._context.bindVAO(c);
        }
      }
      function be(e, t, r, i, o) {
        const n = e.gl,
          a = e.capabilities.instancing;
        e.bindBuffer(r);
        for (const e of i) {
          const r = t.get(e.name);
          void 0 === r &&
            console.error(`There is no location for vertex attribute '${e.name}' defined.`),
            e.baseInstance &&
              !e.divisor &&
              console.error(
                `Vertex attribute '${e.name}' uses baseInstanceOffset without divisor.`,
              );
          const i = (o || (0 + e.baseInstance ? e.baseInstance : 0)) * e.stride;
          if (e.count <= 4)
            n.vertexAttribPointer(r, e.count, e.type, e.normalized, e.stride, e.offset + i),
              n.enableVertexAttribArray(r),
              e.divisor > 0 && a && a.vertexAttribDivisor(r, e.divisor);
          else if (9 === e.count)
            for (let t = 0; t < 3; t++)
              n.vertexAttribPointer(
                r + t,
                3,
                e.type,
                e.normalized,
                e.stride,
                e.offset + 12 * t + i,
              ),
                n.enableVertexAttribArray(r + t),
                e.divisor > 0 && a && a.vertexAttribDivisor(r + t, e.divisor);
          else if (16 === e.count)
            for (let t = 0; t < 4; t++)
              n.vertexAttribPointer(
                r + t,
                4,
                e.type,
                e.normalized,
                e.stride,
                e.offset + 16 * t + i,
              ),
                n.enableVertexAttribArray(r + t),
                e.divisor > 0 && a && a.vertexAttribDivisor(r + t, e.divisor);
          else console.error('Unsupported vertex attribute element count: ' + e.count);
        }
      }
      function _e(e, t, r, i) {
        const o = e.gl,
          n = e.capabilities.instancing;
        e.bindBuffer(r);
        for (const e of i) {
          const r = t.get(e.name);
          if (e.count <= 4)
            o.disableVertexAttribArray(r),
              e.divisor && e.divisor > 0 && n && n.vertexAttribDivisor(r, 0);
          else if (9 === e.count)
            for (let t = 0; t < 3; t++)
              o.disableVertexAttribArray(r + t),
                e.divisor && e.divisor > 0 && n && n.vertexAttribDivisor(r + t, 0);
          else if (16 === e.count)
            for (let t = 0; t < 4; t++)
              o.disableVertexAttribArray(r + t),
                e.divisor && e.divisor > 0 && n && n.vertexAttribDivisor(r + t, 0);
          else console.error('Unsupported vertex attribute element count: ' + e.count);
        }
        e.unbindBuffer(34962);
      }
      function Te(e) {
        switch (e) {
          case 6406:
          case 6409:
          case 36168:
            return 1;
          case 6410:
          case 32854:
          case 33325:
          case 32854:
          case 33189:
            return 2;
          case 6407:
          case 6402:
            return 3;
          case 6408:
          case 34041:
          case 33326:
          case 35898:
          case 33327:
          case 34041:
            return 4;
          case 33328:
          case 34842:
            return 8;
          case 34836:
            return 16;
          case 33776:
          case 33777:
            return 0.5;
          case 33778:
          case 33779:
            return 1;
          case 37488:
          case 37489:
          case 37492:
          case 37493:
          case 37494:
          case 37495:
            return 0.5;
          case 37490:
          case 37491:
          case 37496:
          case 37497:
            return 1;
        }
        return 0;
      }
      function ye(e) {
        if ((0, o.b)(e)) return 0;
        if ('descriptor' in e) return e.glName ? ye(e.descriptor) : 0;
        const t = e.internalFormat || ('pixelFormat' in e && e.pixelFormat);
        if (!t) return 0;
        const r = 'hasMipmap' in e && e.hasMipmap ? 1.3 : 1,
          i = e.width * e.height;
        return Te(t) * i * r;
      }
      const Me = v.L.getLogger('esri.views.webgl.VertexArrayObject');
      class we {
        constructor(e, t, r, i, o = null) {
          (this._context = e),
            (this._locations = t),
            (this._layout = r),
            (this._buffers = i),
            (this._indexBuffer = o),
            (this._glName = null),
            (this._initialized = !1),
            e.instanceCounter.increment(y.R.VAO, this);
        }
        get glName() {
          return this._glName;
        }
        get vertexBuffers() {
          return this._buffers;
        }
        get indexBuffer() {
          return this._indexBuffer;
        }
        get size() {
          return Object.keys(this._buffers).reduce(
            (e, t) => e + this._buffers[t].size,
            (0, o.i)(this._indexBuffer) ? this._indexBuffer.size : 0,
          );
        }
        get layout() {
          return this._layout;
        }
        get locations() {
          return this._locations;
        }
        dispose(e = !0) {
          if (this._context) {
            if (this._glName) {
              var t, r;
              const e =
                null == (t = this._context) || null == (r = t.capabilities) ? void 0 : r.vao;
              e
                ? (e.deleteVertexArray(this._glName), (this._glName = null))
                : Me.warn('Leaked WebGL VAO');
            }
            if ((this._context.getBoundVAO() === this && this._context.bindVAO(null), e)) {
              for (const e in this._buffers) this._buffers[e].dispose(), delete this._buffers[e];
              this._indexBuffer = (0, o.l)(this._indexBuffer);
            }
            this._context.instanceCounter.decrement(y.R.VAO, this), (this._context = null);
          } else
            (this._glName || (e && Object.getOwnPropertyNames(this._buffers).length > 0)) &&
              Me.warn('Leaked WebGL VAO');
        }
        initialize() {
          if (this._initialized) return;
          const e = this._context.capabilities.vao;
          if (e) {
            const t = e.createVertexArray();
            e.bindVertexArray(t), this._bindLayout(), e.bindVertexArray(null), (this._glName = t);
          }
          this._initialized = !0;
        }
        bind() {
          this.initialize();
          const e = this._context.capabilities.vao;
          e ? e.bindVertexArray(this.glName) : (this._context.bindVAO(null), this._bindLayout());
        }
        _bindLayout() {
          const { _buffers: e, _layout: t, _indexBuffer: r } = this;
          e || Me.error('Vertex buffer dictionary is empty!');
          const i = this._context.gl;
          for (const r in e) {
            const i = e[r];
            i || Me.error('Vertex buffer is uninitialized!');
            const o = t[r];
            o || Me.error('Vertex element descriptor is empty!'),
              be(this._context, this._locations, i, o);
          }
          (0, o.i)(r) &&
            (this._context.capabilities.vao
              ? i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, r.glName)
              : this._context.bindBuffer(r));
        }
        unbind() {
          this.initialize();
          const e = this._context.capabilities.vao;
          e ? e.bindVertexArray(null) : this._unbindLayout();
        }
        _unbindLayout() {
          const { _buffers: e, _layout: t } = this;
          e || Me.error('Vertex buffer dictionary is empty!');
          for (const r in e) {
            const i = e[r];
            i || Me.error('Vertex buffer is uninitialized!');
            const o = t[r];
            _e(this._context, this._locations, i, o);
          }
          (0, o.i)(this._indexBuffer) && this._context.unbindBuffer(this._indexBuffer.bufferType);
        }
      }
      var Ae = [
          'layout',
          'centroid',
          'smooth',
          'case',
          'mat2x2',
          'mat2x3',
          'mat2x4',
          'mat3x2',
          'mat3x3',
          'mat3x4',
          'mat4x2',
          'mat4x3',
          'mat4x4',
          'uint',
          'uvec2',
          'uvec3',
          'uvec4',
          'samplerCubeShadow',
          'sampler2DArray',
          'sampler2DArrayShadow',
          'isampler2D',
          'isampler3D',
          'isamplerCube',
          'isampler2DArray',
          'usampler2D',
          'usampler3D',
          'usamplerCube',
          'usampler2DArray',
          'coherent',
          'restrict',
          'readonly',
          'writeonly',
          'resource',
          'atomic_uint',
          'noperspective',
          'patch',
          'sample',
          'subroutine',
          'common',
          'partition',
          'active',
          'filter',
          'image1D',
          'image2D',
          'image3D',
          'imageCube',
          'iimage1D',
          'iimage2D',
          'iimage3D',
          'iimageCube',
          'uimage1D',
          'uimage2D',
          'uimage3D',
          'uimageCube',
          'image1DArray',
          'image2DArray',
          'iimage1DArray',
          'iimage2DArray',
          'uimage1DArray',
          'uimage2DArray',
          'image1DShadow',
          'image2DShadow',
          'image1DArrayShadow',
          'image2DArrayShadow',
          'imageBuffer',
          'iimageBuffer',
          'uimageBuffer',
          'sampler1DArray',
          'sampler1DArrayShadow',
          'isampler1D',
          'isampler1DArray',
          'usampler1D',
          'usampler1DArray',
          'isampler2DRect',
          'usampler2DRect',
          'samplerBuffer',
          'isamplerBuffer',
          'usamplerBuffer',
          'sampler2DMS',
          'isampler2DMS',
          'usampler2DMS',
          'sampler2DMSArray',
          'isampler2DMSArray',
          'usampler2DMSArray',
          'trunc',
          'round',
          'roundEven',
          'isnan',
          'isinf',
          'floatBitsToInt',
          'floatBitsToUint',
          'intBitsToFloat',
          'uintBitsToFloat',
          'packSnorm2x16',
          'unpackSnorm2x16',
          'packUnorm2x16',
          'unpackUnorm2x16',
          'packHalf2x16',
          'unpackHalf2x16',
          'outerProduct',
          'transpose',
          'determinant',
          'inverse',
          'texture',
          'textureSize',
          'textureProj',
          'textureLod',
          'textureOffset',
          'texelFetch',
          'texelFetchOffset',
          'textureProjOffset',
          'textureLodOffset',
          'textureProjLod',
          'textureProjLodOffset',
          'textureGrad',
          'textureGradOffset',
          'textureProjGrad',
          'textureProjGradOffset',
        ],
        Se = [
          'block-comment',
          'line-comment',
          'preprocessor',
          'operator',
          'integer',
          'float',
          'ident',
          'builtin',
          'keyword',
          'whitespace',
          'eof',
          'integer',
        ];
      const Ce = [
        'GL_OES_standard_derivatives',
        'GL_EXT_frag_depth',
        'GL_EXT_draw_buffers',
        'GL_EXT_shader_texture_lod',
      ];
      function Ee(e, t) {
        for (let r = t - 1; r >= 0; r--) {
          const t = e[r];
          if ('whitespace' !== t.type && 'block-comment' !== t.type) {
            if ('keyword' !== t.type) break;
            if ('attribute' === t.data || 'in' === t.data) return !0;
          }
        }
        return !1;
      }
      function Pe(e, t, r, i) {
        i = i || r;
        for (const o of e)
          if ('ident' === o.type && o.data === r)
            return i in t ? t[i]++ : (t[i] = 0), Pe(e, t, i + '_' + t[i], i);
        return r;
      }
      function Fe(e, t, r = 'afterVersion') {
        function i(e, t) {
          for (let r = t; r < e.length; r++) {
            const t = e[r];
            if ('operator' === t.type && ';' === t.data) return r;
          }
          return null;
        }
        const o = { data: '\n', type: 'whitespace' },
          n = (t) => t < e.length && /[^\r\n]$/.test(e[t].data);
        let a = (function (e) {
          let t = -1,
            o = 0,
            n = -1;
          for (let a = 0; a < e.length; a++) {
            const s = e[a];
            if (
              ('preprocessor' === s.type &&
                (s.data.match(/\#(if|ifdef|ifndef)\s+.+/)
                  ? ++o
                  : s.data.match(/\#endif\s*.*/) && --o),
              ('afterVersion' !== r && 'afterPrecision' !== r) ||
                ('preprocessor' === s.type && /^#version/.test(s.data) && (n = Math.max(n, a))),
              'afterPrecision' === r && 'keyword' === s.type && 'precision' === s.data)
            ) {
              const t = i(e, a);
              if (null === t)
                throw new Error('precision statement not followed by any semicolons!');
              n = Math.max(n, t);
            }
            t < n && 0 === o && (t = a);
          }
          return t + 1;
        })(e);
        n(a - 1) && e.splice(a++, 0, o);
        for (const r of t) e.splice(a++, 0, r);
        n(a - 1) && n(a) && e.splice(a, 0, o);
      }
      function De(e, t, r, i = 'lowp') {
        Fe(
          e,
          [
            { type: 'keyword', data: 'out' },
            { type: 'whitespace', data: ' ' },
            { type: 'keyword', data: i },
            { type: 'whitespace', data: ' ' },
            { type: 'keyword', data: r },
            { type: 'whitespace', data: ' ' },
            { type: 'ident', data: t },
            { type: 'operator', data: ';' },
          ],
          'afterPrecision',
        );
      }
      function Re(e, t, r, i, o = 'lowp') {
        Fe(
          e,
          [
            { type: 'keyword', data: 'layout' },
            { type: 'operator', data: '(' },
            { type: 'keyword', data: 'location' },
            { type: 'whitespace', data: ' ' },
            { type: 'operator', data: '=' },
            { type: 'whitespace', data: ' ' },
            { type: 'integer', data: i.toString() },
            { type: 'operator', data: ')' },
            { type: 'whitespace', data: ' ' },
            { type: 'keyword', data: 'out' },
            { type: 'whitespace', data: ' ' },
            { type: 'keyword', data: o },
            { type: 'whitespace', data: ' ' },
            { type: 'keyword', data: r },
            { type: 'whitespace', data: ' ' },
            { type: 'ident', data: t },
            { type: 'operator', data: ';' },
          ],
          'afterPrecision',
        );
      }
      function Oe(e, t) {
        let r,
          i,
          o = -1;
        for (let n = t; n < e.length; n++) {
          const t = e[n];
          if ('operator' === t.type && ('[' === t.data && (r = n), ']' === t.data)) {
            i = n;
            break;
          }
          'integer' === t.type && (o = parseInt(t.data, 10));
        }
        return r && i && e.splice(r, i - r + 1), o;
      }
      class Le {
        constructor(e, t, r, i) {
          (this._context = e),
            (this._locations = i),
            (this._vShader = null),
            (this._fShader = null),
            (this._nameToUniformLocation = {}),
            (this._nameToUniform1 = {}),
            (this._nameToUniform1v = {}),
            (this._nameToUniform2 = {}),
            (this._nameToUniform3 = {}),
            (this._nameToUniform4 = {}),
            (this._nameToUniformMatrix3 = {}),
            (this._nameToUniformMatrix4 = {}),
            e || console.error("RenderingContext isn't initialized!"),
            0 === t.length && console.error('Shaders source should not be empty!'),
            (this._vShader = Ie(this._context, 35633, t)),
            (this._fShader = Ie(this._context, 35632, r)),
            (this._vShader && this._fShader) || console.error('Error loading shaders!');
          const o = this._context.gl,
            n = o.createProgram();
          o.attachShader(n, this._vShader),
            o.attachShader(n, this._fShader),
            i.forEach((e, t) => o.bindAttribLocation(n, e, t)),
            o.linkProgram(n),
            oe() &&
              !o.getProgramParameter(n, o.LINK_STATUS) &&
              console.error(
                'Could not initialize shader\nVALIDATE_STATUS: ' +
                  o.getProgramParameter(n, o.VALIDATE_STATUS) +
                  ', gl error [' +
                  o.getError() +
                  ']infoLog: ' +
                  o.getProgramInfoLog(n),
              ),
            (this._glName = n),
            this._context.instanceCounter.increment(y.R.Program, this);
        }
        get glName() {
          return this._glName;
        }
        dispose() {
          const e = this._context.gl;
          if (this._vShader) {
            const t = this._vShader;
            e.deleteShader(t), (this._vShader = null);
          }
          if (this._fShader) {
            const t = this._fShader;
            e.deleteShader(t), (this._fShader = null);
          }
          this._glName &&
            (e.deleteProgram(this._glName),
            (this._glName = null),
            this._context.instanceCounter.decrement(y.R.Program, this));
        }
        _getUniformLocation(e) {
          return (
            void 0 === this._nameToUniformLocation[e] &&
              (this._nameToUniformLocation[e] = this._context.gl.getUniformLocation(
                this._glName,
                e,
              )),
            this._nameToUniformLocation[e]
          );
        }
        hasUniform(e) {
          return null !== this._getUniformLocation(e);
        }
        setUniform1i(e, t) {
          const r = this._nameToUniform1[e];
          (void 0 !== r && t === r) ||
            (this._context.useProgram(this),
            this._context.gl.uniform1i(this._getUniformLocation(e), t),
            (this._nameToUniform1[e] = t));
        }
        setUniform1iv(e, t) {
          const r = this._nameToUniform1v[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform1iv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform1v[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform2iv(e, t) {
          const r = this._nameToUniform2[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform2iv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform2[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform3iv(e, t) {
          const r = this._nameToUniform3[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform3iv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform3[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform4iv(e, t) {
          const r = this._nameToUniform4[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform4iv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform4[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform1f(e, t) {
          const r = this._nameToUniform1[e];
          (void 0 !== r && t === r) ||
            (this._context.useProgram(this),
            this._context.gl.uniform1f(this._getUniformLocation(e), t),
            (this._nameToUniform1[e] = t));
        }
        setUniform1fv(e, t) {
          const r = this._nameToUniform1v[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform1fv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform1v[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform2f(e, t, r) {
          const i = this._nameToUniform2[e];
          (void 0 !== i && t === i[0] && r === i[1]) ||
            (this._context.useProgram(this),
            this._context.gl.uniform2f(this._getUniformLocation(e), t, r),
            void 0 === i ? (this._nameToUniform2[e] = [t, r]) : ((i[0] = t), (i[1] = r)));
        }
        setUniform2fv(e, t) {
          const r = this._nameToUniform2[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform2fv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform2[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform3f(e, t, r, i) {
          const o = this._nameToUniform3[e];
          (void 0 !== o && t === o[0] && r === o[1] && i === o[2]) ||
            (this._context.useProgram(this),
            this._context.gl.uniform3f(this._getUniformLocation(e), t, r, i),
            void 0 === o
              ? (this._nameToUniform3[e] = [t, r, i])
              : ((o[0] = t), (o[1] = r), (o[2] = i)));
        }
        setUniform3fv(e, t) {
          const r = this._nameToUniform3[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform3fv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform3[e] = Array.from(t)) : Ne(t, r));
        }
        setUniform4f(e, t, r, i, o) {
          const n = this._nameToUniform4[e];
          (void 0 !== n && t === n[0] && r === n[1] && i === n[2] && o === n[3]) ||
            (this._context.useProgram(this),
            this._context.gl.uniform4f(this._getUniformLocation(e), t, r, i, o),
            void 0 === n
              ? (this._nameToUniform4[e] = [t, r, i, o])
              : ((n[0] = t), (n[1] = r), (n[2] = i), (n[3] = o)));
        }
        setUniform4fv(e, t) {
          const r = this._nameToUniform4[e];
          ze(r, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniform4fv(this._getUniformLocation(e), t),
            void 0 === r ? (this._nameToUniform4[e] = Array.from(t)) : Ne(t, r));
        }
        setUniformMatrix3fv(e, t, r = !1) {
          const i = this._nameToUniformMatrix3[e];
          (function (e, t) {
            return (
              !!(0, o.b)(e) ||
              (9 !== e.length
                ? ze(e, t)
                : 9 !== e.length ||
                  e[0] !== t[0] ||
                  e[1] !== t[1] ||
                  e[2] !== t[2] ||
                  e[3] !== t[3] ||
                  e[4] !== t[4] ||
                  e[5] !== t[5] ||
                  e[6] !== t[6] ||
                  e[7] !== t[7] ||
                  e[8] !== t[8])
            );
          })(i, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniformMatrix3fv(this._getUniformLocation(e), r, t),
            void 0 === i ? (this._nameToUniformMatrix3[e] = Array.from(t)) : Ne(t, i));
        }
        setUniformMatrix4fv(e, t, r = !1) {
          const i = this._nameToUniformMatrix4[e];
          (function (e, t) {
            return (
              !!(0, o.b)(e) ||
              (16 !== e.length
                ? ze(e, t)
                : 16 !== e.length ||
                  e[0] !== t[0] ||
                  e[1] !== t[1] ||
                  e[2] !== t[2] ||
                  e[3] !== t[3] ||
                  e[4] !== t[4] ||
                  e[5] !== t[5] ||
                  e[6] !== t[6] ||
                  e[7] !== t[7] ||
                  e[8] !== t[8] ||
                  e[9] !== t[9] ||
                  e[10] !== t[10] ||
                  e[11] !== t[11] ||
                  e[12] !== t[12] ||
                  e[13] !== t[13] ||
                  e[14] !== t[14] ||
                  e[15] !== t[15])
            );
          })(i, t) &&
            (this._context.useProgram(this),
            this._context.gl.uniformMatrix4fv(this._getUniformLocation(e), r, t),
            void 0 === i ? (this._nameToUniformMatrix4[e] = Array.from(t)) : Ne(t, i));
        }
        assertCompatibleVertexAttributeLocations(e) {
          e.locations !== this._locations &&
            console.error('VertexAttributeLocations are incompatible');
        }
        stop() {}
      }
      function ze(e, t) {
        if ((0, o.b)(e) || e.length !== t.length) return !0;
        for (let r = 0; r < e.length; ++r) if (e[r] !== t[r]) return !0;
        return !1;
      }
      function Ie(e, t, r) {
        const i =
            'webgl2' === e.webglVersion
              ? (function (e, t) {
                  const r = (function (e) {
                    return (
                      (t = e),
                      (r = (function () {
                        var e,
                          t,
                          r,
                          i = 0,
                          o = 0,
                          n = 999,
                          a = [],
                          s = [],
                          l = 1,
                          c = 0,
                          d = 0,
                          u = !1,
                          h = !1,
                          f = '';
                        return function (t) {
                          return (
                            (s = []),
                            null !== t
                              ? (function (t) {
                                  var a;
                                  for (i = 0, r = (f += t).length; (e = f[i]), i < r; ) {
                                    switch (((a = i), n)) {
                                      case 0:
                                        i = x();
                                        break;
                                      case 1:
                                      case 2:
                                        i = v();
                                        break;
                                      case 3:
                                        i = b();
                                        break;
                                      case 4:
                                        i = y();
                                        break;
                                      case 11:
                                        i = T();
                                        break;
                                      case 5:
                                        i = M();
                                        break;
                                      case 9999:
                                        i = w();
                                        break;
                                      case 9:
                                        i = g();
                                        break;
                                      case 999:
                                        i = p();
                                    }
                                    if (a !== i)
                                      switch (f[a]) {
                                        case '\n':
                                          (c = 0), ++l;
                                          break;
                                        default:
                                          ++c;
                                      }
                                  }
                                  return (o += i), (f = f.slice(i)), s;
                                })(t.replace ? t.replace(/\r\n/g, '\n') : t)
                              : (a.length && m(a.join('')), (n = 10), m('(eof)'), s)
                          );
                        };
                        function m(e) {
                          e.length &&
                            s.push({ type: Se[n], data: e, position: d, line: l, column: c });
                        }
                        function p() {
                          return (
                            (a = a.length ? [] : a),
                            '/' === t && '*' === e
                              ? ((d = o + i - 1), (n = 0), (t = e), i + 1)
                              : '/' === t && '/' === e
                              ? ((d = o + i - 1), (n = 1), (t = e), i + 1)
                              : '#' === e
                              ? ((n = 2), (d = o + i), i)
                              : /\s/.test(e)
                              ? ((n = 9), (d = o + i), i)
                              : ((u = /\d/.test(e)),
                                (h = /[^\w_]/.test(e)),
                                (d = o + i),
                                (n = u ? 4 : h ? 3 : 9999),
                                i)
                          );
                        }
                        function g() {
                          return /[^\s]/g.test(e)
                            ? (m(a.join('')), (n = 999), i)
                            : (a.push(e), (t = e), i + 1);
                        }
                        function v() {
                          return ('\r' !== e && '\n' !== e) || '\\' === t
                            ? (a.push(e), (t = e), i + 1)
                            : (m(a.join('')), (n = 999), i);
                        }
                        function x() {
                          return '/' === e && '*' === t
                            ? (a.push(e), m(a.join('')), (n = 999), i + 1)
                            : (a.push(e), (t = e), i + 1);
                        }
                        function b() {
                          if ('.' === t && /\d/.test(e)) return (n = 5), i;
                          if ('/' === t && '*' === e) return (n = 0), i;
                          if ('/' === t && '/' === e) return (n = 1), i;
                          if ('.' === e && a.length) {
                            for (; _(a); );
                            return (n = 5), i;
                          }
                          if (';' === e || ')' === e || '(' === e) {
                            if (a.length) for (; _(a); );
                            return m(e), (n = 999), i + 1;
                          }
                          var r = 2 === a.length && '=' !== e;
                          if (/[\w_\d\s]/.test(e) || r) {
                            for (; _(a); );
                            return (n = 999), i;
                          }
                          return a.push(e), (t = e), i + 1;
                        }
                        function _(e) {
                          for (var t, r, i = 0; ; ) {
                            if (
                              ((t = he.indexOf(e.slice(0, e.length + i).join(''))),
                              (r = he[t]),
                              -1 === t)
                            ) {
                              if (i-- + e.length > 0) continue;
                              r = e.slice(0, 1).join('');
                            }
                            return m(r), (d += r.length), (a = a.slice(r.length)).length;
                          }
                        }
                        function T() {
                          return /[^a-fA-F0-9]/.test(e)
                            ? (m(a.join('')), (n = 999), i)
                            : (a.push(e), (t = e), i + 1);
                        }
                        function y() {
                          return '.' === e || /[eE]/.test(e)
                            ? (a.push(e), (n = 5), (t = e), i + 1)
                            : 'x' === e && 1 === a.length && '0' === a[0]
                            ? ((n = 11), a.push(e), (t = e), i + 1)
                            : /[^\d]/.test(e)
                            ? (m(a.join('')), (n = 999), i)
                            : (a.push(e), (t = e), i + 1);
                        }
                        function M() {
                          return (
                            'f' === e && (a.push(e), (t = e), (i += 1)),
                            /[eE]/.test(e) || ('-' === e && /[eE]/.test(t))
                              ? (a.push(e), (t = e), i + 1)
                              : /[^\d]/.test(e)
                              ? (m(a.join('')), (n = 999), i)
                              : (a.push(e), (t = e), i + 1)
                          );
                        }
                        function w() {
                          if (/[^\d\w_]/.test(e)) {
                            var r = a.join('');
                            return (
                              (n = le.indexOf(r) > -1 ? 8 : me.indexOf(r) > -1 ? 7 : 6),
                              m(a.join('')),
                              (n = 999),
                              i
                            );
                          }
                          return a.push(e), (t = e), i + 1;
                        }
                      })()),
                      [].concat(r(t)).concat(r(null))
                    );
                    var t, r;
                  })(e);
                  if (
                    '300 es' ===
                    (function (e, t = '100', r = '300 es') {
                      const i = /^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;
                      for (const o of e)
                        if ('preprocessor' === o.type) {
                          const e = i.exec(o.data);
                          if (e) {
                            const i = e[1].replace(/\s\s+/g, ' ');
                            if (i === r) return i;
                            if (i === t) return (o.data = '#version ' + r), t;
                            throw new Error('unknown glsl version: ' + i);
                          }
                        }
                      return (
                        e.splice(
                          0,
                          0,
                          { type: 'preprocessor', data: '#version ' + r },
                          { type: 'whitespace', data: '\n' },
                        ),
                        null
                      );
                    })(r, '100', '300 es')
                  )
                    throw new Error('shader is already glsl 300 es');
                  let i = null,
                    o = null;
                  const n = {},
                    a = {};
                  for (let e = 0; e < r.length; ++e) {
                    const s = r[e];
                    switch (s.type) {
                      case 'keyword':
                        35633 === t && 'attribute' === s.data
                          ? (s.data = 'in')
                          : 'varying' === s.data && (s.data = 35633 === t ? 'out' : 'in');
                        break;
                      case 'builtin':
                        if (
                          (/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(s.data.trim()) &&
                            (s.data = s.data.replace(/(2D|Cube|EXT)/g, '')),
                          35632 === t &&
                            'gl_FragColor' === s.data &&
                            (i || ((i = Pe(r, n, 'fragColor')), De(r, i, 'vec4')), (s.data = i)),
                          35632 === t && 'gl_FragData' === s.data)
                        ) {
                          const t = Oe(r, e + 1),
                            i = Pe(r, n, 'fragData');
                          Re(r, i, 'vec4', t, 'mediump'), (s.data = i);
                        } else
                          35632 === t &&
                            'gl_FragDepthEXT' === s.data &&
                            (o || (o = Pe(r, n, 'gl_FragDepth')), (s.data = o));
                        break;
                      case 'ident':
                        if (Ae.indexOf(s.data) >= 0) {
                          if (35633 === t && Ee(r, e))
                            throw new Error(
                              'attribute in vertex shader uses a name that is a reserved word in glsl 300 es',
                            );
                          s.data in a || (a[s.data] = Pe(r, n, s.data)), (s.data = a[s.data]);
                        }
                    }
                  }
                  for (let e = r.length - 1; e >= 0; --e) {
                    const t = r[e];
                    if ('preprocessor' === t.type) {
                      const i = t.data.match(/\#extension\s+(.*)\:/);
                      if (i && i[1] && Ce.indexOf(i[1].trim()) >= 0) {
                        const t = r[e + 1];
                        r.splice(e, t && 'whitespace' === t.type ? 2 : 1);
                      }
                      const o = t.data.match(/\#ifdef\s+(.*)/);
                      o && o[1] && Ce.indexOf(o[1].trim()) >= 0 && (t.data = '#if 1');
                      const n = t.data.match(/\#ifndef\s+(.*)/);
                      n && n[1] && Ce.indexOf(n[1].trim()) >= 0 && (t.data = '#if 0');
                    }
                  }
                  return (function (e) {
                    return e.map((e) => ('eof' !== e.type ? e.data : '')).join('');
                  })(r);
                })(r, t)
              : r,
          o = e.gl,
          n = o.createShader(t);
        return (
          o.shaderSource(n, i),
          o.compileShader(n),
          oe() &&
            !o.getShaderParameter(n, o.COMPILE_STATUS) &&
            (console.error(
              'Compile error in '.concat(35633 === t ? 'vertex' : 'fragment', ' shader'),
            ),
            console.error(o.getShaderInfoLog(n)),
            console.error(
              (function (e) {
                let t = 2;
                return e.replace(
                  /\n/g,
                  () =>
                    '\n' +
                    (function (e) {
                      return e >= 1e3 ? e.toString() : ('  ' + e).slice(-3);
                    })(t++) +
                    ':',
                );
              })(i),
            ),
            'webgl2' === e.webglVersion &&
              (console.log('Shader source before transpilation:'), console.log(r))),
          n
        );
      }
      function Ne(e, t) {
        for (let r = 0; r < e.length; ++r) t[r] = e[r];
      }
      function Be() {
        const e = new Float32Array(16);
        return (e[0] = 1), (e[5] = 1), (e[10] = 1), (e[15] = 1), e;
      }
      Be();
      var Ue = r(7200),
        Ve = r(68681);
      (0, Ve.a)();
      class He {
        constructor(e) {
          this.message = e;
        }
        toString() {
          return `AssertException: ${this.message}`;
        }
      }
      function ke(e, t) {
        if (!e) {
          t = t || 'assert';
          const e = new Error(t);
          throw (e.stack && console.log(e.stack), new He(t));
        }
      }
      function Ge(e, t = 0) {
        let r = 0;
        for (let i = 0; i < 4; i++) r += e[t + i] * We[i];
        return r;
      }
      const We = [1 / 256, 1 / 65536, 1 / 16777216, 1 / 4294967296];
      Ge(new Uint8ClampedArray([255, 255, 255, 255]));
      var qe = r(42788);
      class $e {
        constructor() {
          this.id = (0, qe.g)();
        }
        unload() {}
      }
      function je(e, t, r) {
        for (let i = 0; i < r; ++i) (t[2 * i] = e[i]), (t[2 * i + 1] = e[i] - t[2 * i]);
      }
      const Xe = new Float64Array(1),
        Ke = new Float32Array(2);
      new Float64Array(3), new Float32Array(6), (0, l.c)();
      var Ze = r(14049);
      function Ye(e, ...t) {
        let r = '';
        for (let i = 0; i < t.length; i++) r += e[i] + t[i];
        return (r += e[e.length - 1]), r;
      }
      function Qe(e, t) {
        t.linearDepth
          ? e.vertex.code
              .add(Ye`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) {
vec4 eye = view * vec4(pos, 1.0);
depth = (-eye.z - nearFar[0]) / (nearFar[1] - nearFar[0]) ;
return proj * eye;
}`)
          : e.vertex.code.add(Ye`vec4 transformPosition(mat4 proj, mat4 view, vec3 pos) {
return proj * (view * vec4(pos, 1.0));
}`);
      }
      !(function (e) {
        (e.int = function (e) {
          return Math.round(e).toString();
        }),
          (e.float = function (e) {
            return e.toPrecision(8);
          });
      })(Ye || (Ye = {}));
      const Je = v.L.getLogger('esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder');
      class et {
        constructor() {
          this.includedModules = new Map();
        }
        include(e, t) {
          this.includedModules.has(e)
            ? this.includedModules.get(e) !== t &&
              Je.error(
                'Trying to include shader module multiple times with different sets of options.',
              )
            : (this.includedModules.set(e, t), e(this.builder, t));
        }
      }
      class tt extends et {
        constructor() {
          super(...arguments),
            (this.vertex = new ot()),
            (this.fragment = new ot()),
            (this.attributes = new nt()),
            (this.varyings = new at()),
            (this.extensions = new st()),
            (this.constants = new lt());
        }
        get fragmentUniforms() {
          return this.fragment.uniforms;
        }
        get builder() {
          return this;
        }
        generateSource(e) {
          const t = this.extensions.generateSource(e),
            r = this.attributes.generateSource(e),
            i = this.varyings.generateSource(),
            o = 'vertex' === e ? this.vertex : this.fragment,
            n = o.uniforms.generateSource(),
            a = o.code.generateSource(),
            s = 'vertex' === e ? dt : ct,
            l = this.constants.generateSource().concat(o.constants.generateSource());
          return `\n${t.join('\n')}\n\n${s}\n\n${l.join('\n')}\n\n${n.join('\n')}\n\n${r.join(
            '\n',
          )}\n\n${i.join('\n')}\n\n${a.join('\n')}`;
        }
      }
      class rt {
        constructor() {
          this._entries = new Map();
        }
        add(e, t, r) {
          const i = `${e}_${t}_${r}`;
          return this._entries.set(i, { name: e, type: t, arraySize: r }), this;
        }
        generateSource() {
          return Array.from(this._entries.values()).map((e) => {
            return `uniform ${e.type} ${e.name}${((t = e.arraySize), t ? `[${t}]` : '')};`;
            var t;
          });
        }
        get entries() {
          return Array.from(this._entries.values());
        }
      }
      class it {
        constructor() {
          this._entries = new Array();
        }
        add(e) {
          this._entries.push(e);
        }
        generateSource() {
          return this._entries;
        }
      }
      class ot extends et {
        constructor() {
          super(...arguments),
            (this.uniforms = new rt()),
            (this.code = new it()),
            (this.constants = new lt());
        }
        get builder() {
          return this;
        }
      }
      class nt {
        constructor() {
          this._entries = new Array();
        }
        add(e, t) {
          this._entries.push([e, t]);
        }
        generateSource(e) {
          return 'fragment' === e ? [] : this._entries.map((e) => `attribute ${e[1]} ${e[0]};`);
        }
      }
      class at {
        constructor() {
          this._entries = new Array();
        }
        add(e, t) {
          this._entries.push([e, t]);
        }
        generateSource() {
          return this._entries.map((e) => `varying ${e[1]} ${e[0]};`);
        }
      }
      class st {
        constructor() {
          this._entries = new Set();
        }
        add(e) {
          this._entries.add(e);
        }
        generateSource(e) {
          const t = 'vertex' === e ? st.ALLOWLIST_VERTEX : st.ALLOWLIST_FRAGMENT;
          return Array.from(this._entries)
            .filter((e) => t.includes(e))
            .map((e) => `#extension ${e} : enable`);
        }
      }
      (st.ALLOWLIST_FRAGMENT = ['GL_EXT_shader_texture_lod', 'GL_OES_standard_derivatives']),
        (st.ALLOWLIST_VERTEX = []);
      class lt {
        constructor() {
          this._entries = [];
        }
        add(e, t, r) {
          let i = 'ERROR_CONSTRUCTOR_STRING';
          switch (t) {
            case 'float':
              i = lt.numberToFloatStr(r);
              break;
            case 'int':
              i = lt.numberToIntStr(r);
              break;
            case 'bool':
              i = r.toString();
              break;
            case 'vec2':
              i = `vec2(${lt.numberToFloatStr(
                r[0],
              )},                            ${lt.numberToFloatStr(r[1])})`;
              break;
            case 'vec3':
              i = `vec3(${lt.numberToFloatStr(
                r[0],
              )},                            ${lt.numberToFloatStr(
                r[1],
              )},                            ${lt.numberToFloatStr(r[2])})`;
              break;
            case 'vec4':
              i = `vec4(${lt.numberToFloatStr(
                r[0],
              )},                            ${lt.numberToFloatStr(
                r[1],
              )},                            ${lt.numberToFloatStr(
                r[2],
              )},                            ${lt.numberToFloatStr(r[3])})`;
              break;
            case 'ivec2':
              i = `ivec2(${lt.numberToIntStr(
                r[0],
              )},                             ${lt.numberToIntStr(r[1])})`;
              break;
            case 'ivec3':
              i = `ivec3(${lt.numberToIntStr(
                r[0],
              )},                             ${lt.numberToIntStr(
                r[1],
              )},                             ${lt.numberToIntStr(r[2])})`;
              break;
            case 'ivec4':
              i = `ivec4(${lt.numberToIntStr(
                r[0],
              )},                             ${lt.numberToIntStr(
                r[1],
              )},                             ${lt.numberToIntStr(
                r[2],
              )},                             ${lt.numberToIntStr(r[3])})`;
              break;
            case 'mat2':
            case 'mat3':
            case 'mat4':
              i = `${t}(${Array.prototype.map.call(r, (e) => lt.numberToFloatStr(e)).join(', ')})`;
          }
          return this._entries.push(`const ${t} ${e} = ${i};`), this;
        }
        static numberToIntStr(e) {
          return e.toFixed(0);
        }
        static numberToFloatStr(e) {
          return Number.isInteger(e) ? e.toFixed(1) : e.toString();
        }
        generateSource() {
          return Array.from(this._entries);
        }
      }
      const ct =
          '#ifdef GL_FRAGMENT_PRECISION_HIGH\n  precision highp float;\n  precision highp sampler2D;\n#else\n  precision mediump float;\n  precision mediump sampler2D;\n#endif',
        dt = 'precision highp float;\nprecision highp sampler2D;';
      class ut {
        constructor(e, t) {
          (this._module = e), (this._loadModule = t);
        }
        get() {
          return this._module;
        }
        async reload() {
          return (this._module = await this._loadModule()), this._module;
        }
      }
      function ht(e = {}) {
        return (t, r) => {
          var i, o;
          (t._parameterNames = null != (i = t._parameterNames) ? i : []), t._parameterNames.push(r);
          const n = t._parameterNames.length - 1,
            a = e.count || 2,
            s = Math.ceil((0, c.H)(a)),
            l = null != (o = t._parameterBits) ? o : [0];
          let d = 0;
          for (; l[d] + s > 16; ) d++, d >= l.length && l.push(0);
          t._parameterBits = l;
          const u = l[d],
            h = ((1 << s) - 1) << u;
          (l[d] += s),
            Object.defineProperty(t, r, {
              get() {
                return this[n];
              },
              set(e) {
                if (
                  this[n] !== e &&
                  ((this[n] = e),
                  (this._keyDirty = !0),
                  (this._parameterBits[d] = (this._parameterBits[d] & ~h) | ((+e << u) & h)),
                  'number' != typeof e && 'boolean' != typeof e)
                )
                  throw (
                    'Configuration value for ' + r + ' must be boolean or number, got ' + typeof e
                  );
              },
            });
        };
      }
      const ft = new Map([
        ['position', 0],
        ['normal', 1],
        ['uv0', 2],
        ['color', 3],
        ['size', 4],
        ['tangent', 4],
        ['auxpos1', 5],
        ['symbolColor', 5],
        ['auxpos2', 6],
        ['featureAttribute', 6],
        ['instanceFeatureAttribute', 6],
        ['instanceColor', 7],
        ['model', 8],
        ['modelNormal', 12],
        ['modelOriginHi', 11],
        ['modelOriginLo', 15],
      ]);
      class mt extends Le {
        constructor(e, t, r) {
          super(e, t.generateSource('vertex'), t.generateSource('fragment'), r),
            (this._textures = new Map()),
            (this._freeTextureUnits = new T.P({ deallocator: null })),
            (this._fragmentUniforms = ie() ? t.fragmentUniforms.entries : null);
        }
        stop() {
          this._textures.clear(), this._freeTextureUnits.clear();
        }
        bindTexture(e, t) {
          if ((0, o.b)(e) || null == e.glName) {
            const e = this._textures.get(t);
            return (
              e &&
                (this._context.bindTexture(null, e.unit),
                this._freeTextureUnit(e),
                this._textures.delete(t)),
              null
            );
          }
          let r = this._textures.get(t);
          return (
            null == r
              ? ((r = this._allocTextureUnit(e)), this._textures.set(t, r))
              : (r.texture = e),
            this._context.useProgram(this),
            this.setUniform1i(t, r.unit),
            this._context.bindTexture(e, r.unit),
            r.unit
          );
        }
        rebindTextures() {
          this._context.useProgram(this),
            this._textures.forEach((e, t) => {
              this._context.bindTexture(e.texture, e.unit), this.setUniform1i(t, e.unit);
            }),
            (0, o.i)(this._fragmentUniforms) &&
              this._fragmentUniforms.forEach((e) => {
                if (
                  ('sampler2D' === e.type || 'samplerCube' === e.type) &&
                  !this._textures.has(e.name)
                )
                  throw new Error(`Texture sampler ${e.name} has no bound texture`);
              });
        }
        _allocTextureUnit(e) {
          return {
            texture: e,
            unit:
              0 === this._freeTextureUnits.length
                ? this._textures.size
                : this._freeTextureUnits.pop(),
          };
        }
        _freeTextureUnit(e) {
          this._freeTextureUnits.push(e.unit);
        }
      }
      const pt = Be();
      class gt {
        constructor(e, t, r, i) {
          (this.primitiveIndices = e),
            (this._numIndexPerPrimitive = t),
            (this.indices = r),
            (this.position = i),
            (this.center = (0, c.b)()),
            ke(e.length >= 1),
            ke(r.length % this._numIndexPerPrimitive == 0),
            ke(r.length >= e.length * this._numIndexPerPrimitive),
            ke(3 === i.size || 4 === i.size);
          const { data: o, size: n } = i,
            a = e.length;
          let s = n * r[this._numIndexPerPrimitive * e[0]];
          vt.clear(),
            vt.push(s),
            (this.bbMin = (0, c.p)(o[s], o[s + 1], o[s + 2])),
            (this.bbMax = (0, c.u)(this.bbMin));
          for (let t = 0; t < a; ++t) {
            const i = this._numIndexPerPrimitive * e[t];
            for (let e = 0; e < this._numIndexPerPrimitive; ++e) {
              (s = n * r[i + e]), vt.push(s);
              let t = o[s];
              (this.bbMin[0] = Math.min(t, this.bbMin[0])),
                (this.bbMax[0] = Math.max(t, this.bbMax[0])),
                (t = o[s + 1]),
                (this.bbMin[1] = Math.min(t, this.bbMin[1])),
                (this.bbMax[1] = Math.max(t, this.bbMax[1])),
                (t = o[s + 2]),
                (this.bbMin[2] = Math.min(t, this.bbMin[2])),
                (this.bbMax[2] = Math.max(t, this.bbMax[2]));
            }
          }
          (0, c.h)(this.center, this.bbMin, this.bbMax, 0.5),
            (this.radius =
              0.5 *
              Math.max(
                Math.max(this.bbMax[0] - this.bbMin[0], this.bbMax[1] - this.bbMin[1]),
                this.bbMax[2] - this.bbMin[2],
              ));
          let l = this.radius * this.radius;
          for (let e = 0; e < vt.length; ++e) {
            s = vt.getItemAt(e);
            const t = o[s] - this.center[0],
              r = o[s + 1] - this.center[1],
              i = o[s + 2] - this.center[2],
              n = t * t + r * r + i * i;
            if (n <= l) continue;
            const a = Math.sqrt(n),
              c = 0.5 * (a - this.radius);
            (this.radius = this.radius + c), (l = this.radius * this.radius);
            const d = c / a;
            (this.center[0] += t * d), (this.center[1] += r * d), (this.center[2] += i * d);
          }
          vt.clear();
        }
        getCenter() {
          return this.center;
        }
        getBSRadius() {
          return this.radius;
        }
        getBBMin() {
          return this.bbMin;
        }
        getBBMax() {
          return this.bbMax;
        }
        getChildren() {
          if (this._children) return this._children;
          if ((0, c.o)(this.bbMin, this.bbMax) > 1) {
            const e = (0, c.h)((0, c.b)(), this.bbMin, this.bbMax, 0.5),
              t = this.primitiveIndices.length,
              r = new Uint8Array(t),
              i = new Array(8);
            for (let e = 0; e < 8; ++e) i[e] = 0;
            const { data: o, size: n } = this.position;
            for (let a = 0; a < t; ++a) {
              let t = 0;
              const s = this._numIndexPerPrimitive * this.primitiveIndices[a];
              let l = n * this.indices[s],
                c = o[l],
                d = o[l + 1],
                u = o[l + 2];
              for (let e = 1; e < this._numIndexPerPrimitive; ++e) {
                l = n * this.indices[s + e];
                const t = o[l],
                  r = o[l + 1],
                  i = o[l + 2];
                t < c && (c = t), r < d && (d = r), i < u && (u = i);
              }
              c < e[0] && (t |= 1), d < e[1] && (t |= 2), u < e[2] && (t |= 4), (r[a] = t), ++i[t];
            }
            let a = 0;
            for (let e = 0; e < 8; ++e) i[e] > 0 && ++a;
            if (a < 2) return;
            const s = new Array(8);
            for (let e = 0; e < 8; ++e) s[e] = i[e] > 0 ? new Uint32Array(i[e]) : void 0;
            for (let e = 0; e < 8; ++e) i[e] = 0;
            for (let e = 0; e < t; ++e) {
              const t = r[e];
              s[t][i[t]++] = this.primitiveIndices[e];
            }
            this._children = new Array(8);
            for (let e = 0; e < 8; ++e)
              void 0 !== s[e] &&
                (this._children[e] = new gt(
                  s[e],
                  this._numIndexPerPrimitive,
                  this.indices,
                  this.position,
                ));
          }
          return this._children;
        }
        static prune() {
          vt.prune();
        }
      }
      const vt = new T.P({ deallocator: null });
      class xt extends $e {
        constructor(e, t = [], r = 0, i = -1) {
          super(),
            (this._primitiveType = r),
            (this.edgeIndicesLength = i),
            (this.type = 2),
            (this._vertexAttributes = new Map()),
            (this._indices = new Map()),
            (this._boundingInfo = null);
          for (const [t, r] of e) r && this._vertexAttributes.set(t, { ...r });
          if (null == t || 0 === t.length) {
            const e = (function (e) {
                const t = e.values().next().value;
                return null == t ? 0 : t.data.length / t.size;
              })(this._vertexAttributes),
              t = (0, Ze.g)(e);
            this.edgeIndicesLength = this.edgeIndicesLength < 0 ? e : this.edgeIndicesLength;
            for (const e of this._vertexAttributes.keys()) this._indices.set(e, t);
          } else
            for (const [e, r] of t)
              r &&
                (this._indices.set(e, bt(r)),
                'position' === e &&
                  (this.edgeIndicesLength =
                    this.edgeIndicesLength < 0
                      ? this._indices.get(e).length
                      : this.edgeIndicesLength));
        }
        get vertexAttributes() {
          return this._vertexAttributes;
        }
        getMutableAttribute(e) {
          const t = this._vertexAttributes.get(e);
          return t && !t.exclusive && ((t.data = Array.from(t.data)), (t.exclusive = !0)), t;
        }
        get indices() {
          return this._indices;
        }
        get indexCount() {
          const e = this._indices.values().next().value;
          return e ? e.length : 0;
        }
        get primitiveType() {
          return this._primitiveType;
        }
        get faceCount() {
          return this.indexCount / 3;
        }
        get boundingInfo() {
          return (
            (0, o.b)(this._boundingInfo) && (this._boundingInfo = this._calculateBoundingInfo()),
            this._boundingInfo
          );
        }
        computeAttachmentOrigin(e) {
          return 0 === this.primitiveType
            ? this.computeAttachmentOriginTriangles(e)
            : this.computeAttachmentOriginPoints(e);
        }
        computeAttachmentOriginTriangles(e) {
          const t = this.indices.get('position'),
            r = this.vertexAttributes.get('position');
          return (0, Ze.a)(r, t, e);
        }
        computeAttachmentOriginPoints(e) {
          const t = this.indices.get('position'),
            r = this.vertexAttributes.get('position');
          return (0, Ze.b)(r, t, e);
        }
        invalidateBoundingInfo() {
          this._boundingInfo = null;
        }
        _calculateBoundingInfo() {
          const e = this.indices.get('position');
          if (0 === e.length) return null;
          const t = 0 === this.primitiveType ? 3 : 1;
          ke(e.length % t == 0, 'Indexing error: ' + e.length + ' not divisible by ' + t);
          const r = (0, Ze.g)(e.length / t),
            i = this.vertexAttributes.get('position');
          return new gt(r, t, e, i);
        }
      }
      function bt(e) {
        if (e.BYTES_PER_ELEMENT === Uint16Array.BYTES_PER_ELEMENT) return e;
        for (const t of e) if (t >= 65536) return e;
        return new Uint16Array(e);
      }
      function _t(e) {
        e.code.add(Ye`vec4 premultiplyAlpha(vec4 v) {
return vec4(v.rgb * v.a, v.a);
}
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), min(d / (q.x + e), 1.0), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
float rgb2v(vec3 c) {
return max(c.x, max(c.y, c.z));
}`);
      }
      const Tt = [{ name: 'position', count: 2, type: 5126, offset: 0, stride: 8, normalized: !1 }],
        yt = [
          { name: 'position', count: 2, type: 5126, offset: 0, stride: 16, normalized: !1 },
          { name: 'uv0', count: 2, type: 5126, offset: 8, stride: 16, normalized: !1 },
        ];
      (0, c.k)(10), (0, c.k)(12), (0, c.k)(70), (0, c.k)(40);
      const Mt = { scale: 0, factor: 0, minPixelSize: 0, paddingPixels: 0 },
        wt = (e) =>
          class extends e {
            constructor() {
              super(...arguments), (this._isDisposed = !1);
            }
            dispose() {
              for (const t of null != (e = this._managedDisposables) ? e : []) {
                var e;
                const r = this[t];
                (this[t] = null), r && 'function' == typeof r.dispose && r.dispose();
              }
              this._isDisposed = !0;
            }
            get isDisposed() {
              return this._isDisposed;
            }
          };
      class At extends wt(class {}) {}
      class St extends At {
        constructor(e) {
          super(),
            (this._material = e.material),
            (this._techniqueRep = e.techniqueRep),
            (this._output = e.output);
        }
        get technique() {
          return this._technique;
        }
        getPipelineState(e, t) {
          return this.technique.pipeline;
        }
        ensureResources(e) {
          return 2;
        }
        ensureParameters(e) {}
      }
      const Ct = (0, d.c)();
      function Et(e, t, r, i, n, a, s) {
        if (
          !(function (e) {
            return !!(0, o.i)(e) && !e.visible;
          })(t)
        )
          if (e.boundingInfo) {
            ke(0 === e.primitiveType);
            const t = r.tolerance;
            Ft(e.boundingInfo, i, n, t, a, s);
          } else {
            const t = e.indices.get('position'),
              r = e.vertexAttributes.get('position');
            Rt(i, n, 0, t.length / 3, t, r, void 0, a, s);
          }
      }
      const Pt = (0, c.b)();
      function Ft(e, t, r, i, n, a) {
        if ((0, o.b)(e)) return;
        const s = (function (e, t, r) {
          return (0, c.e)(r, 1 / (t[0] - e[0]), 1 / (t[1] - e[1]), 1 / (t[2] - e[2]));
        })(t, r, Pt);
        if (
          ((0, d.m)(Ct, e.getBBMin()),
          (0, d.n)(Ct, e.getBBMax()),
          (0, o.i)(n) && n.applyToAabb(Ct),
          (function (e, t, r, i) {
            return (function (e, t, r, i, o) {
              const n = (e[0] - i - t[0]) * r[0],
                a = (e[3] + i - t[0]) * r[0];
              let s = Math.min(n, a),
                l = Math.max(n, a);
              const c = (e[1] - i - t[1]) * r[1],
                d = (e[4] + i - t[1]) * r[1];
              if (((l = Math.min(l, Math.max(c, d))), l < 0)) return !1;
              if (((s = Math.max(s, Math.min(c, d))), s > l)) return !1;
              const u = (e[2] - i - t[2]) * r[2],
                h = (e[5] + i - t[2]) * r[2];
              return (
                (l = Math.min(l, Math.max(u, h))),
                !(l < 0) && ((s = Math.max(s, Math.min(u, h))), !(s > l) && s < 1 / 0)
              );
            })(e, t, r, i);
          })(Ct, t, s, i))
        ) {
          const { primitiveIndices: o, indices: s, position: l } = e,
            c = o ? o.length : s.length / 3;
          if (c > Ut) {
            const o = e.getChildren();
            if (void 0 !== o) {
              for (let e = 0; e < 8; ++e) void 0 !== o[e] && Ft(o[e], t, r, i, n, a);
              return;
            }
          }
          Rt(t, r, 0, c, s, l, o, n, a);
        }
      }
      const Dt = (0, c.b)();
      function Rt(e, t, r, i, n, a, s, l, c) {
        if (s)
          return (function (e, t, r, i, n, a, s, l, c) {
            const d = a.data,
              u = a.stride || a.size,
              h = e[0],
              f = e[1],
              m = e[2],
              p = t[0] - h,
              g = t[1] - f,
              v = t[2] - m;
            for (let e = r; e < i; ++e) {
              const t = s[e];
              let r = 3 * t,
                i = u * n[r++],
                a = d[i++],
                x = d[i++],
                b = d[i];
              i = u * n[r++];
              let _ = d[i++],
                T = d[i++],
                y = d[i];
              i = u * n[r];
              let M = d[i++],
                w = d[i++],
                A = d[i];
              (0, o.i)(l) &&
                (([a, x, b] = l.applyToVertex(a, x, b, e)),
                ([_, T, y] = l.applyToVertex(_, T, y, e)),
                ([M, w, A] = l.applyToVertex(M, w, A, e)));
              const S = _ - a,
                C = T - x,
                E = y - b,
                P = M - a,
                F = w - x,
                D = A - b,
                R = g * D - F * v,
                O = v * P - D * p,
                L = p * F - P * g,
                z = S * R + C * O + E * L;
              if (Math.abs(z) <= Number.EPSILON) continue;
              const I = h - a,
                N = f - x,
                B = m - b,
                U = I * R + N * O + B * L;
              if (z > 0) {
                if (U < 0 || U > z) continue;
              } else if (U > 0 || U < z) continue;
              const V = N * E - C * B,
                H = B * S - E * I,
                k = I * C - S * N,
                G = p * V + g * H + v * k;
              if (z > 0) {
                if (G < 0 || U + G > z) continue;
              } else if (G > 0 || U + G < z) continue;
              const W = (P * V + F * H + D * k) / z;
              W >= 0 && c(W, zt(S, C, E, P, F, D, Dt), t);
            }
          })(e, t, r, i, n, a, s, l, c);
        const d = a.data,
          u = a.stride || a.size,
          h = e[0],
          f = e[1],
          m = e[2],
          p = t[0] - h,
          g = t[1] - f,
          v = t[2] - m;
        for (let e = r, t = 3 * r; e < i; ++e) {
          let r = u * n[t++],
            i = d[r++],
            a = d[r++],
            s = d[r];
          r = u * n[t++];
          let x = d[r++],
            b = d[r++],
            _ = d[r];
          r = u * n[t++];
          let T = d[r++],
            y = d[r++],
            M = d[r];
          (0, o.i)(l) &&
            (([i, a, s] = l.applyToVertex(i, a, s, e)),
            ([x, b, _] = l.applyToVertex(x, b, _, e)),
            ([T, y, M] = l.applyToVertex(T, y, M, e)));
          const w = x - i,
            A = b - a,
            S = _ - s,
            C = T - i,
            E = y - a,
            P = M - s,
            F = g * P - E * v,
            D = v * C - P * p,
            R = p * E - C * g,
            O = w * F + A * D + S * R;
          if (Math.abs(O) <= Number.EPSILON) continue;
          const L = h - i,
            z = f - a,
            I = m - s,
            N = L * F + z * D + I * R;
          if (O > 0) {
            if (N < 0 || N > O) continue;
          } else if (N > 0 || N < O) continue;
          const B = z * S - A * I,
            U = I * w - S * L,
            V = L * A - w * z,
            H = p * B + g * U + v * V;
          if (O > 0) {
            if (H < 0 || N + H > O) continue;
          } else if (H > 0 || N + H < O) continue;
          const k = (C * B + E * U + P * V) / O;
          k >= 0 && c(k, zt(w, A, S, C, E, P, Dt), e);
        }
      }
      const Ot = (0, c.b)(),
        Lt = (0, c.b)();
      function zt(e, t, r, i, o, n, a) {
        return (0, c.e)(Ot, e, t, r), (0, c.e)(Lt, i, o, n), (0, c.a)(a, Ot, Lt), (0, c.n)(a, a), a;
      }
      function It(e, t) {
        const r = t ? It(t) : {};
        for (const t in e) {
          let i = e[t];
          i && i.forEach && (i = Nt(i)), (null == i && t in r) || (r[t] = i);
        }
        return r;
      }
      function Nt(e) {
        const t = [];
        return e.forEach((e) => t.push(e)), t;
      }
      const Bt = { multiply: 1, ignore: 2, replace: 3, tint: 4 },
        Ut = 1e3;
      class Vt extends $e {
        constructor(e, t) {
          super(),
            (this.type = 3),
            (this.supportsEdges = !1),
            (this._visible = !0),
            (this._renderPriority = 0),
            (this._insertOrder = 0),
            (this._vertexAttributeLocations = ft),
            (this._params = It(e, t)),
            this.validateParameterValues(this._params);
        }
        dispose() {}
        get params() {
          return this._params;
        }
        update(e) {
          return !1;
        }
        setParameterValues(e) {
          (function (e, t) {
            let r = !1;
            for (const i in t) {
              const o = t[i];
              void 0 !== o && ((r = !0), Array.isArray(o) ? (e[i] = o.slice()) : (e[i] = o));
            }
            return r;
          })(this._params, e) &&
            (this.validateParameterValues(this._params), this.parametersChanged());
        }
        validateParameterValues(e) {}
        get visible() {
          return this._visible;
        }
        set visible(e) {
          e !== this._visible && ((this._visible = e), this.parametersChanged());
        }
        isVisibleInPass(e) {
          return !0;
        }
        get renderOccluded() {
          return this.params.renderOccluded;
        }
        get renderPriority() {
          return this._renderPriority;
        }
        set renderPriority(e) {
          e !== this._renderPriority && ((this._renderPriority = e), this.parametersChanged());
        }
        get insertOrder() {
          return this._insertOrder;
        }
        set insertOrder(e) {
          e !== this._insertOrder && ((this._insertOrder = e), this.parametersChanged());
        }
        get vertexAttributeLocations() {
          return this._vertexAttributeLocations;
        }
        isVisible() {
          return this._visible;
        }
        parametersChanged() {
          (0, o.i)(this.materialRepository) && this.materialRepository.materialChanged(this);
        }
      }
      function Ht(e, t, r, i) {
        const o = r.typedBuffer,
          n = r.typedBufferStride,
          a = e.length;
        i *= n;
        for (let r = 0; r < a; ++r) {
          const a = 2 * e[r];
          (o[i] = t[a]), (o[i + 1] = t[a + 1]), (i += n);
        }
      }
      function kt(e, t, r, i, o) {
        const n = r.typedBuffer,
          a = r.typedBufferStride,
          s = e.length;
        if (((i *= a), null == o || 1 === o))
          for (let r = 0; r < s; ++r) {
            const o = 3 * e[r];
            (n[i] = t[o]), (n[i + 1] = t[o + 1]), (n[i + 2] = t[o + 2]), (i += a);
          }
        else
          for (let r = 0; r < s; ++r) {
            const s = 3 * e[r];
            for (let e = 0; e < o; ++e)
              (n[i] = t[s]), (n[i + 1] = t[s + 1]), (n[i + 2] = t[s + 2]), (i += a);
          }
      }
      function Gt(e, t, r, i, o, n = 1) {
        if (!r) return void kt(e, t, i, o, n);
        const a = i.typedBuffer,
          s = i.typedBufferStride,
          l = e.length,
          c = r[0],
          d = r[1],
          u = r[2],
          h = r[4],
          f = r[5],
          m = r[6],
          p = r[8],
          g = r[9],
          v = r[10],
          x = r[12],
          b = r[13],
          _ = r[14];
        if (((o *= s), 1 === n))
          for (let r = 0; r < l; ++r) {
            const i = 3 * e[r],
              n = t[i],
              l = t[i + 1],
              T = t[i + 2];
            (a[o] = c * n + h * l + p * T + x),
              (a[o + 1] = d * n + f * l + g * T + b),
              (a[o + 2] = u * n + m * l + v * T + _),
              (o += s);
          }
        else
          for (let r = 0; r < l; ++r) {
            const i = 3 * e[r],
              l = t[i],
              T = t[i + 1],
              y = t[i + 2],
              M = c * l + h * T + p * y + x,
              w = d * l + f * T + g * y + b,
              A = u * l + m * T + v * y + _;
            for (let e = 0; e < n; ++e) (a[o] = M), (a[o + 1] = w), (a[o + 2] = A), (o += s);
          }
      }
      function Wt(e, t, r, i, o, n = 1) {
        if (!r) return void kt(e, t, i, o, n);
        const a = r,
          l = i.typedBuffer,
          c = i.typedBufferStride,
          d = e.length,
          u = a[0],
          h = a[1],
          f = a[2],
          m = a[4],
          p = a[5],
          g = a[6],
          v = a[8],
          x = a[9],
          b = a[10],
          _ = !(0, s.q)(a),
          T = 1e-6,
          y = 0.999999;
        if (((o *= c), 1 === n))
          for (let r = 0; r < d; ++r) {
            const i = 3 * e[r],
              n = t[i],
              a = t[i + 1],
              s = t[i + 2];
            let d = u * n + m * a + v * s,
              M = h * n + p * a + x * s,
              w = f * n + g * a + b * s;
            if (_) {
              const e = d * d + M * M + w * w;
              if (e < y && e > T) {
                const t = 1 / Math.sqrt(e);
                (d *= t), (M *= t), (w *= t);
              }
            }
            (l[o + 0] = d), (l[o + 1] = M), (l[o + 2] = w), (o += c);
          }
        else
          for (let r = 0; r < d; ++r) {
            const i = 3 * e[r],
              a = t[i],
              s = t[i + 1],
              d = t[i + 2];
            let M = u * a + m * s + v * d,
              w = h * a + p * s + x * d,
              A = f * a + g * s + b * d;
            if (_) {
              const e = M * M + w * w + A * A;
              if (e < y && e > T) {
                const t = 1 / Math.sqrt(e);
                (M *= t), (w *= t), (A *= t);
              }
            }
            for (let e = 0; e < n; ++e) (l[o + 0] = M), (l[o + 1] = w), (l[o + 2] = A), (o += c);
          }
      }
      function qt(e, t, r, i, o, n = 1) {
        if (!r)
          return void (function (e, t, r, i, o = 1) {
            const n = r.typedBuffer,
              a = r.typedBufferStride,
              s = e.length;
            if (((i *= a), 1 === o))
              for (let r = 0; r < s; ++r) {
                const o = 4 * e[r];
                (n[i] = t[o]),
                  (n[i + 1] = t[o + 1]),
                  (n[i + 2] = t[o + 2]),
                  (n[i + 3] = t[o + 3]),
                  (i += a);
              }
            else
              for (let r = 0; r < s; ++r) {
                const s = 4 * e[r];
                for (let e = 0; e < o; ++e)
                  (n[i] = t[s]),
                    (n[i + 1] = t[s + 1]),
                    (n[i + 2] = t[s + 2]),
                    (n[i + 3] = t[s + 3]),
                    (i += a);
              }
          })(e, t, i, o, n);
        const a = r,
          l = i.typedBuffer,
          c = i.typedBufferStride,
          d = e.length,
          u = a[0],
          h = a[1],
          f = a[2],
          m = a[4],
          p = a[5],
          g = a[6],
          v = a[8],
          x = a[9],
          b = a[10],
          _ = !(0, s.q)(a),
          T = 1e-6,
          y = 0.999999;
        if (((o *= c), 1 === n))
          for (let r = 0; r < d; ++r) {
            const i = 4 * e[r],
              n = t[i],
              a = t[i + 1],
              s = t[i + 2],
              d = t[i + 3];
            let M = u * n + m * a + v * s,
              w = h * n + p * a + x * s,
              A = f * n + g * a + b * s;
            if (_) {
              const e = M * M + w * w + A * A;
              if (e < y && e > T) {
                const t = 1 / Math.sqrt(e);
                (M *= t), (w *= t), (A *= t);
              }
            }
            (l[o + 0] = M), (l[o + 1] = w), (l[o + 2] = A), (l[o + 3] = d), (o += c);
          }
        else
          for (let r = 0; r < d; ++r) {
            const i = 4 * e[r],
              a = t[i],
              s = t[i + 1],
              d = t[i + 2],
              M = t[i + 3];
            let w = u * a + m * s + v * d,
              A = h * a + p * s + x * d,
              S = f * a + g * s + b * d;
            if (_) {
              const e = w * w + A * A + S * S;
              if (e < y && e > T) {
                const t = 1 / Math.sqrt(e);
                (w *= t), (A *= t), (S *= t);
              }
            }
            for (let e = 0; e < n; ++e)
              (l[o + 0] = w), (l[o + 1] = A), (l[o + 2] = S), (l[o + 3] = M), (o += c);
          }
      }
      function $t(e, t, r, i, o, n = 1) {
        const a = i.typedBuffer,
          s = i.typedBufferStride,
          l = e.length;
        if (((o *= s), 1 === n)) {
          if (4 === r)
            for (let r = 0; r < l; ++r) {
              const i = 4 * e[r];
              (a[o] = t[i]),
                (a[o + 1] = t[i + 1]),
                (a[o + 2] = t[i + 2]),
                (a[o + 3] = t[i + 3]),
                (o += s);
            }
          else if (3 === r)
            for (let r = 0; r < l; ++r) {
              const i = 3 * e[r];
              (a[o] = t[i]),
                (a[o + 1] = t[i + 1]),
                (a[o + 2] = t[i + 2]),
                (a[o + 3] = 255),
                (o += s);
            }
        } else if (4 === r)
          for (let r = 0; r < l; ++r) {
            const i = 4 * e[r];
            for (let e = 0; e < n; ++e)
              (a[o] = t[i]),
                (a[o + 1] = t[i + 1]),
                (a[o + 2] = t[i + 2]),
                (a[o + 3] = t[i + 3]),
                (o += s);
          }
        else if (3 === r)
          for (let r = 0; r < l; ++r) {
            const i = 3 * e[r];
            for (let e = 0; e < n; ++e)
              (a[o] = t[i]),
                (a[o + 1] = t[i + 1]),
                (a[o + 2] = t[i + 2]),
                (a[o + 3] = 255),
                (o += s);
          }
      }
      function jt(e, t) {
        if (t.slicePlaneEnabled) {
          e.extensions.add('GL_OES_standard_derivatives'),
            t.sliceEnabledForVertexPrograms &&
              (e.vertex.uniforms.add('slicePlaneOrigin', 'vec3'),
              e.vertex.uniforms.add('slicePlaneBasis1', 'vec3'),
              e.vertex.uniforms.add('slicePlaneBasis2', 'vec3')),
            e.fragment.uniforms.add('slicePlaneOrigin', 'vec3'),
            e.fragment.uniforms.add('slicePlaneBasis1', 'vec3'),
            e.fragment.uniforms.add('slicePlaneBasis2', 'vec3');
          const r = Ye`struct SliceFactors {
float front;
float side0;
float side1;
float side2;
float side3;
};
SliceFactors calculateSliceFactors(vec3 pos) {
vec3 rel = pos - slicePlaneOrigin;
vec3 slicePlaneNormal = -cross(slicePlaneBasis1, slicePlaneBasis2);
float slicePlaneW = -dot(slicePlaneNormal, slicePlaneOrigin);
float basis1Len2 = dot(slicePlaneBasis1, slicePlaneBasis1);
float basis2Len2 = dot(slicePlaneBasis2, slicePlaneBasis2);
float basis1Dot = dot(slicePlaneBasis1, rel);
float basis2Dot = dot(slicePlaneBasis2, rel);
return SliceFactors(
dot(slicePlaneNormal, pos) + slicePlaneW,
-basis1Dot - basis1Len2,
basis1Dot - basis1Len2,
-basis2Dot - basis2Len2,
basis2Dot - basis2Len2
);
}
bool sliceByFactors(SliceFactors factors) {
return factors.front < 0.0
&& factors.side0 < 0.0
&& factors.side1 < 0.0
&& factors.side2 < 0.0
&& factors.side3 < 0.0;
}
bool sliceEnabled() {
return dot(slicePlaneBasis1, slicePlaneBasis1) != 0.0;
}
bool sliceByPlane(vec3 pos) {
return sliceEnabled() && sliceByFactors(calculateSliceFactors(pos));
}
#define rejectBySlice(_pos_) sliceByPlane(_pos_)
#define discardBySlice(_pos_) { if (sliceByPlane(_pos_)) discard; }`,
            i = Ye`vec4 applySliceHighlight(vec4 color, vec3 pos) {
SliceFactors factors = calculateSliceFactors(pos);
if (sliceByFactors(factors)) {
return color;
}
const float HIGHLIGHT_WIDTH = 1.0;
const vec4 HIGHLIGHT_COLOR = vec4(0.0, 0.0, 0.0, 0.3);
factors.front /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.front);
factors.side0 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side0);
factors.side1 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side1);
factors.side2 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side2);
factors.side3 /= (2.0 * HIGHLIGHT_WIDTH) * fwidth(factors.side3);
float highlightFactor = (1.0 - step(0.5, factors.front))
* (1.0 - step(0.5, factors.side0))
* (1.0 - step(0.5, factors.side1))
* (1.0 - step(0.5, factors.side2))
* (1.0 - step(0.5, factors.side3));
return mix(color, vec4(HIGHLIGHT_COLOR.rgb, color.a), highlightFactor * HIGHLIGHT_COLOR.a);
}`,
            o = t.sliceHighlightDisabled
              ? Ye`#define highlightSlice(_color_, _pos_) (_color_)`
              : Ye`
        ${i}
        #define highlightSlice(_color_, _pos_) (sliceEnabled() ? applySliceHighlight(_color_, _pos_) : (_color_))
      `;
          t.sliceEnabledForVertexPrograms && e.vertex.code.add(r),
            e.fragment.code.add(r),
            e.fragment.code.add(o);
        } else {
          const r = Ye`#define rejectBySlice(_pos_) false
#define discardBySlice(_pos_) {}
#define highlightSlice(_color_, _pos_) (_color_)`;
          t.sliceEnabledForVertexPrograms && e.vertex.code.add(r), e.fragment.code.add(r);
        }
      }
      const Xt = (0, c.b)();
      function Kt(e) {
        e.code.add(Ye`const float MAX_RGBA_FLOAT =
255.0 / 256.0 +
255.0 / 256.0 / 256.0 +
255.0 / 256.0 / 256.0 / 256.0 +
255.0 / 256.0 / 256.0 / 256.0 / 256.0;
const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);
vec4 float2rgba(const float value) {
float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);
vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);
const float toU8AsFloat = 1.0 / 255.0;
return fixedPointU8 * toU8AsFloat;
}
const vec4 RGBA_2_FLOAT_FACTORS = vec4(
255.0 / (256.0),
255.0 / (256.0 * 256.0),
255.0 / (256.0 * 256.0 * 256.0),
255.0 / (256.0 * 256.0 * 256.0 * 256.0)
);
float rgba2float(vec4 rgba) {
return dot(rgba, RGBA_2_FLOAT_FACTORS);
}`);
      }
      function Zt(e) {
        e.include(Kt),
          e.code.add(Ye`float linearDepthFromFloat(float depth, vec2 nearFar) {
return -(depth * (nearFar[1] - nearFar[0]) + nearFar[0]);
}
float linearDepthFromTexture(sampler2D depthTex, vec2 uv, vec2 nearFar) {
return linearDepthFromFloat(rgba2float(texture2D(depthTex, uv)), nearFar);
}`);
      }
      const Yt = (0, Ve.f)(1, 1, 0, 1),
        Qt = (0, Ve.f)(1, 0, 1, 1);
      function Jt(e) {
        e.fragment.uniforms.add('depthTex', 'sampler2D'),
          e.fragment.uniforms.add('highlightViewportPixelSz', 'vec4'),
          e.fragment.constants
            .add('occludedHighlightFlag', 'vec4', Yt)
            .add('unoccludedHighlightFlag', 'vec4', Qt),
          e.fragment.code.add(Ye`void outputHighlight() {
vec4 fragCoord = gl_FragCoord;
float sceneDepth = texture2D(depthTex, (fragCoord.xy - highlightViewportPixelSz.xy) * highlightViewportPixelSz.zw).r;
if (fragCoord.z > sceneDepth + 5e-7) {
gl_FragColor = occludedHighlightFlag;
}
else {
gl_FragColor = unoccludedHighlightFlag;
}
}`);
      }
      function er(e, t) {
        const r = e.fragment;
        switch (t.alphaDiscardMode) {
          case 0:
            r.code.add(Ye`
        #define discardOrAdjustAlpha(color) { if (color.a < ${Ye.float(0.001)}) { discard; } }
      `);
            break;
          case 1:
            r.code.add(Ye`void discardOrAdjustAlpha(inout vec4 color) {
color.a = 1.0;
}`);
            break;
          case 2:
            r.uniforms.add('textureAlphaCutoff', 'float'),
              r.code.add(
                Ye`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } else { color.a = 1.0; } }`,
              );
            break;
          case 3:
            e.fragment.uniforms.add('textureAlphaCutoff', 'float'),
              e.fragment.code.add(
                Ye`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } }`,
              );
        }
      }
      function tr(e, t) {
        e.fragment.uniforms.add('terrainDepthTexture', 'sampler2D'),
          e.fragment.uniforms.add('cameraNearFar', 'vec2'),
          e.fragment.uniforms.add('inverseViewport', 'vec2'),
          e.fragment.code.add(Ye`
    // Compare the linearized depths of fragment and terrain. Discard fragments on the wrong side of the terrain.
    void terrainDepthTest(vec4 fragCoord, float fragmentDepth){

      float terrainDepth = linearDepthFromTexture(terrainDepthTexture, fragCoord.xy * inverseViewport, cameraNearFar);
      if(fragmentDepth ${t.cullAboveGround ? '>' : '<='} terrainDepth){
        discard;
      }
    }
  `);
      }
      const rr = (function (e, t, r, i, o = 32774, n = 32774, a = [0, 0, 0, 0]) {
          return {
            srcRgb: 770,
            srcAlpha: 1,
            dstRgb: 771,
            dstAlpha: 771,
            opRgb: o,
            opAlpha: n,
            color: { r: a[0], g: a[1], b: a[2], a: a[3] },
          };
        })(),
        ir = M(1, 1),
        or = M(0, 771);
      function nr(e) {
        return 2 === e ? null : 1 === e ? or : ir;
      }
      const ar = { factor: -1, units: -2 };
      function sr(e) {
        return e ? ar : null;
      }
      function lr(e) {
        return 3 === e || 2 === e ? 513 : 515;
      }
      const cr = { mask: 255 },
        dr = {
          function: { func: 519, ref: 2, mask: 2 },
          operation: { fail: 7680, zFail: 7680, zPass: 0 },
        },
        ur = {
          function: { func: 519, ref: 2, mask: 2 },
          operation: { fail: 7680, zFail: 7680, zPass: 7681 },
        };
      function hr(e, t) {
        e.fragment.include(Kt),
          3 === t.output
            ? (e.extensions.add('GL_OES_standard_derivatives'),
              e.fragment.code.add(Ye`float _calculateFragDepth(const in float depth) {
const float SLOPE_SCALE = 2.0;
const float BIAS = 2.0 * .000015259;
float m = max(abs(dFdx(depth)), abs(dFdy(depth)));
float result = depth + SLOPE_SCALE * m + BIAS;
return clamp(result, .0, .999999);
}
void outputDepth(float _linearDepth) {
gl_FragColor = float2rgba(_calculateFragDepth(_linearDepth));
}`))
            : 1 === t.output &&
              e.fragment.code.add(Ye`void outputDepth(float _linearDepth) {
gl_FragColor = float2rgba(_linearDepth);
}`);
      }
      function fr(e, t) {
        t.attributeColor
          ? (e.attributes.add('color', 'vec4'),
            e.varyings.add('vColor', 'vec4'),
            e.vertex.code.add(Ye`void forwardVertexColor() { vColor = color; }`),
            e.vertex.code.add(
              Ye`void forwardNormalizedVertexColor() { vColor = color * 0.003921568627451; }`,
            ))
          : e.vertex.code.add(Ye`void forwardVertexColor() {}
void forwardNormalizedVertexColor() {}`);
      }
      var mr = r(48190),
        pr = r(76996),
        gr = r(32101),
        vr = r(73173);
      class xr {
        constructor(e, t) {
          (this._context = e),
            (this._desc = t),
            this._context.instanceCounter.increment(y.R.Renderbuffer, this);
          const r = this._context.gl;
          (this.glName = r.createRenderbuffer()),
            this._context.bindRenderbuffer(this),
            r.renderbufferStorage(r.RENDERBUFFER, t.internalFormat, t.width, t.height);
        }
        get descriptor() {
          return this._desc;
        }
        resize(e, t) {
          const r = this._desc;
          if (r.width === e && r.height === t) return;
          (r.width = e), (r.height = t);
          const i = this._context.gl;
          this._context.bindRenderbuffer(this),
            i.renderbufferStorage(i.RENDERBUFFER, r.internalFormat, r.width, r.height);
        }
        dispose() {
          this._context &&
            (this._context.gl.deleteRenderbuffer(this.glName),
            this._context.instanceCounter.decrement(y.R.Renderbuffer, this),
            (this._context = null));
        }
      }
      const br = v.L.getLogger('esri.views.webgl.FrameBufferObject');
      class _r {
        constructor(e, t, r, i) {
          if (
            ((this._context = e),
            (this._glName = null),
            (this._depthAttachment = null),
            (this._stencilAttachment = null),
            (this._colorAttachments = new Map()),
            (this._initialized = !1),
            (this._desc = { ...t }),
            e.instanceCounter.increment(y.R.Framebuffer, this),
            r)
          ) {
            Array.isArray(r) || (r = [r]);
            for (let t = 0; t < r.length; ++t) {
              var o;
              const i = r[t];
              let n;
              Tr(i)
                ? ((n = i.descriptor), this._colorAttachments.set(36064 + t, i))
                : ((n = i), this._colorAttachments.set(36064 + t, new y.T(e, i))),
                0 !== (null == (o = this._desc) ? void 0 : o.colorTarget) &&
                  console.error(
                    'Framebuffer is initialized with a texture however the descriptor indicates using a renderbuffer color attachment!',
                  ),
                this._validateColorAttachmentPoint(36064 + t),
                this._validateTextureDimensions(n, this._desc);
            }
          }
          if (i instanceof xr) {
            var n;
            const e = null != (n = this._desc.depthStencilTarget) ? n : 3;
            2 === e
              ? (this._stencilAttachment = i)
              : 1 === e || 3 === e
              ? (this._depthAttachment = i)
              : console.error(
                  'If a Renderbuffer is provided, "depthStencilTarget" must be one of STENCIL_RENDER_BUFFER, DEPTH_RENDER_BUFFER or DEPTH_STENCIL_RENDER_BUFFER',
                ),
              yr(i.descriptor, this._desc);
          } else if (i) {
            let e;
            this._context.capabilities.depthTexture ||
              console.error(
                "Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!",
              ),
              Tr(i)
                ? ((this._depthStencilTexture = i), (e = i.descriptor))
                : (this._depthStencilTexture = new y.T(this._context, i)),
              this._validateTextureDimensions(e, this._desc);
          }
        }
        dispose() {
          if (!this._desc) return;
          const e = this._context.getBoundFramebufferObject();
          this._disposeColorAttachments(),
            this._disposeDepthStencilAttachments(),
            this._glName &&
              (this._context.gl.deleteFramebuffer(this._glName), (this._glName = null)),
            this._context.bindFramebuffer(e),
            this._context.instanceCounter.decrement(y.R.Framebuffer, this),
            (this._desc = null);
        }
        get glName() {
          return this._glName;
        }
        get descriptor() {
          return this._desc;
        }
        get colorTexture() {
          const e = this._colorAttachments.get(36064);
          return e && Tr(e) ? e : null;
        }
        get colorAttachment() {
          return this._colorAttachments.get(36064);
        }
        get depthStencilAttachment() {
          return this._depthStencilTexture || this._depthAttachment || this._stencilAttachment;
        }
        get depthStencilTexture() {
          return this._depthStencilTexture;
        }
        get width() {
          return this._desc.width;
        }
        get height() {
          return this._desc.height;
        }
        get gpuMemoryUsage() {
          return ye(this.colorAttachment) + ye(this.depthStencilAttachment);
        }
        getColorTexture(e) {
          const t = this._colorAttachments.get(e);
          return t && Tr(t) ? t : null;
        }
        attachColorTexture(e, t = 36064) {
          if (!e) return;
          this._validateColorAttachmentPoint(t);
          const r = e.descriptor;
          if (
            (this._validateTextureDimensions(r, this._desc),
            this._disposeColorAttachments(),
            this._initialized)
          ) {
            this._context.bindFramebuffer(this);
            const r = this._context.gl;
            r.framebufferTexture2D(r.FRAMEBUFFER, t, r.TEXTURE_2D, e.glName, 0);
          }
          this._colorAttachments.set(t, e);
        }
        detachColorTexture(e = 36064) {
          const t = this._colorAttachments.get(e);
          if (Tr(t)) {
            const r = t;
            if (this._initialized) {
              this._context.bindFramebuffer(this);
              const t = this._context.gl;
              t.framebufferTexture2D(t.FRAMEBUFFER, e, t.TEXTURE_2D, null, 0);
            }
            return this._colorAttachments.delete(e), r;
          }
        }
        attachDepthStencilTexture(e) {
          if (!e) return;
          const t = e.descriptor;
          if (
            (34041 !== t.pixelFormat &&
              console.error('Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!'),
            34042 !== t.dataType &&
              console.error('Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!'),
            this._context.capabilities.depthTexture ||
              console.error(
                "Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!",
              ),
            this._validateTextureDimensions(t, this._desc),
            this._desc.depthStencilTarget &&
              4 !== this._desc.depthStencilTarget &&
              (this._desc.depthStencilTarget = 4),
            this._disposeDepthStencilAttachments(),
            this._initialized)
          ) {
            this._context.bindFramebuffer(this);
            const t = this._context.gl;
            t.framebufferTexture2D(
              t.FRAMEBUFFER,
              t.DEPTH_STENCIL_ATTACHMENT,
              t.TEXTURE_2D,
              e.glName,
              0,
            );
          }
          this._depthStencilTexture = e;
        }
        detachDepthStencilTexture() {
          const e = this._depthStencilTexture;
          if (e && this._initialized) {
            this._context.bindFramebuffer(this);
            const e = this._context.gl;
            this._context.gl.framebufferTexture2D(
              e.FRAMEBUFFER,
              e.DEPTH_STENCIL_ATTACHMENT,
              e.TEXTURE_2D,
              null,
              0,
            );
          }
          return (this._depthStencilTexture = null), e;
        }
        attachDepthStencilBuffer(e) {
          if (!e) return;
          const t = e.descriptor;
          if (
            (34041 !== t.internalFormat &&
              33189 !== t.internalFormat &&
              console.error('Depth/Stencil buffer must have correct internalFormat'),
            yr(t, this._desc),
            this._disposeDepthStencilAttachments(),
            (this._desc.depthStencilTarget = 34041 === t.internalFormat ? 3 : 1),
            this._initialized)
          ) {
            this._context.bindFramebuffer(this);
            const t = this._context.gl,
              r =
                1 === this._desc.depthStencilTarget
                  ? t.DEPTH_ATTACHMENT
                  : t.DEPTH_STENCIL_ATTACHMENT;
            t.framebufferRenderbuffer(t.FRAMEBUFFER, r, t.RENDERBUFFER, e.glName);
          }
          this._depthAttachment = e;
        }
        detachDepthStencilBuffer() {
          const e = this._context.gl,
            t = this._depthAttachment;
          if (t && this._initialized) {
            this._context.bindFramebuffer(this);
            const t =
              1 === this._desc.depthStencilTarget ? e.DEPTH_ATTACHMENT : e.DEPTH_STENCIL_ATTACHMENT;
            e.framebufferRenderbuffer(e.FRAMEBUFFER, t, e.RENDERBUFFER, null);
          }
          return (this._depthAttachment = null), t;
        }
        detachAll() {
          this.detachColorTexture(),
            this.detachDepthStencilBuffer(),
            this.detachDepthStencilTexture();
        }
        copyToTexture(e, t, r, i, o, n, a) {
          (e < 0 || t < 0 || o < 0 || n < 0) && console.error('Offsets cannot be negative!'),
            (r <= 0 || i <= 0) && console.error('Copy width and height must be greater than zero!');
          const s = this._desc,
            l = a.descriptor;
          3553 !== a.descriptor.target && console.error('Texture target must be TEXTURE_2D!'),
            (e + r > s.width || t + i > s.height || o + r > l.width || n + i > l.height) &&
              console.error(
                'Bad dimensions, the current input values will attempt to read or copy out of bounds!',
              );
          const c = this._context,
            d = c.bindTexture(a, y.T.TEXTURE_UNIT_FOR_UPDATES);
          c.bindFramebuffer(this),
            c.gl.copyTexSubImage2D(3553, 0, o, n, e, t, r, i),
            c.bindTexture(d, y.T.TEXTURE_UNIT_FOR_UPDATES);
        }
        readPixels(e, t, r, i, o, n, a) {
          (r <= 0 || i <= 0) && console.error('Copy width and height must be greater than zero!'),
            a || console.error('Target memory is not initialized!'),
            this._context.bindFramebuffer(this),
            this._context.gl.readPixels(e, t, r, i, o, n, a);
        }
        resize(e, t) {
          const r = this._desc;
          if (r.width !== e || r.height !== t) {
            if (!this._initialized)
              return (
                (r.width = e),
                (r.height = t),
                this._colorAttachments.forEach((r) => {
                  r && r.resize(e, t);
                }),
                void (this._depthStencilTexture && this._depthStencilTexture.resize(e, t))
              );
            (r.width = e),
              (r.height = t),
              this._colorAttachments.forEach((r) => {
                r && r.resize(e, t);
              }),
              null != this._depthStencilTexture
                ? this._depthStencilTexture.resize(e, t)
                : (this._depthAttachment || this._stencilAttachment) &&
                  (this._depthAttachment && this._depthAttachment.resize(e, t),
                  this._stencilAttachment && this._stencilAttachment.resize(e, t)),
              this._context.getBoundFramebufferObject() === this &&
                this._context.bindFramebuffer(null),
              (this._initialized = !1);
          }
        }
        initializeAndBind() {
          var e, t, r, i;
          const o = this._context.gl;
          if (this._initialized) return void o.bindFramebuffer(o.FRAMEBUFFER, this.glName);
          this._glName && o.deleteFramebuffer(this._glName);
          const n = this._context,
            a = o.createFramebuffer(),
            s = this._desc,
            l = null != (e = s.colorTarget) ? e : 1,
            c = null != (t = s.width) ? t : 1,
            d = null != (r = s.height) ? r : 1;
          if ((o.bindFramebuffer(o.FRAMEBUFFER, a), 0 === this._colorAttachments.size))
            if (0 === l)
              this._colorAttachments.set(
                36064,
                (function (e, t) {
                  return new y.T(e, {
                    target: 3553,
                    pixelFormat: 6408,
                    dataType: 5121,
                    samplingMode: 9728,
                    wrapMode: 33071,
                    width: t.width,
                    height: t.height,
                  });
                })(n, s),
              );
            else {
              const e = new xr(n, { internalFormat: 32854, width: c, height: d });
              this._colorAttachments.set(36064, e);
            }
          this._colorAttachments.forEach((e, t) => {
            e &&
              (Tr(e)
                ? o.framebufferTexture2D(o.FRAMEBUFFER, t, o.TEXTURE_2D, e.glName, 0)
                : o.framebufferRenderbuffer(
                    o.FRAMEBUFFER,
                    o.COLOR_ATTACHMENT0,
                    o.RENDERBUFFER,
                    e.glName,
                  ));
          });
          const u = null != (i = s.depthStencilTarget) ? i : 0;
          switch (u) {
            case 1:
            case 3: {
              this._depthAttachment ||
                (this._depthAttachment = new xr(n, {
                  internalFormat: 1 === s.depthStencilTarget ? 33189 : 34041,
                  width: c,
                  height: d,
                }));
              const e = 1 === u ? o.DEPTH_ATTACHMENT : o.DEPTH_STENCIL_ATTACHMENT;
              o.framebufferRenderbuffer(
                o.FRAMEBUFFER,
                e,
                o.RENDERBUFFER,
                this._depthAttachment.glName,
              );
              break;
            }
            case 2:
              this._stencilAttachment ||
                (this._stencilAttachment = new xr(n, {
                  internalFormat: 36168,
                  width: c,
                  height: d,
                })),
                o.framebufferRenderbuffer(
                  o.FRAMEBUFFER,
                  o.STENCIL_ATTACHMENT,
                  o.RENDERBUFFER,
                  this._stencilAttachment.glName,
                );
              break;
            case 4:
              if (!this._depthStencilTexture) {
                n.capabilities.depthTexture ||
                  console.error(
                    "Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture as an attachment!",
                  );
                const e = {
                  target: 3553,
                  pixelFormat: 34041,
                  dataType: 34042,
                  samplingMode: 9728,
                  wrapMode: 33071,
                  width: c,
                  height: d,
                };
                this._depthStencilTexture = new y.T(n, e);
              }
              o.framebufferTexture2D(
                o.FRAMEBUFFER,
                o.DEPTH_STENCIL_ATTACHMENT,
                o.TEXTURE_2D,
                this._depthStencilTexture.glName,
                0,
              );
          }
          oe() &&
            o.checkFramebufferStatus(o.FRAMEBUFFER) !== o.FRAMEBUFFER_COMPLETE &&
            console.error('Framebuffer is incomplete!'),
            (this._glName = a),
            (this._initialized = !0);
        }
        _disposeColorAttachments() {
          this._colorAttachments.forEach((e, t) => {
            if (Tr(e)) {
              if (this._initialized) {
                this._context.bindFramebuffer(this);
                const e = this._context.gl;
                e.framebufferTexture2D(e.FRAMEBUFFER, t, e.TEXTURE_2D, null, 0);
              }
              e.dispose();
            } else if (e instanceof WebGLRenderbuffer) {
              const r = this._context.gl;
              this._initialized &&
                (this._context.bindFramebuffer(this),
                r.framebufferRenderbuffer(r.FRAMEBUFFER, t, r.RENDERBUFFER, null)),
                this._context.gl.deleteRenderbuffer(e);
            }
          }),
            this._colorAttachments.clear();
        }
        _disposeDepthStencilAttachments() {
          const e = this._context.gl;
          if (this._depthAttachment) {
            if (this._initialized) {
              this._context.bindFramebuffer(this);
              const t =
                1 === this._desc.depthStencilTarget
                  ? e.DEPTH_ATTACHMENT
                  : e.DEPTH_STENCIL_ATTACHMENT;
              e.framebufferRenderbuffer(e.FRAMEBUFFER, t, e.RENDERBUFFER, null);
            }
            this._depthAttachment.dispose(), (this._depthAttachment = null);
          }
          this._stencilAttachment &&
            (this._initialized &&
              (this._context.bindFramebuffer(this),
              e.framebufferRenderbuffer(e.FRAMEBUFFER, e.STENCIL_ATTACHMENT, e.RENDERBUFFER, null)),
            this._stencilAttachment.dispose(),
            (this._stencilAttachment = null)),
            this._depthStencilTexture &&
              (this._initialized &&
                (this._context.bindFramebuffer(this),
                e.framebufferTexture2D(
                  e.FRAMEBUFFER,
                  e.DEPTH_STENCIL_ATTACHMENT,
                  e.TEXTURE_2D,
                  null,
                  0,
                )),
              this._depthStencilTexture.dispose(),
              (this._depthStencilTexture = null));
        }
        _validateTextureDimensions(e, t) {
          3553 !== e.target && console.error('Texture type must be TEXTURE_2D!'),
            void 0 !== t.width && t.width >= 0 && void 0 !== t.height && t.height >= 0
              ? (t.width === e.width && t.height === e.height) ||
                console.error("Color attachment texture must match the framebuffer's!")
              : ((t.width = e.width), (t.height = e.height));
        }
        _validateColorAttachmentPoint(e) {
          if (-1 === _r._MAX_COLOR_ATTACHMENTS) {
            const e = this._context.capabilities.drawBuffers;
            if (e) {
              const t = this._context.gl;
              _r._MAX_COLOR_ATTACHMENTS = t.getParameter(e.MAX_COLOR_ATTACHMENTS);
            } else _r._MAX_COLOR_ATTACHMENTS = 1;
          }
          const t = e - 36064;
          t + 1 > _r._MAX_COLOR_ATTACHMENTS &&
            br.error(
              'esri.FrameBufferObject',
              `illegal attachment point for color attachment: ${
                t + 1
              }. Implementation supports up to ${_r._MAX_COLOR_ATTACHMENTS} color attachments`,
            );
        }
      }
      function Tr(e) {
        return 'type' in e && 'texture' === e.type;
      }
      function yr(e, t) {
        void 0 !== t.width && t.width >= 0 && void 0 !== t.height && t.height >= 0
          ? (t.width === e.width && t.height === e.height) ||
            console.error("Renderbuffer dimensions must match the framebuffer's!")
          : ((t.width = e.width), (t.height = e.height));
      }
      _r._MAX_COLOR_ATTACHMENTS = -1;
      class Mr extends St {
        constructor(e) {
          super(e),
            (this._textureIDs = new Set()),
            (this._textureRepository = e.textureRep),
            (this._textureId = e.textureId),
            (this._initTransparent = !!e.initTextureTransparent),
            (this._texture = this._acquire(this._textureId)),
            (this._textureNormal = this._acquire(e.normalTextureId)),
            (this._textureEmissive = this._acquire(e.emissiveTextureId)),
            (this._textureOcclusion = this._acquire(e.occlusionTextureId)),
            (this._textureMetallicRoughness = this._acquire(e.metallicRoughnessTextureId));
        }
        dispose() {
          this._textureIDs.forEach((e) => this._textureRepository.release(e)),
            this._textureIDs.clear();
        }
        updateTexture(e) {
          e !== this._textureId &&
            (this._release(this._textureId),
            (this._textureId = e),
            (this._texture = this._acquire(this._textureId)));
        }
        bindTextures(e) {
          (0, o.i)(this._texture) && e.bindTexture(this._texture.glTexture, 'tex'),
            (0, o.i)(this._textureNormal) &&
              e.bindTexture(this._textureNormal.glTexture, 'normalTexture'),
            (0, o.i)(this._textureEmissive) &&
              e.bindTexture(this._textureEmissive.glTexture, 'texEmission'),
            (0, o.i)(this._textureOcclusion) &&
              e.bindTexture(this._textureOcclusion.glTexture, 'texOcclusion'),
            (0, o.i)(this._textureMetallicRoughness) &&
              e.bindTexture(this._textureMetallicRoughness.glTexture, 'texMetallicRoughness');
        }
        bindTextureScale(e) {
          const t = (0, o.i)(this._texture) && this._texture.glTexture;
          t && t.descriptor.textureCoordinateScaleFactor
            ? e.setUniform2fv(
                'textureCoordinateScaleFactor',
                t.descriptor.textureCoordinateScaleFactor,
              )
            : e.setUniform2f('textureCoordinateScaleFactor', 1, 1);
        }
        _acquire(e) {
          if (!(0, o.b)(e))
            return (
              this._textureIDs.add(e), this._textureRepository.acquire(e, this._initTransparent)
            );
        }
        _release(e) {
          (0, o.b)(e) || (this._textureIDs.delete(e), this._textureRepository.release(e));
        }
      }
      let wr,
        Ar = null,
        Sr = null;
      async function Cr() {
        return (
          (0, o.b)(Sr) &&
            ((Sr = (function () {
              if ((0, o.b)(wr)) {
                const e = (e) => (0, vr.g)(`esri/libs/basisu/${e}`);
                wr = r
                  .e(3786)
                  .then(r.bind(r, 73786))
                  .then(function (e) {
                    return e.b;
                  })
                  .then(({ default: t }) =>
                    t({ locateFile: e }).then((e) => (e.initializeBasis(), delete e.then, e)),
                  );
              }
              return wr;
            })()),
            (Ar = await Sr)),
          Sr
        );
      }
      function Er(e, t, r, i, o) {
        const n = Te(t ? 37496 : 37492),
          a = o && e > 1 ? (4 ** e - 1) / (3 * 4 ** (e - 1)) : 1;
        return Math.ceil(r * i * n * a);
      }
      function Pr(e) {
        return e.getNumImages() >= 1 && !e.isUASTC();
      }
      function Fr(e) {
        return e.getFaces() >= 1 && e.isETC1S();
      }
      function Dr(e, t, r, i, o, n, a, s) {
        const { compressedTextureETC: l, compressedTextureS3TC: c } = e.capabilities,
          [d, u] = l
            ? i
              ? [1, 37496]
              : [0, 37492]
            : c
            ? i
              ? [3, 33779]
              : [2, 33776]
            : [13, 6408],
          h = t.hasMipmap ? r : Math.min(1, r),
          f = [];
        for (let e = 0; e < h; e++) f.push(new Uint8Array(a(e, d))), s(e, d, f[e]);
        const m = f.length > 1,
          p = m ? 9987 : 9729,
          g = { ...t, samplingMode: p, hasMipmap: m, internalFormat: u, width: o, height: n };
        return new y.T(e, g, { type: 'compressed', levels: f });
      }
      const Rr = v.L.getLogger('esri.views.3d.webgl-engine.lib.DDSUtil');
      function Or(e) {
        return (
          e.charCodeAt(0) +
          (e.charCodeAt(1) << 8) +
          (e.charCodeAt(2) << 16) +
          (e.charCodeAt(3) << 24)
        );
      }
      const Lr = Or('DXT1'),
        zr = Or('DXT3'),
        Ir = Or('DXT5');
      class Nr extends $e {
        constructor(e, t) {
          super(),
            (this.data = e),
            (this.type = 4),
            (this.glTexture = null),
            (this.powerOfTwoStretchInfo = null),
            (this.loadingPromise = null),
            (this.loadingController = null),
            (this.events = new pr.E()),
            (this.params = t || {}),
            (this.params.mipmap = !1 !== this.params.mipmap),
            (this.params.noUnpackFlip = this.params.noUnpackFlip || !1),
            (this.params.preMultiplyAlpha = this.params.preMultiplyAlpha || !1),
            (this.params.wrap = this.params.wrap || { s: 10497, t: 10497 }),
            (this.params.powerOfTwoResizeMode = this.params.powerOfTwoResizeMode || 1),
            (this.estimatedTexMemRequired = Nr.estimateTexMemRequired(this.data, this.params)),
            this.startPreload();
        }
        startPreload() {
          const e = this.data;
          (0, o.b)(e) ||
            (e instanceof HTMLVideoElement
              ? this.startPreloadVideoElement(e)
              : e instanceof HTMLImageElement && this.startPreloadImageElement(e));
        }
        startPreloadVideoElement(e) {
          (0, gr.jc)(e.src) ||
            ('auto' === e.preload && e.crossOrigin) ||
            ((e.preload = 'auto'), (e.crossOrigin = 'anonymous'), (e.src = e.src));
        }
        startPreloadImageElement(e) {
          (0, gr.HK)(e.src) ||
            (0, gr.jc)(e.src) ||
            e.crossOrigin ||
            ((e.crossOrigin = 'anonymous'), (e.src = e.src));
        }
        static getDataDimensions(e) {
          return e instanceof HTMLVideoElement ? { width: e.videoWidth, height: e.videoHeight } : e;
        }
        static estimateTexMemRequired(e, t) {
          if ((0, o.b)(e)) return 0;
          if ((0, o.A)(e) || (0, o.y)(e))
            return t.encoding === Nr.KTX2_ENCODING
              ? (function (e, t) {
                  if ((0, o.b)(Ar)) return e.byteLength;
                  const r = new Ar.KTX2File(new Uint8Array(e)),
                    i = Fr(r)
                      ? Er(r.getLevels(), r.getHasAlpha(), r.getWidth(), r.getHeight(), t)
                      : 0;
                  return r.close(), r.delete(), i;
                })(e, t.mipmap)
              : t.encoding === Nr.BASIS_ENCODING
              ? (function (e, t) {
                  if ((0, o.b)(Ar)) return e.byteLength;
                  const r = new Ar.BasisFile(new Uint8Array(e)),
                    i = Pr(r)
                      ? Er(
                          r.getNumLevels(0),
                          r.getHasAlpha(),
                          r.getImageWidth(0, 0),
                          r.getImageHeight(0, 0),
                          t,
                        )
                      : 0;
                  return r.close(), r.delete(), i;
                })(e, t.mipmap)
              : e.byteLength;
          const { width: r, height: i } =
            e instanceof Image ||
            e instanceof ImageData ||
            e instanceof HTMLCanvasElement ||
            e instanceof HTMLVideoElement
              ? Nr.getDataDimensions(e)
              : t;
          return (t.mipmap ? 4 / 3 : 1) * r * i * (t.components || 4) || 0;
        }
        dispose() {
          this.data = void 0;
        }
        get width() {
          return this.params.width;
        }
        get height() {
          return this.params.height;
        }
        createDescriptor(e) {
          var t;
          return {
            target: 3553,
            pixelFormat: 6408,
            dataType: 5121,
            wrapMode: this.params.wrap,
            flipped: !this.params.noUnpackFlip,
            samplingMode: this.params.mipmap ? 9987 : 9729,
            hasMipmap: this.params.mipmap,
            preMultiplyAlpha: this.params.preMultiplyAlpha,
            maxAnisotropy:
              null != (t = this.params.maxAnisotropy)
                ? t
                : this.params.mipmap
                ? e.parameters.maxMaxAnisotropy
                : 1,
          };
        }
        load(e, t) {
          if ((0, o.i)(this.glTexture)) return this.glTexture;
          if ((0, o.i)(this.loadingPromise)) return this.loadingPromise;
          const r = this.data;
          return (0, o.b)(r)
            ? ((this.glTexture = new y.T(e, this.createDescriptor(e), null)), this.glTexture)
            : 'string' == typeof r
            ? this.loadFromURL(e, t, r)
            : r instanceof Image
            ? this.loadFromImageElement(e, t, r)
            : r instanceof HTMLVideoElement
            ? this.loadFromVideoElement(e, t, r)
            : r instanceof ImageData || r instanceof HTMLCanvasElement
            ? this.loadFromImage(e, r, t)
            : ((0, o.A)(r) || (0, o.y)(r)) && this.params.encoding === Nr.DDS_ENCODING
            ? this.loadFromDDSData(e, r)
            : ((0, o.A)(r) || (0, o.y)(r)) && this.params.encoding === Nr.KTX2_ENCODING
            ? this.loadFromKTX2(e, r)
            : ((0, o.A)(r) || (0, o.y)(r)) && this.params.encoding === Nr.BASIS_ENCODING
            ? this.loadFromBasis(e, r)
            : (0, o.y)(r)
            ? this.loadFromPixelData(e, r)
            : (0, o.A)(r)
            ? this.loadFromPixelData(e, new Uint8Array(r))
            : null;
        }
        get requiresFrameUpdates() {
          return this.data instanceof HTMLVideoElement;
        }
        frameUpdate(e, t, r) {
          if (!(this.data instanceof HTMLVideoElement) || (0, o.b)(this.glTexture)) return r;
          if (this.data.readyState < 2 || r === this.data.currentTime) return r;
          if ((0, o.i)(this.powerOfTwoStretchInfo)) {
            const { framebuffer: r, vao: i, sourceTexture: o } = this.powerOfTwoStretchInfo;
            o.setData(this.data), this.drawStretchedTexture(e, t, r, i, o, this.glTexture);
          } else {
            const { width: e, height: t } = this.data,
              { width: r, height: i } = this.glTexture.descriptor;
            e !== r || t !== i
              ? this.glTexture.updateData(0, 0, 0, Math.min(e, r), Math.min(t, i), this.data)
              : this.glTexture.setData(this.data);
          }
          return (
            this.glTexture.descriptor.hasMipmap && this.glTexture.generateMipmap(),
            this.data.currentTime
          );
        }
        loadFromDDSData(e, t) {
          return (
            (this.glTexture = (function (e, t, r) {
              const { textureData: i, internalFormat: o, width: n, height: a } = (function (e, t) {
                const r = new Int32Array(e, 0, 31);
                if (542327876 !== r[0]) return Rr.error('Invalid magic number in DDS header'), null;
                if (!(4 & r[20]))
                  return Rr.error('Unsupported format, must contain a FourCC code'), null;
                const i = r[21];
                let o, n;
                switch (i) {
                  case Lr:
                    (o = 8), (n = 33776);
                    break;
                  case zr:
                    (o = 16), (n = 33778);
                    break;
                  case Ir:
                    (o = 16), (n = 33779);
                    break;
                  default:
                    return (
                      Rr.error(
                        'Unsupported FourCC code:',
                        ((a = i),
                        String.fromCharCode(
                          255 & a,
                          (a >> 8) & 255,
                          (a >> 16) & 255,
                          (a >> 24) & 255,
                        )),
                      ),
                      null
                    );
                }
                var a;
                let s = 1,
                  l = r[4],
                  d = r[3];
                (0 == (3 & l) && 0 == (3 & d)) ||
                  (Rr.warn('Rounding up compressed texture size to nearest multiple of 4.'),
                  (l = (l + 3) & -4),
                  (d = (d + 3) & -4));
                const u = l,
                  h = d;
                131072 & r[2] && !1 !== t && (s = Math.max(1, r[7])),
                  1 === s ||
                    ((0, c.a6)(l) && (0, c.a6)(d)) ||
                    (Rr.warn('Ignoring mipmaps of non power of two sized compressed texture.'),
                    (s = 1));
                let f,
                  m,
                  p = r[1] + 4;
                const g = [];
                for (let t = 0; t < s; ++t)
                  (m = ((l + 3) >> 2) * ((d + 3) >> 2) * o),
                    (f = new Uint8Array(e, p, m)),
                    g.push(f),
                    (p += m),
                    (l = Math.max(1, l >> 1)),
                    (d = Math.max(1, d >> 1));
                return {
                  textureData: { type: 'compressed', levels: g },
                  internalFormat: n,
                  width: u,
                  height: h,
                };
              })(r, t.hasMipmap);
              return (
                (t.samplingMode = i.levels.length > 1 ? 9987 : 9729),
                (t.hasMipmap = i.levels.length > 1),
                (t.internalFormat = o),
                (t.width = n),
                (t.height = a),
                new y.T(e, t, i)
              );
            })(e, this.createDescriptor(e), t)),
            this.glTexture
          );
        }
        loadFromKTX2(e, t) {
          return this.loadAsync(() =>
            (async function (e, t, r) {
              (0, o.b)(Ar) && (Ar = await Cr());
              const i = new Ar.KTX2File(new Uint8Array(r));
              if (!Fr(i)) return null;
              i.startTranscoding();
              const n = Dr(
                e,
                t,
                i.getLevels(),
                i.getHasAlpha(),
                i.getWidth(),
                i.getHeight(),
                (e, t) => i.getImageTranscodedSizeInBytes(e, 0, 0, t),
                (e, t, r) => i.transcodeImage(r, e, 0, 0, t, 0, -1, -1),
              );
              return i.close(), i.delete(), n;
            })(e, this.createDescriptor(e), t).then((e) => ((this.glTexture = e), e)),
          );
        }
        loadFromBasis(e, t) {
          return this.loadAsync(() =>
            (async function (e, t, r) {
              (0, o.b)(Ar) && (Ar = await Cr());
              const i = new Ar.BasisFile(new Uint8Array(r));
              if (!Pr(i)) return null;
              i.startTranscoding();
              const n = Dr(
                e,
                t,
                i.getNumLevels(0),
                i.getHasAlpha(),
                i.getImageWidth(0, 0),
                i.getImageHeight(0, 0),
                (e, t) => i.getImageTranscodedSizeInBytes(0, e, t),
                (e, t, r) => i.transcodeImage(r, 0, e, t, 0, 0),
              );
              return i.close(), i.delete(), n;
            })(e, this.createDescriptor(e), t).then((e) => ((this.glTexture = e), e)),
          );
        }
        loadFromPixelData(e, t) {
          ke(this.params.width > 0 && this.params.height > 0);
          const r = this.createDescriptor(e);
          return (
            (r.pixelFormat =
              1 === this.params.components ? 6409 : 3 === this.params.components ? 6407 : 6408),
            (r.width = this.params.width),
            (r.height = this.params.height),
            (this.glTexture = new y.T(e, r, t)),
            this.glTexture
          );
        }
        loadAsync(e) {
          const t = (0, x.yi)();
          this.loadingController = t;
          const r = e(t.signal);
          this.loadingPromise = r;
          const i = () => {
            this.loadingController === t && (this.loadingController = null),
              this.loadingPromise === r && (this.loadingPromise = null);
          };
          return r.then(i, i), r;
        }
        loadFromURL(e, t, r) {
          return this.loadAsync(async (i) => {
            const o = await _(r, { signal: i });
            return this.loadFromImage(e, o, t);
          });
        }
        loadFromImageElement(e, t, r) {
          return r.complete
            ? this.loadFromImage(e, r, t)
            : this.loadAsync(async (i) => {
                const o = await (0, m.l)(r, r.src, !1, i);
                return this.loadFromImage(e, o, t);
              });
        }
        loadFromVideoElement(e, t, r) {
          return r.readyState >= 2
            ? this.loadFromImage(e, r, t)
            : this.loadFromVideoElementAsync(e, t, r);
        }
        loadFromVideoElementAsync(e, t, r) {
          return this.loadAsync(
            (i) =>
              new Promise((n, a) => {
                const s = () => {
                    r.removeEventListener('loadeddata', l),
                      r.removeEventListener('error', c),
                      (0, o.i)(d) && d.remove();
                  },
                  l = () => {
                    r.readyState >= 2 && (s(), n(this.loadFromImage(e, r, t)));
                  },
                  c = (e) => {
                    s(), a(e || new g.Z('Failed to load video'));
                  };
                r.addEventListener('loadeddata', l), r.addEventListener('error', c);
                const d = (0, x.fu)(i, () => c((0, x.zE)()));
              }),
          );
        }
        loadFromImage(e, t, r) {
          const i = Nr.getDataDimensions(t);
          (this.params.width = i.width), (this.params.height = i.height);
          const o = this.createDescriptor(e);
          return (
            (o.pixelFormat = 3 === this.params.components ? 6407 : 6408),
            !this.requiresPowerOfTwo(e, o) || ((0, c.a6)(i.width) && (0, c.a6)(i.height))
              ? ((o.width = i.width),
                (o.height = i.height),
                (this.glTexture = new y.T(e, o, t)),
                this.glTexture)
              : ((this.glTexture = this.makePowerOfTwoTexture(e, t, i, o, r)), this.glTexture)
          );
        }
        requiresPowerOfTwo(e, t) {
          const r = 33071,
            i =
              'number' == typeof t.wrapMode
                ? t.wrapMode === r
                : t.wrapMode.s === r && t.wrapMode.t === r;
          return !(0, y.i)(e.gl) && (t.hasMipmap || !i);
        }
        makePowerOfTwoTexture(e, t, r, i, o) {
          const { width: n, height: a } = r,
            s = (0, c.G)(n),
            l = (0, c.G)(a);
          let d;
          switch (((i.width = s), (i.height = l), this.params.powerOfTwoResizeMode)) {
            case 2:
              (i.textureCoordinateScaleFactor = [n / s, a / l]),
                (d = new y.T(e, i)),
                d.updateData(0, 0, 0, n, a, t);
              break;
            case 1:
            case null:
            case void 0:
              d = this.stretchToPowerOfTwo(e, t, i, o);
              break;
            default:
              (0, mr.n)(this.params.powerOfTwoResizeMode);
          }
          return i.hasMipmap && d.generateMipmap(), d;
        }
        stretchToPowerOfTwo(e, t, r, i) {
          const o = new y.T(e, r),
            n = new _r(e, { colorTarget: 0, depthStencilTarget: 0 }, o),
            a = new y.T(
              e,
              {
                target: 3553,
                pixelFormat: r.pixelFormat,
                dataType: 5121,
                wrapMode: 33071,
                samplingMode: 9729,
                flipped: !!r.flipped,
                maxAnisotropy: 8,
                preMultiplyAlpha: r.preMultiplyAlpha,
              },
              t,
            ),
            s = (function (e, t = Tt, r = ft, i = -1, o = 1) {
              let n = null;
              switch (t) {
                case yt:
                  n = new Float32Array([i, i, 0, 0, o, i, 1, 0, i, o, 0, 1, o, o, 1, 1]);
                  break;
                case Tt:
                default:
                  n = new Float32Array([i, i, o, i, i, o, o, o]);
              }
              return new we(e, r, { geometry: t }, { geometry: xe.createVertex(e, 35044, n) });
            })(e);
          return (
            this.drawStretchedTexture(e, i, n, s, a, o),
            this.requiresFrameUpdates
              ? (this.powerOfTwoStretchInfo = { vao: s, sourceTexture: a, framebuffer: n })
              : (s.dispose(!0),
                a.dispose(),
                n.detachColorTexture(),
                e.bindFramebuffer(null),
                n.dispose()),
            o
          );
        }
        drawStretchedTexture(e, t, r, i, o, n) {
          e.bindFramebuffer(r);
          const a = e.getViewport();
          e.setViewport(0, 0, n.descriptor.width, n.descriptor.height);
          const s = t.program;
          e.useProgram(s),
            s.setUniform4f('color', 1, 1, 1, 1),
            s.bindTexture(o, 'tex'),
            e.bindVAO(i),
            e.setPipelineState(t.pipeline),
            e.drawArrays(
              5,
              0,
              (function (e, t) {
                return (
                  e.vertexBuffers[t].size /
                  (function (e) {
                    return e[0].stride;
                  })(e.layout[t])
                );
              })(i, 'geometry'),
            ),
            e.bindFramebuffer(null),
            e.setViewport(a.x, a.y, a.width, a.height);
        }
        unload() {
          if ((0, o.i)(this.powerOfTwoStretchInfo)) {
            const { framebuffer: e, vao: t, sourceTexture: r } = this.powerOfTwoStretchInfo;
            t.dispose(!0),
              r.dispose(),
              e.dispose(),
              (this.glTexture = null),
              (this.powerOfTwoStretchInfo = null);
          }
          if (
            ((0, o.i)(this.glTexture) && (this.glTexture.dispose(), (this.glTexture = null)),
            (0, o.i)(this.loadingController))
          ) {
            const e = this.loadingController;
            (this.loadingController = null), (this.loadingPromise = null), e.abort();
          }
          this.events.emit('unloaded');
        }
      }
      (Nr.DDS_ENCODING = 'image/vnd-ms.dds'),
        (Nr.KTX2_ENCODING = 'image/ktx2'),
        (Nr.BASIS_ENCODING = 'image/x.basis');
      var Br = r(15215),
        Ur = r(35861),
        Vr = r(56697),
        Hr = r(2484);
      new Hr.O(function () {
        return { origin: null, direction: null };
      }),
        (0, c.b)(),
        (0, c.b)();
      const kr = v.L.getLogger('esri.geometry.support.sphere');
      function Gr() {
        return (0, Ve.a)();
      }
      function Wr(e, t = Gr()) {
        return (0, Ue.c)(t, e);
      }
      function qr(e) {
        return Array.isArray(e) ? e[3] : e;
      }
      function $r(e) {
        return Array.isArray(e) ? e : ei;
      }
      function jr(e, t, r) {
        if ((0, o.b)(t)) return !1;
        const i = (0, c.s)(Hr.b.get(), t.origin, $r(e)),
          n = (0, c.d)(t.direction, t.direction),
          a = 2 * (0, c.d)(t.direction, i),
          s = a * a - 4 * n * ((0, c.d)(i, i) - e[3] * e[3]);
        if (s < 0) return !1;
        const l = Math.sqrt(s);
        let d = (-a - l) / (2 * n);
        const u = (-a + l) / (2 * n);
        return (
          (d < 0 || (u < d && u > 0)) && (d = u),
          !(d < 0 || (r && (0, c.g)(r, t.origin, (0, c.f)(Hr.b.get(), t.direction, d)), 0))
        );
      }
      function Xr(e, t, r) {
        const i = Hr.b.get(),
          o = Hr.s.get();
        (0, c.a)(i, t.origin, t.direction);
        const n = qr(e);
        (0, c.a)(r, i, t.origin), (0, c.f)(r, r, (1 / (0, c.l)(r)) * n);
        const a = Zr(e, t.origin),
          l = (function (e, t) {
            const r = (0, c.d)(e, t) / ((0, c.l)(e) * (0, c.l)(t));
            return -(0, c.i)(r);
          })(t.origin, r);
        return (0, s.i)(o), (0, s.b)(o, o, l + a, i), (0, c.t)(r, r, o), r;
      }
      function Kr(e, t, r) {
        const i = (0, c.s)(Hr.b.get(), t, $r(e)),
          o = (0, c.f)(Hr.b.get(), i, e[3] / (0, c.l)(i));
        return (0, c.g)(r, o, $r(e));
      }
      function Zr(e, t) {
        const r = (0, c.s)(Hr.b.get(), t, $r(e)),
          i = (0, c.l)(r),
          o = qr(e),
          n = o + Math.abs(o - i);
        return (0, c.i)(o / n);
      }
      const Yr = (0, c.b)();
      function Qr(e, t, r, i) {
        const o = (0, c.s)(Yr, t, $r(e));
        switch (r) {
          case 0: {
            const e = (0, c.B)(o, Yr)[2];
            return (0, c.e)(i, -Math.sin(e), Math.cos(e), 0);
          }
          case 1: {
            const e = (0, c.B)(o, Yr),
              t = e[1],
              r = e[2],
              n = Math.sin(t);
            return (0, c.e)(i, -n * Math.cos(r), -n * Math.sin(r), Math.cos(t));
          }
          case 2:
            return (0, c.n)(i, o);
          default:
            return;
        }
      }
      function Jr(e, t) {
        const r = (0, c.s)(ti, t, $r(e));
        return (0, c.l)(r) - e[3];
      }
      const ei = (0, c.b)(),
        ti = (0, c.b)();
      Object.freeze({
        __proto__: null,
        create: Gr,
        copy: Wr,
        fromCenterAndRadius: function (e, t) {
          return (0, Ve.f)(e[0], e[1], e[2], t);
        },
        wrap: function (e) {
          return e;
        },
        clear: function (e) {
          e[0] = e[1] = e[2] = e[3] = 0;
        },
        fromRadius: function (e) {
          return e;
        },
        getRadius: qr,
        getCenter: $r,
        fromValues: function (e, t, r, i) {
          return (0, Ve.f)(e, t, r, i);
        },
        elevate: function (e, t, r) {
          return e !== r && (0, c.j)(r, e), (r[3] = e[3] + t), r;
        },
        setExtent: function (e, t, r) {
          return kr.error('sphere.setExtent is not yet supported'), e === r ? r : Wr(e, r);
        },
        intersectRay: jr,
        intersectsRay: function (e, t) {
          return jr(e, t, null);
        },
        intersectRayClosestSilhouette: function (e, t, r) {
          if (jr(e, t, r)) return r;
          const i = Xr(e, t, Hr.b.get());
          return (
            (0, c.g)(
              r,
              t.origin,
              (0, c.f)(Hr.b.get(), t.direction, (0, c.w)(t.origin, i) / (0, c.l)(t.direction)),
            ),
            r
          );
        },
        closestPointOnSilhouette: Xr,
        closestPoint: function (e, t, r) {
          return jr(e, t, r)
            ? r
            : ((function (e, t, r) {
                const i = (0, c.d)(e.direction, (0, c.s)(r, t, e.origin));
                (0, c.g)(r, e.origin, (0, c.f)(r, e.direction, i));
              })(t, $r(e), r),
              Kr(e, r, r));
        },
        projectPoint: Kr,
        distanceToSilhouette: function (e, t) {
          const r = (0, c.s)(Hr.b.get(), t, $r(e)),
            i = (0, c.A)(r),
            o = e[3] * e[3];
          return Math.sqrt(Math.abs(i - o));
        },
        angleToSilhouette: Zr,
        axisAt: Qr,
        altitudeAt: Jr,
        setAltitudeAt: function (e, t, r, i) {
          const o = Jr(e, t),
            n = Qr(e, t, 2, ti),
            a = (0, c.f)(ti, n, r - o);
          return (0, c.g)(i, t, a);
        },
      });
      const ri = new (class {
        constructor(e = 0) {
          (this.offset = e), (this.sphere = Gr()), (this.tmpVertex = (0, c.b)());
        }
        applyToVertex(e, t, r) {
          const i = this.objectTransform.transform;
          let o = i[0] * e + i[4] * t + i[8] * r + i[12],
            n = i[1] * e + i[5] * t + i[9] * r + i[13],
            a = i[2] * e + i[6] * t + i[10] * r + i[14];
          const s = this.offset / Math.sqrt(o * o + n * n + a * a);
          (o += o * s), (n += n * s), (a += a * s);
          const l = this.objectTransform.inverse;
          return (
            (this.tmpVertex[0] = l[0] * o + l[4] * n + l[8] * a + l[12]),
            (this.tmpVertex[1] = l[1] * o + l[5] * n + l[9] * a + l[13]),
            (this.tmpVertex[2] = l[2] * o + l[6] * n + l[10] * a + l[14]),
            this.tmpVertex
          );
        }
        applyToMinMax(e, t) {
          const r = this.offset / Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
          (e[0] += e[0] * r), (e[1] += e[1] * r), (e[2] += e[2] * r);
          const i = this.offset / Math.sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
          (t[0] += t[0] * i), (t[1] += t[1] * i), (t[2] += t[2] * i);
        }
        applyToAabb(e) {
          const t = this.offset / Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
          (e[0] += e[0] * t), (e[1] += e[1] * t), (e[2] += e[2] * t);
          const r = this.offset / Math.sqrt(e[3] * e[3] + e[4] * e[4] + e[5] * e[5]);
          return (e[3] += e[3] * r), (e[4] += e[4] * r), (e[5] += e[5] * r), e;
        }
        applyToBoundingSphere(e) {
          const t = Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]),
            r = this.offset / t;
          return (
            (this.sphere[0] = e[0] + e[0] * r),
            (this.sphere[1] = e[1] + e[1] * r),
            (this.sphere[2] = e[2] + e[2] * r),
            (this.sphere[3] = e[3] + (e[3] * this.offset) / t),
            this.sphere
          );
        }
      })();
      new (class {
        constructor(e = 0) {
          (this.offset = e),
            (this.componentLocalOriginLength = 0),
            (this.tmpVertex = (0, c.b)()),
            (this.mbs = (0, Ve.a)()),
            (this.obb = { center: (0, c.b)(), halfSize: (0, Vr.c)(), quaternion: null });
        }
        set localOrigin(e) {
          this.componentLocalOriginLength = Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
        }
        applyToVertex(e, t, r) {
          const i = e,
            o = t,
            n = r + this.componentLocalOriginLength,
            a = this.offset / Math.sqrt(i * i + o * o + n * n);
          return (
            (this.tmpVertex[0] = e + i * a),
            (this.tmpVertex[1] = t + o * a),
            (this.tmpVertex[2] = r + n * a),
            this.tmpVertex
          );
        }
        applyToAabb(e) {
          const t = e[0],
            r = e[1],
            i = e[2] + this.componentLocalOriginLength,
            o = e[3],
            n = e[4],
            a = e[5] + this.componentLocalOriginLength,
            s = this.offset / Math.sqrt(t * t + r * r + i * i);
          (e[0] += t * s), (e[1] += r * s), (e[2] += i * s);
          const l = this.offset / Math.sqrt(o * o + n * n + a * a);
          return (e[3] += o * l), (e[4] += n * l), (e[5] += a * l), e;
        }
        applyToMbs(e) {
          const t = Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]),
            r = this.offset / t;
          return (
            (this.mbs[0] = e[0] + e[0] * r),
            (this.mbs[1] = e[1] + e[1] * r),
            (this.mbs[2] = e[2] + e[2] * r),
            (this.mbs[3] = e[3] + (e[3] * this.offset) / t),
            this.mbs
          );
        }
        applyToObb(e) {
          const t = e.center,
            r = this.offset / Math.sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
          (this.obb.center[0] = t[0] + t[0] * r),
            (this.obb.center[1] = t[1] + t[1] * r),
            (this.obb.center[2] = t[2] + t[2] * r),
            (0, c.C)(this.obb.halfSize, e.halfSize, e.quaternion),
            (0, c.g)(this.obb.halfSize, this.obb.halfSize, e.center);
          const i =
            this.offset /
            Math.sqrt(
              this.obb.halfSize[0] * this.obb.halfSize[0] +
                this.obb.halfSize[1] * this.obb.halfSize[1] +
                this.obb.halfSize[2] * this.obb.halfSize[2],
            );
          return (
            (this.obb.halfSize[0] += this.obb.halfSize[0] * i),
            (this.obb.halfSize[1] += this.obb.halfSize[1] * i),
            (this.obb.halfSize[2] += this.obb.halfSize[2] * i),
            (0, c.s)(this.obb.halfSize, this.obb.halfSize, e.center),
            (0, Ur.c)(ii, e.quaternion),
            (0, c.C)(this.obb.halfSize, this.obb.halfSize, ii),
            (this.obb.halfSize[0] *= this.obb.halfSize[0] < 0 ? -1 : 1),
            (this.obb.halfSize[1] *= this.obb.halfSize[1] < 0 ? -1 : 1),
            (this.obb.halfSize[2] *= this.obb.halfSize[2] < 0 ? -1 : 1),
            (this.obb.quaternion = e.quaternion),
            this.obb
          );
        }
      })(),
        new (class {
          constructor(e = 0) {
            (this.offset = e), (this.tmpVertex = (0, c.b)());
          }
          applyToVertex(e, t, r) {
            const i = e + this.localOrigin[0],
              o = t + this.localOrigin[1],
              n = r + this.localOrigin[2],
              a = this.offset / Math.sqrt(i * i + o * o + n * n);
            return (
              (this.tmpVertex[0] = e + i * a),
              (this.tmpVertex[1] = t + o * a),
              (this.tmpVertex[2] = r + n * a),
              this.tmpVertex
            );
          }
          applyToAabb(e) {
            const t = e[0] + this.localOrigin[0],
              r = e[1] + this.localOrigin[1],
              i = e[2] + this.localOrigin[2],
              o = e[3] + this.localOrigin[0],
              n = e[4] + this.localOrigin[1],
              a = e[5] + this.localOrigin[2],
              s = this.offset / Math.sqrt(t * t + r * r + i * i);
            (e[0] += t * s), (e[1] += r * s), (e[2] += i * s);
            const l = this.offset / Math.sqrt(o * o + n * n + a * a);
            return (e[3] += o * l), (e[4] += n * l), (e[5] += a * l), e;
          }
        })();
      const ii = (0, a.d)();
      var oi = r(29768);
      function ni(e) {
        e.vertex.code.add(Ye`float screenSizePerspectiveMinSize(float size, vec4 factor) {
float nonZeroSize = 1.0 - step(size, 0.0);
return (
factor.z * (
1.0 +
nonZeroSize *
2.0 * factor.w / (
size + (1.0 - nonZeroSize)
)
)
);
}`),
          e.vertex.code
            .add(Ye`float screenSizePerspectiveViewAngleDependentFactor(float absCosAngle) {
return absCosAngle * absCosAngle * absCosAngle;
}`),
          e.vertex.code
            .add(Ye`vec4 screenSizePerspectiveScaleFactor(float absCosAngle, float distanceToCamera, vec4 params) {
return vec4(
min(params.x / (distanceToCamera - params.y), 1.0),
screenSizePerspectiveViewAngleDependentFactor(absCosAngle),
params.z,
params.w
);
}`),
          e.vertex.code
            .add(Ye`float applyScreenSizePerspectiveScaleFactorFloat(float size, vec4 factor) {
return max(mix(size * factor.x, size, factor.y), screenSizePerspectiveMinSize(size, factor));
}`),
          e.vertex.code
            .add(Ye`float screenSizePerspectiveScaleFloat(float size, float absCosAngle, float distanceToCamera, vec4 params) {
return applyScreenSizePerspectiveScaleFactorFloat(
size,
screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params)
);
}`),
          e.vertex.code
            .add(Ye`vec2 applyScreenSizePerspectiveScaleFactorVec2(vec2 size, vec4 factor) {
return mix(size * clamp(factor.x, screenSizePerspectiveMinSize(size.y, factor) / size.y, 1.0), size, factor.y);
}`),
          e.vertex.code
            .add(Ye`vec2 screenSizePerspectiveScaleVec2(vec2 size, float absCosAngle, float distanceToCamera, vec4 params) {
return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params));
}`);
      }
      function ai(e, t) {
        const r = e.vertex.code;
        t.verticalOffsetEnabled
          ? (e.vertex.uniforms.add('verticalOffset', 'vec4'),
            t.screenSizePerspectiveEnabled &&
              (e.include(ni), e.vertex.uniforms.add('screenSizePerspectiveAlignment', 'vec4')),
            r.add(Ye`
    vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) {
      float viewDistance = length((view * vec4(worldPos, 1.0)).xyz);
      ${
        1 === t.viewingMode
          ? Ye`vec3 worldNormal = normalize(worldPos + localOrigin);`
          : Ye`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`
      }
      ${
        t.screenSizePerspectiveEnabled
          ? Ye`
          float cosAngle = dot(worldNormal, normalize(worldPos - camPos));
          float verticalOffsetScreenHeight = screenSizePerspectiveScaleFloat(verticalOffset.x, abs(cosAngle), viewDistance, screenSizePerspectiveAlignment);`
          : Ye`
          float verticalOffsetScreenHeight = verticalOffset.x;`
      }
      // Screen sized offset in world space, used for example for line callouts
      float worldOffset = clamp(verticalOffsetScreenHeight * verticalOffset.y * viewDistance, verticalOffset.z, verticalOffset.w);
      return worldNormal * worldOffset;
    }

    vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
      return worldPos + calculateVerticalOffset(worldPos, localOrigin);
    }
    `))
          : r.add(Ye`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`);
      }
      const si = { screenLength: 0, perDistance: 0, minWorldLength: 0, maxWorldLength: 0 };
      function li(e, t) {
        t.vvInstancingEnabled &&
          (t.vvSize || t.vvColor) &&
          e.attributes.add('instanceFeatureAttribute', 'vec4'),
          t.vvSize
            ? (e.vertex.uniforms.add('vvSizeMinSize', 'vec3'),
              e.vertex.uniforms.add('vvSizeMaxSize', 'vec3'),
              e.vertex.uniforms.add('vvSizeOffset', 'vec3'),
              e.vertex.uniforms.add('vvSizeFactor', 'vec3'),
              e.vertex.uniforms.add('vvSymbolRotationMatrix', 'mat3'),
              e.vertex.uniforms.add('vvSymbolAnchor', 'vec3'),
              e.vertex.code.add(Ye`vec3 vvScale(vec4 _featureAttribute) {
return clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize);
}
vec4 vvTransformPosition(vec3 position, vec4 _featureAttribute) {
return vec4(vvSymbolRotationMatrix * ( vvScale(_featureAttribute) * (position + vvSymbolAnchor)), 1.0);
}`),
              e.vertex.code.add(Ye`
      const float eps = 1.192092896e-07;
      vec4 vvTransformNormal(vec3 _normal, vec4 _featureAttribute) {
        vec3 vvScale = clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize + eps, vvSizeMaxSize);
        return vec4(vvSymbolRotationMatrix * _normal / vvScale, 1.0);
      }

      ${
        t.vvInstancingEnabled
          ? Ye`
      vec4 vvLocalNormal(vec3 _normal) {
        return vvTransformNormal(_normal, instanceFeatureAttribute);
      }

      vec4 localPosition() {
        return vvTransformPosition(position, instanceFeatureAttribute);
      }`
          : ''
      }
    `))
            : e.vertex.code.add(Ye`vec4 localPosition() { return vec4(position, 1.0); }
vec4 vvLocalNormal(vec3 _normal) { return vec4(_normal, 1.0); }`),
          t.vvColor
            ? (e.vertex.constants.add('vvColorNumber', 'int', 8),
              e.vertex.code.add(Ye`
      uniform float vvColorValues[vvColorNumber];
      uniform vec4 vvColorColors[vvColorNumber];

      vec4 vvGetColor(vec4 featureAttribute, float values[vvColorNumber], vec4 colors[vvColorNumber]) {
        float value = featureAttribute.y;
        if (value <= values[0]) {
          return colors[0];
        }

        for (int i = 1; i < vvColorNumber; ++i) {
          if (values[i] >= value) {
            float f = (value - values[i-1]) / (values[i] - values[i-1]);
            return mix(colors[i-1], colors[i], f);
          }
        }
        return colors[vvColorNumber - 1];
      }

      ${
        t.vvInstancingEnabled
          ? Ye`
      vec4 vvColor() {
        return vvGetColor(instanceFeatureAttribute, vvColorValues, vvColorColors);
      }`
          : ''
      }
    `))
            : e.vertex.code.add(Ye`vec4 vvColor() { return vec4(1.0); }`);
      }
      function ci(e) {
        e.vertex.code.add(Ye`const float PI = 3.141592653589793;`),
          e.fragment.code.add(Ye`const float PI = 3.141592653589793;
const float LIGHT_NORMALIZATION = 1.0 / PI;
const float INV_PI = 0.3183098861837907;
const float HALF_PI = 1.570796326794897;`);
      }
      function di(e) {
        e.fragment.include(Kt),
          e.fragment.uniforms.add('uShadowMapTex', 'sampler2D'),
          e.fragment.uniforms.add('uShadowMapNum', 'int'),
          e.fragment.uniforms.add('uShadowMapDistance', 'vec4'),
          e.fragment.uniforms.add('uShadowMapMatrix', 'mat4', 4),
          e.fragment.uniforms.add('uDepthHalfPixelSz', 'float'),
          e.fragment.code.add(Ye`int chooseCascade(float _linearDepth, out mat4 mat) {
vec4 distance = uShadowMapDistance;
float depth = _linearDepth;
int i = depth < distance[1] ? 0 : depth < distance[2] ? 1 : depth < distance[3] ? 2 : 3;
mat = i == 0 ? uShadowMapMatrix[0] : i == 1 ? uShadowMapMatrix[1] : i == 2 ? uShadowMapMatrix[2] : uShadowMapMatrix[3];
return i;
}
vec3 lightSpacePosition(vec3 _vpos, mat4 mat) {
vec4 lv = mat * vec4(_vpos, 1.0);
lv.xy /= lv.w;
return 0.5 * lv.xyz + vec3(0.5);
}
vec2 cascadeCoordinates(int i, vec3 lvpos) {
return vec2(float(i - 2 * (i / 2)) * 0.5, float(i / 2) * 0.5) + 0.5 * lvpos.xy;
}
float readShadowMapDepth(vec2 uv, sampler2D _depthTex) {
return rgba2float(texture2D(_depthTex, uv));
}
float posIsInShadow(vec2 uv, vec3 lvpos, sampler2D _depthTex) {
return readShadowMapDepth(uv, _depthTex) < lvpos.z ? 1.0 : 0.0;
}
float filterShadow(vec2 uv, vec3 lvpos, float halfPixelSize, sampler2D _depthTex) {
float texSize = 0.5 / halfPixelSize;
vec2 st = fract((vec2(halfPixelSize) + uv) * texSize);
float s00 = posIsInShadow(uv + vec2(-halfPixelSize, -halfPixelSize), lvpos, _depthTex);
float s10 = posIsInShadow(uv + vec2(halfPixelSize, -halfPixelSize), lvpos, _depthTex);
float s11 = posIsInShadow(uv + vec2(halfPixelSize, halfPixelSize), lvpos, _depthTex);
float s01 = posIsInShadow(uv + vec2(-halfPixelSize, halfPixelSize), lvpos, _depthTex);
return mix(mix(s00, s10, st.x), mix(s01, s11, st.x), st.y);
}
float readShadowMap(const in vec3 _vpos, float _linearDepth) {
mat4 mat;
int i = chooseCascade(_linearDepth, mat);
if (i >= uShadowMapNum) { return 0.0; }
vec3 lvpos = lightSpacePosition(_vpos, mat);
if (lvpos.z >= 1.0) { return 0.0; }
if (lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) { return 0.0; }
vec2 uv = cascadeCoordinates(i, lvpos);
return filterShadow(uv, lvpos, uDepthHalfPixelSz, uShadowMapTex);
}`);
      }
      function ui(e, t) {
        0 === t.output && t.receiveShadows
          ? (e.varyings.add('linearDepth', 'float'),
            e.vertex.code.add(Ye`void forwardLinearDepth() { linearDepth = gl_Position.w; }`))
          : 1 === t.output || 3 === t.output
          ? (e.varyings.add('linearDepth', 'float'),
            e.vertex.uniforms.add('cameraNearFar', 'vec2'),
            e.vertex.code.add(Ye`void forwardLinearDepth() {
linearDepth = (-position_view().z - cameraNearFar[0]) / (cameraNearFar[1] - cameraNearFar[0]);
}`))
          : e.vertex.code.add(Ye`void forwardLinearDepth() {}`);
      }
      function hi(e) {
        const t = e.fragment.code;
        t.add(Ye`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG)
{
return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5;
}`),
          t.add(Ye`float integratedRadiance(float cosTheta2, float roughness)
{
return (cosTheta2 - 1.0) / (cosTheta2 * (1.0 - roughness * roughness) - 1.0);
}`),
          t.add(Ye`vec3 evaluateSpecularIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float RdotNG, float roughness)
{
float cosTheta2 = 1.0 - RdotNG * RdotNG;
float intRadTheta = integratedRadiance(cosTheta2, roughness);
float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta;
float sky = 2.0 - ground;
return (ground * ambientGround + sky * ambientSky) * 0.5;
}`);
      }
      function fi(e, t) {
        const r = e.fragment.code;
        e.include(ci),
          3 === t.pbrMode || 4 === t.pbrMode
            ? (r.add(Ye`
    struct PBRShadingWater
    {
        float NdotL;   // cos angle between normal and light direction
        float NdotV;   // cos angle between normal and view direction
        float NdotH;   // cos angle between normal and half vector
        float VdotH;   // cos angle between view direction and half vector
        float LdotH;   // cos angle between light direction and half vector
        float VdotN;   // cos angle between view direction and normal vector
    };

    float dtrExponent = ${t.useCustomDTRExponentForWater ? '2.2' : '2.0'};
    `),
              r.add(Ye`vec3 fresnelReflection(float angle, vec3 f0, float f90) {
return f0 + (f90 - f0) * pow(1.0 - angle, 5.0);
}`),
              r.add(Ye`float normalDistributionWater(float NdotH, float roughness)
{
float r2 = roughness * roughness;
float NdotH2 = NdotH * NdotH;
float denom = pow((NdotH2 * (r2 - 1.0) + 1.0), dtrExponent) * PI;
return r2 / denom;
}`),
              r.add(Ye`float geometricOcclusionKelemen(float LoH)
{
return 0.25 / (LoH * LoH);
}`),
              r.add(Ye`vec3 brdfSpecularWater(in PBRShadingWater props, float roughness, vec3 F0, float F0Max)
{
vec3  F = fresnelReflection(props.VdotH, F0, F0Max);
float dSun = normalDistributionWater(props.NdotH, roughness);
float V = geometricOcclusionKelemen(props.LdotH);
float diffusionSunHaze = mix(roughness + 0.045, roughness + 0.385, 1.0 - props.VdotH);
float strengthSunHaze  = 1.2;
float dSunHaze = normalDistributionWater(props.NdotH, diffusionSunHaze)*strengthSunHaze;
return ((dSun + dSunHaze) * V) * F;
}
vec3 tonemapACES(const vec3 x) {
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}`))
            : (1 !== t.pbrMode && 2 !== t.pbrMode) ||
              (e.include(hi),
              r.add(Ye`struct PBRShadingInfo
{
float NdotL;
float NdotV;
float NdotH;
float VdotH;
float LdotH;
float NdotNG;
float RdotNG;
float NdotAmbDir;
float NdotH_Horizon;
vec3 skyRadianceToSurface;
vec3 groundRadianceToSurface;
vec3 skyIrradianceToSurface;
vec3 groundIrradianceToSurface;
float averageAmbientRadiance;
float ssao;
vec3 albedoLinear;
vec3 f0;
vec3 f90;
vec3 diffuseColor;
float metalness;
float roughness;
};`),
              r.add(Ye`float normalDistribution(float NdotH, float roughness)
{
float a = NdotH * roughness;
float b = roughness / (1.0 - NdotH * NdotH + a * a);
return b * b * INV_PI;
}`),
              r.add(Ye`const vec4 c0 = vec4(-1.0, -0.0275, -0.572,  0.022);
const vec4 c1 = vec4( 1.0,  0.0425,  1.040, -0.040);
const vec2 c2 = vec2(-1.04, 1.04);
vec2 prefilteredDFGAnalytical(float roughness, float NdotV) {
vec4 r = roughness * c0 + c1;
float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
return c2 * a004 + r.zw;
}`),
              r.add(Ye`vec3 evaluateEnvironmentIllumination(PBRShadingInfo inputs) {
vec3 indirectDiffuse = evaluateDiffuseIlluminationHemisphere(inputs.groundIrradianceToSurface, inputs.skyIrradianceToSurface, inputs.NdotNG);
vec3 indirectSpecular = evaluateSpecularIlluminationHemisphere(inputs.groundRadianceToSurface, inputs.skyRadianceToSurface, inputs.RdotNG, inputs.roughness);
vec3 diffuseComponent = inputs.diffuseColor * indirectDiffuse * INV_PI;
vec2 dfg = prefilteredDFGAnalytical(inputs.roughness, inputs.NdotV);
vec3 specularColor = inputs.f0 * dfg.x + inputs.f90 * dfg.y;
vec3 specularComponent = specularColor * indirectSpecular;
return (diffuseComponent + specularComponent);
}`),
              r.add(Ye`float gamutMapChanel(float x, vec2 p){
return (x < p.x) ? mix(0.0, p.y, x/p.x) : mix(p.y, 1.0, (x - p.x) / (1.0 - p.x) );
}`),
              r.add(Ye`vec3 blackLevelSoftCompression(vec3 inColor, PBRShadingInfo inputs){
vec3 outColor;
vec2 p = vec2(0.02 * (inputs.averageAmbientRadiance), 0.0075 * (inputs.averageAmbientRadiance));
outColor.x = gamutMapChanel(inColor.x, p) ;
outColor.y = gamutMapChanel(inColor.y, p) ;
outColor.z = gamutMapChanel(inColor.z, p) ;
return outColor;
}`));
      }
      class mi {
        constructor(e) {
          (this.context = e),
            (this.svgAlwaysPremultipliesAlpha = !1),
            (this._doublePrecisionRequiresObfuscation = null),
            (async function (e) {
              const t = new Image();
              if (
                ((t.src =
                  "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A"),
                (t.width = 5),
                (t.height = 5),
                await t.decode(),
                !e.gl)
              )
                return !0;
              const r = new _r(
                  e,
                  { colorTarget: 0, depthStencilTarget: 0 },
                  {
                    target: 3553,
                    wrapMode: 33071,
                    pixelFormat: 6408,
                    dataType: 5121,
                    samplingMode: 9728,
                    width: 1,
                    height: 1,
                  },
                ),
                i = xe.createVertex(e, 35044, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])),
                o = new we(
                  e,
                  new Map([['a_pos', 0]]),
                  {
                    geometry: [
                      { name: 'a_pos', count: 2, type: 5123, offset: 0, stride: 4, normalized: !1 },
                    ],
                  },
                  { geometry: i },
                ),
                n = new Le(
                  e,
                  '\n  precision highp float;\n\n  attribute vec2 a_pos;\n  varying vec2 v_uv;\n\n  void main() {\n    v_uv = a_pos;\n    gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n  }\n  ',
                  '\n  precision highp float;\n\n  varying vec2 v_uv;\n  uniform sampler2D u_texture;\n\n  void main() {\n    gl_FragColor = texture2D(u_texture, v_uv);\n  }\n  ',
                  new Map([['a_pos', 0]]),
                );
              e.useProgram(n);
              const a = new y.T(
                e,
                {
                  dataType: 5121,
                  pixelFormat: 6408,
                  preMultiplyAlpha: !1,
                  wrapMode: 33071,
                  samplingMode: 9729,
                },
                t,
              );
              e.bindTexture(a, 0), n.setUniform1i('u_texture', 0);
              const s = e.getBoundFramebufferObject(),
                { x: l, y: c, width: d, height: u } = e.getViewport();
              e.bindFramebuffer(r), e.setViewport(0, 0, 1, 1), e.bindVAO(o), e.drawArrays(5, 0, 4);
              const h = new Uint8Array(4);
              return (
                r.readPixels(0, 0, 1, 1, 6408, 5121, h),
                n.dispose(),
                o.dispose(!1),
                i.dispose(),
                r.dispose(),
                a.dispose(),
                e.setViewport(l, c, d, u),
                e.bindFramebuffer(s),
                (t.src = ''),
                255 === h[0]
              );
            })(e).then((e) => (this.svgAlwaysPremultipliesAlpha = !e));
        }
        get doublePrecisionRequiresObfuscation() {
          if ((0, o.b)(this._doublePrecisionRequiresObfuscation)) {
            const e = xi(this.context, !1),
              t = xi(this.context, !0);
            this._doublePrecisionRequiresObfuscation = 0 !== e && (0 === t || e / t > 5);
          }
          return this._doublePrecisionRequiresObfuscation;
        }
      }
      let pi = null;
      function gi(e) {
        return ((0, o.b)(pi) || pi.context !== e) && (pi = new mi(e)), pi;
      }
      function vi(e) {
        (0, o.i)(pi) && pi.context === e && (pi = null);
      }
      function xi(e, t) {
        const r = new _r(
            e,
            { colorTarget: 0, depthStencilTarget: 0 },
            {
              target: 3553,
              wrapMode: 33071,
              pixelFormat: 6408,
              dataType: 5121,
              samplingMode: 9728,
              width: 1,
              height: 1,
            },
          ),
          i = xe.createVertex(e, 35044, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])),
          o = new we(
            e,
            new Map([['position', 0]]),
            {
              geometry: [
                { name: 'position', count: 2, type: 5123, offset: 0, stride: 4, normalized: !1 },
              ],
            },
            { geometry: i },
          ),
          n = (0, c.p)(5633261.287538229, 2626832.878767164, 1434988.0495278358),
          a = (0, c.p)(5633271.46742708, 2626873.6381334523, 1434963.231608387),
          s = (function (r, i) {
            const o = new Le(
                e,
                `\n\n  precision highp float;\n\n  attribute vec2 position;\n\n  uniform vec3 u_highA;\n  uniform vec3 u_lowA;\n  uniform vec3 u_highB;\n  uniform vec3 u_lowB;\n\n  varying vec4 v_color;\n\n  ${
                  t ? '#define DOUBLE_PRECISION_REQUIRES_OBFUSCATION' : ''
                }\n\n  #ifdef DOUBLE_PRECISION_REQUIRES_OBFUSCATION\n\n  vec3 dpPlusFrc(vec3 a, vec3 b) {\n    return mix(a, a + b, vec3(notEqual(b, vec3(0))));\n  }\n\n  vec3 dpMinusFrc(vec3 a, vec3 b) {\n    return mix(vec3(0), a - b, vec3(notEqual(a, b)));\n  }\n\n  vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {\n    vec3 t1 = dpPlusFrc(hiA, hiB);\n    vec3 e = dpMinusFrc(t1, hiA);\n    vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;\n    return t1 + t2;\n  }\n\n  #else\n\n  vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {\n    vec3 t1 = hiA + hiB;\n    vec3 e = t1 - hiA;\n    vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;\n    return t1 + t2;\n  }\n\n  #endif\n\n  const float MAX_RGBA_FLOAT =\n    255.0 / 256.0 +\n    255.0 / 256.0 / 256.0 +\n    255.0 / 256.0 / 256.0 / 256.0 +\n    255.0 / 256.0 / 256.0 / 256.0 / 256.0;\n\n  const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);\n\n  vec4 float2rgba(const float value) {\n    // Make sure value is in the domain we can represent\n    float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);\n\n    // Decompose value in 32bit fixed point parts represented as\n    // uint8 rgba components. Decomposition uses the fractional part after multiplying\n    // by a power of 256 (this removes the bits that are represented in the previous\n    // component) and then converts the fractional part to 8bits.\n    vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);\n\n    // Convert uint8 values (from 0 to 255) to floating point representation for\n    // the shader\n    const float toU8AsFloat = 1.0 / 255.0;\n\n    return fixedPointU8 * toU8AsFloat;\n  }\n\n  void main() {\n    vec3 val = dpAdd(u_highA, u_lowA, -u_highB, -u_lowB);\n\n    v_color = float2rgba(val.z / 25.0);\n\n    gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);\n  }\n  `,
                '\n  precision highp float;\n\n  varying vec4 v_color;\n\n  void main() {\n    gl_FragColor = v_color;\n  }\n  ',
                new Map([['position', 0]]),
              ),
              n = new Float32Array(6);
            je(r, n, 3);
            const a = new Float32Array(6);
            return (
              je(i, a, 3),
              e.useProgram(o),
              o.setUniform3f('u_highA', n[0], n[2], n[4]),
              o.setUniform3f('u_lowA', n[1], n[3], n[5]),
              o.setUniform3f('u_highB', a[0], a[2], a[4]),
              o.setUniform3f('u_lowB', a[1], a[3], a[5]),
              o
            );
          })(n, a),
          l = e.getBoundFramebufferObject(),
          { x: d, y: u, width: h, height: f } = e.getViewport();
        e.bindFramebuffer(r), e.setViewport(0, 0, 1, 1), e.bindVAO(o), e.drawArrays(5, 0, 4);
        const m = new Uint8Array(4);
        r.readPixels(0, 0, 1, 1, 6408, 5121, m),
          s.dispose(),
          o.dispose(!1),
          i.dispose(),
          r.dispose(),
          e.setViewport(d, u, h, f),
          e.bindFramebuffer(l);
        const p = (n[2] - a[2]) / 25,
          g = Ge(m);
        return Math.abs(p - g);
      }
      function bi({ code: e }, t) {
        t.doublePrecisionRequiresObfuscation
          ? e.add(Ye`vec3 dpPlusFrc(vec3 a, vec3 b) {
return mix(a, a + b, vec3(notEqual(b, vec3(0))));
}
vec3 dpMinusFrc(vec3 a, vec3 b) {
return mix(vec3(0), a - b, vec3(notEqual(a, b)));
}
vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
vec3 t1 = dpPlusFrc(hiA, hiB);
vec3 e = dpMinusFrc(t1, hiA);
vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;
return t1 + t2;
}`)
          : e.add(Ye`vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
vec3 t1 = hiA + hiB;
vec3 e = t1 - hiA;
vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;
return t1 + t2;
}`);
      }
      function _i(e) {
        return (
          !!(0, o.h)('force-double-precision-obfuscation') ||
          gi(e).doublePrecisionRequiresObfuscation
        );
      }
      function Ti(e, t) {
        t.instanced &&
          t.instancedDoublePrecision &&
          (e.attributes.add('modelOriginHi', 'vec3'),
          e.attributes.add('modelOriginLo', 'vec3'),
          e.attributes.add('model', 'mat3'),
          e.attributes.add('modelNormal', 'mat3')),
          t.instancedDoublePrecision &&
            (e.vertex.include(bi, t),
            e.vertex.uniforms.add('viewOriginHi', 'vec3'),
            e.vertex.uniforms.add('viewOriginLo', 'vec3'));
        const r = [
          Ye`
    vec3 calculateVPos() {
      ${
        t.instancedDoublePrecision
          ? 'return model * localPosition().xyz;'
          : 'return localPosition().xyz;'
      }
    }
    `,
          Ye`
    vec3 subtractOrigin(vec3 _pos) {
      ${
        t.instancedDoublePrecision
          ? Ye`
          vec3 originDelta = dpAdd(viewOriginHi, viewOriginLo, -modelOriginHi, -modelOriginLo);
          return _pos - originDelta;`
          : 'return vpos;'
      }
    }
    `,
          Ye`
    vec3 dpNormal(vec4 _normal) {
      ${
        t.instancedDoublePrecision
          ? 'return normalize(modelNormal * _normal.xyz);'
          : 'return normalize(_normal.xyz);'
      }
    }
    `,
          Ye`
    vec3 dpNormalView(vec4 _normal) {
      ${
        t.instancedDoublePrecision
          ? 'return normalize((viewNormal * vec4(modelNormal * _normal.xyz, 1.0)).xyz);'
          : 'return normalize((viewNormal * _normal).xyz);'
      }
    }
    `,
          t.vertexTangents
            ? Ye`
    vec4 dpTransformVertexTangent(vec4 _tangent) {
      ${
        t.instancedDoublePrecision
          ? 'return vec4(modelNormal * _tangent.xyz, _tangent.w);'
          : 'return _tangent;'
      }

    }
    `
            : Ye``,
        ];
        e.vertex.code.add(r[0]),
          e.vertex.code.add(r[1]),
          e.vertex.code.add(r[2]),
          2 === t.output && e.vertex.code.add(r[3]),
          e.vertex.code.add(r[4]);
      }
      !(function (e) {
        (e.Uniforms = class {}),
          (e.bindCustomOrigin = function (e, t) {
            (function (e, t, r, i) {
              for (let i = 0; i < 3; ++i)
                (Xe[0] = e[i]), je(Xe, Ke, 1), (t[i] = Ke[0]), (r[i] = Ke[1]);
            })(t, yi, Mi),
              e.setUniform3fv('viewOriginHi', yi),
              e.setUniform3fv('viewOriginLo', Mi);
          });
      })(Ti || (Ti = {}));
      const yi = (0, c.b)(),
        Mi = (0, c.b)();
      function wi(e, t) {
        1 === t.attributeTextureCoordinates &&
          (e.attributes.add('uv0', 'vec2'),
          e.varyings.add('vuv0', 'vec2'),
          e.vertex.code.add(Ye`void forwardTextureCoordinates() {
vuv0 = uv0;
}`)),
          2 === t.attributeTextureCoordinates &&
            (e.attributes.add('uv0', 'vec2'),
            e.varyings.add('vuv0', 'vec2'),
            e.attributes.add('uvRegion', 'vec4'),
            e.varyings.add('vuvRegion', 'vec4'),
            e.vertex.code.add(Ye`void forwardTextureCoordinates() {
vuv0 = uv0;
vuvRegion = uvRegion;
}`)),
          0 === t.attributeTextureCoordinates &&
            e.vertex.code.add(Ye`void forwardTextureCoordinates() {}`);
      }
      function Ai(e) {
        e.extensions.add('GL_EXT_shader_texture_lod'),
          e.extensions.add('GL_OES_standard_derivatives'),
          e.fragment.code.add(Ye`#ifndef GL_EXT_shader_texture_lod
float calcMipMapLevel(const vec2 ddx, const vec2 ddy) {
float deltaMaxSqr = max(dot(ddx, ddx), dot(ddy, ddy));
return max(0.0, 0.5 * log2(deltaMaxSqr));
}
#endif
vec4 textureAtlasLookup(sampler2D texture, vec2 textureSize, vec2 textureCoordinates, vec4 atlasRegion) {
vec2 atlasScale = atlasRegion.zw - atlasRegion.xy;
vec2 uvAtlas = fract(textureCoordinates) * atlasScale + atlasRegion.xy;
float maxdUV = 0.125;
vec2 dUVdx = clamp(dFdx(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
vec2 dUVdy = clamp(dFdy(textureCoordinates), -maxdUV, maxdUV) * atlasScale;
#ifdef GL_EXT_shader_texture_lod
return texture2DGradEXT(texture, uvAtlas, dUVdx, dUVdy);
#else
vec2 dUVdxAuto = dFdx(uvAtlas);
vec2 dUVdyAuto = dFdy(uvAtlas);
float mipMapLevel = calcMipMapLevel(dUVdx * textureSize, dUVdy * textureSize);
float autoMipMapLevel = calcMipMapLevel(dUVdxAuto * textureSize, dUVdyAuto * textureSize);
return texture2D(texture, uvAtlas, mipMapLevel - autoMipMapLevel);
#endif
}`);
      }
      function Si(e, t) {
        e.include(wi, t),
          e.fragment.code.add(Ye`
  struct TextureLookupParameter {
    vec2 uv;
    ${t.supportsTextureAtlas ? 'vec2 size;' : ''}
  } vtc;
  `),
          1 === t.attributeTextureCoordinates &&
            e.fragment.code
              .add(Ye`vec4 textureLookup(sampler2D tex, TextureLookupParameter params) {
return texture2D(tex, params.uv);
}`),
          2 === t.attributeTextureCoordinates &&
            (e.include(Ai),
            e.fragment.code
              .add(Ye`vec4 textureLookup(sampler2D tex, TextureLookupParameter params) {
return textureAtlasLookup(tex, params.size, params.uv, vuvRegion);
}`));
      }
      const Ci = (0, Vr.f)(0, 0.6, 0.2);
      function Ei(e, t) {
        const r = e.fragment,
          i = t.hasMetalnessAndRoughnessTexture || t.hasEmissionTexture || t.hasOcclusionTexture;
        1 === t.pbrMode && i && e.include(Si, t),
          2 !== t.pbrMode
            ? (0 === t.pbrMode && r.code.add(Ye`float getBakedOcclusion() { return 1.0; }`),
              1 === t.pbrMode &&
                (r.uniforms.add('emissionFactor', 'vec3'),
                r.uniforms.add('mrrFactors', 'vec3'),
                r.code.add(Ye`vec3 mrr;
vec3 emission;
float occlusion;`),
                t.hasMetalnessAndRoughnessTexture &&
                  (r.uniforms.add('texMetallicRoughness', 'sampler2D'),
                  t.supportsTextureAtlas && r.uniforms.add('texMetallicRoughnessSize', 'vec2'),
                  r.code.add(Ye`void applyMetallnessAndRoughness(TextureLookupParameter params) {
vec3 metallicRoughness = textureLookup(texMetallicRoughness, params).rgb;
mrr[0] *= metallicRoughness.b;
mrr[1] *= metallicRoughness.g;
}`)),
                t.hasEmissionTexture &&
                  (r.uniforms.add('texEmission', 'sampler2D'),
                  t.supportsTextureAtlas && r.uniforms.add('texEmissionSize', 'vec2'),
                  r.code.add(Ye`void applyEmission(TextureLookupParameter params) {
emission *= textureLookup(texEmission, params).rgb;
}`)),
                t.hasOcclusionTexture
                  ? (r.uniforms.add('texOcclusion', 'sampler2D'),
                    t.supportsTextureAtlas && r.uniforms.add('texOcclusionSize', 'vec2'),
                    r.code.add(Ye`void applyOcclusion(TextureLookupParameter params) {
occlusion *= textureLookup(texOcclusion, params).r;
}
float getBakedOcclusion() {
return occlusion;
}`))
                  : r.code.add(Ye`float getBakedOcclusion() { return 1.0; }`),
                r.code.add(Ye`
    void applyPBRFactors() {
      mrr = mrrFactors;
      emission = emissionFactor;
      occlusion = 1.0;
      ${i ? 'vtc.uv = vuv0;' : ''}
      ${
        t.hasMetalnessAndRoughnessTexture
          ? t.supportsTextureAtlas
            ? 'vtc.size = texMetallicRoughnessSize; applyMetallnessAndRoughness(vtc);'
            : 'applyMetallnessAndRoughness(vtc);'
          : ''
      }
      ${
        t.hasEmissionTexture
          ? t.supportsTextureAtlas
            ? 'vtc.size = texEmissionSize; applyEmission(vtc);'
            : 'applyEmission(vtc);'
          : ''
      }
      ${
        t.hasOcclusionTexture
          ? t.supportsTextureAtlas
            ? 'vtc.size = texOcclusionSize; applyOcclusion(vtc);'
            : 'applyOcclusion(vtc);'
          : ''
      }
    }
  `)))
            : r.code.add(Ye`const vec3 mrr = vec3(0.0, 0.6, 0.2);
const vec3 emission = vec3(0.0);
float occlusion = 1.0;
void applyPBRFactors() {}
float getBakedOcclusion() { return 1.0; }`);
      }
      function Pi(e, t, r = !1) {
        r ||
          (e.setUniform3fv('mrrFactors', t.mrrFactors),
          e.setUniform3fv('emissionFactor', t.emissiveFactor));
      }
      function Fi(e) {
        e.vertex.code
          .add(Ye`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) {
vec3 camToVert = posWorld - camPosWorld;
bool isBackface = dot(camToVert, normalWorld) > 0.0;
if (isBackface) {
posClip.z += 0.0000003 * posClip.w;
}
return posClip;
}`);
      }
      function Di(e) {
        const t = Ye`vec3 decodeNormal(vec2 f) {
float z = 1.0 - abs(f.x) - abs(f.y);
return vec3(f + sign(f) * min(z, 0.0), z);
}`;
        e.fragment.code.add(t), e.vertex.code.add(t);
      }
      function Ri(e, t) {
        0 === t.normalType &&
          (e.attributes.add('normal', 'vec3'),
          e.vertex.code.add(Ye`vec3 normalModel() {
return normal;
}`)),
          1 === t.normalType &&
            (e.include(Di),
            e.attributes.add('normalCompressed', 'vec2'),
            e.vertex.code.add(Ye`vec3 normalModel() {
return decodeNormal(normalCompressed);
}`)),
          3 === t.normalType &&
            (e.extensions.add('GL_OES_standard_derivatives'),
            e.fragment.code.add(Ye`vec3 screenDerivativeNormal(vec3 positionView) {
return normalize(cross(dFdx(positionView), dFdy(positionView)));
}`));
      }
      function Oi(e) {
        e.attributes.add('position', 'vec3'),
          e.vertex.code.add(Ye`vec3 positionModel() { return position; }`);
      }
      function Li(e) {
        e.vertex.code.add(Ye`
    vec4 decodeSymbolColor(vec4 symbolColor, out int colorMixMode) {
      float symbolAlpha = 0.0;

      const float maxTint = 85.0;
      const float maxReplace = 170.0;
      const float scaleAlpha = 3.0;

      if (symbolColor.a > maxReplace) {
        colorMixMode = ${Ye.int(1)};
        symbolAlpha = scaleAlpha * (symbolColor.a - maxReplace);
      } else if (symbolColor.a > maxTint) {
        colorMixMode = ${Ye.int(3)};
        symbolAlpha = scaleAlpha * (symbolColor.a - maxTint);
      } else if (symbolColor.a > 0.0) {
        colorMixMode = ${Ye.int(4)};
        symbolAlpha = scaleAlpha * symbolColor.a;
      } else {
        colorMixMode = ${Ye.int(1)};
        symbolAlpha = 0.0;
      }

      return vec4(symbolColor.r, symbolColor.g, symbolColor.b, symbolAlpha);
    }
  `);
      }
      function zi(e, t) {
        t.symbolColor
          ? (e.include(Li),
            e.attributes.add('symbolColor', 'vec4'),
            e.varyings.add('colorMixMode', 'mediump float'))
          : e.fragment.uniforms.add('colorMixMode', 'int'),
          t.symbolColor
            ? e.vertex.code.add(Ye`int symbolColorMixMode;
vec4 getSymbolColor() {
return decodeSymbolColor(symbolColor, symbolColorMixMode) * 0.003921568627451;
}
void forwardColorMixMode() {
colorMixMode = float(symbolColorMixMode) + 0.5;
}`)
            : e.vertex.code.add(Ye`vec4 getSymbolColor() { return vec4(1.0); }
void forwardColorMixMode() {}`);
      }
      function Ii(e, t) {
        e.include(Oi),
          e.vertex.include(bi, t),
          e.varyings.add('vPositionWorldCameraRelative', 'vec3'),
          e.varyings.add('vPosition_view', 'vec3'),
          e.vertex.uniforms.add('uTransform_WorldFromModel_RS', 'mat3'),
          e.vertex.uniforms.add('uTransform_WorldFromModel_TH', 'vec3'),
          e.vertex.uniforms.add('uTransform_WorldFromModel_TL', 'vec3'),
          e.vertex.uniforms.add('uTransform_WorldFromView_TH', 'vec3'),
          e.vertex.uniforms.add('uTransform_WorldFromView_TL', 'vec3'),
          e.vertex.uniforms.add('uTransform_ViewFromCameraRelative_RS', 'mat3'),
          e.vertex.uniforms.add('uTransform_ProjFromView', 'mat4'),
          e.vertex.code.add(Ye`vec3 positionWorldCameraRelative() {
vec3 rotatedModelPosition = uTransform_WorldFromModel_RS * positionModel();
vec3 transform_CameraRelativeFromModel = dpAdd(
uTransform_WorldFromModel_TL,
uTransform_WorldFromModel_TH,
-uTransform_WorldFromView_TL,
-uTransform_WorldFromView_TH
);
return transform_CameraRelativeFromModel + rotatedModelPosition;
}
vec3 position_view() {
return uTransform_ViewFromCameraRelative_RS * positionWorldCameraRelative();
}
void forwardPosition() {
vPositionWorldCameraRelative = positionWorldCameraRelative();
vPosition_view = position_view();
gl_Position = uTransform_ProjFromView * vec4(vPosition_view, 1.0);
}
vec3 positionWorld() {
return uTransform_WorldFromView_TL + vPositionWorldCameraRelative;
}`),
          e.fragment.uniforms.add('uTransform_WorldFromView_TL', 'vec3'),
          e.fragment.code.add(Ye`vec3 positionWorld() {
return uTransform_WorldFromView_TL + vPositionWorldCameraRelative;
}`);
      }
      function Ni(e, t) {
        0 === t.normalType || 1 === t.normalType
          ? (e.include(Ri, t),
            e.varyings.add('vNormalWorld', 'vec3'),
            e.varyings.add('vNormalView', 'vec3'),
            e.vertex.uniforms.add('uTransformNormal_GlobalFromModel', 'mat3'),
            e.vertex.uniforms.add('uTransformNormal_ViewFromGlobal', 'mat3'),
            e.vertex.code.add(Ye`void forwardNormal() {
vNormalWorld = uTransformNormal_GlobalFromModel * normalModel();
vNormalView = uTransformNormal_ViewFromGlobal * vNormalWorld;
}`))
          : 2 === t.normalType
          ? (e.include(Ii, t),
            e.varyings.add('vNormalWorld', 'vec3'),
            e.vertex.code.add(Ye`
    void forwardNormal() {
      vNormalWorld = ${
        1 === t.viewingMode
          ? Ye`normalize(vPositionWorldCameraRelative);`
          : Ye`vec3(0.0, 0.0, 1.0);`
      }
    }
    `))
          : e.vertex.code.add(Ye`void forwardNormal() {}`);
      }
      function Bi(e, t) {
        const r = e.vertex.code,
          i = e.fragment.code;
        (1 !== t.output && 3 !== t.output) ||
          (e.include(Qe, { linearDepth: !0 }),
          e.include(wi, t),
          e.include(li, t),
          e.include(hr, t),
          e.include(jt, t),
          e.vertex.uniforms.add('cameraNearFar', 'vec2'),
          e.varyings.add('depth', 'float'),
          t.hasColorTexture && e.fragment.uniforms.add('tex', 'sampler2D'),
          r.add(Ye`void main(void) {
vpos = calculateVPos();
vpos = subtractOrigin(vpos);
vpos = addVerticalOffset(vpos, localOrigin);
gl_Position = transformPositionWithDepth(proj, view, vpos, cameraNearFar, depth);
forwardTextureCoordinates();
}`),
          e.include(er, t),
          i.add(Ye`
      void main(void) {
        discardBySlice(vpos);
        ${
          t.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        discardOrAdjustAlpha(texColor);`
            : ''
        }
        outputDepth(depth);
      }
    `)),
          2 === t.output &&
            (e.include(Qe, { linearDepth: !1 }),
            e.include(Ri, t),
            e.include(Ni, t),
            e.include(wi, t),
            e.include(li, t),
            t.hasColorTexture && e.fragment.uniforms.add('tex', 'sampler2D'),
            e.vertex.uniforms.add('viewNormal', 'mat4'),
            e.varyings.add('vPositionView', 'vec3'),
            r.add(Ye`
      void main(void) {
        vpos = calculateVPos();
        vpos = subtractOrigin(vpos);
        ${
          0 === t.normalType
            ? Ye`
        vNormalWorld = dpNormalView(vvLocalNormal(normalModel()));`
            : ''
        }
        vpos = addVerticalOffset(vpos, localOrigin);
        gl_Position = transformPosition(proj, view, vpos);
        forwardTextureCoordinates();
      }
    `),
            e.include(jt, t),
            e.include(er, t),
            i.add(Ye`
      void main() {
        discardBySlice(vpos);
        ${
          t.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        discardOrAdjustAlpha(texColor);`
            : ''
        }

        ${
          3 === t.normalType
            ? Ye`
            vec3 normal = screenDerivativeNormal(vPositionView);`
            : Ye`
            vec3 normal = normalize(vNormalWorld);
            if (gl_FrontFacing == false) normal = -normal;`
        }
        gl_FragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0);
      }
    `)),
          4 === t.output &&
            (e.include(Qe, { linearDepth: !1 }),
            e.include(wi, t),
            e.include(li, t),
            t.hasColorTexture && e.fragment.uniforms.add('tex', 'sampler2D'),
            r.add(Ye`void main(void) {
vpos = calculateVPos();
vpos = subtractOrigin(vpos);
vpos = addVerticalOffset(vpos, localOrigin);
gl_Position = transformPosition(proj, view, vpos);
forwardTextureCoordinates();
}`),
            e.include(jt, t),
            e.include(er, t),
            e.include(Jt),
            i.add(Ye`
      void main() {
        discardBySlice(vpos);
        ${
          t.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        discardOrAdjustAlpha(texColor);`
            : ''
        }
        outputHighlight();
      }
    `));
      }
      function Ui(e, t) {
        const r = e.fragment;
        t.vertexTangents
          ? (e.attributes.add('tangent', 'vec4'),
            e.varyings.add('vTangent', 'vec4'),
            2 === t.doubleSidedMode
              ? r.code.add(Ye`mat3 computeTangentSpace(vec3 normal) {
float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w;
vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz);
vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
return mat3(tangent, bitangent, normal);
}`)
              : r.code.add(Ye`mat3 computeTangentSpace(vec3 normal) {
float tangentHeadedness = vTangent.w;
vec3 tangent = normalize(vTangent.xyz);
vec3 bitangent = cross(normal, tangent) * tangentHeadedness;
return mat3(tangent, bitangent, normal);
}`))
          : (e.extensions.add('GL_OES_standard_derivatives'),
            r.code.add(Ye`mat3 computeTangentSpace(vec3 normal, vec3 pos, vec2 st) {
vec3 Q1 = dFdx(pos);
vec3 Q2 = dFdy(pos);
vec2 stx = dFdx(st);
vec2 sty = dFdy(st);
float det = stx.t * sty.s - sty.t * stx.s;
vec3 T = stx.t * Q2 - sty.t * Q1;
T = T - normal * dot(normal, T);
T *= inversesqrt(max(dot(T,T), 1.e-10));
vec3 B = sign(det) * cross(normal, T);
return mat3(T, B, normal);
}`)),
          0 !== t.attributeTextureCoordinates &&
            (e.include(Si, t),
            r.uniforms.add('normalTexture', 'sampler2D'),
            r.uniforms.add('normalTextureSize', 'vec2'),
            r.code.add(Ye`
    vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) {
      vtc.uv = uv;
      ${t.supportsTextureAtlas ? 'vtc.size = normalTextureSize;' : ''}
      vec3 rawNormal = textureLookup(normalTexture, vtc).rgb * 2.0 - 1.0;
      return tangentSpace * rawNormal;
    }
  `));
      }
      function Vi(e, t) {
        const r = e.fragment;
        t.receiveAmbientOcclusion
          ? (r.uniforms.add('ssaoTex', 'sampler2D'),
            r.uniforms.add('viewportPixelSz', 'vec4'),
            r.code.add(Ye`float evaluateAmbientOcclusion() {
return 1.0 - texture2D(ssaoTex, (gl_FragCoord.xy - viewportPixelSz.xy) * viewportPixelSz.zw).a;
}
float evaluateAmbientOcclusionInverse() {
float ssao = texture2D(ssaoTex, (gl_FragCoord.xy - viewportPixelSz.xy) * viewportPixelSz.zw).a;
return viewportPixelSz.z < 0.0 ? 1.0 : ssao;
}`))
          : r.code.add(Ye`float evaluateAmbientOcclusion() { return 0.0; }
float evaluateAmbientOcclusionInverse() { return 1.0; }`);
      }
      function Hi(e, t) {
        const r = e.fragment,
          i = void 0 !== t.lightingSphericalHarmonicsOrder ? t.lightingSphericalHarmonicsOrder : 2;
        0 === i
          ? (r.uniforms.add('lightingAmbientSH0', 'vec3'),
            r.code.add(Ye`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
vec3 ambientLight = 0.282095 * lightingAmbientSH0;
return ambientLight * (1.0 - ambientOcclusion);
}`))
          : 1 === i
          ? (r.uniforms.add('lightingAmbientSH_R', 'vec4'),
            r.uniforms.add('lightingAmbientSH_G', 'vec4'),
            r.uniforms.add('lightingAmbientSH_B', 'vec4'),
            r.code.add(Ye`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
vec4 sh0 = vec4(
0.282095,
0.488603 * normal.x,
0.488603 * normal.z,
0.488603 * normal.y
);
vec3 ambientLight = vec3(
dot(lightingAmbientSH_R, sh0),
dot(lightingAmbientSH_G, sh0),
dot(lightingAmbientSH_B, sh0)
);
return ambientLight * (1.0 - ambientOcclusion);
}`))
          : 2 === i &&
            (r.uniforms.add('lightingAmbientSH0', 'vec3'),
            r.uniforms.add('lightingAmbientSH_R1', 'vec4'),
            r.uniforms.add('lightingAmbientSH_G1', 'vec4'),
            r.uniforms.add('lightingAmbientSH_B1', 'vec4'),
            r.uniforms.add('lightingAmbientSH_R2', 'vec4'),
            r.uniforms.add('lightingAmbientSH_G2', 'vec4'),
            r.uniforms.add('lightingAmbientSH_B2', 'vec4'),
            r.code.add(Ye`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) {
vec3 ambientLight = 0.282095 * lightingAmbientSH0;
vec4 sh1 = vec4(
0.488603 * normal.x,
0.488603 * normal.z,
0.488603 * normal.y,
1.092548 * normal.x * normal.y
);
vec4 sh2 = vec4(
1.092548 * normal.y * normal.z,
0.315392 * (3.0 * normal.z * normal.z - 1.0),
1.092548 * normal.x * normal.z,
0.546274 * (normal.x * normal.x - normal.y * normal.y)
);
ambientLight += vec3(
dot(lightingAmbientSH_R1, sh1),
dot(lightingAmbientSH_G1, sh1),
dot(lightingAmbientSH_B1, sh1)
);
ambientLight += vec3(
dot(lightingAmbientSH_R2, sh2),
dot(lightingAmbientSH_G2, sh2),
dot(lightingAmbientSH_B2, sh2)
);
return ambientLight * (1.0 - ambientOcclusion);
}`),
            (1 !== t.pbrMode && 2 !== t.pbrMode) ||
              r.code.add(Ye`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0);
vec3 calculateAmbientRadiance(float ambientOcclusion)
{
vec3 ambientLight = 1.2 * (0.282095 * lightingAmbientSH0) - 0.2;
return ambientLight *= (1.0 - ambientOcclusion) * skyTransmittance;
}`));
      }
      function ki(e) {
        const t = e.fragment;
        t.uniforms.add('lightingMainDirection', 'vec3'),
          t.uniforms.add('lightingMainIntensity', 'vec3'),
          t.uniforms.add('lightingFixedFactor', 'float'),
          t.code.add(Ye`vec3 evaluateMainLighting(vec3 normal_global, float shadowing) {
float dotVal = clamp(dot(normal_global, lightingMainDirection), 0.0, 1.0);
dotVal = mix(dotVal, 1.0, lightingFixedFactor);
return lightingMainIntensity * ((1.0 - shadowing) * dotVal);
}`);
      }
      function Gi(e, t) {
        const r = e.fragment;
        e.include(ki),
          e.include(Vi, t),
          0 !== t.pbrMode && e.include(fi, t),
          e.include(Hi, t),
          t.receiveShadows && e.include(di, t),
          r.uniforms.add('lightingGlobalFactor', 'float'),
          r.uniforms.add('ambientBoostFactor', 'float'),
          e.include(ci),
          r.code.add(Ye`
    const float GAMMA_SRGB = 2.1;
    const float INV_GAMMA_SRGB = 0.4761904;
    ${0 === t.pbrMode ? '' : 'const vec3 GROUND_REFLECTANCE = vec3(0.2);'}
  `),
          r.code.add(Ye`
    float additionalDirectedAmbientLight(vec3 vPosWorld) {
      float vndl = dot(${
        1 === t.viewingMode ? Ye`normalize(vPosWorld)` : Ye`vec3(0.0, 0.0, 1.0)`
      }, lightingMainDirection);
      return smoothstep(0.0, 1.0, clamp(vndl * 2.5, 0.0, 1.0));
    }
  `),
          r.code.add(Ye`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * lightingMainIntensity;
}`),
          0 === t.pbrMode || 4 === t.pbrMode
            ? r.code
                .add(Ye`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight)
{
vec3 mainLighting = evaluateMainLighting(normalWorld, shadow);
vec3 ambientLighting = calculateAmbientIrradiance(normalWorld, ssao);
vec3 albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
vec3 totalLight = mainLighting + ambientLighting + additionalLight;
totalLight = min(totalLight, vec3(PI));
vec3 outColor = vec3((albedoLinear / PI) * totalLight);
return pow(outColor, vec3(INV_GAMMA_SRGB));
}`)
            : (1 !== t.pbrMode && 2 !== t.pbrMode) ||
              (r.code.add(Ye`const float fillLightIntensity = 0.25;
const float horizonLightDiffusion = 0.4;
const float additionalAmbientIrradianceFactor = 0.02;
vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDir, vec3 normalGround, vec3 mrr, vec3 _emission, float additionalAmbientIrradiance)
{
vec3 viewDirection = -viewDir;
vec3 mainLightDirection = lightingMainDirection;
vec3 h = normalize(viewDirection + mainLightDirection);
PBRShadingInfo inputs;
inputs.NdotL = clamp(dot(normal, mainLightDirection), 0.001, 1.0);
inputs.NdotV = clamp(abs(dot(normal, viewDirection)), 0.001, 1.0);
inputs.NdotH = clamp(dot(normal, h), 0.0, 1.0);
inputs.VdotH = clamp(dot(viewDirection, h), 0.0, 1.0);
inputs.NdotNG = clamp(dot(normal, normalGround), -1.0, 1.0);
vec3 reflectedView = normalize(reflect(viewDirection, normal));
inputs.RdotNG = clamp(dot(reflectedView, normalGround), -1.0, 1.0);
inputs.albedoLinear = pow(albedo, vec3(GAMMA_SRGB));
inputs.ssao = ssao;
inputs.metalness = mrr[0];
inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),
              r.code
                .add(Ye`inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness;
inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0));
inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),
              r.code
                .add(Ye`vec3 ambientDir = vec3(5.0 * normalGround[1] - normalGround[0] * normalGround[2], - 5.0 * normalGround[0] - normalGround[2] * normalGround[1], normalGround[1] * normalGround[1] + normalGround[0] * normalGround[0]);
ambientDir = ambientDir != vec3(0.0)? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
inputs.NdotAmbDir = abs(dot(normal, ambientDir));
vec3 mainLightIrradianceComponent = inputs.NdotL * (1.0 - shadow) * lightingMainIntensity;
vec3 fillLightsIrradianceComponent = inputs.NdotAmbDir * lightingMainIntensity * fillLightIntensity;
vec3 ambientLightIrradianceComponent = calculateAmbientIrradiance(normal, ssao) + additionalLight;
inputs.skyIrradianceToSurface = ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;
inputs.groundIrradianceToSurface = GROUND_REFLECTANCE * ambientLightIrradianceComponent + mainLightIrradianceComponent + fillLightsIrradianceComponent ;`),
              r.code.add(Ye`vec3 horizonRingDir = inputs.RdotNG * normalGround - reflectedView;
vec3 horizonRingH = normalize(viewDirection + horizonRingDir);
inputs.NdotH_Horizon = dot(normal, horizonRingH);
vec3 mainLightRadianceComponent = normalDistribution(inputs.NdotH, inputs.roughness) * lightingMainIntensity * (1.0 - shadow);
vec3 horizonLightRadianceComponent = normalDistribution(inputs.NdotH_Horizon, min(inputs.roughness + horizonLightDiffusion, 1.0)) * lightingMainIntensity * fillLightIntensity;
vec3 ambientLightRadianceComponent = calculateAmbientRadiance(ssao) + additionalLight;
inputs.skyRadianceToSurface = ambientLightRadianceComponent + mainLightRadianceComponent + horizonLightRadianceComponent;
inputs.groundRadianceToSurface = GROUND_REFLECTANCE * (ambientLightRadianceComponent + horizonLightRadianceComponent) + mainLightRadianceComponent;
inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROUND_REFLECTANCE[1]);`),
              r.code.add(Ye`
        vec3 reflectedColorComponent = evaluateEnvironmentIllumination(inputs);
        vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance;
        vec3 emissionComponent = pow(_emission, vec3(GAMMA_SRGB));
        vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent + emissionComponent;
        ${
          2 === t.pbrMode
            ? Ye`vec3 outColor = pow(max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`
            : Ye`vec3 outColor = pow(blackLevelSoftCompression(outColorLinear, inputs), vec3(INV_GAMMA_SRGB));`
        }
        return outColor;
      }
    `));
      }
      function Wi(e, t) {
        const r = e.fragment;
        r.code.add(Ye`struct ShadingNormalParameters {
vec3 normalView;
vec3 viewDirection;
} shadingParams;`),
          1 === t.doubleSidedMode
            ? r.code.add(Ye`vec3 shadingNormal(ShadingNormalParameters params) {
return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView);
}`)
            : 2 === t.doubleSidedMode
            ? r.code.add(Ye`vec3 shadingNormal(ShadingNormalParameters params) {
return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView);
}`)
            : r.code.add(Ye`vec3 shadingNormal(ShadingNormalParameters params) {
return normalize(params.normalView);
}`);
      }
      function qi(e, t) {
        const r = Ye`
  /*
  *  ${t.name}
  *  ${
    0 === t.output
      ? 'RenderOutput: Color'
      : 1 === t.output
      ? 'RenderOutput: Depth'
      : 3 === t.output
      ? 'RenderOutput: Shadow'
      : 2 === t.output
      ? 'RenderOutput: Normal'
      : 4 === t.output
      ? 'RenderOutput: Highlight'
      : ''
  }
  */
  `;
        oe() && (e.fragment.code.add(r), e.vertex.code.add(r));
      }
      function $i(e) {
        e.include(_t),
          e.code.add(Ye`
    vec3 mixExternalColor(vec3 internalColor, vec3 textureColor, vec3 externalColor, int mode) {
      // workaround for artifacts in OSX using Intel Iris Pro
      // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
      vec3 internalMixed = internalColor * textureColor;
      vec3 allMixed = internalMixed * externalColor;

      if (mode == ${Ye.int(1)}) {
        return allMixed;
      }
      else if (mode == ${Ye.int(2)}) {
        return internalMixed;
      }
      else if (mode == ${Ye.int(3)}) {
        return externalColor;
      }
      else {
        // tint (or something invalid)
        float vIn = rgb2v(internalMixed);
        vec3 hsvTint = rgb2hsv(externalColor);
        vec3 hsvOut = vec3(hsvTint.x, hsvTint.y, vIn * hsvTint.z);
        return hsv2rgb(hsvOut);
      }
    }

    float mixExternalOpacity(float internalOpacity, float textureOpacity, float externalOpacity, int mode) {
      // workaround for artifacts in OSX using Intel Iris Pro
      // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
      float internalMixed = internalOpacity * textureOpacity;
      float allMixed = internalMixed * externalOpacity;

      if (mode == ${Ye.int(2)}) {
        return internalMixed;
      }
      else if (mode == ${Ye.int(3)}) {
        return externalOpacity;
      }
      else {
        // multiply or tint (or something invalid)
        return allMixed;
      }
    }
  `);
      }
      !(function (e) {
        (e.ModelTransform = class {
          constructor() {
            (this.worldFromModel_RS = (0, a.c)()),
              (this.worldFromModel_TH = (0, c.b)()),
              (this.worldFromModel_TL = (0, c.b)());
          }
        }),
          (e.ViewProjectionTransform = class {
            constructor() {
              (this.worldFromView_TH = (0, c.b)()),
                (this.worldFromView_TL = (0, c.b)()),
                (this.viewFromCameraRelative_RS = (0, a.c)()),
                (this.projFromView = (0, l.c)());
            }
          }),
          (e.bindModelTransform = function (e, t) {
            e.setUniformMatrix3fv('uTransform_WorldFromModel_RS', t.worldFromModel_RS),
              e.setUniform3fv('uTransform_WorldFromModel_TH', t.worldFromModel_TH),
              e.setUniform3fv('uTransform_WorldFromModel_TL', t.worldFromModel_TL);
          }),
          (e.bindViewProjTransform = function (e, t) {
            e.setUniform3fv('uTransform_WorldFromView_TH', t.worldFromView_TH),
              e.setUniform3fv('uTransform_WorldFromView_TL', t.worldFromView_TL),
              e.setUniformMatrix4fv('uTransform_ProjFromView', t.projFromView),
              e.setUniformMatrix3fv(
                'uTransform_ViewFromCameraRelative_RS',
                t.viewFromCameraRelative_RS,
              );
          });
      })(Ii || (Ii = {})),
        (function (e) {
          e.bindUniforms = function (e, t) {
            e.setUniformMatrix4fv('viewNormal', t);
          };
        })(Ni || (Ni = {}));
      var ji = Object.freeze({
        __proto__: null,
        build: function (e) {
          const t = new tt(),
            r = t.vertex.code,
            i = t.fragment.code;
          return (
            t.include(qi, { name: 'Default Material Shader', output: e.output }),
            t.vertex.uniforms
              .add('proj', 'mat4')
              .add('view', 'mat4')
              .add('camPos', 'vec3')
              .add('localOrigin', 'vec3'),
            t.include(Oi),
            t.varyings.add('vpos', 'vec3'),
            t.include(li, e),
            t.include(Ti, e),
            t.include(ai, e),
            (0 !== e.output && 7 !== e.output) ||
              (t.include(Ri, e),
              t.include(Qe, { linearDepth: !1 }),
              0 === e.normalType && e.offsetBackfaces && t.include(Fi),
              t.include(Ui, e),
              t.include(Ni, e),
              e.instancedColor && t.attributes.add('instanceColor', 'vec4'),
              t.varyings.add('localvpos', 'vec3'),
              t.include(wi, e),
              t.include(ui, e),
              t.include(zi, e),
              t.include(fr, e),
              t.vertex.uniforms.add('externalColor', 'vec4'),
              t.varyings.add('vcolorExt', 'vec4'),
              e.multipassTerrainEnabled && t.varyings.add('depth', 'float'),
              r.add(Ye`
      void main(void) {
        forwardNormalizedVertexColor();
        vcolorExt = externalColor;
        ${e.instancedColor ? 'vcolorExt *= instanceColor;' : ''}
        vcolorExt *= vvColor();
        vcolorExt *= getSymbolColor();
        forwardColorMixMode();

        if (vcolorExt.a < ${Ye.float(0.001)}) {
          gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
        }
        else {
          vpos = calculateVPos();
          localvpos = vpos - view[3].xyz;
          vpos = subtractOrigin(vpos);
          ${
            0 === e.normalType
              ? Ye`
          vNormalWorld = dpNormal(vvLocalNormal(normalModel()));`
              : ''
          }
          vpos = addVerticalOffset(vpos, localOrigin);
          ${e.vertexTangents ? 'vTangent = dpTransformVertexTangent(tangent);' : ''}
          gl_Position = transformPosition(proj, view, vpos);
          ${
            0 === e.normalType && e.offsetBackfaces
              ? 'gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, camPos);'
              : ''
          }
        }

        ${e.multipassTerrainEnabled ? 'depth = (view * vec4(vpos, 1.0)).z;' : ''}
        forwardLinearDepth();
        forwardTextureCoordinates();
      }
    `)),
            7 === e.output &&
              (t.include(jt, e),
              t.include(er, e),
              e.multipassTerrainEnabled && (t.fragment.include(Zt), t.include(tr, e)),
              t.fragment.uniforms
                .add('camPos', 'vec3')
                .add('localOrigin', 'vec3')
                .add('opacity', 'float')
                .add('layerOpacity', 'float'),
              e.hasColorTexture && t.fragment.uniforms.add('tex', 'sampler2D'),
              t.fragment.include($i),
              i.add(Ye`
      void main() {
        discardBySlice(vpos);
        ${e.multipassTerrainEnabled ? 'terrainDepthTest(gl_FragCoord, depth);' : ''}
        ${
          e.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        ${e.textureAlphaPremultiplied ? 'texColor.rgb /= texColor.a;' : ''}
        discardOrAdjustAlpha(texColor);`
            : Ye`vec4 texColor = vec4(1.0);`
        }
        ${
          e.attributeColor
            ? Ye`
        float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`
            : Ye`
        float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));
        `
        }
        gl_FragColor = vec4(opacity_);
      }
    `)),
            0 === e.output &&
              (t.include(jt, e),
              t.include(Gi, e),
              t.include(Vi, e),
              t.include(er, e),
              e.receiveShadows && t.include(di, e),
              e.multipassTerrainEnabled && (t.fragment.include(Zt), t.include(tr, e)),
              t.fragment.uniforms
                .add('camPos', 'vec3')
                .add('localOrigin', 'vec3')
                .add('ambient', 'vec3')
                .add('diffuse', 'vec3')
                .add('opacity', 'float')
                .add('layerOpacity', 'float'),
              e.hasColorTexture && t.fragment.uniforms.add('tex', 'sampler2D'),
              t.include(Ei, e),
              t.include(fi, e),
              t.fragment.include($i),
              t.include(Wi, e),
              i.add(Ye`
      void main() {
        discardBySlice(vpos);
        ${e.multipassTerrainEnabled ? 'terrainDepthTest(gl_FragCoord, depth);' : ''}
        ${
          e.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        ${e.textureAlphaPremultiplied ? 'texColor.rgb /= texColor.a;' : ''}
        discardOrAdjustAlpha(texColor);`
            : Ye`vec4 texColor = vec4(1.0);`
        }
        shadingParams.viewDirection = normalize(vpos - camPos);
        ${
          3 === e.normalType
            ? Ye`
        vec3 normal = screenDerivativeNormal(localvpos);`
            : Ye`
        shadingParams.normalView = vNormalWorld;
        vec3 normal = shadingNormal(shadingParams);`
        }
        ${1 === e.pbrMode ? 'applyPBRFactors();' : ''}
        float ssao = evaluateAmbientOcclusionInverse();
        ssao *= getBakedOcclusion();

        float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
        vec3 additionalLight = ssao * lightingMainIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
        ${
          e.receiveShadows
            ? 'float shadow = readShadowMap(vpos, linearDepth);'
            : 1 === e.viewingMode
            ? 'float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);'
            : 'float shadow = 0.0;'
        }
        vec3 matColor = max(ambient, diffuse);
        ${
          e.attributeColor
            ? Ye`
        vec3 albedo_ = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
        float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`
            : Ye`
        vec3 albedo_ = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
        float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));
        `
        }
        ${
          e.hasNormalTexture
            ? Ye`
              mat3 tangentSpace = ${
                e.vertexTangents
                  ? 'computeTangentSpace(normal);'
                  : 'computeTangentSpace(normal, vpos, vuv0);'
              }
              vec3 shadedNormal = computeTextureNormal(tangentSpace, vuv0);`
            : 'vec3 shadedNormal = normal;'
        }
        ${
          1 === e.pbrMode || 2 === e.pbrMode
            ? 1 === e.viewingMode
              ? Ye`vec3 normalGround = normalize(vpos + localOrigin);`
              : Ye`vec3 normalGround = vec3(0.0, 0.0, 1.0);`
            : Ye``
        }
        ${
          1 === e.pbrMode || 2 === e.pbrMode
            ? Ye`
            float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * lightingMainIntensity[2];
            vec3 shadedColor = evaluateSceneLightingPBR(shadedNormal, albedo_, shadow, 1.0 - ssao, additionalLight, shadingParams.viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`
            : 'vec3 shadedColor = evaluateSceneLighting(shadedNormal, albedo_, shadow, 1.0 - ssao, additionalLight);'
        }
        gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
        ${e.OITEnabled ? 'gl_FragColor = premultiplyAlpha(gl_FragColor);' : ''}
      }
    `)),
            t.include(Bi, e),
            t
          );
        },
      });
      class Xi extends class {
        constructor(e, t, r = () => this.dispose()) {
          (this.release = r),
            t && (this._config = t.snapshot()),
            (this._program = this.initializeProgram(e)),
            (this._pipeline = this.initializePipeline(e));
        }
        dispose() {
          (this._program = (0, o.l)(this._program)), (this._pipeline = this._config = null);
        }
        reload(e) {
          (0, o.l)(this._program), (this._program = this.initializeProgram(e));
        }
        get program() {
          return this._program;
        }
        get pipeline() {
          return this._pipeline;
        }
        get key() {
          return this._config.key;
        }
        get configuration() {
          return this._config;
        }
        bindPass(e, t) {}
        bindMaterial(e, t) {}
        bindDraw(e, t, r) {}
        bindPipelineState(e) {
          e.setPipelineState(this.pipeline);
        }
        ensureAttributeLocations(e) {
          this.program.assertCompatibleVertexAttributeLocations(e);
        }
        get primitiveType() {
          return 4;
        }
      } {
        initializeProgram(e) {
          const t = Xi.shader.get(),
            r = this.configuration,
            i = t.build({
              OITEnabled: 0 === r.transparencyPassType,
              output: r.output,
              viewingMode: e.viewingMode,
              receiveShadows: r.receiveShadows,
              slicePlaneEnabled: r.slicePlaneEnabled,
              sliceHighlightDisabled: r.sliceHighlightDisabled,
              sliceEnabledForVertexPrograms: !1,
              symbolColor: r.symbolColors,
              vvSize: r.vvSize,
              vvColor: r.vvColor,
              vvInstancingEnabled: !0,
              instanced: r.instanced,
              instancedColor: r.instancedColor,
              instancedDoublePrecision: r.instancedDoublePrecision,
              pbrMode: r.usePBR ? (r.isSchematic ? 2 : 1) : 0,
              hasMetalnessAndRoughnessTexture: r.hasMetalnessAndRoughnessTexture,
              hasEmissionTexture: r.hasEmissionTexture,
              hasOcclusionTexture: r.hasOcclusionTexture,
              hasNormalTexture: r.hasNormalTexture,
              hasColorTexture: r.hasColorTexture,
              receiveAmbientOcclusion: r.receiveAmbientOcclusion,
              useCustomDTRExponentForWater: !1,
              normalType: r.normalsTypeDerivate ? 3 : 0,
              doubleSidedMode: r.doubleSidedMode,
              vertexTangents: r.vertexTangents,
              attributeTextureCoordinates:
                r.hasMetalnessAndRoughnessTexture ||
                r.hasEmissionTexture ||
                r.hasOcclusionTexture ||
                r.hasNormalTexture ||
                r.hasColorTexture
                  ? 1
                  : 0,
              textureAlphaPremultiplied: r.textureAlphaPremultiplied,
              attributeColor: r.vertexColors,
              screenSizePerspectiveEnabled: r.screenSizePerspective,
              verticalOffsetEnabled: r.verticalOffset,
              offsetBackfaces: r.offsetBackfaces,
              doublePrecisionRequiresObfuscation: _i(e.rctx),
              alphaDiscardMode: r.alphaDiscardMode,
              supportsTextureAtlas: !1,
              multipassTerrainEnabled: r.multipassTerrainEnabled,
              cullAboveGround: r.cullAboveGround,
            });
          return new mt(e.rctx, i, ft);
        }
        bindPass(e, t) {
          var r, i;
          !(function (e, t) {
            e.setUniformMatrix4fv('proj', t);
          })(this.program, t.camera.projectionMatrix);
          const o = this.configuration.output;
          (1 === this.configuration.output || t.multipassTerrainEnabled || 3 === o) &&
            this.program.setUniform2fv('cameraNearFar', t.camera.nearFar),
            t.multipassTerrainEnabled &&
              (this.program.setUniform2fv('inverseViewport', t.inverseViewport),
              (function (e, t) {
                t.multipassTerrainEnabled &&
                  t.terrainLinearDepthTexture &&
                  e.bindTexture(t.terrainLinearDepthTexture, 'terrainDepthTexture');
              })(this.program, t)),
            7 === o &&
              (this.program.setUniform1f('opacity', e.opacity),
              this.program.setUniform1f('layerOpacity', e.layerOpacity),
              this.program.setUniform4fv('externalColor', e.externalColor),
              this.program.setUniform1i('colorMixMode', Bt[e.colorMixMode])),
            0 === o
              ? (t.lighting.setUniforms(this.program, !1),
                this.program.setUniform3fv('ambient', e.ambient),
                this.program.setUniform3fv('diffuse', e.diffuse),
                this.program.setUniform4fv('externalColor', e.externalColor),
                this.program.setUniform1i('colorMixMode', Bt[e.colorMixMode]),
                this.program.setUniform1f('opacity', e.opacity),
                this.program.setUniform1f('layerOpacity', e.layerOpacity),
                this.configuration.usePBR && Pi(this.program, e, this.configuration.isSchematic))
              : 4 === o &&
                (function (e, t) {
                  e.bindTexture(t.highlightDepthTexture, 'depthTex'),
                    e.setUniform4f(
                      'highlightViewportPixelSz',
                      0,
                      0,
                      t.inverseViewport[0],
                      t.inverseViewport[1],
                    );
                })(this.program, t),
            (function (e, t) {
              (function (e, t) {
                t.vvSizeEnabled &&
                  (e.setUniform3fv('vvSizeMinSize', t.vvSizeMinSize),
                  e.setUniform3fv('vvSizeMaxSize', t.vvSizeMaxSize),
                  e.setUniform3fv('vvSizeOffset', t.vvSizeOffset),
                  e.setUniform3fv('vvSizeFactor', t.vvSizeFactor)),
                  t.vvColorEnabled &&
                    (e.setUniform1fv('vvColorValues', t.vvColorValues),
                    e.setUniform4fv('vvColorColors', t.vvColorColors));
              })(e, t),
                t.vvSizeEnabled &&
                  (e.setUniform3fv('vvSymbolAnchor', t.vvSymbolAnchor),
                  e.setUniformMatrix3fv('vvSymbolRotationMatrix', t.vvSymbolRotationMatrix));
            })(this.program, e),
            (function (e, t, r) {
              if (!t.verticalOffset) return;
              const i = (function (e, t, r, i = si) {
                  return (
                    (i.screenLength = e.screenLength),
                    (i.perDistance = Math.tan(0.5 * t) / (0.5 * r)),
                    (i.minWorldLength = e.minWorldLength),
                    (i.maxWorldLength = e.maxWorldLength),
                    i
                  );
                })(t.verticalOffset, r.camera.fovY, r.camera.fullViewport[3]),
                o = r.camera.pixelRatio || 1;
              e.setUniform4f(
                'verticalOffset',
                i.screenLength * o,
                i.perDistance,
                i.minWorldLength,
                i.maxWorldLength,
              );
            })(this.program, e, t),
            (function (e, t, r) {
              if (!e) return;
              const i = e.parameters,
                o = e.paddingPixelsOverride;
              t.setUniform4f(
                'screenSizePerspectiveAlignment',
                i.divisor,
                i.offset,
                i.minPixelSize,
                o,
              );
            })(e.screenSizePerspective, this.program),
            (2 !== e.textureAlphaMode && 3 !== e.textureAlphaMode) ||
              this.program.setUniform1f('textureAlphaCutoff', e.textureAlphaCutoff),
            null == (r = t.shadowMap) || r.bind(this.program),
            null == (i = t.ssaoHelper) || i.bind(this.program);
        }
        bindDraw(e) {
          const t = this.configuration.instancedDoublePrecision
            ? (0, c.p)(
                e.camera.viewInverseTransposeMatrix[3],
                e.camera.viewInverseTransposeMatrix[7],
                e.camera.viewInverseTransposeMatrix[11],
              )
            : e.origin;
          (function (e, t, r) {
            (0, s.t)(pt, r, t),
              e.setUniform3fv('localOrigin', t),
              e.setUniformMatrix4fv('view', pt);
          })(this.program, t, e.camera.viewMatrix),
            this.program.rebindTextures(),
            (0 === this.configuration.output ||
              7 === this.configuration.output ||
              (1 === this.configuration.output && this.configuration.screenSizePerspective) ||
              (2 === this.configuration.output && this.configuration.screenSizePerspective) ||
              (4 === this.configuration.output && this.configuration.screenSizePerspective)) &&
              (function (e, t, r) {
                e.setUniform3f('camPos', r[3] - t[0], r[7] - t[1], r[11] - t[2]);
              })(this.program, t, e.camera.viewInverseTransposeMatrix),
            2 === this.configuration.output &&
              this.program.setUniformMatrix4fv('viewNormal', e.camera.viewInverseTransposeMatrix),
            this.configuration.instancedDoublePrecision && Ti.bindCustomOrigin(this.program, t),
            (function (e, t, r, i) {
              t.slicePlaneEnabled &&
                ((0, o.i)(r)
                  ? (i
                      ? ((0, c.s)(Xt, r.origin, i), e.setUniform3fv('slicePlaneOrigin', Xt))
                      : e.setUniform3fv('slicePlaneOrigin', r.origin),
                    e.setUniform3fv('slicePlaneBasis1', r.basis1),
                    e.setUniform3fv('slicePlaneBasis2', r.basis2))
                  : (e.setUniform3fv('slicePlaneBasis1', c.Z),
                    e.setUniform3fv('slicePlaneBasis2', c.Z),
                    e.setUniform3fv('slicePlaneOrigin', c.Z)));
            })(this.program, this.configuration, e.slicePlane, t),
            0 === this.configuration.output &&
              (function (e, t, r) {
                t.shadowMappingEnabled && t.shadowMap.bindView(e, r);
              })(this.program, e, t);
        }
        setPipeline(e, t) {
          const r = this.configuration,
            i = 3 === e,
            o = 2 === e;
          return (function (e) {
            return te.intern(e);
          })({
            blending: (0 !== r.output && 7 !== r.output) || !r.transparent ? null : i ? rr : nr(e),
            culling: Ki(r) && S(r.cullFace),
            depthTest: { func: lr(e) },
            depthWrite: i || o ? r.writeDepth && C : null,
            colorWrite: E,
            stencilWrite: r.sceneHasOcludees ? cr : null,
            stencilTest: r.sceneHasOcludees ? (t ? ur : dr) : null,
            polygonOffset: i || o ? null : sr(r.enableOffset),
          });
        }
        initializePipeline() {
          return (
            (this._occludeePipelineState = this.setPipeline(
              this.configuration.transparencyPassType,
              !0,
            )),
            this.setPipeline(this.configuration.transparencyPassType, !1)
          );
        }
        getPipelineState(e) {
          return e ? this._occludeePipelineState : this.pipeline;
        }
      }
      function Ki(e) {
        return e.cullFace
          ? 0 !== e.cullFace
          : !e.slicePlaneEnabled && !e.transparent && !e.doubleSidedMode;
      }
      Xi.shader = new ut(ji, () =>
        Promise.resolve().then(function () {
          return ji;
        }),
      );
      class Zi extends class {
        constructor() {
          (this._key = ''),
            (this._keyDirty = !1),
            (this._parameterBits = this._parameterBits.map(() => 0));
        }
        get key() {
          return (
            this._keyDirty &&
              ((this._keyDirty = !1),
              (this._key = String.fromCharCode.apply(String, this._parameterBits))),
            this._key
          );
        }
        snapshot() {
          const e = this._parameterNames,
            t = { key: this.key };
          for (const r of e) t[r] = this[r];
          return t;
        }
      } {
        constructor() {
          super(...arguments),
            (this.output = 0),
            (this.alphaDiscardMode = 1),
            (this.doubleSidedMode = 0),
            (this.isSchematic = !1),
            (this.vertexColors = !1),
            (this.offsetBackfaces = !1),
            (this.symbolColors = !1),
            (this.vvSize = !1),
            (this.vvColor = !1),
            (this.verticalOffset = !1),
            (this.receiveShadows = !1),
            (this.slicePlaneEnabled = !1),
            (this.sliceHighlightDisabled = !1),
            (this.receiveAmbientOcclusion = !1),
            (this.screenSizePerspective = !1),
            (this.textureAlphaPremultiplied = !1),
            (this.hasColorTexture = !1),
            (this.usePBR = !1),
            (this.hasMetalnessAndRoughnessTexture = !1),
            (this.hasEmissionTexture = !1),
            (this.hasOcclusionTexture = !1),
            (this.hasNormalTexture = !1),
            (this.instanced = !1),
            (this.instancedColor = !1),
            (this.instancedDoublePrecision = !1),
            (this.vertexTangents = !1),
            (this.normalsTypeDerivate = !1),
            (this.writeDepth = !0),
            (this.sceneHasOcludees = !1),
            (this.transparent = !1),
            (this.enableOffset = !0),
            (this.cullFace = 0),
            (this.transparencyPassType = 3),
            (this.multipassTerrainEnabled = !1),
            (this.cullAboveGround = !1);
        }
      }
      (0, oi._)([ht({ count: 8 })], Zi.prototype, 'output', void 0),
        (0, oi._)([ht({ count: 4 })], Zi.prototype, 'alphaDiscardMode', void 0),
        (0, oi._)([ht({ count: 3 })], Zi.prototype, 'doubleSidedMode', void 0),
        (0, oi._)([ht()], Zi.prototype, 'isSchematic', void 0),
        (0, oi._)([ht()], Zi.prototype, 'vertexColors', void 0),
        (0, oi._)([ht()], Zi.prototype, 'offsetBackfaces', void 0),
        (0, oi._)([ht()], Zi.prototype, 'symbolColors', void 0),
        (0, oi._)([ht()], Zi.prototype, 'vvSize', void 0),
        (0, oi._)([ht()], Zi.prototype, 'vvColor', void 0),
        (0, oi._)([ht()], Zi.prototype, 'verticalOffset', void 0),
        (0, oi._)([ht()], Zi.prototype, 'receiveShadows', void 0),
        (0, oi._)([ht()], Zi.prototype, 'slicePlaneEnabled', void 0),
        (0, oi._)([ht()], Zi.prototype, 'sliceHighlightDisabled', void 0),
        (0, oi._)([ht()], Zi.prototype, 'receiveAmbientOcclusion', void 0),
        (0, oi._)([ht()], Zi.prototype, 'screenSizePerspective', void 0),
        (0, oi._)([ht()], Zi.prototype, 'textureAlphaPremultiplied', void 0),
        (0, oi._)([ht()], Zi.prototype, 'hasColorTexture', void 0),
        (0, oi._)([ht()], Zi.prototype, 'usePBR', void 0),
        (0, oi._)([ht()], Zi.prototype, 'hasMetalnessAndRoughnessTexture', void 0),
        (0, oi._)([ht()], Zi.prototype, 'hasEmissionTexture', void 0),
        (0, oi._)([ht()], Zi.prototype, 'hasOcclusionTexture', void 0),
        (0, oi._)([ht()], Zi.prototype, 'hasNormalTexture', void 0),
        (0, oi._)([ht()], Zi.prototype, 'instanced', void 0),
        (0, oi._)([ht()], Zi.prototype, 'instancedColor', void 0),
        (0, oi._)([ht()], Zi.prototype, 'instancedDoublePrecision', void 0),
        (0, oi._)([ht()], Zi.prototype, 'vertexTangents', void 0),
        (0, oi._)([ht()], Zi.prototype, 'normalsTypeDerivate', void 0),
        (0, oi._)([ht()], Zi.prototype, 'writeDepth', void 0),
        (0, oi._)([ht()], Zi.prototype, 'sceneHasOcludees', void 0),
        (0, oi._)([ht()], Zi.prototype, 'transparent', void 0),
        (0, oi._)([ht()], Zi.prototype, 'enableOffset', void 0),
        (0, oi._)([ht({ count: 3 })], Zi.prototype, 'cullFace', void 0),
        (0, oi._)([ht({ count: 4 })], Zi.prototype, 'transparencyPassType', void 0),
        (0, oi._)([ht()], Zi.prototype, 'multipassTerrainEnabled', void 0),
        (0, oi._)([ht()], Zi.prototype, 'cullAboveGround', void 0);
      var Yi = Object.freeze({
        __proto__: null,
        build: function (e) {
          const t = new tt(),
            r = t.vertex.code,
            i = t.fragment.code;
          return (
            t.vertex.uniforms
              .add('proj', 'mat4')
              .add('view', 'mat4')
              .add('camPos', 'vec3')
              .add('localOrigin', 'vec3'),
            t.include(Oi),
            t.varyings.add('vpos', 'vec3'),
            t.include(li, e),
            t.include(Ti, e),
            t.include(ai, e),
            (0 !== e.output && 7 !== e.output) ||
              (t.include(Ri, e),
              t.include(Qe, { linearDepth: !1 }),
              e.offsetBackfaces && t.include(Fi),
              e.instancedColor && t.attributes.add('instanceColor', 'vec4'),
              t.varyings.add('vNormalWorld', 'vec3'),
              t.varyings.add('localvpos', 'vec3'),
              e.multipassTerrainEnabled && t.varyings.add('depth', 'float'),
              t.include(wi, e),
              t.include(ui, e),
              t.include(zi, e),
              t.include(fr, e),
              t.vertex.uniforms.add('externalColor', 'vec4'),
              t.varyings.add('vcolorExt', 'vec4'),
              r.add(Ye`
        void main(void) {
          forwardNormalizedVertexColor();
          vcolorExt = externalColor;
          ${e.instancedColor ? 'vcolorExt *= instanceColor;' : ''}
          vcolorExt *= vvColor();
          vcolorExt *= getSymbolColor();
          forwardColorMixMode();

          if (vcolorExt.a < ${Ye.float(0.001)}) {
            gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
          }
          else {
            vpos = calculateVPos();
            localvpos = vpos - view[3].xyz;
            vpos = subtractOrigin(vpos);
            vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
            vpos = addVerticalOffset(vpos, localOrigin);
            gl_Position = transformPosition(proj, view, vpos);
            ${
              e.offsetBackfaces
                ? 'gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, camPos);'
                : ''
            }
          }
          ${e.multipassTerrainEnabled ? Ye`depth = (view * vec4(vpos, 1.0)).z;` : ''}
          forwardLinearDepth();
          forwardTextureCoordinates();
        }
      `)),
            7 === e.output &&
              (t.include(jt, e),
              t.include(er, e),
              e.multipassTerrainEnabled && (t.fragment.include(Zt), t.include(tr, e)),
              t.fragment.uniforms
                .add('camPos', 'vec3')
                .add('localOrigin', 'vec3')
                .add('opacity', 'float')
                .add('layerOpacity', 'float'),
              t.fragment.uniforms.add('view', 'mat4'),
              e.hasColorTexture && t.fragment.uniforms.add('tex', 'sampler2D'),
              t.fragment.include($i),
              i.add(Ye`
      void main() {
        discardBySlice(vpos);
        ${e.multipassTerrainEnabled ? Ye`terrainDepthTest(gl_FragCoord, depth);` : ''}
        ${
          e.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        ${e.textureAlphaPremultiplied ? 'texColor.rgb /= texColor.a;' : ''}
        discardOrAdjustAlpha(texColor);`
            : Ye`vec4 texColor = vec4(1.0);`
        }
        ${
          e.attributeColor
            ? Ye`
        float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`
            : Ye`
        float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));
        `
        }

        gl_FragColor = vec4(opacity_);
      }
    `)),
            0 === e.output &&
              (t.include(jt, e),
              t.include(Gi, e),
              t.include(Vi, e),
              t.include(er, e),
              e.receiveShadows && t.include(di, e),
              e.multipassTerrainEnabled && (t.fragment.include(Zt), t.include(tr, e)),
              t.fragment.uniforms
                .add('camPos', 'vec3')
                .add('localOrigin', 'vec3')
                .add('ambient', 'vec3')
                .add('diffuse', 'vec3')
                .add('opacity', 'float')
                .add('layerOpacity', 'float'),
              t.fragment.uniforms.add('view', 'mat4'),
              e.hasColorTexture && t.fragment.uniforms.add('tex', 'sampler2D'),
              t.include(Ei, e),
              t.include(fi, e),
              t.fragment.include($i),
              i.add(Ye`
      void main() {
        discardBySlice(vpos);
        ${e.multipassTerrainEnabled ? Ye`terrainDepthTest(gl_FragCoord, depth);` : ''}
        ${
          e.hasColorTexture
            ? Ye`
        vec4 texColor = texture2D(tex, vuv0);
        ${e.textureAlphaPremultiplied ? 'texColor.rgb /= texColor.a;' : ''}
        discardOrAdjustAlpha(texColor);`
            : Ye`vec4 texColor = vec4(1.0);`
        }
        vec3 viewDirection = normalize(vpos - camPos);
        ${1 === e.pbrMode ? 'applyPBRFactors();' : ''}
        float ssao = evaluateAmbientOcclusionInverse();
        ssao *= getBakedOcclusion();

        float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
        vec3 additionalLight = ssao * lightingMainIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
        ${
          e.receiveShadows
            ? 'float shadow = readShadowMap(vpos, linearDepth);'
            : 1 === e.viewingMode
            ? 'float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);'
            : 'float shadow = 0.0;'
        }
        vec3 matColor = max(ambient, diffuse);
        ${
          e.attributeColor
            ? Ye`
        vec3 albedo_ = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
        float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`
            : Ye`
        vec3 albedo_ = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
        float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));
        `
        }
        ${Ye`
        vec3 shadedNormal = normalize(vNormalWorld);
        albedo_ *= 1.2;
        vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
        float alignmentLightView = clamp(dot(viewForward, -lightingMainDirection), 0.0, 1.0);
        float transmittance = 1.0 - clamp(dot(viewForward, shadedNormal), 0.0, 1.0);
        float treeRadialFalloff = vColor.r;
        float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
        additionalLight += backLightFactor * lightingMainIntensity;`}
        ${
          1 === e.pbrMode || 2 === e.pbrMode
            ? 1 === e.viewingMode
              ? Ye`vec3 normalGround = normalize(vpos + localOrigin);`
              : Ye`vec3 normalGround = vec3(0.0, 0.0, 1.0);`
            : Ye``
        }
        ${
          1 === e.pbrMode || 2 === e.pbrMode
            ? Ye`
            float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * lightingMainIntensity[2];
            vec3 shadedColor = evaluateSceneLightingPBR(shadedNormal, albedo_, shadow, 1.0 - ssao, additionalLight, viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);`
            : 'vec3 shadedColor = evaluateSceneLighting(shadedNormal, albedo_, shadow, 1.0 - ssao, additionalLight);'
        }
        gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
        ${e.OITEnabled ? 'gl_FragColor = premultiplyAlpha(gl_FragColor);' : ''}
      }
    `)),
            t.include(Bi, e),
            t
          );
        },
      });
      class Qi extends Xi {
        initializeProgram(e) {
          const t = Qi.shader.get(),
            r = this.configuration,
            i = t.build({
              OITEnabled: 0 === r.transparencyPassType,
              output: r.output,
              viewingMode: e.viewingMode,
              receiveShadows: r.receiveShadows,
              slicePlaneEnabled: r.slicePlaneEnabled,
              sliceHighlightDisabled: r.sliceHighlightDisabled,
              sliceEnabledForVertexPrograms: !1,
              symbolColor: r.symbolColors,
              vvSize: r.vvSize,
              vvColor: r.vvColor,
              vvInstancingEnabled: !0,
              instanced: r.instanced,
              instancedColor: r.instancedColor,
              instancedDoublePrecision: r.instancedDoublePrecision,
              pbrMode: r.usePBR ? 1 : 0,
              hasMetalnessAndRoughnessTexture: !1,
              hasEmissionTexture: !1,
              hasOcclusionTexture: !1,
              hasNormalTexture: !1,
              hasColorTexture: r.hasColorTexture,
              receiveAmbientOcclusion: r.receiveAmbientOcclusion,
              useCustomDTRExponentForWater: !1,
              normalType: 0,
              doubleSidedMode: 2,
              vertexTangents: !1,
              attributeTextureCoordinates: r.hasColorTexture ? 1 : 0,
              textureAlphaPremultiplied: r.textureAlphaPremultiplied,
              attributeColor: r.vertexColors,
              screenSizePerspectiveEnabled: r.screenSizePerspective,
              verticalOffsetEnabled: r.verticalOffset,
              offsetBackfaces: r.offsetBackfaces,
              doublePrecisionRequiresObfuscation: _i(e.rctx),
              alphaDiscardMode: r.alphaDiscardMode,
              supportsTextureAtlas: !1,
              multipassTerrainEnabled: r.multipassTerrainEnabled,
              cullAboveGround: r.cullAboveGround,
            });
          return new mt(e.rctx, i, ft);
        }
      }
      Qi.shader = new ut(Yi, () =>
        Promise.resolve().then(function () {
          return Yi;
        }),
      );
      class Ji extends Vt {
        constructor(e) {
          super(e, to),
            (this.supportsEdges = !0),
            (this.techniqueConfig = new Zi()),
            (this.vertexBufferLayout = Ji.getVertexBufferLayout(this.params)),
            (this.instanceBufferLayout = e.instanced
              ? Ji.getInstanceBufferLayout(this.params)
              : null);
        }
        isVisibleInPass(e) {
          return (4 !== e && 6 !== e && 7 !== e) || this.params.castShadows;
        }
        isVisible() {
          const e = this.params;
          if (!super.isVisible() || 0 === e.layerOpacity) return !1;
          const t = e.instanced,
            r = e.vertexColors,
            i = e.symbolColors,
            o = !!t && t.indexOf('color') > -1,
            n = e.vvColorEnabled,
            a = 'replace' === e.colorMixMode,
            s = e.opacity > 0,
            l = e.externalColor && e.externalColor[3] > 0;
          return r && (o || n || i)
            ? !!a || s
            : r
            ? a
              ? l
              : s
            : o || n || i
            ? !!a || s
            : a
            ? l
            : s;
        }
        getTechniqueConfig(e, t) {
          return (
            (this.techniqueConfig.output = e),
            (this.techniqueConfig.hasNormalTexture = !!this.params.normalTextureId),
            (this.techniqueConfig.hasColorTexture = !!this.params.textureId),
            (this.techniqueConfig.vertexTangents = this.params.vertexTangents),
            (this.techniqueConfig.instanced = !!this.params.instanced),
            (this.techniqueConfig.instancedDoublePrecision = this.params.instancedDoublePrecision),
            (this.techniqueConfig.vvSize = this.params.vvSizeEnabled),
            (this.techniqueConfig.verticalOffset = null !== this.params.verticalOffset),
            (this.techniqueConfig.screenSizePerspective =
              null !== this.params.screenSizePerspective),
            (this.techniqueConfig.slicePlaneEnabled = this.params.slicePlaneEnabled),
            (this.techniqueConfig.sliceHighlightDisabled = this.params.sliceHighlightDisabled),
            (this.techniqueConfig.alphaDiscardMode = this.params.textureAlphaMode),
            (this.techniqueConfig.normalsTypeDerivate = 'screenDerivative' === this.params.normals),
            (this.techniqueConfig.transparent = this.params.transparent),
            (this.techniqueConfig.writeDepth = this.params.writeDepth),
            (this.techniqueConfig.sceneHasOcludees = this.params.sceneHasOcludees),
            (this.techniqueConfig.cullFace = this.params.slicePlaneEnabled
              ? 0
              : this.params.cullFace),
            (this.techniqueConfig.multipassTerrainEnabled = !!t && t.multipassTerrainEnabled),
            (this.techniqueConfig.cullAboveGround = !!t && t.cullAboveGround),
            (0 !== e && 7 !== e) ||
              ((this.techniqueConfig.vertexColors = this.params.vertexColors),
              (this.techniqueConfig.symbolColors = this.params.symbolColors),
              this.params.treeRendering
                ? (this.techniqueConfig.doubleSidedMode = 2)
                : (this.techniqueConfig.doubleSidedMode =
                    this.params.doubleSided && 'normal' === this.params.doubleSidedType
                      ? 1
                      : this.params.doubleSided && 'winding-order' === this.params.doubleSidedType
                      ? 2
                      : 0),
              (this.techniqueConfig.instancedColor =
                !!this.params.instanced && this.params.instanced.indexOf('color') > -1),
              (this.techniqueConfig.receiveShadows =
                this.params.receiveShadows && this.params.shadowMappingEnabled),
              (this.techniqueConfig.receiveAmbientOcclusion =
                !(!t || !t.ssaoEnabled) && this.params.receiveSSAO),
              (this.techniqueConfig.vvColor = this.params.vvColorEnabled),
              (this.techniqueConfig.textureAlphaPremultiplied = !!this.params
                .textureAlphaPremultiplied),
              (this.techniqueConfig.usePBR = this.params.usePBR),
              (this.techniqueConfig.hasMetalnessAndRoughnessTexture = !!this.params
                .metallicRoughnessTextureId),
              (this.techniqueConfig.hasEmissionTexture = !!this.params.emissiveTextureId),
              (this.techniqueConfig.hasOcclusionTexture = !!this.params.occlusionTextureId),
              (this.techniqueConfig.offsetBackfaces = !(
                !this.params.transparent || !this.params.offsetTransparentBackfaces
              )),
              (this.techniqueConfig.isSchematic = this.params.usePBR && this.params.isSchematic),
              (this.techniqueConfig.transparencyPassType = t ? t.transparencyPassType : 3),
              (this.techniqueConfig.enableOffset = !t || t.camera.relativeElevation < 5e5)),
            this.techniqueConfig
          );
        }
        intersect(e, t, r, i, n, a, s) {
          if (null !== this.params.verticalOffset) {
            const e = i.camera;
            (0, c.e)(lo, r[12], r[13], r[14]);
            let t = null;
            switch (i.viewingMode) {
              case 1:
                t = (0, c.n)(ao, lo);
                break;
              case 2:
                t = (0, c.j)(ao, no);
            }
            let o = 0;
            if (null !== this.params.verticalOffset) {
              const r = (0, c.s)(co, lo, e.eye),
                i = (0, c.l)(r),
                n = (0, c.f)(r, r, 1 / i);
              let a = null;
              this.params.screenSizePerspective && (a = (0, c.d)(t, n)),
                (o += (function (e, t, r, i, o) {
                  let n = (r.screenLength || 0) * e.pixelRatio;
                  o &&
                    (n = (function (e, t, r, i) {
                      return (function (e, t) {
                        return Math.max(
                          (0, c.S)(e * t.scale, e, t.factor),
                          (function (e, t) {
                            return 0 === e
                              ? t.minPixelSize
                              : t.minPixelSize * (1 + (2 * t.paddingPixels) / e);
                          })(e, t),
                        );
                      })(
                        e,
                        (function (e, t, r) {
                          const i = r.parameters,
                            o = r.paddingPixelsOverride;
                          return (
                            (Mt.scale = Math.min(i.divisor / (t - i.offset), 1)),
                            (Mt.factor = (function (e) {
                              return Math.abs(e * e * e);
                            })(e)),
                            (Mt.minPixelSize = i.minPixelSize),
                            (Mt.paddingPixels = o),
                            Mt
                          );
                        })(t, r, i),
                      );
                    })(n, i, t, o));
                  const a = (n * Math.tan(0.5 * e.fovY)) / (0.5 * e.fullHeight);
                  return (0, c.c)(
                    a * t,
                    r.minWorldLength || 0,
                    null != r.maxWorldLength ? r.maxWorldLength : 1 / 0,
                  );
                })(e, i, this.params.verticalOffset, a, this.params.screenSizePerspective));
            }
            (0, c.f)(t, t, o),
              (0, c.x)(so, t, i.transform.inverseRotation),
              (n = (0, c.s)(io, n, so)),
              (a = (0, c.s)(oo, a, so));
          }
          var l;
          Et(
            e,
            t,
            i,
            n,
            a,
            ((l = i.verticalOffset), (0, o.i)(l) ? ((ri.offset = l), ri) : null),
            s,
          );
        }
        getGLMaterial(e) {
          if (
            0 === e.output ||
            7 === e.output ||
            1 === e.output ||
            2 === e.output ||
            3 === e.output ||
            4 === e.output
          )
            return new eo(e);
        }
        createBufferWriter() {
          return new ro(this.vertexBufferLayout, this.instanceBufferLayout);
        }
        static getVertexBufferLayout(e) {
          const t =
              e.textureId ||
              e.normalTextureId ||
              e.metallicRoughnessTextureId ||
              e.emissiveTextureId ||
              e.occlusionTextureId,
            r = (0, Br.n)().vec3f('position').vec3f('normal');
          return (
            e.vertexTangents && r.vec4f('tangent'),
            t && r.vec2f('uv0'),
            e.vertexColors && r.vec4u8('color'),
            e.symbolColors && r.vec4u8('symbolColor'),
            r
          );
        }
        static getInstanceBufferLayout(e) {
          let t = (0, Br.n)();
          return (
            (t = e.instancedDoublePrecision
              ? t.vec3f('modelOriginHi').vec3f('modelOriginLo').mat3f('model').mat3f('modelNormal')
              : t.mat4f('model').mat4f('modelNormal')),
            e.instanced && e.instanced.indexOf('color') > -1 && (t = t.vec4f('instanceColor')),
            e.instanced &&
              e.instanced.indexOf('featureAttribute') > -1 &&
              (t = t.vec4f('instanceFeatureAttribute')),
            t
          );
        }
      }
      class eo extends Mr {
        constructor(e) {
          const t = e.material;
          super({ ...e, ...t.params }), this.updateParameters();
        }
        updateParameters(e) {
          const t = this._material.params;
          this.updateTexture(t.textureId),
            (this._technique = this._techniqueRep.releaseAndAcquire(
              t.treeRendering ? Qi : Xi,
              this._material.getTechniqueConfig(this._output, e),
              this._technique,
            ));
        }
        selectPipelines() {}
        _updateShadowState(e) {
          e.shadowMappingEnabled !== this._material.params.shadowMappingEnabled &&
            this._material.setParameterValues({ shadowMappingEnabled: e.shadowMappingEnabled });
        }
        _updateOccludeeState(e) {
          e.hasOccludees !== this._material.params.sceneHasOcludees &&
            this._material.setParameterValues({ sceneHasOcludees: e.hasOccludees });
        }
        ensureParameters(e) {
          (0 !== this._output && 7 !== this._output) ||
            (this._updateShadowState(e), this._updateOccludeeState(e)),
            this.updateParameters(e);
        }
        bind(e) {
          this._technique.bindPass(this._material.params, e),
            this.bindTextures(this._technique.program);
        }
        beginSlot(e) {
          return (
            e ===
            (this._material.params.transparent ? (this._material.params.writeDepth ? 5 : 8) : 3)
          );
        }
        getPipelineState(e, t) {
          return this._technique.getPipelineState(t);
        }
      }
      const to = {
        textureId: void 0,
        initTextureTransparent: !1,
        isSchematic: !1,
        usePBR: !1,
        normalTextureId: void 0,
        vertexTangents: !1,
        occlusionTextureId: void 0,
        emissiveTextureId: void 0,
        metallicRoughnessTextureId: void 0,
        emissiveFactor: [0, 0, 0],
        mrrFactors: [0, 1, 0.5],
        ambient: [0.2, 0.2, 0.2],
        diffuse: [0.8, 0.8, 0.8],
        externalColor: [1, 1, 1, 1],
        colorMixMode: 'multiply',
        opacity: 1,
        layerOpacity: 1,
        vertexColors: !1,
        symbolColors: !1,
        doubleSided: !1,
        doubleSidedType: 'normal',
        cullFace: 2,
        instanced: void 0,
        instancedDoublePrecision: !1,
        normals: 'default',
        receiveSSAO: !0,
        receiveShadows: !0,
        castShadows: !0,
        shadowMappingEnabled: !1,
        verticalOffset: null,
        screenSizePerspective: null,
        slicePlaneEnabled: !1,
        sliceHighlightDisabled: !1,
        offsetTransparentBackfaces: !1,
        vvSizeEnabled: !1,
        vvSizeMinSize: [1, 1, 1],
        vvSizeMaxSize: [100, 100, 100],
        vvSizeOffset: [0, 0, 0],
        vvSizeFactor: [1, 1, 1],
        vvSizeValue: [1, 1, 1],
        vvColorEnabled: !1,
        vvColorValues: [0, 0, 0, 0, 0, 0, 0, 0],
        vvColorColors: [
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
        ],
        vvSymbolAnchor: [0, 0, 0],
        vvSymbolRotationMatrix: (0, a.c)(),
        transparent: !1,
        writeDepth: !0,
        textureAlphaMode: 0,
        textureAlphaCutoff: 0.1,
        textureAlphaPremultiplied: !1,
        sceneHasOcludees: !1,
        renderOccluded: 1,
      };
      class ro {
        constructor(e, t) {
          (this.vertexBufferLayout = e), (this.instanceBufferLayout = t);
        }
        allocate(e) {
          return this.vertexBufferLayout.createBuffer(e);
        }
        elementCount(e) {
          return e.indices.get('position').length;
        }
        write(e, t, r, i) {
          !(function (e, t, r, i, o, n) {
            for (const a of t.fieldNames) {
              const t = e.vertexAttributes.get(a),
                s = e.indices.get(a);
              if (t && s)
                switch (a) {
                  case 'position': {
                    ke(3 === t.size);
                    const e = o.getField(a, u.a);
                    e && Gt(s, t.data, r, e, n);
                    break;
                  }
                  case 'normal': {
                    ke(3 === t.size);
                    const e = o.getField(a, u.a);
                    e && Wt(s, t.data, i, e, n);
                    break;
                  }
                  case 'uv0': {
                    ke(2 === t.size);
                    const e = o.getField(a, u.e);
                    e && Ht(s, t.data, e, n);
                    break;
                  }
                  case 'color': {
                    ke(3 === t.size || 4 === t.size);
                    const e = o.getField(a, u.b);
                    e && $t(s, t.data, t.size, e, n);
                    break;
                  }
                  case 'symbolColor': {
                    ke(3 === t.size || 4 === t.size);
                    const e = o.getField(a, u.b);
                    e && $t(s, t.data, t.size, e, n);
                    break;
                  }
                  case 'tangent': {
                    ke(4 === t.size);
                    const e = o.getField(a, u.g);
                    e && qt(s, t.data, i, e, n);
                    break;
                  }
                }
            }
          })(t, this.vertexBufferLayout, e.transformation, e.invTranspTransformation, r, i);
        }
      }
      const io = (0, c.b)(),
        oo = (0, c.b)(),
        no = (0, c.p)(0, 0, 1),
        ao = (0, c.b)(),
        so = (0, c.b)(),
        lo = (0, c.b)(),
        co = (0, c.b)(),
        uo = v.L.getLogger('esri.views.3d.layers.graphics.objectResourceUtils');
      async function ho(e, t) {
        const r = await (async function (e, t) {
          const r = (0, o.i)(t) && t.streamDataRequester;
          if (r)
            return (async function (e, t, r) {
              const i = await (0, p.r)(t.request(e, 'json', r));
              return !0 === i.ok ? i.value : ((0, x.r9)(i.error), void fo(i.error.details.url));
            })(e, r, t);
          const i = await (0, p.r)((0, m.default)(e, (0, o.u)(t)));
          return !0 === i.ok ? i.value.data : ((0, x.r9)(i.error), void fo(i.error));
        })(e, t);
        return {
          resource: r,
          textures: await (async function (e, t) {
            const r = [];
            for (const i in e) {
              const n = e[i],
                a = n.images[0].data;
              if (!a) {
                uo.warn('Externally referenced texture data is not yet supported');
                continue;
              }
              const s = n.encoding + ';base64,' + a,
                l = '/textureDefinitions/' + i,
                c = { noUnpackFlip: !0, wrap: { s: 10497, t: 10497 }, preMultiplyAlpha: !0 },
                d = (0, o.i)(t) && t.disableTextures ? Promise.resolve(null) : _(s, t);
              r.push(
                d.then((e) => ({
                  refId: l,
                  image: e,
                  params: c,
                  alphaChannelUsage:
                    'rgba' === n.channels ? n.alphaChannelUsage || 'transparency' : 'none',
                })),
              );
            }
            const i = await Promise.all(r),
              n = {};
            for (const e of i) n[e.refId] = e;
            return n;
          })(r.textureDefinitions, t),
        };
      }
      function fo(e) {
        throw new g.Z('', `Request for object resource failed: ${e}`);
      }
      function mo(e) {
        const t = e.params,
          r = t.topology;
        let i = !0;
        switch (
          (t.vertexAttributes || (uo.warn('Geometry must specify vertex attributes'), (i = !1)),
          t.topology)
        ) {
          case 'PerAttributeArray':
            break;
          case 'Indexed':
          case null:
          case void 0: {
            const e = t.faces;
            if (e) {
              if (t.vertexAttributes)
                for (const r in t.vertexAttributes) {
                  const t = e[r];
                  t && t.values
                    ? (null != t.valueType &&
                        'UInt32' !== t.valueType &&
                        (uo.warn(
                          `Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`,
                        ),
                        (i = !1)),
                      null != t.valuesPerElement &&
                        1 !== t.valuesPerElement &&
                        (uo.warn(
                          `Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`,
                        ),
                        (i = !1)))
                    : (uo.warn(
                        `Indexed geometry does not specify face indices for '${r}' attribute`,
                      ),
                      (i = !1));
                }
            } else uo.warn('Indexed geometries must specify faces'), (i = !1);
            break;
          }
          default:
            uo.warn(`Unsupported topology '${r}'`), (i = !1);
        }
        e.params.material || (uo.warn('Geometry requires material'), (i = !1));
        const o = e.params.vertexAttributes;
        for (const e in o)
          o[e].values ||
            (uo.warn('Geometries with externally defined attributes are not yet supported'),
            (i = !1));
        return i;
      }
      function po(e) {
        const t = (0, d.e)();
        return (
          e.forEach((e) => {
            const r = e.boundingInfo;
            (0, o.i)(r) && ((0, d.b)(t, r.getBBMin()), (0, d.b)(t, r.getBBMax()));
          }),
          t
        );
      }
      function go(e) {
        switch (e) {
          case 'mask':
            return 2;
          case 'maskAndTransparency':
            return 3;
          case 'none':
            return 1;
          case 'transparency':
          default:
            return 0;
        }
      }
      function vo(e) {
        const t = e.params;
        return { id: 1, material: t.material, texture: t.texture, region: t.texture };
      }
      const xo = new b.V(1, 2, 'wosr');
      async function bo(e, t) {
        const r = _o((0, i.a)(e));
        if ('wosr' === r.fileType) {
          const e = await (t.cache ? t.cache.loadWOSR(r.url, t) : ho(r.url, t)),
            i = (function (e, t) {
              const r = [],
                i = [],
                n = [],
                a = [],
                s = e.resource,
                l = b.V.parse(s.version || '1.0', 'wosr');
              xo.validate(l);
              const d = s.model.name,
                u = s.model.geometries,
                h = s.materialDefinitions,
                f = e.textures;
              let m = 0;
              const p = new Map();
              for (let e = 0; e < u.length; e++) {
                const s = u[e];
                if (!mo(s)) continue;
                const l = vo(s),
                  d = s.params.vertexAttributes,
                  g = [];
                for (const e in d) {
                  const t = d[e],
                    r = t.values;
                  g.push([e, { data: r, size: t.valuesPerElement, exclusive: !0 }]);
                }
                const v = [];
                if ('PerAttributeArray' !== s.params.topology) {
                  const e = s.params.faces;
                  for (const t in e) v.push([t, new Uint32Array(e[t].values)]);
                }
                const x = f && f[l.texture];
                if (x && !p.has(l.texture)) {
                  const { image: e, params: t } = x,
                    r = new Nr(e, t);
                  a.push(r), p.set(l.texture, r);
                }
                const b = p.get(l.texture),
                  _ = b ? b.id : void 0;
                let T = n[l.material] ? n[l.material][l.texture] : null;
                if (!T) {
                  const e = h[l.material.substring(l.material.lastIndexOf('/') + 1)].params;
                  1 === e.transparency && (e.transparency = 0);
                  const r = x && x.alphaChannelUsage,
                    i = e.transparency > 0 || 'transparency' === r || 'maskAndTransparency' === r,
                    a = {
                      ambient: (0, c.T)(e.diffuse),
                      diffuse: (0, c.T)(e.diffuse),
                      opacity: 1 - (e.transparency || 0),
                      transparent: i,
                      textureAlphaMode: x ? go(x.alphaChannelUsage) : void 0,
                      textureAlphaCutoff: 0.33,
                      textureId: _,
                      initTextureTransparent: !0,
                      doubleSided: !0,
                      cullFace: 0,
                      colorMixMode: e.externalColorMixMode || 'tint',
                      textureAlphaPremultiplied: !0,
                    };
                  (0, o.i)(t) && t.materialParamsMixin && Object.assign(a, t.materialParamsMixin),
                    (T = new Ji(a)),
                    n[l.material] || (n[l.material] = {}),
                    (n[l.material][l.texture] = T);
                }
                i.push(T);
                const y = new xt(g, v);
                (m += v.position ? v.position.length : 0), r.push(y);
              }
              return {
                name: d,
                stageResources: { textures: a, materials: i, geometries: r },
                pivotOffset: s.model.pivotOffset,
                boundingBox: po(r),
                numberOfVertices: m,
                lodThreshold: null,
              };
            })(e, t);
          return {
            lods: [i],
            referenceBoundingBox: i.boundingBox,
            isEsriSymbolResource: !1,
            isWosr: !0,
            remove: e.remove,
          };
        }
        const n = await (t.cache
            ? t.cache.loadGLTF(r.url, t, t.usePBR)
            : (0, f.l)(new f.D(t.streamDataRequester), r.url, t, t.usePBR)),
          a = (0, o.c)(n.model.meta, 'ESRI_proxyEllipsoid');
        n.meta.isEsriSymbolResource &&
          (0, o.i)(a) &&
          -1 !== n.meta.uri.indexOf('/RealisticTrees/') &&
          (function (e, t) {
            for (let r = 0; r < e.model.lods.length; ++r) {
              const i = e.model.lods[r];
              e.customMeta.esriTreeRendering = !0;
              for (const n of i.parts) {
                const i = n.attributes.normal;
                if ((0, o.b)(i)) return;
                const a = n.attributes.position,
                  d = a.count,
                  h = (0, c.b)(),
                  m = (0, c.b)(),
                  p = (0, c.b)(),
                  g = (0, f.c)(u.b, d),
                  v = (0, f.c)(u.a, d),
                  x = (0, s.c)((0, l.c)(), n.transform);
                for (let o = 0; o < d; o++) {
                  a.getVec(o, m),
                    i.getVec(o, h),
                    (0, c.t)(m, m, n.transform),
                    (0, c.s)(p, m, t.center),
                    (0, c.a4)(p, p, t.radius);
                  const s = p[2],
                    l = (0, c.l)(p),
                    d = Math.min(0.45 + 0.55 * l * l, 1);
                  (0, c.a4)(p, p, t.radius),
                    (0, c.t)(p, p, x),
                    (0, c.n)(p, p),
                    r + 1 !== e.model.lods.length &&
                      e.model.lods.length > 1 &&
                      (0, c.h)(p, p, h, s > -1 ? 0.2 : Math.min(-4 * s - 3.8, 1)),
                    v.setVec(o, p),
                    g.set(o, 0, 255 * d),
                    g.set(o, 1, 255 * d),
                    g.set(o, 2, 255 * d),
                    g.set(o, 3, 255);
                }
                (n.attributes.normal = v), (n.attributes.color = g);
              }
            }
          })(n, a);
        const d = n.meta.isEsriSymbolResource
            ? {
                usePBR: t.usePBR,
                isSchematic: !1,
                treeRendering: n.customMeta.esriTreeRendering,
                mrrFactors: [0, 1, 0.2],
              }
            : { usePBR: t.usePBR, isSchematic: !1, mrrFactors: [0, 1, 0.5] },
          h = { ...t.materialParamsMixin, treeRendering: n.customMeta.esriTreeRendering };
        if (null != r.specifiedLodIndex) {
          const e = To(n, d, h, r.specifiedLodIndex);
          let t = e[0].boundingBox;
          return (
            0 !== r.specifiedLodIndex && (t = To(n, d, h, 0)[0].boundingBox),
            {
              lods: e,
              referenceBoundingBox: t,
              isEsriSymbolResource: n.meta.isEsriSymbolResource,
              isWosr: !1,
              remove: n.remove,
            }
          );
        }
        const m = To(n, d, h);
        return {
          lods: m,
          referenceBoundingBox: m[0].boundingBox,
          isEsriSymbolResource: n.meta.isEsriSymbolResource,
          isWosr: !1,
          remove: n.remove,
        };
      }
      function _o(e) {
        const t = e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);
        return t
          ? { fileType: 'gltf', url: t[1], specifiedLodIndex: null != t[4] ? Number(t[4]) : null }
          : e.match(/(.*\.(json|json\.gz))$/)
          ? { fileType: 'wosr', url: e, specifiedLodIndex: null }
          : { fileType: 'unknown', url: e, specifiedLodIndex: null };
      }
      function To(e, t, r, i) {
        const s = e.model,
          l = (0, a.c)(),
          c = new Array(),
          m = new Map(),
          p = new Map();
        return (
          s.lods.forEach((e, a) => {
            if (void 0 !== i && a !== i) return;
            const g = {
              name: e.name,
              stageResources: {
                textures: new Array(),
                materials: new Array(),
                geometries: new Array(),
              },
              lodThreshold: (0, o.i)(e.lodThreshold) ? e.lodThreshold : null,
              pivotOffset: [0, 0, 0],
              numberOfVertices: 0,
              boundingBox: (0, d.e)(),
            };
            c.push(g),
              e.parts.forEach((e) => {
                const i =
                    e.material +
                    (e.attributes.normal ? '_normal' : '') +
                    (e.attributes.color ? '_color' : '') +
                    (e.attributes.texCoord0 ? '_texCoord0' : '') +
                    (e.attributes.tangent ? '_tangent' : ''),
                  a = s.materials.get(e.material),
                  c = (0, o.i)(e.attributes.texCoord0),
                  v = (0, o.i)(e.attributes.normal);
                if (!m.has(i)) {
                  if (c) {
                    if ((0, o.i)(a.textureColor) && !p.has(a.textureColor)) {
                      const e = s.textures.get(a.textureColor),
                        t = { ...e.parameters, preMultiplyAlpha: !0 };
                      p.set(a.textureColor, new Nr(e.data, t));
                    }
                    if ((0, o.i)(a.textureNormal) && !p.has(a.textureNormal)) {
                      const e = s.textures.get(a.textureNormal),
                        t = { ...e.parameters, preMultiplyAlpha: !0 };
                      p.set(a.textureNormal, new Nr(e.data, t));
                    }
                    if ((0, o.i)(a.textureOcclusion) && !p.has(a.textureOcclusion)) {
                      const e = s.textures.get(a.textureOcclusion),
                        t = { ...e.parameters, preMultiplyAlpha: !0 };
                      p.set(a.textureOcclusion, new Nr(e.data, t));
                    }
                    if ((0, o.i)(a.textureEmissive) && !p.has(a.textureEmissive)) {
                      const e = s.textures.get(a.textureEmissive),
                        t = { ...e.parameters, preMultiplyAlpha: !0 };
                      p.set(a.textureEmissive, new Nr(e.data, t));
                    }
                    if (
                      (0, o.i)(a.textureMetallicRoughness) &&
                      !p.has(a.textureMetallicRoughness)
                    ) {
                      const e = s.textures.get(a.textureMetallicRoughness),
                        t = { ...e.parameters, preMultiplyAlpha: !0 };
                      p.set(a.textureMetallicRoughness, new Nr(e.data, t));
                    }
                  }
                  const n = a.color[0] ** (1 / f.C),
                    l = a.color[1] ** (1 / f.C),
                    d = a.color[2] ** (1 / f.C),
                    u = a.emissiveFactor[0] ** (1 / f.C),
                    h = a.emissiveFactor[1] ** (1 / f.C),
                    g = a.emissiveFactor[2] ** (1 / f.C);
                  m.set(
                    i,
                    new Ji({
                      ...t,
                      transparent: 'BLEND' === a.alphaMode,
                      textureAlphaMode: yo(a.alphaMode),
                      textureAlphaCutoff: a.alphaCutoff,
                      diffuse: [n, l, d],
                      ambient: [n, l, d],
                      opacity: a.opacity,
                      doubleSided: a.doubleSided,
                      doubleSidedType: 'winding-order',
                      cullFace: a.doubleSided ? 0 : 2,
                      vertexColors: !!e.attributes.color,
                      vertexTangents: !!e.attributes.tangent,
                      normals: v ? 'default' : 'screenDerivative',
                      castShadows: !0,
                      receiveSSAO: !0,
                      textureId: (0, o.i)(a.textureColor) && c ? p.get(a.textureColor).id : void 0,
                      colorMixMode: a.colorMixMode,
                      normalTextureId:
                        (0, o.i)(a.textureNormal) && c ? p.get(a.textureNormal).id : void 0,
                      textureAlphaPremultiplied: !0,
                      occlusionTextureId:
                        (0, o.i)(a.textureOcclusion) && c ? p.get(a.textureOcclusion).id : void 0,
                      emissiveTextureId:
                        (0, o.i)(a.textureEmissive) && c ? p.get(a.textureEmissive).id : void 0,
                      metallicRoughnessTextureId:
                        (0, o.i)(a.textureMetallicRoughness) && c
                          ? p.get(a.textureMetallicRoughness).id
                          : void 0,
                      emissiveFactor: [u, h, g],
                      mrrFactors: [a.metallicFactor, a.roughnessFactor, t.mrrFactors[2]],
                      isSchematic: !1,
                      ...r,
                    }),
                  );
                }
                const x = (function (e, t) {
                    switch (t) {
                      case 4:
                        return (0, f.e)(e);
                      case 5:
                        return (0, f.d)(e);
                      case 6:
                        return (0, f.b)(e);
                    }
                  })(e.indices || e.attributes.position.count, e.primitiveType),
                  b = e.attributes.position.count,
                  _ = (0, f.c)(u.a, b);
                (0, h.t)(_, e.attributes.position, e.transform);
                const T = [
                    ['position', { data: _.typedBuffer, size: _.elementCount, exclusive: !0 }],
                  ],
                  y = [['position', x]];
                if ((0, o.i)(e.attributes.normal)) {
                  const t = (0, f.c)(u.a, b);
                  (0, n.a)(l, e.transform),
                    (0, h.a)(t, e.attributes.normal, l),
                    T.push([
                      'normal',
                      { data: t.typedBuffer, size: t.elementCount, exclusive: !0 },
                    ]),
                    y.push(['normal', x]);
                }
                if ((0, o.i)(e.attributes.tangent)) {
                  const t = (0, f.c)(u.g, b);
                  (0, n.a)(l, e.transform),
                    (0, f.t)(t, e.attributes.tangent, l),
                    T.push([
                      'tangent',
                      { data: t.typedBuffer, size: t.elementCount, exclusive: !0 },
                    ]),
                    y.push(['tangent', x]);
                }
                if ((0, o.i)(e.attributes.texCoord0)) {
                  const t = (0, f.c)(u.e, b);
                  (0, f.n)(t, e.attributes.texCoord0),
                    T.push(['uv0', { data: t.typedBuffer, size: t.elementCount, exclusive: !0 }]),
                    y.push(['uv0', x]);
                }
                if ((0, o.i)(e.attributes.color)) {
                  const t = (0, f.c)(u.b, b);
                  if (4 === e.attributes.color.elementCount)
                    e.attributes.color instanceof u.g
                      ? (0, f.s)(t, e.attributes.color, 255)
                      : e.attributes.color instanceof u.b
                      ? (0, f.a)(t, e.attributes.color)
                      : e.attributes.color instanceof u.l &&
                        (0, f.s)(t, e.attributes.color, 1 / 256);
                  else {
                    (0, f.f)(t, 255, 255, 255, 255);
                    const r = new u.m(t.buffer, 0, 4);
                    e.attributes.color instanceof u.a
                      ? (0, h.s)(r, e.attributes.color, 255)
                      : e.attributes.color instanceof u.m
                      ? (0, h.c)(r, e.attributes.color)
                      : e.attributes.color instanceof u.n &&
                        (0, h.s)(r, e.attributes.color, 1 / 256);
                  }
                  T.push(['color', { data: t.typedBuffer, size: t.elementCount, exclusive: !0 }]),
                    y.push(['color', x]);
                }
                const M = new xt(T, y);
                g.stageResources.geometries.push(M),
                  g.stageResources.materials.push(m.get(i)),
                  c &&
                    ((0, o.i)(a.textureColor) &&
                      g.stageResources.textures.push(p.get(a.textureColor)),
                    (0, o.i)(a.textureNormal) &&
                      g.stageResources.textures.push(p.get(a.textureNormal)),
                    (0, o.i)(a.textureOcclusion) &&
                      g.stageResources.textures.push(p.get(a.textureOcclusion)),
                    (0, o.i)(a.textureEmissive) &&
                      g.stageResources.textures.push(p.get(a.textureEmissive)),
                    (0, o.i)(a.textureMetallicRoughness) &&
                      g.stageResources.textures.push(p.get(a.textureMetallicRoughness))),
                  (g.numberOfVertices += b);
                const w = M.boundingInfo;
                (0, o.i)(w) &&
                  ((0, d.b)(g.boundingBox, w.getBBMin()), (0, d.b)(g.boundingBox, w.getBBMax()));
              });
          }),
          c
        );
      }
      function yo(e) {
        switch (e) {
          case 'BLEND':
            return 0;
          case 'MASK':
            return 2;
          case 'OPAQUE':
            return 1;
          default:
            return 0;
        }
      }
      var Mo = Object.freeze({
        __proto__: null,
        fetch: bo,
        parseUrl: _o,
        gltfToEngineResources: To,
      });
    },
    35861: (e, t, r) => {
      'use strict';
      r.d(t, { c: () => s, e: () => c, f: () => l, g: () => n, m: () => a, s: () => o });
      var i = r(82426);
      function o(e, t, r) {
        r *= 0.5;
        const i = Math.sin(r);
        return (e[0] = i * t[0]), (e[1] = i * t[1]), (e[2] = i * t[2]), (e[3] = Math.cos(r)), e;
      }
      function n(e, t) {
        const r = 2 * Math.acos(t[3]),
          o = Math.sin(r / 2);
        return (
          o > i.E
            ? ((e[0] = t[0] / o), (e[1] = t[1] / o), (e[2] = t[2] / o))
            : ((e[0] = 1), (e[1] = 0), (e[2] = 0)),
          r
        );
      }
      function a(e, t, r) {
        const i = t[0],
          o = t[1],
          n = t[2],
          a = t[3],
          s = r[0],
          l = r[1],
          c = r[2],
          d = r[3];
        return (
          (e[0] = i * d + a * s + o * c - n * l),
          (e[1] = o * d + a * l + n * s - i * c),
          (e[2] = n * d + a * c + i * l - o * s),
          (e[3] = a * d - i * s - o * l - n * c),
          e
        );
      }
      function s(e, t) {
        return (e[0] = -t[0]), (e[1] = -t[1]), (e[2] = -t[2]), (e[3] = t[3]), e;
      }
      function l(e, t, r, i) {
        const o = (0.5 * Math.PI) / 180;
        (t *= o), (r *= o), (i *= o);
        const n = Math.sin(t),
          a = Math.cos(t),
          s = Math.sin(r),
          l = Math.cos(r),
          c = Math.sin(i),
          d = Math.cos(i);
        return (
          (e[0] = n * l * d - a * s * c),
          (e[1] = a * s * d + n * l * c),
          (e[2] = a * l * c - n * s * d),
          (e[3] = a * l * d + n * s * c),
          e
        );
      }
      const c = r(7200).e;
      (0, i.b)(), (0, i.p)(1, 0, 0), (0, i.p)(0, 1, 0);
    },
    45087: (e, t, r) => {
      'use strict';
      function i() {
        return [1, 0, 0, 0, 1, 0, 0, 0, 1];
      }
      function o(e, t) {
        return new Float64Array(e, t, 9);
      }
      function n() {
        return [0, 0, 0, 1];
      }
      function a(e) {
        return [e[0], e[1], e[2], e[3]];
      }
      function s(e, t) {
        return new Float64Array(e, t, 4);
      }
      r.d(t, { I: () => l, a: () => o, b: () => s, c: () => i, d: () => n, e: () => a });
      const l = [0, 0, 0, 1];
    },
    72836: (e, t, r) => {
      'use strict';
      r.d(t, {
        a: () => n,
        b: () => l,
        c: () => c,
        f: () => d,
        l: () => i,
        n: () => s,
        s: () => a,
        t: () => o,
      });
      const i = r(92143).L.getLogger('esri.views.3d.support.buffer.math');
      function o(e, t, r) {
        if (e.count !== t.count)
          return void i.error(
            'source and destination buffers need to have the same number of elements',
          );
        const o = e.count,
          n = r[0],
          a = r[1],
          s = r[2],
          l = r[4],
          c = r[5],
          d = r[6],
          u = r[8],
          h = r[9],
          f = r[10],
          m = r[12],
          p = r[13],
          g = r[14],
          v = e.typedBuffer,
          x = e.typedBufferStride,
          b = t.typedBuffer,
          _ = t.typedBufferStride;
        for (let e = 0; e < o; e++) {
          const t = e * x,
            r = e * _,
            i = b[r],
            o = b[r + 1],
            T = b[r + 2];
          (v[t] = n * i + l * o + u * T + m),
            (v[t + 1] = a * i + c * o + h * T + p),
            (v[t + 2] = s * i + d * o + f * T + g);
        }
      }
      function n(e, t, r) {
        if (e.count !== t.count)
          return void i.error(
            'source and destination buffers need to have the same number of elements',
          );
        const o = e.count,
          n = r[0],
          a = r[1],
          s = r[2],
          l = r[3],
          c = r[4],
          d = r[5],
          u = r[6],
          h = r[7],
          f = r[8],
          m = e.typedBuffer,
          p = e.typedBufferStride,
          g = t.typedBuffer,
          v = t.typedBufferStride;
        for (let e = 0; e < o; e++) {
          const t = e * p,
            r = e * v,
            i = g[r],
            o = g[r + 1],
            x = g[r + 2];
          (m[t] = n * i + l * o + u * x),
            (m[t + 1] = a * i + c * o + h * x),
            (m[t + 2] = s * i + d * o + f * x);
        }
      }
      function a(e, t, r) {
        const i = Math.min(e.count, t.count),
          o = e.typedBuffer,
          n = e.typedBufferStride,
          a = t.typedBuffer,
          s = t.typedBufferStride;
        for (let e = 0; e < i; e++) {
          const t = e * n,
            i = e * s;
          (o[t] = r * a[i]), (o[t + 1] = r * a[i + 1]), (o[t + 2] = r * a[i + 2]);
        }
      }
      function s(e, t) {
        const r = Math.min(e.count, t.count),
          i = e.typedBuffer,
          o = e.typedBufferStride,
          n = t.typedBuffer,
          a = t.typedBufferStride;
        for (let e = 0; e < r; e++) {
          const t = e * o,
            r = e * a,
            s = n[r],
            l = n[r + 1],
            c = n[r + 2],
            d = Math.sqrt(s * s + l * l + c * c);
          if (d > 0) {
            const e = 1 / d;
            (i[t] = e * s), (i[t + 1] = e * l), (i[t + 2] = e * c);
          }
        }
      }
      function l(e, t, r) {
        const i = Math.min(e.count, t.count),
          o = e.typedBuffer,
          n = e.typedBufferStride,
          a = t.typedBuffer,
          s = t.typedBufferStride;
        for (let e = 0; e < i; e++) {
          const t = e * n,
            i = e * s;
          (o[t] = a[i] >> r), (o[t + 1] = a[i + 1] >> r), (o[t + 2] = a[i + 2] >> r);
        }
      }
      function c(e, t, r) {
        const i = e.typedBuffer,
          o = e.typedBufferStride,
          n = t.typedBuffer,
          a = t.typedBufferStride,
          s = r ? r.count : t.count;
        let l = (r && r.dstIndex ? r.dstIndex : 0) * o,
          c = (r && r.srcIndex ? r.srcIndex : 0) * a;
        for (let e = 0; e < s; ++e)
          (i[l] = n[c]), (i[l + 1] = n[c + 1]), (i[l + 2] = n[c + 2]), (l += o), (c += a);
      }
      function d(e, t, r, i, o) {
        var n, a;
        const s = e.typedBuffer,
          l = e.typedBufferStride,
          c = null != (n = null == o ? void 0 : o.count) ? n : e.count;
        let d = (null != (a = null == o ? void 0 : o.dstIndex) ? a : 0) * l;
        for (let e = 0; e < c; ++e) (s[d] = t), (s[d + 1] = r), (s[d + 2] = i), (d += l);
      }
    },
    56697: (e, t, r) => {
      'use strict';
      function i() {
        return new Float32Array(3);
      }
      function o(e, t, r) {
        const i = new Float32Array(3);
        return (i[0] = e), (i[1] = t), (i[2] = r), i;
      }
      r.d(t, { c: () => i, f: () => o }), o(1, 1, 1), o(1, 0, 0), o(0, 1, 0), o(0, 0, 1);
    },
  },
]);
