@arcgis/core 5.1.0-next.52 → 5.1.0-next.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/009db7b459b18f6a668b.js +1 -0
- package/assets/esri/core/workers/chunks/{386435341e949f5573b4.js → 0fc60b4c44c4e865b699.js} +2 -2
- package/assets/esri/core/workers/chunks/199f70c0373f6008a545.js +1 -0
- package/assets/esri/core/workers/chunks/{d2af5342fbe80e2d8c60.js → 20f9f3470cad47d01803.js} +1 -1
- package/assets/esri/core/workers/chunks/2757cf54656b5d318b11.js +1 -0
- package/assets/esri/core/workers/chunks/2aaeaf022af8493281dc.js +1 -0
- package/assets/esri/core/workers/chunks/34fe4570eef9e73839b8.js +1 -0
- package/assets/esri/core/workers/chunks/{7480bd6f892abf444cac.js → 3c9e1ec94bbcbf494916.js} +3 -3
- package/assets/esri/core/workers/chunks/40bcfc4f8efe7de7ec9d.js +1 -0
- package/assets/esri/core/workers/chunks/{cc1f3a2f281a2f6e0f94.js → 4d54beab8ae5ff31e7b0.js} +1 -1
- package/assets/esri/core/workers/chunks/55bb5b7817c2963c8bfa.js +1 -0
- package/assets/esri/core/workers/chunks/{39f3bea123f20c816ab2.js → 662932d2effd2b384b9e.js} +1 -1
- package/assets/esri/core/workers/chunks/7d56b2ac5030dd8b748e.js +1 -0
- package/assets/esri/core/workers/chunks/{720a33a7f118d2769133.js → 851dd71d28681d4eccfd.js} +1 -1
- package/assets/esri/core/workers/chunks/{88c6cc90606409b5c884.js → 87d2021e91d025a2a142.js} +1 -1
- package/assets/esri/core/workers/chunks/{fe7dec83e40014c55a6b.js → 96e799ca97989a6ed448.js} +1 -1
- package/assets/esri/core/workers/chunks/9db2ff1d4cbb5d1b623e.js +1 -0
- package/assets/esri/core/workers/chunks/a462aa1c7b68efad6906.js +1 -0
- package/assets/esri/core/workers/chunks/{f5fd59291cb161fdc05b.js → a787fe09d3df9d4254ba.js} +1 -1
- package/assets/esri/core/workers/chunks/a971e61336f455b953d5.js +1 -0
- package/assets/esri/core/workers/chunks/b2b77598048818c957b7.js +1 -0
- package/assets/esri/core/workers/chunks/{3fa5f102b6f77c523a76.js → b3e5dcb530cef678c8f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{daf65bccc45dc5c400ae.js → c460ca93ed8e20d8b53a.js} +1 -1
- package/assets/esri/core/workers/chunks/{3fcc8c455af56ae89030.js → ccf845ac0ac354507a25.js} +1 -1
- package/assets/esri/core/workers/chunks/{c48d1ee37c207bfb0aac.js → dd319d5fe89b275e93cf.js} +1 -1
- package/assets/esri/core/workers/chunks/ec91d5081f423755cb07.js +1 -0
- package/assets/esri/core/workers/chunks/{eb36417edc11fa80e312.js → ee8cd91c27e9cdfc3b2e.js} +1 -1
- package/assets/esri/core/workers/chunks/f8eb14170f927aecfbc8.js +1 -0
- package/assets/esri/core/workers/chunks/{792219a079c28bcdc003.js → fcfaaced184f8da3e28d.js} +1 -1
- package/config.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/maybe.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/raster/datasets/FunctionRaster.js +1 -1
- package/layers/raster/functions/AspectFunction.js +1 -1
- package/layers/raster/functions/BaseRasterFunction.js +1 -1
- package/layers/raster/functions/ConvolutionFunction.js +1 -1
- package/layers/raster/functions/CurvatureFunction.js +1 -1
- package/layers/raster/functions/HillshadeFunction.js +1 -1
- package/layers/raster/functions/ShadedReliefFunction.js +1 -1
- package/layers/raster/functions/SlopeFunction.js +1 -1
- package/layers/raster/functions/StatisticsFunction.js +1 -1
- package/layers/raster/functions/pixelUtils.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl/ManagedFBO.d.ts +1 -0
- package/views/3d/webgl/ManagedFBOResource.d.ts +1 -0
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PolygonOffset.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/assets/esri/core/workers/chunks/0b661b90f7ee3ae23425.js +0 -1
- package/assets/esri/core/workers/chunks/167e4ff7cbc88b42db71.js +0 -1
- package/assets/esri/core/workers/chunks/1a481f3ae3146682eb00.js +0 -1
- package/assets/esri/core/workers/chunks/30654845ca1334f1c206.js +0 -1
- package/assets/esri/core/workers/chunks/34207774bc371e95ba3c.js +0 -1
- package/assets/esri/core/workers/chunks/35dbe1eeb6932b03aea2.js +0 -1
- package/assets/esri/core/workers/chunks/380bb57bccc266d6442a.js +0 -1
- package/assets/esri/core/workers/chunks/5351e71ce7839636d06d.js +0 -1
- package/assets/esri/core/workers/chunks/55edd712c6d2d044e550.js +0 -1
- package/assets/esri/core/workers/chunks/64da1ad9df9094ef5c12.js +0 -1
- package/assets/esri/core/workers/chunks/666f201d222c50ab8428.js +0 -1
- package/assets/esri/core/workers/chunks/7380177f16d914fdbc63.js +0 -1
- package/assets/esri/core/workers/chunks/7dba4121cdd20dbc4b20.js +0 -1
- package/assets/esri/core/workers/chunks/bb659dcd297b895830df.js +0 -1
- /package/assets/esri/core/workers/chunks/{386435341e949f5573b4.js.LICENSE.txt → 0fc60b4c44c4e865b699.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6390],{69052(e,t,i){i.d(t,{hr:()=>r,ie:()=>l,uC:()=>o});var s=i(34727);class r{constructor(e,t){this.min=e,this.max=t,this.range=t-e}normalize(e,t=0,i=!1){return n(this.range,this.min,this.max,e,t,i)}clamp(e,t=0){return(0,s.qE)(e-t,this.min,this.max)+t}monotonic(e,t,i){return e<t?t:t+a(this.range,e-t,i)}minimalMonotonic(e,t,i){return n(this.range,e,e+this.range,t,i)}center(e,t,i){return t=this.monotonic(e,t,i),this.normalize((e+t)/2,i)}diff(e,t,i){return this.monotonic(e,t,i)-e}shortestSignedDiff(e,t){e=this.normalize(e);const i=(t=this.normalize(t))-e,s=t<e?this.minimalMonotonic(e,t)-e:t-this.minimalMonotonic(t,e);return Math.abs(i)<Math.abs(s)?i:s}contains(e,t,i){return t=this.minimalMonotonic(e,t),(i=this.minimalMonotonic(e,i))>e&&i<t}}function n(e,t,i,s,r=0,n=!1){return(s-=r)<t?s+=a(e,t-s):s>i&&(s-=a(e,s-i)),n&&s===i&&(s=t),s+r}function a(e,t,i=0){return Math.ceil((t-i)/e)*e+i}const o=new r(0,2*Math.PI),l=(new r(-Math.PI,Math.PI),new r(0,360))},44794(e,t,i){i.d(t,{v:()=>o});var s=i(4718),r=i(62788),n=i(95488);class a{constructor(e,t){this._observable=new n.I,this._value=e,this._equalityFunction=t}get value(){return(0,r.gc)(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.gh){return new a(e,t)}},44123(e,t,i){i.d(t,{WhereClauseCache:()=>n});var s=i(66344),r=i(89696);class n{constructor(e,t){this._cache=new s.q(e),this._invalidCache=new s.q(t)}get(e,t){const i=`${t?.uid}:${e}`,s=this._cache.get(i);if(s)return s;if(null!=this._invalidCache.get(i))return null;try{const s=r.A.create(e,{fieldsIndex:t});return this._cache.put(i,s),s}catch(e){return this._invalidCache.put(i,e),null}}getError(e,t){const i=`${t?.uid}:${e}`;return this._invalidCache.get(i)??null}}},46329(e,t,i){i.d(t,{y:()=>d});var s=i(49186),r=i(4305),n=i(513),a=i(50954),o=i(52006),l=i(49663),u=i(46068),c=i(59803);function d(e,t,i){if((0,o.Xq)(t))return(0,c.T)(e,t,i);if((0,o.n1)(t)){const n=(0,r.m_)(e,t,i)[0];if(null==n)throw new s.A("closestPointOnCurve:unexpected-error","Failed to find close point on bezier curve");return n}if((0,o.aO)(t)){const s=(0,a.pM)(e,t);return(0,n.fM)(s,i)}if((0,o.DA)(t)){const s=(0,l.i)(e,t);return(0,n.fM)(s,i)}const d=(0,u.SW)(e,t);return(0,u.pb)(d,i)}},17136(e,t,i){i.d(t,{Y_:()=>A,O7:()=>R,el:()=>T});var s=i(92602),r=i(69052),n=i(49186),a=i(53966),o=i(39829),l=i(82799),u=i(16930),c=i(80754),d=i(21325),p=i(28735),h=i(11254),f=i(60408),m=i(65864),y=i(2272),g=i(84952),x=i(92300);const v=()=>a.A.getLogger("esri.geometry.support.normalizeUtils");function _(e){return"polygon"===e[0].type}function F(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof l.A||e instanceof o.A)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw v().error(e),new n.A("internal:geometry",e)}const i=(0,c.r8)(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 r=e[s][0],n=e[s][1],a=e[s+1][0],o=e[s+1][1],l=Math.sqrt((a-r)*(a-r)+(o-n)*(o-n)),u=(o-n)/l,c=(a-r)/l,d=l/t;if(d>1){for(let e=1;e<=d-1;e++){const s=e*t,a=c*s+r,o=u*s+n;i.push([a,o])}const e=(l+Math.floor(d-1)*t)/2,s=c*e+r,a=u*e+n;i.push([s,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new o.A({rings:s,spatialReference:e.spatialReference}):new l.A({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,p.ci)(t,!0)}return i&&(e=(0,c.kS)(e,i)),e}function S(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=(0,c.kd)(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=(0,c.kd)(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=(0,c.kd)(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=(0,c.kd)(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function I(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const r=t.cutIndexes[s],n=t.geometries[s],a=(0,c.r8)(n);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,c.kd)(i,180);for(let i=0;i<t.length;i++){const t=n.getPoint(e,i);n.setPoint(e,i,t.clone().offset(s,0))}return!0}})}if(r===i){if(_(e))for(const t of(0,c.r8)(n))e[r]=e[r].addRing(t);else if(F(e))for(const t of(0,c.r8)(n))e[r]=e[r].addPath(t)}else i=r,e[r]=n}return e}async function T(e,t,i){if(!Array.isArray(e))return T([e],t);t&&"string"!=typeof t&&v().warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??s.A.geometryServiceUrl;let n,a,u,_,F,R,b,A,M=0;const C=[],z=[];for(const t of e)if(null!=t)if(n||(n=t.spatialReference,a=(0,d.Vp)(n),u=n.isWebMercator,R=u?102100:4326,_=c.j7[R].maxX,F=c.j7[R].minX,b=c.j7[R].plus180Line,A=c.j7[R].minus180Line),a)if("mesh"===t.type)z.push(t);else if("point"===t.type)z.push(S(t.clone(),_,F));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map(e=>S(e,_,F)),z.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,a);z.push(e.rings?new o.A(e):e)}else if(t.extent){const e=t.extent,i=(0,c.kd)(e.xmin,F)*(2*_);let s=0===i?t.clone():(0,c.kS)(t.clone(),i);e.offset(i,0);let{xmin:r,xmax:n}=e;r=Number(r.toFixed(9)),n=Number(n.toFixed(9)),e.intersects(b)&&n!==_?(M=n>M?n:M,s=w(s,u),C.push(s),z.push("cut")):e.intersects(A)&&r!==F?(M=n*(2*_)>M?n*(2*_):M,s=w(s,u,360),C.push(s),z.push("cut")):z.push(s)}else z.push(t.clone());else z.push(t);else z.push(t);let B=(0,c.kd)(M,_),G=-90;const E=B,O=new l.A;for(;B>0;){const e=360*B-180;O.addPath([[e,G],[e,-1*G]]),G*=-1,B--}if(C.length>0&&E>0){const t=I(C,await async function(e,t,i,s){const r=(0,y.Dl)(e),n=t[0].spatialReference,a={...s,responseType:"json",query:{...r.query,f:"json",sr:(0,d.YX)(n),target:JSON.stringify({geometryType:(0,f.$B)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.A)(r.path+"/cut",a),{cutIndexes:l,geometries:u=[]}=o.data;return{cutIndexes:l,geometries:u.map(e=>{const t=(0,m.rS)(e);return t.spatialReference=n,t})}}(r,C,O,i)),s=[],n=[];for(let i=0;i<z.length;i++){const r=z[i];if("cut"!==r)n.push(r);else{const r=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&r.rings.length>=a.rings.length?(s.push(r),n.push("simplify")):n.push(u?(0,p.Gh)(r):r)}}if(!s.length)return n;const a=await async function(e,t,i){const s="string"==typeof e?(0,g.An)(e):e,r=t[0].spatialReference,n=(0,f.$B)(t[0]),a={...i,query:{...s.query,f:"json",sr:(0,d.YX)(r),geometries:JSON.stringify((0,x.X)(t))}},{data:o}=await(0,h.A)(s.path+"/simplify",a);return(0,x.V)(o.geometries,n,r)}(r,s,i),o=[];for(let e=0;e<n.length;e++){const t=n[e];"simplify"!==t?o.push(t):o.push(u?(0,p.Gh)(a.shift()):a.shift())}return o}const N=[];for(let e=0;e<z.length;e++){const t=z[e];if("cut"!==t)N.push(t);else{const e=C.shift();N.push(!0===u?(0,p.Gh)(e):e)}}return N}function R(e,t,i){const s=(0,d.Vp)(i);if(null==s)return e;const[r,n]=s.valid,a=2*n;let o=0,l=0;t>n?o=Math.ceil(Math.abs(t-n)/a):t<r&&(o=-Math.ceil(Math.abs(t-r)/a)),e>n?l=Math.ceil(Math.abs(e-n)/a):e<r&&(l=-Math.ceil(Math.abs(e-r)/a));let u=e+(o-l)*a;const c=u-t;return c>n?u-=a:c<r&&(u+=a),u}function b(e){const t=(0,d.Vp)(e);if(null==t)return null;const[i,s]=t.valid;return new r.hr(i,s)}const A=b(u.A.WGS84);b(u.A.WebMercator)},80754(e,t,i){i.d(t,{j7:()=>a,kS:()=>l,kd:()=>o,r8:()=>u});var s=i(82799),r=i(16930),n=i(60408);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new s.A({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:r.A.WebMercator}),minus180Line:new s.A({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:r.A.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new s.A({paths:[[[180,-180],[180,180]]],spatialReference:r.A.WGS84}),minus180Line:new s.A({paths:[[[-180,-180],[-180,180]]],spatialReference:r.A.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=u(e);for(const e of i)for(const i of e)i[0]+=t;return e}function u(e){return(0,n.Bi)(e)?e.rings:e.paths}},56390(e,t,i){i.d(t,{do:()=>L,Wc:()=>H});var s=i(4576),r=i(21818),n=i(49186),a=(i(44208),i(4718)),o=i(97768),l=i(17676),u=i(86211),c=i(12195),d=i(91218),p=i(70328),h=i(19419),f=i(537),m=i(60408),y=i(65864),g=i(17136),x=i(21325),v=i(90708),_=i(29441),F=i(51441),w=i(31464);class S{constructor(){this._storage=new Map,this._purgeInterval=5,this._sweep=()=>{if(this._timer=void 0,!this._storage)return;const e=1e3*this._purgeInterval,t=performance.now()-e;for(const[i,s]of this._storage){if(!(s.time<t))return void(this._storage.size>0&&(this._timer=setTimeout(this._sweep,e)));this._storage.delete(i)}}}destroy(){this._storage?.clear(),this._storage=null,clearTimeout(this._timer)}put(e,t){this._storage?.set(e,new T(t)),this._scheduleSweep()}get(e){const t=this._storage?.get(e);if(t)return this._storage?.delete(e),t.time=performance.now(),this._storage?.set(e,t),t.items}clear(){this._storage?.clear()}_scheduleSweep(){this._storage&&(this._timer??=setTimeout(this._sweep,1e3*this._purgeInterval))}get test(){}}let I=0;class T{constructor(e){this.items=e,this.time=performance.now(),this.id=I++}}var R=i(99352),b=i(8384),A=i(58727),M=i(62660),C=i(43668);const z="unsupported-query";async function B(e,{fieldsIndex:t,geometryType:i,spatialReference:s,availableFields:r}){if(null!=e.geometryPrecision||e.multipatchOption&&"xyFootprint"!==e.multipatchOption||e.pixelSize||e.relationParam||e.text)throw new n.A(z,"Unsupported query options",{query:e});return G(t,r,e),function(e,t,i){const{outStatistics:s,groupByFieldsForStatistics:r,having:a}=i,o=r?.length,l=s?.length;if(a){if(!o||!l)throw new n.A(z,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:i});(0,_.eD)(e,t,a,s,i)}if(l){if(null==(u=s)||!u.every(e=>"exceedslimit"!==e.statisticType))return;const a=s.map(e=>e.onStatisticField).filter(Boolean);(0,_.MG)(e,t,a,{expressionName:"onStatisticFields",query:i}),o&&(0,_.MG)(e,t,r,{expressionName:"groupByFieldsForStatistics",query:i});for(const r of s){const{onStatisticField:s,statisticType:a}=r;if("percentile_disc"!==a&&"percentile_cont"!==a||!("statisticParameters"in r))e.get(s)&&"count"!==a&&"min"!==a&&"max"!==a&&(0,_.MG)(e,t,[s],{expressionName:`outStatistics with '${a}' statistic type`,allowedFieldTypes:E,query:i});else{const{statisticParameters:e}=r;if(!e)throw new n.A(z,"statisticParameters should be set for percentile type",{definition:r,query:i})}}}var u}(t,r,e),Promise.all([(0,M.c0)(e,i,s),(0,w.Nk)(s,e.outSR)]).then(()=>e)}function G(e,t,i){const{returnDistinctValues:s,outStatistics:r}=i,a=r?r.map(e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase()).filter(Boolean):[];if("orderByFields"in i&&i.orderByFields&&i.orderByFields.length>0){const s=" asc",r=" desc",n=i.orderByFields.map(e=>{const t=e.toLowerCase();return t.includes(s)?t.split(s)[0]:t.includes(r)?t.split(r)[0]:e}).filter(e=>!a.includes(e));(0,_.MG)(e,t,n,{expressionName:"orderByFields",query:i})}if("outFields"in i)if(i.outFields?.length)(0,_.MG)(e,t,i.outFields,{expressionName:"outFields",query:i,allowedFieldTypes:"all"});else if(s)throw new n.A(z,"outFields should be specified for returnDistinctValues",{query:i});(0,_.SN)(e,t,i.where,i)}const E=new Set([..._.vl,..._.VW]);async function O(e,t,i,s){let r=[];if(i.valueExpression){const{arcadeUtils:e}=await(0,C.l)();r=e.extractFieldNames(i.valueExpression)}if(i.field&&r.push(i.field),i.field2&&r.push(i.field2),i.field3&&r.push(i.field3),i.normalizationField&&r.push(i.normalizationField),!r.length&&!i.valueExpression)throw new n.A(z,"field or valueExpression is required",{params:i});(0,_.MG)(e,t,r,{expressionName:"statistics",query:s})}var N=i(86420),q=i(95466),P=(i(71511),i(53966),i(36708),i(44794),i(78659)),D=i(5482),V=i(69622),Q=i(91429);let j=class extends V.A{constructor(){super(...arguments),this.SCHEDULER_LOG_SLOW_TASKS=!1,this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES=!1}};(0,D.Cg)([(0,Q.MZ)()],j.prototype,"SCHEDULER_LOG_SLOW_TASKS",void 0),(0,D.Cg)([(0,Q.MZ)()],j.prototype,"FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES",void 0),j=(0,D.Cg)([(0,Q.$K)("esri.views.support.debugFlags")],j),new j,Symbol("Yield");new Map([["immediate",0],["schedule",4],["slide",0],["stream loader",0],["elevation query",0],["terrain",1],["surface geometry updates",1],["LoD renderer",2],["Graphics3D",2],["I3S",2],["3DTiles",2],["point cloud",2],["feature fetcher",2],["stream controller",2],["clouds generator",2],["occlusion query",2],["overlay",4],["overlay renderer",4],["stage",4],["graphics deconflictor",4],["graphics filter visibility",4],["graphics scale visibility",4],["graphics frustum visibility",4],["POI frequent",6],["POI infrequent",30],["labeler",8],["feature query",8],["feature tile tree",16],["fast feature tile tree",0],["elevation alignment",12],["elevation alignment scene",14],["text texture atlas",12],["texture unload",12],["line of sight tool",16],["interactive line of sight tool",0],["volume measurement",4],["snapping",0],["shadow accumulator",30],["flow generator",12],["gaussian splat sorting",2],["gaussian splat texture atlas",12],["mapview fetch queue",0],["mapview layerview update",2],["mapview vector tile parsing queue",0]]),(0,P.l5)(6.5),(0,P.l5)(1),(0,P.l5)(30),(0,P.l5)(1e3/30),(0,P.l5)(100);const Z=new class{constructor(){this._begin=performance?.now()??0,this._budget=0,this._done=!1,this._progressed=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e){this._begin=this.now(),this._budget=e,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return this.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}};Z.enabled=!1;const k=new class{remove(){}processQueue(){}schedule(e,t,i){try{if((0,l.G4)(t)){const e=(0,l.NK)();return i?Promise.resolve(i(e)):Promise.reject(e)}return(0,l.z7)(e(Z))}catch(e){return Promise.reject(e)}}reschedule(e,t,i){return this.schedule(e,t,i)}async scheduleGenerator(e,t,i){if((0,l.G4)(t)){const e=(0,l.NK)();if(i)return i(e);throw e}const s=e(Z);for(;;){const e=s.next(Z),r=(0,l.$X)(e)?await e:e;if((0,l.G4)(t)){const e=(0,l.NK)();if(i){const t=i(e),r=s.return(null);return(0,l.$X)(r)&&await(0,l.QZ)(r),t}const t=s.throw(e);throw(0,l.$X)(t)&&await(0,l.QZ)(t),e}if(r.done)return r.value}}};class L{constructor(e){this._changeHandle=null,this.capabilities={query:R.F},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new S,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,"object-id"===e.featureIdInfo.type&&(this.objectIdField=e.featureIdInfo.fieldName),this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=(0,c.W)(e.fieldsIndex)?e.fieldsIndex:q.A.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=k}destroy(){this._changeHandle=(0,o.xt)(this._changeHandle),this._frameTask=(0,o.xt)(this._frameTask),this._clearCache(),(0,o.pR)(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=(0,l.Mq)(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=(0,l.Mq)(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=(0,l.Mq)(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=(0,l.Mq)(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=(0,l.Mq)(t);if(!this.timeInfo?.trackIdField)throw new n.A("unsupported-query","Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=(0,l.Mq)(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=(0,l.Mq)(t);return e=(0,a.o8)(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const s=(0,l.Mq)(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),s)}async executeQueryForUniqueValues(e={},t,i){const s=(0,l.Mq)(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),s)}async executeQueryForClassBreaks(e={},t,i){const s=(0,l.Mq)(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),s)}async executeQueryForHistogram(e={},t,i){const s=(0,l.Mq)(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),s)}async executeQueryForSnapping(e,t){const i=(0,l.Mq)(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=(0,l.Mq)(e);this._timeExtentPromise||=(0,N.W)(this.timeInfo,this.featureStore);const[i,s]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return(0,l.Te)(t),{fullExtent:i,timeExtent:s}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==A.v8)throw t;return await new b.G([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(e){if(e!==A.v8)throw e;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const s=i.size;if(!s)return{count:0,extent:null};const r=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:s,extent:r}}catch(e){if(e===A.v8)return{count:0,extent:null};throw e}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,s=new Set;for(const e of i)s.add(t.featureAdapter.getObjectId(e));return s}catch(e){if(e===A.v8)return new Set;throw e}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==A.v8)throw t;return await new b.G([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await(0,A.iJ)(e,this.definitionExpression,this.spatialReference),yield,e=await async function(e,t){const i=e.bin;if(!i.onField&&!i.onExpression?.value||"autoIntervalBin"===i.type&&null==i.parameters.numberOfBins||"dateBin"===i.type&&(null==i.parameters.number||null==i.parameters.unit)||"fixedBoundariesBin"===i.type&&null==i.parameters.boundaries||"fixedIntervalBin"===i.type&&null==i.parameters.interval)throw new n.A(z,"Unsupported query options",{query:e});return B(e,t)}(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==A.v8)throw i;t=new b.G([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:s,valueExpression:r}=t,n=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:s,valueExpression:r});return yield,await n.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:s,field3:r,valueExpression:n}=t,a=yield*this._executeQueryForStatistics(e,{field:i,field2:s,field3:r,valueExpression:n});return yield,await a.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:s,valueExpression:r}=t,n=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:s,valueExpression:r});return yield,await n.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:s,valueExpression:r}=t,n=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:s,valueExpression:r});return yield,await n.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:s,returnEdge:r,vertexMode:n}=e;if(!r&&"none"===n)return{candidates:[]};let o=(0,a.o8)(e.query);o=await(0,A.T2)(o,this.definitionExpression,this.spatialReference),yield,o=await B(o,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const l=!(0,x.aI)(i.spatialReference,this.spatialReference);l&&(await(0,w.Nk)(i.spatialReference,this.spatialReference),yield);const u="number"==typeof s?s:s.x,c="number"==typeof s?s:s.y,d={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},p=l?(0,w.Cv)(d,this.spatialReference):d;if(!p)return{candidates:[]};const h=(await(0,g.el)((0,y.rS)(i),null,{signal:t}))[0];yield;const f=(await(0,g.el)((0,y.rS)(p),null,{signal:t}))[0];if(yield,null==h||null==f)return{candidates:[]};const m=await this._searchFeatures(U(f.toJSON()));yield;const v=new b.G(m,o,this);this._executeObjectIdsQuery(v),yield,this._executeTimeQuery(v),yield,this._executeAttributesQuery(v),yield,yield*this._executeGeometryQueryForSnapping(v),yield;const _=h.toJSON(),F=l?(0,w.Cv)(_,this.spatialReference):_,S=l?Math.max(p.xmax-p.xmin,p.ymax-p.ymin)/2:s;return v.createSnappingResponse({...e,point:F,distance:S},o.returnZ,i.spatialReference)}async _getBounds(e,t,i){const s=(0,p.hZ)((0,p.vt)(),p.qv);return await this.featureStore.forEachBounds(e,e=>(0,p.RF)(s,e)),H(s,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new b.G(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>(0,r.z)(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=(0,a.o8)(e),e=await(0,A.GC)(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const s=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(s),yield,this._executeObjectIdsQuery(s),yield,this._executeTimeQuery(s),yield,this._executeAttributesQuery(s),s}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:s}=e,r=this.featureStore.featureSpatialReference,n=e.sceneFilter.geometry,a=null==r||(0,x.aI)(r,n.spatialReference)?n:(0,w.Cv)(n,r);if(!a)return null;const o=i||s,l=(0,x.fn)(t)&&!(0,x.aI)(this.spatialReference,t)&&o?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(U(a));if(yield,"disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const s=await(0,M.xt)("esriSpatialRelDisjoint",a,this.geometryType);yield;const r=e=>!t.has(u.getObjectId(e))||s(u.getGeometry(e)),n=yield*this._runSpatialFilter(i,r);yield;const o=new b.G(n,e,this);return await l(o)}if(!c.length)return new b.G([],e,this);if(this._canExecuteSinglePass(a,e))return await l(new b.G(c,e,this));const d=await(0,M.xt)("esriSpatialRelContains",a,this.geometryType);yield;const p=yield*this._runSpatialFilter(c,e=>d(u.getGeometry(e)));return yield,await l(new b.G(p,e,this))}async*_executeGeometryQuery(e,t){if(null!=t&&0===t.items.length)return t;const{geometry:i,outSR:r,returnGeometry:n,returnCentroid:a}=e,o=t?null:this._getCacheKey(e),l=o?this._cache.get(o):null;if(l)return new b.G(l,e,this);const u=(0,x.fn)(r)&&!(0,x.aI)(this.spatialReference,r),c=n||a,d=async e=>(u&&c&&await this._project(e,r),o&&this._cache.put(o,e.items),e),p=this.featureStore.featureSpatialReference,h=!i||null==p||(0,x.aI)(p,i.spatialReference)?i:(0,w.Cv)(i,p);if(!h)return await d(null!=t?t:await this._getAllFeaturesQueryEngineResult(e));yield;const f=this.featureAdapter;let m=await this._searchFeatures(U(i));yield;const y=e.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===y){if(!m.length)return await d(null!=t?t:await this._getAllFeaturesQueryEngineResult(e));const i=new Set;for(const e of m)i.add(f.getObjectId(e));let s;null!=t?s=t.items:(yield,s=await this._getAllFeatures(),yield);const r=await(0,M.xt)(y,h,this.geometryType);yield;const n=e=>!i.has(f.getObjectId(e))||r(f.getGeometry(e)),a=yield*this._runSpatialFilter(s,n);yield;const o=new b.G(a,e,this);return await d(o)}if(null!=t){const e=new s.vW;m=m.filter(i=>(0,s.qh)(t.items,i,t.items.length,e)>=0)}if(!m.length){const t=new b.G([],e,this);return o&&this._cache.put(o,t.items),t}if(this._canExecuteSinglePass(h,e))return await d(new b.G(m,e,this));const g=await(0,M.xt)(y,h,this.geometryType);yield;const v=yield*this._runSpatialFilter(m,e=>g(f.getGeometry(e)));return yield,await d(new b.G(v,e,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const i of e.query.aggregateIds)this.aggregateAdapter.getFeatureObjectIds(i).forEach(e=>t.add(e));const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=(0,N.I)(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=(0,_.j4)(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const s=await(0,M.xt)(i,t.geometry,this.geometryType);yield;const r=this.featureAdapter,n=yield*this._runSpatialFilter(e.items,e=>s(r.getGeometry(e)));e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const s=new Array;for(const r of e)t(r)&&s.push(r),i.madeProgress(),i.done&&(i=yield);return s}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,r=s||i,n=new Map,a=this.featureAdapter.getAttribute;for(const i of e.items){const e=a(i,t),s=a(i,r),o=n.get(e);(!o||s>a(o,r))&&n.set(e,i)}e.items=Array.from(n.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:s,returnCentroid:r,outSR:n,resultType:a,cacheHint:o}=e;if("tile"!==a&&!o)return null;const l=s||r;return(0,x.fn)(n)&&!(0,x.aI)(this.spatialReference,n)&&l?JSON.stringify([t,i,n]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return(0,M.tC)(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||(0,x.aI)(this.spatialReference,t))return e;const i=this.featureAdapter,s=(0,d.isLoaded)()?await this._getFullExtent():void 0,n=await(0,w.lK)(e.items.map(e=>(0,F.pL)(this.geometryType,i.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=(0,r.z)(n.map((t,s)=>i.cloneWithGeometry(e.items[s],(0,v.Ux)(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=(0,a.o8)(e);try{e=await(0,A.GC)(e,this.definitionExpression,this.spatialReference),yield,e=await async function(e,t,{fieldsIndex:i,geometryType:s,spatialReference:r,availableFields:a}){if(null!=e.geometryPrecision||e.multipatchOption||e.pixelSize||e.relationParam||e.text||e.outStatistics||e.groupByFieldsForStatistics||e.having||e.orderByFields)throw new n.A(z,"Unsupported query options",{query:e});return G(i,a,e),Promise.all([O(i,a,t,e),(0,M.c0)(e,s,r),(0,w.Nk)(r,e.outSR)]).then(()=>e)}(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const s=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(s),yield,this._executeObjectIdsQuery(s),yield,this._executeTimeQuery(s),yield,this._executeAttributesQuery(s),yield,s}catch(t){if(t!==A.v8)throw t;return new b.G([],e,this)}}get test(){}}function U(e){if((0,M.tC)(e)){if((0,m.ZC)(e))return[(0,h.fA)(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if((0,m.Bi)(e))return e.rings.map(e=>(0,h.fA)(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[(0,f.Rg)((0,h.vt)(),e)]}function H(e,t,i,s,r){const n={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:(0,F.ag)(s)};r&&isFinite(e[2])&&isFinite(e[5])&&(n.zmin=e[2],n.zmax=e[5],n.hasZ=!0);const a=(0,w.Cv)(n,t,i);if(a.spatialReference=(0,F.ag)(i),a.xmax-a.xmin===0){const e=(0,u.GA)(a.spatialReference);a.xmin-=e,a.xmax+=e}if(a.ymax-a.ymin===0){const e=(0,u.GA)(a.spatialReference);a.ymin-=e,a.ymax+=e}if(r&&null!=a.zmin&&null!=a.zmax&&a.zmax-a.zmin===0){const e=(0,u.GA)(a.spatialReference);a.zmin-=e,a.zmax+=e}return a}},99352(e,t,i){i.d(t,{F:()=>s,P:()=>r});const s={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!0,supportedSpatialAggregationStatistics:{envelope:!0,centroid:!0,convexHull:!0},supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsFormatPBFWithCurves:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,maxUniqueIDCount:void 0,relativeTimeBinWindow:0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},r={supportsDate:!0,supportsFixedInterval:!0,supportsAutoInterval:!0,supportsFixedBoundaries:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!0,supportedStatistics:{count:!0,sum:!0,avg:!0,var:!0,stddev:!0,min:!0,max:!0,percentileContinuous:!0,percentileDiscrete:!0,envelope:!0,centroid:!0,convexHull:!0},supportedNormalizationTypes:{field:!0,log:!0,naturalLog:!0,percentOfTotal:!0,squareRoot:!0}}},8384(e,t,i){i.d(t,{G:()=>z});var s=i(4576),r=i(4718),n=i(12359),a=i(90634),o=i(62577),l=i(21325),u=i(46329),c=i(52006),d=i(29441),p=i(51441),h=i(30524),f=i(87445),m=i(1873),y=i(43668);class g{constructor(e,t,i){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=e.returnDistinctValues??!1,this.fieldsIndex=i,this.featureAdapter=t;const s=e.outFields;if(s&&!s.includes("*")){this.outFields=s;let e=0;for(const t of s){const s=(0,d.Wq)(t),r=this.fieldsIndex.get(s),n=r?null:(0,d.j4)(s,i),a=r?r.name:(0,d.SY)(t)||"FIELD_EXP_"+e++;this._fieldDataCache.set(t,{alias:a,clause:n})}}}countDistinctValues(e){return this.returnDistinctValues?(e.forEach(e=>this.getAttributes(e)),this._returnDistinctMap.size):e.length}getAttributes(e){const t=this._processAttributesForOutFields(e);return this._processAttributesForDistinctValues(t)}getFieldValue(e,t,i){if(i)return this.featureAdapter.getAttribute(e,i.name);const s=t;let r=null;return this._fieldDataCache.has(s)?r=this._fieldDataCache.get(s)?.clause:i||(r=(0,d.j4)(t,this.fieldsIndex),this._fieldDataCache.set(s,{alias:s,clause:r})),r?.calculateValue(e,this.featureAdapter)}getDataValues(e,t,i=!0){const s=t.normalizationType,r=t.normalizationTotal,n=this.fieldsIndex.get(t.field),a=(0,h.zD)(n)||(0,h.Ah)(n),o=(0,h.OH)(n);return e.map(e=>{let n=t.field&&this.getFieldValue(e,t.field,this.fieldsIndex.get(t.field));if(t.field2?(n=`${(0,m.gJ)(n)}${t.fieldDelimiter}${(0,m.gJ)(this.getFieldValue(e,t.field2,this.fieldsIndex.get(t.field2)))}`,t.field3&&(n=`${n}${t.fieldDelimiter}${(0,m.gJ)(this.getFieldValue(e,t.field3,this.fieldsIndex.get(t.field3)))}`)):"string"==typeof n&&i&&(a?n=n?new Date(n).getTime():null:o&&(n=n?(0,f.rb)(n):null)),s&&Number.isFinite(n)){const i="field"===s&&t.normalizationField?this.getFieldValue(e,t.normalizationField,this.fieldsIndex.get(t.normalizationField)):null;n=(0,m.zS)(n,s,i,r)}return n})}async getExpressionValues(e,t,i,s,r){const{arcadeUtils:n}=await(0,y.l)(),a=n.hasGeometryOperations(t);a&&await n.enableGeometryOperations();const o=n.createFunction(t),l=n.getViewInfo(i),u={fields:this.fieldsIndex.fields};return e.map(e=>{const t={attributes:this.featureAdapter.getAttributes(e),layer:u,geometry:a?{...(0,p.pL)(s.geometryType,this.featureAdapter.getGeometry(e)),spatialReference:i?.spatialReference}:null},c=n.createExecContext(t,l,r);return n.executeFunction(o,c)})}validateItem(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:(0,d.j4)(t,this.fieldsIndex)}),this._fieldDataCache.get(t)?.clause?.testFeature(e,this.featureAdapter)??!1}validateItems(e,t){return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:(0,d.j4)(t,this.fieldsIndex)}),this._fieldDataCache.get(t)?.clause?.testSet(e,this.featureAdapter)??!1}_processAttributesForOutFields(e){const t=this.outFields;if(!t?.length)return this.featureAdapter.getAttributes(e);const i={};for(const s of t){const{alias:t,clause:r}=this._fieldDataCache.get(s);i[t]=r?r.calculateValue(e,this.featureAdapter):this.featureAdapter.getAttribute(e,t)}return i}_processAttributesForDistinctValues(e){if(null==e||!this.returnDistinctValues)return e;const t=this.outFields,i=[];if(t)for(const s of t){const{alias:t}=this._fieldDataCache.get(s);i.push(e[t])}else for(const t in e)i.push(e[t]);const s=`${(t||["*"]).join(",")}=${i.join(",")}`;let r=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++r),r>1?null:e}}var x=i(31464),v=i(58727);class _{constructor(e,t,i){this.objectId=e,this.target=t,this.distance=i}}class F extends _{constructor(e,t,i){super(e,t,i),this.type="vertex"}}class w extends _{constructor(e,t,i,s,r,n=!1,a=null){super(e,t,i),this.start=s,this.end=r,this.draped=n,this.curve=a,this.type="edge"}}var S=i(5834),I=i(59977),T=i(57231),R=i(11440),b=i(60909),A=i(98623),M=i(92647);const C="bin";class z{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,r=t?.length;if(!r)return 1;const n=new Map,a=new Map,o=new Set;for(const r of s){const{statisticType:s}=r,l="exceedslimit"!==s?r.onStatisticField:void 0;if(!a.has(l)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,n);i.push(t)}a.set(l,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=a.get(l);for(const t in u){const{data:s,items:r}=u[t],n=s.join(",");i&&!e.validateItems(r,i)||o.add(n)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){const t=this.query.geometry;(0,l.fn)(this.query.outSR)&&!(0,l.aI)(t.spatialReference,this.query.outSR)?e.queryGeometry=(0,p.ag)({spatialReference:this.query.outSR,...(0,x.Cv)(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=(0,p.ag)({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,r=G(this.hasZ,this.hasM),{point:n}=e,a="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y;function l(e,t){const i=(e-n.x)/a,s=(t-n.y)/o;return i*i+s*s}const d={candidates:[]},p="esriGeometryPolygon"===this.geometryType,h="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,f=this._getPointCreator(t,this.spatialReference,i),m=new E(null,0),y=new E(null,0),g={x:0,y:0,z:0};for(const e of this.items){const t=s.getObjectId(e),i=s.getGeometryWithCurves?.(e);if(null!=i){v(i,t);continue}const r=s.getGeometry(e);null==r||x(r,t)}return d.candidates.sort((e,t)=>e.distance-t.distance),d;function x(t,i){const{coords:s}=t,a=t.isPoint?O:t.lengths;if(m.coords=s,y.coords=s,e.returnEdge){let e=0;for(let t=0;t<a.length;t++){const s=a[t],o=e;for(let t=0;t<s;t++,e+=r){if(!p&&t===s-1)continue;if(m.coordsIndex=e,y.coordsIndex=t===s-1?o:e+r,!B(g,n,m,y))continue;const a=l(g.x,g.y);a<=1&&d.candidates.push(new w(i,f(g),Math.sqrt(a),f(m),f(y)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<a.length;t++){const s=a[t],n=e,o=y;o.coordsIndex=n;for(let t=0;t<s;t++,e+=r){if(m.coordsIndex=e,p&&t===s-1&&m.x===o.x&&m.y===o.y)continue;const r=l(m.x,m.y);r<=1&&d.candidates.push(new F(i,f(m),Math.sqrt(r)))}}}else if(h&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<a.length;i++){t.push(e);const s=a[i];e+=s*r,s>1&&t.push(e-r)}for(const e of t){m.coordsIndex=e;const t=l(m.x,m.y);t<=1&&d.candidates.push(new F(i,f(m),Math.sqrt(t)))}}}function v(t,i){const{candidates:s}=d,r={x:0,y:0,z:0};if(e.returnEdge){const e=[n.x,n.y],a=new E(e,0),o=new E(e,0);for(const{segments:n}of t.parts)for(const{start:t,curve:d}of n){const{curvePoint:n}=(0,u.y)(t,d,e),p=l(...n);if(p>1)continue;[r.x,r.y]=n,a.coords=t,o.coords=(0,c.yP)(d);const h=(0,c.Xq)(d)?null:(0,c.tk)(d);s.push(new w(i,f(r),Math.sqrt(p),f(a),f(o),!1,h))}}function a(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const n=l(r.x,r.y);n>1||(r.z=t.vertexZ?.[e]??0,s.push(new F(i,f(r),Math.sqrt(n))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)a(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":a(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const i=t.partOffsets[e],s=t.partOffsets[e+1]-1;a(i),s!==i&&a(s)}}}}_getPointCreator(e,t,i){const s=null==i||(0,l.aI)(t,i)?e=>e:e=>(0,x.Cv)(e,t,i),{hasZ:r}=this;return r&&e?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,minValue:a,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,d=this.fieldsIndex.get(t),p=(0,h.vE)(d)||(0,h.zD)(d)||(0,h.Ah)(d),f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,scale:l,timeZone:u},this.items),y=(0,m.Vb)({normalizationType:r,normalizationField:s,minValue:a,maxValue:o}),g={value:.5,fieldType:d?.type},x=(0,h.yM)(d)?(0,m.z9)({values:f,supportsNullCount:y,percentileParams:g,outStatisticTypes:c}):(0,m.G_)({values:f,minValue:a,maxValue:o,useSampleStdDev:!r,supportsNullCount:y,percentileParams:g,outStatisticTypes:c});return(0,m.oZ)(x,c,p)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:r,scale:n,timeZone:a}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:n,timeZone:a},this.items,!1),l=(0,m.b3)(o);return(0,m.lv)(l,s,r,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:d,timeZone:p}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,scale:d,timeZone:p},this.items),f=(0,m.Rw)(h,{field:t,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return(0,m.jM)(f,a)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:d,timeZone:p}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,scale:d,timeZone:p},this.items);return(0,m.$y)(h,{field:t,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:a,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const{compare:t,fieldOrExpression:r,fieldInfo:n}=N(s,this.fieldsIndex);e.sort((e,s)=>t(i(e,r,n),i(s,r,n)))}}_topNFeatures(e,t,i,r){if(e.length>1&&t?.length){const n=t.map(e=>{const{compare:t,fieldOrExpression:i,fieldInfo:s}=N(e,this.fieldsIndex);return(e,n)=>t(r(e,i,s),r(n,i,s))}).reduceRight((e,t)=>(i,s)=>{const r=t(i,s);return 0===r||Number.isNaN(r)?e(i,s):r}),a=[];for(const t of e)(0,s.HX)(a,t,i,n);return a}return e.slice(0,i)}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:r,objectIdField:n,spatialReference:a}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:d,resultOffset:h,returnZ:f,returnM:m}=e,y=null!=d&&t.length>(h||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&m,hasZ:r&&f,objectIdFieldName:n,spatialReference:(0,p.ag)(u||a),transform:c&&(0,o.VV)(c)||null}}_createFeatures(e,t){const i=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:r}=this,{orderByFields:n,quantizationParameters:a,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:d,resultRecordCount:h,returnZ:f=!1,returnM:m=!1}=e,y=r&&f,x=s&&m;let v;const _=d||0,F=null!=h?_+h:null;null!=F&&F<=5e3&&F<t.length?v=this._topNFeatures(t,n,F,(e,t,s)=>i.getFieldValue(e,t,s)):(v=[...t],this._sortFeatures(v,n,(e,t,s)=>i.getFieldValue(e,t,s))),(_>0||null!=F)&&(v=v.slice(_,F??void 0));const w=[];let S=0;if(this.geometryType&&(l||u)){const e=(0,o.VV)(a)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const s of v){const r=this.featureAdapter.getGeometry(s),n=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),geometry:(0,p.pL)(this.geometryType,r,c,e,y,x)});t&&r&&!n.geometry&&(n.centroid=(0,p.LQ)(this,this.featureAdapter.getCentroid(s,this),e)),w[S++]=n}else if(!l&&u)for(const t of v)w[S++]=this._addFeatureJSONMetadata(t,{attributes:i.getAttributes(t),centroid:(0,p.LQ)(this,this.featureAdapter.getCentroid(t,this),e)});else for(const t of v)w[S++]=this._addFeatureJSONMetadata(t,{attributes:i.getAttributes(t),centroid:(0,p.LQ)(this,this.featureAdapter.getCentroid(t,this),e),geometry:(0,p.pL)(this.geometryType,this.featureAdapter.getGeometry(t),c,e,y,x)})}else for(const e of v){const t=i.getAttributes(e);t&&(w[S++]=this._addFeatureJSONMetadata(e,{attributes:t}))}return w}_addFeatureJSONMetadata(e,t){const i=this.featureAdapter.getMetadata?.(e);return void 0!==i&&(t.metadata=i),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const e of this.query.outStatistics??[])if("exceedslimit"===e.statisticType){t=null!=e.maxPointCount?e.maxPointCount:Number.POSITIVE_INFINITY,i=null!=e.maxRecordCount?e.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=e.maxVertexCount?e.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=G(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)},0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],r=new Map,n=new Map,a=new Map,o=new Map,l=new g(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:d,orderByFields:p,resultRecordCount:f}=e,m=c?.length,y=!!m,x=y?c[0]:null,v=y&&!this.fieldsIndex.get(x);for(const e of u??[]){const{outStatisticFieldName:u,statisticType:p}=e,f=e,g="exceedslimit"!==p?e.onStatisticField:void 0,_="percentile_disc"===p||"percentile_cont"===p,F="EnvelopeAggregate"===p||"CentroidAggregate"===p||"ConvexHullAggregate"===p,w=y&&1===m&&(g===x||v)&&"count"===p;if(y){if(!a.has(g)){const e=[];for(const i of c){const s=this._getAttributeValues(l,i,t,r);e.push(s)}a.set(g,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const e=a.get(g);if(!e)continue;const i=Object.keys(e);for(const s of i){const{count:i,data:n,items:a,itemPositions:p}=e[s],h=n.join(",");if(!d||l.validateItems(a,d)){const e=o.get(h)||{attributes:{}};if(F){e.aggregateGeometries||(e.aggregateGeometries={});const{aggregateGeometries:t,outStatisticFieldName:i}=await this._getAggregateGeometry(f,a);e.aggregateGeometries[i]=t}else{let s=null;if(w)s=i;else{const e=this._getAttributeValues(l,g,t,r),i=p.map(t=>e[t]);s=_&&"statisticParameters"in f?this._getPercentileValue(f,i):this._getStatisticValue(f,i,null,l.returnDistinctValues)}e.attributes[u]=s}let s=0;c.forEach((t,i)=>e.attributes[this.fieldsIndex.get(t)?t:"EXPR_"+ ++s]=n[i]),o.set(h,e)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(f,t);i.aggregateGeometries[s]=e}else{const e=this._getAttributeValues(l,g,t,r);i.attributes[u]=_&&"statisticParameters"in f?this._getPercentileValue(f,e):this._getStatisticValue(f,e,n,l.returnDistinctValues)}const S="min"!==p&&"max"!==p||!(0,h.yM)(this.fieldsIndex.get(g))&&!this._isAnyDateField(g)?null:this.fieldsIndex.get(g)?.type;s.push({name:u,alias:u,type:S||"esriFieldTypeDouble"})}const _=y?Array.from(o.values()):[i];return this._sortFeatures(_,p,(e,t)=>e.attributes[t]),f&&(_.length=Math.min(f,_.length)),{fields:s,features:_}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return(0,h.vE)(t)||(0,h.zD)(t)||(0,h.Ah)(t)||(0,h.OH)(t)}async _getAggregateGeometry(e,t){const{convexHull:s,union:r}=await i.e(1023).then(i.bind(i,81023)),{statisticType:o,outStatisticFieldName:l}=e,{featureAdapter:u,spatialReference:c,geometryType:d}=this,h=t.map(e=>(0,p.pL)(d,u.getGeometry(e))),f=s(c,h,!0)[0],m={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===o){const e=f?(0,a.v)(f):(0,a.HA)(r(c,h));m.aggregateGeometries={...e,spatialReference:c},m.outStatisticFieldName=l||"extent"}else if("CentroidAggregate"===o){const e=f?(0,n.l8)(f):(0,n.Z4)((0,a.HA)(r(c,h)));m.aggregateGeometries={x:e[0],y:e[1],spatialReference:c},m.outStatisticFieldName=l||"centroid"}else"ConvexHullAggregate"===o&&(m.aggregateGeometries=f,m.outStatisticFieldName=l||"convexHull");return m}_getStatisticValue(e,t,i,s){const{onStatisticField:r,statisticType:n}=e;let a=null;return a=i?.has(r)?i.get(r):(0,h.yM)(this.fieldsIndex.get(r))||this._isAnyDateField(r)?(0,m.z9)({values:t,returnDistinct:s}):(0,m.G_)({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(r,a),a["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:r}=e,{value:n,orderBy:a}=s,o=this.fieldsIndex.get(i);return(0,m.qg)(t,{value:n,orderBy:a,fieldType:o?.type,isDiscrete:"percentile_disc"===r})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const r=this.fieldsIndex.get(t),n=i.map(i=>e.getFieldValue(i,t,r));return s.set(t,n),n}_calculateUniqueValues(e,t,i){const s={},r=t.length;for(let n=0;n<r;n++){const r=t[n],a=[];for(const t of e)a.push(t[n]);const o=a.join(",");null==s[o]?s[o]={count:1,data:a,items:[r],itemPositions:[n]}:(i||s[o].count++,s[o].items.push(r),s[o].itemPositions.push(n))}return s}async _getDataValues(e,t,i=!0){const s=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:a,timeZone:o}=e;return n?s.getExpressionValues(t,n,{viewingMode:"map",scale:a,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):s.getDataValues(t,(0,r.o8)(e),i)}_calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,r=t.min??0,n=t.max??0,a=s.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){const o=e[t],l=i[t];if(null!=o&&o>=r&&o<=n){const e=(0,m.Ak)(s,o);e>-1&&(a[e].count++,a[e].items.push(l))}}return a}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:r}=t,n=[],a=[{name:s??i,alias:s??i,type:r??"esriFieldTypeString"},{name:C,alias:C,type:"esriFieldTypeInteger"}],o=new g(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[i],(e,t,i)=>o.getFieldValue(e,t,i));const c=this._getAttributeValues(o,i,u,l),d=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const t in d){const{items:r}=d[t],o=await this._createBinsResponse(e,r);if(n.push(...o.features.map(e=>({...e,attributes:{...e.attributes,[s??i]:t}}))),o.fields)for(const e of o.fields)a.some(t=>t.name===e.name)||a.push(e)}return{fields:a,features:n}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(S.A.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(I.A.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(R.A.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(b.A.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:r,numBins:n,normalizationType:a,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),d=(0,m.sU)(c,{field:s,normalizationField:r,normalizationType:a,normalizationTotal:o,numBins:n,minValue:(0,v.dO)(a?e.normalizationMinValue:l,!1),maxValue:(0,v.dO)(a?e.normalizationMaxValue:u,!1)}),p=this._calculateHistogramBins(c,d,i);return this._createFeaturesFromHistogramBins(p,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:r,start:n,end:a,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,d=r.unit,p=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),f=(0,h.OH)(this.fieldsIndex.get(s)),m=T.g.toJSON(d),y=p.filter(Boolean).sort((e,t)=>e-t),g=null!=n?(0,v.dO)(n,f):y[0],x=null!=a?(0,v.dO)(a,f):y[y.length-1],_=[];if(null!=g&&null!=x){const e={zone:t.outTimeReference?.ianaTimeZone??A.n$},i=u?.unit?T.g.toJSON(u.unit):"milliseconds",s={[i]:u?.value||0},n=M.c9.fromMillis(g,e).minus(s),a=M.c9.fromMillis(x,e).minus(s),d="number"==typeof c&&c>=1&&c<=7?c:7,p=(e,t)=>{const i=(e.weekday-t+7)%7;return e.minus({days:i}).startOf("day")};if("last"===o){let e="week"===m?((e,t)=>p(e,t).plus({days:7}))(a,d):a;for(;e>n;){const t=e.minus({[m]:r.value});if(t<n){_.unshift([l?t.plus(s).toMillis():n.plus(s).toMillis(),e.plus(s).toMillis()]);break}_.unshift([t.plus(s).toMillis(),e.plus(s).toMillis()]),e=t}}else{let e="first"===o?n:"week"===m?p(n,d):n.startOf(m);for(;e<=a;){const t=e.plus({[m]:r.value});if(t>a){_.push([e.plus(s).toMillis(),l?t.plus(s).toMillis():a.plus(s).toMillis()]);break}_.push([e.plus(s).toMillis(),t.plus(s).toMillis()]),e=t}}}const F=this._calculateHistogramBins(p,{intervals:_,min:g,max:x},i);return this._createFeaturesFromHistogramBins(F,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,r=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),n=(0,h.OH)(this.fieldsIndex.get(s)),a=e.boundaries.map(e=>(0,v.dO)(e,n)).sort((e,t)=>e-t),o=[];for(let e=0;e<a.length-1;e++)o.push([a[e],a[e+1]]);const l={intervals:o,min:a.at(0),max:a.at(-1)},u=this._calculateHistogramBins(r,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:r,normalizationType:n,start:a,end:o}=e,l=await this._getDataValues({field:s||e.expression,normalizationField:e.normalizationField,normalizationType:n,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),u=(0,h.OH)(this.fieldsIndex.get(s)),c=(0,m.sU)(l,{field:s,classificationMethod:"defined-interval",definedInterval:r,minValue:(0,v.dO)(n?e.normalizationMinValue:a,u),maxValue:(0,v.dO)(n?e.normalizationMaxValue:o,u)},!0),d=this._calculateHistogramBins(l,c,i);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,r=s||"lowerBoundary",n=i||"upperBoundary",a=[],o=[{name:r,alias:r,type:"esriFieldTypeDouble"},{name:n,alias:n,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:C,alias:C,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const d="dateBin"===t.bin.type,p=t.outTimeReference?.ianaTimeZone;for(const i of e){const{minValue:e,maxValue:s,items:h}=i,f={attributes:{}};let m;if(f.attributes[r]=d&&p&&null!=e?M.c9.fromMillis(e,{zone:p}).toISO():e,t.bin.hideUpperBound||(f.attributes[n]=d&&p&&null!=s?M.c9.fromMillis(s,{zone:p}).toISO():s),l?(m=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},h),f.attributes[C]=++c,"flat"===t.bin.jsonStyle?a.push(...m.features.map(({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...f.attributes}:{...t,...f.attributes}}))):(f.stackedAttributes=m.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),a.push(f))):(t.bin?.splitBy&&(f.attributes[C]=++c),m=await this._createStatisticsQueryResponse(t,h,f),a.push(f)),m.fields)for(const e of m.fields)o.some(t=>t.name===e.name)||o.push(e)}return"desc"===t.binOrder&&a.reverse(),{fields:o,features:a}}}function B(e,t,i,s){const r=s.x-i.x,n=s.y-i.y,a=t.x-i.x,o=t.y-i.y,l=r*r+n*n;if(0===l)return!1;const u=a*r+o*n,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+r*c,e.y=i.y+n*c,!0}function G(e,t){return e?t?4:3:t?3:2}class E{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const O=[1];function N(e,t){const i=e.split(" "),s=i[0],r=t.get(s),n=!!i[1]&&"desc"===i[1].toLowerCase();return{compare:(0,m.FM)(r?.type,n,"case-insensitive"),fieldOrExpression:s,fieldInfo:r}}},29441(e,t,i){i.d(t,{MG:()=>x,SN:()=>h,SY:()=>g,VW:()=>c,Wq:()=>y,eD:()=>f,j4:()=>m,vl:()=>u});var s=i(49186),r=i(44123),n=i(98453);const a=new r.WhereClauseCache(50,500),o="unsupported-query",l=" as ",u=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeBigInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]),c=new Set(["esriFieldTypeDate","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]),d=new Set(["esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...u,...c]);function p(e,t,i={}){const r=m(t,e);if(!r){const i=a.getError(t,e);throw new s.A(o,"invalid SQL expression",{expression:t,error:i})}const n=i.expressionName||"expression";if(i.validateStandardized&&!r.isStandardized)throw new s.A(o,`${n} is not standard`,{expression:t});if(i.validateAggregate&&!r.isAggregate)throw new s.A(o,`${n} does not contain a valid aggregate function`,{expression:t});return r.fieldNames}function h(e,t,i,s){if(!i)return!0;const r="where clause";return x(e,t,p(e,i,{validateStandardized:!0,expressionName:r}),{expressionName:r,query:s}),!0}function f(e,t,i,r,n){if(!i)return!0;const a="having clause",l=p(e,i,{validateAggregate:!0,expressionName:a});x(e,t,l,{expressionName:a,query:n});const u=m(i,e),c=u?.getExpressions().every(t=>{const{aggregateType:i,field:s}=t,n=e.get(s)?.name;return r.some(t=>{const{onStatisticField:s,statisticType:r}=t,a=e.get(s)?.name;return a===n&&r.toLowerCase().trim()===i})});if(!c)throw new s.A(o,"expressions in having clause should also exist in outStatistics",{having:i});return!0}function m(e,t){return e?a.get(e,t):null}function y(e){return/\((.*?)\)/.test(e)?e:e.split(l)[0]}function g(e){return e.split(l)[1]}function x(e,t,i,r={}){const n=new Map;if(function(e,t,i,s,r){const n=r.includes("*")?[...i,...r.filter(e=>"*"!==e)]:r;for(const r of n)if(t.get(r))v(e,t,i,s,r);else try{const n=p(t,y(r),{validateStandardized:!0});for(const r of n)v(e,t,i,s,r)}catch(t){e.set(r,{type:"expression-error",expression:r,error:t})}}(n,e,t,r.allowedFieldTypes??d,i),n.size){const e=r.expressionName??"expression";throw new s.A(o,`${e} contains invalid or missing fields`,{errors:Array.from(n.values()),query:r.query})}}function v(e,t,i,s,r){const a=t.get(r);a?i.has(a.name)?"all"!==s&&!1===s?.has(a.type)&&e.set(r,{type:"invalid-type",fieldName:a.name,fieldType:n.m.fromJSON(a.type),allowedFieldTypes:Array.from(s,e=>n.m.fromJSON(e))}):e.set(r,{type:"missing-field",fieldName:a.name}):e.set(r,{type:"invalid-field",fieldName:r})}},51441(e,t,i){i.d(t,{LQ:()=>r,ag:()=>a,pL:()=>n});var s=i(90708);function r(e,t,i,r=e.hasZ,n=e.hasM){if(null==t)return null;const a=e.hasZ&&r,o=e.hasM&&n;if(i){const e=(0,s.Nl)(t,"esriGeometryPoint",i,r,n);return(0,s.DF)(e,a,o)}return(0,s.DF)(t,a,o)}function n(e,t,i,r,n,a){if(null==t)return null;const o="coords"in t?t:t.geometry;if(null==o)return null;const{hasZ:l,hasM:u}=o,c=l&&(n??=l),d=u&&(a??=u);if(i){let t=(0,s.kz)(o,e,i,n,a);return r&&(t=(0,s.Nl)(t,e,r)),(0,s.zv)(t,e,c,d)}if(r){const t=(0,s.Nl)(o,e,r,n,a);return(0,s.zv)(t,e,c,d)}return(0,s.zv)(o,e,c,d)}function a(e){return e&&o in e?JSON.parse(JSON.stringify(e,l)):e}const o="_geVersion",l=(e,t)=>e===o?void 0:t},31464(e,t,i){i.d(t,{Cv:()=>f,Nk:()=>d,lK:()=>y});var s=i(4576),r=i(91218),n=i(21325),a=i(28735);const o=[0,0];function l(e,t){if(!t)return null;if("x"in t){const i={x:0,y:0};return[i.x,i.y]=e(t.x,t.y,o),null!=t.z&&(i.z=t.z),null!=t.m&&(i.m=t.m),i}if("xmin"in t){const i={xmin:0,ymin:0,xmax:0,ymax:0};return[i.xmin,i.ymin]=e(t.xmin,t.ymin,o),[i.xmax,i.ymax]=e(t.xmax,t.ymax,o),t.hasZ&&(i.zmin=t.zmin,i.zmax=t.zmax,i.hasZ=!0),t.hasM&&(i.mmin=t.mmin,i.mmax=t.mmax,i.hasM=!0),i}return"rings"in t?{rings:u(t.rings,e),hasM:t.hasM,hasZ:t.hasZ}:"paths"in t?{paths:u(t.paths,e),hasM:t.hasM,hasZ:t.hasZ}:"points"in t?{points:c(t.points,e),hasM:t.hasM,hasZ:t.hasZ}:null}function u(e,t){const i=[];for(const s of e)i.push(c(s,t));return i}function c(e,t){const i=[];for(const s of e){const e=t(s[0],s[1],[0,0]);i.push(e),s.length>2&&e.push(s[2]),s.length>3&&e.push(s[3])}return i}async function d(e,t){if(!e||!t)return;const i=Array.isArray(e)?e.map(e=>null!=e.geometry?e.geometry.spatialReference:null).filter(s.Ru):[e];await(0,r.initializeProjection)(i.map(e=>({source:e,dest:t})))}const p=l.bind(null,a.je),h=l.bind(null,a.tD);function f(e,t,i,s){if(!e)return null;if(i||(i=t,t=e.spatialReference),!(0,n.fn)(t)||!(0,n.fn)(i)||(0,n.aI)(t,i))return e;if((0,a.y7)(t,i)){const t=(0,n.K8)(i)?p(e):h(e);return t.spatialReference=i,t}return(0,r.projectMany)([e],t,i,s)[0]}const m=new class{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,i,s){if(!e?.length||!t||!i||(0,n.aI)(t,i))return e;const r={geometries:e,inSpatialReference:t,outSpatialReference:i,options:s,resolve:Promise.withResolvers()};return this._jobs.push(r),this._timer??=setTimeout(this._process,10),r.resolve.promise}_process(){this._timer=null;const e=this._jobs.shift();if(!e)return;const{geometries:t,inSpatialReference:i,outSpatialReference:s,resolve:o,options:l}=e,u=t.filter(e=>null!=e);let c;c=(0,a.y7)(i,s)&&null==l?.extendedParams?(0,n.K8)(s)?u.map(p):u.map(h):(0,r.projectMany)(u,i,s,l);let d=0;const f=t.map(e=>null==e?null:c[d++]);o.resolve(f),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}};function y(e,t,i,s){return m.push(e,t,i,s)}},58727(e,t,i){i.d(t,{GC:()=>y,T2:()=>g,VY:()=>h,dO:()=>v,iJ:()=>m,v8:()=>f});var s=i(49186),r=i(66552),n=i(86211),a=i(91218),o=i(90634),l=i(60408),u=i(65864),c=i(17136),d=i(21325),p=i(31464);const h=new r.J({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),f=Object.freeze({});async function m(e,t,i){const s=e.bin;return s.onField&&(s.onField=s.onField.trim()),s.onExpression?.value&&(s.onExpression.value=s.onExpression.value.trim()),s.splitBy&&(s.splitBy.value&&(s.splitBy.value=s.splitBy.value.trim()),s.splitBy.outAlias&&(s.splitBy.outAlias=s.splitBy.outAlias.trim())),s.stackBy&&(s.stackBy.value&&(s.stackBy.value=s.stackBy.value.trim()),s.stackBy.outAlias&&(s.stackBy.outAlias=s.stackBy.outAlias.trim())),"normalizationField"in s.parameters&&s.parameters.normalizationField&&(s.parameters.normalizationField=s.parameters.normalizationField.trim()),e.outStatistics?.length||(e.outStatistics=[{statisticType:"count",onStatisticField:"1",outStatisticFieldName:"frequency"}]),y(e,t,i)}async function y(e,t,i){const{outFields:s,orderByFields:r,groupByFieldsForStatistics:n,outStatistics:a}=e;if(s)for(let e=0;e<s.length;e++)s[e]=s[e].trim();if(r)for(let e=0;e<r.length;e++)r[e]=r[e].trim();if(n)for(let e=0;e<n.length;e++)n[e]=n[e].trim();if(a)for(let e=0;e<a.length;e++)a[e].onStatisticField&&(a[e].onStatisticField=a[e].onStatisticField.trim());return e.geometry&&!e.outSR&&(e.outSR=e.geometry.spatialReference),g(e,t,i)}async function g(e,t,r){if(!e)return null;let{where:a}=e;if(e.where=a=a?.trim(),(!a||/^1 *= *1$/.test(a)||t&&t===a)&&(e.where=null),!e.geometry)return e;let m=await async function(e){const{distance:t,units:r}=e,a=e.geometry;if(null==t||"vertexAttributes"in a)return a;const o=a.spatialReference,u=r?h.fromJSON(r):(0,n.Ij)(o),c=o&&((0,d.EA)(o)||(0,d.K8)(o))?a:await(0,p.Nk)(o,d.KK).then(()=>(0,p.Cv)(a,d.KK)),f=await i.e(9159).then(i.bind(i,49159));await f.load();const m=f.execute(c,t||1,{unit:u})??void 0;if(!m||!(0,l.Bi)(m)||0===m.rings.length)throw new s.A("unsupported-query:invalid-parameters","Invalid parameters for query by distance");return m}(e);if(e.distance=0,e.units=null,"esriSpatialRelEnvelopeIntersects"===e.spatialRel){const{spatialReference:t}=e.geometry;m=(0,o.HA)(m),m.spatialReference=t}if(m){await(0,p.Nk)(m.spatialReference,r),m=function(e,t){const i=e.spatialReference;return x(e,t)&&(0,l.ZC)(e)?{spatialReference:i,rings:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}:e}(m,r);const t=(await(0,c.el)((0,u.rS)(m)))[0];if(null==t)throw f;const i="quantizationParameters"in e&&e.quantizationParameters?.tolerance||"maxAllowableOffset"in e&&e.maxAllowableOffset||0,s=i&&x(m,r)?{extendedParams:{densificationStep:8*i}}:void 0,n=t.toJSON(),a=(0,p.Cv)(n,n.spatialReference,r,s);if(!a)throw f;a.spatialReference=r,e.geometry=a}return e}function x(e,t){if(!e)return!1;const i=e.spatialReference;return((0,l.ZC)(e)||(0,l.Bi)(e)||(0,l.Rg)(e))&&!(0,d.aI)(i,t)&&!(0,a.canProjectWithoutEngine)(i,t)}function v(e,t){return null==e?null:"string"==typeof e?t?new Date(`1970-01-01T${e}Z`).getTime():new Date(e).getTime():e instanceof Date?e.getTime():e}},62660(e,t,i){i.d(t,{tC:()=>w,c0:()=>F,xt:()=>_});var s=i(49186),r=i(94078),n=i(12176),a=i(60408),o=i(21325);function l(e,t){return c(e,t.coords[0],t.coords[1])}function u(e,t){const{coords:i,lengths:s,stride:r}=t;if(!s)return!1;for(let t=0,n=0;t<s.length;t++,n+=r)if(!c(e,i[n],i[n+1]))return!1;return!0}function c(e,t,i){if(!e)return!1;const{coords:s,lengths:r,stride:n}=e;let a=!1,o=0;for(const e of r)a=d(a,s,n,o,e,t,i),o+=e*n;return a}function d(e,t,i,s,r,n,a){let o=e,l=s;for(let e=s,u=s+r*i;e<u;e+=i){l=e+i,l===u&&(l=s);const r=t[e],c=t[e+1],d=t[l],p=t[l+1];(c<a&&p>=a||p<a&&c>=a)&&r+(a-c)/(p-c)*(d-r)<n&&(o=!o)}return o}var p=i(90708),h=i(51441),f=i(31464);const m="unsupported-query",y={esriSpatialRelIntersects:!0,esriSpatialRelContains:!0,esriSpatialRelWithin:!0,esriSpatialRelCrosses:!0,esriSpatialRelDisjoint:!0,esriSpatialRelTouches:!0,esriSpatialRelOverlaps:!0,esriSpatialRelEnvelopeIntersects:!0,esriSpatialRelIndexIntersects:!1,esriSpatialRelRelation:!1},g={esriGeometryPoint:!0,esriGeometryMultiPatch:!1,esriGeometryMultipoint:!0,esriGeometryPolyline:!0,esriGeometryPolygon:!0,esriGeometryEnvelope:!0},x={esriGeometryPoint:!0,esriGeometryMultiPatch:!0,esriGeometryMultipoint:!0,esriGeometryPolyline:!0,esriGeometryPolygon:!0,esriGeometryEnvelope:!1},v={esriSpatialRelIntersects:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(8414)]).then(i.bind(i,55284)),esriSpatialRelContains:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(609)]).then(i.bind(i,51508)),esriSpatialRelCrosses:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(7316)]).then(i.bind(i,85672)),esriSpatialRelDisjoint:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(6960)]).then(i.bind(i,7978)),esriSpatialRelEnvelopeIntersects:null,esriSpatialRelIndexIntersects:null,esriSpatialRelOverlaps:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(3304)]).then(i.bind(i,46178)),esriSpatialRelTouches:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(7987)]).then(i.bind(i,83547)),esriSpatialRelWithin:()=>Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(1787)]).then(i.bind(i,85445)),esriSpatialRelRelation:null};async function _(e,t,i){if((0,a.Bi)(t)){if("esriGeometryPoint"===i&&("esriSpatialRelIntersects"===e||"esriSpatialRelContains"===e)){const e=(0,p.Ye)(t,!1,!1);return t=>l(e,t)}if("esriGeometryMultipoint"===i){const i=(0,p.Ye)(t,!1,!1);if("esriSpatialRelContains"===e)return e=>u(i,e)}}if((0,a.ZC)(t)){if("esriGeometryPoint"===i&&("esriSpatialRelIntersects"===e||"esriSpatialRelContains"===e))return e=>(0,r.qz)(t,(0,h.pL)(i,e));if("esriGeometryMultipoint"===i&&"esriSpatialRelContains"===e)return e=>(0,r.rL)(t,(0,h.pL)(i,e));if("esriSpatialRelIntersects"===e){const e="mesh"===(s=i)?n.xB:(0,n.xK)(s);return s=>e(t,(0,h.pL)(i,s))}}var s;"esriSpatialRelEnvelopeIntersects"===e&&(e="esriSpatialRelIntersects");const o=await function(e){const t=v[e];if(null==t)throw new Error(`Cannot load unsupported spatial operator: ${e}`);return t()}(e);return e=>o.execute(t,(0,h.pL)(i,e))}async function F(e,t,i){const{spatialRel:r,geometry:n}=e;if(n){if(null==(l=r)||!0!==y[l])throw new s.A(m,"Unsupported query spatial relationship",{query:e});if((0,o.fn)(n.spatialReference)&&(0,o.fn)(i)){if(!function(e){return null!=e&&!0===g[(0,a.$B)(e)]}(n))throw new s.A(m,"Unsupported query geometry type",{query:e});if(!function(e){return null!=e&&!0===x[e]}(t))throw new s.A(m,"Unsupported layer geometry type",{query:e});if(e.outSR)return(0,f.Nk)(e.geometry?.spatialReference,e.outSR)}}var l}function w(e){if((0,a.ZC)(e))return!0;if((0,a.Bi)(e)){for(const t of e.rings){if(5!==t.length)return!1;if(t[0][0]!==t[1][0]||t[0][0]!==t[4][0]||t[2][0]!==t[3][0]||t[0][1]!==t[3][1]||t[0][1]!==t[4][1]||t[1][1]!==t[2][1])return!1}return!0}return!1}},86420(e,t,i){i.d(t,{I:()=>n,W:()=>r});var s=i(21818);async function r(e,t){if(!e)return null;const i=t.featureAdapter,{startTimeField:r,endTimeField:n}=e;let a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;if(r&&n)await t.forEach(e=>{const t=i.getAttribute((0,s.z)(e),r),l=i.getAttribute((0,s.z)(e),n);null==t||isNaN(t)||(a=Math.min(a,t)),null==l||isNaN(l)||(o=Math.max(o,l))});else{const e=r||n;await t.forEach(t=>{const r=i.getAttribute((0,s.z)(t),e);null==r||isNaN(r)||(a=Math.min(a,r),o=Math.max(o,r))})}return{start:a,end:o}}function n(e,t,i){if(!t||!e)return null;const{startTimeField:s,endTimeField:r}=e;if(!s&&!r)return null;const{start:n,end:a}=t;if(null===n&&null===a)return null;if(void 0===n&&void 0===a)return()=>!1;const o=i.getAttributeAsTimestamp?.bind(i)??i.getAttribute.bind(i);return s&&r?function(e,t,i,s,r){return null!=s&&null!=r?n=>{const a=e(n,t),o=e(n,i);return(null==a||a<=r)&&(null==o||o>=s)}:null!=s?t=>{const r=e(t,i);return null==r||r>=s}:null!=r?i=>{const s=e(i,t);return null==s||s<=r}:void 0}(o,s,r,n,a):function(e,t,i,s){return null!=i&&null!=s&&i===s?s=>e(s,t)===i:null!=i&&null!=s?r=>{const n=e(r,t);return null!=n&&n>=i&&n<=s}:null!=i?s=>{const r=e(s,t);return null!=r&&r>=i}:null!=s?i=>{const r=e(i,t);return null!=r&&r<=s}:void 0}(o,s||r,n,a)}},92300(e,t,i){i.d(t,{V:()=>a,X:()=>n});var s=i(60408),r=i(65864);function n(e){return{geometryType:(0,s.$B)(e[0]),geometries:e.map(e=>e.toJSON())}}function a(e,t,i){const s=(0,r.xD)(t);return e.map(e=>{const t=s.fromJSON(e);return t.spatialReference=i,t})}},5834(e,t,i){i.d(t,{A:()=>d});var s=i(5482),r=i(93637),n=i(91429),a=i(56507),o=i(41266),l=i(41366),u=i(93223);function c(e,t,i){(0,r.sM)(i,e instanceof Date?e.getTime():e,t)}let d=class extends((0,l.K)(o.A)){constructor(e){super(e),this.numBins=null,this.end=null,this.start=null,this.type="auto-interval"}};(0,s.Cg)([(0,n.MZ)({type:Number,json:{name:"parameters.numberOfBins",write:!0}})],d.prototype,"numBins",void 0),(0,s.Cg)([(0,n.MZ)({json:{name:"parameters.end",write:{writer:c}}})],d.prototype,"end",void 0),(0,s.Cg)([(0,n.MZ)({json:{name:"parameters.start",write:{writer:c}}})],d.prototype,"start",void 0),(0,s.Cg)([(0,u.e)({autoIntervalBin:"auto-interval"},{readOnly:!0})],d.prototype,"type",void 0),d=(0,s.Cg)([(0,n.$K)("esri.rest.support.AutoIntervalBinParameters")],d),d.from=(0,a.dp)(d)},41266(e,t,i){i.d(t,{A:()=>m});var s=i(5482),r=i(69540),n=i(66552),a=i(25482),o=i(91429),l=i(56507),u=i(93223);const c=new n.J({esriFieldTypeInteger:"integer",esriFieldTypeString:"string"});let d=class extends((0,r.OU)(a.o)){constructor(e){super(e),this.alias=null,this.responseType=null,this.type=null,this.value=null,this.valueType=null}};(0,s.Cg)([(0,o.MZ)({type:String,json:{name:"outAlias",write:!0}})],d.prototype,"alias",void 0),(0,s.Cg)([(0,o.MZ)({type:String})],d.prototype,"responseType",void 0),(0,s.Cg)([(0,o.MZ)({type:String,json:{write:!0}})],d.prototype,"type",void 0),(0,s.Cg)([(0,o.MZ)({type:String,json:{write:!0}})],d.prototype,"value",void 0),(0,s.Cg)([(0,u.e)(c)],d.prototype,"valueType",void 0),d=(0,s.Cg)([(0,o.$K)("esri.rest.support.AttributeBinsGrouping")],d);const p=d;d.from=(0,l.dp)(d);const h=new n.J({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeDate:"date",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"}),f=new n.J({naturalLog:"natural-log",squareRoot:"square-root"});let m=class extends((0,r.OU)(a.o)){constructor(e){super(e),this.expression=null,this.expressionValueType=null,this.field=null,this.firstDayOfWeek=null,this.hideUpperBound=null,this.splitBy=null,this.stackBy=null,this.transformation=null}};(0,s.Cg)([(0,o.MZ)({type:String,json:{name:"onExpression.value",write:!0}})],m.prototype,"expression",void 0),(0,s.Cg)([(0,u.e)(h,{name:"onExpression.valueType"})],m.prototype,"expressionValueType",void 0),(0,s.Cg)([(0,o.MZ)({type:String,json:{name:"onField",write:!0}})],m.prototype,"field",void 0),(0,s.Cg)([(0,o.MZ)({type:Number,json:{write:!0}})],m.prototype,"firstDayOfWeek",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,json:{write:!0}})],m.prototype,"hideUpperBound",void 0),(0,s.Cg)([(0,o.MZ)({type:p,json:{write:{overridePolicy(){return{enabled:null!=this.splitBy?.value||null!=this.splitBy?.type}}}}})],m.prototype,"splitBy",void 0),(0,s.Cg)([(0,o.MZ)({type:p,json:{write:{target:{stackBy:{type:p},jsonStyle:{type:String}},writer:(e,t)=>{e&&(t.stackBy=e.toJSON(),null!=e.responseType&&(t.jsonStyle=e.responseType))},overridePolicy(){return{enabled:null!=this.stackBy?.value||null!=this.stackBy?.type}}},read:{source:["stackBy","jsonStyle"],reader:(e,t)=>p.fromJSON({...t.stackBy,responseType:t.jsonStyle})}}})],m.prototype,"stackBy",void 0),(0,s.Cg)([(0,u.e)(f)],m.prototype,"transformation",void 0),m=(0,s.Cg)([(0,o.$K)("esri.rest.support.BinParametersBase")],m)},59977(e,t,i){i.d(t,{A:()=>y});var s=i(5482),r=i(93637),n=i(91429),a=i(56507),o=i(41266),l=i(69540),u=i(25482),c=i(57231),d=i(93223);let p=class extends((0,l.OU)(u.o)){constructor(e){super(e),this.value=null,this.unit=null}};(0,s.Cg)([(0,n.MZ)({type:Number,json:{name:"number",write:!0}})],p.prototype,"value",void 0),(0,s.Cg)([(0,d.e)(c.g)],p.prototype,"unit",void 0),p=(0,s.Cg)([(0,n.$K)("esri.rest.support.DateBinTimeInterval")],p);const h=p;function f(e,t,i){(0,r.sM)(i,"string"==typeof e?e:e?.getTime(),t)}function m(e,t){const i=e.parameters[t];return i?"string"==typeof i?i:new Date(i):null}p.from=(0,a.dp)(p);let y=class extends o.A{constructor(e){super(e),this.end=null,this.interval=null,this.offset=null,this.returnFullIntervalBin=!1,this.start=null,this.snapToData=null,this.type="date"}};(0,s.Cg)([(0,n.MZ)({cast:e=>null!=e?"string"==typeof e?e:new Date(e):null,json:{name:"parameters.end",read:{reader:(e,t)=>m(t,"end")},write:{writer:f}}})],y.prototype,"end",void 0),(0,s.Cg)([(0,n.MZ)({type:h,json:{name:"parameters",write:!0}})],y.prototype,"interval",void 0),(0,s.Cg)([(0,n.MZ)({type:h,json:{name:"parameters.offset",write:!0}})],y.prototype,"offset",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,json:{name:"parameters.returnFullIntervalBin",write:!0}})],y.prototype,"returnFullIntervalBin",void 0),(0,s.Cg)([(0,n.MZ)({cast:e=>null!=e?"string"==typeof e?e:new Date(e):null,json:{name:"parameters.start",read:{reader:(e,t)=>m(t,"start")},write:{writer:f}}})],y.prototype,"start",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{name:"parameters.snapToData",write:!0}})],y.prototype,"snapToData",void 0),(0,s.Cg)([(0,d.e)({dateBin:"date"},{readOnly:!0})],y.prototype,"type",void 0),y=(0,s.Cg)([(0,n.$K)("esri.rest.support.DateBinParameters")],y),y.from=(0,a.dp)(y)},57231(e,t,i){i.d(t,{g:()=>s});const s=(0,i(66552).O)()({year:"years",quarter:"quarters",month:"months",week:"weeks",day:"days",hour:"hours",minute:"minutes",second:"seconds"})},11440(e,t,i){i.d(t,{A:()=>u});var s=i(5482),r=i(93637),n=i(91429),a=i(56507),o=i(41266),l=i(93223);let u=class extends o.A{constructor(e){super(e),this.boundaries=[],this.type="fixed-boundaries"}};(0,s.Cg)([(0,n.MZ)({json:{name:"parameters.boundaries",write:{writer:function(e,t,i){(0,r.sM)(i,e&&function(e){return e[0]instanceof Date}(e)?e.map(e=>e.getTime()):e,t)}}}})],u.prototype,"boundaries",void 0),(0,s.Cg)([(0,l.e)({fixedBoundariesBin:"fixed-boundaries"},{readOnly:!0})],u.prototype,"type",void 0),u=(0,s.Cg)([(0,n.$K)("esri.rest.support.FixedBoundariesBinParameters")],u),u.from=(0,a.dp)(u)},60909(e,t,i){i.d(t,{A:()=>d});var s=i(5482),r=i(93637),n=i(91429),a=i(56507),o=i(41266),l=i(41366),u=i(93223);function c(e,t,i){(0,r.sM)(i,e instanceof Date?e.getTime():e,t)}let d=class extends((0,l.K)(o.A)){constructor(e){super(e),this.end=null,this.interval=null,this.start=null,this.type="fixed-interval"}};(0,s.Cg)([(0,n.MZ)({json:{name:"parameters.end",write:{writer:c}}})],d.prototype,"end",void 0),(0,s.Cg)([(0,n.MZ)({type:Number,json:{name:"parameters.interval",write:!0}})],d.prototype,"interval",void 0),(0,s.Cg)([(0,n.MZ)({json:{name:"parameters.start",write:{writer:c}}})],d.prototype,"start",void 0),(0,s.Cg)([(0,u.e)({fixedIntervalBin:"fixed-interval"},{readOnly:!0})],d.prototype,"type",void 0),d=(0,s.Cg)([(0,n.$K)("esri.rest.support.FixedIntervalBinParameters")],d),d.from=(0,a.dp)(d)},41366(e,t,i){i.d(t,{K:()=>d,Q:()=>l});var s=i(5482),r=i(66552),n=i(53966),a=i(91429),o=i(93223);const l=(0,r.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),u="percent-of-total",c="field",d=e=>{const t=e;let i=class extends t{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType");const t=!!this.normalizationField,i=null!=this.normalizationTotal;return t||i?(e=t&&c||i&&u||null,t&&i&&n.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==c&&e!==u||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,s.Cg)([(0,a.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],i.prototype,"normalizationField",void 0),(0,s.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],i.prototype,"normalizationMaxValue",void 0),(0,s.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],i.prototype,"normalizationMinValue",void 0),(0,s.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],i.prototype,"normalizationTotal",void 0),(0,s.Cg)([(0,o.e)(l,{name:"parameters.normalizationType"})],i.prototype,"normalizationType",null),i=(0,s.Cg)([(0,a.$K)("esri.rest.support.NormalizationBinParametersMixin")],i),i}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9235],{34930(t,e,s){s.d(e,{$Q:()=>a,Sd:()=>u,b7:()=>l});var n=s(86211),r=s(5443),o=s(86738),i=s(14140);async function a(t,e,n){if("extent"===n.type)return function(t,e,s){const{width:n,height:r}=t,o=new Uint8Array(n*r),a=e.width/n,u=e.height/r;if(s.width/a<.5||s.height/u<.5)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});const{xmin:l,xmax:c,ymin:p,ymax:h}=e,{xmin:m,xmax:d,ymin:g,ymax:f}=s,y=Math.max(l,m),x=Math.min(c,d),w=Math.max(p,g),A=Math.min(h,f),v=.5*a,C=.5*u;if(x-y<v||A-w<C||x<l+v||y>c-v||w>h-C||A<p+C)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});const b=Math.max(0,(y-l)/a),M=Math.min(n,Math.max(0,(x-l)/a)),T=Math.max(0,(h-A)/u),P=Math.min(r,Math.max(0,(h-w)/u)),N=Math.round(b),I=Math.round(M)-1,R=Math.round(T),F=Math.round(P)-1;if(N===I&&b%1>.5&&M%1<.5||R===F&&T%1>.5&&P%1<.5)return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]});if(0===N&&0===R&&I===n&&F===r)return t;const k=t.mask;for(let t=R;t<=F;t++)for(let e=N;e<=I;e++){const s=t*n+e;o[s]=k?k[s]:255}return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]})}(t,e,n);const{width:r,height:o}=t,a=new Uint8Array(r*o);return(await Promise.all([s.e(3661),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(1132)]).then(s.bind(s,25275))).execute(e,n)?"polyline"===n.type?function(t,e,s){const{width:n,height:r}=t,o=new Uint8Array(n*r),a=e.width/n,u=e.height/r,{xmin:l,ymax:c}=e,{paths:p}=s,h=t.mask;for(let t=0;t<p.length;t++){const e=p[t];for(let t=0;t<e.length-1;t++){const[s,i]=e[t],[p,m]=e[t+1],d=Math.min(i,m),g=Math.max(i,m),f=Math.max(0,Math.floor((c-g)/u)),y=Math.min(r-1,Math.floor((c-d)/u));if(!(y<f))if(f===y){const t=Math.min(s,p),e=Math.max(s,p),r=Math.max(0,Math.floor((t-l)/a)),i=Math.min(n-1,Math.floor((e-l)/a));if(i<r)continue;const u=f*n;for(let t=u+r;t<=u+i;t++)o[t]=h?h[t]:255}else{const t=(s-l)/a,e=(p-s)/(m-i)/a,r=u*e;for(let s=f;s<=y;s++){const a=e*(c-s*u-i)+t,l=Math.max(0,Math.floor(r>0?a-r:a)),p=Math.min(n-1,Math.floor(r>0?a:a-r));if(p<l)continue;const m=s*n;for(let t=m+l;t<=m+p;t++)o[t]=h?h[t]:255}}}}return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,pixels:[...t.pixels]})}(t,e,n):(await Promise.all([s.e(3661),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(6671)]).then(s.bind(s,30912))).execute(n,e)?t:function(t,e,s){if(!t)return t;const{width:n,height:r}=t,o=function(t){const{geometry:e,size:s,srcExtent:n,srcMask:r}=t,[o,i]=s;let a;const u=n.width/o,l=n.height/i,{xmin:c,ymax:p}=n;if("extent"===e.type){const t=(e.xmin-c)/u,s=(e.xmax-c)/u,n=(p-e.ymax)/l,r=(p-e.ymin)/l;a=[[[t,n],[t,r],[s,r],[s,n],[t,n]]]}else a=e.rings.map(t=>t.map(([t,e])=>[(t-c)/u,(p-e)/l]));return function(t,e,s){const[n,r]=e,o=new OffscreenCanvas(n,r).getContext("2d");o.fillStyle="#f00",o.beginPath(),t.forEach(t=>{o.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)o.lineTo(t[e][0],t[e][1]);o.closePath()}),o.fill();const i=o.getImageData(0,0,n,r).data,a=n*r,u=new Uint8Array(a);let l=!1;for(let t=0;t<a;t++)s&&!s[t]||(i[4*t+3]>127?u[t]=255:l=!0);return l||s?u:void 0}(a,s,r)}({geometry:s,size:[n,r],srcExtent:e,srcMask:t.mask});return new i.A({pixelType:t.pixelType,width:n,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}(t,e,n):new i.A({pixelType:t.pixelType,width:r,height:o,mask:a,maskIsAlpha:!1,pixels:[...t.pixels]})}function u(t,e){const{extent:s}=l(t,e,new o.A({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:n}=t.extent;if(s.xmax=Math.min(s.xmax,n.xmax),s.ymax=Math.min(s.ymax,n.ymax),s.xmin<s.xmax&&s.ymin<s.ymax){const{x:e,y:n}=t.pixelSize,r=Math.round(s.width/e),o=Math.round(s.height/n);t.extent=s,t.width=r,t.height=o}}function l(t,e,s,o=!0){const{spatialReference:i}=t,{x:a,y:u}=function(t,e){if(t.spatialReference.equals(e))return t;const s=(0,n.GA)(t.spatialReference),r=(0,n.GA)(e);if(s===r)return t;const o=s/r;return{x:t.x*o,y:t.y*o}}(s,i);let l,c,p;const h="extent"===e.type?e:e.extent;let{xmin:m,xmax:d,ymax:g,ymin:f}=h;const{xmin:y,ymax:x}=t.extent;return o?(m=y+(m>y?a*Math.round((m-y)/a):0),g=x-(g<x?u*Math.round((x-g)/u):0),d=y+(d>y?a*Math.round((d-y)/a):0),f=x-(f<x?u*Math.round((x-f)/u):0),l=new r.A({xmin:m,ymax:g,xmax:d,ymin:f,spatialReference:i}),c=Math.round(l.width/a),p=Math.round(l.height/u)):(c=Math.floor((d-m)/a+.8),p=Math.floor((g-f)/u+.8),m=y+(m>y?a*Math.floor((m-y)/a+.1):0),g=x-(g<x?u*Math.floor((x-g)/u+.1):0),d=m+c*a,f=g-p*u,l=new r.A({xmin:m,ymax:g,xmax:d,ymin:f,spatialReference:i})),{extent:l,width:c,height:p}}},99235(t,e,s){s.d(e,{vt:()=>Un,UD:()=>Vn});var n=s(85334),r=s(49186),o=s(4718),i=s(5482),a=s(91429),u=s(94778),l=s(25482);let c=class extends l.o{constructor(){super(...arguments),this.raster=void 0}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],c.prototype,"raster",void 0),c=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BaseFunctionArguments")],c);const p=c;var h;let m=h=class extends p{constructor(){super(...arguments),this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new h({raster:this.raster,raster2:this.raster2,operation:this.operation})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"operation",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],m.prototype,"raster2",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],m.prototype,"rasters",null),m=h=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunctionArguments")],m);const d=m;var g=s(14140),f=s(87186);const y=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let x=class extends l.o{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this.isRoot=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:s}=t;let n=s.rasters||s.raster&&[s.raster];for(;n?.length;){e.unshift(...n);const t=[];for(let e=0;e<n.length;e++){const{parameters:s}=n[e],r=s.rasters||s.raster&&[s.raster];r?.length&&t.push(...r)}n=t}for(let t=e.length-1;t>=0;t--)e[t].isNoopProcess&&e.splice(t,1);let r=!1;for(let t=0;t<e.length;t++){const s=e[t];s.id=e.length-t-1;const{rasters:n}=s.parameters;r=r||null!=n&&n.length>1}const o=e.some(({name:t})=>y.has(t.toLowerCase())),{rawSourceRasterInfos:i}=this;return{functions:e,hasBranches:r,hasFocalFunction:o,isSourceSingleBand:1===i?.[0]?.bandCount}}bind(t,e=!1,s=-1){this.id=s+1;const n=this._getRasterValues();let r=!0;for(let s=0;s<n.length;s++){const o=n[s];if(null!=o&&this._isRasterFunctionValue(o)){const n=o.bind(t,e,this.id+s);if(!n.success)return this._bindingResult=n,n;r=r&&n.supportsGPU}}return!this.rasterInfo||e?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),r&&=this._bindingResult.supportsGPU,this._bindingResult.success&&(this._patchRasterInfo(),r&&this.isRoot)&&(this.processInputBandIds(),this.swizzleInputBandIds(this.rawInputBandIds)||(r=this.rawInputBandIds.length<=3)),this._bindingResult.supportsGPU=r,this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this._bindingResult)}queryRasterFunction(t){const e=[this];for(;e.length;){const s=e.pop();if(t(s))return s;const n=s.getImmediateChildFunctions();e.push(...n)}}getImmediateChildFunctions(){return this._getRasterValues().filter(t=>t&&"object"==typeof t&&"bind"in t)}process(t,e){const s=this._getRasterValues(),n=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map(s=>this._readRasterValue(s,t,e));return this._processPixels({...t,pixelBlocks:n},e)}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);if(t.length>1){const e=t.map(t=>t.processInputBandIds());return this.rawInputBandIds=[...new Set(e.flat())],this.rawInputBandIds}const e=t[0];if(e)return this.rawInputBandIds=e.processInputBandIds(),this.rawInputBandIds;const{bandCount:s}=this.sourceRasterInfos[0],n=Array.from({length:s},(t,e)=>e);return this.rawInputBandIds=this._getInputBandIds(n),this.rawInputBandIds}swizzleInputBandIds(t){const e=this._getRasterValues().filter(this._isRasterFunctionValue);let s=!0;for(const n of e)s=n.swizzleInputBandIds(t)&&s;return!!s&&this._swizzleBandIds(t)}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:s}=this.functionArguments;return s&&Array.isArray(s)&&s.length?(t.rasters=s.map(t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(t=>null!=t)||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:e,rasters:s}=this.functionArguments;if(s&&Array.isArray(s)&&s.length)s.forEach(e=>{if(this._isRasterFunctionValue(e)){const s=e.getClippingGeometries();t.push(...s)}});else if(this._isRasterFunctionValue(e)){const s=e.getClippingGeometries();t.push(...s)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_swizzleBandIds(t){return!0}_isInputRasterPrimaryOrConstant(){return!this._getRasterValues().some(t=>t&&"object"==typeof t&&"rasterFunction"in t&&t.rasterFunction)}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach(t=>{t.statistics=void 0,t.histograms=void 0})}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap(t=>this.functionArguments[t])}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:s,rasterIds:n}=t;if(0===e.length)return s;const r=e.map(t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&n.includes(t)?s[n.indexOf(t)]:"number"!=typeof t?s[0]:void 0),o=r.find(t=>t)??s[0];return r.forEach((t,e)=>{void 0===t&&(r[e]=o)}),r}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,e=[],s=[]){for(let n=0;n<t.sourceRasters.length;n++){const r=t.sourceRasters[n];if("number"!=typeof r)if("bind"in r)this._getPrimaryRasters(r,e,s);else{const t=r,n=this._getPrimaryRasterId(t);if(null==n)continue;s.includes(n)||(this.mainPrimaryRasterId===n?(e.unshift(t),s.unshift(n)):(e.push(t),s.push(n)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,e,s){const{primaryPixelBlocks:n}=e;if(null==t||"$$"===t){const t=n[0];return null==t?null:t.clone()}if("string"==typeof t){const s=e.primaryRasterIds.indexOf(t);return-1===s?null:n[s]}if("number"==typeof t){const e=n[0];if(null==e)return null;const{width:s,height:r,pixelType:o}=e,i=new Float32Array(s*r);i.fill(t);const a=this.sourceRasterInfos[0].bandCount,u=new Array(a).fill(i);return new g.A({width:s,height:r,pixelType:o,pixels:u})}return t.process(e,s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:e,keyProperties:s,statistics:n,histograms:r}=t,o=s.BandProperties;o&&o.length!==e&&(t.keyProperties={...s,BandProperties:void 0}),n&&n.length!==e&&(t.statistics=n.length>e?n.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),s.BAND_COUNT&&Number(s.BAND_COUNT)!==e&&(t.keyProperties={...s,BAND_COUNT:"string"==typeof s.BAND_COUNT?String(e):e})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}}),(0,a.wg)(t=>t?.toLowerCase())],x.prototype,"outputPixelType",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"mainPrimaryRasterId",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"sourceRasters",void 0),(0,i.Cg)([(0,a.MZ)({type:[f.A],json:{write:!0}})],x.prototype,"sourceRasterInfos",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rasterInfo",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"readingBufferSize",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"id",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isNoopProcess",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"supportsGPU",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"rawInputBandIds",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"rawSourceRasterInfos",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"isInputBandIdsSwizzled",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],x.prototype,"swizzledBandSelection",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isBranch",void 0),(0,i.Cg)([(0,a.MZ)()],x.prototype,"isRoot",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],x.prototype,"flatWebGLFunctionChain",null),(0,i.Cg)([(0,a.MZ)()],x.prototype,"_bindingResult",void 0),x=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BaseRasterFunction")],x);const w=x,A={userDefined:-1,lineDetectionHorizontal:0,lineDetectionVertical:1,lineDetectionLeftDiagonal:2,lineDetectionRightDiagonal:3,gradientNorth:4,gradientWest:5,gradientEast:6,gradientSouth:7,gradientNorthEast:8,gradientNorthWest:9,smoothArithmeticMean:10,smoothing3x3:11,smoothing5x5:12,sharpening3x3:13,sharpening5x5:14,laplacian3x3:15,laplacian5x5:16,sobelHorizontal:17,sobelVertical:18,sharpen:19,sharpen2:20,pointSpread:21,none:255},v={bitwiseAnd:11,bitwiseLeftShift:12,bitwiseNot:13,bitwiseOr:14,bitwiseRightShift:15,bitwiseXOr:16,booleanAnd:17,booleanNot:18,booleanOr:19,booleanXOr:20,equalTo:24,greaterThan:28,greaterThanEqual:29,lessThan:33,lessThanEqual:34,isNull:31,notEqual:46},C={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},b={setNull:50,conditional:78},M={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65,...v,...C,majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75,...b},T=new Map([[C.acos,{domain:[0,Math.PI],isInteger:!1}],[C.asin,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[C.atan,{domain:[-Math.PI/2,Math.PI/2],isInteger:!1}],[C.cos,{domain:[-1,1],isInteger:!1}],[C.sin,{domain:[-1,1],isInteger:!1}],[v.booleanAnd,{domain:[0,1],isInteger:!0}],[v.booleanNot,{domain:[0,1],isInteger:!0}],[v.booleanOr,{domain:[0,1],isInteger:!0}],[v.booleanXOr,{domain:[0,1],isInteger:!0}],[v.equalTo,{domain:[0,1],isInteger:!0}],[v.notEqual,{domain:[0,1],isInteger:!0}],[v.greaterThan,{domain:[0,1],isInteger:!0}],[v.greaterThanEqual,{domain:[0,1],isInteger:!0}],[v.lessThan,{domain:[0,1],isInteger:!0}],[v.lessThanEqual,{domain:[0,1],isInteger:!0}],[v.isNull,{domain:[0,1],isInteger:!0}]]);function P(t){return T.get(t)}const N=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function I(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]+r[t]);return i}function R(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand("f32",r);return o.set(n),o}function F(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=n[t]*n[t]);return o}function k(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]-r[t]);return i}function _(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]*r[t]);return i}function S(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=Math.sign(n[t])*Math.floor(Math.abs(n[t])));return o}function B(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]/r[t]);return i}function j(t,e,s){return B(t,e,"f32")}function Z(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=Math.floor(n[t]/r[t]));return i}function z(t,e,s,n){const r=t[0],o=r.length,i=g.A.createEmptyBand(s,o);if(n===C.atanh){for(let t=0;t<o;t++)if(e[t]){const s=r[t];Math.abs(s)>=1?e[t]=0:i[t]=Math.atanh(s)}return i}const a=n===C.asin?Math.asin:Math.acos;for(let t=0;t<o;t++)if(e[t]){const s=r[t];Math.abs(s)>1?e[t]=0:i[t]=a(s)}return i}function G(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n(r[t]));return i}function O(t,e,s,n){const[r,o]=t,i=r.length,a=g.A.createEmptyBand(s,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=n(r[t],o[t]));return a}function D(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]&r[t]);return i}function E(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<<r[t]);return i}function V(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=~n[t]);return o}function U(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]|r[t]);return i}function L(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>>r[t]);return i}function $(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]^r[t]);return i}function K(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]&&r[t]?1:0);return i}function W(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=n[t]?0:1);return o}function H(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]||r[t]?1:0);return i}function q(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=(n[t]?1:0)^(r[t]?1:0));return i}function J(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]===r[t]?1:0);return i}function X(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o),a=n===Math.E;for(let t=0;t<o;t++)e&&!e[t]||(i[t]=a?Math.exp(r[t]):n**r[t]);return i}function Q(t,e,s){return X(t,e,s,10)}function Y(t,e,s){return X(t,e,s,2)}function tt(t,e,s){return X(t,e,s,Math.E)}function et(t,e,s,n){const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(r[t]<=0?e[t]=0:i[t]=n(r[t]));return i}function st(t,e,s){return et(t,e,s,Math.log10)}function nt(t,e,s){return et(t,e,s,Math.log2)}function rt(t,e,s){return et(t,e,s,Math.log)}function ot(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>r[t]?1:0);return i}function it(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]>=r[t]?1:0);return i}function at(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<r[t]?1:0);return i}function ut(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<=r[t]?1:0);return i}function lt(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);if(!e)return o;for(let t=0;t<r;t++)o[t]=e[t]?0:1;return o}function ct(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]%r[t]);return i}function pt(t,e,s){const[n]=t,r=n.length,o=g.A.createEmptyBand(s,r);for(let t=0;t<r;t++)e&&!e[t]||(o[t]=-n[t]);return o}function ht(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]===r[t]?0:1);return i}function mt(t,e,s){const[n,r]=t,o=n.length,i=g.A.createEmptyBand(s,o),a=new Uint8Array(o);for(let t=0;t<o;t++)null!=e&&!e[t]||0!==n[t]||(i[t]=r[t],a[t]=255);return{band:i,mask:a}}function dt(t,e,s){const[n,r,o]=t,i=n.length,a=g.A.createEmptyBand(s,i);for(let t=0;t<i;t++)e&&!e[t]||(a[t]=n[t]?r[t]:o[t]);return a}function gt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s];for(let r=1;r<n;r++){const n=t[r][s];e<n&&(e=n)}i[s]=e}return i}function ft(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s];for(let r=1;r<n;r++){const n=t[r][s];e>n&&(e=n)}i[s]=e}return i}function yt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=r[s],o=e;for(let r=1;r<n;r++){const n=t[r][s];o<n?o=n:e>n&&(e=n)}i[s]=o-e}return i}function xt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){let e=0;for(let r=0;r<n;r++)e+=t[r][s];i[s]=e/n}return i}function wt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s])for(let e=0;e<n;e++){const n=t[e];i[s]+=n[s]}return i}function At(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o);for(let s=0;s<o;s++)if(!e||e[s]){const e=new Float32Array(n);let r=0;for(let o=0;o<n;o++){const n=t[o];r+=n[s],e[o]=n[s]}r/=n;let o=0;for(let t=0;t<n;t++)o+=(e[t]-r)**2;i[s]=Math.sqrt(o/n)}return i}function vt(t,e,s){const n=t.length;if(n<2)return t[0];const r=Math.floor(n/2),[o]=t,i=o.length,a=g.A.createEmptyBand(s,i),u=new Float32Array(n),l=n%2==1;for(let s=0;s<i;s++)if(!e||e[s]){for(let e=0;e<n;e++)u[e]=t[e][s];u.sort(),a[s]=l?u[r]:(u[r]+u[r-1])/2}return a}function Ct(t,e,s){const[n,r]=t;if(null==r)return n;const o=n.length,i=g.A.createEmptyBand(s,o);for(let t=0;t<o;t++)e&&!e[t]||(i[t]=n[t]<r[t]?n[t]:r[t]);return i}function bt(t,e,s){const n=t.length;if(n<=2)return Ct(t,e,s);const r=t[0].length,o=g.A.createEmptyBand(s,r),i=new Map;for(let s=0;s<r;s++)if(!e||e[s]){i.clear();for(let e=0;e<n;e++){const n=t[e][s];i.set(n,i.has(n)?i.get(n)+1:1)}let e=0,r=0;const a=[];for(const t of i.keys())e=i.get(t),e>r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort((t,e)=>t-e),o[s]=a[0]}return o}function Mt(t,e,s){const n=t.length;if(n<=2)return Ct(t,e,s);const r=t[0].length,o=g.A.createEmptyBand(s,r),i=new Map;for(let s=0;s<r;s++)if(!e||e[s]){i.clear();for(let e=0;e<n;e++){const n=t[e][s];i.set(n,i.has(n)?i.get(n)+1:1)}let e=0,r=t.length;const a=[];for(const t of i.keys())e=i.get(t),e<r?(r=e,a.length=0,a.push(t)):e===r&&a.push(t);a.length>1&&a.sort((t,e)=>t-e),o[s]=a[0]}return o}function Tt(t,e,s){const n=t.length;if(n<2)return t[0];const[r]=t,o=r.length,i=g.A.createEmptyBand(s,o),a=new Set;for(let s=0;s<o;s++)if(!e||e[s]){let e;a.clear();for(let r=0;r<n;r++)e=t[r][s],a.add(e);i[s]=a.size}return i}const Pt=new Map,Nt=new Map,It=new Map,Rt=new Map;function Ft(){Pt.size||(Pt.set(4,Math.sqrt),Pt.set(6,Math.acos),Pt.set(7,Math.asin),Pt.set(8,Math.atan),Pt.set(9,Math.atanh),Pt.set(10,Math.abs),Pt.set(21,Math.cos),Pt.set(22,Math.cosh),Pt.set(48,Math.floor),Pt.set(49,Math.ceil),Pt.set(51,Math.sin),Pt.set(52,Math.sinh),Pt.set(56,Math.tan),Pt.set(57,Math.tanh),Pt.set(59,Math.acosh),Pt.set(60,Math.asinh),Pt.set(65,Math.floor),Nt.set(5,Math.pow),Nt.set(61,Math.atan2),It.set(1,I),It.set(2,k),It.set(3,_),It.set(11,D),It.set(12,E),It.set(13,V),It.set(14,U),It.set(15,L),It.set(16,$),It.set(17,K),It.set(18,W),It.set(19,H),It.set(20,q),It.set(23,B),It.set(24,J),It.set(25,tt),It.set(26,Q),It.set(27,Y),It.set(28,ot),It.set(29,it),It.set(30,S),It.set(31,lt),It.set(32,R),It.set(33,at),It.set(34,ut),It.set(35,rt),It.set(36,st),It.set(37,nt),It.set(44,ct),It.set(45,pt),It.set(46,ht),It.set(53,F),It.set(64,j),It.set(65,Z),It.set(76,dt),It.set(78,dt),Rt.set(38,bt),Rt.set(39,gt),Rt.set(40,xt),Rt.set(41,vt),Rt.set(42,ft),Rt.set(43,Mt),Rt.set(47,yt),Rt.set(54,At),Rt.set(55,wt),Rt.set(58,Tt),Rt.set(66,bt),Rt.set(67,gt),Rt.set(68,xt),Rt.set(69,vt),Rt.set(70,ft),Rt.set(71,Mt),Rt.set(72,yt),Rt.set(73,At),Rt.set(74,wt),Rt.set(75,Tt))}function kt(t,e,s={}){Ft();let n=function(t,e=!1){const s=t.map(t=>t.mask),n=s.filter(t=>null!=t),r=t[0].pixels[0].length;if(0===n.length||e&&n.length!==s.length)return new Uint8Array(r).fill(255);const o=n[0],i=new Uint8Array(o);if(1===n.length)return i;if(!e){for(let t=1;t<n.length;t++){const e=n[t];for(let t=0;t<i.length;t++)i[t]&&(i[t]=e[t]?255:0)}return i}for(let t=1;t<n.length;t++){const e=n[t];for(let t=0;t<i.length;t++)0===i[t]&&(i[t]=e[t]?255:0)}return i}(t,e>=66&&e<=75);const{outputPixelType:r="f32"}=s,o=!Rt.has(e)||s.processAsMultiband,i=o?t[0].pixels.length:1,a=[];for(let s=0;s<i;s++){const i=Rt.has(e)&&!o?t.flatMap(t=>t.pixels):t.map(t=>t.pixels[s]);let l,c=!0;if(e===b.setNull){const t=mt(i,n,r);l=t.band,n=t.mask,c=!1}else It.has(e)?l=It.get(e)(i,n,"f64"):Pt.has(e)?l=e===C.asin||e===C.acos||e===C.atanh?z(i,n,"f64",e):G(i,n,"f64",Pt.get(e)):Nt.has(e)?l=O(i,n,"f64",Nt.get(e)):Rt.has(e)?l=Rt.get(e)(i,n,"f64"):(l=i[0],c=!1);if(c&&e!==v.isNull&&!T.has(e)){const t=g.A.createEmptyBand(r,l.length);n||(n=new Uint8Array(l.length).fill(255)),(0,u.$p)(l,n),(0,u.yM)(l,n,r,t),l=t}a.push(l)}const l=t[0];return new g.A({width:l.width,height:l.height,pixelType:r,mask:e===v.isNull?null:n,pixels:a})}let _t=class extends w{constructor(){super(...arguments),this.functionName="Arithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{operation:t}=this.functionArguments;if(t<1||t>6)return{success:!1,supportsGPU:!1,error:"unsupported operation"};const e=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:e.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e?.[0]||null==e?.[1]?null:function(t,e,s){return kt(t,e=[null,1,2,3,23,5,44][e]??1,{outputPixelType:s})}(e,this.functionArguments.operation,this.outputPixelType)}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=["","plus","minus","times","divide","power","mod"][t],s=this.outputPixelType??"f32";let[n,r]=(0,u.hP)(s);const o=(0,u.zw)(s);return o&&(n-=1e-4,r+=1e-4),{imageCount:2,operationName:e,domainRange:[n,r],isOutputRounded:o}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],_t.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:d,json:{write:!0,name:"rasterFunctionArguments"}})],_t.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],_t.prototype,"rasterArgumentNames",void 0),_t=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ArithmeticFunction")],_t);const St=_t;var Bt;let jt=Bt=class extends p{clone(){return new Bt({raster:this.raster})}};jt=Bt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunctionArguments")],jt);const Zt=jt;var zt=s(51181);let Gt=class extends w{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{extent:s,primaryPixelSizes:n}=t,r=n?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1});return(0,zt.di)(e,{resolution:o})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Gt.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Zt,json:{write:!0,name:"rasterFunctionArguments"}})],Gt.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Gt.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gt.prototype,"isGCS",void 0),Gt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.AspectFunction")],Gt);const Ot=Gt;var Dt=s(66552);const Et=new Set(["+","-","*","/","(",")"]);function Vt(t,e){return t.toLowerCase().startsWith("b")?e[parseInt(t.slice(1),10)-1]:parseFloat(t)}function Ut(t,e,s,n){if("number"==typeof s&&"number"==typeof n)return s+n;let r,o,i;"number"==typeof s?(i=n,r=i.length,o=new Float32Array(r),o.fill(s)):(r=s.length,o=s,n.constructor===Number?(i=new Float32Array(r),i.fill(n)):i=n);const a=new Float32Array(r);switch(e){case"+":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]+i[e]);break;case"-":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]-i[e]);break;case"*":for(let e=0;e<r;e++)(null==t||t[e])&&(a[e]=o[e]*i[e]);break;case"/":for(let e=0;e<r;e++)(null==t||t[e])&&i[e]&&(a[e]=o[e]/i[e]);break;case"(":case")":throw new Error("encountered error with custom band index equation")}return a}function Lt(t,e){t.splice(e,1);let s=0,n=0;do{s=0,n=0;for(let e=0;e<t.length;e++)if("("===t[e])s=e;else if(")"===t[e]){n=e;break}n===s+1&&t.splice(s,2)}while(n===s+1);return t}function $t(t){if(1===t.length)return{opIndex:0,numIndex:0};let e=0,s=0;for(let n=0;n<t.length;n++)if("("===t[n])e=n;else if(")"===t[n]){s=n;break}const n=0===s?t:t.slice(e+1,s);let r=-1;for(let t=0;t<n.length;t++)if("*"===n[t]||"/"===n[t]){r=t;break}if(r>-1)s>0&&(r+=e+1);else{for(let t=0;t<n.length;t++)if("+"===n[t]||"-"===n[t]){r=t;break}s>0&&(r+=e+1)}let o=0;for(let e=0;e<r;e++)"("===t[e]&&o++;return{opIndex:r,numIndex:r-o}}var Kt=s(47520);const Wt=new Dt.J({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function Ht(t,e){if(!(0,Kt.AB)(t))return t;const{equation:s,method:n}=e,r=e.bandIndexes.map(t=>t-1),{pixels:o,mask:i}=t;let a;switch(n){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":a=Jt(i,o[r[0]],o[r[1]]);break;case"ndwi":a=Jt(i,o[r[1]],o[r[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o];n&&(r[o]=t/n)}return[r]}(i,o[r[0]],o[r[1]]);break;case"ci-g":case"ci-re":a=function(t,e,s){const n=e.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o];n&&(r[o]=t/n-1)}return[r]}(i,o[r[0]],o[r[1]]);break;case"savi":a=function(t,e,s,n){const r=s.length,o=new Float32Array(r);for(let i=0;i<r;i++)if(null==t||t[i]){const t=s[i],r=e[i],a=r+t+n;a&&(o[i]=(r-t)/a*(1+n))}return[o]}(i,o[r[0]],o[r[1]],r[2]+1);break;case"tsavi":a=function(t,e,s,n,r,o){const i=s.length,a=new Float32Array(i),u=-r*n+o*(1+n*n);for(let o=0;o<i;o++)if(null==t||t[o]){const t=s[o],i=e[o],l=r*i+t+u;l&&(a[o]=n*(i-n*t-r)/l)}return[a]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1,r[4]+1);break;case"msavi":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=s[o],n=e[o],i=2*n+1;r[o]=.5*(i-Math.sqrt(i*i-8*(n-t)))}return[r]}(i,o[r[0]],o[r[1]]);break;case"gemi":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=s[o],n=e[o];if(1!==t&&n+t+.5!==0){const e=(2*(n*n-t*t)+1.5*n+.5*t)/(n+t+.5);r[o]=e*(1-.25*e)-(t-.125)/(1-t)}}return[r]}(i,o[r[0]],o[r[1]]);break;case"pvi":a=function(t,e,s,n,r){const o=s.length,i=new Float32Array(o),a=1/Math.sqrt(1+n*n);for(let u=0;u<o;u++)if(null==t||t[u]){const t=s[u],o=e[u];i[u]=(o-n*t-r)*a}return[i]}(i,o[r[0]],o[r[1]],r[2]+1,r[3]+1);break;case"gvitm":a=function(t,e){const[s,n,r,o,i,a]=e,u=s.length,l=new Float32Array(u);for(let e=0;e<u;e++)(null==t||t[e])&&(l[e]=-.2848*s[e]-.2435*n[e]-.5436*r[e]+.7243*o[e]+.084*i[e]-.18*a[e]);return[l]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]],o[r[5]]]);break;case"sultan":a=function(t,e){const[s,n,r,o,i]=e,a=s.length,u=new Float32Array(a),l=new Float32Array(a),c=new Float32Array(a);for(let e=0;e<a;e++)(null==t||t[e])&&(u[e]=i[e]?o[e]/i[e]*100:0,l[e]=s[e]?o[e]/s[e]*100:0,c[e]=r[e]?n[e]/r[e]*(o[e]/r[e])*100:0);return[u,l,c]}(i,[o[r[0]],o[r[1]],o[r[2]],o[r[3]],o[r[4]]]);break;case"vari":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=o+t-r[e];a&&(i[e]=(o-t)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"mtvi2":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=r[e],u=Math.sqrt((2*t+1)**2-(6*t-5*Math.sqrt(o))-.5);if(u){const s=1.5*(1.2*(t-a)-2.5*(o-a));i[e]=s/u}}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"rtvi-core":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=r[e];i[e]=100*(t-o)-10*(t-a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"evi":a=function(t,e){const[s,n,r]=e,o=s.length,i=new Float32Array(o);for(let e=0;e<o;e++)if(null==t||t[e])for(e=0;e<o;e++){const t=s[e],o=n[e],a=t+6*o-7.5*r[e]+1;a&&(i[e]=2.5*(t-o)/a)}return[i]}(i,[o[r[0]],o[r[1]],o[r[2]]]);break;case"wndwi":a=function(t,e,s=.5){const[n,r,o]=e,i=r.length,a=new Float32Array(i);for(let e=0;e<i;e++)if(null==t||t[e])for(e=0;e<i;e++){const t=n[e],i=r[e],u=o[e],l=t+s*i+(1-s)*u;l&&(a[e]=(t-s*i-(1-s)*u)/l)}return[a]}(i,[o[r[0]],o[r[1]],o[r[2]]],r[3]?r[3]+1:.5);break;case"bai":a=function(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o])for(o=0;o<n;o++){const t=(.1-e[o])**2+(.06-s[o])**2;t&&(r[o]=1/t)}return[r]}(i,o[r[0]],o[r[1]]);break;case"custom":a=function(t,e,s){let n,{ops:r,nums:o}=function(t,e){(t=t.replaceAll(" ","")).startsWith("-")&&(t="0"+t),t.startsWith("+")&&(t=t.slice(1));const s=t.split(""),n=[],r=[];let o="";for(let t=0;t<s.length;t++){const i=s[t];Et.has(i)?(o.length&&r.push(Vt(o,e)),n.push(i),o=""):o=o.concat(i)}return o.length&&r.push(Vt(o,e)),{ops:n,nums:r}}(s,e);if(0===r.length){const t=1===o.length?o[0]:e[0];if(t instanceof Float32Array)return[t];const s=new Float32Array(e[0].length);return"number"==typeof t?s.fill(t):s.set(t),[s]}for(;r.length>0;){const{numIndex:e,opIndex:s}=$t(r);if(n=Ut(t,r[s],o[e],o[e+1]),1===r.length)break;r=Lt(r,s),o.splice(e,2,n)}return[n]}(i,o,s);break;default:return t}const{outputPixelType:l="f32"}=e,c=null!=l&&(0,u.zw)(l);let p;i?(p=new Uint8Array(t.width*t.height),p.set(i)):c&&(p=new Uint8Array(t.width*t.height).fill(255)),c&&(a=a.map(t=>{const e=g.A.createEmptyBand(l,t.length);return(0,u.yM)(t,p,l,e),e}));const h=new g.A({width:t.width,height:t.height,pixelType:l,pixels:a,mask:p});return h.updateStatistics(),h}function qt(t){const e=new Float32Array(9);return e[3*t[0]]=1,e[3*t[1]+1]=1,e[3*t[2]+2]=1,e}function Jt(t,e,s){const n=s.length,r=new Float32Array(n);for(let o=0;o<n;o++)if(null==t||t[o]){const t=e[o],n=s[o],i=t+n;i&&(r[o]=(t-n)/i)}return[r]}var Xt,Qt=s(93223);let Yt=Xt=class extends p{constructor(){super(...arguments),this.method="custom"}clone(){return new Xt({method:this.method,bandIndexes:this.bandIndexes,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{type:String,write:!0}})],Yt.prototype,"bandIndexes",void 0),(0,i.Cg)([(0,Qt.e)(Wt)],Yt.prototype,"method",void 0),Yt=Xt=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunctionArguments")],Yt);const te=Yt,ee=new Set(["vari","mtvi2","rtvi-core","evi"]);let se=class extends w{constructor(){super(...arguments),this.functionName="BandArithmetic",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0];if(t.bandCount<2)return{success:!1,supportsGPU:!1,error:"band-arithmetic-function: source raster has insufficient amount of raster bands"};const e=t.clone();return e.pixelType=this.outputPixelType,e.bandCount="sultan"===this.functionArguments.method?3:1,this._removeStatsHistColormapVAT(e),e.keyProperties={...e.keyProperties,BandProperties:void 0},this.rasterInfo=e,{success:!0,supportsGPU:!["custom","gvitm","sultan"].includes(this.functionArguments.method)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{method:s,bandIndexes:n}=this.functionArguments,r=n.split(" ").map(t=>parseFloat(t));if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this,e=ee.has(this.functionArguments.method)?3:2,s=r.slice(0,e).map(e=>t.indexOf(e-1));r.splice(0,e,...s)}return Ht(e,{method:s,bandIndexes:r,equation:n,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1);2===t.length&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let s,n;const r=new Float32Array(3),{method:o}=this.functionArguments;switch(o){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=qt([e[0],e[1],0]),n="ndxi";break;case"ndwi":s=qt([e[1],e[0],0]),n="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=qt([e[0],e[1],0]),n="sr";break;case"ci-g":case"ci-re":s=qt([e[0],e[1],0]),n="ci";break;case"savi":s=qt([e[0],e[1],0]),n="savi",r[0]=t[2]+1;break;case"tsavi":s=qt([e[0],e[1],0]),n="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":s=qt([e[0],e[1],0]),n="msavi";break;case"gemi":s=qt([e[0],e[1],0]),n="gemi";break;case"pvi":s=qt([e[0],e[1],0]),n="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":s=qt([e[0],e[1],e[2]]),n="vari";break;case"mtvi2":s=qt([e[0],e[1],e[2]]),n="mtvi";break;case"rtvi-core":s=qt([e[0],e[1],e[2]]),n="rtvicore";break;case"evi":s=qt([e[0],e[1],e[2]]),n="evi";break;case"wndwi":s=qt([e[0],e[1],0]),n="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":s=qt([e[1],e[0],0]),n="bai";break;default:s=qt([0,1,2]),n="custom"}return{bandIndexMat3:s,indexType:n,adjustments:r,isOutputRounded:(0,u.zw)(this.outputPixelType)}}_getInputBandIds(t){if("custom"===this.functionArguments.method)return t;const e=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1),s=t.length,n=e.map(t=>t>=s?s-1:t),r=ee.has(this.functionArguments.method)?3:2,o=n.slice(0,r).map(e=>t[e]);return 2===o.length&&o.push(0),o}_swizzleBandIds(t){const e=this.functionArguments.bandIndexes.split(" ").map(t=>parseFloat(t)-1);2===e.length&&e.push(0);const{method:s}=this.functionArguments,n=(["vari","mtvi2","rtvi-core","evi"].includes(s)?e.slice(0,3):"bai"===s||"ndwi"===s?[e[1],e[0]]:e.slice(0,2)).map(e=>t.indexOf(e));return n[2]??=n[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=n,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],se.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:te,json:{write:!0,name:"rasterFunctionArguments"}})],se.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],se.prototype,"rasterArgumentNames",void 0),se=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.BandArithmeticFunction")],se);const ne=se;var re,oe=s(65864),ie=s(50498);const ae=new Dt.J({1:"outside",2:"inside"},{useNumericKeys:!0});let ue=re=class extends p{constructor(){super(...arguments),this.clippingType="outside"}clone(){return new re({clippingGeometry:this.clippingGeometry.clone(),clippingType:this.clippingType})}};(0,i.Cg)([(0,a.MZ)({types:ie.yR,json:{read:oe.rS,write:!0}})],ue.prototype,"clippingGeometry",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:ae.read,write:ae.write}})],ue.prototype,"clippingType",void 0),ue=re=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunctionArguments")],ue);const le=ue;var ce=s(34930),pe=s(37373);let he=class extends w{constructor(){super(...arguments),this.functionName="Clip",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{functionArguments:e}=this,{clippingGeometry:s,clippingType:n}=e;if(!s)return{success:!1,supportsGPU:!1,error:"missing clipping geometry"};if("outside"===n)try{const{spatialReference:e}=t,n="extent"===s.type?(0,pe._l)(s,e):(0,pe.uk)(s,e).extent;n&&(0,ce.Sd)(t,n)}catch{}return{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}_getWebGLParameters(){const{clippingGeometry:t,clippingType:e}=this.functionArguments;return{clippingGeometry:t.toJSON(),clippingType:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],he.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:le,json:{write:!0,name:"rasterFunctionArguments"}})],he.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],he.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],he.prototype,"isNoopProcess",void 0),he=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ClipFunction")],he);const me=he;var de,ge=s(67369),fe=s(95349),ye=s(36005);let xe=de=class extends p{castColormapName(t){if(!t)return null;const e=t.toLowerCase();return ge.L7.includes(e)?e:null}readColorRamp(t){return(0,fe.r)(t)}readColorRampName(t,e){if(!t)return null;const s=ge.kH.jsonValues.find(e=>e.toLowerCase()===t.toLowerCase());return s?ge.kH.fromJSON(s):null}clone(){return new de({colormap:(0,o.o8)(this.colormap),colormapName:this.colormapName,colorRamp:this.colorRamp?.clone(),colorRampName:this.colorRampName})}};(0,i.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],xe.prototype,"colormap",void 0),(0,i.Cg)([(0,a.MZ)({type:String,json:{write:!0}})],xe.prototype,"colormapName",void 0),(0,i.Cg)([(0,a.wg)("colormapName")],xe.prototype,"castColormapName",null),(0,i.Cg)([(0,a.MZ)({types:fe.g,json:{write:!0}})],xe.prototype,"colorRamp",void 0),(0,i.Cg)([(0,ye.w)("colorRamp")],xe.prototype,"readColorRamp",null),(0,i.Cg)([(0,a.MZ)({type:ge.kH.apiValues,json:{type:ge.kH.jsonValues,write:ge.kH.write}})],xe.prototype,"colorRampName",void 0),(0,i.Cg)([(0,ye.w)("colorRampName")],xe.prototype,"readColorRampName",null),xe=de=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunctionArguments")],xe);const we=xe,Ae=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[112,75,3],[113,76,3],[114,77,3],[115,77,3],[116,78,3],[117,79,3],[118,79,3],[119,80,3],[121,81,4],[122,82,4],[123,82,4],[124,83,4],[125,84,4],[126,84,4],[127,85,4],[128,86,4],[129,86,4],[130,87,4],[131,88,4],[132,89,4],[133,89,4],[134,90,4],[135,91,4],[136,91,4],[137,92,4],[138,93,4],[139,94,4],[140,94,4],[142,95,5],[143,96,5],[144,96,5],[145,97,5],[146,98,5],[147,99,5],[148,99,5],[149,100,5],[150,101,5],[151,101,5],[152,102,5],[153,103,5],[154,104,5],[155,104,5],[156,105,5],[157,106,5],[158,106,5],[159,107,5],[160,108,5],[161,108,5],[162,109,5],[164,110,6],[165,111,6],[166,111,6],[167,112,6],[168,113,6],[169,113,6],[170,114,6],[171,115,6],[172,116,6],[173,116,6],[174,117,6],[245,0,0],[245,5,0],[245,10,0],[246,15,0],[246,20,0],[246,25,0],[246,30,0],[247,35,0],[247,40,0],[247,45,0],[247,50,0],[247,55,0],[248,60,0],[248,65,0],[248,70,0],[248,75,0],[249,81,0],[249,86,0],[249,91,0],[249,96,0],[250,101,0],[250,106,0],[250,111,0],[250,116,0],[250,121,0],[251,126,0],[251,131,0],[251,136,0],[251,141,0],[252,146,0],[252,151,0],[252,156,0],[252,156,0],[251,159,0],[250,162,0],[249,165,0],[248,168,0],[247,171,0],[246,174,0],[245,177,0],[245,179,0],[244,182,0],[243,185,0],[242,188,0],[241,191,0],[240,194,0],[239,197,0],[238,200,0],[237,203,0],[236,206,0],[235,209,0],[234,212,0],[233,215,0],[232,218,0],[231,221,0],[230,224,0],[230,226,0],[229,229,0],[228,232,0],[227,235,0],[226,238,0],[225,241,0],[224,244,0],[223,247,0],[165,247,0],[163,244,0],[161,240,0],[158,237,0],[156,233,1],[154,230,1],[152,227,1],[149,223,1],[147,220,1],[145,216,1],[143,213,1],[140,210,2],[138,206,2],[136,203,2],[134,200,2],[132,196,2],[129,193,2],[127,189,2],[125,186,3],[123,183,3],[120,179,3],[118,176,3],[116,172,3],[114,169,3],[111,166,3],[109,162,4],[107,159,4],[105,155,4],[103,152,4],[100,149,4],[98,145,4],[96,142,4],[94,138,5],[91,135,5],[89,132,5],[87,128,5],[85,125,5],[82,121,5],[80,118,5],[78,115,6],[76,111,6],[73,108,6],[71,105,6],[69,101,6],[67,98,6],[65,94,6],[62,91,7],[60,88,7],[58,84,7],[56,81,7],[53,77,7],[51,74,7],[49,71,7],[47,67,8],[44,64,8],[42,60,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8]],ve=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[245,20,0],[245,24,0],[245,29,0],[245,31,0],[247,33,0],[247,33,0],[247,37,0],[247,41,0],[247,41,0],[247,41,0],[247,45,0],[247,45,0],[247,47,0],[247,49,0],[247,49,0],[247,54,0],[247,54,0],[247,56,0],[247,58,0],[247,58,0],[250,62,0],[250,62,0],[250,62,0],[250,67,0],[250,67,0],[250,67,0],[250,69,0],[250,71,0],[250,71,0],[250,75,0],[250,75,0],[250,78,0],[250,79,0],[250,79,0],[250,79,0],[250,81,0],[250,83,0],[250,83,0],[250,87,0],[250,87,0],[250,90,0],[250,92,0],[252,93,0],[252,93,0],[252,97,0],[252,97,0],[252,97,0],[252,97,0],[252,101,0],[252,101,0],[252,101,0],[252,101,0],[252,105,0],[252,105,0],[252,107,0],[252,109,0],[252,109,0],[252,113,13],[255,118,20],[255,119,23],[255,121,25],[255,126,33],[255,132,38],[255,133,40],[255,135,43],[255,141,48],[255,144,54],[255,150,59],[255,152,61],[255,153,64],[255,159,69],[255,163,77],[255,165,79],[255,168,82],[255,174,87],[255,176,92],[255,181,97],[255,183,99],[255,186,102],[255,191,107],[255,197,115],[255,201,120],[255,203,123],[255,205,125],[255,209,130],[255,214,138],[255,216,141],[255,218,143],[255,224,150],[255,228,156],[255,234,163],[255,236,165],[255,238,168],[255,243,173],[255,248,181],[255,252,186],[253,252,186],[250,252,187],[244,250,180],[238,247,176],[234,246,173],[231,245,169],[223,240,163],[217,237,157],[211,235,150],[205,233,146],[200,230,142],[195,227,136],[189,224,132],[184,222,126],[180,220,123],[174,217,119],[169,214,114],[163,212,108],[160,210,105],[154,207,101],[148,204,96],[143,201,93],[138,199,88],[134,197,84],[130,194,81],[126,191,77],[117,189,70],[115,186,68],[112,184,64],[106,181,60],[100,179,55],[94,176,49],[92,174,47],[90,173,45],[81,168,37],[75,166,33],[71,163,28],[66,160,24],[62,158,21],[56,156,14],[51,153,0],[51,153,0],[51,153,0],[50,150,0],[50,150,0],[50,150,0],[50,150,0],[49,148,0],[49,148,0],[49,148,0],[48,145,0],[48,145,0],[48,145,0],[48,145,0],[48,143,0],[48,143,0],[48,143,0],[48,143,0],[47,140,0],[47,140,0],[47,140,0],[47,140,0],[46,138,0],[46,138,0],[46,138,0],[46,138,0],[45,135,0],[45,135,0],[45,135,0],[45,135,0],[44,133,0],[44,133,0],[44,133,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[42,128,0],[42,128,0],[42,128,0],[42,125,0],[42,125,0],[42,125,0],[42,125,0],[41,122,0],[41,122,0],[41,122,0],[41,122,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[39,117,0],[39,117,0],[39,117,0],[39,117,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0]];function Ce(t,e){const s=[],n=[];for(let e=0;e<t.length-1;e++)s.push({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:t[e].slice(1),toColor:t[e+1].slice(1)}),n.push(t[e+1][0]-t[e][0]);const r=t[t.length-1][0];return(0,ge.iv)({type:"multipart",colorRamps:s},{numColors:r,weights:e=e??n})}let be=class extends w{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:s,colorRamp:n,colorRampName:r}=this.functionArguments;if(!e?.length)if(n)this.colorRamp=n,e=(0,ge.R8)(n,{interpolateAlpha:!0});else if(r){const t=(0,ge.M5)(r);t&&(e=(0,ge.R8)(t),this.colorRamp=(0,fe.r)(t))}else s&&(e=function(t){let e;switch(t){case"elevation":e=Ce([[0,0,191,191],[51,0,0,255],[102,255,0,255],[153,255,0,127],[204,191,63,127],[256,20,20,20]]);break;case"gray":e=(0,ge.iv)({type:"algorithmic",algorithm:"esriHSVAlgorithm",fromColor:[0,0,0],toColor:[255,255,255]});break;case"hillshade":e=Ce([[0,38,41,54],[69,79,82,90],[131,156,156,156],[256,253,253,241]],[.268,.238,.495]);break;case"ndvi":e=Ae;break;case"ndvi2":e=function(){const t=Ce([[0,255,255,255],[70,0,255,0],[80,205,173,193],[100,150,150,150],[110,120,51,100],[130,120,100,200],[140,28,3,144],[160,6,0,55],[180,10,25,30],[201,6,7,27]]);for(let e=t.length;e<256;e++)t.push([6,27,7]);return t}();break;case"ndvi3":e=ve;break;case"random":e=function(){const t=[];for(let e=0;e<256;e++){const e=[];for(let t=0;t<3;t++)e.push(Math.round(255*Math.random()));t.push(e)}return t}()}return e?(e=e.map((t,e)=>[e,...t]),e):null}(s));if(!e?.length)return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};const o=this._getOutputPixelType(t.pixelType);this.outputPixelType=o.startsWith("f")?"s32":o;const i=t.clone();return i.pixelType=this.outputPixelType,i.colormap=e,i.bandCount=1,this.rasterInfo=i,{success:!0,supportsGPU:!0}}_processPixels(t){let e=t.pixelBlocks?.[0];return!e||(0,u.zw)(e.pixelType)||(e=e.clone(),e.clamp(this.outputPixelType)),e}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],be.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:we,json:{write:!0,name:"rasterFunctionArguments"}})],be.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"isNoopProcess",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],be.prototype,"indexedColormap",void 0),(0,i.Cg)([(0,a.MZ)()],be.prototype,"colorRamp",void 0),be=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapFunction")],be);const Me=be;var Te;let Pe=Te=class extends p{clone(){return new Te({raster:this.raster})}};Pe=Te=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunctionArguments")],Pe);const Ne=Pe;var Ie=s(4151),Re=s(88178);let Fe=class extends w{constructor(){super(...arguments),this.functionName="ColormapToRGB",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||!t.colormap?.length)return{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: source data must be single band with a colormap"};const e=t.clone();e.pixelType=this.outputPixelType=this._getOutputPixelType("u8"),this._removeStatsHistColormapVAT(e),e.bandCount=3,e.statistics=[{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20},{min:0,max:255,avg:100,stddev:20}],this.rasterInfo=e;const s=[...t.colormap].sort((t,e)=>t[0]-e[0]),{indexedColormap:n,offset:r}=(0,Kt.zg)({colormap:s});return n?(this.lookup={indexedColormap:n,offset:r},{success:!0,supportsGPU:(0,Re.WN)(n)}):{success:!1,supportsGPU:!1,error:"colormap-to-rgb-function: the colormap is not supported"}}_processPixels(t){let e=t.pixelBlocks?.[0];if(!e||!this.lookup)return e;e=e.clone();const s=e.pixels[0],n=e.mask??new Uint8Array(s.length).fill(255),r=new Uint8Array(s.length),o=new Uint8Array(s.length),i=new Uint8Array(s.length),{indexedColormap:a,offset:u}=this.lookup,l=a.length;for(let t=0;t<s.length;t++)if(n[t]){let e=4*(s[t]-u);e<0||e>l-4?n[t]=0:(r[t]=a[e++],o[t]=a[e++],i[t]=a[e++])}return e.pixels=[r,o,i],e.statistics=[new Ie.A(0,255),new Ie.A(0,255),new Ie.A(0,255)],e.pixelType=this.outputPixelType,e}_getWebGLParameters(){return this.lookup}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Fe.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ne,json:{write:!0,name:"rasterFunctionArguments"}})],Fe.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Fe.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Fe.prototype,"lookup",void 0),Fe=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ColormapToRGBFunction")],Fe);const ke=Fe;var _e,Se=s(43937);let Be=_e=class extends p{constructor(){super(...arguments),this.rasters=[]}writeRasters(t,e){e.rasters=t.map(t=>"number"==typeof t||"string"==typeof t?t:t.toJSON())}clone(){return new _e({rasters:(0,o.o8)(this.rasters)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Be.prototype,"rasters",void 0),(0,i.Cg)([(0,Se.K)("rasters")],Be.prototype,"writeRasters",null),Be=_e=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunctionArguments")],Be);const je=Be;let Ze=class extends w{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map(({bandCount:t})=>t).reduce((t,e)=>t+e),t.every(({statistics:t})=>null!=t&&t.length)){const e=[];t.forEach(({statistics:t})=>null!=t&&e.push(...t)),s.statistics=e}if(t.every(({histograms:t})=>null!=t&&t.length)){const e=[];t.forEach(({histograms:t})=>null!=t&&e.push(...t)),s.histograms=e}s.multidimensionalInfo&&s.multidimensionalInfo.variables.forEach(e=>{const s=t.map(t=>t.multidimensionalInfo?.variables.find(({name:t})=>t===e.name)),n=s.map(t=>t?.statistics?.length?t.statistics:null),r=s.map(t=>t?.histograms?.length?t.histograms:null);e.statistics=n.every(t=>null!=t)?n.flat():null,e.histograms=r.every(t=>null!=t)?r.flat():null}),s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const n=t.every(t=>t.keyProperties.BandProperties?.length)?t.flatMap(t=>t.keyProperties.BandProperties):void 0;return s.keyProperties={...s.keyProperties,BandProperties:n},this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;if(!e)return null;const s=e?.[0];return null==s?null:(0,Kt.Wy)(e)}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ze.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:je,json:{write:!0,name:"rasterFunctionArguments"}})],Ze.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Ze.prototype,"rasterArgumentNames",void 0),Ze=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CompositeBandFunction")],Ze);const ze=Ze,Ge=new Dt.J({0:"difference",1:"relative-difference",2:"categorical",3:"euclidean-distance",4:"angle-difference",5:"band-with-most-change"},{useNumericKeys:!0}),Oe=new Dt.J({0:"all",1:"changed",2:"unchanged"},{useNumericKeys:!0});var De;let Ee=De=class extends p{constructor(){super(...arguments),this.method="difference",this.keepMethod="all",this.raster2=void 0}get rasters(){return[this.raster,this.raster2]}clone(){return new De({raster:this.raster,raster2:this.raster2,method:this.method,keepMethod:this.keepMethod})}};(0,i.Cg)([(0,Qt.e)(Ge)],Ee.prototype,"method",void 0),(0,i.Cg)([(0,Qt.e)(Oe)],Ee.prototype,"keepMethod",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ee.prototype,"raster2",void 0),(0,i.Cg)([(0,a.MZ)({readOnly:!0})],Ee.prototype,"rasters",null),Ee=De=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunctionArguments")],Ee);const Ve=Ee;var Ue=s(20437);let Le=class extends w{constructor(){super(...arguments),this.functionName="ComputeChange",this.functionArguments=null,this.rasterArgumentNames=["raster","raster2"]}_bindSourceRasters(){const{method:t}=this.functionArguments,e=this.sourceRasterInfos[0].clone();if(this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(e),"categorical"===t){const t=this.sourceRasterInfos.map(t=>t.attributeTable),s=this._getFieldNames(t,"value"),n=t.map(t=>this._getClassFieldName(t));if(null==s[0]||null==s[1]||null==n[0]||null==n[1])return{success:!1,supportsGPU:!1,error:"both inputs must have proper attribute table with value and class fields"};this._updateAttributeTable(e,s,n)}return e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:"difference"===t||"relative-difference"===t}}_processPixels(t){const{pixelBlocks:e}=t;if(null==e?.[0]||null==e?.[1])return null;const{method:s}=this.functionArguments;return function(t,e,s,n){const[r,o]=t,i=(0,u.zw)(s)&&!(0,u.zw)(r.pixelType)&&!(0,u.zw)(o.pixelType),a=[r.mask,o.mask].filter(t=>t),l=g.A.combineBandMasks(a),c=t.map(t=>t.pixels[0]),{width:p,height:h}=r,m=g.A.createEmptyBand(s,p*h);switch(e){case"difference":case"relative-difference":!function(t){const{bands:[e,s],mask:n,isRelative:r,isRoundingNeeded:o,outBand:i}=t,a=e.length;for(let t=0;t<a;t++)if(!n||n[t]){let n=e[t]-s[t];if(r){const r=Math.max(Math.abs(e[t])-Math.abs(s[t]));n=r>0?n/r:0}i[t]=o?Math.round(n):n}}({bands:c,mask:l,outBand:m,isRoundingNeeded:i,isRelative:"relative-difference"===e});break;case"categorical":!function(t){const{bands:[e,s],categoryIndexLookups:[n,r],classNames:[o,i],mask:a,keepMethod:u,outBand:l}=t,c=e.length,p=o.length,h=i.length,m=p*h,d=m+1,g=m+2;for(let t=0;t<c;t++)if(!a||a[t]){const a=e[t],c=s[t],p=n[a],f=r[c],y=o[p],x=i[f];l[t]=null==p||null==f?m:"changed"===u&&y===x?d:"unchanged"===u&&y!==x?g:p*h+f}}({bands:c,mask:l,outBand:m,...n});break;case"euclidean-distance":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0;for(let r=0;r<i;r++){const o=e[r][t]-s[r][t];n+=o*o}r[t]=Math.sqrt(n)}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m});break;case"angle-difference":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0,o=0,a=0;for(let r=0;r<i;r++){const i=e[r][t],u=s[r][t];n+=i*u,o+=i*i,a+=u*u}const u=Math.sqrt(o*a);r[t]=u?Math.acos(n/u):1.5707963267948966}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m});break;case"band-with-most-change":!function(t){const{pixels:[e,s],mask:n,outBand:r}=t,o=e[0].length,i=e.length;for(let t=0;t<o;t++)if(!n||n[t]){let n=0,o=0;for(let r=0;r<i;r++){const i=Math.abs(e[r][t]-s[r][t]);i>n&&(n=i,o=r)}r[t]=o}}({pixels:t.map(t=>t.pixels),mask:l,outBand:m})}const d=new g.A({width:p,height:h,pixels:[m],pixelType:s,mask:l});return d.updateStatistics(),d}(e,s,this.outputPixelType,this._categoryConfig)}_getWebGLParameters(){const t=this.outputPixelType??"f32";let[e,s]=(0,u.hP)(t);const n=(0,u.zw)(t);return n&&(e-=1e-4,s+=1e-4),{method:this.functionArguments.method,domainRange:[e,s],isOutputRounded:n}}_updateAttributeTable(t,e,s){const n=this.sourceRasterInfos.map(t=>t.attributeTable),r=n.map((t,s)=>t.features.map(t=>t.attributes[e[s]])),o=n.map((t,e)=>t.features.map(t=>t.attributes[s[e]])),i=r.map(t=>{const e=[];return t.forEach((t,s)=>e[t]=s),e}),{keepMethod:a}=this.functionArguments;this._categoryConfig={categoryIndexLookups:i,classNames:o,keepMethod:a};const u=n[0].clone();u.fields=[new Ue.A({name:"OID",type:"oid"}),new Ue.A({name:"Value",type:"integer"}),new Ue.A({name:"ClassName",type:"string"}),new Ue.A({name:"Class_From",type:"string"}),new Ue.A({name:"Class_To",type:"string"})];const l=this._getFieldNames(n,"red"),c=this._getFieldNames(n,"green"),p=this._getFieldNames(n,"blue"),h=[],m=2===l.length&&2===c.length&&2===p.length;m&&(h.push(...n.map((t,e)=>t.features.map(t=>[t.attributes[l[e]],t.attributes[c[e]],t.attributes[p[e]]]))),u.fields.push(new Ue.A({name:"Red",type:"integer"}),new Ue.A({name:"Green",type:"integer"}),new Ue.A({name:"Blue",type:"integer"})));const d=u.features[0].clone();d.geometry=null;const g=[],[f,y]=r.map(t=>t.length);let x=1;for(let t=0;t<f;t++){const e=o[0][t];for(let s=0;s<y;s++){const n=o[1][s];if("changed"===a&&e===n||"unchanged"===a&&e!==n)continue;const r=d.clone();r.attributes={OID:x++,Value:t*y+s,ClassName:e===n?e:`${e} -> ${n}`,Class_From:e,Class_To:n},m&&(r.attributes.Red=h[0][t][0]+h[1][s][0]>>1,r.attributes.Green=h[0][t][1]+h[1][s][1]>>1,r.attributes.Blue=h[0][t][2]+h[1][s][2]>>1),g.push(r)}}if("changed"===a){const t=d.clone();t.attributes={OID:x++,Value:f*y+1,ClassName:"No Change",Class_From:"Same",Class_To:"Same"},g.push(t)}else if("unchanged"===a){const t=d.clone();t.attributes={OID:x++,Value:f*y+2,ClassName:"Changed",Class_From:"Any",Class_To:"Any"},g.push(t)}u.features=g,t.attributeTable=u}_getFieldNames(t,e){return t.map(({fields:t})=>t.find(t=>t.name.toLowerCase()===e)?.name).filter(t=>t)}_getClassFieldName(t){const e=t.fields.find(t=>"string"===t.type&&t.name.toLowerCase().startsWith("class"))??t.fields.find(t=>"string"===t.type&&t.name.toLowerCase().includes("class")||t.name.toLowerCase().includes("type")||t.name.toLowerCase().includes("name"))??t.fields.find(t=>"string"===t.type);return e?.name}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Le.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ve,json:{write:!0,name:"rasterFunctionArguments"}})],Le.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Le.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Le.prototype,"_categoryConfig",void 0),Le=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ComputeChangeFunction")],Le);const $e=Le;var Ke;let We=Ke=class extends p{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Ke({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],We.prototype,"contrastOffset",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],We.prototype,"brightnessOffset",void 0),We=Ke=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunctionArguments")],We);const He=We;var qe=s(51927);let Je=class extends w{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if("u8"!==e.pixelType)return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const s=e.clone();this._removeStatsHistColormapVAT(s),this.rasterInfo=s;const{contrastOffset:n,brightnessOffset:r}=this.functionArguments;return this.lookup=(0,qe.zj)(n,r),{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:(0,Kt.eH)(e,{lut:e.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Je.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:He,json:{write:!0,name:"rasterFunctionArguments"}})],Je.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Je.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Je.prototype,"lookup",void 0),Je=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ContrastBrightnessFunction")],Je);const Xe=Je;function Qe(t,e,s,n,r){const o=Math.floor(n/2);for(let n=0;n<o;n++)for(let o=0;o<e;o++)t[n*e+o]=t[(r-1-n)*e+o],t[(s-1-n)*e+o]=t[(s-r+n)*e+o];const i=Math.floor(r/2);for(let n=0;n<s;n++){const s=n*e;for(let n=0;n<i;n++)t[s+n]=t[s+r-1-n],t[s+e-n-1]=t[s+e+n-r]}}const Ye=new Map;function ts(t,e,s,n,r,o,i){const a=new Float32Array(e*s),u=o.length,l=i?0:n,c=i?n:0,p=i?1:e;for(let i=l;i<s-l;i++){const s=i*e;for(let i=c;i<e-c;i++){if(r&&!r[s+i])continue;let e=0;for(let r=0;r<u;r++)e+=t[s+i+(r-n)*p]*o[r];a[s+i]=e}}return a}function es(t,e,s,n,r,o,i){const a=new Float32Array(e*s),u=Math.floor(n/2),l=Math.floor(r/2);for(let c=u;c<s-u;c++){const s=c*e;for(let c=l;c<e-l;c++){if(o&&!o[s+c])continue;let p=0;for(let o=0;o<n;o++)for(let n=0;n<r;n++)p+=t[s+c+(o-u)*e+n-l]*i[o*r+n];a[s+c]=p}}return a}var ss;Ye.set(A.none,[0,0,0,0,1,0,0,0,0]),Ye.set(A.lineDetectionHorizontal,[-1,-1,-1,2,2,2,-1,-1,-1]),Ye.set(A.lineDetectionVertical,[-1,2,-1,-1,2,-1,-1,2,-1]),Ye.set(A.lineDetectionLeftDiagonal,[2,-1,-1,-1,2,-1,-1,-1,2]),Ye.set(A.lineDetectionRightDiagonal,[-1,-1,2,-1,2,-1,2,-1,-1]),Ye.set(A.gradientNorth,[-1,-2,-1,0,0,0,1,2,1]),Ye.set(A.gradientWest,[-1,0,1,-2,0,2,-1,0,1]),Ye.set(A.gradientEast,[1,0,-1,2,0,-2,1,0,-1]),Ye.set(A.gradientSouth,[1,2,1,0,0,0,-1,-2,-1]),Ye.set(A.gradientNorthEast,[0,-1,-2,1,0,-1,2,1,0]),Ye.set(A.gradientNorthWest,[-2,-1,0,-1,0,1,0,1,2]),Ye.set(A.smoothArithmeticMean,[.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111,.111111111111]),Ye.set(A.smoothing3x3,[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625]),Ye.set(A.smoothing5x5,[1,1,1,1,1,1,4,4,4,1,1,4,12,4,1,1,4,4,4,1,1,1,1,1,1]),Ye.set(A.sharpening3x3,[-1,-1,-1,-1,9,-1,-1,-1,-1]),Ye.set(A.sharpening5x5,[-1,-3,-4,-3,-1,-3,0,6,0,-3,-4,6,21,6,-4,-3,0,6,0,-3,-1,-3,-4,-3,-1]),Ye.set(A.laplacian3x3,[0,-1,0,-1,4,-1,0,-1,0]),Ye.set(A.laplacian5x5,[0,0,-1,0,0,0,-1,-2,-1,0,-1,-2,17,-2,-1,0,-1,-2,-1,0,0,0,-1,0,0]),Ye.set(A.sobelHorizontal,[-1,-2,-1,0,0,0,1,2,1]),Ye.set(A.sobelVertical,[-1,0,1,-2,0,2,-1,0,1]),Ye.set(A.sharpen,[0,-.25,0,-.25,2,-.25,0,-.25,0]),Ye.set(A.sharpen2,[-.25,-.25,-.25,-.25,3,-.25,-.25,-.25,-.25]),Ye.set(A.pointSpread,[-.627,.352,-.627,.352,2.923,.352,-.627,.352,-.627]);let ns=ss=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.kernel=[0,0,0,0,1,0,0,0,0]}set convolutionType(t){this._set("convolutionType",t);const e=Ye.get(t);if(!e||t===A.userDefined||t===A.none)return;const s=Math.round(Math.sqrt(e.length));this._set("kernel",e),this._set("cols",s),this._set("rows",s)}clone(){return new ss({cols:this.cols,rows:this.rows,kernel:[...this.kernel],convolutionType:this.convolutionType,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{type:Number,write:!0}})],ns.prototype,"rows",void 0),(0,i.Cg)([(0,a.MZ)({json:{type:Number,write:!0,name:"columns"}})],ns.prototype,"cols",void 0),(0,i.Cg)([(0,a.MZ)({json:{name:"type",type:Number,write:!0}})],ns.prototype,"convolutionType",null),(0,i.Cg)([(0,a.MZ)({json:{type:[Number],write:!0}})],ns.prototype,"kernel",void 0),ns=ss=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunctionArguments")],ns);const rs=ns;let os=class extends w{constructor(){super(...arguments),this.functionName="Convolution",this.rasterArgumentNames=["raster"]}get _normalizedKernel(){const{kernel:t,convolutionType:e}=this.functionArguments,s=t.reduce((t,e)=>t+e);return-1===e||0===s||1===s?t:t.map(t=>t/s)}_bindSourceRasters(){const{convolutionType:t,rows:e,cols:s,kernel:n}=this.functionArguments;if(!Object.values(A).includes(t))return{success:!1,supportsGPU:!1,error:`convolution-function: the specified kernel type is not supported ${t}`};if(t!==A.none&&e*s!==n.length)return{success:!1,supportsGPU:!1,error:"convolution-function: the specified rows and cols do not match the length of the kernel"};const r=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(r.pixelType);const o=r.clone();o.pixelType=this.outputPixelType;const i=[A.none,A.sharpen,A.sharpen2,A.sharpening3x3,A.sharpening5x5];return(-1===t||"u8"!==this.outputPixelType&&!i.includes(t))&&(o.statistics=null,o.histograms=null),o.colormap=null,o.attributeTable=null,this.rasterInfo=o,{success:!0,supportsGPU:n.length<=25}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e||this.functionArguments.convolutionType===A.none)return e;const{rows:s,cols:n}=this.functionArguments,{_normalizedKernel:r}=this;return function(t,e){const s=function(t){const e=Math.sqrt(t.length),s=t.slice(0,e),n=[1];for(let s=1;s<e;s++){let r=null;for(let n=0;n<e;n++){const o=t[n+s*e],i=t[n];if(null==r)if(0===i){if(o)return{separable:!1,row:null,col:null}}else r=o/i;else if(o/i!==r)return{separable:!1,row:null,col:null}}if(null==r)return{separable:!1,row:null,col:null};n.push(r)}return{separable:!0,row:s,col:n}}(e.kernel),n=!1!==e.mirrorEdges,r=s.separable?function(t,e,s,n=!0){const{pixels:r,width:o,height:i,pixelType:a,mask:u}=t,l=r.length,c=[],p=e.length,h=s.length,m=Math.floor(p/2),d=Math.floor(h/2);for(let t=0;t<l;t++){let a=ts(r[t],o,i,m,u,e,!0);a=ts(a,o,i,d,u,s,!1),n&&Qe(a,o,i,p,h),c.push(a)}return new g.A({width:o,height:i,pixelType:a,pixels:c,mask:u})}(t,s.row,s.col,n):function(t,e,s=!0){const{pixels:n,width:r,height:o,pixelType:i,mask:a}=t,u=n.length,l=[],{kernel:c,rows:p,cols:h}=e;for(let t=0;t<u;t++){const e=es(n[t],r,o,p,h,a,c);s&&Qe(e,r,o,p,h),l.push(e)}return new g.A({width:r,height:o,pixelType:i,pixels:l,mask:a})}(t,e,n),{outputPixelType:o}=e;return o&&r.clamp(o),r}(e,{kernel:r,rows:s,cols:n,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const t=new Float32Array(25),{rows:e,cols:s}=this.functionArguments,{_normalizedKernel:n}=this;for(let r=0;r<e;r++)for(let e=0;e<s;e++)t[5*r+e]=n[r*s+e];return{kernelRows:e,kernelCols:s,kernel:t,clampRange:(0,u.hP)(this.outputPixelType)}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],os.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:rs,json:{write:!0,name:"rasterFunctionArguments"}})],os.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],os.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],os.prototype,"_normalizedKernel",null),os=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ConvolutionFunction")],os);const is=os;var as;const us=new Dt.J({0:"standard",1:"planform",2:"profile"},{useNumericKeys:!0});let ls=as=class extends p{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(t,e){return us.fromJSON(e.type??e.curvatureType??0)}clone(){return new as({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:{target:"type"}}}),(0,Qt.e)(us)],ls.prototype,"curvatureType",void 0),(0,i.Cg)([(0,ye.w)("curvatureType",["type","curvatureType"])],ls.prototype,"readCurvatureType",null),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],ls.prototype,"zFactor",void 0),ls=as=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunctionArguments")],ls);const cs=ls;let ps=class extends w{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.bandCount=1,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,curvatureType:n}=this.functionArguments,{extent:r,primaryPixelSizes:o}=t,i=o?.[0],a=i??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),u=this.isGCS&&s>=1?s*zt.rk:s;return(0,zt.E0)(e,{zFactor:u,curvatureType:n,resolution:a})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*zt.rk:t}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],ps.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:cs,json:{write:!0,name:"rasterFunctionArguments"}})],ps.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],ps.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ps.prototype,"isGCS",void 0),ps=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.CurvatureFunction")],ps);const hs=ps;var ms;let ds=ms=class extends p{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=0}clone(){return new ms({bandIds:this.bandIds?.slice(),bandNames:this.bandNames?.slice(),bandWavelengths:this.bandWavelengths?.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandIds",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"bandWavelengths",void 0),(0,i.Cg)([(0,Qt.e)({0:"name",1:"wavelength",2:"id"})],ds.prototype,"method",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"missingBandAction",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],ds.prototype,"wavelengthMatchTolerance",void 0),ds=ms=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunctionArguments")],ds);const gs=ds;let fs=class extends w{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{functionArguments:t,sourceRasterInfos:e}=this,s=e[0],{method:n,bandNames:r,bandWavelengths:o,bandIds:i,missingBandAction:a}=t,u=r?.length&&("name"===n||"id"!==n&&!i?.length),l=o?.length&&("wavelength"===n||"id"!==n&&!i?.length),c=1===a,p=u?function(t,e){const s=t.bandInfos.map(({name:t})=>t.toLowerCase()),n=[];for(let t=0;t<e.length;t++){const r=e[t].toLowerCase();let o=s.indexOf(r);if(-1===o&&"nearinfrared"===r&&(o=s.findIndex(t=>t.startsWith("nearinfrared_1")),-1===o&&(o=s.findIndex(t=>t.startsWith("nearinfrared")))),-1===o)return null;n.push(o)}return n}(s,r):l?function(t,e,{wavelengthMatchTolerance:s},n){const{bandInfos:r}=t,o=[];for(let t=0;t<r.length;t++){const{minWavelength:e,maxWavelength:s}=r[t];if(!e||!s)return null;o.push({minWavelength:e,maxWavelength:s})}const i=[];for(let t=0;t<e.length;t++){const r=e[t];let a=!1,u=-1,l=Number.MAX_VALUE;for(let t=0;t<o.length;t++){const e=o[t],s=r>=e.minWavelength&&r<=e.maxWavelength,n=Math.abs(r-(e.minWavelength+e.maxWavelength)/2);s?n<l&&(a=!0,u=t,l=n):!a&&n<l&&(u=t,l=n)}if(!a&&s&&l<s&&(a=!0),!a&&n)return null;i.push(u)}return i}(s,o,this.functionArguments,c):function(t,e,s){const{bandCount:n}=t;return!e?.length||s&&e.some(t=>t<0||t>=n)?null:e}(s,i,c);if(null==p)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${u?"band names":l?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=p,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType(s.pixelType);const h=s.clone();h.pixelType=this.outputPixelType,h.bandCount=p.length;const{statistics:m,histograms:d}=h;null!=m&&m.length&&(h.statistics=p.map(t=>m[t]||m[m.length-1])),null!=d&&d.length&&(h.histograms=p.map(t=>d[t]||d[d.length-1])),h.multidimensionalInfo&&h.multidimensionalInfo.variables.forEach(t=>{const{statistics:e,histograms:s}=t;null!=e&&e.length&&(t.statistics=p.map(t=>e[t]||e[e.length-1])),null!=s&&s.length&&(t.histograms=p.map(t=>s[t]||s[s.length-1]))});let g=h.keyProperties?.BandProperties;return g?.length&&(g=p.map(t=>t>=g.length?g[g.length-1]:g[t]),h.keyProperties={...h.keyProperties,BandProperties:g}),this.rasterInfo=h,{success:!0,supportsGPU:h.bandCount<=3}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;let{bandIds:s}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this;s=s.map(e=>t.indexOf(e))}else{const t=e.pixels.length;s=s.map(e=>e>=t?t-1:e)}return e.extractBands(s)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],0===t.length?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:qt(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map(t=>t>=e?e-1:t).map(e=>t[e])}_swizzleBandIds(t){const e=this.functionArguments.bandIds.map(e=>t.indexOf(e));return this.isInputBandIdsSwizzled=!0,e[1]??=e[0],e[2]??=e[1],this.swizzledBandSelection=e,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],fs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:gs,json:{write:!0,name:"rasterFunctionArguments"}})],fs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],fs.prototype,"rasterArgumentNames",void 0),fs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ExtractBandFunction")],fs);const ys=fs;function xs(t,e,s,n){const{pixels:r,width:o,height:i}=t,a=r.length,l=s.startsWith("f"),c=!l,[p,h]=(0,u.hP)(s),m=o*i,d=g.A.createEmptyBand(s,m);for(let t=0;t<i;t++){let s=t*o;for(let t=0;t<o;t++,s++)if(!n||n[s]){let t=0;for(let n=0;n<a;n++)t+=e[n]*r[n][s];l||(t=Math.round(t),c&&(t=t>h?h:t<p?p:t)),d[s]=t}}return d}var ws;let As=ws=class extends p{clone(){return new ws({conversionParameters:[...this.conversionParameters],raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],As.prototype,"conversionParameters",void 0),As=ws=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunctionArguments")],As);const vs=As;let Cs=class extends w{constructor(){super(...arguments),this.functionName="Grayscale",this.functionArguments=null,this.rasterArgumentNames=["raster"]}get _normalizedWeights(){const{conversionParameters:t}=this.functionArguments,e=t.reduce((t,e)=>t+e);return t.map(t=>t/e)}_bindSourceRasters(){const{conversionParameters:t}=this.functionArguments;if(!t?.length)return{success:!1,supportsGPU:!1,error:"missing valid conversion parameters."};const e=this.sourceRasterInfos[0].clone();this.outputPixelType=this._getOutputPixelType(e.pixelType),e.pixelType=this.outputPixelType;const s=3===t.length||3===e.bandCount&&t.length>3;return e.bandCount=1,this._removeStatsHistColormapVAT(e),this.rasterInfo=e,{success:!0,supportsGPU:s}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,s){const{width:n,height:r,mask:o,bandMasks:i}=t,a=i?.length?g.A.combineBandMasks(i):o,u=xs(t,e,s,a),l=new g.A({width:n,height:r,pixels:[u],pixelType:s,mask:a});return l.updateStatistics(),l}(e,this._normalizedWeights,this.outputPixelType)}_getWebGLParameters(){return{weights:this._normalizedWeights}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Cs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:vs,json:{write:!0,name:"rasterFunctionArguments"}})],Cs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Cs.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],Cs.prototype,"_normalizedWeights",null),Cs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.GrayscaleFunction")],Cs);const bs=Cs;var Ms;const Ts=new Dt.J({0:"traditional",1:"multi-directional"},{useNumericKeys:!0}),Ps=new Dt.J({1:"degree",2:"percent-rise",3:"scaled"},{useNumericKeys:!0});let Ns=Ms=class extends p{constructor(){super(...arguments),this.altitude=45,this.azimuth=315,this.hillshadeType="traditional",this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.slopeType="degree",this.zFactor=1,this.removeEdgeEffect=!1}clone(){return new Ms({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,slopeType:this.slopeType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"altitude",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"azimuth",void 0),(0,i.Cg)([(0,a.MZ)(),(0,Qt.e)(Ts)],Ns.prototype,"hillshadeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psPower"}})],Ns.prototype,"pixelSizePower",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0,name:"psZFactor"}})],Ns.prototype,"pixelSizeFactor",void 0),(0,i.Cg)([(0,a.MZ)(),(0,Qt.e)(Ps)],Ns.prototype,"slopeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],Ns.prototype,"zFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],Ns.prototype,"removeEdgeEffect",void 0),Ns=Ms=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunctionArguments")],Ns);const Is=Ns;let Rs=class extends w{constructor(){super(...arguments),this.functionName="Hillshade",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"hillshade-function: source data must be single band"};this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone();return this._removeStatsHistColormapVAT(e),e.pixelType=this.outputPixelType,e.bandCount=1,e.statistics=[{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=e,this.isGCS=e.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e)return null;const{extent:s,primaryPixelSizes:n}=t,r=n?.[0],o=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1}),i=(0,zt.PP)(this.functionArguments,o,this.isGCS),a=(0,zt.fw)(e,i);return a.pixelType=this.outputPixelType,a}_getWebGLParameters(){const t=(0,zt.PP)(this.functionArguments,{x:1,y:1},this.isGCS),e=(0,zt.ng)(t),{slopeType:s,zFactor:n,pixelSizeFactor:r,pixelSizePower:o}=this.functionArguments,i="scaled"===s,a=(0,u.zw)(this.outputPixelType);return{...e,zFactor:n,gcsFactor:this.isGCS?zt.rk:1,pixelSizeFactor:i?r:0,pixelSizePower:i?o:0,isOutputRounded:a}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Rs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Is,json:{write:!0,name:"rasterFunctionArguments"}})],Rs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Rs.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Rs.prototype,"isGCS",void 0),Rs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.HillshadeFunction")],Rs);const Fs=Rs;var ks;let _s=ks=class extends p{constructor(){super(...arguments),this.rasters=[],this.processAsMultiband=!0}writeRasters(t,e){e.rasters=t.map(t=>"number"==typeof t||"string"==typeof t?t:t.toJSON())}clone(){return new ks({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:(0,o.o8)(this.rasters)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"operation",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"rasters",void 0),(0,i.Cg)([(0,Se.K)("rasters")],_s.prototype,"writeRasters",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],_s.prototype,"processAsMultiband",void 0),_s=ks=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunctionArguments")],_s);const Ss=_s;let Bs=class extends w{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:s}=e,{processAsMultiband:n}=this.functionArguments;if(t.some(t=>t.bandCount!==s))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:o}=this.functionArguments,i=N[r];if(!(999===i||o.length===i||o.length<=1&&1===i))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${i}`};const a=e.clone();return a.bandCount=999!==i||n?s:1,this._removeStatsHistColormapVAT(a),this._updateStatistics(a),this._updatePixelType(a),this.rasterInfo=a,{success:!0,supportsGPU:1===a.bandCount&&i<=3}}_processPixels(t){const{pixelBlocks:e}=t;return null==e||e.some(t=>null==t)?null:kt(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){const{operation:t}=this.functionArguments,e=N[t],s=Object.keys(M).find(e=>M[e]===t)?.toLowerCase()??"undefined",n=this.outputPixelType??"f32";let[r,o]=(0,u.hP)(n);const i=(0,u.zw)(n);return i&&(r-=1e-4,o+=1e-4),{imageCount:e,operationName:s,domainRange:[r,o],isOutputRounded:i}}_updateStatistics(t){const e=this.sourceRasterInfos[0],{operation:s}=this.functionArguments,n=P(s)?.domain;if(n){t.statistics=[];for(let e=0;e<t.bandCount;e++)t.statistics[e]={min:n[0],max:n[1],avg:(n[0]+n[1])/2,stddev:(n[0]+n[1])/10}}else 45===s&&e.statistics?.length&&(t.statistics=e.statistics.map(t=>({min:-t.max,max:-t.min,avg:null!=t.avg?-t.avg:void 0,stddev:null!=t.stddev?-t.stddev:void 0})))}_updatePixelType(t){const{statistics:e,pixelType:s}=this.sourceRasterInfos[0],{operation:n}=this.functionArguments,{domain:r,isInteger:o}=P(n)??{domain:null,isInteger:!1};let i="f32";if(r&&o)i=(0,u.X1)(r[0],r[1]);else if(30===n){const t=e?.[0];i=t?(0,u.X1)(t.min,t.max):(0,u.zw)(s)?s:"s32"}else if(45===n&&(0,u.zw)(s)){const t=e?.map(({max:t})=>-t),n=e?.map(({min:t})=>-t),r=t?.length?Math.min(...t):null,o=n?.length?Math.min(...n):null;i=null!=r&&null!=o?(0,u.X1)(r,o):s.startsWith("s")?s.replace("s","u"):"u1"===s||"u2"===s||"u4"===s?"s8":"u8"===s?"s16":"s32"}t.pixelType=this.outputPixelType=this._getOutputPixelType(i)}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Bs.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ss,json:{write:!0,name:"rasterFunctionArguments"}})],Bs.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Bs.prototype,"rasterArgumentNames",void 0),Bs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.LocalFunction")],Bs);const js=Bs;var Zs,zs=s(34727);let Gs=Zs=class extends p{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=0}get normalizedNoDataValues(){const{noDataValues:t}=this;if(!t?.length)return null;let e=!1;const s=t.map(t=>{if("number"==typeof t)return e=!0,[t];if("string"==typeof t){const s=t.trim().split(" ").filter(t=>""!==t.trim()).map(t=>Number(t));return e=e||s.length>0,0===s.length?null:s}return null});return e?s:null}clone(){return new Zs({includedRanges:this.includedRanges?.slice()??[],noDataValues:this.noDataValues?.slice()??[],noDataInterpretation:this.noDataInterpretation})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"includedRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"noDataValues",void 0),(0,i.Cg)([(0,a.MZ)()],Gs.prototype,"normalizedNoDataValues",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Gs.prototype,"noDataInterpretation",void 0),Gs=Zs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunctionArguments")],Gs);const Os=Gs;let Ds=class extends w{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:s,normalizedNoDataValues:n}=this.functionArguments;if(!s?.length&&!n?.length)return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let o=0;o<t.bandCount;o++){const t=(0,Kt.Wt)(e,s?.slice(2*o,2*o+2),n?.[o]);if(null==t){r=null;break}r.push(t)}this.lookups=r;const o=null!=n&&n.every(t=>t?.length===n[0]?.length);return{success:!0,supportsGPU:(!s||s.length<=2*Kt.et)&&(!n||o&&n[0].length<=Kt.et)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{outputPixelType:s,lookups:n}=this,{includedRanges:r,noDataInterpretation:o,normalizedNoDataValues:i}=this.functionArguments;return(0,Kt.dK)(e,{includedRanges:r,noDataValues:i,outputPixelType:s,matchAll:1===o,lookups:n})}_getWebGLParameters(){const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,s=new Float32Array(Kt.et);s.fill(zs.pq),e?.[0]?.length&&s.set(e[0]);const n=new Float32Array(6);for(let e=0;e<n.length;e+=2)n[e]=t?.[e]??-zs.pq,n[e+1]=t?.[e+1]??zs.pq;return t?.length&&n.set(t),{bandCount:this.sourceRasterInfos[0].bandCount,noDataValues:s,includedRanges:n}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Ds.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Os,json:{write:!0,name:"rasterFunctionArguments"}})],Ds.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Ds.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ds.prototype,"lookups",void 0),Ds=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.MaskFunction")],Ds);const Es=Ds;var Vs;let Us=Vs=class extends p{constructor(){super(...arguments),this.visibleBandID=0,this.infraredBandID=1,this.scientificOutput=!1}clone(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this;return new Vs({visibleBandID:t,infraredBandID:e,scientificOutput:s})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"visibleBandID",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"infraredBandID",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Us.prototype,"scientificOutput",void 0),Us=Vs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunctionArguments")],Us);const Ls=Us;let $s=class extends w{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:e,infraredBandID:s}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const n=this.sourceRasterInfos[0],r=Math.max(e,s);if(n.bandCount<2||r>=n.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};if(e<0||s<0)return{success:!1,supportsGPU:!1,error:"ndvi-function: invalid visible or infrared band id"};const o=n.clone();o.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(o),o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,a,u,l]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:a,avg:u,stddev:l}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;let{visibleBandID:s,infraredBandID:n,scientificOutput:r}=this.functionArguments;if(this.rasterInfo.storageInfo.isBsqTile){const{rawInputBandIds:t}=this;n=t.indexOf(n),s=t.indexOf(s)}return function(t,e,s,n){const{mask:r,pixels:o,width:i,height:a}=t,u=o[s],l=o[e],c=l.length,p=n?new Uint8Array(c):new Float32Array(c),h=n?100:1,m=n?100.5:0;for(let t=0;t<c;t++)if(null==r||r[t]){const e=u[t],s=l[t],n=e+s;n&&(p[t]=(e-s)/n*h+m)}const d=new g.A({width:i,height:a,mask:r,pixelType:n?"u8":"f32",pixels:[p]});return d.updateStatistics(),d}(e,s,n,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this.functionArguments;return{bandIndexMat3:qt(this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0]),scaled:!s}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments;return[s,e,0].map(e=>t[e])}_swizzleBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments,n=[e,s].map(e=>t.indexOf(e));return n[2]=n[1],this.isInputBandIdsSwizzled=!0,this.swizzledBandSelection=n,!1}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],$s.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Ls,json:{write:!0,name:"rasterFunctionArguments"}})],$s.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],$s.prototype,"rasterArgumentNames",void 0),$s=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.NDVIFunction")],$s);const Ks=$s;var Ws;let Hs=Ws=class extends p{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new Ws({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"inputRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"outputValues",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"noDataRanges",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"allowUnmatched",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"replacementValue",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Hs.prototype,"isLastInputRangeInclusive",void 0),Hs=Ws=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunctionArguments")],Hs);const qs=Hs;let Js=class extends w{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;t.bandCount=1;const{statistics:s}=t;this._removeStatsHistColormapVAT(t);const{allowUnmatched:n,replacementValue:r,outputValues:o,inputRanges:i,noDataRanges:a,isLastInputRangeInclusive:l}=this.functionArguments,c="unknown"===this.outputPixelType||null==this.outputPixelType;if(this.outputPixelType=this._getOutputPixelType(e),o?.length){const i=s?.[0];if(n&&null==r){let e=i?.min??o[0],s=i?.max??o[0];e=Math.min.apply(null,[...o,e]),s=Math.max.apply(null,[...o,s]),t.statistics=[{min:e,max:s,avg:i?.avg??0,stddev:i?.stddev??-1}]}else{let e=o[0],s=e;for(let t=0;t<o.length;t++)e=e>o[t]?o[t]:e,s=s>o[t]?s:o[t];n&&null!=r&&(e=Math.min(e,r),s=Math.max(s,r)),t.statistics=[{min:e,max:s,avg:i?.avg??0,stddev:i?.stddev??-1}]}if(c){const{min:s,max:i}=t.statistics[0],a=["u8","s8","u16","s16","u32","s32","f32"],l=a.find(t=>{const[e,n]=(0,u.hP)(t);return s>=e&&i<=n})??"f64";o.some(t=>Math.floor(t)!==t)?this.outputPixelType="f64"===l?"f64":"f32":this.outputPixelType=n&&null==r&&a.indexOf(e)>a.indexOf(l)?e:l}}return t.pixelType=this.outputPixelType,this.rasterInfo=t,this.lookup=n?null:(0,Kt.XU)({srcPixelType:e,inputRanges:i,outputValues:o,noDataRanges:a,allowUnmatched:n,isLastInputRangeInclusive:l,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!o||o.length<=Kt.et)&&(!a||a.length<=Kt.et)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{lookup:s,outputPixelType:n}=this;if(s){const t=(0,Kt.eH)(e,{lut:[s.lut],offset:s.offset,outputPixelType:n});return null!=t&&s.mask&&(t.mask=(0,Kt.UK)(e.pixels[0],e.mask,s.mask,s.offset,"u8")),t}const{inputRanges:r,outputValues:o,noDataRanges:i,allowUnmatched:a,isLastInputRangeInclusive:u,replacementValue:l}=this.functionArguments;return(0,Kt.Ew)(e,{inputRanges:r,outputValues:o,noDataRanges:i,outputPixelType:n,allowUnmatched:a,isLastInputRangeInclusive:u,replacementValue:l})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:s}=this.functionArguments,n=this.functionArguments.inputRanges??[],r=this.functionArguments.outputValues??[],o=(0,Kt.bL)(n,r,s),i=new Float32Array(2*Kt.et);return i.fill(zs.pq),e?.length&&i.set(e),{allowUnmatched:t,rangeMaps:o,noDataRanges:i,clampRange:(0,u.hP)(this.outputPixelType),replacementValue:this.functionArguments.replacementValue}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Js.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:qs,json:{write:!0,name:"rasterFunctionArguments"}})],Js.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Js.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Js.prototype,"lookup",void 0),Js=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.RemapFunction")],Js);const Xs=Js;var Qs;let Ys=Qs=class extends Is{readColorRamp(t){if("string"==typeof t){const e=ge.kH.jsonValues.find(e=>e.toLowerCase()===t.toLowerCase());return e?(0,ge.M5)(ge.kH.fromJSON(e)):null}return"toJSON"in t?t.toJSON():t}clone(){return new Qs({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,slopeType:this.slopeType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,removeEdgeEffect:this.removeEdgeEffect,colorRamp:this.colorRamp,colormap:this.colormap,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Ys.prototype,"colorRamp",void 0),(0,i.Cg)([(0,ye.w)("colorRamp")],Ys.prototype,"readColorRamp",null),(0,i.Cg)([(0,a.MZ)({type:[[Number]],json:{write:!0}})],Ys.prototype,"colormap",void 0),Ys=Qs=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunctionArguments")],Ys);const tn=Ys;let en=class extends w{constructor(){super(...arguments),this.functionName="ShadedRelief",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: source data must be single band"};let{colorRamp:e,colormap:s}=this.functionArguments;if(!e&&!s?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a color ramp argument must be specified"};this.outputPixelType=this._getOutputPixelType("u8");const n=t.clone();this._removeStatsHistColormapVAT(n),n.pixelType=this.outputPixelType,n.bandCount=3,n.statistics=[{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10},{min:0,max:255,avg:60,stddev:10}],this.rasterInfo=n,this.isGCS=n.spatialReference?.isGeographic??!1,s?.length||(s=(0,ge.R8)(e,{interpolateAlpha:!0}));const{indexedColormap:r,offset:o}=(0,Kt.zg)({colormap:s});if(!r?.length)return{success:!1,supportsGPU:!1,error:"shadedrelief-function: a valid colorramp is required"};const i=(0,ge.S2)(r);return this.lookup={indexedColormap:r,offset:o,hsvMap:i},{success:!0,supportsGPU:(0,Re.WN)(r)}}_processPixels(t){const e=t.pixelBlocks?.[0];if(!e||!this.lookup)return null;let s=t.primaryPixelSizes?.[0];if(null==s){const{extent:n}=t;s=n?{x:n.width/e.width,y:n.height/e.height}:{x:1,y:1}}const n=(0,zt.PP)(this.functionArguments,s,this.isGCS),r=(0,zt.fw)(e,n),o=this.sourceRasterInfos[0].statistics?.[0]??{min:0,max:8e3};return(0,zt.SC)(r,e,this.lookup.hsvMap,o),r.pixelType=this.outputPixelType,r}_getWebGLParameters(){const t=(0,zt.PP)(this.functionArguments,{x:1,y:1},this.isGCS),e=(0,zt.ng)(t),{slopeType:s,zFactor:n,pixelSizeFactor:r,pixelSizePower:o}=this.functionArguments,i="scaled"===s,{indexedColormap:a,offset:l}=this.lookup,c=this.sourceRasterInfos[0].statistics?.[0],p=(0,u.zw)(this.outputPixelType);return{...e,indexedColormap:a,offset:l,zFactor:n,gcsFactor:this.isGCS?zt.rk:1,pixelSizeFactor:i?r:0,pixelSizePower:i?o:0,minValue:c?.min??0,maxValue:c?.max??8e3,isOutputRounded:p}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],en.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],en.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],en.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],en.prototype,"isGCS",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],en.prototype,"lookup",void 0),en=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.ShadedReliefFunction")],en);const sn=en;var nn;const rn=new Dt.J({1:"degree",2:"percent-rise",3:"adjusted"},{useNumericKeys:!0});let on=nn=class extends p{constructor(){super(...arguments),this.slopeType="degree",this.zFactor=1,this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.removeEdgeEffect=!1}clone(){return new nn({slopeType:this.slopeType,zFactor:this.zFactor,pixelSizePower:this.pixelSizePower,pixelSizeFactor:this.pixelSizeFactor,removeEdgeEffect:this.removeEdgeEffect,raster:this.raster})}};(0,i.Cg)([(0,Qt.e)(rn)],on.prototype,"slopeType",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],on.prototype,"zFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"psPower",write:!0}})],on.prototype,"pixelSizePower",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"psZFactor",write:!0}})],on.prototype,"pixelSizeFactor",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],on.prototype,"removeEdgeEffect",void 0),on=nn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunctionArguments")],on);const an=on;let un=class extends w{constructor(){super(...arguments),this.functionName="Slope",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),t.statistics="percent-rise"!==this.functionArguments.slopeType?[{min:0,max:90,avg:1,stddev:1}]:null,t.bandCount=1,this.rasterInfo=t,this.isGCS=t.spatialReference?.isGeographic??!1,{success:!0,supportsGPU:!0}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return null;const{zFactor:s,slopeType:n,pixelSizePower:r,pixelSizeFactor:o}=this.functionArguments,{isGCS:i}=this,{extent:a,primaryPixelSizes:u}=t,l=u?.[0],c=l??(a?{x:a.width/e.width,y:a.height/e.height}:{x:1,y:1});return(0,zt.yy)(e,{zFactor:s,slopeType:n,pixelSizePower:r,pixelSizeFactor:o,isGCS:i,resolution:c})}_getWebGLParameters(){const{zFactor:t,slopeType:e,pixelSizeFactor:s,pixelSizePower:n}=this.functionArguments;return{zFactor:this.isGCS&&t>=1?t*zt.rk:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:n??0,isOutputRounded:(0,u.zw)(this.outputPixelType)}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],un.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:an,json:{write:!0,name:"rasterFunctionArguments"}})],un.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],un.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],un.prototype,"isGCS",void 0),un=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SlopeFunction")],un);const ln=un;var cn;let pn=cn=class extends p{clone(){return new cn({conversionMatrix:[...this.conversionMatrix],raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],pn.prototype,"conversionMatrix",void 0),pn=cn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunctionArguments")],pn);const hn=pn;let mn=class extends w{constructor(){super(...arguments),this.functionName="SpectralConversion",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone();return this.outputPixelType=this._getOutputPixelType(t.pixelType),t.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(t),this.rasterInfo=t,{success:!0,supportsGPU:3===t.bandCount&&9===this.functionArguments.conversionMatrix.length}}_processPixels(t){const e=t.pixelBlocks?.[0];return null==e?null:function(t,e,s){const{width:n,height:r,mask:o,bandMasks:i}=t,a=i?.length?g.A.combineBandMasks(i):o,u=[],l=t.pixels.length;for(let n=0;n<e.length/l;n++){const r=xs(t,e.slice(n*l,(n+1)*l),s,a);u.push(r)}const c=new g.A({width:n,height:r,pixels:u,pixelType:s,mask:a});return c.updateStatistics(),c}(e,this.functionArguments.conversionMatrix,this.outputPixelType)}_getWebGLParameters(){const t=(0,u.hP)(this.outputPixelType),[e,s,n,r,o,i,a,l,c]=this.functionArguments.conversionMatrix;return{weights:[e,r,a,s,o,l,n,i,c],clampRange:t}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],mn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:hn,json:{write:!0,name:"rasterFunctionArguments"}})],mn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],mn.prototype,"rasterArgumentNames",void 0),mn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.SpectralConversionFunction")],mn);const dn=mn,gn=new Dt.J({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function fn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{statisticsType:u,kernelRows:l,kernelCols:c}=e,p="stddev"===u,h=r*o,m=new Float64Array(h),d=new Float64Array(h),g=new Uint32Array(h);for(let t=0;t<o;t++){const e=t*r;let s=0,o=0,a=0;for(let t=0;t<c;t++)i&&!i[e+t]||(s+=n[e+t],p&&(o+=n[e+t]**2),a++);m[e]=s,d[e]=o,g[e]=a;for(let t=1;t<=r-c;t++){const r=e+t-1,u=r+c;i?(i[r]&&(a--,s-=n[r],p&&(o-=n[r]**2)),i[u]&&(a++,s+=n[u],p&&(o+=n[u]**2))):(s-=n[r],s+=n[u],p&&(o-=n[r]**2,o+=n[u]**2)),m[e+t]=s,g[e+t]=a,p&&(d[e+t]=o)}}const f=new Float64Array(h),y=new Float64Array(h),x=new Uint32Array(h),w=l*r;for(let t=0;t<=r-c;t++){let e=0,s=0,n=0;for(let o=0;o<l;o++){const i=o*r+t;e+=m[i],n+=g[i],p&&(s+=d[i])}f[t]=e,y[t]=s,x[t]=n;for(let i=1;i<=o-l;i++){const o=(i-1)*r+t,a=o+w;e-=m[o],e+=m[a],n-=g[o],n+=g[a],p&&(s-=d[o],s+=d[a]),f[i*r+t]=e,y[i*r+t]=s,x[i*r+t]=n}}const A=Math.floor(l/2),v=Math.floor(c/2);for(let t=A;t<o-A;t++){const e=t*r;for(let n=v;n<r-v;n++){const o=(t-A)*r+n-v,u=x[o];if(0===u||s&&(!i||i[e+n]))continue;const l=f[o]/u,c=p?Math.sqrt((y[o]-f[o]*l)/u):l;a[e+n]=c,i&&(i[e+n]=255)}}}function yn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l,statisticsType:c}=e,p=Math.floor(u/2),h=Math.floor(l/2),m="min"===c,d=a.slice(),g=new Uint32Array(r*o);for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++){let s=m?Number.MAX_VALUE:-Number.MAX_VALUE,o=0;for(let a=0;a<u;a++)for(let u=0;u<l;u++){const l=e+t+(a-p)*r+u-h;i&&!i[l]||(s=m?Math.min(s,n[l]):Math.max(s,n[l]),o++)}i?(d[e+t]=0===o?0:s,g[e+t]=o):a[e+t]=0===o?0:s}}if(i)for(let t=p;t<o-p;t++){const e=t*r;for(let t=h;t<r-h;t++)if(g[e+t]){if(s&&i[e+t])continue;a[e+t]=d[e+t],i[e+t]=255}}}function xn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h=a.slice(),m=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(s&&i?.[e+t])continue;const o=[];for(let s=0;s<u;s++)for(let a=0;a<l;a++){const u=e+t+(s-c)*r+a-p;i&&!i[u]||o.push(n[u])}o.length&&(o.sort((t,e)=>t-e),i?(h[e+t]=o[Math.floor((o.length-1)/2)],m[e+t]=o.length):a[e+t]=o[Math.floor((o.length-1)/2)])}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(m[e+t]){if(s&&i[e+t])continue;a[e+t]=h[e+t],i[e+t]=255}}}function wn(t,e){const{fillNoDataOnly:s}=e,{band:n,width:r,height:o,mask:i,outBand:a}=t;if(s&&!i)return void a.set(n);const{kernelRows:u,kernelCols:l}=e,c=Math.floor(u/2),p=Math.floor(l/2),h="majority"===e.statisticsType,m=u*l,d=a.slice(),g=new Uint32Array(r*o);for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++){if(s&&i?.[e+t])continue;const o=new Map;for(let s=0;s<u;s++)for(let a=0;a<l;a++){const u=e+t+(s-c)*r+a-p;if(i&&!i[u])continue;const l=n[u];o.set(l,o.has(l)?o.get(l)+1:1)}if(0===o.size)continue;let f=0,y=0,x=h?0:m+1;for(const t of o.keys())y=o.get(t),h===y>x&&(x=y,f=t);i?(d[e+t]=f,g[e+t]=o.size):a[e+t]=f}}if(i)for(let t=c;t<o-c;t++){const e=t*r;for(let t=p;t<r-p;t++)if(g[e+t]){if(s&&i[e+t])continue;a[e+t]=d[e+t],i[e+t]=255}}}var An;let vn=An=class extends p{constructor(){super(...arguments),this.rows=3,this.cols=3,this.fillNoDataOnly=!1,this.statisticsType="min"}clone(){return new An({rows:this.rows,cols:this.cols,fillNoDataOnly:this.fillNoDataOnly,statisticsType:this.statisticsType,raster:(0,o.o8)(this.raster)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelRows","rows"],reader:(t,e)=>Number(t??e?.kernelRows??3)}}})],vn.prototype,"rows",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0,read:{source:["kernelCols","cols"],reader:(t,e)=>Number(t??e?.kernelCols??3)}}})],vn.prototype,"cols",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],vn.prototype,"fillNoDataOnly",void 0),(0,i.Cg)([(0,a.MZ)({json:{read:{source:["statisticsType","type"],reader:(t,e)=>gn.fromJSON(e?.statisticsType??e?.type)??"min"},write:{target:"type"}}}),(0,Qt.e)(gn)],vn.prototype,"statisticsType",void 0),vn=An=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunctionArguments")],vn);const Cn=vn;let bn=class extends w{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();s.pixelType=this.outputPixelType;const{statisticsType:n}=this.functionArguments;return"stddev"===n&&this._removeStatsHistColormapVAT(s),this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3&&t<5}}_processPixels(t){const e=t.pixelBlocks?.[0];if(null==e)return e;const{statisticsType:s,rows:n,cols:r,fillNoDataOnly:o}=this.functionArguments;return function(t,e){const{mask:s}=t,{fillNoDataOnly:n}=e;if(n&&!s)return t;const{pixels:r,width:o,height:i,bandMasks:a,pixelType:u}=t,l=r.length,c=o*i,p=[],{kernelRows:h,kernelCols:m,statisticsType:d,mirrorEdges:f}=e;if(n&&!s)return t;const y=e.outputPixelType??u,x=[];for(let t=0;t<l;t++){const u=r[t],l=g.A.createEmptyBand(y,c);n&&l.set(u);const w=a?.[t]??s,A=w?.slice()??null,v={band:u,width:o,height:i,mask:A,outBand:l};switch(d){case"min":case"max":yn(v,e);break;case"mean":case"stddev":fn(v,e);break;case"median":xn(v,e);break;case"majority":case"minority":wn(v,e)}f&&!n&&Qe(l,o,i,h,m),p.push(l),A&&x.push(A)}let w=x[0]??s;x.length!==l&&(x.length=0),l>1&&a?.length&&(w=g.A.combineBandMasks(a));const A=new g.A({pixelType:y,width:o,height:i,pixels:p,bandMasks:a&&x.length?x:null,mask:w});return A.updateStatistics(),A}(e,{kernelRows:n,kernelCols:r,fillNoDataOnly:o,outputPixelType:this.outputPixelType,statisticsType:s,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:s,fillNoDataOnly:n}=this.functionArguments;return{fillNoDataOnly:n,kernelRows:t,kernelCols:e,statisticsType:s,clampRange:(0,u.hP)(this.outputPixelType)}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],bn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Cn,json:{write:!0,name:"rasterFunctionArguments"}})],bn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],bn.prototype,"rasterArgumentNames",void 0),bn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsFunction")],bn);const Mn=bn;var Tn;let Pn=Tn=class extends p{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(t,e){if(!t?.length)return null;const s=[];return t.forEach(t=>{const e={min:t.min,max:t.max,avg:t.avg??t.mean,stddev:t.stddev??t.standardDeviation};s.push(e)}),s}writeStatistics(t,e,s){if(!t?.length)return;const n=[];t.forEach(t=>{const e={...t,mean:t.avg,standardDeviation:t.stddev};delete e.avg,delete e.stddev,n.push(e)}),e[s]=n}clone(){return new Tn({statistics:(0,o.o8)(this.statistics),histograms:(0,o.o8)(this.histograms)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Pn.prototype,"statistics",void 0),(0,i.Cg)([(0,ye.w)("statistics")],Pn.prototype,"readStatistics",null),(0,i.Cg)([(0,Se.K)("statistics")],Pn.prototype,"writeStatistics",null),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Pn.prototype,"histograms",void 0),Pn=Tn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunctionArguments")],Pn);const Nn=Pn;let In=class extends w{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:s,histograms:n}=this.functionArguments;return n&&(e.histograms=n),s&&(e.statistics=s),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],In.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Nn,json:{write:!0,name:"rasterFunctionArguments"}})],In.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],In.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],In.prototype,"indexedColormap",void 0),(0,i.Cg)([(0,a.MZ)()],In.prototype,"isNoopProcess",void 0),In=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StatisticsHistogramFunction")],In);const Rn=In;var Fn;const kn=new Dt.J({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let _n=Fn=class extends p{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(t,e,s){t?.length&&(Array.isArray(t[0])||(t=t.map(t=>[t.min,t.max,t.avg,t.stddev])),e[s]=t)}clone(){return new Fn({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:(0,o.o8)(this.statistics),gamma:(0,o.o8)(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:(0,o.o8)(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],_n.prototype,"computeGamma",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{name:"dra",write:!0}})],_n.prototype,"dynamicRangeAdjustment",void 0),(0,i.Cg)([(0,a.MZ)({type:[Number],json:{write:!0}})],_n.prototype,"gamma",void 0),(0,i.Cg)([(0,a.MZ)()],_n.prototype,"histograms",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"maxPercent",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"minPercent",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"numberOfStandardDeviations",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"max",write:!0}})],_n.prototype,"outputMax",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{name:"min",write:!0}})],_n.prototype,"outputMin",void 0),(0,i.Cg)([(0,a.MZ)({type:Number,json:{write:!0}})],_n.prototype,"sigmoidStrengthLevel",void 0),(0,i.Cg)([(0,a.MZ)({json:{type:[[Number]],write:!0}})],_n.prototype,"statistics",void 0),(0,i.Cg)([(0,Se.K)("statistics")],_n.prototype,"writeStatistics",null),(0,i.Cg)([(0,Qt.e)(kn)],_n.prototype,"stretchType",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean,json:{write:!0}})],_n.prototype,"useGamma",void 0),_n=Fn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunctionArguments")],_n);const Sn=_n;let Bn=class extends w{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:s}=this,{dynamicRangeAdjustment:n,gamma:r,useGamma:o}=s;if(!n&&["u8","u16","s8","s16"].includes(e)){const n=(0,qe.DP)(s.toJSON(),{rasterInfo:t}),i=(0,u.zw)(this.outputPixelType)?"round":"float";this.lookup=(0,qe.RP)({pixelType:e,...n,gamma:o?r:null,rounding:i}),this.cutOffs=n}else n||(this.cutOffs=(0,qe.DP)(s.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const i=t.clone();i.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(i),"u8"===this.outputPixelType&&(i.keyProperties.DataType="processed");const{outputMin:a=0,outputMax:l=255}=this.functionArguments;i.statistics=[];for(let t=0;t<i.bandCount;t++)i.statistics[t]={min:a,max:l};return this.rasterInfo=i,{success:!0,supportsGPU:!n}}_processPixels(t,e){const s=t.pixelBlocks?.[0];if(null==s)return s;const{lookup:n}=this;if(n)return(0,Kt.eH)(s,{...n,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:r}=this,o=e?.stretchCutoff??this.cutOffs??(0,qe.DP)(r.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:s}),i=r.useGamma?r.gamma:null;return(0,qe._N)(s,{...o,gamma:i,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:s,useGamma:n}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,o=n&&s?.length?(0,qe.Nh)(r,s):[1,1,1],{minCutOff:i,maxCutOff:a}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};1===i.length&&(i[1]=i[2]=i[0],a[1]=a[2]=a[0]);const l=a.map((s,n)=>(e-t)/(a[n]-i[n])),c=(0,u.zw)(this.outputPixelType),p=n&&s?[s[0],s[1]??s[0],s[2]??s[0]]:[1,1,1],h=n?[o[0],o[1]??o[0],o[2]??o[0]]:[1,1,1];return{bandCount:r,minOutput:t,maxOutput:e,minCutOff:i,maxCutOff:a,factor:l,useGamma:n,gamma:p,gammaCorrection:h,stretchType:this.functionArguments.stretchType,isOutputRounded:c,type:"stretch"}}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],Bn.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Sn,json:{write:!0,name:"rasterFunctionArguments"}})],Bn.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],Bn.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Bn.prototype,"lookup",void 0),(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],Bn.prototype,"cutOffs",void 0),Bn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.StretchFunction")],Bn);const jn=Bn;var Zn;let zn=Zn=class extends p{constructor(){super(...arguments),this.attributeTableAsRecordSet=null}clone(){return new Zn({attributeTableAsRecordSet:(0,o.o8)(this.attributeTableAsRecordSet)})}};(0,i.Cg)([(0,a.MZ)({json:{write:!0}})],zn.prototype,"attributeTableAsRecordSet",void 0),zn=Zn=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunctionArguments")],zn);const Gn=zn;let On=class extends w{constructor(){super(...arguments),this.functionName="Table",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1||t.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};const{attributeTableAsRecordSet:e}=this.functionArguments;if(!e)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(t.pixelType);const s=t.clone();return s.pixelType=this.outputPixelType,s.bandCount=1,"thematic"!==s.dataType&&(s.keyProperties=s.keyProperties?{...s.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){return t.pixelBlocks?.[0]}};(0,i.Cg)([(0,a.MZ)({json:{write:!0,name:"rasterFunction"}})],On.prototype,"functionName",void 0),(0,i.Cg)([(0,a.MZ)({type:Gn,json:{write:!0,name:"rasterFunctionArguments"}})],On.prototype,"functionArguments",void 0),(0,i.Cg)([(0,a.MZ)()],On.prototype,"rasterArgumentNames",void 0),(0,i.Cg)([(0,a.MZ)()],On.prototype,"isNoopProcess",void 0),On=(0,i.Cg)([(0,a.$K)("esri.layers.raster.functions.TableFunction")],On);const Dn=On,En=new Map;function Vn(t,e){const{rasterFunctionArguments:s}=t;s&&(s.rasters||[s.raster,s.raster2]).forEach(t=>{t&&"number"!=typeof t&&("string"==typeof t?t.startsWith("http")&&(e.includes(t)||e.push(t)):"rasterFunctionArguments"in t&&Vn(t,e))})}function Un(t,e){e=e??{};try{if("function"in(t=(0,o.o8)(t))&&"arguments"in t&&t.arguments){const s=Jn(t,new Map,e);if(Qn(s),!s.renderingRule)throw new r.A("raster-function-helper","Unsupported raster function json.");t=s.renderingRule}if("rasterFunction"in t){const s=Kn(t=$n(t),e);return s.isRoot=!0,s}}catch{}throw new r.A("raster-function-helper","unsupported raster function json.")}function Ln(t){return!!(t&&"object"==typeof t&&t.rasterFunction&&t.rasterFunctionArguments)}function $n(t){const{rasterFunction:e,rasterFunctionArguments:s}=t,n={};for(const t in s){let e=s[t];const r=t.toLowerCase();if("rasters"===r&&Array.isArray(e))n.rasters=e.map(t=>Ln(t)?$n(t):t);else switch(Ln(e)&&(e=$n(e)),r){case"dra":n.dra=e;break;case"pspower":n.psPower=e;break;case"pszfactor":n.psZFactor=e;break;case"bandids":n.bandIds=e;break;default:n[t[0].toLowerCase()+t.slice(1)]=e}}return"Local"!==e||n.rasters?.length||(n.rasters=["$$"]),{...t,rasterFunctionArguments:n}}function Kn(t,e){const{rasterFunction:s,rasterFunctionArguments:n}=t,o=t.outputPixelType?.toLowerCase();if(null==s||!En.has(s))throw new r.A("raster-function-helper",`unsupported raster function: ${s}`);const i=En.get(s),a=("function"==typeof i.ctor?i.ctor:i.ctor.default).fromJSON({...t,outputPixelType:o}),{rasterArgumentNames:u}=a,l=[],c=function(t,e){return"rasters"===e[0]&&Array.isArray(t.rasters)?t.rasters:e.map(e=>t[e])}(n,u),p="rasters"===u[0]||u.length>1,h=[];for(let t=0;t<c.length;t++){const s=c[t];let n;null==s||"string"==typeof s&&s.startsWith("$")?l.push(e?.raster):"string"==typeof s?e[s]&&l.push(e[s]):"number"!=typeof s&&"rasterFunction"in s&&(n=Kn(s,e),p||(a.functionArguments[u[t]]=n),l.push(n)),p&&h.push(n??s)}if(p&&("rasters"===u[0]?a.functionArguments.rasters=h:u.forEach((t,e)=>{a.functionArguments[t]=h[e]})),e){a.sourceRasters=l;const t=e.raster?.url;t&&(a.mainPrimaryRasterId=t)}return a}function Wn(t,e){if(t&&e)for(const s in t){const n=t[s];n&&"object"==typeof n&&"type"in n&&("RasterFunctionTemplate"===n.type?Wn(n.arguments,e):"RasterFunctionVariable"===n.type&&null!=e[n.name]&&(n.value=e[n.name]))}}function Hn(t,e){if(!t||"object"!=typeof t)return t;const{value:s}=t;if(!s||"object"!=typeof s)return t.isDataset?"$$":s;if(Array.isArray(s))return 0===s.length?[]:s.map(t=>t&&"object"==typeof t&&"RasterFunctionVariable"===t.type?Hn(t,e):t);if("value"in s&&["number","string","boolean"].includes(typeof s.value))return s.value;if(t.isDataset&&"Scalar"!==s.type)return"$$";if(!("type"in s))return s;let n=s;switch(s.type){case"Scalar":n=s.value;break;case"AlgorithmicColorRamp":n=qn(s);break;case"MultiPartColorRamp":n={type:"multipart",colorRamps:s.ArrayOfColorRamp.map(qn)};break;case"ArgumentArray":if(s.elements?.length&&"RasterStatistics"!==s.elements[0].type){const t=[];for(let n=0;n<s.elements.length;n++){const o=s.elements[n],{type:i}=o;if(i)if("RasterFunctionTemplate"===i){const{renderingRule:s}=Jn(o,e);t.push(s),null!=o._object_id&&e.set(o._object_id,s)}else{if("RasterFunctionVariable"!==i)throw new r.A("raster-function-helper","unsupported raster function json.");{const s=Hn(o,e);t.push(s),null!=o._object_id&&e.set(o._object_id,s)}}else t.push(o)}n=t}else n=s.elements}return null!=s._object_id&&e.set(s._object_id,n),n}function qn(t){const e=t.algorithm??"esriHSVAlgorithm";let{FromColor:s,ToColor:r}=t;if(!Array.isArray(s)){const{r:t,g:e,b:r}=(0,n.$)({h:s.Hue,s:s.Saturation,v:s.Value});s=[t,e,r,s.AlphaValue]}if(!Array.isArray(r)){const{r:t,g:e,b:s}=(0,n.$)({h:r.Hue,s:r.Saturation,v:r.Value});r=[t,e,s,r.AlphaValue]}return{type:"algorithmic",algorithm:e,fromColor:s,toColor:r}}function Jn(t,e,s){s&&Wn(t,s);const n={renderingRule:{},templates:e};return Xn(t,n),n}function Xn(t,e){if(!t||!e.renderingRule)return;const{renderingRule:s,templates:n}=e,{function:r,arguments:o,_object_id:i}=t;if(!r||!o)return;null!=i&&n.set(i,s),s.rasterFunction=r.type.replace("Function",""),s.outputPixelType=r.pixelType;const a={};s.rasterFunctionArguments=a;for(const t in o){if("type"===t||"object_id"===t||"_object_ref_id"===t)continue;const e=o[t];e&&"object"==typeof e&&"type"in e&&("RasterFunctionTemplate"===e.type||"RasterFunctionVariable"===e.type)?("RasterFunctionVariable"===e.type?a[t]=Hn(e,n):(s.rasterFunctionArguments[t]={},Xn(e,{renderingRule:s.rasterFunctionArguments[t],templates:n})),null!=e._object_id&&n.set(e._object_id,a[t])):a[t]=e}switch(a.DEM&&!a.Raster&&(a.Raster=a.DEM,delete a.DEM),s.rasterFunction){case"Stretch":!function(t){t.Statistics?.length&&"object"==typeof t.Statistics&&(t.Statistics=t.Statistics.map(t=>[t.min,t.max,t.mean,t.standardDeviation])),null!=t.NumberOfStandardDeviation&&(t.NumberOfStandardDeviations=t.NumberOfStandardDeviation,delete t.NumberOfStandardDeviation)}(a);break;case"Colormap":!function(t){"randomcolorramp"===t.ColorRamp?.type?.toLowerCase()&&(delete t.ColorRamp,t.ColormapName="Random"),0===t.ColorSchemeType&&delete t.ColorRamp}(a);break;case"Convolution":!function(t){null!=t.ConvolutionType&&(t.Type=t.ConvolutionType,delete t.ConvolutionType)}(a);break;case"Mask":!function(t){t.NoDataValues?.length&&"string"==typeof t.NoDataValues[0]&&(t.NoDataValues=t.NoDataValues.filter(t=>""!==t).map(t=>Number(t)))}(a)}}function Qn(t){const{renderingRule:e,templates:s}=t;if("object"!=typeof e||!e?.rasterFunctionArguments||!s.size)return;const{rasterFunctionArguments:n}=e;for(const t in n){const e=n[t],o="_object_ref_id"===t?e:e&&"object"==typeof e&&"_object_ref_id"in e?e._object_ref_id:null;if(null!=o){if(!s.has(o))throw new r.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${o} does not exist`);const e=s.get(o);"_object_ref_id"!==t?n[t]=e:e&&"object"==typeof e&&Object.assign(n,e);continue}e&&"object"==typeof e&&(e.rasterFunctionArguments&&Qn({renderingRule:e,templates:s}),Array.isArray(e)&&e.forEach((t,n)=>{if(t&&"object"==typeof t)if(null!=t._object_ref_id){if(!s.has(t._object_ref_id))throw new r.A("raster-function-helper",`unsupported raster function json. _object_ref_id: ${e} does not exist`);const i=s.get(o);i&&"object"==typeof i?Object.assign(t,i):e[n]=i}else Qn({renderingRule:t,templates:s})}))}}En.set("Arithmetic",{desc:"Arithmetic Function",ctor:St,rasterArgumentNames:["rasters"]}),En.set("Aspect",{desc:"Aspect Function",ctor:Ot,rasterArgumentNames:["raster"]}),En.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:ne,rasterArgumentNames:["raster"]}),En.set("Colormap",{desc:"Colormap Function",ctor:Me,rasterArgumentNames:["raster"]}),En.set("ColormapToRGB",{desc:"ColormapToRGB Function",ctor:ke,rasterArgumentNames:["raster"]}),En.set("CompositeBand",{desc:"CompositeBand Function",ctor:ze,rasterArgumentNames:["rasters"]}),En.set("ComputeChange",{desc:"ComputeChange Function",ctor:$e,rasterArgumentNames:["rasters"]}),En.set("Convolution",{desc:"Convolution Function",ctor:is,rasterArgumentNames:["raster"]}),En.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:Xe,rasterArgumentNames:["raster"]}),En.set("ExtractBand",{desc:"ExtractBand Function",ctor:ys,rasterArgumentNames:["raster"]}),En.set("Curvature",{desc:"Curvature Function",ctor:hs,rasterArgumentNames:["raster"]}),En.set("Hillshade",{desc:"Hillshade Function",ctor:Fs,rasterArgumentNames:["raster"]}),En.set("ShadedRelief",{desc:"ShadedRelief Function",ctor:sn,rasterArgumentNames:["raster"]}),En.set("Grayscale",{desc:"Grayscale Function",ctor:bs,rasterArgumentNames:["raster"]}),En.set("Clip",{desc:"Clip Function",ctor:me,rasterArgumentNames:["raster"]}),En.set("Local",{desc:"Local Function",ctor:js,rasterArgumentNames:["rasters"]}),En.set("Mask",{desc:"Mask Function",ctor:Es,rasterArgumentNames:["raster"]}),En.set("NDVI",{desc:"NDVI Function",ctor:Ks,rasterArgumentNames:["raster"]}),En.set("Remap",{desc:"Remap Function",ctor:Xs,rasterArgumentNames:["raster"]}),En.set("Slope",{desc:"Slope Function",ctor:ln,rasterArgumentNames:["raster"]}),En.set("SpectralConversion",{desc:"Spectral Conversion",ctor:dn,rasterArgumentNames:["raster"]}),En.set("Statistics",{desc:"Focal Statistics Function",ctor:Mn,rasterArgumentNames:["raster"]}),En.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Rn,rasterArgumentNames:["raster"]}),En.set("Stretch",{desc:"Stretch Function",ctor:jn,rasterArgumentNames:["raster"]}),En.set("Table",{desc:"Attribute Table Function",ctor:Dn,rasterArgumentNames:["raster"]})}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2806],{82806(e,t,i){i.d(t,{b:()=>k});var r=i(5482),n=i(11254),s=i(49186),a=i(53966),o=i(91429),l=i(56507),c=i(86738),u=i(16930),d=i(21325),h=i(7548),m=i(23636),p=i(4366),f=i(34930),y=i(99235),g=i(37373),R=i(51927),b=i(60694),w=i(10873),x=i(45617),I=i(43577),F=i(13868),S=i(22796),v=i(69409),_=i(87045),C=i(12711),J=i(85676),A=i(94359),D=i(22048),P=i(49410),M=i(34606),H=i(29127),N=i(93223),T=i(36005);const k=e=>{const t=e;let k=class extends t{constructor(...e){super(...e),this._draRasterConfig=null,this._isConstructedFromFunctionRaster=!1,this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=(0,h.qg)(e[0]?.raster)}destroy(){this._draRasterConfig?.rasterJobHandler?.destroy(),this._shutdownJobHandler()}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()}set url(e){this._set("url",(0,b.Jf)(e,a.A.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer;return(0,A.LF)(r,i)||void 0}async computeStatisticsHistograms(e,t){await this.load(t),e=(0,l.PZ)(D.A,e).clone();const{serviceRasterInfo:i}=this;if(null==i)throw new s.A("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:r}=e;if(null==r)throw new s.A("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=r;const{spatialReference:a}=i;if(!r.spatialReference.equals(a)){await(0,g.Hh)();const e="extent"===r.type?(0,g._l)(r,a):(0,g.uk)(r,a);if(null==e)throw new s.A("imagery-tile-mixin:compute-statistics-histograms","geometry cannot be projected to the data source");n=e}const o=e.pixelSize??new c.A({x:i.pixelSize.x,y:i.pixelSize.y,spatialReference:a}),{extent:u,width:d,height:h}=(0,f.b7)(i,n,o),m=await this.fetchPixels(u,d,h,{...t,interpolation:"nearest"});if(null==m.pixelBlock)throw new s.A("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const p=await(0,f.$Q)(m.pixelBlock,u,n),y=this._rasterJobHandler;return y?y.computeStatisticsHistograms({pixelBlock:p},t):(0,R.eH)(p)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const i=(0,p.XU)({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:i,timeExtent:void 0}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t,renderer:i}=this;if(!e||!t||!i)return;const{rasterInfo:r}=this.raster,n=(0,p.ct)(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=n?.name,a=(0,C.m7)(r,s);return this._updateSymbolizer(t,i,s,a)}async applyRenderer(e,t,i){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;await this.updateRenderer();const n=this.bandIds??[],{pixelBlock:s}=await this._symbolize({pixelData:e,simpleStretchParams:t,bandIds:n,symbolizer:this.symbolizer},i);return s}getRawDisplayBandIds(){let{bandIds:e,raster:t}=this;if(this.rasterFunction&&(0,h.qg)(t)){const i=t.rasterFunction.rawInputBandIds;e=e?.length&&i?.length&&1!==t.rasterInfo.bandCount?e.map(e=>i[Math.min(e,i.length-1)]):i}return e&&e.length>3&&e.every((e,t)=>e===t)?null:e}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 r=(0,d.Vp)(e);return _.A.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,i,r={}){if(z(this),r.requestAsImageElement){const s=this.getTileUrl(e,t,i);return(0,n.A)(s,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:r.signal}).then(e=>e.data)}const{serviceRasterInfo:s}=this;if(null!=s.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition){const n=r.tileInfo||s.storageInfo.tileInfo,a=this.raster.getTileExtentFromTileInfo(e,t,i,n);if(a)return{extent:a,pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(r={...r,buffer:{cols:1,rows:1}}),r={...r,refreshParameters:this.refreshParameters},this.raster.fetchTile(e,t,i,r)}async fetchPixels(e,t,i,r={}){if(null!=this.serviceRasterInfo.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition)return{extent:e,pixelBlock:null};await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i);const n=await this.raster.fetchPixels(e,t,i,r);return r.bandIds?.length&&!this.raster.rasterInfo.storageInfo.isBsqTile&&(n.pixelBlock=n.pixelBlock?.extractBands(r.bandIds)),n}async getSamples(e,t){await this.load();const i=(0,l.PZ)(M.A,e).clone();if(i.interpolation&&"nearest"!==i.interpolation)throw new s.A("imagery-tile-mixin:get-samples","only nearest interpolation is currently supported");const r=i.mosaicRule?.multidimensionalDefinition,n={...t,multidimensionalDefinition:r},a=(await this._getSampleLocations(i)).map(e=>this.identify(e,n).then(t=>(t.location=e,t))),o=(await Promise.all(a)).flatMap((e,t)=>this._convertRasterIdentifyResultToSample(e,t));return new H.A({samples:o})}async identify(e,t={}){await this.load();const i=(0,l.PZ)(c.A,e).clone().normalize(),{raster:r,serviceRasterInfo:n}=this;if(null!=n?.multidimensionalInfo&&(!n.hasMultidimensionalTranspose||!(0,p.DY)(t.multidimensionalDefinition)&&!t.transposedVariableName)&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:i,value:null};const a=this.multidimensionalSubset?.areaOfInterest;if(a&&!a.contains(i))throw new s.A("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");let o;if(this.serviceRasterInfo?.storageInfo.isBsqTile){const e=(0,h.qg)(r)?this.getRawDisplayBandIds():this.bandIds;o=e?.length?e:void 0}return r.identify(i,{...t,bandIds:o})}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((0,p.$E)(e)).toISOString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return(0,p.z2)(this.multidimensionalSubset,t)}async getDynamicRangeInputRaster(){if(!this.rasterFunction||!(0,h.qg)(this.raster)||!this._cachedRasterFunctionJson)return null;const e=JSON.stringify(this._cachedRasterFunctionJson);if(this._draRasterConfig?.functionJson===e)return this._draRasterConfig;const t=this.raster.rasterFunction.queryRasterFunction(e=>"Stretch"===e.functionName&&e.functionArguments.dynamicRangeAdjustment);if(!t)return null;const i=t.toJSON(),r=this.raster.primaryRasters.rasters,n=t.functionArguments.raster,s=i.rasterFunctionArguments;if(!n||"object"!=typeof n||!("functionName"in n))return this._draRasterConfig={functionJson:e,raster:r[0],functionArguments:s,rasterJobHandler:this._draRasterConfig?.rasterJobHandler},this._draRasterConfig;const a={raster:r[0]};r.length>1&&r.forEach(e=>a[e.url]=e);const o=(0,y.vt)(n.toJSON(),a),l=new m.A({rasterFunction:o});await l.open();let c=this._draRasterConfig?.rasterJobHandler;try{c||(c=new v.A,await c.initialize()),l.rasterJobHandler=c,await l.syncJobHandler()}catch{}return this._draRasterConfig={functionJson:e,raster:l,functionArguments:s,rasterJobHandler:c},this._draRasterConfig}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,p.fy)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&(0,h.qg)(this.raster)&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}async _initJobHandler(){if(!this._rasterJobHandler)return super._initJobHandler().then(async()=>{if(!this._rasterJobHandler)return;z(this);const{raster:e}=this;e.rasterJobHandler=this._rasterJobHandler,(0,h.qg)(e)&&e.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch(()=>{}),this.renderer&&this.updateRenderer()}).catch(()=>{})}_shutdownJobHandler(){super._shutdownJobHandler(),this.raster&&(this.raster.rasterJobHandler=null)}async _getSampleLocations(e){const{geometry:t}=e;if("point"===t.type)return[t];const{spatialReference:r,type:n}=t;if("multipoint"===n)return t.points.map(e=>new c.A({x:e[0],y:e[1],spatialReference:r}));if("polyline"===n){let n=t;if(e.sampleCount||e.sampleDistance){const r=await Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(2261)]).then(i.bind(i,88411)),s=(await Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(2174)]).then(i.bind(i,965))).execute(t,{unit:"meters"}),a=Math.min(e.sampleCount||100,1e3);let o=e.sampleDistance;o||(o=s/(a+(2===n.paths[0].length?1:0))),n=r.execute(t,o,{unit:"meters"})}return n.paths.flatMap(e=>e.map(e=>new c.A({x:e[0],y:e[1],spatialReference:r})))}const s=Math.min(e.sampleCount||100,1e3),a="extent"===t.type,o=a?t:t.extent,l=Math.sqrt(o.width*o.height/s),u=o.height/l,d=o.width/l,{xmin:h,ymax:m}=o,p=[];for(let e=0;e<u;e++)for(let i=0;i<d;i++){const n=new c.A({x:h+(i+.5)*l,y:m-(e+.5)*l,spatialReference:r});(a||t.contains(n))&&p.push(n)}return p}_configDefaultInterpolation(){if(null==this.interpolation){z(this);const{raster:e}=this,t=(0,C.w6)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){z(this);const{rasterInfo:t}=this.raster,i=(0,p.ct)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),r=i?.name,n=(0,C.I8)({variableName:r,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??(0,C.ci)(t)),!this.renderer||"override"===e){const e=(0,C.Mm)(this.raster),i=n?.renderer??(0,C.PD)(t,{bandIds:this.bandIds,variableName:r,rasterFunctionColorRamp:e}),s=t.statistics,a=s&&s.length>0?s[0]:null,o=a?.max??0,l=a?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===i.type&&(o>1e24||l<-1e24)&&(i.dynamicRangeAdjustment=!0,i.customStatistics=null,"none"===i.stretchType&&(i.stretchType="min-max")),this.renderer=i}const s=(0,C.$P)({...this.renderer.toJSON(),variableName:r}),o=(0,C.m7)(t,r);this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=o):this.symbolizer=new J.A({rendererJSON:s,rasterInfo:o});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,C.PD)(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.customStatistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else a.A.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&(0,h.qg)(this.raster)){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",S.A.fromJSON(e)))}let e,t=this.raster,i=!1;(0,h.qg)(t)?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:r}=this;if(r){const i={raster:t};e.length>1&&e.forEach(e=>i[e.url]=e);const n=(0,y.vt)(r.functionDefinition?.toJSON()??r.toJSON(),i),s=new m.A({rasterFunction:n});s.rasterJobHandler=this._rasterJobHandler,await s.open(),this.raster=s}else this.raster=t,await t.open();if(this._cachedRendererJson=void 0,!i&&!r)return;const{bandIds:n}=this,{bandCount:s}=this.raster.rasterInfo,a=n?.length?n.some(e=>e>=s):s>=3;n&&(a||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}_convertRasterIdentifyResultToSample(e,t){const{rasterInfo:i}=this.raster,r=i.storageInfo.pyramidScalingFactor**(e.pyramidLevel??0),n=(i.pixelSize.x+i.pixelSize.y)/2*r;if(!e.dataSeries?.length)return[new P.A({location:e.location,pixelValue:e.value,locationId:t,resolution:n})];const s=[];return e.dataSeries.forEach(({value:i,multidimensionalDefinition:r},a)=>{const o={Variables:r[0].variableName,Dimensions:r.flatMap(({dimensionName:e})=>e).join(",")};for(const{dimensionName:e,values:t}of r){o[e]=Array.isArray(t[0])?t[0][0]:t[0];const i=t[t.length-1];o[`${e}_Max`]=Array.isArray(i)?i[i.length-1]:i}const l=new P.A({location:e.location,pixelValue:i,rasterId:a,locationId:t,resolution:n,attributes:o});s.push(l)}),s}};function z(e){if(!e.raster||!e.serviceRasterInfo)throw new s.A("imagery-tile","no raster")}return(0,r.Cg)([(0,o.MZ)({clonable:!1})],k.prototype,"_cachedRasterFunctionJson",void 0),(0,r.Cg)([(0,o.MZ)({clonable:!1})],k.prototype,"_compatibleFullExtent",void 0),(0,r.Cg)([(0,o.MZ)({clonable:!1})],k.prototype,"_draRasterConfig",void 0),(0,r.Cg)([(0,o.MZ)({clonable:!1})],k.prototype,"_isConstructedFromFunctionRaster",void 0),(0,r.Cg)([(0,o.MZ)({clonable:!1})],k.prototype,"_rasterFunctionUpdatePromise",void 0),(0,r.Cg)([(0,o.MZ)({type:[l.jz],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],k.prototype,"bandIds",void 0),(0,r.Cg)([(0,o.MZ)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],k.prototype,"copyright",void 0),(0,r.Cg)([(0,o.MZ)({json:{read:!1}})],k.prototype,"fullExtent",null),(0,r.Cg)([(0,o.MZ)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,N.e)(F.SZ)],k.prototype,"interpolation",void 0),(0,r.Cg)([(0,o.MZ)()],k.prototype,"ioConfig",void 0),(0,r.Cg)([(0,o.MZ)({type:[x.A],json:{write:!0}})],k.prototype,"multidimensionalDefinition",null),(0,r.Cg)([(0,o.MZ)({type:I.A,json:{write:!0}})],k.prototype,"multidimensionalSubset",void 0),(0,r.Cg)([(0,o.MZ)()],k.prototype,"raster",void 0),(0,r.Cg)([(0,o.MZ)({type:S.A})],k.prototype,"rasterFunction",null),(0,r.Cg)([(0,o.MZ)()],k.prototype,"serviceRasterInfo",void 0),(0,r.Cg)([(0,o.MZ)()],k.prototype,"sourceJSON",void 0),(0,r.Cg)([(0,o.MZ)({readOnly:!0,type:u.A,json:{read:!1}})],k.prototype,"spatialReference",void 0),(0,r.Cg)([(0,o.MZ)({type:_.A})],k.prototype,"tileInfo",void 0),(0,r.Cg)([(0,o.MZ)(w.OZ)],k.prototype,"url",null),(0,r.Cg)([(0,o.MZ)({types:A.uy})],k.prototype,"renderer",null),(0,r.Cg)([(0,o.MZ)({types:A.uy,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:A.Gj,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],k.prototype,"internalRenderer",null),(0,r.Cg)([(0,T.w)("internalRenderer")],k.prototype,"readRenderer",null),(0,r.Cg)([(0,o.MZ)({clonable:!1})],k.prototype,"symbolizer",void 0),k=(0,r.Cg)([(0,o.$K)("esri.layers.mixins.TiledImagery")],k),k}},23636(e,t,i){i.d(t,{A:()=>h});var r=i(5482),n=i(49186),s=i(91429),a=i(39829),o=i(49859),l=i(34930),c=i(47520),u=i(37373),d=i(22671);let h=class extends o.A{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null,this._clippingGeometry=new Map}async fetchPixels(e,t,i,r={}){const{rasters:n,rasterIds:s}=this.primaryRasters;let a=!1;const{interpolation:o}=r,u=this.rasterFunction.flatWebGLFunctionChain?.hasFocalFunction;!r.requestRawData&&u&&(a=1===n.length&&!r.skipRasterFunction,r={...r,interpolation:"bilinear",requestRawData:a}),r.requestRawData&&n.length>1&&!this.hasUniqueSourceStorageInfo&&(a=!1,r={...r,requestRawData:!1});const d=n.map(n=>n.fetchPixels(e,t,i,r)),h=await Promise.all(d),m=h.map(e=>e.pixelBlock),p=a||r.requestRawData?h.map(e=>e.srcTilePixelSize):null;if(r.skipRasterFunction||m.every(e=>null==e))return h[0];const f=h.find(e=>null!=e.pixelBlock)?.extent??e;let y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:f,primaryPixelBlocks:m,primaryPixelSizes:p,primaryRasterIds:s,parameters:this.processParameters}):this.rasterFunction.process({extent:f,primaryPixelBlocks:m,primaryPixelSizes:p,primaryRasterIds:s},this.processParameters);const{transformGrid:g}=h[0];if(!a||null==y||null==g){const e=r.noClip?null:this.getClippingGeometry(f.spatialReference);return!r.noClip&&null!=y&&e&&(y=await(0,l.$Q)(y,f,e)),{...h[0],pixelBlock:y}}const R={rows:g.spacing[0],cols:g.spacing[1]};let b;b=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:t,height:i},coefs:g.coefficients,sampleSpacing:R,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},r)).pixelBlock:(0,c.$i)(y,{width:t,height:i},g.coefficients,R,o);const w=r.noClip?null:this.getClippingGeometry(e.spatialReference);return r.noClip||null==b||null==w||(b=await(0,l.$Q)(b,e,w)),{extent:e,srcExtent:h[0].srcExtent,pixelBlock:b,srcTilePixelSize:h[0].srcTilePixelSize}}getClippingGeometry(e){const t=this._clippingGeometry.get("0");if(!e||!t)return t;const i=function(e){return String(e.wkid??e.wkt??e.wkt2)}(e);let r=this._clippingGeometry.get(i);return null!=r||(r=e.equals(t.spatialReference)?t:(0,u.uk)(t,e),this._clippingGeometry.set(i,r)),r}async _open(e){const{rasterFunction:t}=this;t.isRoot=!0,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:r}=this.primaryRasters,s=i.map(t=>t.rasterInfo?void 0:t.open(e));await Promise.all(s);const a=i.map(({rasterInfo:e})=>e),o=t.bind({rasterInfos:a,rasterIds:r});if(t.rawSourceRasterInfos=a,!o.success||0===a.length)throw new n.A("raster-function:open",`cannot bind the function: ${o.error??""}`);const l="Table"===t.functionName?t:t.functionArguments?.raster;"Table"===l?.functionName&&(t.rasterInfo.attributeTable=d.A.fromJSON(l.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=a[0];this.hasUniqueSourceStorageInfo=1===a.length||a.slice(1).every(e=>function(e,t){const{storageInfo:i,pixelSize:r,spatialReference:n,extent:s}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return r.x===o.x&&r.y===o.y&&n.equals(l)&&s.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel&&i.firstPyramidLevel===a.firstPyramidLevel&&i.pyramidBlockWidth===a.pyramidBlockWidth&&i.pyramidBlockHeight===a.pyramidBlockHeight&&i.pyramidScalingFactor===a.pyramidScalingFactor}(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 _updateClipGeometry(){const e=this.rasterFunction.getClippingGeometries()[0];let t=e?.clippingGeometry;if(t&&"inside"===e.clippingType){const{extent:e}=this.rasterInfo,r=await Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(2261)]).then(i.bind(i,88411)),n=await Promise.all([i.e(3661),i.e(1878),i.e(8885),i.e(5756),i.e(3299),i.e(9598)]).then(i.bind(i,93054));let s=r.execute(a.A.fromExtent(e),2*(e.width+e.height)/40);s=(0,u.uk)(s,t.spatialReference),t=n.execute(s,t)}this._clippingGeometry.clear(),t&&this._clippingGeometry.set("0",t)}};(0,r.Cg)([(0,s.MZ)({type:String,json:{write:!0}})],h.prototype,"datasetFormat",void 0),(0,r.Cg)([(0,s.MZ)()],h.prototype,"tileType",void 0),(0,r.Cg)([(0,s.MZ)()],h.prototype,"rasterFunction",void 0),(0,r.Cg)([(0,s.MZ)()],h.prototype,"processParameters",void 0),(0,r.Cg)([(0,s.MZ)()],h.prototype,"primaryRasters",void 0),h=(0,r.Cg)([(0,s.$K)("esri.layers.raster.datasets.FunctionRaster")],h)}}]);
|