@arcgis/core 4.25.0-next.20220708 → 4.25.0-next.20220711

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.
Files changed (51) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/40d9c753be00b81d9e79.js +1 -0
  3. package/assets/esri/core/workers/chunks/{8cdeccb6b67098d6a8d7.js → 54b01d2a4aba08d7e16b.js} +1 -1
  4. package/assets/esri/core/workers/chunks/5db5afec37f69c4acaaf.js +1 -0
  5. package/assets/esri/core/workers/chunks/63922dadaa642a959164.js +1 -0
  6. package/assets/esri/core/workers/chunks/{35d46e4eeb43c256a63b.js → 8d6fb50fff035f21878b.js} +1 -1
  7. package/assets/esri/core/workers/chunks/937eed1e51055f730270.js +1 -0
  8. package/assets/esri/core/workers/chunks/9b802fcf571c91347da4.js +1 -0
  9. package/assets/esri/core/workers/chunks/b02a43cf767d8ee13313.js +1 -0
  10. package/assets/esri/core/workers/chunks/ba6c6957830b3f0c4ec8.js +1 -0
  11. package/assets/esri/core/workers/chunks/fc6423ca92289c739e19.js +1 -0
  12. package/interfaces.d.ts +8395 -6016
  13. package/layers/BaseElevationLayer.js +1 -1
  14. package/layers/BaseTileLayer.js +1 -1
  15. package/layers/support/ElevationQuery.js +1 -1
  16. package/layers/support/ExportImageServiceParameters.js +1 -1
  17. package/layers/support/Sublayer.js +1 -1
  18. package/layers/support/TileInfo.js +1 -1
  19. package/layers/support/TileKey.js +5 -0
  20. package/layers/support/TilemapCache.js +1 -1
  21. package/package.json +1 -1
  22. package/renderers/DotDensityRenderer.js +1 -1
  23. package/support/revision.js +1 -1
  24. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  25. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  26. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  27. package/views/3d/terrain/TerrainSurface.js +1 -1
  28. package/views/DOMContainer.js +1 -1
  29. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  30. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  31. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
  32. package/views/interactive/snapping/snappingUtils.js +1 -1
  33. package/widgets/AreaMeasurement3D.js +1 -1
  34. package/widgets/Daylight.js +1 -1
  35. package/widgets/DirectLineMeasurement3D.js +1 -1
  36. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  37. package/widgets/ElevationProfile.js +1 -1
  38. package/widgets/Measurement.js +1 -1
  39. package/widgets/Popup.js +1 -1
  40. package/widgets/ShadowCast.js +1 -1
  41. package/widgets/Spinner.js +1 -1
  42. package/widgets/Weather.js +1 -1
  43. package/widgets/Widget.js +1 -1
  44. package/assets/esri/core/workers/chunks/009386ed70740f87a014.js +0 -1
  45. package/assets/esri/core/workers/chunks/1970d7a65832b70f7f5c.js +0 -1
  46. package/assets/esri/core/workers/chunks/4a364bc073fdc7c1b563.js +0 -1
  47. package/assets/esri/core/workers/chunks/4ca6ada7a4ccde5b5a24.js +0 -1
  48. package/assets/esri/core/workers/chunks/95451d6405729a9f50c7.js +0 -1
  49. package/assets/esri/core/workers/chunks/a9a459639c82c35ada1f.js +0 -1
  50. package/assets/esri/core/workers/chunks/beead2b06c994b4e61af.js +0 -1
  51. package/assets/esri/core/workers/chunks/ecaf8f030026e41e1d1a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Error.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{ZERO as i}from"../geometry/support/aaBoundingRect.js";import s from"./Layer.js";import p from"./support/TileInfo.js";import a from"../geometry/SpatialReference.js";import n from"../geometry/Extent.js";const l={id:"0/0/0",level:0,row:0,col:0,extent:null};let c=class extends s{constructor(){super(...arguments),this.tileInfo=p.create({spatialReference:a.WebMercator,size:256}),this.fullExtent=new n(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,a.WebMercator),this.spatialReference=a.WebMercator,this.type="base-elevation"}getTileBounds(e,t,r,o){const s=o||i;return l.level=e,l.row=t,l.col=r,l.extent=s,this.tileInfo.updateTileInfo(l),l.extent=null,s}fetchTile(){throw new t("BaseElevationLayer:fetchtile-not-implemented","fetchTile() is not implemented")}queryElevation(e,t){return this._importElevationQuery().then((r=>(new r.ElevationQuery).query(this,e,t)))}createElevationSampler(e,t){return this._importElevationQuery().then((r=>(new r.ElevationQuery).createSampler(this,e,t)))}_importElevationQuery(){return import("./support/ElevationQuery.js")}};e([r({type:p})],c.prototype,"tileInfo",void 0),e([r({type:["show","hide"]})],c.prototype,"listMode",void 0),e([r()],c.prototype,"fullExtent",void 0),e([r()],c.prototype,"spatialReference",void 0),e([r({readOnly:!0,value:"base-elevation"})],c.prototype,"type",void 0),c=e([o("esri.layers.BaseElevationLayer")],c);const m=c;export{m as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Error.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import{ZERO as s}from"../geometry/support/aaBoundingRect.js";import i from"./Layer.js";import p from"./support/TileInfo.js";import{TileKey as a}from"./support/TileKey.js";import n from"../geometry/SpatialReference.js";import l from"../geometry/Extent.js";const m=new a("0/0/0",0,0,0,null);let c=class extends i{constructor(){super(...arguments),this.tileInfo=p.create({spatialReference:n.WebMercator,size:256}),this.fullExtent=new l(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,n.WebMercator),this.spatialReference=n.WebMercator,this.type="base-elevation"}getTileBounds(e,t,r,o){const i=o||s;return m.level=e,m.row=t,m.col=r,m.extent=i,this.tileInfo.updateTileInfo(m),m.extent=null,i}fetchTile(){throw new t("BaseElevationLayer:fetchtile-not-implemented","fetchTile() is not implemented")}queryElevation(e,t){return this._importElevationQuery().then((r=>(new r.ElevationQuery).query(this,e,t)))}createElevationSampler(e,t){return this._importElevationQuery().then((r=>(new r.ElevationQuery).createSampler(this,e,t)))}_importElevationQuery(){return import("./support/ElevationQuery.js")}};e([r({type:p})],c.prototype,"tileInfo",void 0),e([r({type:["show","hide"]})],c.prototype,"listMode",void 0),e([r()],c.prototype,"fullExtent",void 0),e([r()],c.prototype,"spatialReference",void 0),e([r({readOnly:!0,value:"base-elevation"})],c.prototype,"type",void 0),c=e([o("esri.layers.BaseElevationLayer")],c);const u=c;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import i from"../geometry/Extent.js";import l from"../geometry/SpatialReference.js";import{create as p}from"../geometry/support/aaBoundingRect.js";import a from"./Layer.js";import{BlendLayer as n}from"./mixins/BlendLayer.js";import{RefreshableLayer as m}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as c}from"./mixins/ScaleRangeLayer.js";import f from"./support/TileInfo.js";const u={id:"0/0/0",level:0,row:0,col:0,extent:null};let y=class extends(n(c(m(a)))){constructor(){super(...arguments),this.tileInfo=f.create({spatialReference:l.WebMercator,size:256}),this.type="base-tile",this.fullExtent=new i(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,l.WebMercator),this.spatialReference=l.WebMercator}getTileBounds(e,t,r,o){const s=o||p();return u.level=e,u.row=t,u.col=r,u.extent=s,this.tileInfo.updateTileInfo(u),u.extent=null,s}fetchTile(e,r,o,s={}){const{signal:i}=s,l=this.getTileUrl(e,r,o),p={responseType:"image",signal:i,query:{...this.refreshParameters}};return t(l,p).then((e=>e.data))}getTileUrl(){throw new r("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};e([o({type:f})],y.prototype,"tileInfo",void 0),e([o({type:["show","hide"]})],y.prototype,"listMode",void 0),e([o({readOnly:!0,value:"base-tile"})],y.prototype,"type",void 0),e([o({nonNullable:!0})],y.prototype,"fullExtent",void 0),e([o()],y.prototype,"spatialReference",void 0),y=e([s("esri.layers.BaseTileLayer")],y);const d=y;export{d as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import i from"../geometry/Extent.js";import p from"../geometry/SpatialReference.js";import{create as l}from"../geometry/support/aaBoundingRect.js";import a from"./Layer.js";import{BlendLayer as n}from"./mixins/BlendLayer.js";import{RefreshableLayer as m}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as c}from"./mixins/ScaleRangeLayer.js";import f from"./support/TileInfo.js";import{TileKey as u}from"./support/TileKey.js";const y=new u("0/0/0",0,0,0,null);let d=class extends(n(c(m(a)))){constructor(){super(...arguments),this.tileInfo=f.create({spatialReference:p.WebMercator,size:256}),this.type="base-tile",this.fullExtent=new i(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,p.WebMercator),this.spatialReference=p.WebMercator}getTileBounds(e,r,t,o){const s=o||l();return y.level=e,y.row=r,y.col=t,y.extent=s,this.tileInfo.updateTileInfo(y),y.extent=null,s}fetchTile(e,t,o,s={}){const{signal:i}=s,p=this.getTileUrl(e,t,o),l={responseType:"image",signal:i,query:{...this.refreshParameters}};return r(p,l).then((e=>e.data))}getTileUrl(){throw new t("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};e([o({type:f})],d.prototype,"tileInfo",void 0),e([o({type:["show","hide"]})],d.prototype,"listMode",void 0),e([o({readOnly:!0,value:"base-tile"})],d.prototype,"type",void 0),e([o({nonNullable:!0})],d.prototype,"fullExtent",void 0),e([o()],d.prototype,"spatialReference",void 0),d=e([s("esri.layers.BaseTileLayer")],d);const j=d;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{isNone as i,isSome as o}from"../../core/maybe.js";import{whenOrAbort as s,throwIfAbortError as l,eachAlways as n}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as a}from"../../core/unitUtils.js";import r from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";import u from"../../geometry/Polyline.js";import{initializeProjection as h,project as p}from"../../geometry/projection.js";import{fromExtent as m,create as f,contains as d}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as y}from"./ElevationSampler.js";import{ElevationTile as T}from"./ElevationTile.js";class v{async queryAll(e,i,o){if(!(e=o&&o.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const s=x.fromGeometry(i);let l=!1;o&&o.returnSampleInfo||(l=!0);const n={...R,...o,returnSampleInfo:!0},a=await this.query(e[e.length-1],s,n),r=await this._queryAllContinue(e,a,n);return r.geometry=r.geometry.export(),l&&delete r.sampleInfo,r}async query(e,i,o){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof x)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const s={...R,...o},l=new w(e,i.spatialReference,s),n=s.signal;return await e.load({signal:n}),await this._createGeometryDescriptor(l,i,n),await this._selectTiles(l,n),await this._populateElevationTiles(l,n),this._sampleGeometryWithElevation(l),this._createQueryResult(l,n)}async createSampler(e,i,o){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const s={...R,...o};return this._createSampler(e,i,s)}async createSamplerAll(e,i,o){if(!(e=o&&o.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const s={...R,...o,returnSampleInfo:!0},l=await this._createSampler(e[e.length-1],i,s);return this._createSamplerAllContinue(e,i,l,s)}async _createSampler(e,t,i,o){const s=i.signal;await e.load({signal:s});const l=t.spatialReference,n=e.tileInfo.spatialReference;l.equals(n)||(await h([{source:l,dest:n}],{signal:s}),t=p(t,n));const a=new _(e,t,i,o);return await this._selectTiles(a,s),await this._populateElevationTiles(a,s),new y(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,o){if(e.pop(),!e.length)return i;const s=i.samplers.map((e=>m(e.extent))),l=await this._createSampler(e[e.length-1],t,o,s);if(0===l.samplers.length)return i;const n=i.samplers.concat(l.samplers),a=new y(n,o.noDataValue);return this._createSamplerAllContinue(e,t,a,o)}async _queryAllContinue(e,t,i){const o=e.pop(),s=t.geometry.coordinates,l=[],n=[];for(let c=0;c<s.length;c++){const i=t.sampleInfo[c];i.demResolution>=0?i.source||(i.source=o):e.length&&(l.push(s[c]),n.push(c))}if(!e.length||0===l.length)return t;const a=t.geometry.clone(l),r=await this.query(e[e.length-1],a,i);return n.forEach(((e,i)=>{s[e].z=r.geometry.coordinates[i].z,t.sampleInfo[e].demResolution=r.sampleInfo[i].demResolution})),this._queryAllContinue(e,t,i)}async _createQueryResult(e,t){const i={geometry:(await e.geometry.project(e.outSpatialReference,t)).export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(i.sampleInfo=this._extractSampleInfo(e)),e.geometry.coordinates.forEach((e=>{e.tile=null,e.elevationTile=null})),i}async _createGeometryDescriptor(e,i,o){let s;const l=e.layer.tileInfo.spatialReference;if(i instanceof x?s=await i.project(l,o):(await h([{source:i.spatialReference,dest:l}],{signal:o}),s=p(i,l)),!s)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${l.wkid}'`);e.geometry=x.fromGeometry(s)}async _selectTiles(e,i){const o=e.options.demResolution;if("geometry"===e.type&&this._preselectOutsideLayerExtent(e),"number"==typeof o)this._selectTilesClosestResolution(e);else if("finest-contiguous"===o)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==o)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${o}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}_preselectOutsideLayerExtent(e){if(i(e.layer.fullExtent))return;const t=new T(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const o=e.layer.fullExtent;e.geometry.coordinates.forEach((e=>{const i=e.x,s=e.y;(i<o.xmin||i>o.xmax||s<o.ymin||s>o.ymax)&&(e.elevationTile=t)}))}_selectTilesClosestResolution(e){const t=e.layer.tileInfo,i=this._findNearestDemResolutionLODIndex(t,e.options.demResolution);e.selectTilesAtLOD(i)}_findNearestDemResolutionLODIndex(e,t){const i=t/a(e.spatialReference);let o=e.lods[0],s=0;for(let l=1;l<e.lods.length;l++){const t=e.lods[l];Math.abs(t.resolution-i)<Math.abs(o.resolution-i)&&(o=t,s=l)}return s}async _selectTilesFinestContiguous(e,t){const i=E(e.layer.tileInfo,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,i,t)}async _selectTilesFinestContiguousAt(e,i,o){const n=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=n.tilemapCache,r=e.getTilesToFetch();try{if(a)await s(Promise.all(r.map((e=>a.fetchAvailability(e.level,e.row,e.col,{signal:o})))),o);else if(await this._populateElevationTiles(e,o),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles")}catch(c){l(c),await this._selectTilesFinestContiguousAt(e,i-1,o)}}async _populateElevationTiles(e,t){const i=e.getTilesToFetch(),l={},a=e.options.cache,r=e.options.noDataValue,c=i.map((async i=>{const s=`${e.layer.uid}:${i.id}:${r}`,n=o(a)?a.get(s):null,c=o(n)?n:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:r,signal:t});o(a)&&a.put(s,c),l[i.id]=new T(i,c)}));await s(n(c),t),e.populateElevationTiles(l)}async _selectTilesAuto(t,i){this._selectTilesAutoFinest(t),this._reduceTilesForMaximumRequests(t);const o=t.layer.tilemapCache;if(!o)return this._selectTilesAutoPrefetchUpsample(t,i);const n=t.getTilesToFetch(),a={},r=n.map((async t=>{const s={id:null,level:0,row:0,col:0,extent:f()},n=await e(o.fetchAvailabilityUpsample(t.level,t.row,t.col,s,{signal:i}));!1===n.ok?l(n.error):a[t.id]=s}));await s(Promise.all(r),i),t.remapTiles(a)}_reduceTilesForMaximumRequests(e){const t=e.layer.tileInfo;let i=0;const o={},s=e=>{e.id in o?o[e.id]++:(o[e.id]=1,i++)},l=e=>{const t=o[e.id];1===t?(delete o[e.id],i--):o[e.id]=t-1};e.forEachTileToFetch(s,l);let n=!0;for(;n&&(n=!1,e.forEachTileToFetch((o=>{i<=e.options.maximumAutoTileRequests||(l(o),t.upsampleTile(o)&&(n=!0),s(o))}),l),n););}_selectTilesAutoFinest(e){const t=E(e.layer.tileInfo,e.options.minDemResolution);e.selectTilesAtLOD(t,e.options.maximumAutoTileRequests)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await this._populateElevationTiles(e,t);let o=!1;e.forEachTileToFetch(((e,t)=>{i.upsampleTile(e)?o=!0:t()})),o&&await this._selectTilesAutoPrefetchUpsample(e,t)}_sampleGeometryWithElevation(e){e.geometry.coordinates.forEach((t=>{const i=t.elevationTile;let s=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);o(e)?s=e:t.elevationTile=null}t.z=s}))}_extractSampleInfo(e){const t=e.layer.tileInfo,i=a(t.spatialReference);return e.geometry.coordinates.map((o=>{let s=-1;if(o.elevationTile&&o.elevationTile!==e.outsideExtentTile){s=t.lodAt(o.elevationTile.tile.level).resolution*i}return{demResolution:s}}))}}class x{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new x;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map((e=>this._cloneCoordinate(e))),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await h([{source:this.spatialReference,dest:e}],{signal:t});const i=new r({spatialReference:this.spatialReference,points:this.coordinates.map((e=>[e.x,e.y]))}),o=p(i,e);if(!o)return null;const s=this.coordinates.map(((e,t)=>{const i=this._cloneCoordinate(e),s=o.points[t];return i.x=s[0],i.y=s[1],i})),l=this.clone(s);return l.spatialReference=e,l}_cloneCoordinate(e){return{x:e.x,y:e.y,z:e.z,m:e.m,tile:null,elevationTile:null}}static fromGeometry(e){const t=new x;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof x)t.coordinates=e.coordinates.map((e=>t._cloneCoordinate(e))),t._exporter=(t,i)=>{const o=e.clone(t);return o.spatialReference=i,o};else switch(e.type){case"point":{const i=e,{hasZ:o,hasM:s}=i;t.coordinates=o&&s?[{x:i.x,y:i.y,z:i.z,m:i.m}]:o?[{x:i.x,y:i.y,z:i.z}]:s?[{x:i.x,y:i.y,m:i.m}]:[{x:i.x,y:i.y}],t._exporter=(t,i)=>e.hasM?new c(t[0].x,t[0].y,t[0].z,t[0].m,i):new c(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:o,hasM:s}=i;t.coordinates=o&&s?i.points.map((e=>({x:e[0],y:e[1],z:e[2],m:e[3]}))):o?i.points.map((e=>({x:e[0],y:e[1],z:e[2]}))):s?i.points.map((e=>({x:e[0],y:e[1],m:e[2]}))):i.points.map((e=>({x:e[0],y:e[1]}))),t._exporter=(t,i)=>e.hasM?new r({points:t.map((e=>[e.x,e.y,e.z,e.m])),hasZ:!0,hasM:!0,spatiaReference:i}):new r(t.map((e=>[e.x,e.y,e.z])),i);break}case"polyline":{const i=e,o=[],s=[],{hasZ:l,hasM:n}=e;let a=0;for(const e of i.paths)if(s.push([a,a+e.length]),a+=e.length,l&&n)for(const t of e)o.push({x:t[0],y:t[1],z:t[2],m:t[3]});else if(l)for(const t of e)o.push({x:t[0],y:t[1],z:t[2]});else if(n)for(const t of e)o.push({x:t[0],y:t[1],m:t[2]});else for(const t of e)o.push({x:t[0],y:t[1]});t.coordinates=o,t._exporter=(t,i)=>{const o=e.hasM?t.map((e=>[e.x,e.y,e.z,e.m])):t.map((e=>[e.x,e.y,e.z])),l=s.map((e=>o.slice(e[0],e[1])));return new u({paths:l,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class g{constructor(e,t){this.layer=e,this.options=t}}class w extends g{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach((e=>e.tile=null));else{const t=this.layer.tileInfo,i=t.lods[e].level;this.geometry.coordinates.forEach((e=>{e.tile=t.tileAt(i,e.x,e.y)}))}}allElevationTilesFetched(){return!this.geometry.coordinates.some((e=>!e.elevationTile))}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates)t.tile=e[t.tile.id]}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const o=i.tile;i.elevationTile||!i.tile||e[o.id]||(e[o.id]=o,t.push(o))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,(()=>t.tile=null))}}class _ extends g{constructor(e,t,i,o){super(e,i),this.type="extent",this.elevationTiles=[],this.candidateTiles=[],this.fetchedCandidates=new Set,this.extent=t.intersection(e.fullExtent),this.maskExtents=o}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),o=Math.min(i,e);o<0?this.candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(o)}_maximumLodForRequests(e){const t=this.layer.tileInfo;if(!e)return t.lods.length-1;const o=this.extent;if(i(o))return-1;for(let i=t.lods.length-1;i>=0;i--){const s=t.lods[i],l=s.resolution*t.size[0],n=s.resolution*t.size[1];if(Math.ceil(o.width/l)*Math.ceil(o.height/n)<=e)return i}return-1}allElevationTilesFetched(){return this.candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this.fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this.candidateTiles){const i=e[t.id];i&&(this.fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this.candidateTiles=this._uniqueNonOverlappingTiles(this.candidateTiles.map((t=>e[t.id])))}getTilesToFetch(){return this.candidateTiles}forEachTileToFetch(e,t){const i=this.candidateTiles;this.candidateTiles=[],i.forEach((i=>{if(this.fetchedCandidates.has(i))return void(t&&t(i));let o=!1;e(i,(()=>o=!0)),o?t&&t(i):this.candidateTiles.push(i)})),this.candidateTiles=this._uniqueNonOverlappingTiles(this.candidateTiles,t)}_uniqueNonOverlappingTiles(e,t){const i={},o=[];for(const l of e)i[l.id]?t&&t(l):(i[l.id]=l,o.push(l));const s=o.sort(((e,t)=>e.level-t.level));return s.filter(((e,i)=>{for(let o=0;o<i;o++)if(d(s[o].extent,e.extent))return t&&t(e),!1;return!0}))}_selectCandidateTilesCoveringExtentAt(e){this.candidateTiles.length=0;const t=this.extent;if(i(t))return;const o=this.layer.tileInfo,s=o.lods[e],l=o.tileAt(s.level,t.xmin,t.ymin),n=s.resolution*o.size[0],a=s.resolution*o.size[1],r=Math.ceil((t.xmax-l.extent[0])/n),c=Math.ceil((t.ymax-l.extent[1])/a);for(let i=0;i<c;i++)for(let e=0;e<r;e++){const t={id:null,level:l.level,row:l.row-i,col:l.col+e};o.updateTileInfo(t),this._tileIsMasked(t)||this.candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some((t=>d(t,e.extent)))}}function E(e,t){let i=e.lods.length-1;if(t>0){const o=t/a(e.spatialReference),s=e.lods.findIndex((e=>e.resolution<o));0===s?i=0:s>0&&(i=s-1)}return i}const R={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};export{v as ElevationQuery,x as GeometryDescriptor,E as getFinestLodIndex};
5
+ import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{isNone as i,isSome as o}from"../../core/maybe.js";import{whenOrAbort as s,throwIfAbortError as n,eachAlways as l}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as a}from"../../core/unitUtils.js";import r from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";import u from"../../geometry/Polyline.js";import{initializeProjection as h,project as p}from"../../geometry/projection.js";import{fromExtent as m,create as f,contains as d}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as y}from"./ElevationSampler.js";import{ElevationTile as T}from"./ElevationTile.js";import{TileKey as v}from"./TileKey.js";class x{async queryAll(e,i,o){if(!(e=o&&o.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const s=g.fromGeometry(i);let n=!1;o&&o.returnSampleInfo||(n=!0);const l={...q,...o,returnSampleInfo:!0},a=await this.query(e[e.length-1],s,l),r=await this._queryAllContinue(e,a,l);return r.geometry=r.geometry.export(),n&&delete r.sampleInfo,r}async query(e,i,o){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof g)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const s={...q,...o},n=new _(e,i.spatialReference,s),l=s.signal;return await e.load({signal:l}),await this._createGeometryDescriptor(n,i,l),await this._selectTiles(n,l),await this._populateElevationTiles(n,l),this._sampleGeometryWithElevation(n),this._createQueryResult(n,l)}async createSampler(e,i,o){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const s={...q,...o};return this._createSampler(e,i,s)}async createSamplerAll(e,i,o){if(!(e=o&&o.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const s={...q,...o,returnSampleInfo:!0},n=await this._createSampler(e[e.length-1],i,s);return this._createSamplerAllContinue(e,i,n,s)}async _createSampler(e,t,i,o){const s=i.signal;await e.load({signal:s});const n=t.spatialReference,l=e.tileInfo.spatialReference;n.equals(l)||(await h([{source:n,dest:l}],{signal:s}),t=p(t,l));const a=new E(e,t,i,o);return await this._selectTiles(a,s),await this._populateElevationTiles(a,s),new y(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,o){if(e.pop(),!e.length)return i;const s=i.samplers.map((e=>m(e.extent))),n=await this._createSampler(e[e.length-1],t,o,s);if(0===n.samplers.length)return i;const l=i.samplers.concat(n.samplers),a=new y(l,o.noDataValue);return this._createSamplerAllContinue(e,t,a,o)}async _queryAllContinue(e,t,i){const o=e.pop(),s=t.geometry.coordinates,n=[],l=[];for(let c=0;c<s.length;c++){const i=t.sampleInfo[c];i.demResolution>=0?i.source||(i.source=o):e.length&&(n.push(s[c]),l.push(c))}if(!e.length||0===n.length)return t;const a=t.geometry.clone(n),r=await this.query(e[e.length-1],a,i);return l.forEach(((e,i)=>{s[e].z=r.geometry.coordinates[i].z,t.sampleInfo[e].demResolution=r.sampleInfo[i].demResolution})),this._queryAllContinue(e,t,i)}async _createQueryResult(e,t){const i={geometry:(await e.geometry.project(e.outSpatialReference,t)).export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(i.sampleInfo=this._extractSampleInfo(e)),e.geometry.coordinates.forEach((e=>{e.tile=null,e.elevationTile=null})),i}async _createGeometryDescriptor(e,i,o){let s;const n=e.layer.tileInfo.spatialReference;if(i instanceof g?s=await i.project(n,o):(await h([{source:i.spatialReference,dest:n}],{signal:o}),s=p(i,n)),!s)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${n.wkid}'`);e.geometry=g.fromGeometry(s)}async _selectTiles(e,i){const o=e.options.demResolution;if("geometry"===e.type&&this._preselectOutsideLayerExtent(e),"number"==typeof o)this._selectTilesClosestResolution(e);else if("finest-contiguous"===o)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==o)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${o}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}_preselectOutsideLayerExtent(e){if(i(e.layer.fullExtent))return;const t=new T(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const o=e.layer.fullExtent;e.geometry.coordinates.forEach((e=>{const i=e.x,s=e.y;(i<o.xmin||i>o.xmax||s<o.ymin||s>o.ymax)&&(e.elevationTile=t)}))}_selectTilesClosestResolution(e){const t=e.layer.tileInfo,i=this._findNearestDemResolutionLODIndex(t,e.options.demResolution);e.selectTilesAtLOD(i)}_findNearestDemResolutionLODIndex(e,t){const i=t/a(e.spatialReference);let o=e.lods[0],s=0;for(let n=1;n<e.lods.length;n++){const t=e.lods[n];Math.abs(t.resolution-i)<Math.abs(o.resolution-i)&&(o=t,s=n)}return s}async _selectTilesFinestContiguous(e,t){const i=R(e.layer.tileInfo,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,i,t)}async _selectTilesFinestContiguousAt(e,i,o){const l=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=l.tilemapCache,r=e.getTilesToFetch();try{if(a)await s(Promise.all(r.map((e=>a.fetchAvailability(e.level,e.row,e.col,{signal:o})))),o);else if(await this._populateElevationTiles(e,o),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles")}catch(c){n(c),await this._selectTilesFinestContiguousAt(e,i-1,o)}}async _populateElevationTiles(e,t){const i=e.getTilesToFetch(),n={},a=e.options.cache,r=e.options.noDataValue,c=i.map((async i=>{const s=`${e.layer.uid}:${i.id}:${r}`,l=o(a)?a.get(s):null,c=o(l)?l:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:r,signal:t});o(a)&&a.put(s,c),n[i.id]=new T(i,c)}));await s(l(c),t),e.populateElevationTiles(n)}async _selectTilesAuto(t,i){this._selectTilesAutoFinest(t),this._reduceTilesForMaximumRequests(t);const o=t.layer.tilemapCache;if(!o)return this._selectTilesAutoPrefetchUpsample(t,i);const l=t.getTilesToFetch(),a={},r=l.map((async t=>{const s=new v(null,0,0,0,f()),l=await e(o.fetchAvailabilityUpsample(t.level,t.row,t.col,s,{signal:i}));!1===l.ok?n(l.error):a[t.id]=s}));await s(Promise.all(r),i),t.remapTiles(a)}_reduceTilesForMaximumRequests(e){const t=e.layer.tileInfo;let i=0;const o={},s=e=>{e.id in o?o[e.id]++:(o[e.id]=1,i++)},n=e=>{const t=o[e.id];1===t?(delete o[e.id],i--):o[e.id]=t-1};e.forEachTileToFetch(s,n);let l=!0;for(;l&&(l=!1,e.forEachTileToFetch((o=>{i<=e.options.maximumAutoTileRequests||(n(o),t.upsampleTile(o)&&(l=!0),s(o))}),n),l););}_selectTilesAutoFinest(e){const t=R(e.layer.tileInfo,e.options.minDemResolution);e.selectTilesAtLOD(t,e.options.maximumAutoTileRequests)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await this._populateElevationTiles(e,t);let o=!1;e.forEachTileToFetch(((e,t)=>{i.upsampleTile(e)?o=!0:t()})),o&&await this._selectTilesAutoPrefetchUpsample(e,t)}_sampleGeometryWithElevation(e){e.geometry.coordinates.forEach((t=>{const i=t.elevationTile;let s=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);o(e)?s=e:t.elevationTile=null}t.z=s}))}_extractSampleInfo(e){const t=e.layer.tileInfo,i=a(t.spatialReference);return e.geometry.coordinates.map((o=>{let s=-1;if(o.elevationTile&&o.elevationTile!==e.outsideExtentTile){s=t.lodAt(o.elevationTile.tile.level).resolution*i}return{demResolution:s}}))}}class g{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new g;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map((e=>this._cloneCoordinate(e))),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await h([{source:this.spatialReference,dest:e}],{signal:t});const i=new r({spatialReference:this.spatialReference,points:this.coordinates.map((e=>[e.x,e.y]))}),o=p(i,e);if(!o)return null;const s=this.coordinates.map(((e,t)=>{const i=this._cloneCoordinate(e),s=o.points[t];return i.x=s[0],i.y=s[1],i})),n=this.clone(s);return n.spatialReference=e,n}_cloneCoordinate(e){return{x:e.x,y:e.y,z:e.z,m:e.m,tile:null,elevationTile:null}}static fromGeometry(e){const t=new g;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof g)t.coordinates=e.coordinates.map((e=>t._cloneCoordinate(e))),t._exporter=(t,i)=>{const o=e.clone(t);return o.spatialReference=i,o};else switch(e.type){case"point":{const i=e,{hasZ:o,hasM:s}=i;t.coordinates=o&&s?[{x:i.x,y:i.y,z:i.z,m:i.m}]:o?[{x:i.x,y:i.y,z:i.z}]:s?[{x:i.x,y:i.y,m:i.m}]:[{x:i.x,y:i.y}],t._exporter=(t,i)=>e.hasM?new c(t[0].x,t[0].y,t[0].z,t[0].m,i):new c(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:o,hasM:s}=i;t.coordinates=o&&s?i.points.map((e=>({x:e[0],y:e[1],z:e[2],m:e[3]}))):o?i.points.map((e=>({x:e[0],y:e[1],z:e[2]}))):s?i.points.map((e=>({x:e[0],y:e[1],m:e[2]}))):i.points.map((e=>({x:e[0],y:e[1]}))),t._exporter=(t,i)=>e.hasM?new r({points:t.map((e=>[e.x,e.y,e.z,e.m])),hasZ:!0,hasM:!0,spatiaReference:i}):new r(t.map((e=>[e.x,e.y,e.z])),i);break}case"polyline":{const i=e,o=[],s=[],{hasZ:n,hasM:l}=e;let a=0;for(const e of i.paths)if(s.push([a,a+e.length]),a+=e.length,n&&l)for(const t of e)o.push({x:t[0],y:t[1],z:t[2],m:t[3]});else if(n)for(const t of e)o.push({x:t[0],y:t[1],z:t[2]});else if(l)for(const t of e)o.push({x:t[0],y:t[1],m:t[2]});else for(const t of e)o.push({x:t[0],y:t[1]});t.coordinates=o,t._exporter=(t,i)=>{const o=e.hasM?t.map((e=>[e.x,e.y,e.z,e.m])):t.map((e=>[e.x,e.y,e.z])),n=s.map((e=>o.slice(e[0],e[1])));return new u({paths:n,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class w{constructor(e,t){this.layer=e,this.options=t}}class _ extends w{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach((e=>e.tile=null));else{const t=this.layer.tileInfo,i=t.lods[e].level;this.geometry.coordinates.forEach((e=>{e.tile=t.tileAt(i,e.x,e.y)}))}}allElevationTilesFetched(){return!this.geometry.coordinates.some((e=>!e.elevationTile))}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates)t.tile=e[t.tile.id]}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const o=i.tile;i.elevationTile||!i.tile||e[o.id]||(e[o.id]=o,t.push(o))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,(()=>t.tile=null))}}class E extends w{constructor(e,t,i,o){super(e,i),this.type="extent",this.elevationTiles=[],this.candidateTiles=[],this.fetchedCandidates=new Set,this.extent=t.intersection(e.fullExtent),this.maskExtents=o}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),o=Math.min(i,e);o<0?this.candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(o)}_maximumLodForRequests(e){const t=this.layer.tileInfo;if(!e)return t.lods.length-1;const o=this.extent;if(i(o))return-1;for(let i=t.lods.length-1;i>=0;i--){const s=t.lods[i],n=s.resolution*t.size[0],l=s.resolution*t.size[1];if(Math.ceil(o.width/n)*Math.ceil(o.height/l)<=e)return i}return-1}allElevationTilesFetched(){return this.candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this.fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this.candidateTiles){const i=e[t.id];i&&(this.fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this.candidateTiles=this._uniqueNonOverlappingTiles(this.candidateTiles.map((t=>e[t.id])))}getTilesToFetch(){return this.candidateTiles}forEachTileToFetch(e,t){const i=this.candidateTiles;this.candidateTiles=[],i.forEach((i=>{if(this.fetchedCandidates.has(i))return void(t&&t(i));let o=!1;e(i,(()=>o=!0)),o?t&&t(i):this.candidateTiles.push(i)})),this.candidateTiles=this._uniqueNonOverlappingTiles(this.candidateTiles,t)}_uniqueNonOverlappingTiles(e,t){const i={},o=[];for(const n of e)i[n.id]?t&&t(n):(i[n.id]=n,o.push(n));const s=o.sort(((e,t)=>e.level-t.level));return s.filter(((e,i)=>{for(let o=0;o<i;o++)if(d(s[o].extent,e.extent))return t&&t(e),!1;return!0}))}_selectCandidateTilesCoveringExtentAt(e){this.candidateTiles.length=0;const t=this.extent;if(i(t))return;const o=this.layer.tileInfo,s=o.lods[e],n=o.tileAt(s.level,t.xmin,t.ymin),l=s.resolution*o.size[0],a=s.resolution*o.size[1],r=Math.ceil((t.xmax-n.extent[0])/l),c=Math.ceil((t.ymax-n.extent[1])/a);for(let i=0;i<c;i++)for(let e=0;e<r;e++){const t=new v(null,n.level,n.row-i,n.col+e);o.updateTileInfo(t),this._tileIsMasked(t)||this.candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some((t=>d(t,e.extent)))}}function R(e,t){let i=e.lods.length-1;if(t>0){const o=t/a(e.spatialReference),s=e.lods.findIndex((e=>e.resolution<o));0===s?i=0:s>0&&(i=s-1)}return i}const q={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};export{x as ElevationQuery,g as GeometryDescriptor,R as getFinestLodIndex};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{isNone as t}from"../../core/maybe.js";import{aliasOf as o}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as a,combineRenderingRules as p,convertRendererToRenderingRule as l,convertRenderingRuleToRFT as c}from"./imageryRendererUtils.js";import m from"./MosaicRule.js";import{interpolationKebab as y,noDataInterpretationKebab as u}from"./rasterEnums.js";import d from"./RasterFunction.js";let f=class extends r{constructor(){super(...arguments),this.layer=null,this.adjustAspectRatio=void 0,this.bandIds=void 0,this.compression=void 0,this.compressionQuality=void 0,this.compressionTolerance=.01,this.interpolation=null,this.noData=null,this.noDataInterpretation=void 0,this.pixelType=void 0,this.lercVersion=2}writeAdjustAspectRatio(e,r,t){this.layer.version<10.3||(r[t]=e)}writeCompressionQuality(e,r,t){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(r[t]=e)}writeCompressionTolerance(e,r,t){"lerc"===this.format&&null!=e&&(r[t]=e)}get format(){return"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}writeLercVersion(e,r,t){"lerc"===this.format&&this.layer.version>=10.5&&(r[t]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("renderingRule"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("renderer"),e.commitProperty("definitionExpression"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let r=e.mosaicRule;const t=e.definitionExpression;return r?t&&t!==r.where&&(r=r.clone(),r.where=t):t&&(r=new m({where:t})),r}get renderingRule(){const e=this.layer;let r=e.renderingRule;const t=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");return r=this._addResampleRasterFunction(r),o&&!t&&"vector-field"!==e.renderer?.type&&(r=this.combineRendererWithRenderingRule()),r}combineRendererWithRenderingRule(){const e=this.layer,{rasterInfo:r,renderingRule:t,renderer:o}=e;if(!o||!a(o))return t;return p(l(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandProperties:r.keyProperties?.BandProperties,convertColorRampToColormap:e.version<10.6,convertToRFT:!!t?.rasterFunctionDefinition}),t)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName||t(this.layer.serviceRasterInfo))return e;const r="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,o=this.layer.serviceRasterInfo.pixelSize;let i=new d({functionName:"Resample",functionArguments:{ResamplingType:r,InputCellSize:o}});return i=e?.rasterFunctionDefinition?new d({rasterFunctionDefinition:c(i)}):i,p(i,e)}};e([i()],f.prototype,"layer",void 0),e([i({json:{write:!0}})],f.prototype,"adjustAspectRatio",void 0),e([n("adjustAspectRatio")],f.prototype,"writeAdjustAspectRatio",null),e([i({json:{write:!0}}),o("layer.bandIds")],f.prototype,"bandIds",void 0),e([i({json:{write:!0}})],f.prototype,"compression",void 0),e([i({json:{write:!0}}),o("layer.compressionQuality")],f.prototype,"compressionQuality",void 0),e([n("compressionQuality")],f.prototype,"writeCompressionQuality",null),e([i({json:{write:!0}}),o("layer.compressionTolerance")],f.prototype,"compressionTolerance",void 0),e([n("compressionTolerance")],f.prototype,"writeCompressionTolerance",null),e([i({json:{write:!0}})],f.prototype,"format",null),e([i({type:String,json:{read:{reader:y.read},write:{writer:y.write}}}),o("layer.interpolation")],f.prototype,"interpolation",void 0),e([i({json:{write:!0}}),o("layer.noData")],f.prototype,"noData",void 0),e([i({type:String,json:{read:{reader:u.read},write:{writer:u.write}}}),o("layer.noDataInterpretation")],f.prototype,"noDataInterpretation",void 0),e([i({json:{write:!0}})],f.prototype,"pixelType",void 0),e([i({json:{write:!0}})],f.prototype,"lercVersion",void 0),e([n("lercVersion")],f.prototype,"writeLercVersion",null),e([i({type:Number})],f.prototype,"version",null),e([i({json:{write:!0}})],f.prototype,"mosaicRule",null),e([i({json:{write:!0}})],f.prototype,"renderingRule",null),f=e([s("esri.layers.mixins.ExportImageServiceParameters")],f);export{f as ExportImageServiceParameters};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{isNone as t}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as n,combineRenderingRules as a,convertRendererToRenderingRule as p,convertRenderingRuleToRFT as l}from"./imageryRendererUtils.js";import c from"./MosaicRule.js";import{interpolationKebab as m,noDataInterpretationKebab as y}from"./rasterEnums.js";import u from"./RasterFunction.js";let d=class extends r{constructor(){super(...arguments),this.layer=null,this.adjustAspectRatio=void 0,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}writeAdjustAspectRatio(e,r,t){this.layer.version<10.3||(r[t]=e)}get bandIds(){return this.layer.bandIds}set bandIds(e){this.layer&&(this.layer.bandIds=e)}get compressionQuality(){return this.layer?.compressionQuality}set compressionQuality(e){this.layer&&(this.layer.compressionQuality=e)}writeCompressionQuality(e,r,t){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(r[t]=e)}get compressionTolerance(){return this.layer?.compressionTolerance}set compressionTolerance(e){this.layer&&(this.layer.compressionTolerance=e)}writeCompressionTolerance(e,r,t){"lerc"===this.format&&null!=e&&(r[t]=e)}get format(){return"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer?.interpolation}set interpolation(e){this.layer&&(this.layer.interpolation=e)}get noData(){return this.layer?.noData}set noData(e){this.layer&&(this.layer.noData=e)}get noDataInterpretation(){return this.layer?.noDataInterpretation}set noDataInterpretation(e){this.layer&&(this.layer.noDataInterpretation=e)}writeLercVersion(e,r,t){"lerc"===this.format&&this.layer.version>=10.5&&(r[t]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("renderingRule"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("renderer"),e.commitProperty("definitionExpression"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let r=e.mosaicRule;const t=e.definitionExpression;return r?t&&t!==r.where&&(r=r.clone(),r.where=t):t&&(r=new c({where:t})),r}get renderingRule(){const e=this.layer;let r=e.renderingRule;const t=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");return r=this._addResampleRasterFunction(r),o&&!t&&"vector-field"!==e.renderer?.type&&(r=this.combineRendererWithRenderingRule()),r}combineRendererWithRenderingRule(){const e=this.layer,{rasterInfo:r,renderingRule:t,renderer:o}=e;if(!o||!n(o))return t;return a(p(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandProperties:r.keyProperties?.BandProperties,convertColorRampToColormap:e.version<10.6,convertToRFT:!!t?.rasterFunctionDefinition}),t)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName||t(this.layer.serviceRasterInfo))return e;const r="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,o=this.layer.serviceRasterInfo.pixelSize;let i=new u({functionName:"Resample",functionArguments:{ResamplingType:r,InputCellSize:o}});return i=e?.rasterFunctionDefinition?new u({rasterFunctionDefinition:l(i)}):i,a(i,e)}};e([o()],d.prototype,"layer",void 0),e([o({json:{write:!0}})],d.prototype,"adjustAspectRatio",void 0),e([s("adjustAspectRatio")],d.prototype,"writeAdjustAspectRatio",null),e([o({json:{write:!0}})],d.prototype,"bandIds",null),e([o({json:{write:!0}})],d.prototype,"compression",void 0),e([o({json:{write:!0}})],d.prototype,"compressionQuality",null),e([s("compressionQuality")],d.prototype,"writeCompressionQuality",null),e([o({json:{write:!0}})],d.prototype,"compressionTolerance",null),e([s("compressionTolerance")],d.prototype,"writeCompressionTolerance",null),e([o({json:{write:!0}})],d.prototype,"format",null),e([o({type:String,json:{read:{reader:m.read},write:{writer:m.write}}})],d.prototype,"interpolation",null),e([o({json:{write:!0}})],d.prototype,"noData",null),e([o({type:String,json:{read:{reader:y.read},write:{writer:y.write}}})],d.prototype,"noDataInterpretation",null),e([o({json:{write:!0}})],d.prototype,"pixelType",void 0),e([o({json:{write:!0}})],d.prototype,"lercVersion",void 0),e([s("lercVersion")],d.prototype,"writeLercVersion",null),e([o({type:Number})],d.prototype,"version",null),e([o({json:{write:!0}})],d.prototype,"mosaicRule",null),e([o({json:{write:!0}})],d.prototype,"renderingRule",null),d=e([i("esri.layers.mixins.ExportImageServiceParameters")],d);export{d as ExportImageServiceParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as a}from"../../symbols.js";import s from"../../core/Collection.js";import l from"../../core/Error.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as y}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as m}from"../../core/sql.js";import{objectToQuery as h}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import{getProperties as g}from"../../core/accessorSupport/utils.js";import{cast as S}from"../../core/accessorSupport/decorators/cast.js";import{reader as I}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as j,ensureType as L,Integer as D,ensureClass as E}from"../../core/accessorSupport/ensureType.js";import{OriginId as O,nameToId as F}from"../../core/accessorSupport/PropertyOrigin.js";import{parse as P}from"./arcgisLayerUrl.js";import x from"./FeatureType.js";import _ from"./Field.js";import T from"./FieldsIndex.js";import N from"./LabelClass.js";import{validateLabelingInfo as M}from"./labelingInfo.js";import V from"./LayerFloorInfo.js";import{DataLayerSource as C}from"./source/DataLayerSource.js";import{MapLayerSource as A}from"./source/MapLayerSource.js";import U from"../../rest/support/Query.js";import{createPopupTemplate as R}from"../../support/popupUtils.js";import k from"../../geometry/Extent.js";import{featureGeometryTypeKebabDictionary as q}from"../../geometry/support/typeUtils.js";var J;function $(e){return e&&"esriSMS"===e.type}function B(e,r,t){const i=this.originIdOf(r)>=F(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function Q(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&this._isOverridden(r))}}function G(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function H(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(r)>=F(t.origin))}}let K=0;const W=new Set;W.add("layer"),W.add("parent"),W.add("loaded"),W.add("loadStatus"),W.add("loadError"),W.add("loadWarnings");let X=J=class extends(n(f(p(d)))){constructor(e){super(e),this.capabilities=void 0,this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.types=null}async load(e){return this.addResolvingPromise((async()=>{if(!this.layer&&!this.url)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let r=null;if(!this.layer||this.originIdOf("url")>O.SERVICE||"data-layer"===this.source?.type){r=(await o(this.url,{responseType:"json",query:{f:"json"},...e})).data}else{let t=this.id;"map-layer"===this.source?.type&&(t=this.source.mapLayerId),r=await this.layer.fetchSublayerInfo(t,e)}r&&(this.sourceJSON=r,this.read({layerDefinition:r},{origin:"service"}))})()),this}readCapabilities(e,r){const t=(e=(r=r.layerDefinition||r).capabilities||e)?e.toLowerCase().split(",").map((e=>e.trim())):[],i=this.url?P(this.url):null,o=t.includes(c(i)&&"MapServer"===i.serverType?"data":"query");return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:o}}}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get fieldsIndex(){return new T(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get id(){const e=this._get("id");return e??K++}set id(e){this._get("id")!==e&&(!1!==this.get("layer.capabilities.exportMap.supportsDynamicLayers")?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},i)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition&&r.layerDefinition.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition&&r.layerDefinition.maxScale||0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeOID"===t.type)return t.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const t=r.layerDefinition;return 1-.01*(null!=t.transparency?t.transparency:t.drawingInfo.transparency)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=j(this.parent.id):r.parentLayerId=-1}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){if(e)for(const r of e.getSymbols())if(a(r)){u.getLogger(this.declaredClass).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new A({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return L(s.ofType(J),e)}writeSublayers(e,r,t){this.get("sublayers.length")&&(r[t]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return null}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${h(t)}`}set url(e){e?this._override("url",e):this._clearOverride("url")}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=g(this),r=new J;return g(r).store=e.clone(W),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return R(this,e)}createQuery(){return new U({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=this.layer?.parsedUrl,r=new(0,(await import("../FeatureLayer.js")).default)({url:e.path});return e&&this.source&&("map-layer"===this.source.type?r.layerId=this.source.mapLayerId:r.dynamicDataSource=this.source),null!=this.layer.refreshInterval&&(r.refreshInterval=this.layer.refreshInterval),this.definitionExpression&&(r.definitionExpression=this.definitionExpression),this.floorInfo&&(r.floorInfo=y(this.floorInfo)),this.originIdOf("labelingInfo")>O.SERVICE&&(r.labelingInfo=y(this.labelingInfo)),this.originIdOf("labelsVisible")>O.DEFAULTS&&(r.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>O.DEFAULTS&&(r.legendEnabled=this.legendEnabled),this.originIdOf("visible")>O.DEFAULTS&&(r.visible=this.visible),this.originIdOf("minScale")>O.DEFAULTS&&(r.minScale=this.minScale),this.originIdOf("maxScale")>O.DEFAULTS&&(r.maxScale=this.maxScale),this.originIdOf("opacity")>O.DEFAULTS&&(r.opacity=this.opacity),this.originIdOf("popupTemplate")>O.DEFAULTS&&(r.popupTemplate=y(this.popupTemplate)),this.originIdOf("renderer")>O.SERVICE&&(r.renderer=y(this.renderer)),"data-layer"===this.source?.type&&(r.dynamicDataSource=this.source.clone()),this.originIdOf("title")>O.DEFAULTS&&(r.title=this.title),"map-image"===this.layer.type&&this.layer.originIdOf("customParameters")>O.DEFAULTS&&(r.customParameters=this.layer.customParameters),"tile"===this.layer.type&&this.layer.originIdOf("customParameters")>O.DEFAULTS&&(r.customParameters=this.layer.customParameters),r}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:t}=this;if(!r||!e)return null;const i=e.attributes?e.attributes[r]:void 0;if(null==i)return null;let o=null;return t.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const t=r&&r.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities?.operations?.supportsQuery)throw new l("Sublayer.queryFeatures","this layer doesn't support queries.");const[{executeQuery:t},{default:i}]=await Promise.all([import("../../rest/query/operations/query.js"),import("../../rest/support/FeatureSet.js")]),o=await t(this.url,U.from(e),this.layer?.spatialReference??null,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}}),a=i.fromJSON(o.data);if(a?.features)for(const s of a.features)s.sourceLayer=this;return a}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=m(e,this.definitionExpression);c(t)&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(i).some((e=>i[e]>O.SERVICE));if(o){const e=r.drawingInfo={};if(i.renderer>O.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>O.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>O.SERVICE){!this.loaded&&this.labelingInfo.some((e=>!e.labelPlacement))&&u.getLogger(this.declaredClass).warnOnce("A Sublayer that has not been loaded also has an undefined 'labelPlacement'. To ensure that labels display correctly, either load the layer or define a valid 'labelPlacement'. ",{layer:this});let r=this.labelingInfo;c(this.geometryType)&&(r=M(this.labelingInfo,q.toJSON(this.geometryType))),e.labelingInfo=r.filter((e=>e.labelPlacement)).map((e=>e.toJSON({origin:"service",layer:this.layer}))),e.showLabels=!0}i.opacity>O.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline&&e.outline.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const t="uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:[];for(const e of t)$(e.symbol)&&r(e.symbol);"symbol"in e&&$(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&$(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,a;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",a="supportsModification"}const s=g(this).getDefaultOrigin();if("service"!==s){if(o&&!1===this.get(`layer.capabilities.exportMap.${o}`))return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(a&&!1===this.get(`capabilities.exportMap.${a}`))return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${a}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==s&&i!==r&&t&&t.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.handles.removeAll()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.handles.add([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.get("layer.capabilities.exportMap.supportsSublayersChanges");null==r||r||(u.getLogger(this.declaredClass).error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){u.getLogger(this.declaredClass).error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${this.layer.id}'`,{reason:r,sublayer:this,layer:this.layer}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};X.test={isMapImageLayerOverridePolicy:e=>e===G||e===B,isTileImageLayerOverridePolicy:e=>e===Q},e([b({readOnly:!0})],X.prototype,"capabilities",void 0),e([I("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],X.prototype,"readCapabilities",null),e([b({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:B}}})],X.prototype,"definitionExpression",null),e([b({type:[_],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],X.prototype,"fields",void 0),e([b({readOnly:!0})],X.prototype,"fieldsIndex",null),e([b({type:V,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:B},origins:{"web-scene":{read:!1,write:!1}}}})],X.prototype,"floorInfo",null),e([b({type:k,json:{read:{source:"layerDefinition.extent"}}})],X.prototype,"fullExtent",void 0),e([b({type:q.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:q.read}}}}})],X.prototype,"geometryType",void 0),e([b({type:String})],X.prototype,"globalIdField",void 0),e([I("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],X.prototype,"readGlobalIdFieldFromService",null),e([b({type:D,json:{write:{ignoreOrigin:!0}}})],X.prototype,"id",null),e([b({value:null,type:[N],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:G}}})],X.prototype,"labelingInfo",null),e([w("labelingInfo")],X.prototype,"writeLabelingInfo",null),e([b({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:G}}})],X.prototype,"labelsVisible",null),e([b({value:null})],X.prototype,"layer",null),e([b({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:H}}})],X.prototype,"legendEnabled",void 0),e([b({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],X.prototype,"listMode",null),e([b({type:Number,value:0,json:{write:{overridePolicy:G}}})],X.prototype,"minScale",null),e([I("minScale",["minScale","layerDefinition.minScale"])],X.prototype,"readMinScale",null),e([b({type:Number,value:0,json:{write:{overridePolicy:G}}})],X.prototype,"maxScale",null),e([I("maxScale",["maxScale","layerDefinition.maxScale"])],X.prototype,"readMaxScale",null),e([b({readOnly:!0})],X.prototype,"effectiveScaleRange",null),e([b({type:String})],X.prototype,"objectIdField",void 0),e([I("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],X.prototype,"readObjectIdFieldFromService",null),e([b({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:G}}})],X.prototype,"opacity",null),e([I("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],X.prototype,"readOpacity",null),e([w("opacity")],X.prototype,"writeOpacity",null),e([b({json:{type:D,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:G}}})],X.prototype,"parent",void 0),e([w("parent")],X.prototype,"writeParent",null),e([b({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:H,writer(e,r,t){r[t]=!e}}}})],X.prototype,"popupEnabled",void 0),e([b({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:H}}})],X.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],X.prototype,"defaultPopupTemplate",null),e([b({types:t,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:G},origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:G}}}}})],X.prototype,"renderer",null),e([b({types:{key:"type",base:null,typeMap:{"data-layer":C,"map-layer":A}},cast(e){if(e){if("mapLayerId"in e)return E(A,e);if("dataSource"in e)return E(C,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:G}}})],X.prototype,"source",null),e([b()],X.prototype,"sourceJSON",void 0),e([b({value:null,json:{type:[D],write:{target:"subLayerIds",allowNull:!0,overridePolicy:G}}})],X.prototype,"sublayers",null),e([S("sublayers")],X.prototype,"castSublayers",null),e([w("sublayers")],X.prototype,"writeSublayers",null),e([b({type:String,json:{name:"name",write:{overridePolicy:H}}})],X.prototype,"title",void 0),e([b({type:String})],X.prototype,"typeIdField",void 0),e([I("typeIdField",["layerDefinition.typeIdField"])],X.prototype,"readTypeIdField",null),e([b({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],X.prototype,"types",void 0),e([b({type:String,json:{read:{source:"layerUrl"},write:{target:"layerUrl",overridePolicy:Q}}})],X.prototype,"url",null),e([b({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:G}}})],X.prototype,"visible",null),e([w("visible")],X.prototype,"writeVisible",null),X=J=e([v("esri.layers.support.Sublayer")],X);const z=X;export{z as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as t,webSceneRendererTypes as i}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as a}from"../../symbols.js";import s from"../../core/Collection.js";import l from"../../core/Error.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as y}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as m}from"../../core/sql.js";import{objectToQuery as h}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import{getProperties as g}from"../../core/accessorSupport/utils.js";import{cast as S}from"../../core/accessorSupport/decorators/cast.js";import{reader as I}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as j,ensureType as L,Integer as D,ensureClass as E}from"../../core/accessorSupport/ensureType.js";import{OriginId as O,nameToId as F}from"../../core/accessorSupport/PropertyOrigin.js";import{parse as P}from"./arcgisLayerUrl.js";import x from"./FeatureType.js";import _ from"./Field.js";import T from"./FieldsIndex.js";import N from"./LabelClass.js";import{validateLabelingInfo as M}from"./labelingInfo.js";import V from"./LayerFloorInfo.js";import{DataLayerSource as C}from"./source/DataLayerSource.js";import{MapLayerSource as A}from"./source/MapLayerSource.js";import U from"../../rest/support/Query.js";import{createPopupTemplate as R}from"../../support/popupUtils.js";import k from"../../geometry/Extent.js";import{featureGeometryTypeKebabDictionary as q}from"../../geometry/support/typeUtils.js";var $;function J(e){return e&&"esriSMS"===e.type}function B(e,r,t){const i=this.originIdOf(r)>=F(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&("map-image"===t.layer?.type&&(t.writeSublayerStructure||i))}}function Q(e,r,t){return{enabled:!!t&&("tile"===t.layer?.type&&this._isOverridden(r))}}function G(e,r,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function H(e,r,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(r)>=F(t.origin))}}let K=0;const W=new Set;W.add("layer"),W.add("parent"),W.add("loaded"),W.add("loadStatus"),W.add("loadError"),W.add("loadWarnings");let X=$=class extends(n(f(p(d)))){constructor(e){super(e),this.capabilities=void 0,this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.types=null}async load(e){return this.addResolvingPromise((async()=>{if(!this.layer&&!this.url)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let r=null;if(!this.layer||this.originIdOf("url")>O.SERVICE||"data-layer"===this.source?.type){r=(await o(this.url,{responseType:"json",query:{f:"json"},...e})).data}else{let t=this.id;"map-layer"===this.source?.type&&(t=this.source.mapLayerId),r=await this.layer.fetchSublayerInfo(t,e)}r&&(this.sourceJSON=r,this.read({layerDefinition:r},{origin:"service"}))})()),this}readCapabilities(e,r){const t=(e=(r=r.layerDefinition||r).capabilities||e)?e.toLowerCase().split(",").map((e=>e.trim())):[],i=this.url?P(this.url):null,o=t.includes(c(i)&&"MapServer"===i.serverType?"data":"query");return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:o}}}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get fieldsIndex(){return new T(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeGlobalID"===t.type)return t.name}get id(){const e=this._get("id");return e??K++}set id(e){this._get("id")!==e&&(!1!==this.get("layer.capabilities.exportMap.supportsDynamicLayers")?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,t,i){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},i)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition&&r.layerDefinition.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition&&r.layerDefinition.maxScale||0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const t of r.fields)if("esriFieldTypeOID"===t.type)return t.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const t=r.layerDefinition;return 1-.01*(null!=t.transparency?t.transparency:t.drawingInfo.transparency)}writeOpacity(e,r,t,i){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=j(this.parent.id):r.parentLayerId=-1}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){if(e)for(const r of e.getSymbols())if(a(r)){u.getLogger(this.declaredClass).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new A({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return L(s.ofType($),e)}writeSublayers(e,r,t){this.get("sublayers.length")&&(r[t]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTypeIdField(e,r){let t=(r=r.layerDefinition||r).typeIdField;if(t&&r.fields){t=t.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===t));e&&(t=e.name)}return null}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${h(t)}`}set url(e){e?this._override("url",e):this._clearOverride("url")}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,t,i){r[t]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=g(this),r=new $;return g(r).store=e.clone(W),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return R(this,e)}createQuery(){return new U({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=this.layer?.parsedUrl,r=new(0,(await import("../FeatureLayer.js")).default)({url:e.path});return e&&this.source&&("map-layer"===this.source.type?r.layerId=this.source.mapLayerId:r.dynamicDataSource=this.source),null!=this.layer.refreshInterval&&(r.refreshInterval=this.layer.refreshInterval),this.definitionExpression&&(r.definitionExpression=this.definitionExpression),this.floorInfo&&(r.floorInfo=y(this.floorInfo)),this.originIdOf("labelingInfo")>O.SERVICE&&(r.labelingInfo=y(this.labelingInfo)),this.originIdOf("labelsVisible")>O.DEFAULTS&&(r.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>O.DEFAULTS&&(r.legendEnabled=this.legendEnabled),this.originIdOf("visible")>O.DEFAULTS&&(r.visible=this.visible),this.originIdOf("minScale")>O.DEFAULTS&&(r.minScale=this.minScale),this.originIdOf("maxScale")>O.DEFAULTS&&(r.maxScale=this.maxScale),this.originIdOf("opacity")>O.DEFAULTS&&(r.opacity=this.opacity),this.originIdOf("popupTemplate")>O.DEFAULTS&&(r.popupTemplate=y(this.popupTemplate)),this.originIdOf("renderer")>O.SERVICE&&(r.renderer=y(this.renderer)),"data-layer"===this.source?.type&&(r.dynamicDataSource=this.source.clone()),this.originIdOf("title")>O.DEFAULTS&&(r.title=this.title),"map-image"===this.layer.type&&this.layer.originIdOf("customParameters")>O.DEFAULTS&&(r.customParameters=this.layer.customParameters),"tile"===this.layer.type&&this.layer.originIdOf("customParameters")>O.DEFAULTS&&(r.customParameters=this.layer.customParameters),r}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:t}=this;if(!r||!e)return null;const i=e.attributes?e.attributes[r]:void 0;if(null==i)return null;let o=null;return t.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===i.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const t=r&&r.feature,i=this.getFeatureType(t);if(i){const r=i.domains&&i.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.capabilities?.operations?.supportsQuery)throw new l("Sublayer.queryFeatures","this layer doesn't support queries.");const[{executeQuery:t},{default:i}]=await Promise.all([import("../../rest/query/operations/query.js"),import("../../rest/support/FeatureSet.js")]),o=await t(this.url,U.from(e),this.layer?.spatialReference??null,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}}),a=i.fromJSON(o.data);if(a?.features)for(const s of a.features)s.sourceLayer=this;return a}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},t=m(e,this.definitionExpression);c(t)&&(r.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(i).some((e=>i[e]>O.SERVICE));if(o){const e=r.drawingInfo={};if(i.renderer>O.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>O.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>O.SERVICE){!this.loaded&&this.labelingInfo.some((e=>!e.labelPlacement))&&u.getLogger(this.declaredClass).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let r=this.labelingInfo;c(this.geometryType)&&(r=M(this.labelingInfo,q.toJSON(this.geometryType))),e.labelingInfo=r.filter((e=>e.labelPlacement)).map((e=>e.toJSON({origin:"service",layer:this.layer}))),e.showLabels=!0}i.opacity>O.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline&&e.outline.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const t="uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:[];for(const e of t)J(e.symbol)&&r(e.symbol);"symbol"in e&&J(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&J(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const t=this.layer,i=this._get(e);let o,a;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",a="supportsModification"}const s=g(this).getDefaultOrigin();if("service"!==s){if(o&&!1===this.get(`layer.capabilities.exportMap.${o}`))return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(a&&!1===this.get(`capabilities.exportMap.${a}`))return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${a}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==s&&i!==r&&t&&t.emit&&t.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.handles.removeAll()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.handles.add([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.get("layer.capabilities.exportMap.supportsSublayersChanges");null==r||r||(u.getLogger(this.declaredClass).error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){u.getLogger(this.declaredClass).error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${this.layer.id}'`,{reason:r,sublayer:this,layer:this.layer}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};X.test={isMapImageLayerOverridePolicy:e=>e===G||e===B,isTileImageLayerOverridePolicy:e=>e===Q},e([b({readOnly:!0})],X.prototype,"capabilities",void 0),e([I("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],X.prototype,"readCapabilities",null),e([b({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:B}}})],X.prototype,"definitionExpression",null),e([b({type:[_],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],X.prototype,"fields",void 0),e([b({readOnly:!0})],X.prototype,"fieldsIndex",null),e([b({type:V,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:B},origins:{"web-scene":{read:!1,write:!1}}}})],X.prototype,"floorInfo",null),e([b({type:k,json:{read:{source:"layerDefinition.extent"}}})],X.prototype,"fullExtent",void 0),e([b({type:q.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:q.read}}}}})],X.prototype,"geometryType",void 0),e([b({type:String})],X.prototype,"globalIdField",void 0),e([I("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],X.prototype,"readGlobalIdFieldFromService",null),e([b({type:D,json:{write:{ignoreOrigin:!0}}})],X.prototype,"id",null),e([b({value:null,type:[N],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:G}}})],X.prototype,"labelingInfo",null),e([w("labelingInfo")],X.prototype,"writeLabelingInfo",null),e([b({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:G}}})],X.prototype,"labelsVisible",null),e([b({value:null})],X.prototype,"layer",null),e([b({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:H}}})],X.prototype,"legendEnabled",void 0),e([b({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],X.prototype,"listMode",null),e([b({type:Number,value:0,json:{write:{overridePolicy:G}}})],X.prototype,"minScale",null),e([I("minScale",["minScale","layerDefinition.minScale"])],X.prototype,"readMinScale",null),e([b({type:Number,value:0,json:{write:{overridePolicy:G}}})],X.prototype,"maxScale",null),e([I("maxScale",["maxScale","layerDefinition.maxScale"])],X.prototype,"readMaxScale",null),e([b({readOnly:!0})],X.prototype,"effectiveScaleRange",null),e([b({type:String})],X.prototype,"objectIdField",void 0),e([I("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],X.prototype,"readObjectIdFieldFromService",null),e([b({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:G}}})],X.prototype,"opacity",null),e([I("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],X.prototype,"readOpacity",null),e([w("opacity")],X.prototype,"writeOpacity",null),e([b({json:{type:D,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:G}}})],X.prototype,"parent",void 0),e([w("parent")],X.prototype,"writeParent",null),e([b({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:H,writer(e,r,t){r[t]=!e}}}})],X.prototype,"popupEnabled",void 0),e([b({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:H}}})],X.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],X.prototype,"defaultPopupTemplate",null),e([b({types:t,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:G},origins:{"web-scene":{types:i,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:G}}}}})],X.prototype,"renderer",null),e([b({types:{key:"type",base:null,typeMap:{"data-layer":C,"map-layer":A}},cast(e){if(e){if("mapLayerId"in e)return E(A,e);if("dataSource"in e)return E(C,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:G}}})],X.prototype,"source",null),e([b()],X.prototype,"sourceJSON",void 0),e([b({value:null,json:{type:[D],write:{target:"subLayerIds",allowNull:!0,overridePolicy:G}}})],X.prototype,"sublayers",null),e([S("sublayers")],X.prototype,"castSublayers",null),e([w("sublayers")],X.prototype,"writeSublayers",null),e([b({type:String,json:{name:"name",write:{overridePolicy:H}}})],X.prototype,"title",void 0),e([b({type:String})],X.prototype,"typeIdField",void 0),e([I("typeIdField",["layerDefinition.typeIdField"])],X.prototype,"readTypeIdField",null),e([b({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],X.prototype,"types",void 0),e([b({type:String,json:{read:{source:"layerUrl"},write:{target:"layerUrl",overridePolicy:Q}}})],X.prototype,"url",null),e([b({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:G}}})],X.prototype,"visible",null),e([w("visible")],X.prototype,"writeVisible",null),X=$=e([v("esri.layers.support.Sublayer")],X);const z=X;export{z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{isNone as r}from"../../core/maybe.js";import{getMetersPerUnitForSR as s}from"../../core/unitUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{Integer as l}from"../../core/accessorSupport/ensureType.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import c from"../../geometry/Point.js";import u from"../../geometry/SpatialReference.js";import{create as f}from"../../geometry/support/aaBoundingRect.js";import{isValid as h,getInfo as m,isGeographic as d,equals as g}from"../../geometry/support/spatialReferenceUtils.js";import{project as y}from"../../geometry/support/webMercatorUtils.js";import v from"./LOD.js";var w;const x=new t({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let O=w=class extends o{constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.minScale=0,this.maxScale=0,this.size=null,this.spatialReference=null}static create(e={}){const{resolutionFactor:t=1,scales:o,size:r=256,spatialReference:i=u.WebMercator,numLODs:l=24}=e;if(!h(i)){const e=[];if(o)for(let t=0;t<o.length;t++){const r=o[t];e.push({level:t,scale:r,resolution:r})}else{let t=5e-4;for(let o=l-1;o>=0;o--)e.unshift({level:o,scale:t,resolution:t}),t*=2}return new w({dpi:96,lods:e,origin:new c(0,0,i),size:[r,r],spatialReference:i})}const n=m(i),a=e.origin?new c({x:e.origin.x,y:e.origin.y,spatialReference:i}):new c(n?{x:n.origin[0],y:n.origin[1],spatialReference:i}:{x:0,y:0,spatialReference:i}),p=96,f=1/(s(i)*39.37*p),g=[];if(o)for(let s=0;s<o.length;s++){const e=o[s],t=e*f;g.push({level:s,scale:e,resolution:t})}else{let e=d(i)?512/r*591657527.5917094:256/r*591657527.591555;const o=Math.ceil(l/t);g.push({level:0,scale:e,resolution:e*f});for(let r=1;r<o;r++){const o=e/2**t,s=o*f;g.push({level:r,scale:o,resolution:s}),e=o}}return new w({dpi:p,lods:g,origin:a,size:[r,r],spatialReference:i})}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const o=m(e);return e.isWrappable&&Math.abs(o.origin[0]-t.x)<=o.dx}return!1}readOrigin(e,t){return c.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,o=0;const r=[];this._levelToLOD={},e&&(t=-1/0,o=1/0,e.forEach((e=>{r.push(e.scale),t=e.scale>t?e.scale:t,o=e.scale<o?e.scale:o,this._levelToLOD[e.level]=e}))),this._set("scales",r),this._set("minScale",t),this._set("maxScale",o),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const o=Math.floor(e),r=o+1;return t[o]/(t[o]/t[r])**(e-o)}scaleToZoom(e){const t=this.scales,o=t.length-1;let r=0;for(;r<o;r++){const o=t[r],s=t[r+1];if(o<=e)return r;if(s===e)return r+1;if(o>e&&s<e)return r+Math.log(o/e)/Math.log(o/s)}return r}snapScale(e,t=.95){const o=this.scaleToZoom(e);return o%Math.floor(o)>=t?this.zoomToScale(Math.ceil(o)):this.zoomToScale(Math.floor(o))}tileAt(e,t,o,s){const i=this.lodAt(e);if(!i)return null;let l,n;if("number"==typeof t)l=t,n=o;else if(g(t.spatialReference,this.spatialReference))l=t.x,n=t.y,s=o;else{const e=y(t,this.spatialReference);if(r(e))return null;l=e.x,n=e.y,s=o}const a=i.resolution*this.size[0],p=i.resolution*this.size[1];return s||(s={id:null,level:0,row:0,col:0,extent:f()}),s.level=e,s.row=Math.floor((this.origin.y-n)/p+.001),s.col=Math.floor((l-this.origin.x)/a+.001),this.updateTileInfo(s),s}updateTileInfo(e,t=w.ExtrapolateOptions.NONE){let o=this.lodAt(e.level);if(!o&&t===w.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(o=t)}if(!o)return;const r=e.level-o.level,s=o.resolution*this.size[0]/2**r,i=o.resolution*this.size[1]/2**r;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=f()),e.extent[0]=this.origin.x+e.col*s,e.extent[1]=this.origin.y-(e.row+1)*i,e.extent[2]=e.extent[0]+s,e.extent[3]=e.extent[1]+i}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel)&&(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),!0)}getTileBounds(e,t){const{resolution:o}=this.lodAt(t.level),r=o*this.size[0],s=o*this.size[1];return e[0]=this.origin.x+t.col*r,e[1]=this.origin.y-(t.row+1)*s,e[2]=e[0]+r,e[3]=e[1]+s,e}lodAt(e){return this._levelToLOD&&this._levelToLOD[e]||null}clone(){return w.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const o=[],r=this.lods.length;for(let s=0;s<r;s++){const e=this.lods[s],r=e.resolution*t;o.push(new v({level:e.level,scale:e.scale,resolution:r}))}return new w({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:o})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let o=0;o<e.length;o++){const r=e[o];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};e([i({type:Number,json:{write:!0}})],O.prototype,"compressionQuality",void 0),e([i({type:Number,json:{write:!0}})],O.prototype,"dpi",void 0),e([i({type:String,json:{read:x.read,write:x.write,origins:{"web-scene":{read:!1,write:!1}}}})],O.prototype,"format",void 0),e([i({readOnly:!0})],O.prototype,"isWrappable",null),e([i({type:c,json:{write:!0}})],O.prototype,"origin",void 0),e([n("origin")],O.prototype,"readOrigin",null),e([i({type:[v],value:null,json:{write:!0}})],O.prototype,"lods",null),e([i({readOnly:!0})],O.prototype,"minScale",void 0),e([i({readOnly:!0})],O.prototype,"maxScale",void 0),e([i({readOnly:!0})],O.prototype,"scales",void 0),e([i({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],O.prototype,"size",void 0),e([n("size",["rows","cols"])],O.prototype,"readSize",null),e([p("size",{cols:{type:l},rows:{type:l}})],O.prototype,"writeSize",null),e([i({type:u,json:{write:!0}})],O.prototype,"spatialReference",void 0),O=w=e([a("esri.layers.support.TileInfo")],O),function(e){var t;(t=e.ExtrapolateOptions||(e.ExtrapolateOptions={}))[t.NONE=0]="NONE",t[t.POWER_OF_TWO=1]="POWER_OF_TWO"}(O||(O={}));const S=O;export{S as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{JSONMap as t}from"../../core/jsonMap.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{isNone as r}from"../../core/maybe.js";import{getMetersPerUnitForSR as s}from"../../core/unitUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{Integer as l}from"../../core/accessorSupport/ensureType.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import c from"../../geometry/Point.js";import u from"../../geometry/SpatialReference.js";import{create as f}from"../../geometry/support/aaBoundingRect.js";import{isValid as h,getInfo as m,isGeographic as d,equals as y}from"../../geometry/support/spatialReferenceUtils.js";import{project as g}from"../../geometry/support/webMercatorUtils.js";import v from"./LOD.js";import{TileKey as w}from"./TileKey.js";var O;const x=new t({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let j=O=class extends o{constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.minScale=0,this.maxScale=0,this.size=null,this.spatialReference=null}static create(e={}){const{resolutionFactor:t=1,scales:o,size:r=256,spatialReference:i=u.WebMercator,numLODs:l=24}=e;if(!h(i)){const e=[];if(o)for(let t=0;t<o.length;t++){const r=o[t];e.push({level:t,scale:r,resolution:r})}else{let t=5e-4;for(let o=l-1;o>=0;o--)e.unshift({level:o,scale:t,resolution:t}),t*=2}return new O({dpi:96,lods:e,origin:new c(0,0,i),size:[r,r],spatialReference:i})}const n=m(i),a=e.origin?new c({x:e.origin.x,y:e.origin.y,spatialReference:i}):new c(n?{x:n.origin[0],y:n.origin[1],spatialReference:i}:{x:0,y:0,spatialReference:i}),p=96,f=1/(s(i)*39.37*p),y=[];if(o)for(let s=0;s<o.length;s++){const e=o[s],t=e*f;y.push({level:s,scale:e,resolution:t})}else{let e=d(i)?512/r*591657527.5917094:256/r*591657527.591555;const o=Math.ceil(l/t);y.push({level:0,scale:e,resolution:e*f});for(let r=1;r<o;r++){const o=e/2**t,s=o*f;y.push({level:r,scale:o,resolution:s}),e=o}}return new O({dpi:p,lods:y,origin:a,size:[r,r],spatialReference:i})}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const o=m(e);return e.isWrappable&&Math.abs(o.origin[0]-t.x)<=o.dx}return!1}readOrigin(e,t){return c.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,o=0;const r=[];this._levelToLOD={},e&&(t=-1/0,o=1/0,e.forEach((e=>{r.push(e.scale),t=e.scale>t?e.scale:t,o=e.scale<o?e.scale:o,this._levelToLOD[e.level]=e}))),this._set("scales",r),this._set("minScale",t),this._set("maxScale",o),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const o=Math.floor(e),r=o+1;return t[o]/(t[o]/t[r])**(e-o)}scaleToZoom(e){const t=this.scales,o=t.length-1;let r=0;for(;r<o;r++){const o=t[r],s=t[r+1];if(o<=e)return r;if(s===e)return r+1;if(o>e&&s<e)return r+Math.log(o/e)/Math.log(o/s)}return r}snapScale(e,t=.95){const o=this.scaleToZoom(e);return o%Math.floor(o)>=t?this.zoomToScale(Math.ceil(o)):this.zoomToScale(Math.floor(o))}tileAt(e,t,o,s){const i=this.lodAt(e);if(!i)return null;let l,n;if("number"==typeof t)l=t,n=o;else if(y(t.spatialReference,this.spatialReference))l=t.x,n=t.y,s=o;else{const e=g(t,this.spatialReference);if(r(e))return null;l=e.x,n=e.y,s=o}const a=i.resolution*this.size[0],p=i.resolution*this.size[1];return s||(s=new w(null,0,0,0,f())),s.level=e,s.row=Math.floor((this.origin.y-n)/p+.001),s.col=Math.floor((l-this.origin.x)/a+.001),this.updateTileInfo(s),s}updateTileInfo(e,t=O.ExtrapolateOptions.NONE){let o=this.lodAt(e.level);if(!o&&t===O.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(o=t)}if(!o)return;const r=e.level-o.level,s=o.resolution*this.size[0]/2**r,i=o.resolution*this.size[1]/2**r;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=f()),e.extent[0]=this.origin.x+e.col*s,e.extent[1]=this.origin.y-(e.row+1)*i,e.extent[2]=e.extent[0]+s,e.extent[3]=e.extent[1]+i}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel)&&(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),!0)}getTileBounds(e,t){const{resolution:o}=this.lodAt(t.level),r=o*this.size[0],s=o*this.size[1];return e[0]=this.origin.x+t.col*r,e[1]=this.origin.y-(t.row+1)*s,e[2]=e[0]+r,e[3]=e[1]+s,e}lodAt(e){return this._levelToLOD&&this._levelToLOD[e]||null}clone(){return O.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const o=[],r=this.lods.length;for(let s=0;s<r;s++){const e=this.lods[s],r=e.resolution*t;o.push(new v({level:e.level,scale:e.scale,resolution:r}))}return new O({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:o})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let o=0;o<e.length;o++){const r=e[o];this._upsampleLevels[r.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/r.resolution:0},t=r}}};e([i({type:Number,json:{write:!0}})],j.prototype,"compressionQuality",void 0),e([i({type:Number,json:{write:!0}})],j.prototype,"dpi",void 0),e([i({type:String,json:{read:x.read,write:x.write,origins:{"web-scene":{read:!1,write:!1}}}})],j.prototype,"format",void 0),e([i({readOnly:!0})],j.prototype,"isWrappable",null),e([i({type:c,json:{write:!0}})],j.prototype,"origin",void 0),e([n("origin")],j.prototype,"readOrigin",null),e([i({type:[v],value:null,json:{write:!0}})],j.prototype,"lods",null),e([i({readOnly:!0})],j.prototype,"minScale",void 0),e([i({readOnly:!0})],j.prototype,"maxScale",void 0),e([i({readOnly:!0})],j.prototype,"scales",void 0),e([i({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],j.prototype,"size",void 0),e([n("size",["rows","cols"])],j.prototype,"readSize",null),e([p("size",{cols:{type:l},rows:{type:l}})],j.prototype,"writeSize",null),e([i({type:u,json:{write:!0}})],j.prototype,"spatialReference",void 0),j=O=e([a("esri.layers.support.TileInfo")],j),function(e){var t;(t=e.ExtrapolateOptions||(e.ExtrapolateOptions={}))[t.NONE=0]="NONE",t[t.POWER_OF_TWO=1]="POWER_OF_TWO"}(j||(j={}));const S=j;export{S as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
+ */
5
+ class t{constructor(t,s,i,e,h){this.id=t,this.level=s,this.row=i,this.col=e,this.extent=h}}export{t as TileKey};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import i from"../../core/Accessor.js";import{ByteSizeUnit as r}from"../../core/byteSizeEstimations.js";import l from"../../core/Error.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import a from"../../core/Logger.js";import o from"../../core/LRUCache.js";import n from"../../core/PooledArray.js";import{onAbort as c,isAbortError as h,isAborted as p,createAbortError as m}from"../../core/promiseUtils.js";import{watch as f,syncAndInitial as u}from"../../core/reactiveUtils.js";import{waitTicks as v}from"../../core/scheduling.js";import{objectToQuery as y}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as d}from"../../core/accessorSupport/decorators/cast.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{tilemapDefinitionId as g,Tilemap as w}from"./Tilemap.js";var T;let j=T=class extends(s(i)){constructor(e){super(e),this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2*r.MEGABYTES,this.request=t,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new o(this.cacheByteSize),this.addHandles([f((()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]}),(()=>this._initializeTilemapDefinition())),f((()=>this.layer?.tileInfo?.lods),(e=>this._initializeAvailableLevels(e)),u)]),this._initializeTilemapDefinition()}castLevels(e){return e<=2?(a.getLogger(this.declaredClass).error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<<this.levels}fetchTilemap(e,t,i,r){if(!this._availableLevels[e])return Promise.reject(new l("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const s=this._tmpTilemapDefinition,a=this._tilemapFromCache(e,t,i,s);if(a)return Promise.resolve(a);const o=r&&r.signal;return r={...r,signal:null},new Promise(((e,t)=>{c(o,(()=>t(m())));const i=g(s);let l=this._pendingTilemapRequests[i];if(!l){l=w.fromDefinition(s,r).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=l,l.then(e,e)}l.then(e,t)}))}getAvailability(e,t,i){if(!this._availableLevels[e])return"unavailable";const r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return this._availableLevels[e]?this.fetchTilemap(e,t,i,r).catch((e=>e)).then((r=>{if(r instanceof w){const s=r.getAvailability(t,i);if("unavailable"===s)throw new l("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return s}if(h(r))throw r;return"unknown"})):Promise.reject(new l("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`))}fetchAvailabilityUpsample(e,t,i,r,l){r.level=e,r.row=t,r.col=i;const s=this.layer.tileInfo;s.updateTileInfo(r);const a=this.fetchAvailability(e,t,i,l).catch((e=>{if(h(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r);throw e}));return this._fetchAvailabilityUpsamplePrefetch(r.id,e,t,i,l,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,l,s){if(!this._prefetchingEnabled)return;const a=`prefetch-${e}`;if(this.handles.has(a))return;const o=new AbortController;s.then((()=>o.abort()),(()=>o.abort()));let n=!1;const c={remove(){n||(n=!0,o.abort())}};if(this.handles.add(c,a),await v(10,o.signal).catch((()=>{})),n||(n=!0,this.handles.remove(a)),p(o))return;const h={id:e,level:t,row:i,col:r},m={...l,signal:o.signal},f=this.layer.tileInfo;for(let p=0;T._prefetches.length<T._maxPrefetch&&f.upsampleTile(h);++p){const e=this.fetchAvailability(h.level,h.row,h.col,m);T._prefetches.push(e);const t=()=>{T._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:y({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request,type:this.layer.type},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;const l=g(r);return this._tilemapCache.get(l)}_initializeAvailableLevels(e){this._availableLevels={},e&&e.forEach((e=>this._availableLevels[e.level]=!0))}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,r)=>!!e._tilemapFromCache(t,i,r,e._tmpTilemapDefinition)}}};j._maxPrefetch=4,j._prefetches=new n({initialSize:T._maxPrefetch}),e([b({constructOnly:!0,type:Number})],j.prototype,"levels",void 0),e([d("levels")],j.prototype,"castLevels",null),e([b({readOnly:!0,type:Number})],j.prototype,"size",null),e([b({constructOnly:!0,type:Number})],j.prototype,"cacheByteSize",void 0),e([b({constructOnly:!0})],j.prototype,"layer",void 0),e([b({constructOnly:!0})],j.prototype,"request",void 0),j=T=e([_("esri.layers.support.TilemapCache")],j);export{j as TilemapCache};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import i from"../../core/Accessor.js";import{ByteSizeUnit as r}from"../../core/byteSizeEstimations.js";import s from"../../core/Error.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import a from"../../core/Logger.js";import o from"../../core/LRUCache.js";import n from"../../core/PooledArray.js";import{onAbort as c,isAbortError as h,isAborted as p,createAbortError as m}from"../../core/promiseUtils.js";import{watch as f,syncAndInitial as u}from"../../core/reactiveUtils.js";import{waitTicks as v}from"../../core/scheduling.js";import{objectToQuery as y}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as d}from"../../core/accessorSupport/decorators/cast.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{TileKey as g}from"./TileKey.js";import{tilemapDefinitionId as w,Tilemap as T}from"./Tilemap.js";var j;let z=j=class extends(l(i)){constructor(e){super(e),this._pendingTilemapRequests={},this._availableLevels={},this.levels=5,this.cacheByteSize=2*r.MEGABYTES,this.request=t,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new o(this.cacheByteSize),this.addHandles([f((()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]}),(()=>this._initializeTilemapDefinition())),f((()=>this.layer?.tileInfo?.lods),(e=>this._initializeAvailableLevels(e)),u)]),this._initializeTilemapDefinition()}castLevels(e){return e<=2?(a.getLogger(this.declaredClass).error("Minimum levels for Tilemap is 3, but got ",e),3):e}get size(){return 1<<this.levels}fetchTilemap(e,t,i,r){if(!this._availableLevels[e])return Promise.reject(new s("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const l=this._tmpTilemapDefinition,a=this._tilemapFromCache(e,t,i,l);if(a)return Promise.resolve(a);const o=r&&r.signal;return r={...r,signal:null},new Promise(((e,t)=>{c(o,(()=>t(m())));const i=w(l);let s=this._pendingTilemapRequests[i];if(!s){s=T.fromDefinition(l,r).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>delete this._pendingTilemapRequests[i];this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)}))}getAvailability(e,t,i){if(!this._availableLevels[e])return"unavailable";const r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return this._availableLevels[e]?this.fetchTilemap(e,t,i,r).catch((e=>e)).then((r=>{if(r instanceof T){const l=r.getAvailability(t,i);if("unavailable"===l)throw new s("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return l}if(h(r))throw r;return"unknown"})):Promise.reject(new s("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`))}fetchAvailabilityUpsample(e,t,i,r,s){r.level=e,r.row=t,r.col=i;const l=this.layer.tileInfo;l.updateTileInfo(r);const a=this.fetchAvailability(e,t,i,s).catch((e=>{if(h(e))throw e;if(l.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r);throw e}));return this._fetchAvailabilityUpsamplePrefetch(r.id,e,t,i,s,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,s,l){if(!this._prefetchingEnabled)return;const a=`prefetch-${e}`;if(this.handles.has(a))return;const o=new AbortController;l.then((()=>o.abort()),(()=>o.abort()));let n=!1;const c={remove(){n||(n=!0,o.abort())}};if(this.handles.add(c,a),await v(10,o.signal).catch((()=>{})),n||(n=!0,this.handles.remove(a)),p(o))return;const h=new g(e,t,i,r),m={...s,signal:o.signal},f=this.layer.tileInfo;for(let p=0;j._prefetches.length<j._maxPrefetch&&f.upsampleTile(h);++p){const e=this.fetchAvailability(h.level,h.row,h.col,m);j._prefetches.push(e);const t=()=>{j._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:y({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request,type:this.layer.type},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;const s=w(r);return this._tilemapCache.get(s)}_initializeAvailableLevels(e){this._availableLevels={},e&&e.forEach((e=>this._availableLevels[e.level]=!0))}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,r)=>!!e._tilemapFromCache(t,i,r,e._tmpTilemapDefinition)}}};z._maxPrefetch=4,z._prefetches=new n({initialSize:j._maxPrefetch}),e([b({constructOnly:!0,type:Number})],z.prototype,"levels",void 0),e([d("levels")],z.prototype,"castLevels",null),e([b({readOnly:!0,type:Number})],z.prototype,"size",null),e([b({constructOnly:!0,type:Number})],z.prototype,"cacheByteSize",void 0),e([b({constructOnly:!0})],z.prototype,"layer",void 0),e([b({constructOnly:!0})],z.prototype,"request",void 0),z=j=e([_("esri.layers.support.TilemapCache")],z);export{z as TilemapCache};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.25.0-next.20220708",
3
+ "version": "4.25.0-next.20220711",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS API for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import{clone as o}from"../core/lang.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/accessorSupport/ensureType.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as l}from"../layers/support/fieldUtils.js";import p from"./Renderer.js";import{VisualVariablesMixin as a}from"./mixins/VisualVariablesMixin.js";import u from"./support/AttributeColorInfo.js";import d from"./support/DotDensityLegendOptions.js";import c from"../symbols/SimpleFillSymbol.js";import h from"../symbols/SimpleLineSymbol.js";var m;let y=m=class extends(a(p)){constructor(e){super(e),this.attributes=null,this.backgroundColor=new t([0,0,0,0]),this.blendDots=!0,this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new h,this.dotValue=null,this.referenceDotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(e){if(null==this.referenceScale)return this.dotValue;const t=e/this.referenceScale*this.dotValue;return t<1?1:t}getSymbol(){return new c({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol()]}getAttributeHash(){return this.attributes&&this.attributes.reduce(((e,t)=>e+t.getAttributeHash()),"")}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new m({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),visualVariables:o(this.visualVariables),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}getControllerHash(){return`${this.attributes.map((e=>e.field||e.valueExpression||""))}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const o of this.attributes)o.valueExpression&&await l(e,t,o.valueExpression),o.field&&e.add(o.field)}};e([s({type:[u],json:{write:!0}})],y.prototype,"attributes",void 0),e([s({type:t,json:{write:!0}})],y.prototype,"backgroundColor",void 0),e([s({type:Boolean}),r("dotBlendingEnabled")],y.prototype,"blendDots",void 0),e([s({type:Boolean,json:{write:!0}})],y.prototype,"dotBlendingEnabled",void 0),e([s({type:String,json:{write:!1}})],y.prototype,"dotShape",void 0),e([s({type:Number,json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1}}}})],y.prototype,"dotSize",void 0),e([s({type:d,json:{write:!0}})],y.prototype,"legendOptions",void 0),e([s({type:h,json:{default:null,write:!0}})],y.prototype,"outline",void 0),e([s({type:Number,json:{write:!0}})],y.prototype,"dotValue",void 0),e([s({type:Number}),r("dotValue")],y.prototype,"referenceDotValue",void 0),e([s({type:Number,json:{write:!0}})],y.prototype,"referenceScale",void 0),e([s({type:Number,json:{write:!0}})],y.prototype,"seed",void 0),e([i({dotDensity:"dot-density"})],y.prototype,"type",void 0),y=m=e([n("esri.renderers.DotDensityRenderer")],y);const b=y;export{b as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import e from"../Color.js";import{clone as o}from"../core/lang.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as n}from"../layers/support/fieldUtils.js";import l from"./Renderer.js";import{VisualVariablesMixin as p}from"./mixins/VisualVariablesMixin.js";import a from"./support/AttributeColorInfo.js";import u from"./support/DotDensityLegendOptions.js";import d from"../symbols/SimpleFillSymbol.js";import c from"../symbols/SimpleLineSymbol.js";var h;let m=h=class extends(p(l)){constructor(t){super(t),this.attributes=null,this.backgroundColor=new e([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new c,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(t){if(null==this.referenceScale)return this.dotValue;const e=t/this.referenceScale*this.dotValue;return e<1?1:e}getSymbol(){return new d({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol()]}getAttributeHash(){return this.attributes&&this.attributes.reduce(((t,e)=>t+e.getAttributeHash()),"")}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new h({attributes:o(this.attributes),backgroundColor:o(this.backgroundColor),dotBlendingEnabled:o(this.dotBlendingEnabled),dotShape:o(this.dotShape),dotSize:o(this.dotSize),dotValue:o(this.dotValue),legendOptions:o(this.legendOptions),outline:o(this.outline),referenceScale:o(this.referenceScale),visualVariables:o(this.visualVariables),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}getControllerHash(){return`${this.attributes.map((t=>t.field||t.valueExpression||""))}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(t,e){await this.collectVVRequiredFields(t,e);for(const o of this.attributes)o.valueExpression&&await n(t,e,o.valueExpression),o.field&&t.add(o.field)}};t([r({type:[a],json:{write:!0}})],m.prototype,"attributes",void 0),t([r({type:e,json:{write:!0}})],m.prototype,"backgroundColor",void 0),t([r({type:Boolean,json:{write:!0}})],m.prototype,"dotBlendingEnabled",void 0),t([r({type:String,json:{write:!1}})],m.prototype,"dotShape",void 0),t([r({type:Number,json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1}}}})],m.prototype,"dotSize",void 0),t([r({type:u,json:{write:!0}})],m.prototype,"legendOptions",void 0),t([r({type:c,json:{default:null,write:!0}})],m.prototype,"outline",void 0),t([r({type:Number,json:{write:!0}})],m.prototype,"dotValue",void 0),t([r({type:Number,json:{write:!0}})],m.prototype,"referenceScale",void 0),t([r({type:Number,json:{write:!0}})],m.prototype,"seed",void 0),t([i({dotDensity:"dot-density"})],m.prototype,"type",void 0),m=h=t([s("esri.renderers.DotDensityRenderer")],m);const y=m;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- const a="20220708",b="736a7d84a104bb98f0d24e137a1a98fb9e771053";export{a as buildDate,b as commitHash};
5
+ const e="20220711",a="42ee893fc78e645abda3255018b65a79d33cea1b";export{e as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import t from"../../../../../../core/Accessor.js";import{isSome as r,isNone as i}from"../../../../../../core/maybe.js";import{watch as o,sync as s}from"../../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/arrayUtils.js";import"../../../../../../core/has.js";import"../../../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{distanceToTile as a}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";import{scaleBoundsPredicate as c}from"../../../../../support/layerViewUtils.js";let p=class extends t{constructor(e){super(e),this.pointOfInterest=null}get tiles(){const e=this.tilesCoveringView,t=r(this.pointOfInterest)?this.pointOfInterest:this.view.center;return e.sort(((e,r)=>a(t,e)-a(t,r))),e}_scaleEnabled(){return c(this.view.scale,this.layer.minScale||0,this.layer.maxScale||0)}get tilesCoveringView(){if(!this.view.ready||!this.view.featuresTilingScheme||!this.view.state||i(this.tileInfo))return[];if(!this._scaleEnabled)return[];const{spans:e,lodInfo:t}=this.view.featuresTilingScheme.getTileCoverage(this.view.state,0),{level:r}=t,o=[];for(const{row:i,colFrom:s,colTo:l}of e)for(let e=s;e<=l;e++){const s={id:null,level:r,row:i,col:t.normalizeCol(e)};this.tileInfo.updateTileInfo(s),o.push(s)}return o}get tileInfo(){return this.view.featuresTilingScheme?.tileInfo??null}get tileSize(){return r(this.tileInfo)?this.tileInfo.size[0]:256}initialize(){this.addHandles(o((()=>this.view?.state?.viewpoint),(()=>this.notifyChange("tilesCoveringView")),s))}};e([l({readOnly:!0})],p.prototype,"tiles",null),e([l({readOnly:!0})],p.prototype,"_scaleEnabled",null),e([l({readOnly:!0})],p.prototype,"tilesCoveringView",null),e([l({readOnly:!0})],p.prototype,"tileInfo",null),e([l({readOnly:!0})],p.prototype,"tileSize",null),e([l({constructOnly:!0})],p.prototype,"view",void 0),e([l({constructOnly:!0})],p.prototype,"layer",void 0),e([l()],p.prototype,"pointOfInterest",void 0),p=e([n("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles2D")],p);export{p as FeatureServiceTiles2D};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import t from"../../../../../../core/Accessor.js";import{isSome as r,isNone as i}from"../../../../../../core/maybe.js";import{watch as o,sync as s}from"../../../../../../core/reactiveUtils.js";import{property as l}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/arrayUtils.js";import"../../../../../../core/has.js";import"../../../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{TileKey as a}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as p}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";import{scaleBoundsPredicate as c}from"../../../../../support/layerViewUtils.js";let u=class extends t{constructor(e){super(e),this.pointOfInterest=null}get tiles(){const e=this.tilesCoveringView,t=r(this.pointOfInterest)?this.pointOfInterest:this.view.center;return e.sort(((e,r)=>p(t,e)-p(t,r))),e}_scaleEnabled(){return c(this.view.scale,this.layer.minScale||0,this.layer.maxScale||0)}get tilesCoveringView(){if(!this.view.ready||!this.view.featuresTilingScheme||!this.view.state||i(this.tileInfo))return[];if(!this._scaleEnabled)return[];const{spans:e,lodInfo:t}=this.view.featuresTilingScheme.getTileCoverage(this.view.state,0),{level:r}=t,o=[];for(const{row:i,colFrom:s,colTo:l}of e)for(let e=s;e<=l;e++){const s=t.normalizeCol(e),l=new a(null,r,i,s);this.tileInfo.updateTileInfo(l),o.push(l)}return o}get tileInfo(){return this.view.featuresTilingScheme?.tileInfo??null}get tileSize(){return r(this.tileInfo)?this.tileInfo.size[0]:256}initialize(){this.addHandles(o((()=>this.view?.state?.viewpoint),(()=>this.notifyChange("tilesCoveringView")),s))}};e([l({readOnly:!0})],u.prototype,"tiles",null),e([l({readOnly:!0})],u.prototype,"_scaleEnabled",null),e([l({readOnly:!0})],u.prototype,"tilesCoveringView",null),e([l({readOnly:!0})],u.prototype,"tileInfo",null),e([l({readOnly:!0})],u.prototype,"tileSize",null),e([l({constructOnly:!0})],u.prototype,"view",void 0),e([l({constructOnly:!0})],u.prototype,"layer",void 0),e([l()],u.prototype,"pointOfInterest",void 0),u=e([n("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles2D")],u);export{u as FeatureServiceTiles2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../../core/HandleOwner.js";import{isSome as r,isNone as i}from"../../../../../../core/maybe.js";import{watch as s,initial as o}from"../../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/arrayUtils.js";import"../../../../../../core/has.js";import"../../../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{Visibility as c}from"../../../../layers/support/FeatureTileDescriptor3D.js";import{distanceToTile as a}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let p=class extends t{constructor(e){super(e),this.pointOfInterest=null}get tiles(){const e=this.tilesCoveringView,t=this._effectivePointOfInterest;if(r(t)){const r=e.map((e=>a(t,e)));for(let i=1;i<r.length;i++)if(r[i-1]>r[i])return e.sort(((e,r)=>a(t,e)-a(t,r))),e.slice()}return e}get tilesCoveringView(){return this._filterTiles(this.view.featureTiles?.tiles?.toArray()).map(u)}get tileInfo(){return this.view.featureTiles?.tilingScheme.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return r(e)?e:this.view.pointsOfInterest?.focus.location}initialize(){this.handles.add(s((()=>this.view.featureTiles),(e=>{this.handles.remove(m),e&&this.handles.add(e.addClient(),m)}),o))}_filterTiles(e){if(i(e))return[];return e.filter((e=>Math.abs(e.measures.screenRect[3]-e.measures.screenRect[1])>f&&e.measures.visibility===c.VISIBLE_ON_SURFACE))}};function u({lij:[e,t,r],extent:i}){return{id:`${e}/${t}/${r}`,level:e,row:t,col:r,extent:i}}e([n({readOnly:!0})],p.prototype,"tiles",null),e([n({readOnly:!0})],p.prototype,"tilesCoveringView",null),e([n({readOnly:!0})],p.prototype,"tileInfo",null),e([n({readOnly:!0})],p.prototype,"tileSize",null),e([n({constructOnly:!0})],p.prototype,"view",void 0),e([n()],p.prototype,"pointOfInterest",void 0),e([n()],p.prototype,"_effectivePointOfInterest",null),p=e([l("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],p);const f=50,m="feature-tiles";export{p as FeatureServiceTiles3D};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../../core/HandleOwner.js";import{isSome as r,isNone as i}from"../../../../../../core/maybe.js";import{watch as s,initial as o}from"../../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/arrayUtils.js";import"../../../../../../core/has.js";import"../../../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{TileKey as p}from"../../../../../../layers/support/TileKey.js";import{Visibility as a}from"../../../../layers/support/FeatureTileDescriptor3D.js";import{distanceToTile as c}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let u=class extends t{constructor(e){super(e),this.pointOfInterest=null}get tiles(){const e=this.tilesCoveringView,t=this._effectivePointOfInterest;if(r(t)){const r=e.map((e=>c(t,e)));for(let i=1;i<r.length;i++)if(r[i-1]>r[i])return e.sort(((e,r)=>c(t,e)-c(t,r))),e.slice()}return e}get tilesCoveringView(){return this._filterTiles(this.view.featureTiles?.tiles?.toArray()).map(f)}get tileInfo(){return this.view.featureTiles?.tilingScheme.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return r(e)?e:this.view.pointsOfInterest?.focus.location}initialize(){this.handles.add(s((()=>this.view.featureTiles),(e=>{this.handles.remove(v),e&&this.handles.add(e.addClient(),v)}),o))}_filterTiles(e){if(i(e))return[];return e.filter((e=>Math.abs(e.measures.screenRect[3]-e.measures.screenRect[1])>m&&e.measures.visibility===a.VISIBLE_ON_SURFACE))}};function f({lij:[e,t,r],extent:i}){return new p(`${e}/${t}/${r}`,e,t,r,i)}e([n({readOnly:!0})],u.prototype,"tiles",null),e([n({readOnly:!0})],u.prototype,"tilesCoveringView",null),e([n({readOnly:!0})],u.prototype,"tileInfo",null),e([n({readOnly:!0})],u.prototype,"tileSize",null),e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n()],u.prototype,"pointOfInterest",void 0),e([n()],u.prototype,"_effectivePointOfInterest",null),u=e([l("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],u);const m=50,v="feature-tiles";export{u as FeatureServiceTiles3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import{isSome as s,isNone as a}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as n}from"../../../../geometry/projection.js";import{create as c}from"../../../../geometry/support/aaBoundingRect.js";import{VisibilityFlag as h,VisibilityGroup as o}from"./enums.js";import{scaleBoundsPredicate as p}from"../../../support/layerViewUtils.js";import{TaskPriority as u}from"../../../support/Scheduler.js";let g=class extends i{constructor(){super(...arguments),this._scaleRangeActive=!1,this.layerScaleRangeVisibilityQuery=!1,this.handles=new t,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.extent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this.updating=!0}setup(e,i,t,s,a){this.graphicsCoreOwner=e,this.layer=i,this.queryGraphicUIDsInExtent=t,this.graphicsCore=s,this.basemapTerrain=a,this.updateScaleRangeActive();const r=this.graphicsCoreOwner.view.resourceController.scheduler;this.handles.add(r.registerTask(u.SCALE_VISIBILITY,this))}destroy(){this.handles.destroy(),this.handles=null,this.graphicsCoreOwner=null,this.extent=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){const i=this.graphicsCoreOwner.view.spatialReference,t=this.graphicsCoreOwner.view.basemapTerrain.spatialReference;if(i===t)this.extent=e;else{const s=c();n(e,i,s,t)?this.extent=s:this.extent=null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&y(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&y(e.minScale,e.maxScale))));const s=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(d)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),d),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),d)):!t&&this.handles.has(d)&&this.handles.remove(d),s}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(){const e=this.graphicsCoreOwner.view.basemapTerrain;if(this.extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this.layerScaleRangeVisibilityQuery){this.layerScaleRangeVisibilityQuery=!0;const i=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this.extent,i.minScale,i.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0)}_finishUpdate(e){this.layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._set("updating",!1)}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||p(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return p(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(s(e.centroid)?i=e.centroid:s(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(h.SCALE_RANGE,i,o.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const t=e.labelGraphics[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const s=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(h.SCALE_RANGE,s,o.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),this.graphicsCoreOwner.suspended)return;const i=e.extent,t=e.scale,r=this._visibleAtLayerScale(t);let l=!1;this.queryGraphicUIDsInExtent(i,e.spatialReference,(e=>{const n=this.graphicsCore.getGraphics3DGraphicById(e);if(a(n))return;const c=n.centroid;s(c)&&(i[0]>c.x||i[1]>c.y||i[2]<c.x||i[3]<c.y)||(n.setVisibilityFlag(h.SCALE_RANGE,r,o.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(n,t)&&(l=!0))})),l&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(h.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function y(e,i){return e>0||i>0}e([r({constructOnly:!0})],g.prototype,"layerScaleEnabled",void 0),e([r({readOnly:!0})],g.prototype,"suspended",void 0),e([r({readOnly:!0})],g.prototype,"updating",void 0),g=e([l("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],g);const d="terrain-events",b=g;export{b as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../core/Accessor.js";import t from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{isSome as r,isNone as a}from"../../../../core/maybe.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectBoundingRect as c}from"../../../../geometry/projection.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{VisibilityFlag as o,VisibilityGroup as p}from"./enums.js";import{scaleBoundsPredicate as u}from"../../../support/layerViewUtils.js";import{TaskPriority as g}from"../../../support/Scheduler.js";const d=s.getLogger("esri.views.3d.layers.graphics.Graphics3DScaleVisibility");let y=class extends i{constructor(){super(...arguments),this._scaleRangeActive=!1,this.layerScaleRangeVisibilityQuery=!1,this.handles=new t,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.extent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this.updating=!0}setup(e,i,t,s,r){this.graphicsCoreOwner=e,this.layer=i,this.queryGraphicUIDsInExtent=t,this.graphicsCore=s,this.basemapTerrain=r,this.updateScaleRangeActive();const a=this.graphicsCoreOwner.view.resourceController.scheduler;this.handles.add(a.registerTask(g.SCALE_VISIBILITY,this))}destroy(){this.handles.destroy(),this.handles=null,this.graphicsCoreOwner=null,this.extent=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){const i=this.graphicsCoreOwner.view.spatialReference,t=this.graphicsCoreOwner.view.basemapTerrain.spatialReference;if(i===t)this.extent=e;else{const s=h();c(e,i,s,t)?this.extent=s:this.extent=null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const e=this.layer,i=e.effectiveScaleRange;let t=this.layerScaleEnabled&&b(i.minScale,i.maxScale);e.labelingInfo&&!t&&(t=e.labelingInfo.some((e=>e&&b(e.minScale,e.maxScale))));const s=this._scaleRangeActive!==t;return this._scaleRangeActive=t,t&&!this.handles.has(m)&&this.basemapTerrain?(this.handles.add(this.basemapTerrain.on("scale-change",(e=>this._scaleUpdateHandler(e))),m),this.layerScaleEnabled&&this.handles.add(this.basemapTerrain.on("tiles-visibility-changed",(()=>this._setDirty())),m)):!t&&this.handles.has(m)&&this.handles.remove(m),s}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(){const e=this.graphicsCoreOwner.view.basemapTerrain;if(this.extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(!this.layerScaleRangeVisibilityQuery){this.layerScaleRangeVisibilityQuery=!0;const i=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this.extent,i.minScale,i.maxScale,(e=>this._finishUpdate(e)))}}else this._finishUpdate(!0)}_finishUpdate(e){this.layerScaleRangeVisibilityQuery=!1,this._set("suspended",!e),this._set("updating",!1)}_visibleAtLayerScale(e){const i=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||u(e,i.minScale||0,i.maxScale||0)}_visibleAtLabelScale(e,i){return u(e,i.minScale||0,i.maxScale||0)}_graphicScale(e){let i;if(r(e.centroid)?i=e.centroid:r(e.graphic.geometry)&&"point"===e.graphic.geometry.type&&(i=e.graphic.geometry),i){return this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(i):1}return null}_graphicVisible(e){if(!this.layerScaleEnabled)return!0;const i=this._graphicScale(e);return this._visibleAtLayerScale(i)}updateVisibility(e){if(this._scaleRangeActive){const i=this._graphicVisible(e);return e.setVisibilityFlag(o.SCALE_RANGE,i,p.GRAPHIC)}return!1}updateGraphicLabelScaleVisibility(e){if(!this._scaleRangeActive)return!1;if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const i=this._graphicScale(e),t=this._updateLabelScaleVisibility(e,i);return t&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),t}_updateLabelScaleVisibility(e,i){if(!e.labelGraphics||0===e.labelGraphics.length)return!1;const t=e.labelGraphics[0]._labelClass;if(t&&null!=t.minScale&&null!=t.maxScale){const s=this._visibleAtLabelScale(i,t);if(e.setVisibilityFlag(o.SCALE_RANGE,s,p.LABEL))return!0}return!1}_scaleUpdateHandler(e){if(this._setDirty(),this.graphicsCoreOwner.suspended)return;const i=e.extent,t=e.scale,s=this._visibleAtLayerScale(t);let l=!1;const n=this.graphicsCoreOwner.view.spatialReference,h=e.spatialReference;if(a(h))return void d.error("scaleUpdate: Internal error, no SpatialReference given for tiles");const u=!h.equals(n);if(u){if(!c(i,h,S,n))return void d.error("scaleUpdate: Internal error, cannot project AABR from "+h+" to wkid "+n)}const g=u?S:i;this.queryGraphicUIDsInExtent(g,h,(e=>{const n=this.graphicsCore.getGraphics3DGraphicById(e);if(a(n))return;const c=n.centroid;r(c)&&(i[0]>c.x||i[1]>c.y||i[2]<c.x||i[3]<c.y)||(n.setVisibilityFlag(o.SCALE_RANGE,s,p.GRAPHIC)&&(l=!0),this._updateLabelScaleVisibility(n,t)&&(l=!0))})),l&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty())}layerMinMaxScaleChangeHandler(){this.updateScaleRangeActive()&&!this._scaleRangeActive?this.graphicsCore.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(o.SCALE_RANGE))):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function b(e,i){return e>0||i>0}e([l({constructOnly:!0})],y.prototype,"layerScaleEnabled",void 0),e([l({readOnly:!0})],y.prototype,"suspended",void 0),e([l({readOnly:!0})],y.prototype,"updating",void 0),y=e([n("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],y);const m="terrain-events",S=h(),f=y;export{f as default};