@arcgis/core 4.29.0-next.20240210 → 4.29.0-next.20240213

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 (77) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/05ebb9cec0e1826b283f.js +1 -0
  3. package/assets/esri/core/workers/chunks/18551a7eb5a9b88aa0dc.js +1 -0
  4. package/assets/esri/core/workers/chunks/24d19abc680b341d13bb.js +1 -0
  5. package/assets/esri/core/workers/chunks/{3f4d63436c3de04a6ebb.js → 254b4ee3621bbe345bb1.js} +1 -1
  6. package/assets/esri/core/workers/chunks/2d682ee6e5d66f2ea5cd.js +1 -0
  7. package/assets/esri/core/workers/chunks/{d5484d470121de2b403b.js → 36d091be859bbb1a149b.js} +1 -1
  8. package/assets/esri/core/workers/chunks/50b41f91be903a0977f9.js +1 -0
  9. package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +1 -0
  10. package/assets/esri/core/workers/chunks/6e135a5dd5223f24da90.js +1 -0
  11. package/assets/esri/core/workers/chunks/784b6a8216b97440b180.js +1 -0
  12. package/assets/esri/core/workers/chunks/{7f7a4de2cd4ab71b9aee.js → 8d119dc0a92ad3612daa.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f13c4b9692dad5802a32.js → 968808e99f08677152cb.js} +84 -84
  14. package/assets/esri/core/workers/chunks/{0014635097a32ad38895.js → a854611d1a86b838c6ad.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{50a5abd75fa7dbb571a5.js → ccd53b81c2688dd11584.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{b2b8e6a0b3f70ada2799.js → e4da908079417cc2f495.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{af0314c2b5b7dc4f5bbd.js → e6dbf0a7b7b1cf64f23f.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{eba72ff1726ff6998204.js → f03d62ab7806b68d0b62.js} +1 -1
  19. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  20. package/geometry/Mesh.js +1 -1
  21. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  22. package/interfaces.d.ts +296 -73
  23. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  24. package/layers/SceneLayer.js +1 -1
  25. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  26. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  27. package/package.json +2 -2
  28. package/portal/support/resourceUtils.js +1 -1
  29. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  30. package/rest/support/meshFeatureSet.js +1 -1
  31. package/support/revision.js +1 -1
  32. package/symbols/cim/constants.js +1 -1
  33. package/symbols/support/previewSymbol2D.js +1 -1
  34. package/versionManagement/support/versionManagementUtils.js +1 -1
  35. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  36. package/views/2d/engine/webgl/collisions/CollisionGrid.js +1 -1
  37. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  38. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  39. package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
  40. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  41. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  42. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
  43. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  44. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  45. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  46. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  47. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  48. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  49. package/views/3d/layers/I3SMeshView3D.js +1 -1
  50. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  51. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  52. package/views/3d/terrain/OverlayRenderer.js +1 -1
  53. package/views/3d/webgl/RenderNode.js +1 -1
  54. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  55. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  56. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  57. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  58. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  59. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  60. package/views/draw/DrawOperation.js +1 -1
  61. package/views/draw/support/Box.js +1 -1
  62. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  63. package/widgets/BasemapLayerList.js +1 -1
  64. package/widgets/Editor.js +1 -1
  65. package/widgets/FeatureForm.js +1 -1
  66. package/widgets/LayerList.js +1 -1
  67. package/widgets/Print/PrintViewModel.js +1 -1
  68. package/widgets/Sketch/SketchViewModel.js +1 -1
  69. package/widgets/TableList.js +1 -1
  70. package/assets/esri/core/workers/chunks/062629a9b4695dea8bf8.js +0 -1
  71. package/assets/esri/core/workers/chunks/37803888bd9a537481a7.js +0 -1
  72. package/assets/esri/core/workers/chunks/560f677a356c7ebde5d3.js +0 -1
  73. package/assets/esri/core/workers/chunks/5bfc5ffad705aaaafcd4.js +0 -1
  74. package/assets/esri/core/workers/chunks/655f4560fb36a0d9ff0b.js +0 -1
  75. package/assets/esri/core/workers/chunks/b927b655e955abe00d48.js +0 -1
  76. package/assets/esri/core/workers/chunks/d2417d179d015f1193a1.js +0 -1
  77. package/assets/esri/core/workers/chunks/f75ec599f53c66cab194.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5496],{80424:(e,t,i)=>{var s;i.d(t,{M:()=>s}),function(e){e[e.KILOBYTES=1024]="KILOBYTES",e[e.MEGABYTES=1048576]="MEGABYTES",e[e.GIGABYTES=1073741824]="GIGABYTES"}(s||(s={}))},23964:(e,t,i)=>{i.d(t,{c:()=>r});var s=i(67432),n=i(9592);class r{constructor(e){this._observable=new n.n,this._map=new Map(e)}get size(){return(0,s.am)(this._observable),this._map.size}clear(){this._map.size>0&&(this._map.clear(),this._observable.notify())}delete(e){const t=this._map.delete(e);return t&&this._observable.notify(),t}entries(){return(0,s.am)(this._observable),this._map.entries()}forEach(e,t){(0,s.am)(this._observable),this._map.forEach(((i,s)=>e.call(t,i,s,this)),t)}get(e){return(0,s.am)(this._observable),this._map.get(e)}has(e){return(0,s.am)(this._observable),this._map.has(e)}keys(){return(0,s.am)(this._observable),this._map.keys()}set(e,t){return this._map.set(e,t),this._observable.notify(),this}values(){return(0,s.am)(this._observable),this._map.values()}[Symbol.iterator](){return(0,s.am)(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}}},52888:(e,t,i)=>{i.d(t,{O:()=>o});var s=i(62088),n=i(67432),r=i(9592);class a{constructor(e,t){this._observable=new r.n,this._value=e,this._equalityFunction=t}get value(){return(0,n.am)(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}}function o(e,t=s.YT){return new a(e,t)}},20480:(e,t,i)=>{i.d(t,{WW:()=>b});var s=i(6220),n=i(20744),r=i(66360),a=i(7488),o=i(48516),l=i(44048),c=i(60544),u=i(29120),h=(i(60708),i(2600)),f=i(6704),p=i(21980),d=i(28176),m=i(81976);const y=()=>r.c.getLogger("esri.geometry.support.normalizeUtils");function g(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.c||e instanceof a.c)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y().error(e),new n.c(e)}const i=(0,l.iM)(e),s=[];for(const e of i){const i=[];s.push(i),i.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const n=e[s][0],r=e[s][1],a=e[s+1][0],o=e[s+1][1],l=Math.sqrt((a-n)*(a-n)+(o-r)*(o-r)),c=(o-r)/l,u=(a-n)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,a=u*s+n,o=c*s+r;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,s=u*e+n,a=c*e+r;i.push([s,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.c({rings:s,spatialReference:e.spatialReference}):new o.c({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.aq)(t,!0)}return i&&(e=(0,l.wb)(e,i)),e}function _(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=(0,l.yK)(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=(0,l.yK)(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=(0,l.yK)(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=(0,l.yK)(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function v(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const n=t.cutIndexes[s],r=t.geometries[s],a=(0,l.iM)(r);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const s=t[e][0];i=s>i?s:i}i=Number(i.toFixed(9));const s=-360*(0,l.yK)(i,180);for(let i=0;i<t.length;i++){const t=r.getPoint(e,i);r.setPoint(e,i,t.clone().offset(s,0))}return!0}}))}if(n===i){if(g(e))for(const t of(0,l.iM)(r))e[n]=e[n].addRing(t);else if(x(e))for(const t of(0,l.iM)(r))e[n]=e[n].addPath(t)}else i=n,e[n]=r}return e}async function b(e,t,i){if(!Array.isArray(e))return b([e],t);t&&"string"!=typeof t&&y().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??s.default.geometryServiceUrl;let r,g,x,I,S,R,T,k,q=0;const C=[],M=[];for(const t of e)if(null!=t)if(r||(r=t.spatialReference,g=(0,c.Nq)(r),x=r.isWebMercator,R=x?102100:4326,I=l.Hh[R].maxX,S=l.Hh[R].minX,T=l.Hh[R].plus180Line,k=l.Hh[R].minus180Line),g)if("mesh"===t.type)M.push(t);else if("point"===t.type)M.push(_(t.clone(),I,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>_(e,I,S))),M.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,g);M.push(e.rings?new a.c(e):e)}else if(t.extent){const e=t.extent,i=(0,l.yK)(e.xmin,S)*(2*I);let s=0===i?t.clone():(0,l.wb)(t.clone(),i);e.offset(i,0),e.intersects(T)&&e.xmax!==I?(q=e.xmax>q?e.xmax:q,s=w(s,x),C.push(s),M.push("cut")):e.intersects(k)&&e.xmin!==S?(q=e.xmax*(2*I)>q?e.xmax*(2*I):q,s=w(s,x,360),C.push(s),M.push("cut")):M.push(s)}else M.push(t.clone());else M.push(t);else M.push(t);let O=(0,l.yK)(q,I),F=-90;const P=O,N=new o.c;for(;O>0;){const e=360*O-180;N.addPath([[e,F],[e,-1*F]]),F*=-1,O--}if(C.length>0&&P>0){const t=v(C,await async function(e,t,i,s){const n=(0,p.UX)(e),r=t[0].spatialReference,a={...s,responseType:"json",query:{...n.query,f:"json",sr:(0,c.um)(r),target:JSON.stringify({geometryType:(0,f.Ce)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.c)(n.path+"/cut",a),{cutIndexes:l,geometries:u=[]}=o.data;return{cutIndexes:l,geometries:u.map((e=>{const t=(0,f.h4)(e);return t.spatialReference=r,t}))}}(n,C,N,i)),s=[],r=[];for(let i=0;i<M.length;i++){const n=M[i];if("cut"!==n)r.push(n);else{const n=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&n.rings.length>=a.rings.length?(s.push(n),r.push("simplify")):r.push(x?(0,u.w7)(n):n)}}if(!s.length)return r;const a=await async function(e,t,i){const s="string"==typeof e?(0,d.as)(e):e,n=t[0].spatialReference,r=(0,f.Ce)(t[0]),a={...i,query:{...s.query,f:"json",sr:(0,c.um)(n),geometries:JSON.stringify((0,m.y)(t))}},{data:o}=await(0,h.c)(s.path+"/simplify",a);return(0,m.Q)(o.geometries,r,n)}(n,s,i),o=[];for(let e=0;e<r.length;e++){const t=r[e];"simplify"!==t?o.push(t):o.push(x?(0,u.w7)(a.shift()):a.shift())}return o}const D=[];for(let e=0;e<M.length;e++){const t=M[e];if("cut"!==t)D.push(t);else{const e=C.shift();D.push(!0===x?(0,u.w7)(e):e)}}return D}},44048:(e,t,i)=>{i.d(t,{Hh:()=>a,iM:()=>c,wb:()=>l,yK:()=>o});var s=i(48516),n=i(56156),r=i(6704);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.c({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:n.c.WebMercator}),minus180Line:new s.c({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:n.c.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.c({paths:[[[180,-180],[180,180]]],spatialReference:n.c.WGS84}),minus180Line:new s.c({paths:[[[-180,-180],[-180,180]]],spatialReference:n.c.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,r.Cs)(e)?e.rings:e.paths}},82744:(e,t,i)=>{i.r(t),i.d(t,{default:()=>kt});var s=i(41948),n=i(82692),r=i(3856),a=i(20744),o=i(66360),l=i(26496),c=i(10860),u=i(57896),h=i(1580),f=i(53368),p=(i(72052),i(9456)),d=i(9968),m=i(12552),y=i(81436),g=i(16660),x=i(25216),w=i(28584),_=(i(60708),i(87080)),v=i(2600),b=i(26832),I=i(33600),S=i(60544),R=i(48212),T=i(21488),k=i(91768),q=i(72464),C=i(75e3),M=i(7368),O=i(87576),F=i(7488),P=i(40504),N=i(94804),D=i(22108),E=i(84452),z=i(56660),A=i(25404),B=i(67776);const J=new Map,L=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.refCount--,e.refCount<=0&&(s.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,s=this._cachedBlocks;if(s.has(i)){const e=s.get(i);return e.ts=Date.now(),e.refCount++,s.delete(i),s.set(i,e),e.block}return null}putBlock(e,t,i,s){const n=this._cachedBlocks,r=e+"/"+t;if(n.has(r)){const e=n.get(r);e.ts=Date.now(),e.refCount++}else n.set(r,{block:i,ts:Date.now(),refCount:1,controller:s});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,s=e+"/"+t;i.has(s)&&i.delete(s)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let s=0;s<t.length&&t[s][1].ts<=i-this._duration;s++)e.delete(t[s][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function H(e,t){return null==t?e:`${e}?sliceId=${t}`}function G(e,t,i){const s=J.get(e);if(!s)return null==t?L.decreaseRefCount(e,i):0;if(null==t||null==s[t])return L.decreaseRefCount(e,i);const n=s[t]?.cache,r=n?.get(i);if(n&&r){if(r.refCount--,0===r.refCount){n.delete(i);for(let e=0;e<s.length;e++)s[e]?.cache.delete(i);r.controller&&r.controller.abort()}return r.refCount}return 0}function W(e,t,i){const s=J.get(e);if(!s)return null==t?L.getBlock(e,i):null;if(null==t||null==s[t]){for(let e=0;e<s.length;e++){const t=s[e]?.cache.get(i);if(t)return t.refCount++,t.block}return L.getBlock(e,i)}const n=s[t]?.cache.get(i);if(n)return n.refCount++,n.block;for(let e=0;e<s.length;e++){if(e===t||!s[e])continue;const n=s[e]?.cache,r=n?.get(i);if(n&&r)return r.refCount++,n.set(i,r),r.block}return null}function j(e,t,i,s,n=null){const r=J.get(e);if(!r)return void(null==t&&L.putBlock(e,i,s,n));if(null==t||null==r[t])return void L.putBlock(e,i,s,n);const a={refCount:1,block:s,isResolved:!1,isRejected:!1,controller:n};s.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),r[t]?.cache.set(i,a)}function U(e,t,i){const s=J.get(e);s?null!=t&&null!=s[t]?s[t]?.cache.delete(i):L.deleteBlock(e,i):null==t&&L.deleteBlock(e,i)}var $=i(620),V=i(34084),Y=i(26852),K=i(32876),X=i(27064),Q=i(95247),Z=i(56156);let ee=0,te=class extends((0,N.g)(P.am)){constructor(){super(...arguments),this._tileFetchQueue=new X.K({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,A.AJ)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:O.c.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,A.eU)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+ee++}set url(e){this._set("url",(0,R.oR)(e,o.c.getLogger(this)))}async open(e){throw new a.c("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,s={}){const n=s.tileInfo||this.rasterInfo.storageInfo.tileInfo,r=this.getTileExtentFromTileInfo(e,t,i,n);return s={noClip:!0,...s},this.fetchPixels(r,n.size[0],n.size[1],s)}async identify(e,t={}){e=(0,f.uY)(B.c,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:s}=t,{rasterInfo:n}=this,{hasMultidimensionalTranspose:r,multidimensionalInfo:a}=n;let{transposedVariableName:o}=t;const l=null!=a&&r&&(null!=s||(0,z.eY)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=n,{datumTransformation:h}=t;let p=(0,A.C_)(e,c,h);if(!u.intersects(p))return{location:p,value:null};if(null!=n.transform){const e=n.transform.inverseTransform(p);if(!n.nativeExtent.intersects(e))return{location:e,value:null};p=e}let d=0;const m=null!=o&&null!=a&&n.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(m)return e.identify(p,t);const{pixelSize:s}=n,r=3,a=s.x*r/2,o=s.y*r/2,l=new Q.c({xmin:p.x-a,xmax:p.x+a,ymin:p.y-o,ymax:p.y+o,spatialReference:c}),u={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:h}=await e.fetchPixels(l,r,r,u),{pixelBlock:f}=await this.fetchPixels(l,r,r,u);if(null==h)return{location:p,value:null};const d=Math.floor(r*r*.5),y=!h.mask||h.mask[d]?h.pixels.map((e=>e[d])):null;let g;return null!=f&&(g=!f.mask||f.mask[d]?f.pixels.map((e=>e[d])):void 0),{location:p,value:y,processedValue:g,pyramidLevel:0}}if(!m)if(t.srcResolution)d=(0,A.eW)(t.srcResolution,n,this.ioConfig.sampling).pyramidLevel;else if(d=await this.computeBestPyramidLevelForLocation(e,t),null==d)return{location:p,value:null};const y=this.identifyPixelLocation(p,d,null,m);if(null===y)return{location:p,value:null};const{row:g,col:x,rowOffset:w,colOffset:_,blockWidth:v}=y,b=o??t.sliceId,I=H(this.rasterId,b),S=`${d}/${g}/${x}`;let R=W(I,null,S);null==R&&(R=this.fetchRawTile(d,g,x,t),j(I,null,S,R));const T=await R;if(!T?.pixels?.length)return{location:p,value:null};const k=w*v+_;return this._processIdentifyResult(T,{srcLocation:p,position:k,pyramidLevel:d,useTransposedTile:!!m,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,s={}){e=(0,A.eo)(e),s=this._getRequestOptionsWithSliceId(s);const{_hasNoneOrGCSShiftTransform:n}=this;if(s.requestRawData&&n)return this._fetchPixels(e,t,i,s);const r=(0,A.eU)(e.spatialReference),a=(0,A._B)(e);if(null==r||0===a||1===a&&this._isGlobalWrappableSource&&n)return this._fetchPixels(e,t,i,s);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(r/(c-l)*t),h=u-Math.round((r/2-l)/(c-l)*t);let f=0;const p=[];for(let n=0;n<=a;n++){const d=new Q.c({xmin:0===n?l:-r/2,xmax:n===a?c-r*n:r/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),m=0===n?u-h:n===a?t-f:u;f+=m,p.push(m);const y=s.disableWrapAround&&n>0?null:this._fetchPixels(d,m,i,s);o.push(y)}const d=(await Promise.all(o)).map((e=>e?.pixelBlock));let m=null;const y={width:t,height:i};return m=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:d,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:p},s)).pixelBlock:(0,Y.Gw)(d,y,{blockWidths:p}),{extent:e,srcExtent:(0,A.yM)(e,this.rasterInfo.spatialReference,s.datumTransformation),pixelBlock:m}}async fetchRawPixels(e,t,i,s={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const n=await this._fetchRawTiles(e,t,i,s),{nativeExtent:r,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new Q.c({xmin:r.xmin+c*t.x,xmax:r.xmin+c*(t.x+i.width-1),ymin:r.ymax-u*(t.y+i.height-1),ymax:r.ymax-u*t.y,spatialReference:r.spatialReference});if(!n)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:p}=n;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:n.pixelBlocks[0]};const d=e>0?o.pyramidBlockWidth:o.blockWidth,m=e>0?o.pyramidBlockHeight:o.blockHeight,y={x:t.x%d,y:t.y%m};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:p,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:s.interpolation,alignmentInfo:null,blockWidths:null},s)).pixelBlock:(0,Y.Gw)(f,p,{clipOffset:y,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,i,s){throw new a.c("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,A.yM)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,V.Y)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:s}=this.ioConfig,{range:n,query:r,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await(0,v.c)(e,{...t,query:{...r,...s},headers:{...a,...o}})}catch(s){if(i>0)return i--,this.request(e,t,i);throw s}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,z.Yt)(e,t)}getTileExtentFromTileInfo(e,t,i,s){const n=s.lodAt(e);return this.getTileExtent({x:n.resolution,y:n.resolution},t,i,s.origin,s.spatialReference,s.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:s}=this.rasterInfo;if(!e.tileInfo){const n=[],r=e.maximumPyramidLevel||0;let a=Math.max(s.x,s.y),o=1/.0254*96*a;for(let e=0;e<=r;e++)n.unshift(new D.c({level:r-e,resolution:a,scale:o})),a*=2,o*=2;const l=new B.c({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new O.c({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:n}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,s){const{width:n,height:r,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new B.c({x:a.xmin,y:a.ymax,spatialReference:l});null==s&&(s=Math.max(0,Math.round(Math.log(Math.max(n,r))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],s);e.storageInfo=new E.c({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:s,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,s,n,r=0,a=2){if(1===n.length&&r>0){n=[...n];let{x:e,y:t}=n[0];for(let i=0;i<r;i++)e*=a,t*=a,n.push({x:e,y:t})}const o=[],{x:l,y:c}=s;for(let s=0;s<n.length;s++){const{x:r,y:a}=n[s];o.push({minCol:Math.floor((e.xmin-l+.1*r)/t/r),maxCol:Math.floor((e.xmax-l-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:s}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const n=s**e;return{x:t.x*n,y:t.y*n}}identifyPixelLocation(e,t,i,s){const{spatialReference:n,nativeExtent:r,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=s&&null!=c?c.tileSize[0]:a.blockWidth,h=s&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,A.C_)(e,n,i);if(!r.intersects(f))return null;if(t<0||t>o)return null;const p=this.getPyramidPixelSize(t),{x:d,y:m}=p,y=(l.y-f.y)/m/h,g=(f.x-l.x)/d/u,x=Math.min(h-1,Math.floor((y-Math.floor(y))*h)),w=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(y),col:Math.floor(g),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,s,n,r){const[a,o]=r,l=s.x+i*a*e.x,c=l+a*e.x,u=s.y-t*o*e.y,h=u-o*e.y;return new Q.c({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:n})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const s=this.rasterInfo.storageInfo.blockBoundary[e];return!s||s.maxRow<t||s.maxCol<i||s.minRow>t||s.minCol>i}updateImageSpaceRasterInfo(e){const{extent:t,pixelSize:i}=e;if(-.5===t.xmin&&.5===t.ymax&&1===i.x&&1===i.y&&null==e.transform)return;const{width:s,height:n}=e,r=Z.c.WebMercator;e.spatialReference=r,e.extent=e.nativeExtent=new Q.c({xmin:-.5,ymax:.5,xmax:s-.5,ymin:.5-n,spatialReference:r}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new B.c({x:1,y:1,spatialReference:r});const{extent:a,storageInfo:o}=e;if(o){o.origin=new B.c({x:a.xmin,y:a.ymax,spatialReference:r});const{tileInfo:t}=o;if(t){t.origin=o.origin;const i=(e.nativePixelSize.x+e.nativePixelSize.y)/2;t.lods.forEach(((e,t)=>{e.resolution=i*2**t,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,s={}){let n=(0,A._B)(e);if(n>=2)return{extent:e,pixelBlock:null};const r=this._getSourceDataInfo(e,t,i,s),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=r;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,p=f.transform,d="gcs-shift"===p?.type,m=null!=(0,A.eU)(e.spatialReference);!d&&m||(n=(0,A._B)(r.srcExtent,d));const y=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:n},s);if(!y)return{extent:e,srcExtent:l,pixelBlock:null};const g=f.storageInfo,x=a>0?g.pyramidBlockWidth:g.blockWidth,w=a>0?g.pyramidBlockHeight:g.blockHeight;let{x:_,y:v}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[a-1])({x:_,y:v}=e[a-1]);else{const e=t**a;_*=e,v*=e}}const b=f.spatialReference,I=new B.c({x:_,y:v,spatialReference:b}),S=x===c&&w===u&&h.x%x==0&&h.y%w==0,R=new B.c({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),T=!e.spatialReference.equals(b),k=b.isGeographic?1e-9:1e-4,{datumTransformation:q}=s;if(!T&&S&&1===y.pixelBlocks.length&&x===t&&w===i&&this._isSameResolution(o,R,k))return{extent:e,srcExtent:l,srcTilePixelSize:I,pixelBlock:y.pixelBlocks[0]};const C=m&&null!=(0,A.eU)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,M=s.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");M&&!this.rasterJobHandler&&await(0,A.AJ)();const O=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R.toJSON(),datumTransformation:q,rasterTransform:p,hasWrapAround:n>0||C,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:M},s):(0,A.iG)({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R,datumTransformation:q,rasterTransform:p,hasWrapAround:n>0||C,isAdaptive:!1,includeGCSGrid:M});let F;const P=!s.requestRawData,N={rows:O.spacing[0],cols:O.spacing[1]},D=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,y.extent.xmin):void 0,{pixelBlocks:E,mosaicSize:z,isPartiallyFilled:J}=y;let L=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:E,srcMosaicSize:z,destDimension:P?{width:t,height:i}:null,coefs:P?O.coefficients:null,sampleSpacing:P?N:null,projectDirections:M,gcsGrid:M?O.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:s.interpolation,alignmentInfo:D,blockWidths:null},s);({pixelBlock:F,localNorthDirections:L}=e)}else{const e=(0,Y.Gw)(E,z,{alignmentInfo:D});F=P?(0,Y.S0)(e,{width:t,height:i},O.coefficients,N,s.interpolation):e,M&&O.gcsGrid&&(L=(0,Y.O8)({width:t,height:i},O.gcsGrid),F=(0,K.UB)(F,this.rasterInfo.dataType,L))}return s.requestRawData||M?{extent:e,srcExtent:l,srcTilePixelSize:I,pixelBlock:F,transformGrid:O,localNorthDirections:L,isPartiallyFilled:J}:{extent:e,srcExtent:l,srcTilePixelSize:I,pixelBlock:F}}async _fetchRawTiles(e,t,i,s){const{origin:n,blockBoundary:r}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const p=this._getRasterTileAlignmentInfo(e,0);s.buffer&&(l-=s.buffer.cols,c-=s.buffer.rows,u+=2*s.buffer.cols,h+=2*s.buffer.rows);let d=0,m=0,y=0;f&&null!=p&&(({worldColumnCountFromOrigin:m,originColumnOffset:y,rightPadding:d}=p),m*p.blockWidth-d>=l+u&&(d=0));const g=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+d-1)/a),_=Math.floor((c+h+d-1)/o),v=r[e];if(!v)return null;const{minRow:b,minCol:I,maxCol:S,maxRow:R}=v;if(0===f&&(_<b||w<I||x>R||g>S))return null;const T=new Array;let k=!1;const q=null==this.ioConfig.allowPartialFill?s.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=_;t++)for(let i=g;i<=w;i++){let n=i;if(!s.disableWrapAround&&f&&null!=p&&m<=i&&(n=i-m-y),t>=b&&n>=I&&R>=t&&S>=n){const i=this._tileFetchQueue.push({pyramidLevel:e,row:t,col:n,options:s},{signal:s.signal});q?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{k=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const C=await Promise.all(T),M={height:(_-x+1)*o,width:(w-g+1)*a},{spatialReference:O}=this.rasterInfo,F=this.getPyramidPixelSize(e),{x:P,y:N}=F;return{extent:new Q.c({xmin:n.x+g*a*P,xmax:n.x+(w+1)*a*P,ymin:n.y-(_+1)*o*N,ymax:n.y-x*o*N,spatialReference:O}),pixelBlocks:C,mosaicSize:M,isPartiallyFilled:k}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,s){const n=this.rasterInfo.storageInfo.blockBoundary[e];if(!n)return Promise.resolve(null);const{minRow:r,minCol:a,maxCol:o,maxRow:l}=n;if(t<r||i<a||t>l||i>o)return Promise.resolve(null);const u=H(this.rasterId,s.sliceId),h=`${e}/${t}/${i}`;let f=W(u,s.registryId,h);if(null==f){const n=new AbortController;f=this.fetchRawTile(e,t,i,{...s,signal:n.signal}),j(u,s.registryId,h,f,n),f.catch((()=>U(u,s.registryId,h)))}return s.signal&&(0,c.wD)(s,(()=>{G(u,s.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const s=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[n,r]=e,a=[],o=[];for(let e=0;e<s;e++){const[t,i]=(0,K.KO)([n[e],r[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=(0,A.Sm)(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,s={}){const n={datumTransformation:s.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};s.srcResolution&&(n.srcResolution=s.srcResolution,this._updateSourceDataInfo(e,n));const r=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=n,c=a/t,u=o/i,h=l<r&&c*u>=16,f=l===r&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new B.c({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,A.K_)(a,this.rasterInfo.spatialReference,e,n.datumTransformation);const f=!o||s.srcResolution&&o.x+o.y<s.srcResolution.x+s.srcResolution.y;if(h&&s.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(r-l+3>=e){const t=2**e;o={x:s.srcResolution.x*t,y:s.srcResolution.y*t}}}o&&(n.srcResolution=o,this._updateSourceDataInfo(e,n))}return this._requireTooManySrcTiles(n.srcWidth,n.srcHeight,t,i)&&(n.srcWidth=0,n.srcHeight=0),n}_requireTooManySrcTiles(e,t,i,s){const{tileInfo:n}=this.rasterInfo.storageInfo,r=e/i,a=t/s;return Math.ceil(e/n.size[0])*Math.ceil(t/n.size[1])>=256*Math.max(1,(i+s)/1024)||r>8||a>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,s=i.spatialReference,{srcResolution:n,datumTransformation:r}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,A.eW)(n,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,A.yM)(e,s,r);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,p=Math.floor((c.xmin-h)/o.x+.1),d=Math.floor((f-c.ymax)/o.y+.1),m=Math.floor((c.xmax-h)/o.x-.1),y=Math.floor((f-c.ymin)/o.y-.1),g=c.width<.1*o.x?0:m-p+1,x=c.height<.1*o.y?0:y-d+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=g,t.srcHeight=x,t.ul={x:p,y:d}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:s,pyramidLevel:n,useTransposedTile:r}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[s])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!r){const t=e.pixels.map((e=>e[s])),r={location:i,value:t,pyramidLevel:n},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(r.magdirValue=a.map((e=>e[0]))),r}let l=e.pixels.map((e=>e.slice(s*a,s*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,z.CI)(o,h.transposedVariableName);if(u){const e=(0,z.W0)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const p=e.noDataValues||this.rasterInfo.noDataValue,d={pixels:l,pixelType:e.pixelType};let m;return null!=p&&((0,$.cF)(d,p),m=d.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===m?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new k.c({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:n}}};(0,s._)([(0,h.qq)()],te.prototype,"_rasterTileAlignmentInfo",void 0),(0,s._)([(0,h.qq)()],te.prototype,"_tileFetchQueue",void 0),(0,s._)([(0,h.qq)({readOnly:!0})],te.prototype,"_isGlobalWrappableSource",null),(0,s._)([(0,h.qq)({readOnly:!0})],te.prototype,"_hasNoneOrGCSShiftTransform",null),(0,s._)([(0,h.qq)()],te.prototype,"rasterJobHandler",null),(0,s._)([(0,h.qq)({readOnly:!0})],te.prototype,"rasterId",null),(0,s._)([(0,h.qq)(T.qW)],te.prototype,"url",null),(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],te.prototype,"datasetName",void 0),(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],te.prototype,"datasetFormat",void 0),(0,s._)([(0,h.qq)()],te.prototype,"hasUniqueSourceStorageInfo",void 0),(0,s._)([(0,h.qq)()],te.prototype,"rasterInfo",void 0),(0,s._)([(0,h.qq)()],te.prototype,"ioConfig",void 0),(0,s._)([(0,h.qq)()],te.prototype,"sourceJSON",void 0),te=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.BaseRaster")],te);const ie=te;var se=i(24296),ne=i(66820);async function re(e,t,s){if("extent"===s.type)return function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n;if(i.width/a<.5||i.height/o<.5)return new ne.c({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:p,ymin:d,ymax:m}=i,y=Math.max(l,f),g=Math.min(c,p),x=Math.max(u,d),w=Math.min(h,m),_=.5*a,v=.5*o;if(g-y<_||w-x<v||g<l+_||y>c-_||x>h-v||w<u+v)return new ne.c({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});const b=Math.max(0,(y-l)/a),I=Math.min(s,Math.max(0,(g-l)/a)),S=Math.max(0,(h-w)/o),R=Math.min(n,Math.max(0,(h-x)/o)),T=Math.round(b),k=Math.round(I)-1,q=Math.round(S),C=Math.round(R)-1;if(T===k&&b%1>.5&&I%1<.5||q===C&&S%1>.5&&R%1<.5)return new ne.c({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]});if(0===T&&0===q&&k===s&&C===n)return e;const M=e.mask;for(let e=q;e<=C;e++)for(let t=T;t<=k;t++){const i=e*s+t;r[i]=M?M[i]:255}return new ne.c({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s);const{width:n,height:r}=e,a=new Uint8Array(n*r),{contains:o,intersects:l}=await Promise.all([i.e(984),i.e(7016)]).then(i.bind(i,57016));return l(t,s)?"polyline"===s.type?function(e,t,i){const{width:s,height:n}=e,r=new Uint8Array(s*n),a=t.width/s,o=t.height/n,{xmin:l,ymax:c}=t,{paths:u}=i,h=e.mask;for(let e=0;e<u.length;e++){const t=u[e];for(let e=0;e<t.length-1;e++){const[i,u]=t[e],[f,p]=t[e+1];let d=Math.floor((c-u)/o),m=Math.floor((c-p)/o);if(m<d){const e=d;d=m,m=e}d=Math.max(0,d),m=Math.min(n-1,m);const y=(f-i)/(p-u);for(let e=d;e<=m;e++){const t=e===d?Math.max(u,p):(n+1-e)*o,c=e===m?Math.min(u,p):t-o;let g=p===u?Math.floor((i-l)/a):Math.floor((y*(t-u)+i-l)/a),x=p===u?Math.floor((f-l)/a):Math.floor((y*(c-u)+i-l)/a);if(x<g){const e=g;g=x,x=e}const w=e*s;g=Math.max(0,g),x=Math.min(s-1,x);for(let e=w+g;e<=w+x;e++)r[e]=h?h[e]:255}}}return new ne.c({pixelType:e.pixelType,width:s,height:n,mask:r,pixels:[...e.pixels]})}(e,t,s):o(s,t)?e:function(e,t,i){if(!e)return e;const{width:s,height:n}=e,r=t.width/s,a=t.height/n,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/r,t=(i.xmax-o)/r,s=(l-i.ymax)/a,n=(l-i.ymin)/a;c=[[[e,s],[e,n],[t,n],[t,s],[e,s]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/r,(l-t)/a]))));const u=document.createElement("canvas");u.width=s,u.height=n;const h=u.getContext("2d");h.fillStyle="#f00",h.beginPath(),c.forEach((e=>{h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath()})),h.fill();const f=h.getImageData(0,0,s,n).data,p=e.mask,d=s*n,m=new Uint8Array(d);for(let e=0;e<d;e++)p&&!p[e]||(m[e]=f[4*e+3]>127?255:0);return new ne.c({pixelType:e.pixelType,width:s,height:n,mask:m,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,s):new ne.c({pixelType:e.pixelType,width:n,height:r,mask:a,maskIsAlpha:!1,pixels:[...e.pixels]})}var ae=i(59500);let oe=class extends ie{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:s}=this.primaryRasters,n=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(n);const r=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:r,rasterIds:s});if(t.rawSourceRasterInfos=r,!o.success||0===r.length)throw new a.c("raster-function:open",`cannot bind the function: ${o.error??""}`);const l="Table"===t.functionName?t:t.functionArguments?.raster;"Table"===l?.functionName&&(t.rasterInfo.attributeTable=ae.c.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=r[0];this.hasUniqueSourceStorageInfo=1===r.length||r.slice(1).every((e=>this._hasSameStorageInfo(e,c))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo),await this._updateClipGeometry()}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,s={}){const{rasters:n,rasterIds:r}=this.primaryRasters;let a=!1;const{interpolation:o}=s,l=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!s.requestRawData&&l&&(a=1===n.length&&!s.skipRasterFunction,s={...s,interpolation:"bilinear",requestRawData:a});const c=n.map((n=>n.fetchPixels(e,t,i,s))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||s.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(s.skipRasterFunction||h.every((e=>null==e)))return u[0];const p=u.find((e=>null!=e.pixelBlock))?.extent??e;let d=this.rasterJobHandler?await this.rasterJobHandler.process({extent:p,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r}):this.rasterFunction.process({extent:p,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:r});const{transformGrid:m}=u[0];if(!a||null==d||null==m){const e=s.noClip?null:this.getClippingGeometry(p.spatialReference);return s.noClip||s.requestRawData||null==d||!e||(d=await re(d,p,e)),{...u[0],pixelBlock:d}}const y={rows:m.spacing[0],cols:m.spacing[1]};let g;g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[d],srcMosaicSize:{width:d.width,height:d.height},destDimension:{width:t,height:i},coefs:m.coefficients,sampleSpacing:y,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},s)).pixelBlock:(0,Y.S0)(d,{width:t,height:i},m.coefficients,y,o);const x=s.noClip?null:this.getClippingGeometry(e.spatialReference);return s.noClip||s.requestRawData||null==g||null==x||(g=await re(g,e,x)),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:g}}getClippingGeometry(e){const t=this._clippingGeometry.get("0");if(!e||!t)return t;const i=this._getSRKey(e);let s=this._clippingGeometry.get(i);return null!=s||(s=e.equals(t.spatialReference)?t:(0,A.aG)(t,e),this._clippingGeometry.set(i,s)),s}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:s,spatialReference:n,extent:r}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return s.x===o.x&&s.y===o.y&&n.equals(l)&&r.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}async _updateClipGeometry(){const e=this.rasterFunction.getClippingGeometries()[0];let t=e?.clippingGeometry;if(t&&"inside"===e.clippingType){const{extent:e}=this.rasterInfo,{difference:s,densify:n}=await Promise.all([i.e(984),i.e(7016)]).then(i.bind(i,57016));let r=n(F.c.fromExtent(e),2*(e.width+e.height)/40);r=(0,A.aG)(r,t.spatialReference),t=s(r,t)}this._clippingGeometry.clear(),t&&this._clippingGeometry.set("0",t)}_getSRKey(e){return String(e.wkid??e.wkt??e.wkt2)}};(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],oe.prototype,"datasetFormat",void 0),(0,s._)([(0,h.qq)()],oe.prototype,"tileType",void 0),(0,s._)([(0,h.qq)()],oe.prototype,"rasterFunction",void 0),(0,s._)([(0,h.qq)()],oe.prototype,"primaryRasters",void 0),oe=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.FunctionRaster")],oe);const le=oe;var ce=i(89004),ue=i(72116),he=i(40996),fe=i(61944),pe=i(65680),de=i(46320);const me=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}get rasterInfo(){return(0,b.y2)(o.c.getLogger(this),"rasterInfo",{replacement:"serviceRasterInfo",version:"4.29",warnOnce:!0}),this._get("serviceRasterInfo")}set url(e){this._set("url",(0,R.oR)(e,o.c.getLogger(this)))}set renderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("renderer",e),this.updateRenderer())}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer;return(0,_.gH)(s,i)||void 0}async convertVectorFieldData(e,t){const{serviceRasterInfo:i}=this;if(null==e||!i)return null;const s=this._rasterJobHandler.instance,n=i.dataType;return s?s.convertVectorFieldData({pixelBlock:e,dataType:n},t):(0,K.Ws)(e,n)}async computeStatisticsHistograms(e,t){e=(0,f.uY)(pe.c,e).clone();const{serviceRasterInfo:i}=this,{geometry:s}=e;if(null==s)throw new a.c("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:r}=i;s.spatialReference.equals(r)||(await(0,A.AJ)(),n="extent"===s.type?(0,A.yM)(s,r):(0,A.aG)(s,r));const o=e.pixelSize??new B.c({x:i.pixelSize.x,y:i.pixelSize.y,spatialReference:r}),{extent:l,width:c,height:u}=function(e,t,i,s=!0){const{spatialReference:n}=e,{x:r,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,se.k8)(e.spatialReference),s=(0,se.k8)(t);if(i===s)return e;const n=i/s;return{x:e.x*n,y:e.y*n}}(i,n);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:p,ymin:d}=u;const{xmin:m,ymax:y}=e.extent;return s?(h=m+(h>m?r*Math.round((h-m)/r):0),p=y-(p<y?a*Math.round((y-p)/a):0),f=m+(f>m?r*Math.round((f-m)/r):0),d=y-(d<y?a*Math.round((y-d)/a):0),o=new Q.c({xmin:h,ymax:p,xmax:f,ymin:d,spatialReference:n}),l=Math.round(o.width/r),c=Math.round(o.height/a)):(l=Math.floor((f-h)/r+.8),c=Math.floor((p-d)/a+.8),h=m+(h>m?r*Math.floor((h-m)/r+.1):0),p=y-(p<y?a*Math.floor((y-p)/a+.1):0),f=h+l*r,d=p-c*a,o=new Q.c({xmin:h,ymax:p,xmax:f,ymin:d,spatialReference:n})),{extent:o,width:l,height:c}}(i,n,o),h=await this.fetchPixels(l,c,u,{...t,interpolation:"nearest"});if(null==h.pixelBlock)throw new a.c("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const p=await re(h.pixelBlock,l,n),d=this._rasterJobHandler.instance;return d?d.computeStatisticsHistograms({pixelBlock:p},t):(0,ue.SA)(p)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,de.__)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;i?.length||(i=(0,z.Qz)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const s=e.timeExtent||this.timeExtent;if(null!=i&&null!=s&&(null!=s.start||null!=s.end)){i=i.map((e=>e.clone()));const n=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),r=i.find((({dimensionName:e})=>"StdTime"===e));if(!n||!r)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=s,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=n.values){const e=n.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>{const i=Array.isArray(e)?e[0]:e,s=Array.isArray(e)?e[1]:e,n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:t;return u===h?i-n:Math.abs(s-h)-Math.abs(r-h)}))[0];r.values=[t]}else i=null}else if(n.hasRegularIntervals&&n.extent){const[e,t]=n.extent;u>t||h<e?i=null:r.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,z.ec)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if(!this.loaded||"imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",C.c.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:s}=this;if(s){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const n=(0,ce.Su)(s.functionDefinition?.toJSON()??s.toJSON(),i),r=new le({rasterFunction:n});r.rasterJobHandler=this._rasterJobHandler.instance,await r.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=r}else this.raster=t,this._cachedRasterFunctionJson=null,await t.when();if(this._cachedRendererJson=null,!i&&!s)return;const{bandIds:n}=this,{bandCount:r}=this.raster.rasterInfo,a=n?.length?n.some((e=>e>=r)):r>=3;n&&(a||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:i}=this.raster,s=(0,z.Dh)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name,r=(0,he.uw)({...this.renderer.toJSON(),variableName:n});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(r))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,he.IF)(i,n),t.rendererJSON=r,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=r)}async applyRenderer(e,t){const i=e?.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let s;await this.updateRenderer();const n=this._rasterJobHandler.instance,r=this.bandIds??[];return s=n?await n.symbolize({...e,simpleStretchParams:t,bandIds:r}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:r}),s}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const s=(0,S.Nq)(e);return O.c.create({size:256,spatialReference:e,origin:s?{x:s.origin[0],y:s.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,s,n={}){if(i(this),n.requestAsImageElement){const i=this.getTileUrl(e,t,s);return(0,v.c)(i,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then((e=>e.data))}const{serviceRasterInfo:r}=this;if(null!=r.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition){const i=n.tileInfo||r.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,s,i),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,s,n)}async fetchPixels(e,t,i,s={}){return null!=this.serviceRasterInfo.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,s))}async identify(e,t={}){const{raster:i,serviceRasterInfo:s}=this;if(null!=s.multidimensionalInfo&&!(s.hasMultidimensionalTranspose&&((0,z.eY)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new a.c("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return(0,z.aQ)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,z.Qz)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new M.c;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{i(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){i(this);const{raster:e}=this,t=(0,he.Mh)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){i(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,he.oh)(t));const s=(0,z.Dh)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=s?.name;if(!this.renderer||"override"===e){const e=(0,he.i)(t,{bandIds:this.bandIds,variableName:n}),i=t.statistics,s=i&&i.length>0?i[0]:null,r=s?.max??0,a=s?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(r>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const r=(0,he.uw)({...this.renderer.toJSON(),variableName:n}),a=(0,he.IF)(t,n);this.symbolizer?(this.symbolizer.rendererJSON=r,this.symbolizer.rasterInfo=a):this.symbolizer=new fe.c({rendererJSON:r,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=(0,he.i)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else o.c.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function i(e){if(!e.raster||!e.serviceRasterInfo)throw new a.c("imagery-tile","no raster")}return(0,s._)([(0,h.qq)({clonable:!1})],t.prototype,"_cachedRendererJson",void 0),(0,s._)([(0,h.qq)({clonable:!1})],t.prototype,"_cachedRasterFunctionJson",void 0),(0,s._)([(0,h.qq)({clonable:!1})],t.prototype,"_compatibleFullExtent",void 0),(0,s._)([(0,h.qq)({clonable:!1})],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,s._)([(0,h.qq)({clonable:!1})],t.prototype,"_rasterJobHandler",void 0),(0,s._)([(0,h.qq)()],t.prototype,"bandIds",void 0),(0,s._)([(0,h.qq)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,s._)([(0,h.qq)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,s._)([(0,h.qq)()],t.prototype,"interpolation",void 0),(0,s._)([(0,h.qq)()],t.prototype,"ioConfig",void 0),(0,s._)([(0,h.qq)({type:[k.c],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,s._)([(0,h.qq)({type:q.c,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,s._)([(0,h.qq)()],t.prototype,"raster",void 0),(0,s._)([(0,h.qq)({type:C.c,json:{name:"renderingRule",write:!0}})],t.prototype,"rasterFunction",null),(0,s._)([(0,h.qq)({readOnly:!0})],t.prototype,"rasterInfo",null),(0,s._)([(0,h.qq)()],t.prototype,"serviceRasterInfo",void 0),(0,s._)([(0,h.qq)()],t.prototype,"sourceJSON",void 0),(0,s._)([(0,h.qq)({readOnly:!0,type:Z.c,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,s._)([(0,h.qq)({type:O.c})],t.prototype,"tileInfo",void 0),(0,s._)([(0,h.qq)(T.qW)],t.prototype,"url",null),(0,s._)([(0,h.qq)({types:_._0,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:_.qk,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],t.prototype,"renderer",null),(0,s._)([(0,I.E)("renderer")],t.prototype,"readRenderer",null),(0,s._)([(0,h.qq)({clonable:!1})],t.prototype,"symbolizer",void 0),t=(0,s._)([(0,m.c)("esri.layers.ImageryTileMixin")],t),t};var ye=i(66576),ge=i(98768),xe=i(26916),we=i(3116),_e=i(19560),ve=i(600),be=i(59520),Ie=i(64896),Se=i(77008);function Re(e){const t=e.fields,i=e.records,s=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",n=[{name:s,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),r=n.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[s]=o++,l=1;l<r.length;l++)t[r[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:n,features:a}}class Te{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const s=t.getUint32(4,!0),n=t.getUint16(8,!0),r=t.getUint16(10,!0),a={version:i,recordCount:s,headerByteCount:n,recordByteCount:r};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,Se.M)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<s&&e.byteLength-o>r;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,Se.M)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const s=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(s.substring(0,4),10),parseInt(s.substring(4,6),10)-1,parseInt(s.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=r}}return{header:a,fields:l,records:c,recordSet:Re({fields:l,records:c})}}}var ke=i(95280);const qe=new Map;qe.set("int16","esriFieldTypeSmallInteger"),qe.set("int32","esriFieldTypeInteger"),qe.set("int64","esriFieldTypeInteger"),qe.set("float32","esriFieldTypeSingle"),qe.set("float64","esriFieldTypeDouble"),qe.set("text","esriFieldTypeString");let Ce=class extends ie{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new a.c("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:s}=this._parseHeader(t);if("thematic"===s.dataType){const e=await this._fetchAuxiliaryInformation();s.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",s),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,s={}){const{transposeInfo:n}=this.rasterInfo.storageInfo,{transposedVariableName:r}=s,a=!(!n||!r),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,s.multidimensionalDefinition,r),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:s.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const p=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:s.signal});if(!p)return null;const[d,m]=this._getTileSize(a);return this.decodePixelBlock(p.data,{width:d,height:m,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,colormap:s,blockWidth:n,blockHeight:r,firstPyramidLevel:a,maximumPyramidLevel:o}=e,l=e.statistics?.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),c=e.histograms?.[0]?.counts?.length?e.histograms:null,u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new Z.c(u?.wkid||u?.wkt||u?.wkt2?u:h);let p=new Q.c({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const d=new B.c({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),m=Math.round((p.xmax-p.xmin)/d.x),y=Math.round((p.ymax-p.ymin)/d.y),g=this._parseTransform(e.geodataXform),x=g?p:null;g&&(p=g.forwardTransform(p),d.x=(p.xmax-p.xmin)/m,d.y=(p.ymax-p.ymin)/y);const w=e.properties??{},_=e.format.toLowerCase().replace("cache/",""),v=new B.c(e.origin.x,e.origin.y,f);let b,I,S,R;if(s?.colors)for(b=[],I=0;I<s.colors.length;I++)S=s.colors[I],R=s.values?s.values[I]:I,b.push([R,255&S,S<<16>>>24,S<<8>>>24,S>>>24]);const T=e.LODInfos,k=[];for(I=0;I<T.levels.length;I++)k.push(new D.c({level:T.levels[I],resolution:T.resolutions[I],scale:96/.0254*T.resolutions[I]}));const q=new O.c({dpi:96,lods:k,format:_,origin:v,size:[n,r],spatialReference:f}),C={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},M=[{maxCol:Math.ceil(m/n)-1,maxRow:Math.ceil(y/r)-1,minCol:0,minRow:0}];let F=2;if(o>0)for(I=0;I<o;I++)M.push({maxCol:Math.ceil(m/F/n)-1,maxRow:Math.ceil(y/F/r)-1,minCol:0,minRow:0}),F*=2;const P=e.mdInfo;let N=null;if(P&&w._yxs){const e=w._yxs;N={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:C,rasterInfo:new Ie.c({width:m,height:y,pixelType:t,bandCount:i,extent:p,nativeExtent:x,transform:g,spatialReference:f,pixelSize:d,keyProperties:w,statistics:l,histograms:c,multidimensionalInfo:P,colormap:b,storageInfo:new E.c({blockWidth:n,blockHeight:r,pyramidBlockWidth:n,pyramidBlockHeight:r,origin:v,tileInfo:q,transposeInfo:N,firstPyramidLevel:a,maximumPyramidLevel:o,blockBoundary:M})})}}_parseTransform(e){if(!(0,ke._)(e))throw new a.c("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,ke.O)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new a.c("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),s=await Promise.all([t,i]);let n;if(s[0]){let e=s[0].fields;const t=s[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":qe.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(n={fields:e,features:i})}}return!n&&s[1]&&(n=Te.parse(s[1]).recordSet),ae.c.fromJSON(n)}_buildCacheFilePath(e,t,i,s,n){const r=this._getPackageSize(!!n),a=Math.floor(t/r)*r,o=Math.floor(i/r)*r,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=s?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!n){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const p=this._getVariableFolderName(n||h.variableName);return`${this.url}/_alllayers/${p}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replaceAll(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const s=this._getPackageSize(i),n=s*(e%s)+t%s;if(n<0)throw new Error("Invalid level / row / col");return 20+n*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let s,n=0;for(s=0;s<5;s++)n|=(255&i[s])<<8*s;const r=0xffffffffff&n;for(n=0,s=5;s<8;s++)n|=(255&i[s])<<8*(s-5);return{position:r,recordSize:0xffffffffff&n}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,s._)([(0,h.qq)({readOnly:!0})],Ce.prototype,"storageInfo",void 0),(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],Ce.prototype,"datasetFormat",void 0),Ce=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.CloudRaster")],Ce);const Me=Ce;var Oe=i(44728),Fe=i(89960);function Pe(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function Ne(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function De(e){const{axes:t}=e.domain,i=Object.keys(t),s=[],n=[];let r=-1,a=-1,o=[];for(let e=0;e<i.length;e++){const l=i[e];Pe(l)?r=e:Ne(l)&&(a=e);const c=t[l],u=[];if("values"in c){c.values.forEach((e=>u.push("string"==typeof e?new Date(e).getTime():e)));const e=u[1]-u[0];s.push([u[0]-.5*e,u[u.length-1]+.5*e]),n.push(e)}else{const{start:e,stop:t,num:i}=c,r=(t-e)/(i-1);s.push([e-.5*r,t+.5*r]),n.push(r);for(let t=0;t<i;t++)u.push(e+r*t)}o.push({name:l,values:u,extent:[u[0],u[u.length-1]]})}r>-1&&-1===a?a=0===r?1:0:a>-1&&-1===r?r=0===a?1:0:-1===a&&-1===r&&(r=0,a=1),o=o.filter(((e,t)=>!(t===r||t===a)));const{referencing:l}=e.domain,c=l.find((e=>e.coordinates.includes(i[r]))).system.id,u=c?.slice(c.lastIndexOf("/")+1),h=null==u||"CRS84"===u?4326:Number(u),f=new Z.c({wkid:h}),[p,d]=s[r],[m,y]=s[a],g=new Q.c({xmin:p,xmax:d,ymin:m,ymax:y,spatialReference:f});return{width:Math.round(g.width/n[r]),height:Math.round(g.height/n[a]),extent:g,dimensions:o}}function Ee(e){const t=(0,Fe.mo)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function ze(){return Math.round(255*Math.random())}function Ae(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let s=0;s<e.length;s++){const n=e[s];null!=n&&(n<t&&(t=n),n>i&&(i=n))}return(0,$.E1)(t,i)}function Be(e,t,i){const s=e.map(((e,i)=>({name:e,count:t[i]}))).sort(((e,t)=>e.name>t.name?-1:1)),n=(r=1,e=>r*=e.count);var r;const a=[...s.slice(1),{name:"",count:1}].reverse().map(n).reverse();let o=0;for(let n=e.length-1;n>=0;n--)o+=a[s.findIndex((({name:t})=>t===e[n]))]*(i%t[n]),i=Math.floor(i/t[n]);return o}let Je=class extends ie{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.source=null}get url(){return""}async open(e){await this.init();const t=this.source,{pixelBlocks:i,attributeTable:s,statistics:n,histograms:r,name:a,nativeExtent:o,transform:l}=t,c=i[0],{width:u,height:h,pixelType:f}=c,p=t.extent??new Q.c({xmin:-.5,ymin:.5,xmax:u-.5,ymax:h-.5,spatialReference:new Z.c({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,m={x:p.width/u,y:p.height/h},y={...t.keyProperties};s&&(y.DataType="Thematic");const g=new Ie.c({width:u,height:h,pixelType:f,extent:p,nativeExtent:o,attributeTable:s,transform:l,pixelSize:m,spatialReference:p.spatialReference,bandCount:c.pixels.length,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:n,isPseudoSpatialReference:d,histograms:r});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(g),this.createRemoteDatasetStorageInfo(g,512,512),this._set("rasterInfo",g),this.updateTileInfo(),g.multidimensionalInfo?await this._buildMDimStats(t.pixelBlocks,g.multidimensionalInfo):await this._buildInMemoryRaster(c,{width:512,height:512},e),g.multidimensionalInfo||(this.source=null),this.datasetName=a}fetchRawTile(e,t,i,s={}){if(!this._pixelBlockTiles){const{rasterInfo:n}=this,[r,a]=n.storageInfo.tileInfo.size,{sliceId:o}=s,{pixelBlocks:l}=this.source,c={pixelBlock:null==o?l[0]:l[o],useBilinear:"thematic"!==n.dataType,tileSize:{width:r,height:a},level:e,row:t,col:i},u=this.rasterJobHandler?this.rasterJobHandler.clipTile(c,s):(0,Y.qM)(c);return Promise.resolve(u)}const n=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(n)}async _buildInMemoryRaster(e,t,i){const{rasterInfo:s}=this,n=s.storageInfo.maximumPyramidLevel??0,r="thematic"!==s.dataType,o=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n,useBilinear:r},i):Promise.resolve((0,Y.SG)(e,t,n,r)),l=null!=s.statistics,u=null!=s.histograms,h=this.ioConfig.skipStatistics||l?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,ue.CW)(e)),f=await(0,c.Dv)([o,h]);if(!f[0].value&&f[1].value)throw new a.c("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=f[0].value,l||(s.statistics=f[1].value?.statistics),u||(s.histograms=f[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let s=0;s<t.variables.length;s++){const n=t.variables[s];if(n.statistics)continue;const r=n.dimensions.map((e=>new k.c({variableName:n.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0}))),a=(0,z.Yt)(r,t),o=null==a?null:e[a];if(null==o)continue;const l=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:o},i):(0,ue.SA)(o);n.statistics=l.statistics,n.histograms||(n.histograms=l.histograms)}}};(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],Je.prototype,"datasetFormat",void 0),(0,s._)([(0,h.qq)()],Je.prototype,"source",void 0),(0,s._)([(0,h.qq)()],Je.prototype,"url",null),Je=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.InMemoryRaster")],Je);const Le=Je;let He=class extends ie{constructor(){super(...arguments),this.datasetFormat="CovJSON"}async open(e){await this.init();const{extent:t,pixelBlocks:i,multidimensionalInfo:s,attributeTable:n,bandNames:r}=await this._fetchData(e),{statistics:a,histograms:o}=(0,ue.SA)(i[0]),l=r?.map((e=>({BandName:e}))),c={DataType:n?"Thematic":s?"Scientific":"Generic",BandProperties:l},u=new Le({source:{extent:t,pixelBlocks:i,attributeTable:n?ae.c.fromJSON(n):null,multidimensionalInfo:s,statistics:a,histograms:o,keyProperties:c,isPseudoSpatialReference:!1}});await u.open(),this._inMemoryRaster=u;const h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",u.rasterInfo)}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _fetchData(e){const t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new a.c(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new a.c(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new a.c(i,"Missing domain referencing in the grid coverage data");const s=Object.values(t.ranges);for(let e=0;e<s.length;e++){const{axisNames:t,shape:n,type:r,values:o}=s[e];if(!("ndarray"===r.toLowerCase()&&o?.length&&t?.length&&n?.length))throw new a.c(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!Pe(t[t.length-1])||!Ne(t[t.length-2]))throw new a.c(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){const{width:t,height:i,extent:s,dimensions:n}=De(e),{ranges:r}=e,a=Object.keys(r).sort(((e,t)=>e<t?-1:1)),o=[];for(let e=0;e<a.length;e++){const t=a[e];n?.length&&o.push({name:t,dimensions:n})}const l=function(e){const t={},{parameters:i}=e;if(!i)return t;for(const[e,s]of Object.entries(i)){const{type:i,description:n,unit:r,categoryEncoding:a,observedProperty:o}=s;if("Parameter"===i&&(t[e]={},n&&(t[e].description=Ee(n)),r&&(t[e].unit=r.label?Ee(r.label):null,t[e].symbol=r.symbol?.value),a)){const i=Object.entries(a).map(((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})));let s=!1;o?.categories?.length&&(o.categories.forEach((e=>{if(!e.id)return;const t=e.id.slice(e.id.lastIndexOf("/")+1),n=i.find((e=>e.ClassName===t));if(!n)return;const r=e.label?Ee(e.label):null;if(n.Label=r,e.preferredColor){const t=Oe.c.fromHex(e.preferredColor);t&&(s=!0,n.Red=t.r,n.Green=t.g,n.Blue=t.b)}})),s&&i.forEach((e=>{null==e.Red&&(e.Red=ze(),e.Green=ze(),e.Blue=ze())})));const n={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map((e=>({attributes:e})))};s&&n.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=n}}return t}(e);o.forEach((e=>l[e.name]&&Object.assign(e,l[e.name])));const c=o.length?{variables:o}:void 0,u=[];for(let e=0;e<a.length;e++){const s=a[e],{values:o,dataType:l,axisNames:c,shape:h}=r[s],f=h.length>2?e*h.slice(0,-2).reduce(((e,t)=>e*t)):0,p=c.slice(0,-2),d=h.slice(0,-2),m="float"===l?"f32":Ae(o),y=t*i,g=o.length/y;for(let s=0;s<g;s++){const r=ne.c.createEmptyBand(m,y),a=new Uint8Array(y).fill(255);let l=!1;const c=s*y;for(let e=0;e<y;e++){const t=o[c+e];null==t?(a[e]=0,l=!0):r[e]=t}if(0===e||n?.length){const e=new ne.c({width:t,height:i,mask:l?a:null,pixels:[r],pixelType:m});e.updateStatistics(),n?.length?u[Be(p,d,s)+f]=e:u.push(e)}else{const e=u[s];e.pixels.push(r),l?e.mask&&(e.mask=ne.c.combineBandMasks([e.mask,a])):e.mask=l?a:null}}}const h=Object.values(l).find((e=>e.attributeTable))?.attributeTable;return{extent:s,pixelBlocks:u,multidimensionalInfo:c,attributeTable:h,bandNames:c?void 0:a}}(t)}};(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),(0,s._)([(0,h.qq)({constructOnly:!0})],He.prototype,"source",void 0),He=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.CovJSONRaster")],He);const Ge=He;var We=i(92400);function je(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const s=[];if(t){const n=je(e,i);for(let e=0;e<n.length;e++)je(n[e],t).forEach((e=>s.push(e)));return s}const n=e.getElementsByTagNameNS("*",i);if(!n||0===n.length)return[];for(let e=0;e<n.length;e++)s.push(n[e]||n.item(e));return s}function Ue(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const s=je(e,i);return s.length>0?t?Ue(s[0],t):s[0]:null}function $e(e,t=null){const i=t?Ue(e,t):e;let s;return i?(s=i.textContent||i.nodeValue,s?s.trim():null):null}function Ve(e,t){return function(e,t){const i=je(e,t),s=[];let n;for(let e=0;e<i.length;e++)n=i[e].textContent||i[e].nodeValue,n&&(n=n.trim(),""!==n&&s.push(n));return s}(e,t).map((e=>Number(e)))}function Ye(e,t){const i=$e(e,t);return Number(i)}function Ke(e,t){const i=e?.nodeName?.toLowerCase(),s=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===s}var Xe=i(79972);function Qe(e,t){if(!e||!t)return null;const i=[];for(let s=0;s<e.length;s++)i.push(e[s]),i.push(t[s]);return i}function Ze(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new Z.c({wkid:t});if(e=String(e).trim(),(0,S.If)(e))return new Z.c({wkt2:e});const i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;const s=i.indexOf("VERTCS"),n=i.indexOf("PROJCS"),r=n>-1?n:i.indexOf("GEOGCS");if(-1===r)return null;const a=e.slice(r,e.lastIndexOf("]",s)+1).trim(),o=e.slice(s,e.lastIndexOf("]")).trim();t=et(a);const l=new Z.c(t?{wkid:t}:{wkt:a}),c=et(o);return c&&(l.vcsWkid=c),l}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=et(e),new Z.c(0!==t?{wkid:t}:{wkt:e})):null}function et(e){const t=e.replaceAll("]","[").replaceAll('"',"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),s=i[0]?.toLowerCase();if(("epsg"===s||"esri"===s)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function tt(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(Ke(e,"SRS")){if(!t.spatialReference){const i=$e(e);t.spatialReference=Ze(i)}}else if(Ke(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:s}=function(e){const t=Ue(e,"GeodataXform"),i=Ze(Ye(t,"SpatialReference/WKID")||$e(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const s=Ye(t,"PolynomialOrder")??1,n=Ve(t,"CoeffX/Double"),r=Ve(t,"CoeffY/Double"),a=Ve(t,"InverseCoeffX/Double"),o=Ve(t,"InverseCoeffY/Double"),l=Qe(n,r),c=Qe(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Xe.c({spatialReference:i,polynomialOrder:s,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=s,t.spatialReference||(t.spatialReference=i)}else je(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=$e(e)));else if(Ke(e,"PAMRasterBand")){const i=function(e){const t=Ye(e,"NoDataValue"),i=Ue(e,"Histograms/HistItem"),s=Ye(i,"HistMin"),n=Ye(i,"HistMax"),r=Ye(i,"BucketCount"),a=$e(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;je(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=Ye(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=s&&null!=n?{min:s,max:n,size:r||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(We.G6):null;const s=!!i[0].histogram;t.histograms=s?i.map((e=>e.histogram)).filter(We.G6):null}return t}let it=class extends ie{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:s,histograms:n,transform:r}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new Z.c({wkid:3857})),n?.length&&null==s&&(s=(0,ue.yE)(n));const{width:o,height:l}=t;let c=new Q.c({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=r?r.forwardTransform(c):c;let h=!0;if(r){const e=r.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(r=null,c=u)}const f=new Le({source:{extent:u,nativeExtent:c,transform:r,pixelBlocks:[t],statistics:s,histograms:n,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(f.ioConfig.skipMapInfo=!0),await f.open(),f.source=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,s={}){return this._inMemoryRaster.fetchRawTile(e,t,i,s)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,V.o)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.c("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const s=i.toLowerCase(),n="gif"===s||"bmp"===s||!(0,p.c)("ios"),r=await this.decodePixelBlock(t,{format:s,useCanvas:n,hasNoZlibMask:!0});if(null==r)throw new a.c("image-aux-raster:open","the data cannot be decoded");return r}async _fetchAuxiliaryData(e){const t=e?.signal,{skipExtensions:i=[],skipMapInfo:s}=this.ioConfig,n=s||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),r=this.datasetFormat,a="JPG"===r?"jgw":"PNG"===r?"pgw":"BMP"===r?"bpw":null,o=a&&i.includes(a)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+a,{responseType:"text",signal:t}),l=await(0,c.Dv)([n,o]);if(t?.aborted)throw(0,c.Uh)();const u=tt(l[0].value?.data);if(!u.transform){const e=l[1].value?l[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;u.transform=6===e?.length?new Xe.c({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],it.prototype,"datasetFormat",void 0),it=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.ImageAuxRaster")],it);const st=it;var nt=i(70680),rt=i(28176),at=i(41464),ot=i(91288),lt=i(71599);let ct=class extends ie{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e?.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const s=i.data;if(this.sourceJSON=s,!s)throw new a.c("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!s.tileInfo)throw new a.c("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=s.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(s.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===s.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=s.name?.slice(s.name.indexOf("/")+1)??"";const n=await this._fetchRasterInfo({signal:t});if(null==n)throw new a.c("image-server-raster:open","cannot initialize image service");(0,lt.sJ)(n,s);const r="Map"===this.tileType?function(e,t){if(!e)return null;const{minScale:i,maxScale:s,minLOD:n,maxLOD:r}=t;if(null!=n&&null!=r)return O.c.fromJSON({...e,lods:e.lods.filter((({level:e})=>null!=e&&e>=n&&e<=r))});if(0!==i&&0!==s){const t=e=>Math.round(1e4*e)/1e4,n=i?t(i):1/0,r=s?t(s):-1/0;return O.c.fromJSON({...e,lods:e.lods.filter((e=>{const i=t(e.scale);return i<=n&&i>=r}))})}return O.c.fromJSON(e)}(s.tileInfo,s):O.c.fromJSON(s.tileInfo);(0,nt.EN)(r);const[o,l]=this._computeMinMaxLOD(n,r),{extent:c,pixelSize:u}=n,h=.5/n.width*u.x,f=Math.max(u.x,u.y),{lods:p}=r;("Map"!==this.tileType&&0!==s.maxScale||Math.abs(u.x-u.y)>h||!p.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,n.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),n.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const d=o.level-l.level,[m,y]=r.size,g=[],x=[];p.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&g.push({x:e.resolution,y:e.resolution}),t<p.length-1&&x.push(Math.round(10*e.resolution/p[t+1].resolution)/10)})),g.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,m,y,r.origin,g,d),_=g.length>1?g.slice(1):null;let v;s.transposeInfo&&(v={tileSize:[s.transposeInfo.rows,s.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0});const b=x.length<=1||x.length>=3&&x.slice(0,-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/d))/10;if(n.storageInfo=new E.c({blockWidth:r.size[0],blockHeight:r.size[1],pyramidBlockWidth:r.size[0],pyramidBlockHeight:r.size[1],pyramidResolutions:_,pyramidScalingFactor:b,compression:r.format,origin:r.origin,firstPyramidLevel:1,maximumPyramidLevel:d,tileInfo:r,transposeInfo:v,blockBoundary:w}),this._fixGCSShift(n),this._set("rasterInfo",n),s.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:(0,rt.as)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new at.G({layer:e})}}async fetchRawTile(e,t,i,s={}){const{storageInfo:n,extent:r}=this.rasterInfo,{transposeInfo:a}=n,o=null!=a&&!!s.transposedVariableName;if(this._slices&&!o&&null==s.sliceId)return null;const l=o?0:n.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:s.transposedVariableName}:{sliceId:s.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:s.signal});if(!h)return null;const f=o?a.tileSize:n.tileInfo.size,p=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==p)return null;const d=n.blockBoundary[e];if("jpg"!==n.compression||i>d.minCol&&i<d.maxCol&&t>d.minRow&&t<d.maxRow)return p;const{origin:m,blockWidth:y,blockHeight:g}=n,{x,y:w}=this.getPyramidPixelSize(e),_=Math.round((r.xmin-m.x)/x)%y,v=Math.round((r.xmax-m.x)/x)%y||y,b=Math.round((m.y-r.ymax)/w)%g,I=Math.round((m.y-r.ymin)/w)%g||g,S=i===d.minCol?_:0,R=t===d.minRow?b:0,T=i===d.maxCol?v:y,k=t===d.maxRow?I:g;return(0,Y.q4)(p,{x:S,y:R},{width:T-S,height:k-R}),p}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([i,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),n[1]?.[0]?.counts?.length||(n[1]=null),{statistics:n[0]||null,histograms:n[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let s=0;const{maximumPyramidLevel:n}=this.rasterInfo.storageInfo;let r=n-s+this._levelOffset;const a=i.srcLocation;for(;r>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(r,i.row,i.col,t))break}catch{}if(r--,s++,i=this.identifyPixelLocation(a,s,t.datumTransformation),null===i)return null}return-1===r||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),s=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),n=Z.c.fromJSON(t.spatialReference||e.spatialReference),r=new B.c({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:n});return new Ie.c({width:i,height:s,bandCount:3,extent:Q.c.fromJSON(e),spatialReference:n,pixelSize:r,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=(0,lt.Rk)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),n=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data?.slices)).catch((()=>null)):null,r=await Promise.all([s,n]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new ot.c,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,s=.5/e.width*i.x,{lods:n}=t,r=t.lodAt(Math.max.apply(null,n.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,n.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=n[0].level,[r,a];if("Raster"===o)return[n.find((e=>e.resolution===i.x))??r,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=n.find((e=>Math.abs(e.scale-c)<s)),u||(u=n.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??r));let h=a;return l>0&&(h=n.find((e=>Math.abs(e.scale-l)<s))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],ct.prototype,"datasetFormat",void 0),(0,s._)([(0,h.qq)()],ct.prototype,"tileType",void 0),ct=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.ImageServerRaster")],ct);const ut=ct;var ht=i(86665);const ft=new Map;ft.set("Int8","s8"),ft.set("UInt8","u8"),ft.set("Int16","s16"),ft.set("UInt16","u16"),ft.set("Int32","s32"),ft.set("UInt32","u32"),ft.set("Float32","f32"),ft.set("Float64","f32"),ft.set("Double64","f32");const pt=new Map;pt.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),pt.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),pt.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),pt.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let dt=class extends ie{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:s,files:n}=this._parseHeader(i.data),{skipMapInfo:r,skipExtensions:a=[]}=this.ioConfig;if(!a.includes("aux.xml")&&!r){const t=await this._fetchAuxiliaryData(e);null!=t&&(s.statistics=t.statistics??s.statistics,s.histograms=t.histograms,t.histograms&&null==s.statistics&&(s.statistics=(0,ue.yE)(t.histograms)))}r&&this.updateImageSpaceRasterInfo(s),this._set("rasterInfo",s),this._files=n;const o=await this.request(n.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(o.data);const{blockWidth:l,blockHeight:c}=this.rasterInfo.storageInfo,u=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:f}=this.rasterInfo,p=[],d=this._getBandSegmentCount();let m=0,y=-1;for(;m<this._storageIndex.length;){y++;const e=Math.ceil(h/l/u**y)-1,t=Math.ceil(f/c/u**y)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,y>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=y),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){const{blockWidth:n,blockHeight:r,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(n*r);return new ne.c({width:n,height:r,pixels:null,mask:e,validPixelCount:0})}const{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[];let y=0;for(y=0;y<d;y++)p&&!p.includes(y)||m.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:s.signal}));const g=await Promise.all(m),x=g.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x),_=[];let v=0;for(y=0;y<d;y++)_.push(v),w.set(new Uint8Array(g[y].data),v),v+=g[y].data.byteLength;const b=pt.get(this.rasterInfo.storageInfo.compression).decoderFormat,I=await this.decodePixelBlock(w.buffer,{width:n,height:r,format:b,planes:p?.length||l,offsets:_,pixelType:c});if(null==I)return null;let{noDataValue:S}=this.rasterInfo;if(null!=S&&"lerc"!==b&&!I.mask&&(S=S[0],null!=S)){const e=I.width*I.height,t=new Uint8Array(e);if(Math.abs(S)>1e24)for(y=0;y<e;y++)Math.abs((I.pixels[0][y]-S)/S)>1e-6&&(t[y]=1);else for(y=0;y<e;y++)I.pixels[0][y]!==S&&(t[y]=1);I.mask=t}let R=0,T=0;if(h!==n||f!==r){let e=I.mask;if(e)for(y=0;y<r;y++)if(T=y*n,y<f)for(R=h;R<n;R++)e[T+R]=0;else for(R=0;R<n;R++)e[T+R]=0;else for(e=new Uint8Array(n*r),I.mask=e,y=0;y<f;y++)for(T=y*n,R=0;R<h;R++)e[T+R]=1}return I}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,s,n,r,a;if(ht.C){for(i=new Uint8Array(e),n=new ArrayBuffer(e.byteLength),s=new Uint8Array(n),r=0;r<e.byteLength/4;r++)for(a=0;a<4;a++)s[4*r+a]=i[4*r+3-a];t=new Uint32Array(n)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return pt.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:s,blockHeight:n,pyramidScalingFactor:r}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,p=0;for(h=0;h<e;h++)p=r**h,c=Math.ceil(a/s/p),u=Math.ceil(o/n/p),f+=c*u;p=r**e,c=Math.ceil(a/s/p),u=Math.ceil(o/n/p),f+=t*c+i,f*=4*l;const d=this._storageIndex.subarray(f,f+4*l);let m=0,y=0;const g=[];for(let e=0;e<l;e++)m=d[4*e]*2**32+d[4*e+1],y=m+d[4*e+2]*2**32+d[4*e+3],g.push({from:m,to:y});return{ranges:g,actualTileWidth:i<c-1?s:Math.ceil(a/p)-s*(c-1),actualTileHeight:t<u-1?n:Math.ceil(o/p)-n*(u-1)}}_parseHeader(e){const t=Ue(e,"MRF_META/Raster");if(!t)throw new a.c("mrf:open","not a valid MRF format");const i=Ue(t,"Size"),s=parseInt(i.getAttribute("x"),10),n=parseInt(i.getAttribute("y"),10),r=parseInt(i.getAttribute("c"),10),o=($e(t,"Compression")||"none").toLowerCase();if(!pt.has(o))throw new a.c("mrf:open","currently does not support compression "+o);const l=$e(t,"DataType")||"UInt8",c=ft.get(l);if(null==c)throw new a.c("mrf:open","currently does not support pixel type "+l);const u=Ue(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),p=Ue(t,"DataValues");let d,m;if(p&&(m=p.getAttribute("NoData"),null!=m&&(d=m.trim().split(" ").map((e=>parseFloat(e))))),Ue(e,"MRF_META/CachedSource"))throw new a.c("mrf:open","currently does not support MRF referencing other data files");const y=Ue(e,"MRF_META/GeoTags"),g=Ue(y,"BoundingBox");let x,w=!1;if(null!=g){const e=parseFloat(g.getAttribute("minx")),t=parseFloat(g.getAttribute("miny")),i=parseFloat(g.getAttribute("maxx")),s=parseFloat(g.getAttribute("maxy")),n=$e(y,"Projection")||"";let r=Z.c.WGS84;if("LOCAL_CS[]"!==n)if(n.toLowerCase().startsWith("epsg:")){const e=Number(n.slice(5));isNaN(e)||0===e||(r=new Z.c({wkid:e}))}else r=Ze(n)??Z.c.WGS84;else w=!0,r=new Z.c({wkid:3857});x=new Q.c(e,t,i,s),x.spatialReference=r}else w=!0,x=new Q.c({xmin:-.5,ymin:.5-n,xmax:s-.5,ymax:.5,spatialReference:new Z.c({wkid:3857})});const _=Ue(e,"MRF_META/Rsets"),v=parseInt(_?.getAttribute("scale")||"2",10),b=x.spatialReference,I=new E.c({origin:new B.c({x:x.xmin,y:x.ymax,spatialReference:b}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:v}),S=new B.c({x:x.width/s,y:x.height/n,spatialReference:b}),R=new Ie.c({width:s,height:n,extent:x,isPseudoSpatialReference:w,spatialReference:b,bandCount:r,pixelType:c,pixelSize:S,noDataValue:d,storageInfo:I}),T=$e(e,"datafile"),k=$e(e,"IndexFile");return{rasterInfo:R,files:{mrf:this.url,index:k||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",pt.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return tt(t)}catch{return null}}};(0,s._)([(0,h.qq)()],dt.prototype,"_files",void 0),(0,s._)([(0,h.qq)()],dt.prototype,"_storageIndex",void 0),(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],dt.prototype,"datasetFormat",void 0),dt=(0,s._)([(0,m.c)("esri.layers.support.rasterIO.MRFRaster")],dt);const mt=dt;var yt=i(4700),gt=i(30656);const xt=(e,t)=>e.get(t)?.values,wt=(e,t)=>e.get(t)?.values?.[0];let _t=class extends ie{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new a.c("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:s,firstIFDPos:n,isBigTiff:r}=(0,yt.sr)(i),l=[];await this._readIFDs(l,i,s,n,0,r?8:4,t);const{imageInfo:c,rasterInfo:u}=this._parseIFDs(l),h=(0,yt.Yj)(l),f=(0,yt.gT)(l);if(this._headerInfo={littleEndian:s,isBigTiff:r,ifds:l,pyramidIFDs:h,maskIFDs:f,...c},this._set("rasterInfo",u),!c.isSupported)throw new a.c("tiffraster:open","this tiff is not supported: "+c.message);if(!c.tileWidth)throw new a.c("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");u.isPseudoSpatialReference&&o.c.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const p=l[0].get("PREDICTOR")?.values?.[0],d=l[0].get("SAMPLEFORMAT")?.values?.[0];if(3===d&&2===p)throw new a.c("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data");const{skipMapInfo:m,skipExtensions:y=[]}=this.ioConfig;if(!y.includes("aux.xml")&&!m){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,u)}y.includes("vat.dbf")||1!==u.bandCount||"u8"!==u.pixelType||m||(u.attributeTable=await this._fetchAuxiliaryTable(e),null!=u.attributeTable&&(u.keyProperties.DataType="thematic")),m&&this.updateImageSpaceRasterInfo(u),this.updateTileInfo()}async fetchRawTile(e,t,i,s={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const n=await this._fetchRawTiffTile(e,t,i,!1,s);if(null!=n&&this._headerInfo.hasMaskBand){const r=await this._fetchRawTiffTile(e,t,i,!0,s);null!=r&&r.pixels[0]instanceof Uint8Array&&(n.mask=r.pixels[0])}return n}_parseIFDs(e){const t=(0,yt.cp)(e),{width:i,height:s,tileWidth:n,tileHeight:r,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:p,affine:d,metadata:m}=t;let y=Ze(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),g=!!t.isPseudoGeographic;null==y&&(g=!0,y=new Z.c({wkid:3857}));const x=new Q.c({...t.extent,spatialReference:y}),w=new B.c(x?{x:x.xmin,y:x.ymax,spatialReference:y}:{x:0,y:0}),_=new E.c({blockWidth:n,blockHeight:r,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:p}),v=new B.c({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:y}),b=m?{BandProperties:m.bandProperties,DataType:m.dataType}:{};let I=null;const S=wt(e[0],"PHOTOMETRICINTERPRETATION"),R=xt(e[0],"COLORMAP");if(S<=3&&R?.length>3&&R.length%3==0){I=[];const e=R.length/3;for(let t=0;t<e;t++)I.push([t,R[t]>>>8,R[t+e]>>>8,R[t+2*e]>>>8])}const T=new Ie.c({width:i,height:s,bandCount:a,pixelType:o,pixelSize:v,storageInfo:_,spatialReference:y,isPseudoSpatialReference:g,keyProperties:b,extent:x,colormap:I,statistics:m?m.statistics:null});return d?.length&&(T.nativeExtent=new Q.c({xmin:-.5,ymin:.5-s,xmax:i-.5,ymax:.5,spatialReference:y}),T.transform=new Xe.c({polynomialOrder:1,forwardCoefficients:[d[2]+d[0]/2,d[5]-d[3]/2,d[0],d[3],-d[1],-d[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new B.c({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/s,spatialReference:y}),_.origin.x=-.5,_.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,ue.yE)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new B.c({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)}async _readIFDs(e,t,i,s,n,r=4,a){if(!s)return null;(s>=t.byteLength||s<0)&&(t=(await this.request(this.url,{range:{from:s+n,to:s+n+this._bufferSize},responseType:"array-buffer",signal:a})).data,n=s+n,s=0);const o=await this._readIFD(t,i,s,n,gt.c.tiffTags,r,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-n,n,r,a)}async _readIFD(e,t,i,s,n=gt.c.tiffTags,r=4,a){if(!e)return null;const o=(0,yt.W)(e,t,i,s,n,r);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const n=i.map((e=>e.offlineOffsetSize)).filter(We.G6),r=Math.min.apply(null,n.map((e=>e[0])));if(Math.min.apply(null,n.map((e=>e[0]+e[1])))-r<=this._bufferSize){const{data:n}=await this.request(this.url,{range:{from:r,to:r+this._bufferSize},responseType:"array-buffer",signal:a});e=n,s=r,i.forEach((i=>(0,yt.Un)(e,t,i,s)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),n=i?.values;if(n&&n.length>4){const r=n[0]+"."+n[1]+"."+n[2],o=await this._readIFD(e,t,i.valueOffset+6-s,s,gt.c.geoKeys,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[r]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:s,to:s+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,s,gt.c.tiffTags,4,a)}}async _fetchRawTiffTile(e,t,i,s,n={}){const r=this._getTileLocation(e,t,i,s);if(!r)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=r,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:n.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),p=1===h.length?h[0].data:new ArrayBuffer(f),d=[0],m=[0];if(h.length>1){const e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){const s=h[t].data;e.set(new Uint8Array(s),i),d[t]=i,i+=s.byteLength,m[t]=s.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:d,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,_,v;if(o!==y||l!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(v=w*y,w<l)for(_=o;_<y;_++)e[v+_]=0;else for(_=0;_<y;_++)e[v+_]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<l;w++)for(v=w*y,_=0;_<o;_++)e[v+_]=1}return x}_getTileLocation(e,t,i,s=!1){const{firstPyramidLevel:n,blockBoundary:r}=this.rasterInfo.storageInfo,a=0===e?0:e-(n-1),{_headerInfo:o}=this;if(!o)return null;const l=s?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,yt.iE)(l,o),u=xt(l,"TILEOFFSETS");if(void 0===u)return null;const h=xt(l,"TILEBYTECOUNTS"),{minRow:f,minCol:p,maxRow:d,maxCol:m}=r[a];if(t>d||i>m||t<f||i<p)return null;const y=wt(l,"IMAGEWIDTH"),g=wt(l,"IMAGELENGTH"),x=wt(l,"TILEWIDTH"),w=wt(l,"TILELENGTH"),_=[];if(c){const{bandCount:e}=this.rasterInfo;for(let s=0;s<e;s++){const e=s*(d+1)*(m+1)+t*(m+1)+i;_[s]={from:u[e],to:u[e]+h[e]-1}}}else{const e=t*(m+1)+i;_.push({from:u[e],to:u[e]+h[e]-1})}for(let e=0;e<_.length;e++)if(null==_[e].from||!_[e].to||_[e].to<0)return null;return{ranges:_,ifd:l,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===d&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return tt(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Te.parse(t);return i?.recordSet?ae.c.fromJSON(i.recordSet):null}catch{return null}}};(0,s._)([(0,h.qq)()],_t.prototype,"_files",void 0),(0,s._)([(0,h.qq)()],_t.prototype,"_headerInfo",void 0),(0,s._)([(0,h.qq)()],_t.prototype,"_bufferSize",void 0),(0,s._)([(0,h.qq)({type:String,json:{write:!0}})],_t.prototype,"datasetFormat",void 0),_t=(0,s._)([(0,m.c)("esri.layers.support.rasterDatasets.TIFFRaster")],_t);const vt=_t,bt=new Map;bt.set("CRF",{desc:"Cloud Raster Format",constructor:Me}),bt.set("MRF",{desc:"Meta Raster Format",constructor:mt}),bt.set("TIFF",{desc:"GeoTIFF",constructor:vt}),bt.set("RasterTileServer",{desc:"Raster Tile Server",constructor:ut}),bt.set("JPG",{desc:"JPG Raster Format",constructor:st}),bt.set("PNG",{desc:"PNG Raster Format",constructor:st}),bt.set("GIF",{desc:"GIF Raster Format",constructor:st}),bt.set("BMP",{desc:"BMP Raster Format",constructor:st}),bt.set("CovJSON",{desc:"COVJSON Raster Format",constructor:Ge}),bt.set("MEMORY",{desc:"In Memory Raster Format",constructor:Le});class It{static get supportedFormats(){const e=new Set;return bt.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,source:s,sourceJSON:n}=e;let r=e.datasetFormat??i?.datasetFormat;null==r&&(t.includes(".")?r=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===s?.type?.toLowerCase()?r="CovJSON":s?.extent&&s.pixelblocks&&(r="MEMORY")),"OVR"===r||"TIF"===r?r="TIFF":"JPG"===r||"JPEG"===r||"JFIF"===r?r="JPG":"COVJSON"===r&&(r="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const o={url:t,source:s,sourceJSON:n,datasetFormat:r,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(o).forEach((e=>{null==o[e]&&delete o[e]})),r){if(!this.supportedFormats.has(r))throw new a.c("rasterfactory:open","not a supported format "+r);if("CRF"===r&&!i?.enableCRF)throw new a.c("rasterfactory:open",`cannot open raster: ${t}`);const s=new(0,bt.get(r).constructor)(o);return await s.open({signal:e.signal}),s}const l=Array.from(bt.keys()).filter((e=>"CovJSON"!==e&&"Memory"!==e));let c=0;const u=()=>{if(r=l[c++],!r)return null;if("CRF"===r&&!i?.enableCRF)return null;const t=new(0,bt.get(r).constructor)(o);return t.open({signal:e.signal}).then((()=>t)).catch((()=>u()))};return u()}static register(e,t,i){bt.has(e.toUpperCase())||bt.set(e.toUpperCase(),{desc:t,constructor:i})}}var St=i(65548),Rt=i(8616);let Tt=class extends((0,x.W)((0,we.I)((0,ye.Y)((0,ge.K)((0,w.G)(me((0,_e.u)((0,g.u)((0,xe.G)((0,l.U)((0,r.q)(y.c)))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,c.Cu)((async(e,t,s)=>{const{save:n,saveAs:r}=await i.e(7448).then(i.bind(i,67448));switch(e){case Rt.U.SAVE:return n(this,t);case Rt.U.SAVE_AS:return r(this,s,t)}}))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.CE).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){const e=[new ve.c({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new ve.c({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{serviceRasterInfo:t}=this,i=t?.attributeTable,s=null!=i?i.fields:null;if(s){const t=s.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e.push(...t)}const n=t?.dataType,r=t?.multidimensionalInfo;if(("vector-magdir"===n||"vector-uv"===n)&&null!=r){const t=r.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new ve.c({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new ve.c({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}createPopupTemplate(e){const{rasterFields:t}=this,i=new Set(t.map((({name:e})=>e)).filter((e=>"raster.servicepixelvalue.raw"!==e.toLowerCase())));return(0,St.Ap)({fields:t,title:this.title},{...e,visibleFieldNames:i})}async generateRasterInfo(e,t){if(!(e=(0,f.uY)(C.c,e)))return this.serviceRasterInfo;try{const{rasterInfo:i}=await this._openFunctionRaster(e,t);return i}catch(e){if(e instanceof a.c)throw e;throw new a.c("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(Rt.U.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(Rt.U.SAVE_AS,t,e)}write(e,t){const i=this._primaryRasters[0]??this.raster;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t?.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new a.c("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t="Function"===this.raster.datasetFormat;else{const{url:t,rasterFunction:i,source:s}=this;if(!t&&!s)throw new a.c("imagery-tile-layer:open","missing url or source parameter");s?await this._openFromSource(s,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}const i=this.raster.rasterInfo;if(!i)throw new a.c("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}else this.read({tileInfo:this.serviceRasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,u.aE)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters="Function"===e.datasetFormat?e.primaryRasters.rasters:[e],this.url||(this.url=this._primaryRasters[0].url)}async _openFromUrlWithRasterFunction(e,t,i){const s=[e];t&&(0,ce.sJ)(t.toJSON(),s);const n=await Promise.all(s.map((e=>It.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:i})))),r=n.findIndex((e=>null==e));if(r>-1)throw new a.c("imagery-tile-layer:open",`cannot open raster: ${s[r]}`);return this._primaryRasters=n,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){const i=await It.open({url:e,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==i)throw new a.c("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[i],this.raster=i}async _openFromSource(e,t){const i="the tiled imagery data source is not supported",s="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!s)throw new a.c("imagery-tile-layer:open",i);"MEMORY"===s&&(e={extent:e.extent,pixelBlocks:[e.pixelBlock]});const n=await It.open({url:"",source:e,datasetFormat:s,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==n)throw new a.c("imagery-tile-layer:open",i);this._primaryRasters=[n],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=n}async _openFunctionRaster(e,t){const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const s=(0,ce.Su)(e.functionDefinition?.toJSON()??e.toJSON(),i),n=new le({rasterFunction:s});return await n.open(t),n}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof a.c&&o.c.getLogger(this).error("imagery-tile-layer:open",e.message),o.c.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}};(0,s._)([(0,h.qq)({clonable:!1})],Tt.prototype,"_primaryRasters",void 0),(0,s._)([(0,h.qq)({type:[f.Ab],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],Tt.prototype,"bandIds",void 0),(0,s._)([(0,h.qq)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,d.G)(be.gh)],Tt.prototype,"interpolation",void 0),(0,s._)([(0,h.qq)(T.Uj)],Tt.prototype,"legendEnabled",void 0),(0,s._)([(0,h.qq)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],Tt.prototype,"isReference",void 0),(0,s._)([(0,h.qq)({type:["show","hide"]})],Tt.prototype,"listMode",void 0),(0,s._)([(0,h.qq)({json:{read:!0,write:!0}})],Tt.prototype,"blendMode",void 0),(0,s._)([(0,h.qq)()],Tt.prototype,"sourceJSON",void 0),(0,s._)([(0,h.qq)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],Tt.prototype,"version",void 0),(0,s._)([(0,h.qq)({readOnly:!0,json:{read:!1}})],Tt.prototype,"type",void 0),(0,s._)([(0,h.qq)({type:["ArcGISTiledImageServiceLayer"]})],Tt.prototype,"operationalLayerType",void 0),(0,s._)([(0,h.qq)({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}}}})],Tt.prototype,"popupEnabled",void 0),(0,s._)([(0,h.qq)({type:n.c,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],Tt.prototype,"popupTemplate",void 0),(0,s._)([(0,h.qq)({readOnly:!0})],Tt.prototype,"defaultPopupTemplate",null),(0,s._)([(0,h.qq)({readOnly:!0,type:[ve.c]})],Tt.prototype,"fields",void 0),(0,s._)([(0,h.qq)({readOnly:!0,type:[ve.c]})],Tt.prototype,"rasterFields",null),(0,s._)([(0,h.qq)({constructOnly:!0})],Tt.prototype,"source",void 0),Tt=(0,s._)([(0,m.c)("esri.layers.ImageryTileLayer")],Tt);const kt=Tt},22108:(e,t,i)=>{i.d(t,{c:()=>u});var s,n=i(41948),r=i(40504),a=i(1580),o=i(53368),l=(i(72052),i(9456),i(12552));let c=s=class extends r.am{constructor(e){super(e),this.cols=null,this.level=0,this.levelValue=null,this.origin=null,this.resolution=0,this.rows=null,this.scale=0}clone(){return new s({cols:this.cols,level:this.level,levelValue:this.levelValue,resolution:this.resolution,rows:this.rows,scale:this.scale})}};(0,n._)([(0,a.qq)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"cols",void 0),(0,n._)([(0,a.qq)({type:o.Ab,json:{write:!0}})],c.prototype,"level",void 0),(0,n._)([(0,a.qq)({type:String,json:{write:!0}})],c.prototype,"levelValue",void 0),(0,n._)([(0,a.qq)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"origin",void 0),(0,n._)([(0,a.qq)({type:Number,json:{write:!0}})],c.prototype,"resolution",void 0),(0,n._)([(0,a.qq)({json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],c.prototype,"rows",void 0),(0,n._)([(0,a.qq)({type:Number,json:{write:!0}})],c.prototype,"scale",void 0),c=s=(0,n._)([(0,l.c)("esri.layers.support.LOD")],c);const u=c},87576:(e,t,i)=>{i.d(t,{c:()=>S});var s,n=i(41948),r=i(14628),a=i(40504),o=i(24296),l=i(1580),c=i(53368),u=(i(72052),i(9456),i(33600)),h=i(12552),f=i(18996),p=i(67776),d=i(56156),m=i(83372),y=i(60544),g=i(29120),x=i(22108),w=i(11712);const _=new r.O({PNG:"png",PNG8:"png8",PNG24:"png24",PNG32:"png32",JPEG:"jpg",JPG:"jpg",DIB:"dib",TIFF:"tiff",EMF:"emf",PS:"ps",PDF:"pdf",GIF:"gif",SVG:"svg",SVGZ:"svgz",Mixed:"mixed",MIXED:"mixed",LERC:"lerc",LERC2D:"lerc2d",RAW:"raw",pbf:"pbf"});let v=s=class extends a.am{static create(e={}){const{resolutionFactor:t=1,scales:i,size:n=256,spatialReference:r=d.c.WebMercator,numLODs:a=24}=e;if(!(0,y.U3)(r)){const e=[];if(i)for(let t=0;t<i.length;t++){const s=i[t];e.push(new x.c({level:t,scale:s,resolution:s}))}else{let t=5e-4;for(let i=a-1;i>=0;i--)e.unshift(new x.c({level:i,scale:t,resolution:t})),t*=2}return new s({dpi:96,lods:e,origin:new p.c(0,0,r),size:[n,n],spatialReference:r})}const l=(0,y.Nq)(r),c=e.origin?new p.c({x:e.origin.x,y:e.origin.y,spatialReference:r}):new p.c(l?{x:l.origin[0],y:l.origin[1],spatialReference:r}:{x:0,y:0,spatialReference:r}),u=1/(39.37*(0,o.k8)(r)*96),h=[];if(i)for(let e=0;e<i.length;e++){const t=i[e],s=t*u;h.push(new x.c({level:e,scale:t,resolution:s}))}else{let e=(0,y.Eb)(r)?512/n*591657527.5917094:256/n*591657527.591555;const i=Math.ceil(a/t);h.push(new x.c({level:0,scale:e,resolution:e*u}));for(let s=1;s<i;s++){const i=e/2**t,n=i*u;h.push(new x.c({level:s,scale:i,resolution:n})),e=i}}return new s({dpi:96,lods:h,origin:c,size:[n,n],spatialReference:r})}constructor(e){super(e),this.dpi=96,this.format=null,this.origin=null,this.size=null,this.spatialReference=null}get isWrappable(){const{spatialReference:e,origin:t}=this;if(e&&t){const i=(0,y.Nq)(e);return e.isWrappable&&!!i&&Math.abs(i.origin[0]-t.x)<=i.dx}return!1}readOrigin(e,t){return p.c.fromJSON({spatialReference:t.spatialReference,...e})}set lods(e){let t=0,i=0;const s=[],n=this._levelToLOD={};e&&(t=-1/0,i=1/0,e.forEach((e=>{s.push(e.scale),t=e.scale>t?e.scale:t,i=e.scale<i?e.scale:i,n[e.level]=e}))),this._set("scales",s),this._set("lods",e),this._initializeUpsampleLevels()}readSize(e,t){return[t.cols,t.rows]}writeSize(e,t){t.cols=e[0],t.rows=e[1]}zoomToScale(e){const t=this.scales;if(e<=0)return t[0];if(e>=t.length-1)return t[t.length-1];const i=Math.floor(e),s=i+1;return t[i]/(t[i]/t[s])**(e-i)}scaleToZoom(e){const t=this.scales,i=t.length-1;let s=0;for(;s<i;s++){const i=t[s],n=t[s+1];if(i<=e)return s;if(n===e)return s+1;if(i>e&&n<e)return s+Math.log(i/e)/Math.log(i/n)}return s}snapScale(e,t=.95){const i=this.scaleToZoom(e);return i%Math.floor(i)>=t?this.zoomToScale(Math.ceil(i)):this.zoomToScale(Math.floor(i))}tileAt(e,t,i,s){const n=this.lodAt(e);if(!n)return null;let r,a;if("number"==typeof t)r=t,a=i;else if((0,y.yK)(t.spatialReference,this.spatialReference))r=t.x,a=t.y,s=i;else{const e=(0,g.yU)(t,this.spatialReference);if(null==e)return null;r=e.x,a=e.y,s=i}const o=n.resolution*this.size[0],l=n.resolution*this.size[1];return s||(s=new w.g(null,0,0,0,(0,m.Su)())),s.level=e,s.row=Math.floor((this.origin.y-a)/l+.001),s.col=Math.floor((r-this.origin.x)/o+.001),this.updateTileInfo(s),s}updateTileInfo(e,t=s.ExtrapolateOptions.NONE){let i=this.lodAt(e.level);if(!i&&t===s.ExtrapolateOptions.POWER_OF_TWO){const t=this.lods[this.lods.length-1];t.level<e.level&&(i=t)}if(!i)return;const n=e.level-i.level,r=i.resolution*this.size[0]/2**n,a=i.resolution*this.size[1]/2**n;e.id=`${e.level}/${e.row}/${e.col}`,e.extent||(e.extent=(0,m.Su)()),e.extent[0]=this.origin.x+e.col*r,e.extent[1]=this.origin.y-(e.row+1)*a,e.extent[2]=e.extent[0]+r,e.extent[3]=e.extent[1]+a}upsampleTile(e){const t=this._upsampleLevels[e.level];return!(!t||-1===t.parentLevel||(e.level=t.parentLevel,e.row=Math.floor(e.row/t.factor+.001),e.col=Math.floor(e.col/t.factor+.001),this.updateTileInfo(e),0))}getTileBounds(e,t){const i=this.lodAt(t.level);if(null==i)return null;const{resolution:s}=i,n=s*this.size[0],r=s*this.size[1];return e[0]=this.origin.x+t.col*n,e[1]=this.origin.y-(t.row+1)*r,e[2]=e[0]+n,e[3]=e[1]+r,e}lodAt(e){return this._levelToLOD?.[e]??null}clone(){return s.fromJSON(this.write({}))}getOrCreateCompatible(e,t){if(256===this.size[0]&&256===this.size[1])return 256===e?this:null;const i=[],n=this.lods.length;for(let e=0;e<n;e++){const s=this.lods[e],n=s.resolution*t;i.push(new x.c({level:s.level,scale:s.scale,resolution:n}))}return new s({size:[e,e],dpi:this.dpi,format:this.format,compressionQuality:this.compressionQuality,origin:this.origin,spatialReference:this.spatialReference,lods:i})}_initializeUpsampleLevels(){const e=this.lods;this._upsampleLevels=[];let t=null;for(let i=0;i<e.length;i++){const s=e[i];this._upsampleLevels[s.level]={parentLevel:t?t.level:-1,factor:t?t.resolution/s.resolution:0},t=s}}};var b,I;(0,n._)([(0,l.qq)({type:Number,json:{write:!0}})],v.prototype,"compressionQuality",void 0),(0,n._)([(0,l.qq)({type:Number,json:{write:!0}})],v.prototype,"dpi",void 0),(0,n._)([(0,l.qq)({type:String,json:{read:_.read,write:_.write,origins:{"web-scene":{read:!1,write:!1}}}})],v.prototype,"format",void 0),(0,n._)([(0,l.qq)({readOnly:!0})],v.prototype,"isWrappable",null),(0,n._)([(0,l.qq)({type:p.c,json:{write:!0}})],v.prototype,"origin",void 0),(0,n._)([(0,u.E)("origin")],v.prototype,"readOrigin",null),(0,n._)([(0,l.qq)({type:[x.c],value:null,json:{write:!0}})],v.prototype,"lods",null),(0,n._)([(0,l.qq)({readOnly:!0})],v.prototype,"scales",void 0),(0,n._)([(0,l.qq)({cast:e=>Array.isArray(e)?e:"number"==typeof e?[e,e]:[256,256]})],v.prototype,"size",void 0),(0,n._)([(0,u.E)("size",["rows","cols"])],v.prototype,"readSize",null),(0,n._)([(0,f.G)("size",{cols:{type:c.Ab},rows:{type:c.Ab}})],v.prototype,"writeSize",null),(0,n._)([(0,l.qq)({type:d.c,json:{write:!0}})],v.prototype,"spatialReference",void 0),v=s=(0,n._)([(0,h.c)("esri.layers.support.TileInfo")],v),b=v||(v={}),(I=b.ExtrapolateOptions||(b.ExtrapolateOptions={}))[I.NONE=0]="NONE",I[I.POWER_OF_TWO=1]="POWER_OF_TWO";const S=v},11712:(e,t,i)=>{i.d(t,{g:()=>s});class s{constructor(e,t,i,s,n=void 0){this.id=e,this.level=t,this.row=i,this.col=s,this.extent=n}}},41464:(e,t,i)=>{i.d(t,{G:()=>S});var s,n=i(41948),r=i(2600),a=i(43780),o=i(80424),l=i(20744),c=i(38912),u=i(11004),h=i(24680),f=i(10860),p=i(57896),d=i(66168),m=i(28176),y=i(1580),g=(i(9456),i(66360),i(72052),i(12552)),x=i(11712),w=i(92400),_=i(62088),v=i(72008);class b{constructor(e){this._validateJSON(e);const{location:t,data:i}=e;this.location=Object.freeze((0,_.ct)(t));const s=this.location.width,n=this.location.height;let r=!0,a=!0;const o=function(e,t=!1){return e<=v._?t?new Array(e).fill(0):new Array(e):new Uint32Array(e)}(Math.ceil(s*n/32));let l=0;for(let e=0;e<i.length;e++){const t=e%32;i[e]?(a=!1,o[l]|=1<<t):r=!1,31===t&&++l}a?(this._availability="unavailable",this.byteSize=40):r?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,v.OA)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;const i=(e-this.location.top)*this.location.width+(t-this.location.left),s=i%32,n=i>>5,r=this._availability;return n<0||n>r.length?"unknown":r[n]&1<<s?"available":"unavailable"}static fromDefinition(e,t){const i=e.service.request||r.c,{row:s,col:n,width:a,height:o}=e,c={query:{f:"json"}};return t=t?{...c,...t}:c,i(function(e){let t;if(e.service.tileServers?.length){const i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;const i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then((e=>e.data)).catch((e=>{if(e&&e.details&&422===e.details.httpStatus)return{location:{top:s,left:n,width:a,height:o},valid:!0,data:(0,w.ah)(a*o,0)};throw e})).then((e=>{if(e.location&&(e.location.top!==s||e.location.left!==n||e.location.width!==a||e.location.height!==o))throw new l.c("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:s,left:n,width:a,height:o}});return b.fromJSON(e)}))}static fromJSON(e){return Object.freeze(new b(e))}_validateJSON(e){if(!e?.location)throw new l.c("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.c("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.c("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.c("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.c("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}}function I(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}let S=s=class extends a.c{constructor(e){super(e),this._pendingTilemapRequests={},this.request=r.c,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.o(2*o.M.MEGABYTES),this.addHandles((0,p.aE)((()=>{const{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]}),(()=>this._initializeTilemapDefinition()),p._8))}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}fetchTilemap(e,t,i,s){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.c("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));const n=this._tmpTilemapDefinition,r=this._tilemapFromCache(e,t,i,n);if(r)return Promise.resolve(r);const a=s?.signal;return s={...s,signal:null},new Promise(((e,t)=>{(0,f.wD)(a,(()=>t((0,f.Uh)())));const i=I(n);let r=this._pendingTilemapRequests[i];if(!r){r=b.fromDefinition(n,s).then((e=>(this._tilemapCache.put(i,e,e.byteSize),e)));const e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=r,r.then(e,e)}r.then(e,t)}))}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";const s=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return s?s.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,s){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(new l.c("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})):this.fetchTilemap(e,t,i,s).catch((e=>e)).then((s=>{if(s instanceof b){const n=s.getAvailability(t,i);if("unavailable"===n)throw new l.c("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i});return n}if((0,f.mA)(s))throw s;return"unknown"}))}fetchAvailabilityUpsample(e,t,i,s,n){s.level=e,s.row=t,s.col=i;const r=this.layer.tileInfo;r.updateTileInfo(s);const a=this.fetchAvailability(e,t,i,n).catch((e=>{if((0,f.mA)(e))throw e;if(r.upsampleTile(s))return this.fetchAvailabilityUpsample(s.level,s.row,s.col,s,n);throw e}));return this._fetchAvailabilityUpsamplePrefetch(s.id,e,t,i,n,a),a}async _fetchAvailabilityUpsamplePrefetch(e,t,i,n,r,a){if(!this._prefetchingEnabled||null==e)return;const o=`prefetch-${e}`;if(this.hasHandles(o))return;const l=new AbortController;a.then((()=>l.abort()),(()=>l.abort()));let u=!1;const h=(0,c.uU)((()=>{u||(u=!0,l.abort())}));if(this.addHandles(h,o),await(0,d.Wi)(10,l.signal).catch((()=>{})),u||(u=!0,this.removeHandles(o)),(0,f.wv)(l))return;const p=new x.g(e,t,i,n),m={...r,signal:l.signal},y=this.layer.tileInfo;for(let e=0;s._prefetches.length<s._maxPrefetch&&y.upsampleTile(p);++e){const e=this.fetchAvailability(p.level,p.row,p.col,m);s._prefetches.push(e);const t=()=>{s._prefetches.removeUnordered(e)};e.then(t,t)}}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;const{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,m.GK)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,s){s.level=e,s.row=t-t%this.size,s.col=i-i%this.size;const n=I(s);return this._tilemapCache.get(n)}get test(){const e=this;return{get prefetchingEnabled(){return e._prefetchingEnabled},set prefetchingEnabled(t){e._prefetchingEnabled=t},hasTilemap:(t,i,s)=>!!e._tilemapFromCache(t,i,s,e._tmpTilemapDefinition)}}};S._maxPrefetch=4,S._prefetches=new h.c({initialSize:s._maxPrefetch}),(0,n._)([(0,y.qq)({constructOnly:!0})],S.prototype,"layer",void 0),(0,n._)([(0,y.qq)({constructOnly:!0})],S.prototype,"minLOD",void 0),(0,n._)([(0,y.qq)({constructOnly:!0})],S.prototype,"maxLOD",void 0),(0,n._)([(0,y.qq)({constructOnly:!0})],S.prototype,"request",void 0),(0,n._)([(0,y.qq)({constructOnly:!0})],S.prototype,"size",void 0),S=s=(0,n._)([(0,g.c)("esri.layers.support.TilemapCache")],S)},81976:(e,t,i)=>{i.d(t,{Q:()=>r,y:()=>n});var s=i(6704);function n(e){return{geometryType:(0,s.Ce)(e[0]),geometries:e.map((e=>e.toJSON()))}}function r(e,t,i){const n=(0,s.uG)(t);return e.map((e=>{const t=n.fromJSON(e);return t.spatialReference=i,t}))}},21980:(e,t,i)=>{i.d(t,{OW:()=>o,UX:()=>a,sR:()=>r}),i(6220),i(47620);var s=i(62088),n=i(28176);function r(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,n.as)(e):(0,s.ct)(e)}function o(e,t,i){const s={};for(const n in e){if("declaredClass"===n)continue;const r=e[n];if(null!=r&&"function"!=typeof r)if(Array.isArray(r))s[n]=r.map((e=>o({item:e},t,i).item));else if("object"==typeof r)if(r.toJSON){const e=r.toJSON(i?.[n]);s[n]=t?e:JSON.stringify(e)}else s[n]=t?r:JSON.stringify(r);else s[n]=r}return s}i(20572)},27064:(e,t,i)=>{i.d(t,{K:()=>u});var s=i(70680),n=i(10860),r=i(54792),a=i(23964),o=i(66168),l=i(52888);class c{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class u{constructor(e){this._schedule=null,this._task=null,this._deferreds=new a.c,this._controllers=new a.c,this._processingItems=new a.c,this._pausedSignal=(0,l.O)(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new r.c(e.peeker),this.process=e.process;const t=e.scheduler;e.priority&&t&&(this._task=t.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=(0,s.oR)(this._schedule),this._task=(0,s.oR)(this._task)}get updating(){return!!this._task?.updating||this.running}get length(){return this._processingItems.size+this._queue.length}abort(e){const t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach((t=>e.push(t))),this._controllers.clear(),e.forEach((e=>e.abort())),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach(((t,i)=>e(i)))}get(e){const t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,t){const i=this.get(e);if(i)return i;const s=new AbortController;let r=null;t&&(r=(0,n.wD)(t,(()=>s.abort())));const a=()=>{o.remove(),null!=r&&r.remove(),this._removeItem(e),this._queue.remove(e),this._scheduleNext()},o=(0,n.Ij)(s.signal,(()=>{const t=this._processingItems.get(e);t&&t.controller.abort(),a(),l.reject((0,n.Uh)())})),l=(0,n.qG)();return this._deferreds.set(e,l),this._controllers.set(e,s),l.promise.then(a,a),this._queue.push(e),this._scheduleNext(),l.promise}last(){return this._queue.last()}lastPromise(){const e=this.last();return e?this.get(e):null}peek(){return this._queue.peek()}popLast(){const e=this._queue.popLast();return e&&(this._deferreds.get(e)?.reject((0,n.Uh)("Removed from queue")),this._removeItem(e)),e}reset(){const e=[];this._processingItems.forEach((t=>e.push(t))),this._processingItems.clear();for(const t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_removeItem(e){this._deferreds.delete(e),this._controllers.delete(e),this._processingItems.delete(e)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,o.Ow)((()=>{this._schedule=null,this._next()})))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if(null==e)return;let t;const i=new AbortController,s=new c(e,i);this._processingItems.set(e,s);try{t=this.process(e,i.signal)}catch(e){this._processError(s,e)}(0,n.eW)(t)?(s.promise=t,t.then((e=>this._processResult(s,e)),(e=>this._processError(s,e)))):this._processResult(s,t)}get test(){return{update:e=>this.runTask(e)}}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4716],{17012:(t,e,n)=>{n.d(e,{e:()=>l});var r,o,i,s=n(8528),a={exports:{}};r=a,o=function(){function t(t,n,o){o=o||2;var i,s,a,c,u,h,f,p=n&&n.length,g=p?n[0]*o:t.length,d=e(t,0,g,o,!0),m=[];if(!d||d.next===d.prev)return m;if(p&&(d=l(t,n,d,o)),t.length>80*o){i=a=t[0],s=c=t[1];for(var y=o;y<g;y+=o)(u=t[y])<i&&(i=u),(h=t[y+1])<s&&(s=h),u>a&&(a=u),h>c&&(c=h);f=0!==(f=Math.max(a-i,c-s))?1/f:0}return r(d,m,o,i,s,f),m}function e(t,e,n,r,o){var i,s;if(o===C(t,e,n,r)>0)for(i=e;i<n;i+=r)s=T(i,t[i],t[i+1],s);else for(i=n-r;i>=e;i-=r)s=T(i,t[i],t[i+1],s);if(s&&v(s,s.next)){var a=s.next;M(s),s=a}return s}function n(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!v(r,r.next)&&0!==x(r.prev,r,r.next))r=r.next;else{var o=r.prev;if(M(r),(r=e=o)===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,l,c,u,h,f){if(t){!f&&h&&p(t,c,u,h);for(var g,d,m=t;t.prev!==t.next;)if(g=t.prev,d=t.next,h?i(t,c,u,h):o(t))e.push(g.i/l),e.push(t.i/l),e.push(d.i/l),M(t),t=d.next,m=d.next;else if((t=d)===m){f?1===f?r(t=s(n(t),e,l),e,l,c,u,h,2):2===f&&a(t,e,l,c,u,h):r(n(t),e,l,c,u,h,1);break}}}function o(t){var e=t.prev,n=t,r=t.next;if(x(e,n,r)>=0)return!1;for(var o=t.next.next;o!==t.prev;){if(m(e.x,e.y,n.x,n.y,r.x,r.y,o.x,o.y)&&x(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function i(t,e,n,r){var o=t.prev,i=t,s=t.next;if(x(o,i,s)>=0)return!1;for(var a=o.x<i.x?o.x<s.x?o.x:s.x:i.x<s.x?i.x:s.x,l=o.y<i.y?o.y<s.y?o.y:s.y:i.y<s.y?i.y:s.y,c=o.x>i.x?o.x>s.x?o.x:s.x:i.x>s.x?i.x:s.x,u=o.y>i.y?o.y>s.y?o.y:s.y:i.y>s.y?i.y:s.y,h=g(a,l,e,n,r),f=g(c,u,e,n,r),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&m(o.x,o.y,i.x,i.y,s.x,s.y,p.x,p.y)&&x(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&m(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&x(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&m(o.x,o.y,i.x,i.y,s.x,s.y,p.x,p.y)&&x(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&m(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&x(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function s(t,e,r){var o=t;do{var i=o.prev,s=o.next.next;!v(i,s)&&w(i,o,o.next,s)&&_(i,s)&&_(s,i)&&(e.push(i.i/r),e.push(o.i/r),e.push(s.i/r),M(o),M(o.next),o=t=s),o=o.next}while(o!==t);return n(o)}function a(t,e,o,i,s,a){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&y(l,c)){var u=S(l,c);return l=n(l,l.next),u=n(u,u.next),r(l,e,o,i,s,a),void r(u,e,o,i,s,a)}c=c.next}l=l.next}while(l!==t)}function l(t,r,o,i){var s,a,l,u=[];for(s=0,a=r.length;s<a;s++)(l=e(t,r[s]*i,s<a-1?r[s+1]*i:t.length,i,!1))===l.next&&(l.steiner=!0),u.push(d(l));for(u.sort(c),s=0;s<u.length;s++)o=n(o=h(u[s],o),o.next);return o}function c(t,e){return t.x-e.x}function u(t){if(t.next.prev===t)return t;let e=t;for(;;){const n=e.next;if(n.prev===e||n===e||n===t)break;e=n}return e}function h(t,e){var r=function(t,e){var n,r=e,o=t.x,i=t.y,s=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var a=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=o&&a>s){if(s=a,a===o){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(o===s)return n;var l,c=n,u=n.x,h=n.y,p=1/0;r=n;do{o>=r.x&&r.x>=u&&o!==r.x&&m(i<h?o:s,i,u,h,i<h?s:o,i,r.x,r.y)&&(l=Math.abs(i-r.y)/(o-r.x),_(r,t)&&(l<p||l===p&&(r.x>n.x||r.x===n.x&&f(n,r)))&&(n=r,p=l)),r=r.next}while(r!==c);return n}(t,e);if(!r)return e;var o=S(r,t),i=n(r,r.next);let s=u(o);return n(s,s.next),i=u(i),u(e===r?i:e)}function f(t,e){return x(t.prev,t,e.prev)<0&&x(e.next,t,t.next)<0}function p(t,e,n,r){var o=t;do{null===o.z&&(o.z=g(o.x,o.y,e,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==t);o.prevZ.nextZ=null,o.prevZ=null,function(t){var e,n,r,o,i,s,a,l,c=1;do{for(n=t,t=null,i=null,s=0;n;){for(s++,r=n,a=0,e=0;e<c&&(a++,r=r.nextZ);e++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(o=n,n=n.nextZ,a--):(o=r,r=r.nextZ,l--),i?i.nextZ=o:t=o,o.prevZ=i,i=o;n=r}i.nextZ=null,c*=2}while(s>1)}(o)}function g(t,e,n,r,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*o)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*o)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function m(t,e,n,r,o,i,s,a){return(o-s)*(e-a)-(t-s)*(i-a)>=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(i-a)-(o-s)*(r-a)>=0}function y(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&w(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(_(t,e)&&_(e,t)&&function(t,e){var n=t,r=!1,o=(t.x+e.x)/2,i=(t.y+e.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(x(t.prev,t,e.prev)||x(t,e.prev,e))||v(t,e)&&x(t.prev,t,t.next)>0&&x(e.prev,e,e.next)>0)}function x(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function v(t,e){return t.x===e.x&&t.y===e.y}function w(t,e,n,r){var o=b(x(t,e,n)),i=b(x(t,e,r)),s=b(x(n,r,t)),a=b(x(n,r,e));return o!==i&&s!==a||!(0!==o||!A(t,n,e))||!(0!==i||!A(t,r,e))||!(0!==s||!A(n,t,r))||!(0!==a||!A(n,e,r))}function A(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function b(t){return t>0?1:t<0?-1:0}function _(t,e){return x(t.prev,t,t.next)<0?x(t,e,t.next)>=0&&x(t,t.prev,e)>=0:x(t,e,t.prev)<0||x(t,t.next,e)<0}function S(t,e){var n=new q(t.i,t.x,t.y),r=new q(e.i,e.x,e.y),o=t.next,i=e.prev;return t.next=e,e.prev=t,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function T(t,e,n,r){var o=new q(t,e,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function q(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function C(t,e,n,r){for(var o=0,i=e,s=n-r;i<n;i+=r)o+=(t[s]-t[i])*(t[i+1]+t[s+1]),s=i;return o}return t.deviation=function(t,e,n,r){var o=e&&e.length,i=o?e[0]*n:t.length,s=Math.abs(C(t,0,i,n));if(o)for(var a=0,l=e.length;a<l;a++){var c=e[a]*n,u=a<l-1?e[a+1]*n:t.length;s-=Math.abs(C(t,c,u,n))}var h=0;for(a=0;a<r.length;a+=3){var f=r[a]*n,p=r[a+1]*n,g=r[a+2]*n;h+=Math.abs((t[f]-t[g])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[g+1]-t[f+1]))}return 0===s&&0===h?0:Math.abs((h-s)/s)},t.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,o=0;o<t.length;o++){for(var i=0;i<t[o].length;i++)for(var s=0;s<e;s++)n.vertices.push(t[o][i][s]);o>0&&(r+=t[o-1].length,n.holes.push(r))}return n},t},void 0!==(i=o())&&(r.exports=i);const l=(0,s.g)(a.exports)},48952:(t,e,n)=>{n.d(e,{a:()=>i,b:()=>a,c:()=>s,d:()=>o,e:()=>h,f:()=>l,n:()=>f,s:()=>c,t:()=>u}),n(9456);var r=n(23704);function o(t,e,n){i(t.typedBuffer,e.typedBuffer,n,t.typedBufferStride,e.typedBufferStride)}function i(t,e,n,r=3,o=r){if(t.length/r!==Math.ceil(e.length/o))return t;const i=t.length/r,s=n[0],a=n[1],l=n[2],c=n[4],u=n[5],h=n[6],f=n[8],p=n[9],g=n[10],d=n[12],m=n[13],y=n[14];let x=0,v=0;for(let n=0;n<i;n++){const n=e[x],i=e[x+1],w=e[x+2];t[v]=s*n+c*i+f*w+d,t[v+1]=a*n+u*i+p*w+m,t[v+2]=l*n+h*i+g*w+y,x+=o,v+=r}return t}function s(t,e,n){a(t.typedBuffer,e.typedBuffer,n,t.typedBufferStride,e.typedBufferStride)}function a(t,e,n,o=3,i=o){if(t.length/o!==Math.ceil(e.length/i))return void(0,r.A)().error("source and destination buffers need to have the same number of elements");const s=t.length/o,a=n[0],l=n[1],c=n[2],u=n[3],h=n[4],f=n[5],p=n[6],g=n[7],d=n[8];let m=0,y=0;for(let n=0;n<s;n++){const n=e[m],r=e[m+1],s=e[m+2];t[y]=a*n+u*r+p*s,t[y+1]=l*n+h*r+g*s,t[y+2]=c*n+f*r+d*s,m+=i,y+=o}}function l(t,e,n){c(t.typedBuffer,e,n,t.typedBufferStride)}function c(t,e,n,r=3){const o=Math.min(t.length/r,e.count),i=e.typedBuffer,s=e.typedBufferStride;let a=0,l=0;for(let e=0;e<o;e++)t[l]=n*i[a],t[l+1]=n*i[a+1],t[l+2]=n*i[a+2],a+=s,l+=r}function u(t,e,n,r=3,o=r){const i=t.length/r;if(i!==Math.ceil(e.length/o))return t;let s=0,a=0;for(let l=0;l<i;l++)t[a]=e[s]+n[0],t[a+1]=e[s+1]+n[1],t[a+2]=e[s+2]+n[2],s+=o,a+=r;return t}function h(t,e){f(t.typedBuffer,e.typedBuffer,t.typedBufferStride,e.typedBufferStride)}function f(t,e,n=3,r=n){const o=Math.min(t.length/n,e.length/r);let i=0,s=0;for(let a=0;a<o;a++){const o=e[i],a=e[i+1],l=e[i+2],c=o*o+a*a+l*l;if(c>0){const e=1/Math.sqrt(c);t[s]=e*o,t[s+1]=e*a,t[s+2]=e*l}i+=r,s+=n}}Object.freeze(Object.defineProperty({__proto__:null,normalize:f,normalizeView:h,scale:c,scaleView:l,shiftRight:function(t,e,n){const r=Math.min(t.count,e.count),o=t.typedBuffer,i=t.typedBufferStride,s=e.typedBuffer,a=e.typedBufferStride;let l=0,c=0;for(let t=0;t<r;t++)o[c]=s[l]>>n,o[c+1]=s[l+1]>>n,o[c+2]=s[l+2]>>n,l+=a,c+=i},transformMat3:a,transformMat3View:s,transformMat4:i,transformMat4View:o,translate:u},Symbol.toStringTag,{value:"Module"}))},63316:(t,e,n)=>{n.d(e,{AD:()=>h,wV:()=>u});var r=n(2600),o=n(20744),i=n(10860),s=n(28176),a=n(49416);let l=null,c=!0;function u(t,e,n,r){if(!e||!n)throw new Error("Cannot construct image data without dimensions");if(c)try{return new ImageData(t,e,n)}catch(t){c=!1}const o=function(t,e,n){return n||(l||(l=document.createElement("canvas"),l.width=1,l.height=1),n=l),n.getContext("2d").createImageData(t,e)}(e,n,r);return o.data.set(t,0),o}async function h(t,e){const{arrayBuffer:l,mediaType:c}=await async function(t,e){const n=(0,s.nV)(t);if(n?.isBase64)return{arrayBuffer:(0,a.K)(n.data),mediaType:n.mediaType};const o=await(0,r.c)(t,{responseType:"array-buffer",...e});return{arrayBuffer:o.data,mediaType:o.getHeader?.("Content-Type")??""}}(t,e),u="image/png"===c;if("image/gif"===c){const{isAnimatedGIF:t,parseGif:r}=await n.e(8560).then(n.bind(n,68560));if(t(l))return r(l,e)}if(u){const{isAnimatedPNG:t,parseApng:r}=await n.e(4464).then(n.bind(n,84464));if(t(l))return r(l,e)}return async function(t,e){const n=window.URL.createObjectURL(t);try{const{data:t}=await(0,r.c)(n,{...e,responseType:"image"});return t}catch(t){if(!(0,i.mA)(t))throw new o.c("invalid-image",`Could not fetch requested image at ${n}`);throw t}finally{window.URL.revokeObjectURL(n)}}(new Blob([l],{type:c}),e)}},94716:(t,e,n)=>{n.d(e,{c:()=>zt});var r=n(41948),o=n(26832),i=n(20744),s=n(95800),a=n(66360),l=n(94804),c=n(10860),u=n(57896),h=n(1580),f=(n(9456),n(72052),n(12552)),p=n(62484),g=n(95247),d=n(50853),m=n(67776),y=n(7488),x=n(66952),v=n(43912);const w="Expected location to be a Point instance";class A extends i.c{constructor(){super("invalid-input:location",w)}}var b=n(51232),_=n(13708),S=n(41104),T=n(82384),M=n(21136),q=n(17012),C=n(82315),F=n(47452),O=n(15688),L=n(97143),I=n(77080),P=(n(60708),n(53648)),R=n(24296),j=n(98472),k=n(58632);n(89560),n(74376),n(71520),n(4636);const U=(0,k.Su)();function N(t,e,n,r,o,i,s){o*=3;for(let a=0;a<i;++a){const i=t[e];r[o++]=i[0],r[o++]=i[1],r[o++]=s?i[2]:0,e+=n}return o/3}function E(t,e,n){if(e){const e=function(t,e,n){const r=function(t,e,n,r){const o=(t=>!Array.isArray(t[0]))(e)?(t,n)=>e[3*t+n]:(t,n)=>e[t][n],i=r?(0,R.k8)(r)/(0,R.gl)(r):1;return(0,k.XX)(t,((t,e)=>(0,j.s)(t,o(e,0)*i,o(e,1)*i,o(e,2))),n)}(U,t,e,n)?(0,k.Oq)(U):[0,0,1];return Math.abs(r[2])>Math.cos((0,P.EF)(80))?C.k.Z:Math.abs(r[1])>Math.abs(r[0])?C.k.Y:C.k.X}(t,t.length-1,n);if(e===C.k.X)return!(0,F.K_)(t,C.k.Y,C.k.Z);if(e===C.k.Y)return!(0,F.K_)(t,C.k.X,C.k.Z)}return!(0,F.K_)(t,C.k.X,C.k.Y)}var D,B;(B=D||(D={}))[B.NONE=0]="NONE",B[B.CCW_IS_HOLE=1]="CCW_IS_HOLE";var W=n(54828);let z=null;function $(t,e){let n=1/0,r=1/0,o=1/0,i=-1/0,s=-1/0,a=-1/0;const l=t.length;let c=0;for(;c<l;){const e=t[c++],l=t[c++],u=t[c++];n=Math.min(n,e),r=Math.min(r,l),o=Math.min(o,u),i=Math.max(i,e),s=Math.max(s,l),a=Math.max(a,u)}return new g.c({xmin:n,ymin:r,zmin:o,xmax:i,ymax:s,zmax:a,spatialReference:e})}var G=n(93184),H=n(71488);const Z="esri.geometry.support.meshUtils.centerAt";const K=(0,p.Su)(),V=(0,p.Su)(),Y=(0,p.Su)();var X=n(28176);function Q(t){const e=(0,X.iu)(t.url);return n=>{const r=(0,X.SU)(n,e,e),o=r?r.replace(/^ *\.\//,""):null;return(o?t.files.get(o):null)??n}}function J(t){return it.fromBlob(t,st(t.name,t.type))}const tt=/^model\/gltf\+json$/,et=/^model\/gltf-binary$/,nt=/\.gltf$/i,rt=/\.glb$/i;function ot(t){const e=new Map;let n,r=null;for(const{name:o,mimeType:i,source:s}of t)null===r&&(tt.test(i)||nt.test(o)?(r=s.url,n="gltf"):(et.test(i)||rt.test(o))&&(r=s.url,n="glb")),e.set(o,s.url),s.files.forEach(((t,n)=>e.set(n,t)));if(null==r)throw new i.c("mesh-load-external:missing-files","Missing files to load external mesh source");return new it(r,(()=>t.forEach((({source:t})=>t.dispose()))),e,n)}class it{constructor(t,e=(()=>{}),n=new Map,r){this.url=t,this.dispose=e,this.files=n,this.type=r}static fromBlob(t,e){const n=URL.createObjectURL(t);return new it(n,(()=>URL.revokeObjectURL(n)),void 0,e)}}function st(t,e){return tt.test(e)||nt.test(t)?"gltf":et.test(e)||nt.test(t)?"glb":void 0}var at=n(3856),lt=n(2952),ct=n(54264);let ut=class extends at.m{constructor(){super(),this.externalSources=new lt.c,this._explicitDisplaySource=null,this.addHandles((0,u.on)((()=>this.externalSources),"after-remove",(({item:t})=>{t===this._explicitDisplaySource&&(this._explicitDisplaySource=null)}),{sync:!0,onListenerRemove:()=>this._explicitDisplaySource=null}))}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(t){if(null!=t&&!(0,ct.Ud)(t))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=t,t&&this.externalSources.every((e=>!(0,ct._o)(e,t)))&&this.externalSources.add(t)}clearSources(){this.externalSources.removeAll()}getExternalSourcesOnService(t){return this.externalSources.items.filter((e=>(0,ct.v_)(e,t)))}get _implicitDisplaySource(){return this.externalSources.find(ct.Ud)}};(0,r._)([(0,h.qq)()],ut.prototype,"externalSources",void 0),(0,r._)([(0,h.qq)()],ut.prototype,"displaySource",null),(0,r._)([(0,h.qq)()],ut.prototype,"_implicitDisplaySource",null),(0,r._)([(0,h.qq)()],ut.prototype,"_explicitDisplaySource",void 0),ut=(0,r._)([(0,f.c)("esri.geometry.support.meshUtils.Metadata")],ut);var ht=n(68612);const ft={position:[-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],normal:[0,0,1,0,0,1,0,0,1,0,0,1],uv:[0,1,1,1,1,0,0,0],faces:[0,1,2,0,2,3],facingAxisOrderSwap:{east:[3,1,2],west:[-3,-1,2],north:[-1,3,2],south:[1,-3,2],up:[1,2,3],down:[1,-2,-3]}};function pt(t,e,n){t.isPlane||function(t){for(let e=0;e<t.position.length;e+=3)t.position[e+2]+=.5}(t),function(t,e){if(null!=e){yt[0]=e[0],yt[4]=e[1],yt[8]=e[2];for(let e=0;e<t.position.length;e+=3){for(let n=0;n<3;n++)mt[n]=t.position[e+n];(0,j.t)(mt,mt,yt);for(let n=0;n<3;n++)t.position[e+n]=mt[n]}if(e[0]!==e[1]||e[1]!==e[2]){yt[0]=1/e[0],yt[4]=1/e[1],yt[8]=1/e[2];for(let e=0;e<t.normal.length;e+=3){for(let n=0;n<3;n++)mt[n]=t.normal[e+n];(0,j.t)(mt,mt,yt),(0,j.n)(mt,mt);for(let n=0;n<3;n++)t.normal[e+n]=mt[n]}}}}(t,function(t,e,n){const r=(0,W._0)(e,n);if(null==t&&1===r)return null;if(null==t)return[r,r,r];if("number"==typeof t){const e=t*r;return[e,e,e]}return[null!=t.width?t.width*r:r,null!=t.depth?t.depth*r:r,null!=t.height?t.height*r:r]}(n?.size,n?.unit,e.spatialReference));const{vertexAttributes:r,vertexSpace:o,transform:i}=(0,W.EX)(t,e,{vertexSpace:n?.vertexSpace,geographic:n?.geographic});return{vertexAttributes:new T.s({...r,uv:t.uv}),vertexSpace:o,transform:i,components:[new v.c({faces:t.faces,material:n?.material||null})],spatialReference:e.spatialReference}}const gt={faceDescriptions:[{axis:[0,-1,0],uvOrigin:[0,.625],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[1,0,0],uvOrigin:[.25,.625],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[0,1,0],uvOrigin:[.5,.625],corners:[[1,-1],[-1,-1],[-1,1],[1,1]]},{axis:[-1,0,0],uvOrigin:[.75,.625],corners:[[1,-1],[-1,-1],[-1,1],[1,1]]},{axis:[0,0,1],uvOrigin:[0,.375],corners:[[-1,-1],[1,-1],[1,1],[-1,1]]},{axis:[0,0,-1],uvOrigin:[0,.875],corners:[[-1,1],[1,1],[1,-1],[-1,-1]]}],uvScales:[[0,0],[1,0],[1,1],[0,1]],faceVertexOffsets:[0,1,2,0,2,3]},dt={south:0,east:1,north:2,west:3,up:4,down:5},mt=(0,p.Su)(),yt=(0,ht.Su)();var xt=n(77556),vt=n(15008),wt=n(87104),At=n(82448),bt=n(51120),_t=n(38496);const St="esri.geometry.support.meshUtils.rotate";function Tt(t,e,n,r=p.cX){if(null!=t){(0,vt.IT)(Ft,(0,x.kX)(e),(0,x.Yz)(e));for(let e=0;e<t.length;e+=n){for(let n=0;n<3;n++)Mt[n]=t[e+n]-r[n];(0,j.e)(Mt,Mt,Ft);for(let n=0;n<3;n++)t[e+n]=Mt[n]+r[n]}}}const Mt=(0,p.Su)(),qt=(0,p.Su)(),Ct=(0,x.Su)(),Ft=(0,wt.Su)(),Ot=(0,ht.Su)(),Lt=(0,p.Su)(),It="esri.geometry.support.meshUtils.scale";function Pt(t,e,n=p.cX){if(t)for(let r=0;r<t.length;r+=3){for(let e=0;e<3;e++)Rt[e]=t[r+e]-n[e];(0,j.i)(Rt,Rt,e);for(let e=0;e<3;e++)t[r+e]=Rt[e]+n[e]}}const Rt=(0,p.Su)(),jt=(0,p.Su)(),kt=(0,p.Su)();var Ut;const Nt="esri.geometry.Mesh";function Et(){return a.c.getLogger(Nt)}const Dt={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:b.c,local:_.c}};let Bt=Ut=class extends(s.c.LoadableMixin((0,l.g)(d.c))){constructor(t){super(t),this.components=null,this.vertexSpace=new b.c,this.transform=null,this.metadata=new ut,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new T.s,this.type="mesh"}initialize(){(0===this.metadata.externalSources.length||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when((()=>{this.addHandles((0,u.aE)((()=>({vertexAttributes:this.vertexAttributes,components:this.components?.map((t=>t.clone()))})),(()=>this._clearSources()),{once:!0,sync:!0}))}))}get hasExtent(){return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):null!=this.metadata.displaySource?.extent}get _transformedExtent(){const{components:t,spatialReference:e,vertexAttributes:n,vertexSpace:r}=this,o=n.position;if(0===o.length||t&&0===t.length)return new g.c({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0,spatialReference:e});if("local"===r.type){const{_untransformedExtent:t,transform:n}=this;return function({xmin:t,xmax:e,ymin:n,ymax:r,zmin:o,zmax:i},s,a,l){o??=0,i??=0,z??=new Float64Array(24);const c=z;return c[0]=t,c[1]=n,c[2]=o,c[3]=t,c[4]=r,c[5]=o,c[6]=e,c[7]=r,c[8]=o,c[9]=e,c[10]=n,c[11]=o,c[12]=t,c[13]=n,c[14]=i,c[15]=t,c[16]=r,c[17]=i,c[18]=e,c[19]=r,c[20]=i,c[21]=e,c[22]=n,c[23]=i,(0,W.project)({positions:c,transform:s,vertexSpace:a,inSpatialReference:l,outSpatialReference:l,outPositions:c}),$(c,l)}(t,n,r,e)}if("georeferenced"===r.type&&(0,M.k$)(r)){const{transform:t}=this;return $((0,W.project)({positions:o,transform:t,vertexSpace:r,inSpatialReference:e,outSpatialReference:e}),e)}return $(o,e)}get _untransformedExtent(){return $(this.vertexAttributes.position,this.spatialReference)}get anchor(){const t=(0,M.mA)(this.vertexSpace,this.spatialReference);if(null!=t)return t;const{center:e,zmin:n}=this._transformedExtent;return new m.c({x:e.x,y:e.y,z:n,spatialReference:this.spatialReference})}get origin(){const t=(0,M.mA)(this.vertexSpace,this.spatialReference);return null!=t?t:this._transformedExtent.center}get extent(){return this.loaded||null==this.metadata?.displaySource?.extent?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(t){this._checkIfLoaded("addComponent()")&&(this.components||(this.components=[]),this.components.push(v.c.from(t)),this.notifyChange("components"))}removeComponent(t){if(this._checkIfLoaded("removeComponent()")){if(this.components){const e=this.components.indexOf(t);if(-1!==e)return this.components.splice(e,1),void this.notifyChange("components")}Et().error("removeComponent()","Provided component is not part of the list of components")}}rotate(t,e,n,r){return(0,x.GA)(t,e,n,Wt),function(t,e,n){if(!t.vertexAttributes?.position||0===e[3])return;const{spatialReference:r,vertexSpace:o}=t,i=n?.origin??t.anchor,s=n?.geographic,l=(0,H.QL)(St,o,r,s);(0,M.k$)(o)?(t.transform??=new S.c,function(t,e,n,r){const o=(0,j.s)(Mt,r.x,r.y,r.z??0),i=(0,j.f)(Mt,o,e);t.applyLocalInverse(i,qt),t.rotation=(0,x.Jn)(t.rotation,n,(0,x.Su)()),t.applyLocalInverse(i,i),(0,j.f)(i,i,qt),t.translation=(0,j.g)((0,p.Su)(),t.translation,i)}(t.transform,o.origin,e,i)):l?function(t,e,n){const r=t.spatialReference,o=(0,At._s)(r),i=Lt;(0,G.M)(n,i,o)||(0,G.M)(t.origin,i,o);const s=t.vertexAttributes.position,a=t.vertexAttributes.normal,l=t.vertexAttributes.tangent,c=new Float64Array(s.length),u=null!=a?new Float32Array(a.length):null,h=null!=l?new Float32Array(l.length):null;(0,bt.y)(o,i,Ft,o),(0,xt.kr)(Ot,Ft);const f=Ct;(0,j.t)((0,x.Yz)(Ct),(0,x.Yz)(e),Ot),f[3]=e[3],(0,_t.K_)(s,r,c),null!=a&&null!=u&&(0,_t.cH)(a,s,c,r,u),null!=l&&null!=h&&(0,_t.GW)(l,s,c,r,h),Tt(c,f,3,i),(0,_t.o$)(c,s,r),null!=a&&null!=u&&(Tt(u,f,3),(0,_t.QP)(u,s,c,r,a)),null!=l&&null!=h&&(Tt(h,f,4),(0,_t.Cr)(h,s,c,r,l)),t.vertexAttributesChanged()}(t,e,i):function(t,e,n){const r=Lt;if(!(0,G.M)(n,r,t.spatialReference)){const e=t.origin;r[0]=e.x,r[1]=e.y,r[2]=e.z,a.c.getLogger(St).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}Tt(t.vertexAttributes.position,e,3,r),Tt(t.vertexAttributes.normal,e,3),Tt(t.vertexAttributes.tangent,e,4),t.vertexAttributesChanged()}(t,e,i)}(this,Wt,r),this}offset(t,e,n){if(!this._checkIfLoaded("offset()"))return this;const{vertexSpace:r,vertexAttributes:o}=this,i=o?.position;if(!i)return this;if((0,M.k$)(r)){const[o,i,s]=r.origin;r.origin=(0,p.WK)(o+t,i+e,s+n)}else{for(let r=0;r<i.length;r+=3)i[r]+=t,i[r+1]+=e,i[r+2]+=n;this.vertexAttributesChanged()}return this}scale(t,e){return this._checkIfLoaded("scale()")?(function(t,e,n){if(!t.vertexAttributes?.position)return;const{vertexSpace:r,spatialReference:o}=t,i=n?.origin??t.anchor,s=n?.geographic,l=(0,H.QL)(It,r,o,s);(0,M.k$)(r)?(t.transform??=new S.c,function(t,e,n,r){const o=(0,j.s)(Rt,r.x,r.y,r.z),i=(0,j.f)(Rt,o,e);t.applyLocalInverse(i,jt);const s=(0,j.i)((0,p.Su)(),t.scale,n);t.scale=s,t.applyLocalInverse(i,i),(0,j.f)(i,i,jt),t.translation=(0,j.g)((0,p.Su)(),t.translation,i)}(t.transform,r.origin,e,i)):l?function(t,e,n){const r=t.spatialReference,o=(0,At._s)(r),i=kt;(0,G.M)(n,i,o)||(0,G.M)(t.origin,i,o);const s=t.vertexAttributes.position,a=t.vertexAttributes.normal,l=t.vertexAttributes.tangent,c=new Float64Array(s.length),u=null!=a?new Float32Array(a.length):null,h=null!=l?new Float32Array(l.length):null;(0,_t.K_)(s,r,c),null!=a&&null!=u&&(0,_t.cH)(a,s,c,r,u),null!=l&&null!=h&&(0,_t.GW)(l,s,c,r,h),Pt(c,e,i),(0,_t.o$)(c,s,r),null!=a&&null!=u&&(0,_t.QP)(u,s,c,r,a),null!=l&&null!=h&&(0,_t.Cr)(h,s,c,r,l),t.vertexAttributesChanged()}(t,e,i):function(t,e,n){const r=kt;if(!(0,G.M)(n,r,t.spatialReference)){const e=t.origin;r[0]=e.x,r[1]=e.y,r[2]=e.z,a.c.getLogger(It).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}Pt(t.vertexAttributes.position,e,r),t.vertexAttributesChanged()}(t,e,i)}(this,t,e),this):this}centerAt(t,e){return this._checkIfLoaded("centerAt()")?(function(t,e,n){if(!t.vertexAttributes?.position)return;const{vertexSpace:r}=t,o=n?.origin??t.anchor,i=n?.geographic,s=(0,H.QL)(Z,r,o.spatialReference,i);(0,M.k$)(r)?function(t,e,n){const{vertexSpace:r}=t;if(!(0,M.k$)(r))return;const o=V,i=K;if(!(0,G.M)(e,i,t.spatialReference))return void a.c.getLogger(Z).error(`Failed to project centerAt location (wkid:${e.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`);if(!(0,G.M)(n,o,t.spatialReference)){const e=t.origin;o[0]=e.x,o[1]=e.y,o[2]=e.z,a.c.getLogger(Z).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}const s=(0,j.f)(Y,i,o);r.origin=(0,j.g)((0,p.Su)(),r.origin,s)}(t,e,o):s?function(t,e,n){const r=(0,W.qu)(t.vertexAttributes,n),{position:o,normal:i,tangent:s}=(0,W.mC)(r,e,!1);t.vertexAttributes.position=o,t.vertexAttributes.normal=i,t.vertexAttributes.tangent=s,t.vertexAttributesChanged()}(t,e,o):function(t,e,n){const r=V,o=K;if((0,G.M)(e,o,t.spatialReference)){if(!(0,G.M)(n,r,t.spatialReference)){const e=t.origin;r[0]=e.x,r[1]=e.y,r[2]=e.z,a.c.getLogger(Z).error(`Failed to project specified origin (wkid:${n.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}(function(t,e,n){if(t)for(let r=0;r<t.length;r+=3)for(let o=0;o<3;o++)t[r+o]+=e[o]-n[o]})(t.vertexAttributes.position,o,r),t.vertexAttributesChanged()}else a.c.getLogger(Z).error(`Failed to project centerAt location (wkid:${e.spatialReference.wkid}) to mesh spatial reference (wkid:${t.spatialReference.wkid}). Projection may be possible after calling projection.load().`)}(t,e,o)}(this,t,e),this):this}load(t){const{metadata:{displaySource:e}}=this;return e&&this.addResolvingPromise(async function(t,e,r){const{source:o}=e,{loadGLTFMesh:s}=await(0,c.Yv)(Promise.all([n.e(8108),n.e(2818)]).then(n.bind(n,42818)),r),a=await async function(t,e){if(Array.isArray(t)){if(!t.length)throw new i.c("mesh-load-external:missing-assets","There must be at least one file to load");return t[0]instanceof File?function(t){return ot(t.map((t=>({name:t.name,mimeType:t.type,source:J(t)}))))}(t):async function(t,e){const n=await(0,c.Y3)(t.map((async t=>{const n=await async function(t,e){const{parts:n,assetMimeType:r,assetName:o}=t;if(1===n.length)return new it(n[0].partUrl);const i=await t.toBlob(e);return(0,c.wp)(e),it.fromBlob(i,st(o,r))}(t);return(0,c.wp)(e),{name:t.assetName,mimeType:t.assetMimeType,source:n}})));if((0,c.wv)(e))throw n.forEach((t=>t.source.dispose())),(0,c.Uh)();return ot(n)}(t,e)}return J(t)}(o,r);(0,c.wp)(r);const l=s(new m.c({x:0,y:0,z:0,spatialReference:t.spatialReference}),a.url,{resolveFile:Q(a),signal:r?.signal,expectedType:a.type});l.then((()=>a.dispose()),(()=>a.dispose()));const{vertexAttributes:u,components:h}=await l;t.vertexAttributes=u,t.components=h}(this,e,t)),Promise.resolve(this)}addExternalSources(t){this.metadata.externalSources.addMany(t)}updateDisplaySource(t){this.metadata.displaySource=t}clone(){return this.cloneWithVertexSpace(this.vertexSpace.clone())}cloneWithVertexSpace(t){let e=null;if(this.components){const t=new Map,n=new Map;e=this.components.map((e=>e.cloneWithDeduplication(t,n)))}const n={components:e,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes.clone(),vertexSpace:t,transform:this.transform?.clone()??null,metadata:this.metadata.clone()};return new Ut(n)}cloneShallow(){return new Ut({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(t){const e=n.e(4232).then(n.bind(n,4232)),r=this.load(),o=await Promise.all([e,r]),{toBinaryGLTF:i}=o[0];return i(this,t)}get memoryUsage(){let t=0;if(t+=this.vertexAttributes.memoryUsage,null!=this.components)for(const e of this.components)t+=e.memoryUsage;return t}_clearSources(){this.metadata.clearSources()}_checkIfLoaded(t){return!!this.loaded||(Et().error(t,"Mesh must be loaded before applying operations"),!1)}static createBox(t,e){if(!(t instanceof m.c))return Et().error(".createBox()",w),null;const n=new Ut(pt(function(){const{faceDescriptions:t,faceVertexOffsets:e,uvScales:n}=gt,r=4*t.length,o=new Float64Array(3*r),i=new Float32Array(3*r),s=new Float32Array(2*r),a=new Uint32Array(2*t.length*3);let l=0,c=0,u=0,h=0;for(let r=0;r<t.length;r++){const f=t[r],p=l/3;for(const t of e)a[h++]=p+t;const g=f.corners;for(let t=0;t<4;t++){const e=g[t];let r=0;s[u++]=.25*n[t][0]+f.uvOrigin[0],s[u++]=f.uvOrigin[1]-.25*n[t][1];for(let t=0;t<3;t++)0!==f.axis[t]?(o[l++]=.5*f.axis[t],i[c++]=f.axis[t]):(o[l++]=.5*e[r++],i[c++]=0)}}return{position:o,normal:i,uv:s,faces:a}}(),t,e));return e?.imageFace&&"all"!==e.imageFace?function(t,e){const n=t.components[0],r=n.faces,o=dt[e],i=6*o,s=new Array(6),a=new Array(r.length-6);let l=0,c=0;for(let t=0;t<r.length;t++)t>=i&&t<i+6?s[l++]=r[t]:a[c++]=r[t];if(null!=t.vertexAttributes.uv){const e=new Float32Array(t.vertexAttributes.uv),n=4*o*2,r=[0,1,1,1,1,0,0,0];for(let t=0;t<r.length;t++)e[n+t]=r[t];t.vertexAttributes.uv=e}return t.components=[new v.c({faces:s,material:n.material}),new v.c({faces:a})],t}(n,e.imageFace):n}static createSphere(t,e){return t instanceof m.c?new Ut(pt(function(t=0){const e=Math.round(8*2**t),n=2*e,r=(e-1)*(n+1)+2*n,o=new Float64Array(3*r),i=new Float32Array(3*r),s=new Float32Array(2*r),a=new Uint32Array((e-1)*n*2*3);let l=0,c=0,u=0,h=0;for(let t=0;t<=e;t++){const r=t/e*Math.PI+.5*Math.PI,f=Math.cos(r),p=Math.sin(r);mt[2]=p;const g=0===t||t===e,d=g?n-1:n;for(let r=0;r<=d;r++){const p=r/d*2*Math.PI;mt[0]=-Math.sin(p)*f,mt[1]=Math.cos(p)*f;for(let t=0;t<3;t++)o[l]=.5*mt[t],i[l]=mt[t],++l;s[c++]=(r+(g?.5:0))/n,s[c++]=t/e,0!==t&&r!==n&&(t!==e&&(a[u++]=h,a[u++]=h+1,a[u++]=h-n),1!==t&&(a[u++]=h,a[u++]=h-n,a[u++]=h-n-1)),h++}}return{position:o,normal:i,uv:s,faces:a}}(e?.densificationFactor||0),t,e)):(Et().error(".createSphere()",w),null)}static createCylinder(t,e){return t instanceof m.c?new Ut(pt(function(t=0){const e=Math.round(16*2**t),n=4*(e+1)+2*e,r=new Float64Array(3*n),o=new Float32Array(3*n),i=new Float32Array(2*n),s=new Uint32Array(4*e*3);let a=0,l=0,c=0,u=0,h=0;for(let t=0;t<=5;t++){const n=0===t||5===t,f=t<=1||t>=4,p=2===t||4===t,g=n?e-1:e;for(let d=0;d<=g;d++){const m=d/g*2*Math.PI,y=n?0:.5;mt[0]=y*Math.sin(m),mt[1]=y*-Math.cos(m),mt[2]=t<=2?.5:-.5;for(let e=0;e<3;e++)r[a++]=mt[e],o[l++]=f?2===e?t<=1?1:-1:0:2===e?0:mt[e]/y;i[c++]=(d+(n?.5:0))/e,i[c++]=t<=1?1*t/3:t<=3?1*(t-2)/3+1/3:1*(t-4)/3+2/3,p||0===t||d===e||(5!==t&&(s[u++]=h,s[u++]=h+1,s[u++]=h-e),1!==t&&(s[u++]=h,s[u++]=h-e,s[u++]=h-e-1)),h++}}return{position:r,normal:o,uv:i,faces:s}}(e?.densificationFactor||0),t,e)):(Et().error(".createCylinder()",w),null)}static createPlane(t,e){if(!(t instanceof m.c))return Et().error(".createPlane()",w),null;const n=e?.facing??"up",r=function(t,e){const n="number"==typeof e?e:null!=e?e.width:1,r="number"==typeof e?e:null!=e?e.height:1;switch(t){case"up":case"down":return{width:n,depth:r};case"north":case"south":return{width:n,height:r};case"east":case"west":return{depth:n,height:r}}}(n,e?.size);return new Ut(pt(function(t){const e=ft.facingAxisOrderSwap[t],n=ft.position,r=ft.normal,o=new Float64Array(n.length),i=new Float32Array(r.length);let s=0;for(let t=0;t<4;t++){const t=s;for(let a=0;a<3;a++){const l=e[a],c=Math.abs(l)-1,u=l>=0?1:-1;o[s]=n[t+c]*u,i[s]=r[t+c]*u,s++}}return{position:o,normal:i,uv:new Float32Array(ft.uv),faces:new Uint32Array(ft.faces),isPlane:!0}}(n),t,{...e,size:r}))}static createFromPolygon(t,e){if(!(t instanceof y.c))return Et().error(".createFromPolygon()","Expected polygon to be a Polygon instance"),null;const n=function(t){const e=function(t,e,n,r){const o=t.length,i=new Array(o),s=new Array(o),a=new Array(o);let l=0,c=0,u=0,h=0;for(let e=0;e<o;++e)h+=t[e].length;const f=(0,O.Gg)(3*h);let p=0;for(let h=o-1;h>=0;h--){const g=t[h],d=n===D.CCW_IS_HOLE&&E(g,e,r);if(d&&1!==o)i[l++]=g;else{let t=g.length;for(let e=0;e<l;++e)t+=i[e].length;const n={index:p,pathLengths:new Array(l+1),count:t,holeIndices:new Array(l)};n.pathLengths[0]=g.length,g.length>0&&(a[u++]={index:p,count:g.length}),p=d?N(g,g.length-1,-1,f,p,g.length,e):N(g,0,1,f,p,g.length,e);for(let t=0;t<l;++t){const r=i[t];n.holeIndices[t]=p,n.pathLengths[t+1]=r.length,r.length>0&&(a[u++]={index:p,count:r.length}),p=N(r,0,1,f,p,r.length,e)}l=0,n.count>0&&(s[c++]=n)}}for(let t=0;t<l;++t){const n=i[t];n.length>0&&(a[u++]={index:p,count:n.length}),p=N(n,0,1,f,p,n.length,e)}return s.length=c,a.length=u,{position:f,polygons:s,outlines:a}}(t.rings,t.hasZ,D.CCW_IS_HOLE,t.spatialReference),n=new Array;let r=0,o=0;for(const t of e.polygons){const i=t.count,s=t.index,a=(0,O.lL)(e.position,3*s,3*i),l=t.holeIndices.map((t=>t-s)),c=(0,L.Uv)((0,q.e)(a,l,3));n.push({position:a,faces:c}),r+=a.length,o+=c.length}const i=function(t,e,n){if(1===t.length)return t[0];const r=(0,O.Gg)(e),o=new Array(n);let i=0,s=0,a=0;for(const e of t){for(let t=0;t<e.position.length;t++)r[i++]=e.position[t];for(const t of e.faces)o[s++]=t+a;a=i/3}return{position:r,faces:(0,L.Uv)(o)}}(n,r,o),s=Array.isArray(i.position)?(0,I.g)(i.position,3,{originalIndices:i.faces}):(0,I.g)(i.position.buffer,6,{originalIndices:i.faces});return i.position=(0,O.cp)(new Float64Array(s.buffer)),i.faces=s.indices,i}(t);return new Ut({vertexAttributes:new T.s({position:n.position}),components:[new v.c({faces:n.faces,shading:"flat",material:e?.material??null})],spatialReference:t.spatialReference,vertexSpace:new b.c})}static async createFromGLTF(t,e,r){if(!(t instanceof m.c)){const t=new A;throw Et().error(".createfromGLTF()",t.message),t}const{loadGLTFMesh:o}=await(0,c.Yv)(Promise.all([n.e(8108),n.e(2818)]).then(n.bind(n,42818)),r);return new Ut(await o(t,e,r))}static async createFromFiles(t,e,n){if((0,o.gx)(Et(),"`Mesh.createFromFiles` is deprecated in favor of 'SceneLayer.convertMesh'",{replacement:"SceneLayer.convertMesh",version:"4.29"}),!(t instanceof m.c)){const t=new A;throw(t=>{Et().error(".createFromFiles()",t.message)})(t),t}if(!n?.layer)throw new i.c("invalid:no-layer","SceneLayer required for file to mesh conversion.");return n.layer.convertMesh(e,{location:t,...n})}static createWithExternalSource(t,e,n){const r=n?.extent??null,{x:o,y:i,z:s,spatialReference:a}=t,l=n?.transform?.clone()??new S.c,c=(0,p.WK)(o,i,s??0),u=(0,M.mm)(n?.vertexSpace??(0,M.GF)(a),c),h={source:e,extent:r},f=new ut;return f.externalSources.push(h),new Ut({metadata:f,transform:l,vertexSpace:u,spatialReference:a})}static createIncomplete(t,e){const{x:n,y:r,z:o,spatialReference:s}=t,a=e?.transform?.clone()??new S.c,l=(0,p.WK)(n,r,o??0),c=(0,M.mm)(e?.vertexSpace??(0,M.GF)(s),l),u=new Ut({transform:a,vertexSpace:c,spatialReference:s});return u.addResolvingPromise(Promise.reject(new i.c("mesh-incomplete","Mesh resources are not complete"))),u}};(0,r._)([(0,h.qq)({type:[v.c],json:{write:!0}})],Bt.prototype,"components",void 0),(0,r._)([(0,h.qq)({nonNullable:!0,types:Dt,constructOnly:!0,json:{write:!0}})],Bt.prototype,"vertexSpace",void 0),(0,r._)([(0,h.qq)({type:S.c,json:{write:!0}})],Bt.prototype,"transform",void 0),(0,r._)([(0,h.qq)({constructOnly:!0})],Bt.prototype,"metadata",void 0),(0,r._)([(0,h.qq)()],Bt.prototype,"hasExtent",null),(0,r._)([(0,h.qq)()],Bt.prototype,"_transformedExtent",null),(0,r._)([(0,h.qq)()],Bt.prototype,"_untransformedExtent",null),(0,r._)([(0,h.qq)()],Bt.prototype,"anchor",null),(0,r._)([(0,h.qq)()],Bt.prototype,"origin",null),(0,r._)([(0,h.qq)({readOnly:!0,json:{read:!1}})],Bt.prototype,"extent",null),(0,r._)([(0,h.qq)({readOnly:!0,json:{read:!1,write:!0,default:!0}})],Bt.prototype,"hasZ",void 0),(0,r._)([(0,h.qq)({readOnly:!0,json:{read:!1,write:!0,default:!1}})],Bt.prototype,"hasM",void 0),(0,r._)([(0,h.qq)({type:T.s,nonNullable:!0,json:{write:!0}})],Bt.prototype,"vertexAttributes",void 0),Bt=Ut=(0,r._)([(0,f.c)(Nt)],Bt);const Wt=(0,x.Su)(),zt=Bt},15688:(t,e,n)=>{n.d(e,{Gg:()=>o,cp:()=>i,lL:()=>s,mw:()=>a,qW:()=>l});var r=n(72008);function o(t,e=!1){return t<=r._?e?new Array(t).fill(0):new Array(t):new Float64Array(t)}function i(t){return((0,r.c7)(t)?t.length:t.byteLength/8)<=r._?Array.from(t):new Float64Array(t)}function s(t,e,n){return Array.isArray(t)?t.slice(e,e+n):t.subarray(e,e+n)}function a(t,e){for(let n=0;n<e.length;++n)t[n]=e[n];return t}function l(t){return Array.isArray(t)?new Float64Array(t):t}},43912:(t,e,n)=>{n.d(e,{c:()=>m});var r,o=n(41948),i=n(40504),s=n(62088),a=n(66360),l=n(1580),c=n(33392),u=n(12552),h=n(53368),f=n(96344),p=n(70492),g=n(82384);let d=r=class extends i.am{static from(t){return(0,h.uY)(r,t)}constructor(t){super(t),this.faces=null,this.material=null,this.name=void 0,this.shading="source",this.trustSourceNormals=!1}castFaces(t){return(0,g.c)(t,Uint32Array,[Uint16Array],{loggerTag:".faces=",stride:3},a.c.getLogger(this))}castMaterial(t){return(0,h.uY)(t&&"object"==typeof t&&("metallic"in t||"roughness"in t||"metallicRoughnessTexture"in t)?p.c:f.c,t)}clone(){return new r({faces:(0,s.ct)(this.faces),shading:this.shading,material:(0,s.ct)(this.material),trustSourceNormals:this.trustSourceNormals,name:this.name})}cloneWithDeduplication(t,e){const n={faces:(0,s.ct)(this.faces),shading:this.shading,material:this.material?this.material.cloneWithDeduplication(t,e):null,trustSourceNormals:this.trustSourceNormals,name:this.name};return new r(n)}get memoryUsage(){let t=0;return null!=this.faces&&(t+=this.faces.byteLength),null!=this.material&&(t+=this.material.memoryUsage),t}};(0,o._)([(0,l.qq)({json:{write:!0}})],d.prototype,"faces",void 0),(0,o._)([(0,c.W)("faces")],d.prototype,"castFaces",null),(0,o._)([(0,l.qq)({type:f.c,json:{write:!0}})],d.prototype,"material",void 0),(0,o._)([(0,c.W)("material")],d.prototype,"castMaterial",null),(0,o._)([(0,l.qq)()],d.prototype,"name",void 0),(0,o._)([(0,l.qq)({type:String,json:{write:!0}})],d.prototype,"shading",void 0),(0,o._)([(0,l.qq)({type:Boolean})],d.prototype,"trustSourceNormals",void 0),d=r=(0,o._)([(0,u.c)("esri.geometry.support.MeshComponent")],d);const m=d},51232:(t,e,n)=>{n.d(e,{c:()=>u});var r=n(41948),o=n(3856),i=n(40504),s=n(1580),a=(n(9456),n(66360),n(72052),n(9968)),l=n(12552);let c=class extends((0,o.q)(i.am)){constructor(t){super(t),this.type="georeferenced",this.origin=null}};(0,r._)([(0,a.G)({georeferenced:"georeferenced"},{readOnly:!0})],c.prototype,"type",void 0),(0,r._)([(0,s.qq)({type:[Number],nonNullable:!1,json:{write:!0}})],c.prototype,"origin",void 0),c=(0,r._)([(0,l.c)("esri.geometry.support.MeshGeoreferencedVertexSpace")],c);const u=c},13708:(t,e,n)=>{n.d(e,{c:()=>h});var r=n(41948),o=n(3856),i=n(40504),s=n(1580),a=(n(9456),n(66360),n(72052),n(9968)),l=n(12552),c=n(62484);let u=class extends((0,o.q)(i.am)){constructor(t){super(t),this.type="local",this.origin=(0,c.Su)()}};(0,r._)([(0,a.G)({local:"local"},{readOnly:!0})],u.prototype,"type",void 0),(0,r._)([(0,s.qq)({type:[Number],nonNullable:!0,json:{write:!0}})],u.prototype,"origin",void 0),u=(0,r._)([(0,l.c)("esri.geometry.support.MeshLocalVertexSpace")],u);const h=u},96344:(t,e,n)=>{n.d(e,{c:()=>f});var r,o=n(41948),i=n(44728),s=n(40504),a=n(1580),l=(n(9456),n(66360),n(72052),n(12552)),c=n(7192),u=n(56160);let h=r=class extends s.am{constructor(t){super(t),this.color=null,this.colorTexture=null,this.colorTextureTransform=null,this.normalTexture=void 0,this.normalTextureTransform=void 0,this.alphaMode="auto",this.alphaCutoff=.5,this.doubleSided=!0}clone(){return this.cloneWithDeduplication(null,new Map)}cloneWithDeduplication(t,e){const n=null!=t?t.get(this):null;if(n)return n;const o=new r(this.clonePropertiesWithDeduplication(e));return null!=t&&t.set(this,o),o}clonePropertiesWithDeduplication(t){return{color:null!=this.color?this.color.clone():null,colorTexture:this.colorTexture?.cloneWithDeduplication(t),normalTexture:this.normalTexture?.cloneWithDeduplication(t),alphaMode:this.alphaMode,alphaCutoff:this.alphaCutoff,doubleSided:this.doubleSided,colorTextureTransform:this.colorTextureTransform?.clone(),normalTextureTransform:this.normalTextureTransform?.clone()}}get memoryUsage(){return this.getMemoryUsage()}getMemoryUsage(){let t=0;return t+=null!=this.color?16:0,null!=this.colorTexture&&(t+=this.colorTexture.memoryUsage),t+=null!=this.colorTextureTransform?20:0,null!=this.normalTexture&&(t+=this.normalTexture.memoryUsage),t+=null!=this.normalTextureTransform?20:0,t}};(0,o._)([(0,a.qq)({type:i.c,json:{write:!0}})],h.prototype,"color",void 0),(0,o._)([(0,a.qq)({type:c.c,json:{write:!0}})],h.prototype,"colorTexture",void 0),(0,o._)([(0,a.qq)({type:u.c,json:{write:!0}})],h.prototype,"colorTextureTransform",void 0),(0,o._)([(0,a.qq)({type:c.c,json:{write:!0}})],h.prototype,"normalTexture",void 0),(0,o._)([(0,a.qq)({type:u.c,json:{write:!0}})],h.prototype,"normalTextureTransform",void 0),(0,o._)([(0,a.qq)({nonNullable:!0,json:{write:!0}})],h.prototype,"alphaMode",void 0),(0,o._)([(0,a.qq)({nonNullable:!0,json:{write:!0}})],h.prototype,"alphaCutoff",void 0),(0,o._)([(0,a.qq)({nonNullable:!0,json:{write:!0}})],h.prototype,"doubleSided",void 0),h=r=(0,o._)([(0,l.c)("esri.geometry.support.MeshMaterial")],h);const f=h},70492:(t,e,n)=>{n.d(e,{c:()=>f});var r,o=n(41948),i=n(44728),s=n(1580),a=(n(9456),n(66360),n(72052),n(12552)),l=n(96344),c=n(7192),u=n(56160);let h=r=class extends l.c{constructor(t){super(t),this.emissiveColor=null,this.emissiveTexture=null,this.emissiveTextureTransform=void 0,this.occlusionTexture=null,this.occlusionTextureTransform=void 0,this.metallic=1,this.roughness=1,this.metallicRoughnessTexture=null,this.metallicRoughnessTextureTransform=void 0}clone(){return this.cloneWithDeduplication(null,new Map)}cloneWithDeduplication(t,e){const n=null!=t?t.get(this):null;if(n)return n;const o=new r(this.clonePropertiesWithDeduplication(e));return null!=t&&t.set(this,o),o}getMemoryUsage(){let t=super.getMemoryUsage();return t+=null!=this.emissiveColor?16:0,null!=this.emissiveTexture&&(t+=this.emissiveTexture.memoryUsage),t+=null!=this.emissiveTextureTransform?20:0,null!=this.occlusionTexture&&(t+=this.occlusionTexture.memoryUsage),t+=null!=this.occlusionTextureTransform?20:0,null!=this.metallicRoughnessTexture&&(t+=this.metallicRoughnessTexture.memoryUsage),t+=null!=this.metallicRoughnessTextureTransform?20:0,t}clonePropertiesWithDeduplication(t){return{...super.clonePropertiesWithDeduplication(t),emissiveColor:this.emissiveColor?.clone(),emissiveTexture:this.emissiveTexture?.cloneWithDeduplication(t),emissiveTextureTransform:this.emissiveTextureTransform?.clone(),occlusionTexture:this.occlusionTexture?.cloneWithDeduplication(t),occlusionTextureTransform:this.occlusionTextureTransform?.clone(),metallic:this.metallic,roughness:this.roughness,metallicRoughnessTexture:this.metallicRoughnessTexture?.cloneWithDeduplication(t),metallicRoughnessTextureTransform:this.metallicRoughnessTextureTransform?.clone()}}};(0,o._)([(0,s.qq)({type:i.c,json:{write:!0}})],h.prototype,"emissiveColor",void 0),(0,o._)([(0,s.qq)({type:c.c,json:{write:!0}})],h.prototype,"emissiveTexture",void 0),(0,o._)([(0,s.qq)({type:u.c,json:{write:!0}})],h.prototype,"emissiveTextureTransform",void 0),(0,o._)([(0,s.qq)({type:c.c,json:{write:!0}})],h.prototype,"occlusionTexture",void 0),(0,o._)([(0,s.qq)({type:u.c,json:{write:!0}})],h.prototype,"occlusionTextureTransform",void 0),(0,o._)([(0,s.qq)({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],h.prototype,"metallic",void 0),(0,o._)([(0,s.qq)({type:Number,nonNullable:!0,json:{write:!0},range:{min:0,max:1}})],h.prototype,"roughness",void 0),(0,o._)([(0,s.qq)({type:c.c,json:{write:!0}})],h.prototype,"metallicRoughnessTexture",void 0),(0,o._)([(0,s.qq)({type:u.c,json:{write:!0}})],h.prototype,"metallicRoughnessTextureTransform",void 0),h=r=(0,o._)([(0,a.c)("esri.geometry.support.MeshMaterialMetallicRoughness")],h);const f=h},7192:(t,e,n)=>{n.d(e,{c:()=>m});var r,o=n(41948),i=(n(9456),n(63316)),s=n(40504),a=n(1580),l=n(53368),c=(n(72052),n(33600)),u=n(12552),h=n(18996),f=n(91952);const p=new WeakMap;let g=0,d=r=class extends s.am{constructor(t){super(t),this.wrap="repeat"}get url(){return this._get("url")||null}set url(t){this._set("url",t),t&&this._set("data",null)}get data(){return this._get("data")||null}set data(t){this._set("data",t),t&&this._set("url",null)}writeData(t,e,n,r){if(t instanceof HTMLImageElement){const o={type:"image-element",src:(0,f.t)(t.src,r),crossOrigin:t.crossOrigin};e[n]=o}else if(t instanceof HTMLCanvasElement){const r=t.getContext("2d").getImageData(0,0,t.width,t.height),o={type:"canvas-element",imageData:this._encodeImageData(r)};e[n]=o}else if(t instanceof HTMLVideoElement){const o={type:"video-element",src:(0,f.t)(t.src,r),autoplay:t.autoplay,loop:t.loop,muted:t.muted,crossOrigin:t.crossOrigin,preload:t.preload};e[n]=o}else if(t instanceof ImageData){const r={type:"image-data",imageData:this._encodeImageData(t)};e[n]=r}}readData(t){switch(t.type){case"image-element":{const e=new Image;return e.src=t.src,e.crossOrigin=t.crossOrigin,e}case"canvas-element":{const e=this._decodeImageData(t.imageData),n=document.createElement("canvas");return n.width=e.width,n.height=e.height,n.getContext("2d").putImageData(e,0,0),n}case"image-data":return this._decodeImageData(t.imageData);case"video-element":{const e=document.createElement("video");return e.src=t.src,e.crossOrigin=t.crossOrigin,e.autoplay=t.autoplay,e.loop=t.loop,e.muted=t.muted,e.preload=t.preload,e}default:return}}get transparent(){const t=this.data,e=this.url;if(t instanceof HTMLCanvasElement)return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0,0,t.width,t.height));if(t instanceof ImageData)return this._imageDataContainsTransparent(t);if(e){const t=e.substr(e.length-4,4).toLowerCase(),n=e.substr(0,15).toLocaleLowerCase();if(".png"===t||"data:image/png;"===n)return!0}return!1}set transparent(t){this._overrideIfSome("transparent",t)}get contentHash(){const t="string"==typeof this.wrap?this.wrap:"object"==typeof this.wrap?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",e=(e="")=>`d:${e},t:${this.transparent},w:${t}`;return null!=this.url?e(this.url):null!=this.data?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?e(this.data.src):(p.has(this.data)||p.set(this.data,++g),e(p.get(this.data))):e()}get memoryUsage(){let t=0;if(t+=null!=this.url?this.url.length:0,null!=this.data){const e=this.data;"data"in e?t+=e.data.byteLength:e instanceof HTMLImageElement?t+=e.naturalWidth*e.naturalHeight*3:e instanceof HTMLCanvasElement&&(t+=e.width*e.height*3)}return t}clone(){const t={url:this.url,data:this.data,wrap:this._cloneWrap()};return new r(t)}cloneWithDeduplication(t){const e=t.get(this);if(e)return e;const n=this.clone();return t.set(this,n),n}_cloneWrap(){return"string"==typeof this.wrap?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}_encodeImageData(t){let e="";for(let n=0;n<t.data.length;n++)e+=String.fromCharCode(t.data[n]);return{data:btoa(e),width:t.width,height:t.height}}_decodeImageData(t){const e=atob(t.data),n=new Uint8ClampedArray(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return(0,i.wV)(n,t.width,t.height)}_imageDataContainsTransparent(t){for(let e=3;e<t.data.length;e+=4)if(255!==t.data[e])return!0;return!1}static from(t){return"string"==typeof t?new r({url:t}):t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLVideoElement?new r({data:t}):(0,l.uY)(r,t)}};(0,o._)([(0,a.qq)({type:String,json:{write:f.w}})],d.prototype,"url",null),(0,o._)([(0,a.qq)({json:{write:{overridePolicy(){return{enabled:!this.url}}}}}),(0,a.qq)()],d.prototype,"data",null),(0,o._)([(0,h.G)("data")],d.prototype,"writeData",null),(0,o._)([(0,c.E)("data")],d.prototype,"readData",null),(0,o._)([(0,a.qq)({type:Boolean,json:{write:{overridePolicy(){return{enabled:this._isOverridden("transparent")}}}}})],d.prototype,"transparent",null),(0,o._)([(0,a.qq)({json:{write:!0}})],d.prototype,"wrap",void 0),(0,o._)([(0,a.qq)({readOnly:!0})],d.prototype,"contentHash",null),d=r=(0,o._)([(0,u.c)("esri.geometry.support.MeshTexture")],d);const m=d},56160:(t,e,n)=>{n.d(e,{c:()=>c});var r=n(41948),o=n(3856),i=n(40504),s=n(1580),a=(n(9456),n(66360),n(72052),n(12552));let l=class extends((0,o.q)(i.am)){constructor(t){super(t),this.offset=[0,0],this.rotation=0,this.scale=[1,1]}};(0,r._)([(0,s.qq)({type:[Number],nonNullable:!0,json:{write:!0}})],l.prototype,"offset",void 0),(0,r._)([(0,s.qq)({type:Number,nonNullable:!0,json:{write:!0}})],l.prototype,"rotation",void 0),(0,r._)([(0,s.qq)({type:[Number],nonNullable:!0,json:{write:!0}})],l.prototype,"scale",void 0),l=(0,r._)([(0,a.c)("esri.geometry.support.MeshTextureTransform")],l);const c=l},41104:(t,e,n)=>{n.d(e,{c:()=>y});var r,o=n(41948),i=n(40504),s=n(1580),a=(n(9456),n(66360),n(72052),n(12552)),l=n(15008),c=n(87104),u=n(41512),h=n(2620),f=n(98472),p=n(62484),g=n(66952);let d=r=class extends i.am{constructor(t){super(t),this.translation=(0,p.Su)(),this.rotationAxis=(0,p.eu)(g.up),this.rotationAngle=0,this.scale=(0,p.WK)(1,1,1)}get rotation(){return(0,g.eE)(this.rotationAxis,this.rotationAngle)}set rotation(t){this.rotationAxis=(0,p.ct)((0,g.Yz)(t)),this.rotationAngle=(0,g.i4)(t)}get localMatrix(){const t=(0,c.Su)();return(0,u.yG)(m,(0,g.Yz)(this.rotation),(0,g.kX)(this.rotation)),(0,l.um)(t,m,this.translation,this.scale),t}get localMatrixInverse(){return(0,l.S_)((0,c.Su)(),this.localMatrix)}applyLocal(t,e){return(0,f.e)(e,t,this.localMatrix)}applyLocalInverse(t,e){return(0,f.e)(e,t,this.localMatrixInverse)}equals(t){return this===t||null!=t&&(0,l.sF)(this.localMatrix,t.localMatrix)}clone(){const t={translation:(0,p.ct)(this.translation),rotationAxis:(0,p.ct)(this.rotationAxis),rotationAngle:this.rotationAngle,scale:(0,p.ct)(this.scale)};return new r(t)}};(0,o._)([(0,s.qq)({type:[Number],nonNullable:!0,json:{write:!0}})],d.prototype,"translation",void 0),(0,o._)([(0,s.qq)({type:[Number],nonNullable:!0,json:{write:!0}})],d.prototype,"rotationAxis",void 0),(0,o._)([(0,s.qq)({type:Number,nonNullable:!0,json:{write:!0}})],d.prototype,"rotationAngle",void 0),(0,o._)([(0,s.qq)({type:[Number],nonNullable:!0,json:{write:!0}})],d.prototype,"scale",void 0),(0,o._)([(0,s.qq)()],d.prototype,"rotation",null),(0,o._)([(0,s.qq)()],d.prototype,"localMatrix",null),(0,o._)([(0,s.qq)()],d.prototype,"localMatrixInverse",null),d=r=(0,o._)([(0,a.c)("esri.geometry.support.MeshTransform")],d);const m=(0,h.Su)(),y=d},82384:(t,e,n)=>{n.d(e,{c:()=>p,s:()=>h});var r,o=n(41948),i=n(40504),s=n(62088),a=n(66360),l=n(1580),c=n(33392),u=n(12552);let h=r=class extends i.am{constructor(t){super(t),this.color=null,this.position=new Float64Array(0),this.uv=null,this.normal=null,this.tangent=null}castColor(t){return p(t,Uint8Array,[Uint8ClampedArray],{loggerTag:".color=",stride:4},a.c.getLogger(this))}castPosition(t){return t&&t instanceof Float32Array&&a.c.getLogger(this).warn(".position=","Setting position attribute from a Float32Array may cause precision problems. Consider storing data in a Float64Array or a regular number array"),p(t,Float64Array,[Float32Array],{loggerTag:".position=",stride:3},a.c.getLogger(this))}castUv(t){return p(t,Float32Array,[Float64Array],{loggerTag:".uv=",stride:2},a.c.getLogger(this))}castNormal(t){return p(t,Float32Array,[Float64Array],{loggerTag:".normal=",stride:3},a.c.getLogger(this))}castTangent(t){return p(t,Float32Array,[Float64Array],{loggerTag:".tangent=",stride:4},a.c.getLogger(this))}clone(){const t={position:(0,s.ct)(this.position),uv:(0,s.ct)(this.uv),normal:(0,s.ct)(this.normal),tangent:(0,s.ct)(this.tangent),color:(0,s.ct)(this.color)};return new r(t)}clonePositional(){const t={position:(0,s.ct)(this.position),normal:(0,s.ct)(this.normal),tangent:(0,s.ct)(this.tangent),uv:this.uv,color:this.color};return new r(t)}get memoryUsage(){let t=0;return t+=this.position.byteLength,null!=this.uv&&(t+=this.uv.byteLength),null!=this.normal&&(t+=this.normal.byteLength),null!=this.tangent&&(t+=this.tangent.byteLength),null!=this.color&&(t+=this.color.byteLength),t}};function f(t,e,n,r){const{loggerTag:o,stride:i}=e;return t.length%i!=0?(r.error(o,`Invalid array length, expected a multiple of ${i}`),new n([])):t}function p(t,e,n,r,o){if(!t)return t;if(t instanceof e)return f(t,r,e,o);for(const i of n)if(t instanceof i)return f(new e(t),r,e,o);if(Array.isArray(t))return f(new e(t),r,e,o);{const r=n.map((t=>`'${t.name}'`));return o.error(`Failed to set property, expected one of ${r}, but got ${t.constructor.name}`),new e([])}}function g(t,e,n){e[n]=function(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=t[n];return e}(t)}(0,o._)([(0,l.qq)({json:{write:g}})],h.prototype,"color",void 0),(0,o._)([(0,c.W)("color")],h.prototype,"castColor",null),(0,o._)([(0,l.qq)({nonNullable:!0,json:{write:g}})],h.prototype,"position",void 0),(0,o._)([(0,c.W)("position")],h.prototype,"castPosition",null),(0,o._)([(0,l.qq)({json:{write:g}})],h.prototype,"uv",void 0),(0,o._)([(0,c.W)("uv")],h.prototype,"castUv",null),(0,o._)([(0,l.qq)({json:{write:g}})],h.prototype,"normal",void 0),(0,o._)([(0,c.W)("normal")],h.prototype,"castNormal",null),(0,o._)([(0,l.qq)({json:{write:g}})],h.prototype,"tangent",void 0),(0,o._)([(0,c.W)("tangent")],h.prototype,"castTangent",null),h=r=(0,o._)([(0,u.c)("esri.geometry.support.MeshVertexAttributes")],h)},66952:(t,e,n)=>{n.d(e,{GA:()=>h,Jn:()=>u,Su:()=>l,Yz:()=>f,eE:()=>c,i4:()=>p,kX:()=>g,up:()=>d});var r=n(53648),o=n(41512),i=n(2620),s=n(98472),a=n(62484);function l(t=d){return[t[0],t[1],t[2],t[3]]}function c(t,e,n=l()){return(0,s.c)(n,t),n[3]=e,n}function u(t,e,n=l()){return(0,o.yG)(m,t,g(t)),(0,o.yG)(y,e,g(e)),(0,o.iW)(m,y,m),function(t,e){return t[3]=e,t}(n,(0,r.UB)((0,o.C0)(n,m)))}function h(t,e,n,r=l()){return c(a.UV,t,x),c(a.IR,e,v),c(a.wx,n,w),u(x,v,x),u(x,w,r),r}function f(t){return t}function p(t){return t[3]}function g(t){return(0,r.EF)(t[3])}n(37008);const d=[0,0,1,0],m=(0,i.Su)(),y=(0,i.Su)(),x=(l(),l()),v=l(),w=l()},23704:(t,e,n)=>{n.d(e,{A:()=>o});var r=n(66360);const o=()=>r.c.getLogger("esri.views.3d.support.buffer.math")},24363:(t,e,n)=>{n.d(e,{C_:()=>u,Su:()=>l,i_:()=>c});var r=n(53648),o=n(52180),i=n(98472),s=n(62484),a=n(20136);function l(t){return t?{origin:(0,s.ct)(t.origin),vector:(0,s.ct)(t.vector)}:{origin:(0,s.Su)(),vector:(0,s.Su)()}}function c(t,e,n=l()){return(0,i.c)(n.origin,t),(0,i.f)(n.vector,e,t),n}function u(t,e,n){return function(t,e,n,o,s){const{vector:l,origin:c}=t,u=(0,i.f)(a.Wq.get(),e,c),h=(0,i.j)(l,u)/(0,i.o)(l);return(0,i.i)(s,l,(0,r.qk)(h,0,1)),(0,i.g)(s,s,t.origin)}(t,e,0,0,n)}(0,s.Su)(),(0,s.Su)(),new o.o((()=>l()))},54264:(t,e,n)=>{n.d(e,{CT:()=>x,Ki:()=>y,Si:()=>a,Ud:()=>c,_o:()=>d,ai:()=>l,mK:()=>v,v_:()=>g});var r=n(2600),o=n(92400),i=n(10860),s=n(4048);class a{constructor(t,e,n){this.assetName=t,this.assetMimeType=e,this.parts=n}equals(t){return this===t||this.assetName===t.assetName&&this.assetMimeType===t.assetMimeType&&(0,o.yK)(this.parts,t.parts,((t,e)=>t.equals(e)))}isOnService(t){return this.parts.every((e=>e.isOnService(t)))}makeHash(){let t="";for(const e of this.parts)t+=e.partHash;return t}async toBlob(t){const{parts:e}=this;if(1===e.length)return e[0].toBlob(t);const n=await Promise.all(e.map((e=>e.toBlob(t))));return(0,i.wp)(t),new Blob(n)}}class l{constructor(t,e){this.partUrl=t,this.partHash=e}equals(t){return this===t||this.partUrl===t.partUrl&&this.partHash===t.partHash}isOnService(t){return this.partUrl.startsWith(`${t.path}/assets/`)}async toBlob(t){const{data:e}=await(0,r.c)(this.partUrl,{responseType:"blob"});return(0,i.wp)(t),e}}function c(t){return function(t){return!!t&&(Array.isArray(t)?t.some(p):p(t))}(t?.source)}function u(t){return!!Array.isArray(t)&&t.every((t=>t instanceof a))}const h=/^(model\/gltf\+json)|(model\/gltf-binary)$/,f=/\.(gltf|glb)/i;function p(t){if(t instanceof File){const{type:e,name:n}=t;return h.test(e)||f.test(n)}return h.test(t.assetMimeType)||f.test(t.assetName)}function g(t,e){if(!t)return!1;const{source:n}=t;return function(t,e){if(Array.isArray(t)){const n=t;return n.length>0&&n.every((t=>m(t,e)))}return m(t,e)}(n,e)}function d(t,e){if(t===e)return!0;const{source:n}=t,{source:r}=e;if(n===r)return!0;if(u(n)&&u(r)){if(n.length!==r.length)return!1;const t=(t,e)=>t.assetName<e.assetName?-1:t.assetName>e.assetName?1:0,e=[...n].sort(t),o=[...r].sort(t);for(let t=0;t<e.length;++t)if(!e[t].equals(o[t]))return!1;return!0}return!1}function m(t,e){return t instanceof a&&t.isOnService(e)}function y(t,e){return t instanceof File?(0,s.K0)(t,e):(0,s.me)(t.assetMimeType,e)??(0,s.If)(t.assetName,e)}function x(t){return Array.isArray(t)?t:[t]}function v(t){return!!t.original}},77080:(t,e,n)=>{n.d(e,{g:()=>i});var r=n(53648),o=n(97143);function i(t,e,n){const i=Array.isArray(t),u=i?t.length/e:t.byteLength/(4*e),h=i?t:new Uint32Array(t,0,u*e),f=n?.minReduction??0,p=n?.originalIndices||null,g=p?p.length:0,d=n?.componentOffsets||null;let m=0;if(d)for(let t=0;t<d.length-1;t++){const e=d[t+1]-d[t];e>m&&(m=e)}else m=u;const y=Math.floor(1.1*m)+1;(null==c||c.length<2*y)&&(c=new Uint32Array((0,r.w7)(2*y)));for(let t=0;t<2*y;t++)c[t]=0;let x=0;const v=!!d&&!!p,w=v?g:u;let A=(0,o.aw)(u);const b=new Uint32Array(g),_=1.96;let S=0!==f?Math.ceil(4*_*_/(f*f)*f*(1-f)):w,T=1,M=d?d[1]:w;for(let t=0;t<w;t++){if(t===S){const e=1-x/t;if(e+_*Math.sqrt(e*(1-e)/t)<f)return null;S*=2}if(t===M){for(let t=0;t<2*y;t++)c[t]=0;if(p)for(let t=d[T-1];t<d[T];t++)b[t]=A[p[t]];M=d[++T]}const n=v?p[t]:t,r=n*e,o=l(h,r,e);let i=o%y,a=x;for(;0!==c[2*i+1];){if(c[2*i]===o){const t=c[2*i+1]-1;if(s(h,r,t*e,e)){a=A[t];break}}i++,i>=y&&(i-=y)}a===x&&(c[2*i]=o,c[2*i+1]=n+1,x++),A[n]=a}if(0!==f&&1-x/u<f)return null;if(v){for(let t=d[T-1];t<b.length;t++)b[t]=A[p[t]];A=(0,o.Uv)(b)}const q=i?new Array(x):new Uint32Array(x*e);x=0;for(let t=0;t<w;t++)A[t]===x&&(a(h,(v?p[t]:t)*e,q,x*e,e),x++);if(p&&!v){const t=new Uint32Array(g);for(let e=0;e<t.length;e++)t[e]=A[p[e]];A=(0,o.Uv)(t)}return{buffer:Array.isArray(q)?q:q.buffer,indices:A,uniqueCount:x}}function s(t,e,n,r){for(let o=0;o<r;o++)if(t[e+o]!==t[n+o])return!1;return!0}function a(t,e,n,r,o){for(let i=0;i<o;i++)n[r+i]=t[e+i]}function l(t,e,n){let r=0;for(let o=0;o<n;o++)r=t[e+o]+r|0,r=r+(r<<11)+(r>>>2)|0;return r>>>0}let c=null},71488:(t,e,n)=>{n.d(e,{Kk:()=>a,QL:()=>l,yO:()=>s});var r=n(26832),o=n(66360),i=n(21136);function s(t,e){return t.isGeographic||t.isWebMercator&&(e??!0)}function a(t,e){switch(t.type){case"georeferenced":return e.isGeographic;case"local":return e.isGeographic||e.isWebMercator}}function l(t,e,n,s){if(void 0!==s){(0,r.O2)(o.c.getLogger(t),"option: geographic",{replacement:"use mesh vertexSpace and spatial reference to control how operations are performed",version:"4.29",warnOnce:!0});const a="local"===e.type;if(!(0,i.k$)(e)||s===a)return n.isGeographic||n.isWebMercator&&s;o.c.getLogger(t).warnOnce(`Specifying the 'geographic' parameter (${s}) for a Mesh vertex space of type "${e.type}" is not supported. This parameter will be ignored.`)}return a(e,n)}},54828:(t,e,n)=>{n.d(e,{CE:()=>A,EX:()=>_,_0:()=>P,_S:()=>b,iS:()=>T,mC:()=>q,project:()=>M,qu:()=>F});var r=n(24296),o=n(68612),i=n(15008),s=n(87104),a=n(98472),l=n(62484),c=n(77556),u=n(60074),h=n(82448),f=n(51120),p=n(62880),g=n(15688),d=n(41104),m=n(21136),y=n(48952),x=n(71488),v=n(38496);function w(t,e,n){return(0,x.yO)(e.spatialReference,n?.geographic)?q(t,e,!1,n):function(t,e,n){const r=new Float64Array(t.position.length),o=t.position,i=e.x,s=e.y,a=e.z??0,l=P(n?n.unit:null,e.spatialReference);for(let t=0;t<o.length;t+=3)r[t]=o[t]*l+i,r[t+1]=o[t+1]*l+s,r[t+2]=o[t+2]*l+a;return{position:r,normal:t.normal,tangent:t.tangent}}(t,e,n)}function A(t,e=s.IJ){const{position:n,normal:r,tangent:o}=t;return{position:(0,y.a)(new Float64Array(n.length),n,e),normal:null!=r?(0,v.W4)(r,new Float32Array(r.length),e):null,tangent:null!=o?(0,v.AT)(o,new Float32Array(o.length),e):null}}function b(t,e,n,r){const{position:o,normal:i,tangent:s}=t;if(!(0,m.k$)(e))return{position:o,normal:i,tangent:s};const a=(0,m.mA)(e,r);return w(A(t,n?.localMatrix),a,{geographic:"local"===e.type})}function _(t,e,n){const r=(0,m.Al)(e,n),o=e.spatialReference,i=(0,m.k$)(r);if(!i)return{vertexAttributes:w(t,e,n),vertexSpace:r,transform:null};const{position:s,normal:a,tangent:l}=t,c=(0,x.Kk)(r,o);switch(r.type){case"georeferenced":return c?{vertexAttributes:q(t,e,i,n),vertexSpace:r,transform:null}:{vertexAttributes:{position:s,normal:a,tangent:l},vertexSpace:r,transform:new d.c};case"local":return{vertexAttributes:{position:s,normal:a,tangent:l},vertexSpace:r,transform:new d.c}}}function S(t,e,n){return(0,x.yO)(e.spatialReference,n?.geographic)?F(t,e,n):C(t,e,n)}function T(t,e,n,r,o){if(!(0,m.k$)(e))return S(t,r,o);const{spatialReference:i}=r,s=b(t,e,n,i);return r.equals((0,m.mA)(e,i))?C(s,r,o):S(s,r,o)}function M({positions:t,transform:e,vertexSpace:n,inSpatialReference:r,outSpatialReference:o,outPositions:c,localMode:d}){const m=n.origin??l.cX,x=null!=n.origin?e?.localMatrix??s.IJ:s.IJ;if("georeferenced"===n.type){const e=c??(0,g.Gg)(t.length);if((0,i.yK)(x,s.IJ)?(0,g.mw)(e,t):(0,y.a)(e,t,x),!(0,a.h)(m,l.cX)){const[t,n,r]=m;for(let o=0;o<e.length;o+=3)e[o]+=t,e[o+1]+=n,e[o+2]+=r}return(0,p.projectBuffer)(e,r,0,e,o,0,e.length/3),e}let v=r;const w=(0,h._s)(r);v=o.isWebMercator&&d||!(0,u.canProjectWithoutEngine)(r,w)?v:w,(0,f.y)(r,m,R,v),(0,i.iW)(R,R,x);const A=c??(0,g.Gg)(t.length);return(0,y.a)(A,t,R),(0,p.projectBuffer)(A,v,0,A,o,0,A.length/3),A}function q(t,e,n,r){const o=e.spatialReference,i=O(e,r,R),s=new Float64Array(t.position.length),a=function(t,e,n,r){(0,y.a)(r,t,e);const o=new Float64Array(t.length);return(0,v.o$)(r,o,n)}(t.position,i,o,s),l=(0,c.yy)(k,i),u=function(t,e,n,r,o){if(null==n)return null;const i=new Float32Array(n.length);return(0,y.b)(i,n,r),(0,v.QP)(i,t,e,o,i),i}(a,s,t.normal,l,o),h=function(t,e,n,r,o){if(null==n)return null;const i=new Float32Array(n.length);(0,y.b)(i,n,r,4);for(let t=3;t<i.length;t+=4)i[t]=n[t];return(0,v.Cr)(i,t,e,o,i),i}(a,s,t.tangent,l,o);if(n){const{x:t,y:n,z:r}=e;(0,y.t)(a,a,[-t,-n,-(r??0)])}return{position:a,normal:u,tangent:h}}function C(t,e,n){const r=new Float64Array(t.position.length),o=t.position,i=e.x,s=e.y,a=e.z??0,l=P(n?n.unit:null,e.spatialReference);for(let t=0;t<o.length;t+=3)r[t]=(o[t]-i)/l,r[t+1]=(o[t+1]-s)/l,r[t+2]=(o[t+2]-a)/l;return{position:r,normal:t.normal,tangent:t.tangent}}function F(t,e,n){const r=e.spatialReference;O(e,n,R);const o=(0,i.S_)(j,R),s=new Float64Array(t.position.length),a=function(t,e,n,r){const o=(0,v.K_)(t,e,r),i=new Float64Array(o.length);return(0,y.a)(i,o,n),i}(t.position,r,o,s),l=(0,c.yy)(k,o);return{position:a,normal:L(t.normal,t.position,s,r,l),tangent:I(t.tangent,t.position,s,r,l)}}function O(t,e,n){(0,f.y)(t.spatialReference,[t.x,t.y,t.z??0],n,(0,h._s)(t.spatialReference));const r=P(e?e.unit:null,t.spatialReference);return(0,i.aU)(n,n,[r,r,r]),n}function L(t,e,n,r,o){if(null==t)return null;const i=(0,v.cH)(t,e,n,r,new Float32Array(t.length));return(0,y.b)(i,i,o),i}function I(t,e,n,r,o){if(null==t)return null;const i=(0,v.GW)(t,e,n,r,new Float32Array(t.length));return(0,y.b)(i,i,o,4),i}function P(t,e){if(null==t)return 1;const n=(0,r.eg)(e);return 1/(0,r.ck)(n,"meters",t)}const R=(0,s.Su)(),j=(0,s.Su)(),k=(0,o.Su)()},38496:(t,e,n)=>{n.d(e,{AT:()=>b,Cr:()=>S,GW:()=>_,K_:()=>v,QP:()=>x,W4:()=>A,cH:()=>y,o$:()=>w});var r=n(66360),o=n(77556),i=n(68612),s=n(87104),a=n(98472),l=n(62484),c=n(82448),u=n(51120),h=n(62880),f=n(60544),p=n(29120),g=n(71004),d=n(48952);const m=()=>r.c.getLogger("esri.geometry.support.meshUtils.normalProjection");function y(t,e,n,r,o){return M(r)?(T(C.TO_PCPF,g.Yj.fromTypedArray(t),g.Ax.fromTypedArray(e),g.Ax.fromTypedArray(n),r,g.Yj.fromTypedArray(o)),o):(m().error("Cannot convert spatial reference to PCPF"),o)}function x(t,e,n,r,o){return M(r)?(T(C.FROM_PCPF,g.Yj.fromTypedArray(t),g.Ax.fromTypedArray(e),g.Ax.fromTypedArray(n),r,g.Yj.fromTypedArray(o)),o):(m().error("Cannot convert to spatial reference from PCPF"),o)}function v(t,e,n){return(0,h.projectBuffer)(t,e,0,n,(0,c._s)(e),0,t.length/3),n}function w(t,e,n){return(0,h.projectBuffer)(t,(0,c._s)(n),0,e,n,0,t.length/3),e}function A(t,e,n){return(0,o.yy)(P,n),(0,d.b)(e,t,P),(0,o.QT)(P)||(0,d.n)(e,e),e}function b(t,e,n){if((0,o.yy)(P,n),(0,d.b)(e,t,P,4),(0,o.QT)(P)||(0,d.n)(e,e,4),t!==e)for(let n=3;n<t.length;n+=4)e[n]=t[n];return e}function _(t,e,n,r,o){if(!M(r))return m().error("Cannot convert spatial reference to PCPF"),o;T(C.TO_PCPF,g.Yj.fromTypedArray(t,4*Float32Array.BYTES_PER_ELEMENT),g.Ax.fromTypedArray(e),g.Ax.fromTypedArray(n),r,g.Yj.fromTypedArray(o,4*Float32Array.BYTES_PER_ELEMENT));for(let e=3;e<t.length;e+=4)o[e]=t[e];return o}function S(t,e,n,r,o){if(!M(r))return m().error("Cannot convert to spatial reference from PCPF"),o;T(C.FROM_PCPF,g.Yj.fromTypedArray(t,16),g.Ax.fromTypedArray(e),g.Ax.fromTypedArray(n),r,g.Yj.fromTypedArray(o,16));for(let e=3;e<t.length;e+=4)o[e]=t[e];return o}function T(t,e,n,r,i,s){if(!e)return;const l=n.count,h=(0,c._s)(i);if(q(i))for(let n=0;n<l;n++)r.getVec(n,O),e.getVec(n,L),(0,u.y)(h,O,I,h),(0,o.kr)(P,I),t===C.FROM_PCPF&&(0,o.oL)(P,P),(0,a.t)(L,L,P),s.setVec(n,L);else for(let i=0;i<l;i++){r.getVec(i,O),e.getVec(i,L),(0,u.y)(h,O,I,h),(0,o.kr)(P,I);const l=(0,p.MB)(n.get(i,1));let c=Math.cos(l);t===C.TO_PCPF&&(c=1/c),P[0]*=c,P[1]*=c,P[2]*=c,P[3]*=c,P[4]*=c,P[5]*=c,t===C.FROM_PCPF&&(0,o.oL)(P,P),(0,a.t)(L,L,P),(0,a.n)(L,L),s.setVec(i,L)}return s}function M(t){return q(t)||function(t){return t.isWebMercator}(t)}function q(t){return t.isWGS84||(0,f.Ub)(t)||(0,f.qg)(t)||(0,f.UB)(t)}var C,F;(F=C||(C={}))[F.TO_PCPF=0]="TO_PCPF",F[F.FROM_PCPF=1]="FROM_PCPF";const O=(0,l.Su)(),L=(0,l.Su)(),I=(0,s.Su)(),P=(0,i.Su)()},21136:(t,e,n)=>{n.d(e,{Al:()=>p,GF:()=>g,k$:()=>h,mA:()=>f,mm:()=>d,wX:()=>u});var r=n(26832),o=n(66360),i=n(67776),s=n(51232),a=n(13708),l=n(48952);function c(){return o.c.getLogger("esri.geometry.Mesh")}function u(t){const{vertexSpace:e}=t;if(null!=e.origin)return t.clone();const{anchor:n}=t,r=n.clone(),o=new s.c({origin:[r.x,r.y,r.z]}),i=t.cloneWithVertexSpace(o),{position:a}=i.vertexAttributes;return i.vertexAttributes.position=(0,l.t)(new Float64Array(a.length),a,[-r.x,-r.y,-(r.z??0)]),i.vertexAttributesChanged(),i}function h(t){return null!=t.origin}function f(t,e){if(!h(t))return null;const[n,r,o]=t.origin;return new i.c({x:n,y:r,z:o,spatialReference:e})}function p(t,e){const{x:n,y:o,z:i,spatialReference:l}=t,u=[n,o,i??0];if(void 0!==e?.geographic){if((0,r.O2)(c(),"option: geographic",{replacement:"use vertexSpace option instead",version:"4.29",warnOnce:!0}),!e?.vertexSpace)return e?.geographic?new a.c({origin:u}):new s.c({origin:u});c().warn("Deprecated geographic flag ignored since vertexSpace option is provided.")}if(!e?.vertexSpace)return l.isGeographic||l.isWebMercator?new a.c({origin:u}):new s.c({origin:u});switch(e.vertexSpace){case"local":return new a.c({origin:u});case"georeferenced":return new s.c({origin:u});case"georeferenced-absolute":return new s.c}}function g(t){return t.isGeographic||t.isWebMercator?"local":"georeferenced"}function d(t,e){return"local"===t?new a.c({origin:e}):new s.c({origin:e})}},58608:(t,e,n)=>{n.d(e,{u:()=>o});var r=n(60924);class o{constructor(){this.id=(0,r.Q)()}}},74376:(t,e,n)=>{var r;n.d(e,{C:()=>r}),function(t){t[t.Layer=0]="Layer",t[t.Object=1]="Object",t[t.Mesh=2]="Mesh",t[t.Line=3]="Line",t[t.Point=4]="Point",t[t.Material=5]="Material",t[t.Texture=6]="Texture",t[t.COUNT=7]="COUNT"}(r||(r={}))},71520:(t,e,n)=>{n.d(e,{K:()=>C});var r=n(87104),o=n(98472),i=n(97143),s=n(72008);function a(t){if(t.length<s._)return Array.from(t);if((0,s.c7)(t))return Float64Array.from(t);if(!("BYTES_PER_ELEMENT"in t))return Array.from(t);switch(t.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(t);case 2:return(0,s.Qx)(t)?Uint16Array.from(t):Int16Array.from(t);case 4:return Float32Array.from(t);default:return Float64Array.from(t)}}var l=n(12260),c=n(24680),u=n(62484),h=n(90736);class f{constructor(t,e,n){this.primitiveIndices=t,this._numIndexPerPrimitive=e,this.position=n,this._children=void 0,(0,h.Uc)(t.length>=1),(0,h.Uc)(3===n.size||4===n.size);const{data:r,size:i,indices:s}=n;(0,h.Uc)(s.length%this._numIndexPerPrimitive==0),(0,h.Uc)(s.length>=t.length*this._numIndexPerPrimitive);const a=t.length;let l=i*s[this._numIndexPerPrimitive*t[0]];p.clear(),p.push(l);const c=(0,u.WK)(r[l],r[l+1],r[l+2]),f=(0,u.ct)(c);for(let e=0;e<a;++e){const n=this._numIndexPerPrimitive*t[e];for(let t=0;t<this._numIndexPerPrimitive;++t){l=i*s[n+t],p.push(l);let e=r[l];c[0]=Math.min(e,c[0]),f[0]=Math.max(e,f[0]),e=r[l+1],c[1]=Math.min(e,c[1]),f[1]=Math.max(e,f[1]),e=r[l+2],c[2]=Math.min(e,c[2]),f[2]=Math.max(e,f[2])}}this.bbMin=c,this.bbMax=f;const g=(0,o.k)((0,u.Su)(),this.bbMin,this.bbMax,.5);this.radius=.5*Math.max(Math.max(f[0]-c[0],f[1]-c[1]),f[2]-c[2]);let d=this.radius*this.radius;for(let t=0;t<p.length;++t){l=p.at(t);const e=r[l]-g[0],n=r[l+1]-g[1],o=r[l+2]-g[2],i=e*e+n*n+o*o;if(i<=d)continue;const s=Math.sqrt(i),a=.5*(s-this.radius);this.radius=this.radius+a,d=this.radius*this.radius;const c=a/s;g[0]+=e*c,g[1]+=n*c,g[2]+=o*c}this.center=g,p.clear()}getChildren(){if(this._children||(0,o.a)(this.bbMin,this.bbMax)<=1)return this._children;const t=(0,o.k)((0,u.Su)(),this.bbMin,this.bbMax,.5),e=this.primitiveIndices.length,n=new Uint8Array(e),r=new Array(8);for(let t=0;t<8;++t)r[t]=0;const{data:i,size:s,indices:a}=this.position;for(let o=0;o<e;++o){let e=0;const l=this._numIndexPerPrimitive*this.primitiveIndices[o];let c=s*a[l],u=i[c],h=i[c+1],f=i[c+2];for(let t=1;t<this._numIndexPerPrimitive;++t){c=s*a[l+t];const e=i[c],n=i[c+1],r=i[c+2];e<u&&(u=e),n<h&&(h=n),r<f&&(f=r)}u<t[0]&&(e|=1),h<t[1]&&(e|=2),f<t[2]&&(e|=4),n[o]=e,++r[e]}let l=0;for(let t=0;t<8;++t)r[t]>0&&++l;if(l<2)return;const c=new Array(8);for(let t=0;t<8;++t)c[t]=r[t]>0?new Uint32Array(r[t]):void 0;for(let t=0;t<8;++t)r[t]=0;for(let t=0;t<e;++t){const e=n[t];c[e][r[e]++]=this.primitiveIndices[t]}this._children=new Array;for(let t=0;t<8;++t)void 0!==c[t]&&this._children.push(new f(c[t],this._numIndexPerPrimitive,this.position));return this._children}static prune(){p.prune()}}const p=new c.c({deallocator:null});var g=n(58608),d=n(74376),m=n(52180),y=n(24363);function x(t,e,n){return(0,o.f)(v,e,t),(0,o.f)(w,n,t),.5*(0,o.l)((0,o.b)(v,v,w))}n(20136),new m.o(y.Su),new m.o((()=>{return t?{p0:(0,u.ct)(t.p0),p1:(0,u.ct)(t.p1),p2:(0,u.ct)(t.p2)}:{p0:(0,u.Su)(),p1:(0,u.Su)(),p2:(0,u.Su)()};var t}));const v=(0,u.Su)(),w=(0,u.Su)(),A=(0,u.Su)(),b=(0,u.Su)(),_=(0,u.Su)(),S=(0,u.Su)();var T=n(60924);class M{constructor(t){this.channel=t,this.id=(0,T.Q)()}}var q=n(4636);n(5480),(0,u.Su)(),new Float32Array(6);class C extends g.u{constructor(t,e,n=null,r=d.C.Mesh,o=null,s=-1){super(),this.material=t,this.mapPositions=n,this.type=r,this.objectAndLayerIdColor=o,this.edgeIndicesLength=s,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[t,n]of e)this._attributes.set(t,{...n,indices:(0,i.Uv)(n.indices)}),t===q.K.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(t).indices.length:this.edgeIndicesLength)}instantiate(t={}){const e=new C(t.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((t,n)=>{t.exclusive=!1,e._attributes.set(n,t)})),e._boundingInfo=this._boundingInfo,e.transformation=t.transformation||this.transformation,e}get attributes(){return this._attributes}getMutableAttribute(t){let e=this._attributes.get(t);return e&&!e.exclusive&&(e={...e,exclusive:!0,data:a(e.data)},this._attributes.set(t,e)),e}setAttributeData(t,e){const n=this._attributes.get(t);n&&this._attributes.set(t,{...n,exclusive:!0,data:e})}get indexCount(){const t=this._attributes.values().next().value.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return null==this._boundingInfo&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(t){return!!(this.type===d.C.Mesh?this._computeAttachmentOriginTriangles(t):this.type===d.C.Line?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t))&&(null!=this._transformation&&(0,o.e)(t,t,this._transformation),!0)}_computeAttachmentOriginTriangles(t){return function(t,e){if(!t)return!1;const{size:n,data:r,indices:i}=t;(0,o.s)(e,0,0,0),(0,o.s)(S,0,0,0);let s=0,a=0;for(let t=0;t<i.length-2;t+=3){const l=i[t]*n,c=i[t+1]*n,u=i[t+2]*n;(0,o.s)(A,r[l],r[l+1],r[l+2]),(0,o.s)(b,r[c],r[c+1],r[c+2]),(0,o.s)(_,r[u],r[u+1],r[u+2]);const h=x(A,b,_);h?((0,o.g)(A,A,b),(0,o.g)(A,A,_),(0,o.i)(A,A,1/3*h),(0,o.g)(e,e,A),s+=h):((0,o.g)(S,S,A),(0,o.g)(S,S,b),(0,o.g)(S,S,_),a+=3)}return!(0===a&&0===s||(0!==s?((0,o.i)(e,e,1/s),0):0===a||((0,o.i)(e,S,1/a),0)))}(this.attributes.get(q.K.POSITION),t)}_computeAttachmentOriginLines(t){const e=this.attributes.get(q.K.POSITION);return function(t,e,n){if(!t)return!1;(0,o.s)(n,0,0,0),(0,o.s)(S,0,0,0);let r=0,i=0;const{size:s,data:a,indices:l}=t,c=l.length-1,u=c+(e?2:0);for(let t=0;t<u;t+=2){const e=t<c?t+1:0,u=l[t<c?t:c]*s,h=l[e]*s;A[0]=a[u],A[1]=a[u+1],A[2]=a[u+2],b[0]=a[h],b[1]=a[h+1],b[2]=a[h+2],(0,o.i)(A,(0,o.g)(A,A,b),.5);const f=(0,o.m)(A,b);f>0?((0,o.g)(n,n,(0,o.i)(A,A,f)),r+=f):0===r&&((0,o.g)(S,S,A),i++)}return 0!==r?((0,o.i)(n,n,1/r),!0):0!==i&&((0,o.i)(n,S,1/i),!0)}(e,function(t,e){return!(!("isClosed"in t)||!t.isClosed)&&e.indices.length>2}(this.material.parameters,e),t)}_computeAttachmentOriginPoints(t){return function(t,e){if(!t)return!1;const{size:n,data:r,indices:i}=t;(0,o.s)(e,0,0,0);let s=-1,a=0;for(let t=0;t<i.length;t++){const o=i[t]*n;s!==o&&(e[0]+=r[o],e[1]+=r[o+1],e[2]+=r[o+2],a++),s=o}return a>1&&(0,o.i)(e,e,1/a),a>0}(this.attributes.get(q.K.POSITION),t)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const t=this.attributes.get(q.K.POSITION);if(!t||0===t.indices.length)return null;const e=this.type===d.C.Mesh?3:1;(0,h.Uc)(t.indices.length%e==0,"Indexing error: "+t.indices.length+" not divisible by "+e);const n=(0,i.yh)(t.indices.length/e);return new f(n,e,t)}get transformation(){return this._transformation??r.IJ}set transformation(t){this._transformation=t&&t!==r.IJ?(0,r.ct)(t):null}addHighlight(){const t=new M(l.sN.Highlight);return this.highlights=function(t,e){return null==t&&(t=[]),t.push(e),t}(this.highlights,t),t}removeHighlight(t){this.highlights=function(t,e){if(null==t)return null;const n=t.filter((t=>t!==e));return 0===n.length?null:n}(this.highlights,t)}}},12260:(t,e,n)=>{var r,o,i,s,a,l,c,u,h;n.d(e,{Aj:()=>a,C2:()=>u,CM:()=>r,Iv:()=>s,OA:()=>c,sN:()=>l,sr:()=>o,yk:()=>h}),function(t){t[t.None=0]="None",t[t.Front=1]="Front",t[t.Back=2]="Back",t[t.COUNT=3]="COUNT"}(r||(r={})),function(t){t[t.Less=0]="Less",t[t.Lequal=1]="Lequal",t[t.COUNT=2]="COUNT"}(o||(o={})),function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.UPDATE=1]="UPDATE"}(i||(i={})),function(t){t[t.NOT_LOADED=0]="NOT_LOADED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED"}(s||(s={})),function(t){t[t.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",t[t.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(a||(a={})),function(t){t[t.Highlight=0]="Highlight",t[t.MaskOccludee=1]="MaskOccludee",t[t.COUNT=2]="COUNT"}(l||(l={})),function(t){t[t.Blend=0]="Blend",t[t.Opaque=1]="Opaque",t[t.Mask=2]="Mask",t[t.MaskBlend=3]="MaskBlend",t[t.COUNT=4]="COUNT"}(c||(c={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON"}(u||(u={})),function(t){t.DDS_ENCODING="image/vnd-ms.dds",t.KTX2_ENCODING="image/ktx2",t.BASIS_ENCODING="image/x.basis"}(h||(h={}))},5480:(t,e,n)=>{function r(t,e){const n=t.length;for(let r=0;r<n;++r)i[0]=t[r],e[r]=i[0];return e}function o(t,e){const n=t.length;for(let r=0;r<n;++r)i[0]=t[r],i[1]=t[r]-i[0],e[r]=i[1];return e}n.d(e,{KM:()=>r,Ky:()=>o});const i=new Float32Array(2)}}]);