@arcgis/core 4.34.0-next.5 → 4.34.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.5",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.7",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../core/Clonable.js";import o from"../core/Error.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i,throwIfAbortError as a}from"../core/promiseUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import m from"./Layer.js";import{ArcGISImageService as c}from"./mixins/ArcGISImageService.js";import{ArcGISService as u}from"./mixins/ArcGISService.js";import{BlendLayer as y}from"./mixins/BlendLayer.js";import{CustomParametersMixin as d}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as g}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as v}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as L}from"./mixins/TemporalLayer.js";import{legendEnabled as w,popupEnabled as I}from"./support/commonProperties.js";import{commonRasterFieldNames as b,rasterDimensionFieldPrefix as x,setDefaultRasterFieldFormats as P}from"./support/rasterFieldUtils.js";import{serviceSupportsSpatialReference as A}from"./support/versionUtils.js";import{createPopupTemplate as T}from"../support/popupUtils.js";import{SaveOperationType as _}from"../webdoc/interfaces.js";let C=class extends(y(L(j(f(h(v(c(g(S(d(u(s(t.ClonableMixin(m)))))))))))))){constructor(...e){super(...e),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery",this._debouncedSaveOperations=i((async(e,r,t)=>{const{save:o,saveAs:s}=await import("./save/imageryUtils.js");switch(e){case _.SAVE:return o(this,r);case _.SAVE_AS:return s(this,t,r)}}))}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(a).then((()=>this._fetchService(r)))),Promise.resolve(this)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(e){this._set("legendEnabled",e)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(e){this._set("listMode",e)}writeOperationalLayerType(e,r,t){const o="vector-field"===this.renderer?.type;r[t]=o?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set,o=b.itemPixelValue.toLowerCase(),s="raster-dataset"===this.sourceType,i=x.toLowerCase(),a=`${b.servicePixelValue.toLowerCase()}.`;for(const l of r){const e=l.name.toLowerCase();e===o||e.startsWith(a)||s&&e.startsWith(i)||t.add(l.name)}const p=T({fields:r,title:this.title},{...e,visibleFieldNames:t}),{rasterInfo:n}=this;return p?.fieldInfos&&n&&P(p.fieldInfos,n),p}queryFeatures(e,r){return this.queryRasters(e,r).then((e=>{if(e?.features)for(const r of e.features)r.layer=r.sourceLayer=this;return e}))}queryFeatureCount(e,r){return this.queryRasterCount(e,r)}redraw(){this.emit("redraw")}async save(e){return this._debouncedSaveOperations(_.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(_.SAVE_AS,r,e)}serviceSupportsSpatialReference(e){return A(this,e)}write(e,r){if(!this._isPreviewLayer)return super.write(e,r);if(r?.messages){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`;r.messages.push(new o("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}};e([p(w)],C.prototype,"legendEnabled",null),e([p({type:["show","hide"]})],C.prototype,"listMode",null),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],C.prototype,"operationalLayerType",void 0),e([l("web-map","operationalLayerType")],C.prototype,"writeOperationalLayerType",null),e([p(I)],C.prototype,"popupEnabled",void 0),e([p({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],C.prototype,"popupTemplate",void 0),e([p({readOnly:!0})],C.prototype,"defaultPopupTemplate",null),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p({readOnly:!0})],C.prototype,"_isPreviewLayer",null),C=e([n("esri.layers.ImageryLayer")],C);const E=C;export{E as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import r from"../PopupTemplate.js";import t from"../core/Clonable.js";import o from"../core/Error.js";import s from"../core/Logger.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as p}from"../core/promiseUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import u from"./Layer.js";import{ArcGISImageService as c}from"./mixins/ArcGISImageService.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{CustomParametersMixin as f}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as h}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as g}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as j}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as I}from"./mixins/TemporalLayer.js";import{legendEnabled as w,popupEnabled as b}from"./support/commonProperties.js";import{commonRasterFieldNames as x,rasterDimensionFieldPrefix as P,setDefaultRasterFieldFormats as _}from"./support/rasterFieldUtils.js";import{serviceSupportsSpatialReference as A}from"./support/versionUtils.js";import{logInvalidElevationInfoWarning as T,elevationModeUnsupportedMessage as E,featureExpressionUnsupportedMessage as C}from"../support/elevationInfoUtils.js";import{createPopupTemplate as O}from"../support/popupUtils.js";import R from"../symbols/support/ElevationInfo.js";import{SaveOperationType as M}from"../webdoc/interfaces.js";let G=class extends(d(I(L(h(v(j(c(g(S(f(y(i(t.ClonableMixin(u)))))))))))))){constructor(...e){super(...e),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery",this._debouncedSaveOperations=a((async(e,r,t)=>{const{save:o,saveAs:s}=await import("./save/imageryUtils.js");switch(e){case M.SAVE:return o(this,r);case M.SAVE_AS:return s(this,t,r)}}))}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(p).then((()=>this._fetchService(r)))),Promise.resolve(this)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(e){this._set("legendEnabled",e)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(e){this._set("listMode",e)}writeOperationalLayerType(e,r,t){const o="vector-field"===this.renderer?.type;r[t]=o?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){return!(!this.raster||!this.url?.toLowerCase().includes("/rasterrendering/imageserver"))}createPopupTemplate(e){const{rasterFields:r}=this,t=new Set,o=x.itemPixelValue.toLowerCase(),s="raster-dataset"===this.sourceType,i=P.toLowerCase(),a=`${x.servicePixelValue.toLowerCase()}.`;for(const l of r){const e=l.name.toLowerCase();e===o||e.startsWith(a)||s&&e.startsWith(i)||t.add(l.name)}const p=O({fields:r,title:this.title},{...e,visibleFieldNames:t}),{rasterInfo:n}=this;return p?.fieldInfos&&n&&_(p.fieldInfos,n),p}queryFeatures(e,r){return this.queryRasters(e,r).then((e=>{if(e?.features)for(const r of e.features)r.layer=r.sourceLayer=this;return e}))}queryFeatureCount(e,r){return this.queryRasterCount(e,r)}redraw(){this.emit("redraw")}async save(e){return this._debouncedSaveOperations(M.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(M.SAVE_AS,r,e)}serviceSupportsSpatialReference(e){return A(this,e)}write(e,r){if(!this._isPreviewLayer)return super.write(e,r);if(r?.messages){const e=`${r.origin}/${r.layerContainerType||"operational-layers"}`;r.messages.push(new o("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}_validateElevationInfo(){const e=this.elevationInfo;T(s.getLogger(this),E("Imagery layers","relative-to-scene",e)),T(s.getLogger(this),C("Imagery layers",e))}};e([n({type:R,value:null,json:{read:!1}})],G.prototype,"elevationInfo",null),e([n(w)],G.prototype,"legendEnabled",null),e([n({type:["show","hide"]})],G.prototype,"listMode",null),e([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],G.prototype,"isReference",void 0),e([n({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],G.prototype,"operationalLayerType",void 0),e([m("web-map","operationalLayerType")],G.prototype,"writeOperationalLayerType",null),e([n(b)],G.prototype,"popupEnabled",void 0),e([n({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],G.prototype,"popupTemplate",void 0),e([n({readOnly:!0})],G.prototype,"defaultPopupTemplate",null),e([n({readOnly:!0,json:{read:!1}})],G.prototype,"type",void 0),e([n({readOnly:!0})],G.prototype,"_isPreviewLayer",null),G=e([l("esri.layers.ImageryLayer")],G);const V=G;export{V 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.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as p}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"./Layer.js";import{ArcGISService as h}from"./mixins/ArcGISService.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as f}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as w}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as F}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as j}from"./mixins/TemporalLayer.js";import{legendEnabled as _}from"./support/commonProperties.js";import O from"./support/Field.js";import{getServicePixelValueField as b,getRawServicePixelValueField as x,getRasterAttributeTableFields as P,getMagnitudeField as I,getDirectionField as T,getMultidimensionalFields as N,commonRasterFieldNames as J,setDefaultRasterFieldFormats as L}from"./support/rasterFieldUtils.js";import C from"./support/RasterFunction.js";import{isFunctionRaster as M,getPrimaryRasters as E}from"./support/rasterDatasets/datasetUtils.js";import A from"./support/rasterDatasets/FunctionRaster.js";import U from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as $,create as V}from"./support/rasterFunctions/rasterFunctionHelper.js";import{createPopupTemplate as B}from"../support/popupUtils.js";import{SaveOperationType as D}from"../webdoc/interfaces.js";let W=class extends(d(F(g(v(w(y(f(R(j(h(S(o(r.ClonableMixin(u)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case D.SAVE:return s(this,t);case D.SAVE_AS:return i(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[b("Pixel Value"),x("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=P(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=I(t),s=T();e.push(r,s)}if(i){const t=N(i);e.push(...t)}return e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map((({name:e})=>e)).filter((e=>e!==J.rawServicePixelValue))),s=B({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&L(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(C,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(D.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(D.SAVE_AS,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=M(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(p((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=E(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&$(t.toJSON(),i);const o=await Promise.all(i.map((e=>U.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r})))),a=o.findIndex((e=>null==e));if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await U.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await U.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>r[e.url]=e));const s=V(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new A({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};e([l({clonable:!1})],W.prototype,"_primaryRasters",void 0),e([l(_)],W.prototype,"legendEnabled",void 0),e([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],W.prototype,"isReference",void 0),e([l({type:["show","hide"]})],W.prototype,"listMode",void 0),e([l({json:{read:!0,write:!0}})],W.prototype,"blendMode",void 0),e([l({type:C,json:{name:"renderingRule",write:!0}})],W.prototype,"rasterFunction",void 0),e([l()],W.prototype,"sourceJSON",void 0),e([l({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],W.prototype,"version",void 0),e([l({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([l({type:["ArcGISTiledImageServiceLayer"]})],W.prototype,"operationalLayerType",void 0),e([l({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],W.prototype,"popupEnabled",void 0),e([l({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],W.prototype,"popupTemplate",void 0),e([l({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([l({readOnly:!0,type:[O]})],W.prototype,"fields",void 0),e([l({readOnly:!0,type:[O]})],W.prototype,"rasterFields",null),e([l({constructOnly:!0})],W.prototype,"source",void 0),W=e([m("esri.layers.ImageryTileLayer")],W);const k=W;export{k as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../PopupTemplate.js";import r from"../core/Clonable.js";import s from"../core/Error.js";import i from"../core/Logger.js";import{MultiOriginJSONMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as n}from"../core/promiseUtils.js";import{watch as l}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import u from"./Layer.js";import{ArcGISService as h}from"./mixins/ArcGISService.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{CustomParametersMixin as y}from"./mixins/CustomParametersMixin.js";import{ImageryTileMixin as f}from"./mixins/ImageryTileMixin.js";import{OperationalLayer as g}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RasterJobHandlerMixin as R}from"./mixins/RasterJobHandlerMixin.js";import{RasterPresetRendererMixin as w}from"./mixins/RasterPresetRendererMixin.js";import{RefreshableLayer as S}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as F}from"./mixins/TemporalLayer.js";import{legendEnabled as _}from"./support/commonProperties.js";import I from"./support/Field.js";import{getServicePixelValueField as O,getRawServicePixelValueField as b,getRasterAttributeTableFields as x,getMagnitudeField as P,getDirectionField as T,getMultidimensionalFields as N,commonRasterFieldNames as L,setDefaultRasterFieldFormats as J}from"./support/rasterFieldUtils.js";import C from"./support/RasterFunction.js";import{isFunctionRaster as E,getPrimaryRasters as M}from"./support/rasterDatasets/datasetUtils.js";import A from"./support/rasterDatasets/FunctionRaster.js";import U from"./support/rasterDatasets/RasterFactory.js";import{getPrimaryRasterUrls as $,create as V}from"./support/rasterFunctions/rasterFunctionHelper.js";import{logInvalidElevationInfoWarning as B,elevationModeUnsupportedMessage as D,featureExpressionUnsupportedMessage as W}from"../support/elevationInfoUtils.js";import{createPopupTemplate as k}from"../support/popupUtils.js";import z from"../symbols/support/ElevationInfo.js";import{SaveOperationType as G}from"../webdoc/interfaces.js";let H=class extends(d(j(g(v(w(y(f(R(F(h(S(o(r.ClonableMixin(u)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=a((async(e,t,r)=>{const{save:s,saveAs:i}=await import("./save/imageryUtils.js");switch(e){case G.SAVE:return s(this,t);case G.SAVE_AS:return i(this,r,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(n).then((()=>this._openRaster(t)))),Promise.resolve(this)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[O("Pixel Value"),b("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,r=t?.attributeTable;if(r){const t=x(r);e.push(...t)}const s=t?.dataType,i=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=i){const t=i.variables[0].unit?.trim(),r=P(t),s=T();e.push(r,s)}if(i){const t=N(i);e.push(...t)}return e}createPopupTemplate(e){const{rasterFields:t}=this,r=e?.visibleFieldNames??new Set(t.map((({name:e})=>e)).filter((e=>e!==L.rawServicePixelValue))),s=k({fields:t,title:this.title},{...e,visibleFieldNames:r}),{rasterInfo:i}=this.raster;return s?.fieldInfos&&i&&J(s.fieldInfos,i),s}async generateRasterInfo(e,t){if(e=c(C,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:r}=await this._openFunctionRaster(e,t);return r}catch(r){if(r instanceof s)throw r;throw new s("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(G.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(G.SAVE_AS,t,e)}write(e,t){const r=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===r.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new s("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=E(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:r,source:i}=this;if(!t&&!i)throw new s("imagery-tile-layer:open","missing url or source parameter");i?await this._openFromSource(i,e):r?await this._openFromUrlWithRasterFunction(t,r,e):await this._openFromUrl(t,e)}const r=this.raster.rasterInfo;if(!r)throw new s("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?r:this._primaryRasters[0].rasterInfo),this._set("spatialReference",r.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(l((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=M(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,r){const i=[e];t&&$(t.toJSON(),i);const o=await Promise.all(i.map((e=>U.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:r})))),a=o.findIndex((e=>null==e));if(a>-1)throw new s("imagery-tile-layer:open",`cannot open raster: ${i[a]}`);return this._primaryRasters=o,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const r=await U.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new s("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){const r="the tiled imagery data source is not supported",i="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!i)throw new s("imagery-tile-layer:open",r);"MEMORY"===i&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const o=await U.open({url:"",source:e,datasetFormat:i,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==o)throw new s("imagery-tile-layer:open",r);this._primaryRasters=[o],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=o}async _openFunctionRaster(e,t){const r={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>r[e.url]=e));const s=V(e.functionDefinition?.toJSON()??e.toJSON(),r),i=new A({rasterFunction:s});return await i.open(t),i}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(r){r instanceof s&&i.getLogger(this).error("imagery-tile-layer:open",r.message),i.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(){const e=this.elevationInfo;B(i.getLogger(this),D("ImageryTile layers","relative-to-scene",e)),B(i.getLogger(this),W("ImageryTile layers",e))}};e([p({clonable:!1})],H.prototype,"_primaryRasters",void 0),e([p({type:z,value:null,json:{read:!1}})],H.prototype,"elevationInfo",null),e([p(_)],H.prototype,"legendEnabled",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],H.prototype,"isReference",void 0),e([p({type:["show","hide"]})],H.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],H.prototype,"blendMode",void 0),e([p({type:C,json:{name:"renderingRule",write:!0}})],H.prototype,"rasterFunction",void 0),e([p()],H.prototype,"sourceJSON",void 0),e([p({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],H.prototype,"version",void 0),e([p({readOnly:!0,json:{read:!1}})],H.prototype,"type",void 0),e([p({type:["ArcGISTiledImageServiceLayer"]})],H.prototype,"operationalLayerType",void 0),e([p({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,r){t[r]=!e}}}})],H.prototype,"popupEnabled",void 0),e([p({type:t,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],H.prototype,"popupTemplate",void 0),e([p({readOnly:!0})],H.prototype,"defaultPopupTemplate",null),e([p({readOnly:!0,type:[I]})],H.prototype,"fields",void 0),e([p({readOnly:!0,type:[I]})],H.prototype,"rasterFields",null),e([p({constructOnly:!0})],H.prototype,"source",void 0),H=e([m("esri.layers.ImageryTileLayer")],H);const Y=H;export{Y as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.5",
3
+ "version": "4.34.0-next.7",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK 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.34/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../Color.js";import{toHSV as r,toLAB as t,toLCH as l,toRGB as e}from"../../core/colorUtils.js";import{JSONMap as i}from"../../core/jsonMap.js";import{isSerializable as n}from"../../core/support/jsonUtils.js";const C=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],m=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],a=new i({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function g(o,r){if(!o||!r||o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(o[t]>r[t]+2||o[t]<r[t]-2)return!1;return!0}function p(o){const r=o.clone();return r.fromColor=o.toColor,r.toColor=o.fromColor,r.algorithm=o.algorithm,r}function u(o){if("multipart"===o.type){const r=o.clone();return r.colorRamps?.length?(r.colorRamps=r.colorRamps.reverse().map((o=>p(o))),r):r}return p(o)}function f(r,t){if(!r)return;const l=t??m;let e=null;return"algorithmic"===r.type?l.some((o=>{if(g(r.fromColor.toRgb(),o.fromColor)&&g(r.toColor.toRgb(),o.toColor))return e=o.id,!0})):"multipart"===r.type&&l.some((t=>{const l=r.colorRamps,i=t.colorRamps;if(l&&i&&l.length===i.length&&!i.some(((r,t)=>{if(!g(l[t].fromColor.toRgb(),new o(r.fromColor).toRgb())||!g(l[t].toColor.toRgb(),new o(r.toColor).toRgb()))return!0}))){if(e)return!0;e=t.id}})),e}function s(o,r,t=!1){if(!o)return;let l=!1,e=f(o,r);return null!=e||t||(l=!0,e=f(o=u(o),r)),e?{id:e,inverted:l}:void 0}function c(o,r=!1){const t="string"==typeof o?o:s(o,void 0,r)?.id;return t?a.toJSON(t):null}function d(o,r="esriCIELabAlgorithm"){const t=m.find((({id:r})=>r===o));return t?t.colorRamps?{type:"multipart",colorRamps:t.colorRamps.map((o=>({type:"algorithmic",algorithm:r,fromColor:[...o.fromColor],toColor:[...o.toColor]})))}:{type:"algorithmic",algorithm:r,fromColor:[...t.fromColor],toColor:[...t.toColor]}:null}function h(o){const r=(o=o||{}).numColors||256,t=o.distanceOffset||0,l=null!=o.isCustomInterval?o.isCustomInterval:null!==o.distanceInterval&&o.distanceInterval!==1/(r-1),e=o.distanceInterval||1/(r-1);return{...o,numColors:r,distanceOffset:t,interpolateAlpha:!!o.interpolateAlpha,distanceInterval:e,isCustomInterval:l,weights:o.weights}}function b(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=0===o.s,m=0===r.s;let a=o.h,g=r.h;C&&!m?a=g:m&&!C&&(r={...r,h:a},g=a);let p,u=Math.abs(g-a);const f=360;u<f/2?p=(g-a)*i:(u=f-u,p=a>g?u*i:-u*i);const s=(r.s-o.s)*i,c=(r.v-o.v)*i;let{s:d,v:h}=o,b=a;if(e){const o=e/i;b=(b+o*p+f)%f,d+=o*s,h+=o*c}const v=[];for(let k=0;k<l-1;k++)v.push({h:b,s:d,v:h}),b=(b+p+f)%f,d+=s,h+=c;return v.push(n?{h:b,s:d,v:h}:r),v}function v(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t;let{l:C,a:m,b:a}=o;const g=(r.l-C)*i,p=(r.a-m)*i,u=(r.b-a)*i,f=[];if(e){const o=e/i;C+=o*g,m+=o*p,a+=o*u}for(let s=0;s<l-1;s++)f.push({l:C,a:m,b:a}),C+=g,m+=p,a+=u;return f.push(n?{l:C,a:m,b:a}:r),f}function k(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=o.h,m=r.h,a=2*Math.PI;let g;if(C<=m){const o=m-C,r=m-C-a;g=Math.abs(r)<Math.abs(o)?r:o}else{const o=m+a-C,r=m-C;g=Math.abs(r)<Math.abs(o)?r:o}const p=g*i,u=(r.l-o.l)*i,f=(r.c-o.c)*i;let{l:s,c,h:d}=o;if(e){const o=e/i;s+=o*u,c+=o*f,d=(d+o*p+a)%a}const h=[];for(let b=0;b<l-1;b++)h.push({l:s,c,h:d}),s+=u,c+=f,d=(d+p+a)%a;return h.push(n?{l:s,c,h:d}:r),h}function y(o,i){let{fromColor:n,toColor:C}=o;n=[...n],C=[...C],3===n.length&&(n=n.concat([255])),3===C.length&&(C=C.concat([255]));const m=o.algorithm||"esriCIELabAlgorithm",a=h(i),{numColors:g,distanceOffset:p,isCustomInterval:u,interpolateAlpha:f}=a;if(1===g&&0===p)return[n];if(2===g&&0===p&&!u)return[n,C];const s={r:n[0],g:n[1],b:n[2]},c={r:C[0],g:C[1],b:C[2]},d="esriCIELabAlgorithm"===m?v(t(s),t(c),a):"esriHSVAlgorithm"===m?b(r(s),r(c),a):k(l(s),l(c),a),y=[],R=n[3]??255,w=((C[3]??255)-R)/(g-1);for(let r=0;r<g;r++){const{r:o,g:t,b:l}=e(d[r]),i=f?Math.round(R+w*r):255;y.push([o,t,l,i])}return y}function R(o,r){const{numColors:t,interpolateAlpha:l}=h(r);let e=r?.weights;const{colorRamps:i}=o;if(e){const o=e.reduce(((o,r)=>o+r));e=e.map((r=>r/o))}else{e=[];for(let o=0;o<i.length;o++)e[o]=1/i.length}const n=[],C=1/(t-1);let m=0,a=!1;for(let p=0;p<i.length;p++){const o=n.length,r=a?0:o*C-m;m+=e[p];let g=p===i.length-1?t-1-o:(e[p]-r)/C;if(a=Math.ceil(g)===g,g=Math.ceil(g),0===g)continue;const u=y(i[p],{numColors:g,interpolateAlpha:l,distanceOffset:r/e[p],distanceInterval:C/e[p]});n.push(...u)}const g=[...i[i.length-1].toColor];return 3===g.length&&g.push(255),n.push(g),n}function w(o,r){const t=n(o)?o.toJSON():o;return"multipart"===t.type?R(t,r):y(t,r)}function B(o,r){const t=w(o,r),l=r?.interpolateAlpha;return t.forEach(((o,r)=>{o.unshift(r),l||o.pop()})),t}function D(o){const t=[];for(let l=0;l<o.length;l+=4){const e=r({r:o[l],g:o[l+1],b:o[l+2]});t.push([e.h/60,e.s/100,255*e.v/100])}return t}function I(o){const t=r(o);return{type:"HsvColor",Hue:t.h,Saturation:t.s,Value:t.v,AlphaValue:255}}function G(o){const r=o.toJSON();return{Algorithm:r?.Algorithm||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:I(o.fromColor),ToColor:I(o.toColor)}}function A(o){const r=c(o);if(!r)return null;if("algorithmic"===o.type)return{...G(o),Name:r};if(o.colorRamps){const t=o.colorRamps.map(G);return{type:"MultiPartColorRamp",NumColorRamps:t.length,ArrayOfColorRamp:t,Name:r}}return null}function P(o){const r=o.reverse().map((o=>{const r=o.toString(16);return r.length<2?"0"+r:r}));return 4294967295&Number.parseInt(r.join(""),16)}export{a as colorRampDict,B as convertColorRampToColormap,w as convertColorRampToColors,P as convertRGBATo32Bit,D as createHsvMap,s as getColorRampId,d as getColorRampJSON,c as getColorRampName,A as getRFxArgColorRampValue,m as predefinedJsonColorRamps,C as rasterColormapNames};
5
+ import{toHSV as o,toLAB as r,toLCH as t,toRGB as l}from"../../core/colorUtils.js";import{JSONMap as e}from"../../core/jsonMap.js";import{isSerializable as i}from"../../core/support/jsonUtils.js";const n=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],C=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],m=new e({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function a(o,r){if(!o||!r||o.length!==r.length)return!1;for(let t=0;t<o.length;t++)if(o[t]>r[t]+2||o[t]<r[t]-2)return!1;return!0}function g(o){const r=o.clone();return r.fromColor=o.toColor,r.toColor=o.fromColor,r}function p(o){if("multipart"===o.type){const r=o.clone();return r.colorRamps?.length?(r.colorRamps=r.colorRamps.reverse().map((o=>g(o))),r):r}return g(o)}function u(o,r){const t=r??C;if("algorithmic"===o.type){const r=o.fromColor.toRgb(),l=o.toColor.toRgb();return t.find((o=>a(r,o.fromColor)&&a(l,o.toColor)))?.id}const l=o.colorRamps?.map((o=>({fromColor:o.fromColor.toRgb(),toColor:o.toColor.toRgb()})));return t.find((o=>{const r=o.colorRamps;return!(!l||!r||l.length!==r.length)&&r.every(((o,r)=>a(l[r].fromColor,o.fromColor)&&a(l[r].toColor,o.toColor)))}))?.id}function f(o,r,t=!1){if(!o)return;let l=!1,e=u(o,r);return null!=e||t||(l=!0,e=u(o=p(o),r)),e?{id:e,inverted:l}:void 0}function s(o,r=!1){const t="string"==typeof o?o:f(o,void 0,r)?.id;return t?m.toJSON(t):null}function d(o,r="esriCIELabAlgorithm"){const t=C.find((({id:r})=>r===o));return t?t.colorRamps?{type:"multipart",colorRamps:t.colorRamps.map((o=>({type:"algorithmic",algorithm:r,fromColor:[...o.fromColor],toColor:[...o.toColor]})))}:{type:"algorithmic",algorithm:r,fromColor:[...t.fromColor],toColor:[...t.toColor]}:null}function c(o){o??={};const r=o.numColors||256,t=o.distanceOffset||0,l=null!=o.isCustomInterval?o.isCustomInterval:null!==o.distanceInterval&&o.distanceInterval!==1/(r-1),e=o.distanceInterval||1/(r-1);return{...o,numColors:r,distanceOffset:t,interpolateAlpha:!!o.interpolateAlpha,distanceInterval:e,isCustomInterval:l,weights:o.weights}}function h(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=0===o.s,m=0===r.s;let a=o.h,g=r.h;C&&!m?a=g:m&&!C&&(r={...r,h:a},g=a);let p=Math.abs(g-a),u=0;const f=360;p<f/2?u=(g-a)*i:(p=f-p,u=a>g?p*i:-p*i);const s=(r.s-o.s)*i,d=(r.v-o.v)*i;let{s:c,v:h}=o,b=a;if(e){const o=e/i;b=(b+o*u+f)%f,c+=o*s,h+=o*d}const v=[];for(let y=0;y<l-1;y++)v.push({h:b,s:c,v:h}),b=(b+u+f)%f,c+=s,h+=d;return v.push(n?{h:b,s:c,v:h}:r),v}function b(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t;let{l:C,a:m,b:a}=o;const g=(r.l-C)*i,p=(r.a-m)*i,u=(r.b-a)*i,f=[];if(e){const o=e/i;C+=o*g,m+=o*p,a+=o*u}for(let s=0;s<l-1;s++)f.push({l:C,a:m,b:a}),C+=g,m+=p,a+=u;return f.push(n?{l:C,a:m,b:a}:r),f}function v(o,r,t){const{numColors:l,distanceOffset:e,distanceInterval:i,isCustomInterval:n}=t,C=o.h,m=r.h,a=2*Math.PI;let g=0;if(C<=m){const o=m-C,r=m-C-a;g=Math.abs(r)<Math.abs(o)?r:o}else{const o=m+a-C,r=m-C;g=Math.abs(r)<Math.abs(o)?r:o}const p=g*i,u=(r.l-o.l)*i,f=(r.c-o.c)*i;let{l:s,c:d,h:c}=o;if(e){const o=e/i;s+=o*u,d+=o*f,c=(c+o*p+a)%a}const h=[];for(let b=0;b<l-1;b++)h.push({l:s,c:d,h:c}),s+=u,d+=f,c=(c+p+a)%a;return h.push(n?{l:s,c:d,h:c}:r),h}function y(e,i){const{fromColor:n,toColor:C}=e,m=3===n.length?[...n,255]:[...n],a=3===C.length?[...C,255]:[...C],g=e.algorithm||"esriCIELabAlgorithm",p=c(i),{numColors:u,distanceOffset:f,isCustomInterval:s,interpolateAlpha:d}=p;if(1===u&&0===f)return[m];if(2===u&&0===f&&!s)return[m,a];const y={r:m[0],g:m[1],b:m[2]},k={r:a[0],g:a[1],b:a[2]},R="esriCIELabAlgorithm"===g?b(r(y),r(k),p):"esriHSVAlgorithm"===g?h(o(y),o(k),p):v(t(y),t(k),p),w=[],B=m[3]??255,D=((a[3]??255)-B)/(u-1);for(let o=0;o<u;o++){const{r,g:t,b:e}=l(R[o]),i=d?Math.round(B+D*o):255;w.push([r,t,e,i])}return w}function k(o,r){const{colorRamps:t}=o;if(!r?.length)return Array.from({length:t.length},(()=>1/t.length));const l=r.reduce(((o,r)=>o+r));return r.map((o=>o/l))}function R(o,r){const{numColors:t,interpolateAlpha:l}=c(r),e=k(o,r?.weights),{colorRamps:i}=o,n=[],C=1/(t-1);let m=0,a=!1;for(let p=0;p<i.length;p++){const o=n.length,r=a?0:o*C-m;m+=e[p];let g=p===i.length-1?t-1-o:(e[p]-r)/C;if(a=Math.ceil(g)===g,g=Math.ceil(g),0===g)continue;const u=y(i[p],{numColors:g,interpolateAlpha:l,distanceOffset:r/e[p],distanceInterval:C/e[p]});n.push(...u)}const g=[...i[i.length-1].toColor];return 3===g.length&&g.push(255),n.push(g),n}function w(o,r){const t=i(o)?o.toJSON():o;return"multipart"===t.type?R(t,r):y(t,r)}function B(o,r){const t=w(o,r),l=r?.interpolateAlpha;return t.forEach(((o,r)=>{o.unshift(r),l||o.pop()})),t}function D(r){const t=[];for(let l=0;l<r.length;l+=4){const e=o({r:r[l],g:r[l+1],b:r[l+2]});t.push([e.h/60,e.s/100,255*e.v/100])}return t}function I(r){const t=o(r);return{type:"HsvColor",Hue:t.h,Saturation:t.s,Value:t.v,AlphaValue:255}}function A(o){const r=o.toJSON();return{Algorithm:r?.Algorithm||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:I(o.fromColor),ToColor:I(o.toColor)}}function G(o){const r=s(o);if(!r)return null;if("algorithmic"===o.type)return{...A(o),Name:r};if(o.colorRamps){const t=o.colorRamps.map(A);return{type:"MultiPartColorRamp",NumColorRamps:t.length,ArrayOfColorRamp:t,Name:r}}return null}function P(o){const r=[...o].reverse().map((o=>{const r=o.toString(16);return r.length<2?"0"+r:r}));return 4294967295&Number.parseInt(r.join(""),16)}export{m as colorRampDict,B as convertColorRampToColormap,w as convertColorRampToColors,P as convertRGBATo32Bit,D as createHsvMap,f as getColorRampId,d as getColorRampJSON,s as getColorRampName,G as getRFxArgColorRampValue,C as predefinedJsonColorRamps,n as rasterColormapNames};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const c="20250529",d="f5bcc793179cdffd181db187dc16be953acd2511";export{c as buildDate,d as commitHash};
5
+ const f="20250531",e="721b35a0b089a2f0ff12477e9fea43559e04506f";export{f as buildDate,e as commitHash};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import ElevationInfo = __esri.ElevationInfo;
4
+ export default ElevationInfo;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{strict as o,JSONMap as r}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{equalsMaybe as s}from"../../core/maybe.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as n}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../../core/accessorSupport/decorators/writer.js";import f from"./FeatureExpressionInfo.js";import{supportedUnits as a}from"./unitConversionUtils.js";var l;const m=o()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),d=new r({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let c=class extends t{static{l=this}constructor(e){super(e),this.featureExpressionInfo=void 0,this.offset=null}readFeatureExpressionInfo(e,o){return null!=e?e.expression?e:void 0:o.featureExpression&&0===o.featureExpression.value?{expression:"0"}:void 0}writeFeatureExpressionInfo(e,o,r,t){o[r]=e.write({},t),"0"===e.expression&&(o.featureExpression={value:0})}get mode(){const{offset:e,featureExpressionInfo:o}=this;return this._isOverridden("mode")?this._get("mode"):null!=e||o?"relative-to-ground":"on-the-ground"}set mode(e){this._override("mode",e)}set unit(e){this._set("unit",e)}write(e,o){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(e,o):null}clone(){return new l({mode:this.mode,offset:this.offset,featureExpressionInfo:this.featureExpressionInfo?this.featureExpressionInfo.clone():void 0,unit:this.unit})}equals(e){return this.mode===e.mode&&this.offset===e.offset&&this.unit===e.unit&&s(this.featureExpressionInfo,e.featureExpressionInfo)}};e([i({type:f,json:{write:!0}})],c.prototype,"featureExpressionInfo",void 0),e([n("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],c.prototype,"readFeatureExpressionInfo",null),e([u("featureExpressionInfo",{featureExpressionInfo:{type:f},"featureExpression.value":{type:[0]}})],c.prototype,"writeFeatureExpressionInfo",null),e([i({type:m.apiValues,nonNullable:!0,json:{type:m.jsonValues,read:m.read,write:{writer:m.write,isRequired:!0}}})],c.prototype,"mode",null),e([i({type:Number,json:{write:!0}})],c.prototype,"offset",void 0),e([i({type:a,json:{type:String,read:d.read,write:d.write}})],c.prototype,"unit",null),c=l=e([p("esri.symbols.support.ElevationInfo")],c);export{c as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Clonable.js";import{strict as r,JSONMap as t}from"../../core/jsonMap.js";import s from"../../core/JSONSupport.js";import{equalsMaybe as i}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import f from"./FeatureExpressionInfo.js";import{supportedUnits as l}from"./unitConversionUtils.js";const m=r()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),d=new t({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let c=class extends(o.ClonableMixin(s)){constructor(e){super(e),this.featureExpressionInfo=void 0,this.offset=null}readFeatureExpressionInfo(e,o){return null!=e?e.expression?e:void 0:o.featureExpression&&0===o.featureExpression.value?{expression:"0"}:void 0}writeFeatureExpressionInfo(e,o,r,t){o[r]=e.write({},t),"0"===e.expression&&(o.featureExpression={value:0})}get mode(){const{offset:e,featureExpressionInfo:o}=this;return this._isOverridden("mode")?this._get("mode"):null!=e||o?"relative-to-ground":"on-the-ground"}set mode(e){this._override("mode",e)}set unit(e){this._set("unit",e)}write(e,o){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(e,o):null}equals(e){return this.mode===e.mode&&this.offset===e.offset&&this.unit===e.unit&&i(this.featureExpressionInfo,e.featureExpressionInfo)}};e([n({type:f,json:{write:!0}})],c.prototype,"featureExpressionInfo",void 0),e([p("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],c.prototype,"readFeatureExpressionInfo",null),e([a("featureExpressionInfo",{featureExpressionInfo:{type:f},"featureExpression.value":{type:[0]}})],c.prototype,"writeFeatureExpressionInfo",null),e([n({type:m.apiValues,nonNullable:!0,json:{type:m.jsonValues,read:m.read,write:{writer:m.write,isRequired:!0}}})],c.prototype,"mode",null),e([n({type:Number,json:{write:!0}})],c.prototype,"offset",void 0),e([n({type:l,json:{type:String,read:d.read,write:d.write}})],c.prototype,"unit",null),c=e([u("esri.symbols.support.ElevationInfo")],c);export{c as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import FeatureExpressionInfo = __esri.FeatureExpressionInfo;
4
+ export default FeatureExpressionInfo;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import s from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as t}from"../../layers/support/fieldUtils.js";var i;let p=i=class extends s{constructor(r){super(r)}async collectRequiredFields(r,s){return t(r,s,this.expression)}clone(){return new i({expression:this.expression,title:this.title})}equals(r){return this.expression===r.expression&&this.title===r.title}};r([e({type:String,json:{write:{isRequired:!0}}})],p.prototype,"expression",void 0),r([e({type:String,json:{write:!0}})],p.prototype,"title",void 0),p=i=r([o("esri.symbols.support.FeatureExpressionInfo")],p);const n=p;export{n as default};
5
+ import{_ as s}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{collectArcadeFieldNames as t}from"../../layers/support/fieldUtils.js";var i;let p=i=class extends e{constructor(s){super(s),this.expression=void 0,this.title=void 0}async collectRequiredFields(s,e){return t(s,e,this.expression)}clone(){return new i({expression:this.expression,title:this.title})}equals(s){return this.expression===s.expression&&this.title===s.title}};s([r({type:String,json:{write:{isRequired:!0}}})],p.prototype,"expression",void 0),s([r({type:String,json:{write:!0}})],p.prototype,"title",void 0),p=i=s([o("esri.symbols.support.FeatureExpressionInfo")],p);const n=p;export{n as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5943],{18768:(e,t,i)=>{i.d(t,{b:()=>l});var s=i(90237),r=i(53966),a=i(10107),n=(i(44208),i(87811),i(40608)),o=i(60694);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,o.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,o.Jf)(e,r.A.getLogger(this)))}};return(0,s._)([(0,a.MZ)()],t.prototype,"title",null),(0,s._)([(0,a.MZ)({type:String})],t.prototype,"url",null),t=(0,s._)([(0,n.$)("esri.layers.mixins.ArcGISService")],t),t}},21312:(e,t,i)=>{i.d(t,{A:()=>m});var s,r=i(90237),a=i(10107),n=(i(44208),i(53966),i(87811),i(93223)),o=i(36005),l=i(40608),c=i(43937),u=i(5443),f=i(86738),h=i(82434);function p(e,t,i){const{x:s,y:r}=t;if(i<2)return{x:e[0]+s*e[2]+r*e[4],y:e[1]+s*e[3]+r*e[5]};if(2===i){const t=s*s,i=r*r,a=s*r;return{x:e[0]+s*e[2]+r*e[4]+t*e[6]+a*e[8]+i*e[10],y:e[1]+s*e[3]+r*e[5]+t*e[7]+a*e[9]+i*e[11]}}const a=s*s,n=r*r,o=s*r,l=a*s,c=a*r,u=s*n,f=r*n;return{x:e[0]+s*e[2]+r*e[4]+a*e[6]+o*e[8]+n*e[10]+l*e[12]+c*e[14]+u*e[16]+f*e[18],y:e[1]+s*e[3]+r*e[5]+a*e[7]+o*e[9]+n*e[11]+l*e[13]+c*e[15]+u*e[17]+f*e[19]}}function d(e,t,i){const{xmin:s,ymin:r,xmax:a,ymax:n,spatialReference:o}=t;let l=[];if(i<2)l.push({x:s,y:n}),l.push({x:a,y:n}),l.push({x:s,y:r}),l.push({x:a,y:r});else{let e=10;for(let t=0;t<e;t++)l.push({x:s,y:r+(n-r)*t/(e-1)}),l.push({x:a,y:r+(n-r)*t/(e-1)});e=8;for(let t=1;t<=e;t++)l.push({x:s+(a-s)*t/e,y:r}),l.push({x:s+(a-s)*t/e,y:n})}l=l.map((t=>p(e,t,i)));const c=l.map((e=>e.x)),f=l.map((e=>e.y));return new u.A({xmin:Math.min.apply(null,c),xmax:Math.max.apply(null,c),ymin:Math.min.apply(null,f),ymax:Math.max.apply(null,f),spatialReference:o})}let m=s=class extends h.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){const{coeffX:i,coeffY:s}=t;if(!i?.length||!s?.length||i.length!==s.length)return null;const r=[];for(let e=0;e<i.length;e++)r.push(i[e]),r.push(s[e]);return r}writeForwardCoefficients(e,t,i){const s=[],r=[];for(let t=0;t<e?.length;t++)t%2==0?s.push(e[t]):r.push(e[t]);t.coeffX=s,t.coeffY=r}get inverseCoefficients(){let e=this._get("inverseCoefficients");const t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){const[t,i,s,r,a,n]=e,o=s*n-a*r,l=a*r-s*n;return[(a*i-t*n)/o,(s*i-t*r)/l,n/o,r/l,-a/o,-s/l]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){const{inverseCoeffX:i,inverseCoeffY:s}=t;if(!i?.length||!s?.length||i.length!==s.length)return null;const r=[];for(let e=0;e<i.length;e++)r.push(i[e]),r.push(s[e]);return r}writeInverseCoefficients(e,t,i){const s=[],r=[];for(let t=0;t<e?.length;t++)t%2==0?s.push(e[t]):r.push(e[t]);t.inverseCoeffX=s,t.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){const t=p(this.forwardCoefficients,e,this.polynomialOrder);return new f.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){const t=p(this.inverseCoefficients,e,this.polynomialOrder);return new f.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return d(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new s({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,r._)([(0,a.MZ)({json:{write:!0}})],m.prototype,"polynomialOrder",void 0),(0,r._)([(0,a.MZ)()],m.prototype,"forwardCoefficients",void 0),(0,r._)([(0,o.w)("forwardCoefficients",["coeffX","coeffY"])],m.prototype,"readForwardCoefficients",null),(0,r._)([(0,c.K)("forwardCoefficients")],m.prototype,"writeForwardCoefficients",null),(0,r._)([(0,a.MZ)({json:{write:!0}})],m.prototype,"inverseCoefficients",null),(0,r._)([(0,o.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],m.prototype,"readInverseCoefficients",null),(0,r._)([(0,c.K)("inverseCoefficients")],m.prototype,"writeInverseCoefficients",null),(0,r._)([(0,a.MZ)()],m.prototype,"affectsPixelSize",null),(0,r._)([(0,n.e)({PolynomialXform:"polynomial"})],m.prototype,"type",void 0),m=s=(0,r._)([(0,l.$)("esri.layers.support.rasterTransforms.PolynomialTransform")],m)},25943:(e,t,i)=>{i.d(t,{d:()=>A});var s,r=i(90237),a=i(78888),n=i(69622),o=i(71903),l=i(49186),c=i(36563),u=(i(44208),i(66344)),f=i(3694),h=i(74887),p=i(36708),d=i(11932),m=i(84952),y=i(10107),g=(i(53966),i(87811),i(40608)),w=i(72802),x=i(4718),v=i(69397),b=i(34275);class I{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);const{location:t,data:i}=e;this.location=Object.freeze((0,x.o8)(t));const s=this.location.width,r=this.location.height;let a=!0,n=!0;const o=function(e,t=!1){return e<=b.y9?t?new Array(e).fill(0):new Array(e):new Uint32Array(e)}(Math.ceil(s*r/32));let c=0;for(let e=0;e<i.length;e++){const t=e%32;i[e]?(n=!1,o[c]|=1<<t):a=!1,31===t&&++c}n?(this._availability="unavailable",this.byteSize=40):a?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,v.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;const i=(e-this.location.top)*this.location.width+(t-this.location.left),s=i%32,r=i>>5,a=this._availability;return r<0||r>a.length?"unknown":a[r]&1<<s?"available":"unavailable"}static fromDefinition(e,t){const i=e.service.request||a.A,{row:s,col:r,width:n,height:o}=e,c={query:{f:"json"}};return t=t?{...c,...t}:c,i(function(e){let t;if(e.service.tileServers?.length){const i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;const i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then((e=>e.data)).catch((e=>{if(422===e?.details?.httpStatus)return{location:{top:s,left:r,width:n,height:o},valid:!0,data:new Array(n*o).fill(0)};throw e})).then((e=>{if(e.location&&(e.location.top!==s||e.location.left!==r||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:s,left:r,width:n,height:o}});return I.fromJSON(e)}))}static fromJSON(e){return Object.freeze(new I(e))}}function _(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function S(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let A=class extends n.A{static{s=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=a.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2*o.u.MEGABYTES),this.addHandles((0,p.wB)((()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]}),(()=>this._initializeTilemapDefinition()),p.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";const s=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return s?s.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,s){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(S(e,t,i)):this._fetchTilemap(e,t,i,s).catch((e=>e)).then((s=>{if(s instanceof I){const r=s.getAvailability(t,i);if("unavailable"===r)throw S(e,t,i);return r}if((0,h.zf)(s))throw s;return"unknown"}))}fetchAvailabilityUpsample(e,t,i,s,r){s.level=e,s.row=t,s.col=i;const a=this.layer.tileInfo;a.updateTileInfo(s);const n=this.fetchAvailability(e,t,i,r).catch((e=>{if((0,h.zf)(e))throw e;if(a.upsampleTile(s))return this.fetchAvailabilityUpsample(s.level,s.row,s.col,s,r);throw e}));return this._fetchAvailabilityUpsamplePrefetch(s.id,e,t,i,r,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,r,a,n){if(!this._prefetchingEnabled||null==e)return;const o=`prefetch-${e}`;if(this.hasHandles(o))return;const l=new AbortController;n.then((()=>l.abort()),(()=>l.abort()));let u=!1;const f=(0,c.hA)((()=>{u||(u=!0,l.abort())}));if(this.addHandles(f,o),await(0,d.md)(10,l.signal).catch((()=>{})),u||(u=!0,this.removeHandles(o)),(0,h.G4)(l))return;const p=new w.U(e,t,i,r),m={...a,signal:l.signal},y=this.layer.tileInfo;for(let e=0;s._prefetches.length<s._maxPrefetch&&y.upsampleTile(p);++e){const e=this.fetchAvailability(p.level,p.row,p.col,m);s._prefetches.push(e);const t=()=>{s._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:s._maxPrefetch})}_fetchTilemap(e,t,i,s){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const r=this._tmpTilemapDefinition,a=this._tilemapFromCache(e,t,i,r);if(a)return Promise.resolve(a);const n=s?.signal;return s={...s,signal:null},new Promise(((e,t)=>{(0,h.u7)(n,(()=>t((0,h.NK)())));const i=_(r);let a=this._pendingTilemapRequests[i];if(!a){a=I.fromDefinition(r,s).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=a,a.then(e,e)}a.then(e,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:(0,m.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,s){s.level=e,s.row=t-t%this.size,s.col=i-i%this.size;const r=_(s);return this._tilemapCache.get(r)}get test(){}};(0,r._)([(0,y.MZ)({constructOnly:!0})],A.prototype,"layer",void 0),(0,r._)([(0,y.MZ)({constructOnly:!0})],A.prototype,"minLOD",void 0),(0,r._)([(0,y.MZ)({constructOnly:!0})],A.prototype,"maxLOD",void 0),(0,r._)([(0,y.MZ)({constructOnly:!0})],A.prototype,"request",void 0),(0,r._)([(0,y.MZ)({constructOnly:!0})],A.prototype,"size",void 0),A=s=(0,r._)([(0,g.$)("esri.layers.support.TilemapCache")],A)},35943:(e,t,i)=>{i.r(t),i.d(t,{default:()=>qe});var s=i(90237),r=i(13874),a=i(69540),n=i(49186),o=i(53966),l=i(92071),c=i(74887),u=i(36708),f=i(10107),h=i(56507),p=i(44208),d=(i(87811),i(40608)),m=i(4146),y=i(18768),g=i(63074),w=i(69208),x=i(89015),v=i(16131),b=i(8303),I=i(63660),_=i(56551),S=i(54310),A=i(25036),T=i(82935),R=i(10873),C=i(20437),M=i(74797),O=i(22796),F=i(76353),P=i(84169),k=i(4916),D=i(68197),N=i(5443),E=i(16930),L=i(73444),B=i(14140),z=i(16019);function J(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function U(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function $(e){const{axes:t}=e.domain,i=Object.keys(t),s=[],r=[];let a=-1,n=-1,o=[];for(let e=0;e<i.length;e++){const l=i[e];J(l)?a=e:U(l)&&(n=e);const c=t[l],u=[];if("values"in c){c.values.forEach((e=>u.push("string"==typeof e?new Date(e).getTime():e)));const e=u[1]-u[0];s.push([u[0]-.5*e,u[u.length-1]+.5*e]),r.push(e)}else{const{start:e,stop:t,num:i}=c,a=(t-e)/(i-1);s.push([e-.5*a,t+.5*a]),r.push(a);for(let t=0;t<i;t++)u.push(e+a*t)}o.push({name:l,values:u,extent:[u[0],u[u.length-1]]})}a>-1&&-1===n?n=0===a?1:0:n>-1&&-1===a?a=0===n?1:0:-1===n&&-1===a&&(a=0,n=1),o=o.filter(((e,t)=>!(t===a||t===n)));const{referencing:l}=e.domain,c=l.find((e=>e.coordinates.includes(i[a]))).system.id,u=c?.slice(c.lastIndexOf("/")+1),f=null==u||"CRS84"===u?4326:Number(u),h=new E.A({wkid:f}),[p,d]=s[a],[m,y]=s[n],g=new N.A({xmin:p,xmax:d,ymin:m,ymax:y,spatialReference:h});return{width:Math.round(g.width/r[a]),height:Math.round(g.height/r[n]),extent:g,dimensions:o}}function V(e){const t=(0,L.ZS)()?.language;return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function j(){return Math.round(255*Math.random())}function q(e){const t={},{parameters:i}=e;if(!i)return t;for(const[e,s]of Object.entries(i)){const{type:i,description:r,unit:a,categoryEncoding:n,observedProperty:o}=s;if("Parameter"===i&&(t[e]={},r&&(t[e].description=V(r)),a&&(t[e].unit=a.label?V(a.label):null,t[e].symbol=a.symbol?.value),n)){const i=Object.entries(n).map(((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})));let s=!1;o?.categories?.length&&(o.categories.forEach((e=>{if(!e.id)return;const t=e.id.slice(e.id.lastIndexOf("/")+1),r=i.find((e=>e.ClassName===t));if(!r)return;const a=e.label?V(e.label):null;if(r.Label=a,e.preferredColor){const t=D.A.fromHex(e.preferredColor);t&&(s=!0,r.Red=t.r,r.Green=t.g,r.Blue=t.b)}})),s&&i.forEach((e=>{null==e.Red&&(e.Red=j(),e.Green=j(),e.Blue=j())})));const r={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map((e=>({attributes:e})))};s&&r.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=r}}return t}function G(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let s=0;s<e.length;s++){const r=e[s];null!=r&&(r<t&&(t=r),r>i&&(i=r))}return(0,z.X1)(t,i)}function H(e,t,i){const s=e.map(((e,i)=>({name:e,count:t[i]}))).sort(((e,t)=>e.name>t.name?-1:1)),r=(a=1,e=>a*=e.count);var a;const n=[...s.slice(1),{name:"",count:1}].reverse().map(r).reverse();let o=0;for(let r=e.length-1;r>=0;r--)o+=n[s.findIndex((({name:t})=>t===e[r]))]*(i%t[r]),i=Math.floor(i/t[r]);return o}var Z=i(45617),W=i(87186),X=i(77301),Y=i(28435),K=i(6952);let Q=class extends k.A{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.source=null}get url(){return""}fetchRawTile(e,t,i,s={}){if(!this._pixelBlockTiles){const{rasterInfo:r}=this,[a,n]=r.storageInfo.tileInfo.size,{sliceId:o}=s,{pixelBlocks:l}=this.source,c={pixelBlock:null==o?l[0]:l[o],useBilinear:"thematic"!==r.dataType,tileSize:{width:a,height:n},level:e,row:t,col:i},u=this.rasterJobHandler?this.rasterJobHandler.clipTile(c,s):(0,Y.J$)(c);return Promise.resolve(u)}const r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _open(e){const t=this.source,{pixelBlocks:i,attributeTable:s,statistics:r,histograms:a,name:n,nativeExtent:o,transform:l}=t,c=i[0],{width:u,height:f,pixelType:h}=c,p=t.extent??new N.A({xmin:-.5,ymin:.5,xmax:u-.5,ymax:f-.5,spatialReference:new E.A({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,m={x:p.width/u,y:p.height/f},y={...t.keyProperties};s&&(y.DataType="Thematic");const g=new W.A({width:u,height:f,pixelType:h,extent:p,nativeExtent:o,attributeTable:s,transform:l,pixelSize:m,spatialReference:p.spatialReference,bandCount:c.pixels.length,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:r,isPseudoSpatialReference:d,histograms:a});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(g),this.createRemoteDatasetStorageInfo(g,512,512),this._set("rasterInfo",g),this.updateTileInfo(),g.multidimensionalInfo?await this._buildMDimStats(t.pixelBlocks,g.multidimensionalInfo):await this._buildInMemoryRaster(c,{width:512,height:512},e),g.multidimensionalInfo||(this.source=null),this.datasetName=n}async _buildInMemoryRaster(e,t,i){const{rasterInfo:s}=this,r=s.storageInfo.maximumPyramidLevel??0,a="thematic"!==s.dataType,o=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:r,useBilinear:a},i):Promise.resolve((0,Y.lD)(e,t,r,a)),l=null!=s.statistics,u=null!=s.histograms,f=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),h=await(0,c.Lx)([o,f]);if(!h[0].value&&h[1].value)throw new n.A("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=h[0].value,l||(s.statistics=h[1].value?.statistics),u||(s.histograms=h[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let s=0;s<t.variables.length;s++){const r=t.variables[s];if(r.statistics)continue;const a=r.dimensions.map((e=>new Z.A({variableName:r.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0}))),n=(0,X.NG)(a,t),o=null==n?null:e[n];if(null==o)continue;const l=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:o},i):(0,K.eH)(o);r.statistics=l.statistics,r.histograms||(r.histograms=l.histograms)}}};(0,s._)([(0,f.MZ)({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),(0,s._)([(0,f.MZ)()],Q.prototype,"source",void 0),(0,s._)([(0,f.MZ)()],Q.prototype,"url",null),Q=(0,s._)([(0,d.$)("esri.layers.support.rasterDatasets.InMemoryRaster")],Q);const ee=Q;var te=i(22671);let ie=class extends k.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _open(e){const{extent:t,pixelBlocks:i,multidimensionalInfo:s,attributeTable:r,bandNames:a}=await this._fetchData(e),{statistics:n,histograms:o}=(0,K.eH)(i[0]),l=a?.map((e=>({BandName:e}))),c={DataType:r?"Thematic":s?"Scientific":"Generic",BandProperties:l},u=new ee({source:{extent:t,pixelBlocks:i,attributeTable:r?te.A.fromJSON(r):null,multidimensionalInfo:s,statistics:n,histograms:o,keyProperties:c,isPseudoSpatialReference:!1}});await u.open(),this._inMemoryRaster=u;const f=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",f.slice(0,f.indexOf("."))),this._set("rasterInfo",u.rasterInfo)}async _fetchData(e){const t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new n.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new n.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new n.A(i,"Missing domain referencing in the grid coverage data");const s=Object.values(t.ranges);for(let e=0;e<s.length;e++){const{axisNames:t,shape:r,type:a,values:o}=s[e];if(!("ndarray"===a.toLowerCase()&&o?.length&&t?.length&&r?.length))throw new n.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!J(t[t.length-1])||!U(t[t.length-2]))throw new n.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){const{width:t,height:i,extent:s,dimensions:r}=$(e),{ranges:a}=e,n=Object.keys(a).sort(((e,t)=>e<t?-1:1)),o=[];for(let e=0;e<n.length;e++){const t=n[e];r?.length&&o.push({name:t,dimensions:r})}const l=q(e);o.forEach((e=>l[e.name]&&Object.assign(e,l[e.name])));const c=o.length?{variables:o}:void 0,u=[];for(let e=0;e<n.length;e++){const s=n[e],{values:o,dataType:l,axisNames:c,shape:f}=a[s],h=f.length>2?e*f.slice(0,-2).reduce(((e,t)=>e*t)):0,p=c.slice(0,-2),d=f.slice(0,-2),m="float"===l?"f32":G(o),y=t*i,g=o.length/y;for(let s=0;s<g;s++){const a=B.A.createEmptyBand(m,y),n=new Uint8Array(y).fill(255);let l=!1;const c=s*y;for(let e=0;e<y;e++){const t=o[c+e];null==t?(n[e]=0,l=!0):a[e]=t}if(0===e||r?.length){const e=new B.A({width:t,height:i,mask:l?n:null,pixels:[a],pixelType:m});e.updateStatistics(),r?.length?u[H(p,d,s)+h]=e:u.push(e)}else{const e=u[s];e.pixels.push(a),l?e.mask&&(e.mask=B.A.combineBandMasks([e.mask,n])):e.mask=l?n:null}}}const f=Object.values(l).find((e=>e.attributeTable))?.attributeTable;return{extent:s,pixelBlocks:u,multidimensionalInfo:c,attributeTable:f,bandNames:c?void 0:n}}(t)}};(0,s._)([(0,f.MZ)({type:String,json:{write:!0}})],ie.prototype,"datasetFormat",void 0),(0,s._)([(0,f.MZ)({constructOnly:!0})],ie.prototype,"source",void 0),ie=(0,s._)([(0,d.$)("esri.layers.support.rasterDatasets.CovJSONRaster")],ie);const se=ie;var re=i(4576),ae=i(21325),ne=i(50103),oe=i(21312);function le(e,t){if(!e||!t)return null;const i=[];for(let s=0;s<e.length;s++)i.push(e[s]),i.push(t[s]);return i}function ce(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new E.A({wkid:t});if(e=String(e).trim(),(0,ae.jp)(e))return new E.A({wkt2:e});const i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;const s=i.indexOf("VERTCS"),r=i.indexOf("PROJCS"),a=r>-1?r:i.indexOf("GEOGCS");if(-1===a)return null;const n=e.slice(a,e.lastIndexOf("]",s)+1).trim(),o=e.slice(s,e.lastIndexOf("]")).trim();t=ue(n);const l=new E.A(t?{wkid:t}:{wkt:n}),c=ue(o);return c&&(l.vcsWkid=c),l}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=ue(e),new E.A(0!==t?{wkid:t}:{wkt:e})):null}function ue(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),s=i[0]?.toLowerCase();if(("epsg"===s||"esri"===s)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function fe(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if((0,ne.g7)(e,"SRS")){if(!t.spatialReference){const i=(0,ne.mX)(e);t.spatialReference=ce(i)}}else if((0,ne.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:s}=function(e){const t=(0,ne.V6)(e,"GeodataXform"),i=ce((0,ne.v7)(t,"SpatialReference/WKID")||(0,ne.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const s=(0,ne.v7)(t,"PolynomialOrder")??1,r=(0,ne.Ui)(t,"CoeffX/Double"),a=(0,ne.Ui)(t,"CoeffY/Double"),n=(0,ne.Ui)(t,"InverseCoeffX/Double"),o=(0,ne.Ui)(t,"InverseCoeffY/Double"),l=le(r,a),c=le(n,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new oe.A({spatialReference:i,polynomialOrder:s,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=s,t.spatialReference||(t.spatialReference=i)}else(0,ne.IC)(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=(0,ne.mX)(e)));else if((0,ne.g7)(e,"PAMRasterBand")){const i=function(e){const t=(0,ne.v7)(e,"NoDataValue"),i=(0,ne.V6)(e,"Histograms/HistItem"),s=(0,ne.v7)(i,"HistMin"),r=(0,ne.v7)(i,"HistMax"),a=(0,ne.v7)(i,"BucketCount"),n=(0,ne.mX)(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;(0,ne.IC)(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const f=(0,ne.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:n?.length&&null!=s&&null!=r?{min:s,max:r,size:a||n.length,counts:n}:null,sourceBandIndex:f,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(re.Ru):null;const s=!!i[0].histogram;t.histograms=s?i.map((e=>e.histogram)).filter(re.Ru):null}return t}var he=i(51244);let pe=class extends k.A{fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _open(e){const t=await this._fetchData(e);let{spatialReference:i,statistics:s,histograms:r,transform:a}=await this._fetchAuxiliaryData(e);const n=!i;n&&(i=new E.A({wkid:3857})),r?.length&&null==s&&(s=(0,K.Pg)(r));const{width:o,height:l}=t;let c=new N.A({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=a?a.forwardTransform(c):c;let f=!0;if(a){const e=a.forwardCoefficients;f=e&&0===e[1]&&0===e[2],f&&(a=null,c=u)}const h=new ee({source:{extent:u,nativeExtent:c,transform:a,pixelBlocks:[t],statistics:s,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:n},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(h.ioConfig.skipMapInfo=!0),await h.open(),h.source=null,this._set("rasterInfo",h.rasterInfo),this._inMemoryRaster=h}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,he.g)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new n.A("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const s=i.toLowerCase(),r="gif"===s||"bmp"===s||!(0,p.A)("ios"),a=await this.decodePixelBlock(t,{format:s,useCanvas:r,hasNoZlibMask:!0});if(null==a)throw new n.A("image-aux-raster:open","the data cannot be decoded");return a}async _fetchAuxiliaryData(e){const t=e?.signal,{skipExtensions:i=[],skipMapInfo:s}=this.ioConfig,r=s||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),a=this.datasetFormat,n="JPG"===a?"jgw":"PNG"===a?"pgw":"BMP"===a?"bpw":null,o=n&&i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),l=await(0,c.Lx)([r,o]);if(t?.aborted)throw(0,c.NK)();const u=fe(l[0].value?.data);if(!u.transform){const e=l[1].value?l[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,s._)([(0,f.MZ)({type:String,json:{write:!0}})],pe.prototype,"datasetFormat",void 0),pe=(0,s._)([(0,d.$)("esri.layers.support.rasterDatasets.ImageAuxRaster")],pe);const de=pe;var me=i(97768),ye=i(84952),ge=i(86738),we=i(20223),xe=i(87045),ve=i(25943),be=i(73037),Ie=i(82371);let _e=class extends k.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,s={}){const{storageInfo:r,extent:a}=this.rasterInfo,{transposeInfo:n}=r,o=null!=n&&!!s.transposedVariableName;if(this._slices&&!o&&null==s.sliceId)return null;const l=o?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null;let f,h;if(r.isBsqTile){const e=(s.bandIds?.length?s.bandIds:[0,1,2]).map((e=>this.request(c,{query:{...u,bandId:e},responseType:"array-buffer",signal:s.signal}))),t=await Promise.all(e),i=t.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),r=new Uint8Array(i);h=[];let a=0;for(const{data:e}of t)h.push(a),r.set(new Uint8Array(e),a),a+=e.byteLength;f=r.buffer}else f=(await this.request(c,{query:u,responseType:"array-buffer",signal:s.signal})).data;if(!f)return null;const p=o?n.tileSize:r.tileInfo.size,d=await this.decodePixelBlock(f,{width:p[0],height:p[1],planes:h?.length,offsets:h,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const m=r.blockBoundary[e];if("jpg"!==r.compression||i>m.minCol&&i<m.maxCol&&t>m.minRow&&t<m.maxRow)return d;const{origin:y,blockWidth:g,blockHeight:w}=r,{x,y:v}=this.getPyramidPixelSize(e),b=Math.round((a.xmin-y.x)/x)%g,I=Math.round((a.xmax-y.x)/x)%g||g,_=Math.round((y.y-a.ymax)/v)%w,S=Math.round((y.y-a.ymin)/v)%w||w,A=i===m.minCol?b:0,T=t===m.minRow?_:0,R=i===m.maxCol?I:g,C=t===m.maxRow?S:w;return(0,Y.z$)(d,{x:A,y:T},{width:R-A,height:C-T}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,s]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),r[1]?.[0]?.counts?.length||(r[1]=null),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let a=r-s+this._levelOffset;const n=i.srcLocation;for(;a>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(a,i.row,i.col,t))break}catch{}if(a--,s++,i=this.identifyPixelLocation(n,s,t.datumTransformation),null===i)return null}return-1===a||null==i?null:s}async _open(e){const t=e?.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const s=i.data;if(this.sourceJSON=s,!s)throw new n.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!s.tileInfo)throw new n.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=s.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(s.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===s.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=s.name?.slice(s.name.indexOf("/")+1)??"";const r=await this._fetchRasterInfo({signal:t});if(null==r)throw new n.A("image-server-raster:open","cannot initialize image service");(0,Ie.E9)(r,s);const a="Map"===this.tileType?function(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:r,maxLOD:a}=t;if(null!=r&&null!=a)return xe.A.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=r&&e<=a))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,r=i?t(i):1/0,a=s?t(s):-1/0;return xe.A.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=r&&i>=a}))})}return xe.A.fromJSON(e)}(s.tileInfo,s):xe.A.fromJSON(s.tileInfo);(0,me.Lw)(a);const[o,l]=this._computeMinMaxLOD(r,a),{extent:c,pixelSize:u}=r,f=.5/r.width*u.x,h=Math.max(u.x,u.y),{lods:p}=a;("Map"!==this.tileType&&0!==s.maxScale||Math.abs(u.x-u.y)>f||!p.some((e=>Math.abs(e.resolution-h)<f)))&&(u.x=u.y=o.resolution,r.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),r.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const d=o.level-l.level,[m,y]=a.size,g=[],w=[];p.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&g.push({x:e.resolution,y:e.resolution}),t<p.length-1&&w.push(Math.round(10*e.resolution/p[t+1].resolution)/10)})),g.sort(((e,t)=>e.x-t.x));const x=this.computeBlockBoundary(c,m,y,a.origin,g,d),v=g.length>1?g.slice(1):null;let b;s.transposeInfo&&(b={tileSize:[s.transposeInfo.rows,s.transposeInfo.cols],packetSize:r.keyProperties?._yxs.PacketSize??0});const I=w.length<=1||w.length>=3&&w.slice(0,-1).every((e=>e===w[0]))?w[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/d))/10;if(r.storageInfo=new we.A({blockWidth:a.size[0],blockHeight:a.size[1],pyramidBlockWidth:a.size[0],pyramidBlockHeight:a.size[1],pyramidResolutions:v,pyramidScalingFactor:I,compression:a.format,origin:a.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:a,isBsqTile:!!s.bsq,transposeInfo:b,blockBoundary:x}),function(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new be.A,e.extent=e.transform.forwardTransform(t))}(r),this._set("rasterInfo",r),s.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:r.storageInfo.tileInfo,parsedUrl:(0,ye.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new ve.d({layer:e})}}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=E.A.fromJSON(t.spatialReference||e.spatialReference),a=new ge.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new W.A({width:i,height:s,bandCount:3,extent:N.A.fromJSON(e),spatialReference:r,pixelSize:a,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=(0,Ie.Tw)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data?.slices)).catch((()=>null)):null,a=await Promise.all([s,r]);return this._slices=a[1],a[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:r}=t,a=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),n=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=r[0].level,[a,n];if("Raster"===o)return[r.find((e=>e.resolution===i.x))??a,n];const{minScale:l,maxScale:c}=this.sourceJSON;let u=a;c>0&&(u=r.find((e=>Math.abs(e.scale-c)<s)),u||(u=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??a));let f=n;return l>0&&(f=r.find((e=>Math.abs(e.scale-l)<s))??n,this._levelOffset=f.level-n.level),[u,f]}};(0,s._)([(0,f.MZ)({type:String,json:{write:!0}})],_e.prototype,"datasetFormat",void 0),(0,s._)([(0,f.MZ)()],_e.prototype,"tileType",void 0),_e=(0,s._)([(0,d.$)("esri.layers.support.rasterDatasets.ImageServerRaster")],_e);const Se=_e;var Ae=i(47124);const Te=new Map;Te.set("Int8","s8"),Te.set("UInt8","u8"),Te.set("Int16","s16"),Te.set("UInt16","u16"),Te.set("Int32","s32"),Te.set("UInt32","u32"),Te.set("Float32","f32"),Te.set("Float64","f32"),Te.set("Double64","f32");const Re=new Map;Re.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Re.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Re.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Re.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Ce=class extends k.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,s={}){const{blockWidth:r,blockHeight:a,blockBoundary:n}=this.rasterInfo.storageInfo,o=n[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:f,actualTileHeight:h}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(r*a);return new B.A({width:r,height:a,pixels:void 0,mask:e,validPixelCount:0})}const{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[];let y=0;for(y=0;y<d;y++)p&&!p.includes(y)||m.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:s.signal}));const g=await Promise.all(m),w=g.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),x=new Uint8Array(w),v=[];let b=0;for(y=0;y<d;y++)v.push(b),x.set(new Uint8Array(g[y].data),b),b+=g[y].data.byteLength;const I=Re.get(this.rasterInfo.storageInfo.compression).decoderFormat,_=await this.decodePixelBlock(x.buffer,{width:r,height:a,format:I,planes:p?.length||l,offsets:v,pixelType:c});if(null==_)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==I&&!_.mask&&(S=S[0],null!=S)){const e=_.width*_.height,t=new Uint8Array(e);if(Math.abs(S)>1e24)for(y=0;y<e;y++)Math.abs((_.pixels[0][y]-S)/S)>1e-6&&(t[y]=1);else for(y=0;y<e;y++)_.pixels[0][y]!==S&&(t[y]=1);_.mask=t}let A=0,T=0;if(f!==r||h!==a){let e=_.mask;if(e)for(y=0;y<a;y++)if(T=y*r,y<h)for(A=f;A<r;A++)e[T+A]=0;else for(A=0;A<r;A++)e[T+A]=0;else for(e=new Uint8Array(r*a),_.mask=e,y=0;y<h;y++)for(T=y*r,A=0;A<f;A++)e[T+A]=1}return _}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:s,files:r}=this._parseHeader(i.data),{skipMapInfo:a,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!a){const t=await this._fetchAuxiliaryData(e);null!=t&&(s.statistics=t.statistics??s.statistics,s.histograms=t.histograms,t.histograms&&null==s.statistics&&(s.statistics=(0,K.Pg)(t.histograms)))}a&&this.updateImageSpaceRasterInfo(s),this._set("rasterInfo",s),this._files=r;const o=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,s,r,a,n;if(Ae.Z){for(i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),s=new Uint8Array(r),a=0;a<e.byteLength/4;a++)for(n=0;n<4;n++)s[4*a+n]=i[4*a+3-n];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(o.data);const{blockWidth:l,blockHeight:c}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:f,height:h}=this.rasterInfo,p=[],d=this._getBandSegmentCount();let m=0,y=-1;for(;m<this._storageIndex.length;){y++;const e=Math.ceil(f/l/u**y)-1,t=Math.ceil(h/c/u**y)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,y>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=y),this.updateTileInfo()}_getBandSegmentCount(){return Re.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:s,blockHeight:r,pyramidScalingFactor:a}=this.rasterInfo.storageInfo,{width:n,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,f,h=0,p=0;for(f=0;f<e;f++)p=a**f,c=Math.ceil(n/s/p),u=Math.ceil(o/r/p),h+=c*u;p=a**e,c=Math.ceil(n/s/p),u=Math.ceil(o/r/p),h+=t*c+i,h*=4*l;const d=this._storageIndex.subarray(h,h+4*l);let m=0,y=0;const g=[];for(let e=0;e<l;e++)m=d[4*e]*2**32+d[4*e+1],y=m+d[4*e+2]*2**32+d[4*e+3],g.push({from:m,to:y});return{ranges:g,actualTileWidth:i<c-1?s:Math.ceil(n/p)-s*(c-1),actualTileHeight:t<u-1?r:Math.ceil(o/p)-r*(u-1)}}_parseHeader(e){const t=(0,ne.V6)(e,"MRF_META/Raster");if(!t)throw new n.A("mrf:open","not a valid MRF format");const i=(0,ne.V6)(t,"Size"),s=parseInt(i.getAttribute("x"),10),r=parseInt(i.getAttribute("y"),10),a=parseInt(i.getAttribute("c"),10),o=((0,ne.mX)(t,"Compression")||"none").toLowerCase();if(!Re.has(o))throw new n.A("mrf:open","currently does not support compression "+o);const l=(0,ne.mX)(t,"DataType")||"UInt8",c=Te.get(l);if(null==c)throw new n.A("mrf:open","currently does not support pixel type "+l);const u=(0,ne.V6)(t,"PageSize"),f=parseInt(u.getAttribute("x"),10),h=parseInt(u.getAttribute("y"),10),p=(0,ne.V6)(t,"DataValues");let d,m;if(p&&(m=p.getAttribute("NoData"),null!=m&&(d=m.trim().split(" ").map((e=>parseFloat(e))))),(0,ne.V6)(e,"MRF_META/CachedSource"))throw new n.A("mrf:open","currently does not support MRF referencing other data files");const y=(0,ne.V6)(e,"MRF_META/GeoTags"),g=(0,ne.V6)(y,"BoundingBox");let w,x=!1;if(null!=g){const e=parseFloat(g.getAttribute("minx")),t=parseFloat(g.getAttribute("miny")),i=parseFloat(g.getAttribute("maxx")),s=parseFloat(g.getAttribute("maxy")),r=(0,ne.mX)(y,"Projection")||"";let a=E.A.WGS84;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){const e=Number(r.slice(5));isNaN(e)||0===e||(a=new E.A({wkid:e}))}else a=ce(r)??E.A.WGS84;else x=!0,a=new E.A({wkid:3857});w=new N.A(e,t,i,s),w.spatialReference=a}else x=!0,w=new N.A({xmin:-.5,ymin:.5-r,xmax:s-.5,ymax:.5,spatialReference:new E.A({wkid:3857})});const v=(0,ne.V6)(e,"MRF_META/Rsets"),b=parseInt(v?.getAttribute("scale")||"2",10),I=w.spatialReference,_=new we.A({origin:new ge.A({x:w.xmin,y:w.ymax,spatialReference:I}),blockWidth:f,blockHeight:h,pyramidBlockWidth:f,pyramidBlockHeight:h,compression:o,pyramidScalingFactor:b}),S=new ge.A({x:w.width/s,y:w.height/r,spatialReference:I}),A=new W.A({width:s,height:r,extent:w,isPseudoSpatialReference:x,spatialReference:I,bandCount:a,pixelType:c,pixelSize:S,noDataValue:d,storageInfo:_}),T=(0,ne.mX)(e,"datafile"),R=(0,ne.mX)(e,"IndexFile");return{rasterInfo:A,files:{mrf:this.url,index:R||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Re.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return fe(t)}catch{return null}}};(0,s._)([(0,f.MZ)()],Ce.prototype,"_files",void 0),(0,s._)([(0,f.MZ)()],Ce.prototype,"_storageIndex",void 0),(0,s._)([(0,f.MZ)({type:String,json:{write:!0}})],Ce.prototype,"datasetFormat",void 0),Ce=(0,s._)([(0,d.$)("esri.layers.support.rasterDatasets.MRFRaster")],Ce);const Me=Ce;var Oe=i(15265);function Fe(e){const t=e.fields,i=e.records,s=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",r=[{name:s,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),a=r.map((e=>e.name)),n=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[s]=o++,l=1;l<a.length;l++)t[a[l]]=e[l-1];n.push({attributes:t})})),{displayFieldName:"",fields:r,features:n}}class Pe{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const s=t.getUint32(4,!0),r=t.getUint16(8,!0),a=t.getUint16(10,!0),n={version:i,recordCount:s,headerByteCount:r,recordByteCount:a};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,Oe.w)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<s&&e.byteLength-o>a;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,Oe.w)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const s=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(s.slice(0,4),10),parseInt(s.slice(4,6),10)-1,parseInt(s.slice(6,8),10)))}o+=t.length})),c.push(i)):o+=a}}return{header:n,fields:l,records:c,recordSet:Fe({fields:l,records:c})}}}var ke=i(45664),De=i(12196);const Ne=(e,t)=>e.get(t)?.values,Ee=(e,t)=>e.get(t)?.values?.[0];let Le=class extends k.A{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,s={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const r=await this._fetchRawTiffTile(e,t,i,!1,s);if(null!=r&&this._headerInfo.hasMaskBand){const a=await this._fetchRawTiffTile(e,t,i,!0,s);null!=a&&a.pixels[0]instanceof Uint8Array&&(r.mask=a.pixels[0])}return r}async _open(e){const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new n.A("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:s,firstIFDPos:r,isBigTiff:a}=(0,ke.uT)(i),l=[],c={fileChunk:i,posIFD:r,fileOffset:0};await this._readIFDs(l,c,s,a?8:4,t);const{imageInfo:u,rasterInfo:f}=function(e){const t=(0,ke.uc)(e),{width:i,height:s,tileWidth:r,tileHeight:a,planes:n,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:f,pyramidBlockHeight:h,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:y}=t;let g=ce(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),w=!!t.isPseudoGeographic;null==g&&(w=!0,g=new E.A({wkid:3857}));const x=new N.A({...t.extent,spatialReference:g}),v=new ge.A(x?{x:x.xmin,y:x.ymax,spatialReference:g}:{x:0,y:0}),b=new we.A({blockWidth:r,blockHeight:a,pyramidBlockWidth:f,pyramidBlockHeight:h,compression:l,origin:v,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidResolutions:p,blockBoundary:d}),I=new ge.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),_=y?{BandProperties:y.bandProperties,DataType:y.dataType}:{};let S=null;const A=Ee(e[0],"PHOTOMETRICINTERPRETATION"),T=Ne(e[0],"COLORMAP");if(A<=3&&T?.length>3&&T.length%3==0){S=[];const e=T.length/3;for(let t=0;t<e;t++)S.push([t,T[t]>>>8,T[t+e]>>>8,T[t+2*e]>>>8])}const R=new W.A({width:i,height:s,bandCount:n,pixelType:o,pixelSize:I,storageInfo:b,spatialReference:g,isPseudoSpatialReference:w,keyProperties:_,extent:x,colormap:S,statistics:y?y.statistics:null});if(m?.length&&(R.nativeExtent=new N.A({xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:g}),R.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),R.extent=R.transform.forwardTransform(R.nativeExtent),R.pixelSize=new ge.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:g}),b.origin.x=-.5,b.origin.y=.5),p){const{x:e,y:t}=R.pixelSize;p.forEach((i=>{i.x*=e,i.y*=t}))}return{imageInfo:t,rasterInfo:R}}(l),h=(0,ke.zS)(l),p=(0,ke.r9)(l);if(this._headerInfo={littleEndian:s,isBigTiff:a,ifds:l,pyramidIFDs:h,maskIFDs:p,...u},this._set("rasterInfo",f),!u.isSupported)throw new n.A("tiffraster:open","this tiff is not supported: "+u.message);if(!u.tileWidth)throw new n.A("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");f.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const d=l[0].get("PREDICTOR")?.values?.[0],m=l[0].get("SAMPLEFORMAT")?.values?.[0];if(3===m&&2===d)throw new n.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:y,skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")&&!y){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,K.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new ge.A({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}(t,f)}g.includes("vat.dbf")||1!==f.bandCount||"u8"!==f.pixelType||y||(f.attributeTable=await this._fetchAuxiliaryTable(e),null!=f.attributeTable&&(f.keyProperties.DataType="thematic")),y&&this.updateImageSpaceRasterInfo(f),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:s,posIFD:r}=e;return(r+8>=i.byteLength||r<0)&&(s=r+s,i=(await this.request(this.url,{range:{from:s,to:s+this._bufferSize},responseType:"array-buffer",signal:t})).data,r=0),{fileChunk:i,fileOffset:s,posIFD:r}}async _readIFDs(e,t,i,s=4,r){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,r);const a=await this._readIFD(t,i,De.NB,s,r);if(!a?.ifd)throw new n.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(a.ifd),!a.nextIFD)return null;t.posIFD=a.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,s,r)}async _readIFD(e,t,i=De.NB,s=4,r){let{fileChunk:a,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;const l=(0,ke.JM)(a,t,n,o,i,s);if(l.success){const e=[];if(l.ifd?.forEach((t=>{t.values||e.push(t)})),e.length>0&&await this._fillOffsets(e,t,l.nextIFD,r),l.ifd?.has("GEOKEYDIRECTORY")){const e=l.ifd.get("GEOKEYDIRECTORY"),i=e?.values;if(i&&i.length>4){const s=i[0]+"."+i[1]+"."+i[2];n=e.valueOffset+6-o;const l=await this._validateOrFetchHeaderBuffer({fileChunk:a,posIFD:n,fileOffset:o},r),c=await this._readIFD(l,t,De.YC,2,r);e.data=c?.ifd,e.data&&e.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}return l}return l.requiredBufferSize?(a=(await this.request(this.url,{range:{from:o,to:o+n+l.requiredBufferSize+8},responseType:"array-buffer",signal:r})).data,a.byteLength<n+l.requiredBufferSize?null:(e.fileChunk=a,e.fileOffset=o,this._readIFD(e,t,i,s,r))):null}async _fillOffsets(e,t,i,s){const r=e.filter((e=>null!=e.offlineOffsetSize));if(0===r.length)return;const a=r.map((e=>e.offlineOffsetSize)),n=Math.min.apply(null,a.map((e=>e[0]))),o=Math.max.apply(null,a.map((e=>e[0]+e[1])));let l=1===a.length||o-n<=this._bufferSize;if(!l&&a.length>1&&(a.sort(((e,t)=>e[0]-t[0])),l=a.reduce(((e,t)=>e===t[0]?t[0]+t[1]:0),a[0][0])===o),l){const e=await this._fetchOffsets(n,Math.max(o,n+this._bufferSize),s);return void r.forEach((i=>(0,ke.Cr)(e,t,i,n)))}const c=r.map((async e=>{const i=e.offlineOffsetSize,r=await this._fetchOffsets(i[0],i[1]+i[0],s);(0,ke.Cr)(r,t,e,i[0])}));await Promise.all(c)}async _fetchOffsets(e,t,i){const s=[],r=this._chunkSize,a=Math.ceil((t-e)/r);let n=e;for(let e=0;e<a;e++)s.push(this.request(this.url,{range:{from:n,to:e===a-1?t:n+r-1},responseType:"array-buffer",signal:i})),n+=r;const o=await Promise.all(s);if(1===a)return o[0].data;const l=new Uint8Array(t-e+1);for(let e=0;e<a;e++)l.set(new Uint8Array(o[e].data),e*r);return l.buffer}async _fetchRawTiffTile(e,t,i,s,r={}){const a=this._getTileLocation(e,t,i,s);if(!a)return null;const{ranges:n,actualTileWidth:o,actualTileHeight:l,ifd:c}=a,u=n.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal}))),f=await Promise.all(u),h=f.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===f.length?f[0].data:new ArrayBuffer(h),d=[0],m=[0];if(f.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<f.length;t++){const s=f[t].data;e.set(new Uint8Array(s),i),d[t]=i,i+=s.byteLength,m[t]=s.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==w)return null;let x,v,b;if(o!==y||l!==g){let e=w.mask;if(e)for(x=0;x<g;x++)if(b=x*y,x<l)for(v=o;v<y;v++)e[b+v]=0;else for(v=0;v<y;v++)e[b+v]=0;else for(e=new Uint8Array(y*g),w.mask=e,x=0;x<l;x++)for(b=x*y,v=0;v<o;v++)e[b+v]=1}return w}_getTileLocation(e,t,i,s=!1){const{firstPyramidLevel:r,blockBoundary:a}=this.rasterInfo.storageInfo,n=0===e?0:e-(r-1),{_headerInfo:o}=this;if(!o)return null;const l=s?o.maskIFDs[n]:0===n?o?.ifds[0]:o?.pyramidIFDs[n-1];if(!l)return null;const c=(0,ke.XO)(l,o),u=Ne(l,"TILEOFFSETS");if(void 0===u)return null;const f=Ne(l,"TILEBYTECOUNTS"),{minRow:h,minCol:p,maxRow:d,maxCol:m}=a[n];if(t>d||i>m||t<h||i<p)return null;const y=Ee(l,"IMAGEWIDTH"),g=Ee(l,"IMAGELENGTH"),w=Ee(l,"TILEWIDTH"),x=Ee(l,"TILELENGTH"),v=[];if(c){const{bandCount:e}=this.rasterInfo;for(let s=0;s<e;s++){const e=s*(d+1)*(m+1)+t*(m+1)+i;v[s]={from:u[e],to:u[e]+f[e]-1}}}else{const e=t*(m+1)+i;v.push({from:u[e],to:u[e]+f[e]-1})}for(let e=0;e<v.length;e++)if(null==v[e].from||!v[e].to||v[e].to<0)return null;return{ranges:v,ifd:l,actualTileWidth:i===m&&y%w||w,actualTileHeight:t===d&&g%x||x}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return fe(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Pe.parse(t);return i?.recordSet?te.A.fromJSON(i.recordSet):null}catch{return null}}};(0,s._)([(0,f.MZ)()],Le.prototype,"_files",void 0),(0,s._)([(0,f.MZ)()],Le.prototype,"_headerInfo",void 0),(0,s._)([(0,f.MZ)()],Le.prototype,"_bufferSize",void 0),(0,s._)([(0,f.MZ)()],Le.prototype,"_chunkSize",void 0),(0,s._)([(0,f.MZ)({type:String,json:{write:!0}})],Le.prototype,"datasetFormat",void 0),Le=(0,s._)([(0,d.$)("esri.layers.support.rasterDatasets.TIFFRaster")],Le);const Be=Le,ze=new Map;ze.set("MRF",{desc:"Meta Raster Format",constructor:Me}),ze.set("TIFF",{desc:"GeoTIFF",constructor:Be}),ze.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Se}),ze.set("JPG",{desc:"JPG Raster Format",constructor:de}),ze.set("PNG",{desc:"PNG Raster Format",constructor:de}),ze.set("GIF",{desc:"GIF Raster Format",constructor:de}),ze.set("BMP",{desc:"BMP Raster Format",constructor:de}),ze.set("CovJSON",{desc:"COVJSON Raster Format",constructor:se}),ze.set("MEMORY",{desc:"In Memory Raster Format",constructor:ee});class Je{static get supportedFormats(){const e=new Set;return ze.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,source:s,sourceJSON:r}=e;let a=e.datasetFormat??i?.datasetFormat;null==a&&(t.includes(".")?a=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===s?.type?.toLowerCase()?a="CovJSON":s?.extent&&s.pixelblocks&&(a="MEMORY")),"OVR"===a||"TIF"===a?a="TIFF":"JPG"===a||"JPEG"===a||"JFIF"===a?a="JPG":"COVJSON"===a&&(a="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(a="RasterTileServer");const o={url:t,source:s,sourceJSON:r,datasetFormat:a,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(o).forEach((e=>{null==o[e]&&delete o[e]})),a){if(!this.supportedFormats.has(a))throw new n.A("rasterfactory:open","not a supported format "+a);if("CRF"===a)throw new n.A("rasterfactory:open",`cannot open raster: ${t}`);const i=new(0,ze.get(a).constructor)(o);return await i.open({signal:e.signal}),i}const l=Array.from(ze.keys()).filter((e=>"CovJSON"!==e&&"Memory"!==e));let c=0;const u=()=>{if(a=l[c++],!a)return null;if("CRF"===a)return null;const t=new(0,ze.get(a).constructor)(o);return t.open({signal:e.signal}).then((()=>t)).catch((()=>u()))};return u()}static register(e,t,i){ze.has(e.toUpperCase())||ze.set(e.toUpperCase(),{desc:t,constructor:i})}}var Ue=i(6049),$e=i(30291),Ve=i(92935);let je=class extends((0,g.dM)((0,A.j)((0,v.q)((0,b.A)((0,_.H)((0,w.d)((0,x.o)((0,I.G)((0,T.e)((0,y.b)((0,S.J)((0,l.P)(a.A.ClonableMixin(m.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,c.sg)((async(e,t,s)=>{const{save:r,saveAs:a}=await i.e(9838).then(i.bind(i,59838));switch(e){case Ve.X.SAVE:return r(this,t);case Ve.X.SAVE_AS:return a(this,s,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.QP).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[(0,M.rZ)("Pixel Value"),(0,M.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){const t=(0,M.jC)(i);e.push(...t)}const s=t?.dataType,r=t?.multidimensionalInfo;if(("vector-magdir"===s||"vector-uv"===s)&&null!=r){const t=r.variables[0].unit?.trim(),i=(0,M.DV)(t),s=(0,M.y6)();e.push(i,s)}if(r){const t=(0,M.AL)(r);e.push(...t)}return e}createPopupTemplate(e){const{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map((({name:e})=>e)).filter((e=>e!==M.F_.rawServicePixelValue))),s=(0,$e.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:r}=this.raster;return s?.fieldInfos&&r&&(0,M.h4)(s.fieldInfos,r),s}async generateRasterInfo(e,t){if(e=(0,h.PZ)(O.A,e),await this.load(),!e||"none"===e.functionName?.toLowerCase())return this.serviceRasterInfo;try{const{rasterInfo:i}=await this._openFunctionRaster(e,t);return i}catch(e){if(e instanceof n.A)throw e;throw new n.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(Ve.X.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Ve.X.SAVE_AS,t,e)}write(e,t){const i=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new n.A("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,F.q)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{const{url:t,rasterFunction:i,source:s}=this;if(!t&&!s)throw new n.A("imagery-tile-layer:open","missing url or source parameter");s?await this._openFromSource(s,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}const i=this.raster.rasterInfo;if(!i)throw new n.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,u.wB)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,F.p)(e),this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,i){const s=[e];t&&(0,Ue.UD)(t.toJSON(),s);const r=await Promise.all(s.map((e=>Je.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:i})))),a=r.findIndex((e=>null==e));if(a>-1)throw new n.A("imagery-tile-layer:open",`cannot open raster: ${s[a]}`);return this._primaryRasters=r,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const i=await Je.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==i)throw new n.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){const i="the tiled imagery data source is not supported",s="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!s)throw new n.A("imagery-tile-layer:open",i);"MEMORY"===s&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});const r=await Je.open({url:"",source:e,datasetFormat:s,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==r)throw new n.A("imagery-tile-layer:open",i);this._primaryRasters=[r],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=r}async _openFunctionRaster(e,t){const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const s=(0,Ue.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),r=new P.A({rasterFunction:s});return await r.open(t),r}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof n.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};(0,s._)([(0,f.MZ)({clonable:!1})],je.prototype,"_primaryRasters",void 0),(0,s._)([(0,f.MZ)(R.fV)],je.prototype,"legendEnabled",void 0),(0,s._)([(0,f.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],je.prototype,"isReference",void 0),(0,s._)([(0,f.MZ)({type:["show","hide"]})],je.prototype,"listMode",void 0),(0,s._)([(0,f.MZ)({json:{read:!0,write:!0}})],je.prototype,"blendMode",void 0),(0,s._)([(0,f.MZ)({type:O.A,json:{name:"renderingRule",write:!0}})],je.prototype,"rasterFunction",void 0),(0,s._)([(0,f.MZ)()],je.prototype,"sourceJSON",void 0),(0,s._)([(0,f.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],je.prototype,"version",void 0),(0,s._)([(0,f.MZ)({readOnly:!0,json:{read:!1}})],je.prototype,"type",void 0),(0,s._)([(0,f.MZ)({type:["ArcGISTiledImageServiceLayer"]})],je.prototype,"operationalLayerType",void 0),(0,s._)([(0,f.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],je.prototype,"popupEnabled",void 0),(0,s._)([(0,f.MZ)({type:r.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],je.prototype,"popupTemplate",void 0),(0,s._)([(0,f.MZ)({readOnly:!0})],je.prototype,"defaultPopupTemplate",null),(0,s._)([(0,f.MZ)({readOnly:!0,type:[C.A]})],je.prototype,"fields",void 0),(0,s._)([(0,f.MZ)({readOnly:!0,type:[C.A]})],je.prototype,"rasterFields",null),(0,s._)([(0,f.MZ)({constructOnly:!0})],je.prototype,"source",void 0),je=(0,s._)([(0,d.$)("esri.layers.ImageryTileLayer")],je);const qe=je},56551:(e,t,i)=>{i.d(t,{H:()=>h});var s=i(90237),r=i(10107),a=(i(44208),i(53966),i(87811),i(40608)),n=i(69540),o=i(25482),l=i(56507),c=i(93223),u=i(94359);let f=class extends(n.A.ClonableMixin(o.A)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,s._)([(0,r.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,s._)([(0,r.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,c.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,s._)([(0,r.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,s._)([(0,r.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,s._)([(0,r.MZ)({types:u.uy,json:{write:!0,origins:{"web-scene":{types:u.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,s._)([(0,a.$)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=class extends e{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,s._)([(0,r.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],t.prototype,"activePresetRendererName",void 0),(0,s._)([(0,r.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],t.prototype,"presetRenderers",void 0),t=(0,s._)([(0,a.$)("esri.layers.mixins.RasterPresetRendererMixin")],t),t}},69397:(e,t,i)=>{i.d(t,{$B:()=>r,Qf:()=>c,Qh:()=>o,RS:()=>a,ez:()=>h,lM:()=>n,qK:()=>f});var s=i(34275);function r(e){return 32+e.length}const a=16;function n(e){if(!e)return 0;let t=f;for(const i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function o(e){if(!e)return 0;if("number"==typeof e[0])return c(e);if(Array.isArray(e))return function(e){const t=e.length;if(0===t||"number"==typeof e[0])return u(e,8);let i=h;for(let s=0;s<t;s++)i+=l(e[s]);return i}(e);let t=f;for(const i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?o(e):f;case"string":return r(e);case"number":return a;case"boolean":return 4;default:return 8}}function c(...e){return e.reduce(((e,t)=>e+(t?(0,s.iu)(t)?t.byteLength+p:Array.isArray(t)?u(t,a):0:0)),0)}function u(e,t){return h+e.length*t}const f=32,h=16,p=145},71903:(e,t,i)=>{var s;i.d(t,{u:()=>s}),function(e){e[e.KILOBYTES=1024]="KILOBYTES",e[e.MEGABYTES=1048576]="MEGABYTES",e[e.GIGABYTES=1073741824]="GIGABYTES"}(s||(s={}))},73037:(e,t,i)=>{i.d(t,{A:()=>c});var s,r=i(90237),a=i(10107),n=(i(44208),i(53966),i(87811),i(93223)),o=i(40608),l=i(82434);let c=s=class extends l.A{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}clone(){return new s({tolerance:this.tolerance})}};(0,r._)([(0,n.e)({GCSShiftXform:"gcs-shift"})],c.prototype,"type",void 0),(0,r._)([(0,a.MZ)()],c.prototype,"tolerance",void 0),c=s=(0,r._)([(0,o.$)("esri.layers.support.rasterTransforms.GCSShiftTransform")],c)},82371:(e,t,i)=>{i.d(t,{E9:()=>d,Tw:()=>h,X6:()=>p});var s=i(78888),r=i(5443),a=i(86738),n=i(16930),o=i(87186),l=i(20223),c=i(2272),u=i(22671);async function f(e,t,i){const f=(0,c.Dl)(e),{rasterFunction:h,sourceJSON:p}=t||{},d=h?JSON.stringify(h.rasterFunctionDefinition||h):null,m=(0,c.lF)({...f.query,renderingRule:d,f:"json"}),y=(0,c.jV)(m,i);e=f.path;const g=p||await(0,s.A)(e,y).then((e=>e.data)),w=g.hasRasterAttributeTable?(0,s.A)(`${e}/rasterAttributeTable`,y):null,x=g.hasColormap?(0,s.A)(`${e}/colormap`,y):null,v=g.hasHistograms?(0,s.A)(`${e}/histograms`,y):null,b=g.currentVersion>=10.3?(0,s.A)(`${e}/keyProperties`,y):null,I=g.hasMultidimensions?(0,s.A)(`${e}/multidimensionalInfo`,y):null,_=await Promise.allSettled([w,x,v,b,I]);let S=null;if(g.minValues&&g.minValues.length===g.bandCount){S=[];for(let e=0;e<g.minValues.length;e++)S.push({min:g.minValues[e],max:g.maxValues[e],avg:g.meanValues[e],stddev:g.stdvValues[e]})}const A=r.A.fromJSON(g.extent),T=Math.ceil(A.width/g.pixelSizeX-.1),R=Math.ceil(A.height/g.pixelSizeY-.1),C=n.A.fromJSON(g.spatialReference||g.extent.spatialReference),M="fulfilled"===_[0].status?_[0].value?.data:null,O=M?.features?.length?u.A.fromJSON(M):null,F="fulfilled"===_[1].status?_[1].value?.data.colormap:null,P=F?.length?F:null,k="fulfilled"===_[2].status?_[2].value?.data.histograms:null,D=k?.[0]?.counts?.length?k:null,N="fulfilled"===_[3].status?_[3].value?.data??{}:{},E="fulfilled"===_[4].status?_[4].value?.data.multidimensionalInfo:null,L=E?.variables?.length?E:null;L&&L.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),e.dimensions?.forEach((e=>{"StdTime"!==e.name||e.recurring||e.unit||(e.unit="ISO8601")}))}));const{defaultVariable:B,serviceDataType:z}=g;B&&B!==N.DefaultVariable&&(N.DefaultVariable=B),z?.includes("esriImageServiceDataTypeVector")&&!z.includes(N.DataType)&&(N.DataType=z.replace("esriImageServiceDataType",""));let J=g.noDataValue;g.noDataValues?.length&&g.noDataValues.some((e=>e!==J))&&(J=g.noDataValues);const U=g.transposeInfo?new l.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a.A({x:g.extent.xmin,y:g.extent.ymax,spatialReference:C}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(T,R))/Math.LN2-8)),transposeInfo:g.transposeInfo}):void 0;return new o.A({width:T,height:R,bandCount:g.bandCount,extent:r.A.fromJSON(g.extent),spatialReference:C,pixelSize:new a.A({x:g.pixelSizeX,y:g.pixelSizeY,spatialReference:C}),pixelType:g.pixelType.toLowerCase(),statistics:S,attributeTable:O,colormap:P,histograms:D,keyProperties:N,noDataValue:J,multidimensionalInfo:L,storageInfo:U})}function h(e,t,i){return f(e,{sourceJSON:t},i)}function p(e,t,i){return f(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},82434:(e,t,i)=>{i.d(t,{A:()=>o});var s=i(90237),r=i(25482),a=i(10107),n=(i(44208),i(53966),i(87811),i(40608));let o=class extends r.A{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,s._)([(0,a.MZ)()],o.prototype,"affectsPixelSize",null),(0,s._)([(0,a.MZ)({json:{write:!0}})],o.prototype,"spatialReference",void 0),o=(0,s._)([(0,n.$)("esri.layers.support.rasterTransforms.BaseRasterTransform")],o)}}]);