(self.webpackChunkRemoteClient = self.webpackChunkRemoteClient || []).push([
  [874, 7258],
  {
    23761: (e, t, r) => {
      'use strict';
      r.d(t, { Z: () => y });
      var i,
        s = r(29768),
        n = r(74569),
        a = r(86748),
        l = r(96467),
        o = r(74673),
        u = r(76506),
        d = r(42788),
        h = r(34250),
        c = (r(91306), r(92143), r(17533)),
        p = r(32422);
      r(21801),
        r(40642),
        r(71552),
        r(73796),
        r(97714),
        r(60947),
        r(2906),
        r(21972),
        r(23639),
        r(86656),
        r(22723),
        r(91055),
        r(27794),
        r(6906),
        r(50406),
        r(60991),
        r(81172),
        r(31450),
        r(26341),
        r(91597),
        r(86787),
        r(35132),
        r(89623),
        r(84069),
        r(44567),
        r(98380),
        r(92896),
        r(22781),
        r(57251),
        r(15324),
        r(76996),
        r(14249),
        r(9801),
        r(53523),
        r(59465),
        r(42911),
        r(46826),
        r(45433),
        r(60217),
        r(29107),
        r(30574),
        r(2157),
        r(25977),
        r(7471),
        r(54414),
        r(1648),
        r(8925),
        r(33921),
        r(3482),
        r(45154),
        r(16769),
        r(55531),
        r(30582),
        r(593),
        r(85699),
        r(63136),
        r(96055),
        r(47776),
        r(18033),
        r(6331),
        r(62048),
        r(4292),
        r(75626),
        r(72652),
        r(29641),
        r(30493),
        r(70821),
        r(82673),
        r(34229),
        r(37029),
        r(63571),
        r(30776),
        r(48027),
        r(54174),
        r(82426),
        r(63130),
        r(25696),
        r(66396),
        r(42775),
        r(95834),
        r(34394),
        r(57150),
        r(76726),
        r(20444),
        r(76393),
        r(78548),
        r(2497),
        r(49906),
        r(46527),
        r(48649),
        r(9960),
        r(3101),
        r(5853),
        r(39141),
        r(32101),
        r(38742),
        r(48243),
        r(34635),
        r(10401),
        r(49900),
        r(66284),
        r(82058),
        r(88762),
        r(73173),
        r(22739),
        r(20543),
        r(67477),
        r(78533),
        r(74653),
        r(91091),
        r(58943),
        r(70737),
        r(8487),
        r(17817),
        r(90814),
        r(15459),
        r(61847),
        r(16796),
        r(16955),
        r(22401),
        r(77894),
        r(55187),
        r(8586),
        r(44509),
        r(69814),
        r(11305),
        r(62259),
        r(44790),
        r(5909),
        r(60669),
        r(48208),
        r(51589);
      let f = (i = class extends o.a {
        constructor(...e) {
          super(...e),
            (this.isAggregate = !1),
            (this.layer = null),
            (this.popupTemplate = null),
            (this.sourceLayer = null),
            Object.defineProperty(this, 'uid', { value: (0, d.g)(), configurable: !0 });
        }
        normalizeCtorArgs(e, t, r, i) {
          return e && !e.declaredClass
            ? e
            : { geometry: e, symbol: t, attributes: r, popupTemplate: i };
        }
        set attributes(e) {
          const t = this._get('attributes');
          t !== e && (this._set('attributes', e), this._notifyLayer('attributes', t, e));
        }
        set geometry(e) {
          const t = this._get('geometry');
          t !== e && (this._set('geometry', e), this._notifyLayer('geometry', t, e));
        }
        set symbol(e) {
          const t = this._get('symbol');
          t !== e && (this._set('symbol', e), this._notifyLayer('symbol', t, e));
        }
        set visible(e) {
          const t = this._get('visible');
          t !== e && (this._set('visible', e), this._notifyLayer('visible', t, e));
        }
        getEffectivePopupTemplate(e = !1) {
          if (this.popupTemplate) return this.popupTemplate;
          for (const t of [this.sourceLayer, this.layer])
            if (t) {
              if ('popupTemplate' in t && t.popupTemplate) return t.popupTemplate;
              if (e && 'defaultPopupTemplate' in t && (0, u.i)(t.defaultPopupTemplate))
                return t.defaultPopupTemplate;
            }
          return null;
        }
        getAttribute(e) {
          return this.attributes && this.attributes[e];
        }
        setAttribute(e, t) {
          if (this.attributes) {
            const r = this.getAttribute(e);
            (this.attributes[e] = t), this._notifyLayer('attributes', r, t, e);
          } else (this.attributes = { [e]: t }), this._notifyLayer('attributes', void 0, t, e);
        }
        getObjectId() {
          return this.sourceLayer &&
            'objectIdField' in this.sourceLayer &&
            this.sourceLayer.objectIdField
            ? this.getAttribute(this.sourceLayer.objectIdField)
            : null;
        }
        toJSON() {
          return {
            geometry: (0, u.i)(this.geometry) ? this.geometry.toJSON() : null,
            symbol: (0, u.i)(this.symbol) ? this.symbol.toJSON() : null,
            attributes: { ...this.attributes },
            popupTemplate: this.popupTemplate && this.popupTemplate.toJSON(),
          };
        }
        clone() {
          return new i(this.cloneProperties());
        }
        notifyGeometryChanged() {
          this._notifyLayer('geometry', this.geometry, this.geometry);
        }
        cloneProperties() {
          return {
            attributes: (0, u.d9)(this.attributes),
            geometry: (0, u.d9)(this.geometry),
            layer: this.layer,
            popupTemplate: this.popupTemplate && this.popupTemplate.clone(),
            sourceLayer: this.sourceLayer,
            symbol: (0, u.d9)(this.symbol),
            visible: this.visible,
          };
        }
        _notifyLayer(e, t, r, i) {
          if (!this.layer || !('graphicChanged' in this.layer)) return;
          const s = { graphic: this, property: e, oldValue: t, newValue: r };
          'attributes' === e && (s.attributeName = i), this.layer.graphicChanged(s);
        }
      });
      (0, s._)([(0, h.Cb)({ value: null })], f.prototype, 'attributes', null),
        (0, s._)(
          [(0, h.Cb)({ value: null, types: n.qM, json: { read: p.im } })],
          f.prototype,
          'geometry',
          null,
        ),
        (0, s._)([(0, h.Cb)({ type: Boolean })], f.prototype, 'isAggregate', void 0),
        (0, s._)([(0, h.Cb)()], f.prototype, 'layer', void 0),
        (0, s._)([(0, h.Cb)({ type: a.Z })], f.prototype, 'popupTemplate', void 0),
        (0, s._)([(0, h.Cb)()], f.prototype, 'sourceLayer', void 0),
        (0, s._)([(0, h.Cb)({ value: null, types: l.LB })], f.prototype, 'symbol', null),
        (0, s._)([(0, h.Cb)({ type: Boolean, value: !0 })], f.prototype, 'visible', null),
        (f = i = (0, s._)([(0, c.j)('esri.Graphic')], f)),
        ((f || (f = {})).generateUID = d.g);
      const y = f;
    },
    21781: (e, t, r) => {
      'use strict';
      r.d(t, { A: () => a });
      var i = r(29768),
        s = r(34250),
        n = (r(76506), r(91306), r(92143), r(17533));
      const a = (e) => {
        let t = class extends e {
          get apiKey() {
            var e;
            return this._isOverridden('apiKey')
              ? this._get('apiKey')
              : 'portalItem' in this
              ? null == (e = this.portalItem)
                ? void 0
                : e.apiKey
              : null;
          }
          set apiKey(e) {
            null != e
              ? this._override('apiKey', e)
              : (this._clearOverride('apiKey'), this.clear('apiKey', 'user'));
          }
        };
        return (
          (0, i._)([(0, s.Cb)({ type: String })], t.prototype, 'apiKey', null),
          (t = (0, i._)([(0, n.j)('esri.layers.mixins.APIKeyMixin')], t)),
          t
        );
      };
    },
    75025: (e, t, r) => {
      'use strict';
      r.d(t, { A: () => u });
      var i = r(29768),
        s = r(92143),
        n = r(76506),
        a = r(34250),
        l = (r(91306), r(17533)),
        o = r(21132);
      const u = (e) => {
        let t = class extends e {
          get title() {
            if (this._get('title') && 'defaults' !== this.originOf('title'))
              return this._get('title');
            if (this.url) {
              const e = (0, o.p)(this.url);
              if ((0, n.i)(e) && e.title) return e.title;
            }
            return this._get('title') || '';
          }
          set title(e) {
            this._set('title', e);
          }
          set url(e) {
            this._set('url', (0, o.s)(e, s.L.getLogger(this.declaredClass)));
          }
        };
        return (
          (0, i._)([(0, a.Cb)()], t.prototype, 'title', null),
          (0, i._)([(0, a.Cb)({ type: String })], t.prototype, 'url', null),
          (t = (0, i._)([(0, l.j)('esri.layers.mixins.ArcGISService')], t)),
          t
        );
      };
    },
    8547: (e, t, r) => {
      'use strict';
      r.d(t, { C: () => a });
      var i = r(29768),
        s = r(34250),
        n = (r(76506), r(91306), r(92143), r(17533));
      const a = (e) => {
        let t = class extends e {
          constructor() {
            super(...arguments), (this.customParameters = null);
          }
        };
        return (
          (0, i._)(
            [(0, s.Cb)({ type: Object, json: { write: !0 } })],
            t.prototype,
            'customParameters',
            void 0,
          ),
          (t = (0, i._)([(0, n.j)('esri.layers.mixins.CustomParametersMixin')], t)),
          t
        );
      };
    },
    81317: (e, t, r) => {
      'use strict';
      r.d(t, { c: () => d, o: () => i });
      const i = { Base64: 0, Hex: 1, String: 2, Raw: 3 };
      function s(e, t) {
        const r = (65535 & e) + (65535 & t);
        return (((e >> 16) + (t >> 16) + (r >> 16)) << 16) | (65535 & r);
      }
      function n(e, t, r, i, n, a) {
        return s(((l = s(s(t, e), s(i, a))) << (o = n)) | (l >>> (32 - o)), r);
        var l, o;
      }
      function a(e, t, r, i, s, a, l) {
        return n((t & r) | (~t & i), e, t, s, a, l);
      }
      function l(e, t, r, i, s, a, l) {
        return n((t & i) | (r & ~i), e, t, s, a, l);
      }
      function o(e, t, r, i, s, a, l) {
        return n(t ^ r ^ i, e, t, s, a, l);
      }
      function u(e, t, r, i, s, a, l) {
        return n(r ^ (t | ~i), e, t, s, a, l);
      }
      function d(e, t = i.Hex) {
        const r = t || i.Base64,
          n = (function (e, t) {
            (e[t >> 5] |= 128 << t % 32), (e[14 + (((t + 64) >>> 9) << 4)] = t);
            let r = 1732584193,
              i = -271733879,
              n = -1732584194,
              d = 271733878;
            for (let t = 0; t < e.length; t += 16) {
              const h = r,
                c = i,
                p = n,
                f = d;
              (r = a(r, i, n, d, e[t + 0], 7, -680876936)),
                (d = a(d, r, i, n, e[t + 1], 12, -389564586)),
                (n = a(n, d, r, i, e[t + 2], 17, 606105819)),
                (i = a(i, n, d, r, e[t + 3], 22, -1044525330)),
                (r = a(r, i, n, d, e[t + 4], 7, -176418897)),
                (d = a(d, r, i, n, e[t + 5], 12, 1200080426)),
                (n = a(n, d, r, i, e[t + 6], 17, -1473231341)),
                (i = a(i, n, d, r, e[t + 7], 22, -45705983)),
                (r = a(r, i, n, d, e[t + 8], 7, 1770035416)),
                (d = a(d, r, i, n, e[t + 9], 12, -1958414417)),
                (n = a(n, d, r, i, e[t + 10], 17, -42063)),
                (i = a(i, n, d, r, e[t + 11], 22, -1990404162)),
                (r = a(r, i, n, d, e[t + 12], 7, 1804603682)),
                (d = a(d, r, i, n, e[t + 13], 12, -40341101)),
                (n = a(n, d, r, i, e[t + 14], 17, -1502002290)),
                (i = a(i, n, d, r, e[t + 15], 22, 1236535329)),
                (r = l(r, i, n, d, e[t + 1], 5, -165796510)),
                (d = l(d, r, i, n, e[t + 6], 9, -1069501632)),
                (n = l(n, d, r, i, e[t + 11], 14, 643717713)),
                (i = l(i, n, d, r, e[t + 0], 20, -373897302)),
                (r = l(r, i, n, d, e[t + 5], 5, -701558691)),
                (d = l(d, r, i, n, e[t + 10], 9, 38016083)),
                (n = l(n, d, r, i, e[t + 15], 14, -660478335)),
                (i = l(i, n, d, r, e[t + 4], 20, -405537848)),
                (r = l(r, i, n, d, e[t + 9], 5, 568446438)),
                (d = l(d, r, i, n, e[t + 14], 9, -1019803690)),
                (n = l(n, d, r, i, e[t + 3], 14, -187363961)),
                (i = l(i, n, d, r, e[t + 8], 20, 1163531501)),
                (r = l(r, i, n, d, e[t + 13], 5, -1444681467)),
                (d = l(d, r, i, n, e[t + 2], 9, -51403784)),
                (n = l(n, d, r, i, e[t + 7], 14, 1735328473)),
                (i = l(i, n, d, r, e[t + 12], 20, -1926607734)),
                (r = o(r, i, n, d, e[t + 5], 4, -378558)),
                (d = o(d, r, i, n, e[t + 8], 11, -2022574463)),
                (n = o(n, d, r, i, e[t + 11], 16, 1839030562)),
                (i = o(i, n, d, r, e[t + 14], 23, -35309556)),
                (r = o(r, i, n, d, e[t + 1], 4, -1530992060)),
                (d = o(d, r, i, n, e[t + 4], 11, 1272893353)),
                (n = o(n, d, r, i, e[t + 7], 16, -155497632)),
                (i = o(i, n, d, r, e[t + 10], 23, -1094730640)),
                (r = o(r, i, n, d, e[t + 13], 4, 681279174)),
                (d = o(d, r, i, n, e[t + 0], 11, -358537222)),
                (n = o(n, d, r, i, e[t + 3], 16, -722521979)),
                (i = o(i, n, d, r, e[t + 6], 23, 76029189)),
                (r = o(r, i, n, d, e[t + 9], 4, -640364487)),
                (d = o(d, r, i, n, e[t + 12], 11, -421815835)),
                (n = o(n, d, r, i, e[t + 15], 16, 530742520)),
                (i = o(i, n, d, r, e[t + 2], 23, -995338651)),
                (r = u(r, i, n, d, e[t + 0], 6, -198630844)),
                (d = u(d, r, i, n, e[t + 7], 10, 1126891415)),
                (n = u(n, d, r, i, e[t + 14], 15, -1416354905)),
                (i = u(i, n, d, r, e[t + 5], 21, -57434055)),
                (r = u(r, i, n, d, e[t + 12], 6, 1700485571)),
                (d = u(d, r, i, n, e[t + 3], 10, -1894986606)),
                (n = u(n, d, r, i, e[t + 10], 15, -1051523)),
                (i = u(i, n, d, r, e[t + 1], 21, -2054922799)),
                (r = u(r, i, n, d, e[t + 8], 6, 1873313359)),
                (d = u(d, r, i, n, e[t + 15], 10, -30611744)),
                (n = u(n, d, r, i, e[t + 6], 15, -1560198380)),
                (i = u(i, n, d, r, e[t + 13], 21, 1309151649)),
                (r = u(r, i, n, d, e[t + 4], 6, -145523070)),
                (d = u(d, r, i, n, e[t + 11], 10, -1120210379)),
                (n = u(n, d, r, i, e[t + 2], 15, 718787259)),
                (i = u(i, n, d, r, e[t + 9], 21, -343485551)),
                (r = s(r, h)),
                (i = s(i, c)),
                (n = s(n, p)),
                (d = s(d, f));
            }
            return [r, i, n, d];
          })(
            (function (e) {
              const t = [];
              for (let r = 0, i = 8 * e.length; r < i; r += 8)
                t[r >> 5] |= (255 & e.charCodeAt(r / 8)) << r % 32;
              return t;
            })(e),
            8 * e.length,
          );
        switch (r) {
          case i.Raw:
            return n;
          case i.Hex:
            return (function (e) {
              const t = '0123456789abcdef',
                r = [];
              for (let i = 0, s = 4 * e.length; i < s; i++)
                r.push(
                  t.charAt((e[i >> 2] >> ((i % 4) * 8 + 4)) & 15) +
                    t.charAt((e[i >> 2] >> ((i % 4) * 8)) & 15),
                );
              return r.join('');
            })(n);
          case i.String:
            return (function (e) {
              const t = [];
              for (let r = 0, i = 32 * e.length; r < i; r += 8)
                t.push(String.fromCharCode((e[r >> 5] >>> r % 32) & 255));
              return t.join('');
            })(n);
          case i.Base64:
            return (function (e) {
              const t = [];
              for (let r = 0, i = 4 * e.length; r < i; r += 3) {
                const i =
                  (((e[r >> 2] >> ((r % 4) * 8)) & 255) << 16) |
                  (((e[(r + 1) >> 2] >> (((r + 1) % 4) * 8)) & 255) << 8) |
                  ((e[(r + 2) >> 2] >> (((r + 2) % 4) * 8)) & 255);
                for (let s = 0; s < 4; s++)
                  8 * r + 6 * s > 32 * e.length
                    ? t.push('=')
                    : t.push(
                        'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(
                          (i >> (6 * (3 - s))) & 63,
                        ),
                      );
              }
              return t.join('');
            })(n);
        }
      }
    },
    21132: (e, t, r) => {
      'use strict';
      r.d(t, {
        a: () => g,
        b: () => y,
        c: () => p,
        d: () => d,
        e: () => w,
        f: () => c,
        p: () => h,
        s: () => _,
        t: () => f,
        w: () => m,
      });
      var i = r(76506),
        s = r(32101),
        n = r(38742);
      const a = [
          'MapServer',
          'ImageServer',
          'FeatureServer',
          'SceneServer',
          'StreamServer',
          'VectorTileServer',
        ],
        l = new RegExp(
          `^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join(
            '|',
          )}))(?:\\/(?:layers\\/)?(\\d+))?`,
          'i',
        ),
        o = new RegExp(
          `^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join(
            '|',
          )}))(?:\\/(?:layers\\/)?(\\d+))?`,
          'i',
        ),
        u = /(.*?)\/(?:layers\/)?(\d+)\/?$/i;
      function d(e) {
        return !!l.test(e);
      }
      function h(e) {
        const t = (0, s.mN)(e),
          r = t.path.match(l) || t.path.match(o);
        if (!r) return null;
        const [, i, n, a, u] = r,
          d = n.indexOf('/');
        return {
          title: p(-1 !== d ? n.slice(d + 1) : n),
          serverType: a,
          sublayer: null != u && '' !== u ? parseInt(u, 10) : null,
          url: { path: i },
        };
      }
      function c(e) {
        const t = (0, s.mN)(e).path.match(u);
        return t ? { serviceUrl: t[1], sublayerId: Number(t[2]) } : null;
      }
      function p(e) {
        return (e = e.replace(/\s*[/_]+\s*/g, ' '))[0].toUpperCase() + e.slice(1);
      }
      function f(e, t) {
        const r = [];
        if (e) {
          const t = h(e);
          (0, i.i)(t) && t.title && r.push(t.title);
        }
        if (t) {
          const e = p(t);
          r.push(e);
        }
        if (2 === r.length) {
          if (-1 !== r[0].toLowerCase().indexOf(r[1].toLowerCase())) return r[0];
          if (-1 !== r[1].toLowerCase().indexOf(r[0].toLowerCase())) return r[1];
        }
        return r.join(' - ');
      }
      function y(e) {
        if (!e) return !1;
        const t = -1 !== (e = e.toLowerCase()).indexOf('.arcgis.com/'),
          r =
            -1 !== e.indexOf('//services') ||
            -1 !== e.indexOf('//tiles') ||
            -1 !== e.indexOf('//features');
        return t && r;
      }
      function _(e, t) {
        return e ? (0, s.Qj)((0, s.Hu)(e, t)) : e;
      }
      function g(e) {
        let { url: t } = e;
        if (!t) return { url: t };
        t = (0, s.Hu)(t, e.logger);
        const r = (0, s.mN)(t),
          n = h(r.path);
        let a;
        if ((0, i.i)(n))
          null != n.sublayer && null == e.layer.layerId && (a = n.sublayer), (t = n.url.path);
        else if (e.nonStandardUrlAllowed) {
          const e = c(r.path);
          (0, i.i)(e) && ((t = e.serviceUrl), (a = e.sublayerId));
        }
        return { url: (0, s.Qj)(t), layerId: a };
      }
      function m(e, t, r, i, a) {
        (0, n.w)(t, i, 'url', a),
          i.url && null != e.layerId && (i.url = (0, s.v_)(i.url, r, e.layerId.toString()));
      }
      function w(e) {
        if (!e) return !1;
        const t = e.toLowerCase(),
          r = -1 !== t.indexOf('/services/'),
          i = -1 !== t.indexOf('/mapserver/wmsserver'),
          s = -1 !== t.indexOf('/imageserver/wmsserver'),
          n = -1 !== t.indexOf('/wmsserver');
        return r && (i || s || n);
      }
    },
    48190: (e, t, r) => {
      'use strict';
      function i(e) {}
      r.d(t, { n: () => i }), r(76506);
    },
    6941: (e, t, r) => {
      'use strict';
      r.d(t, {
        a: () => n,
        b: () => a,
        c: () => l,
        d: () => s,
        e: () => o,
        f: () => u,
        g: () => d,
      });
      const i = [252, 146, 31, 255],
        s = {
          type: 'esriSMS',
          style: 'esriSMSCircle',
          size: 6,
          color: i,
          outline: {
            type: 'esriSLS',
            style: 'esriSLSSolid',
            width: 0.75,
            color: [153, 153, 153, 255],
          },
        },
        n = { type: 'esriSLS', style: 'esriSLSSolid', width: 0.75, color: i },
        a = {
          type: 'esriSFS',
          style: 'esriSFSSolid',
          color: [252, 146, 31, 196],
          outline: {
            type: 'esriSLS',
            style: 'esriSLSSolid',
            width: 0.75,
            color: [255, 255, 255, 191],
          },
        },
        l = {
          type: 'esriTS',
          color: [255, 255, 255, 255],
          font: { family: 'arial-unicode-ms', size: 10, weight: 'bold' },
          horizontalAlignment: 'center',
          kerning: !0,
          haloColor: [0, 0, 0, 255],
          haloSize: 1,
          rotated: !1,
          text: '',
          xoffset: 0,
          yoffset: 0,
          angle: 0,
        },
        o = {
          type: 'esriSMS',
          style: 'esriSMSCircle',
          color: [0, 0, 0, 255],
          outline: null,
          size: 10.5,
        },
        u = { type: 'esriSLS', style: 'esriSLSSolid', color: [0, 0, 0, 255], width: 1.5 },
        d = { type: 'esriSFS', style: 'esriSFSSolid', color: [0, 0, 0, 255], outline: null };
    },
    93939: (e, t, r) => {
      'use strict';
      r.d(t, { a: () => f, d: () => y, h: () => p });
      var i = r(21972),
        s = r(15324),
        n = r(76506),
        a = r(86656);
      const l = [
        'esri.Color',
        'esri.portal.Portal',
        'esri.symbols.support.Symbol3DAnchorPosition2D',
        'esri.symbols.support.Symbol3DAnchorPosition3D',
      ];
      function o(e) {
        return e instanceof i.Z;
      }
      function u(e) {
        return e instanceof s.Z
          ? Object.keys(e.items)
          : o(e)
          ? (0, a.g)(e).keys()
          : e
          ? Object.keys(e)
          : [];
      }
      function d(e, t) {
        return e instanceof s.Z ? e.items[t] : e[t];
      }
      function h(e) {
        return e ? e.declaredClass : null;
      }
      function c(e, t) {
        const r = e.diff;
        if (r && 'function' == typeof r) return r(e, t);
        const i = u(e),
          s = u(t);
        if (0 === i.length && 0 === s.length) return;
        if (
          !i.length ||
          !s.length ||
          (function (e, t) {
            return !(!Array.isArray(e) || !Array.isArray(t)) && e.length !== t.length;
          })(e, t)
        )
          return { type: 'complete', oldValue: e, newValue: t };
        const a = s.filter((e) => -1 === i.indexOf(e)),
          p = i.filter((e) => -1 === s.indexOf(e)),
          f = i
            .filter((r) => s.indexOf(r) > -1 && d(e, r) !== d(t, r))
            .concat(a, p)
            .sort(),
          y = h(e);
        if (y && l.indexOf(y) > -1 && f.length)
          return { type: 'complete', oldValue: e, newValue: t };
        let _;
        const g = o(e) && o(t);
        for (const i of f) {
          const s = d(e, i),
            a = d(t, i);
          let l;
          (g || ('function' != typeof s && 'function' != typeof a)) &&
            s !== a &&
            ((null == s && null == a) ||
              ((l =
                r && r[i] && 'function' == typeof r[i]
                  ? r[i](s, a)
                  : 'object' == typeof s && 'object' == typeof a && h(s) === h(a)
                  ? c(s, a)
                  : { type: 'complete', oldValue: s, newValue: a }),
              (0, n.i)(l) &&
                ((0, n.i)(_) ? (_.diff[i] = l) : (_ = { type: 'partial', diff: { [i]: l } }))));
        }
        return _;
      }
      function p(e, t) {
        if ((0, n.b)(e)) return !1;
        const r = t.split('.');
        let i = e;
        for (const e of r) {
          if ('complete' === i.type) return !0;
          if ('partial' !== i.type) return !1;
          {
            const t = i.diff[e];
            if (!t) return !1;
            i = t;
          }
        }
        return !0;
      }
      function f(e, t) {
        for (const r of t) if (p(e, r)) return !0;
        return !1;
      }
      function y(e, t) {
        if ('function' != typeof e && 'function' != typeof t && (e || t))
          return !e || !t || ('object' == typeof e && 'object' == typeof t && h(e) !== h(t))
            ? { type: 'complete', oldValue: e, newValue: t }
            : c(e, t);
      }
    },
    97944: (e, t, r) => {
      'use strict';
      r.r(t),
        r.d(t, {
          A: () => O,
          F: () => T,
          O: () => B,
          S: () => A,
          T: () => V,
          a: () => W,
          b: () => R,
          c: () => re,
          d: () => j,
          e: () => J,
          f: () => X,
          g: () => ee,
          h: () => Q,
          i: () => H,
          j: () => P,
          k: () => E,
          l: () => te,
          m: () => N,
          n: () => ie,
        });
      var i = r(88762),
        s = r(82058),
        n = r(50406),
        a = r(72256),
        l = r(1886),
        o = r(72274),
        u = r(60947),
        d = r(23761),
        h = r(81317),
        c = r(97546),
        p = r(1709),
        f = r(32422),
        y = r(9506),
        _ = r(40267),
        g = r(76733),
        m = r(87258),
        w = r(31292),
        b = r(27207),
        S = r(15528),
        F = r(49214),
        I = r(73796),
        v = r(78303),
        C = r(46646),
        D = r(49900),
        x = r(56420);
      class T {
        constructor() {
          (this.declaredRootClass = 'esri.arcade.featureSetCollection'),
            (this._layerById = {}),
            (this._layerByName = {});
        }
        add(e, t, r) {
          (this._layerById[t] = r), (this._layerByName[e] = r);
        }
        featureSetByName(e, t = !0, r = ['*']) {
          return void 0 === this._layerByName[e]
            ? this.resolvePromise(null)
            : this.resolvePromise(this._layerByName[e]);
        }
        featureSetById(e, t = !0, r = ['*']) {
          return void 0 === this._layerById[e]
            ? this.resolvePromise(null)
            : this.resolvePromise(this._layerById[e]);
        }
        castToText() {
          return 'object, FeatureSetCollection';
        }
        resolvePromise(e) {
          return (0, n.DB)(e);
        }
      }
      class R extends a.F {
        constructor(e) {
          super(e),
            (this.declaredClass = 'esri.arcade.featureset.actions.AttributeFilter'),
            (this._maxProcessing = 1e3),
            (this._parent = e.parentfeatureset),
            e.whereclause instanceof o.WhereClause
              ? ((this._whereclause = e.whereclause), (this._whereClauseFunction = null))
              : ((this._whereClauseFunction = e.whereclause), (this._whereclause = null));
        }
        _initialiseFeatureSet() {
          null !== this._parent
            ? ((this.fields = this._parent.fields.slice(0)),
              (this.geometryType = this._parent.geometryType),
              (this.objectIdField = this._parent.objectIdField),
              (this.globalIdField = this._parent.globalIdField),
              (this.spatialReference = this._parent.spatialReference),
              (this.hasM = this._parent.hasM),
              (this.hasZ = this._parent.hasZ),
              (this.typeIdField = this._parent.typeIdField),
              (this.types = this._parent.types))
            : ((this.fields = []),
              (this.typeIdField = ''),
              (this.objectIdField = ''),
              (this.globalIdField = ''),
              (this.spatialReference = new u.Z({ wkid: 4326 })),
              (this.geometryType = l.a0.point));
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() => this._parent._getFilteredSet('', null, this._whereclause, null, e))
                .then(
                  (t) => (
                    this._checkCancelled(e),
                    null !== this._whereClauseFunction
                      ? (this._wset = new a.I(
                          t._candidates.slice(0).concat(t._known.slice(0)),
                          [],
                          t._ordered,
                          this._clonePageDefinition(t.pagesDefinition),
                        ))
                      : (this._wset = new a.I(
                          t._candidates.slice(0),
                          t._known.slice(0),
                          t._ordered,
                          this._clonePageDefinition(t.pagesDefinition),
                        )),
                    this._wset
                  ),
                )
            : (0, n.DB)(this._wset);
        }
        _isInFeatureSet(e) {
          let t = this._parent._isInFeatureSet(e);
          return t === l.a1.NotInFeatureSet
            ? t
            : ((t = this._idstates[e]), void 0 === t ? l.a1.Unknown : t);
        }
        _getFeature(e, t, r) {
          return this._parent._getFeature(e, t, r);
        }
        _getFeatures(e, t, r, i) {
          return this._parent._getFeatures(e, t, r, i);
        }
        _featureFromCache(e) {
          return this._parent._featureFromCache(e);
        }
        executeWhereClause(e) {
          return this._whereclause.testFeature(e);
        }
        executeWhereClauseDeferred(e) {
          if (null !== this._whereClauseFunction)
            try {
              const t = this._whereClauseFunction(e);
              return (0, n.y8)(t) ? t : (0, n.DB)(t);
            } catch (e) {
              return (0, n.d1)(e);
            }
          return (0, n.DB)(this.executeWhereClause(e));
        }
        _fetchAndRefineFeatures(e, t, r) {
          const i = new a.I([], e, !1, null),
            s = Math.min(t, e.length);
          return this._parent._getFeatures(i, -1, s, r).then(() => {
            if ((this._checkCancelled(r), null == this._whereClauseFunction)) {
              for (let t = 0; t < s; t++) {
                const r = this._parent._featureFromCache(e[t]);
                !0 === this.executeWhereClause(r)
                  ? (this._idstates[e[t]] = l.a1.InFeatureSet)
                  : (this._idstates[e[t]] = l.a1.NotInFeatureSet);
              }
              return 'success';
            }
            const i = [];
            for (let t = 0; t < s; t++) {
              const r = this._parent._featureFromCache(e[t]);
              i.push(this.executeWhereClauseDeferred(r));
            }
            return (0, n.$6)(i).then((r) => {
              for (let i = 0; i < t; i++)
                !0 === r[i]
                  ? (this._idstates[e[i]] = l.a1.InFeatureSet)
                  : (this._idstates[e[i]] = l.a1.NotInFeatureSet);
              return 'success';
            });
          });
        }
        _getFilteredSet(e, t, r, i, s) {
          return (
            null !== this._whereClauseFunction ||
              (null !== r
                ? null !== this._whereclause && (r = (0, a.c)(this._whereclause, r))
                : (r = this._whereclause)),
            this._ensureLoaded()
              .then(() => this._parent._getFilteredSet(e, t, r, i, s))
              .then((e) => {
                let t;
                return (
                  this._checkCancelled(s),
                  (t =
                    null !== this._whereClauseFunction
                      ? new a.I(
                          e._candidates.slice(0).concat(e._known.slice(0)),
                          [],
                          e._ordered,
                          this._clonePageDefinition(e.pagesDefinition),
                        )
                      : new a.I(
                          e._candidates.slice(0),
                          e._known.slice(0),
                          e._ordered,
                          this._clonePageDefinition(e.pagesDefinition),
                        )),
                  t
                );
              })
          );
        }
        _stat(e, t, r, i, s, l, o) {
          if (null !== this._whereClauseFunction)
            return null === s && '' === r && null === i
              ? this._manualStat(e, t, l, o)
              : (0, n.DB)({ calculated: !1 });
          let u = this._whereclause;
          return (
            null !== s && null !== this._whereclause && (u = (0, a.c)(this._whereclause, s)),
            this._parent
              ._stat(e, t, r, i, u, l, o)
              .then((n) =>
                !1 === n.calculated
                  ? null === s && '' === r && null === i
                    ? this._manualStat(e, t, l, o)
                    : { calculated: !1 }
                  : n,
              )
          );
        }
        _canDoAggregates(e, t, r, i, s) {
          return null !== this._whereClauseFunction
            ? (0, n.DB)(!1)
            : (null !== s
                ? null !== this._whereclause && (s = (0, a.c)(this._whereclause, s))
                : (s = this._whereclause),
              null === this._parent ? (0, n.DB)(!1) : this._parent._canDoAggregates(e, t, r, i, s));
        }
        _getAggregatePagesDataSourceDefinition(e, t, r, i, s, l, o) {
          return null === this._parent
            ? (0, n.d1)(new Error('Should never be called'))
            : (null !== s
                ? null !== this._whereclause && (s = (0, a.c)(this._whereclause, s))
                : (s = this._whereclause),
              this._parent._getAggregatePagesDataSourceDefinition(e, t, r, i, s, l, o));
        }
        static registerAction() {
          a.F._featuresetFunctions.filter = function (e) {
            if ('function' == typeof e) return new R({ parentfeatureset: this, whereclause: e });
            let t = null;
            return (
              e instanceof o.WhereClause && (t = e),
              new R({ parentfeatureset: this, whereclause: t })
            );
          };
        }
      }
      class k {
        constructor() {
          this.sqlRewritable = !1;
        }
        postInitialization(e, t) {}
      }
      class N extends k {
        constructor(e) {
          super(), (this.field = e), (this.sqlRewritable = !0);
        }
        extractValue(e) {
          return e.attributes[this.field.name];
        }
        rewriteSql(e) {
          return { rewritten: this.sqlRewritable, where: e };
        }
      }
      class E extends k {
        constructor(e, t, r) {
          super(),
            (this.originalField = e),
            (this.sqlRewritable = !0),
            (this.field = (0, l.a2)(e)),
            (this.field.name = t),
            (this.field.alias = r);
        }
        rewriteSql(e, t) {
          return {
            rewritten: this.sqlRewritable,
            where: (0, a.r)(e, this.field.name, this.originalField.name, t.getFieldsIndex()),
          };
        }
        extractValue(e) {
          return e.attributes[this.originalField.name];
        }
      }
      class P extends k {
        constructor(e, t, r) {
          super(), (this.field = e), (this.codefield = t), (this.lkp = r), (this.reverseLkp = {});
          for (const e in r) this.reverseLkp[r[e]] = e;
          this.sqlRewritable = !0;
        }
        rewriteSql(e, t) {
          const r = this.evaluateNodeToWhereClause(
            e.parseTree,
            l.a3.Standardised,
            this.field.name,
            this.codefield instanceof o.WhereClause
              ? (0, a.t)(this.codefield, l.a3.Standardised)
              : this.codefield,
            e.parameters,
          );
          return r.indexOf(P.BADNESS) >= 0
            ? { rewritten: !1, where: e }
            : {
                rewritten: this.sqlRewritable,
                where: o.WhereClause.create(r, t._parent.getFieldsIndex()),
              };
        }
        evaluateNodeToWhereClause(e, t, r = null, i = null, s) {
          let n, l, o, u;
          switch (e.type) {
            case 'interval':
              return (0, a.d)(
                this.evaluateNodeToWhereClause(e.value, t, r, i, s),
                e.qualifier,
                e.op,
              );
            case 'case_expression': {
              let i = ' CASE ';
              'simple' === e.format &&
                (i += this.evaluateNodeToWhereClause(e.operand, t, r, P.BADNESS, s));
              for (let n = 0; n < e.clauses.length; n++)
                i +=
                  ' WHEN ' +
                  this.evaluateNodeToWhereClause(e.clauses[n].operand, t, r, P.BADNESS, s) +
                  ' THEN ' +
                  this.evaluateNodeToWhereClause(e.clauses[n].value, t, r, P.BADNESS, s);
              return (
                null !== e.else &&
                  (i += ' ELSE ' + this.evaluateNodeToWhereClause(e.else, t, r, P.BADNESS, s)),
                (i += ' END '),
                i
              );
            }
            case 'param': {
              const r = s[e.value.toLowerCase()];
              if ('string' == typeof r)
                return "'" + s[e.value.toLowerCase()].toString().replace(/'/g, "''") + "'";
              if (r instanceof Date) return (0, a.b)(r, t);
              if (r instanceof Array) {
                const e = [];
                for (let i = 0; i < r.length; i++)
                  'string' == typeof r[i]
                    ? e.push("'" + r[i].toString().replace(/'/g, "''") + "'")
                    : r[i] instanceof Date
                    ? e.push((0, a.b)(r[i], t))
                    : e.push(r[i].toString());
                return e;
              }
              return r.toString();
            }
            case 'expr_list':
              l = [];
              for (const n of e.value) l.push(this.evaluateNodeToWhereClause(n, t, r, i, s));
              return l;
            case 'unary_expr':
              return ' ( NOT ' + this.evaluateNodeToWhereClause(e.expr, t, r, P.BADNESS, s) + ' ) ';
            case 'binary_expr':
              switch (e.operator) {
                case 'AND':
                  return (
                    ' (' +
                    this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                    ' AND ' +
                    this.evaluateNodeToWhereClause(e.right, t, r, i, s) +
                    ') '
                  );
                case 'OR':
                  return (
                    ' (' +
                    this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                    ' OR ' +
                    this.evaluateNodeToWhereClause(e.right, t, r, i, s) +
                    ') '
                  );
                case 'IS':
                  if ('null' !== e.right.type) throw new Error('Unsupported RHS for IS');
                  return ' (' + this.evaluateNodeToWhereClause(e.left, t, r, i, s) + ' IS NULL )';
                case 'ISNOT':
                  if ('null' !== e.right.type) throw new Error('Unsupported RHS for IS');
                  return (
                    ' (' + this.evaluateNodeToWhereClause(e.left, t, r, i, s) + ' IS NOT NULL )'
                  );
                case 'IN':
                  if (((n = []), 'expr_list' === e.right.type)) {
                    if (
                      'column_ref' === e.left.type &&
                      e.left.column.toUpperCase() === this.field.name.toUpperCase()
                    ) {
                      const n = [];
                      let a = !0;
                      for (const t of e.right.value) {
                        if ('string' !== t.type) {
                          a = !1;
                          break;
                        }
                        if (void 0 === this.lkp[t.value]) {
                          a = !1;
                          break;
                        }
                        n.push(this.lkp[t.value].toString());
                      }
                      if (a)
                        return (
                          ' (' +
                          this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                          ' IN (' +
                          n.join(',') +
                          ')) '
                        );
                    }
                    return (
                      (n = this.evaluateNodeToWhereClause(e.right, t, r, i, s)),
                      ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                        ' IN (' +
                        n.join(',') +
                        ')) '
                    );
                  }
                  return (
                    (u = this.evaluateNodeToWhereClause(e.right, t, r, i, s)),
                    u instanceof Array
                      ? ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                        ' IN (' +
                        u.join(',') +
                        ')) '
                      : ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                        ' IN (' +
                        u +
                        ')) '
                  );
                case 'NOT IN':
                  if (((n = []), 'expr_list' === e.right.type)) {
                    if (
                      'column_ref' === e.left.type &&
                      e.left.column.toUpperCase() === this.field.name.toUpperCase()
                    ) {
                      const n = [];
                      let a = !0;
                      for (const t of e.right.value) {
                        if ('string' !== t.type) {
                          a = !1;
                          break;
                        }
                        if (void 0 === this.lkp[t.value]) {
                          a = !1;
                          break;
                        }
                        n.push(this.lkp[t.value].toString());
                      }
                      if (a)
                        return (
                          ' (' +
                          this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                          ' NOT IN (' +
                          n.join(',') +
                          ')) '
                        );
                    }
                    return (
                      (n = this.evaluateNodeToWhereClause(e.right, t, r, i, s)),
                      ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                        ' NOT IN (' +
                        n.join(',') +
                        ')) '
                    );
                  }
                  return (
                    (u = this.evaluateNodeToWhereClause(e.right, t, r, i, s)),
                    u instanceof Array
                      ? ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                        ' NOT IN (' +
                        u.join(',') +
                        ')) '
                      : ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, i, s) +
                        ' NOT IN (' +
                        u +
                        ')) '
                  );
                case 'BETWEEN':
                  return (
                    (o = this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s)),
                    ' (' +
                      this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                      ' BETWEEN ' +
                      o[0] +
                      ' AND ' +
                      o[1] +
                      ' ) '
                  );
                case 'NOTBETWEEN':
                  return (
                    (o = this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s)),
                    ' (' +
                      this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                      ' NOT BETWEEN ' +
                      o[0] +
                      ' AND ' +
                      o[1] +
                      ' ) '
                  );
                case 'LIKE':
                  return '' !== e.escape
                    ? ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                        ' LIKE ' +
                        this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s) +
                        " ESCAPE '" +
                        e.escape +
                        "') "
                    : ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                        ' LIKE ' +
                        this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s) +
                        ') ';
                case 'NOT LIKE':
                  return '' !== e.escape
                    ? ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                        ' NOT LIKE ' +
                        this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s) +
                        " ESCAPE '" +
                        e.escape +
                        "') "
                    : ' (' +
                        this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                        ' NOT LIKE ' +
                        this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s) +
                        ') ';
                case '<>':
                case '=':
                  if ('column_ref' === e.left.type && 'string' === e.right.type) {
                    if (
                      e.left.column.toUpperCase() === this.field.name.toUpperCase() &&
                      void 0 !== this.lkp[e.right.value.toString()]
                    )
                      return (
                        ' (' +
                        i +
                        ' ' +
                        e.operator +
                        ' ' +
                        this.lkp[e.right.value.toString()].toString() +
                        ') '
                      );
                  } else if (
                    'column_ref' === e.right.type &&
                    'string' === e.left.type &&
                    e.right.column.toUpperCase() === this.field.name.toUpperCase()
                  )
                    return (
                      ' (' +
                      this.lkp[e.right.value.toString()].toString() +
                      ' ' +
                      e.operator +
                      ' ' +
                      i +
                      ') '
                    );
                  return (
                    ' (' +
                    this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                    ' ' +
                    e.operator +
                    ' ' +
                    this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s) +
                    ') '
                  );
                case '<':
                case '>':
                case '>=':
                case '<=':
                case '*':
                case '-':
                case '+':
                case '/':
                  return (
                    ' (' +
                    this.evaluateNodeToWhereClause(e.left, t, r, P.BADNESS, s) +
                    ' ' +
                    e.operator +
                    ' ' +
                    this.evaluateNodeToWhereClause(e.right, t, r, P.BADNESS, s) +
                    ') '
                  );
              }
              throw new Error('Not Supported Operator ' + e.operator);
            case 'null':
              return 'null';
            case 'bool':
              return !0 === e.value ? '1' : '0';
            case 'string':
              return "'" + e.value.toString().replace(/'/g, "''") + "'";
            case 'timestamp':
            case 'date':
              return (0, a.b)(e.value, t);
            case 'number':
              return e.value.toString();
            case 'current_time':
              return (0, a.m)('date' === e.mode, t);
            case 'column_ref':
              return r && r.toLowerCase() === e.column.toLowerCase() ? '(' + i + ')' : e.column;
            case 'function': {
              const i = this.evaluateNodeToWhereClause(e.args, t, r, P.BADNESS, s);
              return (0, a.a)(e.name, i, t);
            }
          }
          throw new Error('Unsupported sql syntax ' + e.type);
        }
        extractValue(e) {
          return this.codefield instanceof o.WhereClause
            ? this.reverseLkp[this.codefield.calculateValueCompiled(e)]
            : this.reverseLkp[e.attributes[this.codefield]];
        }
      }
      P.BADNESS = '_!!!_BAD_LKP_!!!!';
      class A extends k {
        constructor(e, t) {
          super(), (this.field = e), (this.sql = t);
        }
        rewriteSql(e, t) {
          return {
            rewritten: !0,
            where: (0, a.r)(
              e,
              this.field.name,
              (0, a.t)(this.sql, l.a3.Standardised),
              t.getFieldsIndex(),
            ),
          };
        }
        extractValue(e) {
          return this.sql.calculateValueCompiled(e);
        }
      }
      class O extends a.F {
        constructor(e) {
          super(e),
            (this._calcFunc = null),
            (this.declaredClass = 'esri.arcade.featureset.actions.Adapted'),
            (this.adaptedFields = null),
            (this._extraFilter = null),
            (this._extraFilter = e.extraFilter),
            (this._parent = e.parentfeatureset),
            (this._maxProcessing = 30),
            (this.adaptedFields = e.adaptedFields);
        }
        static findField(e, t) {
          for (const r of e) if (r.name.toLowerCase() === t.toString().toLowerCase()) return r;
          return null;
        }
        _initialiseFeatureSet() {
          null !== this._parent
            ? ((this.geometryType = this._parent.geometryType),
              (this.objectIdField = this._parent.objectIdField),
              (this.globalIdField = this._parent.globalIdField),
              (this.spatialReference = this._parent.spatialReference),
              (this.hasM = this._parent.hasM),
              (this.hasZ = this._parent.hasZ),
              (this.typeIdField = this._parent.typeIdField),
              (this.types = this._parent.types))
            : ((this.spatialReference = new u.Z({ wkid: 4326 })),
              (this.objectIdField = ''),
              (this.globalIdField = ''),
              (this.geometryType = l.a0.point),
              (this.typeIdField = ''),
              (this.types = null)),
            (this.fields = []);
          for (const e of this.adaptedFields)
            e.postInitialization(this, this._parent), this.fields.push(e.field);
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() =>
                  this._extraFilter
                    ? this._getFilteredSet('', null, null, null, e)
                    : this._parent._getSet(e),
                )
                .then(
                  (t) => (
                    this._checkCancelled(e),
                    (this._wset = new a.I(
                      t._candidates.slice(0),
                      t._known.slice(0),
                      t._ordered,
                      this._clonePageDefinition(t.pagesDefinition),
                    )),
                    this._wset
                  ),
                )
            : (0, n.DB)(this._wset);
        }
        _isInFeatureSet(e) {
          return this._parent._isInFeatureSet(e);
        }
        _getFeatures(e, t, r, i) {
          const s = [];
          -1 !== t && void 0 === this._featureCache[t] && s.push(t);
          const o = this._maxQueryRate();
          if (!0 === this._checkIfNeedToExpandKnownPage(e, o))
            return this._expandPagedSet(e, o, 0, 0, i).then(() => this._getFeatures(e, t, r, i));
          let u = 0;
          for (
            let i = e._lastFetchedIndex;
            i < e._known.length &&
            (u++,
            u <= r && (e._lastFetchedIndex += 1),
            !(
              void 0 === this._featureCache[e._known[i]] &&
              (e._known[i] !== t && s.push(e._known[i]), s.length >= o)
            ));
            i++
          );
          if (0 === s.length) return (0, n.DB)('success');
          e = new a.I([], s, e._ordered, null);
          const h = Math.min(s.length, r);
          return this._parent._getFeatures(e, -1, h, i).then(() => {
            this._checkCancelled(i);
            const e = [];
            for (let t = 0; t < h; t++) {
              const r = this._parent._featureFromCache(s[t]);
              void 0 !== r && e.push({ geometry: r.geometry, attributes: r.attributes, id: s[t] });
            }
            for (const t of e) {
              const e = [];
              for (const r of this.adaptedFields) e[r.field.name] = r.extractValue(t);
              this._featureCache[t.id] = new d.Z({ attributes: e, geometry: (0, l.S)(t.geometry) });
            }
            return 'success';
          });
        }
        _fetchAndRefineFeatures() {
          return (0, n.d1)(new Error('Fetch and Refine should not be called in this featureset'));
        }
        _getFilteredSet(e, t, r, i, s) {
          let n = !1;
          const l = this.reformulateWithoutAdaptions(r);
          (n = l.cannot), (r = l.where);
          let o = !1;
          if (null !== i) {
            o = !0;
            const e = [];
            for (const t of this.adaptedFields)
              if (!(t instanceof N) && !0 === i.scanForField(t.field.name)) {
                if (!(t instanceof E)) {
                  (i = null), (o = !1);
                  break;
                }
                e.push({ field: t.field.name, newfield: t.originalField.name });
              }
            i && e.length > 0 && (i = i.replaceFields(e));
          }
          return (
            null !== r
              ? null !== this._extraFilter && (r = (0, a.c)(this._extraFilter, r))
              : (r = this._extraFilter),
            this._ensureLoaded()
              .then(() => this._parent._getFilteredSet(e, t, r, i, s))
              .then((e) => {
                let t;
                return (
                  this._checkCancelled(s),
                  (t =
                    !0 === n
                      ? new a.I(
                          e._candidates.slice(0).concat(e._known.slice(0)),
                          [],
                          !0 === o && e._ordered,
                          this._clonePageDefinition(e.pagesDefinition),
                        )
                      : new a.I(
                          e._candidates.slice(0),
                          e._known.slice(0),
                          !0 === o && e._ordered,
                          this._clonePageDefinition(e.pagesDefinition),
                        )),
                  t
                );
              })
          );
        }
        reformulateWithoutAdaptions(e) {
          const t = { cannot: !1, where: e };
          if (null !== e)
            for (const r of this.adaptedFields)
              if (!0 === (0, a.s)(e, r.field.name)) {
                const i = r.rewriteSql(e, this);
                if (!0 !== i.rewritten) {
                  (t.cannot = !0), (t.where = null);
                  break;
                }
                t.where = i.where;
              }
          return t;
        }
        _stat(e, t, r, i, s, l, o) {
          let u = !1,
            d = this.reformulateWithoutAdaptions(t);
          return (
            (u = d.cannot),
            (t = d.where),
            (d = this.reformulateWithoutAdaptions(s)),
            (u = u || d.cannot),
            null !== (s = d.where)
              ? null !== this._extraFilter && (s = (0, a.c)(this._extraFilter, s))
              : (s = this._extraFilter),
            !0 === u
              ? null === s && '' === r && null === i
                ? this._manualStat(e, t, l, o)
                : (0, n.DB)({ calculated: !1 })
              : this._parent
                  ._stat(e, t, r, i, s, l, o)
                  .then((n) =>
                    !1 === n.calculated
                      ? null === s && '' === r && null === i
                        ? this._manualStat(e, t, l, o)
                        : { calculated: !1 }
                      : n,
                  )
          );
        }
        _canDoAggregates(e, t, r, i, s) {
          if (null === this._parent) return (0, n.DB)(!1);
          for (let t = 0; t < e.length; t++)
            for (const r of this.adaptedFields)
              if (e[t].toLowerCase() === r.field.name.toLowerCase() && !(r instanceof N))
                return (0, n.DB)(!1);
          const l = [];
          for (let e = 0; e < t.length; e++) {
            const r = t[e];
            if (null !== r.workingexpr) {
              const e = this.reformulateWithoutAdaptions(r.workingexpr);
              if (e.cannot) return (0, n.DB)(!1);
              const t = r.clone();
              (t.workingexpr = e.where), l.push(t);
            } else l.push(r);
          }
          const o = this.reformulateWithoutAdaptions(s);
          return o.cannot
            ? (0, n.DB)(!1)
            : (null !== (s = o.where)
                ? null !== this._extraFilter && (s = (0, a.c)(this._extraFilter, s))
                : (s = this._extraFilter),
              this._parent._canDoAggregates(e, l, r, i, s));
        }
        _getAggregatePagesDataSourceDefinition(e, t, r, i, s, l, o) {
          if (null === this._parent) return (0, n.d1)(new Error('Should never be called'));
          const u = [];
          for (let e = 0; e < t.length; e++) {
            const r = t[e];
            if (null !== r.workingexpr) {
              const e = this.reformulateWithoutAdaptions(r.workingexpr);
              if (e.cannot) return (0, n.d1)(new Error('Should never be called'));
              const t = r.clone();
              (t.workingexpr = e.where), u.push(t);
            } else u.push(r);
          }
          const d = this.reformulateWithoutAdaptions(s);
          return d.cannot
            ? (0, n.d1)(new Error('Should never be called'))
            : (null !== (s = d.where)
                ? null !== this._extraFilter && (s = (0, a.c)(this._extraFilter, s))
                : (s = this._extraFilter),
              this._parent._getAggregatePagesDataSourceDefinition(e, u, r, i, s, l, o));
        }
      }
      function L(e, t) {
        return e === t ? 0 : null === e ? -1 : null === t ? 1 : e < t ? -1 : 1;
      }
      class B {
        constructor(e) {
          const t = e.split(',');
          (this._fields = []), (this._directions = []);
          for (let e = 0; e < t.length; e++) {
            const r = t[e].match(/\S+/g);
            this._fields.push(r[0]),
              2 === r.length
                ? 'asc' === r[1].toLowerCase()
                  ? this._directions.push(1)
                  : this._directions.push(0)
                : this._directions.push(1);
          }
        }
        constructClause() {
          let e = '';
          for (let t = 0; t < this._fields.length; t++)
            0 !== t && (e += ','),
              (e += this._fields[t]),
              1 === this._directions[t] ? (e += ' ASC') : (e += ' DESC');
          return e;
        }
        order(e) {
          e.sort((e, t) => {
            for (let r = 0; r < this._fields.length; r++) {
              const i = this.featureValue(e.feature, this._fields[r], r),
                s = this.featureValue(t.feature, this._fields[r], r);
              let n = 0;
              if (((n = 1 === this._directions[r] ? L(i, s) : -1 * L(i, s)), 0 !== n)) return n;
            }
            return 0;
          });
        }
        scanForField(e) {
          for (let t = 0; t < this._fields.length; t++)
            if (this._fields[t].toLowerCase().trim() === e.toLowerCase().trim()) return !0;
          return !1;
        }
        replaceFields(e) {
          let t = '';
          for (let r = 0; r < this._fields.length; r++) {
            0 !== r && (t += ',');
            let i = this._fields[r];
            for (const t of e)
              if (i.toLowerCase() === t.field.toLowerCase()) {
                i = t.newfield;
                break;
              }
            (t += i), 1 === this._directions[r] ? (t += ' ASC') : (t += ' DESC');
          }
          return new B(t);
        }
        featureValue(e, t, r) {
          const i = e.attributes[t];
          if (void 0 !== i) return i;
          for (const i in e.attributes)
            if (t.toLowerCase() === i.toLowerCase()) return (this._fields[r] = i), e.attributes[i];
          return null;
        }
      }
      class j extends a.F {
        constructor(e) {
          super(e),
            (this._orderbyclause = null),
            (this.declaredClass = 'esri.arcade.featureset.actions.OrderBy'),
            (this._maxProcessing = 100),
            (this._orderbyclause = e.orderbyclause),
            (this._parent = e.parentfeatureset);
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() => this._getFilteredSet('', null, null, this._orderbyclause, e))
                .then((t) => (this._checkCancelled(e), (this._wset = t), this._wset))
            : (0, n.DB)(this._wset);
        }
        manualOrderSet(e, t) {
          return this.getIdColumnDictionary(e, [], -1, t).then((e) => {
            this._orderbyclause.order(e);
            const t = new a.I([], [], !0, null);
            for (let r = 0; r < e.length; r++) t._known.push(e[r].id);
            return t;
          });
        }
        getIdColumnDictionary(e, t, r, i) {
          if (r < e._known.length - 1) {
            const s = this._maxQueryRate();
            if ('GETPAGES' === e._known[r + 1])
              return (0, l.a4)(this._parent._expandPagedSet(e, s, 0, 0, i)).then(() =>
                this.getIdColumnDictionary(e, t, r, i),
              );
            let n = r + 1;
            const a = [];
            for (; n < e._known.length && 'GETPAGES' !== e._known[n]; ) a.push(e._known[n]), n++;
            return (
              (r += a.length),
              (0, l.a4)(this._parent._getFeatureBatch(a, i)).then((s) => {
                this._checkCancelled(i);
                for (const e of s) t.push({ id: e.attributes[this.objectIdField], feature: e });
                return this.getIdColumnDictionary(e, t, r, i);
              })
            );
          }
          return e._candidates.length > 0
            ? (0, l.a4)(this._refineSetBlock(e, this._maxProcessingRate(), i)).then(
                () => (this._checkCancelled(i), this.getIdColumnDictionary(e, t, r, i)),
              )
            : (0, n.DB)(t);
        }
        _isInFeatureSet(e) {
          return this._parent._isInFeatureSet(e);
        }
        _getFeatures(e, t, r, i) {
          return this._parent._getFeatures(e, t, r, i);
        }
        _featureFromCache(e) {
          if (void 0 === this._featureCache[e]) {
            const t = this._parent._featureFromCache(e);
            if (void 0 === t) return;
            return null === t ? null : ((this._featureCache[e] = t), t);
          }
          return this._featureCache[e];
        }
        _fetchAndRefineFeatures() {
          return (0, n.d1)(new Error('Fetch and Refine should not be called in this featureset'));
        }
        _getFilteredSet(e, t, r, i, s) {
          return this._ensureLoaded()
            .then(() =>
              this._parent._getFilteredSet(e, t, r, null === i ? this._orderbyclause : i, s),
            )
            .then((e) => {
              this._checkCancelled(s);
              const i = new a.I(
                e._candidates.slice(0),
                e._known.slice(0),
                e._ordered,
                this._clonePageDefinition(e.pagesDefinition),
              );
              let n = !0;
              return (
                e._candidates.length > 0 && (n = !1),
                !1 === i._ordered
                  ? this.manualOrderSet(i, s).then(
                      (e) => (
                        !1 === n &&
                          ((null === t && null === r) ||
                            (e = new a.I(
                              e._candidates.slice(0).concat(e._known.slice(0)),
                              [],
                              e._ordered,
                              this._clonePageDefinition(e.pagesDefinition),
                            ))),
                        e
                      ),
                    )
                  : i
              );
            });
        }
        static registerAction() {
          a.F._featuresetFunctions.orderBy = function (e) {
            return '' === e ? this : new j({ parentfeatureset: this, orderbyclause: new B(e) });
          };
        }
      }
      class q {
        clone() {
          const e = new q();
          return (
            (e.field = this.field),
            (e.tofieldname = this.tofieldname),
            (e.typeofstat = this.typeofstat),
            (e.workingexpr = this.workingexpr),
            e
          );
        }
        static parseStatField(e, t, r) {
          const i = new q();
          i.field = e;
          const s = o.WhereClause.create(t, r),
            n = (function (e) {
              if ('function' === e.parseTree.type) {
                if (0 === e.parseTree.args.value.length)
                  return { name: e.parseTree.name, expr: null };
                if (e.parseTree.args.value.length > 1)
                  throw new Error('Statistic does not have 1 or 0 Parameters');
                const t = o.WhereClause.create(
                  (0, a.e)(e.parseTree.args.value[0], l.a3.Standardised, e.parameters),
                  e.fieldsIndex,
                );
                return { name: e.parseTree.name, expr: t };
              }
              return null;
            })(s);
          if (null === n) throw new Error('Invalid Statistic Function');
          const u = n.name.toUpperCase().trim();
          if ('MIN' === u) {
            if (((i.typeofstat = 'MIN'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          } else if ('MAX' === u) {
            if (((i.typeofstat = 'MAX'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          } else if ('COUNT' === u) (i.typeofstat = 'COUNT'), (i.workingexpr = n.expr);
          else if ('STDEV' === u) {
            if (((i.typeofstat = 'STDDEV'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          } else if ('SUM' === u) {
            if (((i.typeofstat = 'SUM'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          } else if ('MEAN' === u) {
            if (((i.typeofstat = 'AVG'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          } else if ('AVG' === u) {
            if (((i.typeofstat = 'AVG'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          } else {
            if ('VAR' !== u) throw new Error('Invalid Statistic Function');
            if (((i.typeofstat = 'VAR'), (i.workingexpr = n.expr), null === s))
              throw new Error('Invalid Statistic Function Parameters');
          }
          return i;
        }
        toStatisticsName() {
          switch (this.typeofstat.toUpperCase()) {
            case 'MIN':
              return 'min';
            case 'MAX':
              return 'max';
            case 'SUM':
              return 'sum';
            case 'COUNT':
              return 'count';
            case 'VAR':
              return 'var';
            case 'STDDEV':
              return 'stddev';
            case 'AVG':
              return 'avg';
            default:
              return 'count';
          }
        }
      }
      function G(e) {
        if (!e) return 'COUNT';
        switch (e.toLowerCase()) {
          case 'max':
            return 'MAX';
          case 'var':
          case 'variance':
            return 'VAR';
          case 'avg':
          case 'average':
          case 'mean':
            return 'AVG';
          case 'min':
            return 'MIN';
          case 'sum':
            return 'SUM';
          case 'stdev':
          case 'stddev':
            return 'STDDEV';
          case 'count':
            return 'COUNT';
        }
        return 'COUNT';
      }
      class U extends a.F {
        constructor(e) {
          super(e),
            (this._decodedStatsfield = []),
            (this._decodedGroupbyfield = []),
            (this._candosimplegroupby = !0),
            (this.phsyicalgroupbyfields = []),
            (this.objectIdField = 'ROW__ID'),
            (this._internalObjectIdField = 'ROW__ID'),
            (this._adaptedFields = []),
            (this.declaredClass = 'esri.arcade.featureset.actions.Aggregate'),
            (this._uniqueIds = 1),
            (this._maxQuery = 10),
            (this._maxProcessing = 10),
            (this._parent = e.parentfeatureset),
            (this._config = e);
        }
        isTable() {
          return !0;
        }
        _getSet(e) {
          return null === this._wset
            ? this._getFilteredSet('', null, null, null, e).then(
                (e) => ((this._wset = e), this._wset),
              )
            : (0, n.DB)(this._wset);
        }
        _isInFeatureSet() {
          return l.a1.InFeatureSet;
        }
        nextUniqueName(e) {
          for (; 1 === e['T' + this._uniqueIds.toString()]; ) this._uniqueIds++;
          const t = 'T' + this._uniqueIds.toString();
          return (e[t] = 1), t;
        }
        convertToEsriFieldType(e) {
          return e;
        }
        _initialiseFeatureSet() {
          const e = {};
          let t = !1,
            r = 1;
          const i = this._parent ? this._parent.getFieldsIndex() : new p.Z([]);
          for (this.objectIdField = 'ROW__ID', this.globalIdField = ''; !1 === t; ) {
            let e = !1;
            for (let t = 0; t < this._config.groupbyfields.length; t++)
              if (
                this._config.groupbyfields[t].name.toLowerCase() ===
                this.objectIdField.toLowerCase()
              ) {
                e = !0;
                break;
              }
            if (!1 === e)
              for (let t = 0; t < this._config.statsfields.length; t++)
                if (
                  this._config.statsfields[t].name.toLowerCase() ===
                  this.objectIdField.toLowerCase()
                ) {
                  e = !0;
                  break;
                }
            !1 === e ? (t = !0) : ((this.objectIdField = 'ROW__ID' + r.toString()), r++);
          }
          for (const e of this._config.statsfields) {
            const t = new q();
            (t.field = e.name),
              (t.tofieldname = e.name),
              (t.workingexpr =
                e.expression instanceof o.WhereClause
                  ? e.expression
                  : o.WhereClause.create(e.expression, i)),
              (t.typeofstat = G(e.statistic)),
              this._decodedStatsfield.push(t);
          }
          this._decodedGroupbyfield = [];
          for (const e of this._config.groupbyfields) {
            const t = {
              name: e.name,
              singlefield: null,
              tofieldname: e.name,
              expression:
                e.expression instanceof o.WhereClause
                  ? e.expression
                  : o.WhereClause.create(e.expression, i),
            };
            this._decodedGroupbyfield.push(t);
          }
          if (null !== this._parent) {
            (this.geometryType = this._parent.geometryType),
              (this.spatialReference = this._parent.spatialReference),
              (this.hasM = this._parent.hasM),
              (this.hasZ = this._parent.hasZ),
              (this.typeIdField = '');
            for (const t of this._parent.fields) e[t.name.toUpperCase()] = 1;
            this.types = null;
          } else
            (this.geometryType = l.a0.point),
              (this.typeIdField = ''),
              (this.types = null),
              (this.spatialReference = new u.Z({ wkid: 4326 }));
          this.fields = [];
          const s = new q();
          (s.field = this.nextUniqueName(e)),
            (s.tofieldname = this.objectIdField),
            (s.workingexpr = o.WhereClause.create(
              this._parent.objectIdField,
              this._parent.getFieldsIndex(),
            )),
            (s.typeofstat = 'MIN'),
            this._decodedStatsfield.push(s);
          for (const t of this._decodedGroupbyfield) {
            const r = new c.Z();
            if (
              ((t.name = this.nextUniqueName(e)),
              (r.name = t.tofieldname),
              (r.alias = r.name),
              (0, a.i)(t.expression))
            ) {
              const e = this._parent.getField((0, a.t)(t.expression, l.a3.Standardised));
              if (!e) throw new Error('Field is not present for Aggregation');
              (t.name = e.name),
                (t.singlefield = e.name),
                this.phsyicalgroupbyfields.push(e.name),
                (r.type = e.type);
            } else {
              r.type = this.convertToEsriFieldType((0, a.p)(t.expression, this._parent.fields));
              const e = new c.Z();
              (e.name = t.name),
                (e.alias = e.name),
                this.phsyicalgroupbyfields.push(t.name),
                this._adaptedFields.push(new A(e, t.expression)),
                (this._candosimplegroupby = !1);
            }
            this.fields.push(r);
          }
          if (this._adaptedFields.length > 0)
            for (const e of this._parent.fields) this._adaptedFields.push(new N(e));
          for (let t = 0; t < this._decodedStatsfield.length; t++) {
            const r = new c.Z();
            let i = null;
            const s = this._decodedStatsfield[t];
            (s.field = this.nextUniqueName(e)),
              s.tofieldname === this.objectIdField && (this._internalObjectIdField = s.field),
              (r.name = s.tofieldname),
              (r.alias = r.name);
            const n =
              null !== s.workingexpr && (0, a.i)(s.workingexpr)
                ? (0, a.t)(s.workingexpr, l.a3.Standardised)
                : '';
            switch (this._decodedStatsfield[t].typeofstat) {
              case 'SUM':
                if ('' !== n) {
                  if (((i = this._parent.getField(n)), !i))
                    throw new Error('Field is not present for Aggregation');
                  r.type = i.type;
                } else r.type = 'double';
                break;
              case 'MIN':
              case 'MAX':
                if ('' !== n) {
                  if (((i = this._parent.getField(n)), !i))
                    throw new Error('Field is not present for Aggregation');
                  r.type = i.type;
                } else r.type = 'double';
                break;
              case 'COUNT':
                r.type = 'integer';
                break;
              case 'STDDEV':
              case 'VAR':
              case 'AVG':
                if ('' !== n && ((i = this._parent.getField(n)), !i))
                  throw new Error('Field is not present for Aggregation');
                r.type = 'double';
            }
            this.fields.push(r);
          }
        }
        _canDoAggregates() {
          return (0, n.DB)(!1);
        }
        _getFeatures(e, t, r, i) {
          -1 !== t && this._featureCache[t];
          const s = this._maxQuery;
          return !0 === this._checkIfNeedToExpandKnownPage(e, s)
            ? this._expandPagedSet(e, s, 0, 0, i).then(() => this._getFeatures(e, t, r, i))
            : (0, n.DB)('success');
        }
        _getFilteredSet(e, t, r, i, s) {
          if ('' !== e) return (0, n.DB)(new a.I([], [], !0, null));
          let l = null;
          const o = { ordered: !1, nowhereclause: !1 };
          return this._ensureLoaded()
            .then(() => {
              if (null !== r)
                for (let e = 0; e < this._decodedStatsfield.length; e++)
                  if (!0 === (0, a.s)(r, this._decodedStatsfield[e].tofieldname)) {
                    (o.nowhereclause = !0), (r = null);
                    break;
                  }
              if (null !== i) {
                o.ordered = !0;
                for (let e = 0; e < this._decodedStatsfield.length; e++)
                  if (!0 === i.scanForField(this._decodedStatsfield[e].tofieldname)) {
                    (i = null), (o.ordered = !1);
                    break;
                  }
                if (null !== i)
                  for (const e of this._decodedGroupbyfield)
                    if (null === e.singlefield && !0 === i.scanForField(e.tofieldname)) {
                      (i = null), (o.ordered = !1);
                      break;
                    }
              }
              return !1 === this._candosimplegroupby
                ? (0, n.DB)(!1)
                : this._parent._canDoAggregates(
                    this.phsyicalgroupbyfields,
                    this._decodedStatsfield,
                    '',
                    null,
                    null,
                  );
            })
            .then((e) => {
              if (e) {
                let e = null;
                r && (e = this._reformulateWhereClauseWithoutGroupByFields(r));
                let t = null;
                return (
                  i && (t = this._reformulateOrderClauseWithoutGroupByFields(i)),
                  this._parent
                    ._getAggregatePagesDataSourceDefinition(
                      this.phsyicalgroupbyfields,
                      this._decodedStatsfield,
                      '',
                      null,
                      e,
                      t,
                      this._internalObjectIdField,
                    )
                    .then(
                      (e) => (
                        this._checkCancelled(s),
                        (l =
                          !0 === o.nowhereclause
                            ? new a.I(
                                e._candidates.slice(0).concat(e._known.slice(0)),
                                [],
                                !0 === o.ordered && e._ordered,
                                this._clonePageDefinition(e.pagesDefinition),
                              )
                            : new a.I(
                                e._candidates.slice(0),
                                e._known.slice(0),
                                !0 === o.ordered && e._ordered,
                                this._clonePageDefinition(e.pagesDefinition),
                              )),
                        l
                      ),
                    )
                );
              }
              let t = this._parent;
              if (
                (this._adaptedFields.length > 0 &&
                  (t = new O({
                    parentfeatureset: this._parent,
                    adaptedFields: this._adaptedFields,
                    extraFilter: null,
                  })),
                !0 === o.nowhereclause)
              )
                l = new a.I(['GETPAGES'], [], !1, {
                  aggregatefeaturesetpagedefinition: !0,
                  resultOffset: 0,
                  resultRecordCount: this._maxQuery,
                  internal: {
                    fullyResolved: !1,
                    workingItem: null,
                    type: 'manual',
                    iterator: null,
                    set: [],
                    subfeatureset: new j({
                      parentfeatureset: t,
                      orderbyclause: new B(
                        this.phsyicalgroupbyfields.join(',') +
                          ',' +
                          this._parent.objectIdField +
                          ' ASC',
                      ),
                    }),
                  },
                });
              else {
                let e = t;
                if (null !== r) {
                  let t = null;
                  r && (t = this._reformulateWhereClauseWithoutGroupByFields(r)),
                    (e = new R({ parentfeatureset: e, whereclause: t }));
                }
                l = new a.I(['GETPAGES'], [], !1, {
                  aggregatefeaturesetpagedefinition: !0,
                  resultOffset: 0,
                  resultRecordCount: this._maxQuery,
                  internal: {
                    fullyResolved: !1,
                    workingItem: null,
                    type: 'manual',
                    iterator: null,
                    set: [],
                    subfeatureset: new j({
                      parentfeatureset: e,
                      orderbyclause: new B(
                        this.phsyicalgroupbyfields.join(',') +
                          ',' +
                          this._parent.objectIdField +
                          ' ASC',
                      ),
                    }),
                  },
                });
              }
              return l;
            });
        }
        _reformulateWhereClauseWithoutStatsFields(e) {
          for (const t of this._decodedStatsfield)
            e = (0, a.r)(
              e,
              t.tofieldname,
              (0, a.t)(t.workingexpr, l.a3.Standardised),
              this._parent.getFieldsIndex(),
            );
          return e;
        }
        _reformulateWhereClauseWithoutGroupByFields(e) {
          for (const t of this._decodedGroupbyfield)
            t.tofieldname !== t.name &&
              (e = (0, a.r)(
                e,
                t.tofieldname,
                (0, a.t)(t.expression, l.a3.Standardised),
                this._parent.getFieldsIndex(),
              ));
          return e;
        }
        _reformulateOrderClauseWithoutGroupByFields(e) {
          const t = [];
          for (const e of this._decodedGroupbyfield)
            e.tofieldname !== e.name && t.push({ field: e.tofieldname, newfield: e.name });
          return t.length > 0 ? e.replaceFields(t) : e;
        }
        _clonePageDefinition(e) {
          return null === e
            ? null
            : !0 === e.aggregatefeaturesetpagedefinition
            ? {
                aggregatefeaturesetpagedefinition: !0,
                resultRecordCount: e.resultRecordCount,
                resultOffset: e.resultOffset,
                internal: e.internal,
              }
            : this._parent._clonePageDefinition(e);
        }
        _refineSetBlock(e, t, r) {
          try {
            return !0 === this._checkIfNeedToExpandCandidatePage(e, this._maxQuery)
              ? this._expandPagedSet(e, this._maxQuery, 0, 0, r).then(() =>
                  this._refineSetBlock(e, t, r),
                )
              : (this._checkCancelled(r),
                e._candidates.length,
                this._refineKnowns(e, t),
                e._candidates.length,
                e._candidates.length,
                (0, n.DB)(e));
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _expandPagedSet(e, t, r, i, s) {
          return this._expandPagedSetFeatureSet(e, t, r, i, s);
        }
        _getPhysicalPage(e, t, r) {
          return !0 === e.pagesDefinition.aggregatefeaturesetpagedefinition
            ? (0, n.Ue)((t, i) => {
                this._sequentialGetPhysicalItem(e, e.pagesDefinition.resultRecordCount, r, []).then(
                  (e) => {
                    t(e);
                  },
                  i,
                );
              })
            : this._getAgregagtePhysicalPage(e, t, r).then((e) => {
                for (const t of e) {
                  const e = { geometry: t.geometry, attributes: {} };
                  for (const r of this._decodedGroupbyfield)
                    e.attributes[r.tofieldname] = t.attributes[r.name];
                  for (const r of this._decodedStatsfield)
                    e.attributes[r.tofieldname] = t.attributes[r.field];
                  this._featureCache[e.attributes[this.objectIdField]] = new d.Z(e);
                }
                return e.length;
              });
        }
        _sequentialGetPhysicalItem(e, t, r, i) {
          return (0, n.Ue)((s, n) => {
            null === e.pagesDefinition.internal.iterator &&
              (e.pagesDefinition.internal.iterator = e.pagesDefinition.internal.subfeatureset.iterator(
                r,
              )),
              !0 === e.pagesDefinition.internal.fullyResolved || 0 === t
                ? s(i.length)
                : this._nextAggregateItem(
                    e,
                    t,
                    r,
                    i,
                    (n) => {
                      null === n
                        ? s(i.length)
                        : ((t -= 1), s(this._sequentialGetPhysicalItem(e, t, r, i)));
                    },
                    n,
                  );
          });
        }
        _nextAggregateItem(e, t, r, i, s, n) {
          try {
            (0, l.a4)(e.pagesDefinition.internal.iterator.next()).then((a) => {
              if (null === a)
                if (null !== e.pagesDefinition.internal.workingItem) {
                  const t = this._calculateAndAppendAggregateItem(
                    e.pagesDefinition.internal.workingItem,
                  );
                  i.push(t),
                    (e.pagesDefinition.internal.workingItem = null),
                    e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),
                    (e.pagesDefinition.internal.fullyResolved = !0),
                    s(null);
                } else (e.pagesDefinition.internal.fullyResolved = !0), s(null);
              else {
                const l = this._generateAggregateHash(a);
                if (null === e.pagesDefinition.internal.workingItem)
                  e.pagesDefinition.internal.workingItem = { features: [a], id: l };
                else {
                  if (l !== e.pagesDefinition.internal.workingItem.id) {
                    const r = this._calculateAndAppendAggregateItem(
                      e.pagesDefinition.internal.workingItem,
                    );
                    return (
                      i.push(r),
                      (e.pagesDefinition.internal.workingItem = null),
                      e.pagesDefinition.internal.set.push(r.attributes[this.objectIdField]),
                      (t -= 1),
                      (e.pagesDefinition.internal.workingItem = { features: [a], id: l }),
                      void s(r)
                    );
                  }
                  e.pagesDefinition.internal.workingItem.features.push(a);
                }
                this._nextAggregateItem(e, t, r, i, s, n);
              }
            }, n);
          } catch (e) {
            n(e);
          }
        }
        _calculateFieldStat(e, t, r) {
          const i = [];
          for (let r = 0; r < e.features.length; r++)
            if (null !== t.workingexpr) {
              const s = t.workingexpr.calculateValue(e.features[r]);
              null !== s && i.push(s);
            } else i.push(null);
          switch (t.typeofstat) {
            case 'MIN':
              r.attributes[t.tofieldname] = (0, a.f)('min', i, -1);
              break;
            case 'MAX':
              r.attributes[t.tofieldname] = (0, a.f)('max', i, -1);
              break;
            case 'SUM':
              r.attributes[t.tofieldname] = (0, a.f)('sum', i, -1);
              break;
            case 'COUNT':
              r.attributes[t.tofieldname] = i.length;
              break;
            case 'VAR':
              r.attributes[t.tofieldname] = (0, a.f)('var', i, -1);
              break;
            case 'STDDEV':
              r.attributes[t.tofieldname] = (0, a.f)('stddev', i, -1);
              break;
            case 'AVG':
              r.attributes[t.tofieldname] = (0, a.f)('avg', i, -1);
          }
          return !0;
        }
        _calculateAndAppendAggregateItem(e) {
          const t = { attributes: {}, geometry: null };
          for (const r of this._decodedGroupbyfield) {
            const i = r.singlefield
              ? e.features[0].attributes[r.singlefield]
              : r.expression.calculateValue(e.features[0]);
            t.attributes[r.tofieldname] = i;
          }
          for (const r of this._decodedStatsfield) this._calculateFieldStat(e, r, t);
          const r = [];
          for (let i = 0; i < this._decodedStatsfield.length; i++)
            r.push(this._calculateFieldStat(e, this._decodedStatsfield[i], t));
          return (
            (this._featureCache[t.attributes[this.objectIdField]] = new d.Z({
              attributes: t.attributes,
              geometry: t.geometry,
            })),
            t
          );
        }
        _generateAggregateHash(e) {
          let t = '';
          for (const r of this._decodedGroupbyfield) {
            const i = r.singlefield ? e.attributes[r.singlefield] : r.expression.calculateValue(e);
            t += null == i ? ':' : ':' + i.toString();
          }
          return (0, h.c)(t, h.o.String);
        }
        _stat() {
          return (0, n.DB)({ calculated: !1 });
        }
        getFeatureByObjectId() {
          return (0, n.DB)(null);
        }
        static registerAction() {
          a.F._featuresetFunctions.groupby = function (e, t) {
            return new U({ parentfeatureset: this, groupbyfields: e, statsfields: t });
          };
        }
      }
      class V extends a.F {
        constructor(e) {
          super(e),
            (this._topnum = 0),
            (this.declaredClass = 'esri.arcade.featureset.actions.Top'),
            (this._countedin = 0),
            (this._maxProcessing = 100),
            (this._topnum = e.topnum),
            (this._parent = e.parentfeatureset);
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() => this._parent._getSet(e))
                .then(
                  (e) => (
                    (this._wset = new a.I(
                      e._candidates.slice(0),
                      e._known.slice(0),
                      !1,
                      this._clonePageDefinition(e.pagesDefinition),
                    )),
                    this._setKnownLength(this._wset) > this._topnum &&
                      (this._wset._known = this._wset._known.slice(0, this._topnum)),
                    this._setKnownLength(this._wset) >= this._topnum &&
                      (this._wset._candidates = []),
                    this._wset
                  ),
                )
            : (0, n.DB)(this._wset);
        }
        _setKnownLength(e) {
          return e._known.length > 0 && 'GETPAGES' === e._known[e._known.length - 1]
            ? e._known.length - 1
            : e._known.length;
        }
        _isInFeatureSet(e) {
          const t = this._parent._isInFeatureSet(e);
          if (t === l.a1.NotInFeatureSet) return t;
          const r = this._idstates[e];
          return r === l.a1.InFeatureSet || r === l.a1.NotInFeatureSet
            ? r
            : t === l.a1.InFeatureSet && void 0 === r
            ? this._countedin < this._topnum
              ? ((this._idstates[e] = l.a1.InFeatureSet), this._countedin++, l.a1.InFeatureSet)
              : ((this._idstates[e] = l.a1.NotInFeatureSet), l.a1.NotInFeatureSet)
            : l.a1.Unknown;
        }
        _expandPagedSet(e, t, r, i, s) {
          if (null === this._parent) return (0, n.d1)(new Error('Parent Paging not implemented'));
          if (
            (t > this._topnum && (t = this._topnum),
            this._countedin >= this._topnum &&
              e.pagesDefinition.internal.set.length <= e.pagesDefinition.resultOffset)
          ) {
            let t = e._known.length;
            return (
              t > 0 && 'GETPAGES' === e._known[t - 1] && (e._known.length = t - 1),
              (t = e._candidates.length),
              t > 0 && 'GETPAGES' === e._candidates[t - 1] && (e._candidates.length = t - 1),
              (0, n.DB)('success')
            );
          }
          return this._parent
            ._expandPagedSet(e, t, r, i, s)
            .then(
              (t) => (
                this._setKnownLength(e) > this._topnum && (e._known.length = this._topnum),
                this._setKnownLength(e) >= this._topnum && (e._candidates.length = 0),
                t
              ),
            );
        }
        _getFeatures(e, t, r, i) {
          const s = [],
            l = this._maxQueryRate();
          if (!0 === this._checkIfNeedToExpandKnownPage(e, l))
            return this._expandPagedSet(e, l, 0, 0, i).then(() => this._getFeatures(e, t, r, i));
          -1 !== t && void 0 === this._featureCache[t] && s.push(t);
          let o = 0;
          for (
            let i = e._lastFetchedIndex;
            i < e._known.length &&
            (o++,
            o <= r && (e._lastFetchedIndex += 1),
            !(
              void 0 === this._featureCache[e._known[i]] &&
              (e._known[i] !== t && s.push(e._known[i]), s.length > l)
            ));
            i++
          );
          if (0 === s.length) return (0, n.DB)('success');
          const u = new a.I([], s, !1, null),
            d = Math.min(s.length, r);
          return this._parent._getFeatures(u, -1, d, i).then(() => {
            for (let e = 0; e < d; e++) {
              const t = this._parent._featureFromCache(s[e]);
              void 0 !== t && (this._featureCache[s[e]] = t);
            }
            return 'success';
          });
        }
        _getFilteredSet(e, t, r, i, s) {
          return this._ensureLoaded()
            .then(() => this._getSet(s))
            .then(
              (e) =>
                new a.I(
                  e._candidates.slice(0).concat(e._known.slice(0)),
                  [],
                  !1,
                  this._clonePageDefinition(e.pagesDefinition),
                ),
            );
        }
        _refineKnowns(e, t) {
          let r = 0,
            i = null;
          const s = [];
          for (let n = 0; n < e._candidates.length; n++) {
            const a = this._isInFeatureSet(e._candidates[n]);
            if (a === l.a1.InFeatureSet) {
              if (
                (e._known.push(e._candidates[n]),
                (r += 1),
                null === i
                  ? (i = { start: n, end: n })
                  : i.end === n - 1
                  ? (i.end = n)
                  : (s.push(i), (i = { start: n, end: n })),
                e._known.length >= this._topnum)
              )
                break;
            } else if (a === l.a1.NotInFeatureSet)
              null === i
                ? (i = { start: n, end: n })
                : i.end === n - 1
                ? (i.end = n)
                : (s.push(i), (i = { start: n, end: n })),
                (r += 1);
            else if (a === l.a1.Unknown) break;
            if (r >= t) break;
          }
          null !== i && s.push(i);
          for (let t = s.length - 1; t >= 0; t--)
            e._candidates.splice(s[t].start, s[t].end - s[t].start + 1);
          this._setKnownLength(e) > this._topnum && (e._known = e._known.slice(0, this._topnum)),
            this._setKnownLength(e) >= this._topnum && (e._candidates = []);
        }
        _stat() {
          return (0, n.DB)({ calculated: !1 });
        }
        _canDoAggregates() {
          return (0, n.DB)(!1);
        }
        static registerAction() {
          a.F._featuresetFunctions.top = function (e) {
            return new V({ parentfeatureset: this, topnum: e });
          };
        }
      }
      class M extends a.F {
        constructor(e) {
          super(e),
            (this.declaredClass = 'esri.arcade.featureset.sources.FeatureLayerDynamic'),
            (this._removeGeometry = !1),
            (this._overrideFields = null),
            (this.formulaCredential = null),
            (this._pageJustIds = !1),
            (this._requestStandardised = !1),
            e.spatialReference && (this.spatialReference = e.spatialReference),
            (this._transparent = !0),
            (this._maxProcessing = 1e3),
            (this._layer = e.layer),
            (this._wset = null),
            void 0 !== e.outFields && (this._overrideFields = e.outFields),
            void 0 !== e.includeGeometry && (this._removeGeometry = !1 === e.includeGeometry);
        }
        _maxQueryRate() {
          return l.a5;
        }
        end() {
          return this._layer;
        }
        optimisePagingFeatureQueries(e) {
          this._pageJustIds = e;
        }
        convertQueryToLruCacheKey(e) {
          const t = (0, l.a6)(e.toJSON());
          return (0, h.c)(t, h.o.String);
        }
        load() {
          return (
            null === this._loadPromise &&
              (this._loadPromise = (0, n.Ue)((e, t) => {
                try {
                  if (!0 === this._layer.loaded) return this._initialiseFeatureSet(), void e(this);
                  this._layer.when().then(() => {
                    try {
                      this._initialiseFeatureSet(), e(this);
                    } catch (e) {
                      t(e);
                    }
                  }, t),
                    this._layer.load();
                } catch (e) {
                  t(e);
                }
              })),
            this._loadPromise
          );
        }
        _initialiseFeatureSet() {
          if (
            (null == this.spatialReference &&
              (this.spatialReference = this._layer.spatialReference),
            (this.geometryType = this._layer.geometryType),
            (this.fields = this._layer.fields.slice(0)),
            this._layer.outFields)
          )
            if (1 === this._layer.outFields.length && '*' === this._layer.outFields[0]);
            else {
              const e = [];
              for (const t of this.fields)
                if ('oid' === t.type) e.push(t);
                else
                  for (const r of this._layer.outFields)
                    if (r.toLowerCase() === t.name.toLowerCase()) {
                      e.push(t);
                      break;
                    }
              this.fields = e;
            }
          if (null !== this._overrideFields)
            if (1 === this._overrideFields.length && '*' === this._overrideFields[0])
              this._overrideFields = null;
            else {
              const e = [],
                t = [];
              for (const r of this.fields)
                if ('oid' === r.type) e.push(r), t.push(r.name);
                else
                  for (const i of this._overrideFields)
                    if (i.toLowerCase() === r.name.toLowerCase()) {
                      e.push(r), t.push(r.name);
                      break;
                    }
              (this.fields = e), (this._overrideFields = t);
            }
          if (this._layer.source && this._layer.source.sourceJSON) {
            const e = this._layer.source.sourceJSON.currentVersion;
            !0 === this._layer.source.sourceJSON.useStandardizedQueries
              ? ((this._databaseType = l.a3.StandardisedNoInterval),
                null != e && e >= 10.61 && (this._databaseType = l.a3.Standardised))
              : null != e &&
                (e >= 10.5 &&
                  ((this._databaseType = l.a3.StandardisedNoInterval),
                  (this._requestStandardised = !0)),
                e >= 10.61 && (this._databaseType = l.a3.Standardised));
          }
          this.objectIdField = this._layer.objectIdField;
          for (const e of this.fields) 'global-id' === e.type && (this.globalIdField = e.name);
          (this.hasM = this._layer.supportsM),
            (this.hasZ = this._layer.supportsZ),
            (this.typeIdField = this._layer.typeIdField),
            (this.types = this._layer.types);
        }
        _isInFeatureSet() {
          return l.a1.InFeatureSet;
        }
        _refineSetBlock(e) {
          return (0, n.DB)(e);
        }
        _candidateIdTransform(e) {
          return e;
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() => this._getFilteredSet('', null, null, null, e))
                .then((e) => ((this._wset = e), e))
            : (0, n.DB)(this._wset);
        }
        _runDatabaseProbe(e) {
          return (0, n.Ue)((t, r) => {
            try {
              this._ensureLoaded().then(() => {
                try {
                  const i = new w.Z();
                  (i.where = e.replace('OBJECTID', this._layer.objectIdField)),
                    this._layer.queryObjectIds(i).then(
                      () => {
                        t(!0);
                      },
                      () => {
                        try {
                          t(!1);
                        } catch (e) {
                          r(e);
                        }
                      },
                    );
                } catch (e) {
                  r(e);
                }
              });
            } catch (e) {
              r(e);
            }
          });
        }
        _canUsePagination() {
          return !(
            !this._layer.capabilities ||
            !this._layer.capabilities.query ||
            !0 !== this._layer.capabilities.query.supportsPagination
          );
        }
        _cacheableFeatureSetSourceKey() {
          return this._layer.url;
        }
        pbfSupportedForQuery(e) {
          return (
            !e.outStatistics &&
            this._layer &&
            this._layer.capabilities &&
            this._layer.capabilities.query &&
            !0 === this._layer.capabilities.query.supportsFormatPBF &&
            !0 === this._layer.capabilities.query.supportsQuantizationEditMode
          );
        }
        queryPBF(e) {
          return (
            (e.quantizationParameters = { mode: 'edit' }),
            (0, F.d)(this._layer.parsedUrl, e, new g.O({})).then((e) =>
              m.default.fromJSON((0, _.a)(e.data)).unquantize(),
            )
          );
        }
        get gdbVersion() {
          return this._layer &&
            this._layer.capabilities &&
            this._layer.capabilities.data &&
            this._layer.capabilities.data.isVersioned
            ? this._layer.gdbVersion
              ? this._layer.gdbVersion
              : 'SDE.DEFAULT'
            : '';
        }
        nativeCapabilities() {
          return {
            title: this._layer.title,
            source: this,
            canQueryRelated: !0,
            capabilities: this._layer.capabilities,
            databaseType: this._databaseType,
            requestStandardised: this._requestStandardised,
          };
        }
        executeQuery(e, t) {
          const r = new S.Z({ url: this._layer.parsedUrl.path }),
            i = 'execute' === t && this.pbfSupportedForQuery(e);
          let s = null;
          if (this.recentlyUsedQueries) {
            const n = this.convertQueryToLruCacheKey(e);
            (s = this.recentlyUsedQueries.getFromCache(n)),
              null === s &&
                ((s = !0 !== i ? r[t](e) : this.queryPBF(e)),
                this.recentlyUsedQueries.addToCache(n, s),
                (s = s.catch((e) => {
                  throw (this.recentlyUsedQueries.removeFromCache(n), e);
                })));
          }
          return (
            this.featureSetQueryInterceptor &&
              this.featureSetQueryInterceptor.preLayerQueryCallback({
                layer: this._layer,
                query: e,
                method: t,
              }),
            null === s && (s = !0 !== i ? r[t](e) : this.queryPBF(e)),
            s
          );
        }
        _getFilteredSet(e, t, r, i, s) {
          return this.databaseType().then((n) => {
            if (this.isTable() && t && null !== e && '' !== e) return new a.I([], [], !0, null);
            if (this._canUsePagination()) return this._getFilteredSetUsingPaging(e, t, r, i, s);
            let l = '',
              o = !1;
            null !== i &&
              this._layer.capabilities &&
              this._layer.capabilities.query &&
              !0 === this._layer.capabilities.query.supportsOrderBy &&
              ((l = i.constructClause()), (o = !0));
            const u = new w.Z();
            return (
              (u.where = null === r ? (null === t ? '1=1' : '') : (0, a.t)(r, n)),
              this._requestStandardised && (u.sqlFormat = 'standard'),
              (u.spatialRelationship = this._makeRelationshipEnum(e)),
              (u.outSpatialReference = this.spatialReference),
              (u.orderByFields = '' !== l ? l.split(',') : null),
              (u.geometry = null === t ? null : t),
              (u.relationParameter = this._makeRelationshipParam(e)),
              this.executeQuery(u, 'executeForIds').then(
                (e) => (null === e && (e = []), this._checkCancelled(s), new a.I([], e, o, null)),
              )
            );
          });
        }
        _expandPagedSet(e, t, r, i, s) {
          return this._expandPagedSetFeatureSet(e, t, r, i, s);
        }
        _getFilteredSetUsingPaging(e, t, r, i, s) {
          try {
            let n = '',
              l = !1;
            return (
              null !== i &&
                this._layer.capabilities &&
                this._layer.capabilities.query &&
                !0 === this._layer.capabilities.query.supportsOrderBy &&
                ((n = i.constructClause()), (l = !0)),
              this.databaseType().then((i) => {
                let o = null === r ? (null === t ? '1=1' : '') : (0, a.t)(r, i);
                this._layer.definitionExpression &&
                  (o =
                    '' !== o
                      ? '((' + this._layer.definitionExpression + ') AND (' + o + '))'
                      : this._layer.definitionExpression);
                let u = this._maxQueryRate();
                const d = this._layer.capabilities.query.maxRecordCount;
                void 0 !== d && d < u && (u = d);
                let h = null;
                if (!0 === this._pageJustIds)
                  h = new a.I([], ['GETPAGES'], l, {
                    spatialRel: this._makeRelationshipEnum(e),
                    relationParam: this._makeRelationshipParam(e),
                    outFields: this._layer.objectIdField,
                    resultRecordCount: u,
                    resultOffset: 0,
                    geometry: null === t ? null : t,
                    where: o,
                    orderByFields: n,
                    returnGeometry: !1,
                    returnIdsOnly: 'false',
                    internal: { set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: !1 },
                  });
                else {
                  let r = !0;
                  !0 === this._removeGeometry && (r = !1);
                  const i =
                    null !== this._overrideFields
                      ? this._overrideFields
                      : this._fieldsIncludingObjectId(
                          this._layer.outFields ? this._layer.outFields : ['*'],
                        );
                  h = new a.I([], ['GETPAGES'], l, {
                    spatialRel: this._makeRelationshipEnum(e),
                    relationParam: this._makeRelationshipParam(e),
                    outFields: i.join(','),
                    resultRecordCount: u,
                    resultOffset: 0,
                    geometry: null === t ? null : t,
                    where: o,
                    orderByFields: n,
                    returnGeometry: r,
                    returnIdsOnly: 'false',
                    internal: { set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: !1 },
                  });
                }
                return this._expandPagedSet(h, u, 0, 1, s).then(() => h);
              })
            );
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _clonePageDefinition(e) {
          return null === e
            ? null
            : !0 !== e.groupbypage
            ? {
                groupbypage: !1,
                spatialRel: e.spatialRel,
                relationParam: e.relationParam,
                outFields: e.outFields,
                resultRecordCount: e.resultRecordCount,
                resultOffset: e.resultOffset,
                geometry: e.geometry,
                where: e.where,
                orderByFields: e.orderByFields,
                returnGeometry: e.returnGeometry,
                returnIdsOnly: e.returnIdsOnly,
                internal: e.internal,
              }
            : {
                groupbypage: !0,
                spatialRel: e.spatialRel,
                relationParam: e.relationParam,
                outFields: e.outFields,
                resultRecordCount: e.resultRecordCount,
                useOIDpagination: e.useOIDpagination,
                generatedOid: e.generatedOid,
                groupByFieldsForStatistics: e.groupByFieldsForStatistics,
                resultOffset: e.resultOffset,
                outStatistics: e.outStatistics,
                geometry: e.geometry,
                where: e.where,
                orderByFields: e.orderByFields,
                returnGeometry: e.returnGeometry,
                returnIdsOnly: e.returnIdsOnly,
                internal: e.internal,
              };
        }
        _getPhysicalPage(e, t, r) {
          try {
            const t = e.pagesDefinition.internal.lastRetrieved,
              i = t,
              s = e.pagesDefinition.internal.lastPage,
              n = new w.Z();
            return (
              this._requestStandardised && (n.sqlFormat = 'standard'),
              (n.spatialRelationship = e.pagesDefinition.spatialRel),
              (n.relationParameter = e.pagesDefinition.relationParam),
              (n.outFields = e.pagesDefinition.outFields.split(',')),
              (n.num = e.pagesDefinition.resultRecordCount),
              (n.start = e.pagesDefinition.internal.lastPage),
              (n.geometry = e.pagesDefinition.geometry),
              (n.where = e.pagesDefinition.where),
              (n.orderByFields =
                '' !== e.pagesDefinition.orderByFields
                  ? e.pagesDefinition.orderByFields.split(',')
                  : null),
              (n.returnGeometry = e.pagesDefinition.returnGeometry),
              (n.outSpatialReference = this.spatialReference),
              this.executeQuery(n, 'execute').then((n) => {
                if ((this._checkCancelled(r), e.pagesDefinition.internal.lastPage !== s))
                  return 'done';
                for (let t = 0; t < n.features.length; t++)
                  e.pagesDefinition.internal.set[i + t] =
                    n.features[t].attributes[this._layer.objectIdField];
                if (!1 === this._pageJustIds)
                  for (let e = 0; e < n.features.length; e++)
                    this._featureCache[n.features[e].attributes[this._layer.objectIdField]] =
                      n.features[e];
                return (
                  ((void 0 === n.exceededTransferLimit &&
                    n.features.length !== e.pagesDefinition.resultRecordCount) ||
                    !1 === n.exceededTransferLimit) &&
                    (e.pagesDefinition.internal.fullyResolved = !0),
                  (e.pagesDefinition.internal.lastRetrieved = t + n.features.length),
                  (e.pagesDefinition.internal.lastPage += e.pagesDefinition.resultRecordCount),
                  'done'
                );
              })
            );
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _fieldsIncludingObjectId(e) {
          if (null === e) return [this.objectIdField];
          const t = e.slice(0);
          if (t.indexOf('*') > -1) return t;
          let r = !1;
          for (const e of t)
            if (e.toUpperCase() === this.objectIdField.toUpperCase()) {
              r = !0;
              break;
            }
          return !1 === r && t.push(this.objectIdField), t;
        }
        _getFeatures(e, t, r, i) {
          const s = [];
          try {
            if (
              (-1 !== t && void 0 === this._featureCache[t] && s.push(t),
              !0 === this._checkIfNeedToExpandKnownPage(e, this._maxProcessingRate()))
            )
              return this._expandPagedSet(e, this._maxProcessingRate(), 0, 0, i).then(() =>
                this._getFeatures(e, t, r, i),
              );
            let a = 0;
            for (let i = e._lastFetchedIndex; i < e._known.length; i++) {
              if (((e._lastFetchedIndex += 1), a++, void 0 === this._featureCache[e._known[i]])) {
                let r = !1;
                if (null !== this._layer._mode && void 0 !== this._layer._mode) {
                  const t = this._layer._mode;
                  if (void 0 !== t._featureMap[e._known[i]]) {
                    const s = t._featureMap[e._known[i]];
                    null !== s && ((r = !0), (this._featureCache[e._known[i]] = s));
                  }
                }
                if (
                  !1 === r &&
                  (e._known[i] !== t && s.push(e._known[i]),
                  s.length >= this._maxProcessingRate() - 1)
                )
                  break;
              }
              if (a >= r && 0 === s.length) break;
            }
            if (0 === s.length) return (0, n.DB)('success');
            try {
              const e = new w.Z();
              return (
                this._requestStandardised && (e.sqlFormat = 'standard'),
                (e.objectIds = s),
                (e.outFields =
                  null !== this._overrideFields
                    ? this._overrideFields
                    : this._fieldsIncludingObjectId(
                        this._layer.outFields ? this._layer.outFields : ['*'],
                      )),
                (e.returnGeometry = !0),
                !0 === this._removeGeometry && (e.returnGeometry = !1),
                (e.outSpatialReference = this.spatialReference),
                this.executeQuery(e, 'execute').then((e) => {
                  if ((this._checkCancelled(i), void 0 !== e.error))
                    return (0, n.d1)(new Error(e.error));
                  for (let t = 0; t < e.features.length; t++)
                    this._featureCache[e.features[t].attributes[this._layer.objectIdField]] =
                      e.features[t];
                  return 'success';
                })
              );
            } catch (e) {
              return (0, n.d1)(e);
            }
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _getDistinctPages(e, t, r, i, s, l, o, u, d) {
          return this._ensureLoaded()
            .then(() => this.databaseType())
            .then((h) => {
              let c = r.parseTree.column;
              for (let e = 0; e < this._layer.fields.length; e++)
                if (this._layer.fields[e].name.toLowerCase() === c.toLowerCase()) {
                  c = this._layer.fields[e].name;
                  break;
                }
              const p = new w.Z();
              this._requestStandardised && (p.sqlFormat = 'standard');
              let f = null === l ? (null === s ? '1=1' : '') : (0, a.t)(l, h);
              return (
                this._layer.definitionExpression &&
                  (f =
                    '' !== f
                      ? '((' + this._layer.definitionExpression + ') AND (' + f + '))'
                      : this._layer.definitionExpression),
                (p.where = f),
                (p.spatialRelationship = this._makeRelationshipEnum(i)),
                (p.relationParameter = this._makeRelationshipParam(i)),
                (p.geometry = null === s ? null : s),
                (p.returnDistinctValues = !0),
                (p.returnGeometry = !1),
                (p.outFields = [c]),
                this.executeQuery(p, 'execute').then((a) => {
                  if ((this._checkCancelled(d), !a.hasOwnProperty('features')))
                    return (0, n.d1)(new Error('Unnexected Result querying statistics from layer'));
                  let h = !1;
                  for (let e = 0; e < this._layer.fields.length; e++)
                    if (this._layer.fields[e].name === c) {
                      'date' === this._layer.fields[e].type && (h = !0);
                      break;
                    }
                  for (let e = 0; e < a.features.length; e++) {
                    if (h) {
                      const t = a.features[e].attributes[c];
                      null !== t ? u.push(new Date(t)) : u.push(t);
                    } else u.push(a.features[e].attributes[c]);
                    if (u.length >= o) break;
                  }
                  return 0 === a.features.length
                    ? u
                    : a.features.length === this._layer.capabilities.query.maxRecordCount &&
                      u.length < o
                    ? this._getDistinctPages(
                        e + a.features.length,
                        t,
                        r,
                        i,
                        s,
                        l,
                        o,
                        u,
                        d,
                      ).then((e) => ({ calculated: !0, result: e }))
                    : u;
                })
              );
            });
        }
        _distinctStat(e, t, r, i, s, n, a) {
          return this._getDistinctPages(0, e, t, r, i, s, n, [], a).then((e) => ({
            calculated: !0,
            result: e,
          }));
        }
        isTable() {
          return (
            this._layer.isTable ||
            null === this._layer.geometryType ||
            'table' === this._layer.type ||
            '' === this._layer.geometryType
          );
        }
        _countstat(e, t, r, i) {
          return this.databaseType().then((e) => {
            const s = new w.Z();
            if (
              (this._requestStandardised && (s.sqlFormat = 'standard'),
              this.isTable() && r && null !== t && '' !== t)
            )
              return { calculated: !0, result: 0 };
            let n = null === i ? (null === r ? '1=1' : '') : (0, a.t)(i, e);
            return (
              this._layer.definitionExpression &&
                (n =
                  '' !== n
                    ? '((' + this._layer.definitionExpression + ') AND (' + n + '))'
                    : this._layer.definitionExpression),
              (s.where = n),
              (s.where = n),
              (s.spatialRelationship = this._makeRelationshipEnum(t)),
              (s.relationParameter = this._makeRelationshipParam(t)),
              (s.geometry = null === r ? null : r),
              (s.returnGeometry = !1),
              this.executeQuery(s, 'executeForCount').then((e) => ({ calculated: !0, result: e }))
            );
          });
        }
        _stats(e, t, r, i, s, l, o) {
          return this._ensureLoaded().then(() => {
            const u =
                this._layer.capabilities &&
                this._layer.capabilities.query &&
                !0 === this._layer.capabilities.query.supportsSqlExpression,
              d =
                this._layer.capabilities &&
                this._layer.capabilities.query &&
                !0 === this._layer.capabilities.query.supportsStatistics,
              h =
                this._layer.capabilities &&
                this._layer.capabilities.query &&
                !0 === this._layer.capabilities.query.supportsDistinct;
            return 'count' === e
              ? h
                ? this._countstat(e, r, i, s)
                : { calculated: !1 }
              : !1 === d || (!1 === (0, a.i)(t) && !1 === u) || !1 === t.isStandardized
              ? '' !== r || null !== s
                ? { calculated: !1 }
                : this._manualStat(e, t, l, o)
              : 'distinct' === e
              ? !1 === h
                ? '' !== r || null !== s
                  ? { calculated: !1 }
                  : this._manualStat(e, t, l, o)
                : this._distinctStat(e, t, r, i, s, l, o)
              : this.databaseType().then((l) => {
                  if (this.isTable() && i && null !== r && '' !== r)
                    return { calculated: !0, result: null };
                  const o = new w.Z();
                  this._requestStandardised && (o.sqlFormat = 'standard');
                  let u = null === s ? (null === i ? '1=1' : '') : (0, a.t)(s, l);
                  this._layer.definitionExpression &&
                    (u =
                      '' !== u
                        ? '((' + this._layer.definitionExpression + ') AND (' + u + '))'
                        : this._layer.definitionExpression),
                    (o.where = u),
                    (o.spatialRelationship = this._makeRelationshipEnum(r)),
                    (o.relationParameter = this._makeRelationshipParam(r)),
                    (o.geometry = null === i ? null : i);
                  const d = new b.Z();
                  (d.statisticType = (0, a.g)(e)),
                    (d.onStatisticField = (0, a.t)(t, l)),
                    (d.outStatisticFieldName = 'ARCADE_STAT_RESULT'),
                    (o.returnGeometry = !1);
                  let h = 'ARCADE_STAT_RESULT';
                  return (
                    (o.outStatistics = [d]),
                    this.executeQuery(o, 'execute').then((e) => {
                      if (!e.hasOwnProperty('features') || 0 === e.features.length)
                        return (0, n.d1)(
                          new Error('Unnexected Result querying statistics from layer'),
                        );
                      let t = !1;
                      for (let r = 0; r < e.fields.length; r++)
                        if ('ARCADE_STAT_RESULT' === e.fields[r].name.toUpperCase()) {
                          (h = e.fields[r].name), 'date' === e.fields[r].type && (t = !0);
                          break;
                        }
                      if (t) {
                        let t = e.features[0].attributes[h];
                        return (
                          null !== t && (t = new Date(e.features[0].attributes[h])),
                          { calculated: !0, result: t }
                        );
                      }
                      return { calculated: !0, result: e.features[0].attributes[h] };
                    })
                  );
                });
          });
        }
        _stat(e, t, r, i, s, n, a) {
          return this._stats(e, t, r, i, s, n, a);
        }
        _canDoAggregates(e, t) {
          return this._ensureLoaded().then(() => {
            let e = !1;
            const r =
              this._layer.capabilities &&
              this._layer.capabilities.query &&
              !0 === this._layer.capabilities.query.supportsSqlExpression;
            if (
              (void 0 !== this._layer.capabilities &&
                null !== this._layer.capabilities.query &&
                !0 === this._layer.capabilities.query.supportsStatistics &&
                !0 === this._layer.capabilities.query.supportsOrderBy &&
                (e = !0),
              e)
            )
              for (let i = 0; i < t.length - 1; i++)
                null !== t[i].workingexpr &&
                  (!1 === t[i].workingexpr.isStandardized ||
                    (!1 === (0, a.i)(t[i].workingexpr) && !1 === r)) &&
                  (e = !1);
            return !1 !== e;
          });
        }
        _makeRelationshipEnum(e) {
          if (e.indexOf('esriSpatialRelRelation') >= 0) return 'relation';
          switch (e) {
            case 'esriSpatialRelRelation':
              return 'relation';
            case 'esriSpatialRelIntersects':
              return 'intersects';
            case 'esriSpatialRelContains':
              return 'contains';
            case 'esriSpatialRelOverlaps':
              return 'overlaps';
            case 'esriSpatialRelWithin':
              return 'within';
            case 'esriSpatialRelTouches':
              return 'touches';
            case 'esriSpatialRelCrosses':
              return 'crosses';
            case 'esriSpatialRelEnvelopeIntersects':
              return 'envelope-intersects';
          }
          return e;
        }
        _makeRelationshipParam(e) {
          return e.indexOf('esriSpatialRelRelation') >= 0 ? e.split(':')[1] : '';
        }
        _getAggregatePagesDataSourceDefinition(e, t, r, i, s, n, l) {
          return this._ensureLoaded()
            .then(() => this.databaseType())
            .then((o) => {
              let u = '',
                d = !1,
                h = !1;
              null !== n &&
                this._layer.capabilities &&
                this._layer.capabilities.query &&
                !0 === this._layer.capabilities.query.supportsOrderBy &&
                ((u = n.constructClause()), (h = !0)),
                this._layer.capabilities &&
                  this._layer.capabilities.query &&
                  !1 === this._layer.capabilities.query.supportsPagination &&
                  ((h = !1), (d = !0), (u = this._layer.objectIdField));
              const c = [];
              for (let e = 0; e < t.length; e++) {
                const r = new b.Z();
                (r.onStatisticField =
                  null !== t[e].workingexpr ? (0, a.t)(t[e].workingexpr, o) : ''),
                  (r.outStatisticFieldName = t[e].field),
                  (r.statisticType = t[e].toStatisticsName()),
                  c.push(r);
              }
              '' === u && (u = e.join(','));
              let p = this._maxQueryRate();
              const f = this._layer.capabilities.query.maxRecordCount;
              void 0 !== f && f < p && (p = f);
              let y = null === s ? (null === i ? '1=1' : '') : (0, a.t)(s, o);
              return (
                this._layer.definitionExpression &&
                  (y =
                    '' !== y
                      ? '((' + this._layer.definitionExpression + ') AND (' + y + '))'
                      : this._layer.definitionExpression),
                new a.I([], ['GETPAGES'], h, {
                  groupbypage: !0,
                  spatialRel: this._makeRelationshipEnum(r),
                  relationParam: this._makeRelationshipParam(r),
                  outFields: ['*'],
                  useOIDpagination: d,
                  generatedOid: l,
                  resultRecordCount: p,
                  resultOffset: 0,
                  groupByFieldsForStatistics: e,
                  outStatistics: c,
                  geometry: null === i ? null : i,
                  where: y,
                  orderByFields: u,
                  returnGeometry: !1,
                  returnIdsOnly: !1,
                  internal: {
                    lastMaxId: -1,
                    set: [],
                    lastRetrieved: 0,
                    lastPage: 0,
                    fullyResolved: !1,
                  },
                })
              );
            });
        }
        _getAgregagtePhysicalPage(e, t, r) {
          try {
            let t = e.pagesDefinition.where;
            !0 === e.pagesDefinition.useOIDpagination &&
              (t =
                '' !== t
                  ? '(' +
                    t +
                    ') AND (' +
                    e.pagesDefinition.generatedOid +
                    '>' +
                    e.pagesDefinition.internal.lastMaxId.toString() +
                    ')'
                  : e.pagesDefinition.generatedOid +
                    '>' +
                    e.pagesDefinition.internal.lastMaxId.toString());
            const i = e.pagesDefinition.internal.lastRetrieved,
              s = i,
              a = e.pagesDefinition.internal.lastPage,
              l = new w.Z();
            return (
              this._requestStandardised && (l.sqlFormat = 'standard'),
              (l.where = t),
              (l.spatialRelationship = e.pagesDefinition.spatialRel),
              (l.relationParameter = e.pagesDefinition.relationParam),
              (l.outFields = e.pagesDefinition.outFields),
              (l.outStatistics = e.pagesDefinition.outStatistics),
              (l.geometry = e.pagesDefinition.geometry),
              (l.groupByFieldsForStatistics = e.pagesDefinition.groupByFieldsForStatistics),
              (l.num = e.pagesDefinition.resultRecordCount),
              (l.start = e.pagesDefinition.internal.lastPage),
              (l.returnGeometry = e.pagesDefinition.returnGeometry),
              (l.orderByFields =
                '' !== e.pagesDefinition.orderByFields
                  ? e.pagesDefinition.orderByFields.split(',')
                  : null),
              this.isTable() && l.geometry && l.spatialRelationship
                ? (0, n.DB)([])
                : this.executeQuery(l, 'execute').then((t) => {
                    if ((this._checkCancelled(r), !t.hasOwnProperty('features')))
                      return (0, n.d1)(
                        new Error('Unnexected Result querying aggregates from layer'),
                      );
                    const l = [];
                    if (e.pagesDefinition.internal.lastPage !== a) return [];
                    for (let r = 0; r < t.features.length; r++)
                      e.pagesDefinition.internal.set[s + r] =
                        t.features[r].attributes[e.pagesDefinition.generatedOid];
                    for (let e = 0; e < t.features.length; e++)
                      l.push(new d.Z({ attributes: t.features[e].attributes, geometry: null }));
                    return (
                      !0 === e.pagesDefinition.useOIDpagination
                        ? 0 === t.features.length
                          ? (e.pagesDefinition.internal.fullyResolved = !0)
                          : (e.pagesDefinition.internal.lastMaxId =
                              t.features[t.features.length - 1].attributes[
                                e.pagesDefinition.generatedOid
                              ])
                        : ((void 0 === t.exceededTransferLimit &&
                            t.features.length !== e.pagesDefinition.resultRecordCount) ||
                            !1 === t.exceededTransferLimit) &&
                          (e.pagesDefinition.internal.fullyResolved = !0),
                      (e.pagesDefinition.internal.lastRetrieved = i + t.features.length),
                      (e.pagesDefinition.internal.lastPage += e.pagesDefinition.resultRecordCount),
                      l
                    );
                  })
            );
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        static create(e, t, r, i, s) {
          const n = new y.default({ url: e, outFields: null === t ? ['*'] : t });
          return new M({ layer: n, spatialReference: r, lrucache: i, interceptor: s });
        }
        relationshipMetaData() {
          return this._layer &&
            this._layer.source &&
            this._layer.source.sourceJSON &&
            this._layer.source.sourceJSON.relationships
            ? this._layer.source.sourceJSON.relationships
            : [];
        }
        serviceUrl() {
          return (0, l.a7)(this._layer.parsedUrl.path);
        }
        queryAttachments(e, t, r, i) {
          if (
            this._layer.capabilities.data.supportsAttachment &&
            this._layer.capabilities.operations.supportsQueryAttachments
          ) {
            const s = { objectIds: [e] };
            return (
              ((t && t > 0) || (r && r > 0)) &&
                (s.size = [t && t > 0 ? t : 0, r && r > 0 ? r : t + 1]),
              i && i.length > 0 && (s.attachmentTypes = i),
              this.featureSetQueryInterceptor &&
                this.featureSetQueryInterceptor.preLayerQueryCallback({
                  layer: this._layer,
                  query: s,
                  method: 'attachments',
                }),
              this._layer.queryAttachments(s).then((t) => {
                const r = [];
                return (
                  t &&
                    t[e] &&
                    t[e].forEach((t) => {
                      const i =
                        this._layer.parsedUrl.path +
                        '/' +
                        e.toString() +
                        '/attachments/' +
                        t.id.toString();
                      r.push(new l.M(t.id, t.name, t.contentType, t.size, i));
                    }),
                  r
                );
              })
            );
          }
          return (0, n.DB)([]);
        }
        queryRelatedFeatures(e) {
          const t = {
            f: 'json',
            relationshipId: e.relationshipId.toString(),
            definitionExpression: e.where,
            outFields: e.outFields.join(','),
            returnGeometry: e.returnGeometry.toString(),
          };
          return (
            void 0 !== e.resultOffset &&
              null !== e.resultOffset &&
              (t.resultOffset = e.resultOffset.toString()),
            void 0 !== e.resultRecordCount &&
              null !== e.resultRecordCount &&
              (t.resultRecordCount = e.resultRecordCount.toString()),
            e.orderByFields && (t.orderByFields = e.orderByFields.join(',')),
            e.objectIds.length > 0 && (t.objectIds = e.objectIds.join(',')),
            e.outSpatialReference && (t.outSR = JSON.stringify(e.outSpatialReference.toJSON())),
            this.featureSetQueryInterceptor &&
              this.featureSetQueryInterceptor.preRequestCallback({
                layer: this._layer,
                queryPayload: t,
                method: 'relatedrecords',
                url: this._layer.parsedUrl.path + '/queryRelatedRecords',
              }),
            (0, s.default)(this._layer.parsedUrl.path + '/queryRelatedRecords', {
              responseType: 'json',
              query: t,
            }).then((e) => {
              if (e.data) {
                const t = {},
                  r = e.data;
                if (r && r.relatedRecordGroups) {
                  const e = r.spatialReference;
                  for (const i of r.relatedRecordGroups) {
                    const s = i.objectId,
                      n = [];
                    for (const t of i.relatedRecords) {
                      t.geometry && (t.geometry.spatialReference = e);
                      const r = new d.Z({
                        geometry: t.geometry ? (0, f.im)(t.geometry) : null,
                        attributes: t.attributes,
                      });
                      n.push(r);
                    }
                    t[s] = { features: n, exceededTransferLimit: !0 === r.exceededTransferLimit };
                  }
                }
                return t;
              }
              return (0, n.d1)('Invalid Request');
            })
          );
        }
        getFeatureByObjectId(e, t) {
          const r = new S.Z({ url: this._layer.parsedUrl.path }),
            i = new w.Z();
          return (
            (i.outFields = t),
            (i.returnGeometry = !1),
            (i.outSpatialReference = this.spatialReference),
            (i.where = this.objectIdField + '=' + e.toString()),
            this.featureSetQueryInterceptor &&
              this.featureSetQueryInterceptor.preLayerQueryCallback({
                layer: this._layer,
                query: i,
                method: 'execute',
              }),
            r.execute(i).then((e) => (1 === e.features.length ? e.features[0] : null))
          );
        }
        getIdentityUser() {
          return this.load().then(() => {
            var e;
            const t = null == (e = i.id) ? void 0 : e.findCredential(this._layer.url);
            return t ? t.userId : null;
          });
        }
        getOwningSystemUrl() {
          return this.load().then(() => {
            var e;
            const t = null == (e = i.id) ? void 0 : e.findServerInfo(this._layer.url);
            if (t) return (0, n.DB)(t.owningSystemUrl);
            let r = this._layer.url;
            const a = r.toLowerCase().indexOf('/rest/services');
            return (
              (r = a > -1 ? r.substring(0, a) : r),
              r
                ? ((r += '/rest/info'),
                  (0, n.Ue)((e, t) => {
                    (0, s.default)(r, { query: { f: 'json' } }).then(
                      (t) => {
                        let r = '';
                        t.data && t.data.owningSystemUrl && (r = t.data.owningSystemUrl), e(r);
                      },
                      (t) => {
                        e('');
                      },
                    );
                  }))
                : (0, n.DB)('')
            );
          });
        }
      }
      class W extends a.F {
        constructor(e) {
          super(e),
            (this.declaredClass = 'esri.arcade.featureset.sources.FeatureLayerMemory'),
            (this._removeGeometry = !1),
            (this._overrideFields = null),
            (this._forceIsTable = !1),
            e.spatialReference && (this.spatialReference = e.spatialReference),
            (this._transparent = !0),
            (this._maxProcessing = 1e3),
            (this._layer = e.layer),
            (this._wset = null),
            !0 === e.isTable && (this._forceIsTable = !0),
            void 0 !== e.outFields && (this._overrideFields = e.outFields),
            void 0 !== e.includeGeometry && (this._removeGeometry = !1 === e.includeGeometry);
        }
        _maxQueryRate() {
          return l.a5;
        }
        end() {
          return this._layer;
        }
        optimisePagingFeatureQueries() {}
        load() {
          return (
            null === this._loadPromise &&
              (this._loadPromise = (0, n.Ue)((e, t) => {
                if (!0 === this._layer.loaded) return this._initialiseFeatureSet(), void e(this);
                this._layer.when().then(() => {
                  try {
                    this._initialiseFeatureSet(), e(this);
                  } catch (e) {
                    t(e);
                  }
                }, t),
                  this._layer.load();
              })),
            this._loadPromise
          );
        }
        get gdbVersion() {
          return '';
        }
        _initialiseFeatureSet() {
          if (
            (null == this.spatialReference &&
              (this.spatialReference = this._layer.spatialReference),
            (this.geometryType = this._layer.geometryType),
            (this.fields = this._layer.fields.slice(0)),
            this._layer.outFields)
          )
            if (1 === this._layer.outFields.length && '*' === this._layer.outFields[0]);
            else {
              const e = [];
              for (const t of this.fields)
                if ('oid' === t.type) e.push(t);
                else
                  for (const r of this._layer.outFields)
                    if (r.toLowerCase() === t.name.toLowerCase()) {
                      e.push(t);
                      break;
                    }
              this.fields = e;
            }
          if (null !== this._overrideFields)
            if (1 === this._overrideFields.length && '*' === this._overrideFields[0])
              this._overrideFields = null;
            else {
              const e = [],
                t = [];
              for (const r of this.fields)
                if ('oid' === r.type) e.push(r), t.push(r.name);
                else
                  for (const i of this._overrideFields)
                    if (i.toLowerCase() === r.name.toLowerCase()) {
                      e.push(r), t.push(r.name);
                      break;
                    }
              (this.fields = e), (this._overrideFields = t);
            }
          this.objectIdField = this._layer.objectIdField;
          for (const e of this.fields) 'global-id' === e.type && (this.globalIdField = e.name);
          (this.hasM = this._layer.supportsM),
            (this.hasZ = this._layer.supportsZ),
            (this._databaseType = l.a3.Standardised),
            (this.typeIdField = this._layer.typeIdField),
            (this.types = this._layer.types);
        }
        isTable() {
          return (
            this._forceIsTable ||
            this._layer.isTable ||
            'table' === this._layer.type ||
            !this._layer.geometryType
          );
        }
        _isInFeatureSet() {
          return l.a1.InFeatureSet;
        }
        _candidateIdTransform(e) {
          return e;
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() => this._getFilteredSet('', null, null, null, e))
                .then((e) => ((this._wset = e), e))
            : (0, n.DB)(this._wset);
        }
        _changeFeature(e) {
          const t = {};
          for (const r of this.fields) t[r.name] = e.attributes[r.name];
          return new d.Z({
            geometry: !0 === this._removeGeometry ? null : e.geometry,
            attributes: t,
          });
        }
        _getFilteredSet(e, t, r, i, s) {
          let o = '',
            u = !1;
          if (
            (null !== i && ((o = i.constructClause()), (u = !0)),
            this.isTable() && t && null !== e && '' !== e)
          ) {
            const e = new a.I([], [], !0, null);
            return (0, n.DB)(e);
          }
          const d = new w.Z();
          return (
            (d.where = null === r ? (null === t ? '1=1' : '') : (0, a.t)(r, l.a3.Standardised)),
            (d.spatialRelationship = this._makeRelationshipEnum(e)),
            (d.outSpatialReference = this.spatialReference),
            (d.orderByFields = '' !== o ? o.split(',') : null),
            (d.geometry = null === t ? null : t),
            (d.returnGeometry = !0),
            (d.relationParameter = this._makeRelationshipParam(e)),
            this._layer.queryFeatures(d).then((e) => {
              if (null === e) return new a.I([], [], u, null);
              this._checkCancelled(s);
              const t = [];
              return (
                e.features.forEach((e) => {
                  const r = e.attributes[this._layer.objectIdField];
                  t.push(r), (this._featureCache[r] = this._changeFeature(e));
                }),
                new a.I([], t, u, null)
              );
            })
          );
        }
        _makeRelationshipEnum(e) {
          if (e.indexOf('esriSpatialRelRelation') >= 0) return 'relation';
          switch (e) {
            case 'esriSpatialRelRelation':
              return 'relation';
            case 'esriSpatialRelIntersects':
              return 'intersects';
            case 'esriSpatialRelContains':
              return 'contains';
            case 'esriSpatialRelOverlaps':
              return 'overlaps';
            case 'esriSpatialRelWithin':
              return 'within';
            case 'esriSpatialRelTouches':
              return 'touches';
            case 'esriSpatialRelCrosses':
              return 'crosses';
            case 'esriSpatialRelEnvelopeIntersects':
              return 'envelope-intersects';
          }
          return e;
        }
        _makeRelationshipParam(e) {
          return e.indexOf('esriSpatialRelRelation') >= 0 ? e.split(':')[1] : '';
        }
        _queryAllFeatures() {
          if (this._wset) return (0, n.DB)(this._wset);
          const e = new w.Z();
          return (
            (e.where = '1=1'),
            this._ensureLoaded().then(() => {
              if (this._layer.source && this._layer.source.items) {
                const e = [];
                return (
                  this._layer.source.items.forEach((t) => {
                    const r = t.attributes[this._layer.objectIdField];
                    e.push(r), (this._featureCache[r] = this._changeFeature(t));
                  }),
                  (this._wset = new a.I([], e, !1, null)),
                  this._wset
                );
              }
              return this._layer.queryFeatures(e).then((e) => {
                const t = [];
                return (
                  e.features.forEach((e) => {
                    const r = e.attributes[this._layer.objectIdField];
                    t.push(r), (this._featureCache[r] = this._changeFeature(e));
                  }),
                  (this._wset = new a.I([], t, !1, null)),
                  this._wset
                );
              });
            })
          );
        }
        _getFeatures(e, t, r) {
          const i = [];
          -1 !== t && void 0 === this._featureCache[t] && i.push(t);
          for (
            let s = e._lastFetchedIndex;
            s < e._known.length &&
            ((e._lastFetchedIndex += 1),
            !(
              void 0 === this._featureCache[e._known[s]] &&
              (e._known[s] !== t && i.push(e._known[s]), i.length > r)
            ));
            s++
          );
          return 0 === i.length
            ? (0, n.DB)('success')
            : (0, n.d1)(new Error('Unaccounted for Features. Not in Feature Collection'));
        }
        _refineSetBlock(e) {
          return (0, n.DB)(e);
        }
        _stat() {
          return (0, n.DB)({ calculated: !1 });
        }
        _canDoAggregates() {
          return (0, n.DB)(!1);
        }
        relationshipMetaData() {
          return [];
        }
        static _cloneAttr(e) {
          const t = {};
          for (const r in e) t[r] = e[r];
          return t;
        }
        nativeCapabilities() {
          return {
            title: this._layer.title,
            canQueryRelated: !1,
            source: this,
            capabilities: this._layer.capabilities,
            databaseType: this._databaseType,
            requestStandardised: !0,
          };
        }
        static create(e, t) {
          let r = e.layerDefinition.objectIdField;
          const i = e.layerDefinition.typeIdField ? e.layerDefinition.typeIdField : '',
            s = [];
          if (e.layerDefinition.types)
            for (const t of e.layerDefinition.types) s.push(v.Z.fromJSON(t));
          let n = e.layerDefinition.geometryType;
          void 0 === n && (n = e.featureSet.geometryType || '');
          let a = e.featureSet.features;
          const l = t.toJSON();
          if ('' === r || void 0 === r) {
            let t = !1;
            for (const i of e.layerDefinition.fields)
              if ('oid' === i.type || 'esriFieldTypeOID' === i.type) {
                (r = i.name), (t = !0);
                break;
              }
            if (!1 === t) {
              let t = 'FID',
                i = !0,
                s = 0;
              for (; i; ) {
                let r = !0;
                for (const i of e.layerDefinition.fields)
                  if (i.name === t) {
                    r = !1;
                    break;
                  }
                !0 === r ? (i = !1) : (s++, (t = 'FID' + s.toString()));
              }
              e.layerDefinition.fields.push({ type: 'esriFieldTypeOID', name: t, alias: t });
              const n = [];
              for (let r = 0; r < a.length; r++)
                n.push({
                  geometry: e.featureSet.features[r].geometry,
                  attributes: e.featureSet.features[r].attributes
                    ? this._cloneAttr(e.featureSet.features[r].attributes)
                    : {},
                }),
                  (n[r].attributes[t] = r);
              (a = n), (r = t);
            }
          }
          const o = [];
          for (const t of e.layerDefinition.fields)
            t instanceof c.Z ? o.push(t) : o.push(c.Z.fromJSON(t));
          let u = n;
          switch (u) {
            case 'esriGeometryPoint':
              u = 'point';
              break;
            case 'esriGeometryPolyline':
              u = 'polyline';
              break;
            case 'esriGeometryPolygon':
              u = 'polygon';
              break;
            case 'esriGeometryExtent':
              u = 'extent';
              break;
            case 'esriGeometryMultipoint':
              u = 'multipoint';
          }
          for (const e of a)
            e.geometry &&
              e.geometry instanceof I.Z == 0 &&
              ((e.geometry.type = u),
              void 0 === e.geometry.spatialReference && (e.geometry.spatialReference = l));
          const d = {
            outFields: ['*'],
            source: a,
            fields: o,
            types: s,
            typeIdField: i,
            objectIdField: r,
            spatialReference: t,
          };
          d.geometryType = u || 'point';
          const h = new y.default(d);
          return new W({ layer: h, spatialReference: t, isTable: null === u || '' === u });
        }
        queryAttachments() {
          return (0, n.DB)([]);
        }
        getFeatureByObjectId(e) {
          const t = new w.Z();
          return (
            (t.where = this.objectIdField + '=' + e.toString()),
            this._layer
              .queryFeatures(t)
              .then((e) => (1 === e.features.length ? e.features[0] : null))
          );
        }
        getOwningSystemUrl() {
          return (0, n.DB)('');
        }
        getIdentityUser() {
          return (0, n.DB)('');
        }
      }
      class Z extends a.F {
        constructor(e) {
          super(e),
            (this.declaredClass = 'esri.arcade.featureset.sources.FeatureLayerRelated'),
            (this._findObjectId = -1),
            (this._requestStandardised = !1),
            (this._removeGeometry = !1),
            (this._overrideFields = null),
            (this.featureObjectId = null),
            (this.relatedLayer = null),
            (this.relationship = null),
            e.spatialReference && (this.spatialReference = e.spatialReference),
            (this._transparent = !0),
            (this._maxProcessing = 1e3),
            (this._layer = e.layer),
            (this._wset = null),
            (this._findObjectId = e.objectId),
            (this.featureObjectId = e.objectId),
            (this.relationship = e.relationship),
            (this.relatedLayer = e.relatedLayer),
            void 0 !== e.outFields && (this._overrideFields = e.outFields),
            void 0 !== e.includeGeometry && (this._removeGeometry = !1 === e.includeGeometry);
        }
        _maxQueryRate() {
          return l.a5;
        }
        end() {
          return this._layer;
        }
        optimisePagingFeatureQueries() {}
        load() {
          return (
            null === this._loadPromise &&
              (this._loadPromise = (0, n.Ue)((e, t) => {
                (0, n.$6)([this._layer.load(), this.relatedLayer.load()]).then(() => {
                  this._initialiseFeatureSet(), e(this);
                }, t);
              })),
            this._loadPromise
          );
        }
        nativeCapabilities() {
          return this.relatedLayer.nativeCapabilities();
        }
        _initialiseFeatureSet() {
          if (
            (null == this.spatialReference &&
              (this.spatialReference = this._layer.spatialReference),
            (this.geometryType = this.relatedLayer.geometryType),
            (this.fields = this.relatedLayer.fields.slice(0)),
            null !== this._overrideFields)
          )
            if (1 === this._overrideFields.length && '*' === this._overrideFields[0])
              this._overrideFields = null;
            else {
              const e = [],
                t = [];
              for (const r of this.fields)
                if ('oid' === r.type) e.push(r), t.push(r.name);
                else
                  for (const i of this._overrideFields)
                    if (i.toLowerCase() === r.name.toLowerCase()) {
                      e.push(r), t.push(r.name);
                      break;
                    }
              (this.fields = e), (this._overrideFields = t);
            }
          const e = this._layer.nativeCapabilities();
          e &&
            ((this._databaseType = e.databaseType),
            (this._requestStandardised = e.requestStandardised)),
            (this.objectIdField = this.relatedLayer.objectIdField),
            (this.globalIdField = this.relatedLayer.globalIdField),
            (this.hasM = this.relatedLayer.supportsM),
            (this.hasZ = this.relatedLayer.supportsZ),
            (this.typeIdField = this.relatedLayer.typeIdField),
            (this.types = this.relatedLayer.types);
        }
        databaseType() {
          return this.relatedLayer
            .databaseType()
            .then(
              () => ((this._databaseType = this.relatedLayer._databaseType), this._databaseType),
            );
        }
        isTable() {
          return this.relatedLayer.isTable();
        }
        _isInFeatureSet() {
          return l.a1.InFeatureSet;
        }
        _candidateIdTransform(e) {
          return e;
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() => this._getFilteredSet('', null, null, null, e))
                .then((e) => ((this._wset = e), e))
            : (0, n.DB)(this._wset);
        }
        _changeFeature(e) {
          const t = {};
          for (const r of this.fields) t[r.name] = e.attributes[r.name];
          return new d.Z({
            geometry: !0 === this._removeGeometry ? null : e.geometry,
            attributes: t,
          });
        }
        _getFilteredSet(e, t, r, i, s) {
          return this.databaseType().then(() => {
            if (this.isTable() && t && null !== e && '' !== e) return new a.I([], [], !0, null);
            const n = this._layer.nativeCapabilities();
            if (!1 === n.canQueryRelated) return new a.I([], [], !0, null);
            if (n.capabilities.queryRelated && n.capabilities.queryRelated.supportsPagination)
              return this._getFilteredSetUsingPaging(e, t, r, i, s);
            let l = '',
              o = !1;
            null !== i &&
              n.capabilities &&
              n.capabilities.queryRelated &&
              !0 === n.capabilities.queryRelated.supportsOrderBy &&
              ((l = i.constructClause()), (o = !0));
            const u = new C.Z();
            u.objectIds = [this._findObjectId];
            const d =
              null !== this._overrideFields
                ? this._overrideFields
                : this._fieldsIncludingObjectId(
                    this.relatedLayer.fields ? this.relatedLayer.fields.map((e) => e.name) : ['*'],
                  );
            (u.outFields = d), (u.relationshipId = this.relationship.id), (u.where = '1=1');
            let h = !0;
            return (
              !0 === this._removeGeometry && (h = !1),
              (u.returnGeometry = h),
              this._requestStandardised && (u.sqlFormat = 'standard'),
              (u.outSpatialReference = this.spatialReference),
              (u.orderByFields = '' !== l ? l.split(',') : null),
              n.source.queryRelatedFeatures(u).then((i) => {
                this._checkCancelled(s);
                const n = i[this._findObjectId] ? i[this._findObjectId].features : [],
                  l = [];
                for (let e = 0; e < n.length; e++)
                  (this._featureCache[n[e].attributes[this._layer.objectIdField]] = n[e]),
                    l.push(n[e].attributes[this._layer.objectIdField]);
                const u = t && null !== e && '' !== e,
                  d = null != r;
                return new a.I(u || d ? l : [], u || d ? [] : l, o, null);
              })
            );
          });
        }
        _fieldsIncludingObjectId(e) {
          if (null === e) return [this.objectIdField];
          const t = e.slice(0);
          if (t.indexOf('*') > -1) return t;
          let r = !1;
          for (const e of t)
            if (e.toUpperCase() === this.objectIdField.toUpperCase()) {
              r = !0;
              break;
            }
          return !1 === r && t.push(this.objectIdField), t;
        }
        _getFilteredSetUsingPaging(e, t, r, i, s) {
          try {
            let n = '',
              l = !1;
            const o = this._layer.nativeCapabilities();
            return (
              null !== i &&
                o &&
                o.capabilities.queryRelated &&
                !0 === o.capabilities.queryRelated.supportsOrderBy &&
                ((n = i.constructClause()), (l = !0)),
              this.databaseType().then(() => {
                let i = this._maxQueryRate();
                const u = o.capabilities.query.maxRecordCount;
                void 0 !== u && u < i && (i = u);
                const d = t && null !== e && '' !== e,
                  h = null != r;
                let c = null,
                  p = !0;
                !0 === this._removeGeometry && (p = !1);
                const f =
                  null !== this._overrideFields
                    ? this._overrideFields
                    : this._fieldsIncludingObjectId(
                        this.relatedLayer.fields
                          ? this.relatedLayer.fields.map((e) => e.name)
                          : ['*'],
                      );
                return (
                  (c = new a.I(d || h ? ['GETPAGES'] : [], d || h ? [] : ['GETPAGES'], l, {
                    outFields: f.join(','),
                    resultRecordCount: i,
                    resultOffset: 0,
                    objectIds: [this._findObjectId],
                    where: '1=1',
                    orderByFields: n,
                    returnGeometry: p,
                    returnIdsOnly: 'false',
                    internal: { set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: !1 },
                  })),
                  this._expandPagedSet(c, i, 0, 0, s).then(() => c)
                );
              })
            );
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _expandPagedSet(e, t, r, i, s) {
          return this._expandPagedSetFeatureSet(e, t, r, i, s);
        }
        _clonePageDefinition(e) {
          return null === e
            ? null
            : !0 !== e.groupbypage
            ? {
                groupbypage: !1,
                outFields: e.outFields,
                resultRecordCount: e.resultRecordCount,
                resultOffset: e.resultOffset,
                where: e.where,
                objectIds: e.objectIds,
                orderByFields: e.orderByFields,
                returnGeometry: e.returnGeometry,
                returnIdsOnly: e.returnIdsOnly,
                internal: e.internal,
              }
            : {
                groupbypage: !0,
                outFields: e.outFields,
                resultRecordCount: e.resultRecordCount,
                useOIDpagination: e.useOIDpagination,
                generatedOid: e.generatedOid,
                groupByFieldsForStatistics: e.groupByFieldsForStatistics,
                resultOffset: e.resultOffset,
                outStatistics: e.outStatistics,
                geometry: e.geometry,
                where: e.where,
                objectIds: e.objectIds,
                orderByFields: e.orderByFields,
                returnGeometry: e.returnGeometry,
                returnIdsOnly: e.returnIdsOnly,
                internal: e.internal,
              };
        }
        _getPhysicalPage(e, t, r) {
          try {
            const t = e.pagesDefinition.internal.lastRetrieved,
              i = t,
              s = e.pagesDefinition.internal.lastPage,
              n = this._layer.nativeCapabilities(),
              a = new C.Z();
            return (
              !0 === this._requestStandardised && (a.sqlFormat = 'standard'),
              (a.relationshipId = this.relationship.id),
              (a.objectIds = e.pagesDefinition.objectIds),
              (a.resultOffset = e.pagesDefinition.internal.lastPage),
              (a.resultRecordCount = e.pagesDefinition.resultRecordCount),
              (a.outFields = e.pagesDefinition.outFields.split(',')),
              (a.where = e.pagesDefinition.where),
              (a.orderByFields =
                '' !== e.pagesDefinition.orderByFields
                  ? e.pagesDefinition.orderByFields.split(',')
                  : null),
              (a.returnGeometry = e.pagesDefinition.returnGeometry),
              (a.outSpatialReference = this.spatialReference),
              n.source.queryRelatedFeatures(a).then((n) => {
                if ((this._checkCancelled(r), e.pagesDefinition.internal.lastPage !== s)) return 0;
                const a = n[this._findObjectId] ? n[this._findObjectId].features : [];
                for (let t = 0; t < a.length; t++)
                  e.pagesDefinition.internal.set[i + t] =
                    a[t].attributes[this._layer.objectIdField];
                for (let e = 0; e < a.length; e++)
                  this._featureCache[a[e].attributes[this._layer.objectIdField]] = a[e];
                const l =
                  !n[this._findObjectId] || !1 === n[this._findObjectId].exceededTransferLimit;
                return (
                  a.length !== e.pagesDefinition.resultRecordCount &&
                    l &&
                    (e.pagesDefinition.internal.fullyResolved = !0),
                  (e.pagesDefinition.internal.lastRetrieved = t + a.length),
                  (e.pagesDefinition.internal.lastPage += e.pagesDefinition.resultRecordCount),
                  a.length
                );
              })
            );
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _getFeatures(e, t, r, i) {
          const s = [];
          -1 !== t && void 0 === this._featureCache[t] && s.push(t);
          const a = this._maxQueryRate();
          if (!0 === this._checkIfNeedToExpandKnownPage(e, a))
            return this._expandPagedSet(e, a, 0, 0, i).then(() => this._getFeatures(e, t, r, i));
          let l = 0;
          for (
            let i = e._lastFetchedIndex;
            i < e._known.length &&
            (l++,
            l <= r && (e._lastFetchedIndex += 1),
            !(
              'GETPAGES' !== e._known[i] &&
              void 0 === this._featureCache[e._known[i]] &&
              (e._known[i] !== t && s.push(e._known[i]), s.length > r)
            )) &&
            !(l >= r && 0 === s.length);
            i++
          );
          return 0 === s.length
            ? (0, n.DB)('success')
            : (0, n.d1)(new Error('Unaccounted for Features. Not in Feature Collection'));
        }
        _refineSetBlock(e, t, r) {
          return (0, n.DB)(e);
        }
        _stat(e, t, r, i, s, a, l) {
          return (0, n.DB)({ calculated: !1 });
        }
        get gdbVersion() {
          return this.relatedLayer.gdbVersion;
        }
        _canDoAggregates(e, t, r, i, s) {
          return (0, n.DB)(!1);
        }
        relationshipMetaData() {
          return this.relatedLayer.relationshipMetaData();
        }
        serviceUrl() {
          return this.relatedLayer.serviceUrl();
        }
        queryAttachments(e, t, r, i) {
          return this.relatedLayer.queryAttachments(e, t, r, i);
        }
        getFeatureByObjectId(e, t) {
          return this.relatedLayer.getFeatureByObjectId(e, t);
        }
        getOwningSystemUrl() {
          return this.relatedLayer.getOwningSystemUrl();
        }
        getIdentityUser() {
          return this.relatedLayer.getIdentityUser();
        }
      }
      function z(e, t) {
        if (a.C.applicationCache) {
          const r = a.C.applicationCache.getLayerInfo(e);
          if (r)
            return r.then((r) => (0, n.DB)(new y.default({ url: e, outFields: t, sourceJSON: r })));
          const i = new y.default({ url: e, outFields: t });
          let s = (0, n.Ue)((e, t) => {
            i.load().then(
              () => {
                e(i.sourceJSON);
              },
              (e) => {
                t(e);
              },
            );
          });
          return (
            a.C.applicationCache &&
              (a.C.applicationCache.setLayerInfo(e, s),
              (s = s.catch((t) => {
                throw (a.C.applicationCache.clearLayerInfo(e), t);
              }))),
            s.then(() => (0, n.DB)(i))
          );
        }
        return (0, n.DB)(new y.default({ url: e, outFields: t }));
      }
      function Q(e, t, r, i, s, a = null) {
        return z(e, ['*']).then((e) => (0, n.DB)(J(e, t, r, i, s, a)));
      }
      function J(e, t = null, r = null, i = !0, s = null, n = null) {
        return !0 === e._hasMemorySource()
          ? new W({
              layer: e,
              spatialReference: t,
              outFields: r,
              includeGeometry: i,
              lrucache: s,
              interceptor: n,
            })
          : new M({
              layer: e,
              spatialReference: t,
              outFields: r,
              includeGeometry: i,
              lrucache: s,
              interceptor: n,
            });
      }
      function K(e) {
        if (null !== a.C.applicationCache) {
          const t = a.C.applicationCache.getLayerInfo(e);
          if (null !== t) return t;
        }
        let t = (0, s.default)(e, { responseType: 'json', query: { f: 'json' } }).then((e) => {
          if (e.data) {
            const t = e.data;
            return t.layers || (t.layers = []), t.tables || (t.tables = []), (0, n.DB)(t);
          }
          return (0, n.DB)({ layers: [], tables: [] });
        });
        return (
          null !== a.C.applicationCache &&
            (a.C.applicationCache.setLayerInfo(e, t),
            (t = t.catch((t) => {
              throw (a.C.applicationCache.clearLayerInfo(e), t);
            }))),
          t
        );
      }
      function H(e, t) {
        const r = {
          metadata: null,
          networkId: -1,
          unVersion: 3,
          terminals: [],
          queryelem: null,
          layerNameLkp: {},
          lkp: null,
        };
        return K(e).then((i) => {
          if (
            ((r.metadata = i),
            i.controllerDatasetLayers &&
              void 0 !== i.controllerDatasetLayers.utilityNetworkLayerId &&
              null !== i.controllerDatasetLayers.utilityNetworkLayerId)
          ) {
            if (i.layers) for (const e of i.layers) r.layerNameLkp[e.id] = e.name;
            if (i.tables) for (const e of i.tables) r.layerNameLkp[e.id] = e.name;
            const l = i.controllerDatasetLayers.utilityNetworkLayerId;
            return (
              (r.networkId = l),
              (function (e, t) {
                const r = 'QUERYDATAELEMTS:' + t.toString() + ':' + e;
                if (null !== a.C.applicationCache) {
                  const e = a.C.applicationCache.getLayerInfo(r);
                  if (null !== e) return e;
                }
                let i = (0, s.default)(e + '/queryDataElements', {
                  method: 'post',
                  responseType: 'json',
                  query: { layers: JSON.stringify([t.toString()]), f: 'json' },
                }).then((e) => {
                  if (e.data) {
                    const t = e.data;
                    if (t.layerDataElements && t.layerDataElements[0])
                      return t.layerDataElements[0];
                  }
                  throw new Error('Not Found');
                });
                return (
                  null !== a.C.applicationCache &&
                    (a.C.applicationCache.setLayerInfo(r, i),
                    (i = i.catch((e) => {
                      throw (a.C.applicationCache.clearLayerInfo(r), e);
                    }))),
                  i
                );
              })(e, l).then((i) => {
                if (i) {
                  (r.queryelem = i),
                    r.queryelem &&
                      r.queryelem.dataElement &&
                      void 0 !== r.queryelem.dataElement.schemaGeneration &&
                      (r.unVersion = r.queryelem.dataElement.schemaGeneration),
                    (r.lkp = {}),
                    r.queryelem.dataElement.domainNetworks ||
                      (r.queryelem.dataElement.domainNetworks = []);
                  for (const e of r.queryelem.dataElement.domainNetworks) {
                    for (const t of e.edgeSources ? e.edgeSources : []) {
                      const e = {
                        layerId: t.layerId,
                        sourceId: t.sourceId,
                        className: r.layerNameLkp[t.layerId] ? r.layerNameLkp[t.layerId] : null,
                      };
                      e.className && (r.lkp[e.className] = e);
                    }
                    for (const t of e.junctionSources ? e.junctionSources : []) {
                      const e = {
                        layerId: t.layerId,
                        sourceId: t.sourceId,
                        className: r.layerNameLkp[t.layerId] ? r.layerNameLkp[t.layerId] : null,
                      };
                      e.className && (r.lkp[e.className] = e);
                    }
                  }
                  if (r.queryelem.dataElement.terminalConfigurations)
                    for (const e of r.queryelem.dataElement.terminalConfigurations)
                      for (const t of e.terminals)
                        r.terminals.push({
                          terminalId: t.terminalId,
                          terminalName: t.terminalName,
                        });
                  return (function (e) {
                    if (null !== a.C.applicationCache) {
                      const t = a.C.applicationCache.getLayerInfo(e);
                      if (null !== t) return t;
                    }
                    let t = (0, s.default)(e, { responseType: 'json', query: { f: 'json' } }).then(
                      (e) => {
                        if (e.data) {
                          const t = e.data;
                          return (0, n.DB)(t);
                        }
                        return (0, n.DB)(null);
                      },
                    );
                    return (
                      null !== a.C.applicationCache &&
                        (a.C.applicationCache.setLayerInfo(e, t),
                        (t = t.catch((t) => {
                          throw (a.C.applicationCache.clearLayerInfo(e), t);
                        }))),
                      t
                    );
                  })(e + '/' + l).then((i) => {
                    if (
                      i.systemLayers &&
                      void 0 !== i.systemLayers.associationsTableId &&
                      null !== i.systemLayers.associationsTableId
                    ) {
                      const s = [];
                      return (
                        r.unVersion >= 4 && (s.push('STATUS'), s.push('PERCENTALONG')),
                        Q(
                          e + '/' + i.systemLayers.associationsTableId.toString(),
                          t,
                          [
                            'OBJECTID',
                            'FROMNETWORKSOURCEID',
                            'TONETWORKSOURCEID',
                            'FROMGLOBALID',
                            'TOGLOBALID',
                            'TOTERMINALID',
                            'FROMTERMINALID',
                            'ASSOCIATIONTYPE',
                            'ISCONTENTVISIBLE',
                            'GLOBALID',
                            ...s,
                          ],
                          !1,
                          null,
                          null,
                        )
                          .then((e) => e.load())
                          .then((e) =>
                            r.unVersion >= 4
                              ? (e = e.filter(
                                  o.WhereClause.create(
                                    'STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62,63)',
                                    e.getFieldsIndex(),
                                  ),
                                )).load()
                              : e,
                          )
                          .then((e) => ({
                            lkp: r.lkp,
                            associations: e,
                            unVersion: r.unVersion,
                            terminals: r.terminals,
                          }))
                      );
                    }
                    return { associations: null, unVersion: r.unVersion, lkp: null, terminals: [] };
                  });
                }
                return { associations: null, unVersion: r.unVersion, lkp: null, terminals: [] };
              })
            );
          }
          return { associations: null, unVersion: r.unVersion, lkp: null, terminals: [] };
        });
      }
      function X(e, t, r, i = null, s = null, n = !0, a = null, l = null) {
        let o = e.serviceUrl();
        return o
          ? ((o =
              '/' === o.charAt(o.length - 1)
                ? o + t.relatedTableId.toString()
                : o + '/' + t.relatedTableId.toString()),
            Q(o, i, s, n, a, l).then(
              (o) =>
                new Z({
                  layer: e,
                  relatedLayer: o,
                  relationship: t,
                  objectId: r,
                  spatialReference: i,
                  outFields: s,
                  includeGeometry: n,
                  lrucache: a,
                  interceptor: l,
                }),
            ))
          : null;
      }
      R.registerAction(),
        U.registerAction(),
        j.registerAction(),
        a.S.registerAction(),
        V.registerAction();
      class $ extends T {
        constructor(e, t = null, r = null, i = null) {
          super(),
            (this._map = e),
            (this._overridespref = t),
            (this.lrucache = r),
            (this.interceptor = i),
            (this._instantLayers = []);
        }
        makeAndAddFeatureSet(e, t = !0, r = null) {
          const i = J(
            e,
            this._overridespref,
            null === r ? ['*'] : r,
            t,
            this.lrucache,
            this.interceptor,
          );
          return (
            this._instantLayers.push({
              featureset: i,
              opitem: e,
              includeGeometry: t,
              outFields: JSON.stringify(r),
            }),
            i
          );
        }
        featureSetByName(e, t = !0, r = null) {
          if (void 0 !== this._map.loaded && void 0 !== this._map.load && !1 === this._map.loaded)
            return this._map.load().then(() => {
              try {
                return this.featureSetByName(e, t, r);
              } catch (e) {
                return (0, n.d1)(e);
              }
            });
          null === r && (r = ['*']), (r = (r = r.slice(0)).sort());
          const i = JSON.stringify(r);
          for (let r = 0; r < this._instantLayers.length; r++) {
            const s = this._instantLayers[r];
            if (s.opitem.title === e && s.includeGeometry === t && s.outFields === i)
              return this.resolvePromise(this._instantLayers[r].featureset);
          }
          const s = this._map.layers.find((t) => t instanceof y.default && t.title === e);
          if (s) return this.resolvePromise(this.makeAndAddFeatureSet(s, t, r));
          if (this._map.tables) {
            const i = this._map.tables.find(
              (t) => !!((t.title && t.title === e) || (t.title && t.title === e)),
            );
            if (i) {
              if (i instanceof y.default)
                return this.resolvePromise(this.makeAndAddFeatureSet(i, t, r));
              if (i._materializedTable);
              else {
                const e = i.outFields ? i : { ...i, outFields: ['*'] };
                i._materializedTable = new y.default(e);
              }
              return i._materializedTable
                .load()
                .then(() =>
                  this.resolvePromise(this.makeAndAddFeatureSet(i._materializedTable, t, r)),
                );
            }
          }
          return this.resolvePromise(null);
        }
        featureSetById(e, t = !0, r = ['*']) {
          if (void 0 !== this._map.loaded && void 0 !== this._map.load && !1 === this._map.loaded)
            return this._map.load().then(() => {
              try {
                return this.featureSetById(e, t, r);
              } catch (e) {
                return (0, n.d1)(e);
              }
            });
          null === r && (r = ['*']), (r = (r = r.slice(0)).sort());
          const i = JSON.stringify(r);
          for (let r = 0; r < this._instantLayers.length; r++) {
            const s = this._instantLayers[r];
            if (s.opitem.id === e && s.includeGeometry === t && s.outFields === i)
              return this.resolvePromise(this._instantLayers[r].featureset);
          }
          const s = this._map.layers.find((t) => t instanceof y.default && t.id === e);
          if (s) return this.resolvePromise(this.makeAndAddFeatureSet(s, t, r));
          if (this._map.tables) {
            const i = this._map.tables.find((t) => t.id === e);
            if (i) {
              if (i instanceof y.default)
                return this.resolvePromise(this.makeAndAddFeatureSet(i, t, r));
              if (i._materializedTable);
              else {
                const e = { ...i, outFields: ['*'] };
                i._materializedTable = new y.default(e);
              }
              return i._materializedTable
                .load()
                .then(() =>
                  this.resolvePromise(this.makeAndAddFeatureSet(i._materializedTable, t, r)),
                );
            }
          }
          return this.resolvePromise(null);
        }
      }
      class Y extends T {
        constructor(e, t = null, r = null, i = null) {
          super(),
            (this._url = e),
            (this._overridespref = t),
            (this.lrucache = r),
            (this.interceptor = i),
            (this.metadata = null),
            (this._instantLayers = []);
        }
        get url() {
          return this._url;
        }
        makeAndAddFeatureSet(e, t = !0, r = null) {
          const i = J(e, this._overridespref, null === r ? ['*'] : r, t, this.lrucache);
          return (
            this._instantLayers.push({
              featureset: i,
              opitem: e,
              includeGeometry: t,
              outFields: JSON.stringify(r),
            }),
            i
          );
        }
        _loadMetaData() {
          return K(this._url).then((e) => ((this.metadata = e), e));
        }
        load() {
          return this._loadMetaData();
        }
        clone() {
          return new Y(this._url, this._overridespref, this.lrucache, this.interceptor);
        }
        featureSetByName(e, t = !0, r = null) {
          null === r && (r = ['*']), (r = (r = r.slice(0)).sort());
          const i = JSON.stringify(r);
          for (let r = 0; r < this._instantLayers.length; r++) {
            const s = this._instantLayers[r];
            if (s.opitem.title === e && s.includeGeometry === t && s.outFields === i)
              return this.resolvePromise(this._instantLayers[r].featureset);
          }
          return this._loadMetaData().then((i) => {
            let s = null;
            for (const t of i.layers ? i.layers : []) t.name === e && (s = t);
            if (!s) for (const t of i.tables ? i.tables : []) t.name === e && (s = t);
            return s
              ? z(this._url + '/' + s.id, ['*']).then((e) => this.makeAndAddFeatureSet(e, t, r))
              : this.resolvePromise(null);
          });
        }
        featureSetById(e, t = !0, r = ['*']) {
          null === r && (r = ['*']), (r = (r = r.slice(0)).sort());
          const i = JSON.stringify(r);
          e = null != e ? e.toString() : '';
          for (let r = 0; r < this._instantLayers.length; r++) {
            const s = this._instantLayers[r];
            if (s.opitem.id === e && s.includeGeometry === t && s.outFields === i)
              return this.resolvePromise(this._instantLayers[r].featureset);
          }
          return this._loadMetaData().then((i) => {
            let s = null;
            for (const t of i.layers ? i.layers : [])
              null !== t.id && void 0 !== t.id && t.id.toString() === e && (s = t);
            if (!s)
              for (const t of i.tables ? i.tables : [])
                null !== t.id && void 0 !== t.id && t.id.toString() === e && (s = t);
            return s
              ? z(this._url + '/' + s.id, ['*']).then((e) => this.makeAndAddFeatureSet(e, t, r))
              : this.resolvePromise(null);
          });
        }
      }
      function ee(e, t) {
        return null === e ? t : new D.Z({ url: e.field('url') });
      }
      function te(e, t, r) {
        return i.id.findCredential(e.restUrl)
          ? 'loaded' === e.loadStatus && '' === t && e.user && e.user.sourceJSON && !1 === r
            ? (0, n.DB)(e.user.sourceJSON)
            : '' === t
            ? (0, s.default)(e.restUrl + '/community/self', {
                responseType: 'json',
                query: { f: 'json', ...(!1 === r ? {} : { returnUserLicenseTypeExtensions: !0 }) },
              }).then((e) => {
                if (e.data) {
                  const t = e.data;
                  if (t && t.username) return (0, n.DB)(t);
                }
                return (0, n.DB)(null);
              })
            : (0, s.default)(e.restUrl + '/community/users/' + t, {
                responseType: 'json',
                query: { f: 'json' },
              }).then((e) => {
                if (e.data) {
                  const t = e.data;
                  return t.error ? null : (0, n.DB)(t);
                }
                return (0, n.DB)(null);
              })
          : (0, n.DB)(null);
      }
      function re(e, t, r, i, s, o, u, d = null) {
        if (a.C.applicationCache) {
          const h = a.C.applicationCache.getLayerInfo(e + ':' + o.url);
          if (h)
            return h.then(
              (e) => {
                try {
                  const a = new y.default({ url: (0, l.a7)(e.url) + '/' + t, outFields: ['*'] });
                  return (0, n.DB)(J(a, r, i, s, u, d));
                } catch (e) {
                  return (0, n.d1)(e);
                }
              },
              (e) => (0, n.d1)(e),
            );
        }
        return (0, n.Ue)((n, h) => {
          const c = new x.default({ id: e, portal: o }).load();
          a.C.applicationCache && a.C.applicationCache.setLayerInfo(e + ':' + o.url, c),
            c.then(
              (e) => {
                try {
                  const a = new y.default({ url: (0, l.a7)(e.url) + '/' + t, outFields: ['*'] });
                  n(J(a, r, i, s, u, d));
                } catch (e) {
                  h(e);
                }
              },
              (t) => {
                a.C.applicationCache && a.C.applicationCache.clearLayerInfo(e + ':' + o.url), h(t);
              },
            );
        });
      }
      var ie = Object.freeze({
        __proto__: null,
        initialiseMetaDataCache: function () {
          null === a.C.applicationCache && (a.C.applicationCache = new a.C());
        },
        constructFeatureSetFromUrl: Q,
        constructFeatureSet: J,
        constructAssociationMetaDataFeatureSetFromUrl: H,
        constructFeatureSetFromRelationship: X,
        createFeatureSetCollectionFromMap: function (e, t, r = null, i = null) {
          return new $(e, t, r, i);
        },
        createFeatureSetCollectionFromService: function (e, t, r = null, i = null) {
          return new Y(e, t, r, i);
        },
        getPortal: ee,
        lookupUser: te,
        constructFeatureSetFromPortalItem: re,
      });
    },
    85557: (e, t, r) => {
      'use strict';
      r.d(t, { m: () => n });
      var i = r(53785),
        s = r(89623);
      const n = {
        inches: (0, i.c)(1, 'meters', 'inches'),
        feet: (0, i.c)(1, 'meters', 'feet'),
        'us-feet': (0, i.c)(1, 'meters', 'us-feet'),
        yards: (0, i.c)(1, 'meters', 'yards'),
        miles: (0, i.c)(1, 'meters', 'miles'),
        'nautical-miles': (0, i.c)(1, 'meters', 'nautical-miles'),
        millimeters: (0, i.c)(1, 'meters', 'millimeters'),
        centimeters: (0, i.c)(1, 'meters', 'centimeters'),
        decimeters: (0, i.c)(1, 'meters', 'decimeters'),
        meters: (0, i.c)(1, 'meters', 'meters'),
        kilometers: (0, i.c)(1, 'meters', 'kilometers'),
        'decimal-degrees': 1 / (0, i.l)(1, 'meters', s.e.radius),
      };
    },
    55823: (e, t, r) => {
      'use strict';
      r.d(t, { a: () => s });
      var i = r(92847);
      function s(e, t, r) {
        if (!r || !r.features || !r.hasZ) return;
        const s = (0, i.g)(r.geometryType, t, e.outSpatialReference);
        if (s) for (const e of r.features) s(e.geometry);
      }
    },
    42788: (e, t, r) => {
      'use strict';
      r.d(t, { g: () => s });
      let i = 0;
      function s() {
        return ++i;
      }
    },
    74057: (e, t, r) => {
      'use strict';
      r.d(t, {
        PR: () => F,
        Lq: () => f,
        Km: () => y,
        cM: () => _,
        ap: () => g,
        V3: () => b,
        B3: () => p,
      });
      var i = r(48027),
        s = r(23761),
        n = r(48190),
        a = r(92143),
        l = r(76506),
        o = r(85557),
        u = r(52228);
      r(54174),
        r(82426),
        r(91306),
        r(31450),
        r(71552),
        r(40642),
        r(74569),
        r(21801),
        r(34250),
        r(86656),
        r(22723),
        r(17533),
        r(81172),
        r(73796),
        r(74673),
        r(21972),
        r(23639),
        r(91055),
        r(27794),
        r(6906),
        r(50406),
        r(60991),
        r(26341),
        r(97714),
        r(60947),
        r(2906),
        r(91597),
        r(86787),
        r(35132),
        r(89623),
        r(84069),
        r(44567),
        r(98380),
        r(92896),
        r(22781),
        r(57251),
        r(32422),
        r(86748),
        r(15324),
        r(76996),
        r(14249),
        r(9801),
        r(53523),
        r(59465),
        r(42911),
        r(46826),
        r(45433),
        r(60217),
        r(29107),
        r(30574),
        r(2157),
        r(25977),
        r(7471),
        r(54414),
        r(1648),
        r(8925),
        r(33921),
        r(3482),
        r(45154),
        r(16769),
        r(55531),
        r(30582),
        r(593),
        r(85699),
        r(63136),
        r(96055),
        r(47776),
        r(18033),
        r(6331),
        r(62048),
        r(4292),
        r(75626),
        r(72652),
        r(29641),
        r(30493),
        r(70821),
        r(82673),
        r(34229),
        r(37029),
        r(96467),
        r(63571),
        r(30776),
        r(63130),
        r(25696),
        r(66396),
        r(42775),
        r(95834),
        r(34394),
        r(57150),
        r(76726),
        r(20444),
        r(76393),
        r(78548),
        r(2497),
        r(49906),
        r(46527),
        r(48649),
        r(9960),
        r(3101),
        r(5853),
        r(39141),
        r(32101),
        r(38742),
        r(48243),
        r(34635),
        r(10401),
        r(49900),
        r(66284),
        r(82058),
        r(88762),
        r(73173),
        r(22739),
        r(20543),
        r(67477),
        r(78533),
        r(74653),
        r(91091),
        r(58943),
        r(70737),
        r(8487),
        r(17817),
        r(90814),
        r(15459),
        r(61847),
        r(16796),
        r(16955),
        r(22401),
        r(77894),
        r(55187),
        r(8586),
        r(44509),
        r(69814),
        r(11305),
        r(62259),
        r(44790),
        r(5909),
        r(60669),
        r(48208),
        r(51589),
        r(53785),
        r(95587);
      const d = a.L.getLogger('esri.renderers.visualVariables.support.visualVariableUtils'),
        h = new s.Z(),
        c = Math.PI,
        p = /^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i;
      function f(e, t, r) {
        const s =
          'visualVariables' in e && e.visualVariables
            ? e.visualVariables.filter((e) => 'color' === e.type)[0]
            : e;
        if (!s) return;
        if ('esri.renderers.visualVariables.ColorVariable' !== s.declaredClass)
          return void d.warn(
            'The visualVariable should be an instance of esri.renderers.visualVariables.ColorVariable',
          );
        const n = 'number' == typeof t,
          a = n ? null : t,
          o = a && a.attributes;
        let u = n ? t : null;
        const h = s.field,
          { ipData: c, hasExpression: p } = s.cache;
        let f = s.cache.compiledFunc;
        if (!h && !p) {
          const e = s.stops;
          return e && e[0] && e[0].color;
        }
        if ('number' != typeof u)
          if (p) {
            if (!(0, l.i)(r) || !(0, l.i)(r.arcade))
              return void d.error('Use of arcade expressions requires an arcade context');
            const e = {
                viewingMode: r.viewingMode,
                scale: r.scale,
                spatialReference: r.spatialReference,
              },
              t = r.arcade.arcadeUtils,
              i = t.getViewInfo(e),
              n = t.createExecContext(a, i);
            if (!f) {
              const e = t.createSyntaxTree(s.valueExpression);
              (f = t.createFunction(e)), (s.cache.compiledFunc = f);
            }
            u = t.executeFunction(f, n);
          } else o && (u = o[h]);
        const y = s.normalizationField,
          _ = o ? parseFloat(o[y]) : void 0;
        if (null != u && (!y || n || (!isNaN(_) && 0 !== _))) {
          isNaN(_) || n || (u /= _);
          const e = S(u, c);
          if (e) {
            const t = e[0],
              n = e[1],
              a =
                t === n
                  ? s.stops[t].color
                  : i.Z.blendColors(
                      s.stops[t].color,
                      s.stops[n].color,
                      e[2],
                      (0, l.i)(r) ? r.color : void 0,
                    );
            return new i.Z(a);
          }
        }
      }
      function y(e, t, r) {
        const i =
          'visualVariables' in e && e.visualVariables
            ? e.visualVariables.filter((e) => 'opacity' === e.type)[0]
            : e;
        if (!i) return;
        if ('esri.renderers.visualVariables.OpacityVariable' !== i.declaredClass)
          return void d.warn(
            'The visualVariable should be an instance of esri.renderers.visualVariables.OpacityVariable',
          );
        const s = 'number' == typeof t,
          n = s ? null : t,
          a = n && n.attributes;
        let o = s ? t : null;
        const u = i.field,
          { ipData: h, hasExpression: c } = i.cache;
        let p = i.cache.compiledFunc;
        if (!u && !c) {
          const e = i.stops;
          return e && e[0] && e[0].opacity;
        }
        if ('number' != typeof o)
          if (c) {
            if ((0, l.b)(r) || (0, l.b)(r.arcade))
              return void d.error('Use of arcade expressions requires an arcade context');
            const e = {
                viewingMode: r.viewingMode,
                scale: r.scale,
                spatialReference: r.spatialReference,
              },
              t = r.arcade.arcadeUtils,
              s = t.getViewInfo(e),
              a = t.createExecContext(n, s);
            if (!p) {
              const e = t.createSyntaxTree(i.valueExpression);
              (p = t.createFunction(e)), (i.cache.compiledFunc = p);
            }
            o = t.executeFunction(p, a);
          } else a && (o = a[u]);
        const f = i.normalizationField,
          y = a ? parseFloat(a[f]) : void 0;
        if (null != o && (!f || s || (!isNaN(y) && 0 !== y))) {
          isNaN(y) || s || (o /= y);
          const e = S(o, h);
          if (e) {
            const t = e[0],
              r = e[1];
            if (t === r) return i.stops[t].opacity;
            {
              const s = i.stops[t].opacity;
              return s + (i.stops[r].opacity - s) * e[2];
            }
          }
        }
      }
      function _(e, t, r) {
        const i =
          'visualVariables' in e && e.visualVariables
            ? e.visualVariables.filter((e) => 'rotation' === e.type)[0]
            : e;
        if (!i) return;
        if ('esri.renderers.visualVariables.RotationVariable' !== i.declaredClass)
          return void d.warn(
            'The visualVariable should be an instance of esri.renderers.visualVariables.RotationVariable',
          );
        const s = i.axis || 'heading',
          n = 'heading' === s && 'arithmetic' === i.rotationType ? 90 : 0,
          a = 'heading' === s && 'arithmetic' === i.rotationType ? -1 : 1,
          o = 'number' == typeof t ? null : t,
          u = o && o.attributes,
          h = i.field,
          { hasExpression: c } = i.cache;
        let p = i.cache.compiledFunc,
          f = 0;
        if (!h && !c) return f;
        if (c) {
          if ((0, l.b)(r) || (0, l.b)(r.arcade))
            return void d.error('Use of arcade expressions requires an arcade context');
          const e = {
              viewingMode: r.viewingMode,
              scale: r.scale,
              spatialReference: r.spatialReference,
            },
            t = r.arcade.arcadeUtils,
            s = t.getViewInfo(e),
            n = t.createExecContext(o, s);
          if (!p) {
            const e = t.createSyntaxTree(i.valueExpression);
            (p = t.createFunction(e)), (i.cache.compiledFunc = p);
          }
          f = t.executeFunction(p, n);
        } else u && (f = u[h] || 0);
        return (f = 'number' != typeof f || isNaN(f) ? null : n + a * f), f;
      }
      function g(e, t, r) {
        const i =
          'visualVariables' in e && e.visualVariables
            ? e.visualVariables.filter((e) => 'size' === e.type)[0]
            : e;
        if (!i) return;
        if ('esri.renderers.visualVariables.SizeVariable' !== i.declaredClass)
          return void d.warn(
            'The visualVariable should be an instance of esri.renderers.visualVariables.SizeVariable',
          );
        const s = (function (e, t, r, i, s) {
          switch (t.transformationType) {
            case 'additive':
              return (function (e, t, r, i) {
                return e + (m(t.minSize, r, i) || t.minDataValue);
              })(e, t, r, i);
            case 'constant':
              return (function (e, t, r) {
                const i = e.stops;
                let s = i && i.length && i[0].size;
                return null == s && (s = e.minSize), m(s, t, r);
              })(t, r, i);
            case 'clamped-linear':
              return (function (e, t, r, i) {
                const s = (e - t.minDataValue) / (t.maxDataValue - t.minDataValue),
                  n = m(t.minSize, r, i),
                  a = m(t.maxSize, r, i),
                  o = (0, l.i)(i) ? i.shape : void 0;
                if (e <= t.minDataValue) return n;
                if (e >= t.maxDataValue) return a;
                if ('area' === t.scaleBy && o) {
                  const e = 'circle' === o,
                    t = e ? c * (n / 2) ** 2 : n * n,
                    r = t + s * ((e ? c * (a / 2) ** 2 : a * a) - t);
                  return e ? 2 * Math.sqrt(r / c) : Math.sqrt(r);
                }
                return n + s * (a - n);
              })(e, t, r, i);
            case 'proportional':
              return (function (e, t, r, i) {
                const s = (0, l.i)(i) ? i.shape : void 0,
                  n = e / t.minDataValue,
                  a = m(t.minSize, r, i),
                  o = m(t.maxSize, r, i);
                let u = null;
                return (
                  (u =
                    'circle' === s
                      ? 2 * Math.sqrt(n * (a / 2) ** 2)
                      : 'square' === s || 'diamond' === s || 'image' === s
                      ? Math.sqrt(n * a ** 2)
                      : n * a),
                  w(u, a, o)
                );
              })(e, t, r, i);
            case 'stops':
              return (function (e, t, r, i, s) {
                const [n, a, l] = S(e, s);
                if (n === a) return m(t.stops[n].size, r, i);
                {
                  const e = m(t.stops[n].size, r, i);
                  return e + (m(t.stops[a].size, r, i) - e) * l;
                }
              })(e, t, r, i, s);
            case 'real-world-size':
              return (function (e, t, r, i) {
                const s = ((0, l.i)(i) && i.resolution ? i.resolution : 1) * o.m[t.valueUnit],
                  n = m(t.minSize, r, i),
                  a = m(t.maxSize, r, i),
                  { valueRepresentation: u } = t;
                let d = null;
                return (
                  (d =
                    'area' === u
                      ? (2 * Math.sqrt(e / c)) / s
                      : 'radius' === u || 'distance' === u
                      ? (2 * e) / s
                      : e / s),
                  w(d, n, a)
                );
              })(e, t, r, i);
            case 'identity':
              return e;
            case 'unknown':
              return null;
          }
        })(
          (function (e, t, r) {
            const i = 'number' == typeof t,
              s = i ? null : t,
              n = s && s.attributes;
            let a = i ? t : null;
            const { isScaleDriven: o } = e.cache;
            let h = e.cache.compiledFunc;
            if (o) {
              const t = (0, l.i)(r) ? r.scale : void 0,
                i = (0, l.i)(r) ? r.view : void 0;
              a =
                null == t || '3d' === i
                  ? (function (e) {
                      let t = null,
                        r = null;
                      const i = e.stops;
                      return (
                        i
                          ? ((t = i[0].value), (r = i[i.length - 1].value))
                          : ((t = e.minDataValue || 0), (r = e.maxDataValue || 0)),
                        (t + r) / 2
                      );
                    })(e)
                  : t;
            } else if (!i)
              switch (e.inputValueType) {
                case 'expression': {
                  if ((0, l.b)(r) || (0, l.b)(r.arcade))
                    return void d.error('Use of arcade expressions requires an arcade context');
                  const t = {
                      viewingMode: r.viewingMode,
                      scale: r.scale,
                      spatialReference: r.spatialReference,
                    },
                    i = r.arcade.arcadeUtils,
                    n = i.getViewInfo(t),
                    o = i.createExecContext(s, n);
                  if (!h) {
                    const t = i.createSyntaxTree(e.valueExpression);
                    (h = i.createFunction(t)), (e.cache.compiledFunc = h);
                  }
                  a = i.executeFunction(h, o);
                  break;
                }
                case 'field':
                  n && (a = n[e.field]);
                  break;
                case 'unknown':
                  a = null;
              }
            if (!(0, u.b)(a)) return null;
            if (i || !e.normalizationField) return a;
            const c = n ? parseFloat(n[e.normalizationField]) : null;
            return (0, u.b)(c) && 0 !== c ? a / c : null;
          })(i, t, r),
          i,
          t,
          r,
          i.cache.ipData,
        );
        return null == s || isNaN(s) ? 0 : s;
      }
      function m(e, t, r) {
        return null == e ? null : (0, u.i)(e) ? g(e, t, r) : (0, u.b)(e) ? e : null;
      }
      function w(e, t, r) {
        return (0, u.b)(r) && e > r ? r : (0, u.b)(t) && e < t ? t : e;
      }
      function b(e, t, r) {
        const { isScaleDriven: i } = e.cache;
        if (!((i && '3d' === r) || t)) return null;
        const s = { scale: t, view: r };
        let n = m(e.minSize, h, s),
          a = m(e.maxSize, h, s);
        if (null != n || null != a) {
          if (n > a) {
            const e = a;
            (a = n), (n = e);
          }
          return { minSize: n, maxSize: a };
        }
      }
      function S(e, t) {
        if (!t) return;
        let r = 0,
          i = t.length - 1;
        return (
          t.some((t, s) => (e < t ? ((i = s), !0) : ((r = s), !1))),
          [r, i, (e - t[r]) / (t[i] - t[r])]
        );
      }
      function F(e, t, r) {
        const i = ['proportional', 'proportional', 'proportional'];
        for (const s of e) {
          const e = s.useSymbolValue ? 'symbol-value' : g(s, t, r);
          switch (s.axis) {
            case 'width':
              i[0] = e;
              break;
            case 'depth':
              i[1] = e;
              break;
            case 'height':
              i[2] = e;
              break;
            case 'width-and-depth':
              (i[0] = e), (i[1] = e);
              break;
            case 'all':
            case void 0:
            case null:
              (i[0] = e), (i[1] = e), (i[2] = e);
              break;
            default:
              (0, n.n)(s.axis);
          }
        }
        return i;
      }
    },
    92847: (e, t, r) => {
      'use strict';
      r.d(t, { g: () => a, u: () => o });
      var i = r(76506),
        s = r(53785),
        n = r(60947);
      function a(e, t, r) {
        if ((0, i.b)(t) || (0, i.b)(r) || r.vcsWkid || (0, n.e)(t, r)) return null;
        const a = (0, s.d)(t) / (0, s.d)(r);
        if (1 === a) return null;
        switch (e) {
          case 'point':
          case 'esriGeometryPoint':
            return (e) => {
              return (r = a), void ((t = e) && null != t.z && (t.z *= r));
              var t, r;
            };
          case 'polyline':
          case 'esriGeometryPolyline':
            return (e) =>
              (function (e, t) {
                if (e) for (const r of e.paths) for (const e of r) e.length > 2 && (e[2] *= t);
              })(e, a);
          case 'polygon':
          case 'esriGeometryPolygon':
            return (e) =>
              (function (e, t) {
                if (e) for (const r of e.rings) for (const e of r) e.length > 2 && (e[2] *= t);
              })(e, a);
          case 'multipoint':
          case 'esriGeometryMultipoint':
            return (e) =>
              (function (e, t) {
                if (e) for (const r of e.points) r.length > 2 && (r[2] *= t);
              })(e, a);
          default:
            return null;
        }
      }
      function l(e, t, r) {
        if (null == e.hasM || e.hasZ)
          for (const e of t) for (const t of e) t.length > 2 && (t[2] *= r);
      }
      function o(e, t, r) {
        if ((!e && !t) || !r) return;
        const i = (0, s.d)(r);
        u(e, r, i), u(t, r, i);
      }
      function u(e, t, r) {
        if (e) for (const i of e) d(i.geometry, t, r);
      }
      function d(e, t, r) {
        if (!e || !e.spatialReference || (0, n.e)(e.spatialReference, t)) return;
        const i = (0, s.d)(e.spatialReference) / r;
        if (1 !== i)
          if ('x' in e) null != e.z && (e.z *= i);
          else if ('rings' in e) l(e, e.rings, i);
          else if ('paths' in e) l(e, e.paths, i);
          else if ('points' in e && (null == e.hasM || e.hasZ))
            for (const t of e.points) t.length > 2 && (t[2] *= i);
      }
    },
    82933: (e, t, r) => {
      'use strict';
      r.d(t, { Z: () => d });
      var i = r(29768),
        s = r(21972),
        n = r(15324),
        a = r(76506),
        l = r(34250),
        o = r(17533);
      r(23639),
        r(92143),
        r(31450),
        r(71552),
        r(40642),
        r(86656),
        r(22723),
        r(91055),
        r(27794),
        r(6906),
        r(50406),
        r(60991),
        r(81172),
        r(91306),
        r(76996);
      let u = class extends s.Z {
        constructor(e) {
          super(e), (this._groups = new Map());
        }
        destroy() {
          this.removeAll();
        }
        get size() {
          let e = 0;
          return (
            this._groups.forEach((t) => {
              e += t.length;
            }),
            e
          );
        }
        add(e, t) {
          if (!this._isHandle(e) && !Array.isArray(e) && !n.Z.isCollection(e)) return this;
          const r = this._getOrCreateGroup(t);
          return (
            Array.isArray(e) || n.Z.isCollection(e)
              ? e.forEach((e) => this._isHandle(e) && r.push(e))
              : r.push(e),
            this.notifyChange('size'),
            this
          );
        }
        forEach(e, t) {
          if ('function' == typeof e) this._groups.forEach((t) => t.forEach(e));
          else {
            const r = this._getGroup(e);
            r && t && r.forEach(t);
          }
        }
        has(e) {
          return this._groups.has(this._ensureGroupKey(e));
        }
        remove(e) {
          if (Array.isArray(e) || n.Z.isCollection(e)) return e.forEach(this.remove, this), this;
          if (!this.has(e)) return this;
          const t = this._getGroup(e);
          for (let e = 0; e < t.length; e++) t[e].remove();
          return this._deleteGroup(e), this.notifyChange('size'), this;
        }
        removeAll() {
          return (
            this._groups.forEach((e) => {
              for (let t = 0; t < e.length; t++) e[t].remove();
            }),
            this._groups.clear(),
            this.notifyChange('size'),
            this
          );
        }
        _isHandle(e) {
          return e && !!e.remove;
        }
        _getOrCreateGroup(e) {
          if (this.has(e)) return this._getGroup(e);
          const t = [];
          return this._groups.set(this._ensureGroupKey(e), t), t;
        }
        _getGroup(e) {
          return (0, a.a)(this._groups.get(this._ensureGroupKey(e)));
        }
        _deleteGroup(e) {
          return this._groups.delete(this._ensureGroupKey(e));
        }
        _ensureGroupKey(e) {
          return e || '_default_';
        }
      };
      (0, i._)([(0, l.Cb)({ readOnly: !0 })], u.prototype, 'size', null),
        (u = (0, i._)([(0, o.j)('esri.core.Handles')], u));
      const d = u;
    },
    46495: (e, t, r) => {
      'use strict';
      r.d(t, { Z: () => c });
      var i = r(29768),
        s = r(57251),
        n = r(74673),
        a = r(76506),
        l = r(34250),
        o = (r(91306), r(92143), r(17533)),
        u = r(2906);
      r(71552),
        r(21972),
        r(23639),
        r(86656),
        r(22723),
        r(91055),
        r(27794),
        r(6906),
        r(50406),
        r(60991),
        r(81172),
        r(31450),
        r(40642),
        r(26341);
      const d = new s.J({
        esriFeatureEditToolAutoCompletePolygon: 'auto-complete-polygon',
        esriFeatureEditToolCircle: 'circle',
        esriFeatureEditToolEllipse: 'ellipse',
        esriFeatureEditToolFreehand: 'freehand',
        esriFeatureEditToolLine: 'line',
        esriFeatureEditToolNone: 'none',
        esriFeatureEditToolPoint: 'point',
        esriFeatureEditToolPolygon: 'polygon',
        esriFeatureEditToolRectangle: 'rectangle',
        esriFeatureEditToolArrow: 'arrow',
        esriFeatureEditToolTriangle: 'triangle',
        esriFeatureEditToolLeftArrow: 'left-arrow',
        esriFeatureEditToolRightArrow: 'right-arrow',
        esriFeatureEditToolUpArrow: 'up-arrow',
        esriFeatureEditToolDownArrow: 'down-arrow',
      });
      let h = class extends n.a {
        constructor(e) {
          super(e),
            (this.name = null),
            (this.description = null),
            (this.drawingTool = null),
            (this.prototype = null),
            (this.thumbnail = null);
        }
        writeDrawingTool(e, t) {
          t.drawingTool = d.toJSON(e);
        }
        writePrototype(e, t) {
          t.prototype = (0, a.yd)((0, a.d9)(e), !0);
        }
        writeThumbnail(e, t) {
          t.thumbnail = (0, a.yd)((0, a.d9)(e));
        }
      };
      (0, i._)([(0, l.Cb)({ json: { write: !0 } })], h.prototype, 'name', void 0),
        (0, i._)([(0, l.Cb)({ json: { write: !0 } })], h.prototype, 'description', void 0),
        (0, i._)(
          [(0, l.Cb)({ json: { read: d.read, write: d.write } })],
          h.prototype,
          'drawingTool',
          void 0,
        ),
        (0, i._)([(0, u.w)('drawingTool')], h.prototype, 'writeDrawingTool', null),
        (0, i._)([(0, l.Cb)({ json: { write: !0 } })], h.prototype, 'prototype', void 0),
        (0, i._)([(0, u.w)('prototype')], h.prototype, 'writePrototype', null),
        (0, i._)([(0, l.Cb)({ json: { write: !0 } })], h.prototype, 'thumbnail', void 0),
        (0, i._)([(0, u.w)('thumbnail')], h.prototype, 'writeThumbnail', null),
        (h = (0, i._)([(0, o.j)('esri.layers.support.FeatureTemplate')], h));
      const c = h;
    },
    78303: (e, t, r) => {
      'use strict';
      r.d(t, { Z: () => y });
      var i = r(29768),
        s = r(74673),
        n = r(76506),
        a = r(34250),
        l = (r(91306), r(92143), r(97714)),
        o = r(17533),
        u = r(2906),
        d = (r(9801), r(46495)),
        h = r(46826),
        c = r(53523),
        p = r(45433);
      r(21972),
        r(23639),
        r(86656),
        r(22723),
        r(91055),
        r(27794),
        r(6906),
        r(50406),
        r(60991),
        r(81172),
        r(71552),
        r(31450),
        r(40642),
        r(26341),
        r(42911),
        r(57251),
        r(59465);
      let f = class extends s.a {
        constructor(e) {
          super(e),
            (this.id = null),
            (this.name = null),
            (this.domains = null),
            (this.templates = null);
        }
        readDomains(e) {
          const t = {};
          for (const r in e)
            if (e.hasOwnProperty(r)) {
              const i = e[r];
              switch (i.type) {
                case 'range':
                  t[r] = p.Z.fromJSON(i);
                  break;
                case 'codedValue':
                  t[r] = c.Z.fromJSON(i);
                  break;
                case 'inherited':
                  t[r] = h.Z.fromJSON(i);
              }
            }
          return t;
        }
        writeDomains(e, t) {
          const r = {};
          for (const t in e) e.hasOwnProperty(t) && (r[t] = e[t] && e[t].toJSON());
          (0, n.yd)(r), (t.domains = r);
        }
        readTemplates(e) {
          return e && e.map((e) => new d.Z(e));
        }
        writeTemplates(e, t) {
          t.templates = e && e.map((e) => e.toJSON());
        }
      };
      (0, i._)([(0, a.Cb)({ json: { write: !0 } })], f.prototype, 'id', void 0),
        (0, i._)([(0, a.Cb)({ json: { write: !0 } })], f.prototype, 'name', void 0),
        (0, i._)([(0, a.Cb)({ json: { write: !0 } })], f.prototype, 'domains', void 0),
        (0, i._)([(0, l.r)('domains')], f.prototype, 'readDomains', null),
        (0, i._)([(0, u.w)('domains')], f.prototype, 'writeDomains', null),
        (0, i._)([(0, a.Cb)({ json: { write: !0 } })], f.prototype, 'templates', void 0),
        (0, i._)([(0, l.r)('templates')], f.prototype, 'readTemplates', null),
        (0, i._)([(0, u.w)('templates')], f.prototype, 'writeTemplates', null),
        (f = (0, i._)([(0, o.j)('esri.layers.support.FeatureType')], f));
      const y = f;
    },
    87258: (e, t, r) => {
      'use strict';
      r.r(t), r.d(t, { default: () => m });
      var i = r(29768),
        s = r(74569),
        n = r(23761),
        a = r(57251),
        l = r(74673),
        o = r(76506),
        u = r(34250),
        d = (r(91306), r(92143), r(97714)),
        h = r(17533),
        c = r(2906),
        p = r(60947),
        f = r(32422),
        y = r(97546);
      r(21801),
        r(40642),
        r(71552),
        r(73796),
        r(21972),
        r(23639),
        r(86656),
        r(22723),
        r(91055),
        r(27794),
        r(6906),
        r(50406),
        r(60991),
        r(81172),
        r(31450),
        r(26341),
        r(91597),
        r(86787),
        r(35132),
        r(89623),
        r(84069),
        r(44567),
        r(98380),
        r(92896),
        r(22781),
        r(86748),
        r(15324),
        r(76996),
        r(14249),
        r(9801),
        r(53523),
        r(59465),
        r(42911),
        r(46826),
        r(45433),
        r(60217),
        r(29107),
        r(30574),
        r(2157),
        r(25977),
        r(7471),
        r(54414),
        r(1648),
        r(8925),
        r(33921),
        r(3482),
        r(45154),
        r(16769),
        r(55531),
        r(30582),
        r(593),
        r(85699),
        r(63136),
        r(96055),
        r(47776),
        r(18033),
        r(6331),
        r(62048),
        r(4292),
        r(75626),
        r(72652),
        r(29641),
        r(30493),
        r(70821),
        r(82673),
        r(34229),
        r(37029),
        r(96467),
        r(63571),
        r(30776),
        r(48027),
        r(54174),
        r(82426),
        r(63130),
        r(25696),
        r(66396),
        r(42775),
        r(95834),
        r(34394),
        r(57150),
        r(76726),
        r(20444),
        r(76393),
        r(78548),
        r(2497),
        r(49906),
        r(46527),
        r(48649),
        r(9960),
        r(3101),
        r(5853),
        r(39141),
        r(32101),
        r(38742),
        r(48243),
        r(34635),
        r(10401),
        r(49900),
        r(66284),
        r(82058),
        r(88762),
        r(73173),
        r(22739),
        r(20543),
        r(67477),
        r(78533),
        r(74653),
        r(91091),
        r(58943),
        r(70737),
        r(8487),
        r(17817),
        r(90814),
        r(15459),
        r(61847),
        r(16796),
        r(16955),
        r(22401),
        r(77894),
        r(55187),
        r(8586),
        r(44509),
        r(69814),
        r(11305),
        r(62259),
        r(44790),
        r(5909),
        r(60669),
        r(48208),
        r(51589),
        r(54732);
      const _ = new a.J({
        esriGeometryPoint: 'point',
        esriGeometryMultipoint: 'multipoint',
        esriGeometryPolyline: 'polyline',
        esriGeometryPolygon: 'polygon',
        esriGeometryEnvelope: 'extent',
        mesh: 'mesh',
        '': null,
      });
      let g = class extends l.a {
        constructor(e) {
          super(e),
            (this.displayFieldName = null),
            (this.exceededTransferLimit = !1),
            (this.features = []),
            (this.fields = null),
            (this.geometryType = null),
            (this.hasM = !1),
            (this.hasZ = !1),
            (this.queryGeometry = null),
            (this.spatialReference = null);
        }
        readFeatures(e, t) {
          const r = p.Z.fromJSON(t.spatialReference),
            i = [];
          for (let t = 0; t < e.length; t++) {
            const s = e[t],
              a = n.Z.fromJSON(s),
              l = s.geometry && s.geometry.spatialReference;
            (0, o.i)(a.geometry) && !l && (a.geometry.spatialReference = r), i.push(a);
          }
          return i;
        }
        writeGeometryType(e, t, r, i) {
          if (e) return void _.write(e, t, r, i);
          const { features: s } = this;
          if (s)
            for (const e of s)
              if (e && (0, o.i)(e.geometry)) return void _.write(e.geometry.type, t, r, i);
        }
        readQueryGeometry(e, t) {
          if (!e) return null;
          const r = !!e.spatialReference,
            i = (0, f.im)(e);
          return (
            !r && t.spatialReference && (i.spatialReference = p.Z.fromJSON(t.spatialReference)), i
          );
        }
        writeSpatialReference(e, t) {
          if (e) return void (t.spatialReference = e.toJSON());
          const { features: r } = this;
          if (r)
            for (const e of r)
              if (e && (0, o.i)(e.geometry) && e.geometry.spatialReference)
                return void (t.spatialReference = e.geometry.spatialReference.toJSON());
        }
        toJSON(e) {
          const t = this.write(null);
          if (t.features && Array.isArray(e) && e.length > 0)
            for (let r = 0; r < t.features.length; r++) {
              const i = t.features[r];
              if (i.geometry) {
                const t = e && e[r];
                i.geometry = (t && t.toJSON()) || i.geometry;
              }
            }
          return t;
        }
        quantize(e) {
          const {
              scale: [t, r],
              translate: [i, s],
            } = e,
            n = this.features,
            a = this._getQuantizationFunction(
              this.geometryType,
              (e) => Math.round((e - i) / t),
              (e) => Math.round((s - e) / r),
            );
          for (let e = 0, t = n.length; e < t; e++)
            a((0, o.u)(n[e].geometry)) || (n.splice(e, 1), e--, t--);
          return (this.transform = e), this;
        }
        unquantize() {
          const { geometryType: e, features: t, transform: r } = this;
          if (!r) return this;
          const {
              translate: [i, s],
              scale: [n, a],
            } = r,
            l = this._getHydrationFunction(
              e,
              (e) => e * n + i,
              (e) => s - e * a,
            );
          for (const { geometry: e } of t) (0, o.i)(e) && l(e);
          return (this.transform = null), this;
        }
        _quantizePoints(e, t, r) {
          let i, s;
          const n = [];
          for (let a = 0, l = e.length; a < l; a++) {
            const l = e[a];
            if (a > 0) {
              const e = t(l[0]),
                a = r(l[1]);
              (e === i && a === s) || (n.push([e - i, a - s]), (i = e), (s = a));
            } else (i = t(l[0])), (s = r(l[1])), n.push([i, s]);
          }
          return n.length > 0 ? n : null;
        }
        _getQuantizationFunction(e, t, r) {
          return 'point' === e
            ? (e) => ((e.x = t(e.x)), (e.y = r(e.y)), e)
            : 'polyline' === e || 'polygon' === e
            ? (e) => {
                const i = (0, f.oU)(e) ? e.rings : e.paths,
                  s = [];
                for (let e = 0, n = i.length; e < n; e++) {
                  const n = i[e],
                    a = this._quantizePoints(n, t, r);
                  a && s.push(a);
                }
                return s.length > 0 ? ((0, f.oU)(e) ? (e.rings = s) : (e.paths = s), e) : null;
              }
            : 'multipoint' === e
            ? (e) => {
                const i = this._quantizePoints(e.points, t, r);
                return i.length > 0 ? ((e.points = i), e) : null;
              }
            : 'extent' === e
            ? (e) => e
            : null;
        }
        _getHydrationFunction(e, t, r) {
          return 'point' === e
            ? (e) => {
                (e.x = t(e.x)), (e.y = r(e.y));
              }
            : 'polyline' === e || 'polygon' === e
            ? (e) => {
                const i = (0, f.oU)(e) ? e.rings : e.paths;
                let s, n;
                for (let e = 0, a = i.length; e < a; e++) {
                  const a = i[e];
                  for (let e = 0, i = a.length; e < i; e++) {
                    const i = a[e];
                    e > 0 ? ((s += i[0]), (n += i[1])) : ((s = i[0]), (n = i[1])),
                      (i[0] = t(s)),
                      (i[1] = r(n));
                  }
                }
              }
            : 'extent' === e
            ? (e) => {
                (e.xmin = t(e.xmin)),
                  (e.ymin = r(e.ymin)),
                  (e.xmax = t(e.xmax)),
                  (e.ymax = r(e.ymax));
              }
            : 'multipoint' === e
            ? (e) => {
                const i = e.points;
                let s, n;
                for (let e = 0, a = i.length; e < a; e++) {
                  const a = i[e];
                  e > 0 ? ((s += a[0]), (n += a[1])) : ((s = a[0]), (n = a[1])),
                    (a[0] = t(s)),
                    (a[1] = r(n));
                }
              }
            : void 0;
        }
      };
      (0, i._)(
        [(0, u.Cb)({ type: String, json: { write: !0 } })],
        g.prototype,
        'displayFieldName',
        void 0,
      ),
        (0, i._)(
          [
            (0, u.Cb)({
              type: Boolean,
              json: { write: { overridePolicy: (e) => ({ enabled: e }) } },
            }),
          ],
          g.prototype,
          'exceededTransferLimit',
          void 0,
        ),
        (0, i._)(
          [(0, u.Cb)({ type: [n.Z], json: { write: !0 } })],
          g.prototype,
          'features',
          void 0,
        ),
        (0, i._)([(0, d.r)('features')], g.prototype, 'readFeatures', null),
        (0, i._)([(0, u.Cb)({ type: [y.Z], json: { write: !0 } })], g.prototype, 'fields', void 0),
        (0, i._)(
          [
            (0, u.Cb)({
              type: ['point', 'multipoint', 'polyline', 'polygon', 'extent', 'mesh'],
              json: { read: { reader: _.read } },
            }),
          ],
          g.prototype,
          'geometryType',
          void 0,
        ),
        (0, i._)([(0, c.w)('geometryType')], g.prototype, 'writeGeometryType', null),
        (0, i._)(
          [
            (0, u.Cb)({
              type: Boolean,
              json: { write: { overridePolicy: (e) => ({ enabled: e }) } },
            }),
          ],
          g.prototype,
          'hasM',
          void 0,
        ),
        (0, i._)(
          [
            (0, u.Cb)({
              type: Boolean,
              json: { write: { overridePolicy: (e) => ({ enabled: e }) } },
            }),
          ],
          g.prototype,
          'hasZ',
          void 0,
        ),
        (0, i._)(
          [(0, u.Cb)({ types: s.qM, json: { write: !0 } })],
          g.prototype,
          'queryGeometry',
          void 0,
        ),
        (0, i._)([(0, d.r)('queryGeometry')], g.prototype, 'readQueryGeometry', null),
        (0, i._)(
          [(0, u.Cb)({ type: p.Z, json: { write: !0 } })],
          g.prototype,
          'spatialReference',
          void 0,
        ),
        (0, i._)([(0, c.w)('spatialReference')], g.prototype, 'writeSpatialReference', null),
        (0, i._)([(0, u.Cb)({ json: { write: !0 } })], g.prototype, 'transform', void 0),
        (g = (0, i._)([(0, h.j)('esri.rest.support.FeatureSet')], g)),
        (g.prototype.toJSON.isDefaultToJSON = !0),
        g || (g = {});
      const m = g;
    },
  },
]);
