(self.webpackChunkRemoteClient = self.webpackChunkRemoteClient || []).push([
  [2256],
  {
    72256: (e, t, r) => {
      'use strict';
      r.d(t, {
        C: () => h,
        E: () => G,
        F: () => B,
        I: () => c,
        S: () => Y,
        a: () => m,
        b: () => y,
        c: () => p,
        d: () => F,
        e: () => _,
        f: () => x,
        g: () => R,
        i: () => k,
        m: () => w,
        p: () => S,
        r: () => f,
        s: () => E,
        t: () => d,
      });
      var n = r(50406),
        s = r(1886),
        a = r(72274),
        i = r(42870),
        o = r(60947),
        l = r(1709);
      class u {
        constructor(e, t) {
          (this._lastId = -1), (this._progress = t), (this._parent = e);
        }
        reset() {
          this._lastId = -1;
        }
        nextBatch(e) {
          if (null !== this._parent._mainSetInUse)
            return this._parent._mainSetInUse.then(
              (t) => this.nextBatch(e),
              (t) => this.nextBatch(e),
            );
          const t = { returnpromise: null, hasset: !1 },
            r = [];
          return (
            (t.returnpromise = (0, n.Ue)((n, s) => {
              this._parent._getSet(this._progress).then(
                (a) => {
                  let i = a._known.length - 1;
                  if (
                    ('GETPAGES' === a._known[a._known.length - 1] && (i -= 1),
                    this._lastId + e > i &&
                      a._known.length > 0 &&
                      'GETPAGES' === a._known[a._known.length - 1])
                  )
                    this._parent
                      ._expandPagedSet(a, this._parent._maxQueryRate(), 0, 0, this._progress)
                      .then(
                        (r) => {
                          (t.hasset = !0),
                            (this._parent._mainSetInUse = null),
                            this.nextBatch(e).then(n, s);
                        },
                        (e) => {
                          (t.hasset = !0), (this._parent._mainSetInUse = null), s(e);
                        },
                      );
                  else {
                    if (i >= this._lastId + e || 0 === a._candidates.length) {
                      for (let t = 0; t < e; t++) {
                        const e = t + this._lastId + 1;
                        if (e >= a._known.length) break;
                        r[t] = a._known[e];
                      }
                      return (
                        (this._lastId += r.length),
                        0 === r.length &&
                          ((t.hasset = !0), (this._parent._mainSetInUse = null), n([])),
                        void this._parent._getFeatureBatch(r, this._progress).then(
                          (e) => {
                            (t.hasset = !0), (this._parent._mainSetInUse = null), n(e);
                          },
                          (e) => {
                            (t.hasset = !0), (this._parent._mainSetInUse = null), s(e);
                          },
                        )
                      );
                    }
                    this._parent
                      ._refineSetBlock(a, this._parent._maxProcessingRate(), this._progress)
                      .then(
                        () => {
                          (t.hasset = !0),
                            (this._parent._mainSetInUse = null),
                            this.nextBatch(e).then(n, s);
                        },
                        (e) => {
                          (t.hasset = !0), (this._parent._mainSetInUse = null), s(e);
                        },
                      );
                  }
                },
                (e) => {
                  (t.hasset = !0), (this._parent._mainSetInUse = null), s(e);
                },
              );
            })),
            !1 === t.hasset && ((this._parent._mainSetInUse = t.returnpromise), (t.hasset = !0)),
            t.returnpromise
          );
        }
        next() {
          if (null !== this._parent._mainSetInUse)
            return this._parent._mainSetInUse.then(
              (e) => this.next(),
              (e) => this.next(),
            );
          const e = { returnpromise: null, hasset: !1 };
          return (
            (e.returnpromise = (0, n.Ue)((t, r) => {
              this._parent._getSet(this._progress).then(
                (n) => {
                  this._lastId < n._known.length - 1
                    ? 'GETPAGES' === n._known[this._lastId + 1]
                      ? this._parent
                          ._expandPagedSet(n, this._parent._maxQueryRate(), 0, 0, this._progress)
                          .then(
                            (t) => (
                              (e.hasset = !0), (this._parent._mainSetInUse = null), this.next()
                            ),
                          )
                          .then(t, r)
                      : ((this._lastId += 1),
                        this._parent._getFeature(n, n._known[this._lastId], this._progress).then(
                          (r) => {
                            (e.hasset = !0), (this._parent._mainSetInUse = null), t(r);
                          },
                          (t) => {
                            (e.hasset = !0), (this._parent._mainSetInUse = null), r(t);
                          },
                        ))
                    : n._candidates.length > 0
                    ? this._parent
                        ._refineSetBlock(n, this._parent._maxProcessingRate(), this._progress)
                        .then(
                          () => {
                            (e.hasset = !0),
                              (this._parent._mainSetInUse = null),
                              this.next().then(t, r);
                          },
                          (t) => {
                            (e.hasset = !0), (this._parent._mainSetInUse = null), r(t);
                          },
                        )
                    : ((e.hasset = !0), (this._parent._mainSetInUse = null), t(null));
                },
                (t) => {
                  (e.hasset = !0), (this._parent._mainSetInUse = null), r(t);
                },
              );
            })),
            !1 === e.hasset && ((this._parent._mainSetInUse = e.returnpromise), (e.hasset = !0)),
            e.returnpromise
          );
        }
        count() {
          return -1 !== this._parent._totalCount
            ? (0, n.DB)(this._parent._totalCount)
            : this._parent
                ._getSet(this._progress)
                .then((e) => this._refineAllSets(e))
                .then(
                  (e) => (
                    (this._parent._totalCount = e._known.length),
                    (0, n.DB)(this._parent._totalCount)
                  ),
                );
        }
        _refineAllSets(e) {
          return e._known.length > 0 && 'GETPAGES' === e._known[e._known.length - 1]
            ? this._parent
                ._expandPagedSet(e, this._parent._maxQueryRate(), 0, 1, this._progress)
                .then((t) => this._refineAllSets(e))
                .then((e) => (0, n.DB)(e))
            : e._candidates.length > 0
            ? 'GETPAGES' === e._known[e._candidates.length - 1]
              ? this._parent
                  ._expandPagedSet(e, this._parent._maxQueryRate(), 0, 2, this._progress)
                  .then((t) => this._refineAllSets(e))
                  .then((e) => (0, n.DB)(e))
              : this._parent
                  ._refineSetBlock(e, this._parent._maxProcessingRate(), this._progress)
                  .then((e) => (e._candidates.length > 0 ? this._refineAllSets(e) : (0, n.DB)(e)))
            : (0, n.DB)(e);
        }
      }
      class c {
        constructor(e, t, r, n) {
          (this._candidates = null),
            (this._known = null),
            (this._lastFetchedIndex = 0),
            (this._ordered = !1),
            (this.pagesDefinition = null),
            (this._candidates = e),
            (this._known = t),
            (this._ordered = r),
            (this.pagesDefinition = n);
        }
      }
      class h {
        constructor() {
          (this._databaseTypeMetaData = {}), (this._layerInfo = {});
        }
        clearDatabaseType(e) {
          void 0 === this._databaseTypeMetaData[e] && delete this._databaseTypeMetaData[e];
        }
        getDatabaseType(e) {
          return 'MUSTBESET' === e || void 0 === this._databaseTypeMetaData[e]
            ? null
            : this._databaseTypeMetaData[e];
        }
        setDatabaseType(e, t) {
          this._databaseTypeMetaData[e] = t;
        }
        getLayerInfo(e) {
          return void 0 === this._layerInfo[e] ? null : this._layerInfo[e];
        }
        setLayerInfo(e, t) {
          this._layerInfo[e] = t;
        }
        clearLayerInfo(e) {
          void 0 !== this._layerInfo[e] && delete this._layerInfo[e];
        }
      }
      function d(e, t) {
        return g(e.parseTree, t, e.parameters);
      }
      function _(e, t, r) {
        return g(e, t, r);
      }
      function f(e, t, r, n) {
        return a.WhereClause.create(g(e.parseTree, s.a3.Standardised, e.parameters, t, r), n);
      }
      function p(e, t, r = 'AND') {
        return a.WhereClause.create(
          '((' + d(e, s.a3.Standardised) + ')' + r + '(' + d(t, s.a3.Standardised) + '))',
          e.fieldsIndex,
        );
      }
      function g(e, t, r, n = null, s = null) {
        let a, i, o, l;
        switch (e.type) {
          case 'interval':
            return F(g(e.value, t, r, n, s), e.qualifier, e.op);
          case 'case_expression': {
            let a = ' CASE ';
            'simple' === e.format && (a += g(e.operand, t, r, n, s));
            for (let i = 0; i < e.clauses.length; i++)
              a +=
                ' WHEN ' +
                g(e.clauses[i].operand, t, r, n, s) +
                ' THEN ' +
                g(e.clauses[i].value, t, r, n, s);
            return null !== e.else && (a += ' ELSE ' + g(e.else, t, r, n, s)), (a += ' END '), a;
          }
          case 'param': {
            const n = r[e.value.toLowerCase()];
            if ('string' == typeof n)
              return "'" + r[e.value.toLowerCase()].toString().replace(/'/g, "''") + "'";
            if (n instanceof Date) return y(n, t);
            if (n instanceof Array) {
              const e = [];
              for (let r = 0; r < n.length; r++)
                'string' == typeof n[r]
                  ? e.push("'" + n[r].toString().replace(/'/g, "''") + "'")
                  : n[r] instanceof Date
                  ? e.push(y(n[r], t))
                  : e.push(n[r].toString());
              return e;
            }
            return n.toString();
          }
          case 'expr_list':
            i = [];
            for (const a of e.value) i.push(g(a, t, r, n, s));
            return i;
          case 'unary_expr':
            return ' ( NOT ' + g(e.expr, t, r, n, s) + ' ) ';
          case 'binary_expr':
            switch (e.operator) {
              case 'AND':
                return ' (' + g(e.left, t, r, n, s) + ' AND ' + g(e.right, t, r, n, s) + ') ';
              case 'OR':
                return ' (' + g(e.left, t, r, n, s) + ' OR ' + g(e.right, t, r, n, s) + ') ';
              case 'IS':
                if ('null' !== e.right.type) throw new Error('Unsupported RHS for IS');
                return ' (' + g(e.left, t, r, n, s) + ' IS NULL )';
              case 'ISNOT':
                if ('null' !== e.right.type) throw new Error('Unsupported RHS for IS');
                return ' (' + g(e.left, t, r, n, s) + ' IS NOT NULL )';
              case 'IN':
                return (
                  (a = []),
                  'expr_list' === e.right.type
                    ? ((a = g(e.right, t, r, n, s)),
                      ' (' + g(e.left, t, r, n, s) + ' IN (' + a.join(',') + ')) ')
                    : ((l = g(e.right, t, r, n, s)),
                      l instanceof Array
                        ? ' (' + g(e.left, t, r, n, s) + ' IN (' + l.join(',') + ')) '
                        : ' (' + g(e.left, t, r, n, s) + ' IN (' + l + ')) ')
                );
              case 'NOT IN':
                return (
                  (a = []),
                  'expr_list' === e.right.type
                    ? ((a = g(e.right, t, r, n, s)),
                      ' (' + g(e.left, t, r, n, s) + ' NOT IN (' + a.join(',') + ')) ')
                    : ((l = g(e.right, t, r, n, s)),
                      l instanceof Array
                        ? ' (' + g(e.left, t, r, n, s) + ' NOT IN (' + l.join(',') + ')) '
                        : ' (' + g(e.left, t, r, n, s) + ' NOT IN (' + l + ')) ')
                );
              case 'BETWEEN':
                return (
                  (o = g(e.right, t, r, n, s)),
                  ' (' + g(e.left, t, r, n, s) + ' BETWEEN ' + o[0] + ' AND ' + o[1] + ' ) '
                );
              case 'NOTBETWEEN':
                return (
                  (o = g(e.right, t, r, n, s)),
                  ' (' + g(e.left, t, r, n, s) + ' NOT BETWEEN ' + o[0] + ' AND ' + o[1] + ' ) '
                );
              case 'LIKE':
                return '' !== e.escape
                  ? ' (' +
                      g(e.left, t, r, n, s) +
                      ' LIKE ' +
                      g(e.right, t, r, n, s) +
                      " ESCAPE '" +
                      e.escape +
                      "') "
                  : ' (' + g(e.left, t, r, n, s) + ' LIKE ' + g(e.right, t, r, n, s) + ') ';
              case 'NOT LIKE':
                return '' !== e.escape
                  ? ' (' +
                      g(e.left, t, r, n, s) +
                      ' NOT LIKE ' +
                      g(e.right, t, r, n, s) +
                      " ESCAPE '" +
                      e.escape +
                      "') "
                  : ' (' + g(e.left, t, r, n, s) + ' NOT LIKE ' + g(e.right, t, r, n, s) + ') ';
              case '<>':
              case '<':
              case '>':
              case '>=':
              case '<=':
              case '=':
              case '*':
              case '-':
              case '+':
              case '/':
                return (
                  ' (' +
                  g(e.left, t, r, n, s) +
                  ' ' +
                  e.operator +
                  ' ' +
                  g(e.right, t, r, n, 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 y(e.value, t);
          case 'number':
            return e.value.toString();
          case 'current_time':
            return w('date' === e.mode, t);
          case 'column_ref':
            return n && n.toLowerCase() === e.column.toLowerCase() ? '(' + s + ')' : e.column;
          case 'function': {
            const a = g(e.args, t, r, n, s);
            return m(e.name, a, t);
          }
        }
        throw new Error('Unsupported sql syntax ' + e.type);
      }
      function m(e, t, r) {
        switch (e.toLowerCase().trim()) {
          case 'abs':
            if (1 !== t.length) throw new Error('Invalid Parameter for call to ABS');
            return 'abs(' + t[0] + ')';
          case 'ceiling':
          case 'ceil':
            if (1 !== t.length) throw new Error('Invalid Parameter for call to CEILING');
            switch (r) {
              case s.a3.Standardised:
              case s.a3.StandardisedNoInterval:
              default:
                return 'CEILING(' + t[0] + ')';
            }
          case 'floor':
            if (1 !== t.length) throw new Error('Invalid Parameter for call to Floor');
            return 'FLOOR(' + t[0] + ')';
          case 'log':
            if (1 !== t.length) throw new Error('Invalid Parameter for call to LOG');
            return 'LOG(' + t[0] + ')';
          case 'log10':
            if (1 !== t.length) throw new Error('Invalid Parameter for call to LOG10');
            return 'LOG10(' + t[0] + ')';
          case 'power':
            if (2 !== t.length) throw new Error('Invalid Parameter for call to POWER');
            return 'POWER(' + t[0] + ',' + t[1] + ')';
          case 'round':
            if (2 === t.length) return 'ROUND(' + t[0] + ',' + t[1] + ')';
            if (1 === t.length) return 'ROUND(' + t[0] + ')';
            throw new Error('Invalid Parameter for call to ROUND');
          case 'truncate':
            if (t.length < 1 || t.length > 2)
              throw new Error('Invalid Parameter for TRUNCATE function');
            switch (r) {
              case s.a3.SqlServer:
                return 'ROUND(' + t[0] + (1 === t.length ? '0' : ',' + t[1]) + ',1)';
              default:
                return 'TRUNCATE(' + t[0] + (1 === t.length ? ')' : ',' + t[1] + ')');
            }
          case 'char_length':
          case 'len':
            if (1 !== t.length) throw new Error('Invalid Parameter for CHAR_LENGTH function');
            switch (r) {
              case s.a3.SqlServer:
                return 'LEN(' + t[0] + ')';
              case s.a3.Oracle:
                return 'LENGTH(' + t[0] + ')';
              default:
                return 'CHAR_LENGTH(' + t[0] + ')';
            }
          case 'concat':
            if (t.length < 1) throw new Error('Invalid Parameter for CONCAT function');
            {
              let e = 'CONCAT(';
              for (let r = 0; r < t.length; r++) 0 !== r && (e += ','), (e += t[r]);
              return (e += ')'), e;
            }
          case 'lower':
          case 'lcase':
            if (1 !== t.length) throw new Error('Invalid Parameter for Lower function');
            return 'LOWER(' + t[0] + ')';
          case 'upper':
          case 'ucase':
            if (1 !== t.length) throw new Error('Invalid Parameter for Upper function');
            return 'UPPER(' + t[0] + ')';
          case 'substring': {
            let e = '';
            switch (r) {
              case s.a3.Oracle:
                return (
                  (e = 'SUBSTR(' + t[0] + ',' + t[1]),
                  3 === t.length && (e += ',' + t[2]),
                  (e += ')'),
                  e
                );
              case s.a3.SqlServer:
                return (
                  (e =
                    3 === t.length
                      ? 'SUBSTRING(' + t[0] + ',' + t[1] + ',' + t[2] + ')'
                      : 'SUBSTRING(' + t[0] + ',  ' + t[1] + ', LEN(' + t[0] + ') - ' + t[1] + ')'),
                  e
                );
              default:
                return (
                  (e = 'SUBSTRING(' + t[0] + ' FROM ' + t[1]),
                  3 === t.length && (e += ' FOR ' + t[2]),
                  (e += ')'),
                  e
                );
            }
          }
          case 'extract':
            return 'EXTRACT(' + t[0].replace(/\'/g, '') + ' FROM ' + t[1] + ')';
        }
        throw new Error('Function Not Recognised');
      }
      function y(e, t) {
        const r = s.a8.Moment(e),
          n = 0 === r.minute() && 0 === r.hour() && 0 === r.second() && 0 === r.millisecond();
        switch (t) {
          case s.a3.FILEGDB:
          case s.a3.Standardised:
          case s.a3.StandardisedNoInterval:
            return n
              ? "date '" + r.format('YYYY-MM-DD') + "'"
              : "date '" + r.format('YYYY-MM-DD HH:mm:ss') + "'";
          case s.a3.Oracle:
            return n
              ? "TO_DATE('" + r.format('YYYY-MM-DD') + "','YYYY-MM-DD')"
              : "TO_DATE('" + r.format('YYYY-MM-DD HH:mm:ss') + "','YYYY-MM-DD HH24:MI:SS')";
          case s.a3.SqlServer:
            return "'" + r.format(n ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss') + "'";
          case s.a3.PGDB:
            return '#' + r.format(n ? 'MM-DD-YYYY' : 'MM-DD-YYYY HH:mm:ss') + '#';
          case s.a3.Postgres:
            return "TIMESTAMP '" + r.format(n ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss') + "'";
          default:
            return "date '" + r.format('YYYY-MM-DD HH:mm:ss') + "'";
        }
      }
      function w(e, t) {
        switch (t) {
          case s.a3.FILEGDB:
          case s.a3.Standardised:
          case s.a3.StandardisedNoInterval:
          case s.a3.Oracle:
            return e ? 'CURRENT_DATE' : 'CURRENT_TIMESTAMP';
          case s.a3.SqlServer:
            return e ? 'CAST(GETDATE() AS DATE)' : 'GETDATE()';
          case s.a3.PGDB:
          case s.a3.Postgres:
          default:
            return e ? 'CURRENT_DATE' : 'CURRENT_TIMESTAMP';
        }
      }
      function S(e, t, r = {}) {
        const n = {},
          s = {},
          a = {
            esriFieldTypeSmallInteger: 'integer',
            esriFieldTypeInteger: 'integer',
            esriFieldTypeSingle: 'double',
            esriFieldTypeDouble: 'double',
            esriFieldTypeString: 'string',
            esriFieldTypeDate: 'date',
            esriFieldTypeOID: 'integer',
            oid: 'integer',
            long: 'integer',
            'small-integer': 'integer',
            integer: 'integer',
            single: 'double',
            double: 'double',
            date: 'date',
            string: 'string',
          };
        for (const e of t) {
          const t = a[e.type];
          n[e.name.toLowerCase()] = void 0 === t ? '' : t;
        }
        for (const e in r) {
          const t = a[r[e]];
          s[e.toLowerCase()] = void 0 === t ? '' : t;
        }
        switch (b(n, e.parseTree, e.parameters, s)) {
          case 'double':
            return 'double';
          case 'integer':
            return 'integer';
          case 'double':
            return 'double';
          case 'date':
            return 'date';
          case 'string':
            return 'string';
        }
        return '';
      }
      function b(e, t, r, n) {
        let s;
        switch (t.type) {
          case 'interval':
            return 'integer';
          case 'case_expression': {
            const s = [];
            if ('simple' === t.format) {
              for (let a = 0; a < t.clauses.length; a++) s.push(b(e, t.clauses[a].value, r, n));
              null !== t.else && s.push(b(e, t.else, r, n));
            } else {
              for (let a = 0; a < t.clauses.length; a++) s.push(b(e, t.else, r, n));
              null !== t.else && s.push(b(e, t.else, r, n));
            }
            return v(s);
          }
          case 'param': {
            const e = n[t.value.toLowerCase()];
            if (void 0 === e && r) {
              const e = r[t.value.toLowerCase()];
              if (void 0 === e) return '';
              if (null === e) return '';
              if ('string' == typeof e || e instanceof String) return 'string';
              if ('boolean' == typeof e) return 'boolean';
              if (e instanceof Date) return 'date';
              if ('number' == typeof e) return e % 1 == 0 ? 'integer' : 'double';
            }
            return void 0 === e ? '' : e;
          }
          case 'expr_list': {
            const s = [];
            for (const a of t.value) s.push(b(e, a, r, n));
            return s;
          }
          case 'unary_expr':
            return 'boolean';
          case 'binary_expr':
            switch (t.operator) {
              case 'AND':
              case 'OR':
                return 'boolean';
              case 'IS':
              case 'ISNOT':
                if ('null' !== t.right.type) throw new Error('Unsupported RHS for IS');
                return 'boolean';
              case 'IN':
              case 'NOT IN':
              case 'BETWEEN':
              case 'NOTBETWEEN':
              case 'LIKE':
              case 'NOT LIKE':
                return 'boolean';
              case '<>':
              case '<':
              case '>':
              case '>=':
              case '<=':
              case '=':
                return 'boolean';
              case '*':
              case '-':
              case '+':
              case '/':
                return v([b(e, t.left, r, n), b(e, t.right, r, n)]);
              default:
                throw new Error('Not Supported Operator ' + t.operator);
            }
          case 'null':
            return '';
          case 'bool':
            return 'boolean';
          case 'string':
            return 'string';
          case 'number':
            return null === t.value ? '' : t.value % 1 == 0 ? 'integer' : 'double';
          case 'date':
          case 'timestamp':
          case 'current_time':
            return 'date';
          case 'column_ref': {
            const r = e[t.column.toLowerCase()];
            return void 0 === r ? '' : r;
          }
          case 'function':
            switch (t.name.toLowerCase()) {
              case 'position':
              case 'extract':
              case 'char_length':
                return 'integer';
              case 'round':
                return (
                  (s = b(e, t.args, r, n)), s instanceof Array ? (s.length > 0 ? s[0] : '') : s
                );
              case 'sign':
                return (
                  (s = b(e, t.args, r, n)),
                  s instanceof Array && (s = v(s)),
                  'integer' === s || 'double' === s ? s : 'double'
                );
              case 'ceiling':
              case 'floor':
              case 'abs': {
                const s = b(e, t.args, r, n);
                return s instanceof Array ? v(s) : s;
              }
              case 'area':
              case 'length':
              case 'log':
              case 'log10':
              case 'sin':
              case 'cos':
              case 'tan':
              case 'asin':
              case 'acos':
              case 'atan':
              case 'power':
                return 'double';
              case 'substring':
              case 'trim':
              case 'concat':
              case 'lower':
              case 'upper':
                return 'string';
              case 'truncate':
                return 'double';
              case 'round':
                return (
                  (s = b(e, t.args, r, n)), s instanceof Array ? (s.length > 0 ? s[0] : '') : s
                );
            }
            return '';
        }
        throw new Error('Unsupported sql syntax ' + t.type);
      }
      h.applicationCache = null;
      const I = { boolean: 1, string: 2, integer: 3, double: 4, date: 5 };
      function v(e) {
        if (e) {
          let t = '';
          for (const r of e) '' !== r && (t = '' === t || I[t] < I[r] ? r : t);
          return t;
        }
        return '';
      }
      function E(e, t) {
        return T(e.parseTree, t);
      }
      function k(e) {
        return 'column_ref' === e.parseTree.type;
      }
      function T(e, t) {
        if (null == e) return !1;
        switch (e.type) {
          case 'when_clause':
            return T(e.operand, t) || T(e.value, t);
          case 'case_expression':
            for (const r of e.clauses) if (T(r, t)) return !0;
            return (
              !('simple' !== e.format || !T(e.operand, t)) || !(null === e.else || !T(e.else, t))
            );
          case 'param':
            return !1;
          case 'expr_list':
            for (const r of e.value) if (T(r, t)) return !0;
            return !1;
          case 'unary_expr':
            return T(e.expr, t);
          case 'binary_expr':
            return T(e.left, t) || T(e.right, t);
          case 'null':
          case 'bool':
          case 'date':
          case 'timestamp':
          case 'string':
          case 'number':
            return !1;
          case 'column_ref':
            return t.toLowerCase() === e.column.toLowerCase();
          case 'function':
            return T(e.args, t);
        }
        return !1;
      }
      function D(e) {
        let t = '';
        return (t += e.period.toUpperCase()), t;
      }
      function F(e, t, r) {
        let n = '';
        return (
          (n = 'interval-period' === t.type ? D(t) : D(t.start) + ' TO ' + D(t.end)),
          'INTERVAL ' + r + ' ' + e + ' ' + n
        );
      }
      function P(e) {
        let t = 0;
        for (let r = 0; r < e.length; r++) t += e[r];
        return t / e.length;
      }
      function C(e) {
        const t = P(e);
        let r = 0;
        for (let n = 0; n < e.length; n++) r += (t - e[n]) ** 2;
        return r / e.length;
      }
      function N(e) {
        const t = P(e);
        let r = 0;
        for (let n = 0; n < e.length; n++) r += (t - e[n]) ** 2;
        return r / (e.length - 1);
      }
      function A(e) {
        let t = 0;
        for (let r = 0; r < e.length; r++) t += e[r];
        return t;
      }
      function R(e) {
        switch (e.toLowerCase()) {
          case 'distinct':
            return 'distinct';
          case 'avg':
          case 'mean':
            return 'avg';
          case 'min':
            return 'min';
          case 'sum':
            return 'sum';
          case 'max':
            return 'max';
          case 'stdev':
          case 'stddev':
            return 'stddev';
          case 'var':
          case 'variance':
            return 'var';
          case 'count':
            return 'count';
        }
        return '';
      }
      function x(e, t, r = 1e3) {
        switch (e.toLowerCase()) {
          case 'distinct':
            return (function (e, t) {
              const r = [],
                n = {},
                a = [];
              for (let i = 0; i < e.length; i++) {
                if (void 0 !== e[i] && null !== e[i]) {
                  const t = e[i];
                  if ((0, s.a9)(t) || (0, s.aa)(t)) void 0 === n[t] && (r.push(t), (n[t] = 1));
                  else {
                    let e = !1;
                    for (let r = 0; r < a.length; r++) !0 === (0, s.ab)(a[r], t) && (e = !0);
                    !1 === e && (a.push(t), r.push(t));
                  }
                }
                if (r.length >= t && -1 !== t) return r;
              }
              return r;
            })(t, r);
          case 'avg':
          case 'mean':
            return P(t);
          case 'min':
            return Math.min.apply(Math, t);
          case 'sum':
            return A(t);
          case 'max':
            return Math.max.apply(Math, t);
          case 'stdev':
          case 'stddev':
            return Math.sqrt(C(t));
          case 'var':
          case 'variance':
            return C(t);
          case 'count':
            return t.length;
        }
        return 0;
      }
      function O(e, t, r, s = !1) {
        try {
          const a = e.iterator(r);
          return (0, n.Ue)((e, r) => {
            M(a, [], t, s, e, r);
          });
        } catch (e) {
          return (0, n.d1)(e);
        }
      }
      function M(e, t, r, n, a, i) {
        (0, s.a4)(
          e.next().then((s) => {
            try {
              if (null !== s) {
                const o = r.calculateValue(s);
                return (
                  null === o ? !1 === n && (t[t.length] = o) : (t[t.length] = o),
                  M(e, t, r, n, a, i)
                );
              }
              a(t);
            } catch (e) {
              i(e);
            }
          }, i),
        );
      }
      function L(e, t, r = 1e3, s = null) {
        return (function (e, t, r, s) {
          try {
            return U(e.iterator(s), {}, [], t, r);
          } catch (e) {
            return (0, n.d1)(e);
          }
        })(e, t, r, s);
      }
      function U(e, t, r, n, s) {
        return e.next().then((a) => {
          if (null !== a) {
            const i = n.calculateValue(a);
            return (
              null != i && void 0 === t[i] && (r.push(i), (t[i] = 1)),
              r.length >= s && -1 !== s ? r : U(e, t, r, n, s)
            );
          }
          return r;
        });
      }
      class B {
        constructor(e) {
          (this.recentlyUsedQueries = null),
            (this.featureSetQueryInterceptor = null),
            (this._idstates = []),
            (this._parent = null),
            (this._wset = null),
            (this._mainSetInUse = null),
            (this._maxProcessing = 200),
            (this._maxQuery = 500),
            (this._totalCount = -1),
            (this._databaseType = s.a3.NotEvaluated),
            (this._databaseTypeProbed = null),
            (this.declaredRootClass = 'esri.arcade.featureset.support.FeatureSet'),
            (this._featureCache = []),
            (this.types = null),
            (this.fields = null),
            (this.geometryType = ''),
            (this.objectIdField = ''),
            (this.globalIdField = ''),
            (this.spatialReference = null),
            (this.hasM = !1),
            (this.hasZ = !1),
            (this._transparent = !1),
            (this.loaded = !1),
            (this._loadPromise = null),
            (this._fieldsIndex = null),
            e && e.lrucache && (this.recentlyUsedQueries = e.lrucache),
            e && e.interceptor && (this.featureSetQueryInterceptor = e.interceptor);
        }
        optimisePagingFeatureQueries(e) {
          this._parent && this._parent.optimisePagingFeatureQueries(e);
        }
        _hasMemorySource() {
          return !0;
        }
        prop(e, t) {
          return void 0 === t ? this[e] : (void 0 !== this[e] && (this[e] = t), this);
        }
        end() {
          return null !== this._parent && !0 === this._parent._transparent
            ? this._parent.end()
            : this._parent;
        }
        _ensureLoaded() {
          return this.load();
        }
        load() {
          return (
            null === this._loadPromise &&
              (this._loadPromise = (0, n.Ue)((e, t) => {
                if (!0 === this._parent.loaded) return this._initialiseFeatureSet(), void e(this);
                this._parent.load().then(() => {
                  try {
                    this._initialiseFeatureSet(), e(this);
                  } catch (e) {
                    t(e);
                  }
                }, t);
              })),
            this._loadPromise
          );
        }
        _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 o.Z({ wkid: 4326 })),
              (this.geometryType = s.a0.point));
        }
        getField(e, t) {
          let r;
          return (
            (t = t || this.fields) &&
              ((e = e.toLowerCase()),
              t.some((t) => (t && t.name.toLowerCase() === e && (r = t), !!r))),
            r
          );
        }
        getFieldsIndex() {
          return (
            null === this._fieldsIndex && (this._fieldsIndex = new l.Z(this.fields)),
            this._fieldsIndex
          );
        }
        _maxProcessingRate() {
          return null !== this._parent
            ? Math.min(this._maxProcessing, this._parent._maxProcessingRate())
            : Math.min(this._maxProcessing, this._maxQueryRate());
        }
        _maxQueryRate() {
          return null !== this._parent
            ? Math.max(this._maxQuery, this._parent._maxQueryRate())
            : this._maxQuery;
        }
        _checkCancelled(e) {
          if (null !== e && e.aborted) throw new Error('Operation has been cancelled.');
        }
        nativeCapabilities() {
          return this._parent.nativeCapabilities();
        }
        _canDoAggregates(e, t, r, s, a) {
          return null === this._parent
            ? (0, n.DB)(!1)
            : this._parent._canDoAggregates(e, t, r, s, a);
        }
        _getAggregatePagesDataSourceDefinition(e, t, r, s, a, i, o) {
          return null === this._parent
            ? (0, n.d1)(new Error('Should never be called'))
            : this._parent._getAggregatePagesDataSourceDefinition(e, t, r, s, a, i, o);
        }
        _getAgregagtePhysicalPage(e, t, r) {
          return null === this._parent
            ? (0, n.d1)(new Error('Should never be called'))
            : this._parent._getAgregagtePhysicalPage(e, t, r);
        }
        databaseType() {
          if (this._databaseType === s.a3.NotEvaluated) {
            if (null !== h.applicationCache) {
              const e = h.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());
              if (null !== e) return e;
            }
            if (null !== this._databaseTypeProbed) return this._databaseTypeProbed;
            const e = [
              {
                thetype: s.a3.SqlServer,
                testwhere:
                  "(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0",
              },
              {
                thetype: s.a3.Oracle,
                testwhere:
                  "(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0",
              },
              {
                thetype: s.a3.StandardisedNoInterval,
                testwhere:
                  "(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0",
              },
            ];
            let t = (0, n.Ue)((t, r) => {
              this._getDatabaseTypeImpl(e, 0).then(
                (e) => {
                  (this._databaseType = e), t(this._databaseType);
                },
                (e) => {
                  r(e);
                },
              );
            });
            return (
              null !== h.applicationCache &&
                (h.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(), t),
                (t = t.catch((e) => {
                  throw (
                    (h.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()), e)
                  );
                }))),
              (this._databaseTypeProbed = t),
              this._databaseTypeProbed
            );
          }
          return (0, n.DB)(this._databaseType);
        }
        _cacheableFeatureSetSourceKey() {
          return 'MUSTBESET';
        }
        _getDatabaseTypeImpl(e, t) {
          return t >= e.length
            ? (0, n.DB)(s.a3.StandardisedNoInterval)
            : this._runDatabaseProbe(e[t].testwhere).then((r) =>
                !0 === r ? e[t].thetype : this._getDatabaseTypeImpl(e, t + 1),
              );
        }
        _runDatabaseProbe(e) {
          return null !== this._parent
            ? this._parent._runDatabaseProbe(e)
            : (0, n.d1)(new Error('Not Implemented'));
        }
        isTable() {
          return this._parent.isTable();
        }
        _featureFromCache(e) {
          if (void 0 !== this._featureCache[e]) return this._featureCache[e];
        }
        _isInFeatureSet(e) {
          return s.a1.Unknown;
        }
        _getSet(e) {
          throw new Error('Not implemented in abstract class');
        }
        _getFeature(e, t, r) {
          try {
            return (
              this._checkCancelled(r),
              void 0 !== this._featureFromCache(t)
                ? (0, n.DB)(this._featureFromCache(t))
                : this._getFeatures(e, t, this._maxProcessingRate(), r).then(
                    () => (
                      this._checkCancelled(r),
                      void 0 !== this._featureFromCache(t)
                        ? this._featureFromCache(t)
                        : (0, n.d1)(new Error('Feature Not Found'))
                    ),
                  )
            );
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _getFeatureBatch(e, t) {
          try {
            this._checkCancelled(t);
            const r = new c([], e, !1, null),
              n = [];
            return this._getFeatures(r, -1, e.length, t).then(() => {
              this._checkCancelled(t);
              for (const t of e)
                void 0 !== this._featureFromCache(t) && n.push(this._featureFromCache(t));
              return n;
            });
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _getFeatures(e, t, r, s) {
          return (0, n.DB)('success');
        }
        _getFilteredSet(e, t, r, n, s) {
          throw new Error('Not implemented in abstract class');
        }
        _refineSetBlock(e, t, r) {
          try {
            if (!0 === this._checkIfNeedToExpandCandidatePage(e, this._maxQueryRate()))
              return this._expandPagedSet(e, this._maxQueryRate(), 0, 0, r).then(() =>
                this._refineSetBlock(e, t, r),
              );
            this._checkCancelled(r);
            const s = e._candidates.length;
            this._refineKnowns(e, t);
            let a = s - e._candidates.length;
            return 0 === e._candidates.length || a >= t
              ? (0, n.DB)(e)
              : this._refineIfParentKnown(e, t - a, r).then(() => {
                  if (
                    (this._checkCancelled(r),
                    this._refineKnowns(e, t - a),
                    (a = s - e._candidates.length),
                    a < t && e._candidates.length > 0)
                  ) {
                    const n = t - a,
                      s = this._prepareFetchAndRefineSet(e._candidates);
                    return this._fetchAndRefineFeatures(
                      s,
                      s.length > n ? n : e._candidates.length,
                      r,
                    ).then(() => (this._checkCancelled(r), this._refineKnowns(e, t - a), e));
                  }
                  return e;
                });
          } catch (e) {
            return (0, n.d1)(e);
          }
        }
        _fetchAndRefineFeatures(e, t, r) {
          return null;
        }
        _prepareFetchAndRefineSet(e) {
          const t = [];
          for (let r = 0; r < e.length; r++) this._isPhysicalFeature(e[r]) && t.push(e[r]);
          return t;
        }
        _isPhysicalFeature(e) {
          return null === this._parent || this._parent._isPhysicalFeature(e);
        }
        _refineKnowns(e, t) {
          let r = 0,
            n = null;
          const a = [];
          t = this._maxQueryRate();
          for (let i = 0; i < e._candidates.length && 'GETPAGES' !== e._candidates[i]; i++) {
            let o = !1;
            const l = this._candidateIdTransform(e._candidates[i]);
            l !== e._candidates[i] && (o = !0);
            const u = this._isInFeatureSet(l);
            if (u === s.a1.InFeatureSet)
              !0 === o
                ? e._known.indexOf(l) < 0 && (e._known.push(l), (r += 1))
                : (e._known.push(e._candidates[i]), (r += 1)),
                null === n
                  ? (n = { start: i, end: i })
                  : n.end === i - 1
                  ? (n.end = i)
                  : (a.push(n), (n = { start: i, end: i }));
            else if (u === s.a1.NotInFeatureSet)
              null === n
                ? (n = { start: i, end: i })
                : n.end === i - 1
                ? (n.end = i)
                : (a.push(n), (n = { start: i, end: i })),
                (r += 1);
            else if (u === s.a1.Unknown && ((r += 1), !0 === e._ordered)) break;
            if (r >= t) break;
          }
          null !== n && a.push(n);
          for (let t = a.length - 1; t >= 0; t--)
            e._candidates.splice(a[t].start, a[t].end - a[t].start + 1);
        }
        _refineIfParentKnown(e, t, r) {
          const n = new c([], [], e._ordered, null);
          return (n._candidates = e._candidates.slice(0)), this._parent._refineSetBlock(n, t, r);
        }
        _candidateIdTransform(e) {
          return this._parent._candidateIdTransform(e);
        }
        _checkIfNeedToExpandKnownPage(e, t) {
          if (null === e.pagesDefinition) return !1;
          let r = 0;
          for (let n = e._lastFetchedIndex; n < e._known.length; n++) {
            if ('GETPAGES' === e._known[n]) return !0;
            if (void 0 === this._featureCache[e._known[n]] && ((r += 1), r >= t)) break;
          }
          return !1;
        }
        _checkIfNeedToExpandCandidatePage(e, t) {
          if (null === e.pagesDefinition) return !1;
          let r = 0;
          for (let n = 0; n < e._candidates.length; n++) {
            if ('GETPAGES' === e._candidates[n]) return !0;
            if (((r += 1), r >= t)) break;
          }
          return !1;
        }
        _expandPagedSet(e, t, r, s, a) {
          return null === this._parent
            ? (0, n.d1)(new Error('Parent Paging not implemented'))
            : this._parent._expandPagedSet(e, t, r, s, a);
        }
        _expandPagedSetFeatureSet(e, t, r, s, a) {
          return (
            e._known.length > 0 && 'GETPAGES' === e._known[e._known.length - 1] && (s = 1),
            0 === s &&
              e._candidates.length > 0 &&
              'GETPAGES' === e._candidates[e._candidates.length - 1] &&
              (s = 2),
            0 === s
              ? (0, n.DB)('finished')
              : this._getPage(e, s, a).then((n) =>
                  r + n < t ? this._expandPagedSet(e, t, r + n, 0, a) : 'success',
                )
          );
        }
        _getPage(e, t, r) {
          const s = 1 === t ? e._known : e._candidates;
          if (
            e.pagesDefinition.internal.set.length > e.pagesDefinition.resultOffset ||
            !0 === e.pagesDefinition.internal.fullyResolved
          ) {
            s.length = s.length - 1;
            let t = 0;
            for (
              let r = 0;
              r < e.pagesDefinition.resultRecordCount &&
              !(e.pagesDefinition.resultOffset + r >= e.pagesDefinition.internal.set.length);
              r++
            )
              (s[s.length] = e.pagesDefinition.internal.set[e.pagesDefinition.resultOffset + r]),
                t++;
            e.pagesDefinition.resultOffset += t;
            let r = !1;
            return (
              !0 === e.pagesDefinition.internal.fullyResolved &&
                e.pagesDefinition.internal.set.length <= e.pagesDefinition.resultOffset &&
                (r = !0),
              !1 === r && s.push('GETPAGES'),
              (0, n.DB)(t)
            );
          }
          return this._getPhysicalPage(e, t, r).then(() => this._getPage(e, t, r));
        }
        _getPhysicalPage(e, t, r) {
          return null;
        }
        _clonePageDefinition(e) {
          return null === this._parent ? null : this._parent._clonePageDefinition(e);
        }
        _first(e) {
          return this.iterator(e).next();
        }
        first(e) {
          return this._first(e);
        }
        calculateStatistic(e, t, r, n) {
          return this._ensureLoaded().then(() =>
            this._stat(e, t, '', null, null, r, n).then((s) =>
              !1 === s.calculated ? this._manualStat(e, t, r, n).then((e) => e.result) : s.result,
            ),
          );
        }
        _manualStat(e, t, r, s) {
          switch (e.toLowerCase()) {
            case 'count':
              return (function (e, t) {
                try {
                  return e.iterator(t).count();
                } catch (e) {
                  return (0, n.d1)(e);
                }
              })(this, s).then((e) => ({ calculated: !0, result: e }));
            case 'distinct':
              return L(this, t, r).then((e) => ({ calculated: !0, result: e }));
            case 'avg':
            case 'mean':
              return (function (e, t, r) {
                let n = '';
                return (
                  !1 === k(t) && (n = S(t, e.fields, null)),
                  O(e, t, r, !0).then((e) => {
                    if (0 === e.length) return null;
                    const t = P(e);
                    return null === t
                      ? t
                      : 'integer' === n
                      ? ((r = +(r = t)),
                        isFinite(r) ? r - (r % 1) || (r < 0 ? -0 : 0 === r ? r : 0) : r)
                      : t;
                    var r;
                  })
                );
              })(this, t, s).then((e) => ({ calculated: !0, result: e }));
            case 'stdev':
              return (function (e, t, r) {
                return O(e, t, r, !0).then((e) => (0 === e.length ? null : Math.sqrt(N(e))));
              })(this, t, s).then((e) => ({ calculated: !0, result: e }));
            case 'variance':
              return (function (e, t, r) {
                return O(e, t, r, !0).then((e) => (0 === e.length ? null : N(e)));
              })(this, t, s).then((e) => ({ calculated: !0, result: e }));
            case 'sum':
              return (function (e, t, r) {
                return O(e, t, r, !0).then((e) => (0 === e.length ? null : A(e)));
              })(this, t, s).then((e) => ({ calculated: !0, result: e }));
            case 'min':
              return (function (e, t, r) {
                return O(e, t, r, !0).then((e) =>
                  0 === e.length ? null : Math.min.apply(Math, e),
                );
              })(this, t, s).then((e) => ({ calculated: !0, result: e }));
            case 'max':
              return (function (e, t, r) {
                return O(e, t, r, !0).then((e) =>
                  0 === e.length ? null : Math.max.apply(Math, e),
                );
              })(this, t, s).then((e) => ({ calculated: !0, result: e }));
            default:
              return (0, n.DB)({ calculated: !0, result: 0 });
          }
        }
        _stat(e, t, r, n, s, a, i) {
          return this._parent
            ._stat(e, t, r, n, s, a, i)
            .then((o) =>
              !1 === o.calculated
                ? null === s && '' === r && null === n
                  ? this._manualStat(e, t, a, i)
                  : { calculated: !1 }
                : o,
            );
        }
        _unionAllGeomSelf(e) {
          const t = this.iterator(this._defaultTracker(e)),
            r = [];
          return (0, n.Ue)((e, n) => {
            this._unionShapeInBatches(r, t, e, n);
          });
        }
        _unionAllGeom(e) {
          return (0, n.Ue)((t, r) => {
            const n = this.iterator(this._defaultTracker(e));
            this._unionShapeInBatches([], n, t, r);
          });
        }
        _unionShapeInBatches(e, t, r, n) {
          t.next().then((s) => {
            try {
              null !== s && null !== s.geometry && e.push(s.geometry),
                e.length > 30 || (null === s && e.length > 1)
                  ? (0, i.G0)(e).then((a) => {
                      try {
                        null === s ? r(a) : ((e = [a]), this._unionShapeInBatches(e, t, r, n));
                      } catch (e) {
                        n(e);
                      }
                    }, n)
                  : null === s
                  ? 1 === e.length
                    ? r(e[0])
                    : r(null)
                  : this._unionShapeInBatches(e, t, r, n);
            } catch (e) {
              n(e);
            }
          }, n);
        }
        iterator(e) {
          return new u(this, e);
        }
        intersection(e, t = !1) {
          return B._featuresetFunctions.intersection.bind(this)(e, t);
        }
        difference(e, t = !1, r = !0) {
          return B._featuresetFunctions.difference.bind(this)(e, t, r);
        }
        symmetricDifference(e, t = !1, r = !0) {
          return B._featuresetFunctions.symmetricDifference.bind(this)(e, t, r);
        }
        morphShape(e, t, r = 'unknown', n = null) {
          return B._featuresetFunctions.morphShape.bind(this)(e, t, r, n);
        }
        morphShapeAndAttributes(e, t, r = 'unknown') {
          return B._featuresetFunctions.morphShapeAndAttributes.bind(this)(e, t, r);
        }
        union(e, t = !1) {
          return B._featuresetFunctions.union.bind(this)(e, t);
        }
        intersects(e) {
          return B._featuresetFunctions.intersects.bind(this)(e);
        }
        envelopeIntersects(e) {
          return B._featuresetFunctions.envelopeIntersects.bind(this)(e);
        }
        contains(e) {
          return B._featuresetFunctions.contains.bind(this)(e);
        }
        overlaps(e) {
          return B._featuresetFunctions.overlaps.bind(this)(e);
        }
        relate(e, t) {
          return B._featuresetFunctions.relate.bind(this)(e, t);
        }
        within(e) {
          return B._featuresetFunctions.within.bind(this)(e);
        }
        touches(e) {
          return B._featuresetFunctions.touches.bind(this)(e);
        }
        top(e) {
          return B._featuresetFunctions.top.bind(this)(e);
        }
        crosses(e) {
          return B._featuresetFunctions.crosses.bind(this)(e);
        }
        buffer(e, t, r, n = !0) {
          return B._featuresetFunctions.buffer.bind(this)(e, t, r, n);
        }
        filter(e, t = null) {
          return B._featuresetFunctions.filter.bind(this)(e, t);
        }
        orderBy(e) {
          return B._featuresetFunctions.orderBy.bind(this)(e);
        }
        dissolve(e, t) {
          return B._featuresetFunctions.dissolve.bind(this)(e, t);
        }
        groupby(e, t) {
          return B._featuresetFunctions.groupby.bind(this)(e, t);
        }
        reduce(e, t = null, r) {
          return (0, n.Ue)((n, s) => {
            this._reduceImpl(this.iterator(this._defaultTracker(r)), e, t, 0, n, s, 0);
          });
        }
        _reduceImpl(e, t, r, s, a, i, o) {
          try {
            if (++o > 1e3)
              return void setTimeout(() => {
                (o = 0), this._reduceImpl(e, t, r, s, a, i, o);
              });
            e.next().then((l) => {
              try {
                if (null === l) a(r);
                else {
                  const u = t(r, l, s, this);
                  (0, n.y8)(u)
                    ? u.then((r) => {
                        this._reduceImpl(e, t, r, s + 1, a, i, o);
                      }, i)
                    : this._reduceImpl(e, t, u, s + 1, a, i, o);
                }
              } catch (e) {
                i(e);
              }
            }, i);
          } catch (e) {
            i(e);
          }
        }
        removeField(e) {
          return B._featuresetFunctions.removeField.bind(this)(e);
        }
        addField(e, t, r = null) {
          return B._featuresetFunctions.addField.bind(this)(e, t, r);
        }
        sumArea(e, t = !1, r) {
          const n = (0, s.ac)(e);
          return this.reduce(
            (e, r) =>
              null === r.geometry
                ? 0
                : t
                ? (0, i.Y4)(r.geometry, n).then((t) => e + t)
                : (0, i.CJ)(r.geometry, n).then((t) => e + t),
            0,
            r,
          );
        }
        sumLength(e, t = !1, r) {
          const n = (0, s.ad)(e);
          return this.reduce(
            (e, r) =>
              null === r.geometry
                ? 0
                : t
                ? (0, i.kQ)(r.geometry, n).then((t) => e + t)
                : (0, i.sz)(r.geometry, n).then((t) => e + t),
            0,
            r,
          );
        }
        _substituteVars(e, t) {
          if (null !== t) {
            const r = {};
            for (const e in t) r[e.toLowerCase()] = t[e];
            e.parameters = r;
          }
        }
        distinct(e, t = 1e3, r = null, n) {
          return this.load().then(() => {
            const s = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(s, r),
              this.calculateStatistic('distinct', s, t, this._defaultTracker(n))
            );
          });
        }
        min(e, t = null, r) {
          return this.load().then(() => {
            const n = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(n, t),
              this.calculateStatistic('min', n, -1, this._defaultTracker(r))
            );
          });
        }
        max(e, t = null, r) {
          return this.load().then(() => {
            const n = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(n, t),
              this.calculateStatistic('max', n, -1, this._defaultTracker(r))
            );
          });
        }
        avg(e, t = null, r) {
          return this.load().then(() => {
            const n = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(n, t),
              this.calculateStatistic('avg', n, -1, this._defaultTracker(r))
            );
          });
        }
        sum(e, t = null, r) {
          return this.load().then(() => {
            const n = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(n, t),
              this.calculateStatistic('sum', n, -1, this._defaultTracker(r))
            );
          });
        }
        stdev(e, t = null, r) {
          return this.load().then(() => {
            const n = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(n, t),
              this.calculateStatistic('stdev', n, -1, this._defaultTracker(r))
            );
          });
        }
        variance(e, t = null, r) {
          return this.load().then(() => {
            const n = a.WhereClause.create(e, this.getFieldsIndex());
            return (
              this._substituteVars(n, t),
              this.calculateStatistic('variance', n, -1, this._defaultTracker(r))
            );
          });
        }
        count(e) {
          return this.load().then(() =>
            this.calculateStatistic(
              'count',
              a.WhereClause.create('1', this.getFieldsIndex()),
              -1,
              this._defaultTracker(e),
            ),
          );
        }
        _defaultTracker(e) {
          return e || { aborted: !1 };
        }
        forEach(e, t) {
          return (0, n.Ue)((r, n) => {
            this._forEachImpl(this.iterator(this._defaultTracker(t)), e, this, r, n, 0);
          });
        }
        _forEachImpl(e, t, r, s, a, i) {
          try {
            if (++i > 1e3)
              return void setTimeout(() => {
                (i = 0), this._forEachImpl(e, t, r, s, a, i);
              }, 0);
            e.next().then((o) => {
              try {
                if (null === o) s(r);
                else {
                  const l = t(o);
                  null == l
                    ? this._forEachImpl(e, t, r, s, a, i)
                    : (0, n.y8)(l)
                    ? l.then(() => {
                        try {
                          this._forEachImpl(e, t, r, s, a, i);
                        } catch (e) {
                          a(e);
                        }
                      }, a)
                    : this._forEachImpl(e, t, r, s, a, i);
                }
              } catch (e) {
                a(e);
              }
            }, a);
          } catch (e) {
            a(e);
          }
        }
        convertToJSON(e) {
          const t = {
            layerDefinition: { geometryType: this.geometryType, fields: [] },
            featureSet: { features: [], geometryType: this.geometryType },
          };
          for (let e = 0; e < this.fields.length; e++)
            t.layerDefinition.fields.push((0, s.ae)(this.fields[e]));
          return this.reduce(
            (e, r) => {
              const n = { geometry: r.geometry && r.geometry.toJSON(), attributes: {} };
              for (const e in r.attributes) n.attributes[e] = r.attributes[e];
              return t.featureSet.features.push(n), 1;
            },
            0,
            e,
          ).then(() => t);
        }
        castToText() {
          return 'object, FeatureSet';
        }
        queryAttachments(e, t, r, n) {
          return this._parent.queryAttachments(e, t, r, n);
        }
        serviceUrl() {
          return this._parent.serviceUrl();
        }
        subtypes() {
          return this.typeIdField
            ? {
                subtypeField: this.typeIdField,
                subtypes: this.types ? this.types.map((e) => ({ name: e.name, code: e.id })) : [],
              }
            : null;
        }
        relationshipMetaData() {
          return this._parent.relationshipMetaData();
        }
        get gdbVersion() {
          return this._parent ? this._parent.gdbVersion : '';
        }
        schema() {
          const e = [];
          for (const t of this.fields) e.push((0, s.ae)(t));
          return {
            objectIdField: this.objectIdField,
            globalIdField: this.globalIdField,
            geometryType: void 0 === s.af[this.geometryType] ? '' : s.af[this.geometryType],
            fields: e,
          };
        }
        convertToText(e, t) {
          return 'schema' === e
            ? this._ensureLoaded().then(() => JSON.stringify(this.schema()))
            : 'featureset' === e
            ? this._ensureLoaded().then(() => {
                const e = [];
                return this.reduce(
                  (t, r) => {
                    const n = {
                      geometry: r.geometry ? r.geometry.toJSON() : null,
                      attributes: r.attributes,
                    };
                    return (
                      null !== n.geometry &&
                        n.geometry.spatialReference &&
                        delete n.geometry.spatialReference,
                      e.push(n),
                      1
                    );
                  },
                  0,
                  t,
                ).then(() => {
                  const t = this.schema();
                  return (
                    (t.features = e),
                    (t.spatialReference = this.spatialReference.toJSON()),
                    JSON.stringify(t)
                  );
                });
              })
            : (0, n.DB)(this.castToText());
        }
        getFeatureByObjectId(e, t) {
          return this._parent.getFeatureByObjectId(e, t);
        }
        getOwningSystemUrl() {
          return this._parent.getOwningSystemUrl();
        }
        getIdentityUser() {
          return this._parent.getIdentityUser();
        }
      }
      B._featuresetFunctions = {};
      class G extends B {
        constructor(e) {
          super(e),
            (this.declaredClass = 'esri.layers.featureset.sources.Empty'),
            (this._maxProcessing = 1e3),
            (this._wset = new c([], [], !1, null)),
            (this._parent = e.parentfeatureset),
            (this._databaseType = s.a3.Standardised);
        }
        _getSet() {
          return (0, n.DB)(this._wset);
        }
        optimisePagingFeatureQueries() {}
        _isInFeatureSet() {
          return s.a1.NotInFeatureSet;
        }
        _getFeature() {
          return (0, n.d1)(new Error('No Feature Found in EmptySet'));
        }
        queryAttachments() {
          return (0, n.DB)([]);
        }
        _getFeatures() {
          return (0, n.DB)('success');
        }
        _featureFromCache() {
          return null;
        }
        _fetchAndRefineFeatures() {
          return (0, n.d1)(new Error('Fetch and Refine should not be called in this featureset'));
        }
        _getFilteredSet() {
          return (0, n.DB)(new c([], [], !1, null));
        }
        _stat(e, t, r, n, s, a, i) {
          return this._manualStat(e, t, a, i);
        }
        _canDoAggregates() {
          return (0, n.DB)(!1);
        }
      }
      class Y extends B {
        constructor(e) {
          super(e),
            (this._relation = ''),
            (this._relationGeom = null),
            (this._relationString = ''),
            (this.declaredClass = 'esri.arcade.featureset.actions.SpatialFilter'),
            (this._relationString = e.relationString),
            (this._parent = e.parentfeatureset),
            (this._maxProcessing = 40),
            (this._relation = e.relation),
            (this._relationGeom = e.relationGeom);
        }
        _getSet(e) {
          return null === this._wset
            ? this._ensureLoaded()
                .then(() =>
                  this._parent._getFilteredSet(
                    'esriSpatialRelRelation' !== this._relation
                      ? this._relation
                      : this._relation + ':' + this._relationString,
                    this._relationGeom,
                    null,
                    null,
                    e,
                  ),
                )
                .then(
                  (t) => (
                    this._checkCancelled(e),
                    (this._wset = new c(
                      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 === s.a1.NotInFeatureSet
            ? t
            : ((t = this._idstates[e]), void 0 === t ? s.a1.Unknown : t);
        }
        _getFeature(e, t, r) {
          return this._parent._getFeature(e, t, r);
        }
        _getFeatures(e, t, r, n) {
          return this._parent._getFeatures(e, t, r, n);
        }
        _featureFromCache(e) {
          return this._parent._featureFromCache(e);
        }
        executeSpatialRelationTest(e) {
          if (null === e.geometry) return (0, n.DB)(!1);
          switch (this._relation) {
            case 'esriSpatialRelEnvelopeIntersects': {
              const t = (0, s.ag)(this._relationGeom),
                r = (0, s.ag)(e.geometry);
              return (0, i.kK)(t, r);
            }
            case 'esriSpatialRelIntersects':
              return (0, i.kK)(this._relationGeom, e.geometry);
            case 'esriSpatialRelContains':
              return (0, i.r3)(this._relationGeom, e.geometry);
            case 'esriSpatialRelOverlaps':
              return (0, i.Nm)(this._relationGeom, e.geometry);
            case 'esriSpatialRelWithin':
              return (0, i.uh)(this._relationGeom, e.geometry);
            case 'esriSpatialRelTouches':
              return (0, i.W4)(this._relationGeom, e.geometry);
            case 'esriSpatialRelCrosses':
              return (0, i.jU)(this._relationGeom, e.geometry);
            case 'esriSpatialRelRelation':
              return (0, i.LV)(this._relationGeom, e.geometry, this._relationString);
          }
        }
        _fetchAndRefineFeatures(e, t, r) {
          const a = new c([], e, !1, null),
            i = Math.min(t, e.length);
          return this._parent
            ._getFeatures(a, -1, i, r)
            .then(() => {
              this._checkCancelled(r);
              const t = [];
              for (let r = 0; r < i; r++) {
                const n = this._parent._featureFromCache(e[r]);
                t.push(this.executeSpatialRelationTest(n));
              }
              return (0, n.$6)(t);
            })
            .then((r) => {
              for (let n = 0; n < t; n++)
                !0 === r[n]
                  ? (this._idstates[e[n]] = s.a1.InFeatureSet)
                  : (this._idstates[e[n]] = s.a1.NotInFeatureSet);
              return 'success';
            });
        }
        _getFilteredSet(e, t, r, n, s) {
          return this._ensureLoaded()
            .then(() =>
              this._parent._getFilteredSet(
                'esriSpatialRelRelation' !== this._relation
                  ? this._relation
                  : this._relation + ':' + this._relationString,
                this._relationGeom,
                r,
                n,
                s,
              ),
            )
            .then((e) => {
              let r;
              return (
                this._checkCancelled(s),
                (r =
                  null !== t
                    ? new c(
                        e._candidates.slice(0).concat(e._known.slice(0)),
                        [],
                        e._ordered,
                        this._clonePageDefinition(e.pagesDefinition),
                      )
                    : new c(
                        e._candidates.slice(0),
                        e._known.slice(0),
                        e._ordered,
                        this._clonePageDefinition(e.pagesDefinition),
                      )),
                r
              );
            });
        }
        _stat(e, t, r, s, a, i, o) {
          return '' !== r
            ? (0, n.DB)({ calculated: !1 })
            : this._parent
                ._stat(
                  e,
                  t,
                  'esriSpatialRelRelation' !== this._relation
                    ? this._relation
                    : this._relation + ':' + this._relationString,
                  this._relationGeom,
                  a,
                  i,
                  o,
                )
                .then((n) =>
                  !1 === n.calculated
                    ? null === a && '' === r && null === s
                      ? this._manualStat(e, t, i, o)
                      : { calculated: !1 }
                    : n,
                );
        }
        _canDoAggregates(e, t, r, s, a) {
          return '' !== r || null !== s || null === this._parent
            ? (0, n.DB)(!1)
            : this._parent._canDoAggregates(
                e,
                t,
                'esriSpatialRelRelation' !== this._relation
                  ? this._relation
                  : this._relation + ':' + this._relationString,
                this._relationGeom,
                a,
              );
        }
        _getAggregatePagesDataSourceDefinition(e, t, r, s, a, i, o) {
          return null === this._parent
            ? (0, n.d1)(new Error('Should never be called'))
            : this._parent._getAggregatePagesDataSourceDefinition(
                e,
                t,
                'esriSpatialRelRelation' !== this._relation
                  ? this._relation
                  : this._relation + ':' + this._relationString,
                this._relationGeom,
                a,
                i,
                o,
              );
        }
        static registerAction() {
          (B._featuresetFunctions.intersects = function (e) {
            return null == e
              ? new G({ parentfeatureset: this })
              : new Y({
                  parentfeatureset: this,
                  relation: 'esriSpatialRelIntersects',
                  relationGeom: e,
                });
          }),
            (B._featuresetFunctions.envelopeIntersects = function (e) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelEnvelopeIntersects',
                    relationGeom: e,
                  });
            }),
            (B._featuresetFunctions.contains = function (e) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelContains',
                    relationGeom: e,
                  });
            }),
            (B._featuresetFunctions.overlaps = function (e) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelOverlaps',
                    relationGeom: e,
                  });
            }),
            (B._featuresetFunctions.within = function (e) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelWithin',
                    relationGeom: e,
                  });
            }),
            (B._featuresetFunctions.touches = function (e) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelTouches',
                    relationGeom: e,
                  });
            }),
            (B._featuresetFunctions.crosses = function (e) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelCrosses',
                    relationGeom: e,
                  });
            }),
            (B._featuresetFunctions.relate = function (e, t) {
              return null == e
                ? new G({ parentfeatureset: this })
                : new Y({
                    parentfeatureset: this,
                    relation: 'esriSpatialRelRelation',
                    relationGeom: e,
                    relationString: t,
                  });
            });
        }
      }
    },
    46987: (e, t, r) => {
      'use strict';
      r.d(t, { Z: () => l });
      var n = r(22723),
        s = r(92143),
        a = r(50406),
        i = r(37453);
      r(76506), r(31450), r(71552), r(40642), r(60991), r(81172), r(88762), r(32101);
      const o = s.L.getLogger('esri.core.workers.Connection'),
        l = class {
          constructor() {
            (this._clients = new Array()),
              (this._clientPromises = new Array()),
              (this._clientIdx = 0);
          }
          destroy() {
            this.close();
          }
          get closed() {
            return !this._clients || !this._clients.length;
          }
          open(e, t) {
            return new Promise((r, n) => {
              let s = !0;
              const o = (e) => {
                (0, a.k_)(t.signal), s && ((s = !1), e());
              };
              (this._clients.length = e.length), (this._clientPromises.length = e.length);
              for (let s = 0; s < e.length; ++s) {
                const l = e[s];
                (0, a.y8)(l)
                  ? (this._clientPromises[s] = l.then(
                      (e) => ((this._clients[s] = new i.default(e, t)), o(r), this._clients[s]),
                      () => (o(n), null),
                    ))
                  : ((this._clients[s] = new i.default(l, t)),
                    (this._clientPromises[s] = Promise.resolve(this._clients[s])),
                    o(r));
              }
            });
          }
          broadcast(e, t, r) {
            const n = new Array(this._clientPromises.length);
            for (let s = 0; s < this._clientPromises.length; ++s) {
              const a = this._clientPromises[s];
              n[s] = a.then((n) => n.invoke(e, t, r));
            }
            return n;
          }
          close() {
            for (const e of this._clientPromises) e.then((e) => e.close());
            (this._clients.length = 0), (this._clientPromises.length = 0);
          }
          getAvailableClient() {
            let e;
            for (let t = 0; t < this._clients.length; ++t) {
              const r = this._clients[t];
              if (r) {
                if (!r.isBusy()) return Promise.resolve(r);
              } else (e = e || []), e.push(this._clientPromises[t]);
            }
            return e
              ? Promise.race(e)
              : ((this._clientIdx = (this._clientIdx + 1) % this._clients.length),
                Promise.resolve(this._clients[this._clientIdx]));
          }
          invoke(e, t, r) {
            let n = null;
            return (
              Array.isArray(r)
                ? (o.warn(
                    'invoke()',
                    'The transferList parameter is deprecated, use the options object instead',
                  ),
                  (n = { transferList: r }))
                : (n = r),
              this.closed
                ? Promise.reject(new Error('Connection closed'))
                : this.getAvailableClient().then((r) => r.invoke(e, t, n))
            );
          }
          on(e, t) {
            return Promise.all(this._clientPromises).then(() =>
              (0, n.h)(this._clients.map((r) => r.on(e, t))),
            );
          }
          openPorts() {
            return new Promise((e) => {
              const t = new Array(this._clientPromises.length);
              let r = t.length;
              for (let n = 0; n < this._clientPromises.length; ++n)
                this._clientPromises[n].then((s) => {
                  (t[n] = s.openPort()), 0 == --r && e(t);
                });
            });
          }
          get test() {
            return { numClients: this._clients.length };
          }
        };
    },
    65514: (e, t, r) => {
      'use strict';
      r.d(t, { bA: () => G, Mz: () => U });
      var n = r(60991),
        s = r(76506),
        a = r(50406),
        i = r(46987),
        o = r(37453),
        l = r(88762),
        u = r(92143),
        c = r(73173),
        h = r(31450),
        d = (r(66284), r(32101)),
        _ = r(3482);
      r(81172), r(71552), r(40642), r(22723), r(82058), r(33921), r(57251);
      let f = null;
      f = (0, d.hF)((0, c.g)('esri/core/workers/init.js'));
      const p = {};
      (p.baseUrl = (0, d.hF)((0, c.g)('dojo/'))),
        (p.packages = [{ name: 'esri', location: '../esri' }]);
      class g {
        constructor() {
          const e = document.createDocumentFragment();
          ['addEventListener', 'dispatchEvent', 'removeEventListener'].forEach((t) => {
            this[t] = (...r) => e[t](...r);
          });
        }
      }
      const m = s.g.MutationObserver || s.g.WebKitMutationObserver,
        y = (function () {
          let e;
          if (s.g.process && s.g.process.nextTick)
            e = (e) => {
              s.g.process.nextTick(e);
            };
          else if (s.g.Promise)
            e = (e) => {
              s.g.Promise.resolve().then(e);
            };
          else if (m) {
            const t = [],
              r = document.createElement('div');
            new m(() => {
              for (; t.length > 0; ) t.shift()();
            }).observe(r, { attributes: !0 }),
              (e = (e) => {
                t.push(e), r.setAttribute('queueStatus', '1');
              });
          }
          return e;
        })(),
        w = (() => {
          const e = s.g.MessageEvent;
          try {
            new e('message', { data: null });
          } catch {
            return (e, t = {}) => {
              const { data: r, bubbles: n = !1, cancelable: s = !1 } = t,
                a = document.createEvent('Event');
              return a.initEvent(e, n, s), (a.data = r), a;
            };
          }
          return (t, r) => new e(t, r);
        })();
      class S {
        constructor() {
          (this._dispatcher = new g()), this._workerPostMessage({ type: o.M.HANDSHAKE });
        }
        terminate() {}
        get onmessage() {
          return this._onmessageHandler;
        }
        set onmessage(e) {
          this._onmessageHandler && this.removeEventListener('message', this._onmessageHandler),
            (this._onmessageHandler = e),
            e && this.addEventListener('message', e);
        }
        get onmessageerror() {
          return this._onmessageerrorHandler;
        }
        set onmessageerror(e) {
          this._onmessageerrorHandler &&
            this.removeEventListener('messageerror', this._onmessageerrorHandler),
            (this._onmessageerrorHandler = e),
            e && this.addEventListener('messageerror', e);
        }
        get onerror() {
          return this._onerrorHandler;
        }
        set onerror(e) {
          this._onerrorHandler && this.removeEventListener('error', this._onerrorHandler),
            (this._onerrorHandler = e),
            e && this.addEventListener('error', e);
        }
        postMessage(e) {
          y(() => {
            this._workerMessageHandler(w('message', { data: e }));
          });
        }
        dispatchEvent(e) {
          return this._dispatcher.dispatchEvent(e);
        }
        addEventListener(e, t, r) {
          this._dispatcher.addEventListener(e, t, r);
        }
        removeEventListener(e, t, r) {
          this._dispatcher.removeEventListener(e, t, r);
        }
        _workerPostMessage(e) {
          y(() => {
            this.dispatchEvent(w('message', { data: e }));
          });
        }
        async _workerMessageHandler(e) {
          const t = (0, o.r)(e);
          if (t && t.type === o.M.OPEN) {
            const { modulePath: e, jobId: r } = t;
            let n = await o.default.loadWorker(e);
            n || (n = await import(e));
            const s = o.default.connect(n);
            this._workerPostMessage({ type: o.M.OPENED, jobId: r, data: s });
          }
        }
      }
      const b = u.L.getLogger('esri.core.workers'),
        { HANDSHAKE: I } = o.M;
      let v, E;
      const k = 'Failed to create Worker. Fallback to execute module in main thread';
      async function T(e) {
        return new Promise((t) => {
          function r(s) {
            const a = (0, o.r)(s);
            a &&
              a.type === I &&
              (e.removeEventListener('message', r), e.removeEventListener('error', n), t(e));
          }
          function n(t) {
            t.preventDefault(),
              e.removeEventListener('message', r),
              e.removeEventListener('error', n),
              b.warn('Failed to create Worker. Fallback to execute module in main thread', t),
              (e = new S()).addEventListener('message', r),
              e.addEventListener('error', n);
          }
          e.addEventListener('message', r), e.addEventListener('error', n);
        });
      }
      let D = 0;
      const F = u.L.getLogger('esri.core.workers'),
        { ABORT: P, INVOKE: C, OPEN: N, OPENED: A, RESPONSE: R } = o.M;
      class x {
        constructor(e, t) {
          (this._outJobs = new Map()),
            (this._inJobs = new Map()),
            (this.worker = e),
            (this.id = t),
            e.addEventListener('message', this._onMessage.bind(this)),
            e.addEventListener('error', (e) => {
              e.preventDefault(), F.error(e);
            });
        }
        static async create(e) {
          const t = await (async function () {
            if (!(0, s.h)('esri-workers')) return T(new S());
            if (!v && !E)
              try {
                const e = 'let globalId=0;const outgoing=new Map,configuration=JSON.parse("{CONFIGURATION}");self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}function invokeStaticMessage(e,o,r){const t=r&&r.signal,n=globalId++;return new Promise(((r,i)=>{if(t){if(t.aborted)return i(createAbortError());t.addEventListener("abort",(()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:5,jobId:n}),i(createAbortError()))}))}outgoing.set(n,{resolve:r,reject:i}),self.postMessage({type:4,jobId:n,methodName:e,abortable:null!=t,data:o})}))}let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,buildDate:r,version:t}=configuration.kernelInfo,{revision:n,buildDate:i,version:s}=e.kernelInfo;o!==n&&console.warn(`[esri.core.workers] Version mismatch detected between ArcGIS API for JavaScript and assets:\nAPI version: ${t} [Date: ${r}, Revision: ${o.slice(0,8)}]\nAssets version: ${s} [Date: ${i}, Revision: ${n.slice(0,8)}]`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case 1:let e;function t(o){const t=e.connect(o);self.postMessage({type:2,jobId:r,data:t},[t])}"function"==typeof define&&define.amd?require([workerPath],(r=>{e=r.default||r,checkWorkerRevision(e),e.loadWorker(o.modulePath).then((e=>e||new Promise((e=>{require([o.modulePath],e)})))).then(t)})):"System"in self&&"function"==typeof System.import?System.import(workerPath).then((r=>(e=r.default,checkWorkerRevision(e),e.loadWorker(o.modulePath)))).then((e=>e||System.import(o.modulePath))).then(t):(self.RemoteClient||importScripts(workerPath),e=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(e),e.loadWorker(o.modulePath).then(t));break;case 3:if(outgoing.has(r)){const e=outgoing.get(r);outgoing.delete(r),o.error?e.reject(JSON.parse(o.error)):e.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});'.replace(
                  '"{CONFIGURATION}"',
                  `'${(function () {
                    let e;
                    if (null != h.Z.default) {
                      const t = { ...h.Z };
                      delete t.default, (e = JSON.parse(JSON.stringify(t)));
                    } else e = JSON.parse(JSON.stringify(h.Z));
                    (e.assetsPath = (0, d.hF)(e.assetsPath)),
                      (e.request.interceptors = []),
                      (e.log.interceptors = []),
                      (e.locale = (0, _.g)()),
                      (e.has = {
                        'csp-restrictions': (0, s.h)('csp-restrictions'),
                        'esri-2d-debug': !1,
                        'esri-2d-update-debug': (0, s.h)('esri-2d-update-debug'),
                        'esri-2d-query-centroid-enabled': (0, s.h)(
                          'esri-2d-query-centroid-enabled',
                        ),
                        'featurelayer-pbf': (0, s.h)('featurelayer-pbf'),
                        'esri-atomics': (0, s.h)('esri-atomics'),
                        'esri-shared-array-buffer': (0, s.h)('esri-shared-array-buffer'),
                        'esri-tiles-debug': (0, s.h)('esri-tiles-debug'),
                        'esri-workers-arraybuffer-transfer': (0, s.h)(
                          'esri-workers-arraybuffer-transfer',
                        ),
                        'host-webworker': 1,
                      }),
                      e.workers.loaderUrl
                        ? (e.workers.loaderUrl = (0, d.hF)(e.workers.loaderUrl))
                        : f && (e.workers.loaderUrl = f),
                      e.workers.workerPath
                        ? (e.workers.workerPath = (0, d.hF)(e.workers.workerPath))
                        : (e.workers.workerPath = 'esri/core/workers/RemoteClient');
                    const t = h.Z.workers.loaderConfig,
                      r = (function (e) {
                        var t;
                        const r = {
                          async: e.async,
                          isDebug: e.isDebug,
                          locale: e.locale,
                          baseUrl: e.baseUrl,
                          has: { ...e.has },
                          map: { ...e.map },
                          packages: (e.packages && e.packages.concat()) || [],
                          paths: { ...e.paths },
                        };
                        return (
                          e.hasOwnProperty('async') || (r.async = !0),
                          e.hasOwnProperty('isDebug') || (r.isDebug = !1),
                          e.baseUrl || (r.baseUrl = p.baseUrl),
                          null == (t = p.packages) ||
                            t.forEach((e) => {
                              !(function (e, t) {
                                for (const r of e) if (r.name === t.name) return;
                                e.push(t);
                              })(r.packages, e);
                            }),
                          r
                        );
                      })({
                        baseUrl: null == t ? void 0 : t.baseUrl,
                        locale: (0, _.g)(),
                        has: {
                          'csp-restrictions': (0, s.h)('csp-restrictions'),
                          'dojo-test-sniff': 0,
                          'host-webworker': 1,
                          ...(null == t ? void 0 : t.has),
                        },
                        map: { ...(null == t ? void 0 : t.map) },
                        paths: { ...(null == t ? void 0 : t.paths) },
                        packages: (null == t ? void 0 : t.packages) || [],
                      }),
                      n = { version: l.i8, buildDate: l.rh, revision: l.LB };
                    return JSON.stringify({ esriConfig: e, loaderConfig: r, kernelInfo: n });
                  })()}'`,
                );
                v = URL.createObjectURL(new Blob([e], { type: 'text/javascript' }));
              } catch (e) {
                E = e || {};
              }
            let e;
            if (v)
              try {
                e = new Worker(v, { name: 'esri-worker-' + D++ });
              } catch (t) {
                b.warn(k, E), (e = new S());
              }
            else b.warn(k, E), (e = new S());
            return T(e);
          })();
          return new x(t, e);
        }
        terminate() {
          this.worker.terminate();
        }
        async open(e, t = {}) {
          const { signal: r } = t,
            n = (0, o.n)();
          return new Promise((t, s) => {
            const i = {
              resolve: t,
              reject: s,
              abortHandle: (0, a.$F)(r, () => {
                this._outJobs.delete(n), this._post({ type: P, jobId: n });
              }),
            };
            this._outJobs.set(n, i), this._post({ type: N, jobId: n, modulePath: e });
          });
        }
        _onMessage(e) {
          const t = (0, o.r)(e);
          if (t)
            switch (t.type) {
              case A:
                this._onOpenedMessage(t);
                break;
              case R:
                this._onResponseMessage(t);
                break;
              case P:
                this._onAbortMessage(t);
                break;
              case C:
                this._onInvokeMessage(t);
            }
        }
        _onAbortMessage(e) {
          const t = this._inJobs,
            r = e.jobId,
            n = t.get(r);
          n && (n.controller && n.controller.abort(), t.delete(r));
        }
        _onInvokeMessage(e) {
          const { methodName: t, jobId: r, data: n, abortable: s } = e,
            i = s ? (0, a.yi)() : null,
            u = this._inJobs,
            c = l.Nv[t];
          let h;
          try {
            if ('function' != typeof c) throw new TypeError(`${t} is not a function`);
            h = c.call(null, n, { signal: i ? i.signal : null });
          } catch (e) {
            return void this._post({ type: R, jobId: r, error: (0, o.t)(e) });
          }
          (0, a.y8)(h)
            ? (u.set(r, { controller: i, promise: h }),
              h.then(
                (e) => {
                  u.has(r) && (u.delete(r), this._post({ type: R, jobId: r }, e));
                },
                (e) => {
                  u.has(r) &&
                    (u.delete(r),
                    e || (e = { message: 'Error encountered at method' + t }),
                    (0, a.D_)(e) ||
                      this._post({
                        type: R,
                        jobId: r,
                        error: (0, o.t)(e || { message: `Error encountered at method ${t}` }),
                      }));
                },
              ))
            : this._post({ type: R, jobId: r }, h);
        }
        _onOpenedMessage(e) {
          var t;
          const { jobId: r, data: n } = e,
            s = this._outJobs.get(r);
          s && (this._outJobs.delete(r), null == (t = s.abortHandle) || t.remove(), s.resolve(n));
        }
        _onResponseMessage(e) {
          var t;
          const { jobId: r, error: s, data: a } = e,
            i = this._outJobs.get(r);
          i &&
            (this._outJobs.delete(r),
            null == (t = i.abortHandle) || t.remove(),
            s ? i.reject(n.Z.fromJSON(JSON.parse(s))) : i.resolve(a));
        }
        _post(e, t, r) {
          return (0, o.p)(this.worker, e, t, r);
        }
      }
      let O = (0, s.h)('esri-workers-debug')
        ? 1
        : (0, s.h)('host-browser')
        ? navigator.hardwareConcurrency - 1
        : 0;
      O || (O = ((0, s.h)('safari') && (0, s.h)('mac')) || (0, s.h)('trident') ? 7 : 2);
      let M = 0;
      const L = [];
      function U(e, t) {
        return B(e, { client: t });
      }
      async function B(e, t) {
        const r = new i.Z();
        return await r.open(e, t), r;
      }
      async function G(e, t = {}) {
        if ('string' != typeof e)
          throw new n.Z('workers:undefined-module', 'modulePath is missing');
        let r = t.strategy || 'distributed';
        if (
          ((0, s.h)('host-webworker') && !(0, s.h)('esri-workers') && (r = 'local'), 'local' === r)
        ) {
          let r = await o.default.loadWorker(e);
          r || (r = await import(e)), (0, a.k_)(t.signal);
          const n = t.client || r;
          return B([o.default.connect(r)], { ...t, client: n });
        }
        if (
          (await (async function () {
            if (H) return H;
            Y = (0, a.yi)();
            const e = [];
            for (let t = 0; t < O; t++) {
              const r = x.create(t).then((e) => ((L[t] = e), e));
              e.push(r);
            }
            return (H = Promise.all(e)), H;
          })(),
          (0, a.k_)(t.signal),
          'dedicated' === r)
        ) {
          const r = M++ % O;
          return B([await L[r].open(e, t)], t);
        }
        if (t.maxNumWorkers && t.maxNumWorkers > 0) {
          const r = Math.min(t.maxNumWorkers, O);
          if (r < O) {
            const n = new Array(r);
            for (let s = 0; s < r; ++s) {
              const r = M++ % O;
              n[s] = L[r].open(e, t);
            }
            return B(n, t);
          }
        }
        return B(
          L.map((r) => r.open(e, t)),
          t,
        );
      }
      let Y,
        H = null;
    },
    42870: (e, t, r) => {
      'use strict';
      r.d(t, {
        f3: () => P,
        oq: () => c,
        r3: () => d,
        jU: () => _,
        z7: () => h,
        Cz: () => R,
        e5: () => E,
        ED: () => w,
        TE: () => f,
        fS: () => p,
        D$: () => A,
        Y4: () => L,
        rd: () => C,
        j2: () => x,
        kQ: () => U,
        wf: () => T,
        kK: () => g,
        Gg: () => I,
        cv: () => F,
        Nm: () => S,
        CJ: () => O,
        sz: () => M,
        LV: () => b,
        U1: () => N,
        og: () => v,
        Sp: () => k,
        W4: () => m,
        G0: () => D,
        uh: () => y,
      }),
        r(74569);
      var n = r(65514),
        s = (r(91597), r(32422));
      function a(e) {
        var t;
        return Array.isArray(e)
          ? null == (t = e[0])
            ? void 0
            : t.spatialReference
          : null == e
          ? void 0
          : e.spatialReference;
      }
      function i(e) {
        return e ? (Array.isArray(e) ? e.map(i) : e.toJSON ? e.toJSON() : e) : e;
      }
      function o(e) {
        return Array.isArray(e) ? e.map((e) => (0, s.im)(e)) : (0, s.im)(e);
      }
      let l;
      async function u(e, t) {
        return (
          await (async function () {
            return l || (l = (0, n.bA)('geometryEngineWorker', { strategy: 'distributed' })), l;
          })()
        ).invoke('executeGEOperation', { operation: e, parameters: i(t) });
      }
      async function c(e, t) {
        return o(await u('clip', [a(e), e, t]));
      }
      async function h(e, t) {
        return o(await u('cut', [a(e), e, t]));
      }
      function d(e, t) {
        return u('contains', [a(e), e, t]);
      }
      function _(e, t) {
        return u('crosses', [a(e), e, t]);
      }
      function f(e, t, r) {
        return u('distance', [a(e), e, t, r]);
      }
      function p(e, t) {
        return u('equals', [a(e), e, t]);
      }
      function g(e, t) {
        return u('intersects', [a(e), e, t]);
      }
      function m(e, t) {
        return u('touches', [a(e), e, t]);
      }
      function y(e, t) {
        return u('within', [a(e), e, t]);
      }
      function w(e, t) {
        return u('disjoint', [a(e), e, t]);
      }
      function S(e, t) {
        return u('overlaps', [a(e), e, t]);
      }
      function b(e, t, r) {
        return u('relate', [a(e), e, t, r]);
      }
      function I(e) {
        return u('isSimple', [a(e), e]);
      }
      async function v(e) {
        return o(await u('simplify', [a(e), e]));
      }
      async function E(e, t) {
        return o(await u('difference', [a(e), e, t]));
      }
      async function k(e, t) {
        return o(await u('symmetricDifference', [a(e), e, t]));
      }
      async function T(e, t) {
        return o(await u('intersect', [a(e), e, t]));
      }
      async function D(e, t = null) {
        const r = (function (e, t) {
          let r;
          return Array.isArray(e) ? (r = e) : ((r = []), r.push(e), null != t && r.push(t)), r;
        })(e, t);
        return o(await u('union', [a(r), r]));
      }
      async function F(e, t, r, n, s, i) {
        return o(await u('offset', [a(e), e, t, r, n, s, i]));
      }
      async function P(e, t, r, n = !1) {
        const s = [a(e), e, t, r, n];
        return o(await u('buffer', s));
      }
      async function C(e, t, r, n, s, i) {
        const l = [a(e), e, t, r, n, s, i];
        return o(await u('geodesicBuffer', l));
      }
      async function N(e, t, r) {
        var n;
        if (null == e) throw new Error('Illegal Argument Exception');
        const s = e.spatialReference;
        r =
          null != (n = r)
            ? n
            : (function (e) {
                return 'xmin' in e ? e.center : 'x' in e ? e : e.extent.center;
              })(e);
        const a = e.constructor.fromJSON(await u('rotate', [s, e, t, r]));
        return (a.spatialReference = s), a;
      }
      async function A(e, t, r, n) {
        return o(await u('generalize', [a(e), e, t, r, n]));
      }
      async function R(e, t, r) {
        return o(await u('densify', [a(e), e, t, r]));
      }
      async function x(e, t, r, n = 0) {
        return o(await u('geodesicDensify', [a(e), e, t, r, n]));
      }
      function O(e, t) {
        return u('planarArea', [a(e), e, t]);
      }
      function M(e, t) {
        return u('planarLength', [a(e), e, t]);
      }
      function L(e, t, r) {
        return u('geodesicArea', [a(e), e, t, r]);
      }
      function U(e, t, r) {
        return u('geodesicLength', [a(e), e, t, r]);
      }
      r(91306),
        r(76506),
        r(92143),
        r(31450),
        r(71552),
        r(40642),
        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(35132),
        r(89623),
        r(86787),
        r(84069),
        r(44567),
        r(98380),
        r(92896),
        r(22781),
        r(57251),
        r(46987),
        r(37453),
        r(88762),
        r(32101),
        r(73173),
        r(82058),
        r(66284),
        r(33921),
        r(3482);
    },
  },
]);
