1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533 |
- import {
- e
- } from "./chunk-KD6NQDSX.js";
- import {
- C as C2,
- N,
- a as a2,
- c as c3,
- d as d2,
- f as f4,
- f2 as f5,
- g as g2,
- i as i2,
- l,
- m as m2,
- n as n5,
- o,
- o2,
- p as p2,
- s as s4,
- s2 as s5,
- t as t2,
- t2 as t3,
- w,
- y as y2
- } from "./chunk-MDR3KRG4.js";
- import {
- J
- } from "./chunk-PLCWBBQ4.js";
- import {
- n as n4,
- s as s3
- } from "./chunk-UEYSTU4P.js";
- import {
- f as f2
- } from "./chunk-4GGDRIJK.js";
- import {
- c as c2
- } from "./chunk-BJT4XIGU.js";
- import {
- D,
- F,
- Me,
- S,
- b,
- i3 as i,
- n2 as n,
- t3 as t
- } from "./chunk-FT2BCPUP.js";
- import {
- s as s2
- } from "./chunk-BY5BVC57.js";
- import {
- Ze
- } from "./chunk-WM52QDLS.js";
- import {
- n as n2,
- x as x4
- } from "./chunk-LXOC7SMQ.js";
- import {
- d
- } from "./chunk-VBR5BOXI.js";
- import {
- x as x3
- } from "./chunk-NLLFSKB2.js";
- import {
- f as f3
- } from "./chunk-ISHZAVNR.js";
- import {
- a
- } from "./chunk-XJHQZ4NT.js";
- import {
- ut
- } from "./chunk-JKFWEHNK.js";
- import {
- n as n3
- } from "./chunk-NQA5XJGK.js";
- import {
- g
- } from "./chunk-7C23ILQ4.js";
- import {
- m,
- x as x2
- } from "./chunk-WD4J43GZ.js";
- import {
- r
- } from "./chunk-JLSNMUQJ.js";
- import {
- y
- } from "./chunk-JGBXYDGB.js";
- import {
- x
- } from "./chunk-YUA3AHKR.js";
- import {
- j
- } from "./chunk-LU5IJZB4.js";
- import {
- v
- } from "./chunk-RMDDCMKS.js";
- import {
- U
- } from "./chunk-DVUG3KID.js";
- import {
- s
- } from "./chunk-FWSQEIAR.js";
- import {
- p
- } from "./chunk-6T6G6LCQ.js";
- import {
- k2 as k
- } from "./chunk-PQFTYGF5.js";
- import {
- C
- } from "./chunk-V6P2MAQQ.js";
- import {
- c,
- f
- } from "./chunk-YXWMMD76.js";
- // node_modules/@arcgis/core/arcade/featureSetCollection.js
- var e2 = class {
- constructor() {
- this.declaredRootClass = "esri.arcade.featureSetCollection", this._layerById = {}, this._layerByName = {};
- }
- add(e4, t5, a6) {
- this._layerById[t5] = a6, this._layerByName[e4] = a6;
- }
- async featureSetByName(e4, t5 = true, a6 = ["*"]) {
- return void 0 === this._layerByName[e4] ? null : this._layerByName[e4];
- }
- async featureSetById(e4, t5 = true, a6 = ["*"]) {
- return void 0 === this._layerById[e4] ? null : this._layerById[e4];
- }
- castToText(e4 = false) {
- return "object, FeatureSetCollection";
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/actions/AttributeFilter.js
- var c4 = class extends C2 {
- constructor(e4) {
- super(e4), this.declaredClass = "esri.arcade.featureset.actions.AttributeFilter", this._maxProcessing = 1e3, this._parent = e4.parentfeatureset, e4.whereclause instanceof f2 ? (this._whereclause = e4.whereclause, this._whereClauseFunction = null) : (this._whereClauseFunction = e4.whereclause, this._whereclause = null);
- }
- _initialiseFeatureSet() {
- null !== this._parent ? (this.fields = this._parent.fields.slice(0), this.geometryType = this._parent.geometryType, this.objectIdField = this._parent.objectIdField, this.globalIdField = this._parent.globalIdField, this.spatialReference = this._parent.spatialReference, this.hasM = this._parent.hasM, this.hasZ = this._parent.hasZ, this.typeIdField = this._parent.typeIdField, this.types = this._parent.types) : (this.fields = [], this.typeIdField = "", this.objectIdField = "", this.globalIdField = "", this.spatialReference = new k({ wkid: 4326 }), this.geometryType = S.point);
- }
- async _getSet(e4) {
- if (null === this._wset) {
- await this._ensureLoaded();
- const t5 = await this._parent._getFilteredSet("", null, this._whereclause, null, e4);
- return this._checkCancelled(e4), null !== this._whereClauseFunction ? this._wset = new t3(t5._candidates.slice(0).concat(t5._known.slice(0)), [], t5._ordered, this._clonePageDefinition(t5.pagesDefinition)) : this._wset = new t3(t5._candidates.slice(0), t5._known.slice(0), t5._ordered, this._clonePageDefinition(t5.pagesDefinition)), this._wset;
- }
- return this._wset;
- }
- _isInFeatureSet(e4) {
- var _a;
- let t5 = (_a = this._parent) == null ? void 0 : _a._isInFeatureSet(e4);
- return t5 === i.NotInFeatureSet ? t5 : (t5 = this._idstates[e4], void 0 === t5 ? i.Unknown : t5);
- }
- _getFeature(e4, t5, s7) {
- return this._parent._getFeature(e4, t5, s7);
- }
- _getFeatures(e4, t5, s7, i3) {
- return this._parent._getFeatures(e4, t5, s7, i3);
- }
- _featureFromCache(e4) {
- return this._parent._featureFromCache(e4);
- }
- executeWhereClause(e4) {
- var _a, _b;
- return (_b = (_a = this._whereclause) == null ? void 0 : _a.testFeature(e4)) != null ? _b : false;
- }
- async executeWhereClauseDeferred(e4) {
- if (null !== this._whereClauseFunction) {
- const t5 = this._whereClauseFunction(e4);
- return C(t5), t5;
- }
- return this.executeWhereClause(e4);
- }
- async _fetchAndRefineFeatures(e4, t5, s7) {
- var _a, _b, _c;
- const r2 = new t3([], e4, false, null), a6 = Math.min(t5, e4.length);
- if (await ((_a = this._parent) == null ? void 0 : _a._getFeatures(r2, -1, a6, s7)), this._checkCancelled(s7), null == this._whereClauseFunction) {
- for (let t6 = 0; t6 < a6; t6++) {
- const s8 = (_b = this._parent) == null ? void 0 : _b._featureFromCache(e4[t6]);
- true === this.executeWhereClause(s8) ? this._idstates[e4[t6]] = i.InFeatureSet : this._idstates[e4[t6]] = i.NotInFeatureSet;
- }
- return "success";
- }
- const l2 = [];
- for (let i3 = 0; i3 < a6; i3++) {
- const t6 = (_c = this._parent) == null ? void 0 : _c._featureFromCache(e4[i3]);
- l2.push(await this.executeWhereClauseDeferred(t6));
- }
- for (let i3 = 0; i3 < t5; i3++)
- true === l2[i3] ? this._idstates[e4[i3]] = i.InFeatureSet : this._idstates[e4[i3]] = i.NotInFeatureSet;
- return "success";
- }
- async _getFilteredSet(e4, t5, s7, r2, n6) {
- null !== this._whereClauseFunction || (null !== s7 ? null !== this._whereclause && (s7 = i2(this._whereclause, s7)) : s7 = this._whereclause), await this._ensureLoaded();
- const l2 = await this._parent._getFilteredSet(e4, t5, s7, r2, n6);
- let h;
- return this._checkCancelled(n6), h = null !== this._whereClauseFunction ? new t3(l2._candidates.slice(0).concat(l2._known.slice(0)), [], l2._ordered, this._clonePageDefinition(l2.pagesDefinition)) : new t3(l2._candidates.slice(0), l2._known.slice(0), l2._ordered, this._clonePageDefinition(l2.pagesDefinition)), h;
- }
- async _stat(e4, t5, s7, i3, r2, n6, l2) {
- if (null !== this._whereClauseFunction)
- return null === r2 && "" === s7 && null === i3 ? this._manualStat(e4, t5, n6, l2) : { calculated: false };
- let h = this._whereclause;
- null !== r2 && null !== this._whereclause && (h = i2(this._whereclause, r2));
- const u = await this._parent._stat(e4, t5, s7, i3, h, n6, l2);
- return false === u.calculated ? null === r2 && "" === s7 && null === i3 ? this._manualStat(e4, t5, n6, l2) : { calculated: false } : u;
- }
- async _canDoAggregates(e4, t5, s7, i3, r2) {
- return null === this._whereClauseFunction && (null !== r2 ? null !== this._whereclause && (r2 = i2(this._whereclause, r2)) : r2 = this._whereclause, null !== this._parent && this._parent._canDoAggregates(e4, t5, s7, i3, r2));
- }
- async _getAggregatePagesDataSourceDefinition(s7, i3, r2, n6, l2, h, u) {
- if (null === this._parent)
- throw new o(n5.NeverReach);
- return null !== l2 ? null !== this._whereclause && (l2 = i2(this._whereclause, l2)) : l2 = this._whereclause, this._parent._getAggregatePagesDataSourceDefinition(s7, i3, r2, n6, l2, h, u);
- }
- static registerAction() {
- C2._featuresetFunctions.filter = function(e4) {
- if ("function" == typeof e4)
- return new c4({ parentfeatureset: this, whereclause: e4 });
- let t5 = null;
- return e4 instanceof f2 && (t5 = e4), new c4({ parentfeatureset: this, whereclause: t5 });
- };
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/actions/Adapted.js
- var T = class {
- constructor(e4) {
- this.field = e4, this.sqlRewritable = false;
- }
- postInitialization(e4, t5) {
- }
- };
- var F2 = class extends T {
- constructor(e4) {
- super(e4), this.sqlRewritable = true;
- }
- extractValue(e4) {
- return e4.attributes[this.field.name];
- }
- rewriteSql(e4) {
- return { rewritten: this.sqlRewritable, where: e4 };
- }
- };
- var W = class extends T {
- constructor(e4, t5, r2) {
- super(n(e4)), this.originalField = e4, this.sqlRewritable = true, this.field.name = t5, this.field.alias = r2;
- }
- rewriteSql(e4, t5) {
- return { rewritten: this.sqlRewritable, where: c3(e4, this.field.name, this.originalField.name, t5.getFieldsIndex()) };
- }
- extractValue(e4) {
- return e4.attributes[this.originalField.name];
- }
- };
- var E = class extends T {
- constructor(e4, t5, r2) {
- super(e4), this.codefield = t5, this.lkp = r2, this.reverseLkp = {};
- for (const s7 in r2)
- this.reverseLkp[r2[s7]] = s7;
- this.sqlRewritable = true;
- }
- rewriteSql(e4, t5) {
- const r2 = this.evaluateNodeToWhereClause(e4.parseTree, t.Standardised, this.field.name, this.codefield instanceof f2 ? s5(this.codefield, t.Standardised) : this.codefield, e4.parameters);
- return r2.includes(E.BADNESS) ? { rewritten: false, where: e4 } : { rewritten: this.sqlRewritable, where: f2.create(r2, f(t5._parent).getFieldsIndex()) };
- }
- evaluateNodeToWhereClause(e4, t5, a6 = null, i3 = null, l2) {
- let n6, o3, h, u;
- switch (e4.type) {
- case "interval":
- return N(this.evaluateNodeToWhereClause(e4.value, t5, a6, i3, l2), e4.qualifier, e4.op);
- case "case-expression": {
- let r2 = " CASE ";
- "simple" === e4.format && (r2 += this.evaluateNodeToWhereClause(e4.operand, t5, a6, E.BADNESS, l2));
- for (let s7 = 0; s7 < e4.clauses.length; s7++)
- r2 += " WHEN " + this.evaluateNodeToWhereClause(e4.clauses[s7].operand, t5, a6, E.BADNESS, l2) + " THEN " + this.evaluateNodeToWhereClause(e4.clauses[s7].value, t5, a6, E.BADNESS, l2);
- return null !== e4.else && (r2 += " ELSE " + this.evaluateNodeToWhereClause(e4.else, t5, a6, E.BADNESS, l2)), r2 += " END ", r2;
- }
- case "parameter": {
- const r2 = l2[e4.value.toLowerCase()];
- if ("string" == typeof r2) {
- return "'" + l2[e4.value.toLowerCase()].toString().replace(/'/g, "''") + "'";
- }
- if (r2 instanceof Date)
- return f4(r2, t5);
- if (r2 instanceof Array) {
- const e5 = [];
- for (let s7 = 0; s7 < r2.length; s7++)
- "string" == typeof r2[s7] ? e5.push("'" + r2[s7].toString().replace(/'/g, "''") + "'") : r2[s7] instanceof Date ? e5.push(f4(r2[s7], t5)) : e5.push(r2[s7].toString());
- return e5;
- }
- return r2.toString();
- }
- case "expression-list":
- o3 = [];
- for (const r2 of e4.value)
- o3.push(this.evaluateNodeToWhereClause(r2, t5, a6, i3, l2));
- return o3;
- case "unary-expression":
- return " ( NOT " + this.evaluateNodeToWhereClause(e4.expr, t5, a6, E.BADNESS, l2) + " ) ";
- case "binary-expression":
- switch (e4.operator) {
- case "AND":
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " AND " + this.evaluateNodeToWhereClause(e4.right, t5, a6, i3, l2) + ") ";
- case "OR":
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " OR " + this.evaluateNodeToWhereClause(e4.right, t5, a6, i3, l2) + ") ";
- case "IS":
- if ("null" !== e4.right.type)
- throw new s4(t2.UnsupportedIsRhs);
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " IS NULL )";
- case "ISNOT":
- if ("null" !== e4.right.type)
- throw new s4(t2.UnsupportedIsRhs);
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " IS NOT NULL )";
- case "IN":
- if (n6 = [], "expression-list" === e4.right.type) {
- if ("column-reference" === e4.left.type && e4.left.column.toUpperCase() === this.field.name.toUpperCase()) {
- const r2 = [];
- let s7 = true;
- for (const t6 of e4.right.value) {
- if ("string" !== t6.type) {
- s7 = false;
- break;
- }
- if (void 0 === this.lkp[t6.value]) {
- s7 = false;
- break;
- }
- r2.push(this.lkp[t6.value].toString());
- }
- if (s7)
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " IN (" + r2.join(",") + ")) ";
- }
- return n6 = this.evaluateNodeToWhereClause(e4.right, t5, a6, i3, l2), " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " IN (" + n6.join(",") + ")) ";
- }
- return u = this.evaluateNodeToWhereClause(e4.right, t5, a6, i3, l2), u instanceof Array ? " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " IN (" + u.join(",") + ")) " : " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " IN (" + u + ")) ";
- case "NOT IN":
- if (n6 = [], "expression-list" === e4.right.type) {
- if ("column-reference" === e4.left.type && e4.left.column.toUpperCase() === this.field.name.toUpperCase()) {
- const r2 = [];
- let s7 = true;
- for (const t6 of e4.right.value) {
- if ("string" !== t6.type) {
- s7 = false;
- break;
- }
- if (void 0 === this.lkp[t6.value]) {
- s7 = false;
- break;
- }
- r2.push(this.lkp[t6.value].toString());
- }
- if (s7)
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " NOT IN (" + r2.join(",") + ")) ";
- }
- return n6 = this.evaluateNodeToWhereClause(e4.right, t5, a6, i3, l2), " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " NOT IN (" + n6.join(",") + ")) ";
- }
- return u = this.evaluateNodeToWhereClause(e4.right, t5, a6, i3, l2), u instanceof Array ? " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " NOT IN (" + u.join(",") + ")) " : " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, i3, l2) + " NOT IN (" + u + ")) ";
- case "BETWEEN":
- return h = this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2), " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " BETWEEN " + h[0] + " AND " + h[1] + " ) ";
- case "NOTBETWEEN":
- return h = this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2), " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " NOT BETWEEN " + h[0] + " AND " + h[1] + " ) ";
- case "LIKE":
- return "" !== e4.escape ? " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " LIKE " + this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2) + " ESCAPE '" + e4.escape + "') " : " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " LIKE " + this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2) + ") ";
- case "NOT LIKE":
- return "" !== e4.escape ? " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " NOT LIKE " + this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2) + " ESCAPE '" + e4.escape + "') " : " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " NOT LIKE " + this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2) + ") ";
- case "<>":
- case "=":
- if ("column-reference" === e4.left.type && "string" === e4.right.type) {
- if (e4.left.column.toUpperCase() === this.field.name.toUpperCase() && void 0 !== this.lkp[e4.right.value.toString()])
- return " (" + i3 + " " + e4.operator + " " + this.lkp[e4.right.value.toString()].toString() + ") ";
- } else if ("column-reference" === e4.right.type && "string" === e4.left.type && e4.right.column.toUpperCase() === this.field.name.toUpperCase())
- return " (" + this.lkp[e4.right.value.toString()].toString() + " " + e4.operator + " " + i3 + ") ";
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " " + e4.operator + " " + this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2) + ") ";
- case "<":
- case ">":
- case ">=":
- case "<=":
- case "*":
- case "-":
- case "+":
- case "/":
- return " (" + this.evaluateNodeToWhereClause(e4.left, t5, a6, E.BADNESS, l2) + " " + e4.operator + " " + this.evaluateNodeToWhereClause(e4.right, t5, a6, E.BADNESS, l2) + ") ";
- }
- case "null":
- return "null";
- case "boolean":
- return true === e4.value ? "1" : "0";
- case "string":
- return "'" + e4.value.toString().replace(/'/g, "''") + "'";
- case "timestamp":
- case "date":
- return f4(e4.value, t5);
- case "number":
- return e4.value.toString();
- case "current-time":
- return d2("date" === e4.mode, t5);
- case "column-reference":
- return a6 && a6.toLowerCase() === e4.column.toLowerCase() ? "(" + i3 + ")" : e4.column;
- case "function": {
- const r2 = this.evaluateNodeToWhereClause(e4.args, t5, a6, E.BADNESS, l2);
- return l(e4.name, r2, t5);
- }
- }
- throw new s4(t2.UnsupportedSyntax, { node: e4.type });
- }
- extractValue(e4) {
- return this.codefield instanceof f2 ? this.reverseLkp[this.codefield.calculateValueCompiled(e4)] : this.reverseLkp[e4.attributes[this.codefield]];
- }
- };
- E.BADNESS = "_!!!_BAD_LKP_!!!!";
- var x5 = class extends T {
- constructor(e4, t5) {
- super(e4), this._sql = t5;
- }
- rewriteSql(e4, t5) {
- return { rewritten: true, where: c3(e4, this.field.name, s5(this._sql, t.Standardised), t5.getFieldsIndex()) };
- }
- extractValue(e4) {
- return this._sql.calculateValueCompiled(e4);
- }
- };
- var A = class extends C2 {
- constructor(e4) {
- super(e4), this._calcFunc = null, this.declaredClass = "esri.arcade.featureset.actions.Adapted", this.adaptedFields = [], this._extraFilter = null, this._extraFilter = e4.extraFilter, this._parent = e4.parentfeatureset, this._maxProcessing = 30, this.adaptedFields = e4.adaptedFields;
- }
- static findField(e4, t5) {
- for (const r2 of e4)
- if (r2.name.toLowerCase() === t5.toString().toLowerCase())
- return r2;
- return null;
- }
- _initialiseFeatureSet() {
- null !== this._parent ? (this.geometryType = this._parent.geometryType, this.objectIdField = this._parent.objectIdField, this.globalIdField = this._parent.globalIdField, this.spatialReference = this._parent.spatialReference, this.hasM = this._parent.hasM, this.hasZ = this._parent.hasZ, this.typeIdField = this._parent.typeIdField, this.types = this._parent.types) : (this.spatialReference = new k({ wkid: 4326 }), this.objectIdField = "", this.globalIdField = "", this.geometryType = S.point, this.typeIdField = "", this.types = null), this.fields = [];
- for (const e4 of this.adaptedFields)
- e4.postInitialization(this, this._parent), this.fields.push(e4.field);
- }
- async _getSet(e4) {
- var _a;
- if (null === this._wset) {
- await this._ensureLoaded();
- let t5 = null;
- return t5 = this._extraFilter ? await this._getFilteredSet("", null, null, null, e4) : await ((_a = this._parent) == null ? void 0 : _a._getSet(e4)), this._checkCancelled(e4), c(t5), this._wset = new t3(t5._candidates.slice(0), t5._known.slice(0), t5._ordered, this._clonePageDefinition(t5.pagesDefinition)), this._wset;
- }
- return this._wset;
- }
- _isInFeatureSet(e4) {
- return f(this._parent)._isInFeatureSet(e4);
- }
- async _getFeatures(r2, s7, a6, i3) {
- var _a, _b;
- const l2 = [];
- -1 !== s7 && void 0 === this._featureCache[s7] && l2.push(s7);
- const o3 = this._maxQueryRate();
- if (true === this._checkIfNeedToExpandKnownPage(r2, o3))
- return await this._expandPagedSet(r2, o3, 0, 0, i3), this._getFeatures(r2, s7, a6, i3);
- let h = 0;
- for (let e4 = r2._lastFetchedIndex; e4 < r2._known.length && (h++, h <= a6 && (r2._lastFetchedIndex += 1), !(void 0 === this._featureCache[r2._known[e4]] && (r2._known[e4] !== s7 && l2.push(r2._known[e4]), l2.length >= o3))); e4++)
- ;
- if (0 === l2.length)
- return "success";
- r2 = new t3([], l2, r2._ordered, null);
- const u = Math.min(l2.length, a6);
- await ((_a = this._parent) == null ? void 0 : _a._getFeatures(r2, -1, u, i3)), this._checkCancelled(i3);
- const c5 = [];
- for (let e4 = 0; e4 < u; e4++) {
- const t5 = (_b = this._parent) == null ? void 0 : _b._featureFromCache(l2[e4]);
- void 0 !== t5 && c5.push({ geometry: t5.geometry, attributes: t5.attributes, id: l2[e4] });
- }
- for (const n6 of c5) {
- const r3 = [];
- for (const e4 of this.adaptedFields)
- r3[e4.field.name] = e4.extractValue(n6);
- this._featureCache[n6.id] = new g({ attributes: r3, geometry: c2(n6.geometry) });
- }
- return "success";
- }
- async _fetchAndRefineFeatures() {
- throw new o(n5.NeverReach);
- }
- async _getFilteredSet(e4, t5, r2, s7, a6) {
- let i3 = false;
- const l2 = this._reformulateWithoutAdaptions(r2);
- i3 = l2.cannot, r2 = l2.where;
- let o3 = false;
- if (null !== s7) {
- o3 = true;
- const e5 = [];
- for (const t6 of this.adaptedFields)
- if (!(t6 instanceof F2) && true === s7.scanForField(t6.field.name)) {
- if (!(t6 instanceof W)) {
- s7 = null, o3 = false;
- break;
- }
- e5.push({ field: t6.field.name, newfield: t6.originalField.name });
- }
- s7 && e5.length > 0 && (s7 = s7.replaceFields(e5));
- }
- null !== r2 ? null !== this._extraFilter && (r2 = i2(this._extraFilter, r2)) : r2 = this._extraFilter, await this._ensureLoaded();
- const h = await f(this._parent)._getFilteredSet(e4, t5, r2, s7, a6);
- let u;
- return this._checkCancelled(a6), u = true === i3 ? new t3(h._candidates.slice(0).concat(h._known.slice(0)), [], true === o3 && h._ordered, this._clonePageDefinition(h.pagesDefinition)) : new t3(h._candidates.slice(0), h._known.slice(0), true === o3 && h._ordered, this._clonePageDefinition(h.pagesDefinition)), u;
- }
- _reformulateWithoutAdaptions(e4) {
- const t5 = { cannot: false, where: e4 };
- if (null !== e4) {
- for (const r2 of this.adaptedFields)
- if (true === y2(e4, r2.field.name)) {
- const s7 = r2.rewriteSql(e4, this);
- if (true !== s7.rewritten) {
- t5.cannot = true, t5.where = null;
- break;
- }
- t5.where = s7.where;
- }
- }
- return t5;
- }
- async _stat(e4, t5, r2, s7, a6, i3, l2) {
- let n6 = false, o3 = this._reformulateWithoutAdaptions(t5);
- if (n6 = o3.cannot, t5 = o3.where, o3 = this._reformulateWithoutAdaptions(a6), n6 = n6 || o3.cannot, null !== (a6 = o3.where) ? null !== this._extraFilter && (a6 = i2(this._extraFilter, a6)) : a6 = this._extraFilter, true === n6)
- return null === a6 && "" === r2 && null === s7 ? this._manualStat(e4, t5, i3, l2) : { calculated: false };
- const h = await f(this._parent)._stat(e4, t5, r2, s7, a6, i3, l2);
- return false === h.calculated ? null === a6 && "" === r2 && null === s7 ? this._manualStat(e4, t5, i3, l2) : { calculated: false } : h;
- }
- async _canDoAggregates(e4, t5, r2, s7, a6) {
- if (null === this._parent)
- return false;
- for (let n6 = 0; n6 < e4.length; n6++)
- for (const t6 of this.adaptedFields)
- if (e4[n6].toLowerCase() === t6.field.name.toLowerCase() && !(t6 instanceof F2))
- return false;
- const i3 = [];
- for (let n6 = 0; n6 < t5.length; n6++) {
- const e5 = t5[n6];
- if (null !== e5.workingexpr) {
- const t6 = this._reformulateWithoutAdaptions(e5.workingexpr);
- if (t6.cannot)
- return false;
- const r3 = e5.clone();
- r3.workingexpr = t6.where, i3.push(r3);
- } else
- i3.push(e5);
- }
- const l2 = this._reformulateWithoutAdaptions(a6);
- return !l2.cannot && (null !== (a6 = l2.where) ? null !== this._extraFilter && (a6 = i2(this._extraFilter, a6)) : a6 = this._extraFilter, this._parent._canDoAggregates(e4, i3, r2, s7, a6));
- }
- async _getAggregatePagesDataSourceDefinition(e4, t5, r2, s7, l2, n6, o3) {
- if (null === this._parent)
- throw new o(n5.NeverReach);
- const h = [];
- for (let c5 = 0; c5 < t5.length; c5++) {
- const e5 = t5[c5];
- if (null !== e5.workingexpr) {
- const t6 = this._reformulateWithoutAdaptions(e5.workingexpr);
- if (t6.cannot)
- throw new o(n5.NeverReach);
- const r3 = e5.clone();
- r3.workingexpr = t6.where, h.push(r3);
- } else
- h.push(e5);
- }
- const u = this._reformulateWithoutAdaptions(l2);
- if (u.cannot)
- throw new o(n5.NeverReach);
- return null !== (l2 = u.where) ? null !== this._extraFilter && (l2 = i2(this._extraFilter, l2)) : l2 = this._extraFilter, this._parent._getAggregatePagesDataSourceDefinition(e4, h, r2, s7, l2, n6, o3);
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/support/OrderbyClause.js
- function t4(t5, e4) {
- return t5 === e4 ? 0 : null === t5 ? -1 : null === e4 ? 1 : t5 < e4 ? -1 : 1;
- }
- var e3 = class {
- constructor(t5) {
- const e4 = t5.split(",");
- this._fields = [], this._directions = [];
- for (let s7 = 0; s7 < e4.length; s7++) {
- const t6 = e4[s7].match(/\S+/g);
- this._fields.push(t6[0]), 2 === t6.length ? "asc" === t6[1].toLowerCase() ? this._directions.push(1) : this._directions.push(0) : this._directions.push(1);
- }
- }
- constructClause() {
- let t5 = "";
- for (let e4 = 0; e4 < this._fields.length; e4++)
- 0 !== e4 && (t5 += ","), t5 += this._fields[e4], 1 === this._directions[e4] ? t5 += " ASC" : t5 += " DESC";
- return t5;
- }
- order(e4) {
- e4.sort((e5, s7) => {
- for (let i3 = 0; i3 < this._fields.length; i3++) {
- const r2 = this.featureValue(e5.feature, this._fields[i3], i3), l2 = this.featureValue(s7.feature, this._fields[i3], i3);
- let o3 = 0;
- if (o3 = 1 === this._directions[i3] ? t4(r2, l2) : -1 * t4(r2, l2), 0 !== o3)
- return o3;
- }
- return 0;
- });
- }
- scanForField(t5) {
- for (let e4 = 0; e4 < this._fields.length; e4++)
- if (this._fields[e4].toLowerCase().trim() === t5.toLowerCase().trim())
- return true;
- return false;
- }
- replaceFields(t5) {
- let s7 = "";
- for (let e4 = 0; e4 < this._fields.length; e4++) {
- 0 !== e4 && (s7 += ",");
- let i3 = this._fields[e4];
- for (const e5 of t5)
- if (i3.toLowerCase() === e5.field.toLowerCase()) {
- i3 = e5.newfield;
- break;
- }
- s7 += i3, 1 === this._directions[e4] ? s7 += " ASC" : s7 += " DESC";
- }
- return new e3(s7);
- }
- featureValue(t5, e4, s7) {
- const i3 = t5.attributes[e4];
- if (void 0 !== i3)
- return i3;
- for (const r2 in t5.attributes)
- if (e4.toLowerCase() === r2.toLowerCase())
- return this._fields[s7] = r2, t5.attributes[r2];
- return null;
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/actions/OrderBy.js
- var a3 = class extends C2 {
- constructor(e4) {
- super(e4), this._orderbyclause = null, this.declaredClass = "esri.arcade.featureset.actions.OrderBy", this._maxProcessing = 100, this._orderbyclause = e4.orderbyclause, this._parent = e4.parentfeatureset;
- }
- async _getSet(e4) {
- if (null === this._wset) {
- await this._ensureLoaded();
- const t5 = await this._getFilteredSet("", null, null, this._orderbyclause, e4);
- return this._checkCancelled(e4), this._wset = t5, this._wset;
- }
- return this._wset;
- }
- async manualOrderSet(e4, t5) {
- var _a;
- const r2 = await this.getIdColumnDictionary(e4, [], -1, t5);
- (_a = this._orderbyclause) == null ? void 0 : _a.order(r2);
- const n6 = new t3([], [], true, null);
- for (let s7 = 0; s7 < r2.length; s7++)
- n6._known.push(r2[s7].id);
- return n6;
- }
- async getIdColumnDictionary(t5, r2, n6, s7) {
- if (n6 < t5._known.length - 1) {
- const i3 = this._maxQueryRate();
- if ("GETPAGES" === t5._known[n6 + 1])
- return await Me(this._parent._expandPagedSet(t5, i3, 0, 0, s7)), this.getIdColumnDictionary(t5, r2, n6, s7);
- let a6 = n6 + 1;
- const o3 = [];
- for (; a6 < t5._known.length && "GETPAGES" !== t5._known[a6]; )
- o3.push(t5._known[a6]), a6++;
- n6 += o3.length;
- const u = await Me(this._parent._getFeatureBatch(o3, s7));
- this._checkCancelled(s7);
- for (const e4 of u)
- r2.push({ id: e4.attributes[this.objectIdField], feature: e4 });
- return this.getIdColumnDictionary(t5, r2, n6, s7);
- }
- return t5._candidates.length > 0 ? (await Me(this._refineSetBlock(t5, this._maxProcessingRate(), s7)), this._checkCancelled(s7), this.getIdColumnDictionary(t5, r2, n6, s7)) : r2;
- }
- _isInFeatureSet(e4) {
- return this._parent._isInFeatureSet(e4);
- }
- _getFeatures(e4, t5, r2, n6) {
- return this._parent._getFeatures(e4, t5, r2, n6);
- }
- _featureFromCache(e4) {
- if (void 0 === this._featureCache[e4]) {
- const t5 = this._parent._featureFromCache(e4);
- if (void 0 === t5)
- return;
- return null === t5 ? null : (this._featureCache[e4] = t5, t5);
- }
- return this._featureCache[e4];
- }
- async _fetchAndRefineFeatures() {
- throw new o(n5.NeverReach);
- }
- async _getFilteredSet(e4, t5, r2, n6, i3) {
- await this._ensureLoaded();
- const a6 = await this._parent._getFilteredSet(e4, t5, r2, null === n6 ? this._orderbyclause : n6, i3);
- this._checkCancelled(i3);
- const o3 = new t3(a6._candidates.slice(0), a6._known.slice(0), a6._ordered, this._clonePageDefinition(a6.pagesDefinition));
- let u = true;
- if (a6._candidates.length > 0 && (u = false), false === o3._ordered) {
- let e5 = await this.manualOrderSet(o3, i3);
- return false === u && (null === t5 && null === r2 || (e5 = new t3(e5._candidates.slice(0).concat(e5._known.slice(0)), [], e5._ordered, this._clonePageDefinition(e5.pagesDefinition)))), e5;
- }
- return o3;
- }
- static registerAction() {
- C2._featuresetFunctions.orderBy = function(e4) {
- return "" === e4 ? this : new a3({ parentfeatureset: this, orderbyclause: new e3(e4) });
- };
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/support/StatsField.js
- function s6(s7) {
- if ("function" === s7.parseTree.type) {
- if (0 === s7.parseTree.args.value.length)
- return { name: s7.parseTree.name, expr: null };
- if (s7.parseTree.args.value.length > 1)
- throw new s4(t2.MissingStatisticParameters);
- const a6 = f2.create(o2(s7.parseTree.args.value[0], t.Standardised, s7.parameters), s7.fieldsIndex);
- return { name: s7.parseTree.name, expr: a6 };
- }
- return null;
- }
- var a4 = class {
- constructor() {
- this.field = "", this.tofieldname = "", this.typeofstat = "MIN", this.workingexpr = null;
- }
- clone() {
- const e4 = new a4();
- return e4.field = this.field, e4.tofieldname = this.tofieldname, e4.typeofstat = this.typeofstat, e4.workingexpr = this.workingexpr, e4;
- }
- static parseStatField(r2, n6, o3) {
- const l2 = new a4();
- l2.field = r2;
- const p3 = f2.create(n6, o3), f6 = s6(p3);
- if (null === f6)
- throw new s4(t2.UnsupportedSqlFunction, { function: "" });
- const u = f6.name.toUpperCase().trim();
- if ("MIN" === u) {
- if (l2.typeofstat = "MIN", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: "min" });
- } else if ("MAX" === u) {
- if (l2.typeofstat = "MAX", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: "max" });
- } else if ("COUNT" === u)
- l2.typeofstat = "COUNT", l2.workingexpr = f6.expr;
- else if ("STDEV" === u) {
- if (l2.typeofstat = "STDDEV", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: "stdev" });
- } else if ("SUM" === u) {
- if (l2.typeofstat = "SUM", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: "sum" });
- } else if ("MEAN" === u) {
- if (l2.typeofstat = "AVG", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: u });
- } else if ("AVG" === u) {
- if (l2.typeofstat = "AVG", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: "avg" });
- } else {
- if ("VAR" !== u)
- throw new s4(t2.UnsupportedSqlFunction, { function: u });
- if (l2.typeofstat = "VAR", l2.workingexpr = f6.expr, null === p3)
- throw new s4(t2.InvalidFunctionParameters, { function: "var" });
- }
- return l2;
- }
- toStatisticsName() {
- switch (this.typeofstat.toUpperCase()) {
- case "MIN":
- return "min";
- case "MAX":
- return "max";
- case "SUM":
- return "sum";
- case "COUNT":
- default:
- return "count";
- case "VAR":
- return "var";
- case "STDDEV":
- return "stddev";
- case "AVG":
- return "avg";
- }
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/actions/GroupBy.js
- function j2(e4) {
- if (!e4)
- return "COUNT";
- switch (e4.toLowerCase()) {
- case "max":
- return "MAX";
- case "var":
- case "variance":
- return "VAR";
- case "avg":
- case "average":
- case "mean":
- return "AVG";
- case "min":
- return "MIN";
- case "sum":
- return "SUM";
- case "stdev":
- case "stddev":
- return "STDDEV";
- case "count":
- return "COUNT";
- }
- return "COUNT";
- }
- var C3 = class extends C2 {
- constructor(e4) {
- super(e4), this._decodedStatsfield = [], this._decodedGroupbyfield = [], this._candosimplegroupby = true, this.phsyicalgroupbyfields = [], this.objectIdField = "ROW__ID", this._internalObjectIdField = "ROW__ID", this._adaptedFields = [], this.declaredClass = "esri.arcade.featureset.actions.Aggregate", this._uniqueIds = 1, this._maxQuery = 10, this._maxProcessing = 10, this._parent = e4.parentfeatureset, this._config = e4;
- }
- isTable() {
- return true;
- }
- async _getSet(e4) {
- if (null === this._wset) {
- const t5 = await this._getFilteredSet("", null, null, null, e4);
- return this._wset = t5, this._wset;
- }
- return this._wset;
- }
- _isInFeatureSet() {
- return i.InFeatureSet;
- }
- _nextUniqueName(e4) {
- for (; 1 === e4["T" + this._uniqueIds.toString()]; )
- this._uniqueIds++;
- const t5 = "T" + this._uniqueIds.toString();
- return e4[t5] = 1, t5;
- }
- _convertToEsriFieldType(e4) {
- return e4;
- }
- _initialiseFeatureSet() {
- const e4 = {};
- let t5 = false, n6 = 1;
- const r2 = this._parent ? this._parent.getFieldsIndex() : new r([]);
- for (this.objectIdField = "ROW__ID", this.globalIdField = ""; false === t5; ) {
- let e5 = false;
- for (let t6 = 0; t6 < this._config.groupbyfields.length; t6++)
- if (this._config.groupbyfields[t6].name.toLowerCase() === this.objectIdField.toLowerCase()) {
- e5 = true;
- break;
- }
- if (false === e5) {
- for (let t6 = 0; t6 < this._config.statsfields.length; t6++)
- if (this._config.statsfields[t6].name.toLowerCase() === this.objectIdField.toLowerCase()) {
- e5 = true;
- break;
- }
- }
- false === e5 ? t5 = true : (this.objectIdField = "ROW__ID" + n6.toString(), n6++);
- }
- for (const i3 of this._config.statsfields) {
- const e5 = new a4();
- e5.field = i3.name, e5.tofieldname = i3.name, e5.workingexpr = i3.expression instanceof f2 ? i3.expression : f2.create(i3.expression, r2), e5.typeofstat = j2(i3.statistic), this._decodedStatsfield.push(e5);
- }
- this._decodedGroupbyfield = [];
- for (const i3 of this._config.groupbyfields) {
- const e5 = { name: i3.name, singlefield: null, tofieldname: i3.name, expression: i3.expression instanceof f2 ? i3.expression : f2.create(i3.expression, r2) };
- this._decodedGroupbyfield.push(e5);
- }
- if (null !== this._parent) {
- this.geometryType = this._parent.geometryType, this.spatialReference = this._parent.spatialReference, this.hasM = this._parent.hasM, this.hasZ = this._parent.hasZ, this.typeIdField = "";
- for (const t6 of this._parent.fields)
- e4[t6.name.toUpperCase()] = 1;
- this.types = null;
- } else
- this.geometryType = S.point, this.typeIdField = "", this.types = null, this.spatialReference = new k({ wkid: 4326 });
- this.fields = [];
- const a6 = new a4();
- a6.field = this._nextUniqueName(e4), a6.tofieldname = this.objectIdField, a6.workingexpr = f2.create(this._parent.objectIdField, this._parent.getFieldsIndex()), a6.typeofstat = "MIN", this._decodedStatsfield.push(a6);
- for (const s7 of this._decodedGroupbyfield) {
- const t6 = new y();
- if (s7.name = this._nextUniqueName(e4), t6.name = s7.tofieldname, t6.alias = t6.name, w(s7.expression)) {
- const e5 = this._parent.getField(s5(s7.expression, t.Standardised));
- if (!e5)
- throw new o(n5.AggregationFieldNotFound);
- s7.name = e5.name, s7.singlefield = e5.name, this.phsyicalgroupbyfields.push(e5.name), t6.type = e5.type;
- } else {
- t6.type = this._convertToEsriFieldType(p2(s7.expression, this._parent.fields));
- const e5 = new y();
- e5.name = s7.name, e5.alias = e5.name, this.phsyicalgroupbyfields.push(s7.name), this._adaptedFields.push(new x5(e5, s7.expression)), this._candosimplegroupby = false;
- }
- this.fields.push(t6);
- }
- if (this._adaptedFields.length > 0)
- for (const i3 of this._parent.fields)
- this._adaptedFields.push(new F2(i3));
- for (let i3 = 0; i3 < this._decodedStatsfield.length; i3++) {
- const t6 = new y();
- let s7 = null;
- const n7 = this._decodedStatsfield[i3];
- n7.field = this._nextUniqueName(e4), n7.tofieldname === this.objectIdField && (this._internalObjectIdField = n7.field), t6.name = n7.tofieldname, t6.alias = t6.name;
- const r3 = null !== n7.workingexpr && w(n7.workingexpr) ? s5(n7.workingexpr, t.Standardised) : "";
- switch (this._decodedStatsfield[i3].typeofstat) {
- case "SUM":
- if ("" !== r3) {
- if (s7 = this._parent.getField(r3), !s7)
- throw new o(n5.AggregationFieldNotFound);
- t6.type = s7.type;
- } else
- t6.type = "double";
- break;
- case "MIN":
- case "MAX":
- if ("" !== r3) {
- if (s7 = this._parent.getField(r3), !s7)
- throw new o(n5.AggregationFieldNotFound);
- t6.type = s7.type;
- } else
- t6.type = "double";
- break;
- case "COUNT":
- t6.type = "integer";
- break;
- case "STDDEV":
- case "VAR":
- case "AVG":
- if ("" !== r3 && (s7 = this._parent.getField(r3), !s7))
- throw new o(n5.AggregationFieldNotFound);
- t6.type = "double";
- }
- this.fields.push(t6);
- }
- }
- async _canDoAggregates() {
- return false;
- }
- async _getFeatures(e4, t5, i3, s7) {
- -1 !== t5 && this._featureCache[t5];
- const n6 = this._maxQuery;
- return true === this._checkIfNeedToExpandKnownPage(e4, n6) ? (await this._expandPagedSet(e4, n6, 0, 0, s7), this._getFeatures(e4, t5, i3, s7)) : "success";
- }
- async _getFilteredSet(e4, t5, i3, s7, l2) {
- if ("" !== e4)
- return new t3([], [], true, null);
- let u = null;
- const f6 = { ordered: false, nowhereclause: false };
- if (await this._ensureLoaded(), null !== i3) {
- for (let n6 = 0; n6 < this._decodedStatsfield.length; n6++)
- if (true === y2(i3, this._decodedStatsfield[n6].tofieldname)) {
- f6.nowhereclause = true, i3 = null;
- break;
- }
- }
- if (null !== s7) {
- f6.ordered = true;
- for (let e5 = 0; e5 < this._decodedStatsfield.length; e5++)
- if (true === s7.scanForField(this._decodedStatsfield[e5].tofieldname)) {
- s7 = null, f6.ordered = false;
- break;
- }
- if (null !== s7) {
- for (const e5 of this._decodedGroupbyfield)
- if (null === e5.singlefield && true === s7.scanForField(e5.tofieldname)) {
- s7 = null, f6.ordered = false;
- break;
- }
- }
- }
- if (false !== this._candosimplegroupby && await this._parent._canDoAggregates(this.phsyicalgroupbyfields, this._decodedStatsfield, "", null, null)) {
- let e5 = null;
- i3 && (e5 = this._reformulateWhereClauseWithoutGroupByFields(i3));
- let t6 = null;
- s7 && (t6 = this._reformulateOrderClauseWithoutGroupByFields(s7));
- const n6 = await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields, this._decodedStatsfield, "", null, e5, t6, this._internalObjectIdField);
- return this._checkCancelled(l2), u = true === f6.nowhereclause ? new t3(n6._candidates.slice(0).concat(n6._known.slice(0)), [], true === f6.ordered && n6._ordered, this._clonePageDefinition(n6.pagesDefinition)) : new t3(n6._candidates.slice(0), n6._known.slice(0), true === f6.ordered && n6._ordered, this._clonePageDefinition(n6.pagesDefinition)), u;
- }
- let c5 = this._parent;
- if (this._adaptedFields.length > 0 && (c5 = new A({ parentfeatureset: this._parent, adaptedFields: this._adaptedFields, extraFilter: null })), true === f6.nowhereclause)
- u = new t3(["GETPAGES"], [], false, { aggregatefeaturesetpagedefinition: true, resultOffset: 0, resultRecordCount: this._maxQuery, internal: { fullyResolved: false, workingItem: null, type: "manual", iterator: null, set: [], subfeatureset: new a3({ parentfeatureset: c5, orderbyclause: new e3(this.phsyicalgroupbyfields.join(",") + "," + this._parent.objectIdField + " ASC") }) } });
- else {
- let e5 = c5;
- if (null !== i3) {
- let t6 = null;
- i3 && (t6 = this._reformulateWhereClauseWithoutGroupByFields(i3)), e5 = new c4({ parentfeatureset: e5, whereclause: t6 });
- }
- u = new t3(["GETPAGES"], [], false, { aggregatefeaturesetpagedefinition: true, resultOffset: 0, resultRecordCount: this._maxQuery, internal: { fullyResolved: false, workingItem: null, type: "manual", iterator: null, set: [], subfeatureset: new a3({ parentfeatureset: e5, orderbyclause: new e3(this.phsyicalgroupbyfields.join(",") + "," + this._parent.objectIdField + " ASC") }) } });
- }
- return u;
- }
- _reformulateWhereClauseWithoutStatsFields(e4) {
- for (const t5 of this._decodedStatsfield)
- e4 = c3(e4, t5.tofieldname, s5(t5.workingexpr, t.Standardised), this._parent.getFieldsIndex());
- return e4;
- }
- _reformulateWhereClauseWithoutGroupByFields(e4) {
- for (const t5 of this._decodedGroupbyfield)
- t5.tofieldname !== t5.name && (e4 = c3(e4, t5.tofieldname, s5(t5.expression, t.Standardised), this._parent.getFieldsIndex()));
- return e4;
- }
- _reformulateOrderClauseWithoutGroupByFields(e4) {
- const t5 = [];
- for (const i3 of this._decodedGroupbyfield)
- i3.tofieldname !== i3.name && t5.push({ field: i3.tofieldname, newfield: i3.name });
- return t5.length > 0 ? e4.replaceFields(t5) : e4;
- }
- _clonePageDefinition(e4) {
- return null === e4 ? null : true === e4.aggregatefeaturesetpagedefinition ? { aggregatefeaturesetpagedefinition: true, resultRecordCount: e4.resultRecordCount, resultOffset: e4.resultOffset, internal: e4.internal } : this._parent._clonePageDefinition(e4);
- }
- async _refineSetBlock(e4, t5, i3) {
- if (true === this._checkIfNeedToExpandCandidatePage(e4, this._maxQuery))
- return await this._expandPagedSet(e4, this._maxQuery, 0, 0, i3), this._refineSetBlock(e4, t5, i3);
- this._checkCancelled(i3);
- const s7 = e4._candidates.length;
- this._refineKnowns(e4, t5);
- e4._candidates.length;
- return e4._candidates.length, e4;
- }
- _expandPagedSet(e4, t5, i3, s7, n6) {
- return this._expandPagedSetFeatureSet(e4, t5, i3, s7, n6);
- }
- async _getPhysicalPage(t5, i3, s7) {
- if (true === t5.pagesDefinition.aggregatefeaturesetpagedefinition)
- return this._sequentialGetPhysicalItem(t5, t5.pagesDefinition.resultRecordCount, s7, []);
- const n6 = await this._getAgregagtePhysicalPage(t5, i3, s7);
- for (const r2 of n6) {
- const t6 = { geometry: r2.geometry, attributes: {} };
- for (const e4 of this._decodedGroupbyfield)
- t6.attributes[e4.tofieldname] = r2.attributes[e4.name];
- for (const e4 of this._decodedStatsfield)
- t6.attributes[e4.tofieldname] = r2.attributes[e4.field];
- this._featureCache[t6.attributes[this.objectIdField]] = new g(t6);
- }
- return n6.length;
- }
- _sequentialGetPhysicalItem(e4, t5, i3, s7) {
- return new Promise((n6, r2) => {
- null === e4.pagesDefinition.internal.iterator && (e4.pagesDefinition.internal.iterator = e4.pagesDefinition.internal.subfeatureset.iterator(i3)), true === e4.pagesDefinition.internal.fullyResolved || 0 === t5 ? n6(s7.length) : this._nextAggregateItem(e4, t5, i3, s7, (r3) => {
- null === r3 ? n6(s7.length) : (t5 -= 1, n6(this._sequentialGetPhysicalItem(e4, t5, i3, s7)));
- }, r2);
- });
- }
- _nextAggregateItem(e4, i3, s7, n6, r2, a6) {
- try {
- Me(e4.pagesDefinition.internal.iterator.next()).then((t5) => {
- if (null === t5)
- if (null !== e4.pagesDefinition.internal.workingItem) {
- const t6 = this._calculateAndAppendAggregateItem(e4.pagesDefinition.internal.workingItem);
- n6.push(t6), e4.pagesDefinition.internal.workingItem = null, e4.pagesDefinition.internal.set.push(t6.attributes[this.objectIdField]), e4.pagesDefinition.internal.fullyResolved = true, r2(null);
- } else
- e4.pagesDefinition.internal.fullyResolved = true, r2(null);
- else {
- const l2 = this._generateAggregateHash(t5);
- if (null === e4.pagesDefinition.internal.workingItem)
- e4.pagesDefinition.internal.workingItem = { features: [t5], id: l2 };
- else {
- if (l2 !== e4.pagesDefinition.internal.workingItem.id) {
- const s8 = this._calculateAndAppendAggregateItem(e4.pagesDefinition.internal.workingItem);
- return n6.push(s8), e4.pagesDefinition.internal.workingItem = null, e4.pagesDefinition.internal.set.push(s8.attributes[this.objectIdField]), i3 -= 1, e4.pagesDefinition.internal.workingItem = { features: [t5], id: l2 }, void r2(s8);
- }
- e4.pagesDefinition.internal.workingItem.features.push(t5);
- }
- this._nextAggregateItem(e4, i3, s7, n6, r2, a6);
- }
- }, a6);
- } catch (l2) {
- a6(l2);
- }
- }
- _calculateFieldStat(e4, t5, i3) {
- const s7 = [];
- for (let n6 = 0; n6 < e4.features.length; n6++)
- if (null !== t5.workingexpr) {
- const i4 = t5.workingexpr.calculateValue(e4.features[n6]);
- null !== i4 && s7.push(i4);
- } else
- s7.push(null);
- switch (t5.typeofstat) {
- case "MIN":
- i3.attributes[t5.tofieldname] = g2("min", s7, -1);
- break;
- case "MAX":
- i3.attributes[t5.tofieldname] = g2("max", s7, -1);
- break;
- case "SUM":
- i3.attributes[t5.tofieldname] = g2("sum", s7, -1);
- break;
- case "COUNT":
- i3.attributes[t5.tofieldname] = s7.length;
- break;
- case "VAR":
- i3.attributes[t5.tofieldname] = g2("var", s7, -1);
- break;
- case "STDDEV":
- i3.attributes[t5.tofieldname] = g2("stddev", s7, -1);
- break;
- case "AVG":
- i3.attributes[t5.tofieldname] = g2("avg", s7, -1);
- }
- return true;
- }
- _calculateAndAppendAggregateItem(t5) {
- const i3 = { attributes: {}, geometry: null };
- for (const e4 of this._decodedGroupbyfield) {
- const s8 = e4.singlefield ? t5.features[0].attributes[e4.singlefield] : e4.expression.calculateValue(t5.features[0]);
- i3.attributes[e4.tofieldname] = s8;
- }
- for (const e4 of this._decodedStatsfield)
- this._calculateFieldStat(t5, e4, i3);
- const s7 = [];
- for (let e4 = 0; e4 < this._decodedStatsfield.length; e4++)
- s7.push(this._calculateFieldStat(t5, this._decodedStatsfield[e4], i3));
- return this._featureCache[i3.attributes[this.objectIdField]] = new g({ attributes: i3.attributes, geometry: i3.geometry }), i3;
- }
- _generateAggregateHash(e4) {
- let t5 = "";
- for (const i3 of this._decodedGroupbyfield) {
- const s7 = i3.singlefield ? e4.attributes[i3.singlefield] : i3.expression.calculateValue(e4);
- t5 += null == s7 ? ":" : ":" + s7.toString();
- }
- return x4(t5, n2.String);
- }
- async _stat() {
- return { calculated: false };
- }
- async getFeatureByObjectId() {
- return null;
- }
- static registerAction() {
- C2._featuresetFunctions.groupby = function(e4, t5) {
- return new C3({ parentfeatureset: this, groupbyfields: e4, statsfields: t5 });
- };
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/actions/Top.js
- var a5 = class extends C2 {
- constructor(t5) {
- super(t5), this._topnum = 0, this.declaredClass = "esri.arcade.featureset.actions.Top", this._countedin = 0, this._maxProcessing = 100, this._topnum = t5.topnum, this._parent = t5.parentfeatureset;
- }
- async _getSet(t5) {
- if (null === this._wset) {
- await this._ensureLoaded();
- const e4 = await this._parent._getSet(t5);
- return this._wset = new t3(e4._candidates.slice(0), e4._known.slice(0), false, this._clonePageDefinition(e4.pagesDefinition)), this._setKnownLength(this._wset) > this._topnum && (this._wset._known = this._wset._known.slice(0, this._topnum)), this._setKnownLength(this._wset) >= this._topnum && (this._wset._candidates = []), this._wset;
- }
- return this._wset;
- }
- _setKnownLength(t5) {
- return t5._known.length > 0 && "GETPAGES" === t5._known[t5._known.length - 1] ? t5._known.length - 1 : t5._known.length;
- }
- _isInFeatureSet(t5) {
- const e4 = this._parent._isInFeatureSet(t5);
- if (e4 === i.NotInFeatureSet)
- return e4;
- const n6 = this._idstates[t5];
- return n6 === i.InFeatureSet || n6 === i.NotInFeatureSet ? n6 : e4 === i.InFeatureSet && void 0 === n6 ? this._countedin < this._topnum ? (this._idstates[t5] = i.InFeatureSet, this._countedin++, i.InFeatureSet) : (this._idstates[t5] = i.NotInFeatureSet, i.NotInFeatureSet) : i.Unknown;
- }
- async _expandPagedSet(n6, s7, i3, a6, o3) {
- if (null === this._parent)
- throw new o(n5.NotImplemented);
- if (s7 > this._topnum && (s7 = this._topnum), this._countedin >= this._topnum && n6.pagesDefinition.internal.set.length <= n6.pagesDefinition.resultOffset) {
- let t5 = n6._known.length;
- return t5 > 0 && "GETPAGES" === n6._known[t5 - 1] && (n6._known.length = t5 - 1), t5 = n6._candidates.length, t5 > 0 && "GETPAGES" === n6._candidates[t5 - 1] && (n6._candidates.length = t5 - 1), "success";
- }
- const r2 = await this._parent._expandPagedSet(n6, s7, i3, a6, o3);
- return this._setKnownLength(n6) > this._topnum && (n6._known.length = this._topnum), this._setKnownLength(n6) >= this._topnum && (n6._candidates.length = 0), r2;
- }
- async _getFeatures(t5, e4, n6, i3) {
- const a6 = [], o3 = this._maxQueryRate();
- if (true === this._checkIfNeedToExpandKnownPage(t5, o3))
- return await this._expandPagedSet(t5, o3, 0, 0, i3), this._getFeatures(t5, e4, n6, i3);
- -1 !== e4 && void 0 === this._featureCache[e4] && a6.push(e4);
- let r2 = 0;
- for (let s7 = t5._lastFetchedIndex; s7 < t5._known.length && (r2++, r2 <= n6 && (t5._lastFetchedIndex += 1), !(void 0 === this._featureCache[t5._known[s7]] && (t5._known[s7] !== e4 && a6.push(t5._known[s7]), a6.length > o3))); s7++)
- ;
- if (0 === a6.length)
- return "success";
- const _ = new t3([], a6, false, null), h = Math.min(a6.length, n6);
- await this._parent._getFeatures(_, -1, h, i3);
- for (let s7 = 0; s7 < h; s7++) {
- const t6 = this._parent._featureFromCache(a6[s7]);
- void 0 !== t6 && (this._featureCache[a6[s7]] = t6);
- }
- return "success";
- }
- async _getFilteredSet(t5, e4, n6, i3, a6) {
- await this._ensureLoaded();
- const o3 = await this._getSet(a6);
- return new t3(o3._candidates.slice(0).concat(o3._known.slice(0)), [], false, this._clonePageDefinition(o3.pagesDefinition));
- }
- _refineKnowns(t5, e4) {
- let n6 = 0, s7 = null;
- const a6 = [];
- for (let o3 = 0; o3 < t5._candidates.length; o3++) {
- const r2 = this._isInFeatureSet(t5._candidates[o3]);
- if (r2 === i.InFeatureSet) {
- if (t5._known.push(t5._candidates[o3]), n6 += 1, null === s7 ? s7 = { start: o3, end: o3 } : s7.end === o3 - 1 ? s7.end = o3 : (a6.push(s7), s7 = { start: o3, end: o3 }), t5._known.length >= this._topnum)
- break;
- } else if (r2 === i.NotInFeatureSet)
- null === s7 ? s7 = { start: o3, end: o3 } : s7.end === o3 - 1 ? s7.end = o3 : (a6.push(s7), s7 = { start: o3, end: o3 }), n6 += 1;
- else if (r2 === i.Unknown)
- break;
- if (n6 >= e4)
- break;
- }
- null !== s7 && a6.push(s7);
- for (let i3 = a6.length - 1; i3 >= 0; i3--)
- t5._candidates.splice(a6[i3].start, a6[i3].end - a6[i3].start + 1);
- this._setKnownLength(t5) > this._topnum && (t5._known = t5._known.slice(0, this._topnum)), this._setKnownLength(t5) >= this._topnum && (t5._candidates = []);
- }
- async _stat() {
- return { calculated: false };
- }
- async _canDoAggregates() {
- return false;
- }
- static registerAction() {
- C2._featuresetFunctions.top = function(t5) {
- return new a5({ parentfeatureset: this, topnum: t5 });
- };
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/sources/FeatureLayerDynamic.js
- var v2 = class extends C2 {
- constructor(e4) {
- super(e4), this.declaredClass = "esri.arcade.featureset.sources.FeatureLayerDynamic", this._removeGeometry = false, this._overrideFields = null, this.formulaCredential = null, this._pageJustIds = false, this._requestStandardised = false, this._useDefinitionExpression = true, e4.spatialReference && (this.spatialReference = e4.spatialReference), this._transparent = true, this._maxProcessing = 1e3, this._layer = e4.layer, this._wset = null, void 0 !== e4.outFields && (this._overrideFields = e4.outFields), void 0 !== e4.includeGeometry && (this._removeGeometry = false === e4.includeGeometry);
- }
- _maxQueryRate() {
- return F;
- }
- end() {
- return this._layer;
- }
- optimisePagingFeatureQueries(e4) {
- this._pageJustIds = e4;
- }
- convertQueryToLruCacheKey(e4) {
- const t5 = D(e4.toJSON());
- return x4(t5, n2.String);
- }
- async loadImpl() {
- return true === this._layer.loaded ? (this._initialiseFeatureSet(), this) : (await this._layer.load(), this._initialiseFeatureSet(), this);
- }
- _initialiseFeatureSet() {
- var _a;
- if (null == this.spatialReference && (this.spatialReference = this._layer.spatialReference), this.geometryType = this._layer.geometryType, this.fields = this._layer.fields.slice(0), this._layer.outFields)
- if (1 === this._layer.outFields.length && "*" === this._layer.outFields[0])
- ;
- else {
- const e4 = [];
- for (const t5 of this.fields)
- if ("oid" === t5.type)
- e4.push(t5);
- else
- for (const i3 of this._layer.outFields)
- if (i3.toLowerCase() === t5.name.toLowerCase()) {
- e4.push(t5);
- break;
- }
- this.fields = e4;
- }
- else
- ;
- if (null !== this._overrideFields)
- if (1 === this._overrideFields.length && "*" === this._overrideFields[0])
- this._overrideFields = null;
- else {
- const e4 = [], t5 = [];
- for (const i3 of this.fields)
- if ("oid" === i3.type)
- e4.push(i3), t5.push(i3.name);
- else
- for (const r2 of this._overrideFields)
- if (r2.toLowerCase() === i3.name.toLowerCase()) {
- e4.push(i3), t5.push(i3.name);
- break;
- }
- this.fields = e4, this._overrideFields = t5;
- }
- if (this._layer.source && this._layer.source.sourceJSON) {
- const e4 = this._layer.source.sourceJSON.currentVersion;
- true === this._layer.source.sourceJSON.useStandardizedQueries ? (this._databaseType = t.StandardisedNoInterval, null != e4 && e4 >= 10.61 && (this._databaseType = t.Standardised)) : null != e4 && (e4 >= 10.5 && (this._databaseType = t.StandardisedNoInterval, this._requestStandardised = true), e4 >= 10.61 && (this._databaseType = t.Standardised));
- }
- this.objectIdField = this._layer.objectIdField;
- for (const e4 of this.fields)
- "global-id" === e4.type && (this.globalIdField = e4.name);
- this.hasM = this._layer.supportsM, this.hasZ = this._layer.supportsZ, this.typeIdField = (_a = this._layer.typeIdField) != null ? _a : "", this.types = this._layer.types;
- }
- _isInFeatureSet() {
- return i.InFeatureSet;
- }
- async _refineSetBlock(e4) {
- return e4;
- }
- _candidateIdTransform(e4) {
- return e4;
- }
- async _getSet(e4) {
- if (null === this._wset) {
- await this._ensureLoaded();
- const t5 = await this._getFilteredSet("", null, null, null, e4);
- return this._wset = t5, t5;
- }
- return this._wset;
- }
- async _runDatabaseProbe(e4) {
- await this._ensureLoaded();
- const t5 = new x2();
- t5.where = e4.replace("OBJECTID", this._layer.objectIdField);
- try {
- return await this._layer.queryObjectIds(t5), true;
- } catch (i3) {
- return false;
- }
- }
- _canUsePagination() {
- return !(!this._layer.capabilities || !this._layer.capabilities.query || true !== this._layer.capabilities.query.supportsPagination);
- }
- _cacheableFeatureSetSourceKey() {
- return this._layer.url;
- }
- pbfSupportedForQuery(e4) {
- var _a, _b;
- const t5 = (_b = (_a = this._layer) == null ? void 0 : _a.capabilities) == null ? void 0 : _b.query;
- return !e4.outStatistics && true === (t5 == null ? void 0 : t5.supportsFormatPBF) && true === (t5 == null ? void 0 : t5.supportsQuantizationEditMode);
- }
- async queryPBF(e4) {
- e4.quantizationParameters = { mode: "edit" };
- const t5 = await f3(this._layer.parsedUrl, e4, new a({}));
- return x3.fromJSON(ut(t5.data)).unquantize();
- }
- get gdbVersion() {
- return this._layer && this._layer.capabilities && this._layer.capabilities.data && this._layer.capabilities.data.isVersioned ? this._layer.gdbVersion ? this._layer.gdbVersion : "SDE.DEFAULT" : "";
- }
- nativeCapabilities() {
- var _a;
- return { title: (_a = this._layer.title) != null ? _a : "", source: this, canQueryRelated: true, capabilities: this._layer.capabilities, databaseType: this._databaseType, requestStandardised: this._requestStandardised };
- }
- executeQuery(e4, t5) {
- const i3 = "execute" === t5 ? s2 : "executeForCount" === t5 ? n4 : s3, r2 = "execute" === t5 && this.pbfSupportedForQuery(e4);
- let s7 = null;
- if (this.recentlyUsedQueries) {
- const t6 = this.convertQueryToLruCacheKey(e4);
- s7 = this.recentlyUsedQueries.getFromCache(t6), null === s7 && (s7 = true !== r2 ? i3(this._layer.parsedUrl.path, e4) : this.queryPBF(e4), this.recentlyUsedQueries.addToCache(t6, s7), s7 = s7.catch((e5) => {
- var _a;
- throw (_a = this.recentlyUsedQueries) == null ? void 0 : _a.removeFromCache(t6), e5;
- }));
- }
- return this.featureSetQueryInterceptor && this.featureSetQueryInterceptor.preLayerQueryCallback({ layer: this._layer, query: e4, method: t5 }), null === s7 && (s7 = true !== r2 ? i3(this._layer.parsedUrl.path, e4) : this.queryPBF(e4)), s7;
- }
- async _getFilteredSet(e4, t5, i3, r2, a6) {
- const n6 = await this.databaseType();
- if (this.isTable() && t5 && null !== e4 && "" !== e4) {
- return new t3([], [], true, null);
- }
- if (this._canUsePagination())
- return this._getFilteredSetUsingPaging(e4, t5, i3, r2, a6);
- let l2 = "", o3 = false;
- null !== r2 && this._layer.capabilities && this._layer.capabilities.query && true === this._layer.capabilities.query.supportsOrderBy && (l2 = r2.constructClause(), o3 = true);
- const u = new x2();
- u.where = null === i3 ? null === t5 ? "1=1" : "" : s5(i3, n6), this._requestStandardised && (u.sqlFormat = "standard"), u.spatialRelationship = this._makeRelationshipEnum(e4), u.outSpatialReference = this.spatialReference, u.orderByFields = "" !== l2 ? l2.split(",") : null, u.geometry = null === t5 ? null : t5, u.relationParameter = this._makeRelationshipParam(e4);
- let c5 = await this.executeQuery(u, "executeForIds");
- null === c5 && (c5 = []), this._checkCancelled(a6);
- return new t3([], c5, o3, null);
- }
- _expandPagedSet(e4, t5, i3, r2, s7) {
- return this._expandPagedSetFeatureSet(e4, t5, i3, r2, s7);
- }
- async _getFilteredSetUsingPaging(e4, t5, i3, r2, a6) {
- var _a;
- let n6 = "", l2 = false;
- null !== r2 && this._layer.capabilities && this._layer.capabilities.query && true === this._layer.capabilities.query.supportsOrderBy && (n6 = r2.constructClause(), l2 = true);
- const o3 = await this.databaseType();
- let u = null === i3 ? null === t5 ? "1=1" : "" : s5(i3, o3);
- this._layer.definitionExpression && this._useDefinitionExpression && (u = "" !== u ? "((" + this._layer.definitionExpression + ") AND (" + u + "))" : this._layer.definitionExpression);
- let c5 = this._maxQueryRate();
- const p3 = (_a = this._layer.capabilities) == null ? void 0 : _a.query.maxRecordCount;
- void 0 !== p3 && p3 < c5 && (c5 = p3);
- let h = null;
- if (true === this._pageJustIds)
- h = new t3([], ["GETPAGES"], l2, { spatialRel: this._makeRelationshipEnum(e4), relationParam: this._makeRelationshipParam(e4), outFields: this._layer.objectIdField, resultRecordCount: c5, resultOffset: 0, geometry: null === t5 ? null : t5, where: u, orderByFields: n6, returnGeometry: false, returnIdsOnly: "false", internal: { set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: false } });
- else {
- let i4 = true;
- true === this._removeGeometry && (i4 = false);
- const r3 = null !== this._overrideFields ? this._overrideFields : this._fieldsIncludingObjectId(this._layer.outFields ? this._layer.outFields : ["*"]);
- h = new t3([], ["GETPAGES"], l2, { spatialRel: this._makeRelationshipEnum(e4), relationParam: this._makeRelationshipParam(e4), outFields: r3.join(","), resultRecordCount: c5, resultOffset: 0, geometry: null === t5 ? null : t5, where: u, orderByFields: n6, returnGeometry: i4, returnIdsOnly: "false", internal: { set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: false } });
- }
- return await this._expandPagedSet(h, c5, 0, 1, a6), h;
- }
- _clonePageDefinition(e4) {
- return null === e4 ? null : true !== e4.groupbypage ? { groupbypage: false, spatialRel: e4.spatialRel, relationParam: e4.relationParam, outFields: e4.outFields, resultRecordCount: e4.resultRecordCount, resultOffset: e4.resultOffset, geometry: e4.geometry, where: e4.where, orderByFields: e4.orderByFields, returnGeometry: e4.returnGeometry, returnIdsOnly: e4.returnIdsOnly, internal: e4.internal } : { groupbypage: true, spatialRel: e4.spatialRel, relationParam: e4.relationParam, outFields: e4.outFields, resultRecordCount: e4.resultRecordCount, useOIDpagination: e4.useOIDpagination, generatedOid: e4.generatedOid, groupByFieldsForStatistics: e4.groupByFieldsForStatistics, resultOffset: e4.resultOffset, outStatistics: e4.outStatistics, geometry: e4.geometry, where: e4.where, orderByFields: e4.orderByFields, returnGeometry: e4.returnGeometry, returnIdsOnly: e4.returnIdsOnly, internal: e4.internal };
- }
- async _getPhysicalPage(e4, t5, i3) {
- const r2 = e4.pagesDefinition.internal.lastRetrieved, s7 = r2, a6 = e4.pagesDefinition.internal.lastPage, n6 = new x2();
- this._requestStandardised && (n6.sqlFormat = "standard"), n6.spatialRelationship = e4.pagesDefinition.spatialRel, n6.relationParameter = e4.pagesDefinition.relationParam, n6.outFields = e4.pagesDefinition.outFields.split(","), n6.num = e4.pagesDefinition.resultRecordCount, n6.start = e4.pagesDefinition.internal.lastPage, n6.geometry = e4.pagesDefinition.geometry, n6.where = e4.pagesDefinition.where, n6.orderByFields = "" !== e4.pagesDefinition.orderByFields ? e4.pagesDefinition.orderByFields.split(",") : null, n6.returnGeometry = e4.pagesDefinition.returnGeometry, n6.outSpatialReference = this.spatialReference;
- const l2 = await this.executeQuery(n6, "execute");
- if (this._checkCancelled(i3), e4.pagesDefinition.internal.lastPage !== a6)
- return "done";
- const o3 = this._layer.objectIdField;
- for (let u = 0; u < l2.features.length; u++)
- e4.pagesDefinition.internal.set[s7 + u] = l2.features[u].attributes[o3];
- if (false === this._pageJustIds)
- for (let u = 0; u < l2.features.length; u++)
- this._featureCache[l2.features[u].attributes[o3]] = l2.features[u];
- return (void 0 === l2.exceededTransferLimit && l2.features.length !== e4.pagesDefinition.resultRecordCount || false === l2.exceededTransferLimit) && (e4.pagesDefinition.internal.fullyResolved = true), e4.pagesDefinition.internal.lastRetrieved = r2 + l2.features.length, e4.pagesDefinition.internal.lastPage += e4.pagesDefinition.resultRecordCount, "done";
- }
- _fieldsIncludingObjectId(e4) {
- if (null === e4)
- return [this.objectIdField];
- const t5 = e4.slice(0);
- if (t5.includes("*"))
- return t5;
- let i3 = false;
- for (const r2 of t5)
- if (r2.toUpperCase() === this.objectIdField.toUpperCase()) {
- i3 = true;
- break;
- }
- return false === i3 && t5.push(this.objectIdField), t5;
- }
- async _getFeatures(e4, t5, i3, r2) {
- const s7 = [];
- if (-1 !== t5 && void 0 === this._featureCache[t5] && s7.push(t5), true === this._checkIfNeedToExpandKnownPage(e4, this._maxProcessingRate()))
- return await this._expandPagedSet(e4, this._maxProcessingRate(), 0, 0, r2), this._getFeatures(e4, t5, i3, r2);
- let a6 = 0;
- for (let u = e4._lastFetchedIndex; u < e4._known.length; u++) {
- if (e4._lastFetchedIndex += 1, a6++, void 0 === this._featureCache[e4._known[u]]) {
- let i4 = false;
- if (null !== this._layer._mode && void 0 !== this._layer._mode) {
- const t6 = this._layer._mode;
- if (void 0 !== t6._featureMap[e4._known[u]]) {
- const r3 = t6._featureMap[e4._known[u]];
- null !== r3 && (i4 = true, this._featureCache[e4._known[u]] = r3);
- }
- }
- if (false === i4 && (e4._known[u] !== t5 && s7.push(e4._known[u]), s7.length >= this._maxProcessingRate() - 1))
- break;
- }
- if (a6 >= i3 && 0 === s7.length)
- break;
- }
- if (0 === s7.length)
- return "success";
- const n6 = new x2();
- this._requestStandardised && (n6.sqlFormat = "standard"), n6.objectIds = s7, n6.outFields = null !== this._overrideFields ? this._overrideFields : this._fieldsIncludingObjectId(this._layer.outFields ? this._layer.outFields : ["*"]), n6.returnGeometry = true, true === this._removeGeometry && (n6.returnGeometry = false), n6.outSpatialReference = this.spatialReference;
- const l2 = await this.executeQuery(n6, "execute");
- if (this._checkCancelled(r2), void 0 !== l2.error)
- throw new o(n5.RequestFailed, { reason: l2.error });
- const o3 = this._layer.objectIdField;
- for (let u = 0; u < l2.features.length; u++)
- this._featureCache[l2.features[u].attributes[o3]] = l2.features[u];
- return "success";
- }
- async _getDistinctPages(e4, t5, i3, r2, s7, a6, n6, l2, o3) {
- var _a, _b;
- await this._ensureLoaded();
- const u = await this.databaseType();
- let c5 = i3.parseTree.column;
- const p3 = (_a = this._layer.fields) != null ? _a : [];
- for (let d5 = 0; d5 < p3.length; d5++)
- if (p3[d5].name.toLowerCase() === c5.toLowerCase()) {
- c5 = p3[d5].name;
- break;
- }
- const h = new x2();
- this._requestStandardised && (h.sqlFormat = "standard");
- let y3 = null === a6 ? null === s7 ? "1=1" : "" : s5(a6, u);
- this._layer.definitionExpression && this._useDefinitionExpression && (y3 = "" !== y3 ? "((" + this._layer.definitionExpression + ") AND (" + y3 + "))" : this._layer.definitionExpression), h.where = y3, h.spatialRelationship = this._makeRelationshipEnum(r2), h.relationParameter = this._makeRelationshipParam(r2), h.geometry = null === s7 ? null : s7, h.returnDistinctValues = true, h.returnGeometry = false, h.outFields = [c5];
- const f6 = await this.executeQuery(h, "execute");
- if (this._checkCancelled(o3), !f6.hasOwnProperty("features"))
- throw new o(n5.InvalidStatResponse);
- let _ = false;
- for (let d5 = 0; d5 < p3.length; d5++)
- if (p3[d5].name === c5) {
- "date" === p3[d5].type && (_ = true);
- break;
- }
- for (let d5 = 0; d5 < f6.features.length; d5++) {
- if (_) {
- const e5 = f6.features[d5].attributes[c5];
- null !== e5 ? l2.push(new Date(e5)) : l2.push(e5);
- } else
- l2.push(f6.features[d5].attributes[c5]);
- if (l2.length >= n6)
- break;
- }
- if (0 === f6.features.length)
- return l2;
- if (f6.features.length === ((_b = this._layer.capabilities) == null ? void 0 : _b.query.maxRecordCount) && l2.length < n6) {
- return { calculated: true, result: await this._getDistinctPages(e4 + f6.features.length, t5, i3, r2, s7, a6, n6, l2, o3) };
- }
- return l2;
- }
- async _distinctStat(e4, t5, i3, r2, s7, a6, n6) {
- return { calculated: true, result: await this._getDistinctPages(0, e4, t5, i3, r2, s7, a6, [], n6) };
- }
- isTable() {
- return this._layer.isTable || null === this._layer.geometryType || "table" === this._layer.type || "" === this._layer.geometryType;
- }
- async _countstat(e4, t5, i3, r2) {
- const s7 = await this.databaseType(), a6 = new x2();
- if (this._requestStandardised && (a6.sqlFormat = "standard"), this.isTable() && i3 && null !== t5 && "" !== t5)
- return { calculated: true, result: 0 };
- let n6 = null === r2 ? null === i3 ? "1=1" : "" : s5(r2, s7);
- this._layer.definitionExpression && this._useDefinitionExpression && (n6 = "" !== n6 ? "((" + this._layer.definitionExpression + ") AND (" + n6 + "))" : this._layer.definitionExpression), a6.where = n6, a6.where = n6, a6.spatialRelationship = this._makeRelationshipEnum(t5), a6.relationParameter = this._makeRelationshipParam(t5), a6.geometry = null === i3 ? null : i3, a6.returnGeometry = false;
- return { calculated: true, result: await this.executeQuery(a6, "executeForCount") };
- }
- async _stats(e4, t5, i3, r2, s7, a6, n6) {
- var _a;
- await this._ensureLoaded();
- const l2 = this._layer.capabilities && this._layer.capabilities.query && true === this._layer.capabilities.query.supportsSqlExpression, o3 = this._layer.capabilities && this._layer.capabilities.query && true === this._layer.capabilities.query.supportsStatistics, u = this._layer.capabilities && this._layer.capabilities.query && true === this._layer.capabilities.query.supportsDistinct;
- if ("count" === e4)
- return u ? this._countstat(e4, i3, r2, s7) : { calculated: false };
- if (false === o3 || false === w(t5) && false === l2 || false === t5.isStandardized)
- return "" !== i3 || null !== s7 ? { calculated: false } : this._manualStat(e4, t5, a6, n6);
- if ("distinct" === e4)
- return false === u ? "" !== i3 || null !== s7 ? { calculated: false } : this._manualStat(e4, t5, a6, n6) : this._distinctStat(e4, t5, i3, r2, s7, a6, n6);
- const h = await this.databaseType();
- if (this.isTable() && r2 && null !== i3 && "" !== i3)
- return { calculated: true, result: null };
- const y3 = new x2();
- this._requestStandardised && (y3.sqlFormat = "standard");
- let f6 = null === s7 ? null === r2 ? "1=1" : "" : s5(s7, h);
- this._layer.definitionExpression && this._useDefinitionExpression && (f6 = "" !== f6 ? "((" + this._layer.definitionExpression + ") AND (" + f6 + "))" : this._layer.definitionExpression), y3.where = f6, y3.spatialRelationship = this._makeRelationshipEnum(i3), y3.relationParameter = this._makeRelationshipParam(i3), y3.geometry = null === r2 ? null : r2;
- const _ = new m();
- _.statisticType = m2(e4), _.onStatisticField = s5(t5, h), _.outStatisticFieldName = "ARCADE_STAT_RESULT", y3.returnGeometry = false;
- let m3 = "ARCADE_STAT_RESULT";
- y3.outStatistics = [_];
- const g4 = await this.executeQuery(y3, "execute");
- if (!g4.hasOwnProperty("features") || 0 === g4.features.length)
- throw new o(n5.InvalidStatResponse);
- let S3 = false;
- const F4 = (_a = g4.fields) != null ? _a : [];
- for (let d5 = 0; d5 < F4.length; d5++)
- if ("ARCADE_STAT_RESULT" === F4[d5].name.toUpperCase()) {
- m3 = F4[d5].name, "date" === F4[d5].type && (S3 = true);
- break;
- }
- if (S3) {
- let e5 = g4.features[0].attributes[m3];
- return null !== e5 && (e5 = new Date(g4.features[0].attributes[m3])), { calculated: true, result: e5 };
- }
- return { calculated: true, result: g4.features[0].attributes[m3] };
- }
- _stat(e4, t5, i3, r2, s7, a6, n6) {
- return this._stats(e4, t5, i3, r2, s7, a6, n6);
- }
- async _canDoAggregates(e4, t5) {
- var _a, _b;
- await this._ensureLoaded();
- let i3 = false;
- const r2 = (_a = this._layer.capabilities) == null ? void 0 : _a.query, s7 = true === (r2 == null ? void 0 : r2.supportsSqlExpression);
- if (null != r2 && true === r2.supportsStatistics && true === r2.supportsOrderBy && (i3 = true), i3)
- for (let a6 = 0; a6 < t5.length - 1; a6++)
- (false === ((_b = t5[a6].workingexpr) == null ? void 0 : _b.isStandardized) || false === w(t5[a6].workingexpr) && false === s7) && (i3 = false);
- return false !== i3;
- }
- _makeRelationshipEnum(e4) {
- if (e4.includes("esriSpatialRelRelation"))
- return "relation";
- switch (e4) {
- case "esriSpatialRelRelation":
- return "relation";
- case "esriSpatialRelIntersects":
- return "intersects";
- case "esriSpatialRelContains":
- return "contains";
- case "esriSpatialRelOverlaps":
- return "overlaps";
- case "esriSpatialRelWithin":
- return "within";
- case "esriSpatialRelTouches":
- return "touches";
- case "esriSpatialRelCrosses":
- return "crosses";
- case "esriSpatialRelEnvelopeIntersects":
- return "envelope-intersects";
- }
- return e4;
- }
- _makeRelationshipParam(e4) {
- return e4.includes("esriSpatialRelRelation") ? e4.split(":")[1] : "";
- }
- async _getAggregatePagesDataSourceDefinition(e4, t5, i3, r2, a6, n6, l2) {
- var _a;
- await this._ensureLoaded();
- const o3 = await this.databaseType();
- let u = "", c5 = false, p3 = false;
- null !== n6 && this._layer.capabilities && this._layer.capabilities.query && true === this._layer.capabilities.query.supportsOrderBy && (u = n6.constructClause(), p3 = true), this._layer.capabilities && this._layer.capabilities.query && false === this._layer.capabilities.query.supportsPagination && (p3 = false, c5 = true, u = this._layer.objectIdField);
- const h = [];
- for (let s7 = 0; s7 < t5.length; s7++) {
- const e5 = new m();
- e5.onStatisticField = null !== t5[s7].workingexpr ? s5(t5[s7].workingexpr, o3) : "", e5.outStatisticFieldName = t5[s7].field, e5.statisticType = t5[s7].toStatisticsName(), h.push(e5);
- }
- "" === u && (u = e4.join(","));
- let y3 = this._maxQueryRate();
- const f6 = (_a = this._layer.capabilities) == null ? void 0 : _a.query.maxRecordCount;
- void 0 !== f6 && f6 < y3 && (y3 = f6);
- let _ = null === a6 ? null === r2 ? "1=1" : "" : s5(a6, o3);
- this._layer.definitionExpression && this._useDefinitionExpression && (_ = "" !== _ ? "((" + this._layer.definitionExpression + ") AND (" + _ + "))" : this._layer.definitionExpression);
- return new t3([], ["GETPAGES"], p3, { groupbypage: true, spatialRel: this._makeRelationshipEnum(i3), relationParam: this._makeRelationshipParam(i3), outFields: ["*"], useOIDpagination: c5, generatedOid: l2, resultRecordCount: y3, resultOffset: 0, groupByFieldsForStatistics: e4, outStatistics: h, geometry: null === r2 ? null : r2, where: _, orderByFields: u, returnGeometry: false, returnIdsOnly: false, internal: { lastMaxId: -1, set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: false } });
- }
- async _getAgregagtePhysicalPage(t5, i3, r2) {
- let s7 = t5.pagesDefinition.where;
- true === t5.pagesDefinition.useOIDpagination && (s7 = "" !== s7 ? "(" + s7 + ") AND (" + t5.pagesDefinition.generatedOid + ">" + t5.pagesDefinition.internal.lastMaxId.toString() + ")" : t5.pagesDefinition.generatedOid + ">" + t5.pagesDefinition.internal.lastMaxId.toString());
- const a6 = t5.pagesDefinition.internal.lastRetrieved, n6 = a6, l2 = t5.pagesDefinition.internal.lastPage, o3 = new x2();
- if (this._requestStandardised && (o3.sqlFormat = "standard"), o3.where = s7, o3.spatialRelationship = t5.pagesDefinition.spatialRel, o3.relationParameter = t5.pagesDefinition.relationParam, o3.outFields = t5.pagesDefinition.outFields, o3.outStatistics = t5.pagesDefinition.outStatistics, o3.geometry = t5.pagesDefinition.geometry, o3.groupByFieldsForStatistics = t5.pagesDefinition.groupByFieldsForStatistics, o3.num = t5.pagesDefinition.resultRecordCount, o3.start = t5.pagesDefinition.internal.lastPage, o3.returnGeometry = t5.pagesDefinition.returnGeometry, o3.orderByFields = "" !== t5.pagesDefinition.orderByFields ? t5.pagesDefinition.orderByFields.split(",") : null, this.isTable() && o3.geometry && o3.spatialRelationship)
- return [];
- const u = await this.executeQuery(o3, "execute");
- if (this._checkCancelled(r2), !u.hasOwnProperty("features"))
- throw new o(n5.InvalidStatResponse);
- const d5 = [];
- if (t5.pagesDefinition.internal.lastPage !== l2)
- return [];
- for (let e4 = 0; e4 < u.features.length; e4++)
- t5.pagesDefinition.internal.set[n6 + e4] = u.features[e4].attributes[t5.pagesDefinition.generatedOid];
- for (let c5 = 0; c5 < u.features.length; c5++)
- d5.push(new g({ attributes: u.features[c5].attributes, geometry: null }));
- return true === t5.pagesDefinition.useOIDpagination ? 0 === u.features.length ? t5.pagesDefinition.internal.fullyResolved = true : t5.pagesDefinition.internal.lastMaxId = u.features[u.features.length - 1].attributes[t5.pagesDefinition.generatedOid] : (void 0 === u.exceededTransferLimit && u.features.length !== t5.pagesDefinition.resultRecordCount || false === u.exceededTransferLimit) && (t5.pagesDefinition.internal.fullyResolved = true), t5.pagesDefinition.internal.lastRetrieved = a6 + u.features.length, t5.pagesDefinition.internal.lastPage += t5.pagesDefinition.resultRecordCount, d5;
- }
- static create(e4, t5, i3, r2, s7) {
- const a6 = new Ze({ url: e4, outFields: null === t5 ? ["*"] : t5 });
- return new v2({ layer: a6, spatialReference: i3, lrucache: r2, interceptor: s7 });
- }
- relationshipMetaData() {
- return this._layer && this._layer.source && this._layer.source.sourceJSON && this._layer.source.sourceJSON.relationships ? this._layer.source.sourceJSON.relationships : [];
- }
- serviceUrl() {
- return b(this._layer.parsedUrl.path);
- }
- async queryAttachments(e4, t5, r2, s7, a6) {
- const n6 = this._layer.capabilities;
- if ((n6 == null ? void 0 : n6.data.supportsAttachment) && (n6 == null ? void 0 : n6.operations.supportsQueryAttachments)) {
- const n7 = { objectIds: [e4], returnMetadata: a6 };
- (t5 && t5 > 0 || r2 && r2 > 0) && (n7.size = [t5 && t5 > 0 ? t5 : 0, r2 && r2 > 0 ? r2 : t5 + 1]), s7 && s7.length > 0 && (n7.attachmentTypes = s7), this.featureSetQueryInterceptor && this.featureSetQueryInterceptor.preLayerQueryCallback({ layer: this._layer, query: n7, method: "attachments" });
- const l2 = await this._layer.queryAttachments(n7), o3 = [];
- return l2 && l2[e4] && l2[e4].forEach((t6) => {
- const r3 = this._layer.parsedUrl.path + "/" + e4.toString() + "/attachments/" + t6.id.toString();
- let s8 = null;
- a6 && t6.exifInfo && (s8 = J.convertJsonToArcade(t6.exifInfo, true)), o3.push(new e(t6.id, t6.name, t6.contentType, t6.size, r3, s8));
- }), o3;
- }
- return [];
- }
- async queryRelatedFeatures(i3) {
- var _a;
- const r2 = { f: "json", relationshipId: i3.relationshipId.toString(), definitionExpression: i3.where, outFields: (_a = i3.outFields) == null ? void 0 : _a.join(","), returnGeometry: i3.returnGeometry.toString() };
- void 0 !== i3.resultOffset && null !== i3.resultOffset && (r2.resultOffset = i3.resultOffset.toString()), void 0 !== i3.resultRecordCount && null !== i3.resultRecordCount && (r2.resultRecordCount = i3.resultRecordCount.toString()), i3.orderByFields && (r2.orderByFields = i3.orderByFields.join(",")), i3.objectIds && i3.objectIds.length > 0 && (r2.objectIds = i3.objectIds.join(",")), i3.outSpatialReference && (r2.outSR = JSON.stringify(i3.outSpatialReference.toJSON())), this.featureSetQueryInterceptor && this.featureSetQueryInterceptor.preRequestCallback({ layer: this._layer, queryPayload: r2, method: "relatedrecords", url: this._layer.parsedUrl.path + "/queryRelatedRecords" });
- const s7 = await U(this._layer.parsedUrl.path + "/queryRelatedRecords", { responseType: "json", query: r2 });
- if (s7.data) {
- const t5 = {}, i4 = s7.data;
- if (i4 && i4.relatedRecordGroups) {
- const r3 = i4.spatialReference;
- for (const s8 of i4.relatedRecordGroups) {
- const a6 = s8.objectId, n6 = [];
- for (const t6 of s8.relatedRecords) {
- t6.geometry && (t6.geometry.spatialReference = r3);
- const i5 = new g({ geometry: t6.geometry ? v(t6.geometry) : null, attributes: t6.attributes });
- n6.push(i5);
- }
- t5[a6] = { features: n6, exceededTransferLimit: true === i4.exceededTransferLimit };
- }
- }
- return t5;
- }
- throw new o(n5.InvalidRequest);
- }
- async getFeatureByObjectId(e4, t5) {
- const i3 = new x2();
- i3.outFields = t5, i3.returnGeometry = false, i3.outSpatialReference = this.spatialReference, i3.where = this.objectIdField + "=" + e4.toString(), this.featureSetQueryInterceptor && this.featureSetQueryInterceptor.preLayerQueryCallback({ layer: this._layer, query: i3, method: "execute" });
- const r2 = await s2(this._layer.parsedUrl.path, i3);
- return 1 === r2.features.length ? r2.features[0] : null;
- }
- async getIdentityUser() {
- var _a;
- await this.load();
- const e4 = (_a = s) == null ? void 0 : _a.findCredential(this._layer.url);
- return e4 ? e4.userId : null;
- }
- async getOwningSystemUrl() {
- var _a;
- await this.load();
- const e4 = (_a = s) == null ? void 0 : _a.findServerInfo(this._layer.url);
- if (e4)
- return e4.owningSystemUrl;
- let i3 = this._layer.url;
- const r2 = i3.toLowerCase().indexOf("/rest/services");
- if (i3 = r2 > -1 ? i3.substring(0, r2) : i3, i3) {
- i3 += "/rest/info";
- try {
- const e5 = await U(i3, { query: { f: "json" } });
- let r3 = "";
- return e5.data && e5.data.owningSystemUrl && (r3 = e5.data.owningSystemUrl), r3;
- } catch (s7) {
- return "";
- }
- }
- return "";
- }
- getDataSourceFeatureSet() {
- var _a, _b, _c, _d;
- const e4 = new v2({ layer: this._layer, spatialReference: (_a = this.spatialReference) != null ? _a : void 0, outFields: (_b = this._overrideFields) != null ? _b : void 0, includeGeometry: !this._removeGeometry, lrucache: (_c = this.recentlyUsedQueries) != null ? _c : void 0, interceptor: (_d = this.featureSetQueryInterceptor) != null ? _d : void 0 });
- return e4._useDefinitionExpression = false, e4;
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/sources/FeatureLayerMemory.js
- var d3 = class extends C2 {
- constructor(e4) {
- super(e4), this.declaredClass = "esri.arcade.featureset.sources.FeatureLayerMemory", this._removeGeometry = false, this._overrideFields = null, this._forceIsTable = false, e4.spatialReference && (this.spatialReference = e4.spatialReference), this._transparent = true, this._maxProcessing = 1e3, this._layer = e4.layer, this._wset = null, true === e4.isTable && (this._forceIsTable = true), void 0 !== e4.outFields && (this._overrideFields = e4.outFields), void 0 !== e4.includeGeometry && (this._removeGeometry = false === e4.includeGeometry);
- }
- _maxQueryRate() {
- return F;
- }
- end() {
- return this._layer;
- }
- optimisePagingFeatureQueries() {
- }
- async loadImpl() {
- return true === this._layer.loaded ? (this._initialiseFeatureSet(), this) : (await this._layer.load(), this._initialiseFeatureSet(), this);
- }
- get gdbVersion() {
- return "";
- }
- _initialiseFeatureSet() {
- if (null == this.spatialReference && (this.spatialReference = this._layer.spatialReference), this.geometryType = this._layer.geometryType, this.fields = this._layer.fields.slice(0), this._layer.outFields)
- if (1 === this._layer.outFields.length && "*" === this._layer.outFields[0])
- ;
- else {
- const e4 = [];
- for (const t5 of this.fields)
- if ("oid" === t5.type)
- e4.push(t5);
- else
- for (const s7 of this._layer.outFields)
- if (s7.toLowerCase() === t5.name.toLowerCase()) {
- e4.push(t5);
- break;
- }
- this.fields = e4;
- }
- else
- ;
- if (null !== this._overrideFields)
- if (1 === this._overrideFields.length && "*" === this._overrideFields[0])
- this._overrideFields = null;
- else {
- const e4 = [], t5 = [];
- for (const s7 of this.fields)
- if ("oid" === s7.type)
- e4.push(s7), t5.push(s7.name);
- else
- for (const r2 of this._overrideFields)
- if (r2.toLowerCase() === s7.name.toLowerCase()) {
- e4.push(s7), t5.push(s7.name);
- break;
- }
- this.fields = e4, this._overrideFields = t5;
- }
- this.objectIdField = this._layer.objectIdField;
- for (const e4 of this.fields)
- "global-id" === e4.type && (this.globalIdField = e4.name);
- this.hasM = this._layer.supportsM, this.hasZ = this._layer.supportsZ, this._databaseType = t.Standardised, this.typeIdField = this._layer.typeIdField, this.types = this._layer.types;
- }
- isTable() {
- return this._forceIsTable || this._layer.isTable || "table" === this._layer.type || !this._layer.geometryType;
- }
- _isInFeatureSet() {
- return i.InFeatureSet;
- }
- _candidateIdTransform(e4) {
- return e4;
- }
- async _getSet(e4) {
- if (null === this._wset) {
- await this._ensureLoaded();
- const t5 = await this._getFilteredSet("", null, null, null, e4);
- return this._wset = t5, t5;
- }
- return this._wset;
- }
- _changeFeature(t5) {
- const s7 = {};
- for (const e4 of this.fields)
- s7[e4.name] = t5.attributes[e4.name];
- return new g({ geometry: true === this._removeGeometry ? null : t5.geometry, attributes: s7 });
- }
- async _getFilteredSet(e4, t5, s7, r2, a6) {
- let n6 = "", u = false;
- if (null !== r2 && (n6 = r2.constructClause(), u = true), this.isTable() && t5 && null !== e4 && "" !== e4) {
- return new t3([], [], true, null);
- }
- const h = new x2();
- h.where = null === s7 ? null === t5 ? "1=1" : "" : s5(s7, t.Standardised), h.spatialRelationship = this._makeRelationshipEnum(e4), h.outSpatialReference = this.spatialReference, h.orderByFields = "" !== n6 ? n6.split(",") : null, h.geometry = null === t5 ? null : t5, h.returnGeometry = true, h.relationParameter = this._makeRelationshipParam(e4);
- const c5 = await this._layer.queryFeatures(h);
- if (null === c5)
- return new t3([], [], u, null);
- this._checkCancelled(a6);
- const y3 = [];
- c5.features.forEach((e5) => {
- const t6 = e5.attributes[this._layer.objectIdField];
- y3.push(t6), this._featureCache[t6] = this._changeFeature(e5);
- });
- return new t3([], y3, u, null);
- }
- _makeRelationshipEnum(e4) {
- if (e4.includes("esriSpatialRelRelation"))
- return "relation";
- switch (e4) {
- case "esriSpatialRelRelation":
- return "relation";
- case "esriSpatialRelIntersects":
- return "intersects";
- case "esriSpatialRelContains":
- return "contains";
- case "esriSpatialRelOverlaps":
- return "overlaps";
- case "esriSpatialRelWithin":
- return "within";
- case "esriSpatialRelTouches":
- return "touches";
- case "esriSpatialRelCrosses":
- return "crosses";
- case "esriSpatialRelEnvelopeIntersects":
- return "envelope-intersects";
- }
- return e4;
- }
- _makeRelationshipParam(e4) {
- return e4.includes("esriSpatialRelRelation") ? e4.split(":")[1] : "";
- }
- async _queryAllFeatures() {
- if (this._wset)
- return this._wset;
- const e4 = new x2();
- if (e4.where = "1=1", await this._ensureLoaded(), this._layer.source && this._layer.source.items) {
- const e5 = [];
- return this._layer.source.items.forEach((t6) => {
- const s8 = t6.attributes[this._layer.objectIdField];
- e5.push(s8), this._featureCache[s8] = this._changeFeature(t6);
- }), this._wset = new t3([], e5, false, null), this._wset;
- }
- const t5 = await this._layer.queryFeatures(e4), s7 = [];
- return t5.features.forEach((e5) => {
- const t6 = e5.attributes[this._layer.objectIdField];
- s7.push(t6), this._featureCache[t6] = this._changeFeature(e5);
- }), this._wset = new t3([], s7, false, null), this._wset;
- }
- async _getFeatures(e4, r2, i3) {
- const a6 = [];
- -1 !== r2 && void 0 === this._featureCache[r2] && a6.push(r2);
- for (let t5 = e4._lastFetchedIndex; t5 < e4._known.length && (e4._lastFetchedIndex += 1, !(void 0 === this._featureCache[e4._known[t5]] && (e4._known[t5] !== r2 && a6.push(e4._known[t5]), a6.length > i3))); t5++)
- ;
- if (0 === a6.length)
- return "success";
- throw new o(n5.MissingFeatures);
- }
- async _refineSetBlock(e4) {
- return e4;
- }
- async _stat() {
- return { calculated: false };
- }
- async _canDoAggregates() {
- return false;
- }
- relationshipMetaData() {
- return [];
- }
- static _cloneAttr(e4) {
- const t5 = {};
- for (const s7 in e4)
- t5[s7] = e4[s7];
- return t5;
- }
- nativeCapabilities() {
- var _a;
- return { title: (_a = this._layer.title) != null ? _a : "", canQueryRelated: false, source: this, capabilities: this._layer.capabilities, databaseType: this._databaseType, requestStandardised: true };
- }
- static create(e4, t5) {
- let s7 = e4.layerDefinition.objectIdField;
- const r2 = e4.layerDefinition.typeIdField ? e4.layerDefinition.typeIdField : "", i3 = [];
- if (e4.layerDefinition.types)
- for (const u of e4.layerDefinition.types)
- i3.push(n3.fromJSON(u));
- let a6 = e4.layerDefinition.geometryType;
- void 0 === a6 && (a6 = e4.featureSet.geometryType || "");
- let l2 = e4.featureSet.features;
- const n6 = t5.toJSON();
- if ("" === s7 || void 0 === s7) {
- let t6 = false;
- for (const r3 of e4.layerDefinition.fields)
- if ("oid" === r3.type || "esriFieldTypeOID" === r3.type) {
- s7 = r3.name, t6 = true;
- break;
- }
- if (false === t6) {
- let t7 = "FID", r3 = true, i4 = 0;
- for (; r3; ) {
- let s8 = true;
- for (const r4 of e4.layerDefinition.fields)
- if (r4.name === t7) {
- s8 = false;
- break;
- }
- true === s8 ? r3 = false : (i4++, t7 = "FID" + i4.toString());
- }
- e4.layerDefinition.fields.push({ type: "esriFieldTypeOID", name: t7, alias: t7 });
- const a7 = [];
- for (let s8 = 0; s8 < l2.length; s8++)
- a7.push({ geometry: e4.featureSet.features[s8].geometry, attributes: e4.featureSet.features[s8].attributes ? this._cloneAttr(e4.featureSet.features[s8].attributes) : {} }), a7[s8].attributes[t7] = s8;
- l2 = a7, s7 = t7;
- }
- }
- const o3 = [];
- for (const u of e4.layerDefinition.fields)
- u instanceof y ? o3.push(u) : o3.push(y.fromJSON(u));
- let p3 = a6;
- switch (p3) {
- case "esriGeometryPoint":
- p3 = "point";
- break;
- case "esriGeometryPolyline":
- p3 = "polyline";
- break;
- case "esriGeometryPolygon":
- p3 = "polygon";
- break;
- case "esriGeometryExtent":
- p3 = "extent";
- break;
- case "esriGeometryMultipoint":
- p3 = "multipoint";
- }
- for (const h of l2)
- h.geometry && h.geometry instanceof p == false && (h.geometry.type = p3, void 0 === h.geometry.spatialReference && (h.geometry.spatialReference = n6));
- const f6 = { outFields: ["*"], source: l2, fields: o3, types: i3, typeIdField: r2, objectIdField: s7, spatialReference: t5 };
- f6.geometryType = p3 || "point";
- const _ = new Ze(f6);
- return new d3({ layer: _, spatialReference: t5, isTable: null === p3 || "" === p3 });
- }
- async queryAttachments() {
- return [];
- }
- async getFeatureByObjectId(e4) {
- const t5 = new x2();
- t5.where = this.objectIdField + "=" + e4.toString();
- const s7 = await this._layer.queryFeatures(t5);
- return 1 === s7.features.length ? s7.features[0] : null;
- }
- async getOwningSystemUrl() {
- return "";
- }
- async getIdentityUser() {
- return "";
- }
- };
- // node_modules/@arcgis/core/arcade/featureset/sources/FeatureLayerRelated.js
- var d4 = class extends C2 {
- constructor(e4) {
- super(e4), this.declaredClass = "esri.arcade.featureset.sources.FeatureLayerRelated", this._findObjectId = -1, this._requestStandardised = false, this._removeGeometry = false, this._overrideFields = null, this.featureObjectId = null, e4.spatialReference && (this.spatialReference = e4.spatialReference), this._transparent = true, this._maxProcessing = 1e3, this._layer = e4.layer, this._wset = null, this._findObjectId = e4.objectId, this.featureObjectId = e4.objectId, this.relationship = e4.relationship, this._relatedLayer = e4.relatedLayer, void 0 !== e4.outFields && (this._overrideFields = e4.outFields), void 0 !== e4.includeGeometry && (this._removeGeometry = false === e4.includeGeometry);
- }
- _maxQueryRate() {
- return F;
- }
- end() {
- return this._layer;
- }
- optimisePagingFeatureQueries() {
- }
- async loadImpl() {
- var _a;
- return await Promise.all([this._layer.load(), (_a = this._relatedLayer) == null ? void 0 : _a.load()]), this._initialiseFeatureSet(), this;
- }
- nativeCapabilities() {
- return this._relatedLayer.nativeCapabilities();
- }
- _initialiseFeatureSet() {
- if (null == this.spatialReference && (this.spatialReference = this._layer.spatialReference), this.geometryType = this._relatedLayer.geometryType, this.fields = this._relatedLayer.fields.slice(0), null !== this._overrideFields)
- if (1 === this._overrideFields.length && "*" === this._overrideFields[0])
- this._overrideFields = null;
- else {
- const e5 = [], t5 = [];
- for (const i3 of this.fields)
- if ("oid" === i3.type)
- e5.push(i3), t5.push(i3.name);
- else
- for (const r2 of this._overrideFields)
- if (r2.toLowerCase() === i3.name.toLowerCase()) {
- e5.push(i3), t5.push(i3.name);
- break;
- }
- this.fields = e5, this._overrideFields = t5;
- }
- const e4 = this._layer.nativeCapabilities();
- e4 && (this._databaseType = e4.databaseType, this._requestStandardised = e4.requestStandardised), this.objectIdField = this._relatedLayer.objectIdField, this.globalIdField = this._relatedLayer.globalIdField, this.hasM = this._relatedLayer.supportsM, this.hasZ = this._relatedLayer.supportsZ, this.typeIdField = this._relatedLayer.typeIdField, this.types = this._relatedLayer.types;
- }
- async databaseType() {
- return await this._relatedLayer.databaseType(), this._databaseType = this._relatedLayer._databaseType, this._databaseType;
- }
- isTable() {
- return this._relatedLayer.isTable();
- }
- _isInFeatureSet() {
- return i.InFeatureSet;
- }
- _candidateIdTransform(e4) {
- return e4;
- }
- async _getSet(e4) {
- if (null === this._wset) {
- await this._ensureLoaded();
- const t5 = await this._getFilteredSet("", null, null, null, e4);
- return this._wset = t5, t5;
- }
- return this._wset;
- }
- _changeFeature(t5) {
- const i3 = {};
- for (const e4 of this.fields)
- i3[e4.name] = t5.attributes[e4.name];
- return new g({ geometry: true === this._removeGeometry ? null : t5.geometry, attributes: i3 });
- }
- async _getFilteredSet(e4, t5, i3, r2, a6) {
- var _a;
- if (await this.databaseType(), this.isTable() && t5 && null !== e4 && "" !== e4) {
- return new t3([], [], true, null);
- }
- const n6 = this._layer.nativeCapabilities();
- if (false === n6.canQueryRelated) {
- return new t3([], [], true, null);
- }
- if (((_a = n6.capabilities) == null ? void 0 : _a.queryRelated) && n6.capabilities.queryRelated.supportsPagination)
- return this._getFilteredSetUsingPaging(e4, t5, i3, r2, a6);
- let d5 = "", o3 = false;
- null !== r2 && n6.capabilities && n6.capabilities.queryRelated && true === n6.capabilities.queryRelated.supportsOrderBy && (d5 = r2.constructClause(), o3 = true);
- const u = new d();
- u.objectIds = [this._findObjectId];
- const h = null !== this._overrideFields ? this._overrideFields : this._fieldsIncludingObjectId(this._relatedLayer.fields ? this._relatedLayer.fields.map((e5) => e5.name) : ["*"]);
- u.outFields = h, u.relationshipId = this.relationship.id, u.where = "1=1";
- let c5 = true;
- true === this._removeGeometry && (c5 = false), u.returnGeometry = c5, this._requestStandardised && (u.sqlFormat = "standard"), u.outSpatialReference = this.spatialReference, u.orderByFields = "" !== d5 ? d5.split(",") : null;
- const y3 = await n6.source.queryRelatedFeatures(u);
- this._checkCancelled(a6);
- const p3 = y3[this._findObjectId] ? y3[this._findObjectId].features : [], _ = [];
- for (let s7 = 0; s7 < p3.length; s7++)
- this._featureCache[p3[s7].attributes[this._relatedLayer.objectIdField]] = p3[s7], _.push(p3[s7].attributes[this._relatedLayer.objectIdField]);
- const f6 = t5 && null !== e4 && "" !== e4, g4 = null != i3;
- return new t3(f6 || g4 ? _ : [], f6 || g4 ? [] : _, o3, null);
- }
- _fieldsIncludingObjectId(e4) {
- if (null === e4)
- return [this.objectIdField];
- const t5 = e4.slice(0);
- if (t5.includes("*"))
- return t5;
- let i3 = false;
- for (const r2 of t5)
- if (r2.toUpperCase() === this.objectIdField.toUpperCase()) {
- i3 = true;
- break;
- }
- return false === i3 && t5.push(this.objectIdField), t5;
- }
- async _getFilteredSetUsingPaging(e4, t5, i3, r2, a6) {
- var _a, _b;
- let n6 = "", l2 = false;
- const d5 = this._layer.nativeCapabilities();
- null !== r2 && d5 && ((_a = d5.capabilities) == null ? void 0 : _a.queryRelated) && true === d5.capabilities.queryRelated.supportsOrderBy && (n6 = r2.constructClause(), l2 = true), await this.databaseType();
- const o3 = "1=1";
- let u = this._maxQueryRate();
- const h = (_b = d5.capabilities) == null ? void 0 : _b.query.maxRecordCount;
- void 0 !== h && h < u && (u = h);
- const c5 = t5 && null !== e4 && "" !== e4, y3 = null != i3;
- let p3 = null, _ = true;
- true === this._removeGeometry && (_ = false);
- const f6 = null !== this._overrideFields ? this._overrideFields : this._fieldsIncludingObjectId(this._relatedLayer.fields ? this._relatedLayer.fields.map((e5) => e5.name) : ["*"]);
- return p3 = new t3(c5 || y3 ? ["GETPAGES"] : [], c5 || y3 ? [] : ["GETPAGES"], l2, { outFields: f6.join(","), resultRecordCount: u, resultOffset: 0, objectIds: [this._findObjectId], where: o3, orderByFields: n6, returnGeometry: _, returnIdsOnly: "false", internal: { set: [], lastRetrieved: 0, lastPage: 0, fullyResolved: false } }), await this._expandPagedSet(p3, u, 0, 0, a6), p3;
- }
- _expandPagedSet(e4, t5, i3, r2, s7) {
- return this._expandPagedSetFeatureSet(e4, t5, i3, r2, s7);
- }
- _clonePageDefinition(e4) {
- return null === e4 ? null : true !== e4.groupbypage ? { groupbypage: false, outFields: e4.outFields, resultRecordCount: e4.resultRecordCount, resultOffset: e4.resultOffset, where: e4.where, objectIds: e4.objectIds, orderByFields: e4.orderByFields, returnGeometry: e4.returnGeometry, returnIdsOnly: e4.returnIdsOnly, internal: e4.internal } : { groupbypage: true, outFields: e4.outFields, resultRecordCount: e4.resultRecordCount, useOIDpagination: e4.useOIDpagination, generatedOid: e4.generatedOid, groupByFieldsForStatistics: e4.groupByFieldsForStatistics, resultOffset: e4.resultOffset, outStatistics: e4.outStatistics, geometry: e4.geometry, where: e4.where, objectIds: e4.objectIds, orderByFields: e4.orderByFields, returnGeometry: e4.returnGeometry, returnIdsOnly: e4.returnIdsOnly, internal: e4.internal };
- }
- async _getPhysicalPage(e4, t5, i3) {
- const r2 = e4.pagesDefinition.internal.lastRetrieved, s7 = r2, a6 = e4.pagesDefinition.internal.lastPage, n6 = this._layer.nativeCapabilities(), d5 = new d();
- true === this._requestStandardised && (d5.sqlFormat = "standard"), d5.relationshipId = this.relationship.id, d5.objectIds = e4.pagesDefinition.objectIds, d5.resultOffset = e4.pagesDefinition.internal.lastPage, d5.resultRecordCount = e4.pagesDefinition.resultRecordCount, d5.outFields = e4.pagesDefinition.outFields.split(","), d5.where = e4.pagesDefinition.where, d5.orderByFields = "" !== e4.pagesDefinition.orderByFields ? e4.pagesDefinition.orderByFields.split(",") : null, d5.returnGeometry = e4.pagesDefinition.returnGeometry, d5.outSpatialReference = this.spatialReference;
- const o3 = await n6.source.queryRelatedFeatures(d5);
- if (this._checkCancelled(i3), e4.pagesDefinition.internal.lastPage !== a6)
- return 0;
- const u = o3[this._findObjectId] ? o3[this._findObjectId].features : [];
- for (let l2 = 0; l2 < u.length; l2++)
- e4.pagesDefinition.internal.set[s7 + l2] = u[l2].attributes[this._relatedLayer.objectIdField];
- for (let l2 = 0; l2 < u.length; l2++)
- this._featureCache[u[l2].attributes[this._relatedLayer.objectIdField]] = u[l2];
- const h = !o3[this._findObjectId] || false === o3[this._findObjectId].exceededTransferLimit;
- return u.length !== e4.pagesDefinition.resultRecordCount && h && (e4.pagesDefinition.internal.fullyResolved = true), e4.pagesDefinition.internal.lastRetrieved = r2 + u.length, e4.pagesDefinition.internal.lastPage += e4.pagesDefinition.resultRecordCount, u.length;
- }
- async _getFeatures(e4, r2, s7, a6) {
- const n6 = [];
- -1 !== r2 && void 0 === this._featureCache[r2] && n6.push(r2);
- const l2 = this._maxQueryRate();
- if (true === this._checkIfNeedToExpandKnownPage(e4, l2))
- return await this._expandPagedSet(e4, l2, 0, 0, a6), this._getFeatures(e4, r2, s7, a6);
- let d5 = 0;
- for (let t5 = e4._lastFetchedIndex; t5 < e4._known.length && (d5++, d5 <= s7 && (e4._lastFetchedIndex += 1), !("GETPAGES" !== e4._known[t5] && void 0 === this._featureCache[e4._known[t5]] && (e4._known[t5] !== r2 && n6.push(e4._known[t5]), n6.length > s7))) && !(d5 >= s7 && 0 === n6.length); t5++)
- ;
- if (0 === n6.length)
- return "success";
- throw new o(n5.MissingFeatures);
- }
- async _refineSetBlock(e4, t5, i3) {
- return e4;
- }
- async _stat(e4, t5, i3, r2, s7, a6, n6) {
- return { calculated: false };
- }
- get gdbVersion() {
- return this._relatedLayer.gdbVersion;
- }
- async _canDoAggregates(e4, t5, i3, r2, s7) {
- return false;
- }
- relationshipMetaData() {
- return this._relatedLayer.relationshipMetaData();
- }
- serviceUrl() {
- return this._relatedLayer.serviceUrl();
- }
- queryAttachments(e4, t5, i3, r2, s7) {
- return this._relatedLayer.queryAttachments(e4, t5, i3, r2, s7);
- }
- getFeatureByObjectId(e4, t5) {
- return this._relatedLayer.getFeatureByObjectId(e4, t5);
- }
- getOwningSystemUrl() {
- return this._relatedLayer.getOwningSystemUrl();
- }
- getIdentityUser() {
- return this._relatedLayer.getIdentityUser();
- }
- getDataSourceFeatureSet() {
- return this._relatedLayer;
- }
- };
- // node_modules/@arcgis/core/arcade/featureSetUtils.js
- function I() {
- null === a2.applicationCache && (a2.applicationCache = new a2());
- }
- async function S2(e4, t5) {
- if (a2.applicationCache) {
- const r2 = a2.applicationCache.getLayerInfo(e4);
- if (r2) {
- const a6 = await r2;
- return new Ze({ url: e4, outFields: t5, sourceJSON: a6 });
- }
- const n6 = new Ze({ url: e4, outFields: t5 }), s7 = (async () => (await n6.load(), n6.sourceJSON))();
- if (a2.applicationCache) {
- a2.applicationCache.setLayerInfo(e4, s7);
- try {
- return await s7, n6;
- } catch (a6) {
- throw a2.applicationCache.clearLayerInfo(e4), a6;
- }
- }
- return await s7, n6;
- }
- return new Ze({ url: e4, outFields: t5 });
- }
- async function N2(e4, t5, a6, r2, n6, s7 = null) {
- return F3(await S2(e4, ["*"]), t5, a6, r2, n6, s7);
- }
- function F3(e4, t5 = null, a6 = null, r2 = true, n6 = null, s7 = null) {
- const i3 = { layer: e4, spatialReference: t5, outFields: a6, includeGeometry: r2, lrucache: n6, interceptor: s7 };
- return true === e4._hasMemorySource() ? new d3(i3) : new v2(i3);
- }
- async function T2(e4) {
- if (null !== a2.applicationCache) {
- const t5 = a2.applicationCache.getLayerInfo(e4);
- if (null !== t5)
- return t5;
- }
- const a6 = (async () => {
- const a7 = await U(e4, { responseType: "json", query: { f: "json" } });
- return a7.data ? a7.data : null;
- })();
- if (null !== a2.applicationCache) {
- a2.applicationCache.setLayerInfo(e4, a6);
- try {
- return await a6;
- } catch (r2) {
- throw a2.applicationCache.clearLayerInfo(e4), r2;
- }
- }
- return a6;
- }
- async function g3(e4, a6) {
- const r2 = "QUERYDATAELEMTS:" + a6.toString() + ":" + e4;
- if (null !== a2.applicationCache) {
- const e5 = a2.applicationCache.getLayerInfo(r2);
- if (null !== e5)
- return e5;
- }
- const n6 = (async () => {
- const r3 = await U(e4 + "/queryDataElements", { method: "post", responseType: "json", query: { layers: JSON.stringify([a6.toString()]), f: "json" } });
- if (r3.data) {
- const e5 = r3.data;
- if (e5.layerDataElements && e5.layerDataElements[0])
- return e5.layerDataElements[0];
- }
- throw new o(n5.DataElementsNotFound);
- })();
- if (null !== a2.applicationCache) {
- a2.applicationCache.setLayerInfo(r2, n6);
- try {
- return await n6;
- } catch (s7) {
- throw a2.applicationCache.clearLayerInfo(r2), s7;
- }
- }
- return n6;
- }
- async function A2(e4) {
- if (null !== a2.applicationCache) {
- const t5 = a2.applicationCache.getLayerInfo(e4);
- if (null !== t5)
- return t5;
- }
- const a6 = (async () => {
- const a7 = await U(e4, { responseType: "json", query: { f: "json" } });
- if (a7.data) {
- const e5 = a7.data;
- return e5.layers || (e5.layers = []), e5.tables || (e5.tables = []), e5;
- }
- return { layers: [], tables: [] };
- })();
- if (null !== a2.applicationCache) {
- a2.applicationCache.setLayerInfo(e4, a6);
- try {
- return await a6;
- } catch (r2) {
- throw a2.applicationCache.clearLayerInfo(e4), r2;
- }
- }
- return a6;
- }
- async function C4(e4, t5) {
- const a6 = { metadata: null, networkId: -1, unVersion: 3, terminals: [], queryelem: null, layerNameLkp: {}, lkp: null }, r2 = await A2(e4);
- if (a6.metadata = r2, r2.controllerDatasetLayers && void 0 !== r2.controllerDatasetLayers.utilityNetworkLayerId && null !== r2.controllerDatasetLayers.utilityNetworkLayerId) {
- if (r2.layers)
- for (const e5 of r2.layers)
- a6.layerNameLkp[e5.id] = e5.name;
- if (r2.tables)
- for (const e5 of r2.tables)
- a6.layerNameLkp[e5.id] = e5.name;
- const n6 = r2.controllerDatasetLayers.utilityNetworkLayerId;
- a6.networkId = n6;
- const s7 = await g3(e4, n6);
- if (s7) {
- a6.queryelem = s7, a6.queryelem && a6.queryelem.dataElement && void 0 !== a6.queryelem.dataElement.schemaGeneration && (a6.unVersion = a6.queryelem.dataElement.schemaGeneration), a6.lkp = {}, a6.queryelem.dataElement.domainNetworks || (a6.queryelem.dataElement.domainNetworks = []);
- for (const e5 of a6.queryelem.dataElement.domainNetworks) {
- for (const t6 of e5.edgeSources ? e5.edgeSources : []) {
- const e6 = { layerId: t6.layerId, sourceId: t6.sourceId, className: a6.layerNameLkp[t6.layerId] ? a6.layerNameLkp[t6.layerId] : null };
- e6.className && (a6.lkp[e6.className] = e6);
- }
- for (const t6 of e5.junctionSources ? e5.junctionSources : []) {
- const e6 = { layerId: t6.layerId, sourceId: t6.sourceId, className: a6.layerNameLkp[t6.layerId] ? a6.layerNameLkp[t6.layerId] : null };
- e6.className && (a6.lkp[e6.className] = e6);
- }
- }
- if (a6.queryelem.dataElement.terminalConfigurations)
- for (const e5 of a6.queryelem.dataElement.terminalConfigurations)
- for (const t6 of e5.terminals)
- a6.terminals.push({ terminalId: t6.terminalId, terminalName: t6.terminalName });
- const r3 = await T2(e4 + "/" + n6);
- if (r3.systemLayers && void 0 !== r3.systemLayers.associationsTableId && null !== r3.systemLayers.associationsTableId) {
- const n7 = [];
- a6.unVersion >= 4 && (n7.push("STATUS"), n7.push("PERCENTALONG"));
- let s8 = await N2(e4 + "/" + r3.systemLayers.associationsTableId.toString(), t5, ["OBJECTID", "FROMNETWORKSOURCEID", "TONETWORKSOURCEID", "FROMGLOBALID", "TOGLOBALID", "TOTERMINALID", "FROMTERMINALID", "ASSOCIATIONTYPE", "ISCONTENTVISIBLE", "GLOBALID", ...n7], false, null, null);
- return await s8.load(), a6.unVersion >= 4 && (s8 = s8.filter(f2.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62,63)", s8.getFieldsIndex())), await s8.load()), { lkp: a6.lkp, associations: s8, unVersion: a6.unVersion, terminals: a6.terminals };
- }
- return { associations: null, unVersion: a6.unVersion, lkp: null, terminals: [] };
- }
- return { associations: null, unVersion: a6.unVersion, lkp: null, terminals: [] };
- }
- return { associations: null, unVersion: a6.unVersion, lkp: null, terminals: [] };
- }
- async function k2(e4, t5, a6, r2 = null, n6 = null, s7 = true, i3 = null, l2 = null) {
- let o3 = e4.serviceUrl();
- if (!o3)
- return null;
- o3 = "/" === o3.charAt(o3.length - 1) ? o3 + t5.relatedTableId.toString() : o3 + "/" + t5.relatedTableId.toString();
- const u = await N2(o3, r2, n6, s7, i3, l2);
- return new d4({ layer: e4, relatedLayer: u, relationship: t5, objectId: a6, spatialReference: r2, outFields: n6, includeGeometry: s7, lrucache: i3, interceptor: l2 });
- }
- c4.registerAction(), C3.registerAction(), a3.registerAction(), f5.registerAction(), a5.registerAction();
- var j3 = class extends e2 {
- constructor(e4, t5 = null, a6 = null, r2 = null) {
- super(), this._map = e4, this._overridespref = t5, this._lrucache = a6, this._interceptor = r2, this._instantLayers = [];
- }
- _makeAndAddFeatureSet(e4, t5 = true, a6 = null) {
- const r2 = F3(e4, this._overridespref, null === a6 ? ["*"] : a6, t5, this._lrucache, this._interceptor);
- return this._instantLayers.push({ featureset: r2, opitem: e4, includeGeometry: t5, outFields: JSON.stringify(a6) }), r2;
- }
- async featureSetByName(e4, t5 = true, a6 = null) {
- if (void 0 !== this._map.loaded && void 0 !== this._map.load && false === this._map.loaded)
- return await this._map.load(), this.featureSetByName(e4, t5, a6);
- null === a6 && (a6 = ["*"]), a6 = (a6 = a6.slice(0)).sort();
- const r2 = JSON.stringify(a6);
- for (let s7 = 0; s7 < this._instantLayers.length; s7++) {
- const a7 = this._instantLayers[s7];
- if (a7.opitem.title === e4 && a7.includeGeometry === t5 && a7.outFields === r2)
- return this._instantLayers[s7].featureset;
- }
- const n6 = this._map.allLayers.find((t6) => t6 instanceof Ze && t6.title === e4);
- if (n6)
- return this._makeAndAddFeatureSet(n6, t5, a6);
- if (this._map.tables) {
- const r3 = this._map.tables.find((t6) => !!(t6.title && t6.title === e4 || t6.title && t6.title === e4));
- if (r3) {
- if (r3 instanceof Ze)
- return this._makeAndAddFeatureSet(r3, t5, a6);
- if (r3._materializedTable)
- ;
- else {
- const e5 = r3.outFields ? r3 : { ...r3, outFields: ["*"] };
- r3._materializedTable = new Ze(e5);
- }
- return await r3._materializedTable.load(), this._makeAndAddFeatureSet(r3._materializedTable, t5, a6);
- }
- }
- return null;
- }
- async featureSetById(e4, t5 = true, a6 = ["*"]) {
- if (void 0 !== this._map.loaded && void 0 !== this._map.load && false === this._map.loaded)
- return await this._map.load(), this.featureSetById(e4, t5, a6);
- null === a6 && (a6 = ["*"]), a6 = (a6 = a6.slice(0)).sort();
- const r2 = JSON.stringify(a6);
- for (let s7 = 0; s7 < this._instantLayers.length; s7++) {
- const a7 = this._instantLayers[s7];
- if (a7.opitem.id === e4 && a7.includeGeometry === t5 && a7.outFields === r2)
- return this._instantLayers[s7].featureset;
- }
- const n6 = this._map.allLayers.find((t6) => t6 instanceof Ze && t6.id === e4);
- if (n6)
- return this._makeAndAddFeatureSet(n6, t5, a6);
- if (this._map.tables) {
- const r3 = this._map.tables.find((t6) => t6.id === e4);
- if (r3) {
- if (r3 instanceof Ze)
- return this._makeAndAddFeatureSet(r3, t5, a6);
- if (r3._materializedTable)
- ;
- else {
- const e5 = { ...r3, outFields: ["*"] };
- r3._materializedTable = new Ze(e5);
- }
- return await r3._materializedTable.load(), this._makeAndAddFeatureSet(r3._materializedTable, t5, a6);
- }
- }
- return null;
- }
- };
- var O = class extends e2 {
- constructor(e4, t5 = null, a6 = null, r2 = null) {
- super(), this._url = e4, this._overridespref = t5, this._lrucache = a6, this._interceptor = r2, this.metadata = null, this._instantLayers = [];
- }
- get url() {
- return this._url;
- }
- _makeAndAddFeatureSet(e4, t5 = true, a6 = null) {
- const r2 = F3(e4, this._overridespref, null === a6 ? ["*"] : a6, t5, this._lrucache);
- return this._instantLayers.push({ featureset: r2, opitem: e4, includeGeometry: t5, outFields: JSON.stringify(a6) }), r2;
- }
- async _loadMetaData() {
- const e4 = await A2(this._url);
- return this.metadata = e4, e4;
- }
- load() {
- return this._loadMetaData();
- }
- clone() {
- return new O(this._url, this._overridespref, this._lrucache, this._interceptor);
- }
- async featureSetByName(e4, t5 = true, a6 = null) {
- null === a6 && (a6 = ["*"]), a6 = (a6 = a6.slice(0)).sort();
- const r2 = JSON.stringify(a6);
- for (let i3 = 0; i3 < this._instantLayers.length; i3++) {
- const a7 = this._instantLayers[i3];
- if (a7.opitem.title === e4 && a7.includeGeometry === t5 && a7.outFields === r2)
- return this._instantLayers[i3].featureset;
- }
- const n6 = await this._loadMetaData();
- let s7 = null;
- for (const i3 of n6.layers ? n6.layers : [])
- i3.name === e4 && (s7 = i3);
- if (!s7)
- for (const i3 of n6.tables ? n6.tables : [])
- i3.name === e4 && (s7 = i3);
- if (s7) {
- const e5 = await S2(this._url + "/" + s7.id, ["*"]);
- return this._makeAndAddFeatureSet(e5, t5, a6);
- }
- return null;
- }
- async featureSetById(e4, t5 = true, a6 = ["*"]) {
- null === a6 && (a6 = ["*"]), a6 = (a6 = a6.slice(0)).sort();
- const r2 = JSON.stringify(a6);
- e4 = null != e4 ? e4.toString() : "";
- for (let i3 = 0; i3 < this._instantLayers.length; i3++) {
- const a7 = this._instantLayers[i3];
- if (a7.opitem.id === e4 && a7.includeGeometry === t5 && a7.outFields === r2)
- return this._instantLayers[i3].featureset;
- }
- const n6 = await this._loadMetaData();
- let s7 = null;
- for (const i3 of n6.layers ? n6.layers : [])
- null !== i3.id && void 0 !== i3.id && i3.id.toString() === e4 && (s7 = i3);
- if (!s7)
- for (const i3 of n6.tables ? n6.tables : [])
- null !== i3.id && void 0 !== i3.id && i3.id.toString() === e4 && (s7 = i3);
- if (s7) {
- const e5 = await S2(this._url + "/" + s7.id, ["*"]);
- return this._makeAndAddFeatureSet(e5, t5, a6);
- }
- return null;
- }
- };
- function E2(e4, t5, a6 = null, r2 = null) {
- return new j3(e4, t5, a6, r2);
- }
- function b2(e4, t5, a6 = null, r2 = null) {
- return new O(e4, t5, a6, r2);
- }
- function D2(e4, t5) {
- if (null === e4)
- return t5;
- return new j({ url: e4.field("url") });
- }
- async function q(a6, r2, n6) {
- if (!s.findCredential(a6.restUrl))
- return null;
- if ("loaded" === a6.loadStatus && "" === r2 && a6.user && a6.user.sourceJSON && false === n6)
- return a6.user.sourceJSON;
- if ("" === r2) {
- const e4 = await U(a6.restUrl + "/community/self", { responseType: "json", query: { f: "json", ...false === n6 ? {} : { returnUserLicenseTypeExtensions: true } } });
- if (e4.data) {
- const t5 = e4.data;
- if (t5 && t5.username)
- return t5;
- }
- return null;
- }
- const s7 = await U(a6.restUrl + "/community/users/" + r2, { responseType: "json", query: { f: "json" } });
- if (s7.data) {
- const e4 = s7.data;
- return e4.error ? null : e4;
- }
- return null;
- }
- function v3(e4, t5, a6, r2, n6) {
- if (null === e4)
- return null;
- if (e4 instanceof Ze) {
- switch (t5) {
- case "datasource":
- return F3(e4, n6, e4.outFields, true, a6, r2).getDataSourceFeatureSet();
- case "parent":
- case "root":
- return F3(e4, n6, e4.outFields, true, a6, r2);
- }
- return null;
- }
- if (e4 instanceof C2)
- switch (t5) {
- case "datasource":
- return e4.getDataSourceFeatureSet();
- case "parent":
- return e4;
- case "root":
- return e4.getRootFeatureSet();
- }
- return null;
- }
- async function G(e4, t5, a6, r2, n6, s7, i3, l2 = null) {
- var _a;
- if (a2.applicationCache) {
- const o4 = a2.applicationCache.getLayerInfo(e4 + ":" + s7.url);
- if (o4) {
- const e5 = await o4;
- return F3(new Ze({ url: b(e5.url) + "/" + t5, outFields: ["*"] }), a6, r2, n6, i3, l2);
- }
- }
- const o3 = new x({ id: e4, portal: s7 }).load();
- a2.applicationCache && a2.applicationCache.setLayerInfo(e4 + ":" + s7.url, o3);
- try {
- const e5 = await o3;
- return F3(new Ze({ url: b((_a = e5.url) != null ? _a : "") + "/" + t5, outFields: ["*"] }), a6, r2, n6, i3, l2);
- } catch (u) {
- throw a2.applicationCache && a2.applicationCache.clearLayerInfo(e4 + ":" + s7.url), u;
- }
- }
- export {
- e2 as e,
- c4 as c,
- F2 as F,
- W,
- E,
- x5 as x,
- A,
- e3 as e2,
- a3 as a,
- a5 as a2,
- d3 as d,
- I,
- N2 as N,
- F3 as F2,
- C4 as C,
- k2 as k,
- E2,
- b2 as b,
- D2 as D,
- q,
- v3 as v,
- G
- };
- //# sourceMappingURL=chunk-UI53XRRK.js.map
|