@arcgis/core 5.2.1 → 5.2.2

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 (145) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0fa29352f2ecf0c515e8.js +1 -0
  5. package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
  6. package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{10878932826ddb60fac4.js → 1fcc998421c7c16de2ca.js} +1 -1
  8. package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
  9. package/assets/esri/core/workers/chunks/251f706d226b1d47ba99.js +1 -0
  10. package/assets/esri/core/workers/chunks/{ba38231193919e093917.js → 2529f12fc16e98c014ca.js} +1 -1
  11. package/assets/esri/core/workers/chunks/2b4dd42920d37b1ff0a9.js +2 -0
  12. package/assets/esri/core/workers/chunks/2b804b5d7ce10f0f0cf0.js +1 -0
  13. package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
  14. package/assets/esri/core/workers/chunks/36f31416132de434ec00.js +1 -0
  15. package/assets/esri/core/workers/chunks/3e29ab5ec136e669b633.js +1 -0
  16. package/assets/esri/core/workers/chunks/{36c780a9527c75b36725.js → 40d7e54529d13fdd2bf1.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{2cb209bc51a19487692d.js → 43aef67452fa6ff8d8f9.js} +2 -2
  18. package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
  19. package/assets/esri/core/workers/chunks/{5d42f0898bf30ae940ea.js → 46071e59290bf06bb614.js} +1 -1
  20. package/assets/esri/core/workers/chunks/46d91cd99558304da0c7.js +1 -0
  21. package/assets/esri/core/workers/chunks/4cf72dcccf2be353a701.js +1 -0
  22. package/assets/esri/core/workers/chunks/{e3a742dc0c291b47ba56.js → 510c2eb78f5e12f77bbc.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{98d1efb6f2439c6344cf.js → 5b2d1c8763a1716677c0.js} +1 -1
  24. package/assets/esri/core/workers/chunks/5bf7de2e2faa55e53629.js +1 -0
  25. package/assets/esri/core/workers/chunks/{042614bf65b7d63025cb.js → 5f49233d5b67a9ad71d7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/604433b02a165d187953.js +1 -0
  27. package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
  28. package/assets/esri/core/workers/chunks/{094eb9677cdebfaa9e1b.js → 648d5cdfc3e92be3db55.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{bc6fdd9faf8ed54be0cb.js → 6694e2b27fd6ddf44e21.js} +1 -1
  30. package/assets/esri/core/workers/chunks/70268d790c2f1cb83d43.js +1 -0
  31. package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
  32. package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
  33. package/assets/esri/core/workers/chunks/{d56fdf5ce5ff53dc0e69.js → 84495695313b01832369.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{31640b41e0ecdff892fa.js → 85b63811ae7bcb6f74b6.js} +2 -2
  35. package/assets/esri/core/workers/chunks/{c4bbe4707e90b7cd0379.js → 8ac4a043a4f185db271f.js} +1 -1
  36. package/assets/esri/core/workers/chunks/8d01dd92f5c897193ab5.js +1 -0
  37. package/assets/esri/core/workers/chunks/900c8569596609183f19.js +2 -0
  38. package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
  39. package/assets/esri/core/workers/chunks/95c9c5677bbe7fd0420a.js +1 -0
  40. package/assets/esri/core/workers/chunks/{b70885deebc6106597ad.js → 983b85727e09c54bede0.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{d20dcd4ce4b0111d924f.js → 9bbc8e5d42921a8050bb.js} +1 -1
  42. package/assets/esri/core/workers/chunks/a07070de96e143a329a4.js +1 -0
  43. package/assets/esri/core/workers/chunks/a17fb26d6ac4895e51a3.js +2 -0
  44. package/assets/esri/core/workers/chunks/{0d52e1b6d38f2670658c.js → a6f74bd1a9c87b9836ca.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{a85cdafbaf1848bb924b.js → a846c94d49df8d4cd5be.js} +1 -1
  46. package/assets/esri/core/workers/chunks/aa4f12fcb9f4ed3dba18.js +1 -0
  47. package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
  48. package/assets/esri/core/workers/chunks/{509a74e9334f31b931d4.js → b54ba2bd6b1b90dcc0cc.js} +1 -1
  49. package/assets/esri/core/workers/chunks/bde8f3b3ce5b1d3ee774.js +1 -0
  50. package/assets/esri/core/workers/chunks/c25ae83fd790f181bb42.js +1 -0
  51. package/assets/esri/core/workers/chunks/{dc51dcaa4e2f9a90f5bd.js → c2cbe0f5e8958cf18e58.js} +2 -2
  52. package/assets/esri/core/workers/chunks/c4c55d8a98ba3f51f63c.js +1 -0
  53. package/assets/esri/core/workers/chunks/c5bf19da62a3d31009fe.js +2 -0
  54. package/assets/esri/core/workers/chunks/{2226c20c38e20713bcb5.js.LICENSE.txt → c5bf19da62a3d31009fe.js.LICENSE.txt} +1 -1
  55. package/assets/esri/core/workers/chunks/{2a2a4650dd9b953d317c.js → c93343a91161c4e40c28.js} +1 -1
  56. package/assets/esri/core/workers/chunks/cb4c5544382eb8c4a87f.js +1 -0
  57. package/assets/esri/core/workers/chunks/{2d83ba260dd6bbe38206.js → d05665ddc8d31403aed3.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d24dea0bdb17db07e2b3.js +1 -0
  59. package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
  60. package/assets/esri/core/workers/chunks/d4bc6d65dff5d0cc93ba.js +1 -0
  61. package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{aea44253c80493ef5755.js → e7b168ba31142c00f765.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{a504a5e06cb89a620799.js → ec8b7476eac4718eb0ac.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
  65. package/assets/esri/core/workers/chunks/{d53cc574a21031436c45.js → f79494829a5b65b5b4c9.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{26261b21d1edf476ea49.js → f7ec3b7f2eccd9c4c2e5.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{20ee2f36f0fd0ae01e15.js → f88cbf9b1d1d7400c060.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{bf4d913e523eae2fda28.js → fa7b189e9b2cc8d4a77f.js} +1 -1
  69. package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
  70. package/assets/esri/core/workers/chunks/{735c1dffc3439bdba3cc.js → fd172c96d2b36032a1d9.js} +1 -1
  71. package/config.js +1 -1
  72. package/core/workers.d.ts +1 -0
  73. package/kernel.js +1 -1
  74. package/layers/CSVLayer.js +1 -1
  75. package/layers/SceneLayer.js +1 -1
  76. package/layers/graphics/sources/CSVSource.js +1 -1
  77. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  78. package/layers/graphics/sources/MemorySource.js +2 -2
  79. package/layers/graphics/sources/support/QueryTask.js +1 -1
  80. package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
  81. package/layers/mixins/ArcGISImageService.js +1 -1
  82. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  83. package/layers/support/TimeInformation.js +1 -1
  84. package/layers/support/timeInfoUtils.js +2 -0
  85. package/package.json +4 -4
  86. package/rest/query/executeAttributeBinsQuery.js +1 -1
  87. package/rest/query/executeForExtent.js +1 -1
  88. package/rest/query/executeForTopCount.js +1 -1
  89. package/rest/query/executeForTopExtents.js +1 -1
  90. package/rest/query/executeForTopIds.js +1 -1
  91. package/rest/query/executeTopFeaturesQuery.js +1 -1
  92. package/rest/query/operations/query.js +1 -1
  93. package/rest/query/operations/queryAttributeBins.js +1 -1
  94. package/rest/query/operations/queryTopFeatures.js +1 -1
  95. package/rest/support/timeUtils.js +1 -1
  96. package/symbols/TextSymbol.d.ts +0 -1
  97. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  98. package/views/3d/environment/SunLighting.d.ts +10 -8
  99. package/views/3d/environment/VirtualLighting.d.ts +10 -8
  100. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  101. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  102. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  103. package/widgets/OrientedImageryViewer.js +2 -2
  104. package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
  105. package/assets/esri/core/workers/chunks/2226c20c38e20713bcb5.js +0 -2
  106. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  107. package/assets/esri/core/workers/chunks/2b6684d057d9ad17ac13.js +0 -1
  108. package/assets/esri/core/workers/chunks/2e66c969bf4209c957b5.js +0 -2
  109. package/assets/esri/core/workers/chunks/377595b23379b0c8fe95.js +0 -1
  110. package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
  111. package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
  112. package/assets/esri/core/workers/chunks/3c881b1adc8a5dea9a90.js +0 -1
  113. package/assets/esri/core/workers/chunks/4e6656a5f29e31902fca.js +0 -2
  114. package/assets/esri/core/workers/chunks/50e8943d2c0b96fab2c1.js +0 -1
  115. package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
  116. package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
  117. package/assets/esri/core/workers/chunks/60c79934799927114074.js +0 -1
  118. package/assets/esri/core/workers/chunks/63b5418a1c3fe0a97a86.js +0 -1
  119. package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
  120. package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +0 -1
  121. package/assets/esri/core/workers/chunks/7dfbc31f3b56728485a4.js +0 -1
  122. package/assets/esri/core/workers/chunks/822f83d7c09ef0a9bbdf.js +0 -1
  123. package/assets/esri/core/workers/chunks/844eedda8f749972f707.js +0 -2
  124. package/assets/esri/core/workers/chunks/8b8118ab56cc808b5a71.js +0 -1
  125. package/assets/esri/core/workers/chunks/8d86b0cb0e004ad72040.js +0 -1
  126. package/assets/esri/core/workers/chunks/98760040f0c9d47c718d.js +0 -1
  127. package/assets/esri/core/workers/chunks/a2f0894218e665780a21.js +0 -1
  128. package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
  129. package/assets/esri/core/workers/chunks/ab6506a3c16f8717fc00.js +0 -1
  130. package/assets/esri/core/workers/chunks/c45edd0a7d57263bb7d6.js +0 -1
  131. package/assets/esri/core/workers/chunks/c52466eb1f3c33ae1f5a.js +0 -1
  132. package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
  133. package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
  134. package/assets/esri/core/workers/chunks/c80a3b039e510c118399.js +0 -1
  135. package/assets/esri/core/workers/chunks/c88a70f68c8ce8c30e9b.js +0 -1
  136. package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
  137. package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
  138. package/assets/esri/core/workers/chunks/e9cdb0b0f074583edebd.js +0 -1
  139. package/assets/esri/core/workers/chunks/f5cc78291b53931b91e8.js +0 -1
  140. /package/assets/esri/core/workers/chunks/{844eedda8f749972f707.js.LICENSE.txt → 2b4dd42920d37b1ff0a9.js.LICENSE.txt} +0 -0
  141. /package/assets/esri/core/workers/chunks/{2cb209bc51a19487692d.js.LICENSE.txt → 43aef67452fa6ff8d8f9.js.LICENSE.txt} +0 -0
  142. /package/assets/esri/core/workers/chunks/{31640b41e0ecdff892fa.js.LICENSE.txt → 85b63811ae7bcb6f74b6.js.LICENSE.txt} +0 -0
  143. /package/assets/esri/core/workers/chunks/{4e6656a5f29e31902fca.js.LICENSE.txt → 900c8569596609183f19.js.LICENSE.txt} +0 -0
  144. /package/assets/esri/core/workers/chunks/{2e66c969bf4209c957b5.js.LICENSE.txt → a17fb26d6ac4895e51a3.js.LICENSE.txt} +0 -0
  145. /package/assets/esri/core/workers/chunks/{dc51dcaa4e2f9a90f5bd.js.LICENSE.txt → c2cbe0f5e8958cf18e58.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2486],{38961(e,t,r){var i=r(32198),s=r(7762),o=r(36708),n=r(10107),a=r(64108),l=r(80559);let u=class extends s.A{constructor(e){super(e),this.getCollections=null}initialize(){this.addHandles((0,l.fm)(()=>this._refresh(),o.OH))}destroy(){this.getCollections=null}_refresh(){let e=this.getCollections?.();if(null==e)return void this.removeAll();let t=0;for(let r of e)null!=r&&(t=this._processCollection(t,r));this.splice(t)}_createNewInstance(e){return new s.A(e)}_processCollection(e,t){if(!t)return e;let r=this.itemFilterFunction??(e=>!!e);for(let i of t)if(i){if(r(i)){let t=this.indexOf(i,e);t>=0?t!==e&&this.reorder(i,e):this.add(i,e),++e}if(this.getChildrenFunction){let t=this.getChildrenFunction(i);if(Array.isArray(t))for(let r of t)e=this._processCollection(e,r);else e=this._processCollection(e,t)}}return e}};(0,i.Cg)([(0,n.MZ)()],u.prototype,"getCollections",void 0),(0,i.Cg)([(0,n.MZ)()],u.prototype,"getChildrenFunction",void 0),(0,i.Cg)([(0,n.MZ)()],u.prototype,"itemFilterFunction",void 0),u=(0,i.Cg)([(0,a.$)("esri.core.CollectionFlattener")],u);const p=u;r.d(t,["A",0,p])},46140(e,t,r){r.d(t,{A:()=>s});var i=r(49186);class s{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){let t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new s(this.major,this.minor,this._context)}static parse(e,t=""){let[r,o]=e.split("."),n=/^\s*\d+\s*$/;if(!r?.match||!n.test(r)){let r=t&&t+":";throw new i.A(r+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e})}if(!o?.match||!n.test(o)){let r=t&&t+":";throw new i.A(r+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e})}return new s(parseInt(r,10),parseInt(o,10),t)}}},6797(e,t,r){r.d(t,{Ui:()=>y});var i=r(69622),s=r(7762),o=r(88620);const n=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function a(e){return e instanceof i.A}function l(e){return e instanceof s.A?Object.keys(e.items):a(e)?(0,o.oY)(e).keys():e?Object.keys(e):[]}function u(e,t){return e instanceof s.A?e.items[t]:e[t]}function p(e){return e?e.declaredClass:null}function d(e,t){let r=e.diff;if(r&&"function"==typeof r)return r(e,t);let i=l(e),s=l(t);if(0===i.length&&0===s.length)return;if(!i.length||!s.length||function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&e.length!==t.length}(e,t))return{type:"complete",oldValue:e,newValue:t};let o=s.filter(e=>!i.includes(e)),y=i.filter(e=>!s.includes(e)),c=i.filter(r=>s.includes(r)&&u(e,r)!==u(t,r)).concat(o,y).sort(),h=p(e);if(h&&n.has(h)&&c.length)return{type:"complete",oldValue:e,newValue:t};let f,m=a(e)&&a(t);for(let i of c){let s,o=u(e,i),n=u(t,i);if((m||"function"!=typeof o&&"function"!=typeof n)&&o!==n&&(null!=o||null!=n)){if(r&&r[i]&&"function"==typeof r[i])s=r[i]?.(o,n);else if(o instanceof Date&&n instanceof Date){if(o.getTime()===n.getTime())continue;s={type:"complete",oldValue:o,newValue:n}}else s="object"==typeof o&&"object"==typeof n&&p(o)===p(n)?d(o,n):{type:"complete",oldValue:o,newValue:n};null!=s&&(null==f?f={type:"partial",diff:{[i]:s}}:f.diff[i]=s)}}return f}function y(e,t){if("function"!=typeof e&&"function"!=typeof t&&(null!=e||null!=t))return null==e||null==t||"object"==typeof e&&"object"==typeof t&&p(e)!==p(t)?{type:"complete",oldValue:e,newValue:t}:d(e,t)}},81583(e,t,r){r.d(t,{L:()=>a,g:()=>n});var i=r(60999),s=r(7762),o=r(92474);async function n(e,t){return await e.load(),a(e,t)}async function a(e,t){let r=[],n=(...e)=>{for(let t of e)if(null!=t){if(Array.isArray(t)){n(...t);continue}if(s.A.isCollection(t)){t.forEach(e=>n(e));continue}(0,o.Zm)(t)&&r.push(t)}};t(n);let a=null;if(await(0,i.Tj)(r,async e=>{let t=await(0,i.Ke)(function(e){return"loadAll"in e&&"function"==typeof e.loadAll}(e)?e.loadAll():e.load());!1===t.ok&&!a&&(a=t)}),a)throw a.error;return e}},64314(e,t,r){r.d(t,{A:()=>C});var i=r(32198),s=r(69622),o=r(49186),n=r(44208),a=r(17676),l=r(84952),u=r(91429),p=r(21325),d=r(20557),y=r(2272),c=r(99614),h=r(20615),f=r(74910),m=r(78286),g=r(99199),b=r(62815),v=r(63746);class w{constructor(e){this._options=e,this.featureSet={features:[]},this.parseOnly=null,this._transformInPlace=null,this._transformInPlaceXY=null,this._finishVertex=w._finishVertexNonPoint,this._attributesClass=null,this._previousX=0,this._previousY=0,this._point=null,this._lengths=null,this._vertex=[],this._part=null,this._parts=null,this._i=0}queryGeometryType(){return this.featureSet.queryGeometryType}queryGeometry(){return this.featureSet.queryGeometry}idField(e){"string"==typeof e&&(this.featureSet.objectIdFieldName=e)}finish(){this._options.applyTransform&&(this.featureSet.transform=null);let{spatialReference:e,features:t}=this.featureSet;if(e)for(let{geometry:r}of t)r&&(r.spatialReference=e)}feature(){this._attributesClass??=(0,v._)(this.featureSet.fields?.map(e=>e.name)??[]),this.featureSet.features.push({attributes:new this._attributesClass}),this._options.applyTransform&&this._setVertexTransformer()}centroid([e,t]){this.featureSet.features.at(-1).centroid={x:e,y:t}}geometry(e,t,r){this._previousX=this._previousY=0,this._lengths=r;let i,{hasZ:s,hasM:o}=this.featureSet;switch(s??=!1,o??=!1,this._i=0,this._vertex=[0,0],s&&this._vertex.push(0),o&&this._vertex.push(0),this._finishVertex=w._finishVertexNonPoint,t){case"esriGeometryPoint":this._point={x:0,y:0},i=this._point,this._finishVertex=s?o?w._finishVertexPointXYZM:w._finishVertexPointXYZ:o?w._finishVertexPointXYM:w._finishVertexPointXY;break;case"esriGeometryMultipoint":i={points:[],hasZ:s,hasM:o},this._part=i.points,this._parts=[];break;case"esriGeometryPolyline":i={paths:[],hasZ:s,hasM:o},this._parts=i.paths,this._part=[];break;case"esriGeometryPolygon":i={rings:[],hasZ:s,hasM:o},this._parts=i.rings,this._part=[]}1===e?(this.featureSet.queryGeometry=i,this.featureSet.queryGeometryType=t,this._options.applyTransform||this._setVertexTransformer()):this.featureSet.features.at(-1).geometry=i}coord(e){let t=this._vertex;t[this._i++]=e,!(this._i<t.length)&&(this._i=0,this._transformInPlace&&(t[0]+=this._previousX,t[1]+=this._previousY,[this._previousX,this._previousY]=t,this._transformInPlace(t)),this._finishVertex(this))}curvedGeometry(e,t,r,i){let s,{hasZ:o,hasM:n}=this.featureSet;switch(o??=!1,n??=!1,e){case"esriGeometryPoint":case"esriGeometryMultipoint":throw Error(`Curved ${e} does not make sense`);case"esriGeometryPolyline":s={paths:[],curvePaths:[],hasZ:o,hasM:n},this._parts=s.curvePaths,this._part=[];break;case"esriGeometryPolygon":s={rings:[],curveRings:[],hasZ:o,hasM:n},this._parts=s.curveRings,this._part=[]}this.featureSet.features.at(-1).geometry=s}startCurvedPart(e){this._part.push(this._transform(e))}finishCurvedPart(e){this._parts.push(this._part),this._part=[]}lineSegment(e,t){this._part.push(this._transform(t))}bezierSegment(e,t,r,i){this._part.push({b:[this._transform(t),this._transformXY(r),this._transformXY(i)]})}circularArcSegment(e,t,r){this._part.push({c:[this._transform(t),this._transformXY(r)]})}ellipticArcSegment(e,t,r,i,s,o,n,a){this._part.push({a:[this._transform(t),this._transformXY(r),i,s,o,n,a]})}static _finishVertexPointXY({_point:e,_vertex:t}){[e.x,e.y]=t}static _finishVertexPointXYZ({_point:e,_vertex:t}){[e.x,e.y,e.z]=t}static _finishVertexPointXYM({_point:e,_vertex:t}){[e.x,e.y,e.m]=t}static _finishVertexPointXYZM({_point:e,_vertex:t}){[e.x,e.y,e.z,e.m]=t}static _finishVertexNonPoint(e){let{_part:t,_parts:r,_lengths:i,_vertex:s}=e;t.push([...s]),!(t.length<i[r.length])&&(e._previousX=e._previousY=0,e._part=[],r.push(t))}_setVertexTransformer(){let{sourceSpatialReference:e}=this._options,{spatialReference:t,hasZ:r,transform:i}=this.featureSet,s=r?(0,b.d)(e,t):1;this._transformInPlace??=(0,v.M)(this.featureSet,s),this._transformInPlaceXY??=(0,v.M)({transform:i})}_transform(e){let t=[...e];return this._transformInPlace?.(t),t}_transformXY(e){let t=[e[0],e[1]];return this._transformInPlaceXY?.(t),t}}var S=r(80893),I=r(22671),x=r(97552);let C=class extends s.A{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.pbfSupportedWithCurves=!1,this.queryAttachmentsSupported=!1,this.relativeTimeBinWindow=0,this.sourceSpatialReference=null,this.timeInformation=null,this.uniqueIdFields=null,this.url=null}get parsedUrl(){return(0,l.An)(this.url)}async execute(e,t){let r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){let r,i=this._normalizeQuery(e),s=null!=e.outStatistics?.[0],o=(0,n.A)("featurelayer-pbf-statistics");if(this.pbfSupported&&(!s||o)&&(!e.returnTrueCurves||this.pbfSupportedWithCurves))try{r=await async function(e,t,r,i){let s=(0,y.Dl)(e),o={...r},n=x.A.from(t),a=!n.quantizationParameters;return await(0,S.IJ)(s,n,new w({sourceSpatialReference:n.sourceSpatialReference,applyTransform:a}),o,i)}(this.url,i,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}catch(e){if("query:parsing-pbf"!==e.name)throw e;this.pbfSupported=!1}return r??=await(0,g.e)(this.url,i,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields}),this._normalizeFields(r.fields),r}async featureSetFromJSON(e,t,i){if(!this._queryGet3DObjectFormat(e)||null==this.infoFor3D||!t.features)return I.A.fromJSON(t);let{meshFeatureSetFromJSON:s}=await(0,a.qr)(Promise.all([r.e(2258),r.e(118),r.e(9855)]).then(()=>r(40050)),i);return s(e,this.infoFor3D,t)}executeForCount(e,t){return(0,h.I)(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}executeForExtent(e,t){return(0,f.L)(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}executeForIds(e,t){return(0,m.V)(this.url,this._normalizeQuery(e),t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeRelationshipQuery(e,t){let[{default:i},{executeRelationshipQuery:s}]=await(0,a.qr)(Promise.all([Promise.resolve().then(()=>r(26591)),r.e(1763).then(()=>r(71763))]),t),o=i.from(e);return(this.gdbVersion||this.dynamicDataSource)&&(o=o.clone(),o.gdbVersion=o.gdbVersion||this.gdbVersion,o.dynamicDataSource=o.dynamicDataSource||this.dynamicDataSource),s(this.url,o,t)}async executeRelationshipQueryForCount(e,t){let[{default:i},{executeRelationshipQueryForCount:s}]=await(0,a.qr)(Promise.all([Promise.resolve().then(()=>r(26591)),r.e(1763).then(()=>r(71763))]),t),o=i.from(e);return(this.gdbVersion||this.dynamicDataSource)&&(o=o.clone(),o.gdbVersion=o.gdbVersion||this.gdbVersion,o.dynamicDataSource=o.dynamicDataSource||this.dynamicDataSource),s(this.url,o,t)}async executeAttachmentQuery(e,t){let{executeAttachmentQuery:i,fetchAttachments:s,processAttachmentQueryResult:o}=await(0,a.qr)(r.e(9239).then(()=>r(9239)),t),n=(0,y.Dl)(this.url);return o(n,await(this.queryAttachmentsSupported?i(n,e,t):s(n,e,t)))}async executeAttributeBinsQuery(e,t){let{executeAttributeBinsQuery:i}=await(0,a.qr)(r.e(3103).then(()=>r(33103)),t);return i(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executePivotQuery(e,t){let{executePivotQuery:i}=await(0,a.qr)(r.e(566).then(()=>r(80566)),t);return i(this.parsedUrl,e,t)}async executeTopFeaturesQuery(e,t){let{executeTopFeaturesQuery:i}=await(0,a.qr)(r.e(1273).then(()=>r(11273)),t);return i(this.parsedUrl,e,this.sourceSpatialReference,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeForTopIds(e,t){let{executeForTopIds:i}=await(0,a.qr)(r.e(1277).then(()=>r(21277)),t);return i(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeForTopExtents(e,t){let{executeForTopExtents:i}=await(0,a.qr)(r.e(8018).then(()=>r(8018)),t);return i(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}async executeForTopCount(e,t){let{executeForTopCount:i}=await(0,a.qr)(r.e(980).then(()=>r(10980)),t);return i(this.parsedUrl,e,t,{timeInformation:this.timeInformation,uniqueIdFields:this.uniqueIdFields})}_normalizeQuery(e){let t=x.A.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource);let{infoFor3D:r}=this,i=this._queryGet3DObjectFormat(e);if(null!=r&&i){if(t=t===e?t.clone():t,t.formatOf3DObjects=i,t.outSpatialReference&&!(0,p.aI)(t.outSpatialReference,this.sourceSpatialReference))throw new o.A("query:unsupported-out-spatial-reference","3D object feature services do not support projection of geometries");if(null==t.outFields||!t.outFields.includes("*")){t=t===e?t.clone():t,t.outFields??(t.outFields=[]);let{originX:i,originY:s,originZ:o,translationX:n,translationY:a,translationZ:l,scaleX:u,scaleY:p,scaleZ:d,rotationX:y,rotationY:c,rotationZ:h,rotationDeg:f}=r.transformFieldRoles;t.outFields.push(i,s,o,n,a,l,u,p,d,y,c,h,f)}}return t}_normalizeFields(e){if(null!=this.fieldsIndex&&null!=e)for(let t of e){let e=this.fieldsIndex.get(t.name);e&&Object.assign(t,e.toJSON())}}_queryGet3DObjectFormat({returnGeometry:e,multipatchOption:t,outStatistics:r}){return!0!==e||"xyFootprint"===t||r?null:(0,d.Hz)(this.infoFor3D)}};(0,i.Cg)([(0,u.MZ)({types:c.e})],C.prototype,"dynamicDataSource",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"fieldsIndex",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"gdbVersion",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"infoFor3D",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],C.prototype,"parsedUrl",null),(0,i.Cg)([(0,u.MZ)()],C.prototype,"pbfSupported",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"pbfSupportedWithCurves",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"queryAttachmentsSupported",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"relativeTimeBinWindow",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"sourceSpatialReference",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"timeInformation",void 0),(0,i.Cg)([(0,u.MZ)()],C.prototype,"uniqueIdFields",void 0),(0,i.Cg)([(0,u.MZ)({type:String})],C.prototype,"url",void 0),C=(0,i.Cg)([(0,u.$K)("esri.layers.graphics.sources.support.QueryTask")],C)},52136(e,t,r){var i=r(32198),s=r(91429);r.d(t,["p",0,e=>{let t=e,r=class extends t{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null==e?(this._clearOverride("apiKey"),this.clear("apiKey","user")):this._override("apiKey",e)}};return(0,i.Cg)([(0,s.MZ)({type:String})],r.prototype,"apiKey",null),r=(0,i.Cg)([(0,s.$K)("esri.layers.mixins.APIKeyMixin")],r),r}])},98534(e,t,r){var i=r(32198),s=r(56507),o=r(5479),n=r(91869),a=r(17676),l=r(84952),u=r(46140),p=r(91429),d=r(5443),y=r(16930),c=r(60694),h=r(10873),f=r(10407),m=r(36005);r.d(t,["V",0,e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.capabilities=void 0,this.copyright=null,this.fullExtent=null,this.legendEnabled=!0,this.spatialReference=null,this.version=void 0,this._allLayersAndTablesMap=null}readCapabilities(e,t){let r=t.capabilities&&t.capabilities.split(",").map(e=>e.toLowerCase().trim());if(!r)return{operations:{supportsExportMap:!1,supportsExportTiles:!1,supportsIdentify:!1,supportsQuery:!1,supportsTileMap:!1},exportMap:null,exportTiles:null};let i=this.type,s="tile"!==i&&!!t.supportsDynamicLayers,o=r.includes("query"),n=r.includes("map"),a=!!t.exportTilesAllowed,l=r.includes("tilemap"),p=r.includes("data"),d="tile"!==i&&(!t.tileInfo||s),y="tile"!==i&&(!t.tileInfo||s),c="tile"!==i,h="tile"!==i&&s&&t.currentVersion>=11.1,f=t.cimVersion?u.A.parse(t.cimVersion):null,m=f?.greaterEqual(1,4)??!1,g=f?.greaterEqual(2,0)??!1;return{operations:{supportsExportMap:n,supportsExportTiles:a,supportsIdentify:o,supportsQuery:p,supportsTileMap:l},exportMap:n?{supportsArcadeExpressionForLabeling:m,supportsCIMSymbols:g,supportsDynamicLayers:s,supportsSublayerOrderBy:h,supportsSublayerDefinitionExpression:y,supportsSublayerVisibility:d,supportsSublayersChanges:c}:null,exportTiles:a?{maxExportTilesCount:+t.maxExportTilesCount}:null}}readVersion(e,t){let r=t.currentVersion;return r||=t.hasOwnProperty("capabilities")||t.hasOwnProperty("tables")?10:t.hasOwnProperty("supportedImageFormatTypes")?9.31:9.3,r}async fetchRelatedService(e){let t=this.portalItem;if(!t||!(0,f.bK)(t))return null;this._relatedFeatureServicePromise||=t.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},e).then(e=>e.find(e=>"Feature Service"===e.type)??null,()=>null);let r=await this._relatedFeatureServicePromise;return(0,a.Te)(e),r?{itemId:r.id,url:r.url}:null}async fetchSublayerInfo(e,t){let{source:r}=e;if(this?.portalItem&&"tile"===this.type&&"map-layer"===r?.type&&(0,f.bK)(this.portalItem)&&e.originIdOf("url")<2){let i=await this.fetchRelatedService(t);i&&(e.url=(0,l.fj)(i.url,r.mapLayerId.toString()),e.layerItemId=i.itemId)}let i,{url:o}=e;if("data-layer"===r.type||"workspace-layer"===r.type)i=(await(0,s.A)(o,{responseType:"json",query:{f:"json",...this.customParameters,token:this.apiKey},...t})).data;else{let s=e.id;"map-layer"===r?.type&&(s=r.mapLayerId);try{i=(await this.fetchAllLayersAndTables(t)).get(s)}catch{}if(o&&e.originIdOf("url")>2)try{let e=await this._fetchAllLayersAndTablesFromService(o),t=(0,c.qg)(o)?.sublayer??r.mapLayerId,s=structuredClone(e.get(t));if(null!=s){for(let e of["drawingInfo","maxScale","minScale","name"])delete s[e];i={...i,...s}}}catch{}}return i}async fetchAllLayersAndTables(e){return this._fetchAllLayersAndTablesFromService(this.parsedUrl?.path,e)}async _fetchAllLayersAndTablesFromService(e,t){await this.load(t),this._allLayersAndTablesMap||=new Map;let r=(0,c.qg)(e),i=await(0,n.tE)(this._allLayersAndTablesMap,r?.url.path,()=>(0,s.A)((0,l.fj)(r?.url.path,"/layers"),{query:{f:"json",...this.customParameters,token:this.apiKey}}).then(async e=>{let t=new Map,{layers:i,tables:n}=e.data,a=[...i??[],...n??[]];for(let e of a)t.set(e.id,e);if((0,o.zN)(t.values(),e=>null==e.capabilities||null==e.extent)){let{data:e}=await(0,s.A)(r?.url.path,{query:{f:"json",...this.customParameters,token:this.apiKey}}).catch(()=>({data:{capabilities:"",fullExtent:void 0}}));for(let r of t.values())r.capabilities??=e.capabilities??"",r.extent??=e.fullExtent}return{result:t}},e=>({error:e})));if((0,a.Te)(t),"result"in i)return i.result;throw i.error}};return(0,i.Cg)([(0,p.MZ)({readOnly:!0})],r.prototype,"capabilities",void 0),(0,i.Cg)([(0,m.w)("service","capabilities",["capabilities","cimVersion","currentVersion","exportTilesAllowed","maxExportTilesCount","supportsDynamicLayers","tileInfo"])],r.prototype,"readCapabilities",null),(0,i.Cg)([(0,p.MZ)({json:{read:{source:"copyrightText"}}})],r.prototype,"copyright",void 0),(0,i.Cg)([(0,p.MZ)({type:d.A})],r.prototype,"fullExtent",void 0),(0,i.Cg)([(0,p.MZ)(h.id)],r.prototype,"id",void 0),(0,i.Cg)([(0,p.MZ)({type:Boolean,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend"}}})],r.prototype,"legendEnabled",void 0),(0,i.Cg)([(0,p.MZ)(h.M6)],r.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,p.MZ)({type:y.A})],r.prototype,"spatialReference",void 0),(0,i.Cg)([(0,p.MZ)({readOnly:!0})],r.prototype,"version",void 0),(0,i.Cg)([(0,m.w)("service","version",["currentVersion","capabilities","tables","supportedImageFormatTypes"])],r.prototype,"readVersion",null),r=(0,i.Cg)([(0,p.$K)("esri.layers.mixins.ArcGISMapService")],r),r}])},32756(e,t,r){r.d(t,{Rr:()=>a});var i=r(32198),s=r(93637),o=r(91429),n=r(91880);function a(e,t,r){if(!e)return null;let i=e.find(e=>!!e.field);if(!i)return null;let s=new n.A;return s.read(i,r),[s]}const l={type:[n.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:a},write:{writer:function(e,t,r,i){let o=e.find(e=>!!e.field);o&&(0,s.sM)(r,[o.toJSON()],t)}}}};r.d(t,["fY",0,e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.orderBy=null}};return(0,i.Cg)([(0,o.MZ)(l)],r.prototype,"orderBy",void 0),r=(0,i.Cg)([(0,o.$K)("esri.layers.mixins.OrderedLayer")],r),r},"ne",0,l])},91921(e,t,r){var i=r(32198),s=r(7762),o=r(38961),n=r(49186),a=r(53966),l=r(36708),u=r(91429),p=r(35666),d=r(88620),y=r(15775),c=r(63389);const h=s.A.ofType(y.A);function f(e,t){e&&e.forEach(e=>{t(e),e.sublayers&&e.sublayers.length&&f(e.sublayers,t)})}r.d(t,["I",0,e=>{let t=e,r=class extends t{constructor(...e){super(...e),this.allSublayers=new o.A({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.sublayersSourceJSON={2:{},3:{},4:{},5:{},6:{}},this.subtables=null,this.addHandles([(0,l.wB)(()=>this.sublayers,(e,t)=>this._handleSublayersChange(e,t),l.OH),(0,l.wB)(()=>this.subtables,(e,t)=>this._handleSublayersChange(e,t),l.OH)])}destroy(){this.allSublayers.destroy()}readSublayers(e,t){if(!t||!e)return;let{sublayersSourceJSON:r}=this,i=(0,p.aB)(t.origin);if(i<2||(r[i]={context:t,visibleLayers:e.visibleLayers||r[i].visibleLayers,layers:e.layers||r[i].layers},i>2))return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);let{sublayers:s,origin:o}=this.createSublayersForOrigin("web-document"),n=(0,d.oY)(this);n.setDefaultOrigin(o),this._set("sublayers",new h(s)),n.setDefaultOrigin("user")}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(e){let t,r=(0,p.aB)("web-document"===e?"web-map":e),i=2,s=this.sublayersSourceJSON[2].layers,o=this.sublayersSourceJSON[2].context,n=null,a=[3,4,5].filter(e=>e<=r);for(let e of a){let t=this.sublayersSourceJSON[e];(0,c._X)(t.layers)&&(i=e,s=t.layers,o=t.context,t.visibleLayers&&(n={visibleLayers:t.visibleLayers,context:t.context}))}let l=[3,4,5].filter(e=>e>i&&e<=r),u=null;for(let e of l){let{layers:r,visibleLayers:i,context:s}=this.sublayersSourceJSON[e];r&&(u={layers:r,context:s},t??=e),i&&(n={visibleLayers:i,context:s})}let d=function(e,t){let r=[],i={};return e&&e.forEach(e=>{let s=new y.A;if(s.read(e,t),i[s.id]=s,null!=e.parentLayerId&&-1!==e.parentLayerId){let t=i[e.parentLayerId];t.sublayers||=[],t.sublayers.unshift(s)}else r.unshift(s)}),r}(s,o),m=new Map,g=new Set;if(u)for(let e of u.layers)m.set(e.id,e);if(n?.visibleLayers)for(let e of n.visibleLayers)g.add(e);return f(d,e=>{u&&e.read(m.get(e.id),u.context),n&&e.read({defaultVisibility:g.has(e.id)},n.context)}),{origin:(0,p.OL)(i),originWithPartialOverrides:t?(0,p.OL)(t):null,sublayers:new h({items:d})}}read(e,t){super.read(e,t),this.readSublayers(e,t)}_handleSublayersChange(e,t){t&&(t.forEach(e=>{e.parent=null,e.layer=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this,e.layer=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this,e.layer=this}),e.on("after-remove",({item:e})=>{e.parent=null,e.layer=null})],"sublayers-owner"),"tile"===this.type&&this.addHandles(e.on("before-changes",e=>{a.A.getLogger("esri.layers.TileLayer").error(new n.A("tilelayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{layer:this})),e.preventDefault()}),"sublayers-owner"))}};return(0,i.Cg)([(0,u.MZ)({readOnly:!0})],r.prototype,"allSublayers",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],r.prototype,"effectiveScaleRange",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],r.prototype,"effectiveVisible",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0,type:s.A.ofType(y.A)})],r.prototype,"serviceSublayers",void 0),(0,i.Cg)([(0,u.MZ)({value:null,type:h,json:{read:!1,write:{allowNull:!0,ignoreOrigin:!0}}})],r.prototype,"sublayers",void 0),(0,i.Cg)([(0,u.MZ)({readOnly:!0})],r.prototype,"sublayersSourceJSON",void 0),(0,i.Cg)([(0,u.MZ)({type:h,json:{read:{source:"tables"}}})],r.prototype,"subtables",void 0),r=(0,i.Cg)([(0,u.$K)("esri.layers.mixins.SublayersOwner")],r),r}])},28032(e,t,r){r.d(t,{A:()=>l});var i=r(32198),s=r(69540),o=r(25482),n=r(91429),a=r(56400);let l=class extends((0,s.OU)(o.o)){constructor(e){super(e),this.creatorField=null,this.creationDateField=null,this.editorField=null,this.editDateField=null,this.realm=null,this.timeZone=null}};(0,i.Cg)([(0,n.MZ)()],l.prototype,"creatorField",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"creationDateField",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"editorField",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"editDateField",void 0),(0,i.Cg)([(0,n.MZ)()],l.prototype,"realm",void 0),(0,i.Cg)([(0,n.MZ)((0,a.P6)("dateFieldsTimeReference",!0))],l.prototype,"timeZone",void 0),l=(0,i.Cg)([(0,n.$K)("esri.layers.support.EditFieldsInfo")],l)},29005(e,t,r){r.d(t,{A:()=>u});var i=r(32198),s=r(69540),o=r(66552),n=r(25482),a=r(91429);const l=new o.J({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let u=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],u.prototype,"name",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],u.prototype,"description",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:l.read,write:l.write}})],u.prototype,"drawingTool",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],u.prototype,"prototype",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],u.prototype,"thumbnail",void 0),u=(0,i.Cg)([(0,a.$K)("esri.layers.support.FeatureTemplate")],u)},33143(e,t,r){r.d(t,{A:()=>d});var i=r(32198),s=r(69540),o=r(25482),n=r(91429),a=r(8631),l=r(29005),u=r(36005),p=r(43937);let d=class extends((0,s.OU)(o.o)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){let t={};for(let r of Object.keys(e))t[r]=(0,a.r)(e[r]);return t}writeDomains(e,t){let r={};for(let t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,i.Cg)([(0,n.MZ)({json:{write:!0}})],d.prototype,"id",void 0),(0,i.Cg)([(0,n.MZ)({json:{write:!0}})],d.prototype,"name",void 0),(0,i.Cg)([(0,n.MZ)({json:{write:!0}})],d.prototype,"domains",void 0),(0,i.Cg)([(0,u.w)("domains")],d.prototype,"readDomains",null),(0,i.Cg)([(0,p.K)("domains")],d.prototype,"writeDomains",null),(0,i.Cg)([(0,n.MZ)({type:[l.A],json:{write:!0}})],d.prototype,"templates",void 0),d=(0,i.Cg)([(0,n.$K)("esri.layers.support.FeatureType")],d)},46499(e,t,r){r.d(t,{A:()=>C});var i,s,o=r(32198),n=(r(44208),r(66552)),a=r(25482),l=r(4718),u=r(90629),p=r(91429),d=r(90360),y=r(73913),c=r(32730),h=r(77548),f=r(59868),m=r(73838),g=r(33910),b=r(36005),v=r(43937);const w=new n.J({esriServerPointLabelPlacementAboveCenter:"above-center",esriServerPointLabelPlacementAboveLeft:"above-left",esriServerPointLabelPlacementAboveRight:"above-right",esriServerPointLabelPlacementBelowCenter:"below-center",esriServerPointLabelPlacementBelowLeft:"below-left",esriServerPointLabelPlacementBelowRight:"below-right",esriServerPointLabelPlacementCenterCenter:"center-center",esriServerPointLabelPlacementCenterLeft:"center-left",esriServerPointLabelPlacementCenterRight:"center-right",esriServerLinePlacementAboveAfter:"above-after",esriServerLinePlacementAboveAlong:"above-along",esriServerLinePlacementAboveBefore:"above-before",esriServerLinePlacementAboveStart:"above-start",esriServerLinePlacementAboveEnd:"above-end",esriServerLinePlacementBelowAfter:"below-after",esriServerLinePlacementBelowAlong:"below-along",esriServerLinePlacementBelowBefore:"below-before",esriServerLinePlacementBelowStart:"below-start",esriServerLinePlacementBelowEnd:"below-end",esriServerLinePlacementCenterAfter:"center-after",esriServerLinePlacementCenterAlong:"center-along",esriServerLinePlacementCenterBefore:"center-before",esriServerLinePlacementCenterStart:"center-start",esriServerLinePlacementCenterEnd:"center-end",esriServerPolygonPlacementAlwaysHorizontal:"always-horizontal"},{ignoreUnknown:!0});function S(e,t,r){return{enabled:!(0,h.TU)(r?.layer)}}function I(e){return!e||"service"!==e.origin&&"map-image"!==e.layer?.type}function x(e){return!!function(e){return"map-image"===e?.type}(e)&&!!e.capabilities?.exportMap?.supportsArcadeExpressionForLabeling}let C=class extends a.o{static{i=c.vK}static{s=this}static evaluateWhere(e,t){let r=(e,t,r)=>{switch(t){case"=":return e==r;case"<>":return e!=r;case">":return e>r;case">=":return e>=r;case"<":return e<r;case"<=":return e<=r}return!1};try{if(null==e)return!0;let i=e.split(" ");if(3===i.length)return r(t[i[0]],i[1],i[2]);if(7===i.length){let e=r(t[i[0]],i[1],i[2]),s=i[3],o=r(t[i[4]],i[5],i[6]);switch(s){case"AND":return e&&o;case"OR":return e||o}}return!1}catch{}}constructor(e){super(e),this[i]=!0,this.type="label",this.name=null,this.allowOverrun=!1,this.deconflictionStrategy="static",this.labelExpression=null,this.labelExpressionInfo=null,this.labelPlacement=null,this.offsetDistance=0,this.labelPosition="curved",this.maxScale=0,this.minScale=0,this.repeatLabel=!0,this.symbol=f.Hk,this.useCodedValues=void 0,this.where=null}readLabelExpression(e,t){let r=t.labelExpressionInfo;if(!r||!r.value&&!r.expression)return e}writeLabelExpression(e,t,r){if(this.labelExpressionInfo)if(null!=this.labelExpressionInfo.value)e=(0,c.D3)(this.labelExpressionInfo.value);else if(null!=this.labelExpressionInfo.expression){let t=(0,c.tH)(this.labelExpressionInfo.expression);t&&(e="["+t+"]")}null!=e&&(t[r]=e)}writeLabelExpressionInfo(e,t,r,i){if(null==e&&null!=this.labelExpression&&I(i))e=new y.A({expression:this.getLabelExpressionArcade()});else if(!e)return;let s=e.toJSON(i);s.expression&&(t[r]=s)}writeMaxScale(e,t){(e||this.minScale)&&(t.maxScale=e)}writeMinScale(e,t){(e||this.maxScale)&&(t.minScale=e)}get repeatLabelDistance(){return this._get("repeatLabelDistance")}set repeatLabelDistance(e){this._set("repeatLabelDistance",e)}getLabelExpression(){return(0,c.XJ)(this)}getLabelExpressionArcade(){return(0,c.BI)(this)}getLabelExpressionSingleField(){return(0,c.rU)(this)}hash(){return JSON.stringify(this)}clone(){return new s({allowOverrun:this.allowOverrun,deconflictionStrategy:this.deconflictionStrategy,labelExpression:this.labelExpression,labelExpressionInfo:(0,l.o8)(this.labelExpressionInfo),labelPosition:this.labelPosition,labelPlacement:this.labelPlacement,offsetDistance:this.offsetDistance,maxScale:this.maxScale,minScale:this.minScale,name:this.name,repeatLabel:this.repeatLabel,repeatLabelDistance:this.repeatLabelDistance,symbol:(0,l.o8)(this.symbol),where:this.where,useCodedValues:this.useCodedValues})}};(0,o.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],C.prototype,"name",void 0),(0,o.Cg)([(0,p.MZ)({type:Boolean,json:{write:!0,default:!1,origins:{"web-scene":{write:!1},"portal-item":{default:!1,write:{overridePolicy:S}}}}})],C.prototype,"allowOverrun",void 0),(0,o.Cg)([(0,p.MZ)({type:String,json:{write:!0,default:"static",origins:{"web-scene":{write:!1},"portal-item":{default:"static",write:{overridePolicy:S}}}}})],C.prototype,"deconflictionStrategy",void 0),(0,o.Cg)([(0,p.MZ)({type:String,json:{write:{overridePolicy(e,t,r){return this.labelExpressionInfo&&"service"===r?.origin&&x(r.layer)?{enabled:!1}:{allowNull:!0}}}}})],C.prototype,"labelExpression",void 0),(0,o.Cg)([(0,b.w)("labelExpression")],C.prototype,"readLabelExpression",null),(0,o.Cg)([(0,v.K)("labelExpression")],C.prototype,"writeLabelExpression",null),(0,o.Cg)([(0,p.MZ)({type:y.A,json:{write:{overridePolicy:(e,t,r)=>function(e){return I(e)||x(e?.layer)}(r)?{allowNull:!0}:{enabled:!1}}}})],C.prototype,"labelExpressionInfo",void 0),(0,o.Cg)([(0,v.K)("labelExpressionInfo")],C.prototype,"writeLabelExpressionInfo",null),(0,o.Cg)([(0,p.MZ)({type:w.apiValues,json:{type:w.jsonValues,read:w.read,write:w.write}})],C.prototype,"labelPlacement",void 0),(0,o.Cg)([(0,p.MZ)({type:Number,json:{read:!0,write:!0,default:0,origins:{"web-scene":{write:!1}}}})],C.prototype,"offsetDistance",void 0),(0,o.Cg)([(0,p.MZ)({type:["curved","parallel"],json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],C.prototype,"labelPosition",void 0),(0,o.Cg)([(0,p.MZ)({type:Number})],C.prototype,"maxScale",void 0),(0,o.Cg)([(0,v.K)("maxScale")],C.prototype,"writeMaxScale",null),(0,o.Cg)([(0,p.MZ)({type:Number})],C.prototype,"minScale",void 0),(0,o.Cg)([(0,v.K)("minScale")],C.prototype,"writeMinScale",null),(0,o.Cg)([(0,p.MZ)({type:Boolean,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:S}}}}})],C.prototype,"repeatLabel",void 0),(0,o.Cg)([(0,p.MZ)({type:Number,cast:u.cr,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:S}}}}})],C.prototype,"repeatLabelDistance",null),(0,o.Cg)([(0,p.MZ)({types:g.em,json:{types:g.em,origins:{"portal-item":{types:g.em,read:{reader:(0,d.C)({types:g.em})},default:null},"web-scene":{types:g.Rv,read:{reader:(0,d.C)({types:g.Rv})},write:m.oO,default:null}},write:m.oO,default:null}})],C.prototype,"symbol",void 0),(0,o.Cg)([(0,p.MZ)({type:Boolean,json:{write:!0}})],C.prototype,"useCodedValues",void 0),(0,o.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],C.prototype,"where",void 0),C=s=(0,o.Cg)([(0,p.$K)("esri.layers.support.LabelClass")],C)},73913(e,t,r){r.d(t,{A:()=>p});var i,s=r(32198),o=r(25482),n=r(91429),a=r(32730),l=r(36005),u=r(43937);let p=class extends o.o{static{i=this}constructor(e){super(e),this.name=null,this.expression=null,this.title=null,this.value=null}readExpression(e,t){return t.value?(0,a.mX)(t.value):e}writeExpression(e,t,r){null!=this.value&&(e=(0,a.mX)(this.value)),null!=e&&(t[r]=e)}clone(){return new i({name:this.name,expression:this.expression,title:this.title,value:this.value})}};(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],p.prototype,"name",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{write:{writerEnsuresNonNull:!0}}})],p.prototype,"expression",void 0),(0,s.Cg)([(0,l.w)("expression",["expression","value"])],p.prototype,"readExpression",null),(0,s.Cg)([(0,u.K)("expression")],p.prototype,"writeExpression",null),(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],p.prototype,"title",void 0),(0,s.Cg)([(0,n.MZ)({json:{read:!1,write:!1}})],p.prototype,"value",void 0),p=i=(0,s.Cg)([(0,n.$K)("esri.layers.support.LabelExpressionInfo")],p)},37352(e,t,r){r.d(t,{A:()=>l});var i,s=r(32198),o=r(7762),n=r(25482),a=r(91429);let l=i=class extends n.o{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new o.A}clone(){return new i({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,s.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],l.prototype,"floorField",void 0),(0,s.Cg)([(0,a.MZ)({json:{read:!1,write:!1}})],l.prototype,"viewAllMode",void 0),(0,s.Cg)([(0,a.MZ)({json:{read:!1,write:!1}})],l.prototype,"viewAllLevelIds",void 0),l=i=(0,s.Cg)([(0,a.$K)("esri.layers.support.LayerFloorInfo")],l)},91880(e,t,r){r.d(t,{A:()=>u});var i,s=r(32198),o=r(66552),n=r(25482),a=r(91429);const l=new o.J({asc:"ascending",desc:"descending"});let u=class extends n.o{static{i=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,s.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],u.prototype,"field",void 0),(0,s.Cg)([(0,a.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],u.prototype,"valueExpression",void 0),(0,s.Cg)([(0,a.MZ)({type:l.apiValues,json:{type:l.jsonValues,read:l.read,write:l.write}})],u.prototype,"order",void 0),u=i=(0,s.Cg)([(0,a.$K)("esri.layers.support.OrderByInfo")],u)},45067(e,t,r){r.d(t,{A:()=>p});var i=r(32198),s=r(69540),o=r(66552),n=r(25482),a=r(91429);const l=new o.J({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),u=new o.J({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let p=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.cardinality=null,this.catalogId=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};(0,i.Cg)([(0,a.MZ)({json:{read:l.read,write:l.write}})],p.prototype,"cardinality",void 0),(0,i.Cg)([(0,a.MZ)({json:{name:"catalogID"}})],p.prototype,"catalogId",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"composite",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"id",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"keyField",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"keyFieldInRelationshipTable",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"name",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"relatedTableId",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:!0,write:!0}})],p.prototype,"relationshipTableId",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:u.read,write:u.write}})],p.prototype,"role",void 0),p=(0,i.Cg)([(0,a.$K)("esri.layers.support.Relationship")],p)},15775(e,t,r){r.d(t,{A:()=>me});var i=r(32198),s=r(40124),o=r(56507),n=r(7762),a=r(49186),l=r(44208),u=r(4902),p=r(4718),d=r(92474),y=r(53966),c=r(25728),h=r(39516),f=r(84952),m=r(91429),g=r(78888),b=r(35666),v=r(88620),w=r(5443),S=r(16930),I=r(83960),x=r(50498),C=r(41910),A=r(60950),M=r(89808),F=r(99959);const _=Symbol("isMapImageGraphicOriginSymbol");var P;class O extends F.A{get[(P=_,A.ym)](){return this.sublayer}get[M.Q](){return this.layer}get[C.e7](){return this.sublayer}constructor(e,t){super(),this[P]=!0,this.type="map-image",this.layer=e,this.sublayer=t}get id(){return`${this.layer.id}:__${this.sublayer.id}__`}}const L=Symbol("isTileGraphicOriginSymbol");var T;class Z extends F.A{get[(T=L,A.ym)](){return this.sublayer}get[M.Q](){return this.layer}get[C.e7](){return this.sublayer}constructor(e,t){super(),this[T]=!0,this.type="tile",this.layer=e,this.sublayer=t}get id(){return`${this.layer.id}:__${this.sublayer.id}__`}}var D,j=r(64314),q=r(32756),E=r(28032),V=r(15426),R=r(33143),N=r(20437),B=r(95466),k=r(30524),$=r(46499),z=r(39383),K=r(37352),J=r(91880),Q=r(45067),G=r(6666),U=r(41214),X=r(2272),Y=r(65615),W=r(93849),H=r(29308),ee=r(54546),te=r(97552),re=r(30291),ie=r(33910),se=r(43440),oe=r(36005),ne=r(43937);function ae(e){return"esriSMS"===e?.type}function le(e,t,r){let i=r.minimumWritableOrigin||r.origin;return!!i&&e.originIdOf(t)>=(0,b.aB)(i)}function ue(e,t,r){let i=le(this,t,r);return{ignoreOrigin:!0,allowNull:i,enabled:!!r&&"map-image"===r.layer?.type&&(r.writeSublayerStructure||i)}}function pe(e,t,r){return{enabled:!!r&&"tile"===r.layer?.type&&(le(this,t,r)||this._isOverridden(t))}}function de(e,t,r){return{ignoreOrigin:!0,enabled:r&&r.writeSublayerStructure||!1}}function ye(e,t,r){return{ignoreOrigin:!0,enabled:!!r?.writeSublayerStructure&&this.originIdOf(t)>2}}function ce(e,t,r){return{ignoreOrigin:!0,enabled:!!r&&(r.writeSublayerStructure||le(this,t,r))}}let he=0;const fe=new Set(["layer","parent","loaded","loadStatus","loadError","loadWarnings"]);let me=class extends((0,c.M)((0,u.s)(d.x_))){static{D=this}constructor(e){super(e),this.attributeTableTemplate=null,this.capabilities=void 0,this.editFieldsInfo=null,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.isTable=!1,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.relationships=null,this.sourceJSON=null,this.spatialReference=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this.uniqueIdFields=null,this._lastParsedUrl=null}async load(e){return this.addResolvingPromise(this.reload(e)),this}readCapabilities(e,t){t=t.layerDefinition||t;let{attachment:r,operations:{supportsQuery:i,supportsQueryAttachments:s},query:{supportsFormatPBF:o,supportsOrderBy:n,supportsPagination:a,relativeTimeBinWindow:l},data:{supportsAttachment:u},queryRelated:p}=(0,G.S$)(t,this.url);return{attachment:{supportsOrderByFields:r?.supportsOrderByFields??!1,supportsResize:r?.supportsResize??!1,supportsTypeWildcard:r?.supportsTypeWildcard??!1},exportMap:{supportsModification:!!t.canModifyLayer},operations:{supportsQuery:i,supportsQueryAttachments:s},data:{supportsAttachment:u},query:{relativeTimeBinWindow:l,supportsFormatPBF:o,supportsOrderBy:n,supportsPagination:a},queryRelated:p}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get effectiveScaleRange(){let e=this._get("effectiveScaleRange"),{maxScale:t,minScale:r,parent:i}=this,s={minScale:r,maxScale:t};return void 0!==i?.effectiveScaleRange&&(0,I.RH)(s,i.effectiveScaleRange),e&&e.minScale===s.minScale&&e.maxScale===s.maxScale?e:s}get effectiveUniqueIdFields(){return this.uniqueIdFields?[...this.uniqueIdFields]:this.objectIdField?[this.objectIdField]:[]}get effectiveVisible(){return this.visible&&(this.parent?.effectiveVisible??!0)}readMaxScaleRange(e,t){return{minScale:(t=t.layerDefinition||t).minScale??0,maxScale:t.maxScale??0}}get fieldsIndex(){return new B.A(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,t){if((t=t.layerDefinition||t).globalIdField)return t.globalIdField;if(t.fields)for(let e of t.fields)if("esriFieldTypeGlobalID"===e.type)return e.name}get graphicOrigin(){if(!this.layer)return null;switch(this.layer.type){case"tile":return new Z(this.layer,this);case"map-image":return new O(this.layer,this)}}get id(){return this._get("id")??he++}set id(e){if(this._get("id")!==e){if(!1===this.layer?.capabilities?.exportMap?.supportsDynamicLayers)return void this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'");this._set("id",e)}}readIsTable(e,t){return"Table"===t.type}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,t,r,i){e&&e.length&&(t.layerDefinition={drawingInfo:{labelingInfo:e.map(e=>e.write({},i))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers?.forEach(t=>t.layer=e)}set listMode(e){this._set("listMode",e)}get loaded(){return super.loaded}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,t){return t.minScale||t.layerDefinition?.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,t){return t.maxScale||t.layerDefinition?.maxScale||0}readObjectIdFieldFromService(e,t){return(t=t.layerDefinition||t).objectIdField?t.objectIdField:t.fields?.find(e=>"esriFieldTypeOID"===e.type)?.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,t){let{layerDefinition:r}=t;return 1-.01*(r?.transparency??r?.drawingInfo?.transparency??0)}writeOpacity(e,t,r,i){t.layerDefinition={drawingInfo:{transparency:100-100*e}}}set orderBy(e){this._setAndNotifyLayer("orderBy",e)}writeParent(e,t){t.parentLayerId=this.parent&&this.parent!==this.layer?(0,g.Vr)(this.parent.id):-1}get queryTask(){if(!this.layer)return null;let{capabilities:e,fieldsIndex:t,layer:r,uniqueIdFields:i,url:s}=this,{spatialReference:o}=r,n="gdbVersion"in r?r.gdbVersion:void 0,a=(0,l.A)("featurelayer-pbf")&&e?.query.supportsFormatPBF,u=e?.operations?.supportsQueryAttachments??!1,p=e?.query?.relativeTimeBinWindow??0;return new j.A({fieldsIndex:t,gdbVersion:n,pbfSupported:a,queryAttachmentsSupported:u,relativeTimeBinWindow:p,sourceSpatialReference:o,uniqueIdFields:i,url:s})}set renderer(e){if((0,k.yp)(e,this.fieldsIndex),e)for(let t of e.symbols)if((0,ie.wk)(t)){y.A.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new W.A({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}get sublayers(){return this._get("sublayers")}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return(0,g.dp)(n.A.ofType(D),e)}writeSublayers(e,t,r){this.sublayers?.length&&(t[r]=this.sublayers.map(e=>e.id).toArray().reverse())}readTitle(e,t){return t.layerDefinition?.name??t.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();let e=t.fields.find(e=>e.name.toLowerCase()===r);e&&(r=e.name)}return r}readUniqueIdFields(e,t){return t.layerDefinition?.uniqueIdInfo?.OIDFieldContainsHashValue?t.layerDefinition.uniqueIdInfo.fields:null}get url(){let e=this.layer?.parsedUrl??this._lastParsedUrl,t=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===t?.type)return`${e.path}/${t.mapLayerId}`;let r={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${(0,f.x0)(r)}`}set url(e){this._overrideIfSome("url",e)}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,t,r,i){t[r]=this.getAtOrigin("defaultVisibility","service")||e}clone(){let{store:e}=(0,v.oY)(this),t=new D;return(0,v.oY)(t).store=e.clone(fe),this.commitProperty("url"),t._lastParsedUrl=this._lastParsedUrl,t}createPopupTemplate(e){return(0,re.tn)(this,e)}createQuery(){return new te.A({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.sublayers)return null;let e,t=(await Promise.all([r.e(8673),r.e(9953),r.e(1017),r.e(9789),r.e(5087),r.e(8589),r.e(1560)]).then(()=>r(18589))).default,{layer:i,url:s}=this;if(s&&this.originIdOf("url")>2)e=new t({url:s});else{if(!i?.parsedUrl)throw new a.A("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{let r=i.parsedUrl;e=new t({url:r.path}),r&&this.source&&("map-layer"===this.source.type?e.layerId=this.source.mapLayerId:e.dynamicDataSource=this.source)}}return null!=i?.refreshInterval&&(e.refreshInterval=i.refreshInterval),this.definitionExpression&&(e.definitionExpression=this.definitionExpression),this.floorInfo&&(e.floorInfo=(0,p.o8)(this.floorInfo)),this.originIdOf("labelingInfo")>2&&(e.labelingInfo=(0,p.o8)(this.labelingInfo)),this.originIdOf("labelsVisible")>0&&(e.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>0&&(e.legendEnabled=this.legendEnabled),this.originIdOf("visible")>0&&(e.visible=this.visible),this.originIdOf("minScale")>0&&(e.minScale=this.minScale),this.originIdOf("maxScale")>0&&(e.maxScale=this.maxScale),this.originIdOf("opacity")>0&&(e.opacity=this.opacity),this.originIdOf("popupTemplate")>0&&(e.popupTemplate=(0,p.o8)(this.popupTemplate)),this.originIdOf("renderer")>2&&(e.renderer=(0,p.o8)(this.renderer)),"data-layer"===this.source?.type&&(e.dynamicDataSource=this.source.clone()),this.originIdOf("title")>0&&(e.title=this.title),"map-image"===i?.type&&i.originIdOf("customParameters")>0&&(e.customParameters=i.customParameters),"tile"===i?.type&&i.originIdOf("customParameters")>0&&(e.customParameters=i.customParameters),e}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){return(0,V.xd)(this.types,this.typeIdField,e)}getFieldDomain(e,t){let r=t?.feature,i=this.getFeatureType(r);if(i){let t=i.domains&&i.domains[e];if(t&&"inherited"!==t.type)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){await this.load();let r=ee.A.from(e),i=this.capabilities;if(!i?.data?.supportsAttachment)throw new a.A("queryAttachments:not-supported","this layer doesn't support attachments");let{attachmentTypes:s,objectIds:o,globalIds:n,num:l,size:u,start:p,where:d}=r;if(!i?.operations?.supportsQueryAttachments&&(s?.length>0||n?.length>0||u?.length>0||l||p||d))throw new a.A("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",r);if(!(o?.length||n?.length||d))throw new a.A("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",r);return!i?.attachment?.supportsOrderByFields&&r.orderByFields?.length&&(r=r.clone(),r.orderByFields=null),this.queryTask.executeAttachmentQuery(r,t)}async queryFeatureCount(e=this.createQuery(),t){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new a.A("queryFeatureCount:not-supported","this layer doesn't support queries.");if(!this.url)throw new a.A("queryFeatureCount:not-supported","this layer has no url.");let r=this.layer?.apiKey;return await this.queryTask.executeForCount(e,{...t,query:{...this.layer?.customParameters,token:r}})}async queryFeatures(e=this.createQuery(),t){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new a.A("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new a.A("queryFeatures:not-supported","this layer has no url.");let r=await this.queryTask.execute(e,{...t,query:{...this.layer?.customParameters,token:this.layer?.apiKey}});if(r?.features){let e=this.graphicOrigin;for(let t of r.features)t.sourceLayer=this,t.origin=e}return r}async queryObjectIds(e=this.createQuery(),t){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new a.A("queryObjectIds:not-supported","this layer doesn't support queries.");if(!this.url)throw new a.A("queryObjectIds:not-supported","this layer has no url.");let r=this.layer?.apiKey;return await this.queryTask.executeForIds(e,{...t,query:{...this.layer?.customParameters,token:r}})}async queryRelatedFeatures(e,t){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new a.A("queryRelatedFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new a.A("queryRelatedFeatures:not-supported","this layer has no url.");let r=this.layer?.apiKey;return await this.queryTask.executeRelationshipQuery(e,{...t,query:{...this.layer?.customParameters,token:r}})}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.capabilities.operations.supportsQuery)throw new a.A("queryRelatedFeaturesCount:not-supported","this layer doesn't support queries.");if(!this.capabilities.queryRelated.supportsCount)throw new a.A("queryRelatedFeaturesCount:not-supported","this layer doesn't support query related counts.");if(!this.url)throw new a.A("queryRelatedFeaturesCount:not-supported","this layer has no url.");let r=this.layer?.apiKey;return await this.queryTask.executeRelationshipQueryForCount(e,{...t,query:{...this.layer?.customParameters,token:r}})}async reload(e){if("not-loaded"===this.loadStatus)return this.load(e).then(()=>{});let{layer:t,url:r}=this;if(!t&&!r)throw new a.A("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let i=t?await t.fetchSublayerInfo(this,e):(await(0,o.A)(r,{query:{f:"json"},...e})).data;i&&(this.sourceJSON={...this.sourceJSON,...i},this.read({layerDefinition:i},{origin:"service",layer:t,url:(0,X.Dl)(r)}))}toExportImageJSON(e){let t={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},r=(0,h.mA)(e,this.definitionExpression);null!=r&&(t.definitionExpression=r);let i=["renderer","labelingInfo","opacity","labelsVisible"].reduce((e,t)=>(e[t]=this.originIdOf(t),e),{});if(Object.keys(i).some(e=>i[e]>2)){let e=t.drawingInfo={};if(i.renderer>2&&(e.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>2&&(e.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>2)if(this.labelingInfo){!this.loaded&&this.labelingInfo?.some(e=>!e.labelPlacement)&&y.A.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let t=this.labelingInfo;null!=this.geometryType&&(t=(0,z.z)(this.labelingInfo,x.gy.toJSON(this.geometryType))),e.showLabels=!0,e.labelingInfo=t.filter(e=>e.labelPlacement).map(e=>e.toJSON({origin:"service",layer:this.layer}))}else e.showLabels=!1;i.opacity>2&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return(this.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1)&&this.originIdOf("orderBy")>2&&(t.orderBy=this.orderBy?.map(e=>e.toJSON())??null),t}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,e=>{e.color||("esriSMSX"===e.style||"esriSMSCross"===e.style)&&(e.color=e.outline?.color?e.outline.color:[0,0,0,0])})}_forEachSimpleMarkerSymbols(e,t){if(e){let r=("uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:null)??[];for(let e of r)ae(e.symbol)&&t(e.symbol);"symbol"in e&&ae(e.symbol)&&t(e.symbol),"defaultSymbol"in e&&ae(e.defaultSymbol)&&t(e.defaultSymbol)}}_setAndNotifyLayer(e,t){let r,i,s=this.layer,o=this._get(e);switch(e){case"definitionExpression":case"floorInfo":r="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":r="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":r="supportsDynamicLayers",i="supportsModification";break;case"orderBy":r="supportsSublayerOrderBy",i="supportsModification"}let n=(0,v.oY)(this).getDefaultOrigin();if("service"!==n){if(r&&!1===this.layer?.capabilities?.exportMap?.[r])return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${r}'`);if(i&&!1===this.capabilities?.exportMap[i])return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${i}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,t),"service"!==n&&o!==t&&s?.emit&&s.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,t){t&&(t.forEach(e=>{e.parent=null,e.layer=null}),this.removeAllHandles()),e&&(e.forEach(e=>{e.parent=this,e.layer=this.layer}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this,e.layer=this.layer}),e.on("after-remove",({item:e})=>{e.parent=null,e.layer=null}),e.on("before-changes",e=>{(this.layer?.capabilities?.exportMap?.supportsSublayersChanges??!0)||(y.A.getLogger(this).error(new a.A("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())})]))}_logLockedError(e,t){let{layer:r,declaredClass:i}=this;y.A.getLogger(i).error(new a.A("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${r?.id}'`,{reason:t,sublayer:this,layer:r}))}_getLayerDomain(e){return this.fieldsIndex.get(e)?.domain??null}static{this.test={isMapImageLayerOverridePolicy:e=>e===ye||e===de||e===ue,isTileImageLayerOverridePolicy:e=>e===pe}}};(0,i.Cg)([(0,m.MZ)({type:se.A,json:{name:"attributeTableInfo",write:{overridePolicy:ue},origins:{"web-scene":{write:!1}}}})],me.prototype,"attributeTableTemplate",void 0),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"capabilities",void 0),(0,i.Cg)([(0,oe.w)("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],me.prototype,"readCapabilities",null),(0,i.Cg)([(0,m.MZ)()],me.prototype,"defaultPopupTemplate",null),(0,i.Cg)([(0,m.MZ)({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:ue}}})],me.prototype,"definitionExpression",null),(0,i.Cg)([(0,m.MZ)({readOnly:!0,type:E.A,json:{origins:{service:{read:{source:"layerDefinition.editFieldsInfo"}}}}})],me.prototype,"editFieldsInfo",void 0),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"effectiveScaleRange",null),(0,i.Cg)([(0,m.MZ)({readOnly:!0,type:[String]})],me.prototype,"effectiveUniqueIdFields",null),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"effectiveVisible",null),(0,i.Cg)([(0,oe.w)("service","maxScaleRange",["minScale","maxScale"])],me.prototype,"readMaxScaleRange",null),(0,i.Cg)([(0,m.MZ)({type:[N.A],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],me.prototype,"fields",void 0),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"fieldsIndex",null),(0,i.Cg)([(0,m.MZ)({type:K.A,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:ue},origins:{"web-scene":{read:!1,write:!1}}}})],me.prototype,"floorInfo",null),(0,i.Cg)([(0,m.MZ)({type:w.A,json:{read:{source:"layerDefinition.extent"}}})],me.prototype,"fullExtent",void 0),(0,i.Cg)([(0,m.MZ)({type:x.gy.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:x.gy.read}}}}})],me.prototype,"geometryType",void 0),(0,i.Cg)([(0,m.MZ)({type:String})],me.prototype,"globalIdField",void 0),(0,i.Cg)([(0,oe.w)("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],me.prototype,"readGlobalIdFieldFromService",null),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"graphicOrigin",null),(0,i.Cg)([(0,m.MZ)({type:g.jz,json:{write:{ignoreOrigin:!0}}})],me.prototype,"id",null),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"isTable",void 0),(0,i.Cg)([(0,oe.w)("service","isTable",["type"])],me.prototype,"readIsTable",null),(0,i.Cg)([(0,m.MZ)({value:null,type:[$.A],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:ye}}})],me.prototype,"labelingInfo",null),(0,i.Cg)([(0,ne.K)("labelingInfo")],me.prototype,"writeLabelingInfo",null),(0,i.Cg)([(0,m.MZ)({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:de}}})],me.prototype,"labelsVisible",null),(0,i.Cg)([(0,m.MZ)({value:null})],me.prototype,"layer",null),(0,i.Cg)([(0,m.MZ)({type:String,json:{write:{overridePolicy:pe}}})],me.prototype,"layerItemId",void 0),(0,i.Cg)([(0,m.MZ)({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:ce}}})],me.prototype,"legendEnabled",void 0),(0,i.Cg)([(0,m.MZ)({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],me.prototype,"listMode",null),(0,i.Cg)([(0,m.MZ)({type:Number,value:0,json:{write:{overridePolicy:de}}})],me.prototype,"minScale",null),(0,i.Cg)([(0,oe.w)("minScale",["minScale","layerDefinition.minScale"])],me.prototype,"readMinScale",null),(0,i.Cg)([(0,m.MZ)({type:Number,value:0,json:{write:{overridePolicy:de}}})],me.prototype,"maxScale",null),(0,i.Cg)([(0,oe.w)("maxScale",["maxScale","layerDefinition.maxScale"])],me.prototype,"readMaxScale",null),(0,i.Cg)([(0,m.MZ)()],me.prototype,"objectIdField",void 0),(0,i.Cg)([(0,oe.w)("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],me.prototype,"readObjectIdFieldFromService",null),(0,i.Cg)([(0,m.MZ)({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:de}}})],me.prototype,"opacity",null),(0,i.Cg)([(0,oe.w)("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],me.prototype,"readOpacity",null),(0,i.Cg)([(0,ne.K)("opacity")],me.prototype,"writeOpacity",null),(0,i.Cg)([(0,m.MZ)({value:null,type:[J.A],json:{name:"layerDefinition.orderBy",read:{reader:q.Rr},write:{overridePolicy:ue},origins:{"web-scene":{read:!1,write:!1}}}})],me.prototype,"orderBy",null),(0,i.Cg)([(0,m.MZ)({json:{type:g.jz,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:de}}})],me.prototype,"parent",void 0),(0,i.Cg)([(0,ne.K)("parent")],me.prototype,"writeParent",null),(0,i.Cg)([(0,m.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy:ce,writer(e,t,r){t[r]=!e}}}})],me.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,m.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:ce}}})],me.prototype,"popupTemplate",void 0),(0,i.Cg)([(0,m.MZ)({readOnly:!0})],me.prototype,"queryTask",null),(0,i.Cg)([(0,m.MZ)({type:[Q.A],readOnly:!0,json:{origins:{service:{read:{source:"layerDefinition.relationships"}}}}})],me.prototype,"relationships",void 0),(0,i.Cg)([(0,m.MZ)({types:U.Hg,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:ye},origins:{"web-scene":{types:U.XJ,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:ye}}}}})],me.prototype,"renderer",null),(0,i.Cg)([(0,m.MZ)({types:{key:"type",base:null,typeMap:{"data-layer":Y.A,"map-layer":W.A,"workspace-layer":H.A}},cast(e){if(e){if("mapLayerId"in e)return(0,g.PZ)(W.A,e);if("dataSource"in e)return(0,g.PZ)(Y.A,e);if("workspaceId"in e&&"layerId"in e)return(0,g.PZ)(H.A,e)}return e},json:{name:"layerDefinition.source",types:{key:"type",base:null,typeMap:{"data-layer":Y.A,"map-layer":W.A}},write:{overridePolicy:de}}})],me.prototype,"source",null),(0,i.Cg)([(0,m.MZ)()],me.prototype,"sourceJSON",void 0),(0,i.Cg)([(0,m.MZ)({type:S.A,json:{origins:{service:{read:{source:"layerDefinition.extent.spatialReference"}}}}})],me.prototype,"spatialReference",void 0),(0,i.Cg)([(0,m.MZ)({value:null,json:{type:[g.jz],write:{target:"subLayerIds",allowNull:!0,overridePolicy:de}}})],me.prototype,"sublayers",null),(0,i.Cg)([(0,m.wg)("sublayers")],me.prototype,"castSublayers",null),(0,i.Cg)([(0,ne.K)("sublayers")],me.prototype,"writeSublayers",null),(0,i.Cg)([(0,m.MZ)({type:String,json:{name:"name",write:{overridePolicy:ce}}})],me.prototype,"title",void 0),(0,i.Cg)([(0,oe.w)("service","title",["name","layerDefinition.name"])],me.prototype,"readTitle",null),(0,i.Cg)([(0,m.MZ)({type:String})],me.prototype,"typeIdField",void 0),(0,i.Cg)([(0,m.MZ)({json:{read:!1},readOnly:!0,value:"sublayer"})],me.prototype,"type",void 0),(0,i.Cg)([(0,oe.w)("typeIdField",["layerDefinition.typeIdField"])],me.prototype,"readTypeIdField",null),(0,i.Cg)([(0,m.MZ)({type:[R.A],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],me.prototype,"types",void 0),(0,i.Cg)([(0,m.MZ)({type:[String],readOnly:!0})],me.prototype,"uniqueIdFields",void 0),(0,i.Cg)([(0,oe.w)("service","uniqueIdFields",["layerDefinition.uniqueIdInfo.OIDFieldContainsHashValue","layerDefinition.uniqueIdInfo.fields"])],me.prototype,"readUniqueIdFields",null),(0,i.Cg)([(0,m.MZ)({type:String,json:{name:"layerUrl",write:{overridePolicy:pe}}})],me.prototype,"url",null),(0,i.Cg)([(0,m.MZ)({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:de}}})],me.prototype,"visible",null),(0,i.Cg)([(0,ne.K)("visible")],me.prototype,"writeVisible",null),me=D=(0,i.Cg)([(0,m.$K)("esri.layers.support.Sublayer")],me)},33446(e,t,r){r.d(t,{Cp:()=>n,mn:()=>o});var i=r(49186),s=r(17676);async function o(e,t,r){let o;try{o=await a(e,r)}catch(e){throw new i.A("request:server",`Unable to load ${t}`,{url:t,error:e})}return(0,s.Te)(r),o}async function n(e,t,r,o,n){let l;try{l=await a(e,n)}catch(e){throw new i.A("request:server",`Unable to load tile ${t}/${r}/${o}`,{error:e,level:t,row:r,col:o})}return(0,s.Te)(n),l}async function a(e,t){let r=await createImageBitmap(e,{imageOrientation:t?.imageOrientation??"none"}),i=t?.type??(e instanceof Blob?e.type.startsWith("image/")?e.type:t?.allowDeriveTypeFromData?await async function(e){return e.byteLength<2?"unknown":137===e[0]&&80===e[1]?"image/png":71===e[0]&&73===e[1]?"image/gif":66===e[0]&&77===e[1]?"image/bmp":255===e[0]&&216===e[1]?"image/jpeg":"unknown"}(await e.bytes()):void 0:void 0);return new l(r,i)}class l{constructor(e,t){this.bitmap=e,this.type=t}get isOpaque(){return"image/jpeg"===this.type}}},39383(e,t,r){r.d(t,{w:()=>l,z:()=>d});var i=r(49186),s=r(53966),o=r(46499);const n=()=>s.A.getLogger("esri.layers.support.labelingInfo"),a=/\[([^[\]]+)\]/gi;function l(e,t,r){return e?e.map(e=>{let i=new o.A;if(i.read(e,r),i.labelExpression){let e=t.fields||t.layerDefinition?.fields||this.fields;i.labelExpression=i.labelExpression.replaceAll(a,(t,r)=>`[${function(e,t){if(!t)return e;let r=e.toLowerCase();for(let e=0;e<t.length;e++){let i=t[e].name;if(i.toLowerCase()===r)return i}return e}(r,e)}]`)}return i}):null}const u=["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],p={esriGeometryPoint:u,esriGeometryMultiPatch:["always-horizontal"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along","above-along","below-along"],esriGeometryMultipoint:u,esriGeometryEnvelope:null};function d(e,t){let r=[];for(let s of e){let e=s.labelPlacement,o=p[t];if(!s.symbol)return n().warn("No ILabelClass symbol specified."),[];if(!o)return n().error(new i.A("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${t}' is not supported`)),[];if(o.includes(e))r.push(s);else{let i=o[0];e&&n().warn(`Found invalid label placement type ${e} for ${t}. Defaulting to ${i}`);let a=s.clone();a.labelPlacement=i,r.push(a)}}return r}},63389(e,t,r){function i(e,t,r){return!(t.flatten(({sublayers:e})=>e).length===e.length&&!e.some(e=>e.originIdOf("minScale")>r||e.originIdOf("maxScale")>r||e.originIdOf("renderer")>r||e.originIdOf("labelingInfo")>r||e.originIdOf("opacity")>r||e.originIdOf("labelsVisible")>r||e.originIdOf("source")>r)&&o(e,t))}function s(e,t,r){return!!e.some(e=>{let t=e.source,i=!t||"map-layer"===t.type&&t.mapLayerId===e.id&&(null==t.gdbVersion||t.gdbVersion===r);e.commitProperty("renderer"),e.commitProperty("labelingInfo"),e.commitProperty("opacity"),e.commitProperty("labelsVisible"),e.commitProperty("orderBy");let s=e.layer?.capabilities?.exportMap?.supportsSublayerOrderBy??!1;return!i||e.originIdOf("renderer")>2||e.originIdOf("labelingInfo")>2||e.originIdOf("opacity")>2||e.originIdOf("labelsVisible")>2||s&&e.originIdOf("orderBy")>2})||!o(e,t)}function o(e,t){if(!e?.length||null==t)return!0;let r=t.slice().reverse().flatten(({sublayers:e})=>e&&e.toArray().reverse()).map(e=>e.id).toArray();if(e.length>r.length)return!1;let i=0,s=r.length;for(let{id:t}of e){for(;i<s&&r[i]!==t;)i++;if(i>=s)return!1}return!0}function n(e){return!!e&&e.some(e=>null!=e.minScale||null!=e.layerDefinition?.minScale)}r.d(t,{Sk:()=>s,Zx:()=>i,_X:()=>n})},73681(e,t,r){r.d(t,{n:()=>l});var i=r(49186),s=r(53966),o=r(46140),n=r(95466),a=r(55674);class l{static async from(e,t,r){let n=e.dictionary_version?o.A.parse(e.dictionary_version):null,p=new Set(e.itemsNames),d={};if(t)for(let e in t)d[e]=t[e];if(e.authoringInfo.configuration)for(let t of e.authoringInfo.configuration)d.hasOwnProperty(t.name)||(d[t.name]=t.value);let y=new Set(e.authoringInfo.symbol);for(let e of Object.keys(r))y.delete(e);y.size&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:y});let c=await(0,a.xR)(e.expression,null,d);if(!c)throw new i.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");let h=!n||!n.greaterEqual(4,0);h&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:n});let f=new u(r,h);return new l(h,p,c,f)}constructor(e,t,r,i){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=r,this._reader=i}get itemNames(){return this._itemNames}evaluate(e,t,r,i){try{return this._reader.bind(e,r,i),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("arcade: dictionary script evaluation failed",{error:e})}return null}createDictionaryFieldsIndex(e){if(!this._requiresFieldCoercionToString)return new n.A(e);let t=e.map(e=>({...e,type:"esriFieldTypeString"}));return new n.A(t)}}class u extends a.Gj{constructor(e,t){super(),this._fieldMap=e,this._requiresFieldCoercionToString=t}_getField(e){let t=this._fieldMap[e]??e;return this._boundSchema.fieldsIndex.get(t)}field(e){if(!this._requiresFieldCoercionToString)return super.field(e,!1);let t=this._getField(e);return null==t||null==this._boundTarget.attributes[t.name]?"":""+this._boundTarget.attributes[t.name]}}},20615(e,t,r){r.d(t,{I:()=>n});var i=r(2272),s=r(80893),o=r(97552);function n(e,t,r,n){return(0,s.gW)((0,i.Dl)(e),o.A.from(t),r,n)}},74910(e,t,r){r.d(t,{L:()=>a});var i=r(5443),s=r(2272),o=r(80893),n=r(97552);async function a(e,t,r,a){let l=(0,s.Dl)(e),u=await(0,o.Jf)(l,n.A.from(t),{...r},a),p=u.extent;return!p||isNaN(p.xmin)||isNaN(p.ymin)||isNaN(p.xmax)||isNaN(p.ymax)?{count:u.count,extent:null}:{count:u.count,extent:i.A.fromJSON(p)}}},78286(e,t,r){r.d(t,{V:()=>n});var i=r(2272),s=r(80893),o=r(97552);async function n(e,t,r,n){let a=(0,i.Dl)(e),l=await(0,s.Pk)(a,o.A.from(t),r,n);return l.objectIds??function(e){if(e)return function(e){return!Array.isArray(e[0])}(e)?e:e.map(e=>JSON.stringify(e))}(l.uniqueIds)??[]}},99199(e,t,r){r.d(t,{e:()=>l,s:()=>a});var i=r(2272),s=r(80893),o=r(22671),n=r(97552);async function a(e,t,r,i){let s=await l(e,t,r,i);return o.A.fromJSON(s)}function l(e,t,r,o){let a=(0,i.Dl)(e),l={...r},u=n.A.from(t);return(0,s.eW)(a,u,u.sourceSpatialReference,l,o)}},63746(e,t,r){function i(e){return class{constructor(){for(let t of e)this[t]=null}}}function s(e,t=1){let{transform:r,hasZ:i,hasM:s}=e;if(null==r)return i&&1!==t?e=>{e[2]*=t}:null;let[o,n]=function(e,t,r,i){let{scale:s,translate:o,originPosition:n}=e;return"upperLeft"===n&&(s=s.map((e,t)=>1===t?-e:e)),t&&(s=s.map((e,t)=>2===t?e*i:e),o=o.map((e,t)=>2===t?e*i:e)),!t&&r&&(s=s.filter((e,t)=>2!==t),o=o.filter((e,t)=>2!==t)),[s,o]}(r,i,s,t),a=e.hasZ?3:2;return e=>{for(let t=0;t<e.length&&(t!==a||0!==e[t]);++t)e[t]=e[t]*o[t]+n[t]}}r.d(t,{M:()=>s,_:()=>i})},41366(e,t,r){var i=r(32198),s=r(66552),o=r(53966),n=r(91429),a=r(93223);const l=(0,s.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),u="percent-of-total",p="field";r.d(t,["K",0,e=>{let t=e,r=class extends t{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType"),t=!!this.normalizationField,r=null!=this.normalizationTotal;return t||r?(e=t&&p||r&&u||null,t&&r&&o.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):(e===p||e===u)&&(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,i.Cg)([(0,n.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],r.prototype,"normalizationField",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],r.prototype,"normalizationMaxValue",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],r.prototype,"normalizationMinValue",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],r.prototype,"normalizationTotal",void 0),(0,i.Cg)([(0,a.e)(l,{name:"parameters.normalizationType"})],r.prototype,"normalizationType",null),r=(0,i.Cg)([(0,n.$K)("esri.rest.support.NormalizationBinParametersMixin")],r),r},"Q",0,l])},2991(e,t,r){r.d(t,{G9:()=>u,RZ:()=>l});var i=r(39516);const s="=",o=">=",n="<=";function a(e,t,r,s){let o=s.get(e)?.type,n=s.getTimeZone(e);return`${(0,i.iA)(e)} ${t} ${(0,i.YG)(r,{type:"date"},{type:o,timeZone:n})}`}function l(e,t,r,l){if(!t||!r)return;let{startField:u,endField:p}=t,{start:d,end:y}=e;if(!d&&!y||!u&&!p)return;let c=u??p,h=p??u;if(c&&h){if(d&&y){if(d.getTime()===y.getTime())return(0,i.mA)(l,a(c,s,d,r));if(!u||!p){let e=a(c,o,d,r),t=a(c,n,y,r);return(0,i.mA)(l,(0,i.mA)(e,t))}let e=a(u,o,d,r),t=a(p,n,y,r);return(0,i.mA)(l,(0,i.mA)(e,t))}if(d)return(0,i.mA)(l,a(c,o,d,r));if(y)return(0,i.mA)(l,a(h,n,y,r))}}function u(e){let{start:t,end:r}=e;if(t||r){if(!t&&r)return`null,${r.getTime()}`;if(!r&&t)return`${t.getTime()},null`;if(r&&t)return t.getTime()===r.getTime()?`${t.getTime()}`:`${t.getTime()},${r.getTime()}`}}},93470(e,t,r){const i=[252,146,31,255],s={type:"esriSMS",style:"esriSMSCircle",size:6,color:i,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},o={type:"esriSLS",style:"esriSLSSolid",width:.75,color:i};r.d(t,["Cb",0,s,"HW",0,{type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},"JR",0,[153,153,153,255],"JZ",0,{type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},"WR",0,{type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},"b6",0,{type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null},"fT",0,i,"nC",0,{type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},"yM",0,o])}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1137],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...s){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(s,r)||(i=e.apply(this,s),t=this,r=s,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{Qf:()=>l,Qh:()=>s,lM:()=>a});var r=i(34275);function a(e){if(!e)return 0;let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return l(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return o(e,8);let i=f;for(let r=0;r<t;r++)i+=n(e[r]);return i}(e);let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i]));return t}function n(e,t=!0){switch(typeof e){case"object":return t?s(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function l(...e){return e.reduce((e,t)=>e+(t?(0,r.iu)(t)?t.byteLength+h:Array.isArray(t)?o(t,16):0:0),0)}function o(e,t){return f+e.length*t}const u=32,f=16,h=145},5359(e,t,i){i.d(t,{Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}i.d(t,["H",0,r])},11137(e,t,i){i.r(t),i.d(t,{default:()=>rt});var r,a=i(32198),s=i(40124),n=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),p=i(91429),d=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),C=i(63074),S=i(69208),A=i(34287),T=i(8303),R=i(72545),_=i(56551),O=i(54310),M=i(25036),F=i(82935),P=i(82806),k=i(7548),D=i(23636),N=i(49859),L=i(68197),B=i(5443),E=i(16930),J=i(73444),z=i(94778),H=i(14140);function U(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function j(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Z(e){let t=(0,J.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function $(){return Math.round(255*Math.random())}function q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:s,categoryEncoding:n,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Z(a)),s&&(t[e].unit=s.label?Z(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})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Z(e.label):null,e.preferredColor)){let t=L.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=$(),e.Green=$(),e.Blue=$())}));let a={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}))};r&&a.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=a}}return t}function V(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,z.X1)(t,i)}function G(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),s=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),n=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);n+=s[l]*(i%t[a]),i=Math.floor(i/t[a])}return n}var W=i(4366),X=i(47520),K=i(51927),Y=i(45617),Q=i(87186);let ee=class extends N.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,s=this._pixelBlockTiles.get(a);if(s)return s;if(!this.source)return null;let{rasterInfo:n}=this,[l,o]=n.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let s=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return s&&this._pixelBlockTiles.set(a,s),s}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let p={pixelBlock:c,useBilinear:"thematic"!==n.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(p,r):(0,X.J$)(p)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:s,nativeExtent:n,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:p}=f??t.imageInfo,d=t.extent??new B.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new E.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:d.width/h,y:d.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:p,extent:d,nativeExtent:n,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:d.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,s="thematic"!==r.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:s},i):Promise.resolve((0,X.lD)(e,t,a,s)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),c=await(0,h.Lx)([n,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let s=a.dimensions.map(e=>new Y.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,W.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,K.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends N.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,K.eH)(i[0]),o=s?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:n,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.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 l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.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:a,type:s,values:n}=r[e];if(!("ndarray"===s.toLowerCase()&&n?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!U(t[t.length-1])||!j(t[t.length-2]))throw new l.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:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];U(o)?s=e:j(o)&&(n=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,s=(t-e)/(i-1);r.push([e-.5*s,t+.5*s]),a.push(s);for(let t=0;t<i;t++)f.push(e+s*t)}l.push({name:o,values:f,extent:[f[0],f[f.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:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[s])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new E.A({wkid:h}),[p,d]=r[s],[m,g]=r[n],y=new B.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[s]),height:Math.round(y.height/a[n]),extent:y,dimensions:l}}(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];a?.length&&l.push({name:t,dimensions:a})}let o=q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<n.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=s[n[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),p=u.slice(0,-2),d="float"===l?"f32":V(r),m=t*i,g=r.length/m;for(let s=0;s<g;s++){let n=H.A.createEmptyBand(d,m),l=new Uint8Array(m).fill(255),o=!1,u=s*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||a?.length){let e=new H.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:d});e.updateStatistics(),a?.length?f[G(c,p,s)+h]=e:f.push(e)}else{let e=f[s];e.pixels.push(n),o?e.mask&&=H.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:n}}(t)}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var se=i(4576),ne=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new E.A({wkid:t});if(e=String(e).trim(),(0,ne.jp)(e))return new E.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 r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),s=a>-1?a:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(n);let o=t?new E.A({wkid:t}):new E.A({wkt:n}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new E.A({wkt:e}):new E.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(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,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),s=(0,le.Ui)(t,"CoeffY/Double"),n=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,s),u=ue(n,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,s=(0,le.v7)(e,"NoDataValue"),n=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(n,"HistMin"),o=(0,le.v7)(n,"HistMax"),u=(0,le.v7)(n,"BucketCount"),f=(0,le.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,le.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":r=s;break;case"STATISTICS_STDDEV":a=s}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}: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(se.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(se.Ru):null),t}var pe=i(85951),de=i(96381);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends N.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,s="immediate"===a||"jpg"!==r;if(s){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,pe.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:n,ioConfig:o}=this,u=new te({preGenerateTiles:s,rasterJobHandler:n,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:s}=await this._fetchAuxiliaryData(t),n=!i;n&&(i=new E.A({wkid:3857})),a?.length&&null==r&&(r=(0,K.Pg)(a));let{width:l,height:o}=e,u=new B.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=s?s.forwardTransform(u):u,h=!0;if(s){let e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:s,statistics:r,histograms:a,isPseudoSpatialReference:n,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,de.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||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=r||null==n||i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(75414),Ie=i(20223),Ce=i(87045),Se=i(25943),Ae=i(82371);let Te=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,r={}){let{storageInfo:a,extent:s}=this.rasterInfo,{transposeInfo:n}=a,l=null!=n&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let s=0;for(let{data:e}of t)u.push(s),a.set(new Uint8Array(e),s),s+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:p}=a,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:u?.length,offsets:u,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==g)return null;let y=a.blockBoundary[e];if("jpg"!==a.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return g;let{origin:w,blockWidth:v,blockHeight:x}=a,{x:b,y:I}=this.getPyramidPixelSize(e),C=Math.round((s.xmin-w.x)/b)%v,S=Math.round((s.xmax-w.x)/b)%v||v,A=Math.round((w.y-s.ymax)/I)%x,T=Math.round((w.y-s.ymin)/I)%x||x,R=i===y.minCol?C:0,_=t===y.minRow?A:0,O=i===y.maxCol?S:v,M=t===y.maxRow?T:x;return(0,X.z$)(g,{x:R,y:_},{width:O-R,height:M-_}),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),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[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 r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,s=a-r+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--,r++,i=this.identifyPixelLocation(n,r,t.datumTransformation),null===i)return null}return-1===s||null==i?null:r}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 l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.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 a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Ae.E9)(a,r);let s="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:s}=t;if(null!=a&&null!=s)return Ce.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=s)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,s=r?t(r):-1/0;return Ce.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=s})})}return Ce.A.fromJSON(e)}(r.tileInfo,r):Ce.A.fromJSON(r.tileInfo);(0,u.Lw)(s);let[n,o]=this._computeMinMaxLOD(a,s),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(n.resolution-h.x)>c)&&(h.x=h.y=n.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let p=n.level-o.level,[d,m]=s.size,g=[],y=[],{lods:w}=s;w.forEach((e,t)=>{e.level>=o.level&&e.level<=n.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,d,m,s.origin,g,p),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/n.resolution)**(-1/p))/10,C=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Ie.A({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,isBsqTile:C,transposeInfo:v,blockBoundary:x}),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 be.A,e.extent=e.transform.forwardTransform(t))}(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Se.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),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=E.A.fromJSON(t.spatialReference||e.spatialReference),s=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:B.A.fromJSON(e),spatialReference:a,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Ae.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([r,a]);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,r=.5/e.width*i.x,{lods:a}=t,s=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[s,n];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:u}=this.sourceJSON,f=s;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??n,this._levelOffset=h.level-n.level),[f,h]}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],Te.prototype,"tileType",void 0),Te=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageServerRaster")],Te);const Re=Te;var _e=i(10713);const Oe=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Me=new Map;Me.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Me.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Me.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Me.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Me.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Fe=class extends N.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,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:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*s);return new H.A({width:a,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<d;g++)(!p||p.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<d;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Me.get(this.rasterInfo.storageInfo.compression).decoderFormat,C="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:s,format:I,planes:p?.length||o,offsets:x,pixelType:u,canvasUsage:C?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==I&&!S.mask&&(A=A[0],null!=A)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-A)/A)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==A&&(t[g]=1);S.mask=t}let T=0,R=0;if(h!==a||c!==s){let e=S.mask;if(e)for(g=0;g<s;g++)if(R=g*a,g<c)for(T=h;T<a;T++)e[R+T]=0;else for(T=0;T<a;T++)e[R+T]=0;else for(e=new Uint8Array(a*s),S.mask=e,g=0;g<c;g++)for(R=g*a,T=0;T<h;T++)e[R+T]=1}return S}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:r,files:a}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,K.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.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(_e.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=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/f**g)-1,t=Math.ceil(c/u/f**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 r,a,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=r*a;p=o**e,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=t*r+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<r-1?n:Math.ceil(u/p)-n*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/p)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),n=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Me.has(n))throw new l.A("mrf:open","currently does not support compression "+n);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Oe.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),p=f.getAttribute("c"),d=p?p===String(s):Me.get(n).isOneSegment;this._isBsq=!d;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",s=E.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(s=new E.A({wkid:e}))}else s=fe(a)??E.A.WGS84;else x=!0,s=new E.A({wkid:3857});y=new B.A(e,t,i,r),y.spatialReference=s}else x=!0,y=new B.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new E.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),C=y.spatialReference,S=new Ie.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:C}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:n,pyramidScalingFactor:I}),A=new xe.A({x:y.width/r,y:y.height/a,spatialReference:C}),T=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:C,bandCount:s,pixelType:u,pixelSize:A,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,le.mX)(t,"DataFile")),_=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Me.get(n).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 ce(t)}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Fe.prototype,"datasetFormat",void 0),Fe=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.MRFRaster")],Fe);const Pe=Fe;i(44208);var ke=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=a.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:a,features:n}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:r,headerByteCount:a,recordByteCount:s},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,ke.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(;u.length<r&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,ke.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 r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=s}return{header:n,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Le=i(44094),Be=i(94213);const Ee="none-tiled tiff is not optimized for access, convert to COG and retry.";let Je=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,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this._headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,r);null!=s&&s.pixels[0]instanceof Uint8Array&&(a.mask=s.pixels[0])}return a}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 l.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:a,isBigTiff:s}=(0,Le.uT)(i),n=[],u={fileChunk:i,posIFD:a,fileOffset:0};await this._readIFDs(n,u,r,s?8:4,t);let{imageInfo:f,rasterInfo:h}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:s,planes:n,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new E.A({wkid:3857}));let x=new B.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new Ie.A({blockWidth:a,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:p,blockBoundary:d}),C=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},A=new Q.A({width:i,height:r,bandCount:n,pixelType:l,pixelSize:C,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(A.nativeExtent=new B.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),A.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),p){let{x:e,y:t}=A.pixelSize;p.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:A}}(n),c=(0,Le.zS)(n),p=(0,Le.r9)(n);if(this._headerInfo={littleEndian:r,isBigTiff:s,ifds:n,pyramidIFDs:c,maskIFDs:p,...f},this._set("rasterInfo",h),!f.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+f.message);if(!f.tileWidth||!f.tileHeight)throw new l.A("tiffraster:open",Ee);h.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let d=n[0].get("PREDICTOR")?.values?.[0];if(3===n[0].get("SAMPLEFORMAT")?.values?.[0]&&2===d)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");let{skipMapInfo:m,skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")&&!m){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,K.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 xe.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,h)}!g.includes("vat.dbf")&&1===h.bandCount&&"u8"===h.pixelType&&!m&&(h.attributeTable=await this._fetchAuxiliaryTable(e),null!=h.attributeTable&&(h.keyProperties.DataType="thematic")),m&&this.updateImageSpaceRasterInfo(h),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;return(a+8>=i.byteLength||a<0)&&(r=a+r,i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,a=0),{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let s=await this._readIFD(t,i,Be.NB,r,a);if(!s?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(s.ifd),!s.nextIFD)return null;t.posIFD=s.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Be.NB,r=4,a){let{fileChunk:s,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(s,t,n,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Be.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",Ee);let r=[];if(e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),e.has("GEOKEYDIRECTORY")){let i=e.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){let e=r[0]+"."+r[1]+"."+r[2];n=i.valueOffset+6-o;let l=await this._validateOrFetchHeaderBuffer({fileChunk:s,posIFD:n,fileOffset:o},a);i.data=(await this._readIFD(l,t,Be.YC,2,a))?.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return u}return u.requiredBufferSize?(s=(await this.request(this.url,{range:{from:o,to:o+n+u.requiredBufferSize+8},responseType:"array-buffer",signal:a})).data,s.byteLength<n+u.requiredBufferSize?null:(e.fileChunk=s,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let s=a.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),r);return void a.forEach(i=>(0,Le.Cr)(e,t,i,n))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchOffsets(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize,s=Math.ceil((t-e)/a),n=e;for(let e=0;e<s;e++)r.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+a-1},responseType:"array-buffer",signal:i})),n+=a;let l=await Promise.all(r);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*a);return o.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let s=this._getTileLocation(e,t,i,r);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:u}=s,f=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),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 r=h[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:u,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.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),w.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 w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(a-1),{_headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let u=(0,Le.XO)(o,l),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.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,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(d+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===d&&y%v||v}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(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=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_headerInfo",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Je.prototype,"datasetFormat",void 0),Je=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.TIFFRaster")],Je);const ze=Je,He=new Map;He.set("MRF",{desc:"Meta Raster Format",constructor:Pe}),He.set("TIFF",{desc:"GeoTIFF",constructor:ze}),He.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Re}),He.set("JPG",{desc:"JPG Raster Format",constructor:we}),He.set("PNG",{desc:"PNG Raster Format",constructor:we}),He.set("GIF",{desc:"GIF Raster Format",constructor:we}),He.set("BMP",{desc:"BMP Raster Format",constructor:we}),He.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),He.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class Ue{static get supportedFormats(){let e=new Set;return He.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,s=e.datasetFormat??i?.datasetFormat;s??(t.includes(".")?s=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?s="CovJSON":r?.extent&&r.pixelblocks&&(s="MEMORY")),"OVR"===s||"TIF"===s||"DM"===s?s="TIFF":"JPG"===s||"JPEG"===s||"JFIF"===s?s="JPG":"COVJSON"===s&&(s="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");let n={url:t,source:r,sourceJSON:a,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(n).forEach(e=>{n[e]??delete n[e]}),s){if(!this.supportedFormats.has(s))throw new l.A("rasterfactory:open","not a supported format "+s);if("CRF"===s)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,He.get(s).constructor)(n);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(He.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(s=o[u++],!s||"CRF"===s)return null;let t=new(0,He.get(s).constructor)(n);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){He.has(e.toUpperCase())||He.set(e.toUpperCase(),{desc:t,constructor:i})}}var je=i(99235),Ze=i(10873),$e=i(20437),qe=i(74797),Ve=i(22796),Ge=i(69409);const We={instance:null,refCount:0,connectionPromise:null};async function Xe(){if(We.refCount++,We.instance)return We.instance;if(!We.connectionPromise){let e=new Ge.A;We.connectionPromise=e.initialize().then(()=>{We.instance=e})}return await We.connectionPromise,We.instance}function Ke(){We.refCount--,!(We.refCount>0)&&(We.instance?.destroy(),We.instance=null,We.connectionPromise=null,We.refCount=0)}var Ye=i(24212),Qe=i(30291),et=i(88625),tt=i(59923);let it=class extends((0,C.dM)((0,M.j)((0,A.q)((0,T.A)((0,_.H)((0,S.d)((0,P.b)((0,R.G)((0,F.e)((0,I.b)((0,O.J)((0,f.M)((0,n.OU)(b.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:s}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,qe.rZ)("Pixel Value"),(0,qe.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,qe.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,qe.DV)(t),r=(0,qe.y6)();e.push(i,r)}if(a){let t=(0,qe.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==qe.F_.rawServicePixelValue)),r=(0,Qe.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,qe.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,d.PZ)(Ve.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,tt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,k.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,k.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,je.UD)(t.toJSON(),a),a.some(e=>at(e,this.ioConfig))&&(r=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let s=await Promise.all(a.map(e=>Ue.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),n=s.findIndex(e=>null==e);if(n>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[n]}`);return this._primaryRasters=s,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;at(e,this.ioConfig)&&(i=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let r=await Ue.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await Ue.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,je.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new D.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,Ye.XF)(o.A.getLogger(this),(0,Ye.$7)("ImageryTile layers","relative-to-scene",e)),(0,Ye.XF)(o.A.getLogger(this),(0,Ye.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],it.prototype,"charts",void 0),(0,a.Cg)([(0,p.MZ)({type:et.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],it.prototype,"elevationInfo",null),(0,a.Cg)([(0,p.MZ)({type:Ce.A})],it.prototype,"tileInfo",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,clonable:!1})],it.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,p.MZ)(Ze.fV)],it.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],it.prototype,"isReference",void 0),(0,a.Cg)([(0,p.MZ)({type:["show","hide"]})],it.prototype,"listMode",void 0),(0,a.Cg)([(0,p.MZ)({json:{read:!0,write:!0}})],it.prototype,"blendMode",void 0),(0,a.Cg)([(0,p.MZ)({type:Ve.A,json:{name:"renderingRule",write:!0}})],it.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,p.MZ)()],it.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],it.prototype,"version",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],it.prototype,"type",void 0),(0,a.Cg)([(0,p.MZ)({type:["ArcGISTiledImageServiceLayer"]})],it.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],it.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],it.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0})],it.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,p.MZ)(Ze.PY)],it.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"fields",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"rasterFields",null),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],it.prototype,"source",void 0),it=(0,a.Cg)([(0,p.$K)("esri.layers.ImageryTileLayer")],it);const rt=it;function at(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),s=i(91429),n=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,n.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,n.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,s.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,s.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),s=i(69540),n=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},10333(e,t,i){i.d(t,{A:()=>n});var r=i(32198),a=i(25482),s=i(91429);let n=class extends a.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var r,a=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=r=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 r({tolerance:this.tolerance})}};(0,a.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var r,a=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,s=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=r*r,n=a*a,l=r*a,o=s*r,u=s*a,f=r*n,h=a*n;return{x:e[0]+r*e[2]+a*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function p(e,t,i){let{xmin:r,ymin:a,xmax:s,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:s,y:l}),u.push({x:r,y:a}),u.push({x:s,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:s,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(s-r)*t/e,y:a}),u.push({x:r+(s-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,s,n]=e,l=r*n-s*a,o=s*a-r*n;return[(s*i-t*n)/l,(r*i-t*a)/o,n/l,a/o,-s/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}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 r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),s=i(56507),n=i(69622),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),p=i(76030),d=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,s=!0,n=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(n=!1,o[u]|=1<<t):s=!1,31===t&&++u}n?(this._availability="unavailable",this.byteSize=40):s?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,s=this._availability;return a<0||a>s.length?"unknown":s[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||s.A,{row:r,col:a,width:n,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:o},valid:!0,data:Array(n*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=s.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let s=this.layer.tileInfo;s.updateTileInfo(r);let n=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,s){if(!this._prefetchingEnabled)return;let n=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(n))return;let l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,n),await(0,p.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(n)),(0,h.G4)(l))return;let c=new g.U(e,t,i),d={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,d);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,a);if(s)return Promise.resolve(s);let n=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(n,()=>t((0,h.NK)()));let i=x(a),s=this._pendingTilemapRequests[i];if(!s){s=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,d.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>d,Tw:()=>c,X6:()=>p});var r=i(56507),a=i(5443),s=i(86738),n=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:p}=t||{},d=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:d,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=p||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,C=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,A=await Promise.allSettled([v,x,b,I,C,S]),T=a.A.fromJSON(y.extent),R=Math.ceil(T.width/y.pixelSizeX-.1),_=Math.ceil(T.height/y.pixelSizeY-.1),O=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),M="fulfilled"===A[0].status?A[0].value?.data:null,F=M?.features?.length?f.A.fromJSON(M):null,P="fulfilled"===A[1].status?A[1].value?.data.colormap:null,k=P?.length?P:null,D="fulfilled"===A[2].status?A[2].value?.data.histograms:null,N=D?.[0]?.counts?.length?D:null,L="fulfilled"===A[3].status?A[3].value?.data??{}:{},B="fulfilled"===A[4].status?A[4].value?.data.multidimensionalInfo:null,E=B?.variables?.length?B:null;var J;(J=E)&&J.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let z=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===A[5].status?A[5].value?.data.statistics:null),{defaultVariable:H,serviceDataType:U}=y;H&&H!==L.DefaultVariable&&(L.DefaultVariable=H),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(L.DataType)&&(L.DataType=U.replace("esriImageServiceDataType",""));let j=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==j)&&(j=y.noDataValues);let Z=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new s.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:O}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,_))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:R,height:_,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:O,pixelSize:new s.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:O}),pixelType:y.pixelType.toLowerCase(),statistics:z,attributeTable:F,colormap:k,histograms:N,keyProperties:L,noDataValue:j,multidimensionalInfo:E,storageInfo:Z})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function p(e,t,i){return h(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),s=i(4718),n=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let s=e[a];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[a]=s.map(e=>f(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?s:JSON.stringify(s);else r[a]=s}return r}async function h(e,t,s){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(6361),i.e(6475),i.e(7715)]).then(()=>i(50148)),(await a.id.getCredential(e,s))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>n});var r=i(56512),a=i(86211),s=i(16271);function n(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:p}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,s.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",s=(0,a.mq)(i);return s?(0,a.oU)(e,r,s):0});const c={mode:"absolute-height",offset:0},p={mode:"on-the-ground",offset:null}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1137],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...s){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(s,r)||(i=e.apply(this,s),t=this,r=s,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{Qf:()=>l,Qh:()=>s,lM:()=>a});var r=i(34275);function a(e){if(!e)return 0;let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i],!1));return t}function s(e){if(!e)return 0;if("number"==typeof e[0])return l(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return o(e,8);let i=f;for(let r=0;r<t;r++)i+=n(e[r]);return i}(e);let t=u;for(let i in e)e.hasOwnProperty(i)&&(t+=n(e[i]));return t}function n(e,t=!0){switch(typeof e){case"object":return t?s(e):u;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function l(...e){return e.reduce((e,t)=>e+(t?(0,r.iu)(t)?t.byteLength+h:Array.isArray(t)?o(t,16):0:0),0)}function o(e,t){return f+e.length*t}const u=32,f=16,h=145},5359(e,t,i){i.d(t,{Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}i.d(t,["H",0,r])},11137(e,t,i){i.r(t),i.d(t,{default:()=>rt});var r,a=i(32198),s=i(40124),n=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),p=i(91429),d=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),C=i(63074),S=i(69208),A=i(34287),T=i(8303),R=i(72545),_=i(56551),O=i(54310),M=i(25036),F=i(82935),P=i(82806),k=i(7548),D=i(23636),N=i(49859),L=i(68197),B=i(5443),E=i(16930),J=i(73444),z=i(94778),H=i(14140);function U(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function j(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Z(e){let t=(0,J.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function $(){return Math.round(255*Math.random())}function q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:s,categoryEncoding:n,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Z(a)),s&&(t[e].unit=s.label?Z(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})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Z(e.label):null,e.preferredColor)){let t=L.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=$(),e.Green=$(),e.Blue=$())}));let a={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}))};r&&a.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=a}}return t}function V(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,z.X1)(t,i)}function G(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),s=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),n=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);n+=s[l]*(i%t[a]),i=Math.floor(i/t[a])}return n}var W=i(4366),X=i(47520),K=i(51927),Y=i(45617),Q=i(87186);let ee=class extends N.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,s=this._pixelBlockTiles.get(a);if(s)return s;if(!this.source)return null;let{rasterInfo:n}=this,[l,o]=n.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let s=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return s&&this._pixelBlockTiles.set(a,s),s}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let p={pixelBlock:c,useBilinear:"thematic"!==n.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(p,r):(0,X.J$)(p)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:s,nativeExtent:n,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:p}=f??t.imageInfo,d=t.extent??new B.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new E.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:d.width/h,y:d.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:p,extent:d,nativeExtent:n,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:d.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,s="thematic"!==r.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:s},i):Promise.resolve((0,X.lD)(e,t,a,s)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),c=await(0,h.Lx)([n,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let s=a.dimensions.map(e=>new Y.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,W.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,K.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends N.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,K.eH)(i[0]),o=s?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:n,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.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 l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.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:a,type:s,values:n}=r[e];if(!("ndarray"===s.toLowerCase()&&n?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!U(t[t.length-1])||!j(t[t.length-2]))throw new l.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:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];U(o)?s=e:j(o)&&(n=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,s=(t-e)/(i-1);r.push([e-.5*s,t+.5*s]),a.push(s);for(let t=0;t<i;t++)f.push(e+s*t)}l.push({name:o,values:f,extent:[f[0],f[f.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:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[s])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new E.A({wkid:h}),[p,d]=r[s],[m,g]=r[n],y=new B.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[s]),height:Math.round(y.height/a[n]),extent:y,dimensions:l}}(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];a?.length&&l.push({name:t,dimensions:a})}let o=q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<n.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=s[n[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),p=u.slice(0,-2),d="float"===l?"f32":V(r),m=t*i,g=r.length/m;for(let s=0;s<g;s++){let n=H.A.createEmptyBand(d,m),l=new Uint8Array(m).fill(255),o=!1,u=s*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||a?.length){let e=new H.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:d});e.updateStatistics(),a?.length?f[G(c,p,s)+h]=e:f.push(e)}else{let e=f[s];e.pixels.push(n),o?e.mask&&=H.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:n}}(t)}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var se=i(4576),ne=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new E.A({wkid:t});if(e=String(e).trim(),(0,ne.jp)(e))return new E.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 r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),s=a>-1?a:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(n);let o=t?new E.A({wkid:t}):new E.A({wkt:n}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new E.A({wkt:e}):new E.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(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,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),s=(0,le.Ui)(t,"CoeffY/Double"),n=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,s),u=ue(n,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,s=(0,le.v7)(e,"NoDataValue"),n=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(n,"HistMin"),o=(0,le.v7)(n,"HistMax"),u=(0,le.v7)(n,"BucketCount"),f=(0,le.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,le.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":r=s;break;case"STATISTICS_STDDEV":a=s}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}: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(se.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(se.Ru):null),t}var pe=i(85951),de=i(96381);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends N.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,s="immediate"===a||"jpg"!==r;if(s){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,pe.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:n,ioConfig:o}=this,u=new te({preGenerateTiles:s,rasterJobHandler:n,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:s}=await this._fetchAuxiliaryData(t),n=!i;n&&(i=new E.A({wkid:3857})),a?.length&&null==r&&(r=(0,K.Pg)(a));let{width:l,height:o}=e,u=new B.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=s?s.forwardTransform(u):u,h=!0;if(s){let e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:s,statistics:r,histograms:a,isPseudoSpatialReference:n,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,de.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||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=r||null==n||i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(75414),Ie=i(20223),Ce=i(87045),Se=i(25943),Ae=i(82371);let Te=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,r={}){let{storageInfo:a,extent:s}=this.rasterInfo,{transposeInfo:n}=a,l=null!=n&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let s=0;for(let{data:e}of t)u.push(s),a.set(new Uint8Array(e),s),s+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:p}=a,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:u?.length,offsets:u,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==g)return null;let y=a.blockBoundary[e];if("jpg"!==a.compression||i>y.minCol&&i<y.maxCol&&t>y.minRow&&t<y.maxRow)return g;let{origin:w,blockWidth:v,blockHeight:x}=a,{x:b,y:I}=this.getPyramidPixelSize(e),C=Math.round((s.xmin-w.x)/b)%v,S=Math.round((s.xmax-w.x)/b)%v||v,A=Math.round((w.y-s.ymax)/I)%x,T=Math.round((w.y-s.ymin)/I)%x||x,R=i===y.minCol?C:0,_=t===y.minRow?A:0,O=i===y.maxCol?S:v,M=t===y.maxRow?T:x;return(0,X.z$)(g,{x:R,y:_},{width:O-R,height:M-_}),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),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[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 r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,s=a-r+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--,r++,i=this.identifyPixelLocation(n,r,t.datumTransformation),null===i)return null}return-1===s||null==i?null:r}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 l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.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 a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Ae.E9)(a,r);let s="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:s}=t;if(null!=a&&null!=s)return Ce.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=s)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,s=r?t(r):-1/0;return Ce.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=s})})}return Ce.A.fromJSON(e)}(r.tileInfo,r):Ce.A.fromJSON(r.tileInfo);(0,u.Lw)(s);let[n,o]=this._computeMinMaxLOD(a,s),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(n.resolution-h.x)>c)&&(h.x=h.y=n.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let p=n.level-o.level,[d,m]=s.size,g=[],y=[],{lods:w}=s;w.forEach((e,t)=>{e.level>=o.level&&e.level<=n.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,d,m,s.origin,g,p),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/n.resolution)**(-1/p))/10,C=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Ie.A({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,isBsqTile:C,transposeInfo:v,blockBoundary:x}),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 be.A,e.extent=e.transform.forwardTransform(t))}(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Se.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),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=E.A.fromJSON(t.spatialReference||e.spatialReference),s=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:B.A.fromJSON(e),spatialReference:a,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Ae.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([r,a]);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,r=.5/e.width*i.x,{lods:a}=t,s=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[s,n];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:u}=this.sourceJSON,f=s;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??n,this._levelOffset=h.level-n.level),[f,h]}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],Te.prototype,"tileType",void 0),Te=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageServerRaster")],Te);const Re=Te;var _e=i(10713);const Oe=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Me=new Map;Me.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Me.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Me.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Me.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Me.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Fe=class extends N.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,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:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*s);return new H.A({width:a,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<d;g++)(!p||p.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<d;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Me.get(this.rasterInfo.storageInfo.compression).decoderFormat,C="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:s,format:I,planes:p?.length||o,offsets:x,pixelType:u,canvasUsage:C?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==I&&!S.mask&&(A=A[0],null!=A)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-A)/A)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==A&&(t[g]=1);S.mask=t}let T=0,R=0;if(h!==a||c!==s){let e=S.mask;if(e)for(g=0;g<s;g++)if(R=g*a,g<c)for(T=h;T<a;T++)e[R+T]=0;else for(T=0;T<a;T++)e[R+T]=0;else for(e=new Uint8Array(a*s),S.mask=e,g=0;g<c;g++)for(R=g*a,T=0;T<h;T++)e[R+T]=1}return S}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:r,files:a}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,K.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.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(_e.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=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/f**g)-1,t=Math.ceil(c/u/f**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 r,a,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=r*a;p=o**e,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=t*r+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<r-1?n:Math.ceil(u/p)-n*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/p)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),n=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Me.has(n))throw new l.A("mrf:open","currently does not support compression "+n);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Oe.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),p=f.getAttribute("c"),d=p?p===String(s):Me.get(n).isOneSegment;this._isBsq=!d;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",s=E.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(s=new E.A({wkid:e}))}else s=fe(a)??E.A.WGS84;else x=!0,s=new E.A({wkid:3857});y=new B.A(e,t,i,r),y.spatialReference=s}else x=!0,y=new B.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new E.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),C=y.spatialReference,S=new Ie.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:C}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:n,pyramidScalingFactor:I}),A=new xe.A({x:y.width/r,y:y.height/a,spatialReference:C}),T=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:C,bandCount:s,pixelType:u,pixelSize:A,noDataValue:m,storageInfo:S}),R=this._getAuxFullPath((0,le.mX)(t,"DataFile")),_=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:R||this.url.replace(".mrf",Me.get(n).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 ce(t)}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Fe.prototype,"datasetFormat",void 0),Fe=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.MRFRaster")],Fe);const Pe=Fe;i(44208);var ke=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=a.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:a,features:n}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:r,headerByteCount:a,recordByteCount:s},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,ke.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(;u.length<r&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,ke.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 r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=s}return{header:n,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Le=i(44094),Be=i(94213);const Ee="none-tiled tiff is not optimized for access, convert to COG and retry.";let Je=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,r={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this._headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,r);null!=s&&s.pixels[0]instanceof Uint8Array&&(a.mask=s.pixels[0])}return a}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 l.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:a,isBigTiff:s}=(0,Le.uT)(i),n=[],u={fileChunk:i,posIFD:a,fileOffset:0};await this._readIFDs(n,u,r,s?8:4,t);let{imageInfo:f,rasterInfo:h}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:s,planes:n,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new E.A({wkid:3857}));let x=new B.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new Ie.A({blockWidth:a,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:p,blockBoundary:d}),C=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},A=new Q.A({width:i,height:r,bandCount:n,pixelType:l,pixelSize:C,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(A.nativeExtent=new B.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),A.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),p){let{x:e,y:t}=A.pixelSize;p.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:A}}(n),c=(0,Le.zS)(n),p=(0,Le.r9)(n);if(this._headerInfo={littleEndian:r,isBigTiff:s,ifds:n,pyramidIFDs:c,maskIFDs:p,...f},this._set("rasterInfo",h),!f.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+f.message);if(!f.tileWidth||!f.tileHeight)throw new l.A("tiffraster:open",Ee);h.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let d=n[0].get("PREDICTOR")?.values?.[0];if(3===n[0].get("SAMPLEFORMAT")?.values?.[0]&&2===d)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");let{skipMapInfo:m,skipExtensions:g=[]}=this.ioConfig;if(!g.includes("aux.xml")&&!m){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,K.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 xe.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,h)}!g.includes("vat.dbf")&&1===h.bandCount&&"u8"===h.pixelType&&!m&&(h.attributeTable=await this._fetchAuxiliaryTable(e),null!=h.attributeTable&&(h.keyProperties.DataType="thematic")),m&&this.updateImageSpaceRasterInfo(h),this.updateTileInfo()}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;return(a+8>=i.byteLength||a<0)&&(r=a+r,i=(await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:t})).data,a=0),{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let s=await this._readIFD(t,i,Be.NB,r,a);if(!s?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(s.ifd),!s.nextIFD)return null;t.posIFD=s.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Be.NB,r=4,a){let{fileChunk:s,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(s,t,n,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Be.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",Ee);let r=[];if(e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),e.has("GEOKEYDIRECTORY")){let i=e.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){let e=r[0]+"."+r[1]+"."+r[2];n=i.valueOffset+6-o;let l=await this._validateOrFetchHeaderBuffer({fileChunk:s,posIFD:n,fileOffset:o},a);i.data=(await this._readIFD(l,t,Be.YC,2,a))?.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[e]})}}return u}return u.requiredBufferSize?(s=(await this.request(this.url,{range:{from:o,to:o+n+u.requiredBufferSize+8},responseType:"array-buffer",signal:a})).data,s.byteLength<n+u.requiredBufferSize?null:(e.fileChunk=s,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let s=a.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),r);return void a.forEach(i=>(0,Le.Cr)(e,t,i,n))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchOffsets(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize,s=Math.ceil((t-e)/a),n=e;for(let e=0;e<s;e++)r.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+a-1},responseType:"array-buffer",signal:i})),n+=a;let l=await Promise.all(r);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*a);return o.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let s=this._getTileLocation(e,t,i,r);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:u}=s,f=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),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 r=h[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:u,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.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),w.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 w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(a-1),{_headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let u=(0,Le.XO)(o,l),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.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,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(d+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===d&&y%v||v}}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(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=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_headerInfo",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,p.MZ)()],Je.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Je.prototype,"datasetFormat",void 0),Je=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.TIFFRaster")],Je);const ze=Je,He=new Map;He.set("MRF",{desc:"Meta Raster Format",constructor:Pe}),He.set("TIFF",{desc:"GeoTIFF",constructor:ze}),He.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Re}),He.set("JPG",{desc:"JPG Raster Format",constructor:we}),He.set("PNG",{desc:"PNG Raster Format",constructor:we}),He.set("GIF",{desc:"GIF Raster Format",constructor:we}),He.set("BMP",{desc:"BMP Raster Format",constructor:we}),He.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),He.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class Ue{static get supportedFormats(){let e=new Set;return He.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,s=e.datasetFormat??i?.datasetFormat;s??(t.includes(".")?s=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?s="CovJSON":r?.extent&&r.pixelblocks&&(s="MEMORY")),"OVR"===s||"TIF"===s||"DM"===s?s="TIFF":"JPG"===s||"JPEG"===s||"JFIF"===s?s="JPG":"COVJSON"===s&&(s="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");let n={url:t,source:r,sourceJSON:a,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(n).forEach(e=>{n[e]??delete n[e]}),s){if(!this.supportedFormats.has(s))throw new l.A("rasterfactory:open","not a supported format "+s);if("CRF"===s)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,He.get(s).constructor)(n);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(He.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(s=o[u++],!s||"CRF"===s)return null;let t=new(0,He.get(s).constructor)(n);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){He.has(e.toUpperCase())||He.set(e.toUpperCase(),{desc:t,constructor:i})}}var je=i(99235),Ze=i(10873),$e=i(20437),qe=i(74797),Ve=i(22796),Ge=i(69409);const We={instance:null,refCount:0,connectionPromise:null};async function Xe(){if(We.refCount++,We.instance)return We.instance;if(!We.connectionPromise){let e=new Ge.A;We.connectionPromise=e.initialize().then(()=>{We.instance=e})}return await We.connectionPromise,We.instance}function Ke(){We.refCount--,!(We.refCount>0)&&(We.instance?.destroy(),We.instance=null,We.connectionPromise=null,We.refCount=0)}var Ye=i(24212),Qe=i(30291),et=i(88625),tt=i(59923);let it=class extends((0,C.dM)((0,M.j)((0,A.q)((0,T.A)((0,_.H)((0,S.d)((0,P.b)((0,R.G)((0,F.e)((0,I.b)((0,O.J)((0,f.M)((0,n.OU)(b.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:s}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,qe.rZ)("Pixel Value"),(0,qe.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,qe.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,qe.DV)(t),r=(0,qe.y6)();e.push(i,r)}if(a){let t=(0,qe.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==qe.F_.rawServicePixelValue)),r=(0,Qe.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,qe.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,d.PZ)(Ve.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,tt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,k.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,k.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,je.UD)(t.toJSON(),a),a.some(e=>at(e,this.ioConfig))&&(r=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let s=await Promise.all(a.map(e=>Ue.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),n=s.findIndex(e=>null==e);if(n>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[n]}`);return this._primaryRasters=s,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;at(e,this.ioConfig)&&(i=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let r=await Ue.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await Ue.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,je.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new D.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,Ye.XF)(o.A.getLogger(this),(0,Ye.$7)("ImageryTile layers","relative-to-scene",e)),(0,Ye.XF)(o.A.getLogger(this),(0,Ye.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],it.prototype,"charts",void 0),(0,a.Cg)([(0,p.MZ)({type:et.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],it.prototype,"elevationInfo",null),(0,a.Cg)([(0,p.MZ)({type:Ce.A})],it.prototype,"tileInfo",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,clonable:!1})],it.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,p.MZ)(Ze.fV)],it.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],it.prototype,"isReference",void 0),(0,a.Cg)([(0,p.MZ)({type:["show","hide"]})],it.prototype,"listMode",void 0),(0,a.Cg)([(0,p.MZ)({json:{read:!0,write:!0}})],it.prototype,"blendMode",void 0),(0,a.Cg)([(0,p.MZ)({type:Ve.A,json:{name:"renderingRule",write:!0}})],it.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,p.MZ)()],it.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],it.prototype,"version",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],it.prototype,"type",void 0),(0,a.Cg)([(0,p.MZ)({type:["ArcGISTiledImageServiceLayer"]})],it.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],it.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],it.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0})],it.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,p.MZ)(Ze.PY)],it.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"fields",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[$e.A]})],it.prototype,"rasterFields",null),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],it.prototype,"source",void 0),it=(0,a.Cg)([(0,p.$K)("esri.layers.ImageryTileLayer")],it);const rt=it;function at(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),s=i(91429),n=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,n.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,n.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,s.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,s.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),s=i(69540),n=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},10333(e,t,i){i.d(t,{A:()=>n});var r=i(32198),a=i(25482),s=i(91429);let n=class extends a.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var r,a=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=r=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 r({tolerance:this.tolerance})}};(0,a.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var r,a=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,s=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=r*r,n=a*a,l=r*a,o=s*r,u=s*a,f=r*n,h=a*n;return{x:e[0]+r*e[2]+a*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function p(e,t,i){let{xmin:r,ymin:a,xmax:s,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:s,y:l}),u.push({x:r,y:a}),u.push({x:s,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:s,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(s-r)*t/e,y:a}),u.push({x:r+(s-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,s,n]=e,l=r*n-s*a,o=s*a-r*n;return[(s*i-t*n)/l,(r*i-t*a)/o,n/l,a/o,-s/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}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 r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),s=i(56507),n=i(69622),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),p=i(76030),d=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,s=!0,n=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(n=!1,o[u]|=1<<t):s=!1,31===t&&++u}n?(this._availability="unavailable",this.byteSize=40):s?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,s=this._availability;return a<0||a>s.length?"unknown":s[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||s.A,{row:r,col:a,width:n,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:o},valid:!0,data:Array(n*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=s.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let s=this.layer.tileInfo;s.updateTileInfo(r);let n=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,s){if(!this._prefetchingEnabled)return;let n=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(n))return;let l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,n),await(0,p.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(n)),(0,h.G4)(l))return;let c=new g.U(e,t,i),d={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,d);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,a);if(s)return Promise.resolve(s);let n=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(n,()=>t((0,h.NK)()));let i=x(a),s=this._pendingTilemapRequests[i];if(!s){s=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,d.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>d,Tw:()=>c,X6:()=>p});var r=i(56507),a=i(5443),s=i(86738),n=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:p}=t||{},d=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:d,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=p||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,C=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,A=await Promise.allSettled([v,x,b,I,C,S]),T=a.A.fromJSON(y.extent),R=Math.ceil(T.width/y.pixelSizeX-.1),_=Math.ceil(T.height/y.pixelSizeY-.1),O=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),M="fulfilled"===A[0].status?A[0].value?.data:null,F=M?.features?.length?f.A.fromJSON(M):null,P="fulfilled"===A[1].status?A[1].value?.data.colormap:null,k=P?.length?P:null,D="fulfilled"===A[2].status?A[2].value?.data.histograms:null,N=D?.[0]?.counts?.length?D:null,L="fulfilled"===A[3].status?A[3].value?.data??{}:{},B="fulfilled"===A[4].status?A[4].value?.data.multidimensionalInfo:null,E=B?.variables?.length?B:null;var J;(J=E)&&J.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let z=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===A[5].status?A[5].value?.data.statistics:null),{defaultVariable:H,serviceDataType:U}=y;H&&H!==L.DefaultVariable&&(L.DefaultVariable=H),U?.includes("esriImageServiceDataTypeVector")&&!U.includes(L.DataType)&&(L.DataType=U.replace("esriImageServiceDataType",""));let j=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==j)&&(j=y.noDataValues);let Z=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new s.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:O}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(R,_))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:R,height:_,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:O,pixelSize:new s.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:O}),pixelType:y.pixelType.toLowerCase(),statistics:z,attributeTable:F,colormap:k,histograms:N,keyProperties:L,noDataValue:j,multidimensionalInfo:E,storageInfo:Z})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function p(e,t,i){return h(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),s=i(4718),n=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let s=e[a];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[a]=s.map(e=>f(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?s:JSON.stringify(s);else r[a]=s}return r}async function h(e,t,s){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(7956),i.e(7715)]).then(()=>i(50148)),(await a.id.getCredential(e,s))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>n});var r=i(56512),a=i(86211),s=i(16271);function n(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:p}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,s.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",s=(0,a.mq)(i);return s?(0,a.oU)(e,r,s):0});const c={mode:"absolute-height",offset:0},p={mode:"on-the-ground",offset:null}}}]);