@arcgis/core 6.0.0-next.29 → 6.0.0-next.30

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 (122) hide show
  1. package/WebDocument2D.js +1 -1
  2. package/WebMap.d.ts +3 -19
  3. package/WebMap.js +1 -1
  4. package/WebScene.js +1 -1
  5. package/arcgisGlobal.d.ts +1 -0
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +1 -0
  8. package/assets/esri/core/workers/chunks/{b01688ccc29d33bfc82d.js → 28a821de9dbf10324033.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d3c3fb079ad97970f834.js → 4fb2fcc95f852bf8f86c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{84940d8e14caf5a27e04.js → 64b360625c68cb863a08.js} +1 -1
  11. package/assets/esri/core/workers/chunks/71f792a20077aa739f87.js +1 -0
  12. package/assets/esri/core/workers/chunks/{e480e7d5f40049a2053b.js → 7af4edc6e87d27b9d467.js} +1 -1
  13. package/assets/esri/core/workers/chunks/90c1d10eae7ae71889b0.js +1 -0
  14. package/assets/esri/core/workers/chunks/{8a485130781b49dbf608.js → 9d40786c5ceface786ba.js} +1 -1
  15. package/assets/esri/core/workers/chunks/aba259a70bee68d2edb7.js +1 -0
  16. package/assets/esri/core/workers/chunks/c33a9635c294c8774977.js +1 -0
  17. package/assets/esri/views/3d/environment/resources/milkyway-band.avif +0 -0
  18. package/chunks/GlobalIllumination.glsl.js +16 -10
  19. package/chunks/GlobalIlluminationBlur.glsl.js +14 -14
  20. package/chunks/GlobalIlluminationUpscale.glsl.js +4 -4
  21. package/chunks/RibbonLine.glsl.js +78 -75
  22. package/config.js +1 -1
  23. package/core/workers/WorkerHandle.js +1 -1
  24. package/kernel.js +1 -1
  25. package/layers/WMTSLayer.d.ts +1 -1
  26. package/layers/WMTSLayer.js +1 -1
  27. package/layers/mixins/TiledImagery.d.ts +7 -0
  28. package/layers/support/WMTSSublayer.d.ts +5 -5
  29. package/networks/Network.js +1 -1
  30. package/networks/support/TopologyValidationJobInfo.js +1 -1
  31. package/package.json +2 -2
  32. package/rest/networks/support/ValidateNetworkTopologyResult.js +1 -1
  33. package/support/timeUtils.js +1 -1
  34. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  35. package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
  36. package/views/2d/layers/SketchLayerView2D.js +1 -1
  37. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  38. package/views/2d/types.d.ts +2 -1
  39. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  40. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  41. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  42. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  43. package/views/3d/interactive/visualElements/StageObjectVisualElement.js +2 -0
  44. package/views/3d/layers/WMTSLayerView3D.js +1 -1
  45. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  46. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  47. package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +1 -1
  48. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  49. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  50. package/views/3d/layers/graphics/Graphics3DPathSymbolLayerConstants.js +1 -1
  51. package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +1 -1
  52. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  53. package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
  54. package/views/3d/layers/graphics/pointUtils.js +1 -1
  55. package/views/3d/terrain/ExtentHelper.js +1 -1
  56. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  57. package/views/3d/terrain/PatchRenderData.js +1 -1
  58. package/views/3d/terrain/SphericalPatch.js +1 -1
  59. package/views/3d/terrain/TerrainRenderer.js +1 -1
  60. package/views/3d/terrain/TerrainSurface.js +1 -1
  61. package/views/3d/terrain/Tile.js +1 -1
  62. package/views/3d/terrain/tileUtils.js +1 -1
  63. package/views/3d/types.d.ts +2 -1
  64. package/views/3d/webgl-engine/Stage.js +1 -1
  65. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexInfo.glsl.js +10 -11
  66. package/views/3d/webgl-engine/core/shaderLibrary/util/PackedUint32.glsl.js +2 -0
  67. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  68. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  69. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  70. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +1 -1
  71. package/views/3d/webgl-engine/effects/globalIllumination/globalIlluminationUniforms.js +2 -0
  72. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  73. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  74. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  75. package/views/3d/webgl-engine/lib/PackedUint32.js +2 -0
  76. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  77. package/views/3d/webgl-engine/lib/PathVertexInfo.js +1 -1
  78. package/views/3d/webgl-engine/lib/RibbonLineVertexInfo.js +2 -0
  79. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  80. package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
  81. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  82. package/views/3d/webgl-engine/materials/LineCalloutMaterialBaseInstance.js +1 -1
  83. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  85. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  86. package/views/3d/webgl-engine/parts/Model.js +1 -1
  87. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  88. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +1 -1
  89. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  90. package/views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js +1 -1
  91. package/views/SelectionManager.d.ts +5 -5
  92. package/views/SelectionManager.js +1 -1
  93. package/views/input/InputManager.js +1 -1
  94. package/views/layers/WMTSLayerView.d.ts +16 -0
  95. package/views/layers/WMTSLayerView.js +2 -0
  96. package/views/layers/support/highlightUtils.js +1 -1
  97. package/views/selection/SelectionOperation.js +1 -1
  98. package/views/selection/types.d.ts +3 -3
  99. package/views/support/GeometryWorker.js +1 -1
  100. package/views/support/GeometryWorkerHandle.js +1 -1
  101. package/views/support/selectionUtils.js +1 -1
  102. package/webdoc/support/webdocLoadUtils.js +1 -1
  103. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  104. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  105. package/widgets/FeatureTable/RelationshipColumn.js +1 -1
  106. package/widgets/OrientedImageryViewer/imageMeasurementWorkerUtils.js +1 -1
  107. package/widgets/support/SelectionList/GroupLayerItem.d.ts +5 -5
  108. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  109. package/widgets/support/SelectionList/ItemBase.d.ts +3 -3
  110. package/widgets/support/SelectionList/LayerItem.js +1 -1
  111. package/widgets/support/SelectionList/SelectionListViewModel.d.ts +5 -6
  112. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  113. package/widgets/support/SelectionList/types.d.ts +3 -1
  114. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  115. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  116. package/widgets/support/symbolPreviewUtils.js +1 -1
  117. package/assets/esri/core/workers/chunks/2de4296590bf9f9e9add.js +0 -1
  118. package/assets/esri/core/workers/chunks/4976f5567fc7f1b63d10.js +0 -1
  119. package/assets/esri/core/workers/chunks/53c7510df09b71ab5646.js +0 -1
  120. package/assets/esri/core/workers/chunks/66c2a28a851130b87c04.js +0 -1
  121. package/assets/esri/core/workers/chunks/e7aaf7579592b79d6dd7.js +0 -1
  122. package/layers/geospatialPDF/CIM2DLayerview.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as o,rotate as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as c,fromValues as l,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as d,length as f,scale as p,distance as m,transformMat4 as h,set as g,normalize as _,subtract as v,transformMat3 as ee,scaleAndAdd as y,sub as b,dot as te}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as x,fromValues as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as C,create as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as T,empty as ne,expandPointInPlace as E}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec3f as re}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as ie}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as ae}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as D,isColor as oe,isOIT as se}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as ce}from"../core/shaderLibrary/hud/HUD.glsl.js";import{getVec3AttributeView as O,getVec2AttributeView as le,getScalarAttributeView as ue,getVec4AttributeView as de}from"../lib/attributeViewUtils.js";import{GLTextureMaterialBindParameters as fe,GLTextureMaterial as pe}from"../lib/GLTextureMaterial.js";import{PointMaterial as me}from"../lib/PointMaterial.js";import{screenPolygonIntersectsBounds as he,screenPolygonIntersectsTriangle as ge}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as _e,Hit as ve}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as ye}from"../lib/screenSizePerspectiveUtils.js";import{assert as be}from"../lib/Util.js";import{writePosition as xe,writeNormal as Se,writeColor as k,writeBufferVec2 as A,writeBufferFloat as j,writeBufferVec3 as Ce,writeBufferZeros as M,writeBufferVec4 as we}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Te}from"./internal/MaterialUtil.js";import{a as N}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Ee,getInstanceLayout as De,HUDMaterialTechnique as Oe}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ke}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as P}from"../../../../webscene/support/AlphaCutoff.js";class Ae extends me{constructor(e,t,n=!1){super(e,Ke),this.produces=new Map([[12,e=>D(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>D(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>D(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&D(e)]]),this._visible=!0,this._configuration=new ke(t,n)}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this,r=t.draped;n.enableOITOffset=e.enableOITOffset,n.hasSlicePlane=this.parameters.hasSlicePlane,n.hasVerticalOffset=!!this.parameters.verticalOffset,n.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,n.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits===`screen`,n.polygonOffset=this.parameters.polygonOffset,n.draped=r,n.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,n.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,n.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,n.hasRotation=this.parameters.hasRotation,n.hasVVSize=!!this.parameters.vvSize,n.hasVVColor=!!this.parameters.vvColor,n.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,n.hasFocusAreaStyle=this.parameters.focusAreaStyle!=null,n.depthTestEnabled=this.parameters.depthEnabled,n.hasVertexColor=this.parameters.hasVertexColor,n.hasVertexSize=this.parameters.hasVertexSize,n.hasVertexRotation=this.parameters.hasVertexRotation,n.hasVertexUVi=this.parameters.hasVertexUVi,n.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,oe(e.output)&&(n.debugDrawLabelBorder=!!ae.LABELS_SHOW_BORDER),n.hasOcclusionTexture=!t.drawAsLabel&&n.transparentOccluded&&se(e.output)}intersectRay(e,t,n,r,i,a){let{options:{selectionMode:o,hud:s,excludeLabels:c},point:l,camera:u}=n,{parameters:g}=this;if(o&&s&&(!c||!g.isLabel)&&e.visible&&l&&u){for(let{renderScreenPosition:r,screenSize:i,pixelRatioTolerance:o,halfOutlineSize:s,rotationAngle:c,anchor:_,centerView:v}of this._forEachScreenSpaceHUDInstance(Be,e,t,u))if(I(l,r[0],r[1],i,o,s,c,g,_)){let e=n.ray;if(V[0]=l[0],V[1]=l[1],V[2]=r[2],u.unprojectFromRenderScreen(V,R)){let t=x();d(t,e.direction);let n=1/f(t);p(t,t,n);let r=m(e.origin,R)*n,i=x();h(i,v,u.inverseViewMatrix),a(r,r,t,-1,i)}}}}*_forEachScreenSpaceHUDInstance(e,t,n,i){let{parameters:o}=this,s=O(t,`position`),c=le(t,`size`),l=O(t,`normal`),u=ue(t,`rotation`),f=O(t,`centerOffset`),m=de(t,`featureAttribute`),b=o.size,te=r(Fe,n),x=o.centerOffsetUnits===`screen`;for(let t=0;t<s.count;t++){let{scaleX:r,scaleY:S}=Je(m?.getVec(t,Ie)??null,o,i.pixelRatio);if(s.getVec(t,R),h(R,R,n),h(R,R,i.viewMatrix),f?f.getVec(t,G):g(G,0,0,0),!x&&(R[0]+=G[0],R[1]+=G[1],G[2]!==0)){let e=G[2];_(G,R),v(R,R,p(G,G,e))}l.getVec(t,z),ee(z,z,te);let{normal:C,cosAngle:w}=F(z,i,He),T=$(o,R,w,i,L);if(y(R,R,C,T),i.applyProjection(R,B),B[0]>-1){x&&(G[0]||G[1])&&(B[0]+=G[0]*i.pixelRatio,G[1]!==0&&(B[1]+=L.alignmentEvaluator.apply(G[1])*i.pixelRatio),i.unapplyProjection(B,R)),B[0]+=o.screenOffset[0]*i.pixelRatio,B[1]+=o.screenOffset[1]*i.pixelRatio,B[0]=Math.floor(B[0]),B[1]=Math.floor(B[1]),Q[0]=b[0],Q[1]=b[1],c!=null&&(Q[0]*=c.get(t,0),Q[1]*=c.get(t,1)),L.evaluator.applyVec2(Q,Q);let n=0;o.textureIsSignedDistanceField&&(n=Math.min(o.outlineSize,.5*Q[0])*i.pixelRatio/2),Q[0]*=r,Q[1]*=S,d(e.centerView,R),g(e.renderScreenPosition,B[0],B[1],B[2]),a(e.screenSize,Q),e.pixelRatioTolerance=Ue*i.pixelRatio,e.halfOutlineSize=n,e.rotationAngle=o.rotation+(u?.get(t)??0),e.anchor=N(o),yield e}}}*_forEachDrapedHUDInstance(e,t,n){let r=O(t,`position`),i=le(t,`size`),o=ue(t,`rotation`),s=de(t,`featureAttribute`),c=this.parameters,l=c.size;e.pixelRatioTolerance=We*n,e.anchor=N(c);for(let t=0;t<r.count;t++){let{scaleX:u,scaleY:d}=Je(s?.getVec(t,Ie)??null,c,n);e.x=r.get(t,0),e.y=r.get(t,1),Q[0]=l[0],Q[1]=l[1],i!=null&&(Q[0]*=i.get(t,0),Q[1]*=i.get(t,1)),e.halfOutlineSize=0,c.textureIsSignedDistanceField&&(e.halfOutlineSize=Math.min(c.outlineSize,.5*Q[0])*n/2),Q[0]*=u,Q[1]*=d,a(e.screenSize,Q),e.rotationAngle=c.rotation+(o?.get(t)??0),yield e}}intersectRayDraped(e,t,n,r,i,a){let o=this.parameters;for(let{x:t,y:s,screenSize:c,pixelRatioTolerance:l,halfOutlineSize:u,rotationAngle:d,anchor:f}of this._forEachDrapedHUDInstance(Ve,e,a))I(n,t,s,c,l,u,d,o,f)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,n,r,i){if(!n.options.selectionMode||n.options.excludeLabels&&this.parameters.isLabel)return null;let a=this.parameters;for(let{x:n,y:o,screenSize:s,pixelRatioTolerance:c,halfOutlineSize:l,rotationAngle:u,anchor:d}of this._forEachDrapedHUDInstance(Ve,e,i))if(Ne(r,n+t[0],o+t[1],s,c,l,u,a,d,!1))return new _e(-1);return null}intersectScreenPolygon(e,t,n,r){let{options:{selectionMode:i,hud:a,excludeLabels:o},camera:s}=n,{parameters:c}=this;if(!i||!a||o&&c.isLabel||!e.visible||t==null)return null;let l=new ve(1),u=1/s.pixelRatio;for(let{renderScreenPosition:i,screenSize:a,pixelRatioTolerance:o,halfOutlineSize:d,rotationAngle:f,anchor:p,centerView:g}of this._forEachScreenSpaceHUDInstance(Be,e,t,s)){let e=h(R,g,s.inverseViewMatrix);if(!n.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;let t=i[0]*u,_=(s.fullHeight-i[1])*u;if(Z[0]=a[0]*u,Z[1]=a[1]*u,Ne(r,t,_,Z,o*u,d*u,f,c,p,!0)){let t=m(s.eye,e);l.updateIfCloserFromValues(t,-1,e,null)}}return l.valid?l:null}createBufferWriter(){return new qe(this.parameters)}createPrimitivePositionReader(e,t){be(t!=null,`HUD geometry requires instancing`);let n=e.vertex.getField(`position`,re);return e=>n.getVec(0,e)}applyShaderOffsets(e,t,n,i,a,o,s,c){ee(H,n,r(Fe,i));let l=F(H,s,He),u=Ye(f(t),s),d=$(this.parameters,t,l.cosAngle,s,c);y(t,t,l.normal,d+u),y(e,e,H,d+u);let p=o+d;this._applyPolygonOffsetView(t,l,p,s,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,n,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),a!=null&&d(a,i),this._applyPolygonOffsetNDC(i,n,r,i),i}_applyPolygonOffsetView(t,n,r,i,a){let o=i.aboveGround?1:-1,s=Math.sign(r);s===0&&(s=o);let c=o*s;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);let l=e(Math.abs(n.cosAngle),.01,1),u=1-Math.sqrt(1-l*l)/l/i.viewport[2];return c>0?p(a,t,u):p(a,t,1/u),a}_applyCenterOffsetView(e,t,n){let r=this.parameters.centerOffsetUnits!==`screen`;return n!==e&&d(n,e),r&&(n[0]+=t[0],n[1]+=t[1],t[2]&&(_(z,n),b(n,n,p(z,z,t[2])))),n}_applyCenterOffsetNDC(e,t,n,r){let i=this.parameters.centerOffsetUnits!==`screen`;return r!==e&&d(r,e),i||(r[0]+=t[0]/n.fullWidth*2,r[1]+=t[1]/n.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,n,r){let i=this.parameters.shaderPolygonOffset;if(e!==r&&d(r,e),i){let e=n.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){let{color:e,outlineSize:t,outlineColor:n}=this.parameters,r=e[3]>=P||t>=P&&n[3]>=P;return this._visible&&r}createGLMaterial(e){return new je(e)}calculateRelativeScreenBounds(e,t,n=T()){return Me(this.parameters,e,t,n),n[2]=n[0]+e[0],n[3]=n[1]+e[1],n}}class je extends pe{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(Oe,e)}}function Me(e,t,n,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*n,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*n}function F(e,t,n){return h(n.normal,e,t.viewInverseTransposeMatrix),n.cosAngle=te(n.normal,Ge),n}function I(e,n,r,i,a,c,l,u,d){let f=Pe(n,r,i,a,c,u,d,Le);return o(W,n,r),s(U,e,W,t(l)),U[0]>f[0]&&U[0]<f[2]&&U[1]>f[1]&&U[1]<f[3]}function Ne(e,n,r,i,a,c,l,u,d,f){let p=Pe(n,r,i,a,c,u,d,Le,f);if(o(q,p[0],p[1]),o(J,p[2],p[1]),o(Y,p[2],p[3]),o(X,p[0],p[3]),l!==0){let e=t(l);o(W,n,r),s(q,q,W,e),s(J,J,W,e),s(Y,Y,W,e),s(X,X,W,e),ne(p),E(p,q),E(p,J),E(p,Y),E(p,X)}return he(e,p)?ge(e,q,J,Y)||ge(e,q,Y,X):!1}function Pe(e,t,n,r,i,a,o,s,c=!1){let l=e-r-n[0]*o[0],u=l+n[0]+2*r,d=c?1-o[1]:o[1],f=t-r-n[1]*d,p=f+n[1]+2*r,m=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&m!=null&&(l+=n[0]*m[0],f+=n[1]*(c?1-m[3]:m[1]),u-=n[0]*(1-m[2]),p-=n[1]*(c?m[1]:1-m[3]),l-=i,u+=i,f-=i,p+=i),s[0]=l,s[1]=f,s[2]=u,s[3]=p,s}const L=new ye,R=x(),z=x(),B=w(),V=n(),H=x(),U=u(),W=u(),Fe=i(),G=x(),K=x(),Ie=w(),Le=T(),q=u(),J=u(),Y=u(),X=u(),Z=u();class Re{constructor(){this.renderScreenPosition=x(),this.screenSize=u(),this.centerView=x(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=u()}}class ze{constructor(){this.x=0,this.y=0,this.screenSize=u(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=u()}}const Be=new Re,Ve=new ze,He={normal:x(),cosAngle:0},Ue=1,We=2,Q=l(0,0),Ge=S(0,0,1);class Ke extends fe{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=C,this.size=c,this.polygonOffset=0,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=C,this.outlineSize=0,this.distanceFieldBoundingBox=w(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits=`world`,this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class qe{constructor(e){this.baseInstanceLayout=Ee,this.layout=De(e)}elementCount(e){return e.get(`position`).indices.length}elementCountBaseInstance(e){return e.get(`uv0`).indices.length}write(e,t,n,r){if(r==null)return;let{buffer:i,offset:a}=r,{position:o,normal:s,color:c,size:l,rotation:u,centerOffset:d,groundDistance:f,featureAttribute:p,uvi:m,olidColor:h}=i;xe(n.get(`position`),e,o,a),Se(n.get(`normal`),t,s,a);let g=n.get(`position`).indices.length;if(m){let e=n.get(`uvi`)?.data;if(e&&e.length>=4){let[t,n,r,i]=e;for(let e=0;e<g;++e){let o=a+e;m.setValues(o,t,n,r,i)}}}if(c&&k(n.get(`color`),4,c,a),l&&A(n.get(`size`),l,a),u&&j(n.get(`rotation`),u,a),d&&(n.get(`centerOffset`)?Ce(n.get(`centerOffset`),d,a):M(d,a,g)),n.get(`groundDistance`)?j(n.get(`groundDistance`),f,a):M(f,a,g),p&&(n.get(`featureAttribute`)?we(n.get(`featureAttribute`),p,a):M(p,a,g)),h!=null){let e=n.get(`olidColor`);e==null?M(h,a,g):k(e,4,h,a)}}writeBaseInstance(e,t){let{uv0:n}=t;A(e.get(`uv0`),n,0)}rebaseBuffers(e,t){if(t==null)return;let{buffer:n,offset:r}=t;n.copyFrom(e.vertex,0,r)}}function Je(e,t,n){return e==null||t.vvSize==null?{scaleX:n,scaleY:n}:(ie(K,t,e),{scaleX:K[0]*n,scaleY:K[1]*n})}function Ye(e,t){let n=t.computeRenderPixelSizeAtDistance(e)*ce;return(t.aboveGround?1:-1)*n}function $(e,t,n,r,i){if(!e.verticalOffset?.screenLength){let r=f(t);return i.update(n,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}let a=f(t),o=e.screenSizePerspectiveAlignment??e.screenSizePerspective,s=Te(r,a,e.verticalOffset,n,o,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(n,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),s}export{Ae as HUDMaterial,Ke as Parameters};
2
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as o,rotate as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as c,fromValues as l,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as d,length as f,scale as p,distance as m,transformMat4 as h,set as g,normalize as _,subtract as v,transformMat3 as y,scaleAndAdd as b,sub as x,dot as ee}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as S,fromValues as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as w,create as T}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as E,empty as te,expandPointInPlace as D}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec3f as ne}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as re}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as O,isColor as ae,isOIT as oe}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as se}from"../core/shaderLibrary/hud/HUD.glsl.js";import{getVec3AttributeView as k,getVec2AttributeView as ce,getScalarAttributeView as le,getVec4AttributeView as ue}from"../lib/attributeViewUtils.js";import{GLTextureMaterialBindParameters as de,GLTextureMaterial as fe}from"../lib/GLTextureMaterial.js";import{PointMaterial as pe}from"../lib/PointMaterial.js";import{screenPolygonIntersectsBounds as me,screenPolygonIntersectsTriangle as he}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as ge,Hit as _e}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as ve}from"../lib/screenSizePerspectiveUtils.js";import{assert as ye}from"../lib/Util.js";import{verticalOffsetAtDistance as be}from"./internal/MaterialUtil.js";import{a as A}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as xe,getInstanceLayout as Se,HUDMaterialTechnique as Ce}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as we}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as j}from"../../../../webscene/support/AlphaCutoff.js";class Te extends pe{constructor(e,t,n=!1){super(e,Re),this.produces=new Map([[12,e=>O(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>O(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>O(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&O(e)]]),this._visible=!0,this._configuration=new we(t,n)}updateConfiguration(e){super.updateConfiguration(e);let{parameters:t,_configuration:n}=this,r=t.draped;n.enableOITOffset=e.enableOITOffset,n.hasSlicePlane=this.parameters.hasSlicePlane,n.hasVerticalOffset=!!this.parameters.verticalOffset,n.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,n.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits===`screen`,n.polygonOffset=this.parameters.polygonOffset,n.draped=r,n.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,n.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,n.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,n.hasRotation=this.parameters.hasRotation,n.hasVVSize=!!this.parameters.vvSize,n.hasVVColor=!!this.parameters.vvColor,n.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,n.hasFocusAreaStyle=this.parameters.focusAreaStyle!=null,n.depthTestEnabled=this.parameters.depthEnabled,n.hasVertexColor=this.parameters.hasVertexColor,n.hasVertexSize=this.parameters.hasVertexSize,n.hasVertexRotation=this.parameters.hasVertexRotation,n.hasVertexUVi=this.parameters.hasVertexUVi,n.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,ae(e.output)&&(n.debugDrawLabelBorder=!!ie.LABELS_SHOW_BORDER),n.hasOcclusionTexture=!t.drawAsLabel&&n.transparentOccluded&&oe(e.output)}intersectRay(e,t,n,r,i,a){let{options:{selectionMode:o,hud:s,excludeLabels:c},point:l,camera:u}=n,{parameters:g}=this;if(o&&s&&(!c||!g.isLabel)&&e.visible&&l&&u){for(let{renderScreenPosition:r,screenSize:i,pixelRatioTolerance:o,halfOutlineSize:s,rotationAngle:c,anchor:_,centerView:v}of this._forEachScreenSpaceHUDInstance(Z,e,t,u))if(N(l,r[0],r[1],i,o,s,c,g,_)){let e=n.ray;if(B[0]=l[0],B[1]=l[1],B[2]=r[2],u.unprojectFromRenderScreen(B,L)){let t=S();d(t,e.direction);let n=1/f(t);p(t,t,n);let r=m(e.origin,L)*n,i=S();h(i,v,u.inverseViewMatrix),a(r,r,t,-1,i)}}}}*_forEachScreenSpaceHUDInstance(e,t,n,i){let{parameters:o}=this,s=k(t,`position`),c=ce(t,`size`),l=k(t,`normal`),u=le(t,`rotation`),f=k(t,`centerOffset`),m=ue(t,`featureAttribute`),x=o.size,ee=r(Oe,n),S=o.centerOffsetUnits===`screen`;for(let t=0;t<s.count;t++){let{scaleX:r,scaleY:C}=Be(m?.getVec(t,ke)??null,o,i.pixelRatio);if(s.getVec(t,L),h(L,L,n),h(L,L,i.viewMatrix),f?f.getVec(t,W):g(W,0,0,0),!S&&(L[0]+=W[0],L[1]+=W[1],W[2]!==0)){let e=W[2];_(W,L),v(L,L,p(W,W,e))}l.getVec(t,R),y(R,R,ee);let{normal:w,cosAngle:T}=M(R,i,Pe),E=$(o,L,T,i,I);if(b(L,L,w,E),i.applyProjection(L,z),z[0]>-1){S&&(W[0]||W[1])&&(z[0]+=W[0]*i.pixelRatio,W[1]!==0&&(z[1]+=I.alignmentEvaluator.apply(W[1])*i.pixelRatio),i.unapplyProjection(z,L)),z[0]+=o.screenOffset[0]*i.pixelRatio,z[1]+=o.screenOffset[1]*i.pixelRatio,z[0]=Math.floor(z[0]),z[1]=Math.floor(z[1]),Q[0]=x[0],Q[1]=x[1],c!=null&&(Q[0]*=c.get(t,0),Q[1]*=c.get(t,1)),I.evaluator.applyVec2(Q,Q);let n=0;o.textureIsSignedDistanceField&&(n=Math.min(o.outlineSize,.5*Q[0])*i.pixelRatio/2),Q[0]*=r,Q[1]*=C,d(e.centerView,L),g(e.renderScreenPosition,z[0],z[1],z[2]),a(e.screenSize,Q),e.pixelRatioTolerance=Fe*i.pixelRatio,e.halfOutlineSize=n,e.rotationAngle=o.rotation+(u?.get(t)??0),e.anchor=A(o),yield e}}}*_forEachDrapedHUDInstance(e,t,n){let r=k(t,`position`),i=ce(t,`size`),o=le(t,`rotation`),s=ue(t,`featureAttribute`),c=this.parameters,l=c.size;e.pixelRatioTolerance=Ie*n,e.anchor=A(c);for(let t=0;t<r.count;t++){let{scaleX:u,scaleY:d}=Be(s?.getVec(t,ke)??null,c,n);e.x=r.get(t,0),e.y=r.get(t,1),Q[0]=l[0],Q[1]=l[1],i!=null&&(Q[0]*=i.get(t,0),Q[1]*=i.get(t,1)),e.halfOutlineSize=0,c.textureIsSignedDistanceField&&(e.halfOutlineSize=Math.min(c.outlineSize,.5*Q[0])*n/2),Q[0]*=u,Q[1]*=d,a(e.screenSize,Q),e.rotationAngle=c.rotation+(o?.get(t)??0),yield e}}intersectRayDraped(e,t,n,r,i,a){let o=this.parameters;for(let{x:t,y:s,screenSize:c,pixelRatioTolerance:l,halfOutlineSize:u,rotationAngle:d,anchor:f}of this._forEachDrapedHUDInstance(Ne,e,a))N(n,t,s,c,l,u,d,o,f)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,n,r,i){if(!n.options.selectionMode||n.options.excludeLabels&&this.parameters.isLabel)return null;let a=this.parameters;for(let{x:n,y:o,screenSize:s,pixelRatioTolerance:c,halfOutlineSize:l,rotationAngle:u,anchor:d}of this._forEachDrapedHUDInstance(Ne,e,i))if(P(r,n+t[0],o+t[1],s,c,l,u,a,d,!1))return new ge(-1);return null}intersectScreenPolygon(e,t,n,r){let{options:{selectionMode:i,hud:a,excludeLabels:o},camera:s}=n,{parameters:c}=this;if(!i||!a||o&&c.isLabel||!e.visible||t==null)return null;let l=new _e(1),u=1/s.pixelRatio;for(let{renderScreenPosition:i,screenSize:a,pixelRatioTolerance:o,halfOutlineSize:d,rotationAngle:f,anchor:p,centerView:g}of this._forEachScreenSpaceHUDInstance(Z,e,t,s)){let e=h(L,g,s.inverseViewMatrix);if(!n.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;let t=i[0]*u,_=(s.fullHeight-i[1])*u;if(X[0]=a[0]*u,X[1]=a[1]*u,P(r,t,_,X,o*u,d*u,f,c,p,!0)){let t=m(s.eye,e);l.updateIfCloserFromValues(t,-1,e,null)}}return l.valid?l:null}createBufferWriter(){return new ze(this.parameters)}createPrimitivePositionReader(e,t){ye(t!=null,`HUD geometry requires instancing`);let n=e.vertex.getField(`position`,ne);return e=>n.getVec(0,e)}applyShaderOffsets(e,t,n,i,a,o,s,c){y(V,n,r(Oe,i));let l=M(V,s,Pe),u=Ve(f(t),s),d=$(this.parameters,t,l.cosAngle,s,c);b(t,t,l.normal,d+u),b(e,e,V,d+u);let p=o+d;this._applyPolygonOffsetView(t,l,p,s,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,n,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),a!=null&&d(a,i),this._applyPolygonOffsetNDC(i,n,r,i),i}_applyPolygonOffsetView(t,n,r,i,a){let o=i.aboveGround?1:-1,s=Math.sign(r);s===0&&(s=o);let c=o*s;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);let l=e(Math.abs(n.cosAngle),.01,1),u=1-Math.sqrt(1-l*l)/l/i.viewport[2];return c>0?p(a,t,u):p(a,t,1/u),a}_applyCenterOffsetView(e,t,n){let r=this.parameters.centerOffsetUnits!==`screen`;return n!==e&&d(n,e),r&&(n[0]+=t[0],n[1]+=t[1],t[2]&&(_(R,n),x(n,n,p(R,R,t[2])))),n}_applyCenterOffsetNDC(e,t,n,r){let i=this.parameters.centerOffsetUnits!==`screen`;return r!==e&&d(r,e),i||(r[0]+=t[0]/n.fullWidth*2,r[1]+=t[1]/n.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,n,r){let i=this.parameters.shaderPolygonOffset;if(e!==r&&d(r,e),i){let e=n.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){let{color:e,outlineSize:t,outlineColor:n}=this.parameters,r=e[3]>=j||t>=j&&n[3]>=j;return this._visible&&r}createGLMaterial(e){return new Ee(e)}calculateRelativeScreenBounds(e,t,n=E()){return De(this.parameters,e,t,n),n[2]=n[0]+e[0],n[3]=n[1]+e[1],n}}class Ee extends fe{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(Ce,e)}}function De(e,t,n,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*n,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*n}function M(e,t,n){return h(n.normal,e,t.viewInverseTransposeMatrix),n.cosAngle=ee(n.normal,Le),n}function N(e,n,r,i,a,c,l,u,d){let f=F(n,r,i,a,c,u,d,Ae);return o(U,n,r),s(H,e,U,t(l)),H[0]>f[0]&&H[0]<f[2]&&H[1]>f[1]&&H[1]<f[3]}function P(e,n,r,i,a,c,l,u,d,f){let p=F(n,r,i,a,c,u,d,Ae,f);if(o(K,p[0],p[1]),o(q,p[2],p[1]),o(J,p[2],p[3]),o(Y,p[0],p[3]),l!==0){let e=t(l);o(U,n,r),s(K,K,U,e),s(q,q,U,e),s(J,J,U,e),s(Y,Y,U,e),te(p),D(p,K),D(p,q),D(p,J),D(p,Y)}return me(e,p)?he(e,K,q,J)||he(e,K,J,Y):!1}function F(e,t,n,r,i,a,o,s,c=!1){let l=e-r-n[0]*o[0],u=l+n[0]+2*r,d=c?1-o[1]:o[1],f=t-r-n[1]*d,p=f+n[1]+2*r,m=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&m!=null&&(l+=n[0]*m[0],f+=n[1]*(c?1-m[3]:m[1]),u-=n[0]*(1-m[2]),p-=n[1]*(c?m[1]:1-m[3]),l-=i,u+=i,f-=i,p+=i),s[0]=l,s[1]=f,s[2]=u,s[3]=p,s}const I=new ve,L=S(),R=S(),z=T(),B=n(),V=S(),H=u(),U=u(),Oe=i(),W=S(),G=S(),ke=T(),Ae=E(),K=u(),q=u(),J=u(),Y=u(),X=u();class je{constructor(){this.renderScreenPosition=S(),this.screenSize=u(),this.centerView=S(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=u()}}class Me{constructor(){this.x=0,this.y=0,this.screenSize=u(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=u()}}const Z=new je,Ne=new Me,Pe={normal:S(),cosAngle:0},Fe=1,Ie=2,Q=l(0,0),Le=C(0,0,1);class Re extends de{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=w,this.size=c,this.polygonOffset=0,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=w,this.outlineSize=0,this.distanceFieldBoundingBox=T(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits=`world`,this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class ze{constructor(e){this.baseInstanceLayout=xe,this.layout=Se(e)}elementCount(){throw Error(`HUDMaterial only supports BufferGeometry`)}elementCountBaseInstance(){throw Error(`HUDMaterial only supports BufferGeometry`)}write(){throw Error(`HUDMaterial only supports BufferGeometry`)}writeBaseInstance(){throw Error(`HUDMaterial only supports BufferGeometry`)}rebaseBuffers(e,t){if(t==null)return;let{buffer:n,offset:r}=t;n.copyFrom(e.vertex,0,r)}}function Be(e,t,n){return e==null||t.vvSize==null?{scaleX:n,scaleY:n}:(re(G,t,e),{scaleX:G[0]*n,scaleY:G[1]*n})}function Ve(e,t){let n=t.computeRenderPixelSizeAtDistance(e)*se;return(t.aboveGround?1:-1)*n}function $(e,t,n,r,i){if(!e.verticalOffset?.screenLength){let r=f(t);return i.update(n,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}let a=f(t),o=e.screenSizePerspectiveAlignment??e.screenSizePerspective,s=be(r,a,e.verticalOffset,n,o,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(n,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),s}export{Te as HUDMaterial,Re as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{Attribute as e}from"../lib/Attribute.js";import{BufferGeometryBaseInstance as t}from"../lib/BufferGeometryBaseInstance.js";import{Buffers as n}from"../lib/Buffers.js";import{GeometryBaseInstance as r}from"../lib/GeometryBaseInstance.js";import{baseLayout as i}from"../shaders/HUDMaterialTechnique.js";function a(){return l??=s(),l}function o(){return u??=c(),u}function s(){let t=new e([0,0,0,255,255,0,255,255],[0,1,2,3],2,!0);return new r([[`uv0`,t]])}function c(){let e=i.createBuffer(4);return e.uv0.setValues(0,0,0),e.uv0.setValues(1,0,255),e.uv0.setValues(2,255,0),e.uv0.setValues(3,255,255),new t(new n(e))}let l=null,u=null;export{a as getHUDMaterialBaseInstance,o as getHUDMaterialBufferBaseInstance};
2
+ import{BufferGeometryBaseInstance as e}from"../lib/BufferGeometryBaseInstance.js";import{Buffers as t}from"../lib/Buffers.js";import{baseLayout as n}from"../shaders/HUDMaterialTechnique.js";function r(){return a??=i(),a}function i(){let r=n.createBuffer(4);return r.uv0.setValues(0,0,0),r.uv0.setValues(1,0,255),r.uv0.setValues(2,255,0),r.uv0.setValues(3,255,255),new e(new t(r))}let a=null;export{r as getHUDMaterialBufferBaseInstance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as n}from"../core/shaderLibrary/ShaderOutput.js";import r from"../lib/GLMaterial.js";import{LineMaterial as i,LineMaterialParameters as a}from"../lib/LineMaterial.js";import{writeBufferVec2 as o,writePosition as s,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as d,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as h}from"../../../../webscene/support/AlphaCutoff.js";class g extends i{constructor(e,t){super(e,y),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[15,e=>n(e)],[16,e=>n(e)]]),this._configuration=new m(t),this._uniqueMaterialIdentifier=_(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=this.parameters.verticalOffset!=null,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null,this._configuration.hudDepth=e.slot===16,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits===`screen`,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=h||(this.parameters.borderColor?.[3]??0)>=h}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new v(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=_(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function _({renderOccluded:t,isDecoration:n,horizontalScreenOffset:r,color:i,size:a,shaderPolygonOffset:o,hudDepthAlignStart:s,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:d,borderColor:f}){return e`${t}:${n}:${r}:[${i}]:${a}:${o}:${s}:${c}:${l}:${u!=null}:{${d?.screenLength}:${d?.minWorldLength}:${d?.maxWorldLength}}:[${f}]`}class v extends r{beginSlot(e){return this.getTechnique(d,e)}}class y extends a{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits=`world`,this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get(`position`).indices.length}elementCountBaseInstance(e){return e.get(`uv0`).indices.length}writeBaseInstance(e,t){let{uv0:n}=t;o(e.get(`uv0`),n,0)}write(e,t,n,r){if(r==null)return;let{buffer:i,offset:a}=r;s(n.get(`position`),e,i.position,a),c(n.get(`normal`),t,i.normal,a),l(n.get(`centerOffset`),i.centerOffset,a),u(n.get(`groundDistance`),i.groundDistance,a)}}export{g as LineCalloutMaterial,y as Parameters,_ as uniqueMaterialIdentifier};
2
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec3f as n}from"../../../../geometry/support/buffer/BufferView.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{LineMaterial as a,LineMaterialParameters as o}from"../lib/LineMaterial.js";import{assert as s}from"../lib/Util.js";import{LineCalloutTechnique as c,layout as l,baseLayout as u}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class p extends a{constructor(e,t){super(e,g),this.intersectRayDraped=void 0,this.intersectScreenPolygonDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=m(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=this.parameters.verticalOffset!=null,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null,this._configuration.hudDepth=e.slot===16,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits===`screen`,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=f||(this.parameters.borderColor?.[3]??0)>=f}intersectRay(){}intersectScreenPolygon(){return null}createGLMaterial(e){return new h(e)}createBufferWriter(){return new _}createPrimitivePositionReader(e,t){s(t!=null,`Line callout geometry requires instancing`);let r=e.vertex.getField(`position`,n);return e=>r.getVec(0,e)}validateParameters(e){this._uniqueMaterialIdentifier=m(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function m({renderOccluded:t,isDecoration:n,horizontalScreenOffset:r,color:i,size:a,shaderPolygonOffset:o,hudDepthAlignStart:s,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:d,borderColor:f}){return e`${t}:${n}:${r}:[${i}]:${a}:${o}:${s}:${c}:${l}:${u!=null}:{${d?.screenLength}:${d?.minWorldLength}:${d?.maxWorldLength}}:[${f}]`}class h extends i{beginSlot(e){return this.getTechnique(c,e)}}class g extends o{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits=`world`,this.hasSlicePlane=!1}}class _{constructor(){this.layout=l,this.baseInstanceLayout=u}elementCount(){throw Error(`LineCalloutMaterial only supports BufferGeometry`)}elementCountBaseInstance(){throw Error(`LineCalloutMaterial only supports BufferGeometry`)}writeBaseInstance(){throw Error(`LineCalloutMaterial only supports BufferGeometry`)}write(){throw Error(`LineCalloutMaterial only supports BufferGeometry`)}rebaseBuffers(e,t){if(t==null)return;let{buffer:n,offset:r}=t;n.copyFrom(e.vertex,0,r)}}export{p as LineCalloutMaterial,g as Parameters,m as uniqueMaterialIdentifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{Attribute as e}from"../lib/Attribute.js";import{GeometryBaseInstance as t}from"../lib/GeometryBaseInstance.js";function n(){return i??=r(),i}function r(){let n=new e([0,0,0,255,255,0,255,255],[0,1,2,3],2,!0);return new t([[`uv0`,n]])}let i=null;export{n as getLineCalloutMaterialBaseInstance};
2
+ import{BufferGeometryBaseInstance as e}from"../lib/BufferGeometryBaseInstance.js";import{Buffers as t}from"../lib/Buffers.js";import{baseLayout as n}from"../shaders/LineCalloutTechnique.js";function r(){return a??=i(),a}function i(){let r=n.createBuffer(4);return r.uv0.setValues(0,0,0),r.uv0.setValues(1,0,255),r.uv0.setValues(2,255,0),r.uv0.setValues(3,255,255),new e(new t(r))}let a=null;export{r as getLineCalloutMaterialBaseInstance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{offsetPathVertexInfoFrameIndex as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as _}from"../lib/screenPolygonTriangleIntersections.js";import{assert as v}from"../lib/Util.js";import{applyPolygonOffsetToHit as y}from"./intersectWithPolygonOffset.js";import{getLayout as b,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as C}from"./PathTechnique.js";import{PathTechniqueConfiguration as w}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as T}from"./TriangleMaterial.js";import{writeAttributes as E,writePosition as D,writeBufferVec2 as O,writeBufferInt16 as k,writeBufferFloat16 as A,writeBufferFloat as j,writeColor as M,writeBufferUint8 as N}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as F}from"../../../../webscene/support/AlphaCutoff.js";class I extends T{constructor(e,t){super(e,R),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new w(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,f(e.output)?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=F}intersectRay(e,t,n,r,i,a){g(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return y(_(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new z(b(),x(this.parameters))}createGLMaterial(e){return new L(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class L extends m{beginSlot(e){return this.getTechnique(C,e)}}class R extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class z{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){E(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){v(c.size===1);let{data:e,stride:t,indices:n}=c;for(let r=0;r<n.length;++r){let a=e[t*n[r]];s.set(i.offset+r,h(a,o))}}}_writeTextureBuffer(e,l,u){let d=u.offset,f=u.buffer.getField(`position`,t),m=l.get(`position`);f&&m&&(v(m.size===3),D(m,e,f,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(v(g.size===2),O(g,h,d));let _=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);_&&y&&(v(y.size===2),O(y,_,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(v(x.size===1),k(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(v(C.size===2),O(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(v(T.size===1),A(T,w,d));let E=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);E&&P&&j(P,E,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(v(I.size===2),O(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&j(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&M(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&j(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(v(W.size===1),N(W,U,d)),p()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&M(n,4,e,d)}}}export{R as Parameters,z as PathBufferWriter,I as PathMaterial};
2
+ import{BufferViewUint32 as e,BufferViewVec3f as t,BufferViewVec2Snorm16 as n,BufferViewSnorm16 as r,BufferViewFloat16 as i,BufferViewFloat as a,BufferViewVec2f as o,BufferViewVec4Unorm8 as s,BufferViewUnorm8 as c}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as l}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as d,isColor as f}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as p}from"../effects/geometry/olidUtils.js";import m from"../lib/GLMaterial.js";import{pathVertexInfoPacking as h}from"../lib/PathVertexInfo.js";import{intersectTriangleGeometry as g}from"../lib/RayIntersections.js";import{intersectTriangleGeometryWithScreenPolygon as _}from"../lib/screenPolygonTriangleIntersections.js";import{assert as v}from"../lib/Util.js";import{applyPolygonOffsetToHit as y}from"./intersectWithPolygonOffset.js";import{getLayout as b,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as S,PathTechnique as C}from"./PathTechnique.js";import{PathTechniqueConfiguration as w}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as T}from"./TriangleMaterial.js";import{writeAttributes as E,writePosition as D,writeBufferVec2 as O,writeBufferInt16 as k,writeBufferFloat16 as A,writeBufferFloat as j,writeColor as M,writeBufferUint8 as N}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as P}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as F}from"../../../../webscene/support/AlphaCutoff.js";class I extends T{constructor(e,t){super(e,R),this.supportsEdges=!0,this.produces=new Map([[2,e=>(this.parameters.castShadows&&u(e)||d(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&u(e)||d(e))&&this.transparent]]),this._configuration=new w(t.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=e.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.pathJoinType=this.parameters.pathJoinType,this._configuration.offsetBackfaces=this.transparent,f(e.output)?(this._configuration.receiveShadows=e.shadowMap.enabled,this._configuration.hasShadowHighlights=P(this._configuration,e),this._configuration.receiveAmbientOcclusion=e.ssao!=null,this._configuration.receiveGlobalIllumination=e.globalIlluminationEnabled):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=this._configuration.receiveGlobalIllumination=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=+!!this.emissions,this._configuration.snowCover=e.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type,this._configuration.hasPathSize=this.parameters.hasPathSize,this._configuration.hasPathColor=this.parameters.hasPathColor,this._configuration.hasPathOpacity=this.parameters.hasPathOpacity}isVisibleForOutput(e){return e===5||e===7||e===6?this.parameters.castShadows:!0}get visible(){return this.parameters.opacity>=F}intersectRay(e,t,n,r,i,a){g(e,n,r,i,null,a)}intersectRayDraped(){}intersectScreenPolygonDraped(){return null}intersectScreenPolygon(e,t,n,r){return y(_(e,n,t,r,null),this._configuration,n.camera.eye)}createBufferWriter(){return new z(b(),x(this.parameters))}createGLMaterial(e){return new L(e)}get transparent(){return this.parameters.drivenOpacity||this.parameters.opacity<1}}class L extends m{beginSlot(e){return this.getTechnique(C,e)}}class R extends S{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2,this.pathJoinType=1}}class z{constructor(e,t){this.layout=e,this.textureBufferLayout=t,this.maxTextureBufferItemIndex=l}elementCount(e){return e.get(`pathVertexInfo`)?.indices.length??0}elementCountTextureBuffer(e){return e.get(`position`)?.indices.length??0}write(e,t,n,r,i,a){r!=null&&this._writeVertexBuffer(e,t,n,r,i),a!=null&&this._writeTextureBuffer(e,n,a)}_writeVertexBuffer(t,n,r,i,a){E(r,this.layout,t,n,i);let o=a?.from??0,s=i.buffer.getField(`pathVertexInfo`,e),c=r.get(`pathVertexInfo`);if(s&&c){v(c.size===1);let{data:e,stride:t,indices:n}=c,r=h.getField(0);for(let a=0;a<n.length;++a){let c=e[t*n[a]],l=r.get(c)+o;v(l>=0&&l<=r.max,`Path frame index out of range`),s.set(i.offset+a,r.set(c,l))}}}_writeTextureBuffer(e,l,u){let d=u.offset,f=u.buffer.getField(`position`,t),m=l.get(`position`);f&&m&&(v(m.size===3),D(m,e,f,d));let h=u.buffer.getField(`profileRight`,n),g=l.get(`profileRight`);h&&g&&(v(g.size===2),O(g,h,d));let _=u.buffer.getField(`profileUp`,n),y=l.get(`profileUp`);_&&y&&(v(y.size===2),O(y,_,d));let b=u.buffer.getField(`profileRotation`,r),x=l.get(`profileRotation`);b&&x&&(v(x.size===1),k(x,b,d));let S=u.buffer.getField(`pathRotationUp`,n),C=l.get(`pathRotationUp`);S&&C&&(v(C.size===2),O(C,S,d));let w=u.buffer.getField(`pathMaxStretchDistance`,i),T=l.get(`pathMaxStretchDistance`);w&&T&&(v(T.size===1),A(T,w,d));let E=u.buffer.getField(`sizeFeatureAttribute`,a),P=l.get(`sizeFeatureAttribute`);E&&P&&j(P,E,d);let F=u.buffer.getField(`size`,o),I=l.get(`size`);F&&I&&(v(I.size===2),O(I,F,d));let L=u.buffer.getField(`colorFeatureAttribute`,a),R=l.get(`colorFeatureAttribute`);L&&R&&j(R,L,d);let z=u.buffer.getField(`color`,s),B=l.get(`color`);z&&B&&M(B,4,z,d);let V=u.buffer.getField(`opacityFeatureAttribute`,a),H=l.get(`opacityFeatureAttribute`);V&&H&&j(H,V,d);let U=u.buffer.getField(`opacity`,c),W=l.get(`opacity`);if(U&&W&&(v(W.size===1),N(W,U,d)),p()){let e=u.buffer.getField(`olidColor`,s),t=m?.indices.length??0,n=l.get(`olidColor`);n&&e&&t&&M(n,4,e,d)}}}export{R as Parameters,z as PathBufferWriter,I as PathMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as fe,screenPolygonIntersectsBufferedSegment as pe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as me,DrapedHit as he}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ge}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as _e,assert as N}from"../lib/Util.js";import{isImagePattern as ve}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ye}from"./VisualVariablePassParameters.js";import{writeColor as be}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as xe,intersectScreenPolygonWithWorldSizedLineSegment as Se}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Ce}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as we,getTextureBufferLayout as Te}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ee}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as De}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";class ke extends de{constructor(e,t){super(e,je),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new De(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Fe(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Pe(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Oe||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Oe}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=I(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Ne(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!_e(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=Re;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Y[0],_[0]-b,_[1]+b,0),l(Y[1],_[0]+b,_[1]+b,0),l(Y[2],_[0]+b,_[1]-b,0),l(Y[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Y[e],X[e]))return;O(a.eye,X[0],X[1],Ke),O(a.eye,X[1],X[2],Z),O(a.eye,X[2],X[3],qe),O(a.eye,X[3],X[0],Q);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s))){if(k(Ke,L)<0&&k(Ke,R)<0||k(Z,L)<0&&k(Z,R)<0||k(qe,L)<0&&k(qe,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=a.projectToRenderScreen(L,G),n=a.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=a.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!a.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=a.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!a.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,We),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,L,R,_,a,r,y);if(o>=e*e)continue}x=o,m(Ve,L),m(He,R),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(Ve,He,We),S(e,t,Ge),W)){u(W,W,e);let n=h(W);f(W,W,1/n),r=n/g(e,t)}i(r,r,W,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c))){let t=xe(L,R,u,a,o,Ue);if(t!=null&&t<d&&(d=t,f=e,m(W,Ue),t===0))break}d<1/0&&i(d,d,W,f)}intersectScreenPolygon(t,n,r,i){let{options:a}=r;if(!a.selectionMode||!t.visible)return null;if(!_e(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let o=this._getLineSize(t.attributes);return this.parameters.worldSized?this._intersectWorldSizedPolygon(t,n,r,i,o):this._intersectScreenSizedPolygon(t,n,r,i,o)}_intersectScreenSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o}=n,s=e.attributes,c=s.get(`position`).data,l=$,u=l*a.pixelRatio,d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,c,t,F(this.parameters,s)))for(let[t,n]of o.processLineSegment(Ye,L,R)){if(!fe(a,t,n,G,K))continue;let o=S(G,K,We),s=i/2+l;this.parameters.screenSizePerspective&&(_(Re,G,K,.5),s=Math.max(s,this.computeScreenSizePerspectiveWidth(o,t,n,Re,a,i,u)/a.pixelRatio)),a.renderToScreen(G,ze),a.renderToScreen(K,Be),pe(r,ze,Be,s)&&(T(S(t,n,Ge),a.eye,V),d.updateIfCloserFromValues(g(a.eye,V),e,V,null))}return d}_intersectWorldSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o,metersPerRenderUnit:s}=n,{attributes:c}=e,l=c.get(`position`).data,u=i/(2*s),d=new me(4);for(let e of this._forEachTransformedLineSegment(L,R,l,t,F(this.parameters,c)))for(let[t,n]of o.processLineSegment(Ye,L,R)){T(S(t,n,Ge),a.eye,V);let i=g(a.eye,V);d.valid&&i>=d.distance||Se(t,n,u,a,r)&&d.updateIfCloserFromValues(i,e,V,null)}return d}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=I(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Ne(z,B,this.parameters,e,t))if(pe(r,z,B,o))return new he(n);return null}createBufferWriter(){return new Me(we(this.parameters),Te(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new Ae(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Le,V,i.viewMatrix);let c=h(Le),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Ie.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Ie.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class Ae extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ee,e)}}class je extends ye{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return ve(this.stipplePattern)&&this.stippleTexture!=null}}class Me{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Fe(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return F(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`),N(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(J,r.data,t,e),t>0&&(w==null?E+=g(q,J):E=w[t]??E);let n=s+t+1;if(c.setVec(n,J),l.set(n,E),m(q,J),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,q),c.getVec(t,J);let d=w?.[i]??E+g(q,J);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&be(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ie);N(f!=null,`Missing texture buffer index field`),N(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;N(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),P(m,y+_,m,y,_),v=P(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=P(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function P(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function F(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function I(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Ne(e,t,n,r,i){let a=r.get(`position`).data,c=F(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Pe(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Fe(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Ce+n}}const Ie=new ge,L=b(),R=b(),z=c(),B=c(),V=b(),Le=b(),H=b(),U=b(),W=b(),Re=b(),G=n(),K=n(),ze=r(),Be=r(),Ve=b(),He=b(),Ue=b(),We=D(),Ge=D(),q=b(),J=b(),Y=[n(),n(),n(),n()],X=[b(),b(),b(),b()],Ke=A(),Z=A(),qe=A(),Q=A(),$=4,Je={getDrapedRibbonLineMaxDistance:I},Ye=[b(),b()];export{je as Parameters,ke as RibbonLineMaterial,Je as test};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as te,BufferViewFloat as j,BufferViewVec4Unorm8 as ne,BufferViewVec4f16 as re,BufferViewUint32 as ie}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as ae,isColor as M,isDepth as oe,isColorHighlightOLIDOrDepth as se,is2DGeometryOutput as ce}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as le}from"../effects/geometry/olidUtils.js";import ue from"../lib/GLMaterial.js";import{LineMaterial as de}from"../lib/LineMaterial.js";import{ribbonLineVertexInfoPacking as fe,encodeRibbonLineVertexInfo as pe}from"../lib/RibbonLineVertexInfo.js";import{projectWorldLineSegmentToRenderScreen as me,screenPolygonIntersectsBufferedSegment as he}from"../lib/screenPolygonOverlapUtils.js";import{Hit as ge,DrapedHit as _e}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as ve}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as ye,assert as N}from"../lib/Util.js";import{isImagePattern as be}from"./lineStippleUtils.js";import{VisualVariablePassParameters as xe}from"./VisualVariablePassParameters.js";import{writeColor as Se}from"./internal/bufferWriterUtils.js";import{intersectRayWithWorldSizedLineSegment as Ce,intersectScreenPolygonWithWorldSizedLineSegment as we}from"./internal/worldSizedRibbonLineIntersectionUtils.js";import{n as Te}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Ee,getTextureBufferLayout as De}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Oe}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as ke}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Ae}from"../../../../webscene/support/AlphaCutoff.js";class je extends de{constructor(e,t){super(e,Ne),this.produces=new Map([[2,e=>ae(e)||M(e)&&this.parameters.renderOccluded===8],[3,e=>oe(e)],[10,e=>se(e)&&this.parameters.renderOccluded===8],[11,e=>se(e)&&this.parameters.renderOccluded===8],[4,e=>M(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>M(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>ce(e)]]),this._configuration=new ke(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Le(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Ie(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n,this._configuration.hasVertexColor=this.parameters.hasVertexColor,this._configuration.hasVertexSize=this.parameters.hasVertexSize,this._configuration.hasLineDistance=this.parameters.hasLineDistance}get visible(){return this.parameters.color[3]>=Ae||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Ae}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=F(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of Fe(R,z,this.parameters,e)){let e=l-R[0],r=u-R[1],i=z[0]-R[0],a=z[1]-R[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,o){let{options:s,camera:c}=r;if(!s.selectionMode||!t.visible||!c)return;if(!ye(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let l=this._getLineSize(t.attributes);this.parameters.worldSized?this._intersectRayWithWorldSizedLine(t,n,r,l,o):this._intersectRayWithScreenSizedLine(t,n,r,l,o)}_intersectRayWithScreenSizedLine(e,t,n,r,i){let{camera:a}=n,s=e.attributes,c=s.get(`position`).data,_=W;o(_,n.point);let v=r*a.pixelRatio,y=$*a.pixelRatio,b=v/2+y;l(Y[0],_[0]-b,_[1]+b,0),l(Y[1],_[0]+b,_[1]+b,0),l(Y[2],_[0]+b,_[1]-b,0),l(Y[3],_[0]-b,_[1]-b,0);for(let e=0;e<4;e++)if(!a.unprojectFromRenderScreen(Y[e],X[e]))return;O(a.eye,X[0],X[1],Z),O(a.eye,X[1],X[2],qe),O(a.eye,X[2],X[3],Je),O(a.eye,X[3],X[0],Q);let x=Number.MAX_VALUE,T=0;for(let e of this._forEachTransformedLineSegment(I,L,c,t,P(this.parameters,s))){if(k(Z,I)<0&&k(Z,L)<0||k(qe,I)<0&&k(qe,L)<0||k(Je,I)<0&&k(Je,L)<0||k(Q,I)<0&&k(Q,L)<0)continue;let t=a.projectToRenderScreen(I,G),n=a.projectToRenderScreen(L,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(H,I,L);let e=a.frustum,n=-k(e[4],I)/d(H,ee(e[4]));if(f(H,H,n),p(I,I,H),!a.projectToRenderScreen(I,t))continue}else if(t[2]>0&&n[2]<0){u(H,L,I);let e=a.frustum,t=-k(e[4],L)/d(H,ee(e[4]));if(f(H,H,t),p(L,L,H),!a.projectToRenderScreen(L,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let i=S(t,n,Ge),o=C(i,_);if(!(o>=x)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(i,I,L,_,a,r,y);if(o>=e*e)continue}x=o,m(He,I),m(Ue,L),T=e}}if(x<b*b){let{rayBegin:e,rayEnd:t}=n,r=Number.MAX_VALUE;if(w(S(He,Ue,Ge),S(e,t,Ke),U)){u(U,U,e);let n=h(U);f(U,U,1/n),r=n/g(e,t)}i(r,r,U,T)}}_intersectRayWithWorldSizedLine(e,t,n,r,i){let{camera:a,ray:o,metersPerRenderUnit:s}=n,c=e.attributes,l=c.get(`position`).data,u=r/(2*s),d=1/0,f=0;for(let e of this._forEachTransformedLineSegment(I,L,l,t,P(this.parameters,c))){let t=Ce(I,L,u,a,o,We);if(t!=null&&t<d&&(d=t,f=e,m(U,We),t===0))break}d<1/0&&i(d,d,U,f)}intersectScreenPolygon(t,n,r,i){let{options:a}=r;if(!a.selectionMode||!t.visible)return null;if(!ye(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let o=this._getLineSize(t.attributes);return this.parameters.worldSized?this._intersectWorldSizedPolygon(t,n,r,i,o):this._intersectScreenSizedPolygon(t,n,r,i,o)}_intersectScreenSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o}=n,s=e.attributes,c=s.get(`position`).data,l=$,u=l*a.pixelRatio,d=new ge(4);for(let e of this._forEachTransformedLineSegment(I,L,c,t,P(this.parameters,s)))for(let[t,n]of o.processLineSegment(Xe,I,L)){if(!me(a,t,n,G,K))continue;let o=S(G,K,Ge),s=i/2+l;this.parameters.screenSizePerspective&&(_(W,G,K,.5),s=Math.max(s,this.computeScreenSizePerspectiveWidth(o,t,n,W,a,i,u)/a.pixelRatio)),a.renderToScreen(G,Be),a.renderToScreen(K,Ve),he(r,Be,Ve,s)&&(T(S(t,n,Ke),a.eye,B),d.updateIfCloserFromValues(g(a.eye,B),e,B,null))}return d}_intersectWorldSizedPolygon(e,t,n,r,i){let{camera:a,screenPolygonPrimitiveProcessor:o,metersPerRenderUnit:s}=n,{attributes:c}=e,l=c.get(`position`).data,u=i/(2*s),d=new ge(4);for(let e of this._forEachTransformedLineSegment(I,L,l,t,P(this.parameters,c)))for(let[t,n]of o.processLineSegment(Xe,I,L)){T(S(t,n,Ke),a.eye,B);let i=g(a.eye,B);d.valid&&i>=d.distance||we(t,n,u,a,r)&&d.updateIfCloserFromValues(i,e,B,null)}return d}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=F(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of Fe(R,z,this.parameters,e,t))if(he(r,R,z,o))return new _e(n);return null}createBufferWriter(){return new Pe(Ee(this.parameters),De(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new Me(e)}validateParameters(e){N(e.hasLineDistance||e.stipplePattern==null,`Patterned ribbon lines require line distances`),e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(B,t,n,s),v(ze,B,i.viewMatrix);let c=h(ze),l=this.computeCameraAbsCosAngle(B,i,this._configuration.spherical);return Re.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Re.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(U,e):l(U,0,0,1),u(V,e,t.eye),y(V,V),Math.abs(d(U,V))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else this.parameters.hasVertexSize&&e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class Me extends ue{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Oe,e)}}class Ne extends xe{constructor(){super(...arguments),this._width=0,this.color=x,this.hasVertexColor=!0,this.hasVertexSize=!0,this.hasLineDistance=!0,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return be(this.stipplePattern)&&this.stippleTexture!=null}}class Pe{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.maxTextureBufferItemIndex=fe.getField(0).max,this.numJoinSubdivisions=Le(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return P(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,te),l=o.getField(`u0`,j),u=o.getField(`sizeFeatureAttribute`,j),d=o.getField(`size`,j),f=o.getField(`colorFeatureAttribute`,j),p=o.getField(`color`,ne),h=o.getField(`olidColor`,ne),_=o.getField(`timeStamps`,re),v=o.getField(`opacityFeatureAttribute`,j),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);N(c!==null,`Expected valid position field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(J,r.data,t,e),l!=null&&t>0&&(w==null?E+=g(q,J):E=w[t]??E);let n=s+t+1;if(c.setVec(n,J),l!=null&&(l.set(n,E),m(q,J)),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){N(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;if(o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),l!=null){c.getVec(r,q),c.getVec(t,J);let e=w?.[i]??E+g(q,J);l.set(a,e)}}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);le()&&D!=null&&h!=null&&Se(D,4,h,s)}_writeVertexBuffer(e,t,n){let{buffer:r,offset:i}=t,a=e.get(`position`),o=a.indices,s=a.data.length/3,c=this._isClosed(e),l=s+(c?3:2);o&&o.length!==2*(s-1)&&console.warn(`RibbonLineMaterial does not support indices`);let u=r.getField(`ribbonLineVertexInfo`,ie);N(u!=null,`Missing ribbon vertex information field`),N(n!=null,`Using a texture layout, but the texture range for this instance was not provided`);let d=n.from;N(n.numElements===l,`Expected number of elements in TextureBuffer to equal number of points`);let f=u.typedBuffer,p=i+1,m=(e,t,n,r=!1)=>{f[p++]=pe(d+n+1,t,e,r)},h=0,g=0;c?(h=0,g=s):(m(1,-3,0),m(1,3,0),h=1,g=s-1);let _=this._isAssumedMetalDriver;for(let e=h;e<g;e++){m(0,-1,e),m(0,1,e),_&&(m(0,-1,e,!0),m(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);m(r,-1,e,_),m(r,1,e,_)}m(1,-2,e,_),m(1,2,e,_),_&&(m(1,-2,e),m(1,2,e))}c?(m(0,-1,g),m(0,1,g)):(m(0,-4,g),m(0,4,g)),f[i]=f[i+1],f[p]=f[p-1],p++,this._parameters.wireframe&&this._addWireframeVertices(f,i,p)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n){let r=n;for(let i=t;i<=n-4;i+=2)e[r++]=e[i],e[r++]=e[i+2],e[r++]=e[i+1],e[r++]=e[i+2],e[r++]=e[i+1],e[r++]=e[i+3]}}function P(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function F(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*Fe(e,t,n,r,i){let a=r.get(`position`).data,c=P(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Ie(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Le(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return Te+n}}const Re=new ve,I=b(),L=b(),R=c(),z=c(),B=b(),ze=b(),V=b(),H=b(),U=b(),W=b(),G=n(),K=n(),Be=r(),Ve=r(),He=b(),Ue=b(),We=b(),Ge=D(),Ke=D(),q=b(),J=b(),Y=[n(),n(),n(),n()],X=[b(),b(),b(),b()],Z=A(),qe=A(),Je=A(),Q=A(),$=4,Ye={getDrapedRibbonLineMaxDistance:F},Xe=[b(),b()];export{Ne as Parameters,je as RibbonLineMaterial,Ye as test};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{subtract as e,length as t,scale as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as i,hasIdentityRotation as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as o,BufferViewVec4f as s,BufferViewFloat as c,BufferViewVec2i16 as l,BufferViewVec2f16 as u,BufferViewVec2f as d,BufferViewVec3f as f}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as p}from"../../lib/Util.js";function m(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e)a[n]=r[i[e]],n+=o}function h(e,t,n,r=1){let{data:i,indices:a}=e,o=t.typedBuffer,s=t.typedBufferStride,c=a.length;if(n*=s,r===1)for(let e=0;e<c;++e)o[n]=i[a[e]],n+=s;else for(let e=0;e<c;++e){let t=i[a[e]];for(let e=0;e<r;e++)o[n]=t,n+=s}}function g(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e)a[n]=r[i[e]],n+=o}function _(e,t,n){let{data:r,stride:i,indices:a}=e,o=a.length;for(let e=0;e<o;++e)t.set(n+e,r[i*a[e]])}function v(e,t,n){let{data:r,stride:i,indices:a}=e,o=a.length;for(let e=0;e<o;++e)t.set(n+e,r[i*a[e]])}function y(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e){let t=2*i[e];a[n]=r[t],a[n+1]=r[t+1],n+=o}}function b(e,t,n,r=1){let{data:i,indices:a}=e,o=t.typedBuffer,s=t.typedBufferStride,c=a.length;if(n*=s,r===1)for(let e=0;e<c;++e){let t=3*a[e];o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],n+=s}else for(let e=0;e<c;++e){let t=3*a[e];for(let e=0;e<r;++e)o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],n+=s}}function x(e,t,n,r=1){let{data:i,indices:a}=e,o=t.typedBuffer,s=t.typedBufferStride,c=a.length;if(n*=s,r===1)for(let e=0;e<c;++e){let t=4*a[e];o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],o[n+3]=i[t+3],n+=s}else for(let e=0;e<c;++e){let t=4*a[e];for(let e=0;e<r;++e)o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],o[n+3]=i[t+3],n+=s}}function S(e,t,n){let r=e.typedBuffer,i=e.typedBufferStride,a=e.elementCount;t*=i;for(let e=0;e<n;++e){for(let e=0;e<a;++e)r[t+e]=0;t+=i}}function C(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e){let t=9*i[e];for(let e=0;e<9;++e)a[n+e]=r[t+e];n+=o}}function w(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e){let t=16*i[e];for(let e=0;e<16;++e)a[n+e]=r[t+e];n+=o}}function T(e,t,n,r,i=1){if(!t){b(e,n,r,i);return}let{data:o,indices:s}=e,c=n.typedBuffer,l=n.typedBufferStride,u=s.length,d=t[0],f=t[1],p=t[2],m=t[4],h=t[5],g=t[6],_=t[8],v=t[9],y=t[10],x=t[12],S=t[13],C=t[14];r*=l;let w=0,T=0,E=0,D=a(t)?e=>{w=o[e]+x,T=o[e+1]+S,E=o[e+2]+C}:e=>{let t=o[e],n=o[e+1],r=o[e+2];w=d*t+m*n+_*r+x,T=f*t+h*n+v*r+S,E=p*t+g*n+y*r+C};if(i===1)for(let e=0;e<u;++e)D(3*s[e]),c[r]=w,c[r+1]=T,c[r+2]=E,r+=l;else for(let e=0;e<u;++e){D(3*s[e]);for(let e=0;e<i;++e)c[r]=w,c[r+1]=T,c[r+2]=E,r+=l}}function E(e,t,n,r){if(!t){y(e,n,r);return}let{data:i,indices:o}=e,s=n.typedBuffer,c=n.typedBufferStride,l=o.length,u=t[0],d=t[1],f=t[4],p=t[5],m=t[12],h=t[13];r*=c;let g=0,_=0,v=a(t)?e=>{g=i[e]+m,_=i[e+1]+h}:e=>{let t=i[e],n=i[e+1];g=u*t+f*n+m,_=d*t+p*n+h};for(let e=0;e<l;++e)v(2*o[e]),s[r]=g,s[r+1]=_,r+=c}function D(e,t,n,r,o=1){if(!t){b(e,n,r,o);return}let{data:s,indices:c}=e,l=t,u=n.typedBuffer,d=n.typedBufferStride,f=c.length,p=l[0],m=l[1],h=l[2],g=l[4],_=l[5],v=l[6],y=l[8],x=l[9],S=l[10],C=!i(l),w=1e-6,T=.999999;r*=d;let E=0,D=0,O=0,k=a(l)?e=>{E=s[e],D=s[e+1],O=s[e+2]}:e=>{let t=s[e],n=s[e+1],r=s[e+2];E=p*t+g*n+y*r,D=m*t+_*n+x*r,O=h*t+v*n+S*r};if(o===1){if(C)for(let e=0;e<f;++e){k(3*c[e]);let t=E*E+D*D+O*O;if(t<T&&t>w){let e=1/Math.sqrt(t);u[r]=E*e,u[r+1]=D*e,u[r+2]=O*e}else u[r]=E,u[r+1]=D,u[r+2]=O;r+=d}else for(let e=0;e<f;++e)k(3*c[e]),u[r]=E,u[r+1]=D,u[r+2]=O,r+=d}else for(let e=0;e<f;++e){if(k(3*c[e]),C){let e=E*E+D*D+O*O;if(e<T&&e>w){let t=1/Math.sqrt(e);E*=t,D*=t,O*=t}}for(let e=0;e<o;++e)u[r]=E,u[r+1]=D,u[r+2]=O,r+=d}}function O(e,t,n,r,a=1){if(!t){x(e,n,r,a);return}let{data:o,indices:s}=e,c=t,l=n.typedBuffer,u=n.typedBufferStride,d=s.length,f=c[0],p=c[1],m=c[2],h=c[4],g=c[5],_=c[6],v=c[8],y=c[9],b=c[10],S=!i(c),C=1e-6,w=.999999;if(r*=u,a===1)for(let e=0;e<d;++e){let t=4*s[e],n=o[t],i=o[t+1],a=o[t+2],c=o[t+3],d=f*n+h*i+v*a,x=p*n+g*i+y*a,T=m*n+_*i+b*a;if(S){let e=d*d+x*x+T*T;if(e<w&&e>C){let t=1/Math.sqrt(e);d*=t,x*=t,T*=t}}l[r]=d,l[r+1]=x,l[r+2]=T,l[r+3]=c,r+=u}else for(let e=0;e<d;++e){let t=4*s[e],n=o[t],i=o[t+1],c=o[t+2],d=o[t+3],x=f*n+h*i+v*c,T=p*n+g*i+y*c,E=m*n+_*i+b*c;if(S){let e=x*x+T*T+E*E;if(e<w&&e>C){let t=1/Math.sqrt(e);x*=t,T*=t,E*=t}}for(let e=0;e<a;++e)l[r]=x,l[r+1]=T,l[r+2]=E,l[r+3]=d,r+=u}}function k(e,t,n,r,i=1){let{data:a,indices:o}=e,s=n.typedBuffer,c=n.typedBufferStride,l=o.length;if(r*=c,t===a.length&&t===4){s[r]=a[0],s[r+1]=a[1],s[r+2]=a[2],s[r+3]=a[3];let e=new Uint32Array(n.typedBuffer.buffer,n.start),t=c/4;r/=4;let o=e[r];r+=t;let u=l*i;for(let n=1;n<u;++n)e[r]=o,r+=t}else if(i===1){if(t===4){for(let e=0;e<l;++e){let t=4*o[e];s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=a[t+3],r+=c}return}for(let e=0;e<l;++e){let t=3*o[e];s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=255,r+=c}}else if(t===4)for(let e=0;e<l;++e){let t=4*o[e];for(let e=0;e<i;++e)s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=a[t+3],r+=c}else for(let e=0;e<l;++e){let t=3*o[e];for(let e=0;e<i;++e)s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=255,r+=c}}function A(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length,c=r[0];n*=o;for(let e=0;e<s;++e)a[n]=c,n+=o}function j(r,i,a,o){e(M,r,i);let s=Math.max(Math.sqrt(t(M)),1e-4);n(M,M,1/s),a[o++]=M[0],a[o++]=M[1],a[o++]=M[2],a[o++]=s}const M=r();function N(e,t,n,r,i){let{buffer:a,offset:o}=i;for(let i of t.fields.keys()){let t=e.get(i),s=t?.indices;t&&s&&P(i,t,n,r,a,o)}}function P(e,t,n,r,i,a){switch(e){case`position`:{p(t.size===3);let r=i.getField(e,f);p(!!r,`No buffer view for ${e}`),T(t,n,r,a);break}case`normal`:{p(t.size===3);let n=i.getField(e,f);p(!!n,`No buffer view for ${e}`),D(t,r,n,a);break}case`normalCompressed`:case`profileRight`:case`profileUp`:{p(t.size===2);let n=i.getField(e,l);p(!!n,`No buffer view for ${e}`),y(t,n,a);break}case`uv0`:{p(t.size===2);let n=i.getField(e,u)??i.getField(e,d);p(!!n,`No buffer view for ${e}`),y(t,n,a);break}case`uvi`:{p(t.size===2);let n=i.getField(e,l);p(!!n,`No buffer view for ${e}`),y(t,n,a);break}case`color`:case`symbolColor`:{let n=i.getField(e,o);p(!!n,`No buffer view for ${e}`),p(t.size===3||t.size===4),k(t,t.size,n,a);break}case`colorFeatureAttribute`:case`opacityFeatureAttribute`:case`sizeFeatureAttribute`:{let n=i.getField(e,c)??i.getField(e,c);p(!!n,`No buffer view for ${e}`),p(t.size===1),A(t,n,a);break}case`tangent`:{p(t.size===4);let r=i.getField(e,s);p(!!r,`No buffer view for ${e}`),O(t,n,r,a);break}case`olidColor`:p(t.size===4),k(t,4,i.getField(e,o),a)}}function F(e,t,n,r){let{data:i,stride:a,size:o,indices:s}=e;p(o===1,`Index should be 1D`);let c=s.length;for(let e=0;e<c;++e){let o=i[a*s[e]];t.set(n+e,r+o)}}function I(e,t,n,r){for(let i=0;i<r;++i)e.set(t+i,n)}export{P as writeAttribute,N as writeAttributes,h as writeBufferFloat,m as writeBufferFloat16,g as writeBufferInt16,C as writeBufferMat3f,w as writeBufferMat4f,_ as writeBufferUint32,v as writeBufferUint8,y as writeBufferVec2,b as writeBufferVec3,x as writeBufferVec4,S as writeBufferZeros,k as writeColor,I as writeConstTextureElementIndex,j as writeDeltaF16Vector,D as writeNormal,T as writePosition,E as writePosition2d,O as writeTangent,F as writeTextureElementIndex,A as writeVVFeatureAttribute};
2
+ import{subtract as e,length as t,scale as n}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as i,hasIdentityRotation as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as o,BufferViewVec4f as s,BufferViewFloat as c,BufferViewVec2i16 as l,BufferViewVec2f16 as u,BufferViewVec2f as d,BufferViewVec3f as f}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as p}from"../../lib/Util.js";function m(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e)a[n]=r[i[e]],n+=o}function h(e,t,n,r=1){let{data:i,indices:a}=e,o=t.typedBuffer,s=t.typedBufferStride,c=a.length;if(n*=s,r===1)for(let e=0;e<c;++e)o[n]=i[a[e]],n+=s;else for(let e=0;e<c;++e){let t=i[a[e]];for(let e=0;e<r;e++)o[n]=t,n+=s}}function g(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e)a[n]=r[i[e]],n+=o}function _(e,t,n){let{data:r,stride:i,indices:a}=e,o=a.length;for(let e=0;e<o;++e)t.set(n+e,r[i*a[e]])}function v(e,t,n){let{data:r,stride:i,indices:a}=e,o=a.length;for(let e=0;e<o;++e)t.set(n+e,r[i*a[e]])}function y(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e){let t=2*i[e];a[n]=r[t],a[n+1]=r[t+1],n+=o}}function b(e,t,n,r=1){let{data:i,indices:a}=e,o=t.typedBuffer,s=t.typedBufferStride,c=a.length;if(n*=s,r===1)for(let e=0;e<c;++e){let t=3*a[e];o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],n+=s}else for(let e=0;e<c;++e){let t=3*a[e];for(let e=0;e<r;++e)o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],n+=s}}function x(e,t,n,r=1){let{data:i,indices:a}=e,o=t.typedBuffer,s=t.typedBufferStride,c=a.length;if(n*=s,r===1)for(let e=0;e<c;++e){let t=4*a[e];o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],o[n+3]=i[t+3],n+=s}else for(let e=0;e<c;++e){let t=4*a[e];for(let e=0;e<r;++e)o[n]=i[t],o[n+1]=i[t+1],o[n+2]=i[t+2],o[n+3]=i[t+3],n+=s}}function S(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e){let t=9*i[e];for(let e=0;e<9;++e)a[n+e]=r[t+e];n+=o}}function C(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length;n*=o;for(let e=0;e<s;++e){let t=16*i[e];for(let e=0;e<16;++e)a[n+e]=r[t+e];n+=o}}function w(e,t,n,r,i=1){if(!t){b(e,n,r,i);return}let{data:o,indices:s}=e,c=n.typedBuffer,l=n.typedBufferStride,u=s.length,d=t[0],f=t[1],p=t[2],m=t[4],h=t[5],g=t[6],_=t[8],v=t[9],y=t[10],x=t[12],S=t[13],C=t[14];r*=l;let w=0,T=0,E=0,D=a(t)?e=>{w=o[e]+x,T=o[e+1]+S,E=o[e+2]+C}:e=>{let t=o[e],n=o[e+1],r=o[e+2];w=d*t+m*n+_*r+x,T=f*t+h*n+v*r+S,E=p*t+g*n+y*r+C};if(i===1)for(let e=0;e<u;++e)D(3*s[e]),c[r]=w,c[r+1]=T,c[r+2]=E,r+=l;else for(let e=0;e<u;++e){D(3*s[e]);for(let e=0;e<i;++e)c[r]=w,c[r+1]=T,c[r+2]=E,r+=l}}function T(e,t,n,r){if(!t){y(e,n,r);return}let{data:i,indices:o}=e,s=n.typedBuffer,c=n.typedBufferStride,l=o.length,u=t[0],d=t[1],f=t[4],p=t[5],m=t[12],h=t[13];r*=c;let g=0,_=0,v=a(t)?e=>{g=i[e]+m,_=i[e+1]+h}:e=>{let t=i[e],n=i[e+1];g=u*t+f*n+m,_=d*t+p*n+h};for(let e=0;e<l;++e)v(2*o[e]),s[r]=g,s[r+1]=_,r+=c}function E(e,t,n,r,o=1){if(!t){b(e,n,r,o);return}let{data:s,indices:c}=e,l=t,u=n.typedBuffer,d=n.typedBufferStride,f=c.length,p=l[0],m=l[1],h=l[2],g=l[4],_=l[5],v=l[6],y=l[8],x=l[9],S=l[10],C=!i(l),w=1e-6,T=.999999;r*=d;let E=0,D=0,O=0,k=a(l)?e=>{E=s[e],D=s[e+1],O=s[e+2]}:e=>{let t=s[e],n=s[e+1],r=s[e+2];E=p*t+g*n+y*r,D=m*t+_*n+x*r,O=h*t+v*n+S*r};if(o===1){if(C)for(let e=0;e<f;++e){k(3*c[e]);let t=E*E+D*D+O*O;if(t<T&&t>w){let e=1/Math.sqrt(t);u[r]=E*e,u[r+1]=D*e,u[r+2]=O*e}else u[r]=E,u[r+1]=D,u[r+2]=O;r+=d}else for(let e=0;e<f;++e)k(3*c[e]),u[r]=E,u[r+1]=D,u[r+2]=O,r+=d}else for(let e=0;e<f;++e){if(k(3*c[e]),C){let e=E*E+D*D+O*O;if(e<T&&e>w){let t=1/Math.sqrt(e);E*=t,D*=t,O*=t}}for(let e=0;e<o;++e)u[r]=E,u[r+1]=D,u[r+2]=O,r+=d}}function D(e,t,n,r,a=1){if(!t){x(e,n,r,a);return}let{data:o,indices:s}=e,c=t,l=n.typedBuffer,u=n.typedBufferStride,d=s.length,f=c[0],p=c[1],m=c[2],h=c[4],g=c[5],_=c[6],v=c[8],y=c[9],b=c[10],S=!i(c),C=1e-6,w=.999999;if(r*=u,a===1)for(let e=0;e<d;++e){let t=4*s[e],n=o[t],i=o[t+1],a=o[t+2],c=o[t+3],d=f*n+h*i+v*a,x=p*n+g*i+y*a,T=m*n+_*i+b*a;if(S){let e=d*d+x*x+T*T;if(e<w&&e>C){let t=1/Math.sqrt(e);d*=t,x*=t,T*=t}}l[r]=d,l[r+1]=x,l[r+2]=T,l[r+3]=c,r+=u}else for(let e=0;e<d;++e){let t=4*s[e],n=o[t],i=o[t+1],c=o[t+2],d=o[t+3],x=f*n+h*i+v*c,T=p*n+g*i+y*c,E=m*n+_*i+b*c;if(S){let e=x*x+T*T+E*E;if(e<w&&e>C){let t=1/Math.sqrt(e);x*=t,T*=t,E*=t}}for(let e=0;e<a;++e)l[r]=x,l[r+1]=T,l[r+2]=E,l[r+3]=d,r+=u}}function O(e,t,n,r,i=1){let{data:a,indices:o}=e,s=n.typedBuffer,c=n.typedBufferStride,l=o.length;if(r*=c,t===a.length&&t===4){s[r]=a[0],s[r+1]=a[1],s[r+2]=a[2],s[r+3]=a[3];let e=new Uint32Array(n.typedBuffer.buffer,n.start),t=c/4;r/=4;let o=e[r];r+=t;let u=l*i;for(let n=1;n<u;++n)e[r]=o,r+=t}else if(i===1){if(t===4){for(let e=0;e<l;++e){let t=4*o[e];s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=a[t+3],r+=c}return}for(let e=0;e<l;++e){let t=3*o[e];s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=255,r+=c}}else if(t===4)for(let e=0;e<l;++e){let t=4*o[e];for(let e=0;e<i;++e)s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=a[t+3],r+=c}else for(let e=0;e<l;++e){let t=3*o[e];for(let e=0;e<i;++e)s[r]=a[t],s[r+1]=a[t+1],s[r+2]=a[t+2],s[r+3]=255,r+=c}}function k(e,t,n){let{data:r,indices:i}=e,a=t.typedBuffer,o=t.typedBufferStride,s=i.length,c=r[0];n*=o;for(let e=0;e<s;++e)a[n]=c,n+=o}function A(r,i,a,o){e(j,r,i);let s=Math.max(Math.sqrt(t(j)),1e-4);n(j,j,1/s),a[o++]=j[0],a[o++]=j[1],a[o++]=j[2],a[o++]=s}const j=r();function M(e,t,n,r,i){let{buffer:a,offset:o}=i;for(let i of t.fields.keys()){let t=e.get(i),s=t?.indices;t&&s&&N(i,t,n,r,a,o)}}function N(e,t,n,r,i,a){switch(e){case`position`:{p(t.size===3);let r=i.getField(e,f);p(!!r,`No buffer view for ${e}`),w(t,n,r,a);break}case`normal`:{p(t.size===3);let n=i.getField(e,f);p(!!n,`No buffer view for ${e}`),E(t,r,n,a);break}case`normalCompressed`:case`profileRight`:case`profileUp`:{p(t.size===2);let n=i.getField(e,l);p(!!n,`No buffer view for ${e}`),y(t,n,a);break}case`uv0`:{p(t.size===2);let n=i.getField(e,u)??i.getField(e,d);p(!!n,`No buffer view for ${e}`),y(t,n,a);break}case`uvi`:{p(t.size===2);let n=i.getField(e,l);p(!!n,`No buffer view for ${e}`),y(t,n,a);break}case`color`:case`symbolColor`:{let n=i.getField(e,o);p(!!n,`No buffer view for ${e}`),p(t.size===3||t.size===4),O(t,t.size,n,a);break}case`colorFeatureAttribute`:case`opacityFeatureAttribute`:case`sizeFeatureAttribute`:{let n=i.getField(e,c)??i.getField(e,c);p(!!n,`No buffer view for ${e}`),p(t.size===1),k(t,n,a);break}case`tangent`:{p(t.size===4);let r=i.getField(e,s);p(!!r,`No buffer view for ${e}`),D(t,n,r,a);break}case`olidColor`:p(t.size===4),O(t,4,i.getField(e,o),a)}}function P(e,t,n,r){let{data:i,stride:a,size:o,indices:s}=e;p(o===1,`Index should be 1D`);let c=s.length;for(let e=0;e<c;++e){let o=i[a*s[e]];t.set(n+e,r+o)}}function F(e,t,n,r){for(let i=0;i<r;++i)e.set(t+i,n)}export{N as writeAttribute,M as writeAttributes,h as writeBufferFloat,m as writeBufferFloat16,g as writeBufferInt16,S as writeBufferMat3f,C as writeBufferMat4f,_ as writeBufferUint32,v as writeBufferUint8,y as writeBufferVec2,b as writeBufferVec3,x as writeBufferVec4,O as writeColor,F as writeConstTextureElementIndex,A as writeDeltaF16Vector,E as writeNormal,w as writePosition,T as writePosition2d,D as writeTangent,P as writeTextureElementIndex,k as writeVVFeatureAttribute};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../core/has.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{GridLocalOriginFactory as t}from"../lib/GridLocalOriginFactory.js";import n from"../lib/ModelDirtySet.js";import{RenderGeometry as r}from"../lib/RenderGeometry.js";import{assert as i}from"../lib/Util.js";class a{constructor(){this.dirtySet=new n({model:this}),this._originFactory=new t(null),this._textures=new Map,this._layers=new Map}hasTexture(e){return this._textures.has(e.id)}getTexture(e){return e==null?null:this._textures.get(e)}addTexture(e){let t=e.id;i(!this._textures.has(t),`Model/Stage already contains texture to be added`),this._textures.set(t,e)}removeTexture(e){return this._textures.delete(e.id)}addTextures(e){for(let t of e)t&&(i(!this._textures.has(t.id),`Model/Stage already contains object to be added`),this._textures.set(t.id,t))}removeTextures(e){for(let t of e)t&&(i(this._textures.has(t.id),`Model/Stage doesn't contain object to be removed`),this._textures.delete(t.id))}forEachTexture(e){this._textures.forEach(t=>e(t))}hasLayer(e){return this._layers.has(e.id)}getLayer(e){return e==null?null:this._layers.get(e)}addLayer(e){let t=e.id;i(!this._layers.has(t),`Model/Stage already contains layer to be added`),this._layers.set(t,e)}removeLayer(e){return this._layers.delete(e.id)}getRenderGeometry(e,t){if(e.type===1)return i(t.type===1),t;i(t.type===0);let n=new r(t,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation});return n.transformation=e.getCombinedStaticTransformation(t,o),n.localOrigin=t.localOrigin??this._originFactory.getOrigin(n.boundingSphere.center),n}updateRenderGeometryTransformation(e,t,n){if(e==null)return!1;n.transformation=e.getCombinedStaticTransformation(t,o);let r=t.localOrigin??this._originFactory.getOrigin(n.boundingSphere.center);return n.localOrigin!==r}get test(){}}const o=e();export{a as Model};
2
+ import"../../../../core/has.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{GridLocalOriginFactory as t}from"../lib/GridLocalOriginFactory.js";import n from"../lib/ModelDirtySet.js";import{RenderGeometry as r}from"../lib/RenderGeometry.js";import{assert as i}from"../lib/Util.js";class a{constructor(){this.dirtySet=new n({model:this}),this.localOriginFactory=new t(null),this._textures=new Map,this._layers=new Map}hasTexture(e){return this._textures.has(e.id)}getTexture(e){return e==null?null:this._textures.get(e)}addTexture(e){let t=e.id;i(!this._textures.has(t),`Model/Stage already contains texture to be added`),this._textures.set(t,e)}removeTexture(e){return this._textures.delete(e.id)}addTextures(e){for(let t of e)t&&(i(!this._textures.has(t.id),`Model/Stage already contains object to be added`),this._textures.set(t.id,t))}removeTextures(e){for(let t of e)t&&(i(this._textures.has(t.id),`Model/Stage doesn't contain object to be removed`),this._textures.delete(t.id))}forEachTexture(e){this._textures.forEach(t=>e(t))}hasLayer(e){return this._layers.has(e.id)}getLayer(e){return e==null?null:this._layers.get(e)}addLayer(e){let t=e.id;i(!this._layers.has(t),`Model/Stage already contains layer to be added`),this._layers.set(t,e)}removeLayer(e){return this._layers.delete(e.id)}getRenderGeometry(e,t){if(e.type===1)return i(t.type===1),t;i(t.type===0);let n=new r(t,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation});return n.transformation=e.getCombinedStaticTransformation(t,o),n.localOrigin=t.localOrigin??this.localOriginFactory.getOrigin(n.boundingSphere.center),n}updateRenderGeometryTransformation(e,t,n){if(e==null)return!1;n.transformation=e.getCombinedStaticTransformation(t,o);let r=t.localOrigin??this.localOriginFactory.getOrigin(n.boundingSphere.center);return n.localOrigin!==r}get test(){}}const o=e();export{a as Model};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/forwardLocalUp.glsl.js";import"../core/shaderLibrary/shading/lightingUniforms.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/readFragmentShadow.glsl.js";import"../core/shaderLibrary/util/cameraUniforms.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/NoPerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"./alphaCutoff.glsl.js";import"./animatedAlpha.glsl.js";import"./lineUniforms.js";import"./OutputColorHighlightOLID.glsl.js";import"./RibbonLineTextureBuffer.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,n as numRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
2
+ import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import"../core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import"../core/shaderLibrary/shading/forwardLocalUp.glsl.js";import"../core/shaderLibrary/shading/lightingUniforms.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/readFragmentShadow.glsl.js";import"../core/shaderLibrary/util/cameraUniforms.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/NoPerspective.glsl.js";import"../core/shaderLibrary/util/PackedUint32.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../lib/RibbonLineVertexInfo.js";import"./alphaCutoff.glsl.js";import"./animatedAlpha.glsl.js";import"./lineUniforms.js";import"./OutputColorHighlightOLID.glsl.js";import"./RibbonLineTextureBuffer.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,n as numRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as n}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function r(t){return e().u32(`textureElementIndex`,{integer:!0}).vec2f16(`lineParameters`)}const i=[{type:`vec3f32`,name:`position`},{type:`f32`,name:`u0`}];function a(e){let r=[...i];return e.hasVVColor?r.push({type:`f32`,name:`colorFeatureAttribute`}):r.push({type:`vec4unorm8`,name:`color`}),e.hasVVSize?r.push({type:`f32`,name:`sizeFeatureAttribute`}):r.push({type:`f32`,name:`size`}),e.hasVVOpacity&&r.push({type:`f32`,name:`opacityFeatureAttribute`}),t()&&r.push({type:`vec4unorm8`,name:`olidColor`}),e.hasAnimation&&r.push({type:`vec4f16`,name:`timeStamps`}),new n(r)}export{r as getLayout,a as getTextureBufferLayout};
2
+ import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";import{TextureBackedBufferLayout as n}from"../lib/TextureBackedBuffer/TextureBackedBufferLayout.js";function r(t){return e().u32(`ribbonLineVertexInfo`,{integer:!0})}const i=[{type:`vec3f32`,name:`position`}];function a(e){let r=[...i];return e.hasLineDistance&&r.push({type:`f32`,name:`u0`}),e.hasVVColor?r.push({type:`f32`,name:`colorFeatureAttribute`}):e.hasVertexColor&&r.push({type:`vec4unorm8`,name:`color`}),e.hasVVSize?r.push({type:`f32`,name:`sizeFeatureAttribute`}):e.hasVertexSize&&r.push({type:`f32`,name:`size`}),e.hasVVOpacity&&r.push({type:`f32`,name:`opacityFeatureAttribute`}),t()&&r.push({type:`vec4unorm8`,name:`olidColor`}),e.hasAnimation&&r.push({type:`vec4f16`,name:`timeStamps`}),new n(r)}export{r as getLayout,a as getTextureBufferLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{LineTechniqueConfiguration as n}from"./LineTechniqueConfiguration.js";const r=16,i=8;class a extends n{constructor(){super(...arguments),this.capType=0,this.animation=2,this.polygonOffsetIndex=0,this.numJoinSubdivisions=1,this.polygonOffset=0,this.writeDepth=!1,this.transparent=!1,this.enableOITOffset=!0,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.wireframe=!1,this.imagePattern=!1,this.useFlatJoinVarying=!1}get hasAnimation(){return this.animation!==0}get usePerspectiveCorrectStipple(){return this.worldSized&&!this.draped}}e([t({count:3})],a.prototype,`capType`,void 0),e([t({count:4})],a.prototype,`animation`,void 0),e([t({count:16})],a.prototype,`polygonOffsetIndex`,void 0),e([t({count:8})],a.prototype,`numJoinSubdivisions`,void 0),e([t({count:5})],a.prototype,`polygonOffset`,void 0),e([t()],a.prototype,`writeDepth`,void 0),e([t()],a.prototype,`transparent`,void 0),e([t()],a.prototype,`enableOITOffset`,void 0),e([t()],a.prototype,`stippleEnabled`,void 0),e([t()],a.prototype,`stippleOffColorEnabled`,void 0),e([t()],a.prototype,`stipplePreferContinuous`,void 0),e([t()],a.prototype,`roundJoins`,void 0),e([t()],a.prototype,`applyMarkerOffset`,void 0),e([t()],a.prototype,`falloffEnabled`,void 0),e([t()],a.prototype,`innerColorEnabled`,void 0),e([t()],a.prototype,`wireframe`,void 0),e([t()],a.prototype,`imagePattern`,void 0),e([t()],a.prototype,`useFlatJoinVarying`,void 0);export{i as NUM_JOIN_SUBDIVISION_COUNT,r as POLYGON_OFFSET_INDEX_COUNT,a as RibbonLineTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{LineTechniqueConfiguration as n}from"./LineTechniqueConfiguration.js";const r=16,i=8;class a extends n{constructor(){super(...arguments),this.capType=0,this.animation=2,this.polygonOffsetIndex=0,this.numJoinSubdivisions=1,this.polygonOffset=0,this.writeDepth=!1,this.transparent=!1,this.enableOITOffset=!0,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.wireframe=!1,this.imagePattern=!1,this.useFlatJoinVarying=!1,this.hasVertexColor=!0,this.hasVertexSize=!0,this.hasLineDistance=!0}get hasAnimation(){return this.animation!==0}get usePerspectiveCorrectStipple(){return this.worldSized&&!this.draped}}e([t({count:3})],a.prototype,`capType`,void 0),e([t({count:4})],a.prototype,`animation`,void 0),e([t({count:16})],a.prototype,`polygonOffsetIndex`,void 0),e([t({count:8})],a.prototype,`numJoinSubdivisions`,void 0),e([t({count:5})],a.prototype,`polygonOffset`,void 0),e([t()],a.prototype,`writeDepth`,void 0),e([t()],a.prototype,`transparent`,void 0),e([t()],a.prototype,`enableOITOffset`,void 0),e([t()],a.prototype,`stippleEnabled`,void 0),e([t()],a.prototype,`stippleOffColorEnabled`,void 0),e([t()],a.prototype,`stipplePreferContinuous`,void 0),e([t()],a.prototype,`roundJoins`,void 0),e([t()],a.prototype,`applyMarkerOffset`,void 0),e([t()],a.prototype,`falloffEnabled`,void 0),e([t()],a.prototype,`innerColorEnabled`,void 0),e([t()],a.prototype,`wireframe`,void 0),e([t()],a.prototype,`imagePattern`,void 0),e([t()],a.prototype,`useFlatJoinVarying`,void 0),e([t()],a.prototype,`hasVertexColor`,void 0),e([t()],a.prototype,`hasVertexSize`,void 0),e([t()],a.prototype,`hasLineDistance`,void 0);export{i as NUM_JOIN_SUBDIVISION_COUNT,r as POLYGON_OFFSET_INDEX_COUNT,a as RibbonLineTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{TextureBackedBufferModule as e}from"../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{Texture2DUintDrawUniform as t}from"../core/shaderModules/Texture2DUintDrawUniform.js";import{getTextureBufferLayout as n}from"./RibbonLineLayouts.js";const r=new t(`componentTextureBuffer`,e=>e.textureBuffer);function i(t){return new e({layout:n(t),itemIndexExpression:`textureElementIndex`,bufferUniform:r})}export{i as getTextureBackedBufferModule};
2
+ import{TextureBackedBufferModule as e}from"../core/shaderLibrary/TextureBackedBuffer.glsl.js";import{getPackedUint32Field as t}from"../core/shaderLibrary/util/PackedUint32.glsl.js";import{Texture2DUintDrawUniform as n}from"../core/shaderModules/Texture2DUintDrawUniform.js";import{ribbonLineVertexInfoPacking as r}from"../lib/RibbonLineVertexInfo.js";import{getTextureBufferLayout as i}from"./RibbonLineLayouts.js";const a=new n(`componentTextureBuffer`,e=>e.textureBuffer);function o(n){return new e({layout:i(n),itemIndexExpression:t(r,0,`ribbonLineVertexInfo`),bufferUniform:a})}export{o as getTextureBackedBufferModule};
@@ -135,7 +135,7 @@ export default class SelectionManager extends EventedAccessor {
135
135
  * @param layer - The selectable layer to which to add the selection. This must be a layer with graphics in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
136
136
  * @param selection - An array of features, ie. [Graphic[]](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) to add to the current selection.
137
137
  */
138
- add(layer: GraphicsLayer | SketchLayer, selection: Graphic[]): void;
138
+ add(layer: SelectableLayerWithGraphics | GraphicsLayer | SketchLayer, selection: Graphic[]): void;
139
139
  /**
140
140
  * Adds features to the current selection. It does not replace the existing selection.
141
141
  *
@@ -169,7 +169,7 @@ export default class SelectionManager extends EventedAccessor {
169
169
  * @param target - The selectable layer that provides the selected features. This must be a layer with graphics in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
170
170
  * @returns Returns an array of [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/)s representing the selected features.
171
171
  */
172
- getSelection(target: GraphicsLayer): Graphic[] | undefined;
172
+ getSelection(target: SelectableLayerWithGraphics | GraphicsLayer | SketchLayer): Graphic[] | undefined;
173
173
  /**
174
174
  * @param target - The selectable layer that provides the selected features. This must be a layer with object IDs in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
175
175
  * @returns Returns an array of [ObjectId's](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ObjectId) representing the selected features.
@@ -186,7 +186,7 @@ export default class SelectionManager extends EventedAccessor {
186
186
  * @param layer - The selectable layer from which to remove the selection. This must be a layer with graphics in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
187
187
  * @param selection - An array of features, ie. [Graphic[]](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) to remove from the current selection.
188
188
  */
189
- remove(layer: SelectableLayerWithGraphics, selection: Graphic[]): void;
189
+ remove(layer: SelectableLayerWithGraphics | GraphicsLayer | SketchLayer, selection: Graphic[]): void;
190
190
  /**
191
191
  * @param layer - The selectable layer from which to remove the selection. This must be a layer with object IDs in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
192
192
  * @param selection - An array of features, ie. [ObjectId](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ObjectId)[] to remove from the current selection.
@@ -203,7 +203,7 @@ export default class SelectionManager extends EventedAccessor {
203
203
  * @param layer - The selectable layer for which to replace the selection. This must be a layer with graphics in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
204
204
  * @param selection - An array of features, ie. [Graphic[]](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) to set as the current selection.
205
205
  */
206
- replace(layer: SelectableLayerWithGraphics, selection: Graphic[]): void;
206
+ replace(layer: SelectableLayerWithGraphics | GraphicsLayer | SketchLayer, selection: Graphic[]): void;
207
207
  /**
208
208
  * @param layer - The selectable layer for which to replace the selection. This must be a layer with object IDs in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
209
209
  * @param selection - An array of features, ie. [ObjectId](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ObjectId)[] to set as the current selection.
@@ -242,7 +242,7 @@ export default class SelectionManager extends EventedAccessor {
242
242
  * @param layer - The selectable layer for which to toggle the selection. This must be a layer with graphics in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
243
243
  * @param selection - An array of features, ie. [Graphic[]](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) to toggle within the current selection.
244
244
  */
245
- toggle(layer: GraphicsLayer | SketchLayer, selection: Graphic[]): void;
245
+ toggle(layer: SelectableLayerWithGraphics | GraphicsLayer | SketchLayer, selection: Graphic[]): void;
246
246
  /**
247
247
  * @param layer - The selectable layer for which to toggle the selection. This must be a layer with object IDs in the [sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
248
248
  * @param selection - An array of features, ie. [ObjectId](https://developers.arcgis.com/javascript/latest/references/core/views/types/#ObjectId)[] to toggle within the current selection.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t,difference as n}from"../core/arrayUtils.js";import r from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import{deprecatedProperty as a,deprecatedFunction as o}from"../core/deprecate.js";import{EventedAccessor as s}from"../core/Evented.js";import{makeHandle as c}from"../core/handleUtils.js";import l from"../core/Logger.js";import{getOrCreateMapValue as u}from"../core/MapUtils.js";import{destroyMaybe as d}from"../core/maybe.js";import f from"../core/ReactiveMap.js";import{watch as p,initial as m,on as h}from"../core/reactiveUtils.js";import{addMany as g,symmetricDifference as _}from"../core/SetUtils.js";import{property as v,subclass as y}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../core/support/UpdatingHandles.js";import{getGraphicLayer as x}from"../graphic/graphicOriginUtils.js";import{isSubtypeSublayer as S,isSubtypeGroupLayer as C,isKnowledgeGraphLayer as w,isMapImageLayer as T}from"../layers/support/layerUtils.js";import E from"../rest/support/Query.js";import{isGraphic as D}from"../support/graphicInstanceUtils.js";import{isSelectableLayerWithObjectIds as O,isSelectableLayerViewWithObjectIds as k,isSelectableLayer as A,isSelectableLayerView as j,isTableLayer as M,isSelectableLayerViewWithHighlights as N,isSelectableLayerWithGraphics as P,isSelectableLayerBaseWithEditing as F}from"./support/selectionUtils.js";let I=class extends s{constructor(e){super(e),this._layerEditHandles=new r,this._selectionMap=new f,this._sources=new r,this._trashCan=[],this._updatingHandles=new b,this._vizTaskId=0,this.highlightEnabled=!0,this.highlightName=`default`,this.layerViewMap=new WeakMap,this.view=null}initialize(){this.addHandles([p(()=>[this.view,this.highlightEnabled],()=>void this._refreshVisualization()),p(()=>this.view,e=>{e?.when().then(()=>this.syncSources()).catch(()=>{})},m),h(()=>this.sources,`change`,e=>{let t=this._selectionMap,n=[];for(let r of e.removed){let e=t.get(r);e&&(t.delete(r),e.highlightHandle?.remove(),n.push({layer:r,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),n.length&&this._onSelectionChange(n)},{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.destroyAll(),this._updatingHandles.destroy(),d(this._layerEditHandles),d(this._sources)}get count(){let e=0;for(let t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get selections(){return Array.from(this._selectionMap.entries()).map(e=>{let[t,n]=e;return{layer:t,selection:[...n.selection]}})}get showHighlight(){return this.highlightEnabled}set showHighlight(e){a(l.getLogger(this),`showHighlight`,{replacement:`highlightEnabled`}),this.highlightEnabled=e}get sources(){return this._sources}set sources(e){i(e,this._sources)}get updating(){return this._updatingHandles.updating}add(e,t){let n=new Set;g(n,this._selectionMap.get(e)?.selection);for(let r of t)n.add(L(e,r));this._setSelection(e,Array.from(n))}clear(){let e=this._selectionMap.values();this._trashCan.push(...e);let t=[];for(let[e,n]of this._selectionMap.entries())t.push({layer:e,added:[],removed:[...n.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}getSelection(e){return this._selectionMap.get(e)?.selection}syncSources(){let e=new Set,t=this.view?.map;if(!t)return;let n=t=>{w(t)?(t.layers?.forEach(n),t.tables?.forEach(n)):T(t)?(t.sublayers?.forEach(n),t.subtables?.forEach(n)):C(t)?t.sublayers?.forEach(n):A(t)&&e.add(t)};t.allLayers.forEach(n),t.allTables.forEach(n),this.sources=[...e]}async getSelectedFeatures(e,n={},r=`layerView`){let{view:i,selections:a}=this;if(!i&&r===`layerView`)return l.getLogger(this).warn(`Cannot query layer views without a view.`),[];let o=a.map(async t=>{let{layer:a,selection:o}=t;if(o.length&&O(a)&&(!e||e.includes(a))){if(i&&r===`layerView`&&!a.isTable){let e=await this._findLayerView(a);if(k(e))return z(e,o,n)}return z(a,o,n)}}).filter(t);return(await Promise.all(o)).filter(t)}updateSelection(e){let t=new Map;for(let[e,n]of this._selectionMap)t.set(e,new Set(n.selection));let r=!1,i=e.current.concat(e.added);for(let e of i){let n=x(e);if(A(n)&&this.sources.includes(n)){let i=u(t,n,()=>new Set),a=L(n,e);a!=null&&(i.add(a),r=!0)}}for(let n of e.removed){let e=x(n);if(A(e)&&this.sources.includes(e)){let i=t.get(e),a=L(e,n);a&&i&&(i.delete(a),r=!0)}}if(r){let{_selectionMap:e,_trashCan:r}=this,i=[];for(let[a,o]of t){let t=e.get(a),s=Array.from(o);t!==void 0&&r.push(t),e.set(a,{selection:s}),i.push({layer:a,selection:s,...n(t===void 0?[]:t.selection,s)})}this._onSelectionChange(i)}}setSelection(e,t){o(l.getLogger(this),`SelectionManager.setSelection is deprecated. Use SelectionManager.replace instead.`,{replacement:`SelectionManager.replace`,warnOnce:!0}),this.replace(e,t)}appendToSelection(e,t){o(l.getLogger(this),`SelectionManager.appendToSelection is deprecated. Use SelectionManager.add instead.`,{replacement:`SelectionManager.add`,warnOnce:!0}),this.add(e,t)}remove(e,t){let n=this._selectionMap.get(e);if(!n)return;let r=[],i=new Set(t.map(t=>L(e,t)));for(let e of n.selection)i.has(e)||r.push(e);this._setSelection(e,r)}replace(e,t){this._setSelection(e,t.map(t=>L(e,t)))}removeFromSelection(e,t){o(l.getLogger(this),`SelectionManager.removeFromSelection is deprecated. Use SelectionManager.remove instead.`,{replacement:`SelectionManager.remove`,warnOnce:!0}),this.remove(e,t)}toggle(e,t){let n=this._selectionMap.get(e),r=t.map(t=>L(e,t));if(!n||n.selection.length===0){this._setSelection(e,r);return}let i=new Set(n.selection),a=new Set(r),o=_(i,a);this._setSelection(e,Array.from(o))}toggleInSelection(e,t){o(l.getLogger(this),`SelectionManager.toggleInSelection is deprecated. Use SelectionManager.toggle instead.`,{replacement:`SelectionManager.toggle`,warnOnce:!0}),this.toggle(e,t)}async _findLayerView(e){let t=this.layerViewMap.get(e);if(t||!this.view)return t;let n=S(e)&&e.parent?e.parent:e,r=await this.view.whenLayerView(n).catch(()=>void 0);if(j(r))return this.layerViewMap.set(e,r),r.addHandles(c(()=>this.layerViewMap.delete(e))),r}_onSelectionChange(e){this._refreshVisualization(),this.emit(`selection-change`,{view:this.view,changes:e})}async _refreshVisualization(){await this._updatingHandles.addPromise(this._updateVisualization())}async _updateVisualization(){for(this._vizTaskId++;this._trashCan.length>0;)this._trashCan.pop()?.highlightHandle?.remove();let{_selectionMap:e,highlightName:t,sources:n,view:r}=this,i=r&&this.highlightEnabled,a=this._vizTaskId;for(let o of n){let n=e.get(o);if(n?.highlightHandle?.remove(),i&&n?.selection.length&&!M(o,r)){let e=await this._findLayerView(o);if(N(e)&&a===this._vizTaskId){let r=n.selection;n.highlightHandle=e.highlight(r,{name:t})}}}}_refreshListeners(){this._layerEditHandles.destroyAll();let e=new Set(this.sources.map(e=>S(e)?e.parent:e));for(let t of e)A(t)&&(P(t)?this._layerEditHandles.push(t.graphics.on(`change`,e=>this._onGraphicsLayerEdit(t,e))):F(t)&&this._layerEditHandles.push(t.on(`edits`,e=>this._onLayerEdit(t,e))))}_onLayerEdit(e,t){if(C(e))this._onParentLayerEdit(e,t);else if(t.deletedFeatures.length&&this._selectionMap.has(e)){let n=[];t.deletedFeatures.forEach(({error:e,objectId:t})=>{t!=null&&e==null&&n.push(t)}),this.remove(e,n)}}_onGraphicsLayerEdit(e,t){let{removed:n}=t;n.length&&this._selectionMap.has(e)&&this.remove(e,n)}_onParentLayerEdit(e,t){let{deletedFeatures:n,edits:r,updatedFeatures:i}=t;if(r?.updateFeatures?.forEach(t=>{let n=t.getObjectId()??t.attributes[e.objectIdField];if(n==null||i.find(e=>e.objectId===n)?.error)return;let r=e.findSublayerForFeature(t);if(!A(r))return;let a=e.sublayers.find(e=>!!(A(e)&&this.getSelection(e)?.includes(n)));A(a)&&a!==r&&(this.remove(a,[n]),this.add(r,[n]))}),n.length){let t=[];n.forEach(({error:e,objectId:n})=>{n!=null&&e==null&&t.push(n)}),e.sublayers.forEach(e=>{A(e)&&this._selectionMap.has(e)&&this.remove(e,t)})}}_setSelection(e,t){if(!this.sources.includes(e))throw Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);let r=this._selectionMap.get(e);if(!r||!R(r,{selection:t})){r&&this._trashCan.push(r),this._selectionMap.set(e,{selection:[...t]});let i=r?n(r.selection,t):{};this._onSelectionChange([{layer:e,selection:[...t],...i}])}}};e([v()],I.prototype,`_layerEditHandles`,void 0),e([v()],I.prototype,`_selectionMap`,void 0),e([v()],I.prototype,`_sources`,void 0),e([v()],I.prototype,`_updatingHandles`,void 0),e([v({readOnly:!0,nonNullable:!0})],I.prototype,`count`,null),e([v({readOnly:!0,nonNullable:!0})],I.prototype,`hasSelection`,null),e([v()],I.prototype,`highlightEnabled`,void 0),e([v()],I.prototype,`highlightName`,void 0),e([v()],I.prototype,`layerViewMap`,void 0),e([v({readOnly:!0,nonNullable:!0})],I.prototype,`selections`,null),e([v()],I.prototype,`showHighlight`,null),e([v()],I.prototype,`sources`,null),e([v()],I.prototype,`updating`,null),e([v()],I.prototype,`view`,void 0),I=e([y(`esri.views.SelectionManager`)],I);const L=(e,t)=>{if(O(e)&&D(t)){let e=t.getObjectId();if(e!=null)return e}return t},R=(e,t)=>{if(e==null&&t==null)return!0;if(e!=null&&t==null||e==null&&t!=null)return!1;if(e!=null&&t!=null&&e.selection!=null&&t.selection!=null){let n=[...e.selection],r=[...t.selection];if(n.length!==r.length)return!1;n.sort(),r.sort();for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1}return!0},z=async(e,t,n={})=>e.queryFeatures(new E({...n,objectIds:t})).then(t=>({data:t,layer:j(e)?e.layer:e})),B=I;export{B as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t,difference as n}from"../core/arrayUtils.js";import r from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import{deprecatedProperty as a,deprecatedFunction as o}from"../core/deprecate.js";import{EventedAccessor as s}from"../core/Evented.js";import{makeHandle as c}from"../core/handleUtils.js";import l from"../core/Logger.js";import{getOrCreateMapValue as u}from"../core/MapUtils.js";import{destroyMaybe as d}from"../core/maybe.js";import f from"../core/ReactiveMap.js";import{watch as p,initial as m,on as h}from"../core/reactiveUtils.js";import{addMany as g,symmetricDifference as _}from"../core/SetUtils.js";import{property as v,subclass as y}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../core/support/UpdatingHandles.js";import{getGraphicLayer as x}from"../graphic/graphicOriginUtils.js";import{isMapImageGraphicOrigin as S}from"../graphic/isMapImageGraphicOrigin.js";import{isMapNotesGraphicOrigin as C}from"../graphic/isMapNotesGraphicOrigin.js";import{isMapImageLayer as w,isMapNotesLayer as T,isSubtypeGroupLayer as E,isSublayer as D,isSubtypeSublayer as O,isGraphicsLayer as k,isKnowledgeGraphLayer as A}from"../layers/support/layerUtils.js";import j from"../rest/support/Query.js";import{isGraphic as M}from"../support/graphicInstanceUtils.js";import{isHighlightableLayerView as N}from"./layers/support/highlightUtils.js";import{isSelectableLayerWithObjectIds as P,isSelectableLayerViewWithObjectIds as F,isSelectableLayer as I,isSelectableLayerView as L,isTableLayer as R,isSelectableLayerViewWithHighlights as z,isSelectableLayerWithGraphics as B,isSelectableLayerBaseWithEditing as V}from"./support/selectionUtils.js";let H=class extends s{constructor(e){super(e),this._layerEditHandles=new r,this._selectionMap=new f,this._sources=new r,this._trashCan=[],this._updatingHandles=new b,this._vizTaskId=0,this.highlightEnabled=!0,this.highlightName=`default`,this.layerViewMap=new WeakMap,this.view=null}initialize(){this.addHandles([p(()=>[this.view,this.highlightEnabled],()=>void this._refreshVisualization()),p(()=>this.view,e=>{e?.when().then(()=>this.syncSources()).catch(()=>{})},m),h(()=>this.sources,`change`,e=>{let t=this._selectionMap,n=[];for(let r of e.removed){let e=t.get(r);e&&(t.delete(r),e.highlightHandle?.remove(),n.push({layer:r,selection:[],added:[],removed:[...e.selection]}))}this._refreshListeners(),n.length&&this._onSelectionChange(n)},{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this.clear(),this._layerEditHandles.destroyAll(),this._updatingHandles.destroy(),d(this._layerEditHandles),d(this._sources)}get count(){let e=0;for(let t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get selections(){return Array.from(this._selectionMap.entries()).map(e=>{let[t,n]=e;return{layer:t,selection:[...n.selection]}})}get showHighlight(){return this.highlightEnabled}set showHighlight(e){a(l.getLogger(this),`showHighlight`,{replacement:`highlightEnabled`}),this.highlightEnabled=e}get sources(){return this._sources}set sources(e){i(e,this._sources)}get updating(){return this._updatingHandles.updating}add(e,t){let n=new Set;g(n,this._selectionMap.get(e)?.selection);for(let r of t)n.add(U(e,r));this._setSelection(e,Array.from(n))}clear(){let e=this._selectionMap.values();this._trashCan.push(...e);let t=[];for(let[e,n]of this._selectionMap.entries())t.push({layer:e,added:[],removed:[...n.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}getSelection(e){return this._selectionMap.get(e)?.selection}syncSources(){let e=new Set,t=this.view?.map;if(!t)return;let n=t=>{k(t)&&t.internal||(A(t)?(t.layers?.forEach(n),t.tables?.forEach(n)):w(t)?(t.sublayers?.forEach(n),t.subtables?.forEach(n)):T(t)||E(t)?t.sublayers?.forEach(n):I(t)&&e.add(t))};t.allLayers.forEach(n),t.allTables.forEach(n),this.sources=[...e]}async getSelectedFeatures(e,n={},r=`layerView`){let{view:i,selections:a}=this;if(!i&&r===`layerView`)return l.getLogger(this).warn(`Cannot query layer views without a view.`),[];let o=a.map(async t=>{let{layer:a,selection:o}=t;if(o.length&&P(a)&&(!e||e.includes(a))){if(i&&r===`layerView`&&!a.isTable){let e=await this._findLayerView(a);if(F(e))return G(e,o,n)}return G(a,o,n)}}).filter(t);return(await Promise.all(o)).filter(t)}updateSelection(e){let t=new Map;for(let[e,n]of this._selectionMap)t.set(e,new Set(n.selection));let r=!1,i=e.current.concat(e.added);for(let e of i){let n=this._getGraphicSource(e);if(I(n)&&this.sources.includes(n)){let i=u(t,n,()=>new Set),a=U(n,e);a!=null&&(i.add(a),r=!0)}}for(let n of e.removed){let e=this._getGraphicSource(n);if(I(e)&&this.sources.includes(e)){let i=t.get(e),a=U(e,n);a&&i&&(i.delete(a),r=!0)}}if(r){let{_selectionMap:e,_trashCan:r}=this,i=[];for(let[a,o]of t){let t=e.get(a),s=Array.from(o);t!==void 0&&r.push(t),e.set(a,{selection:s}),i.push({layer:a,selection:s,...n(t===void 0?[]:t.selection,s)})}this._onSelectionChange(i)}}setSelection(e,t){o(l.getLogger(this),`SelectionManager.setSelection is deprecated. Use SelectionManager.replace instead.`,{replacement:`SelectionManager.replace`,warnOnce:!0}),this.replace(e,t)}appendToSelection(e,t){o(l.getLogger(this),`SelectionManager.appendToSelection is deprecated. Use SelectionManager.add instead.`,{replacement:`SelectionManager.add`,warnOnce:!0}),this.add(e,t)}remove(e,t){let n=this._selectionMap.get(e);if(!n)return;let r=[],i=new Set(t.map(t=>U(e,t)));for(let e of n.selection)i.has(e)||r.push(e);this._setSelection(e,r)}replace(e,t){this._setSelection(e,t.map(t=>U(e,t)))}removeFromSelection(e,t){o(l.getLogger(this),`SelectionManager.removeFromSelection is deprecated. Use SelectionManager.remove instead.`,{replacement:`SelectionManager.remove`,warnOnce:!0}),this.remove(e,t)}toggle(e,t){let n=this._selectionMap.get(e),r=t.map(t=>U(e,t));if(!n||n.selection.length===0){this._setSelection(e,r);return}let i=new Set(n.selection),a=new Set(r),o=_(i,a);this._setSelection(e,Array.from(o))}toggleInSelection(e,t){o(l.getLogger(this),`SelectionManager.toggleInSelection is deprecated. Use SelectionManager.toggle instead.`,{replacement:`SelectionManager.toggle`,warnOnce:!0}),this.toggle(e,t)}_getGraphicSource(e){let t=e.origin;return C(t)||S(t)?t.sublayer:x(e)}_getLayerViewSource(e){return w(e.parent)?e.parent:T(e.layer)?e.layer:E(e.parent)?e.parent:e}async _findLayerView(e){let t=this.layerViewMap.get(e);if(t||!this.view)return t;let n=this._getLayerViewSource(e),r=await this.view.whenLayerView(n).catch(()=>void 0);if(L(r)||N(r))return this.layerViewMap.set(e,r),r.addHandles(c(()=>this.layerViewMap.delete(e))),r}_onSelectionChange(e){this._refreshVisualization(),this.emit(`selection-change`,{view:this.view,changes:e})}async _refreshVisualization(){await this._updatingHandles.addPromise(this._updateVisualization())}async _updateVisualization(){for(this._vizTaskId++;this._trashCan.length>0;)this._trashCan.pop()?.highlightHandle?.remove();let{_selectionMap:e,highlightName:t,sources:n,view:r}=this,i=r&&this.highlightEnabled,a=this._vizTaskId;for(let o of n){let n=e.get(o);if(n?.highlightHandle?.remove(),i&&n?.selection.length&&!R(o,r)){let e=await this._findLayerView(o);if(z(e)&&a===this._vizTaskId){if(D(o)&&w(o.parent)&&!n.selection.every(e=>M(e)))return;let r=n.selection;n.highlightHandle=e.highlight(r,{name:t})}}}}_refreshListeners(){this._layerEditHandles.destroyAll();let e=new Set(this.sources.map(e=>O(e)?e.parent:e));for(let t of e)I(t)&&(B(t)?this._layerEditHandles.push(t.graphics.on(`change`,e=>this._onGraphicsLayerEdit(t,e))):V(t)&&this._layerEditHandles.push(t.on(`edits`,e=>this._onLayerEdit(t,e))))}_onLayerEdit(e,t){if(E(e))this._onParentLayerEdit(e,t);else if(t.deletedFeatures.length&&this._selectionMap.has(e)){let n=[];t.deletedFeatures.forEach(({error:e,objectId:t})=>{t!=null&&e==null&&n.push(t)}),this.remove(e,n)}}_onGraphicsLayerEdit(e,t){let{removed:n}=t;n.length&&this._selectionMap.has(e)&&this.remove(e,n)}_onParentLayerEdit(e,t){let{deletedFeatures:n,edits:r,updatedFeatures:i}=t;if(r?.updateFeatures?.forEach(t=>{let n=t.getObjectId()??t.attributes[e.objectIdField];if(n==null||i.find(e=>e.objectId===n)?.error)return;let r=e.findSublayerForFeature(t);if(!I(r))return;let a=e.sublayers.find(e=>!!(I(e)&&this.getSelection(e)?.includes(n)));I(a)&&a!==r&&(this.remove(a,[n]),this.add(r,[n]))}),n.length){let t=[];n.forEach(({error:e,objectId:n})=>{n!=null&&e==null&&t.push(n)}),e.sublayers.forEach(e=>{I(e)&&this._selectionMap.has(e)&&this.remove(e,t)})}}_setSelection(e,t){if(!this.sources.includes(e))throw Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);let r=this._selectionMap.get(e);if(!r||!W(r,{selection:t})){r&&this._trashCan.push(r),this._selectionMap.set(e,{selection:[...t]});let i=r?n(r.selection,t):{};this._onSelectionChange([{layer:e,selection:[...t],...i}])}}};e([v()],H.prototype,`_layerEditHandles`,void 0),e([v()],H.prototype,`_selectionMap`,void 0),e([v()],H.prototype,`_sources`,void 0),e([v()],H.prototype,`_updatingHandles`,void 0),e([v({readOnly:!0,nonNullable:!0})],H.prototype,`count`,null),e([v({readOnly:!0,nonNullable:!0})],H.prototype,`hasSelection`,null),e([v()],H.prototype,`highlightEnabled`,void 0),e([v()],H.prototype,`highlightName`,void 0),e([v()],H.prototype,`layerViewMap`,void 0),e([v({readOnly:!0,nonNullable:!0})],H.prototype,`selections`,null),e([v()],H.prototype,`showHighlight`,null),e([v()],H.prototype,`sources`,null),e([v()],H.prototype,`updating`,null),e([v()],H.prototype,`view`,void 0),H=e([y(`esri.views.SelectionManager`)],H);const U=(e,t)=>{if(P(e)&&M(t)){let e=t.getObjectId();if(e!=null)return e}return t},W=(e,t)=>{if(e==null&&t==null)return!0;if(e!=null&&t==null||e==null&&t!=null)return!1;if(e!=null&&t!=null&&e.selection!=null&&t.selection!=null){let n=[...e.selection],r=[...t.selection];if(n.length!==r.length)return!1;n.sort(),r.sort();for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1}return!0},G=async(e,t,n={})=>e.queryFeatures(new j({...n,objectIds:t})).then(t=>({data:t,layer:L(e)?e.layer:e})),K=H;export{K as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import"../../core/has.js";import n from"../../core/Logger.js";import r from"../../core/Queue.js";import{createScreenPoint as i}from"../../core/screenUtils.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{primaryKey as s,isSystemModifier as c}from"./keys.js";import{LatestPen as l}from"./handlers/LatestPen.js";import{LatestPointer as u}from"./handlers/LatestPointer.js";import{MultiTouch as d}from"./handlers/MultiTouch.js";import{PropertiesPool as f}from"../support/PropertiesPool.js";class p{constructor(){this.id=0,this.type=`mouse`,this.location=i()}}class m{constructor(){this.tiltX=0,this.tiltY=0}}let h=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=s,this._propertiesPool=new f({latestPointerInfo:()=>new p,latestPenInfo:()=>new m},this),this._latestPointerInfo=void 0,this._latestPenInfo=void 0,this._paused=!1,this._testTimestamp=void 0}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this.eventSource.onKeyModifierReceived=this._updateKeyModifiers.bind(this),this._installRecognizers()}destroy(){let e=Object.keys(this._nameToGroup);for(let t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some(e=>e.handler.hasPendingInputs)}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get latestPointerInfo(){return this._latestPointerInfo}get latestPenInfo(){return this._latestPenInfo}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,n=_.INTERNAL){if(this._nameToGroup[e]||t.length===0)return;let r={name:e,handlers:t.map(e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:n,eventCallback:null,uninstallCallback:null}))};this._nameToGroup[e]=r;for(let e=r.handlers.length-1;e>=0;e--){let t=r.handlers[e];this._handlers.push(t),t.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(e,n,r,i,a)=>{this._emitInputEvent(t.priorityIndex+1,e,n,r,a,i)},setPointerCapture:(e,n)=>{this._setPointerCapture(r,t,e,n)},setEventCallback:e=>{t.eventCallback=e},setUninstallCallback:e=>{t.uninstallCallback=e},refreshHasPendingInputs:()=>{this.notifyChange(`hasPendingInputs`)}})}this.updateDependencies()}uninstallHandlers(e){let t=this._nameToGroup[e];t?(t.handlers.forEach(e=>{e.removed=!0,e.uninstallCallback?.()}),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):n.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return this._nameToGroup[e]!==void 0}isModifierKeyDown(e){return this._activeKeyModifiers.has(e)}updateDependencies(){if(this._currentPropagation){this._updateDependenciesAfterPropagation=!0;return}this._updateDependenciesAfterPropagation=!1;let e=new Set,t=new Set;this._handlersPriority=[];for(let e=this._handlers.length-1;e>=0;e--){let t=this._handlers[e];t.priorityIndex=e,this._handlersPriority.push(t)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let n=this._handlersPriority.length-1;n>=0;n--){let r=this._handlersPriority[n];r.priorityIndex=n;let i=r.handler.hasSideEffects;if(!i){for(let t of r.handler.outgoingEventTypes)if(e.has(t)){i=!0;break}}if(i)for(let n of r.handler.incomingEventMatches){e.add(n.eventType);for(let e of n.keyModifiers)c(e)||t.add(e)}r.active=i}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add(`pointer-capture-lost`),this._keyModifiers.size>0&&(this._sourceEvents.add(`key-down`),this._sourceEvents.add(`key-up`)),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents,this.eventSource.modifierKeys=this._keyModifiers)}_setLatestPointer(e,t,n,r){let i=this._latestPointerInfo;if(i==null||i.id!==e||i.type!==t||i.location.x!==n||i.location.y!==r){let i=this._propertiesPool.get(`latestPointerInfo`);i.id=e,i.type=t,i.location.x=n,i.location.y=r,this._latestPointerInfo=i}}_setLatestPen(e,t){let n=this._latestPenInfo,r=n!=null&&e===0&&t===0,i=r?n?.tiltX:e,a=r?n?.tiltY:t;if(i==null||a==null)n!=null&&(this._latestPenInfo=void 0);else if(n==null||n.tiltX!==i||n.tiltY!==a){let e=this._propertiesPool.get(`latestPenInfo`);e.tiltX=i,e.tiltY=a,this._latestPenInfo=e}}_onEventReceived(e,t){if(e===`pointer-capture-lost`){let e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);let n=this._testTimestamp??t.native?.timestamp,r=t.native?.cancelable;this._emitInputEventFromSource(e,t,n,r)}_updateKeyModifiers(e,t){if(!t)return;let n=!1,r=()=>{n||=(this._activeKeyModifiers=new Set(this._activeKeyModifiers),!0)},i=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(r(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(r(),this._activeKeyModifiers.delete(e))};if(e===`key-down`||e===`key-up`){let n=t.key;this._keyModifiers.has(n)&&i(n,e===`key-down`)}let a=t.native;i(`Alt`,!!a?.altKey),i(`Control`,!!a?.ctrlKey),i(`Ctrl`,!!a?.ctrlKey),i(`Shift`,!!a?.shiftKey),i(`Meta`,!!a?.metaKey),i(`Primary`,this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new u((e,t,n,r)=>this._setLatestPointer(e,t,n,r)),this._latestPenHandler=new l((e,t)=>this._setLatestPen(e,t)),this._multiTouchHandler=new d,this.installHandlers(`input-manager-logic`,[this._latestPointerHandler,this._latestPenHandler,this._multiTouchHandler],_.ALWAYS),this.recognizers.length>0&&this.installHandlers(`default`,this.recognizers,_.INTERNAL)}_setPointerCapture(e,t,n,r){let i=e.name+`-`+t.priorityIndex,a=this._pointerCaptures.get(n.pointerId)||new Set;this._pointerCaptures.set(n.pointerId,a),r?(a.add(i),a.size===1&&this.eventSource&&this.eventSource.setPointerCapture(n,!0)):a.has(i)&&(a.delete(i),a.size===0&&(this._pointerCaptures.delete(n.pointerId),this.eventSource&&this.eventSource.setPointerCapture(n,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter(e=>!e.removed),this.updateDependencies()}_emitInputEventFromSource(e,t,n,r){this._emitInputEvent(0,e,t,n,r)}_emitInputEvent(e,t,n,r,i,a){let o=r??this._currentPropagation?.timestamp??performance.now(),s=i??!1,c={event:new g(t,n,o,a||this._activeKeyModifiers,s),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(c):this._doNewPropagation(c)}_doNewPropagation(e){this._currentPropagation={events:new r,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;let e=this._currentPropagation;if(e){for(;e.events.length>0;){let{event:t,priorityIndex:n}=e.events.pop(),r=t.data?.eventId;if(!(r!=null&&this._stoppedPropagationEventIds.has(r)))for(e.currentHandler=this._handlersPriority[n];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){r!=null&&this._stoppedPropagationEventIds.add(r);break}if(t.shouldPausePropagation(()=>this._continuePropagation())){this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1});return}}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){let t=new r;t.push(e);let n=this._currentPropagation;if(n){for(;n.events.length;)t.push(n.events.pop());n.events=t,n.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(let n of e.handler.incomingEventMatches)for(let e of t.handler.incomingEventMatches){if(n.eventType!==e.eventType)continue;let t=n.keyModifiers.filter(t=>e.keyModifiers.includes(t));if(t.length===n.keyModifiers.length!=(t.length===e.keyModifiers.length))return n.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){let t=[];for(let n of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(n,t[e])>=0;)e++;t.splice(e,0,n)}return t}get test(){}};e([a({readOnly:!0})],h.prototype,`hasPendingInputs`,null),e([a({constructOnly:!0})],h.prototype,`eventSource`,void 0),e([a({constructOnly:!0})],h.prototype,`recognizers`,void 0),e([a()],h.prototype,`multiTouchActive`,null),e([a()],h.prototype,`_latestPointerInfo`,void 0),e([a()],h.prototype,`latestPointerInfo`,null),e([a()],h.prototype,`_latestPenInfo`,void 0),e([a()],h.prototype,`latestPenInfo`,null),e([a()],h.prototype,`_paused`,void 0),e([a({readOnly:!0})],h.prototype,`updating`,null),h=e([o(`esri.views.input.InputManager`)],h);class g{constructor(e,t,n,r,i){this.type=e,this.data=t,this.timestamp=n,this.modifiers=r,this.cancelable=i,this._propagationState=0,this._resumeCallback=null}stopPropagation(){this._propagationState|=1}shouldStopPropagation(){return!!(this._propagationState&1)}defer(e){this._propagationState|=2;let t=(e,t)=>{this._propagationState&=-3;let n=this._resumeCallback;if(this._resumeCallback=null,n&&n(),t)throw e;return e};return(typeof e==`function`?e():e).then(e=>t(e,!1),e=>t(e,!0))}shouldPausePropagation(e){return this._propagationState&2?(this._resumeCallback=e,!0):!1}preventDefault(){this.data.native.preventDefault()}}const _={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};export{h as InputManager,m as LatestPenInfo,p as LatestPointerInfo,_ as ViewEventPriorities};
2
+ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import"../../core/has.js";import n from"../../core/Logger.js";import r from"../../core/Queue.js";import{createScreenPoint as i}from"../../core/screenUtils.js";import{property as a,subclass as o}from"../../core/accessorSupport/decorators.js";import{primaryKey as s,isSystemModifier as c}from"./keys.js";import{LatestPen as l}from"./handlers/LatestPen.js";import{LatestPointer as u}from"./handlers/LatestPointer.js";import{MultiTouch as d}from"./handlers/MultiTouch.js";import{PropertiesPool as f}from"../support/PropertiesPool.js";class p{constructor(){this.id=0,this.type=`mouse`,this.location=i()}}class m{constructor(){this.tiltX=0,this.tiltY=0}}let h=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=s,this._propertiesPool=new f({latestPointerInfo:()=>new p,latestPenInfo:()=>new m},this),this._latestPointerInfo=void 0,this._latestPenInfo=void 0,this._paused=!1,this._testTimestamp=void 0}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this.eventSource.onKeyModifierReceived=this._updateKeyModifiers.bind(this),this._installRecognizers()}destroy(){let e=Object.keys(this._nameToGroup);for(let t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some(e=>e.handler.hasPendingInputs)}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get latestPointerInfo(){return this._latestPointerInfo}get latestPenInfo(){return this._latestPenInfo}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,t,n=_.INTERNAL){if(this._nameToGroup[e]||t.length===0)return;let r={name:e,handlers:t.map(e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:n,eventCallback:null,uninstallCallback:null}))};this._nameToGroup[e]=r;for(let e=r.handlers.length-1;e>=0;e--){let t=r.handlers[e];this._handlers.push(t),t.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(e,n,r,i,a)=>{this._emitInputEvent(t.priorityIndex+1,e,n,r,a,i)},setPointerCapture:(e,n)=>{this._setPointerCapture(r,t,e,n)},setEventCallback:e=>{t.eventCallback=e},setUninstallCallback:e=>{t.uninstallCallback=e},refreshHasPendingInputs:()=>{this.notifyChange(`hasPendingInputs`)}})}this.updateDependencies()}uninstallHandlers(e){let t=this._nameToGroup[e];t?(t.handlers.forEach(e=>{e.removed=!0,e.uninstallCallback?.()}),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):n.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return this._nameToGroup[e]!==void 0}isModifierKeyDown(e){return this._activeKeyModifiers.has(e)}updateDependencies(){if(this._currentPropagation){this._updateDependenciesAfterPropagation=!0;return}this._updateDependenciesAfterPropagation=!1;let e=new Set,t=new Set;this._handlersPriority=[];for(let e=this._handlers.length-1;e>=0;e--){let t=this._handlers[e];t.priorityIndex=e,this._handlersPriority.push(t)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let n=this._handlersPriority.length-1;n>=0;n--){let r=this._handlersPriority[n];r.priorityIndex=n;let i=r.handler.hasSideEffects;if(!i){for(let t of r.handler.outgoingEventTypes)if(e.has(t)){i=!0;break}}if(i)for(let n of r.handler.incomingEventMatches){e.add(n.eventType);for(let e of n.keyModifiers)c(e)||t.add(e)}r.active=i}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add(`pointer-capture-lost`),this._keyModifiers.size>0&&(this._sourceEvents.add(`key-down`),this._sourceEvents.add(`key-up`)),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents,this.eventSource.modifierKeys=this._keyModifiers)}_setLatestPointer(e,t,n,r){let i=this._latestPointerInfo;if(i==null||i.id!==e||i.type!==t||i.location.x!==n||i.location.y!==r){let i=this._propertiesPool.get(`latestPointerInfo`);i.id=e,i.type=t,i.location.x=n,i.location.y=r,this._latestPointerInfo=i}}_setLatestPen(e,t){let n=this._latestPenInfo,r=n!=null&&e===0&&t===0,i=r?n?.tiltX:e,a=r?n?.tiltY:t;if(i==null||a==null)n!=null&&(this._latestPenInfo=void 0);else if(n==null||n.tiltX!==i||n.tiltY!==a){let e=this._propertiesPool.get(`latestPenInfo`);e.tiltX=i,e.tiltY=a,this._latestPenInfo=e}}_onEventReceived(e,t){if(e===`pointer-capture-lost`){let e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);let n=`native`in t?t.native:void 0,r=this._testTimestamp??n?.timeStamp,i=n?.cancelable;this._emitInputEventFromSource(e,t,r,i)}_updateKeyModifiers(e,t){if(!t)return;let n=!1,r=()=>{n||=(this._activeKeyModifiers=new Set(this._activeKeyModifiers),!0)},i=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(r(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(r(),this._activeKeyModifiers.delete(e))};if(e===`key-down`||e===`key-up`){let n=t.key;this._keyModifiers.has(n)&&i(n,e===`key-down`)}let a=t.native;i(`Alt`,!!a?.altKey),i(`Control`,!!a?.ctrlKey),i(`Ctrl`,!!a?.ctrlKey),i(`Shift`,!!a?.shiftKey),i(`Meta`,!!a?.metaKey),i(`Primary`,this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new u((e,t,n,r)=>this._setLatestPointer(e,t,n,r)),this._latestPenHandler=new l((e,t)=>this._setLatestPen(e,t)),this._multiTouchHandler=new d,this.installHandlers(`input-manager-logic`,[this._latestPointerHandler,this._latestPenHandler,this._multiTouchHandler],_.ALWAYS),this.recognizers.length>0&&this.installHandlers(`default`,this.recognizers,_.INTERNAL)}_setPointerCapture(e,t,n,r){let i=e.name+`-`+t.priorityIndex,a=this._pointerCaptures.get(n.pointerId)||new Set;this._pointerCaptures.set(n.pointerId,a),r?(a.add(i),a.size===1&&this.eventSource&&this.eventSource.setPointerCapture(n,!0)):a.has(i)&&(a.delete(i),a.size===0&&(this._pointerCaptures.delete(n.pointerId),this.eventSource&&this.eventSource.setPointerCapture(n,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter(e=>!e.removed),this.updateDependencies()}_emitInputEventFromSource(e,t,n,r){this._emitInputEvent(0,e,t,n,r)}_emitInputEvent(e,t,n,r,i,a){let o=r??this._currentPropagation?.timestamp??performance.now(),s=i??!1,c={event:new g(t,n,o,a||this._activeKeyModifiers,s),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(c):this._doNewPropagation(c)}_doNewPropagation(e){this._currentPropagation={events:new r,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){this._paused=!1;let e=this._currentPropagation;if(e){for(;e.events.length>0;){let{event:t,priorityIndex:n}=e.events.pop(),r=t.data?.eventId;if(!(r!=null&&this._stoppedPropagationEventIds.has(r)))for(e.currentHandler=this._handlersPriority[n];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback?.(t),t.shouldStopPropagation()){r!=null&&this._stoppedPropagationEventIds.add(r);break}if(t.shouldPausePropagation(()=>this._continuePropagation())){this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1});return}}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){let t=new r;t.push(e);let n=this._currentPropagation;if(n){for(;n.events.length;)t.push(n.events.pop());n.events=t,n.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(let n of e.handler.incomingEventMatches)for(let e of t.handler.incomingEventMatches){if(n.eventType!==e.eventType)continue;let t=n.keyModifiers.filter(t=>e.keyModifiers.includes(t));if(t.length===n.keyModifiers.length!=(t.length===e.keyModifiers.length))return n.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){let t=[];for(let n of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(n,t[e])>=0;)e++;t.splice(e,0,n)}return t}get test(){}};e([a({readOnly:!0})],h.prototype,`hasPendingInputs`,null),e([a({constructOnly:!0})],h.prototype,`eventSource`,void 0),e([a({constructOnly:!0})],h.prototype,`recognizers`,void 0),e([a()],h.prototype,`multiTouchActive`,null),e([a()],h.prototype,`_latestPointerInfo`,void 0),e([a()],h.prototype,`latestPointerInfo`,null),e([a()],h.prototype,`_latestPenInfo`,void 0),e([a()],h.prototype,`latestPenInfo`,null),e([a()],h.prototype,`_paused`,void 0),e([a({readOnly:!0})],h.prototype,`updating`,null),h=e([o(`esri.views.input.InputManager`)],h);class g{constructor(e,t,n,r,i){this.type=e,this.data=t,this.timestamp=n,this.modifiers=r,this.cancelable=i,this._propagationState=0,this._resumeCallback=null}stopPropagation(){this._propagationState|=1}shouldStopPropagation(){return!!(this._propagationState&1)}defer(e){this._propagationState|=2;let t=(e,t)=>{this._propagationState&=-3;let n=this._resumeCallback;if(this._resumeCallback=null,n&&n(),t)throw e;return e};return(typeof e==`function`?e():e).then(e=>t(e,!1),e=>t(e,!0))}shouldPausePropagation(e){return this._propagationState&2?(this._resumeCallback=e,!0):!1}preventDefault(){this.data.native.preventDefault()}}const _={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};export{h as InputManager,m as LatestPenInfo,p as LatestPointerInfo,_ as ViewEventPriorities};
@@ -0,0 +1,16 @@
1
+ import type WMTSLayer from "../../layers/WMTSLayer.js";
2
+ import type LayerView from "./LayerView.js";
3
+
4
+ /**
5
+ * Represents the [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) of a [WMTSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMTSLayer/)
6
+ * after it has been added to a [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) in either a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/), [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) or [LinkChartView](https://developers.arcgis.com/javascript/latest/references/core/views/LinkChartView/).
7
+ *
8
+ * The WMTSLayerView is responsible for rendering a [WMTSLayer's](https://developers.arcgis.com/javascript/latest/references/core/layers/WMTSLayer/) tiles in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/).
9
+ *
10
+ * @since 6.0
11
+ * @see [WMTSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMTSLayer/)
12
+ */
13
+ export default abstract class WMTSLayerView extends LayerView {
14
+ /** The layer being viewed. */
15
+ get layer(): WMTSLayer;
16
+ }
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import n from"./LayerView.js";let r=class extends n{constructor(){super(...arguments),this.layer=null}async updateLayer(){this.layer.updateFrom(this)}};r=e([t(`esri.views.layers.WMTSLayerView`)],r);export{r as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Collection.js";import{isGraphic as n}from"../../../support/graphicInstanceUtils.js";function r(r){if(!r)return[];let i=n(r)?[r]:t.isCollection(r)?r.toArray():Array.isArray(r)?r:[];return i=i?.filter(e),(i?.length??0)===0?[]:i}function i(e){return!!(e&&typeof e==`object`&&`pixelRanges`in e&&e.pixelRanges)}function a(e){return Array.isArray(e.pixelRanges)&&e.pixelRanges.length===0}export{r as getHighlightGraphics,a as isEmptyPixelRanges,i as isPixelHighlightTarget};
2
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Collection.js";import{isGraphic as n}from"../../../support/graphicInstanceUtils.js";function r(r){if(!r)return[];let i=n(r)?[r]:t.isCollection(r)?r.toArray():Array.isArray(r)?r:[];return i=i?.filter(e),(i?.length??0)===0?[]:i}function i(e){return!!(e&&typeof e==`object`&&`pixelRanges`in e&&e.pixelRanges)}function a(e){return Array.isArray(e.pixelRanges)&&e.pixelRanges.length===0}function o(e){return typeof e==`object`&&!!e&&`highlight`in e&&typeof e.highlight==`function`}export{r as getHighlightGraphics,a as isEmptyPixelRanges,o as isHighlightableLayerView,i as isPixelHighlightTarget};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import{EventedAccessor as r}from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{debounce as s,onAbort as c,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import u from"../../core/ReactiveMap.js";import{on as d}from"../../core/reactiveUtils.js";import{createScreenPoint as f}from"../../core/screenUtils.js";import{property as p,subclass as m}from"../../core/accessorSupport/decorators.js";import h from"../../geometry/Point.js";import g from"../../geometry/Polygon.js";import{isClockwise as _}from"../../geometry/support/coordsUtils.js";import{sketchKeys as v,selectionKeys as y}from"../interactive/keybindings.js";import{getSelectionFromGeometry as b}from"../../widgets/support/Selector2D/selectorUtils.js";import{getSelectionFromScreenSelector as x}from"../../widgets/support/Selector3D/selectorUtils.js";let S=class extends r{constructor(e){super(e),this._completed=!1,this._isConstraintKeyDown=!1,this._processTask=null,this.createTool=`rectangle`,this.effectiveSourceMap=new u,this.mode=null,this.persistSelection=!0,this.returnFeatureTitleFields=!1,this.returnGeometry=!0,this.selection=new n,this.selectionManager=null,this.selectOnComplete=!0,this.sources=null,this.toolName=``,this.type=`add`,this._process=s(async(e,n)=>{let{callback:r,completed:i}=e,a=t(async t=>{let{effectiveSelectionManager:n,effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selection:c,sources:l,view:u}=this;if(!l?.length&&!n.sources.length||!u){c.removeAll();return}let d=u.type===`3d`&&`screenSelector`in e&&e.screenSelector&&l!=null?await x({selector:e.screenSelector,signal:t,sources:l,view:u}):`selector`in e&&e.selector&&l!=null?await b({effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selector:e.selector,signal:t,sources:l,view:u}):[];if(c.removeAll(),c.addMany(d),i&&this.persistSelection)switch(this.effectiveType){case`remove`:n.updateSelection({current:[],added:[],removed:d});break;case`replace`:n.clear(),n.updateSelection({current:d,added:[],removed:[]});break;default:n.updateSelection({current:d,added:[],removed:[]})}r?.()});return c(n,()=>a.abort()),this._processTask=a,a.promise},C),this._onOperationFinish=this._onOperationFinish.bind(this)}async initialize(){await this._setup()}get _defaultMode(){return this.createTool===`polygon`?`click`:`hybrid`}get _selectionArea(){let e=this._tool.coordinates;if(e.length===0)return;let t=f(),n=this.view.spatialReference,r=e=>{t.x=e[0],t.y=e[1];let n=this.view.toMap(t);return[n?.x??0,n?.y??0]};if(e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])){let[t,i]=r(e[0]);return new h({x:t,y:i,spatialReference:n})}let i=e.map(r);return i.length===0?void 0:(_(i)||i.reverse(),new g({spatialReference:n,rings:[i]}))}get _screenSelector(){let e=this._tool.coordinates;if(e.length===0)return;let t=e=>f(e[0],e[1]);return e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])?t(e[0]):e.map(t)}get completed(){return this._completed}get effectiveSelectionManager(){return this.selectionManager??this.view.selectionManager}get effectiveType(){let e=this.type??`add`;if(this._isConstraintKeyDown)switch(e){case`add`:return`remove`;case`remove`:return`add`;case`replace`:return`add`;default:return e}return e}get processingFinalSelection(){return!!(this._processTask&&this._tool?.drawOperation?.isCompleted)}cancel(){this.selection.removeAll(),this._onOperationFinish(!0)}destroy(){this._toolImportController=o(this._toolImportController)}async _setup(){let{createTool:e,view:t}=this;if(await t.whenReady(),this.destroyed||this._toolImportController)return;let n=new AbortController;this._toolImportController=n;let r=await import(`../draw/DrawScreenTool.js`);if(n.signal.aborted)return;let o=Symbol();try{this._tool=new r.DrawScreenTool({view:t,mode:this.mode??this._defaultMode,geometryType:e,cursor:e===`point`?`default`:`crosshair`})}finally{this._toolImportController=null}this._tool?(this.selectOnComplete||this.addHandles(this._tool.on([`cursor-update`,`vertex-add`,`vertex-remove`],()=>{this._syncConstraintKeyDown(),l(this._process(this._selectionProcessParams))}),o),this._syncConstraintKeyDown(),this.addHandles([d(()=>t,`key-down`,e=>{if(!e.repeat)switch(this._syncConstraintKeyDown(),e.key){case v.constraint:this._tool.uniformSizeToggled=!0,e.stopPropagation();break;case v.center:this._tool.centeredToggled=!0,e.stopPropagation()}}),d(()=>t,`key-up`,e=>{switch(this._syncConstraintKeyDown(),e.key){case v.constraint:this._tool.uniformSizeToggled=!1,e.stopPropagation();break;case v.center:this._tool.centeredToggled=!1,e.stopPropagation()}}),this.selection.on(`change`,({added:e,removed:t})=>this.emit(`selection-change`,{operationType:this.effectiveType,added:e,removed:t})),this._tool.on(`complete`,async e=>{this._syncConstraintKeyDown(),this.removeHandles(o),e.aborted?this.cancel():(this._tool.cursor=`progress`,await this._process({...this._selectionProcessParams,callback:this._onOperationFinish,completed:!0}))})],o),this.addHandles(i(()=>t.tools.remove(this._tool))),t.addAndActivateTool(this._tool)):a.getLogger(this).warn(`Unable to import Draw module. SelectionOperation failed to load.`)}_syncConstraintKeyDown(){let{inputManager:e}=this.view;this._isConstraintKeyDown=y.invertType.some(t=>e.isModifierKeyDown(t))}get _selectionProcessParams(){return this.view.type===`3d`?{screenSelector:this._screenSelector}:{selector:this._selectionArea}}_onOperationFinish(e=!1){this.removeAllHandles(),this._processTask?.abort(),this._completed=!0,this.emit(`complete`,{aborted:e,operationType:this.effectiveType,selection:this.selection.toArray(),toolName:this.toolName})}};e([p()],S.prototype,`_completed`,void 0),e([p()],S.prototype,`_defaultMode`,null),e([p()],S.prototype,`_isConstraintKeyDown`,void 0),e([p()],S.prototype,`_processTask`,void 0),e([p()],S.prototype,`_selectionArea`,null),e([p()],S.prototype,`_screenSelector`,null),e([p()],S.prototype,`completed`,null),e([p({constructOnly:!0})],S.prototype,`createTool`,void 0),e([p()],S.prototype,`effectiveSelectionManager`,null),e([p()],S.prototype,`effectiveSourceMap`,void 0),e([p()],S.prototype,`effectiveType`,null),e([p({constructOnly:!0})],S.prototype,`mode`,void 0),e([p()],S.prototype,`persistSelection`,void 0),e([p()],S.prototype,`processingFinalSelection`,null),e([p()],S.prototype,`returnFeatureTitleFields`,void 0),e([p()],S.prototype,`returnGeometry`,void 0),e([p({readOnly:!0})],S.prototype,`selection`,void 0),e([p({constructOnly:!0})],S.prototype,`selectionManager`,void 0),e([p({constructOnly:!0})],S.prototype,`selectOnComplete`,void 0),e([p()],S.prototype,`sources`,void 0),e([p({constructOnly:!0})],S.prototype,`toolName`,void 0),e([p()],S.prototype,`type`,void 0),e([p({constructOnly:!0})],S.prototype,`view`,void 0),S=e([m(`esri.views.selection.SelectionOperation`)],S);const C=100,w=S;export{w as default};
2
+ import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import{EventedAccessor as r}from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import{isLoadable as a}from"../../core/Loadable.js";import o from"../../core/Logger.js";import{abortMaybe as s}from"../../core/maybe.js";import{debounce as c,onAbort as l,ignoreAbortErrors as u}from"../../core/promiseUtils.js";import d from"../../core/ReactiveMap.js";import{on as f}from"../../core/reactiveUtils.js";import{createScreenPoint as p}from"../../core/screenUtils.js";import{property as m,subclass as h}from"../../core/accessorSupport/decorators.js";import g from"../../geometry/Point.js";import _ from"../../geometry/Polygon.js";import{isClockwise as v}from"../../geometry/support/coordsUtils.js";import{sketchKeys as y,selectionKeys as b}from"../interactive/keybindings.js";import{getSelectionFromGeometry as x}from"../../widgets/support/Selector2D/selectorUtils.js";import{getSelectionFromScreenSelector as S}from"../../widgets/support/Selector3D/selectorUtils.js";let C=class extends r{constructor(e){super(e),this._completed=!1,this._isConstraintKeyDown=!1,this._processTask=null,this.createTool=`rectangle`,this.effectiveSourceMap=new d,this.mode=null,this.persistSelection=!0,this.returnFeatureTitleFields=!1,this.returnGeometry=!0,this.selection=new n,this.selectionManager=null,this.selectOnComplete=!0,this.sources=null,this.toolName=``,this.type=`add`,this._process=c(async(e,n)=>{let{callback:r,completed:i}=e,a=t(async t=>{let{effectiveSelectionManager:n,effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selection:c,sources:l,view:u}=this;if(!l?.length&&!n.sources.length||!u){c.removeAll();return}let d=u.type===`3d`&&`screenSelector`in e&&e.screenSelector&&l!=null?await S({selector:e.screenSelector,signal:t,sources:l,view:u}):`selector`in e&&e.selector&&l!=null?await x({effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selector:e.selector,signal:t,sources:l,view:u}):[];if(c.removeAll(),c.addMany(d),i&&this.persistSelection)switch(this.effectiveType){case`remove`:n.updateSelection({current:[],added:[],removed:d});break;case`replace`:n.clear(),n.updateSelection({current:d,added:[],removed:[]});break;default:n.updateSelection({current:d,added:[],removed:[]})}r?.()});return l(n,()=>a.abort()),this._processTask=a,a.promise},w),this._onOperationFinish=this._onOperationFinish.bind(this)}async initialize(){await this._setup()}get _defaultMode(){return this.createTool===`polygon`?`click`:`hybrid`}get _selectionArea(){let e=this._tool.coordinates;if(e.length===0)return;let t=p(),n=this.view.spatialReference,r=e=>{t.x=e[0],t.y=e[1];let n=this.view.toMap(t);return[n?.x??0,n?.y??0]};if(e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])){let[t,i]=r(e[0]);return new g({x:t,y:i,spatialReference:n})}let i=e.map(r);return i.length===0?void 0:(v(i)||i.reverse(),new _({spatialReference:n,rings:[i]}))}get _screenSelector(){let e=this._tool.coordinates;if(e.length===0)return;let t=e=>p(e[0],e[1]);return e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])?t(e[0]):e.map(t)}get completed(){return this._completed}get effectiveSelectionManager(){return this.selectionManager??this.view.selectionManager}get effectiveType(){let e=this.type??`add`;if(this._isConstraintKeyDown)switch(e){case`add`:return`remove`;case`remove`:return`add`;case`replace`:return`add`;default:return e}return e}get processingFinalSelection(){return!!(this._processTask&&this._tool?.drawOperation?.isCompleted)}cancel(){this.selection.removeAll(),this._onOperationFinish(!0)}destroy(){this._toolImportController=s(this._toolImportController)}async _setup(){let{createTool:e,view:t}=this;if(await t.whenReady(),this.destroyed||this._toolImportController)return;let n=new AbortController;this._toolImportController=n;let r=await import(`../draw/DrawScreenTool.js`);if(n.signal.aborted)return;let s=Symbol();try{await Promise.all(this.sources?.map(e=>a(e)&&e.load())??[]),this._tool=new r.DrawScreenTool({view:t,mode:this.mode??this._defaultMode,geometryType:e,cursor:e===`point`?`default`:`crosshair`})}finally{this._toolImportController=null}this._tool?(this.selectOnComplete||this.addHandles(this._tool.on([`cursor-update`,`vertex-add`,`vertex-remove`],()=>{this._syncConstraintKeyDown(),u(this._process(this._selectionProcessParams))}),s),this._syncConstraintKeyDown(),this.addHandles([f(()=>t,`key-down`,e=>{if(!e.repeat)switch(this._syncConstraintKeyDown(),e.key){case y.constraint:this._tool.uniformSizeToggled=!0,e.stopPropagation();break;case y.center:this._tool.centeredToggled=!0,e.stopPropagation()}}),f(()=>t,`key-up`,e=>{switch(this._syncConstraintKeyDown(),e.key){case y.constraint:this._tool.uniformSizeToggled=!1,e.stopPropagation();break;case y.center:this._tool.centeredToggled=!1,e.stopPropagation()}}),this.selection.on(`change`,({added:e,removed:t})=>this.emit(`selection-change`,{operationType:this.effectiveType,added:e,removed:t})),this._tool.on(`complete`,async e=>{this._syncConstraintKeyDown(),this.removeHandles(s),e.aborted?this.cancel():(this._tool.cursor=`progress`,await this._process({...this._selectionProcessParams,callback:this._onOperationFinish,completed:!0}))})],s),this.addHandles(i(()=>t.tools.remove(this._tool))),t.addAndActivateTool(this._tool)):o.getLogger(this).warn(`Unable to import Draw module. SelectionOperation failed to load.`)}_syncConstraintKeyDown(){let{inputManager:e}=this.view;this._isConstraintKeyDown=b.invertType.some(t=>e.isModifierKeyDown(t))}get _selectionProcessParams(){return this.view.type===`3d`?{screenSelector:this._screenSelector}:{selector:this._selectionArea}}_onOperationFinish(e=!1){this.removeAllHandles(),this._processTask?.abort(),this._completed=!0,this.emit(`complete`,{aborted:e,operationType:this.effectiveType,selection:this.selection.toArray(),toolName:this.toolName})}};e([m()],C.prototype,`_completed`,void 0),e([m()],C.prototype,`_defaultMode`,null),e([m()],C.prototype,`_isConstraintKeyDown`,void 0),e([m()],C.prototype,`_processTask`,void 0),e([m()],C.prototype,`_selectionArea`,null),e([m()],C.prototype,`_screenSelector`,null),e([m()],C.prototype,`completed`,null),e([m({constructOnly:!0})],C.prototype,`createTool`,void 0),e([m()],C.prototype,`effectiveSelectionManager`,null),e([m()],C.prototype,`effectiveSourceMap`,void 0),e([m()],C.prototype,`effectiveType`,null),e([m({constructOnly:!0})],C.prototype,`mode`,void 0),e([m()],C.prototype,`persistSelection`,void 0),e([m()],C.prototype,`processingFinalSelection`,null),e([m()],C.prototype,`returnFeatureTitleFields`,void 0),e([m()],C.prototype,`returnGeometry`,void 0),e([m({readOnly:!0})],C.prototype,`selection`,void 0),e([m({constructOnly:!0})],C.prototype,`selectionManager`,void 0),e([m({constructOnly:!0})],C.prototype,`selectOnComplete`,void 0),e([m()],C.prototype,`sources`,void 0),e([m({constructOnly:!0})],C.prototype,`toolName`,void 0),e([m()],C.prototype,`type`,void 0),e([m({constructOnly:!0})],C.prototype,`view`,void 0),C=e([h(`esri.views.selection.SelectionOperation`)],C);const w=100,T=C;export{T as default};