@geoscene/core 4.29.5 → 4.29.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/serviceAreaMetaData.js +1 -1
- package/assets/geoscene/core/workers/RemoteClient.js +1 -1
- package/assets/geoscene/core/workers/chunks/02a8f0cc511b810d29dd.js +1 -1
- package/assets/geoscene/core/workers/chunks/0b2f4079142b4c2a4ddf.js +1 -1
- package/assets/geoscene/core/workers/chunks/26f1ec6ce2720bcc1202.js +1 -1
- package/assets/geoscene/core/workers/chunks/348bcc57b99a975902a8.js +1 -1
- package/assets/geoscene/core/workers/chunks/54c8eea3a70e92842c6a.js +1 -1
- package/assets/geoscene/core/workers/chunks/5db9739e00f15613d1ea.js +1 -1
- package/assets/geoscene/core/workers/chunks/71fed2917f4bee173836.js +1 -1
- package/assets/geoscene/core/workers/chunks/851de06c5980b9b7362a.js +1 -1
- package/assets/geoscene/core/workers/chunks/9d8ce7eec9d80a038477.js +1 -1
- package/assets/geoscene/core/workers/chunks/b139cf91bc148aa84419.js +1 -1
- package/assets/geoscene/core/workers/chunks/c527692694688a5b3b07.js +2 -4
- package/assets/geoscene/core/workers/chunks/c556644bb0cf88770939.js +1 -1
- package/assets/geoscene/core/workers/chunks/cf3d5bd2c9115a3e0b79.js +1 -1
- package/assets/geoscene/core/workers/chunks/eceaa46f622f6fa31128.js +1 -1
- package/assets/geoscene/core/workers/chunks/f59b5ea05caca8a1a398.js +1 -1
- package/assets/geoscene/core/workers/chunks/f60e5dd0e712cf32f782.js +1 -1
- package/assets/geoscene/images/basemap/gray.jpg +0 -0
- package/assets/geoscene/themes/base/widgets/_BasemapGallery.scss +0 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_en.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nb.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -1
- package/assets/geoscene/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -1
- package/chunks/HUDMaterial.glsl.js +0 -1
- package/chunks/persistableUrlUtils.js +1 -1
- package/config.js +1 -1
- package/copyright.txt +1 -1
- package/core/devEnvironmentUtils.js +1 -1
- package/core/urlUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/support/urlUtils.js +1 -1
- package/request.js +1 -1
- package/rest/support/PlacesParameters.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/BasemapStyle.js +1 -1
- package/support/apiKeyUtils.js +1 -1
- package/support/basemapDefinitions.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/MixExternalColor.glsl.js +0 -2
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/assets/geoscene/core/workers/chunks/0af5d2f792b83f7dd0aa.js.LICENSE.txt +0 -5
- package/assets/geoscene/core/workers/chunks/5015d4fccf4854b9da1e.js.LICENSE.txt +0 -10
- package/assets/geoscene/core/workers/chunks/54c8eea3a70e92842c6a.js.LICENSE.txt +0 -16
- package/assets/geoscene/core/workers/chunks/804267fca0627d277286.js.LICENSE.txt +0 -5
- package/assets/geoscene/core/workers/chunks/87c4848dd48119fd75f9.js.LICENSE.txt +0 -5
- package/assets/geoscene/core/workers/chunks/8ec7475f19f8979dfaae.js.LICENSE.txt +0 -5
- package/assets/geoscene/core/workers/chunks/904b3e9c98e5de220650.js.LICENSE.txt +0 -11
- package/assets/geoscene/core/workers/chunks/c1f78653c70f6bde65b3.js.LICENSE.txt +0 -5
- package/assets/geoscene/core/workers/chunks/da21d31db537be097da9.js.LICENSE.txt +0 -5
- package/assets/geoscene/core/workers/chunks/e742cd41ab9b164ad974.js.LICENSE.txt +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1780,8616,6236],{50408:(e,t,i)=>{i.d(t,{c:()=>s});class s{constructor(){this.declaredRootClass="geoscene.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}},52260:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>le,constructFeatureSet:()=>ne,constructFeatureSetFromPortalItem:()=>pe,constructFeatureSetFromRelationship:()=>oe,constructFeatureSetFromUrl:()=>re,convertToFeatureSet:()=>fe,createFeatureSetCollectionFromMap:()=>de,createFeatureSetCollectionFromService:()=>he,initialiseMetaDataCache:()=>ie});var s=i(2600),r=i(50408),n=i(96680),a=i(74185),l=i(6444),o=i(35512),u=i(28136),c=i(5245),d=i(38174),h=i(35772),f=i(81812),p=i(74440),y=i(3048),_=i(67312),g=i(63220);class m{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,s){const r=new m;r.field=e;const n=g.WhereClause.create(t,i,s),a=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new c.oi(c.kP.MissingStatisticParameters);const t=g.WhereClause.create((0,y.Oc)(e.parseTree.args.value[0],p.or.Standardised,e.parameters),e.fieldsIndex,e.timeZone);return{name:e.parseTree.name,expr:t}}return null}(n);if(null===a)throw new c.oi(c.kP.UnsupportedSqlFunction,{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(r.typeofstat="MIN",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"min"})}else if("MAX"===l){if(r.typeofstat="MAX",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===l)r.typeofstat="COUNT",r.workingexpr=a.expr;else if("STDEV"===l){if(r.typeofstat="STDDEV",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===l){if(r.typeofstat="SUM",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===l){if(r.typeofstat="AVG",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:l})}else if("AVG"===l){if(r.typeofstat="AVG",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==l)throw new c.oi(c.kP.UnsupportedSqlFunction,{function:l});if(r.typeofstat="VAR",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"var"})}return r}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"}}}var w=i(77380),F=i(85436),S=i(43846),b=i(62024),I=i(56156),C=i(600),v=i(16424);function T(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class D extends d.c{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="geoscene.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return p.kV.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new v.c([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s,this.dateFieldsTimeZoneDefaultUTC),t.typeofstat=T(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s,this.dateFieldsTimeZoneDefaultUTC),sqlType:null};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=p.cT.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new I.c({wkid:4326});this.fields=[];const r=new m;r.field=this._nextUniqueName(e),r.tofieldname=this.objectIdField,r.workingexpr=g.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC),r.typeofstat="MIN",this._decodedStatsfield.push(r);for(const t of this._decodedGroupbyfield){const i=new C.c;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,y.ct)(t.expression)){const e=this._parent.getField((0,y.gj)(t.expression,p.or.Standardised));if(!e)throw new c.SD(c.aG.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type,t.sqlType=e.type}else{i.type=this._convertToEsriFieldType((0,y.wv)(t.expression,this._parent.fields));const e=new C.c;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new o.eq(e,t.expression)),this._candosimplegroupby=!1,t.sqlType=i.type}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new o.kX(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new C.c;let s=null;const r=this._decodedStatsfield[t];r.field=this._nextUniqueName(e),r.tofieldname===this.objectIdField&&(this._internalObjectIdField=r.field),i.name=r.tofieldname,i.alias=i.name;const n=null!==r.workingexpr&&(0,y.ct)(r.workingexpr)?(0,y.gj)(r.workingexpr,p.or.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(s=this._parent.getField(n),!s)throw new c.SD(c.aG.AggregationFieldNotFound);i.type=s.type}else i.type="double";break;case"MIN":case"MAX":if(""!==n){if(s=this._parent.getField(n),!s)throw new c.SD(c.aG.AggregationFieldNotFound);i.type=s.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(s=this._parent.getField(n),!s))throw new c.SD(c.aG.AggregationFieldNotFound);i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const r=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,r)?(await this._expandPagedSet(e,r,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,r){if(""!==e)return new h.c([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,y.G_)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==s){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,l.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(r),n=!0===l.nowhereclause?new h.c(a._candidates.slice(0).concat(a._known.slice(0)),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new h.c(a._candidates.slice(0),a._known.slice(0),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let c=this._parent;if(this._adaptedFields.length>0&&(c=new o.A$({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new h.c(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.c({parentfeatureset:c,orderbyclause:new f.c(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=c;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a.c({parentfeatureset:e,whereclause:t})}n=new h.c(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.c({parentfeatureset:e,orderbyclause:new f.c(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,y.OK)(e,t.tofieldname,(0,y.gj)(t.workingexpr,p.or.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,y.OK)(e,t.tofieldname,(0,y.gj)(t.expression,p.or.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const e of s){const t={geometry:e.geometry,attributes:{}},i={};for(const t in e.attributes)i[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.c(t)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((r,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?r(s.length):this._nextAggregateItem(e,t,i,s,(n=>{null===n?r(s.length):(t-=1,r(this._sequentialGetPhysicalItem(e,t,i,s)))}),n)}))}_nextAggregateItem(e,t,i,s,r,a){try{(0,n.a2)(e.pagesDefinition.internal.iterator.next()).then((n=>{if(null===n)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const l=this._generateAggregateHash(n);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[n],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[n],id:l},void r(i)}e.pagesDefinition.internal.workingItem.features.push(n)}this._nextAggregateItem(e,t,i,s,r,a)}}),a)}catch(e){a(e)}}_calculateFieldStat(e,t,i){const s=[];for(let i=0;i<e.features.length;i++)if(null!==t.workingexpr){const r=t.workingexpr.calculateValue(e.features[i]);null!==r&&(r instanceof F.K||r instanceof b.C?s.push(r.toNumber()):r instanceof S.U?s.push(r.toMilliseconds()):s.push(r))}else s.push(null);switch(t.typeofstat){case"MIN":i.attributes[t.tofieldname]=(0,_.Kk)("min",s,-1);break;case"MAX":i.attributes[t.tofieldname]=(0,_.Kk)("max",s,-1);break;case"SUM":i.attributes[t.tofieldname]=(0,_.Kk)("sum",s,-1);break;case"COUNT":i.attributes[t.tofieldname]=s.length;break;case"VAR":i.attributes[t.tofieldname]=(0,_.Kk)("var",s,-1);break;case"STDDEV":i.attributes[t.tofieldname]=(0,_.Kk)("stddev",s,-1);break;case"AVG":i.attributes[t.tofieldname]=(0,_.Kk)("avg",s,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.features[0].attributes[i.singlefield]:g.WhereClause.convertValueToStorageFormat(i.expression.calculateValue(e.features[0]),i.sqlType);t.attributes[i.tofieldname]=s}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let s=0;s<this._decodedStatsfield.length;s++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[s],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.c({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return(0,w.I)(t,w.Y.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){d.c._featuresetFunctions.groupby=function(e,t){return new D({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var k=i(12500),R=i(96100),x=i(47620),N=i(73528),P=i(8736),L=i(6704),A=i(60544),O=i(672),E=i(8444),q=i(20744),G=i(9456),j=i(10860),U=i(4048),B=i(88204),M=i(99944),W=i(49132),V=i(59500),Q=i(95776);function Z(e,t){return null!=t&&!0===e.returnGeometry&&"xyFootprint"!==e.multipatchOption&&!e.outStatistics}i(6220),i(72052),i(28176),i(31864),i(19212);var z=i(46788),K=(i(60708),i(66360),i(7488),i(48516),i(44048),i(67932),i(91232),i(24296),i(22080),i(819)),J=(i(77048),i(53648),i(95247),i(18648)),Y=(i(9770),i(57404));class X extends d.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.yE}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,p.Sc)(e.toJSON());return(0,w.I)(t,w.Y.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=p.or.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=p.or.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=p.or.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=p.or.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._layer instanceof E.default?(this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.types=null,this.typeIdField=null):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types,this.subtypeField=this._layer.subtypeField,this.subtypes=this._layer.subtypes)}_isInFeatureSet(){return p.kV.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new Q.c;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){const t=this._layer?.capabilities?.query;return!e.outStatistics&&!0===t?.supportsFormatPBF&&!0===t?.supportsQuantizationEditMode}async queryPBF(e){return e.quantizationParameters={mode:"edit"},(await async function(e,t,s,r){return async function(e,t,s,r){const n=s?.infoFor3D;if(!Z(e,n)||null==n||!t.assetMaps||!t.features?.length)return V.c.fromJSON(t);const{meshFeatureSetFromJSON:a}=await(0,j.Yv)(Promise.all([i.e(8624),i.e(3180),i.e(7424),i.e(9780),i.e(456)]).then(i.bind(i,12784)),r);return a(e,n,t)}(t,await async function(e,t,i,s){const r={...s},n=function(e,t){let i=Q.c.from(e);i.sourceSpatialReference=i.sourceSpatialReference??t?.sourceSpatialReference??null,(t?.gdbVersion||t?.dynamicDataSource)&&(i=i===e?i.clone():i,i.gdbVersion=e.gdbVersion||t.gdbVersion,i.dynamicDataSource=e.dynamicDataSource?B.U.from(e.dynamicDataSource):t.dynamicDataSource);const s=t?.infoFor3D;if(null!=s&&Z(e,s)){i=i===e?i.clone():i,i.formatOf3DObjects=null;const{supportedFormats:t,queryFormats:r}=s,n=(0,U.me)("model/gltf-binary",t)??(0,U.If)("glb",t),a=(0,U.me)("model/gltf+json",t)??(0,U.If)("gtlf",t);for(const e of r){if(e===n){i.formatOf3DObjects=e;break}e!==a||i.formatOf3DObjects||(i.formatOf3DObjects=e)}if(!i.formatOf3DObjects)throw new q.c("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(null==i.outFields||!i.outFields.includes("*")){i=i===e?i.clone():i,null==i.outFields&&(i.outFields=[]);const{originX:t,originY:r,originZ:n,translationX:a,translationY:l,translationZ:o,scaleX:u,scaleY:c,scaleZ:d,rotationX:h,rotationY:f,rotationZ:p,rotationDeg:y}=s.transformFieldRoles;i.outFields.push(t,r,n,a,l,o,u,c,d,h,f,p,y)}}return i}(t,i),a=null!=t.outStatistics?.[0],l=(0,G.c)("featurelayer-pbf-statistics"),o=!a||l;let u;if("pbf"===i?.format&&o)try{u=await(0,W.S)(e,n,r)}catch(e){if("query:parsing-pbf"!==e.name)throw e;i.format="json"}return"json"!==i?.format&&o||(u=await(0,M.E)(e,n,r)),function(e,t){if(null!=e&&null!=t)for(const i of t){const t=e.get(i.name);t&&Object.assign(i,t.toJSON())}}(i?.fieldsIndex,u.fields),u}(e,t,s,r),s,r)}(this._layer.parsedUrl,e,{format:"pbf"},{})).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){e.returnZ=this.hasZ,e.returnM=this.hasM;const i="execute"===t?M.c:"executeForCount"===t?z._:K.g,s="execute"===t&&this.pbfSupportedForQuery(e);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(t,r),r=r.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),r}async _getFilteredSet(e,t,i,s,r){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new h.c([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new Q.c;this.datesInUnknownTimezone&&(o.timeReferenceUnknownClient=!0),o.where=null===i?null===t?"1=1":"":(0,y.gj)(i,n),this._requestStandardised&&(o.sqlFormat="standard"),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(r),new h.c([],u,l,null)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=s.constructClause(),a=!0);const l=await this.databaseType();let o=null===i?null===t?"1=1":"":(0,y.gj)(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(o=""!==o?"(("+this._layer.definitionExpression+") AND ("+o+"))":this._layer.definitionExpression);let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);let d=null;if(!0===this._pageJustIds)d=new h.c([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const s=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new h.c([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:s.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,r),d}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=new Q.c;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=e.pagesDefinition.where,a.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[r+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFeatures(e,t,i,s){const r=[];if(-1!==t&&void 0===this._featureCache[t]&&r.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,s),this._getFeatures(e,t,i,s);let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[s]]){let i=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[s]]){const r=t._featureMap[e._known[s]];null!==r&&(i=!0,this._featureCache[e._known[s]]=r)}}if(!1===i&&(e._known[s]!==t&&r.push(e._known[s]),r.length>=this._maxProcessingRate()-1))break}if(n>=i&&0===r.length)break}if(0===r.length)return"success";const a=new Q.c;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.objectIds=r,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(s),void 0!==l.error)throw new c.SD(c.aG.RequestFailed,{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,s,r,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let d=i.parseTree.column;const h=this._layer.fields??[];for(let e=0;e<h.length;e++)if(h[e].name.toLowerCase()===d.toLowerCase()){d=h[e].name;break}const f=new Q.c;this._requestStandardised&&(f.sqlFormat="standard"),this.datesInUnknownTimezone&&(f.timeReferenceUnknownClient=!0);let p=null===n?null===r?"1=1":"":(0,y.gj)(n,u);this._layer.definitionExpression&&this._useDefinitionExpression&&(p=""!==p?"(("+this._layer.definitionExpression+") AND ("+p+"))":this._layer.definitionExpression),f.where=p,f.spatialRelationship=this._makeRelationshipEnum(s),f.relationParameter=this._makeRelationshipParam(s),f.geometry=null===r?null:r,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[d];const _=await this.executeQuery(f,"execute");if(this._checkCancelled(o),!_.hasOwnProperty("features"))throw new c.SD(c.aG.InvalidStatResponse);let g=!1;for(let e=0;e<h.length;e++)if(h[e].name===d){"date"===h[e].type&&(g=!0);break}for(let e=0;e<_.features.length;e++){if(g){const t=_.features[e].attributes[d];null!==t?l.push(new Date(t)):l.push(t)}else l.push(_.features[e].attributes[d]);if(l.length>=a)break}return 0===_.features.length?l:_.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+_.features.length,t,i,s,r,n,a,l,o)}:l}async _distinctStat(e,t,i,s,r,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,s,r,n,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,i,s){const r=await this.databaseType(),n=new Q.c;if(this._requestStandardised&&(n.sqlFormat="standard"),this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};let a=null===s?null===i?"1=1":"":(0,y.gj)(s,r);return this._layer.definitionExpression&&this._useDefinitionExpression&&(a=""!==a?"(("+this._layer.definitionExpression+") AND ("+a+"))":this._layer.definitionExpression),n.where=a,this.datesInUnknownTimezone&&(n.timeReferenceUnknownClient=!0),n.where=a,n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===i?null:i,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,i,s,r,n,a){await this._ensureLoaded();const l=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression,o=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics,u=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsDistinct;if("count"===e)return u?this._countstat(e,i,s,r):{calculated:!1};if(!1===o||!1===(0,y.ct)(t)&&!1===l||!1===t.isStandardized)return""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===u?""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,i,s,r,n,a);const d=await this.databaseType();if(this.isTable()&&s&&null!==i&&""!==i)return{calculated:!0,result:null};const h=new Q.c;this._requestStandardised&&(h.sqlFormat="standard");let f=null===r?null===s?"1=1":"":(0,y.gj)(r,d);this._layer.definitionExpression&&this._useDefinitionExpression&&(f=""!==f?"(("+this._layer.definitionExpression+") AND ("+f+"))":this._layer.definitionExpression),h.where=f,h.spatialRelationship=this._makeRelationshipEnum(i),h.relationParameter=this._makeRelationshipParam(i),h.geometry=null===s?null:s,this.datesInUnknownTimezone&&(h.timeReferenceUnknownClient=!0);const p=new Y.c;p.statisticType=(0,_.AJ)(e),p.onStatisticField=(0,y.gj)(t,d),p.outStatisticFieldName="ARCADE_STAT_RESULT",h.returnGeometry=!1;let g="ARCADE_STAT_RESULT";h.outStatistics=[p];const m=await this.executeQuery(h,"execute");if(!m.hasOwnProperty("features")||0===m.features.length)throw new c.SD(c.aG.InvalidStatResponse);let w=!1;const F=m.fields??[];for(let e=0;e<F.length;e++)if("ARCADE_STAT_RESULT"===F[e].name.toUpperCase()){g=F[e].name,"date"===F[e].type&&(w=!0);break}if(w){let e=m.features[0].attributes[g];return null!==e&&(e=new Date(m.features[0].attributes[g])),{calculated:!0,result:e}}return{calculated:!0,result:m.features[0].attributes[g]}}_stat(e,t,i,s,r,n,a){return this._stats(e,t,i,s,r,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const s=this._layer.capabilities?.query,r=!0===s?.supportsSqlExpression;if(null!=s&&!0===s.supportsStatistics&&!0===s.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,y.ct)(t[e].workingexpr)&&!1===r)&&(i=!1);return!1!==i}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,c=!1;null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=n.constructClause(),c=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(c=!1,u=!0,o=this._layer.objectIdField);const d=[];for(let e=0;e<t.length;e++){const i=new Y.c;i.onStatisticField=null!==t[e].workingexpr?(0,y.gj)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),d.push(i)}""===o&&(o=e.join(","));let f=this._maxQueryRate();const p=this._layer.capabilities?.query.maxRecordCount;null!=p&&p<f&&(f=p);let _=null===r?null===s?"1=1":"":(0,y.gj)(r,l);return this._layer.definitionExpression&&this._useDefinitionExpression&&(_=""!==_?"(("+this._layer.definitionExpression+") AND ("+_+"))":this._layer.definitionExpression),new h.c([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:u,generatedOid:a,resultRecordCount:f,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===s?null:s,where:_,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,i){let s=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(s=""!==s?"("+s+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const r=e.pagesDefinition.internal.lastRetrieved,n=r,a=e.pagesDefinition.internal.lastPage,o=new Q.c;if(this._requestStandardised&&(o.sqlFormat="standard"),o.where=s,o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,this.datesInUnknownTimezone&&(o.timeReferenceUnknownClient=!0),o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new c.SD(c.aG.InvalidStatResponse);const d=[];if(e.pagesDefinition.internal.lastPage!==a)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[n+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)d.push(new l.c({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,d}static create(e,t,i,s,r){const n=new O.default({url:e,outFields:null===t?["*"]:t});return new X({layer:n,spatialReference:i,lrucache:s,interceptor:r})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,p.mY)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,s,r){const n=this._layer.capabilities;if(n?.data.supportsAttachment&&n?.operations.supportsQueryAttachments){const n={objectIds:[e],returnMetadata:r};(t&&t>0||i&&i>0)&&(n.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(n.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:n,method:"attachments"});const a=await this._layer.queryAttachments(n),l=[];return a&&a[e]&&a[e].forEach((t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let s=null;r&&t.exifInfo&&(s=P.c.convertJsonToArcade(t.exifInfo,"system",!0)),l.push(new N.c(t.id,t.name,t.contentType,t.size,i,s,t.keywords??null))})),l}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields?.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,A.um)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,s.c)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const i=t.spatialReference;for(const s of t.relatedRecordGroups){const r=s.objectId,n=[];for(const e of s.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.c({geometry:e.geometry?(0,L.h4)(e.geometry):null,attributes:e.attributes});n.push(t)}e[r]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new c.SD(c.aG.InvalidRequest)}async getFeatureByObjectId(e,t){const i=new Q.c;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.datesInUnknownTimezone&&(i.timeReferenceUnknownClient=!0),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await(0,M.c)(this._layer.parsedUrl.path,i);return 1===s.features.length?s.features[0]:null}async getIdentityUser(){await this.load();const e=x.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=x.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const e=await(0,s.c)(t,{query:{f:"json"}});let i="";return e.data?.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new X({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,{parsedUrl:{path:t},serviceItemId:i=null}=this._layer;if(t){const r=await(0,s.c)(t,{responseType:"json",query:{f:"json"}});e=r?.data?.name??null,i=r?.data?.serviceItemId??null}const r=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===i?null:i,serviceLayerUrl:""===t?null:t,webMapLayerId:r?this._layer.id??null:null,webMapLayerTitle:r?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var H=i(60140);class $ extends d.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.yE}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer?.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),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return p.kV.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new l.c({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new h.c([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new h.c([],[],!0,null);if(n.capabilities?.queryRelated&&n.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&n.capabilities?.queryRelated&&!0===n.capabilities.queryRelated.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new J.default;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),o.returnGeometry=c,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null;const d=await n.source.queryRelatedFeatures(o);this._checkCancelled(r);const f=d[this._findObjectId]?d[this._findObjectId].features:[],p=[];for(let e=0;e<f.length;e++)this._featureCache[f[e].attributes[this._relatedLayer.objectIdField]]=f[e],p.push(f[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=i;return new h.c(y||_?p:[],y||_?[]:p,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==s&&l?.capabilities?.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,d=null!=i;let f=null,p=!0;!0===this._removeGeometry&&(p=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return f=new h.c(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:p,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(f,o,0,0,r),f}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new J.default;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await a.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[r+t]=u[t].attributes[this._relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this._relatedLayer.objectIdField]]=u[e];const c=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&c&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,s){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let a=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[s]&&void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>i)))&&!(a>=i&&0===r.length);s++);if(0===r.length)return"success";throw new c.SD(c.aG.MissingFeatures)}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,r,n,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,r){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,r){return this._relatedLayer.queryAttachments(e,t,i,s,r)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var ee=i(57372),te=i(9764);function ie(){null===ee.c.applicationCache&&(ee.c.applicationCache=new ee.c)}async function se(e,t){if(ee.c.applicationCache){const i=ee.c.applicationCache.getLayerInfo(e);if(i){const s=await i;return new O.default({url:e,outFields:t,sourceJSON:s})}const s=new O.default({url:e,outFields:t}),r=(async()=>(await s.load(),s.sourceJSON))();if(ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(e,r);try{return await r,s}catch(t){throw ee.c.applicationCache.clearLayerInfo(e),t}}return await r,s}return new O.default({url:e,outFields:t})}async function re(e,t,i,s,r,n=null){return ne(await se(e,["*"]),t,i,s,r,n)}function ne(e,t=null,i=null,s=!0,r=null,a=null){if(e instanceof O.default||(0,n.a0)(e)){const n={layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:a};return 1==!(e.url||!e.source)?new H.c(n):new X(n)}const l=ne(e.parent,t,i,s,r,a);return l.filter(g.WhereClause.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),e.parent.fieldsIndex,l.dateFieldsTimeZoneDefaultUTC))}async function ae(e){if(null!==ee.c.applicationCache){const t=ee.c.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,s.c)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw ee.c.applicationCache.clearLayerInfo(e),t}}return t}async function le(e,t){const i={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},r=await ae(e);if(i.metadata=r,void 0!==r.controllerDatasetLayers?.utilityNetworkLayerId&&null!==r.controllerDatasetLayers.utilityNetworkLayerId){if(r.layers)for(const e of r.layers)i.layerNameLkp[e.id]=e.name;if(r.tables)for(const e of r.tables)i.layerNameLkp[e.id]=e.name;const n=r.controllerDatasetLayers.utilityNetworkLayerId;i.networkId=n;const a=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==ee.c.applicationCache){const e=ee.c.applicationCache.getLayerInfo(i);if(null!==e)return e}const r=(async()=>{const i=await(0,s.c)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new c.SD(c.aG.DataElementsNotFound)})();if(null!==ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(i,r);try{return await r}catch(e){throw ee.c.applicationCache.clearLayerInfo(i),e}}return r}(e,n);if(a){i.queryelem=a,i.queryelem?.dataElement&&void 0!==i.queryelem.dataElement.schemaGeneration&&(i.unVersion=i.queryelem.dataElement.schemaGeneration),i.lkp={},i.queryelem.dataElement.domainNetworks||(i.queryelem.dataElement.domainNetworks=[]);for(const e of i.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}}if(i.queryelem.dataElement.terminalConfigurations)for(const e of i.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)i.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const r=await async function(e){if(null!==ee.c.applicationCache){const t=ee.c.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,s.c)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw ee.c.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+n);if(void 0!==r.systemLayers?.associationsTableId&&null!==r.systemLayers.associationsTableId){const s=[];i.unVersion>=4&&(s.push("STATUS"),s.push("PERCENTALONG"));let n=await re(e+"/"+r.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...s],!1,null,null);return await n.load(),i.unVersion>=4&&(n=n.filter(g.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",n.getFieldsIndex(),n.dateFieldsTimeZoneDefaultUTC)),await n.load()),{lkp:i.lkp,associations:n,unVersion:i.unVersion,terminals:i.terminals}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}async function oe(e,t,i,s=null,r=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await re(o,s,r,n,a,l);return new $({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:s,outFields:r,includeGeometry:n,lrucache:a,interceptor:l})}a.c.registerAction(),D.registerAction(),u.c.registerAction(),k.c.registerAction(),R.c.registerAction();class ue extends r.c{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=ne(e,this._overridespref,null===i?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>{if(t instanceof O.default){if(t.title===e)return!0}else if((0,n.a0)(t)&&t.title===e)return!0;return!1}));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>!!(t.title&&t.title===e||t.title&&t.title===e)));if(s){if(s instanceof O.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e=s.outFields?s:{...s,outFields:["*"]};s._materializedTable=new O.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}async featureSetById(e,t=!0,i=["*"]){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>{if(t instanceof O.default){if(t.id===e)return!0}else if((0,n.a0)(t)&&t.id===e)return!0;return!1}));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>t.id===e));if(s){if(s instanceof O.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e={...s,outFields:["*"]};s._materializedTable=new O.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}}class ce extends r.c{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=ne(e,this._overridespref,null===i?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await ae(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ce(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers??[])t.name===e&&(n=t);if(!n)for(const t of r.tables??[])t.name===e&&(n=t);if(n){const e=await se(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of r.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await se(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}}function de(e,t,i=null,s=null){return new ue(e,t,i,s)}function he(e,t,i=null,s=null){return new ce(e,t,i,s)}function fe(e,t,i,s,r){if(null===e)return null;if(e instanceof O.default){switch(t){case"datasource":return ne(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return ne(e,r,e.outFields,!0,i,s)}return null}if((0,n.a0)(e)){switch(t){case"datasource":return ne(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return ne(e,r,e.outFields,!0,i,s)}return null}if((0,n.a1)(e)){switch(t){case"datasource":return ne(e.parent,r,e.parent.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return ne(e,r,e.parent.outFields,!0,i,s)}return null}if(e instanceof d.c)switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}async function pe(e,t,i,s,r,n,a,l=null){if(ee.c.applicationCache){const o=ee.c.applicationCache.getLayerInfo(e+":"+n.url);if(o){const e=await o;return ne(new O.default({url:(0,p.mY)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}}const o=new te.default({id:e,portal:n}).load();ee.c.applicationCache&&ee.c.applicationCache.setLayerInfo(e+":"+n.url,o);try{const e=await o;return ne(new O.default({url:(0,p.mY)(e.url??"")+"/"+t,outFields:["*"]}),i,s,r,a,l)}catch(t){throw ee.c.applicationCache&&ee.c.applicationCache.clearLayerInfo(e+":"+n.url),t}}},35512:(e,t,i)=>{i.d(t,{A$:()=>m,MH:()=>y,_0:()=>_,eq:()=>g,kX:()=>p});var s=i(6444),r=i(98412),n=i(5245),a=i(38174),l=i(35772),o=i(74440),u=i(3048),c=i(70680),d=i(63220),h=i(56156);class f{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class p extends f{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class y extends f{constructor(e,t,i){super((0,o.qG)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,u.OK)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class _ extends f{constructor(e,t,i){super(e),this.codefield=t,this.lkp=i,this.reverseLkp={};for(const e in i)this.reverseLkp[i[e]]=e;this.sqlRewritable=!0}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,o.or.Standardised,this.field.name,this.codefield instanceof d.WhereClause?(0,u.gj)(this.codefield,o.or.Standardised):this.codefield,e.parameters);return i.includes(_.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:d.WhereClause.create(i,t._parent.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)}}evaluateNodeToWhereClause(e,t,i=null,s=null,r){let a,l,c,d;switch(e.type){case"interval":return(0,u.UV)(this.evaluateNodeToWhereClause(e.value,t,i,s,r),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,i,_.BADNESS,r));for(let n=0;n<e.clauses.length;n++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,i,_.BADNESS,r)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,i,_.BADNESS,r);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,_.BADNESS,r)),s+=" END ",s}case"parameter":{const i=r[e.value.toLowerCase()];if("string"==typeof i)return"'"+i.toString().replaceAll("'","''")+"'";if((0,o.It)(i))return(0,u.QT)(i,t);if((0,o.IL)(i))return(0,u.QT)(i,t);if((0,o.Yv)(i))return(0,u.ik)(i,t);if((0,o.uK)(i))return(0,u.Qb)(i,t);if((0,o.Qr)(i))return(0,u.Lp)(i,t);if(i instanceof Array){const e=[];for(let s=0;s<i.length;s++)"string"==typeof i[s]?e.push("'"+i[s].toString().replaceAll("'","''")+"'"):(0,o.It)(i[s])||(0,o.IL)(i[s])?e.push((0,u.QT)(i[s],t)):(0,o.Yv)(i[s])?e.push((0,u.ik)(i[s],t)):(0,o.uK)(i[s])?e.push((0,u.Qb)(i[s],t)):(0,o.Qr)(i[s])?e.push((0,u.Lp)(i[s],t)):e.push(i[s].toString());return e}return i.toString()}case"expression-list":l=[];for(const n of e.value)l.push(this.evaluateNodeToWhereClause(n,t,i,s,r));return l;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,_.BADNESS,r)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"IS":if("null"!==e.right.type)throw new n.oi(n.kP.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new n.oi(n.kP.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NOT NULL )";case"IN":if(a=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+n.join(",")+")) "}return a=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+a.join(",")+")) "}return d=this.evaluateNodeToWhereClause(e.right,t,i,s,r),d instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+d.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+d+")) ";case"NOT IN":if(a=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+n.join(",")+")) "}return a=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+a.join(",")+")) "}return d=this.evaluateNodeToWhereClause(e.right,t,i,s,r),d instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+d.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+d+")) ";case"BETWEEN":return c=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" BETWEEN "+c[0]+" AND "+c[1]+" ) ";case"NOTBETWEEN":return c=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" NOT BETWEEN "+c[0]+" AND "+c[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return(0,u.Yv)("date"===e.mode,t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"data-type":return e.value;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,i,_.BADNESS,r);return(0,u.I1)(e.name,s,t)}}throw new n.oi(n.kP.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof d.WhereClause?this.reverseLkp[d.WhereClause.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}_.BADNESS="_!!!_BAD_LKP_!!!!";class g extends f{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,u.OK)(e,this.field.name,(0,u.gj)(this._sql,o.or.Standardised),t.getFieldsIndex())}}extractValue(e){return d.WhereClause.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class m extends a.c{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="geoscene.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_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 h.c({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=o.cT.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),(0,c.EN)(t),this._wset=new l.c(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,n){const a=[];-1!==t&&void 0===this._featureCache[t]&&a.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,n),this._getFeatures(e,t,i,n);let u=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&a.push(e._known[s]),a.length>=o)));s++);if(0===a.length)return"success";e=new l.c([],a,e._ordered,null);const c=Math.min(a.length,i);await(this._parent?._getFeatures(e,-1,c,n)),this._checkCancelled(n);const d=[];for(let e=0;e<c;e++){const t=this._parent?._featureFromCache(a[e]);void 0!==t&&d.push({geometry:t.geometry,attributes:t.attributes,id:a[e]})}for(const e of d){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new s.c({attributes:t,geometry:(0,r.SW)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new n.SD(n.aG.NeverReach)}async _getFilteredSet(e,t,i,s,r){let n=!1;const a=this._reformulateWithoutAdaptions(i);n=a.cannot,i=a.where;let o=!1;if(null!==s){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof p)&&!0===s.scanForField(t.field.name)){if(!(t instanceof y)){s=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,u.Sy)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,i,s,r);let d;return this._checkCancelled(r),d=!0===n?new l.c(c._candidates.slice(0).concat(c._known.slice(0)),[],!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new l.c(c._candidates.slice(0),c._known.slice(0),!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),d}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,u.G_)(e,i.field.name)){const s=i.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,i,s,r,n,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(r),l=l||o.cannot,null!==(r=o.where)?null!==this._extraFilter&&(r=(0,u.Sy)(this._extraFilter,r)):r=this._extraFilter,!0===l)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,i,s,r,n,a);return!1===c.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,i,s,r){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const i of this.adaptedFields)if(e[t].toLowerCase()===i.field.name.toLowerCase()&&!(i instanceof p))return!1;const n=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)return!1;const t=i.clone();t.workingexpr=e.where,n.push(t)}else n.push(i)}const a=this._reformulateWithoutAdaptions(r);return!a.cannot&&(null!==(r=a.where)?null!==this._extraFilter&&(r=(0,u.Sy)(this._extraFilter,r)):r=this._extraFilter,this._parent._canDoAggregates(e,n,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,a,l){if(null===this._parent)throw new n.SD(n.aG.NeverReach);const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new n.SD(n.aG.NeverReach);const t=i.clone();t.workingexpr=e.where,o.push(t)}else o.push(i)}const c=this._reformulateWithoutAdaptions(r);if(c.cannot)throw new n.SD(n.aG.NeverReach);return null!==(r=c.where)?null!==this._extraFilter&&(r=(0,u.Sy)(this._extraFilter,r)):r=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,i,s,r,a,l)}}},74185:(e,t,i)=>{i.d(t,{c:()=>d});var s=i(5245),r=i(38174),n=i(35772),a=i(74440),l=i(3048),o=i(10860),u=i(63220),c=i(56156);class d extends r.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.WhereClause?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new c.c({wkid:4326}),this.geometryType=a.cT.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new n.c(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new n.c(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return t===a.kV.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?a.kV.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.eW)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const s=new n.c([],e,!1,null),r=Math.min(t,e.length);if(await(this._parent?._getFeatures(s,-1,r,i)),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<r;t++){const i=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=a.kV.InFeatureSet:this._idstates[e[t]]=a.kV.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<r;t++){const i=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===l[i]?this._idstates[e[i]]=a.kV.InFeatureSet:this._idstates[e[i]]=a.kV.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,i,s,r){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,l.Sy)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,s,r);let o;return this._checkCancelled(r),o=null!==this._whereClauseFunction?new n.c(a._candidates.slice(0).concat(a._known.slice(0)),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new n.c(a._candidates.slice(0),a._known.slice(0),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,i,s,r,n,a){if(null!==this._whereClauseFunction)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};let o=this._whereclause;null!==r&&null!==this._whereclause&&(o=(0,l.Sy)(this._whereclause,r));const u=await this._parent._stat(e,t,i,s,o,n,a);return!1===u.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,i,s,r){return null===this._whereClauseFunction&&(null!==r?null!==this._whereclause&&(r=(0,l.Sy)(this._whereclause,r)):r=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,o){if(null===this._parent)throw new s.SD(s.aG.NeverReach);return null!==n?null!==this._whereclause&&(n=(0,l.Sy)(this._whereclause,n)):n=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,o)}static registerAction(){r.c._featuresetFunctions.filter=function(e){if("function"==typeof e)return new d({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.WhereClause&&(t=e),new d({parentfeatureset:this,whereclause:t})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},28136:(e,t,i)=>{i.d(t,{c:()=>o});var s=i(96680),r=i(5245),n=i(38174),a=i(35772),l=i(81812);class o extends n.c{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="geoscene.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const i=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(i);const s=new a.c([],[],!0,null);for(let e=0;e<i.length;e++)s._known.push(i[e].id);return s}async getIdColumnDictionary(e,t,i,r){if(i<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,s.a2)(this._parent._expandPagedSet(e,n,0,0,r)),this.getIdColumnDictionary(e,t,i,r);let a=i+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;i+=l.length;const o=await(0,s.a2)(this._parent._getFeatureBatch(l,r));this._checkCancelled(r);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,r)}return e._candidates.length>0?(await(0,s.a2)(this._refineSetBlock(e,this._maxProcessingRate(),r)),this._checkCancelled(r),this.getIdColumnDictionary(e,t,i,r)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new r.SD(r.aG.NeverReach)}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,i,null===s?this._orderbyclause:s,r);this._checkCancelled(r);const l=new a.c(n._candidates.slice(0),n._known.slice(0),n._ordered,this._clonePageDefinition(n.pagesDefinition));let o=!0;if(n._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,r);return!1===o&&(null===t&&null===i||(e=new a.c(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){n.c._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.c(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},96100:(e,t,i)=>{i.d(t,{c:()=>l});var s=i(5245),r=i(38174),n=i(35772),a=i(74440);class l extends r.c{constructor(e){super(e),this._topnum=0,this.declaredClass="geoscene.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new n.c(t._candidates.slice(0),t._known.slice(0),!1,this._clonePageDefinition(t.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(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===a.kV.NotInFeatureSet)return t;const i=this._idstates[e];return i===a.kV.InFeatureSet||i===a.kV.NotInFeatureSet?i:t===a.kV.InFeatureSet&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=a.kV.InFeatureSet,this._countedin++,a.kV.InFeatureSet):(this._idstates[e]=a.kV.NotInFeatureSet,a.kV.NotInFeatureSet):a.kV.Unknown}async _expandPagedSet(e,t,i,r,n){if(null===this._parent)throw new s.SD(s.aG.NotImplemented);if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const a=await this._parent._expandPagedSet(e,t,i,r,n);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),a}async _getFeatures(e,t,i,s){const r=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,s),this._getFeatures(e,t,i,s);-1!==t&&void 0===this._featureCache[t]&&r.push(t);let l=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>a)));s++);if(0===r.length)return"success";const o=new n.c([],r,!1,null),u=Math.min(r.length,i);await this._parent._getFeatures(o,-1,u,s);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(r[e]);void 0!==t&&(this._featureCache[r[e]]=t)}return"success"}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const a=await this._getSet(r);return new n.c(a._candidates.slice(0).concat(a._known.slice(0)),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,s=null;const r=[];for(let n=0;n<e._candidates.length;n++){const l=this._isInFeatureSet(e._candidates[n]);if(l===a.kV.InFeatureSet){if(e._known.push(e._candidates[n]),i+=1,null===s?s={start:n,end:n}:s.end===n-1?s.end=n:(r.push(s),s={start:n,end:n}),e._known.length>=this._topnum)break}else if(l===a.kV.NotInFeatureSet)null===s?s={start:n,end:n}:s.end===n-1?s.end=n:(r.push(s),s={start:n,end:n}),i+=1;else if(l===a.kV.Unknown)break;if(i>=t)break}null!==s&&r.push(s);for(let t=r.length-1;t>=0;t--)e._candidates.splice(r[t].start,r[t].end-r[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){r.c._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},60140:(e,t,i)=>{i.d(t,{c:()=>y});var s=i(6444),r=i(5245),n=i(38174),a=i(35772),l=i(74440),o=i(3048),u=i(50853),c=i(672),d=i(8444),h=i(79648),f=i(600),p=i(95776);class y extends n.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l.yE}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===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),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=l.or.Standardised,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this._layer instanceof d.default?(this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.types=null,this.typeIdField=null):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types,this.subtypeField=this._layer.subtypeField,this.subtypes=this._layer.subtypes)}isTable(){return this._forceIsTable||this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return l.kV.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new s.c({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){let n="",u=!1;if(null!==s&&(n=s.constructClause(),u=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.c([],[],!0,null);const c=new p.c;c.returnZ=this.hasZ,c.returnM=this.hasM,c.where=null===i?null===t?"1=1":"":(0,o.gj)(i,l.or.Standardised),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==n?n.split(","):null,c.geometry=null===t?null:t,c.returnGeometry=!0,c.relationParameter=this._makeRelationshipParam(e);const d=await this._layer.queryFeatures(c);if(null===d)return new a.c([],[],u,null);this._checkCancelled(r);const h=[];return d.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];h.push(t),this._featureCache[t]=this._changeFeature(e)})),new a.c([],h,u,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new p.c;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const i=t.attributes[this._layer.objectIdField];e.push(i),this._featureCache[i]=this._changeFeature(t)})),this._wset=new a.c([],e,!1,null),this._wset}e.returnZ=this.hasZ,e.returnM=this.hasM;const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];i.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new a.c([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);for(let r=e._lastFetchedIndex;r<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>i)));r++);if(0===s.length)return"success";throw new r.SD(r.aG.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField??"",r=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)r.push(h.c.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!i){let t=!1;for(const s of e.layerDefinition.fields)if("oid"===s.type||"esriFieldTypeOID"===s.type){i=s.name,t=!0;break}if(!1===t){let t="FID",s=!0,r=0;for(;s;){let i=!0;for(const s of e.layerDefinition.fields)if(s.name===t){i=!1;break}!0===i?s=!1:(r++,t="FID"+r.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let i=0;i<a.length;i++)n.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),n[i].attributes[t]=i;a=n,i=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof f.c?o.push(t):o.push(f.c.fromJSON(t));let d=n;switch(d||(d=""),d){case"esriGeometryPoint":d="point";break;case"esriGeometryPolyline":d="polyline";break;case"esriGeometryPolygon":d="polygon";break;case"esriGeometryEnvelope":d="extent";break;case"esriGeometryMultipoint":d="multipoint";break;case"":case"esriGeometryNull":d="esriGeometryNull"}if("esriGeometryNull"!==d)for(const e of a)e.geometry&&e.geometry instanceof u.c==0&&(e.geometry.type=d,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of a)e.geometry&&(e.geometry=null);const p={outFields:["*"],source:a,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:r,typeIdField:s,objectIdField:i,spatialReference:t},_="esriGeometryNull"===d||null===d;_||(p.geometryType=d);const g=new c.default(p);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&g.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new y({layer:g,spatialReference:t,isTable:_})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=new p.c;t.where=this.objectIdField+"="+e.toString(),t.returnZ=this.hasZ,t.returnM=this.hasM;const i=await this._layer.queryFeatures(t);return 1===i.features.length?i.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer?.datesInUnknownTimezone}get editFieldsInfo(){return this._layer?.editFieldsInfo}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}},81812:(e,t,i)=>{function s(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{c:()=>r});class r{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const i=t[e].match(/\S+/g);this._fields.push(i[0]),2===i.length?"asc"===i[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e.feature,this._fields[i],i),n=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?s(r,n):-1*s(r,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let i=0;i<this._fields.length;i++){0!==i&&(t+=",");let s=this._fields[i];for(const t of e)if(s.toLowerCase()===t.field.toLowerCase()){s=t.newfield;break}t+=s,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new r(t)}featureValue(e,t,i){const s=e.attributes[t];if(void 0!==s)return s;for(const s in e.attributes)if(t.toLowerCase()===s.toLowerCase())return this._fields[i]=s,e.attributes[s];return null}}},79648:(e,t,i)=>{i.d(t,{c:()=>f});var s=i(41948),r=i(3856),n=i(40504),a=i(1580),l=(i(9456),i(66360),i(72052),i(33600)),o=i(12552),u=i(18996),c=i(89812),d=i(87352);let h=class extends((0,r.q)(n.am)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const i of Object.keys(e))t[i]=(0,c.h4)(e[i]);return t}writeDomains(e,t){const i={};for(const t of Object.keys(e))e[t]&&(i[t]=e[t]?.toJSON());t.domains=i}};(0,s._)([(0,a.qq)({json:{write:!0}})],h.prototype,"id",void 0),(0,s._)([(0,a.qq)({json:{write:!0}})],h.prototype,"name",void 0),(0,s._)([(0,a.qq)({json:{write:!0}})],h.prototype,"domains",void 0),(0,s._)([(0,l.E)("domains")],h.prototype,"readDomains",null),(0,s._)([(0,u.G)("domains")],h.prototype,"writeDomains",null),(0,s._)([(0,a.qq)({type:[d.c],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,s._)([(0,o.c)("geoscene.layers.support.FeatureType")],h);const f=h},48212:(e,t,i)=>{i.d(t,{Ab:()=>w,Ej:()=>h,K0:()=>d,M9:()=>f,Wq:()=>y,YB:()=>c,_2:()=>g,oR:()=>_,q_:()=>p,wn:()=>m});var s=i(28176),r=i(91952);const n={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer"},a=Object.values(n),l=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),o=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function c(e){return!!l.test(e)}function d(e){if(null==e)return null;const t=(0,s.as)(e),i=t?.path.match(l)||t?.path.match(o);if(!i)return null;const[,r,a,u,c]=i,d=a.indexOf("/");return{title:f(-1!==d?a.slice(d+1):a),serverType:n[u.toLowerCase()],sublayer:null!=c&&""!==c?parseInt(c,10):null,url:{path:r}}}function h(e){const t=(0,s.as)(e).path.match(u);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function f(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function p(e,t){const i=[];if(e){const t=d(e);null!=t&&t.title&&i.push(t.title)}if(t){const e=f(t);i.push(e)}if(2===i.length){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function y(e){if(!e)return!1;const t=(e=e.toLowerCase()).includes(".arcgis.com/"),i=e.includes("//services")||e.includes("//tiles")||e.includes("//features");return t&&i}function _(e,t){return e?(0,s.ai)((0,s.kN)(e,t)):e}function g(e){let{url:t}=e;if(!t)return{url:t};t=(0,s.kN)(t,e.logger);const i=(0,s.as)(t),r=d(i.path);let n;if(null!=r)null!=r.sublayer&&null==e.layer.layerId&&(n=r.sublayer),t=r.url.path;else if(e.nonStandardUrlAllowed){const e=h(i.path);null!=e&&(t=e.serviceUrl,n=e.sublayerId)}return{url:(0,s.ai)(t),layerId:n}}function m(e,t,i,n,a){(0,r.w)(t,n,"url",a),n.url&&null!=e.layerId&&(n.url=(0,s.kn)(n.url,i,e.layerId.toString()))}function w(e){if(!e)return!1;const t=e.toLowerCase(),i=t.includes("/services/"),s=t.includes("/mapserver/wmsserver"),r=t.includes("/imageserver/wmsserver"),n=t.includes("/wmsserver");return i&&(s||r||n)}},4048:(e,t,i)=>{i.d(t,{If:()=>l,K0:()=>u,Mn:()=>p,kD:()=>n,me:()=>a,sz:()=>r,w$:()=>o});const s=[["binary","application/octet-stream","bin",""]];function r(e,t){return null!=d(t.name,e?.supportedFormats??[])}function n(e,t){if(!e)return!1;const i=u(t,e.supportedFormats??[]);return null!=i&&e.editFormats.includes(i)}function a(e,t){return h(function(e,t){const i=e.toLowerCase();return c(t).find((e=>f(e)===i))}(e,t))}function l(e,t){return h(d(e,t))}function o(e,t){return f(function(e,t){return c(t).find((t=>h(t)===e))}(e,t))}function u(e,t){return l(e.name,t)??a(e.type,t)}function c(e){return[...s,...e]}function d(e,t){const i=e.toLowerCase();return c(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>i.endsWith(e)))))}function h(e){return e?.[0]}function f(e){return e?.[1].toLowerCase()}function p(e){return e.tables?.find((e=>"assetMaps"===e.role))}},46940:(e,t,i)=>{i.d(t,{CI:()=>h,KI:()=>u,O2:()=>a,_S:()=>l,mU:()=>o,oj:()=>c,qk:()=>d});var s=i(60074),r=i(56156),n=i(29120);function a(e,t){if(!l(e,t)){const i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,d.HOSTED_SERVICE)}function u(e,t){const i=e.typeKeywords;if(i){const e=i.indexOf(t);e>-1&&i.splice(e,1)}}async function c(e){const t=e.clone().normalize();let i;if(t.length>1)for(const e of t)i?e.width>i.width&&(i=e):i=e;else i=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,n.aq)(e);const i=r.c.WGS84;return await(0,s.initializeProjection)(t,i),(0,s.project)(e,i)}(i)}const d={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"GeoScene API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table",HOSTED_SERVICE:"Hosted Service",LOCAL_SCENE:"ViewingMode-Local",TILED_IMAGERY:"Tiled Imagery",GROUP_LAYER_MAP:"Map"};function h(e){const{portal:t,isOrgItem:i,itemControl:s}=e,r=t.user?.privileges;let n=!r||r.includes("features:user:edit"),a=!!i&&!!r?.includes("features:user:fullEdit");const l="update"===s||"admin"===s;return l?a=n=!0:a&&(n=!0),{features:{edit:n,fullEdit:a},content:{updateItem:l}}}},46788:(e,t,i)=>{i.d(t,{_:()=>a});var s=i(21980),r=i(32848),n=i(95776);async function a(e,t,i){const a=(0,s.UX)(e);return(0,r.WE)(a,n.c.from(t),{...i}).then((e=>e.data.count))}},819:(e,t,i)=>{i.d(t,{g:()=>a});var s=i(21980),r=i(32848),n=i(95776);async function a(e,t,i){const a=(0,s.UX)(e);return(0,r.Qn)(a,n.c.from(t),{...i}).then((e=>e.data.objectIds))}},99944:(e,t,i)=>{i.d(t,{E:()=>o,c:()=>l});var s=i(21980),r=i(32848),n=i(59500),a=i(95776);async function l(e,t,i){const s=await o(e,t,i);return n.c.fromJSON(s)}async function o(e,t,i){const n=(0,s.UX)(e),l={...i},o=a.c.from(t),{data:u}=await(0,r.EL)(n,o,o.sourceSpatialReference,l);return u}},49132:(e,t,i)=>{i.d(t,{S:()=>_});var s=i(21980),r=i(70680),n=i(37924),a=i(97088);function l(e,t){return t}function o(e,t,i,s){switch(i){case 0:return h(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?h(e,t+s,1):function({translate:e,scale:t},i,s){return e[s]-i*t[s]}(e,t+s,1)}}function u(e,t,i,s){return 2===i?h(e,t,2):o(e,t,i,s)}function c(e,t,i,s){return 2===i?0===t?0:h(e,t,3):o(e,t,i,s)}function d(e,t,i,s){return 3===i?0===t?0:h(e,t,3):u(e,t,i,s)}function h({translate:e,scale:t},i,s){return e[s]+i*t[s]}class f{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=l,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=(0,n.O)(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=t)for(const i of e.features)t(i.geometry)}createSpatialReference(){return{}}addField(e,t){const i=e.fields;(0,r.EN)(i),i.push(t);const s=i.map((e=>e.name));this._attributesConstructor=function(){for(const e of s)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,i)=>this.addCoordinatePoint(e,t,i),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,i)=>this._addCoordinatePolygon(e,t,i),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,i)=>this._addCoordinatePolyline(e,t,i),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,i)=>this._addCoordinateMultipoint(e,t,i),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,i){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:i,queryGeometryType:s}=t,r=(0,a.Ij)(i.clone(),i,!1,!1,this._transform),n=(0,a.qw)(r,s,!1,!1);e.queryGeometryType=s,e.queryGeometry={...n}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,i){const s=this._transform;switch(t=this._applyTransform(s,t,i,0),i){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let i=0;t<=1&&(i=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(s,e,t,i):0}_addCoordinatePolyline(e,t,i){this._dehydratedAddPointsCoordinate(e.paths,t,i)}_addCoordinatePolygon(e,t,i){this._dehydratedAddPointsCoordinate(e.rings,t,i)}_addCoordinateMultipoint(e,t,i){0===i&&e.points.push([]);const s=this._transformPathLikeValue(t,i);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,i){0===i&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,i),r=e[e.length-1];0===i&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),r.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:i}=e;return t&&i?d:t?u:i?c:o}}var p=i(32848),y=(i(59500),i(95776));async function _(e,t,i){const r=(0,s.UX)(e),n={...i},a=y.c.from(t),l=!a.quantizationParameters,{data:o}=await(0,p.aA)(r,a,new f({sourceSpatialReference:a.sourceSpatialReference,applyTransform:l}),n);return o}},21012:(e,t,i)=>{i.d(t,{M:()=>r});var s=i(37924);function r(e,t,i){if(!i?.features||!i.hasZ)return;const r=(0,s.O)(i.geometryType,t,e.outSpatialReference);if(null!=r)for(const e of i.features)r(e.geometry)}},31864:(e,t,i)=>{i.d(t,{c:()=>d});var s,r=i(41948),n=i(40504),a=i(1580),l=i(53368),o=(i(72052),i(9456),i(12552));const u={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let c=s=class extends n.am{constructor(e){super(e),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:e}=this,t=function(e){const{exifInfo:t,exifName:i,tagName:s}=e;if(!t||!i||!s)return null;const r=t.find((e=>e.name===i));return r?function(e){const{tagName:t,tags:i}=e;if(!i||!t)return null;const s=i.find((e=>e.name===t));return s?.value||null}({tagName:s,tags:r.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:e});return u[t]||null}clone(){return new s({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,r._)([(0,a.qq)({type:String})],c.prototype,"contentType",void 0),(0,r._)([(0,a.qq)()],c.prototype,"exifInfo",void 0),(0,r._)([(0,a.qq)({readOnly:!0})],c.prototype,"orientationInfo",null),(0,r._)([(0,a.qq)({type:l.Ab})],c.prototype,"id",void 0),(0,r._)([(0,a.qq)({type:String})],c.prototype,"globalId",void 0),(0,r._)([(0,a.qq)({type:String})],c.prototype,"keywords",void 0),(0,r._)([(0,a.qq)({type:String})],c.prototype,"name",void 0),(0,r._)([(0,a.qq)({json:{read:!1}})],c.prototype,"parentGlobalId",void 0),(0,r._)([(0,a.qq)({json:{read:!1}})],c.prototype,"parentObjectId",void 0),(0,r._)([(0,a.qq)({type:l.Ab})],c.prototype,"size",void 0),(0,r._)([(0,a.qq)({json:{read:!1}})],c.prototype,"url",void 0),c=s=(0,r._)([(0,o.c)("geoscene.layers.support.AttachmentInfo")],c);const d=c},59500:(e,t,i)=>{i.d(t,{c:()=>w});var s,r=i(41948),n=i(60708),a=i(6444),l=i(14628),o=i(40504),u=i(62088),c=i(1580),d=(i(9456),i(66360),i(33600)),h=i(12552),f=i(18996),p=i(56156),y=i(6704),_=i(600);const g=new l.O({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=s=class extends o.am{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const i=p.c.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const r=e[t],n=a.c.fromJSON(r),l=r.geometry?.spatialReference;null==n.geometry||l||(n.geometry.spatialReference=i);const o=r.aggregateGeometries,u=n.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],s=o[e],r=s?.spatialReference;null==t||r||(t.spatialReference=i)}s.push(n)}return s}writeGeometryType(e,t,i,s){if(e)return void g.write(e,t,i,s);const{features:r}=this;if(r)for(const e of r)if(null!=e?.geometry)return void g.write(e.geometry.type,t,i,s)}readQueryGeometry(e,t){if(!e)return null;const i=!!e.spatialReference,s=(0,y.h4)(e);return s&&!i&&t.spatialReference&&(s.spatialReference=p.c.fromJSON(t.spatialReference)),s}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:i}=this;if(i)for(const e of i)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new s(this.cloneProperties())}cloneProperties(){return(0,u.ct)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let i=0;i<t.features.length;i++){const s=t.features[i];if(s.geometry){const t=e?.[i];s.geometry=t?.toJSON()||s.geometry}}return t}quantize(e){const{scale:[t,i],translate:[s,r]}=e,n=this.features,a=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-s)/t)),(e=>Math.round((r-e)/i)));for(let e=0,t=n.length;e<t;e++)a?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:i}=this;if(!i)return this;const{translate:[s,r],scale:[n,a]}=i;let l=null,o=null;if(this.hasZ&&null!=i?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=i;l=i=>i*t+e}if(this.hasM&&null!=i?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=i;o=i=>null==i?i:i*t+e}const u=this._getHydrationFunction(e,(e=>e*n+s),(e=>r-e*a),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,i){let s,r;const n=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=i(l[1]);e===s&&a===r||(n.push([e-s,a-r]),s=e,r=a)}else s=t(l[0]),r=i(l[1]),n.push([s,r])}return n.length>0?n:null}_getQuantizationFunction(e,t,i){return"point"===e?e=>(e.x=t(e.x),e.y=i(e.y),e):"polyline"===e||"polygon"===e?e=>{const s=(0,y.Cs)(e)?e.rings:e.paths,r=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],a=this._quantizePoints(n,t,i);a&&r.push(a)}return r.length>0?((0,y.Cs)(e)?e.rings=r:e.paths=r,e):null}:"multipoint"===e?e=>{const s=this._quantizePoints(e.points,t,i);return s&&s.length>0?(e.points=s,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,i,s,r){return"point"===e?e=>{e.x=t(e.x),e.y=i(e.y),s&&(e.z=s(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,y.Cs)(e)?e.rings:e.paths;let a,l;for(let e=0,s=n.length;e<s;e++){const s=n[e];for(let e=0,r=s.length;e<r;e++){const r=s[e];e>0?(a+=r[0],l+=r[1]):(a=r[0],l=r[1]),r[0]=t(a),r[1]=i(l)}}if(s&&r)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2]),i[3]=r(i[3])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2])}}else if(r)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=i(e.ymin),e.xmax=t(e.xmax),e.ymax=i(e.ymax),s&&null!=e.zmax&&null!=e.zmin&&(e.zmax=s(e.zmax),e.zmin=s(e.zmin)),r&&null!=e.mmax&&null!=e.mmin&&(e.mmax=r(e.mmax),e.mmin=r(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let a,l;for(let e=0,s=n.length;e<s;e++){const s=n[e];e>0?(a+=s[0],l+=s[1]):(a=s[0],l=s[1]),s[0]=t(a),s[1]=i(l)}if(s&&r)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2]),t[3]=r(t[3])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}else if(r)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=r(t[2])}}:null}};(0,r._)([(0,c.qq)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,r._)([(0,c.qq)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,r._)([(0,c.qq)({type:[a.c],json:{write:!0}})],m.prototype,"features",void 0),(0,r._)([(0,d.E)("features")],m.prototype,"readFeatures",null),(0,r._)([(0,c.qq)({type:[_.c],json:{write:!0}})],m.prototype,"fields",void 0),(0,r._)([(0,c.qq)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,r._)([(0,f.G)("geometryType")],m.prototype,"writeGeometryType",null),(0,r._)([(0,c.qq)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,r._)([(0,c.qq)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,r._)([(0,c.qq)({types:n.Su,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,r._)([(0,d.E)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,r._)([(0,c.qq)({type:p.c,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,r._)([(0,f.G)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,r._)([(0,c.qq)({json:{write:!0}})],m.prototype,"transform",void 0),m=s=(0,r._)([(0,h.c)("geoscene.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0;const w=m}}]);
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1780,8616,6236],{50408:(e,t,i)=>{i.d(t,{c:()=>s});class s{constructor(){this.declaredRootClass="geoscene.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}},52260:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>le,constructFeatureSet:()=>ne,constructFeatureSetFromPortalItem:()=>pe,constructFeatureSetFromRelationship:()=>oe,constructFeatureSetFromUrl:()=>re,convertToFeatureSet:()=>fe,createFeatureSetCollectionFromMap:()=>de,createFeatureSetCollectionFromService:()=>he,initialiseMetaDataCache:()=>ie});var s=i(2600),r=i(50408),n=i(96680),a=i(74185),l=i(6444),o=i(35512),u=i(28136),c=i(5245),d=i(38174),h=i(35772),f=i(81812),p=i(74440),y=i(3048),_=i(67312),g=i(63220);class m{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,s){const r=new m;r.field=e;const n=g.WhereClause.create(t,i,s),a=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new c.oi(c.kP.MissingStatisticParameters);const t=g.WhereClause.create((0,y.Oc)(e.parseTree.args.value[0],p.or.Standardised,e.parameters),e.fieldsIndex,e.timeZone);return{name:e.parseTree.name,expr:t}}return null}(n);if(null===a)throw new c.oi(c.kP.UnsupportedSqlFunction,{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(r.typeofstat="MIN",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"min"})}else if("MAX"===l){if(r.typeofstat="MAX",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===l)r.typeofstat="COUNT",r.workingexpr=a.expr;else if("STDEV"===l){if(r.typeofstat="STDDEV",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===l){if(r.typeofstat="SUM",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===l){if(r.typeofstat="AVG",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:l})}else if("AVG"===l){if(r.typeofstat="AVG",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==l)throw new c.oi(c.kP.UnsupportedSqlFunction,{function:l});if(r.typeofstat="VAR",r.workingexpr=a.expr,null===n)throw new c.oi(c.kP.InvalidFunctionParameters,{function:"var"})}return r}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"}}}var w=i(77380),F=i(85436),S=i(43846),b=i(62024),I=i(56156),C=i(600),v=i(16424);function T(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class D extends d.c{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="geoscene.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return p.kV.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new v.c([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s,this.dateFieldsTimeZoneDefaultUTC),t.typeofstat=T(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s,this.dateFieldsTimeZoneDefaultUTC),sqlType:null};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=p.cT.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new I.c({wkid:4326});this.fields=[];const r=new m;r.field=this._nextUniqueName(e),r.tofieldname=this.objectIdField,r.workingexpr=g.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC),r.typeofstat="MIN",this._decodedStatsfield.push(r);for(const t of this._decodedGroupbyfield){const i=new C.c;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,y.ct)(t.expression)){const e=this._parent.getField((0,y.gj)(t.expression,p.or.Standardised));if(!e)throw new c.SD(c.aG.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type,t.sqlType=e.type}else{i.type=this._convertToEsriFieldType((0,y.wv)(t.expression,this._parent.fields));const e=new C.c;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new o.eq(e,t.expression)),this._candosimplegroupby=!1,t.sqlType=i.type}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new o.kX(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new C.c;let s=null;const r=this._decodedStatsfield[t];r.field=this._nextUniqueName(e),r.tofieldname===this.objectIdField&&(this._internalObjectIdField=r.field),i.name=r.tofieldname,i.alias=i.name;const n=null!==r.workingexpr&&(0,y.ct)(r.workingexpr)?(0,y.gj)(r.workingexpr,p.or.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(s=this._parent.getField(n),!s)throw new c.SD(c.aG.AggregationFieldNotFound);i.type=s.type}else i.type="double";break;case"MIN":case"MAX":if(""!==n){if(s=this._parent.getField(n),!s)throw new c.SD(c.aG.AggregationFieldNotFound);i.type=s.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(s=this._parent.getField(n),!s))throw new c.SD(c.aG.AggregationFieldNotFound);i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const r=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,r)?(await this._expandPagedSet(e,r,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,r){if(""!==e)return new h.c([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,y.G_)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==s){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,l.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(r),n=!0===l.nowhereclause?new h.c(a._candidates.slice(0).concat(a._known.slice(0)),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new h.c(a._candidates.slice(0),a._known.slice(0),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let c=this._parent;if(this._adaptedFields.length>0&&(c=new o.A$({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new h.c(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.c({parentfeatureset:c,orderbyclause:new f.c(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=c;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a.c({parentfeatureset:e,whereclause:t})}n=new h.c(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.c({parentfeatureset:e,orderbyclause:new f.c(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,y.OK)(e,t.tofieldname,(0,y.gj)(t.workingexpr,p.or.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,y.OK)(e,t.tofieldname,(0,y.gj)(t.expression,p.or.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const e of s){const t={geometry:e.geometry,attributes:{}},i={};for(const t in e.attributes)i[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.c(t)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((r,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?r(s.length):this._nextAggregateItem(e,t,i,s,(n=>{null===n?r(s.length):(t-=1,r(this._sequentialGetPhysicalItem(e,t,i,s)))}),n)}))}_nextAggregateItem(e,t,i,s,r,a){try{(0,n.a2)(e.pagesDefinition.internal.iterator.next()).then((n=>{if(null===n)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const l=this._generateAggregateHash(n);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[n],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[n],id:l},void r(i)}e.pagesDefinition.internal.workingItem.features.push(n)}this._nextAggregateItem(e,t,i,s,r,a)}}),a)}catch(e){a(e)}}_calculateFieldStat(e,t,i){const s=[];for(let i=0;i<e.features.length;i++)if(null!==t.workingexpr){const r=t.workingexpr.calculateValue(e.features[i]);null!==r&&(r instanceof F.K||r instanceof b.C?s.push(r.toNumber()):r instanceof S.U?s.push(r.toMilliseconds()):s.push(r))}else s.push(null);switch(t.typeofstat){case"MIN":i.attributes[t.tofieldname]=(0,_.Kk)("min",s,-1);break;case"MAX":i.attributes[t.tofieldname]=(0,_.Kk)("max",s,-1);break;case"SUM":i.attributes[t.tofieldname]=(0,_.Kk)("sum",s,-1);break;case"COUNT":i.attributes[t.tofieldname]=s.length;break;case"VAR":i.attributes[t.tofieldname]=(0,_.Kk)("var",s,-1);break;case"STDDEV":i.attributes[t.tofieldname]=(0,_.Kk)("stddev",s,-1);break;case"AVG":i.attributes[t.tofieldname]=(0,_.Kk)("avg",s,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.features[0].attributes[i.singlefield]:g.WhereClause.convertValueToStorageFormat(i.expression.calculateValue(e.features[0]),i.sqlType);t.attributes[i.tofieldname]=s}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let s=0;s<this._decodedStatsfield.length;s++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[s],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.c({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return(0,w.I)(t,w.Y.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){d.c._featuresetFunctions.groupby=function(e,t){return new D({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var k=i(12500),R=i(96100),x=i(47620),N=i(73528),P=i(8736),L=i(6704),A=i(60544),O=i(672),E=i(8444),q=i(20744),G=i(9456),j=i(10860),U=i(4048),B=i(88204),M=i(99944),W=i(49132),V=i(59500),Q=i(95776);function Z(e,t){return null!=t&&!0===e.returnGeometry&&"xyFootprint"!==e.multipatchOption&&!e.outStatistics}i(6220),i(72052),i(28176),i(31864),i(19212);var z=i(46788),K=(i(60708),i(66360),i(7488),i(48516),i(44048),i(67932),i(91232),i(24296),i(22080),i(819)),J=(i(77048),i(53648),i(95247),i(18648)),Y=(i(9770),i(57404));class X extends d.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.yE}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,p.Sc)(e.toJSON());return(0,w.I)(t,w.Y.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=p.or.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=p.or.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=p.or.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=p.or.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._layer instanceof E.default?(this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.types=null,this.typeIdField=null):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types,this.subtypeField=this._layer.subtypeField,this.subtypes=this._layer.subtypes)}_isInFeatureSet(){return p.kV.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new Q.c;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){const t=this._layer?.capabilities?.query;return!e.outStatistics&&!0===t?.supportsFormatPBF&&!0===t?.supportsQuantizationEditMode}async queryPBF(e){return e.quantizationParameters={mode:"edit"},(await async function(e,t,s,r){return async function(e,t,s,r){const n=s?.infoFor3D;if(!Z(e,n)||null==n||!t.assetMaps||!t.features?.length)return V.c.fromJSON(t);const{meshFeatureSetFromJSON:a}=await(0,j.Yv)(Promise.all([i.e(8624),i.e(3180),i.e(7424),i.e(9780),i.e(456)]).then(i.bind(i,12784)),r);return a(e,n,t)}(t,await async function(e,t,i,s){const r={...s},n=function(e,t){let i=Q.c.from(e);i.sourceSpatialReference=i.sourceSpatialReference??t?.sourceSpatialReference??null,(t?.gdbVersion||t?.dynamicDataSource)&&(i=i===e?i.clone():i,i.gdbVersion=e.gdbVersion||t.gdbVersion,i.dynamicDataSource=e.dynamicDataSource?B.U.from(e.dynamicDataSource):t.dynamicDataSource);const s=t?.infoFor3D;if(null!=s&&Z(e,s)){i=i===e?i.clone():i,i.formatOf3DObjects=null;const{supportedFormats:t,queryFormats:r}=s,n=(0,U.me)("model/gltf-binary",t)??(0,U.If)("glb",t),a=(0,U.me)("model/gltf+json",t)??(0,U.If)("gtlf",t);for(const e of r){if(e===n){i.formatOf3DObjects=e;break}e!==a||i.formatOf3DObjects||(i.formatOf3DObjects=e)}if(!i.formatOf3DObjects)throw new q.c("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(null==i.outFields||!i.outFields.includes("*")){i=i===e?i.clone():i,null==i.outFields&&(i.outFields=[]);const{originX:t,originY:r,originZ:n,translationX:a,translationY:l,translationZ:o,scaleX:u,scaleY:c,scaleZ:d,rotationX:h,rotationY:f,rotationZ:p,rotationDeg:y}=s.transformFieldRoles;i.outFields.push(t,r,n,a,l,o,u,c,d,h,f,p,y)}}return i}(t,i),a=null!=t.outStatistics?.[0],l=(0,G.c)("featurelayer-pbf-statistics"),o=!a||l;let u;if("pbf"===i?.format&&o)try{u=await(0,W.S)(e,n,r)}catch(e){if("query:parsing-pbf"!==e.name)throw e;i.format="json"}return"json"!==i?.format&&o||(u=await(0,M.E)(e,n,r)),function(e,t){if(null!=e&&null!=t)for(const i of t){const t=e.get(i.name);t&&Object.assign(i,t.toJSON())}}(i?.fieldsIndex,u.fields),u}(e,t,s,r),s,r)}(this._layer.parsedUrl,e,{format:"pbf"},{})).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){e.returnZ=this.hasZ,e.returnM=this.hasM;const i="execute"===t?M.c:"executeForCount"===t?z._:K.g,s="execute"===t&&this.pbfSupportedForQuery(e);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(t,r),r=r.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),r}async _getFilteredSet(e,t,i,s,r){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new h.c([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new Q.c;this.datesInUnknownTimezone&&(o.timeReferenceUnknownClient=!0),o.where=null===i?null===t?"1=1":"":(0,y.gj)(i,n),this._requestStandardised&&(o.sqlFormat="standard"),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(r),new h.c([],u,l,null)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=s.constructClause(),a=!0);const l=await this.databaseType();let o=null===i?null===t?"1=1":"":(0,y.gj)(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(o=""!==o?"(("+this._layer.definitionExpression+") AND ("+o+"))":this._layer.definitionExpression);let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);let d=null;if(!0===this._pageJustIds)d=new h.c([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const s=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new h.c([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:s.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,r),d}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=new Q.c;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=e.pagesDefinition.where,a.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[r+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFeatures(e,t,i,s){const r=[];if(-1!==t&&void 0===this._featureCache[t]&&r.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,s),this._getFeatures(e,t,i,s);let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[s]]){let i=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[s]]){const r=t._featureMap[e._known[s]];null!==r&&(i=!0,this._featureCache[e._known[s]]=r)}}if(!1===i&&(e._known[s]!==t&&r.push(e._known[s]),r.length>=this._maxProcessingRate()-1))break}if(n>=i&&0===r.length)break}if(0===r.length)return"success";const a=new Q.c;this._requestStandardised&&(a.sqlFormat="standard"),this.datesInUnknownTimezone&&(a.timeReferenceUnknownClient=!0),a.objectIds=r,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(s),void 0!==l.error)throw new c.SD(c.aG.RequestFailed,{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,s,r,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let d=i.parseTree.column;const h=this._layer.fields??[];for(let e=0;e<h.length;e++)if(h[e].name.toLowerCase()===d.toLowerCase()){d=h[e].name;break}const f=new Q.c;this._requestStandardised&&(f.sqlFormat="standard"),this.datesInUnknownTimezone&&(f.timeReferenceUnknownClient=!0);let p=null===n?null===r?"1=1":"":(0,y.gj)(n,u);this._layer.definitionExpression&&this._useDefinitionExpression&&(p=""!==p?"(("+this._layer.definitionExpression+") AND ("+p+"))":this._layer.definitionExpression),f.where=p,f.spatialRelationship=this._makeRelationshipEnum(s),f.relationParameter=this._makeRelationshipParam(s),f.geometry=null===r?null:r,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[d];const _=await this.executeQuery(f,"execute");if(this._checkCancelled(o),!_.hasOwnProperty("features"))throw new c.SD(c.aG.InvalidStatResponse);let g=!1;for(let e=0;e<h.length;e++)if(h[e].name===d){"date"===h[e].type&&(g=!0);break}for(let e=0;e<_.features.length;e++){if(g){const t=_.features[e].attributes[d];null!==t?l.push(new Date(t)):l.push(t)}else l.push(_.features[e].attributes[d]);if(l.length>=a)break}return 0===_.features.length?l:_.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+_.features.length,t,i,s,r,n,a,l,o)}:l}async _distinctStat(e,t,i,s,r,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,s,r,n,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,i,s){const r=await this.databaseType(),n=new Q.c;if(this._requestStandardised&&(n.sqlFormat="standard"),this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};let a=null===s?null===i?"1=1":"":(0,y.gj)(s,r);return this._layer.definitionExpression&&this._useDefinitionExpression&&(a=""!==a?"(("+this._layer.definitionExpression+") AND ("+a+"))":this._layer.definitionExpression),n.where=a,this.datesInUnknownTimezone&&(n.timeReferenceUnknownClient=!0),n.where=a,n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===i?null:i,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,i,s,r,n,a){await this._ensureLoaded();const l=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression,o=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics,u=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsDistinct;if("count"===e)return u?this._countstat(e,i,s,r):{calculated:!1};if(!1===o||!1===(0,y.ct)(t)&&!1===l||!1===t.isStandardized)return""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===u?""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,i,s,r,n,a);const d=await this.databaseType();if(this.isTable()&&s&&null!==i&&""!==i)return{calculated:!0,result:null};const h=new Q.c;this._requestStandardised&&(h.sqlFormat="standard");let f=null===r?null===s?"1=1":"":(0,y.gj)(r,d);this._layer.definitionExpression&&this._useDefinitionExpression&&(f=""!==f?"(("+this._layer.definitionExpression+") AND ("+f+"))":this._layer.definitionExpression),h.where=f,h.spatialRelationship=this._makeRelationshipEnum(i),h.relationParameter=this._makeRelationshipParam(i),h.geometry=null===s?null:s,this.datesInUnknownTimezone&&(h.timeReferenceUnknownClient=!0);const p=new Y.c;p.statisticType=(0,_.AJ)(e),p.onStatisticField=(0,y.gj)(t,d),p.outStatisticFieldName="ARCADE_STAT_RESULT",h.returnGeometry=!1;let g="ARCADE_STAT_RESULT";h.outStatistics=[p];const m=await this.executeQuery(h,"execute");if(!m.hasOwnProperty("features")||0===m.features.length)throw new c.SD(c.aG.InvalidStatResponse);let w=!1;const F=m.fields??[];for(let e=0;e<F.length;e++)if("ARCADE_STAT_RESULT"===F[e].name.toUpperCase()){g=F[e].name,"date"===F[e].type&&(w=!0);break}if(w){let e=m.features[0].attributes[g];return null!==e&&(e=new Date(m.features[0].attributes[g])),{calculated:!0,result:e}}return{calculated:!0,result:m.features[0].attributes[g]}}_stat(e,t,i,s,r,n,a){return this._stats(e,t,i,s,r,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const s=this._layer.capabilities?.query,r=!0===s?.supportsSqlExpression;if(null!=s&&!0===s.supportsStatistics&&!0===s.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,y.ct)(t[e].workingexpr)&&!1===r)&&(i=!1);return!1!==i}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,c=!1;null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=n.constructClause(),c=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(c=!1,u=!0,o=this._layer.objectIdField);const d=[];for(let e=0;e<t.length;e++){const i=new Y.c;i.onStatisticField=null!==t[e].workingexpr?(0,y.gj)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),d.push(i)}""===o&&(o=e.join(","));let f=this._maxQueryRate();const p=this._layer.capabilities?.query.maxRecordCount;null!=p&&p<f&&(f=p);let _=null===r?null===s?"1=1":"":(0,y.gj)(r,l);return this._layer.definitionExpression&&this._useDefinitionExpression&&(_=""!==_?"(("+this._layer.definitionExpression+") AND ("+_+"))":this._layer.definitionExpression),new h.c([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:u,generatedOid:a,resultRecordCount:f,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===s?null:s,where:_,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,i){let s=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(s=""!==s?"("+s+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const r=e.pagesDefinition.internal.lastRetrieved,n=r,a=e.pagesDefinition.internal.lastPage,o=new Q.c;if(this._requestStandardised&&(o.sqlFormat="standard"),o.where=s,o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,this.datesInUnknownTimezone&&(o.timeReferenceUnknownClient=!0),o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new c.SD(c.aG.InvalidStatResponse);const d=[];if(e.pagesDefinition.internal.lastPage!==a)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[n+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)d.push(new l.c({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,d}static create(e,t,i,s,r){const n=new O.default({url:e,outFields:null===t?["*"]:t});return new X({layer:n,spatialReference:i,lrucache:s,interceptor:r})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,p.mY)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,s,r){const n=this._layer.capabilities;if(n?.data.supportsAttachment&&n?.operations.supportsQueryAttachments){const n={objectIds:[e],returnMetadata:r};(t&&t>0||i&&i>0)&&(n.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(n.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:n,method:"attachments"});const a=await this._layer.queryAttachments(n),l=[];return a&&a[e]&&a[e].forEach((t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let s=null;r&&t.exifInfo&&(s=P.c.convertJsonToArcade(t.exifInfo,"system",!0)),l.push(new N.c(t.id,t.name,t.contentType,t.size,i,s,t.keywords??null))})),l}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields?.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,A.um)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,s.c)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const i=t.spatialReference;for(const s of t.relatedRecordGroups){const r=s.objectId,n=[];for(const e of s.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.c({geometry:e.geometry?(0,L.h4)(e.geometry):null,attributes:e.attributes});n.push(t)}e[r]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new c.SD(c.aG.InvalidRequest)}async getFeatureByObjectId(e,t){const i=new Q.c;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.datesInUnknownTimezone&&(i.timeReferenceUnknownClient=!0),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await(0,M.c)(this._layer.parsedUrl.path,i);return 1===s.features.length?s.features[0]:null}async getIdentityUser(){await this.load();const e=x.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=x.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const e=await(0,s.c)(t,{query:{f:"json"}});let i="";return e.data?.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new X({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,{parsedUrl:{path:t},serviceItemId:i=null}=this._layer;if(t){const r=await(0,s.c)(t,{responseType:"json",query:{f:"json"}});e=r?.data?.name??null,i=r?.data?.serviceItemId??null}const r=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===i?null:i,serviceLayerUrl:""===t?null:t,webMapLayerId:r?this._layer.id??null:null,webMapLayerTitle:r?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var H=i(60140);class $ extends d.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return p.yE}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer?.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),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return p.kV.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new l.c({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new h.c([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new h.c([],[],!0,null);if(n.capabilities?.queryRelated&&n.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&n.capabilities?.queryRelated&&!0===n.capabilities.queryRelated.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new J.default;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),o.returnGeometry=c,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null;const d=await n.source.queryRelatedFeatures(o);this._checkCancelled(r);const f=d[this._findObjectId]?d[this._findObjectId].features:[],p=[];for(let e=0;e<f.length;e++)this._featureCache[f[e].attributes[this._relatedLayer.objectIdField]]=f[e],p.push(f[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=i;return new h.c(y||_?p:[],y||_?[]:p,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==s&&l?.capabilities?.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,d=null!=i;let f=null,p=!0;!0===this._removeGeometry&&(p=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return f=new h.c(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:p,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(f,o,0,0,r),f}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new J.default;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await a.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[r+t]=u[t].attributes[this._relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this._relatedLayer.objectIdField]]=u[e];const c=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&c&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,s){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let a=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[s]&&void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>i)))&&!(a>=i&&0===r.length);s++);if(0===r.length)return"success";throw new c.SD(c.aG.MissingFeatures)}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,r,n,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,r){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,r){return this._relatedLayer.queryAttachments(e,t,i,s,r)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var ee=i(57372),te=i(9764);function ie(){null===ee.c.applicationCache&&(ee.c.applicationCache=new ee.c)}async function se(e,t){if(ee.c.applicationCache){const i=ee.c.applicationCache.getLayerInfo(e);if(i){const s=await i;return new O.default({url:e,outFields:t,sourceJSON:s})}const s=new O.default({url:e,outFields:t}),r=(async()=>(await s.load(),s.sourceJSON))();if(ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(e,r);try{return await r,s}catch(t){throw ee.c.applicationCache.clearLayerInfo(e),t}}return await r,s}return new O.default({url:e,outFields:t})}async function re(e,t,i,s,r,n=null){return ne(await se(e,["*"]),t,i,s,r,n)}function ne(e,t=null,i=null,s=!0,r=null,a=null){if(e instanceof O.default||(0,n.a0)(e)){const n={layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:a};return 1==!(e.url||!e.source)?new H.c(n):new X(n)}const l=ne(e.parent,t,i,s,r,a);return l.filter(g.WhereClause.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),e.parent.fieldsIndex,l.dateFieldsTimeZoneDefaultUTC))}async function ae(e){if(null!==ee.c.applicationCache){const t=ee.c.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,s.c)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw ee.c.applicationCache.clearLayerInfo(e),t}}return t}async function le(e,t){const i={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},r=await ae(e);if(i.metadata=r,void 0!==r.controllerDatasetLayers?.utilityNetworkLayerId&&null!==r.controllerDatasetLayers.utilityNetworkLayerId){if(r.layers)for(const e of r.layers)i.layerNameLkp[e.id]=e.name;if(r.tables)for(const e of r.tables)i.layerNameLkp[e.id]=e.name;const n=r.controllerDatasetLayers.utilityNetworkLayerId;i.networkId=n;const a=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==ee.c.applicationCache){const e=ee.c.applicationCache.getLayerInfo(i);if(null!==e)return e}const r=(async()=>{const i=await(0,s.c)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new c.SD(c.aG.DataElementsNotFound)})();if(null!==ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(i,r);try{return await r}catch(e){throw ee.c.applicationCache.clearLayerInfo(i),e}}return r}(e,n);if(a){i.queryelem=a,i.queryelem?.dataElement&&void 0!==i.queryelem.dataElement.schemaGeneration&&(i.unVersion=i.queryelem.dataElement.schemaGeneration),i.lkp={},i.queryelem.dataElement.domainNetworks||(i.queryelem.dataElement.domainNetworks=[]);for(const e of i.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]??null};e.className&&(i.lkp[e.className]=e)}}if(i.queryelem.dataElement.terminalConfigurations)for(const e of i.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)i.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const r=await async function(e){if(null!==ee.c.applicationCache){const t=ee.c.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,s.c)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==ee.c.applicationCache){ee.c.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw ee.c.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+n);if(void 0!==r.systemLayers?.associationsTableId&&null!==r.systemLayers.associationsTableId){const s=[];i.unVersion>=4&&(s.push("STATUS"),s.push("PERCENTALONG"));let n=await re(e+"/"+r.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...s],!1,null,null);return await n.load(),i.unVersion>=4&&(n=n.filter(g.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",n.getFieldsIndex(),n.dateFieldsTimeZoneDefaultUTC)),await n.load()),{lkp:i.lkp,associations:n,unVersion:i.unVersion,terminals:i.terminals}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}async function oe(e,t,i,s=null,r=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await re(o,s,r,n,a,l);return new $({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:s,outFields:r,includeGeometry:n,lrucache:a,interceptor:l})}a.c.registerAction(),D.registerAction(),u.c.registerAction(),k.c.registerAction(),R.c.registerAction();class ue extends r.c{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=ne(e,this._overridespref,null===i?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>{if(t instanceof O.default){if(t.title===e)return!0}else if((0,n.a0)(t)&&t.title===e)return!0;return!1}));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>!!(t.title&&t.title===e||t.title&&t.title===e)));if(s){if(s instanceof O.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e=s.outFields?s:{...s,outFields:["*"]};s._materializedTable=new O.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}async featureSetById(e,t=!0,i=["*"]){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>{if(t instanceof O.default){if(t.id===e)return!0}else if((0,n.a0)(t)&&t.id===e)return!0;return!1}));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>t.id===e));if(s){if(s instanceof O.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e={...s,outFields:["*"]};s._materializedTable=new O.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}}class ce extends r.c{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=ne(e,this._overridespref,null===i?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await ae(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ce(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers??[])t.name===e&&(n=t);if(!n)for(const t of r.tables??[])t.name===e&&(n=t);if(n){const e=await se(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of r.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await se(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}}function de(e,t,i=null,s=null){return new ue(e,t,i,s)}function he(e,t,i=null,s=null){return new ce(e,t,i,s)}function fe(e,t,i,s,r){if(null===e)return null;if(e instanceof O.default){switch(t){case"datasource":return ne(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return ne(e,r,e.outFields,!0,i,s)}return null}if((0,n.a0)(e)){switch(t){case"datasource":return ne(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return ne(e,r,e.outFields,!0,i,s)}return null}if((0,n.a1)(e)){switch(t){case"datasource":return ne(e.parent,r,e.parent.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return ne(e,r,e.parent.outFields,!0,i,s)}return null}if(e instanceof d.c)switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}async function pe(e,t,i,s,r,n,a,l=null){if(ee.c.applicationCache){const o=ee.c.applicationCache.getLayerInfo(e+":"+n.url);if(o){const e=await o;return ne(new O.default({url:(0,p.mY)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}}const o=new te.default({id:e,portal:n}).load();ee.c.applicationCache&&ee.c.applicationCache.setLayerInfo(e+":"+n.url,o);try{const e=await o;return ne(new O.default({url:(0,p.mY)(e.url??"")+"/"+t,outFields:["*"]}),i,s,r,a,l)}catch(t){throw ee.c.applicationCache&&ee.c.applicationCache.clearLayerInfo(e+":"+n.url),t}}},35512:(e,t,i)=>{i.d(t,{A$:()=>m,MH:()=>y,_0:()=>_,eq:()=>g,kX:()=>p});var s=i(6444),r=i(98412),n=i(5245),a=i(38174),l=i(35772),o=i(74440),u=i(3048),c=i(70680),d=i(63220),h=i(56156);class f{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class p extends f{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class y extends f{constructor(e,t,i){super((0,o.qG)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,u.OK)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class _ extends f{constructor(e,t,i){super(e),this.codefield=t,this.lkp=i,this.reverseLkp={};for(const e in i)this.reverseLkp[i[e]]=e;this.sqlRewritable=!0}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,o.or.Standardised,this.field.name,this.codefield instanceof d.WhereClause?(0,u.gj)(this.codefield,o.or.Standardised):this.codefield,e.parameters);return i.includes(_.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:d.WhereClause.create(i,t._parent.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)}}evaluateNodeToWhereClause(e,t,i=null,s=null,r){let a,l,c,d;switch(e.type){case"interval":return(0,u.UV)(this.evaluateNodeToWhereClause(e.value,t,i,s,r),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,i,_.BADNESS,r));for(let n=0;n<e.clauses.length;n++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,i,_.BADNESS,r)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,i,_.BADNESS,r);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,_.BADNESS,r)),s+=" END ",s}case"parameter":{const i=r[e.value.toLowerCase()];if("string"==typeof i)return"'"+i.toString().replaceAll("'","''")+"'";if((0,o.It)(i))return(0,u.QT)(i,t);if((0,o.IL)(i))return(0,u.QT)(i,t);if((0,o.Yv)(i))return(0,u.ik)(i,t);if((0,o.uK)(i))return(0,u.Qb)(i,t);if((0,o.Qr)(i))return(0,u.Lp)(i,t);if(i instanceof Array){const e=[];for(let s=0;s<i.length;s++)"string"==typeof i[s]?e.push("'"+i[s].toString().replaceAll("'","''")+"'"):(0,o.It)(i[s])||(0,o.IL)(i[s])?e.push((0,u.QT)(i[s],t)):(0,o.Yv)(i[s])?e.push((0,u.ik)(i[s],t)):(0,o.uK)(i[s])?e.push((0,u.Qb)(i[s],t)):(0,o.Qr)(i[s])?e.push((0,u.Lp)(i[s],t)):e.push(i[s].toString());return e}return i.toString()}case"expression-list":l=[];for(const n of e.value)l.push(this.evaluateNodeToWhereClause(n,t,i,s,r));return l;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,_.BADNESS,r)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"IS":if("null"!==e.right.type)throw new n.oi(n.kP.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new n.oi(n.kP.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NOT NULL )";case"IN":if(a=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+n.join(",")+")) "}return a=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+a.join(",")+")) "}return d=this.evaluateNodeToWhereClause(e.right,t,i,s,r),d instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+d.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+d+")) ";case"NOT IN":if(a=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+n.join(",")+")) "}return a=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+a.join(",")+")) "}return d=this.evaluateNodeToWhereClause(e.right,t,i,s,r),d instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+d.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+d+")) ";case"BETWEEN":return c=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" BETWEEN "+c[0]+" AND "+c[1]+" ) ";case"NOTBETWEEN":return c=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" NOT BETWEEN "+c[0]+" AND "+c[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,r)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return(0,u.Yv)("date"===e.mode,t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"data-type":return e.value;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,i,_.BADNESS,r);return(0,u.I1)(e.name,s,t)}}throw new n.oi(n.kP.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof d.WhereClause?this.reverseLkp[d.WhereClause.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}_.BADNESS="_!!!_BAD_LKP_!!!!";class g extends f{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,u.OK)(e,this.field.name,(0,u.gj)(this._sql,o.or.Standardised),t.getFieldsIndex())}}extractValue(e){return d.WhereClause.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class m extends a.c{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="geoscene.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_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 h.c({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=o.cT.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),(0,c.EN)(t),this._wset=new l.c(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,n){const a=[];-1!==t&&void 0===this._featureCache[t]&&a.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,n),this._getFeatures(e,t,i,n);let u=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&a.push(e._known[s]),a.length>=o)));s++);if(0===a.length)return"success";e=new l.c([],a,e._ordered,null);const c=Math.min(a.length,i);await(this._parent?._getFeatures(e,-1,c,n)),this._checkCancelled(n);const d=[];for(let e=0;e<c;e++){const t=this._parent?._featureFromCache(a[e]);void 0!==t&&d.push({geometry:t.geometry,attributes:t.attributes,id:a[e]})}for(const e of d){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new s.c({attributes:t,geometry:(0,r.SW)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new n.SD(n.aG.NeverReach)}async _getFilteredSet(e,t,i,s,r){let n=!1;const a=this._reformulateWithoutAdaptions(i);n=a.cannot,i=a.where;let o=!1;if(null!==s){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof p)&&!0===s.scanForField(t.field.name)){if(!(t instanceof y)){s=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,u.Sy)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,i,s,r);let d;return this._checkCancelled(r),d=!0===n?new l.c(c._candidates.slice(0).concat(c._known.slice(0)),[],!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new l.c(c._candidates.slice(0),c._known.slice(0),!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),d}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,u.G_)(e,i.field.name)){const s=i.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,i,s,r,n,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(r),l=l||o.cannot,null!==(r=o.where)?null!==this._extraFilter&&(r=(0,u.Sy)(this._extraFilter,r)):r=this._extraFilter,!0===l)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,i,s,r,n,a);return!1===c.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,i,s,r){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const i of this.adaptedFields)if(e[t].toLowerCase()===i.field.name.toLowerCase()&&!(i instanceof p))return!1;const n=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)return!1;const t=i.clone();t.workingexpr=e.where,n.push(t)}else n.push(i)}const a=this._reformulateWithoutAdaptions(r);return!a.cannot&&(null!==(r=a.where)?null!==this._extraFilter&&(r=(0,u.Sy)(this._extraFilter,r)):r=this._extraFilter,this._parent._canDoAggregates(e,n,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,a,l){if(null===this._parent)throw new n.SD(n.aG.NeverReach);const o=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new n.SD(n.aG.NeverReach);const t=i.clone();t.workingexpr=e.where,o.push(t)}else o.push(i)}const c=this._reformulateWithoutAdaptions(r);if(c.cannot)throw new n.SD(n.aG.NeverReach);return null!==(r=c.where)?null!==this._extraFilter&&(r=(0,u.Sy)(this._extraFilter,r)):r=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,i,s,r,a,l)}}},74185:(e,t,i)=>{i.d(t,{c:()=>d});var s=i(5245),r=i(38174),n=i(35772),a=i(74440),l=i(3048),o=i(10860),u=i(63220),c=i(56156);class d extends r.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.WhereClause?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new c.c({wkid:4326}),this.geometryType=a.cT.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new n.c(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new n.c(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return t===a.kV.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?a.kV.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.eW)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const s=new n.c([],e,!1,null),r=Math.min(t,e.length);if(await(this._parent?._getFeatures(s,-1,r,i)),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<r;t++){const i=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=a.kV.InFeatureSet:this._idstates[e[t]]=a.kV.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<r;t++){const i=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===l[i]?this._idstates[e[i]]=a.kV.InFeatureSet:this._idstates[e[i]]=a.kV.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,i,s,r){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,l.Sy)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,s,r);let o;return this._checkCancelled(r),o=null!==this._whereClauseFunction?new n.c(a._candidates.slice(0).concat(a._known.slice(0)),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new n.c(a._candidates.slice(0),a._known.slice(0),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,i,s,r,n,a){if(null!==this._whereClauseFunction)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};let o=this._whereclause;null!==r&&null!==this._whereclause&&(o=(0,l.Sy)(this._whereclause,r));const u=await this._parent._stat(e,t,i,s,o,n,a);return!1===u.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,i,s,r){return null===this._whereClauseFunction&&(null!==r?null!==this._whereclause&&(r=(0,l.Sy)(this._whereclause,r)):r=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,o){if(null===this._parent)throw new s.SD(s.aG.NeverReach);return null!==n?null!==this._whereclause&&(n=(0,l.Sy)(this._whereclause,n)):n=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,o)}static registerAction(){r.c._featuresetFunctions.filter=function(e){if("function"==typeof e)return new d({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.WhereClause&&(t=e),new d({parentfeatureset:this,whereclause:t})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},28136:(e,t,i)=>{i.d(t,{c:()=>o});var s=i(96680),r=i(5245),n=i(38174),a=i(35772),l=i(81812);class o extends n.c{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="geoscene.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const i=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(i);const s=new a.c([],[],!0,null);for(let e=0;e<i.length;e++)s._known.push(i[e].id);return s}async getIdColumnDictionary(e,t,i,r){if(i<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,s.a2)(this._parent._expandPagedSet(e,n,0,0,r)),this.getIdColumnDictionary(e,t,i,r);let a=i+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;i+=l.length;const o=await(0,s.a2)(this._parent._getFeatureBatch(l,r));this._checkCancelled(r);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,r)}return e._candidates.length>0?(await(0,s.a2)(this._refineSetBlock(e,this._maxProcessingRate(),r)),this._checkCancelled(r),this.getIdColumnDictionary(e,t,i,r)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new r.SD(r.aG.NeverReach)}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,i,null===s?this._orderbyclause:s,r);this._checkCancelled(r);const l=new a.c(n._candidates.slice(0),n._known.slice(0),n._ordered,this._clonePageDefinition(n.pagesDefinition));let o=!0;if(n._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,r);return!1===o&&(null===t&&null===i||(e=new a.c(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){n.c._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.c(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},96100:(e,t,i)=>{i.d(t,{c:()=>l});var s=i(5245),r=i(38174),n=i(35772),a=i(74440);class l extends r.c{constructor(e){super(e),this._topnum=0,this.declaredClass="geoscene.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new n.c(t._candidates.slice(0),t._known.slice(0),!1,this._clonePageDefinition(t.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(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===a.kV.NotInFeatureSet)return t;const i=this._idstates[e];return i===a.kV.InFeatureSet||i===a.kV.NotInFeatureSet?i:t===a.kV.InFeatureSet&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=a.kV.InFeatureSet,this._countedin++,a.kV.InFeatureSet):(this._idstates[e]=a.kV.NotInFeatureSet,a.kV.NotInFeatureSet):a.kV.Unknown}async _expandPagedSet(e,t,i,r,n){if(null===this._parent)throw new s.SD(s.aG.NotImplemented);if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const a=await this._parent._expandPagedSet(e,t,i,r,n);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),a}async _getFeatures(e,t,i,s){const r=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,s),this._getFeatures(e,t,i,s);-1!==t&&void 0===this._featureCache[t]&&r.push(t);let l=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>a)));s++);if(0===r.length)return"success";const o=new n.c([],r,!1,null),u=Math.min(r.length,i);await this._parent._getFeatures(o,-1,u,s);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(r[e]);void 0!==t&&(this._featureCache[r[e]]=t)}return"success"}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const a=await this._getSet(r);return new n.c(a._candidates.slice(0).concat(a._known.slice(0)),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,s=null;const r=[];for(let n=0;n<e._candidates.length;n++){const l=this._isInFeatureSet(e._candidates[n]);if(l===a.kV.InFeatureSet){if(e._known.push(e._candidates[n]),i+=1,null===s?s={start:n,end:n}:s.end===n-1?s.end=n:(r.push(s),s={start:n,end:n}),e._known.length>=this._topnum)break}else if(l===a.kV.NotInFeatureSet)null===s?s={start:n,end:n}:s.end===n-1?s.end=n:(r.push(s),s={start:n,end:n}),i+=1;else if(l===a.kV.Unknown)break;if(i>=t)break}null!==s&&r.push(s);for(let t=r.length-1;t>=0;t--)e._candidates.splice(r[t].start,r[t].end-r[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){r.c._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},60140:(e,t,i)=>{i.d(t,{c:()=>y});var s=i(6444),r=i(5245),n=i(38174),a=i(35772),l=i(74440),o=i(3048),u=i(50853),c=i(672),d=i(8444),h=i(79648),f=i(600),p=i(95776);class y extends n.c{constructor(e){super(e),this.declaredClass="geoscene.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l.yE}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===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),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=l.or.Standardised,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this._layer instanceof d.default?(this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.types=null,this.typeIdField=null):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types,this.subtypeField=this._layer.subtypeField,this.subtypes=this._layer.subtypes)}isTable(){return this._forceIsTable||this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return l.kV.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new s.c({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){let n="",u=!1;if(null!==s&&(n=s.constructClause(),u=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.c([],[],!0,null);const c=new p.c;c.returnZ=this.hasZ,c.returnM=this.hasM,c.where=null===i?null===t?"1=1":"":(0,o.gj)(i,l.or.Standardised),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==n?n.split(","):null,c.geometry=null===t?null:t,c.returnGeometry=!0,c.relationParameter=this._makeRelationshipParam(e);const d=await this._layer.queryFeatures(c);if(null===d)return new a.c([],[],u,null);this._checkCancelled(r);const h=[];return d.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];h.push(t),this._featureCache[t]=this._changeFeature(e)})),new a.c([],h,u,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new p.c;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const i=t.attributes[this._layer.objectIdField];e.push(i),this._featureCache[i]=this._changeFeature(t)})),this._wset=new a.c([],e,!1,null),this._wset}e.returnZ=this.hasZ,e.returnM=this.hasM;const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];i.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new a.c([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);for(let r=e._lastFetchedIndex;r<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>i)));r++);if(0===s.length)return"success";throw new r.SD(r.aG.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField??"",r=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)r.push(h.c.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!i){let t=!1;for(const s of e.layerDefinition.fields)if("oid"===s.type||"esriFieldTypeOID"===s.type){i=s.name,t=!0;break}if(!1===t){let t="FID",s=!0,r=0;for(;s;){let i=!0;for(const s of e.layerDefinition.fields)if(s.name===t){i=!1;break}!0===i?s=!1:(r++,t="FID"+r.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let i=0;i<a.length;i++)n.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),n[i].attributes[t]=i;a=n,i=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof f.c?o.push(t):o.push(f.c.fromJSON(t));let d=n;switch(d||(d=""),d){case"esriGeometryPoint":d="point";break;case"esriGeometryPolyline":d="polyline";break;case"esriGeometryPolygon":d="polygon";break;case"esriGeometryEnvelope":d="extent";break;case"esriGeometryMultipoint":d="multipoint";break;case"":case"esriGeometryNull":d="esriGeometryNull"}if("esriGeometryNull"!==d)for(const e of a)e.geometry&&e.geometry instanceof u.c==0&&(e.geometry.type=d,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of a)e.geometry&&(e.geometry=null);const p={outFields:["*"],source:a,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:r,typeIdField:s,objectIdField:i,spatialReference:t},_="esriGeometryNull"===d||null===d;_||(p.geometryType=d);const g=new c.default(p);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&g.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new y({layer:g,spatialReference:t,isTable:_})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=new p.c;t.where=this.objectIdField+"="+e.toString(),t.returnZ=this.hasZ,t.returnM=this.hasM;const i=await this._layer.queryFeatures(t);return 1===i.features.length?i.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer?.datesInUnknownTimezone}get editFieldsInfo(){return this._layer?.editFieldsInfo}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}},81812:(e,t,i)=>{function s(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{c:()=>r});class r{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const i=t[e].match(/\S+/g);this._fields.push(i[0]),2===i.length?"asc"===i[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e.feature,this._fields[i],i),n=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?s(r,n):-1*s(r,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let i=0;i<this._fields.length;i++){0!==i&&(t+=",");let s=this._fields[i];for(const t of e)if(s.toLowerCase()===t.field.toLowerCase()){s=t.newfield;break}t+=s,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new r(t)}featureValue(e,t,i){const s=e.attributes[t];if(void 0!==s)return s;for(const s in e.attributes)if(t.toLowerCase()===s.toLowerCase())return this._fields[i]=s,e.attributes[s];return null}}},79648:(e,t,i)=>{i.d(t,{c:()=>f});var s=i(41948),r=i(3856),n=i(40504),a=i(1580),l=(i(9456),i(66360),i(72052),i(33600)),o=i(12552),u=i(18996),c=i(89812),d=i(87352);let h=class extends((0,r.q)(n.am)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const i of Object.keys(e))t[i]=(0,c.h4)(e[i]);return t}writeDomains(e,t){const i={};for(const t of Object.keys(e))e[t]&&(i[t]=e[t]?.toJSON());t.domains=i}};(0,s._)([(0,a.qq)({json:{write:!0}})],h.prototype,"id",void 0),(0,s._)([(0,a.qq)({json:{write:!0}})],h.prototype,"name",void 0),(0,s._)([(0,a.qq)({json:{write:!0}})],h.prototype,"domains",void 0),(0,s._)([(0,l.E)("domains")],h.prototype,"readDomains",null),(0,s._)([(0,u.G)("domains")],h.prototype,"writeDomains",null),(0,s._)([(0,a.qq)({type:[d.c],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,s._)([(0,o.c)("geoscene.layers.support.FeatureType")],h);const f=h},48212:(e,t,i)=>{i.d(t,{Ab:()=>w,Ej:()=>h,K0:()=>d,M9:()=>f,Wq:()=>y,YB:()=>c,_2:()=>g,oR:()=>_,q_:()=>p,wn:()=>m});var s=i(28176),r=i(91952);const n={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer"},a=Object.values(n),l=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),o=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function c(e){return!!l.test(e)}function d(e){if(null==e)return null;const t=(0,s.as)(e),i=t?.path.match(l)||t?.path.match(o);if(!i)return null;const[,r,a,u,c]=i,d=a.indexOf("/");return{title:f(-1!==d?a.slice(d+1):a),serverType:n[u.toLowerCase()],sublayer:null!=c&&""!==c?parseInt(c,10):null,url:{path:r}}}function h(e){const t=(0,s.as)(e).path.match(u);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function f(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function p(e,t){const i=[];if(e){const t=d(e);null!=t&&t.title&&i.push(t.title)}if(t){const e=f(t);i.push(e)}if(2===i.length){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function y(e){if(!e)return!1;const t=(e=e.toLowerCase()).includes(".Grcgis.cn/"),i=e.includes("//services")||e.includes("//tiles")||e.includes("//features");return t&&i}function _(e,t){return e?(0,s.ai)((0,s.kN)(e,t)):e}function g(e){let{url:t}=e;if(!t)return{url:t};t=(0,s.kN)(t,e.logger);const i=(0,s.as)(t),r=d(i.path);let n;if(null!=r)null!=r.sublayer&&null==e.layer.layerId&&(n=r.sublayer),t=r.url.path;else if(e.nonStandardUrlAllowed){const e=h(i.path);null!=e&&(t=e.serviceUrl,n=e.sublayerId)}return{url:(0,s.ai)(t),layerId:n}}function m(e,t,i,n,a){(0,r.w)(t,n,"url",a),n.url&&null!=e.layerId&&(n.url=(0,s.kn)(n.url,i,e.layerId.toString()))}function w(e){if(!e)return!1;const t=e.toLowerCase(),i=t.includes("/services/"),s=t.includes("/mapserver/wmsserver"),r=t.includes("/imageserver/wmsserver"),n=t.includes("/wmsserver");return i&&(s||r||n)}},4048:(e,t,i)=>{i.d(t,{If:()=>l,K0:()=>u,Mn:()=>p,kD:()=>n,me:()=>a,sz:()=>r,w$:()=>o});const s=[["binary","application/octet-stream","bin",""]];function r(e,t){return null!=d(t.name,e?.supportedFormats??[])}function n(e,t){if(!e)return!1;const i=u(t,e.supportedFormats??[]);return null!=i&&e.editFormats.includes(i)}function a(e,t){return h(function(e,t){const i=e.toLowerCase();return c(t).find((e=>f(e)===i))}(e,t))}function l(e,t){return h(d(e,t))}function o(e,t){return f(function(e,t){return c(t).find((t=>h(t)===e))}(e,t))}function u(e,t){return l(e.name,t)??a(e.type,t)}function c(e){return[...s,...e]}function d(e,t){const i=e.toLowerCase();return c(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>i.endsWith(e)))))}function h(e){return e?.[0]}function f(e){return e?.[1].toLowerCase()}function p(e){return e.tables?.find((e=>"assetMaps"===e.role))}},46940:(e,t,i)=>{i.d(t,{CI:()=>h,KI:()=>u,O2:()=>a,_S:()=>l,mU:()=>o,oj:()=>c,qk:()=>d});var s=i(60074),r=i(56156),n=i(29120);function a(e,t){if(!l(e,t)){const i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,d.HOSTED_SERVICE)}function u(e,t){const i=e.typeKeywords;if(i){const e=i.indexOf(t);e>-1&&i.splice(e,1)}}async function c(e){const t=e.clone().normalize();let i;if(t.length>1)for(const e of t)i?e.width>i.width&&(i=e):i=e;else i=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,n.aq)(e);const i=r.c.WGS84;return await(0,s.initializeProjection)(t,i),(0,s.project)(e,i)}(i)}const d={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"GeoScene API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table",HOSTED_SERVICE:"Hosted Service",LOCAL_SCENE:"ViewingMode-Local",TILED_IMAGERY:"Tiled Imagery",GROUP_LAYER_MAP:"Map"};function h(e){const{portal:t,isOrgItem:i,itemControl:s}=e,r=t.user?.privileges;let n=!r||r.includes("features:user:edit"),a=!!i&&!!r?.includes("features:user:fullEdit");const l="update"===s||"admin"===s;return l?a=n=!0:a&&(n=!0),{features:{edit:n,fullEdit:a},content:{updateItem:l}}}},46788:(e,t,i)=>{i.d(t,{_:()=>a});var s=i(21980),r=i(32848),n=i(95776);async function a(e,t,i){const a=(0,s.UX)(e);return(0,r.WE)(a,n.c.from(t),{...i}).then((e=>e.data.count))}},819:(e,t,i)=>{i.d(t,{g:()=>a});var s=i(21980),r=i(32848),n=i(95776);async function a(e,t,i){const a=(0,s.UX)(e);return(0,r.Qn)(a,n.c.from(t),{...i}).then((e=>e.data.objectIds))}},99944:(e,t,i)=>{i.d(t,{E:()=>o,c:()=>l});var s=i(21980),r=i(32848),n=i(59500),a=i(95776);async function l(e,t,i){const s=await o(e,t,i);return n.c.fromJSON(s)}async function o(e,t,i){const n=(0,s.UX)(e),l={...i},o=a.c.from(t),{data:u}=await(0,r.EL)(n,o,o.sourceSpatialReference,l);return u}},49132:(e,t,i)=>{i.d(t,{S:()=>_});var s=i(21980),r=i(70680),n=i(37924),a=i(97088);function l(e,t){return t}function o(e,t,i,s){switch(i){case 0:return h(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?h(e,t+s,1):function({translate:e,scale:t},i,s){return e[s]-i*t[s]}(e,t+s,1)}}function u(e,t,i,s){return 2===i?h(e,t,2):o(e,t,i,s)}function c(e,t,i,s){return 2===i?0===t?0:h(e,t,3):o(e,t,i,s)}function d(e,t,i,s){return 3===i?0===t?0:h(e,t,3):u(e,t,i,s)}function h({translate:e,scale:t},i,s){return e[s]+i*t[s]}class f{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=l,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=(0,n.O)(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=t)for(const i of e.features)t(i.geometry)}createSpatialReference(){return{}}addField(e,t){const i=e.fields;(0,r.EN)(i),i.push(t);const s=i.map((e=>e.name));this._attributesConstructor=function(){for(const e of s)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,i)=>this.addCoordinatePoint(e,t,i),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,i)=>this._addCoordinatePolygon(e,t,i),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,i)=>this._addCoordinatePolyline(e,t,i),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,i)=>this._addCoordinateMultipoint(e,t,i),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,i){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:i,queryGeometryType:s}=t,r=(0,a.Ij)(i.clone(),i,!1,!1,this._transform),n=(0,a.qw)(r,s,!1,!1);e.queryGeometryType=s,e.queryGeometry={...n}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,i){const s=this._transform;switch(t=this._applyTransform(s,t,i,0),i){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let i=0;t<=1&&(i=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(s,e,t,i):0}_addCoordinatePolyline(e,t,i){this._dehydratedAddPointsCoordinate(e.paths,t,i)}_addCoordinatePolygon(e,t,i){this._dehydratedAddPointsCoordinate(e.rings,t,i)}_addCoordinateMultipoint(e,t,i){0===i&&e.points.push([]);const s=this._transformPathLikeValue(t,i);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,i){0===i&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,i),r=e[e.length-1];0===i&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),r.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:i}=e;return t&&i?d:t?u:i?c:o}}var p=i(32848),y=(i(59500),i(95776));async function _(e,t,i){const r=(0,s.UX)(e),n={...i},a=y.c.from(t),l=!a.quantizationParameters,{data:o}=await(0,p.aA)(r,a,new f({sourceSpatialReference:a.sourceSpatialReference,applyTransform:l}),n);return o}},21012:(e,t,i)=>{i.d(t,{M:()=>r});var s=i(37924);function r(e,t,i){if(!i?.features||!i.hasZ)return;const r=(0,s.O)(i.geometryType,t,e.outSpatialReference);if(null!=r)for(const e of i.features)r(e.geometry)}},31864:(e,t,i)=>{i.d(t,{c:()=>d});var s,r=i(41948),n=i(40504),a=i(1580),l=i(53368),o=(i(72052),i(9456),i(12552));const u={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let c=s=class extends n.am{constructor(e){super(e),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:e}=this,t=function(e){const{exifInfo:t,exifName:i,tagName:s}=e;if(!t||!i||!s)return null;const r=t.find((e=>e.name===i));return r?function(e){const{tagName:t,tags:i}=e;if(!i||!t)return null;const s=i.find((e=>e.name===t));return s?.value||null}({tagName:s,tags:r.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:e});return u[t]||null}clone(){return new s({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,r._)([(0,a.qq)({type:String})],c.prototype,"contentType",void 0),(0,r._)([(0,a.qq)()],c.prototype,"exifInfo",void 0),(0,r._)([(0,a.qq)({readOnly:!0})],c.prototype,"orientationInfo",null),(0,r._)([(0,a.qq)({type:l.Ab})],c.prototype,"id",void 0),(0,r._)([(0,a.qq)({type:String})],c.prototype,"globalId",void 0),(0,r._)([(0,a.qq)({type:String})],c.prototype,"keywords",void 0),(0,r._)([(0,a.qq)({type:String})],c.prototype,"name",void 0),(0,r._)([(0,a.qq)({json:{read:!1}})],c.prototype,"parentGlobalId",void 0),(0,r._)([(0,a.qq)({json:{read:!1}})],c.prototype,"parentObjectId",void 0),(0,r._)([(0,a.qq)({type:l.Ab})],c.prototype,"size",void 0),(0,r._)([(0,a.qq)({json:{read:!1}})],c.prototype,"url",void 0),c=s=(0,r._)([(0,o.c)("geoscene.layers.support.AttachmentInfo")],c);const d=c},59500:(e,t,i)=>{i.d(t,{c:()=>w});var s,r=i(41948),n=i(60708),a=i(6444),l=i(14628),o=i(40504),u=i(62088),c=i(1580),d=(i(9456),i(66360),i(33600)),h=i(12552),f=i(18996),p=i(56156),y=i(6704),_=i(600);const g=new l.O({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=s=class extends o.am{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const i=p.c.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const r=e[t],n=a.c.fromJSON(r),l=r.geometry?.spatialReference;null==n.geometry||l||(n.geometry.spatialReference=i);const o=r.aggregateGeometries,u=n.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],s=o[e],r=s?.spatialReference;null==t||r||(t.spatialReference=i)}s.push(n)}return s}writeGeometryType(e,t,i,s){if(e)return void g.write(e,t,i,s);const{features:r}=this;if(r)for(const e of r)if(null!=e?.geometry)return void g.write(e.geometry.type,t,i,s)}readQueryGeometry(e,t){if(!e)return null;const i=!!e.spatialReference,s=(0,y.h4)(e);return s&&!i&&t.spatialReference&&(s.spatialReference=p.c.fromJSON(t.spatialReference)),s}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:i}=this;if(i)for(const e of i)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new s(this.cloneProperties())}cloneProperties(){return(0,u.ct)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let i=0;i<t.features.length;i++){const s=t.features[i];if(s.geometry){const t=e?.[i];s.geometry=t?.toJSON()||s.geometry}}return t}quantize(e){const{scale:[t,i],translate:[s,r]}=e,n=this.features,a=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-s)/t)),(e=>Math.round((r-e)/i)));for(let e=0,t=n.length;e<t;e++)a?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:i}=this;if(!i)return this;const{translate:[s,r],scale:[n,a]}=i;let l=null,o=null;if(this.hasZ&&null!=i?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=i;l=i=>i*t+e}if(this.hasM&&null!=i?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=i;o=i=>null==i?i:i*t+e}const u=this._getHydrationFunction(e,(e=>e*n+s),(e=>r-e*a),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}_quantizePoints(e,t,i){let s,r;const n=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=i(l[1]);e===s&&a===r||(n.push([e-s,a-r]),s=e,r=a)}else s=t(l[0]),r=i(l[1]),n.push([s,r])}return n.length>0?n:null}_getQuantizationFunction(e,t,i){return"point"===e?e=>(e.x=t(e.x),e.y=i(e.y),e):"polyline"===e||"polygon"===e?e=>{const s=(0,y.Cs)(e)?e.rings:e.paths,r=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],a=this._quantizePoints(n,t,i);a&&r.push(a)}return r.length>0?((0,y.Cs)(e)?e.rings=r:e.paths=r,e):null}:"multipoint"===e?e=>{const s=this._quantizePoints(e.points,t,i);return s&&s.length>0?(e.points=s,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,i,s,r){return"point"===e?e=>{e.x=t(e.x),e.y=i(e.y),s&&(e.z=s(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,y.Cs)(e)?e.rings:e.paths;let a,l;for(let e=0,s=n.length;e<s;e++){const s=n[e];for(let e=0,r=s.length;e<r;e++){const r=s[e];e>0?(a+=r[0],l+=r[1]):(a=r[0],l=r[1]),r[0]=t(a),r[1]=i(l)}}if(s&&r)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2]),i[3]=r(i[3])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=s(i[2])}}else if(r)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=i(e.ymin),e.xmax=t(e.xmax),e.ymax=i(e.ymax),s&&null!=e.zmax&&null!=e.zmin&&(e.zmax=s(e.zmax),e.zmin=s(e.zmin)),r&&null!=e.mmax&&null!=e.mmin&&(e.mmax=r(e.mmax),e.mmin=r(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let a,l;for(let e=0,s=n.length;e<s;e++){const s=n[e];e>0?(a+=s[0],l+=s[1]):(a=s[0],l=s[1]),s[0]=t(a),s[1]=i(l)}if(s&&r)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2]),t[3]=r(t[3])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}else if(r)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=r(t[2])}}:null}};(0,r._)([(0,c.qq)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,r._)([(0,c.qq)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,r._)([(0,c.qq)({type:[a.c],json:{write:!0}})],m.prototype,"features",void 0),(0,r._)([(0,d.E)("features")],m.prototype,"readFeatures",null),(0,r._)([(0,c.qq)({type:[_.c],json:{write:!0}})],m.prototype,"fields",void 0),(0,r._)([(0,c.qq)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,r._)([(0,f.G)("geometryType")],m.prototype,"writeGeometryType",null),(0,r._)([(0,c.qq)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,r._)([(0,c.qq)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,r._)([(0,c.qq)({types:n.Su,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,r._)([(0,d.E)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,r._)([(0,c.qq)({type:p.c,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,r._)([(0,f.G)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,r._)([(0,c.qq)({json:{write:!0}})],m.prototype,"transform",void 0),m=s=(0,r._)([(0,h.c)("geoscene.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0;const w=m}}]);
|