@arcgis/core 5.2.0-next.34 → 5.2.0-next.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/analysis/Viewshed.d.ts +0 -5
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{4316b78fc36bfd893a90.js → 155940ef3d1888272d73.js} +1 -1
  4. package/assets/esri/core/workers/chunks/24aa98cb2021ddd789ce.js +1 -0
  5. package/assets/esri/core/workers/chunks/406c7723e8db470822bf.js +1 -0
  6. package/assets/esri/core/workers/chunks/{37dc6a8495f1f44e2d45.js → 6c746ac4bd2e57b8cb41.js} +1 -1
  7. package/assets/esri/core/workers/chunks/8a9b2efa0603e9fa4e8b.js +1 -0
  8. package/assets/esri/core/workers/chunks/{fe8032905992e6574714.js → 9fb0431b0628dcb53004.js} +54 -54
  9. package/assets/esri/core/workers/chunks/{87c7092282214f5b78b8.js → bbcb213d20693fcad5be.js} +12 -12
  10. package/assets/esri/core/workers/chunks/{414691f7758c78e2a704.js → cfbbfa5edffa57bd3a8e.js} +1 -1
  11. package/assets/esri/core/workers/chunks/d0217187aed8bb7038f4.js +1 -0
  12. package/assets/esri/core/workers/chunks/{b7d7bfcb089a3f1a38b6.js → dd785e595cd08b2d6284.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{0087ad36f7d38fc7fe11.js → ee446250a40e5d89bb5a.js} +44 -44
  14. package/assets/esri/core/workers/chunks/{42b1c526c4c9636a169d.js → f1f3fe9d2d96578f4f6b.js} +1 -1
  15. package/chunks/FocusAreaColor.glsl.js +1 -10
  16. package/chunks/RibbonLine.glsl.js +22 -22
  17. package/config.js +1 -1
  18. package/geometry/support/plane.js +1 -1
  19. package/geometry/support/triangle.js +1 -1
  20. package/kernel.js +1 -1
  21. package/layers/raster/datasets/pixelReader.js +1 -1
  22. package/layers/raster/functions/pixelUtils.js +1 -1
  23. package/package.json +1 -1
  24. package/popup/Features.d.ts +2 -2
  25. package/popup/Features.js +1 -1
  26. package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
  27. package/support/revision.js +1 -1
  28. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  29. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  30. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  31. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  32. package/views/3d/analysis/Viewshed/types.d.ts +17 -0
  33. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -14
  34. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  35. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  36. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  37. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  38. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  39. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  40. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  41. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  42. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  43. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  44. package/views/3d/webgl/ManagedFBO.js +1 -1
  45. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +1 -1
  46. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
  47. package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
  48. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  49. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  50. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  51. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  52. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  53. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  54. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  55. package/views/layers/ViewshedLayerView.d.ts +0 -10
  56. package/views/support/LayerViewManager.js +1 -1
  57. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  58. package/assets/esri/core/workers/chunks/7a59d39010ed33b8fabb.js +0 -1
  59. package/assets/esri/core/workers/chunks/a0f7e37d385fc68b138d.js +0 -1
  60. package/assets/esri/core/workers/chunks/dfae4440afe0ca7c5b25.js +0 -1
  61. package/assets/esri/core/workers/chunks/fec9ce6ad634c904ffdf.js +0 -1
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5404],{95404(e,r,t){t.d(r,{computeObjectLayerResourceSize:()=>c}),t(11254);var i=t(49186),n=t(66344),o=t(51850),s=t(70328),l=t(8887);let u=new n.q(50);async function c(e,r=null){if(!e.isPrimitive){const r=e.resource?.href;if(!r)throw new i.A("symbol:invalid-resource","The symbol does not have a valid resource");const n=u.get(r);if(null!=n)return n;const{fetch:l}=await Promise.all([t.e(1843),t.e(7005),t.e(6261),t.e(4566)]).then(t.bind(t,39897)),c=await l(r,{disableTextures:!0,spherical:!0}),a=(0,s.Ej)(c.referenceBoundingBox,(0,o.vt)());return u.put(r,a),a}if(!e.resource?.primitive)throw new i.A("symbol:invalid-resource","The symbol does not have a valid resource");const n=(0,s.vt)((0,l.Fq)(e.resource.primitive));if(null!=r)for(let e=0;e<n.length;e++)n[e]*=r;return(0,s.Ej)(n,(0,o.vt)())}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5404],{95404(e,r,t){t.d(r,{computeObjectLayerResourceSize:()=>c}),t(11254);var i=t(49186),n=t(66344),o=t(51850),s=t(70328),l=t(8887);let u=new n.q(50);async function c(e,r=null){if(!e.isPrimitive){const r=e.resource?.href;if(!r)throw new i.A("symbol:invalid-resource","The symbol does not have a valid resource");const n=u.get(r);if(null!=n)return n;const{fetch:l}=await Promise.all([t.e(1843),t.e(7005),t.e(894),t.e(6662)]).then(t.bind(t,49261)),c=await l(r,{disableTextures:!0,spherical:!0}),a=(0,s.Ej)(c.referenceBoundingBox,(0,o.vt)());return u.put(r,a),a}if(!e.resource?.primitive)throw new i.A("symbol:invalid-resource","The symbol does not have a valid resource");const n=(0,s.vt)((0,l.Fq)(e.resource.primitive));if(null!=r)for(let e=0;e<n.length;e++)n[e]*=r;return(0,s.Ej)(n,(0,o.vt)())}}}]);
@@ -1,11 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{signal as e}from"../core/signal.js";import{ScreenSpacePass as o}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{FloatPassUniform as r}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as s}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{IntegerPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{Texture2DPassUniform as t}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as c}from"../views/webgl/NoParameters.js";import{ShaderBuilder as l}from"../views/webgl/ShaderBuilder.js";class f extends c{constructor(){super(...arguments),this.effect=0,this.fadeFactor=e(1)}}function i(){const e=new l;return e.include(o),e.outputs.add("fragColor","vec4",0),e.fragment.uniforms.add(new t("colorTexture",e=>e.color),new t("focusArea",e=>e.focusArea),new a("focusAreaEffectMode",e=>e.effect),new r("fadeFactor",e=>e.fadeFactor.value)).main.add(s`
3
- float mask = texture( focusArea, uv, 0.0 ).r;
4
- vec4 color = texture( colorTexture, uv, 0.0 );
5
- vec4 colorDeSaturate = vec4(color.r * 0.25 + color.g * 0.5 + color.b * 0.25);
6
- if (focusAreaEffectMode == ${s.int(0)}) {
7
- fragColor = mask > 0.0 ? color : mix(color, 0.55 * colorDeSaturate + 0.45, fadeFactor);
8
- } else {
9
- fragColor = mask > 0.0 ? color : mix(color, 0.33 * color, fadeFactor);
10
- }
11
- `),e}const n=Object.freeze(Object.defineProperty({__proto__:null,FocusAreaColorPassParameters:f,build:i},Symbol.toStringTag,{value:"Module"}));export{f as F,n as a,i as b};
2
+ import{signal as e}from"../core/signal.js";import{ScreenSpacePass as r}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{FloatPassUniform as o}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{IntegerPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{Texture2DPassUniform as a}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{NoParameters as t}from"../views/webgl/NoParameters.js";import{ShaderBuilder as c}from"../views/webgl/ShaderBuilder.js";class n extends t{constructor(){super(...arguments),this.effect=0,this.fadeFactor=e(1)}}function f(){const e=new c;return e.include(r),e.outputs.add("fragColor","vec4",0),e.fragment.uniforms.add(new a("colorTexture",e=>e.color),new a("focusArea",e=>e.focusArea),new s("focusAreaEffectMode",e=>e.effect),new o("fadeFactor",e=>e.fadeFactor.value)).constants.add("EffectBright","int",0).main.add("\n float mask = texture(focusArea, uv).r;\n \n if (focusAreaEffectMode == EffectBright) {\n vec4 color = texture(colorTexture, uv);\n float luminance = color.r * 0.25 + color.g * 0.5 + color.b * 0.25;\n fragColor = mask > 0.0 ? color : mix(color, vec4(0.55 * luminance + 0.45), fadeFactor);\n } else {\n if(mask > 0.0) discard;\n fragColor = vec4(vec3(0.0), fadeFactor * 0.67);\n }\n "),e}const i=Object.freeze(Object.defineProperty({__proto__:null,FocusAreaColorPassParameters:n,build:f},Symbol.toStringTag,{value:"Module"}));export{n as F,i as a,f as b};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{LineStipple as n,computePixelSize as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js";import{MarkerSizing as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{PiUtils as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import{positionOutsideClipSpace as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{ColorConversion as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{NoPerspectiveWrite as d,NoPerspectiveRead as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js";import{addProjViewLocalOrigin as p,addPixelRatio as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2BindUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float4BindUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4PassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as D,If as u}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as x}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{alphaCutoff as L}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{AnimatedLine as b}from"../views/3d/webgl-engine/shaders/AnimatedLine.glsl.js";import{outputColorHighlightOLID as w}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as y}from"../views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js";import{ShaderBuilder as P}from"../views/webgl/ShaderBuilder.js";const C=1;function z(C){const z=new P,{attributes:j,varyings:F,vertex:W,fragment:R}=z,{applyMarkerOffset:I,draped:A,output:V,capType:E,stippleEnabled:T,falloffEnabled:N,roundJoins:O,wireframe:J,innerColorEnabled:_,hasAnimation:M,hasScreenSizePerspective:U,worldSizedImagePattern:B}=C,H=y().createBuilder(z,C);W.inputs.add("position",()=>H.getTextureAttribute("position")),R.include(a),z.include(t,C),z.include(n,C),z.include(i,C),z.include(b,C);const $=I&&!A;$&&(W.uniforms.add(new S("markerScale",e=>e.markerScale)),z.include(o,{space:2,hasScreenSizePerspective:U})),p(W,C),W.uniforms.add(new x("inverseProjectionMatrix",e=>e.camera.inverseProjectionMatrix),new v("nearFar",e=>e.camera.nearFar),new S("miterLimit",e=>"miter"!==e.join?0:e.miterLimit),new f("viewport",e=>e.camera.fullViewport)),W.constants.add("LARGE_HALF_FLOAT","float",65500),W.constants.add("EPS","float",.001),W.constants.add("NUM_JOIN_SUBDIVISIONS","float",C.numJoinSubdivisions),j.add("textureElementIndex","uint"),j.add("previousDelta","vec4"),j.add("nextDelta","vec4"),j.add("lineParameters","vec2"),j.add("u0","float"),F.add("vColor","vec4"),F.add("vpos","vec3",{invariant:!0}),F.add("vLineDistance","float"),F.add("vLineWidth","float"),T||(F.add("vIsInsideJoin","int"),F.add("vStretchFactor","float"),F.add("vJoinCenterLineSDFs","vec2"),F.add("vSubdivisionFactor","float"));const k=T;k&&F.add("vLineSizeInv","float");const G=2===E,X=T&&G,Y=N||X;Y&&F.add("vLineDistanceNorm","float"),G&&(F.add("vSegmentSDF","float"),F.add("vReverseSegmentSDF","float")),W.code.add(D`vec3 perpendicular(vec3 v) {
2
+ import{SliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{ObjectAndLayerIdColor as i}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{LineStipple as n,computePixelSize as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js";import{MarkerSizing as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{PiUtils as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import{positionOutsideClipSpace as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{ColorConversion as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{NoPerspectiveWrite as d,NoPerspectiveRead as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js";import{addProjViewLocalOrigin as p,addPixelRatio as m}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2BindUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float4BindUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4PassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as S}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as D,If as u}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as x}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{alphaCutoff as L}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{AnimatedLine as b}from"../views/3d/webgl-engine/shaders/AnimatedLine.glsl.js";import{outputColorHighlightOLID as w}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as y}from"../views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js";import{ShaderBuilder as P}from"../views/webgl/ShaderBuilder.js";const C=1;function z(C){const z=new P,{attributes:j,varyings:F,vertex:W,fragment:R}=z,{applyMarkerOffset:A,draped:I,output:T,capType:V,stippleEnabled:E,falloffEnabled:N,roundJoins:O,wireframe:J,innerColorEnabled:_,hasAnimation:M,hasScreenSizePerspective:U,worldSizedImagePattern:$}=C,B=y().createBuilder(z,C);W.inputs.add("position",()=>B.getTextureAttribute("position")),R.include(a),z.include(t,C),z.include(n,C),z.include(i,C),z.include(b,C);const H=A&&!I;H&&(W.uniforms.add(new S("markerScale",e=>e.markerScale)),z.include(o,{space:2,hasScreenSizePerspective:U})),p(W,C),W.uniforms.add(new x("inverseProjectionMatrix",e=>e.camera.inverseProjectionMatrix),new v("nearFar",e=>e.camera.nearFar),new S("miterLimit",e=>"miter"!==e.join?0:e.miterLimit),new f("viewport",e=>e.camera.fullViewport)),W.constants.add("LARGE_HALF_FLOAT","float",65500),W.constants.add("EPS","float",.001),W.constants.add("NUM_JOIN_SUBDIVISIONS","float",C.numJoinSubdivisions),j.add("textureElementIndex","uint"),j.add("lineParameters","vec2"),j.add("u0","float"),F.add("vColor","vec4"),F.add("vpos","vec3",{invariant:!0}),F.add("vLineDistance","float"),F.add("vLineWidth","float"),E||(F.add("vIsInsideJoin","int"),F.add("vStretchFactor","float"),F.add("vJoinCenterLineSDFs","vec2"),F.add("vSubdivisionFactor","float"));const k=E;k&&F.add("vLineSizeInv","float");const G=2===V,X=E&&G,Y=N||X;Y&&F.add("vLineDistanceNorm","float"),G&&(F.add("vSegmentSDF","float"),F.add("vReverseSegmentSDF","float")),W.code.add(D`vec3 perpendicular(vec3 v) {
3
3
  return vec3(v.y, -v.x, 0.0);
4
4
  }
5
5
  float interp(float ncp, vec4 a, vec4 b) {
@@ -46,13 +46,13 @@ if (next.z > -nearFar[0]) {
46
46
  next = mix(next, pos, interp(vnp, next, pos));
47
47
  }
48
48
  }
49
- }`),m(W),W.constants.add("aaWidth","float",T?0:1).main.add(D`
50
- vec3 position = ${H.getTextureAttribute("position")};
49
+ }`),m(W),W.constants.add("aaWidth","float",E?0:1),W.main.add(D`
50
+ vec3 position = ${B.getTextureAttribute("position")};
51
51
 
52
52
  // unpack values from vertex type
53
53
  bool isStartVertex = abs(abs(lineParameters.y) - 3.0) == 1.0;
54
- vec3 prevPosition = position + previousDelta.xyz * previousDelta.w;
55
- vec3 nextPosition = position + nextDelta.xyz * nextDelta.w;
54
+ vec3 prevPosition = ${B.getTextureAttribute("position",-1)};
55
+ vec3 nextPosition = ${B.getTextureAttribute("position",1)};
56
56
 
57
57
  float coverage = 1.0;
58
58
 
@@ -67,7 +67,7 @@ next = mix(next, pos, interp(vnp, next, pos));
67
67
  vec4 next = view * vec4(nextPosition, 1.0);
68
68
 
69
69
  bool isJoin = abs(lineParameters.y) < 3.0;
70
- `),$&&W.main.add(D`vec4 other = isStartVertex ? next : prev;
70
+ `),H&&W.main.add(D`vec4 other = isStartVertex ? next : prev;
71
71
  bool markersHidden = areWorldMarkersHidden(pos.xyz, other.xyz);
72
72
  if (!isJoin && !markersHidden) {
73
73
  pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
@@ -88,10 +88,10 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
88
88
  float rightLen = length(right);
89
89
 
90
90
  float lineSize = getSize(${u(U,"clippedPos")});
91
- ${u(T&&U,"float patternLineSize = getSize(clippedCenter);")}
92
- ${u(T&&!U,"float patternLineSize = lineSize;")}
91
+ ${u(E&&U,"float patternLineSize = getSize(clippedCenter);")}
92
+ ${u(E&&!U,"float patternLineSize = lineSize;")}
93
93
 
94
- ${u(B,D`
94
+ ${u($,D`
95
95
  lineSize += aaWidth;
96
96
  float lineWidth = lineSize * pixelRatio * worldToScreenRatio;
97
97
  if (lineWidth < 1.0) {
@@ -110,7 +110,7 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
110
110
 
111
111
  vLineWidth = noPerspectiveWrite(lineWidth, pos.w);
112
112
  ${k?D`vLineSizeInv = noPerspectiveWrite(1.0 / lineSize, pos.w);`:""}
113
- `);(T||G)&&W.main.add(D`
113
+ `);(E||G)&&W.main.add(D`
114
114
  float isEndVertex = float(!isStartVertex);
115
115
  vec3 segmentOrigin = mix(pos.xyz, prev.xyz, isEndVertex);
116
116
  vec3 segment = mix(right, left, isEndVertex);
@@ -122,7 +122,7 @@ vec3 capDisplacementDir = vec3(0.0, 0.0, 0.0);
122
122
  vec3 joinDisplacementDir = vec3(0.0, 0.0, 0.0);
123
123
  float displacementLen = lineWidth;
124
124
  float miterDisplacementLen = lineWidth;
125
- float innerDisplacementLen = lineWidth;`),T||W.main.add(D`vIsInsideJoin = 0;
125
+ float innerDisplacementLen = lineWidth;`),E||W.main.add(D`vIsInsideJoin = 0;
126
126
  vStretchFactor = 1.0;
127
127
  vSubdivisionFactor = 0.0;
128
128
  vJoinCenterLineSDFs = vec2(LARGE_HALF_FLOAT);`),W.main.add(D`float subdivisionFactor = 0.0;
@@ -140,7 +140,7 @@ if (!isOutside) {
140
140
  displacementLen = innerDisplacementLen;
141
141
  }
142
142
  }
143
- subdivisionFactor = lineParameters.x;`),T||W.main.add(D`if(subdivisionFactor > 0.0) {
143
+ subdivisionFactor = lineParameters.x;`),E||W.main.add(D`if(subdivisionFactor > 0.0) {
144
144
  vIsInsideJoin = 1;
145
145
  }
146
146
  vSubdivisionFactor = isOutside ? subdivisionFactor : 0.5;
@@ -165,7 +165,7 @@ vStretchFactor = noPerspectiveWrite(max(triangleHeight / (2.0 * lineWidth), 1.0)
165
165
  vec3 endDir = rightLen < EPS ? left : right;
166
166
  endDir = perpendicular(endDir);
167
167
 
168
- float factor = ${T?D`min(1.0, subdivisionFactor * ((NUM_JOIN_SUBDIVISIONS + 1.0) / NUM_JOIN_SUBDIVISIONS))`:D`subdivisionFactor`};
168
+ float factor = ${E?D`min(1.0, subdivisionFactor * ((NUM_JOIN_SUBDIVISIONS + 1.0) / NUM_JOIN_SUBDIVISIONS))`:D`subdivisionFactor`};
169
169
 
170
170
  float rotationAngle = acos(clamp(dot(startDir.xy, endDir.xy), -1.0, 1.0));
171
171
  joinDisplacementDir = rotateZ(startDir, -sign(lineParameters.y) * factor * rotationAngle);
@@ -173,8 +173,8 @@ vStretchFactor = noPerspectiveWrite(max(triangleHeight / (2.0 * lineWidth), 1.0)
173
173
  vec3 startDir = perpendicular(leftLen < EPS ? right : left);
174
174
  vec3 endDir = perpendicular(rightLen < EPS ? left : right);
175
175
 
176
- ${u(T,D`joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? endDir : startDir;`,D`joinDisplacementDir = mix(startDir, endDir, subdivisionFactor);`)}
177
- `);const Z=0!==E;return W.main.add(D`
176
+ ${u(E,D`joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? endDir : startDir;`,D`joinDisplacementDir = mix(startDir, endDir, subdivisionFactor);`)}
177
+ `);const Z=0!==V;return W.main.add(D`
178
178
  displacementLen = lineWidth;
179
179
  }
180
180
  } else {
@@ -203,7 +203,7 @@ vStretchFactor = noPerspectiveWrite(max(triangleHeight / (2.0 * lineWidth), 1.0)
203
203
  ${Y?D`vLineDistanceNorm = lineDistNorm;`:""}
204
204
 
205
205
  pos.xyz += dpos;
206
- `),T||W.main.add(D`if (isJoin) {
206
+ `),E||W.main.add(D`if (isJoin) {
207
207
  vec2 joinCenterToVertex = dposXY;
208
208
  vec2 leftCenterlineDir = left.xy;
209
209
  vec2 rightCenterlineDir = right.xy;
@@ -220,17 +220,17 @@ pos.w
220
220
  );
221
221
  }`),G&&W.main.add(D`vec2 segmentDir = normalize(segment.xy);
222
222
  vSegmentSDF = noPerspectiveWrite((isJoin && isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentOrigin.xy, segmentDir)), pos.w);
223
- vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),T&&(A?W.uniforms.add(new h("worldToScreenRatio",e=>1/e.screenToPCSRatio)):W.main.add(D`vec3 segmentCenter = mix((nextPosition + position) * 0.5, (position + prevPosition) * 0.5, isEndVertex);
223
+ vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),E&&(I?W.uniforms.add(new h("worldToScreenRatio",e=>1/e.screenToPCSRatio)):W.main.add(D`vec3 segmentCenter = mix((nextPosition + position) * 0.5, (position + prevPosition) * 0.5, isEndVertex);
224
224
  float worldToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),W.main.add(D`float segmentLengthScreenDouble = length(segment.xy);
225
225
  float segmentLengthScreen = segmentLengthScreenDouble * 0.5;
226
226
  float discreteWorldToScreenRatio = discretizeWorldToScreenRatio(worldToScreenRatio);
227
227
  float segmentLengthRender = length(mix(nextPosition - position, position - prevPosition, isEndVertex));
228
- vStipplePatternStretch = worldToScreenRatio / discreteWorldToScreenRatio;`),A?W.main.add(D`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteWorldToScreenRatio / worldToScreenRatio;
228
+ vStipplePatternStretch = worldToScreenRatio / discreteWorldToScreenRatio;`),I?W.main.add(D`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteWorldToScreenRatio / worldToScreenRatio;
229
229
  float startPseudoScreen = u0 * discreteWorldToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):W.main.add(D`float startPseudoScreen = mix(u0, u0 - segmentLengthRender, isEndVertex) * discreteWorldToScreenRatio;
230
230
  float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRatio;`),W.uniforms.add(new S("stipplePatternPixelSize",e=>r(e))),W.main.add(D`
231
231
  float patternLength = patternLineSize * stipplePatternPixelSize;
232
232
 
233
- ${u(B,D`
233
+ ${u($,D`
234
234
  float uu = mix(u0, u0 - segmentLengthRender, isEndVertex);
235
235
  vStippleDistanceLimits = vec2(uu, uu + segmentLengthRender);
236
236
  vStipplePatternStretch = 1.0;
@@ -277,7 +277,7 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRat
277
277
  vColor = getColor();
278
278
  vColor.a = noPerspectiveWrite(vColor.a * coverage, pos.w);
279
279
 
280
- ${J&&!A?"pos.z -= EPS * pos.w;":""}
280
+ ${J&&!I?"pos.z -= EPS * pos.w;":""}
281
281
 
282
282
  // transform final position to camera space for slicing
283
283
  vpos = (inverseProjectionMatrix * pos).xyz;
@@ -301,11 +301,11 @@ lineDistanceNorm
301
301
  float stippleRadius = length(stipplePosition * lineWidth);
302
302
  float stippleCapSDF = (stippleRadius - lineWidth) * 0.5;
303
303
  float stippleCoverage = clamp(0.5 - stippleCapSDF, 0.0, 1.0);
304
- float stippleAlpha = step(alphaCutoff, stippleCoverage);`):R.main.add(D`float stippleAlpha = getStippleAlpha(lineWidth);`),11!==V&&R.main.add(D`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),z.include(c),R.uniforms.add(new g("intrinsicColor",e=>e.color)).main.add(D`vec4 color = intrinsicColor * vColor;
304
+ float stippleAlpha = step(alphaCutoff, stippleCoverage);`):R.main.add(D`float stippleAlpha = getStippleAlpha(lineWidth);`),11!==T&&R.main.add(D`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),z.include(c),R.uniforms.add(new g("intrinsicColor",e=>e.color)).main.add(D`vec4 color = intrinsicColor * vColor;
305
305
  color.a = noPerspectiveRead(color.a);`),_&&R.uniforms.add(new g("innerColor",e=>e.innerColor??e.color),new S("innerWidth",(e,i)=>e.innerWidth*i.camera.pixelRatio)).main.add(D`float distToInner = abs(lineDistance) - innerWidth;
306
306
  float innerAA = clamp(0.5 - distToInner, 0.0, 1.0);
307
307
  float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a);
308
- color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`),R.main.add(D`vec4 finalColor = blendStipple(color, stippleAlpha);`),N&&(R.uniforms.add(new S("falloff",e=>e.falloff)),R.main.add(D`finalColor.a *= pow(max(0.0, 1.0 - abs(lineDistanceNorm)), falloff);`)),T||R.main.add(D`float stretchFactor = vIsInsideJoin == 1 ? noPerspectiveRead(vStretchFactor) : 1.0;
308
+ color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`),R.main.add(D`vec4 finalColor = blendStipple(color, stippleAlpha);`),N&&(R.uniforms.add(new S("falloff",e=>e.falloff)),R.main.add(D`finalColor.a *= pow(max(0.0, 1.0 - abs(lineDistanceNorm)), falloff);`)),E||R.main.add(D`float stretchFactor = vIsInsideJoin == 1 ? noPerspectiveRead(vStretchFactor) : 1.0;
309
309
  float featherWidth = 2.0;
310
310
  float featherStartDistance = max(lineWidth - featherWidth / stretchFactor, 0.0);
311
311
  float straightFeatherStartDistance = max(lineWidth - featherWidth, 0.0);
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.34";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.35";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../core/mathUtils.js";import{exactEquals as r,subtract as n,normalize as o,dot as e,lerp as c,copy as i,add as u,scale as f,cross as s,set as a}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as l,exactEquals as g}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as h}from"./vector.js";import{sv3d as p,sv4d as M}from"./vectorStacks.js";import{tangentFrame as v}from"../../views/3d/support/mathUtils.js";function b(t=tt){return[t[0],t[1],t[2],t[3]]}const j=g,x=l;function q(t=tt[0],r=tt[1],n=tt[2],o=tt[3]){return E(t,r,n,o,M.get())}function y(t,r){return E(r[0],r[1],r[2],r[3],t)}function d(t){return t}function E(t,r,n,o,e=b()){return e[0]=t,e[1]=r,e[2]=n,e[3]=o,e}function U(t,r,n){return i(n,t),n[3]=r,n}function k(t,r,n){const o=r[0]*r[0]+r[1]*r[1]+r[2]*r[2],e=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return n[0]=r[0]*e,n[1]=r[1]*e,n[2]=r[2]*e,n[3]=-(n[0]*t[0]+n[1]*t[1]+n[2]*t[2]),n}function w(t,r,n,o=b()){const e=n[0]-r[0],c=n[1]-r[1],i=n[2]-r[2],u=t[0]-r[0],f=t[1]-r[1],s=t[2]-r[2],a=c*s-i*f,m=i*u-e*s,l=e*f-c*u,g=a*a+m*m+l*l,h=Math.abs(g-1)>1e-5&&g>1e-12?1/Math.sqrt(g):1;return o[0]=a*h,o[1]=m*h,o[2]=l*h,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function S(t,c,i,u=0,f=Math.floor(i*(1/3)),s=Math.floor(i*(2/3))){if(i<3)return!1;c(B,u);let a=f,m=!1;for(;a<i-1&&!m;)c(C,a),a++,m=!r(B,C);if(!m)return!1;for(a=Math.max(a,s),m=!1;a<i&&!m;)c(D,a),a++,n(F,B,C),o(F,F),n(G,C,D),o(G,G),m=!r(B,D)&&!r(C,D)&&Math.abs(e(F,G))<A;return m?(w(B,C,D,t),!0):(0!==u||1!==f||2!==s)&&S(t,c,i,0,1,2)}function z(t,r,n=!0){const o=r.length/3;return S(t,(t,n)=>a(t,r[3*n+0],r[3*n+1],r[3*n+2]),n?o-1:o)}const A=.99619469809,B=m(),C=m(),D=m(),F=m(),G=m();function H(t,r,n){return r!==t&&y(t,r),t[3]=-e(d(t),n),t}function I(t,r){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r}function J(t,r,n,o){return s(D,r,t),k(n,D,o)}function K(t,r,o,e){return $(_(t,r,n(p.get(),o,r),rt,e))}function L(t,r,n){return null!=r&&$(_(t,r.origin,r.direction,nt,n))}function N(t,r,n){return $(_(t,r.origin,r.vector,0,n))}function O(t,r,n){return $(_(t,r.origin,r.vector,1,n))}function P(t,r){return Z(t,r)>=0}function Q(t,r){const n=e(d(t),r.ray.direction),o=-Z(t,r.ray.origin);if(o<0&&n>=0)return!1;if(n>-1e-6&&n<1e-6)return o>0;if((o<0||n<0)&&!(o<0&&n<0))return!0;const c=o/n;return n>0?c<r.c1&&(r.c1=c):c>r.c0&&(r.c0=c),r.c0<=r.c1}function R(t,r){const n=e(d(t),r.ray.direction),o=-Z(t,r.ray.origin);if(n>-1e-6&&n<1e-6)return o>0;const c=o/n;return n>0?c<r.c1&&(r.c1=c):c>r.c0&&(r.c0=c),r.c0<=r.c1}function T(t,r,n,o,e=!0){let u=0,f=r[n-1],s=Z(t,f),a=e?s>0:s<=0;for(let m=0;m<n;m++){const n=r[m],l=Z(t,n),g=e?l>0:l<=0;a!==g&&c(o[u++],f,n,s/(s-l)),g&&i(o[u++],n),f=n,s=l,a=g}return u}function V(t,r,o){const e=f(p.get(),d(t),-t[3]),c=X(t,n(p.get(),r,e),p.get());return u(o,c,e),o}function W(t,r,o,e){const c=d(t),i=p.get(),u=p.get();v(c,i,u);const f=n(p.get(),o,r),s=h(i,f),m=h(u,f),l=h(c,f);return a(e,s,m,l)}function X(t,r,o){const c=f(p.get(),d(t),e(d(t),r));return n(o,r,c),o}function Y(t,r){return Math.abs(Z(t,r))}function Z(t,r){return e(d(t),r)+t[3]}function $(t){return 0===t||1===t}function _(r,n,o,c,i){const s=e(d(r),o),a=Z(r,n);if(0===s)return a>=0?2:3;let m=-a/s;return 1&c&&(m=t(m,0,1)),!(4&c)&&m<0||!(8&c)&&m>1?a>=0?2:3:(u(i,n,f(i,o,m)),a>=0?0:1)}const tt=[0,0,1,0],rt=12,nt=8;export{Q as clip,R as clipInfinite,T as clipPolygon,y as copy,b as create,Y as distance,x as equals,j as exactEquals,z as fromArray,S as fromManyPoints,U as fromNormalAndOffset,w as fromPoints,k as fromPositionAndNormal,E as fromValues,J as fromVectorsAndPoint,d as getNormal,K as intersectLine,_ as intersectLineOrRay,N as intersectLineSegment,O as intersectLineSegmentClamp,L as intersectRay,P as isPointInside,I as negate,V as projectPoint,W as projectPointLocal,X as projectVector,H as setOffsetFromPoint,Z as signedDistance,tt as up,q as wrap};
2
+ import{clamp as t}from"../../core/mathUtils.js";import{exactEquals as n,subtract as r,normalize as o,dot as c,lerp as e,copy as u,add as i,scale as f,cross as s,set as a,scaleAndAdd as m}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as g,exactEquals as h}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as p}from"./vector.js";import{sv3d as M,sv4d as v}from"./vectorStacks.js";import{tangentFrame as b}from"../../views/3d/support/mathUtils.js";function j(t=ct){return[t[0],t[1],t[2],t[3]]}const x=h,q=g;function y(t=ct[0],n=ct[1],r=ct[2],o=ct[3]){return U(t,n,r,o,v.get())}function d(t,n){return U(n[0],n[1],n[2],n[3],t)}function E(t){return t}function U(t,n,r,o,c=j()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function k(t,n,r){return u(r,t),r[3]=n,r}function w(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function S(t,n,r,o=j()){const c=r[0]-n[0],e=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],f=t[1]-n[1],s=t[2]-n[2],a=e*s-u*f,m=u*i-c*s,l=c*f-e*i,g=a*a+m*m+l*l,h=Math.abs(g-1)>1e-5&&g>1e-12?1/Math.sqrt(g):1;return o[0]=a*h,o[1]=m*h,o[2]=l*h,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function z(t,e,u,i=0,f=Math.floor(u*(1/3)),s=Math.floor(u*(2/3))){if(u<3)return!1;e(C,i);let a=f,m=!1;for(;a<u-1&&!m;)e(D,a),a++,m=!n(C,D);if(!m)return!1;for(a=Math.max(a,s),m=!1;a<u&&!m;)e(F,a),a++,r(G,C,D),o(G,G),r(H,D,F),o(H,H),m=!n(C,F)&&!n(D,F)&&Math.abs(c(G,H))<B;return m?(S(C,D,F,t),!0):(0!==i||1!==f||2!==s)&&z(t,e,u,0,1,2)}function A(t,n,r=!0){const o=n.length/3;return z(t,(t,r)=>a(t,n[3*r+0],n[3*r+1],n[3*r+2]),r?o-1:o)}const B=.99619469809,C=l(),D=l(),F=l(),G=l(),H=l();function I(t,n,r){return n!==t&&d(t,n),t[3]=-c(E(t),r),t}function J(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function K(t,n,r,o){return s(F,n,t),w(r,F,o)}function L(t,n,o,c){return rt(ot(t,n,r(M.get(),o,n),et,c))}function N(t,n,r){return null!=n&&rt(ot(t,n.origin,n.direction,ut,r))}function O(t,n,r){return rt(ot(t,n.origin,n.vector,0,r))}function P(t,n,r){return rt(ot(t,n.origin,n.vector,1,r))}function Q(t,n){return nt(t,n)>=0}function R(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!0)}function T(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!1)}function V(t,n,r,o,e,u,i){const f=c(E(t),r),s=nt(t,n);if(f>-1e-6&&f<1e-6)return W(s,e,u);const a=-s/f,m=W(f,e,!1);return!(i&&!m&&!W(s,e,u))&&(m?a>o.c0&&(o.c0=a):a<o.c1&&(o.c1=a),o.c0<=o.c1)}function W(t,n,r){return r?n?t>=0:t<=0:n?t>0:t<0}function X(t,n,r,o,c=!1){let i=0,f=n[r-1],s=nt(t,f),a=c?s>0:s<=0;for(let m=0;m<r;m++){const r=n[m],l=nt(t,r),g=c?l>0:l<=0;a!==g&&e(o[i++],f,r,s/(s-l)),g&&u(o[i++],r),f=r,s=l,a=g}return i}function Y(t,n,o,c,e,u=!1){return r(it,o,n),ft.c0=0,ft.c1=1,!!V(t,n,it,ft,u,!u,!1)&&(m(c,n,it,ft.c0),m(e,n,it,ft.c1),!0)}function Z(t,n,o){const c=f(M.get(),E(t),-t[3]),e=_(t,r(M.get(),n,c),M.get());return i(o,e,c),o}function $(t,n,o,c){const e=E(t),u=M.get(),i=M.get();b(e,u,i);const f=r(M.get(),o,n),s=p(u,f),m=p(i,f),l=p(e,f);return a(c,s,m,l)}function _(t,n,o){const e=f(M.get(),E(t),c(E(t),n));return r(o,n,e),o}function tt(t,n){return Math.abs(nt(t,n))}function nt(t,n){return c(E(t),n)+t[3]}function rt(t){return 0===t||1===t}function ot(n,r,o,e,u){const s=c(E(n),o),a=nt(n,r);if(0===s)return a>=0?2:3;let m=-a/s;return 1&e&&(m=t(m,0,1)),!(4&e)&&m<0||!(8&e)&&m>1?a>=0?2:3:(i(u,r,f(u,o,m)),a>=0?0:1)}const ct=[0,0,1,0],et=12,ut=8,it=l(),ft={c0:0,c1:1};export{R as clip,T as clipInfinite,Y as clipLineSegment,X as clipPolygon,d as copy,j as create,tt as distance,q as equals,x as exactEquals,A as fromArray,z as fromManyPoints,k as fromNormalAndOffset,S as fromPoints,w as fromPositionAndNormal,U as fromValues,K as fromVectorsAndPoint,E as getNormal,L as intersectLine,ot as intersectLineOrRay,O as intersectLineSegment,P as intersectLineSegmentClamp,N as intersectRay,Q as isPointInside,J as negate,Z as projectPoint,$ as projectPointLocal,_ as projectVector,I as setOffsetFromPoint,nt as signedDistance,ct as up,y as wrap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ObjectStack as t}from"../../core/ObjectStack.js";import{subtract as n,length as r,cross as e,scale as o,add as i,sub as c,dot as s,copy as u,scaleAndAdd as f}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as p,clone as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as g,distance2 as m,fromValues as v}from"./lineSegment.js";import{sv3d as d}from"./vectorStacks.js";function j(t){return t?{p0:a(t.p0),p1:a(t.p1),p2:a(t.p2)}:{p0:p(),p1:p(),p2:p()}}function l(t,n,r){const e=z.get();return e.p0=t,e.p1=n,e.p2=r,e}function b(t,n=j()){return h(t.p0,t.p1,t.p2,n)}function h(t,n,r,e=j()){return u(e.p0,t),u(e.p1,n),u(e.p2,r),e}function x(t,r){const o=t.p0,i=t.p1,c=t.p2,u=n(d.get(),i,o),f=n(d.get(),c,i),p=n(d.get(),o,c),a=n(d.get(),r,o),g=n(d.get(),r,i),j=n(d.get(),r,c),l=e(u,u,p),b=s(e(d.get(),u,l),a),h=s(e(d.get(),f,l),g),x=s(e(d.get(),p,l),j);if(b>0&&h>0&&x>0){const t=s(l,a);return t*t/s(l,l)}const S=m(v(o,u,q.get()),r),k=m(v(i,f,q.get()),r),w=m(v(c,p,q.get()),r);return Math.min(S,k,w)}function S(t,n,r){const e=1e-5,{direction:c,origin:s}=n,{p0:u,p1:f,p2:p}=t,a=f[0]-u[0],g=f[1]-u[1],m=f[2]-u[2],v=p[0]-u[0],d=p[1]-u[1],j=p[2]-u[2],l=c[1]*j-d*c[2],b=c[2]*v-j*c[0],h=c[0]*d-v*c[1],x=a*l+g*b+m*h;if(x>-e&&x<e)return!1;const S=1/x,k=s[0]-u[0],w=s[1]-u[1],M=s[2]-u[2],y=S*(k*l+w*b+M*h);if(y<0||y>1)return!1;const O=w*m-g*M,V=M*a-m*k,q=k*g-a*w,z=S*(c[0]*O+c[1]*V+c[2]*q);if(z<0||y+z>1)return!1;if(r){o(r,c,S*(v*O+d*V+j*q)),i(r,s,r)}return!0}function k(t,n,r){return Math.abs(w(t,n,r))}function w(t,n,r){const[e,o]=t,[i,c]=n,[s,u]=r;return.5*((i-e)*(u-o)-(c-o)*(s-e))}function M(t,n,r,e,o=0){const i=w(e,t,n),c=w(e,n,r),s=w(e,r,t);return!((i<-o||c<-o||s<-o)&&(i>o||c>o||s>o))}function y(t,o,i){return n(A,o,t),n(B,i,t),.5*r(e(A,A,B))}function O(t,n,r,e,o){c(A,e,r),c(C,o,r),c(B,n,r);const i=s(A,B),p=s(C,B);if(i<=0&&p<=0)return void u(t,r);c(B,n,e);const a=s(A,B),g=s(C,B);if(a>=0&&g<=a)return void u(t,e);const m=i*g-a*p;if(m<=0&&i>=0&&a<=0)return void f(t,r,A,i/(i-a));c(B,n,o);const v=s(A,B),d=s(C,B);if(d>=0&&v<=d)return void u(t,o);const j=v*p-i*d;if(j<=0&&p>=0&&d<=0)return void f(t,r,C,p/(p-d));const l=a*d-v*g;if(l<=0&&g-a>=0&&v-d>=0)return c(B,o,e),void f(t,e,B,(g-a)/(g-a+(v-d)));const b=1/(l+j+m);u(t,r),f(t,t,A,j*b),f(t,t,C,m*b)}function V(t,n,i,s){c(A,i,n),c(B,s,n),e(t,A,B);const u=r(t);return 0!==u&&(o(t,t,1/u),!0)}const q=new t(g),z=new t(()=>j()),A=p(),B=p(),C=p();export{k as area2dFromValues,y as area3dFromValues,O as closestPointFromValues,M as containsPoint2dFromValues,b as copy,j as create,x as distance2,h as fromValues,S as intersectRay,V as normalFromValues,l as wrap};
2
+ import{ObjectStack as t}from"../../core/ObjectStack.js";import{subtract as n,length as r,cross as e,sub as o,scale as i,dot as c,copy as s,scaleAndAdd as u,add as f}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as p,clone as a}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as g,distance2 as m,fromValues as v}from"./lineSegment.js";import{sv3d as d}from"./vectorStacks.js";function j(t){return t?{p0:a(t.p0),p1:a(t.p1),p2:a(t.p2)}:{p0:p(),p1:p(),p2:p()}}function l(t,n,r){const e=z.get();return e.p0=t,e.p1=n,e.p2=r,e}function b(t,n=j()){return h(t.p0,t.p1,t.p2,n)}function h(t,n,r,e=j()){return s(e.p0,t),s(e.p1,n),s(e.p2,r),e}function x(t,r){const o=t.p0,i=t.p1,s=t.p2,u=n(d.get(),i,o),f=n(d.get(),s,i),p=n(d.get(),o,s),a=n(d.get(),r,o),g=n(d.get(),r,i),j=n(d.get(),r,s),l=e(u,u,p),b=c(e(d.get(),u,l),a),h=c(e(d.get(),f,l),g),x=c(e(d.get(),p,l),j);if(b>0&&h>0&&x>0){const t=c(l,a);return t*t/c(l,l)}const S=m(v(o,u,q.get()),r),k=m(v(i,f,q.get()),r),w=m(v(s,p,q.get()),r);return Math.min(S,k,w)}function S(t,n,r){const e=1e-5,{direction:o,origin:c}=n,{p0:s,p1:u,p2:p}=t,a=u[0]-s[0],g=u[1]-s[1],m=u[2]-s[2],v=p[0]-s[0],d=p[1]-s[1],j=p[2]-s[2],l=o[1]*j-d*o[2],b=o[2]*v-j*o[0],h=o[0]*d-v*o[1],x=a*l+g*b+m*h;if(x>-e&&x<e)return!1;const S=1/x,k=c[0]-s[0],w=c[1]-s[1],M=c[2]-s[2],y=S*(k*l+w*b+M*h);if(y<0||y>1)return!1;const O=w*m-g*M,V=M*a-m*k,q=k*g-a*w,z=S*(o[0]*O+o[1]*V+o[2]*q);if(z<0||y+z>1)return!1;if(r){i(r,o,S*(v*O+d*V+j*q)),f(r,c,r)}return!0}function k(t,n,r){return Math.abs(w(t,n,r))}function w(t,n,r){const[e,o]=t,[i,c]=n,[s,u]=r;return.5*((i-e)*(u-o)-(c-o)*(s-e))}function M(t,n,r,e,o=0){const i=w(e,t,n),c=w(e,n,r),s=w(e,r,t);return!((i<-o||c<-o||s<-o)&&(i>o||c>o||s>o))}function y(t,o,i){return n(A,o,t),n(B,i,t),.5*r(e(A,A,B))}function O(t,n,r,e,i){o(A,e,r),o(C,i,r),o(B,n,r);const f=c(A,B),p=c(C,B);if(f<=0&&p<=0)return void s(t,r);o(B,n,e);const a=c(A,B),g=c(C,B);if(a>=0&&g<=a)return void s(t,e);const m=f*g-a*p;if(m<=0&&f>=0&&a<=0)return void u(t,r,A,f/(f-a));o(B,n,i);const v=c(A,B),d=c(C,B);if(d>=0&&v<=d)return void s(t,i);const j=v*p-f*d;if(j<=0&&p>=0&&d<=0)return void u(t,r,C,p/(p-d));const l=a*d-v*g;if(l<=0&&g-a>=0&&v-d>=0)return o(B,i,e),void u(t,e,B,(g-a)/(g-a+(v-d)));const b=1/(l+j+m);s(t,r),u(t,t,A,j*b),u(t,t,C,m*b)}function V(t,n,c,s){o(A,c,n),o(B,s,n),e(t,A,B);const u=r(t);return 0!==u&&(i(t,t,1/u),!0)}const q=new t(g),z=new t(()=>j()),A=p(),B=p(),C=p();export{k as area2dFromValues,y as area3dFromValues,O as closestPointFromValues,M as containsPoint2dFromValues,b as copy,j as create,x as distance2,h as fromValues,S as intersectRay,V as normalFromValues,l as wrap};
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.34",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.35",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import{getByteCount as o}from"../formats/pixelRangeUtils.js";import{convertPixelSize as a,snapToRaster as r,clip as s}from"../functions/clipUtils.js";import{transformPixels as l}from"../functions/pixelTransformUtils.js";import{mapPixelValueToAttribute as c,mosaic as p,pixelIdFieldName as u,convertPixelBlockToFeatures as f,getValidPixels as m,countCategoricalPixels as x}from"../functions/pixelUtils.js";import{load as d,projectPolygon as h}from"../functions/rasterProjectionHelper.js";import{computeBoxStatistics as y,computeStatisticsHistograms as w}from"../functions/stretchUtils.js";import g from"../../support/Field.js";import S from"../../support/PixelBlock.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const z=2**30,B=2048,P=2**20,I=20,R=100;async function j(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function v(e){const{rasterInfo:t,geometry:i,pixelSize:o,downsampleOnly:s=!1,maxPixelCountForDownsample:l}=e;if(!o)return!0;if(!s)return!1;const c=a(o,t.spatialReference);if(c.x+c.y<=t.pixelSize.x+t.pixelSize.y)return!0;if(null==l)return!1;const p="polyline"===i?.type?i.extent:i??t.extent,u=new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference}),f=r(t,p,u);return f.width*f.height<=l}function T(e){const t=[new g({name:u,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new g({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function F(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<I){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/R;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await d(),t=h(t,i)}return t}async function C(e,t,i=!1){const{spatialReference:o}=e,a=t?.geometry,s=await F(a??e.extent,o),l="extent"===s.type?s:s.extent,c=null==a||"extent"===a.type&&a.spatialReference.equals(o)?void 0:s,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),u=!!t?.autoResample,f=u?p:t?.pixelSize??p;let{extent:m,width:x,height:d}=r(e,l,f);if(!u)return{extent:m,clipGeometry:c,width:x,height:d,pixelSize:f};const h=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=f;const g=t?.maxPixelCount??P;for(;x*d>g&&(!i||Math.max(x,d)>1024);)y*=h,w*=h,x/=h,d/=h;return x=Math.round(x),d=Math.round(d),{extent:m,clipGeometry:c,width:x,height:d,pixelSize:new n({x:y,y:w,spatialReference:o})}}async function*M(e,n,o=!1,a){const{extent:r,clipGeometry:l,width:c,height:p}=n,u=r.width/c,f=r.height/p,m=Math.ceil(c/B),x=Math.ceil(p/B),d=u*B,h=f*B,{xmin:y,xmax:w,ymin:g,ymax:S}=r,k=x*m,b={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...a};for(let z=0;z<x;z++)for(let n=0;n<m;n++){t(b);const a=new i({xmin:y+n*d,xmax:o?Math.min(w,y+(n+1)*d):y+(n+1)*d,ymax:S-z*h,ymin:o?Math.max(g,S-(z+1)*h):S-(z+1)*h,spatialReference:r.spatialReference}),c={row:z,col:n},p=z*m+n+1;if(l&&!a.intersects(l)){yield{extent:a,pixelBlock:null,id:c,total:k,current:p};continue}const x=o?Math.round(a.width/u):B,P=o?Math.round(a.height/f):B;let{pixelBlock:I}=await e.fetchPixels(a,x,P,b).catch(()=>({pixelBlock:void 0}));I&&l&&(I=await s(I,a,l)),yield{extent:a,pixelBlock:I,id:c,total:k,current:p}}}async function*O(e,i,n){const o=await j(e,n),a=T(o),r={...i,geometry:i?.geometry??o.extent},s=M(e,await C(o,r),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const r=Q(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await V({pixelBlock:s,rasterJobHandler:r},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*o.width*B+c.id.col*B;t(n),f.featureSet=await $({pixelBlock:s,extent:c.extent,fields:a,skipFactor:i?.skipFactor??1,rasterJobHandler:r,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function H(t,i,n){const a=o(i),{width:r,height:s}=t;if(r*s*a>z)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&r*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function D(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const o=await j(t),a=await C(o,i,!0);H(a,o.pixelType);const{extent:r,pixelSize:s}=a,l=Math.round(o.extent.width/s.x),c=T(o),p={fields:c,features:[]},u=p.features,{maxPixelCount:f}=i,m=!!i.autoResample&&null!=f&&a.width*a.height>f,x=m?1:i.skipFactor??1,d=a.width<=B||a.height<=B,h=M(t,a,1===x||d,n);for await(const e of h){if(!e.pixelBlock)continue;const i=Q(t),a=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),r=await $({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:a,imageRowSize:l},n);if(r?.features?.length){const{features:e}=r,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}if(m&&f){const e=f/(i.skipFactor??1)**2;if(u.length>e){const t=u.length/e,i=[...u],n=u.length-1;u.length=0;for(let o=0,a=0;o<e-1;o++){a+=t;const e=Math.round(a);e<n&&u.push(i[e])}}}return{extent:r,featureSet:p,pixelSize:s}}async function J(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return q(e,n,i);if("polyline"===n.type)return U(e,n,i);const o=await X(e,{geometry:n},i);if(!o)return null;return y(o)}async function q(e,t,i){const n=await j(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>E(e,t,i)),a=(await Promise.all(o)).filter(e=>null!=e);if(a.length<=1)return N(a[0]);const r=a[0].map((e,t)=>a.map(e=>e[t]));return y(new S({pixels:r,pixelType:n.pixelType}))}async function E(e,t,i){if("imagery"===e.type){const n=await e.identify(new b({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function N(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function U(e,t,i){const n=await K(e,{geometry:t},i),o=await j(e,i),{bandCount:a,pixelType:r}=o,s=new Array(a).fill(0).map(()=>S.createEmptyBand(r,n.length));let l=0;for(let c=0;c<n.length;c++){const e=n[c];if(null!=e.value){l++;for(let t=0;t<a;t++)s[t][c]=e.value[t]}}l!==n.length&&s.forEach((e,t)=>{s[t]=e.subarray(0,l)});return y(new S({pixels:s,pixelType:r}))}async function A(t,i,n){const o=await j(t,n);if(!o.attributeTable||!o.pixelType.startsWith("u"))return null;const a=o.attributeTable.clone(),r=a.fields.find(e=>"value"===e.name.toLowerCase());let s=a.fields.find(e=>"count"===e.name.toLowerCase());if(!r)throw new e("compute-attribute-table","Value field not found in attribute table");s||(s=new g({name:"Count",alias:"Count",type:"double"}),a.fields.push(s),a.features.forEach(e=>{e.attributes[s.name]=0}));const l=2**Number(o.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p,pixelSize:u,downsampleOnly:f,maxPixelCountForDownsample:m}=i,d=v({rasterInfo:o,geometry:p,pixelSize:u,downsampleOnly:f,maxPixelCountForDownsample:m})?void 0:u;return await _(t,{geometry:p,pixelSize:d},(e,t)=>x(e,c),n),a.features.forEach(e=>{const t=e.attributes[r.name];e.attributes[s.name]=c[t]}),a}async function G(e,t,i){const{geometry:n}=t;if("point"===n.type)return E(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>E(e,t,i)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return W(o).map(e=>e/o.length)}const o=await _(e,{geometry:n},(e,t)=>L(e),i),a=o?.filter(e=>e.count>0);if(!a?.length)return null;const r=W(a.map(e=>e.bandSum)),s=a.map(e=>e.count).reduce((e,t)=>e+t);return r.map(e=>e/s)}function W(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function L(e){const{width:t,height:i,pixels:n,mask:o}=e,a=new Array(n.length).fill(0);let r=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)a[e]+=n[e][i];r++}}return{bandSum:a,count:r}}async function K(e,t,i){const n=await _(e,{geometry:t.geometry},m,i);return n?.flat()??[]}async function _(i,n,o,a){const r=i.spatialReference;let{geometry:l}=n;if("polyline"===l.type&&!l.spatialReference.equals(r)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(l,r);if(null==t)throw new e("read-pixels","failed to fetch pixels");l=t}const c="polyline"===l.type?l.extent:l,p=await F(c,r),u="polyline"===l.type?l:p,f=await j(i,a),m={geometry:p,autoResample:!1,pixelSize:n?.pixelSize},x=[],d=M(i,await C(f,m),!0,a);for await(const e of d){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await s(e.pixelBlock,i,u),i);x.push(n),t(a)}return x}async function V(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:a}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):w(n);return{statistics:o,histograms:a}}async function $(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:a,pixelIdOffset:r,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=a?await a.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s});return p?{fields:n,features:p}:void 0}function Q(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function X(e,t,i){const n=await j(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await C(n,t);o.bandIds=t.bandIds?.length?t.bandIds:void 0,H(o,n.pixelType,t.maxPixelCount);const{width:a,height:r}=o;if(a<=B&&r<=B){const t=o.bandIds?.length?o.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(o.extent,a,r,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=M(e,o,!1,i);for await(const p of l)s.push(p.pixelBlock);if(!s.some(e=>null!=e))return null;const c=Math.ceil(a/B),u=Math.ceil(r/B),f={width:c*B,height:u*B};let m;const x=Q(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=p(s,f);return m}async function Y(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const{pixelSize:o,downsampleOnly:a,maxPixelCountForDownsample:r}=i,s=await j(t,n),p=v({rasterInfo:s,geometry:i.geometry,pixelSize:o,downsampleOnly:a,maxPixelCountForDownsample:r})?void 0:o;let u=await X(t,{...i,pixelSize:p},n);if(!u)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:f}=i;f&&"value"!==f.toLowerCase()&&(u=c(u,s,f));const m=Q(t),{transformType:x}=i;if(x){const e={lambda:i.lambda,shift:i.shift};u=m?await m.transformPixels({pixelBlock:u,transformType:x,transformParameters:e},{...n,transferPixelsToWorker:!0}):l(u,x,e)}const d=i.histogramSize??void 0;return m?await m.computeStatisticsHistograms({pixelBlock:u,histogramSize:d,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):w(u,{histogramSize:d,includeSkewnessKurtosis:!0})}export{J as computeBoxStatistics,A as computeRasterAttributeTable,Y as computeStatisticsHistograms,O as createPixelFeatureSetCursor,D as fetchPixelFeatureSet,G as identifyAveragePixelValue,K as readIntersectingPixels};
2
+ import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import{getByteCount as o}from"../formats/pixelRangeUtils.js";import{convertPixelSize as a,snapToRaster as r,clip as s}from"../functions/clipUtils.js";import{transformPixels as l}from"../functions/pixelTransformUtils.js";import{mapPixelValueToAttribute as c,mosaic as p,pixelIdFieldName as u,convertPixelBlockToFeatures as f,getValidPixels as m,countCategoricalPixels as x}from"../functions/pixelUtils.js";import{load as d,projectPolygon as h}from"../functions/rasterProjectionHelper.js";import{computeBoxStatistics as y,computeStatisticsHistograms as w}from"../functions/stretchUtils.js";import g from"../../support/Field.js";import S from"../../support/PixelBlock.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const z=2**30,B=2048,P=2**20,I=20,R=100;async function j(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function v(e){const{rasterInfo:t,geometry:i,pixelSize:o,downsampleOnly:s=!1,maxPixelCountForDownsample:l}=e;if(!o)return!0;if(!s)return!1;const c=a(o,t.spatialReference);if(c.x+c.y<=t.pixelSize.x+t.pixelSize.y)return!0;if(null==l)return!1;const p="polyline"===i?.type?i.extent:i??t.extent,u=new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference}),f=r(t,p,u);return f.width*f.height<=l}function F(e){const t=[new g({name:u,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new g({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function C(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<I){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/R;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await d(),t=h(t,i)}return t}async function M(e,t,i=!1){const{spatialReference:o}=e,a=t?.geometry,s=await C(a??e.extent,o),l="extent"===s.type?s:s.extent,c=null==a||"extent"===a.type&&a.spatialReference.equals(o)?void 0:s,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),u=!!t?.autoResample,f=u?p:t?.pixelSize??p;let{extent:m,width:x,height:d}=r(e,l,f);if(!u)return{extent:m,clipGeometry:c,width:x,height:d,pixelSize:f};const h=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=f;const g=t?.maxPixelCount??P;for(;x*d>g&&(!i||Math.max(x,d)>1024);)y*=h,w*=h,x/=h,d/=h;return x=Math.round(x),d=Math.round(d),{extent:m,clipGeometry:c,width:x,height:d,pixelSize:new n({x:y,y:w,spatialReference:o})}}async function*T(e,n,o=!1,a){const{extent:r,clipGeometry:l,width:c,height:p}=n,u=r.width/c,f=r.height/p,m=Math.ceil(c/B),x=Math.ceil(p/B),d=u*B,h=f*B,{xmin:y,xmax:w,ymin:g,ymax:S}=r,k=x*m,b={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...a};for(let z=0;z<x;z++)for(let n=0;n<m;n++){t(b);const a=new i({xmin:y+n*d,xmax:o?Math.min(w,y+(n+1)*d):y+(n+1)*d,ymax:S-z*h,ymin:o?Math.max(g,S-(z+1)*h):S-(z+1)*h,spatialReference:r.spatialReference}),c={row:z,col:n},p=z*m+n+1;if(l&&!a.intersects(l)){yield{extent:a,pixelBlock:null,id:c,total:k,current:p};continue}const x=o?Math.round(a.width/u):B,P=o?Math.round(a.height/f):B;let{pixelBlock:I}=await e.fetchPixels(a,x,P,b).catch(()=>({pixelBlock:void 0}));I&&l&&(I=await s(I,a,l)),yield{extent:a,pixelBlock:I,id:c,total:k,current:p}}}async function*O(e,i,n){const o=await j(e,n),a=F(o),r={...i,geometry:i?.geometry??o.extent},s=T(e,await M(o,r),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const r=Q(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await V({pixelBlock:s,rasterJobHandler:r},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*o.width*B+c.id.col*B;t(n),f.featureSet=await $({pixelBlock:s,extent:c.extent,fields:a,skipFactor:i?.skipFactor??1,rasterJobHandler:r,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function H(t,i,n){const a=o(i),{width:r,height:s}=t;if(r*s*a>z)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&r*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function D(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const o=await j(t),a=await M(o,i,!0);H(a,o.pixelType);const{extent:r,pixelSize:s}=a,l=Math.round(o.extent.width/s.x),c=F(o),p={fields:c,features:[]},u=p.features,{maxPixelCount:f}=i,m=!!i.autoResample&&null!=f&&a.width*a.height>f,x=m?1:i.skipFactor??1,d=a.width<=B||a.height<=B,h=T(t,a,1===x||d,n);for await(const e of h){if(!e.pixelBlock)continue;const i=Q(t),a=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),r=await $({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:a,imageRowSize:l},n);if(r?.features?.length){const{features:e}=r,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}if(m&&f){const e=f/(i.skipFactor??1)**2;if(u.length>e){const t=u.length/e,i=[...u],n=u.length-1;u.length=0;for(let o=0,a=0;o<e-1;o++){a+=t;const e=Math.round(a);e<n&&u.push(i[e])}}}return{extent:r,featureSet:p,pixelSize:s}}async function J(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return q(e,n,i);if("polyline"===n.type)return U(e,n,i);const o=await X(e,{geometry:n},i);if(!o)return null;return y(o)}async function q(e,t,i){const n=await j(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>E(e,t,i)),a=(await Promise.all(o)).filter(e=>null!=e);if(a.length<=1)return N(a[0]);const r=a[0].map((e,t)=>a.map(e=>e[t]));return y(new S({pixels:r,pixelType:n.pixelType}))}async function E(e,t,i){if("imagery"===e.type){const n=await e.identify(new b({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function N(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function U(e,t,i){const n=await K(e,{geometry:t},i),o=await j(e,i),{bandCount:a,pixelType:r}=o,s=new Array(a).fill(0).map(()=>S.createEmptyBand(r,n.length));let l=0;for(let c=0;c<n.length;c++){const e=n[c];if(null!=e.value){l++;for(let t=0;t<a;t++)s[t][c]=e.value[t]}}l!==n.length&&s.forEach((e,t)=>{s[t]=e.subarray(0,l)});return y(new S({pixels:s,pixelType:r}))}async function A(t,i,n){const o=await j(t,n);if(!o.attributeTable)return null;const a=o.attributeTable.clone(),r=a.fields.find(e=>"value"===e.name.toLowerCase());let s=a.fields.find(e=>"count"===e.name.toLowerCase());if(!r)throw new e("compute-attribute-table","Value field not found in attribute table");s||(s=new g({name:"Count",alias:"Count",type:"double"}),a.fields.push(s),a.features.forEach(e=>{e.attributes[s.name]=0}));const{geometry:l,pixelSize:c,downsampleOnly:p,maxPixelCountForDownsample:u}=i,f=new Map,m=v({rasterInfo:o,geometry:l,pixelSize:c,downsampleOnly:p,maxPixelCountForDownsample:u})?void 0:c;return await _(t,{geometry:l,pixelSize:m},(e,t)=>x(e,f),n),a.features.forEach(e=>{const t=e.attributes[r.name];e.attributes[s.name]=f.get(t)??0}),a}async function G(e,t,i){const{geometry:n}=t;if("point"===n.type)return E(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>E(e,t,i)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return L(o).map(e=>e/o.length)}const o=await _(e,{geometry:n},(e,t)=>W(e),i),a=o?.filter(e=>e.count>0);if(!a?.length)return null;const r=L(a.map(e=>e.bandSum)),s=a.map(e=>e.count).reduce((e,t)=>e+t);return r.map(e=>e/s)}function L(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function W(e){const{width:t,height:i,pixels:n,mask:o}=e,a=new Array(n.length).fill(0);let r=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)a[e]+=n[e][i];r++}}return{bandSum:a,count:r}}async function K(e,t,i){const n=await _(e,{geometry:t.geometry},m,i);return n?.flat()??[]}async function _(i,n,o,a){const r=i.spatialReference;let{geometry:l}=n;if("polyline"===l.type&&!l.spatialReference.equals(r)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(l,r);if(null==t)throw new e("read-pixels","failed to fetch pixels");l=t}const c="polyline"===l.type?l.extent:l,p=await C(c,r),u="polyline"===l.type?l:p,f=await j(i,a),m={geometry:p,autoResample:!1,pixelSize:n?.pixelSize},x=[],d=T(i,await M(f,m),!0,a);for await(const e of d){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await s(e.pixelBlock,i,u),i);x.push(n),t(a)}return x}async function V(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:a}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):w(n);return{statistics:o,histograms:a}}async function $(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:a,pixelIdOffset:r,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=a?await a.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s});return p?{fields:n,features:p}:void 0}function Q(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function X(e,t,i){const n=await j(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await M(n,t);o.bandIds=t.bandIds?.length?t.bandIds:void 0,H(o,n.pixelType,t.maxPixelCount);const{width:a,height:r}=o;if(a<=B&&r<=B){const t=o.bandIds?.length?o.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(o.extent,a,r,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=T(e,o,!1,i);for await(const p of l)s.push(p.pixelBlock);if(!s.some(e=>null!=e))return null;const c=Math.ceil(a/B),u=Math.ceil(r/B),f={width:c*B,height:u*B};let m;const x=Q(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=p(s,f);return m}async function Y(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const{pixelSize:o,downsampleOnly:a,maxPixelCountForDownsample:r}=i,s=await j(t,n),p=v({rasterInfo:s,geometry:i.geometry,pixelSize:o,downsampleOnly:a,maxPixelCountForDownsample:r})?void 0:o;let u=await X(t,{...i,pixelSize:p},n);if(!u)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:f}=i;f&&"value"!==f.toLowerCase()&&(u=c(u,s,f));const m=Q(t),{transformType:x}=i;if(x){const e={lambda:i.lambda,shift:i.shift};u=m?await m.transformPixels({pixelBlock:u,transformType:x,transformParameters:e},{...n,transferPixelsToWorker:!0}):l(u,x,e)}const d=i.histogramSize??void 0;return m?await m.computeStatisticsHistograms({pixelBlock:u,histogramSize:d,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):w(u,{histogramSize:d,includeSkewnessKurtosis:!0})}export{J as computeBoxStatistics,A as computeRasterAttributeTable,Y as computeStatisticsHistograms,O as createPixelFeatureSetCursor,D as fetchPixelFeatureSet,G as identifyAveragePixelValue,K as readIntersectingPixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import{getPixelValueRange as e}from"../formats/pixelRangeUtils.js";import n from"../../support/PixelBlock.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function r(t,e){return e?.length&&o(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const e=t,{width:l,height:i,pixelType:r}=e[0];if(e.some(t=>t.width!==l||t.height!==i))return null;const s=e.map(({mask:t})=>t).filter(t=>null!=t);let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&k(s.slice(1),a));const h=[];e.forEach(({pixels:t})=>h.push(...t));const f=null!=a&&h.length===e.length?e.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=e.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new n({pixelType:r,width:l,height:i,mask:a,bandMasks:f,pixels:h,statistics:u.length?u:null})}function a(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach(t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function h(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let d,m=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<r;e++)i[e]&&(m=4*(c[e]-h),m<h||m>t?i[e]=0:(u[e]=s[m],p[e]=s[m+1],x[e]=s[m+2],i[e]=s[m+3]));else{i=new Uint8Array(r);for(let e=0;e<r;e++)m=4*(c[e]-h),m<h||m>t?i[e]=0:(u[e]=s[m],p[e]=s[m+1],x[e]=s[m+2],i[e]=s[m+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<r;o++)i[o]&&(d=a[c[o]],u[o]=d[0],p[o]=d[1],x[o]=d[2],i[o]=d[3]);else{i=new Uint8Array(r);for(let t=0;t<r;t++)d=a[c[t]],u[t]=d[0],p[t]=d[1],x[t]=d[2],i[t]=d[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function f(t,e){if(!o(t))return null;const{pixels:l,mask:i}=t,r=l.length;let s=e.lut;const{offset:a}=e;s&&1===s[0].length&&(s=l.map(()=>s));const h=[],f=e.outputPixelType||"u8";for(let n=0;n<r;n++){const t=c(l[n],i,s[n],a||0,f);h.push(t)}const u=new n({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return u.updateStatistics(),u}function c(t,e,l,i,o){const r=t.length,s=n.createEmptyBand(o,r);if(e)for(let n=0;n<r;n++)e[n]&&(s[n]=l[t[n]-i]);else for(let n=0;n<r;n++)s[n]=l[t[n]-i];return s}function u(t,e,n,l){const{width:i,height:o,pixels:r,mask:s}=t,a=i*o,{bandId:h,ranges:f}=n,c=r[h];if(!c)return;const u=1===f.length,[p,x]=f[0];for(let d=0;d<a;d++)if(!s||s[d]){const t=c[d];if(u)t>=p&&t<=x&&(e[d]=l);else for(let n=0;n<f.length;n++){const[i,o]=f[n];if(t>=i&&t<=o){e[d]=l;break}}}}function p(t,e,n,l){const{width:i,height:o,xyMask:r,xBandId:s,yBandId:a,xBandRange:h,yBandRange:f}=n,{pixels:c,mask:u}=t,p=c[s],x=c[a],[d,m]=h,[g,y]=f,w=(m-d)/i,k=(y-g)/o;for(let M=0;M<p.length;M++)if(!u||u[M]){let t=p[M],n=x[M];if(t<d||t>m||n<g||n>y)continue;r?(t=(t-d)*w,t=t>i-1?i-1:t<0?0:255&t,n=(y-n)*k,n=n>o-1?o-1:n<0?0:255&n,r[n*i+t]&&(e[M]=l)):e[M]=l}}function x(t){const{pixelBlock:e,renderedPixelBlock:n,highlightOptions:l}=t;if(!o(e))return;const{width:i,height:r}=e,s=i*r,a=new Uint8Array(s);for(let o=1;o<=l.length;o++){const t=l[o-1];"bandId"in t?u(e,a,t,o):p(e,a,t,o)}const{pixels:h}=n;1===h.length&&(h[1]=h[0].slice(),h[2]=h[0].slice());const f=l.map(t=>t.color),[c,x,d]=h;if(n.mask){const t=n.mask;for(let e=0;e<s;e++)if(t[e]){t[e]=255;const n=a[e];if(n){const l=f[n-1];c[e]=l[0],x[e]=l[1],d[e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(s).fill(255);for(let e=0;e<s;e++){const n=a[e];if(n){const l=f[n-1];c[e]=l[0],x[e]=l[1],d[e]=l[2],t[e]=l[3]}}n.mask=t}n.maskIsAlpha=!0}function d(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=h[o];let n=!1,l=s,i=a,x=0,d=r-1;for(;d-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:d=l,l=Math.floor((x+d)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[d].value?(i=e[d],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[d].value?(i=e[x],n=!0):d===r-1?n=!1:(i=e[d],n=!0))),n?(f[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):f[o]=c[o]=u[o]=p[o]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function m(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function g(t,l){if(!o(t))return null;const{width:i,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],d=n.createEmptyBand(h,x.length),m=t.mask,g=new Uint8Array(i*r);m?g.set(m):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map(t=>t-y);w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=e(h);for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===s[2*l]||t>w[2*l]&&t<w[2*l+1]){d[n]=a[l],e=!0;break}e||(c?d[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!m||m[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){d[n]=0,g[n]=0;break}}}return new n({width:i,height:r,pixelType:h,pixels:[d],mask:g})}function y(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function w(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}return e}function k(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}return e}function M(t,e){if(!o(t))return null;const{width:l,height:i,pixels:r}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=r.length,{includedRanges:f,noDataValues:u,outputPixelType:p,matchAll:x,lookups:d}=e;if(d){const t=[];for(let e=0;e<h;e++){const n=d[e],l=c(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?w(t,a):k(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),y(r[e],f?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):w(t,a)}else for(let n=0;n<h;n++)y(r[n],f?.slice(2*n,2*n+2),u?.[n],a);return new n({width:l,height:i,pixelType:p,pixels:r,mask:a})}function A(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=n.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,d]=e(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>d?d:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function U(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function b(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function T(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),s=Math.min.apply(null,r.map(t=>t.extent.xmin)),a=Math.min.apply(null,r.map(t=>t.extent.ymin)),h=Math.max.apply(null,r.map(t=>t.extent.xmax)),f=Math.max.apply(null,r.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:S(r.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function B(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=b(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let d=u.ymin;d<u.ymax;d++){const n=(i*s+d-h)*f+(l*r-a)+p,o=d*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let d=u.ymin;d<u.ymax;d++){const n=(i*s+d-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function S(t,e,l={}){const{clipOffset:i,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,e,{blockWidths:a});const h=t.find(t=>o(t));if(null==h)return null;const f=r?r.width:e.width,c=r?r.height:e.height,u=h.width,p=h.height,x=e.width/u,d=e.height/p,m={offset:i||{x:0,y:0},mosaic:r||e,block:{width:u,height:p}},g=h.pixelType,y=n.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let n=0;n<w;n++){A=new y(f*c);for(let e=0;e<d;e++)for(let l=0;l<x;l++){const i=t[e*x+l];o(i)&&(M=i.pixels[n],B(A,M,m,l,e,s))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),b=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),T=U?new Uint8Array(f*c):void 0,S=b?[]:void 0;if(T){for(let e=0;e<d;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;B(T,null!=i?i:l?255:0,m,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<d;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;B(n,null!=r?r:o?255:0,m,i,l,s)}S.push(n)}}const C=new n({width:f,height:c,pixels:k,pixelType:g,bandMasks:S,mask:T});return C.updateStatistics(),C}function v(t,e,l){const i=t.find(t=>null!=t);if(null==i)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=e,h=r?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=n.getPixelArrayConstructor(i.pixelType);if(r)for(let n=0,y=0;n<t.length;y+=f[n],n++){const e=t[n];if(!o(e))continue;const l=e.mask;for(let t=0;t<a;t++)for(let i=0;i<f[n];i++)h[t*s+i+y]=null==l?255:l[t*e.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),d=x?[]:void 0,m=s*a;for(let n=0;n<u;n++){const e=new p(m),l=x?new Uint8Array(m):void 0;for(let i=0,r=0;i<t.length;r+=f[i],i++){const h=t[i];if(!o(h))continue;const c=h.pixels[n];if(null!=c){for(let t=0;t<a;t++)for(let n=0;n<f[i];n++)e[t*s+n+r]=c[t*h.width+n];if(l){const t=h.bandMasks?.[n]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+r]=t?t[e*h.width+n]:255}}}c.push(e),d&&l&&d.push(l)}const g=new n({width:s,height:a,mask:h,bandMasks:d,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function C(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>i)return t;if(0===r&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)f[t+e]=o<s||o>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function I(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,r=i[0],s=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;D(t,r[i],a?a[i]:1)}s[o*n]=R(t),s[o*n+1]=s[o*n+2]=s[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;D(t,r[l],a?a[l]:1),l=(o-1)*n+e+1,D(t,r[l],a?a[l]:1),l=o*n+e+1,D(t,r[l],a?a[l]:1),l=(o+1)*n+e+1,D(t,r[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,r[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,r[l],a?a[l]:1),l=o*n+e-3,P(t,r[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,r[l],a?a[l]:1),s[o*n+e]=R(t)}s[o*n+e+1]=s[o*n+e]}for(let o=0;o<n;o++)s[o]=s[n+o]=s[2*n+o],s[(l-1)*n+o]=s[(l-2)*n+o];return e.updateStatistics(),e}function R(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function D(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function _(t,e,l){let{x:i,y:r}=e;const{width:s,height:a}=l;if(0===i&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(r+a,f);if(p<0||x<0||!o(t))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:d}=t,m=s*a,g=d.length,y=[];for(let o=0;o<g;o++){const e=d[o],l=n.createEmptyBand(t.pixelType,m);for(let t=c;t<x;t++){const n=t*h;let o=(t+r-c)*s+i;for(let t=u;t<p;t++)l[o++]=e[n+t]}y.push(l)}const w=new Uint8Array(m),k=t.mask;for(let n=c;n<x;n++){const t=n*h;let e=(n+r-c)*s+i;for(let n=u;n<p;n++)w[e++]=k?k[t+n]:1}const M=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function F(t,e=!0){if(!o(t))return null;const{pixels:l,width:i,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(r/2),u=r-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],s=n.createEmptyBand(a,f*c);let x=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=t[n*i+l];if(e){const e=l===p?o:t[n*i+l+1],r=n===u?o:t[n*i+l+i],a=l===p?r:n===u?e:t[n*i+l+i+1];s[x++]=(o+e+r+a)/4}else s[x++]=o}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=s[n*i+l];if(e){const e=l===p?o:s[n*i+l+1],r=n===u?o:s[n*i+l+i],a=l===p?r:n===u?e:s[n*i+l+i+1];x[t++]=o*e*r*a?1:0}else x[t++]=o}}return new n({width:f,height:c,pixelType:a,pixels:h,mask:x})}function W(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:r}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(s/i),n=Math.ceil(a/r);for(let l=0;l<n;l++){f.y=l*r;for(let n=0;n<t;n++){f.x=n*i;const t=_(u,f,e);h.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=F(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function E(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:r,useBilinear:s}=t;if(!o(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=_(e,{y:i*u,x:r*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=F(p,s);return p}function N(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,d,m,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let B,S,v=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],d=n[p+1],m=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=0;t<e;t++)B=(t+.5)/h,A[v+t]=(x*B+d*S+m)*o+i,U[v+t]=(g*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}p+=6,x=n[p],d=n[p+1],m=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=e;t<h;t++)B=(t+.5)/h,A[v+t]=(x*B+d*S+m)*o+i,U[v+t]=(g*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=N(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function z(t,e,l,i,r="nearest"){if(!o(t))return null;"majority"===r&&(t=I(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=n.getPixelArrayConstructor(f),x=s.length,{width:d,height:m}=e;let g=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=N({width:c,height:u},e,l,i,"majority"===r?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<m;o++){U=o*A;for(let r=0;r<d;r++){if(y[U]<0||w[U]<0)t[o*d+r]=0;else if(l)t[o*d+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*d+r]=(1-u)*n+u*p+i}else t[o*d+r]=e[k[U]+M[U]*c]}U++}}},T=[];let B;const S=h?.length===x,v=[];for(let n=0;n<x;n++){if(S){const t=new Uint8Array(d*m);b(t,h[n],h[n],!0),v.push(t)}B=new p(d*m),b(B,s[n],S?h[n]:a,"nearest"===r||"majority"===r),T.push(B)}const C=new n({width:d,height:m,pixelType:f,pixels:T,bandMasks:S?v:void 0});if(null!=a)C.mask=new Uint8Array(d*m),b(C.mask,a,a,!0);else if(g){C.mask=new Uint8Array(d*m);for(let t=0;t<d*m;t++)C.mask[t]=y[t]<0||w[t]<0?0:1}return C.updateStatistics(),C}function O(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:r=!1,pixelIdOffset:s=0}=t,a=[],{width:h,height:f,pixels:c,mask:u}=e,p=t.imageRowSize??h,x=n.width/h,d=n.height/f,m=c.length,g=Math.floor(o/2),{xmin:y,ymax:w}=n,k=r?void 0:n.spatialReference.toJSON();for(let M=g;M<f;M+=o)for(let t=g;t<h;t+=o){const e=M*h+t;if(!u||u[e]){const n={x:y+(t+.5)*x,y:w-(M+.5)*d,spatialReference:k},o={[i]:s+M*p+t};for(let t=0;t<m;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function L(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[r[t]]++,s++)}return s}function G(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:h-(u+.5)*s,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}function V(t,e,l){const{attributeTable:i}=e;if(!i)return t;const o=i.fields.find(t=>t.name.toLowerCase()===l.toLowerCase()),r=i.fields.find(t=>"value"===t.name.toLowerCase());if(!o||!r)return t;const[s]=t.pixels,a="single"===o.type?"f32":"double"===o.type||"big-integer"===o.type?"f64":"small-integer"===o.type?"s16":"s32",h=s.length,f=new("f32"===a?Float32Array:"f64"===a?Float64Array:"s16"===a?Int16Array:Int32Array)(h),c=new Map;for(const n of i.features){const t=n.attributes[r.name],e=n.attributes[o.name];c.set(t,e)}const u=t.mask??new Uint8Array(h).fill(255);for(let n=0;n<h;n++)if(u[n]){const t=c.get(s[n]);null==t?u[n]=0:f[n]=t}return new n({width:t.width,height:t.height,pixels:[f],mask:u,pixelType:a})}function $(t){const{srcDimensions:e,destDimension:n,transformGrid:{coefficients:l,spacing:i},bias:o=0,pos:{x:r,y:s}}=t;if(!l?.length)return null;const{width:a,height:h}=e,{width:f}=n,[c,u]=i,p=Math.ceil(f/c-.1/c),x=Math.floor(r/c),d=Math.floor(s/u),m=Math.floor(r-x*c),g=Math.floor(s-d*u),y=12*(d*p+x)+(m>=g?6:0),w=(g+.5)/u,k=(m+.5)/c;return{x:(l[y]*k+l[y+1]*w+l[y+2])*a+o,y:(l[y+3]*k+l[y+4]*w+l[y+5])*h+o}}function J(t){const{pos:e,pixelData:n,pixelSize:l,transformGrid:i}=t;if(!n.pixelBlock)return null;const{xmin:o,xmax:r,ymin:s,ymax:a}=n.extent;let h=Math.floor((e.x-o)/l.x),f=Math.floor((a-e.y)/l.y);const c={width:Math.round((r-o)/l.x),height:Math.round((a-s)/l.y)},{width:u,height:p,mask:x}=n.pixelBlock;if(i){const t=$({pos:{x:h,y:f},transformGrid:i,srcDimensions:{width:u,height:p},destDimension:c});if(!t||t.x<0||t.x>=u||t.y<0||t.y>=p)return null;h=t.x,f=t.y}const d=Math.floor(f),m=Math.floor(h),g=d*u+m,y=x&&!x[g]?null:n.pixelBlock.pixels.map(t=>t[g]);return{x:h,y:f,row:d,col:m,position:g,value:y}}export{z as approximateTransform,_ as clip,E as clipTile,h as colorize,s as compositeBands,O as convertPixelBlockToFeatures,L as countCategoricalPixels,a as createColormapLUT,U as createMaskLUT,m as createRangeMaps,A as createRemapLUT,r as extractBands,b as getClipBounds,j as getLocalArithmeticNorthRotations,J as getPixelLocationAndValue,$ as getPixelOffset,G as getValidPixels,x as highlightPixels,N as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,f as lookupPixels,V as mapPixelValueToAttribute,M as mask,k as matchAnyMask,l as maxMapSizeGpu,S as mosaic,T as mosaicPixelData,i as pixelIdFieldName,g as remap,d as remapColor,I as resampleByMajority,u as selectBySingleBandRange,p as selectByXYMask,C as setValidBoundary,W as split};
2
+ import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import{getPixelValueRange as e}from"../formats/pixelRangeUtils.js";import n from"../../support/PixelBlock.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function r(t,e){return e?.length&&o(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const e=t,{width:l,height:i,pixelType:r}=e[0];if(e.some(t=>t.width!==l||t.height!==i))return null;const s=e.map(({mask:t})=>t).filter(t=>null!=t);let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&k(s.slice(1),a));const h=[];e.forEach(({pixels:t})=>h.push(...t));const f=null!=a&&h.length===e.length?e.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=e.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new n({pixelType:r,width:l,height:i,mask:a,bandMasks:f,pixels:h,statistics:u.length?u:null})}function a(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach(t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function h(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let d,m=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<r;e++)i[e]&&(m=4*(c[e]-h),m<h||m>t?i[e]=0:(u[e]=s[m],p[e]=s[m+1],x[e]=s[m+2],i[e]=s[m+3]));else{i=new Uint8Array(r);for(let e=0;e<r;e++)m=4*(c[e]-h),m<h||m>t?i[e]=0:(u[e]=s[m],p[e]=s[m+1],x[e]=s[m+2],i[e]=s[m+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<r;o++)i[o]&&(d=a[c[o]],u[o]=d[0],p[o]=d[1],x[o]=d[2],i[o]=d[3]);else{i=new Uint8Array(r);for(let t=0;t<r;t++)d=a[c[t]],u[t]=d[0],p[t]=d[1],x[t]=d[2],i[t]=d[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function f(t,e){if(!o(t))return null;const{pixels:l,mask:i}=t,r=l.length;let s=e.lut;const{offset:a}=e;s&&1===s[0].length&&(s=l.map(()=>s));const h=[],f=e.outputPixelType||"u8";for(let n=0;n<r;n++){const t=c(l[n],i,s[n],a||0,f);h.push(t)}const u=new n({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return u.updateStatistics(),u}function c(t,e,l,i,o){const r=t.length,s=n.createEmptyBand(o,r);if(e)for(let n=0;n<r;n++)e[n]&&(s[n]=l[t[n]-i]);else for(let n=0;n<r;n++)s[n]=l[t[n]-i];return s}function u(t,e,n,l){const{width:i,height:o,pixels:r,mask:s}=t,a=i*o,{bandId:h,ranges:f}=n,c=r[h];if(!c)return;const u=1===f.length,[p,x]=f[0];for(let d=0;d<a;d++)if(!s||s[d]){const t=c[d];if(u)t>=p&&t<=x&&(e[d]=l);else for(let n=0;n<f.length;n++){const[i,o]=f[n];if(t>=i&&t<=o){e[d]=l;break}}}}function p(t,e,n,l){const{width:i,height:o,xyMask:r,xBandId:s,yBandId:a,xBandRange:h,yBandRange:f}=n,{pixels:c,mask:u}=t,p=c[s],x=c[a],[d,m]=h,[g,y]=f,w=(m-d)/i,k=(y-g)/o;for(let M=0;M<p.length;M++)if(!u||u[M]){let t=p[M],n=x[M];if(t<d||t>m||n<g||n>y)continue;r?(t=(t-d)*w,t=t>i-1?i-1:t<0?0:255&t,n=(y-n)*k,n=n>o-1?o-1:n<0?0:255&n,r[n*i+t]&&(e[M]=l)):e[M]=l}}function x(t){const{pixelBlock:e,renderedPixelBlock:n,highlightOptions:l}=t;if(!o(e))return;const{width:i,height:r}=e,s=i*r,a=new Uint8Array(s);for(let o=1;o<=l.length;o++){const t=l[o-1];"bandId"in t?u(e,a,t,o):p(e,a,t,o)}const{pixels:h}=n;1===h.length&&(h[1]=h[0].slice(),h[2]=h[0].slice());const f=l.map(t=>t.color),[c,x,d]=h;if(n.mask){const t=n.mask;for(let e=0;e<s;e++)if(t[e]){t[e]=255;const n=a[e];if(n){const l=f[n-1];c[e]=l[0],x[e]=l[1],d[e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(s).fill(255);for(let e=0;e<s;e++){const n=a[e];if(n){const l=f[n-1];c[e]=l[0],x[e]=l[1],d[e]=l[2],t[e]=l[3]}}n.mask=t}n.maskIsAlpha=!0}function d(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=h[o];let n=!1,l=s,i=a,x=0,d=r-1;for(;d-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:d=l,l=Math.floor((x+d)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[d].value?(i=e[d],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[d].value?(i=e[x],n=!0):d===r-1?n=!1:(i=e[d],n=!0))),n?(f[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):f[o]=c[o]=u[o]=p[o]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function m(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function g(t,l){if(!o(t))return null;const{width:i,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],d=n.createEmptyBand(h,x.length),m=t.mask,g=new Uint8Array(i*r);m?g.set(m):g.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map(t=>t-y);w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=e(h);for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===s[2*l]||t>w[2*l]&&t<w[2*l+1]){d[n]=a[l],e=!0;break}e||(c?d[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!m||m[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){d[n]=0,g[n]=0;break}}}return new n({width:i,height:r,pixelType:h,pixels:[d],mask:g})}function y(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function w(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}return e}function k(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}return e}function M(t,e){if(!o(t))return null;const{width:l,height:i,pixels:r}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const h=r.length,{includedRanges:f,noDataValues:u,outputPixelType:p,matchAll:x,lookups:d}=e;if(d){const t=[];for(let e=0;e<h;e++){const n=d[e],l=c(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?w(t,a):k(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(s);n.set(a),y(r[e],f?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):w(t,a)}else for(let n=0;n<h;n++)y(r[n],f?.slice(2*n,2*n+2),u?.[n],a);return new n({width:l,height:i,pixelType:p,pixels:r,mask:a})}function A(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=n.createEmptyBand(h,f),p=new Uint8Array(f);r&&p.fill(255);const[x,d]=e(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>d?d:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function U(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function b(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function T(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),s=Math.min.apply(null,r.map(t=>t.extent.xmin)),a=Math.min.apply(null,r.map(t=>t.extent.ymin)),h=Math.max.apply(null,r.map(t=>t.extent.xmax)),f=Math.max.apply(null,r.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-s)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-s)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:S(r.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function B(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=b(r,s,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let d=u.ymin;d<u.ymax;d++){const n=(i*s+d-h)*f+(l*r-a)+p,o=d*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let d=u.ymin;d<u.ymax;d++){const n=(i*s+d-h)*f+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function S(t,e,l={}){const{clipOffset:i,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return v(t,e,{blockWidths:a});const h=t.find(t=>o(t));if(null==h)return null;const f=r?r.width:e.width,c=r?r.height:e.height,u=h.width,p=h.height,x=e.width/u,d=e.height/p,m={offset:i||{x:0,y:0},mosaic:r||e,block:{width:u,height:p}},g=h.pixelType,y=n.getPixelArrayConstructor(g),w=h.pixels.length,k=[];let M,A;for(let n=0;n<w;n++){A=new y(f*c);for(let e=0;e<d;e++)for(let l=0;l<x;l++){const i=t[e*x+l];o(i)&&(M=i.pixels[n],B(A,M,m,l,e,s))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),b=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),T=U?new Uint8Array(f*c):void 0,S=b?[]:void 0;if(T){for(let e=0;e<d;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;B(T,null!=i?i:l?255:0,m,n,e,s)}if(S)for(let e=0;e<w;e++){const n=new Uint8Array(f*c);for(let l=0;l<d;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;B(n,null!=r?r:o?255:0,m,i,l,s)}S.push(n)}}const C=new n({width:f,height:c,pixels:k,pixelType:g,bandMasks:S,mask:T});return C.updateStatistics(),C}function v(t,e,l){const i=t.find(t=>null!=t);if(null==i)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=e,h=r?new Uint8Array(s*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=n.getPixelArrayConstructor(i.pixelType);if(r)for(let n=0,y=0;n<t.length;y+=f[n],n++){const e=t[n];if(!o(e))continue;const l=e.mask;for(let t=0;t<a;t++)for(let i=0;i<f[n];i++)h[t*s+i+y]=null==l?255:l[t*e.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),d=x?[]:void 0,m=s*a;for(let n=0;n<u;n++){const e=new p(m),l=x?new Uint8Array(m):void 0;for(let i=0,r=0;i<t.length;r+=f[i],i++){const h=t[i];if(!o(h))continue;const c=h.pixels[n];if(null!=c){for(let t=0;t<a;t++)for(let n=0;n<f[i];n++)e[t*s+n+r]=c[t*h.width+n];if(l){const t=h.bandMasks?.[n]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*s+n+r]=t?t[e*h.width+n]:255}}}c.push(e),d&&l&&d.push(l)}const g=new n({width:s,height:a,mask:h,bandMasks:d,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function C(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,r=e.x,s=e.y,a=n.width+r,h=n.height+s;if(r<0||s<0||a>l||h>i)return t;if(0===r&&0===s&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)f[t+e]=o<s||o>=h||e<r||e>=a?0:1}return t.updateStatistics(),t}function I(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,r=i[0],s=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;D(t,r[i],a?a[i]:1)}s[o*n]=R(t),s[o*n+1]=s[o*n+2]=s[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;D(t,r[l],a?a[l]:1),l=(o-1)*n+e+1,D(t,r[l],a?a[l]:1),l=o*n+e+1,D(t,r[l],a?a[l]:1),l=(o+1)*n+e+1,D(t,r[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,r[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,r[l],a?a[l]:1),l=o*n+e-3,P(t,r[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,r[l],a?a[l]:1),s[o*n+e]=R(t)}s[o*n+e+1]=s[o*n+e]}for(let o=0;o<n;o++)s[o]=s[n+o]=s[2*n+o],s[(l-1)*n+o]=s[(l-2)*n+o];return e.updateStatistics(),e}function R(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function D(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function _(t,e,l){let{x:i,y:r}=e;const{width:s,height:a}=l;if(0===i&&0===r&&a===t.height&&s===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,r),u=Math.max(0,i),p=Math.min(i+s,h),x=Math.min(r+a,f);if(p<0||x<0||!o(t))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:d}=t,m=s*a,g=d.length,y=[];for(let o=0;o<g;o++){const e=d[o],l=n.createEmptyBand(t.pixelType,m);for(let t=c;t<x;t++){const n=t*h;let o=(t+r-c)*s+i;for(let t=u;t<p;t++)l[o++]=e[n+t]}y.push(l)}const w=new Uint8Array(m),k=t.mask;for(let n=c;n<x;n++){const t=n*h;let e=(n+r-c)*s+i;for(let n=u;n<p;n++)w[e++]=k?k[t+n]:1}const M=new n({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function F(t,e=!0){if(!o(t))return null;const{pixels:l,width:i,height:r,mask:s,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(r/2),u=r-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],s=n.createEmptyBand(a,f*c);let x=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=t[n*i+l];if(e){const e=l===p?o:t[n*i+l+1],r=n===u?o:t[n*i+l+i],a=l===p?r:n===u?e:t[n*i+l+i+1];s[x++]=(o+e+r+a)/4}else s[x++]=o}h.push(s)}let x=null;if(null!=s){x=new Uint8Array(f*c);let t=0;for(let n=0;n<r;n+=2)for(let l=0;l<i;l+=2){const o=s[n*i+l];if(e){const e=l===p?o:s[n*i+l+1],r=n===u?o:s[n*i+l+i],a=l===p?r:n===u?e:s[n*i+l+i+1];x[t++]=o*e*r*a?1:0}else x[t++]=o}}return new n({width:f,height:c,pixelType:a,pixels:h,mask:x})}function W(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:r}=e;let{width:s,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(s/i),n=Math.ceil(a/r);for(let l=0;l<n;l++){f.y=l*r;for(let n=0;n<t;n++){f.x=n*i;const t=_(u,f,e);h.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=F(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return h}function E(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:r,useBilinear:s}=t;if(!o(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=_(e,{y:i*u,x:r*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=F(p,s);return p}function N(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(s/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,d,m,g,y,w;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let B,S,v=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],d=n[p+1],m=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=0;t<e;t++)B=(t+.5)/h,A[v+t]=(x*B+d*S+m)*o+i,U[v+t]=(g*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}p+=6,x=n[p],d=n[p+1],m=n[p+2],g=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<f;e++){v=(C*f+e)*k+t*h,S=(e+.5)/f;for(let t=e;t<h;t++)B=(t+.5)/h,A[v+t]=(x*B+d*S+m)*o+i,U[v+t]=(g*B+y*S+w)*r+i,b[v+t]=Math.floor(A[v+t]),T[v+t]=Math.floor(U[v+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function j(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=N(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,h=new Float32Array(s*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*s+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*s+t]=e}}return h}function z(t,e,l,i,r="nearest"){if(!o(t))return null;"majority"===r&&(t=I(t));const{pixels:s,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=n.getPixelArrayConstructor(f),x=s.length,{width:d,height:m}=e;let g=!1;for(let n=0;n<l.length;n+=3)-1===l[n]&&-1===l[n+1]&&-1===l[n+2]&&(g=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=N({width:c,height:u},e,l,i,"majority"===r?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<m;o++){U=o*A;for(let r=0;r<d;r++){if(y[U]<0||w[U]<0)t[o*d+r]=0;else if(l)t[o*d+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),h=Math.ceil(w[U]),f=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+s*c]+f*e[a+s*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*d+r]=(1-u)*n+u*p+i}else t[o*d+r]=e[k[U]+M[U]*c]}U++}}},T=[];let B;const S=h?.length===x,v=[];for(let n=0;n<x;n++){if(S){const t=new Uint8Array(d*m);b(t,h[n],h[n],!0),v.push(t)}B=new p(d*m),b(B,s[n],S?h[n]:a,"nearest"===r||"majority"===r),T.push(B)}const C=new n({width:d,height:m,pixelType:f,pixels:T,bandMasks:S?v:void 0});if(null!=a)C.mask=new Uint8Array(d*m),b(C.mask,a,a,!0);else if(g){C.mask=new Uint8Array(d*m);for(let t=0;t<d*m;t++)C.mask[t]=y[t]<0||w[t]<0?0:1}return C.updateStatistics(),C}function O(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:r=!1,pixelIdOffset:s=0}=t,a=[],{width:h,height:f,pixels:c,mask:u}=e,p=t.imageRowSize??h,x=n.width/h,d=n.height/f,m=c.length,g=Math.floor(o/2),{xmin:y,ymax:w}=n,k=r?void 0:n.spatialReference.toJSON();for(let M=g;M<f;M+=o)for(let t=g;t<h;t+=o){const e=M*h+t;if(!u||u[e]){const n={x:y+(t+.5)*x,y:w-(M+.5)*d,spatialReference:k},o={[i]:s+M*p+t};for(let t=0;t<m;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function L(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)if(!o||o[t]){const n=r[t];e.set(n,(e.get(n)??0)+1),s++}}return s}function G(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:h-(u+.5)*s,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}function V(t,e,l){const{attributeTable:i}=e;if(!i)return t;const o=i.fields.find(t=>t.name.toLowerCase()===l.toLowerCase()),r=i.fields.find(t=>"value"===t.name.toLowerCase());if(!o||!r)return t;const[s]=t.pixels,a="single"===o.type?"f32":"double"===o.type||"big-integer"===o.type?"f64":"small-integer"===o.type?"s16":"s32",h=s.length,f=new("f32"===a?Float32Array:"f64"===a?Float64Array:"s16"===a?Int16Array:Int32Array)(h),c=new Map;for(const n of i.features){const t=n.attributes[r.name],e=n.attributes[o.name];c.set(t,e)}const u=t.mask??new Uint8Array(h).fill(255);for(let n=0;n<h;n++)if(u[n]){const t=c.get(s[n]);null==t?u[n]=0:f[n]=t}return new n({width:t.width,height:t.height,pixels:[f],mask:u,pixelType:a})}function $(t){const{srcDimensions:e,destDimension:n,transformGrid:{coefficients:l,spacing:i},bias:o=0,pos:{x:r,y:s}}=t;if(!l?.length)return null;const{width:a,height:h}=e,{width:f}=n,[c,u]=i,p=Math.ceil(f/c-.1/c),x=Math.floor(r/c),d=Math.floor(s/u),m=Math.floor(r-x*c),g=Math.floor(s-d*u),y=12*(d*p+x)+(m>=g?6:0),w=(g+.5)/u,k=(m+.5)/c;return{x:(l[y]*k+l[y+1]*w+l[y+2])*a+o,y:(l[y+3]*k+l[y+4]*w+l[y+5])*h+o}}function J(t){const{pos:e,pixelData:n,pixelSize:l,transformGrid:i}=t;if(!n.pixelBlock)return null;const{xmin:o,xmax:r,ymin:s,ymax:a}=n.extent;let h=Math.floor((e.x-o)/l.x),f=Math.floor((a-e.y)/l.y);const c={width:Math.round((r-o)/l.x),height:Math.round((a-s)/l.y)},{width:u,height:p,mask:x}=n.pixelBlock;if(i){const t=$({pos:{x:h,y:f},transformGrid:i,srcDimensions:{width:u,height:p},destDimension:c});if(!t||t.x<0||t.x>=u||t.y<0||t.y>=p)return null;h=t.x,f=t.y}const d=Math.floor(f),m=Math.floor(h),g=d*u+m,y=x&&!x[g]?null:n.pixelBlock.pixels.map(t=>t[g]);return{x:h,y:f,row:d,col:m,position:g,value:y}}export{z as approximateTransform,_ as clip,E as clipTile,h as colorize,s as compositeBands,O as convertPixelBlockToFeatures,L as countCategoricalPixels,a as createColormapLUT,U as createMaskLUT,m as createRangeMaps,A as createRemapLUT,r as extractBands,b as getClipBounds,j as getLocalArithmeticNorthRotations,J as getPixelLocationAndValue,$ as getPixelOffset,G as getValidPixels,x as highlightPixels,N as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,f as lookupPixels,V as mapPixelValueToAttribute,M as mask,k as matchAnyMask,l as maxMapSizeGpu,S as mosaic,T as mosaicPixelData,i as pixelIdFieldName,g as remap,d as remapColor,I as resampleByMajority,u as selectBySingleBandRange,p as selectByXYMask,C as setValidBoundary,W as split};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.34",
3
+ "version": "5.2.0-next.35",
4
4
  "type": "module",
5
5
  "homepage": "https://js.arcgis.com",
6
6
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
@@ -547,14 +547,14 @@ export default class Features extends FeaturesSuperclass {
547
547
  * @internal
548
548
  * @see [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/Features/#selectedFeatureIndex)
549
549
  */
550
- next(): Features;
550
+ next(): void;
551
551
  /**
552
552
  * Selects the feature at the previous index in relation to the selected feature.
553
553
  *
554
554
  * @internal
555
555
  * @see [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/Features/#selectedFeatureIndex)
556
556
  */
557
- previous(): Features;
557
+ previous(): void;
558
558
  /**
559
559
  * Sets the view to a given target. If [goToOverride](https://developers.arcgis.com/javascript/latest/references/core/popup/Features/#goToOverride) is set, `goToOverride()` will be called with the current view and specified `params`.
560
560
  * Otherwise, the view will be set using the provided `params`.
package/popup/Features.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Error.js";import{EventedAccessor as r}from"../core/Evented.js";import s from"../core/Logger.js";import{abortMaybe as n}from"../core/maybe.js";import{debounce as o,isAbortError as a}from"../core/promiseUtils.js";import l from"../core/ReactiveSet.js";import{watch as h,when as u,sync as c}from"../core/reactiveUtils.js";import{addMany as p}from"../core/SetUtils.js";import{property as d,subclass as g}from"../core/accessorSupport/decorators.js";import m from"../geometry/Point.js";import{initializeProjection as f,project as y}from"../geometry/projectionUtils.js";import _ from"../geometry/SpatialReference.js";import{geographicToWebMercator as F}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as v}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as w}from"../layers/LayerConstants.js";import{ActionsCollection as C,zoomToAggregatedFeatures as b,browseAggregatedFeatures as I,zoomToFeature as P}from"./actions.js";import{getSelectedTarget as A}from"./actionUtils.js";import L from"./Feature.js";import j from"./support/FeatureAbilities.js";import{getDisplayedSymbol as x}from"../symbols/support/symbolUtils.js";import{system as E}from"../time/constants.js";import{highlightsSupported as R}from"../views/support/layerViewUtils.js";import{GoTo as O}from"../widgets/support/GoTo.js";const U="location-scale-handle",S=()=>[P.clone()],T=()=>[b.clone(),I.clone()];let H=null;function M(e,t){switch(e){case"building-scene":case"map-image":case"tile":case"imagery":return!0;case"imagery-tile":return"2d"===t;default:return!1}}let D=class extends(O(r)){constructor(e){super(e),this._pendingPromises=new l,this._fetchFeaturesController=null,this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new j,this.actions=new C,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=o(async e=>{this._cancelLocationUpdate();const t=new AbortController,{signal:i}=t;this._locationUpdateController=t,await this._locationUpdate(e,{signal:i}).catch(()=>{}).finally(()=>{this._locationUpdateController===t&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([h(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),h(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),h(()=>this.location,e=>this._locationChange(e)),h(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),h(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),h(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),h(()=>this.featureItems,()=>this._featureItemsChange()),h(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),u(()=>!this.waitingForResult,()=>this._waitingForResultChange(),c),u(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelFetchingFeatures(),this._cancelCenterAtLocation(),this._pendingPromises.clear(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return this.open&&!this.waitingForResult}get allActions(){const e=this._get("allActions")||new C;e.removeAll();const{actions:i,defaultActions:r,defaultPopupTemplateEnabled:s,includeDefaultActions:n,selectedFeature:o}=this,a=n?r.concat(i):i,l=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),h=l?.actions,u=l?.overwriteActions?h:h?.concat(a)??a;return u?.filter(t).forEach(t=>e.add(t)),e}set content(e){this.promises=[],this._set("content",e)}get defaultActions(){const e=this._get("defaultActions")||new C;return e.removeAll(),e.addMany(this.selectedFeature?.isAggregate?T():S()),e}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}set features(e){if(this._get("features")===e)return;const t=e||[];this._set("features",t),this._syncSelectedFeatureIndex(t)}get initialDisplayMode(){return this._get("initialDisplayMode")||"feature"}set initialDisplayMode(e){this._set("initialDisplayMode",e),this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,r=e?.spatialReference?.isWGS84;r&&i&&(t=F(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._get("promises")!==e&&(this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),e=e.slice(),p(this._pendingPromises,e),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[]))}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??E}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return(!!this._fetchFeaturesController||this.pendingPromisesCount>0)&&0===this.featureCount}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,heading:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:r}=this;if(!r||!e)throw new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:r});return r.fetchPopupFeaturesLegacy(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_syncSelectedFeatureIndex(e){const{pendingPromisesCount:t,promiseCount:i,selectedFeatureIndex:r}=this,s=i&&e.length;"list"!==this.initialDisplayMode?s&&t&&-1===r?this.selectedFeatureIndex=0:s&&-1!==r||(this.selectedFeatureIndex=e.length?0:-1):(!s||s&&t===i)&&(this.selectedFeatureIndex=-1)}_centerAtLocation(){const{view:e}=this,t=A(this);this._cancelCenterAtLocation();const r=new AbortController,{signal:n}=r;return this._centerAtLocationController=r,t&&e?this.callGoTo({target:{target:t,scale:e.scale},options:{signal:n}}).catch(e=>{a(e)||s.getLogger(this).error(e)}):Promise.reject(new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:r}=this;r&&!this._locationUpdateController&&i&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){"list"!==this.initialDisplayMode&&(this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null)}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:r,featureItems:s}=this;if(null==i)return;const n=((i-1)*r+t)%t,o=Math.min(n+r,s.length);for(let a=n;a<o;a++){const t=s[a];t&&(t.graphic??=e[a])}}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;const s=v(e)?.type;if("map-image"!==s&&"imagery"!==s&&"imagery-tile"!==s||(e.symbol=await x(e)),(i||!t)&&e.geometry){if("point"===e.geometry.type)return void(this.location=e.geometry);const t=await import("../geometry/operators/labelPointOperator.js");return void(this.location=t.execute(e.geometry))}if(i&&!e.geometry){await this._centerAtLocation();const e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureItems",[])}_updateFeatureItems(){const e=this.selectedFeature,t=this.features,i=this.featureItems,r=this.view,s=this.spatialReference,n=this.map,o=this.timeZone,a=this.location,l=this.featureItemAbilities??this._defaultFeatureAbilities;if(!t?.length)return void this._destroyFeatureItems();const h=[],u=new Map,c=new Set;i.forEach(e=>{const t=e?.graphic;e&&t&&u.set(t,e)}),t.forEach((t,p)=>{if(!t)return;const d=i[p];if(d&&!c.has(d)&&(null==d.graphic||d.graphic===t))return d.abilities=l,h[p]=d,void c.add(d);const g=u.get(t);if(g&&!c.has(g))return g.abilities=l,h[p]=g,void c.add(g);const m=new L({abilities:l,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:s,graphic:t===e?t:null,location:a,map:n,view:r,timeZone:o});h[p]=m,c.add(m)}),i.forEach(e=>{!e||c.has(e)||e.destroyed||e.destroy()}),this._set("featureItems",h)}async _getScreenPoint(e,t){const{spatialReference:i,view:r}=this;if(!r)return null;await r.when();const s=e?.spatialReference;return s&&i?(await f(s,i,null,t),r.toScreen(e)):null}_cancelCenterAtLocation(){this._centerAtLocationController=n(this._centerAtLocationController)}_cancelFetchingFeatures(){this._fetchFeaturesController=n(this._fetchFeaturesController)}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:r}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:r}),{signal:r,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const r=new AbortController,{signal:s}=r;this._fetchFeaturesController=r;const n=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:s,event:i});return n.catch(()=>{}).finally(()=>{this._fetchFeaturesController===r&&(this._fetchFeaturesController=null)}),n}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(U),this.addHandles([h(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{a(e)||s.getLogger(this).error(e)})),u(()=>!this.open,()=>{this.removeHandles(U)},{once:!0})],U);const{pendingFeatures:r}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:r}}async _locationUpdate(e,t){const{spatialReference:i}=this,r=this.selectedFeature?.geometry?.type,n=this.location??e;if(r&&"mesh"!==r&&i&&n&&this.selectedFeature){if("point"===r){const e=await import("../geometry/operators/labelPointOperator.js");return void(this.location=e.execute(this.selectedFeature.geometry))}try{const e=this.selectedFeature;let r=e.geometry;const s=this._getHighlightLayer(e),o=e.getObjectId();if(!s||!this.view)return;if(o){const e=this.view?.allLayerViews.find(e=>e.layer.uid===s.uid);if(!e||!("queryFeatures"in e))return;const n=e.createQuery();n.outSpatialReference=i,n.objectIds=[o],n.returnGeometry=!0;const{features:a}=await e.queryFeatures(n,t);r=a[0]?.geometry}if(!r||"mesh"===r.type)return;r=y(r,i),H??=await Promise.all([import("../geometry/operators/intersectsOperator.js"),import("../geometry/operators/proximityOperator.js")]);const[a,l]=H;if(!a.execute(r,n)){const t=l.getNearestCoordinate(r,n).coordinate??n;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||s.getLogger(this).error(o)}}}_cancelLocationUpdate(){this._locationUpdateController=n(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const t=v(e),{layer:i}=e;return t&&"layer"in t&&t.layer?t.layer:"map-notes"===t?.type||"subtype-group"===t?.type?t:i??t}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(M(t.type,i))return e;const r=e.getObjectId();if(null!=r)return r;const s="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||w:null,n=e.attributes;return n&&s&&n[s]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:r,view:s,open:n}=this;if(!s||!r||!n)return;const o=this._getHighlightLayer(i);if(!o)return;const a=this._getHighlightLayerView(s,o);if(!a)return;this._highlightPromises[e]=a;const l=await a;if(!(l&&R(l)&&this._highlightPromises[e]===a&&this[t]&&this.highlightEnabled))return;const h=l.highlight(this._getHighlightTarget(i,o,s.type));this.addHandles(h,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=new Set(t),r=e.filter(e=>!i.has(e));r?.length&&(this.features=t.concat(r))}};e([d()],D.prototype,"_fetchFeaturesController",void 0),e([d({type:C})],D.prototype,"actions",void 0),e([d({readOnly:!0})],D.prototype,"active",null),e([d()],D.prototype,"activeFeature",void 0),e([d({readOnly:!0})],D.prototype,"allActions",null),e([d()],D.prototype,"aggregatedFeaturesEnabled",void 0),e([d({value:null})],D.prototype,"content",null),e([d({type:C,readOnly:!0})],D.prototype,"defaultActions",null),e([d({type:Boolean})],D.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],D.prototype,"effectiveHeading",null),e([d({readOnly:!0})],D.prototype,"featureCount",null),e([d()],D.prototype,"featurePage",void 0),e([d({value:[]})],D.prototype,"features",null),e([d()],D.prototype,"featuresPerPage",void 0),e([d()],D.prototype,"featureMenuOpen",void 0),e([d({type:j})],D.prototype,"featureItemAbilities",void 0),e([d({readOnly:!0})],D.prototype,"featureItems",void 0),e([d()],D.prototype,"heading",void 0),e([d()],D.prototype,"highlightEnabled",void 0),e([d()],D.prototype,"includeDefaultActions",void 0),e([d({value:"feature"})],D.prototype,"initialDisplayMode",null),e([d({type:m})],D.prototype,"location",null),e([d()],D.prototype,"map",null),e([d()],D.prototype,"open",void 0),e([d({readOnly:!0})],D.prototype,"pendingPromisesCount",null),e([d({readOnly:!0})],D.prototype,"promiseCount",null),e([d()],D.prototype,"promises",null),e([d({value:null,readOnly:!0})],D.prototype,"selectedFeature",null),e([d({value:-1})],D.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],D.prototype,"selectedFeatureItem",null),e([d({type:_})],D.prototype,"spatialReference",null),e([d({readOnly:!0})],D.prototype,"state",null),e([d()],D.prototype,"timeZone",null),e([d()],D.prototype,"updateLocationEnabled",void 0),e([d()],D.prototype,"view",void 0),e([d({readOnly:!0})],D.prototype,"waitingForContents",null),e([d({readOnly:!0})],D.prototype,"waitingForResult",null),e([d()],D.prototype,"zoomFactor",void 0),D=e([g("esri.popup.Features")],D);const V=D;export{V as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Error.js";import{EventedAccessor as r}from"../core/Evented.js";import s from"../core/Logger.js";import{abortMaybe as n}from"../core/maybe.js";import{debounce as o,isAbortError as a}from"../core/promiseUtils.js";import l from"../core/ReactiveSet.js";import{watch as h,when as u,sync as c}from"../core/reactiveUtils.js";import{addMany as p}from"../core/SetUtils.js";import{property as d,subclass as g}from"../core/accessorSupport/decorators.js";import m from"../geometry/Point.js";import{initializeProjection as f,project as y}from"../geometry/projectionUtils.js";import _ from"../geometry/SpatialReference.js";import{geographicToWebMercator as F}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as v}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as w}from"../layers/LayerConstants.js";import{ActionsCollection as C,zoomToAggregatedFeatures as b,browseAggregatedFeatures as I,zoomToFeature as P}from"./actions.js";import{getSelectedTarget as A}from"./actionUtils.js";import L from"./Feature.js";import j from"./support/FeatureAbilities.js";import{getDisplayedSymbol as x}from"../symbols/support/symbolUtils.js";import{system as E}from"../time/constants.js";import{highlightsSupported as R}from"../views/support/layerViewUtils.js";import{GoTo as O}from"../widgets/support/GoTo.js";const U="location-scale-handle",S=()=>[P.clone()],T=()=>[b.clone(),I.clone()];let H=null;function M(e,t){switch(e){case"building-scene":case"map-image":case"tile":case"imagery":return!0;case"imagery-tile":return"2d"===t;default:return!1}}let D=class extends(O(r)){constructor(e){super(e),this._pendingPromises=new l,this._fetchFeaturesController=null,this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new j,this.actions=new C,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=o(async e=>{this._cancelLocationUpdate();const t=new AbortController,{signal:i}=t;this._locationUpdateController=t,await this._locationUpdate(e,{signal:i}).catch(()=>{}).finally(()=>{this._locationUpdateController===t&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([h(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),h(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),h(()=>this.location,e=>this._locationChange(e)),h(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),h(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),h(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),h(()=>this.featureItems,()=>this._featureItemsChange()),h(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),u(()=>!this.waitingForResult,()=>this._waitingForResultChange(),c),u(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelFetchingFeatures(),this._cancelCenterAtLocation(),this._pendingPromises.clear(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return this.open&&!this.waitingForResult}get allActions(){const e=this._get("allActions")||new C;e.removeAll();const{actions:i,defaultActions:r,defaultPopupTemplateEnabled:s,includeDefaultActions:n,selectedFeature:o}=this,a=n?r.concat(i):i,l=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),h=l?.actions,u=l?.overwriteActions?h:h?.concat(a)??a;return u?.filter(t).forEach(t=>e.add(t)),e}set content(e){this.promises=[],this._set("content",e)}get defaultActions(){const e=this._get("defaultActions")||new C;return e.removeAll(),e.addMany(this.selectedFeature?.isAggregate?T():S()),e}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}set features(e){if(this._get("features")===e)return;const t=e||[];this._set("features",t),this._syncSelectedFeatureIndex(t)}get initialDisplayMode(){return this._get("initialDisplayMode")||"feature"}set initialDisplayMode(e){this._set("initialDisplayMode",e),this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,r=e?.spatialReference?.isWGS84;r&&i&&(t=F(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._get("promises")!==e&&(this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),e=e.slice(),p(this._pendingPromises,e),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[]))}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??E}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return(!!this._fetchFeaturesController||this.pendingPromisesCount>0)&&0===this.featureCount}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,heading:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:r}=this;if(!r||!e)throw new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:r});return r.fetchPopupFeaturesLegacy(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_syncSelectedFeatureIndex(e){const{pendingPromisesCount:t,promiseCount:i,selectedFeatureIndex:r}=this,s=i&&e.length;"list"!==this.initialDisplayMode?s&&t&&-1===r?this.selectedFeatureIndex=0:s&&-1!==r||(this.selectedFeatureIndex=e.length?0:-1):(!s||s&&t===i)&&(this.selectedFeatureIndex=-1)}_centerAtLocation(){const{view:e}=this,t=A(this);this._cancelCenterAtLocation();const r=new AbortController,{signal:n}=r;return this._centerAtLocationController=r,t&&e?this.callGoTo({target:{target:t,scale:e.scale},options:{signal:n}}).catch(e=>{a(e)||s.getLogger(this).error(e)}):Promise.reject(new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:r}=this;r&&!this._locationUpdateController&&i&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){"list"!==this.initialDisplayMode&&(this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null)}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:r,featureItems:s}=this;if(null==i)return;const n=((i-1)*r+t)%t,o=Math.min(n+r,s.length);for(let a=n;a<o;a++){const t=s[a];t&&(t.graphic??=e[a])}}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;const s=v(e)?.type;if("map-image"!==s&&"imagery"!==s&&"imagery-tile"!==s||(e.symbol=await x(e)),(i||!t)&&e.geometry){if("point"===e.geometry.type)return void(this.location=e.geometry);const t=await import("../geometry/operators/labelPointOperator.js");return void(this.location=t.execute(e.geometry))}if(i&&!e.geometry){await this._centerAtLocation();const e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureItems",[])}_updateFeatureItems(){const e=this.selectedFeature,t=this.features,i=this.featureItems,r=this.view,s=this.spatialReference,n=this.map,o=this.timeZone,a=this.location,l=this.featureItemAbilities??this._defaultFeatureAbilities;if(!t?.length)return void this._destroyFeatureItems();const h=[],u=new Map,c=new Set;i.forEach(e=>{const t=e?.graphic;e&&t&&u.set(t,e)}),t.forEach((t,p)=>{if(!t)return;const d=i[p];if(d&&!c.has(d)&&(null==d.graphic||d.graphic===t))return d.abilities=l,h[p]=d,void c.add(d);const g=u.get(t);if(g&&!c.has(g))return g.abilities=l,h[p]=g,void c.add(g);const m=new L({abilities:l,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:s,graphic:t===e?t:null,location:a,map:n,view:r,timeZone:o});h[p]=m,c.add(m)}),i.forEach(e=>{!e||c.has(e)||e.destroyed||e.destroy()}),this._set("featureItems",h)}async _getScreenPoint(e,t){const{spatialReference:i,view:r}=this;if(!r)return null;await r.when();const s=e?.spatialReference;return s&&i?(await f(s,i,null,t),r.toScreen(e)):null}_cancelCenterAtLocation(){this._centerAtLocationController=n(this._centerAtLocationController)}_cancelFetchingFeatures(){this._fetchFeaturesController=n(this._fetchFeaturesController)}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:r}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:r}),{signal:r,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const r=new AbortController,{signal:s}=r;this._fetchFeaturesController=r;const n=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:s,event:i});return n.catch(()=>{}).finally(()=>{this._fetchFeaturesController===r&&(this._fetchFeaturesController=null)}),n}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(U),this.addHandles([h(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{a(e)||s.getLogger(this).error(e)})),u(()=>!this.open,()=>{this.removeHandles(U)},{once:!0})],U);const{pendingFeatures:r}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:r}}async _locationUpdate(e,t){const{spatialReference:i}=this,r=this.selectedFeature?.geometry?.type,n=this.location??e;if(r&&"mesh"!==r&&i&&n&&this.selectedFeature){if("point"===r){const e=await import("../geometry/operators/labelPointOperator.js");return void(this.location=e.execute(this.selectedFeature.geometry))}try{const e=this.selectedFeature;let r=e.geometry;const s=this._getHighlightLayer(e),o=e.getObjectId();if(!s||!this.view)return;if(o){const e=this.view?.allLayerViews.find(e=>e.layer.uid===s.uid);if(!e||!("queryFeatures"in e))return;const n=e.createQuery();n.outSpatialReference=i,n.objectIds=[o],n.returnGeometry=!0;const{features:a}=await e.queryFeatures(n,t);r=a[0]?.geometry}if(!r||"mesh"===r.type)return;r=y(r,i),H??=await Promise.all([import("../geometry/operators/intersectsOperator.js"),import("../geometry/operators/proximityOperator.js")]);const[a,l]=H;if(!a.execute(r,n)){const t=l.getNearestCoordinate(r,n).coordinate??n;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||s.getLogger(this).error(o)}}}_cancelLocationUpdate(){this._locationUpdateController=n(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const t=v(e),{layer:i}=e;return t&&"layer"in t&&t.layer?t.layer:"map-notes"===t?.type||"subtype-group"===t?.type?t:i??t}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(M(t.type,i))return e;const r=e.getObjectId();if(null!=r)return r;const s="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||w:null,n=e.attributes;return n&&s&&n[s]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:r,view:s,open:n}=this;if(!s||!r||!n)return;const o=this._getHighlightLayer(i);if(!o)return;const a=this._getHighlightLayerView(s,o);if(!a)return;this._highlightPromises[e]=a;const l=await a;if(!(l&&R(l)&&this._highlightPromises[e]===a&&this[t]&&this.highlightEnabled))return;const h=l.highlight(this._getHighlightTarget(i,o,s.type));this.addHandles(h,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=new Set(t),r=e.filter(e=>!i.has(e));r?.length&&(this.features=t.concat(r))}};e([d()],D.prototype,"_fetchFeaturesController",void 0),e([d({type:C})],D.prototype,"actions",void 0),e([d({readOnly:!0})],D.prototype,"active",null),e([d()],D.prototype,"activeFeature",void 0),e([d({readOnly:!0})],D.prototype,"allActions",null),e([d()],D.prototype,"aggregatedFeaturesEnabled",void 0),e([d({value:null})],D.prototype,"content",null),e([d({type:C,readOnly:!0})],D.prototype,"defaultActions",null),e([d({type:Boolean})],D.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],D.prototype,"effectiveHeading",null),e([d({readOnly:!0})],D.prototype,"featureCount",null),e([d()],D.prototype,"featurePage",void 0),e([d({value:[]})],D.prototype,"features",null),e([d()],D.prototype,"featuresPerPage",void 0),e([d()],D.prototype,"featureMenuOpen",void 0),e([d({type:j})],D.prototype,"featureItemAbilities",void 0),e([d({readOnly:!0})],D.prototype,"featureItems",void 0),e([d()],D.prototype,"heading",void 0),e([d()],D.prototype,"highlightEnabled",void 0),e([d()],D.prototype,"includeDefaultActions",void 0),e([d({value:"feature"})],D.prototype,"initialDisplayMode",null),e([d({type:m})],D.prototype,"location",null),e([d()],D.prototype,"map",null),e([d()],D.prototype,"open",void 0),e([d({readOnly:!0})],D.prototype,"pendingPromisesCount",null),e([d({readOnly:!0})],D.prototype,"promiseCount",null),e([d()],D.prototype,"promises",null),e([d({value:null,readOnly:!0})],D.prototype,"selectedFeature",null),e([d({value:-1})],D.prototype,"selectedFeatureIndex",null),e([d({readOnly:!0})],D.prototype,"selectedFeatureItem",null),e([d({type:_})],D.prototype,"spatialReference",null),e([d({readOnly:!0})],D.prototype,"state",null),e([d()],D.prototype,"timeZone",null),e([d()],D.prototype,"updateLocationEnabled",void 0),e([d()],D.prototype,"view",void 0),e([d({readOnly:!0})],D.prototype,"waitingForContents",null),e([d({readOnly:!0})],D.prototype,"waitingForResult",null),e([d()],D.prototype,"zoomFactor",void 0),D=e([g("esri.popup.Features")],D);const V=D;export{V as default};