UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines • 23.5 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8072],{38961:(e,t,r)=>{r.d(t,{A:()=>p});var s=r(90237),i=r(5503),l=r(36708),o=r(10107),n=r(40608),a=r(80559);let u=class extends i.A{constructor(e){super(e),this.getCollections=null}initialize(){this.addHandles((0,a.fm)((()=>this._refresh()),l.OH))}destroy(){this.getCollections=null}_refresh(){const e=null!=this.getCollections?this.getCollections():null;if(null==e)return void this.removeAll();let t=0;for(const r of e)null!=r&&(t=this._processCollection(t,r));this.splice(t,this.length)}_createNewInstance(e){return new i.A(e)}_processCollection(e,t){if(!t)return e;const r=this.itemFilterFunction??(e=>!!e);for(const s of t)if(s){if(r(s)){const t=this.indexOf(s,e);t>=0?t!==e&&this.reorder(s,e):this.add(s,e),++e}if(this.getChildrenFunction){const t=this.getChildrenFunction(s);if(Array.isArray(t))for(const r of t)e=this._processCollection(e,r);else e=this._processCollection(e,t)}}return e}};(0,s._)([(0,o.MZ)()],u.prototype,"getCollections",void 0),(0,s._)([(0,o.MZ)()],u.prototype,"getChildrenFunction",void 0),(0,s._)([(0,o.MZ)()],u.prototype,"itemFilterFunction",void 0),u=(0,s._)([(0,n.$)("esri.core.CollectionFlattener")],u);const p=u},79465:(e,t,r)=>{r.r(t),r.d(t,{default:()=>$});var s=r(90237),i=r(5503),l=r(38961),o=r(92071),n=r(74887),a=r(36708),u=r(84952),p=r(10107),y=(r(44208),r(53966),r(87811),r(36005)),h=r(40608),c=r(43937),d=r(5443),f=r(16930),m=r(4146),g=r(63074),v=r(16131),b=r(8303),_=r(54310),w=r(25036),M=r(10873),S=r(65529),P=r(25482),I=r(92474),x=r(799),F=r(56507),A=r(92602),Z=r(70333),R=(r(13874),r(78888)),E=r(4718),O=r(70328),G=r(537);r(65494),r(22671);const L={esriGeometryPoint:"points",esriGeometryPolyline:"polylines",esriGeometryPolygon:"polygons"};function k(e){const t=e.folders||[],r=t.slice(),s=new Map,i=new Map,l=new Map,o=new Map,n=new Map,a={esriGeometryPoint:i,esriGeometryPolyline:l,esriGeometryPolygon:o};(e.featureCollection?.layers||[]).forEach((e=>{const t=(0,E.o8)(e);t.featureSet.features=[];const r=e.featureSet.geometryType;s.set(r,t);const n=e.layerDefinition.objectIdField;"esriGeometryPoint"===r?H(i,n,e.featureSet.features):"esriGeometryPolyline"===r?H(l,n,e.featureSet.features):"esriGeometryPolygon"===r&&H(o,n,e.featureSet.features)})),e.groundOverlays&&e.groundOverlays.forEach((e=>{n.set(e.id,e)})),t.forEach((t=>{t.networkLinkIds.forEach((s=>{const i=function(e,t,r){const s=function(e,t){let r;return t.some((t=>t.id===e&&(r=t,!0))),r}(e,r);return s&&(s.parentFolderId=t,s.networkLink=s),s}(s,t.id,e.networkLinks);i&&r.push(i)}))})),r.forEach((e=>{if(e.featureInfos){e.points=(0,E.o8)(s.get("esriGeometryPoint")),e.polylines=(0,E.o8)(s.get("esriGeometryPolyline")),e.polygons=(0,E.o8)(s.get("esriGeometryPolygon")),e.mapImages=[];for(const t of e.featureInfos)switch(t.type){case"esriGeometryPoint":case"esriGeometryPolyline":case"esriGeometryPolygon":{const r=a[t.type].get(t.id);r&&e[L[t.type]]?.featureSet.features.push(r);break}case"GroundOverlay":{const r=n.get(t.id);r&&e.mapImages.push(r);break}}e.fullExtent=U([e])}}));const u=U(r);return{folders:t,sublayers:r,extent:u}}function C(e,t,r,s){const i=Z.id?.findCredential(e);e=(0,u.a6)(e,{token:i?.token});const l=A.A.kmlServiceUrl;return(0,R.A)(l,{query:{url:e,model:"simple",folders:"",refresh:0!==r||void 0,outSR:JSON.stringify(t)},responseType:"json",signal:s})}function T(e,t,r=null,s=[]){const i=[],l={},o=t.sublayers,n=new Set(t.folders.map((e=>e.id)));return o.forEach((t=>{const o=new e;if(r?o.read(t,r):o.read(t),s.length&&n.has(o.id)&&(o.visible=s.includes(o.id)),l[t.id]=o,null!=t.parentFolderId&&-1!==t.parentFolderId){const e=l[t.parentFolderId];e.sublayers||(e.sublayers=[]),e.sublayers?.unshift(o)}else i.unshift(o)})),i}function H(e,t,r){r.forEach((r=>{e.set(r.attributes[t],r)}))}function U(e){const t=(0,O.vt)(O.qv),r=(0,O.vt)(O.qv);for(const s of e){if(s.polygons?.featureSet?.features)for(const e of s.polygons.featureSet.features)(0,G.LJ)(t,e.geometry),(0,O.RF)(r,t);if(s.polylines?.featureSet?.features)for(const e of s.polylines.featureSet.features)(0,G.LJ)(t,e.geometry),(0,O.RF)(r,t);if(s.points?.featureSet?.features)for(const e of s.points.featureSet.features)(0,G.LJ)(t,e.geometry),(0,O.RF)(r,t);if(s.mapImages)for(const e of s.mapImages)(0,G.LJ)(t,e.extent),(0,O.RF)(r,t)}return(0,O.aI)(r,O.qv)?void 0:{xmin:r[0],ymin:r[1],zmin:r[2],xmax:r[3],ymax:r[4],zmax:r[5],spatialReference:f.A.WGS84}}var N;let j=N=class extends(S.A.EventedMixin(P.A.JSONSupportMixin(I.A))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([(0,a.on)((()=>this.sublayers),"after-add",(({item:e})=>{e.parent=this,e.layer=this.layer}),a.OH),(0,a.on)((()=>this.sublayers),"after-remove",(({item:e})=>{e.layer=e.parent=null}),a.OH),(0,a.wB)((()=>this.sublayers),((e,t)=>{if(t)for(const e of t)e.layer=e.parent=null;if(e)for(const t of e)t.parent=this,t.layer=this.layer}),a.OH),(0,a.wB)((()=>this.layer),(e=>{if(this.sublayers)for(const t of this.sublayers)t.layer=e}),a.OH)])}initialize(){(0,a.C_)((()=>this.networkLink)).then((()=>(0,a.C_)((()=>!0===this.visible)))).then((()=>this.load()))}load(e){if(!this.networkLink)return;if(this.networkLink.viewFormat)return;const t=null!=e?e.signal:null,r=this._fetchService(this._get("networkLink")?.href??"",t).then((e=>{const t=U(e.sublayers);this.fullExtent=d.A.fromJSON(t),this.sourceJSON=e;const r=(0,F.dp)(i.A.ofType(N),T(N,e));this.sublayers?this.sublayers.addMany(r):this.sublayers=r,this.layer?.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")}));return this.addResolvingPromise(r),Promise.resolve(this)}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}_fetchService(e,t){return C(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then((e=>k(e.data)))}};(0,s._)([(0,p.MZ)()],j.prototype,"description",void 0),(0,s._)([(0,p.MZ)({type:d.A})],j.prototype,"fullExtent",void 0),(0,s._)([(0,p.MZ)()],j.prototype,"id",void 0),(0,s._)([(0,p.MZ)({readOnly:!0,value:null})],j.prototype,"networkLink",void 0),(0,s._)([(0,p.MZ)({json:{write:{allowNull:!0}}})],j.prototype,"parent",void 0),(0,s._)([(0,p.MZ)({type:i.A.ofType(j),json:{write:{allowNull:!0}}})],j.prototype,"sublayers",void 0),(0,s._)([(0,p.MZ)({value:null,json:{read:{source:"name",reader:e=>(0,x._e)(e)}}})],j.prototype,"title",void 0),(0,s._)([(0,p.MZ)({value:!0})],j.prototype,"visible",null),(0,s._)([(0,y.w)("visible",["visibility"])],j.prototype,"readVisible",null),(0,s._)([(0,p.MZ)()],j.prototype,"sourceJSON",void 0),(0,s._)([(0,p.MZ)()],j.prototype,"layer",void 0),j=N=(0,s._)([(0,h.$)("esri.layers.support.KMLSublayer")],j);const q=j,J=["kml","xml"];let z=class extends((0,g.dM)((0,_.J)((0,w.j)((0,v.q)((0,b.A)((0,o.P)(m.A))))))){constructor(...e){super(...e),this._visibleFolders=[],this.allSublayers=new l.A({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.outSpatialReference=f.A.WGS84,this.path=null,this.legendEnabled=!1,this.operationalLayerType="KML",this.sublayers=null,this.type="kml",this.url=null}initialize(){this.addHandles([(0,a.wB)((()=>this.sublayers),((e,t)=>{t&&t.forEach((e=>{e.parent=null,e.layer=null})),e&&e.forEach((e=>{e.parent=this,e.layer=this}))}),a.OH),this.on("sublayer-update",(()=>this.notifyChange("fullExtent")))])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}readSublayersFromItemOrWebMap(e,t){this._visibleFolders=t.visibleFolders}readSublayers(e,t,r){return T(q,t,r,this._visibleFolders)}writeSublayers(e,t){const r=[],s=e.toArray();for(;s.length;){const e=s[0];e.networkLink||(e.visible&&r.push(e.id),e.sublayers&&s.push(...e.sublayers.toArray())),s.shift()}t.visibleFolders=r}get title(){const e=this._get("title");return e&&"defaults"!==this.originOf("title")?e:this.url?(0,u.e7)(this.url,J)||"KML":e}set title(e){this._set("title",e)}get visibleSublayers(){const e=this.sublayers,t=[],r=e=>{e.visible&&(t.push(e),e.sublayers&&e.sublayers.forEach(r))};return e&&e.forEach(r),t}get fullExtent(){return this._recomputeFullExtent()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["KML"],supportsData:!1},e).catch(n.QP).then((()=>this._fetchService(t)))),Promise.resolve(this)}destroy(){super.destroy(),this.allSublayers.destroy()}async _fetchService(e){const t=k((await Promise.resolve().then((()=>this.resourceInfo?{ssl:!1,data:this.resourceInfo}:C(this.url??"",this.outSpatialReference,this.refreshInterval,e)))).data);this.read(t,{origin:"service"})}_recomputeFullExtent(){let e=null;null!=this.extent&&(e=this.extent.clone());const t=r=>{if(r.sublayers)for(const s of r.sublayers.items)t(s),s.visible&&s.fullExtent&&(null!=e?e.union(s.fullExtent):e=s.fullExtent.clone())};return t(this),e}};(0,s._)([(0,p.MZ)({readOnly:!0})],z.prototype,"allSublayers",void 0),(0,s._)([(0,p.MZ)({type:f.A})],z.prototype,"outSpatialReference",void 0),(0,s._)([(0,p.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],z.prototype,"path",void 0),(0,s._)([(0,p.MZ)({readOnly:!0,json:{read:!1,write:!1}})],z.prototype,"legendEnabled",void 0),(0,s._)([(0,p.MZ)({type:["show","hide","hide-children"]})],z.prototype,"listMode",void 0),(0,s._)([(0,p.MZ)({type:["KML"]})],z.prototype,"operationalLayerType",void 0),(0,s._)([(0,p.MZ)({})],z.prototype,"resourceInfo",void 0),(0,s._)([(0,p.MZ)({type:i.A.ofType(q),json:{write:{ignoreOrigin:!0}}})],z.prototype,"sublayers",void 0),(0,s._)([(0,y.w)(["web-map","portal-item"],"sublayers",["visibleFolders"])],z.prototype,"readSublayersFromItemOrWebMap",null),(0,s._)([(0,y.w)("service","sublayers",["sublayers"])],z.prototype,"readSublayers",null),(0,s._)([(0,c.K)("sublayers")],z.prototype,"writeSublayers",null),(0,s._)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),(0,s._)([(0,p.MZ)({json:{origins:{"web-map":{read:{source:"title"}}},write:{ignoreOrigin:!0}}})],z.prototype,"title",null),(0,s._)([(0,p.MZ)(M.OZ)],z.prototype,"url",void 0),(0,s._)([(0,p.MZ)({readOnly:!0})],z.prototype,"visibleSublayers",null),(0,s._)([(0,p.MZ)({type:d.A})],z.prototype,"extent",void 0),(0,s._)([(0,p.MZ)()],z.prototype,"fullExtent",null),z=(0,s._)([(0,h.$)("esri.layers.KMLLayer")],z);const $=z},8303:(e,t,r)=>{r.d(t,{A:()=>M});var s=r(90237),i=r(92602),l=r(70333),o=r(78888),n=r(60999),a=r(49186),u=r(53966),p=r(97768),y=r(74887),h=r(84952),c=r(10107),d=(r(44208),r(87811),r(36005)),f=r(40608),m=r(43937),g=r(83531),v=r(20655),b=r(80812),_=r(41318),w=r(10407);const M=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,p.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new b.default({id:t.itemId,portal:r?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{const{load:s}=await r.e(1204).then(r.bind(r,41204));return(0,y.Te)(t),await s({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t)}catch(e){throw(0,y.zf)(e)||u.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,y.QP)(e),!0))))}async setUserPrivileges(e,t){if(!i.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:r,fullEdit:s},content:{updateItem:i}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",s),this._set("userHasUpdateItemPrivileges",i)}catch(e){(0,y.QP)(e)}}async _fetchUserPrivileges(e,t){let r=this.portalItem;if(!e||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(t);const s=!l.id?.findCredential(this.url),i=e===r.id;if(i&&r.portal.user)return this._getUserPrivileges(r,s);let o,n;if(i)o=r.portal.url;else try{o=await(0,g.wI)(this.url,t)}catch(e){(0,y.QP)(e)}if(!o||!(0,h.b8)(o,r.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;n=await(l.id?.getCredential(`${o}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,y.QP)(e)}const a=!0,u=!1,p=!1;if(!n)return{features:{edit:a,fullEdit:u},content:{updateItem:p}};try{if(i?await r.reload():(r=new b.default({id:e,portal:{url:o}}),await r.load(t)),r.portal.user)return this._getUserPrivileges(r,s)}catch(e){(0,y.QP)(e)}return{features:{edit:a,fullEdit:u},content:{updateItem:p}}}_getUserPrivileges(e,t){const r=(0,w.It)(e);return t&&(r.features.edit=!0),r}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,y.QP)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?l.id?.findCredential(this.url):null;if(!t)return!0;const r=S.credential===t?S.user:await this._fetchEditingUser(e);return S.credential=t,S.user=r,null==r?.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const r=l.id?.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,i=v.A.getDefault();if(i&&i.loaded&&(0,h.S8)(i.restUrl)===(0,h.S8)(s))return i.user;const a=`${s}/community/self`,u=null!=e?e.signal:null,p=await(0,n.Ke)((0,o.A)(a,{authMode:"no-prompt",query:{f:"json"},signal:u}));return p.ok?_.A.fromJSON(p.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t?.portal,s=this.portalItem?.id&&(this.portalItem.portal||v.A.getDefault());return r&&s&&!(0,h.ut)(s.restUrl,r.restUrl)?(t.messages&&t.messages.push(new a.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,s._)([(0,c.MZ)({type:b.default})],t.prototype,"portalItem",null),(0,s._)([(0,d.w)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,s._)([(0,m.K)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,s._)([(0,c.MZ)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,s._)([(0,c.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,s._)([(0,c.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,s._)([(0,c.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,s._)([(0,f.$)("esri.layers.mixins.PortalLayer")],t),t},S={credential:null,user:null}},96576:(e,t,r)=>{r.d(t,{A:()=>c});var s,i=r(90237),l=r(4718),o=r(10107),n=(r(44208),r(53966),r(93223)),a=r(40608),u=r(92438),p=r(63988),y=r(49849);let h=s=class extends((0,p.h)(u.A)){constructor(e){super(e),this.description=null,this.label=null,this.symbol=null,this.type="simple"}async collectRequiredFields(e,t){await Promise.all([this.collectSymbolFields(e,t),this.collectVVRequiredFields(e,t)])}async collectSymbolFields(e,t){await Promise.all(this.symbols.map((r=>r.collectRequiredFields(e,t))))}getSymbol(e,t){return this.symbol}async getSymbolAsync(e,t){return this.symbol}get symbols(){return this.symbol?[this.symbol]:[]}getAttributeHash(){return this.visualVariables?.reduce(((e,t)=>e+t.getAttributeHash()),"")??""}getMeshHash(){return this.symbols.reduce(((e,t)=>e+JSON.stringify(t)),"")}get arcadeRequired(){return this.arcadeRequiredForVisualVariables}clone(){return new s({description:this.description,label:this.label,symbol:(0,l.o8)(this.symbol),visualVariables:(0,l.o8)(this.visualVariables),authoringInfo:(0,l.o8)(this.authoringInfo)})}};(0,i._)([(0,o.MZ)({type:String,json:{write:!0}})],h.prototype,"description",void 0),(0,i._)([(0,o.MZ)({type:String,json:{write:!0}})],h.prototype,"label",void 0),(0,i._)([(0,o.MZ)(y.Wp)],h.prototype,"symbol",void 0),(0,i._)([(0,n.e)({simple:"simple"})],h.prototype,"type",void 0),h=s=(0,i._)([(0,a.$)("esri.renderers.SimpleRenderer")],h);const c=h},65494:(e,t,r)=>{r.d(t,{L:()=>a,r:()=>o});var s=r(67076),i=r(90360),l=r(13112);function o(e,t){return a(e,null,t)}const n=(0,i.C)({types:l.Hg});function a(e,t,r){return e?e&&(e.styleName||e.styleUrl)&&"uniqueValue"!==e.type?(r?.messages&&r.messages.push(new s.A("renderer:unsupported","Only UniqueValueRenderer can be referenced from a web style, but found '"+e.type+"'",{definition:e,context:r})),null):n(e,t,r):null}},22671:(e,t,r)=>{r.d(t,{A:()=>b});var s,i=r(90237),l=r(52106),o=r(66552),n=r(25482),a=r(4718),u=r(10107),p=(r(44208),r(53966),r(36005)),y=r(40608),h=r(43937),c=r(16930),d=r(65864),f=r(50498),m=r(20437);const g=new o.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let v=s=class extends n.A{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,l.A)}writeGeometryType(e,t,r,s){if(e)return void g.write(e,t,r,s);const{features:i}=this;if(i)for(const e of i)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,s)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,s=(0,d.rS)(e);return s&&!r&&t.spatialReference&&(s.spatialReference=c.A.fromJSON(t.spatialReference)),s}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)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,a.o8)({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 r=0;r<t.features.length;r++){const s=t.features[r];if(s.geometry){const t=e?.[r];s.geometry=t?.toJSON()||s.geometry}}return t}quantize(e){const{scale:[t,r],translate:[s,i]}=e,l=this.features,o=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-s)/t)),(e=>Math.round((i-e)/r)));for(let e=0,t=l.length;e<t;e++)o?.(l[e].geometry)||(l.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[s,i],scale:[l,o]}=r;let n=null,a=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;n=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;a=r=>null==r?r:r*t+e}const u=this._getHydrationFunction(e,(e=>e*l+s),(e=>i-e*o),n,a);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){const s=c.A.fromJSON(t.spatialReference),i=[];for(let t=0;t<e.length;t++){const l=e[t],o=r.fromJSON(l),n=l.geometry?.spatialReference;null==o.geometry||n||(o.geometry.spatialReference=s);const a=l.aggregateGeometries,u=o.aggregateGeometries;if(a&&null!=u)for(const e in u){const t=u[e],r=a[e],i=r?.spatialReference;null==t||i||(t.spatialReference=s)}i.push(o)}return i}_quantizePoints(e,t,r){let s,i;const l=[];for(let o=0,n=e.length;o<n;o++){const n=e[o];if(o>0){const e=t(n[0]),o=r(n[1]);e===s&&o===i||(l.push([e-s,o-i]),s=e,i=o)}else s=t(n[0]),i=r(n[1]),l.push([s,i])}return l.length>0?l:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const s=(0,d.Bi)(e)?e.rings:e.paths,i=[];for(let e=0,l=s.length;e<l;e++){const l=s[e],o=this._quantizePoints(l,t,r);o&&i.push(o)}return i.length>0?((0,d.Bi)(e)?e.rings=i:e.paths=i,e):null}:"multipoint"===e?e=>{const s=this._quantizePoints(e.points,t,r);return s&&s.length>0?(e.points=s,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,s,i){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),s&&(e.z=s(e.z))}:"polyline"===e||"polygon"===e?e=>{const l=(0,d.Bi)(e)?e.rings:e.paths;let o,n;for(let e=0,s=l.length;e<s;e++){const s=l[e];for(let e=0,i=s.length;e<i;e++){const i=s[e];e>0?(o+=i[0],n+=i[1]):(o=i[0],n=i[1]),i[0]=t(o),i[1]=r(n)}}if(s&&i)for(let e=0,t=l.length;e<t;e++){const t=l[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=s(r[2]),r[3]=i(r[3])}}else if(s)for(let e=0,t=l.length;e<t;e++){const t=l[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=s(r[2])}}else if(i)for(let e=0,t=l.length;e<t;e++){const t=l[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),s&&null!=e.zmax&&null!=e.zmin&&(e.zmax=s(e.zmax),e.zmin=s(e.zmin)),i&&null!=e.mmax&&null!=e.mmin&&(e.mmax=i(e.mmax),e.mmin=i(e.mmin))}:"multipoint"===e?e=>{const l=e.points;let o,n;for(let e=0,s=l.length;e<s;e++){const s=l[e];e>0?(o+=s[0],n+=s[1]):(o=s[0],n=s[1]),s[0]=t(o),s[1]=r(n)}if(s&&i)for(let e=0,t=l.length;e<t;e++){const t=l[e];t[2]=s(t[2]),t[3]=i(t[3])}else if(s)for(let e=0,t=l.length;e<t;e++){const t=l[e];t[2]=s(t[2])}else if(i)for(let e=0,t=l.length;e<t;e++){const t=l[e];t[2]=i(t[2])}}:null}};(0,i._)([(0,u.MZ)({type:String,json:{write:!0}})],v.prototype,"displayFieldName",void 0),(0,i._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"exceededTransferLimit",void 0),(0,i._)([(0,u.MZ)({type:[l.A],json:{write:!0}})],v.prototype,"features",void 0),(0,i._)([(0,p.w)("features")],v.prototype,"readFeatures",null),(0,i._)([(0,u.MZ)({type:[m.A],json:{write:!0}})],v.prototype,"fields",void 0),(0,i._)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],v.prototype,"geometryType",void 0),(0,i._)([(0,h.K)("geometryType")],v.prototype,"writeGeometryType",null),(0,i._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"hasM",void 0),(0,i._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"hasZ",void 0),(0,i._)([(0,u.MZ)({types:f.yR,json:{write:!0}})],v.prototype,"queryGeometry",void 0),(0,i._)([(0,p.w)("queryGeometry")],v.prototype,"readQueryGeometry",null),(0,i._)([(0,u.MZ)({type:c.A,json:{write:!0}})],v.prototype,"spatialReference",void 0),(0,i._)([(0,h.K)("spatialReference")],v.prototype,"writeSpatialReference",null),(0,i._)([(0,u.MZ)({json:{write:!0}})],v.prototype,"transform",void 0),v=s=(0,i._)([(0,y.$)("esri.rest.support.FeatureSet")],v),v.prototype.toJSON.isDefaultToJSON=!0;const b=v}}]);