@arcgis/core 5.2.0-next.148 → 5.2.0-next.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/09b9a886363bc1197785.js +1 -0
  3. package/assets/esri/core/workers/chunks/0ad0484ffcbe4ad21bd3.js +1 -0
  4. package/assets/esri/core/workers/chunks/{52c25809edf7ac008a52.js → 12a7997a40c77f5c9160.js} +1 -1
  5. package/assets/esri/core/workers/chunks/18787aa685524b958561.js +1 -0
  6. package/assets/esri/core/workers/chunks/{776ae25a34352d3468bc.js → 19743dedaa40446259ec.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{27a425d87c57b91489b3.js → 21f45a47708e6e43147f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2c626f525f3483c03477.js +1 -0
  9. package/assets/esri/core/workers/chunks/{7a05b18f655c1167ce0a.js → 2ef5237e4c876d6a4ee0.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{0a078721c7e0e24027f0.js → 320e5942a098dd104366.js} +1 -1
  11. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +1 -0
  12. package/assets/esri/core/workers/chunks/45367aa8e5c5d574de94.js +1 -0
  13. package/assets/esri/core/workers/chunks/47d074136a7f8e551a9a.js +1 -0
  14. package/assets/esri/core/workers/chunks/{24cc7b6b5e307a89cdd5.js → 50036a323c2e7f155311.js} +1 -1
  15. package/assets/esri/core/workers/chunks/5116b569a8dbda4910c8.js +1 -0
  16. package/assets/esri/core/workers/chunks/{b2737120c5999b2f3909.js → 55dcbf296d8d0092e473.js} +1 -1
  17. package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +1 -0
  18. package/assets/esri/core/workers/chunks/6b04285726b803b82564.js +1 -0
  19. package/assets/esri/core/workers/chunks/6c9acd9e4e201dc380e9.js +1 -0
  20. package/assets/esri/core/workers/chunks/7449568eb2305bf2d650.js +1 -0
  21. package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +1 -0
  22. package/assets/esri/core/workers/chunks/7d212c415f2709037408.js +1 -0
  23. package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +1 -0
  24. package/assets/esri/core/workers/chunks/8414ffd937c1099e0bbc.js +1 -0
  25. package/assets/esri/core/workers/chunks/9401cc22373566e1171e.js +1 -0
  26. package/assets/esri/core/workers/chunks/97d6ef9e34a43ad2e556.js +1 -0
  27. package/assets/esri/core/workers/chunks/{c76c42c74eedd43263d3.js → 9dd1fc56eb1ea6eb705e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/a07cb6a2f5b66d4e9f15.js +1 -0
  29. package/assets/esri/core/workers/chunks/a40b6d8b5c73e06e14d4.js +1 -0
  30. package/assets/esri/core/workers/chunks/a7f3576208f295b670d6.js +1 -0
  31. package/assets/esri/core/workers/chunks/a80e49acc827dbf3b524.js +1 -0
  32. package/assets/esri/core/workers/chunks/aeaaff7a4b1a99540f52.js +1 -0
  33. package/assets/esri/core/workers/chunks/b19b6102ed2d6f67b43b.js +1 -0
  34. package/assets/esri/core/workers/chunks/b1b4066e8d1c0c9656e5.js +1 -0
  35. package/assets/esri/core/workers/chunks/b4334713bacdfe40ce3d.js +1 -0
  36. package/assets/esri/core/workers/chunks/bbec9d2e3b75a5c59681.js +1 -0
  37. package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +1 -0
  38. package/assets/esri/core/workers/chunks/c8d178a0c82fffd7fed5.js +1 -0
  39. package/assets/esri/core/workers/chunks/c8d6bb5cca49926a0214.js +1 -0
  40. package/assets/esri/core/workers/chunks/cde4b044e013b9e41591.js +1 -0
  41. package/assets/esri/core/workers/chunks/{7a4f1484b119ebafc2e7.js → d2347d6aa1c57fd57029.js} +1 -1
  42. package/assets/esri/core/workers/chunks/dca35dbe427605ef6fcc.js +1 -0
  43. package/assets/esri/core/workers/chunks/f1df76f098a3cc924832.js +1 -0
  44. package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +1 -0
  45. package/assets/esri/core/workers/chunks/f8a83d447b7aef051876.js +1 -0
  46. package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +1 -0
  47. package/config.js +1 -1
  48. package/core/Loadable.js +1 -1
  49. package/geometry/HeightModelInfo.js +1 -1
  50. package/kernel.js +1 -1
  51. package/layers/BaseDynamicLayer.d.ts +1 -0
  52. package/layers/BaseElevationLayer.d.ts +2 -0
  53. package/layers/BaseTileLayer.d.ts +12 -9
  54. package/layers/CSVLayer.d.ts +0 -15
  55. package/layers/FeatureLayer.d.ts +2 -15
  56. package/layers/GeoJSONLayer.d.ts +0 -52
  57. package/layers/GeoRSSLayer.d.ts +0 -44
  58. package/layers/ParquetLayer.d.ts +81 -3
  59. package/layers/ParquetLayer.js +1 -1
  60. package/layers/VectorTileLayer.d.ts +2 -12
  61. package/layers/mixins/RefreshableLayer.d.ts +1 -3
  62. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  63. package/layers/support/layersLoader.js +1 -1
  64. package/package.json +2 -2
  65. package/popup/FeaturesModel.d.ts +1 -1
  66. package/popup/FeaturesModel.js +1 -1
  67. package/portal/support/portalLayers.js +1 -1
  68. package/renderers/VectorFieldRenderer.d.ts +4 -4
  69. package/smartMapping/renderers/color.js +1 -1
  70. package/smartMapping/renderers/dotDensity.js +1 -1
  71. package/smartMapping/renderers/heatmap.js +1 -1
  72. package/smartMapping/renderers/pieChart.js +1 -1
  73. package/smartMapping/renderers/type.js +1 -1
  74. package/smartMapping/statistics/heatmapStatistics.js +1 -1
  75. package/smartMapping/statistics/histogram.js +1 -1
  76. package/smartMapping/statistics/summaryStatistics.js +1 -1
  77. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  78. package/smartMapping/statistics/uniqueValues.js +1 -1
  79. package/smartMapping/support/adapters/support/layerUtils.js +1 -1
  80. package/smartMapping/types.d.ts +3 -1
  81. package/views/3d/terrain/TerrainData.js +1 -1
  82. package/views/3d/terrain/terrainUtils.js +1 -1
  83. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  84. package/views/DOMContainer.d.ts +27 -9
  85. package/views/DOMContainer.js +1 -1
  86. package/views/PopupView.d.ts +6 -0
  87. package/views/VideoView.d.ts +27 -9
  88. package/views/View.d.ts +16 -7
  89. package/views/View.js +1 -1
  90. package/views/draw/support/InteractiveHandle.js +1 -1
  91. package/views/interactive/snapping/SnappingManagerPool.js +1 -1
  92. package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
  93. package/views/layers/FeatureLikeLayerView.d.ts +1 -2
  94. package/views/layers/ParquetLayerView.d.ts +15 -0
  95. package/assets/esri/core/workers/chunks/05963f57cbe5a5249496.js +0 -1
  96. package/assets/esri/core/workers/chunks/131e89663014bc76c4ee.js +0 -1
  97. package/assets/esri/core/workers/chunks/14a3808427deaaa85bf2.js +0 -1
  98. package/assets/esri/core/workers/chunks/16053ce50642c5ffbfa9.js +0 -1
  99. package/assets/esri/core/workers/chunks/19689c66776b39cec234.js +0 -1
  100. package/assets/esri/core/workers/chunks/1a6027f08893aba9e677.js +0 -1
  101. package/assets/esri/core/workers/chunks/1b3f59fcad6e14c4d0e0.js +0 -1
  102. package/assets/esri/core/workers/chunks/20458fffda7692c78135.js +0 -1
  103. package/assets/esri/core/workers/chunks/2164fcaced72b0fda31f.js +0 -1
  104. package/assets/esri/core/workers/chunks/219d0935ce281902a49f.js +0 -1
  105. package/assets/esri/core/workers/chunks/2416518db4a0117541a8.js +0 -1
  106. package/assets/esri/core/workers/chunks/25b0885d3bc190b28c04.js +0 -1
  107. package/assets/esri/core/workers/chunks/2e75df54852d65e71330.js +0 -1
  108. package/assets/esri/core/workers/chunks/39d1d2fbe94afcd0a590.js +0 -1
  109. package/assets/esri/core/workers/chunks/3e9f056e4d1f0d067fc6.js +0 -1
  110. package/assets/esri/core/workers/chunks/43321f244effd3d67069.js +0 -1
  111. package/assets/esri/core/workers/chunks/47e6b5631a625298db5b.js +0 -1
  112. package/assets/esri/core/workers/chunks/561c48cb4d49b150765b.js +0 -1
  113. package/assets/esri/core/workers/chunks/5ea8809b6519c05ad9f6.js +0 -1
  114. package/assets/esri/core/workers/chunks/5f0c06f59121e09091f7.js +0 -1
  115. package/assets/esri/core/workers/chunks/62795a1573cbaa4b8e7a.js +0 -1
  116. package/assets/esri/core/workers/chunks/70ee81ba22badbbf045c.js +0 -1
  117. package/assets/esri/core/workers/chunks/794e5a67a88cb10c1a19.js +0 -1
  118. package/assets/esri/core/workers/chunks/841f67baf6a1634ada48.js +0 -1
  119. package/assets/esri/core/workers/chunks/8602b3587d4bdd9cc9f5.js +0 -1
  120. package/assets/esri/core/workers/chunks/898f43feeec74acde1ec.js +0 -1
  121. package/assets/esri/core/workers/chunks/8ef802ef8d108ae2e473.js +0 -1
  122. package/assets/esri/core/workers/chunks/94c5f3bc07fe516dafbe.js +0 -1
  123. package/assets/esri/core/workers/chunks/a101b89c18488f213d80.js +0 -1
  124. package/assets/esri/core/workers/chunks/a337ca943862b30b978d.js +0 -1
  125. package/assets/esri/core/workers/chunks/ac03976b8450331aa31e.js +0 -1
  126. package/assets/esri/core/workers/chunks/b0fd7cd5fc9526d30ddc.js +0 -1
  127. package/assets/esri/core/workers/chunks/b3e812c3a06b486f05d2.js +0 -1
  128. package/assets/esri/core/workers/chunks/ba48045a81acc4cda927.js +0 -1
  129. package/assets/esri/core/workers/chunks/c7699edd14497d174445.js +0 -1
  130. package/assets/esri/core/workers/chunks/dbcac8c1a76d4a9db13d.js +0 -1
  131. package/assets/esri/core/workers/chunks/de8d7f11f5a078c01b83.js +0 -1
  132. package/assets/esri/core/workers/chunks/f05de08e194a3f9b96f2.js +0 -1
  133. package/assets/esri/core/workers/chunks/f2b69bd704db62915a6b.js +0 -1
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1003],{1003(e,t,i){i.r(t),i.d(t,{default:()=>me});var a=i(49186),r=i(32198),s=i(91429),n=i(49859),l=i(68197),o=i(5443),f=i(16930),u=i(73444),h=i(94778),c=i(14140);function p(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function d(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function m(e){let{axes:t}=e.domain,i=Object.keys(t),a=[],r=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];p(o)?s=e:d(o)&&(n=e);let f=t[o],u=[];if("values"in f){f.values.forEach(e=>u.push("string"==typeof e?new Date(e).getTime():e));let e=u[1]-u[0];a.push([u[0]-.5*e,u[u.length-1]+.5*e]),r.push(e)}else{let{start:e,stop:t,num:i}=f,s=(t-e)/(i-1);a.push([e-.5*s,t+.5*s]),r.push(s);for(let t=0;t<i;t++)u.push(e+s*t)}l.push({name:o,values:u,extent:[u[0],u[u.length-1]]})}s>-1&&-1===n?n=+(0===s):n>-1&&-1===s?s=+(0===n):-1===n&&-1===s&&(s=0,n=1),l=l.filter((e,t)=>t!==s&&t!==n);let{referencing:u}=e.domain,h=u.find(e=>e.coordinates.includes(i[s])).system.id,c=h?.slice(h.lastIndexOf("/")+1),m=null==c||"CRS84"===c?4326:Number(c),g=new f.A({wkid:m}),[y,x]=a[s],[w,I]=a[n],b=new o.A({xmin:y,xmax:x,ymin:w,ymax:I,spatialReference:g});return{width:Math.round(b.width/r[s]),height:Math.round(b.height/r[n]),extent:b,dimensions:l}}function g(e){let t=(0,u.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function y(){return Math.round(255*Math.random())}function x(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,a]of Object.entries(i)){let{type:i,description:r,unit:s,categoryEncoding:n,observedProperty:o}=a;if("Parameter"===i&&(t[e]={},r&&(t[e].description=g(r)),s&&(t[e].unit=s.label?g(s.label):null,t[e].symbol=s.symbol?.value),n)){let i=Object.entries(n).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),a=!1;o?.categories?.length&&(o.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),r=i.find(e=>e.ClassName===t);if(r&&(r.Label=e.label?g(e.label):null,e.preferredColor)){let t=l.A.fromHex(e.preferredColor);t&&(a=!0,r.Red=t.r,r.Green=t.g,r.Blue=t.b)}}),a&&i.forEach(e=>{e.Red??(e.Red=y(),e.Green=y(),e.Blue=y())}));let 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}))};a&&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 w(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let a=0;a<e.length;a++){let r=e[a];null!=r&&(r<t&&(t=r),r>i&&(i=r))}return(0,h.X1)(t,i)}function I(e,t,i){let a=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),r=(e=>t=>e*=t.count)(1),s=[...a.slice(1),{name:"",count:1}].reverse().map(r).reverse(),n=0;for(let r=e.length-1;r>=0;r--){let l=a.findIndex(({name:t})=>t===e[r]);n+=s[l]*(i%t[r]),i=Math.floor(i/t[r])}return n}var b=i(17676),v=i(4366),C=i(47520),S=i(51927),T=i(45617),A=i(87186);let R=class extends n.A{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}fetchRawTile(e,t,i,a={}){if(!this._pixelBlockTiles){let{rasterInfo:r}=this,[s,n]=r.storageInfo.tileInfo.size,{sliceId:l}=a,{pixelBlocks:o}=this.source,f={pixelBlock:null==l?o[0]:o[l],useBilinear:"thematic"!==r.dataType,tileSize:{width:s,height:n},level:e,row:t,col:i},u=this.rasterJobHandler?this.rasterJobHandler.clipTile(f,a):(0,C.J$)(f);return Promise.resolve(u)}let r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _open(e){let t=this.source,{pixelBlocks:i,attributeTable:a,statistics:r,histograms:s,name:n,nativeExtent:l,transform:u,colormap:h}=t,c=i[0],{width:p,height:d,pixelType:m}=c,g=t.extent??new o.A({xmin:-.5,ymin:.5,xmax:p-.5,ymax:d-.5,spatialReference:new f.A({wkid:3857})}),y=t.isPseudoSpatialReference??!t.extent,x={x:g.width/p,y:g.height/d},w={...t.keyProperties};t.dataType&&(w.DataType=t.dataType),t.bandInfos&&(w.BandProperties=t.bandInfos.map(e=>e.toJSON())),a&&(w.DataType="Thematic");let I=new A.A({width:p,height:d,pixelType:m,extent:g,nativeExtent:l,attributeTable:a,colormap:h,transform:u,pixelSize:x,spatialReference:g.spatialReference,bandCount:c.pixels.length,keyProperties:w,multidimensionalInfo:t.multidimensionalInfo,statistics:r,isPseudoSpatialReference:y,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(I),this.createRemoteDatasetStorageInfo(I,512,512),this._set("rasterInfo",I),this.updateTileInfo(),I.multidimensionalInfo?await this._buildMDimStats(t.pixelBlocks,I.multidimensionalInfo):this.preGenerateTiles&&await this._buildInMemoryRaster(c,{width:512,height:512},e),I.multidimensionalInfo||(this.source=null),this.datasetName=n}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,s=r.storageInfo.maximumPyramidLevel??0,n="thematic"!==r.dataType,l=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:s,useBilinear:n},i):Promise.resolve((0,C.lD)(e,t,s,n)),o=null!=r.statistics,f=null!=r.histograms,u=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,S.f4)(e)),h=await(0,b.Lx)([l,u]);if(!h[0].value&&h[1].value)throw new a.A("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=h[0].value,o||(r.statistics=h[1].value?.statistics),f||(r.histograms=h[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let a=0;a<t.variables.length;a++){let r=t.variables[a];if(r.statistics)continue;let s=r.dimensions.map(e=>new T.A({variableName:r.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,v.NG)(s,t),l=null==n?null:e[n];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,S.eH)(l);r.statistics=o.statistics,r.histograms||=o.histograms}}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],R.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)({constructOnly:!0})],R.prototype,"preGenerateTiles",void 0),(0,r.Cg)([(0,s.MZ)()],R.prototype,"source",void 0),(0,r.Cg)([(0,s.MZ)()],R.prototype,"url",null),R=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.InMemoryRaster")],R);const M=R;var O=i(22671);let _=class extends n.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,a={}){return this._inMemoryRaster.fetchRawTile(e,t,i,a)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:a,attributeTable:r,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,S.eH)(i[0]),o=s?.map(e=>({BandName:e})),f={DataType:r?"Thematic":a?"Scientific":"Generic",BandProperties:o},u=new M({source:{extent:t,pixelBlocks:i,attributeTable:r?O.A.fromJSON(r):null,multidimensionalInfo:a,statistics:n,histograms:l,keyProperties:f,isPseudoSpatialReference:!1}});await u.open(),this._inMemoryRaster=u;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",u.rasterInfo)}async _fetchData(e){let 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 a.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new a.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new a.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:s,type:n,values:l}=r[e];if(!("ndarray"===n.toLowerCase()&&l?.length&&t?.length&&s?.length))throw new a.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!p(t[t.length-1])||!d(t[t.length-2]))throw new a.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:a,dimensions:r}=m(e),{ranges:s}=e,n=Object.keys(s).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<n.length;e++){let t=n[e];r?.length&&l.push({name:t,dimensions:r})}let o=x(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let f=l.length?{variables:l}:void 0,u=[];for(let e=0;e<n.length;e++){let{values:a,dataType:l,axisNames:o,shape:f}=s[n[e]],h=f.length>2?e*f.slice(0,-2).reduce((e,t)=>e*t):0,p=o.slice(0,-2),d=f.slice(0,-2),m="float"===l?"f32":w(a),g=t*i,y=a.length/g;for(let s=0;s<y;s++){let n=c.A.createEmptyBand(m,g),l=new Uint8Array(g).fill(255),o=!1,f=s*g;for(let e=0;e<g;e++){let t=a[f+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||r?.length){let e=new c.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:m});e.updateStatistics(),r?.length?u[I(p,d,s)+h]=e:u.push(e)}else{let e=u[s];e.pixels.push(n),o?e.mask&&=c.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:a,pixelBlocks:u,multidimensionalInfo:f,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:f?void 0:n}}(t)}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],_.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)({constructOnly:!0})],_.prototype,"source",void 0),_=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.CovJSONRaster")],_);const k=_;var F=i(4576),B=i(21325),P=i(330),N=i(43163);function D(e,t){if(!e||!t)return null;let i=[];for(let a=0;a<e.length;a++)i.push(e[a]),i.push(t[a]);return i}function E(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new f.A({wkid:t});if(e=String(e).trim(),(0,B.jp)(e))return new f.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let a=i.indexOf("VERTCS"),r=i.indexOf("PROJCS"),s=r>-1?r:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",a)+1).trim(),l=e.slice(a,e.lastIndexOf("]")).trim();t=L(n);let o=t?new f.A({wkid:t}):new f.A({wkt:n}),u=L(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=L(e),0===t?new f.A({wkt:e}):new f.A({wkid:t})):null}function L(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),a=i[0]?.toLowerCase();if(("epsg"===a||"esri"===a)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function H(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,P.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,P.mX)(e);t.spatialReference=E(i)}}else if((0,P.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:a}=function(e){let t=(0,P.V6)(e,"GeodataXform"),i=E((0,P.v7)(t,"SpatialReference/WKID")||(0,P.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let a=(0,P.v7)(t,"PolynomialOrder")??1,r=(0,P.Ui)(t,"CoeffX/Double"),s=(0,P.Ui)(t,"CoeffY/Double"),n=(0,P.Ui)(t,"InverseCoeffX/Double"),l=(0,P.Ui)(t,"InverseCoeffY/Double"),o=D(r,s),f=D(n,l);return{spatialReference:i,transform:o&&f&&o.length&&f.length?new N.A({spatialReference:i,polynomialOrder:a,forwardCoefficients:o,inverseCoefficients:f}):null}}(e);t.transform=a,t.spatialReference||=i}else(0,P.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,P.mX)(e));else if((0,P.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,a,r,s=(0,P.v7)(e,"NoDataValue"),n=(0,P.V6)(e,"Histograms/HistItem"),l=(0,P.v7)(n,"HistMin"),o=(0,P.v7)(n,"HistMax"),f=(0,P.v7)(n,"BucketCount"),u=(0,P.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,P.IC)(e,"Metadata/MDI").forEach(e=>{let s=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=s;break;case"STATISTICS_MAXIMUM":i=s;break;case"STATISTICS_MEAN":a=s;break;case"STATISTICS_STDDEV":r=s}});let h=(0,P.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:u?.length&&null!=l&&null!=o?{min:l,max:o,size:f||u.length,counts:u}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:a,stddev:r}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(F.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(F.Ru):null),t}var z=i(85951),J=i(96381);let U=class extends n.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}fetchRawTile(e,t,i,a={}){if(this._imageBlob){let{blockWidth:a,blockHeight:r}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[a,r],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0})}return this._inMemoryRaster?this._inMemoryRaster.fetchRawTile(e,t,i,a):Promise.resolve(null)}async _open(e){let t=await this._fetchData(e);if(null==t)throw new a.A("image-aux-raster:open","the data cannot be decoded");let{spatialReference:i,statistics:r,histograms:s,transform:n}=await this._fetchAuxiliaryData(e),l=!i;l&&(i=new f.A({wkid:3857})),s?.length&&null==r&&(r=(0,S.Pg)(s));let{width:u,height:h,pixelBlock:c}=t,p=new o.A({xmin:-.5,ymin:.5-h,xmax:u-.5,ymax:.5,spatialReference:i}),d=n?n.forwardTransform(p):p,m=!0;if(n){let e=n.forwardCoefficients;m=e&&0===e[1]&&0===e[2],m&&(n=null,p=d)}if(!c){let e=new A.A({width:u,height:h,bandCount:3,pixelType:"u8",extent:d,nativeExtent:p,transform:n,pixelSize:{x:d.width/u,y:d.height/h},spatialReference:d.spatialReference,keyProperties:{DataType:"Processed"}});return this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(e),this.createRemoteDatasetStorageInfo(e,512,512),this._set("rasterInfo",e),void this.updateTileInfo()}let{rasterJobHandler:g,ioConfig:y}=this,x=new M({preGenerateTiles:!1,rasterJobHandler:g,source:{extent:d,nativeExtent:p,transform:n,pixelBlocks:[c],statistics:r,histograms:s,keyProperties:{DataType:"Processed"},isPseudoSpatialReference:l},ioConfig:{...y,sampling:"closest",skipStatistics:!0}});await x.open(),x.source=null,this._set("rasterInfo",x.rasterInfo),this._inMemoryRaster=x}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,J.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new a.A("image-aux-raster:open","the data is not a supported format");if(this._set("datasetFormat",i.toUpperCase()),"jpg"===i){let e=(0,z.R)(t);if(null==e)throw new a.A("image-aux-raster:open","the data is not a supported format");return this._imageBlob=t,e}try{let e=await this.decodePixelBlock(t,{format:i,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0});return this._imageBlob=t,e?{width:e.width,height:e.height,pixelBlock:e}:null}catch{let e=await this.decodePixelBlock(t,{format:i,canvasUsage:"no-canvas",skipStatistics:!0});return e?{width:e.width,height:e.height,pixelBlock:e}:null}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:a}=this.ioConfig,r=a||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,n="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,l=n&&i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,b.Lx)([r,l]);if(t?.aborted)throw(0,b.NK)();let f=H(o[0].value?.data);if(!f.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;f.transform=6===e?.length?new N.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return f}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],U.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)()],U.prototype,"rasterJobHandler",null),U=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.ImageAuxRaster")],U);const G=U;var q=i(97768),j=i(84952),V=i(86738),W=i(75414),Z=i(20223),X=i(87045),$=i(25943),Y=i(82371);let K=class extends n.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,a={}){let{storageInfo:r,extent:s}=this.rasterInfo,{transposeInfo:n}=r,l=null!=n&&!!a.transposedVariableName;if(this._slices&&!l&&null==a.sliceId)return null;let o,f,u=l?0:r.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${u}/${t}/${i}`,c={...this._slices?l?{variable:a.transposedVariableName}:{sliceId:a.sliceId||0}:null,...a.refreshParameters};if(r.isBsqTile){let e=(a.bandIds?.length?a.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:a.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),r=new Uint8Array(i);f=[];let s=0;for(let{data:e}of t)f.push(s),r.set(new Uint8Array(e),s),s+=e.byteLength;o=r.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:a.signal})).data;if(!o)return null;let{tileInfo:p}=r,d=l?n.tileSize:p.size,m=/^(mixed|jp)/i.test(p.format),g=await this.decodePixelBlock(o,{width:d[0],height:d[1],planes:f?.length,offsets:f,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m});if(null==g)return null;let y=r.blockBoundary[e];if("jpg"!==r.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return g;let{origin:x,blockWidth:w,blockHeight:I}=r,{x:b,y:v}=this.getPyramidPixelSize(e),S=Math.round((s.xmin-x.x)/b)%w,T=Math.round((s.xmax-x.x)/b)%w||w,A=Math.round((x.y-s.ymax)/v)%I,R=Math.round((x.y-s.ymin)/v)%I||I,M=i===y.minCol?S:0,O=t===y.minRow?A:0,_=i===y.maxCol?T:w,k=t===y.maxRow?R:I;return(0,C.z$)(g,{x:M,y:O},{width:_-M,height:k-O}),g}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let 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){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),a=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),r=await Promise.all([i,a]);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 a=0,{maximumPyramidLevel:r}=this.rasterInfo.storageInfo,s=r-a+this._levelOffset,n=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,a++,i=this.identifyPixelLocation(n,a,t.datumTransformation),null===i)return null}return-1===s||null==i?null:a}async _open(e){let 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:"));let r=i.data;if(this.sourceJSON=r,!r)throw new a.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new a.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let s=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==s)throw new a.A("image-server-raster:open","cannot initialize image service");(0,Y.E9)(s,r);let n="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:a,minLOD:r,maxLOD:s}=t;if(null!=r&&null!=s)return X.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=r&&e<=s)});if(0!==i&&0!==a){let t=e=>Math.round(1e4*e)/1e4,r=i?t(i):1/0,s=a?t(a):-1/0;return X.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=r&&i>=s})})}return X.A.fromJSON(e)}(r.tileInfo,r):X.A.fromJSON(r.tileInfo);(0,q.Lw)(n);let[l,o]=this._computeMinMaxLOD(s,n),{extent:f,pixelSize:u}=s,h=.001*Math.min(u.x,u.y);(u.x!==u.y||Math.abs(l.resolution-u.x)>h)&&(u.x=u.y=l.resolution,s.width=Math.ceil((f.xmax-f.xmin)/u.x-.1),s.height=Math.ceil((f.ymax-f.ymin)/u.y-.1));let c=l.level-o.level,[p,d]=n.size,m=[],g=[],{lods:y}=n;y.forEach((e,t)=>{e.level>=o.level&&e.level<=l.level&&m.push({x:e.resolution,y:e.resolution}),t<y.length-1&&g.push(Math.round(10*e.resolution/y[t+1].resolution)/10)}),m.sort((e,t)=>e.x-t.x);let x,w=this.computeBlockBoundary(f,p,d,n.origin,m,c),I=m.length>1?m.slice(1):null;r.transposeInfo&&(x={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:s.keyProperties?._yxs.PacketSize??0});let b=g.length<=1||g.length>=3&&g.slice(0,-1).every(e=>e===g[0])?g[0]??2:Math.round(10/(o.resolution/l.resolution)**(-1/c))/10,v=!!r.bsq&&"Raster"===this.tileType;if(s.storageInfo=new Z.A({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:I,pyramidScalingFactor:b,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:c,tileInfo:n,isBsqTile:v,transposeInfo:x,blockBoundary:w}),function(e){let{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new W.A,e.extent=e.transform.forwardTransform(t))}(s),this._set("rasterInfo",s),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:s.storageInfo.tileInfo,parsedUrl:(0,j.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new $.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),a=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=f.A.fromJSON(t.spatialReference||e.spatialReference),s=new V.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new A.A({width:i,height:a,bandCount:3,extent:o.A.fromJSON(e),spatialReference:r,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},a=(0,Y.Tw)(this.url,this.sourceJSON,i),r=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([a,r]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,a=.5/e.width*i.x,{lods:r}=t,s=t.lodAt(Math.max.apply(null,r.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,r.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=r[0].level,[s,n];if("Raster"===l)return[r.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:f}=this.sourceJSON,u=s;f>0&&(u=r.find(e=>Math.abs(e.scale-f)<a),u||=r.filter(e=>e.scale>f).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=r.find(e=>Math.abs(e.scale-o)<a)??n,this._levelOffset=h.level-n.level),[u,h]}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],K.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)()],K.prototype,"tileType",void 0),K=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.ImageServerRaster")],K);const Q=K;var ee=i(10713);const te=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),ie=new Map;ie.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),ie.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),ie.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),ie.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),ie.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let ae=class extends n.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,a={}){let{blockWidth:r,blockHeight:s,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:f}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:p}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(r*s);return new c.A({width:r,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:d}=this.ioConfig,m=this._getBandSegmentCount(),g=[],y=0;for(y=0;y<m;y++)(!d||d.includes(y))&&g.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:a.signal}));let x=await Promise.all(g),w=x.map(e=>e.data.byteLength).reduce((e,t)=>e+t),I=new Uint8Array(w),b=[],v=0;for(y=0;y<m;y++)b.push(v),I.set(new Uint8Array(x[y].data),v),v+=x[y].data.byteLength;let C=ie.get(this.rasterInfo.storageInfo.compression).decoderFormat,S="jpg"===C&&4===o&&1===b.length,T=await this.decodePixelBlock(I.buffer,{width:r,height:s,format:C,planes:d?.length||o,offsets:b,pixelType:f,canvasUsage:S?"no-canvas":void 0,decodeJpegAsRgb:!1}).catch(()=>null);if(null==T)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==C&&!T.mask&&(A=A[0],null!=A)){let e=T.width*T.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(y=0;y<e;y++)Math.abs((T.pixels[0][y]-A)/A)>1e-6&&(t[y]=1);else for(y=0;y<e;y++)T.pixels[0][y]!==A&&(t[y]=1);T.mask=t}let R=0,M=0;if(h!==r||p!==s){let e=T.mask;if(e)for(y=0;y<s;y++)if(M=y*r,y<p)for(R=h;R<r;R++)e[M+R]=0;else for(R=0;R<r;R++)e[M+R]=0;else for(e=new Uint8Array(r*s),T.mask=e,y=0;y<p;y++)for(M=y*r,R=0;R<h;R++)e[M+R]=1}return T}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:a,files:r}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(a.statistics=t.statistics??a.statistics,a.histograms=t.histograms,t.histograms&&null==a.statistics&&(a.statistics=(0,S.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(a),this._set("rasterInfo",a),this._files=r;let l=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(ee.Z){let i=new Uint8Array(e),a=new ArrayBuffer(e.byteLength),r=new Uint8Array(a);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)r[4*t+e]=i[4*t+3-e];t=new Uint32Array(a)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:f}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,p=[],d=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/u**g)-1,t=Math.ceil(c/f/u**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let a,r,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:f,height:u}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,a=Math.ceil(f/n/p),r=Math.ceil(u/l/p),c+=a*r;p=o**e,a=Math.ceil(f/n/p),r=Math.ceil(u/l/p),c+=t*a+i,c*=4*h;let d=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<a-1?n:Math.ceil(f/p)-n*(a-1),actualTileHeight:t<r-1?l:Math.ceil(u/p)-l*(r-1)}}_parseHeader(e){let t=(0,P.V6)(e,"MRF_META/Raster");if(!t)throw new a.A("mrf:open","not a valid MRF format");let i=(0,P.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),s=parseInt(i.getAttribute("y"),10),n=parseInt(i.getAttribute("c"),10),l=((0,P.mX)(t,"Compression")||"none").toLowerCase();if(!ie.has(l))throw new a.A("mrf:open","currently does not support compression "+l);let u=(0,P.mX)(t,"DataType")||"UInt8",h=te.get(u.toLowerCase());if(null==h)throw new a.A("mrf:open","currently does not support pixel type "+u);let c=(0,P.V6)(t,"PageSize"),p=parseInt(c.getAttribute("x"),10),d=parseInt(c.getAttribute("y"),10),m=c.getAttribute("c"),g=m?m===String(n):ie.get(l).isOneSegment;this._isBsq=!g;let y,x=(0,P.V6)(t,"DataValues");if(x){let e=x.getAttribute("NoData");null!=e&&(y=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,P.V6)(e,"MRF_META/CachedSource"))throw new a.A("mrf:open","currently does not support MRF referencing other data files");let w,I=(0,P.V6)(e,"MRF_META/GeoTags"),b=(0,P.V6)(I,"BoundingBox"),v=!1;if(null!=b){let e=parseFloat(b.getAttribute("minx")),t=parseFloat(b.getAttribute("miny")),i=parseFloat(b.getAttribute("maxx")),a=parseFloat(b.getAttribute("maxy")),r=(0,P.mX)(I,"Projection")||"",s=f.A.WGS84;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){let e=Number(r.slice(5));!isNaN(e)&&0!==e&&(s=new f.A({wkid:e}))}else s=E(r)??f.A.WGS84;else v=!0,s=new f.A({wkid:3857});w=new o.A(e,t,i,a),w.spatialReference=s}else v=!0,w=new o.A({xmin:-.5,ymin:.5-s,xmax:r-.5,ymax:.5,spatialReference:new f.A({wkid:3857})});let C=(0,P.V6)(e,"MRF_META/Rsets"),S=parseInt(C?.getAttribute("scale")||"2",10),T=w.spatialReference,R=new Z.A({origin:new V.A({x:w.xmin,y:w.ymax,spatialReference:T}),blockWidth:p,blockHeight:d,pyramidBlockWidth:p,pyramidBlockHeight:d,compression:l,pyramidScalingFactor:S}),M=new V.A({x:w.width/r,y:w.height/s,spatialReference:T}),O=new A.A({width:r,height:s,extent:w,isPseudoSpatialReference:v,spatialReference:T,bandCount:n,pixelType:h,pixelSize:M,noDataValue:y,storageInfo:R}),_=this._getAuxFullPath((0,P.mX)(t,"DataFile")),k=this._getAuxFullPath((0,P.mX)(t,"IndexFile"));return{rasterInfo:O,files:{mrf:this.url,index:k||this.url.replace(".mrf",".idx"),data:_||this.url.replace(".mrf",ie.get(l).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return H(t)}catch{return null}}};(0,r.Cg)([(0,s.MZ)()],ae.prototype,"_files",void 0),(0,r.Cg)([(0,s.MZ)()],ae.prototype,"_storageIndex",void 0),(0,r.Cg)([(0,s.MZ)()],ae.prototype,"_isBsq",void 0),(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],ae.prototype,"datasetFormat",void 0),ae=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.MRFRaster")],ae);const re=ae;i(44208);var se=i(53966),ne=i(9334);function le(e){let t=e.fields,i=e.records,a=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",r=[{name:a,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=r.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[a]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:r,features:n}}function oe(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let a=t.getUint32(4,!0),r=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:a,headerByteCount:r,recordByteCount:s},l=32,o=[],f=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,ne.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;f.length<a&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,ne.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let a=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(a.slice(0,4),10),parseInt(a.slice(4,6),10)-1,parseInt(a.slice(6,8),10)))}l+=t.length}),f.push(i)):l+=s}return{header:n,fields:o,records:f,recordSet:le({fields:o,records:f})}}var fe=i(44094),ue=i(94213);const he="none-tiled tiff is not optimized for access, convert to COG and retry.";let ce=class extends n.A{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,a={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let r=await this._fetchRawTiffTile(e,t,i,!1,a);if(null!=r&&this._headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,a);null!=s&&s.pixels[0]instanceof Uint8Array&&(r.mask=s.pixels[0])}return r}async _open(e){let 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 a.A("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));let{littleEndian:r,firstIFDPos:s,isBigTiff:n}=(0,fe.uT)(i),l=[],u={fileChunk:i,posIFD:s,fileOffset:0};await this._readIFDs(l,u,r,n?8:4,t);let{imageInfo:h,rasterInfo:c}=function(e){let t=(0,fe.uc)(e),{width:i,height:a,tileWidth:r,tileHeight:s,planes:n,pixelType:l,compression:u,firstPyramidLevel:h,maximumPyramidLevel:c,pyramidBlockWidth:p,pyramidBlockHeight:d,pyramidResolutions:m,tileBoundary:g,affine:y,metadata:x,colormap:w}=t,I=E(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),b=!!t.isPseudoGeographic;I??=(b=!0,new f.A({wkid:3857}));let v=new o.A({...t.extent,spatialReference:I}),C=v?new V.A({x:v.xmin,y:v.ymax,spatialReference:I}):new V.A({x:0,y:0}),S=new Z.A({blockWidth:r,blockHeight:s,pyramidBlockWidth:p,pyramidBlockHeight:d,compression:u,origin:C,firstPyramidLevel:h,maximumPyramidLevel:c,pyramidResolutions:m,blockBoundary:g}),T=new V.A({x:(v.xmax-v.xmin)/i,y:(v.ymax-v.ymin)/a,spatialReference:I}),R=x?{BandProperties:x.bandProperties,DataType:x.dataType}:{},M=new A.A({width:i,height:a,bandCount:n,pixelType:l,pixelSize:T,storageInfo:S,spatialReference:I,isPseudoSpatialReference:b,keyProperties:R,extent:v,colormap:w,statistics:x?x.statistics:null});if(y?.length&&(M.nativeExtent=new o.A({xmin:-.5,ymin:.5-a,xmax:i-.5,ymax:.5,spatialReference:I}),M.transform=new N.A({polynomialOrder:1,forwardCoefficients:[y[2]+y[0]/2,y[5]-y[3]/2,y[0],y[3],-y[1],-y[4]]}),M.extent=M.transform.forwardTransform(M.nativeExtent),M.pixelSize=new V.A({x:(v.xmax-v.xmin)/i,y:(v.ymax-v.ymin)/a,spatialReference:I}),S.origin.x=-.5,S.origin.y=.5),m){let{x:e,y:t}=M.pixelSize;m.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:M}}(l),p=(0,fe.zS)(l),d=(0,fe.r9)(l);if(this._headerInfo={littleEndian:r,isBigTiff:n,ifds:l,pyramidIFDs:p,maskIFDs:d,...h},this._set("rasterInfo",c),!h.isSupported)throw new a.A("tiffraster:open","this tiff is not supported: "+h.message);if(!h.tileWidth||!h.tileHeight)throw new a.A("tiffraster:open",he);c.isPseudoSpatialReference&&se.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let m=l[0].get("PREDICTOR")?.values?.[0];if(3===l[0].get("SAMPLEFORMAT")?.values?.[0]&&2===m)throw new a.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");let{skipMapInfo:g,skipExtensions:y=[]}=this.ioConfig;if(!y.includes("aux.xml")&&!g){let 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,S.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new V.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,c)}!y.includes("vat.dbf")&&1===c.bandCount&&"u8"===c.pixelType&&!g&&(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),g&&this.updateImageSpaceRasterInfo(c),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:a,posIFD:r}=e;return(r+8>=i.byteLength||r<0)&&(a=r+a,i=(await this.request(this.url,{range:{from:a,to:a+this._bufferSize},responseType:"array-buffer",signal:t})).data,r=0),{fileChunk:i,fileOffset:a,posIFD:r}}async _readIFDs(e,t,i,r=4,s){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,s);let n=await this._readIFD(t,i,ue.NB,r,s);if(!n?.ifd)throw new a.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;t.posIFD=n.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,s)}async _readIFD(e,t,i=ue.NB,r=4,s){let{fileChunk:n,posIFD:l,fileOffset:o}=e;if(!e.fileChunk)return null;let f=(0,fe.JM)(n,t,l,o,i,r);if(f.success){let{ifd:e}=f;if(!e)throw new a.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==ue.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new a.A("tiffraster:open",he);let r=[];if(e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,f.nextIFD,s),e.has("GEOKEYDIRECTORY")){let i=e.get("GEOKEYDIRECTORY"),a=i?.values;if(a&&a.length>4){let e=a[0]+"."+a[1]+"."+a[2];l=i.valueOffset+6-o;let r=await this._validateOrFetchHeaderBuffer({fileChunk:n,posIFD:l,fileOffset:o},s);i.data=(await this._readIFD(r,t,ue.YC,2,s))?.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return f}return f.requiredBufferSize?(n=(await this.request(this.url,{range:{from:o,to:o+l+f.requiredBufferSize+8},responseType:"array-buffer",signal:s})).data,n.byteLength<l+f.requiredBufferSize?null:(e.fileChunk=n,e.fileOffset=o,this._readIFD(e,t,i,r,s))):null}async _fillOffsets(e,t,i,a){let r=e.filter(e=>null!=e.offlineOffsetSize);if(0===r.length)return;let s=r.map(e=>e.offlineOffsetSize),n=Math.min.apply(null,s.map(e=>e[0])),l=Math.max.apply(null,s.map(e=>e[0]+e[1])),o=1===s.length||l-n<=this._bufferSize;if(!o&&s.length>1&&(s.sort((e,t)=>e[0]-t[0]),o=s.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,s[0][0])===l),o){let e=await this._fetchOffsets(n,Math.max(l,n+this._bufferSize),a);return void r.forEach(i=>(0,fe.Cr)(e,t,i,n))}let f=r.map(async e=>{let i=e.offlineOffsetSize,r=await this._fetchOffsets(i[0],i[1]+i[0],a);(0,fe.Cr)(r,t,e,i[0])});await Promise.all(f)}async _fetchOffsets(e,t,i){let a=[],r=this._chunkSize,s=Math.ceil((t-e)/r),n=e;for(let e=0;e<s;e++)a.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+r-1},responseType:"array-buffer",signal:i})),n+=r;let l=await Promise.all(a);if(1===s)return l[0].data;let o=new Uint8Array(t-e+1);for(let e=0;e<s;e++)o.set(new Uint8Array(l[e].data),e*r);return o.buffer}async _fetchRawTiffTile(e,t,i,a,r={}){let s=this._getTileLocation(e,t,i,a);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:f}=s,u=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal})),h=await Promise.all(u),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=1===h.length?h[0].data:new ArrayBuffer(c),d=[0],m=[0];if(h.length>1){let e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){let a=h[t].data;e.set(new Uint8Array(a),i),d[t]=i,i+=a.byteLength,m[t]=a.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:f,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null});if(null==x)return null;if(l!==g||o!==y){let e=x.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),x.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return x}_getTileLocation(e,t,i,a=!1){let{firstPyramidLevel:r,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(r-1),{_headerInfo:l}=this;if(!l)return null;let o=a?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let f=(0,fe.XO)(o,l),u=(0,fe.wc)(o,"TILEOFFSETS"),h=(0,fe.wc)(o,"TILEBYTECOUNTS");if(!u?.length||!h?.length)return null;let{minRow:c,minCol:p,maxRow:d,maxCol:m}=s[n];if(t>d||i>m||t<c||i<p)return null;let g=(0,fe.LZ)(o,"IMAGEWIDTH"),y=(0,fe.LZ)(o,"IMAGELENGTH"),x=(0,fe.LZ)(o,"TILEWIDTH"),w=(0,fe.LZ)(o,"TILELENGTH"),I=[];if(f){let{bandCount:e}=this.rasterInfo;for(let a=0;a<e;a++){let e=a*(d+1)*(m+1)+t*(m+1)+i;I[a]={from:u[e],to:u[e]+h[e]-1}}}else{let e=t*(m+1)+i;I.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<I.length;e++)if(null==I[e].from||!I[e].to||I[e].to<0)return null;return{ranges:I,ifd:o,actualTileWidth:i===m&&g%x||x,actualTileHeight:t===d&&y%w||w}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return H(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=oe(t);return i?.recordSet?O.A.fromJSON(i.recordSet):null}catch{return null}}};(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_files",void 0),(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_headerInfo",void 0),(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_bufferSize",void 0),(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_chunkSize",void 0),(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],ce.prototype,"datasetFormat",void 0),ce=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.TIFFRaster")],ce);const pe=ce,de=new Map;de.set("MRF",{desc:"Meta Raster Format",constructor:re}),de.set("TIFF",{desc:"GeoTIFF",constructor:pe}),de.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Q}),de.set("JPG",{desc:"JPG Raster Format",constructor:G}),de.set("PNG",{desc:"PNG Raster Format",constructor:G}),de.set("GIF",{desc:"GIF Raster Format",constructor:G}),de.set("BMP",{desc:"BMP Raster Format",constructor:G}),de.set("CovJSON",{desc:"COVJSON Raster Format",constructor:k}),de.set("MEMORY",{desc:"In Memory Raster Format",constructor:M});class me{static get supportedFormats(){let e=new Set;return de.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:s}=e,n=e.datasetFormat??i?.datasetFormat;n??(t.includes(".")?n=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?n="CovJSON":r?.extent&&r.pixelblocks&&(n="MEMORY")),"OVR"===n||"TIF"===n||"DM"===n?n="TIFF":"JPG"===n||"JPEG"===n||"JFIF"===n?n="JPG":"COVJSON"===n&&(n="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");let l={url:t,source:r,sourceJSON:s,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(l).forEach(e=>{l[e]??delete l[e]}),n){if(!this.supportedFormats.has(n))throw new a.A("rasterfactory:open","not a supported format "+n);if("CRF"===n)throw new a.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,de.get(n).constructor)(l);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(de.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),f=0,u=()=>{if(n=o[f++],!n||"CRF"===n)return null;let t=new(0,de.get(n).constructor)(l);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>u())};return u()}static register(e,t,i){de.has(e.toUpperCase())||de.set(e.toUpperCase(),{desc:t,constructor:i})}}},330(e,t,i){function a(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";let r=[];if(t){let s=a(e,i);for(let e=0;e<s.length;e++)a(s[e],t).forEach(e=>r.push(e));return r}let s=e.getElementsByTagNameNS("*",i);if(!s||0===s.length)return[];for(let e=0;e<s.length;e++)r.push(s[e]||s.item(e));return r}function r(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";let s=a(e,i);return s.length>0?t?r(s[0],t):s[0]:null}function s(e,t=null){let i,a=t?r(e,t):e;return a?(i=a.textContent||a.nodeValue,i?i.trim():null):null}function n(e,t){let i,r=a(e,t),s=[];for(let e=0;e<r.length;e++)i=r[e].textContent||r[e].nodeValue,i&&(i=i.trim(),""!==i&&s.push(i));return s}function l(e,t=null){return s(e,t)?.split(" ").map(e=>Number(e))??[]}function o(e,t){return n(e,t).map(e=>Number(e))}function f(e,t){let i=s(e,t);return Number(i)}function u(e,t){let i=e?.nodeName?.toLowerCase(),a=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===a}function h(e){return e.nodeName.slice(e.nodeName.lastIndexOf(":")+1)}i.d(t,{Dy:()=>n,IC:()=>a,Ui:()=>o,V6:()=>r,g7:()=>u,mX:()=>s,pN:()=>l,v7:()=>f,vv:()=>h})},10333(e,t,i){i.d(t,{A:()=>n});var a=i(32198),r=i(25482),s=i(91429);let n=class extends r.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,a.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var a,r=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=a=class extends n.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 a({tolerance:this.tolerance})}};(0,r.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,r.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=a=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var a,r=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),f=i(36005),u=i(43937),h=i(93223);function c(e,t,i){let{x:a,y:r}=t;if(i<2)return{x:e[0]+a*e[2]+r*e[4],y:e[1]+a*e[3]+r*e[5]};if(2===i){let t=a*a,i=r*r,s=a*r;return{x:e[0]+a*e[2]+r*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+a*e[3]+r*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=a*a,n=r*r,l=a*r,o=s*a,f=s*r,u=a*n,h=r*n;return{x:e[0]+a*e[2]+r*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+f*e[14]+u*e[16]+h*e[18],y:e[1]+a*e[3]+r*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+f*e[15]+u*e[17]+h*e[19]}}function p(e,t,i){let{xmin:a,ymin:r,xmax:s,ymax:l,spatialReference:o}=t,f=[];if(i<2)f.push({x:a,y:l}),f.push({x:s,y:l}),f.push({x:a,y:r}),f.push({x:s,y:r});else{let e=10;for(let t=0;t<e;t++)f.push({x:a,y:r+(l-r)*t/(e-1)}),f.push({x:s,y:r+(l-r)*t/(e-1)});e=8;for(let t=1;t<=e;t++)f.push({x:a+(s-a)*t/e,y:r}),f.push({x:a+(s-a)*t/e,y:l})}f=f.map(t=>c(e,t,i));let u=f.map(e=>e.x),h=f.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,u),xmax:Math.max.apply(null,u),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=a=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:a}=t;if(!i?.length||!a?.length||i.length!==a.length)return null;let r=[];for(let e=0;e<i.length;e++)r.push(i[e]),r.push(a[e]);return r}writeForwardCoefficients(e,t,i){let a=[],r=[];for(let t=0;t<e?.length;t++)t%2==0?a.push(e[t]):r.push(e[t]);t.coeffX=a,t.coeffY=r}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,a,r,s,n]=e,l=a*n-s*r,o=s*r-a*n;return[(s*i-t*n)/l,(a*i-t*r)/o,n/l,r/o,-s/l,-a/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:a}=t;if(!i?.length||!a?.length||i.length!==a.length)return null;let r=[];for(let e=0;e<i.length;e++)r.push(i[e]),r.push(a[e]);return r}writeInverseCoefficients(e,t,i){let a=[],r=[];for(let t=0;t<e?.length;t++)t%2==0?a.push(e[t]):r.push(e[t]);t.inverseCoeffX=a,t.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new a({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,r.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,r.Cg)([(0,f.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,r.Cg)([(0,u.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,r.Cg)([(0,f.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,r.Cg)([(0,u.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,r.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=a=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1003],{1003(e,t,i){i.r(t),i.d(t,{default:()=>me});var a=i(49186),r=i(32198),s=i(91429),n=i(49859),l=i(68197),o=i(5443),f=i(16930),u=i(73444),h=i(94778),c=i(14140);function p(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function d(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function m(e){let{axes:t}=e.domain,i=Object.keys(t),a=[],r=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];p(o)?s=e:d(o)&&(n=e);let f=t[o],u=[];if("values"in f){f.values.forEach(e=>u.push("string"==typeof e?new Date(e).getTime():e));let e=u[1]-u[0];a.push([u[0]-.5*e,u[u.length-1]+.5*e]),r.push(e)}else{let{start:e,stop:t,num:i}=f,s=(t-e)/(i-1);a.push([e-.5*s,t+.5*s]),r.push(s);for(let t=0;t<i;t++)u.push(e+s*t)}l.push({name:o,values:u,extent:[u[0],u[u.length-1]]})}s>-1&&-1===n?n=+(0===s):n>-1&&-1===s?s=+(0===n):-1===n&&-1===s&&(s=0,n=1),l=l.filter((e,t)=>t!==s&&t!==n);let{referencing:u}=e.domain,h=u.find(e=>e.coordinates.includes(i[s])).system.id,c=h?.slice(h.lastIndexOf("/")+1),m=null==c||"CRS84"===c?4326:Number(c),g=new f.A({wkid:m}),[y,x]=a[s],[w,I]=a[n],b=new o.A({xmin:y,xmax:x,ymin:w,ymax:I,spatialReference:g});return{width:Math.round(b.width/r[s]),height:Math.round(b.height/r[n]),extent:b,dimensions:l}}function g(e){let t=(0,u.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function y(){return Math.round(255*Math.random())}function x(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,a]of Object.entries(i)){let{type:i,description:r,unit:s,categoryEncoding:n,observedProperty:o}=a;if("Parameter"===i&&(t[e]={},r&&(t[e].description=g(r)),s&&(t[e].unit=s.label?g(s.label):null,t[e].symbol=s.symbol?.value),n)){let i=Object.entries(n).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),a=!1;o?.categories?.length&&(o.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),r=i.find(e=>e.ClassName===t);if(r&&(r.Label=e.label?g(e.label):null,e.preferredColor)){let t=l.A.fromHex(e.preferredColor);t&&(a=!0,r.Red=t.r,r.Green=t.g,r.Blue=t.b)}}),a&&i.forEach(e=>{e.Red??(e.Red=y(),e.Green=y(),e.Blue=y())}));let 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}))};a&&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 w(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let a=0;a<e.length;a++){let r=e[a];null!=r&&(r<t&&(t=r),r>i&&(i=r))}return(0,h.X1)(t,i)}function I(e,t,i){let a=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),r=(e=>t=>e*=t.count)(1),s=[...a.slice(1),{name:"",count:1}].reverse().map(r).reverse(),n=0;for(let r=e.length-1;r>=0;r--){let l=a.findIndex(({name:t})=>t===e[r]);n+=s[l]*(i%t[r]),i=Math.floor(i/t[r])}return n}var b=i(17676),v=i(4366),C=i(47520),S=i(51927),T=i(45617),A=i(87186);let R=class extends n.A{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}fetchRawTile(e,t,i,a={}){if(!this._pixelBlockTiles){let{rasterInfo:r}=this,[s,n]=r.storageInfo.tileInfo.size,{sliceId:l}=a,{pixelBlocks:o}=this.source,f={pixelBlock:null==l?o[0]:o[l],useBilinear:"thematic"!==r.dataType,tileSize:{width:s,height:n},level:e,row:t,col:i},u=this.rasterJobHandler?this.rasterJobHandler.clipTile(f,a):(0,C.J$)(f);return Promise.resolve(u)}let r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _open(e){let t=this.source,{pixelBlocks:i,attributeTable:a,statistics:r,histograms:s,name:n,nativeExtent:l,transform:u,colormap:h}=t,c=i[0],{width:p,height:d,pixelType:m}=c,g=t.extent??new o.A({xmin:-.5,ymin:.5,xmax:p-.5,ymax:d-.5,spatialReference:new f.A({wkid:3857})}),y=t.isPseudoSpatialReference??!t.extent,x={x:g.width/p,y:g.height/d},w={...t.keyProperties};t.dataType&&(w.DataType=t.dataType),t.bandInfos&&(w.BandProperties=t.bandInfos.map(e=>e.toJSON())),a&&(w.DataType="Thematic");let I=new A.A({width:p,height:d,pixelType:m,extent:g,nativeExtent:l,attributeTable:a,colormap:h,transform:u,pixelSize:x,spatialReference:g.spatialReference,bandCount:c.pixels.length,keyProperties:w,multidimensionalInfo:t.multidimensionalInfo,statistics:r,isPseudoSpatialReference:y,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(I),this.createRemoteDatasetStorageInfo(I,512,512),this._set("rasterInfo",I),this.updateTileInfo(),I.multidimensionalInfo?await this._buildMDimStats(t.pixelBlocks,I.multidimensionalInfo):this.preGenerateTiles&&await this._buildInMemoryRaster(c,{width:512,height:512},e),I.multidimensionalInfo||(this.source=null),this.datasetName=n}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,s=r.storageInfo.maximumPyramidLevel??0,n="thematic"!==r.dataType,l=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:s,useBilinear:n},i):Promise.resolve((0,C.lD)(e,t,s,n)),o=null!=r.statistics,f=null!=r.histograms,u=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,S.f4)(e)),h=await(0,b.Lx)([l,u]);if(!h[0].value&&h[1].value)throw new a.A("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=h[0].value,o||(r.statistics=h[1].value?.statistics),f||(r.histograms=h[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let a=0;a<t.variables.length;a++){let r=t.variables[a];if(r.statistics)continue;let s=r.dimensions.map(e=>new T.A({variableName:r.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,v.NG)(s,t),l=null==n?null:e[n];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,S.eH)(l);r.statistics=o.statistics,r.histograms||=o.histograms}}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],R.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)({constructOnly:!0})],R.prototype,"preGenerateTiles",void 0),(0,r.Cg)([(0,s.MZ)()],R.prototype,"source",void 0),(0,r.Cg)([(0,s.MZ)()],R.prototype,"url",null),R=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.InMemoryRaster")],R);const M=R;var _=i(22671);let O=class extends n.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,a={}){return this._inMemoryRaster.fetchRawTile(e,t,i,a)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:a,attributeTable:r,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,S.eH)(i[0]),o=s?.map(e=>({BandName:e})),f={DataType:r?"Thematic":a?"Scientific":"Generic",BandProperties:o},u=new M({source:{extent:t,pixelBlocks:i,attributeTable:r?_.A.fromJSON(r):null,multidimensionalInfo:a,statistics:n,histograms:l,keyProperties:f,isPseudoSpatialReference:!1}});await u.open(),this._inMemoryRaster=u;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",u.rasterInfo)}async _fetchData(e){let 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 a.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new a.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new a.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:s,type:n,values:l}=r[e];if(!("ndarray"===n.toLowerCase()&&l?.length&&t?.length&&s?.length))throw new a.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!p(t[t.length-1])||!d(t[t.length-2]))throw new a.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:a,dimensions:r}=m(e),{ranges:s}=e,n=Object.keys(s).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<n.length;e++){let t=n[e];r?.length&&l.push({name:t,dimensions:r})}let o=x(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let f=l.length?{variables:l}:void 0,u=[];for(let e=0;e<n.length;e++){let{values:a,dataType:l,axisNames:o,shape:f}=s[n[e]],h=f.length>2?e*f.slice(0,-2).reduce((e,t)=>e*t):0,p=o.slice(0,-2),d=f.slice(0,-2),m="float"===l?"f32":w(a),g=t*i,y=a.length/g;for(let s=0;s<y;s++){let n=c.A.createEmptyBand(m,g),l=new Uint8Array(g).fill(255),o=!1,f=s*g;for(let e=0;e<g;e++){let t=a[f+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||r?.length){let e=new c.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:m});e.updateStatistics(),r?.length?u[I(p,d,s)+h]=e:u.push(e)}else{let e=u[s];e.pixels.push(n),o?e.mask&&=c.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:a,pixelBlocks:u,multidimensionalInfo:f,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:f?void 0:n}}(t)}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],O.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)({constructOnly:!0})],O.prototype,"source",void 0),O=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.CovJSONRaster")],O);const k=O;var F=i(4576),B=i(21325),P=i(330),D=i(43163);function N(e,t){if(!e||!t)return null;let i=[];for(let a=0;a<e.length;a++)i.push(e[a]),i.push(t[a]);return i}function E(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new f.A({wkid:t});if(e=String(e).trim(),(0,B.jp)(e))return new f.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let a=i.indexOf("VERTCS"),r=i.indexOf("PROJCS"),s=r>-1?r:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",a)+1).trim(),l=e.slice(a,e.lastIndexOf("]")).trim();t=L(n);let o=t?new f.A({wkid:t}):new f.A({wkt:n}),u=L(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=L(e),0===t?new f.A({wkt:e}):new f.A({wkid:t})):null}function L(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),a=i[0]?.toLowerCase();if(("epsg"===a||"esri"===a)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function H(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,P.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,P.mX)(e);t.spatialReference=E(i)}}else if((0,P.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:a}=function(e){let t=(0,P.V6)(e,"GeodataXform"),i=E((0,P.v7)(t,"SpatialReference/WKID")||(0,P.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let a=(0,P.v7)(t,"PolynomialOrder")??1,r=(0,P.Ui)(t,"CoeffX/Double"),s=(0,P.Ui)(t,"CoeffY/Double"),n=(0,P.Ui)(t,"InverseCoeffX/Double"),l=(0,P.Ui)(t,"InverseCoeffY/Double"),o=N(r,s),f=N(n,l);return{spatialReference:i,transform:o&&f&&o.length&&f.length?new D.A({spatialReference:i,polynomialOrder:a,forwardCoefficients:o,inverseCoefficients:f}):null}}(e);t.transform=a,t.spatialReference||=i}else(0,P.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,P.mX)(e));else if((0,P.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,a,r,s=(0,P.v7)(e,"NoDataValue"),n=(0,P.V6)(e,"Histograms/HistItem"),l=(0,P.v7)(n,"HistMin"),o=(0,P.v7)(n,"HistMax"),f=(0,P.v7)(n,"BucketCount"),u=(0,P.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,P.IC)(e,"Metadata/MDI").forEach(e=>{let s=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=s;break;case"STATISTICS_MAXIMUM":i=s;break;case"STATISTICS_MEAN":a=s;break;case"STATISTICS_STDDEV":r=s}});let h=(0,P.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:u?.length&&null!=l&&null!=o?{min:l,max:o,size:f||u.length,counts:u}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:a,stddev:r}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(F.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(F.Ru):null),t}var z=i(85951),J=i(96381);let U=class extends n.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}fetchRawTile(e,t,i,a={}){if(this._imageBlob){let{blockWidth:a,blockHeight:r}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[a,r],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0})}return this._inMemoryRaster?this._inMemoryRaster.fetchRawTile(e,t,i,a):Promise.resolve(null)}async _open(e){let t=await this._fetchData(e);if(null==t)throw new a.A("image-aux-raster:open","the data cannot be decoded");let{spatialReference:i,statistics:r,histograms:s,transform:n}=await this._fetchAuxiliaryData(e),l=!i;l&&(i=new f.A({wkid:3857})),s?.length&&null==r&&(r=(0,S.Pg)(s));let{width:u,height:h,pixelBlock:c}=t,p=new o.A({xmin:-.5,ymin:.5-h,xmax:u-.5,ymax:.5,spatialReference:i}),d=n?n.forwardTransform(p):p,m=!0;if(n){let e=n.forwardCoefficients;m=e&&0===e[1]&&0===e[2],m&&(n=null,p=d)}if(!c){let e=new A.A({width:u,height:h,bandCount:3,pixelType:"u8",extent:d,nativeExtent:p,transform:n,pixelSize:{x:d.width/u,y:d.height/h},spatialReference:d.spatialReference,keyProperties:{DataType:"Processed"}});return this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(e),this.createRemoteDatasetStorageInfo(e,512,512),this._set("rasterInfo",e),void this.updateTileInfo()}let{rasterJobHandler:g,ioConfig:y}=this,x=new M({preGenerateTiles:!1,rasterJobHandler:g,source:{extent:d,nativeExtent:p,transform:n,pixelBlocks:[c],statistics:r,histograms:s,keyProperties:{DataType:"Processed"},isPseudoSpatialReference:l},ioConfig:{...y,sampling:"closest",skipStatistics:!0}});await x.open(),x.source=null,this._set("rasterInfo",x.rasterInfo),this._inMemoryRaster=x}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,J.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new a.A("image-aux-raster:open","the data is not a supported format");if(this._set("datasetFormat",i.toUpperCase()),"jpg"===i){let e=(0,z.R)(t);if(null==e)throw new a.A("image-aux-raster:open","the data is not a supported format");return this._imageBlob=t,e}try{let e=await this.decodePixelBlock(t,{format:i,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0});return this._imageBlob=t,e?{width:e.width,height:e.height,pixelBlock:e}:null}catch{let e=await this.decodePixelBlock(t,{format:i,canvasUsage:"no-canvas",skipStatistics:!0});return e?{width:e.width,height:e.height,pixelBlock:e}:null}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:a}=this.ioConfig,r=a||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,n="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,l=n&&i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,b.Lx)([r,l]);if(t?.aborted)throw(0,b.NK)();let f=H(o[0].value?.data);if(!f.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;f.transform=6===e?.length?new D.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return f}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],U.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)()],U.prototype,"rasterJobHandler",null),U=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.ImageAuxRaster")],U);const G=U;var q=i(97768),j=i(84952),W=i(86738),V=i(75414),Z=i(20223),X=i(87045),$=i(25943),Y=i(82371);let K=class extends n.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,a={}){let{storageInfo:r,extent:s}=this.rasterInfo,{transposeInfo:n}=r,l=null!=n&&!!a.transposedVariableName;if(this._slices&&!l&&null==a.sliceId)return null;let o,f,u=l?0:r.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${u}/${t}/${i}`,c={...this._slices?l?{variable:a.transposedVariableName}:{sliceId:a.sliceId||0}:null,...a.refreshParameters};if(r.isBsqTile){let e=(a.bandIds?.length?a.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:a.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),r=new Uint8Array(i);f=[];let s=0;for(let{data:e}of t)f.push(s),r.set(new Uint8Array(e),s),s+=e.byteLength;o=r.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:a.signal})).data;if(!o)return null;let{tileInfo:p}=r,d=l?n.tileSize:p.size,m=/^(mixed|jp)/i.test(p.format),g=await this.decodePixelBlock(o,{width:d[0],height:d[1],planes:f?.length,offsets:f,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m});if(null==g)return null;let y=r.blockBoundary[e];if("jpg"!==r.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return g;let{origin:x,blockWidth:w,blockHeight:I}=r,{x:b,y:v}=this.getPyramidPixelSize(e),S=Math.round((s.xmin-x.x)/b)%w,T=Math.round((s.xmax-x.x)/b)%w||w,A=Math.round((x.y-s.ymax)/v)%I,R=Math.round((x.y-s.ymin)/v)%I||I,M=i===y.minCol?S:0,_=t===y.minRow?A:0,O=i===y.maxCol?T:w,k=t===y.maxRow?R:I;return(0,C.z$)(g,{x:M,y:_},{width:O-M,height:k-_}),g}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let 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){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),a=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),r=await Promise.all([i,a]);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 a=0,{maximumPyramidLevel:r}=this.rasterInfo.storageInfo,s=r-a+this._levelOffset,n=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,a++,i=this.identifyPixelLocation(n,a,t.datumTransformation),null===i)return null}return-1===s||null==i?null:a}async _open(e){let 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:"));let r=i.data;if(this.sourceJSON=r,!r)throw new a.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new a.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let s=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==s)throw new a.A("image-server-raster:open","cannot initialize image service");(0,Y.E9)(s,r);let n="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:a,minLOD:r,maxLOD:s}=t;if(null!=r&&null!=s)return X.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=r&&e<=s)});if(0!==i&&0!==a){let t=e=>Math.round(1e4*e)/1e4,r=i?t(i):1/0,s=a?t(a):-1/0;return X.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=r&&i>=s})})}return X.A.fromJSON(e)}(r.tileInfo,r):X.A.fromJSON(r.tileInfo);(0,q.Lw)(n);let[l,o]=this._computeMinMaxLOD(s,n),{extent:f,pixelSize:u}=s,h=.001*Math.min(u.x,u.y);(u.x!==u.y||Math.abs(l.resolution-u.x)>h)&&(u.x=u.y=l.resolution,s.width=Math.ceil((f.xmax-f.xmin)/u.x-.1),s.height=Math.ceil((f.ymax-f.ymin)/u.y-.1));let c=l.level-o.level,[p,d]=n.size,m=[],g=[],{lods:y}=n;y.forEach((e,t)=>{e.level>=o.level&&e.level<=l.level&&m.push({x:e.resolution,y:e.resolution}),t<y.length-1&&g.push(Math.round(10*e.resolution/y[t+1].resolution)/10)}),m.sort((e,t)=>e.x-t.x);let x,w=this.computeBlockBoundary(f,p,d,n.origin,m,c),I=m.length>1?m.slice(1):null;r.transposeInfo&&(x={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:s.keyProperties?._yxs.PacketSize??0});let b=g.length<=1||g.length>=3&&g.slice(0,-1).every(e=>e===g[0])?g[0]??2:Math.round(10/(o.resolution/l.resolution)**(-1/c))/10,v=!!r.bsq&&"Raster"===this.tileType;if(s.storageInfo=new Z.A({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:I,pyramidScalingFactor:b,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:c,tileInfo:n,isBsqTile:v,transposeInfo:x,blockBoundary:w}),function(e){let{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new V.A,e.extent=e.transform.forwardTransform(t))}(s),this._set("rasterInfo",s),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:s.storageInfo.tileInfo,parsedUrl:(0,j.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new $.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),a=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=f.A.fromJSON(t.spatialReference||e.spatialReference),s=new W.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new A.A({width:i,height:a,bandCount:3,extent:o.A.fromJSON(e),spatialReference:r,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},a=(0,Y.Tw)(this.url,this.sourceJSON,i),r=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([a,r]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,a=.5/e.width*i.x,{lods:r}=t,s=t.lodAt(Math.max.apply(null,r.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,r.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=r[0].level,[s,n];if("Raster"===l)return[r.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:f}=this.sourceJSON,u=s;f>0&&(u=r.find(e=>Math.abs(e.scale-f)<a),u||=r.filter(e=>e.scale>f).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=r.find(e=>Math.abs(e.scale-o)<a)??n,this._levelOffset=h.level-n.level),[u,h]}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],K.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)()],K.prototype,"tileType",void 0),K=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.ImageServerRaster")],K);const Q=K;var ee=i(10713);const te=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),ie=new Map;ie.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),ie.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),ie.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),ie.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),ie.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let ae=class extends n.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,a={}){let{blockWidth:r,blockHeight:s,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:f}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:p}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(u.some(e=>e.from>e.to)){let e=new Uint8Array(r*s);return new c.A({width:r,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:d}=this.ioConfig,m=this._getBandSegmentCount(),g=[],y=0;for(y=0;y<m;y++)(!d||d.includes(y))&&g.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:a.signal}));let x=await Promise.all(g),w=x.map(e=>e.data.byteLength).reduce((e,t)=>e+t),I=new Uint8Array(w),b=[],v=0;for(y=0;y<m;y++)b.push(v),I.set(new Uint8Array(x[y].data),v),v+=x[y].data.byteLength;let C=ie.get(this.rasterInfo.storageInfo.compression).decoderFormat,S="jpg"===C&&4===o&&1===b.length,T=await this.decodePixelBlock(I.buffer,{width:r,height:s,format:C,planes:d?.length||o,offsets:b,pixelType:f,canvasUsage:S?"no-canvas":void 0,decodeJpegAsRgb:!1}).catch(()=>null);if(null==T)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==C&&!T.mask&&(A=A[0],null!=A)){let e=T.width*T.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(y=0;y<e;y++)Math.abs((T.pixels[0][y]-A)/A)>1e-6&&(t[y]=1);else for(y=0;y<e;y++)T.pixels[0][y]!==A&&(t[y]=1);T.mask=t}let R=0,M=0;if(h!==r||p!==s){let e=T.mask;if(e)for(y=0;y<s;y++)if(M=y*r,y<p)for(R=h;R<r;R++)e[M+R]=0;else for(R=0;R<r;R++)e[M+R]=0;else for(e=new Uint8Array(r*s),T.mask=e,y=0;y<p;y++)for(M=y*r,R=0;R<h;R++)e[M+R]=1}return T}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:a,files:r}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(a.statistics=t.statistics??a.statistics,a.histograms=t.histograms,t.histograms&&null==a.statistics&&(a.statistics=(0,S.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(a),this._set("rasterInfo",a),this._files=r;let l=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(ee.Z){let i=new Uint8Array(e),a=new ArrayBuffer(e.byteLength),r=new Uint8Array(a);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)r[4*t+e]=i[4*t+3-e];t=new Uint32Array(a)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:f}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,p=[],d=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/u**g)-1,t=Math.ceil(c/f/u**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let a,r,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:f,height:u}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,a=Math.ceil(f/n/p),r=Math.ceil(u/l/p),c+=a*r;p=o**e,a=Math.ceil(f/n/p),r=Math.ceil(u/l/p),c+=t*a+i,c*=4*h;let d=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<a-1?n:Math.ceil(f/p)-n*(a-1),actualTileHeight:t<r-1?l:Math.ceil(u/p)-l*(r-1)}}_parseHeader(e){let t=(0,P.V6)(e,"MRF_META/Raster");if(!t)throw new a.A("mrf:open","not a valid MRF format");let i=(0,P.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),s=parseInt(i.getAttribute("y"),10),n=parseInt(i.getAttribute("c"),10),l=((0,P.mX)(t,"Compression")||"none").toLowerCase();if(!ie.has(l))throw new a.A("mrf:open","currently does not support compression "+l);let u=(0,P.mX)(t,"DataType")||"UInt8",h=te.get(u.toLowerCase());if(null==h)throw new a.A("mrf:open","currently does not support pixel type "+u);let c=(0,P.V6)(t,"PageSize"),p=parseInt(c.getAttribute("x"),10),d=parseInt(c.getAttribute("y"),10),m=c.getAttribute("c"),g=m?m===String(n):ie.get(l).isOneSegment;this._isBsq=!g;let y,x=(0,P.V6)(t,"DataValues");if(x){let e=x.getAttribute("NoData");null!=e&&(y=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,P.V6)(e,"MRF_META/CachedSource"))throw new a.A("mrf:open","currently does not support MRF referencing other data files");let w,I=(0,P.V6)(e,"MRF_META/GeoTags"),b=(0,P.V6)(I,"BoundingBox"),v=!1;if(null!=b){let e=parseFloat(b.getAttribute("minx")),t=parseFloat(b.getAttribute("miny")),i=parseFloat(b.getAttribute("maxx")),a=parseFloat(b.getAttribute("maxy")),r=(0,P.mX)(I,"Projection")||"",s=f.A.WGS84;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){let e=Number(r.slice(5));!isNaN(e)&&0!==e&&(s=new f.A({wkid:e}))}else s=E(r)??f.A.WGS84;else v=!0,s=new f.A({wkid:3857});w=new o.A(e,t,i,a),w.spatialReference=s}else v=!0,w=new o.A({xmin:-.5,ymin:.5-s,xmax:r-.5,ymax:.5,spatialReference:new f.A({wkid:3857})});let C=(0,P.V6)(e,"MRF_META/Rsets"),S=parseInt(C?.getAttribute("scale")||"2",10),T=w.spatialReference,R=new Z.A({origin:new W.A({x:w.xmin,y:w.ymax,spatialReference:T}),blockWidth:p,blockHeight:d,pyramidBlockWidth:p,pyramidBlockHeight:d,compression:l,pyramidScalingFactor:S}),M=new W.A({x:w.width/r,y:w.height/s,spatialReference:T}),_=new A.A({width:r,height:s,extent:w,isPseudoSpatialReference:v,spatialReference:T,bandCount:n,pixelType:h,pixelSize:M,noDataValue:y,storageInfo:R}),O=this._getAuxFullPath((0,P.mX)(t,"DataFile")),k=this._getAuxFullPath((0,P.mX)(t,"IndexFile"));return{rasterInfo:_,files:{mrf:this.url,index:k||this.url.replace(".mrf",".idx"),data:O||this.url.replace(".mrf",ie.get(l).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return H(t)}catch{return null}}};(0,r.Cg)([(0,s.MZ)()],ae.prototype,"_files",void 0),(0,r.Cg)([(0,s.MZ)()],ae.prototype,"_storageIndex",void 0),(0,r.Cg)([(0,s.MZ)()],ae.prototype,"_isBsq",void 0),(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],ae.prototype,"datasetFormat",void 0),ae=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.MRFRaster")],ae);const re=ae;i(44208);var se=i(53966),ne=i(9334);function le(e){let t=e.fields,i=e.records,a=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",r=[{name:a,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=r.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[a]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:r,features:n}}function oe(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let a=t.getUint32(4,!0),r=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:a,headerByteCount:r,recordByteCount:s},l=32,o=[],f=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,ne.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;f.length<a&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,ne.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let a=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(a.slice(0,4),10),parseInt(a.slice(4,6),10)-1,parseInt(a.slice(6,8),10)))}l+=t.length}),f.push(i)):l+=s}return{header:n,fields:o,records:f,recordSet:le({fields:o,records:f})}}var fe=i(44094),ue=i(94213);const he="none-tiled tiff is not optimized for access, convert to COG and retry.";let ce=class extends n.A{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this._chunkSize=10485760,this.datasetFormat="TIFF"}async fetchRawTile(e,t,i,a={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let r=await this._fetchRawTiffTile(e,t,i,!1,a);if(null!=r&&this._headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,a);null!=s&&s.pixels[0]instanceof Uint8Array&&(r.mask=s.pixels[0])}return r}async _open(e){let 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 a.A("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));let{littleEndian:r,firstIFDPos:s,isBigTiff:n}=(0,fe.uT)(i),l=[],u={fileChunk:i,posIFD:s,fileOffset:0};await this._readIFDs(l,u,r,n?8:4,t);let{imageInfo:h,rasterInfo:c}=function(e){let t=(0,fe.uc)(e),{width:i,height:a,tileWidth:r,tileHeight:s,planes:n,pixelType:l,compression:u,firstPyramidLevel:h,maximumPyramidLevel:c,pyramidBlockWidth:p,pyramidBlockHeight:d,pyramidResolutions:m,tileBoundary:g,affine:y,metadata:x,colormap:w}=t,I=E(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),b=!!t.isPseudoGeographic;I??=(b=!0,new f.A({wkid:3857}));let v=new o.A({...t.extent,spatialReference:I}),C=v?new W.A({x:v.xmin,y:v.ymax,spatialReference:I}):new W.A({x:0,y:0}),S=new Z.A({blockWidth:r,blockHeight:s,pyramidBlockWidth:p,pyramidBlockHeight:d,compression:u,origin:C,firstPyramidLevel:h,maximumPyramidLevel:c,pyramidResolutions:m,blockBoundary:g}),T=new W.A({x:(v.xmax-v.xmin)/i,y:(v.ymax-v.ymin)/a,spatialReference:I}),R=x?{BandProperties:x.bandProperties,DataType:x.dataType}:{},M=new A.A({width:i,height:a,bandCount:n,pixelType:l,pixelSize:T,storageInfo:S,spatialReference:I,isPseudoSpatialReference:b,keyProperties:R,extent:v,colormap:w,statistics:x?x.statistics:null});if(y?.length&&(M.nativeExtent=new o.A({xmin:-.5,ymin:.5-a,xmax:i-.5,ymax:.5,spatialReference:I}),M.transform=new D.A({polynomialOrder:1,forwardCoefficients:[y[2]+y[0]/2,y[5]-y[3]/2,y[0],y[3],-y[1],-y[4]]}),M.extent=M.transform.forwardTransform(M.nativeExtent),M.pixelSize=new W.A({x:(v.xmax-v.xmin)/i,y:(v.ymax-v.ymin)/a,spatialReference:I}),S.origin.x=-.5,S.origin.y=.5),m){let{x:e,y:t}=M.pixelSize;m.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:M}}(l),p=(0,fe.zS)(l),d=(0,fe.r9)(l);if(this._headerInfo={littleEndian:r,isBigTiff:n,ifds:l,pyramidIFDs:p,maskIFDs:d,...h},this._set("rasterInfo",c),!h.isSupported)throw new a.A("tiffraster:open","this tiff is not supported: "+h.message);if(!h.tileWidth||!h.tileHeight)throw new a.A("tiffraster:open",he);c.isPseudoSpatialReference&&se.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let m=l[0].get("PREDICTOR")?.values?.[0];if(3===l[0].get("SAMPLEFORMAT")?.values?.[0]&&2===m)throw new a.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");let{skipMapInfo:g,skipExtensions:y=[]}=this.ioConfig;if(!y.includes("aux.xml")&&!g){let 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,S.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new W.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,c)}!y.includes("vat.dbf")&&1===c.bandCount&&"u8"===c.pixelType&&!g&&(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),g&&this.updateImageSpaceRasterInfo(c),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:a,posIFD:r}=e;return(r+8>=i.byteLength||r<0)&&(a=r+a,i=(await this.request(this.url,{range:{from:a,to:a+this._bufferSize},responseType:"array-buffer",signal:t})).data,r=0),{fileChunk:i,fileOffset:a,posIFD:r}}async _readIFDs(e,t,i,r=4,s){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,s);let n=await this._readIFD(t,i,ue.NB,r,s);if(!n?.ifd)throw new a.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(n.ifd),!n.nextIFD)return null;t.posIFD=n.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,s)}async _readIFD(e,t,i=ue.NB,r=4,s){let{fileChunk:n,posIFD:l,fileOffset:o}=e;if(!e.fileChunk)return null;let f=(0,fe.JM)(n,t,l,o,i,r);if(f.success){let{ifd:e}=f;if(!e)throw new a.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==ue.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new a.A("tiffraster:open",he);let r=[];if(e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,f.nextIFD,s),e.has("GEOKEYDIRECTORY")){let i=e.get("GEOKEYDIRECTORY"),a=i?.values;if(a&&a.length>4){let e=a[0]+"."+a[1]+"."+a[2];l=i.valueOffset+6-o;let r=await this._validateOrFetchHeaderBuffer({fileChunk:n,posIFD:l,fileOffset:o},s);i.data=(await this._readIFD(r,t,ue.YC,2,s))?.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return f}return f.requiredBufferSize?(n=(await this.request(this.url,{range:{from:o,to:o+l+f.requiredBufferSize+8},responseType:"array-buffer",signal:s})).data,n.byteLength<l+f.requiredBufferSize?null:(e.fileChunk=n,e.fileOffset=o,this._readIFD(e,t,i,r,s))):null}async _fillOffsets(e,t,i,a){let r=e.filter(e=>null!=e.offlineOffsetSize);if(0===r.length)return;let s=r.map(e=>e.offlineOffsetSize),n=Math.min.apply(null,s.map(e=>e[0])),l=Math.max.apply(null,s.map(e=>e[0]+e[1])),o=1===s.length||l-n<=this._bufferSize;if(!o&&s.length>1&&(s.sort((e,t)=>e[0]-t[0]),o=s.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,s[0][0])===l),o){let e=await this._fetchOffsets(n,Math.max(l,n+this._bufferSize),a);return void r.forEach(i=>(0,fe.Cr)(e,t,i,n))}let f=r.map(async e=>{let i=e.offlineOffsetSize,r=await this._fetchOffsets(i[0],i[1]+i[0],a);(0,fe.Cr)(r,t,e,i[0])});await Promise.all(f)}async _fetchOffsets(e,t,i){let a=[],r=this._chunkSize,s=Math.ceil((t-e)/r),n=e;for(let e=0;e<s;e++)a.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+r-1},responseType:"array-buffer",signal:i})),n+=r;let l=await Promise.all(a);if(1===s)return l[0].data;let o=new Uint8Array(t-e+1);for(let e=0;e<s;e++)o.set(new Uint8Array(l[e].data),e*r);return o.buffer}async _fetchRawTiffTile(e,t,i,a,r={}){let s=this._getTileLocation(e,t,i,a);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:f}=s,u=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal})),h=await Promise.all(u),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=1===h.length?h[0].data:new ArrayBuffer(c),d=[0],m=[0];if(h.length>1){let e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){let a=h[t].data;e.set(new Uint8Array(a),i),d[t]=i,i+=a.byteLength,m[t]=a.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:f,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null});if(null==x)return null;if(l!==g||o!==y){let e=x.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),x.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return x}_getTileLocation(e,t,i,a=!1){let{firstPyramidLevel:r,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(r-1),{_headerInfo:l}=this;if(!l)return null;let o=a?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let f=(0,fe.XO)(o,l),u=(0,fe.wc)(o,"TILEOFFSETS"),h=(0,fe.wc)(o,"TILEBYTECOUNTS");if(!u?.length||!h?.length)return null;let{minRow:c,minCol:p,maxRow:d,maxCol:m}=s[n];if(t>d||i>m||t<c||i<p)return null;let g=(0,fe.LZ)(o,"IMAGEWIDTH"),y=(0,fe.LZ)(o,"IMAGELENGTH"),x=(0,fe.LZ)(o,"TILEWIDTH"),w=(0,fe.LZ)(o,"TILELENGTH"),I=[];if(f){let{bandCount:e}=this.rasterInfo;for(let a=0;a<e;a++){let e=a*(d+1)*(m+1)+t*(m+1)+i;I[a]={from:u[e],to:u[e]+h[e]-1}}}else{let e=t*(m+1)+i;I.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<I.length;e++)if(null==I[e].from||!I[e].to||I[e].to<0)return null;return{ranges:I,ifd:o,actualTileWidth:i===m&&g%x||x,actualTileHeight:t===d&&y%w||w}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return H(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=oe(t);return i?.recordSet?_.A.fromJSON(i.recordSet):null}catch{return null}}};(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_files",void 0),(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_headerInfo",void 0),(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_bufferSize",void 0),(0,r.Cg)([(0,s.MZ)()],ce.prototype,"_chunkSize",void 0),(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],ce.prototype,"datasetFormat",void 0),ce=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.TIFFRaster")],ce);const pe=ce,de=new Map;de.set("MRF",{desc:"Meta Raster Format",constructor:re}),de.set("TIFF",{desc:"GeoTIFF",constructor:pe}),de.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Q}),de.set("JPG",{desc:"JPG Raster Format",constructor:G}),de.set("PNG",{desc:"PNG Raster Format",constructor:G}),de.set("GIF",{desc:"GIF Raster Format",constructor:G}),de.set("BMP",{desc:"BMP Raster Format",constructor:G}),de.set("CovJSON",{desc:"COVJSON Raster Format",constructor:k}),de.set("MEMORY",{desc:"In Memory Raster Format",constructor:M});class me{static get supportedFormats(){let e=new Set;return de.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:s}=e,n=e.datasetFormat??i?.datasetFormat;n??(t.includes(".")?n=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?n="CovJSON":r?.extent&&r.pixelblocks&&(n="MEMORY")),"OVR"===n||"TIF"===n||"DM"===n?n="TIFF":"JPG"===n||"JPEG"===n||"JFIF"===n?n="JPG":"COVJSON"===n&&(n="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(n="RasterTileServer");let l={url:t,source:r,sourceJSON:s,datasetFormat:n,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(l).forEach(e=>{l[e]??delete l[e]}),n){if(!this.supportedFormats.has(n))throw new a.A("rasterfactory:open","not a supported format "+n);if("CRF"===n)throw new a.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,de.get(n).constructor)(l);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(de.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),f=0,u=()=>{if(n=o[f++],!n||"CRF"===n)return null;let t=new(0,de.get(n).constructor)(l);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>u())};return u()}static register(e,t,i){de.has(e.toUpperCase())||de.set(e.toUpperCase(),{desc:t,constructor:i})}}},10333(e,t,i){i.d(t,{A:()=>n});var a=i(32198),r=i(25482),s=i(91429);let n=class extends r.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,a.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var a,r=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=a=class extends n.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 a({tolerance:this.tolerance})}};(0,r.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,r.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=a=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var a,r=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),f=i(36005),u=i(43937),h=i(93223);function c(e,t,i){let{x:a,y:r}=t;if(i<2)return{x:e[0]+a*e[2]+r*e[4],y:e[1]+a*e[3]+r*e[5]};if(2===i){let t=a*a,i=r*r,s=a*r;return{x:e[0]+a*e[2]+r*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+a*e[3]+r*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=a*a,n=r*r,l=a*r,o=s*a,f=s*r,u=a*n,h=r*n;return{x:e[0]+a*e[2]+r*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+f*e[14]+u*e[16]+h*e[18],y:e[1]+a*e[3]+r*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+f*e[15]+u*e[17]+h*e[19]}}function p(e,t,i){let{xmin:a,ymin:r,xmax:s,ymax:l,spatialReference:o}=t,f=[];if(i<2)f.push({x:a,y:l}),f.push({x:s,y:l}),f.push({x:a,y:r}),f.push({x:s,y:r});else{let e=10;for(let t=0;t<e;t++)f.push({x:a,y:r+(l-r)*t/(e-1)}),f.push({x:s,y:r+(l-r)*t/(e-1)});e=8;for(let t=1;t<=e;t++)f.push({x:a+(s-a)*t/e,y:r}),f.push({x:a+(s-a)*t/e,y:l})}f=f.map(t=>c(e,t,i));let u=f.map(e=>e.x),h=f.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,u),xmax:Math.max.apply(null,u),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=a=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:a}=t;if(!i?.length||!a?.length||i.length!==a.length)return null;let r=[];for(let e=0;e<i.length;e++)r.push(i[e]),r.push(a[e]);return r}writeForwardCoefficients(e,t,i){let a=[],r=[];for(let t=0;t<e?.length;t++)t%2==0?a.push(e[t]):r.push(e[t]);t.coeffX=a,t.coeffY=r}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,a,r,s,n]=e,l=a*n-s*r,o=s*r-a*n;return[(s*i-t*n)/l,(a*i-t*r)/o,n/l,r/o,-s/l,-a/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:a}=t;if(!i?.length||!a?.length||i.length!==a.length)return null;let r=[];for(let e=0;e<i.length;e++)r.push(i[e]),r.push(a[e]);return r}writeInverseCoefficients(e,t,i){let a=[],r=[];for(let t=0;t<e?.length;t++)t%2==0?a.push(e[t]):r.push(e[t]);t.inverseCoeffX=a,t.inverseCoeffY=r}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new a({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,r.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,r.Cg)([(0,f.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,r.Cg)([(0,u.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,r.Cg)([(0,f.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,r.Cg)([(0,u.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,r.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=a=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)}}]);