@arcgis/core 5.1.0-next.135 → 5.1.0-next.137

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 (209) hide show
  1. package/Graphic.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/144f103b789e1657bad6.js +2 -0
  4. package/assets/esri/core/workers/chunks/1a4bec464daa9662ab2a.js +1 -0
  5. package/assets/esri/core/workers/chunks/1b4e64cb23212229f982.js +1 -0
  6. package/assets/esri/core/workers/chunks/1eef5e0b4c621af0261d.js +2 -0
  7. package/assets/esri/core/workers/chunks/22fc6de248290e7dd005.js +2 -0
  8. package/assets/esri/core/workers/chunks/292498a9c7d462d215c6.js +1 -0
  9. package/assets/esri/core/workers/chunks/3b4fc67f6cb7393fbd97.js +1 -0
  10. package/assets/esri/core/workers/chunks/4d8388370fe66307dcf2.js +1 -0
  11. package/assets/esri/core/workers/chunks/{db26cf2c2735183294b8.js → 50345dfc00380b158c96.js} +1 -1
  12. package/assets/esri/core/workers/chunks/53251094c0926d10f4e7.js +1 -0
  13. package/assets/esri/core/workers/chunks/5468a65698931603656d.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d7acbc2ddff4cee8a465.js → 5ee887fc6e1e0e70e02f.js} +1 -1
  15. package/assets/esri/core/workers/chunks/5ff6170f43119395b5f2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{7c787cd27af3cec75027.js → 634d3f7f3e1c7bc35045.js} +1 -1
  17. package/assets/esri/core/workers/chunks/69da36b217688d46b3d8.js +1 -0
  18. package/assets/esri/core/workers/chunks/6c0fc20a62f8f1921423.js +1 -0
  19. package/assets/esri/core/workers/chunks/{a2247f4c3116efb16c4f.js → 7e23de8d9b2d938808f6.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{72edd08a2ff08970ba38.js → 87011d2fe14c54e296af.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{4d43619c73721946441b.js → 8810bac7b4a98472268a.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{67ea60aef8fde61420da.js → 89c072b5e28d65093ca2.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{f64241d613f56fbcd981.js → 8d23ea08912813916b9d.js} +1 -1
  24. package/assets/esri/core/workers/chunks/928b18e13e015330d44b.js +1 -0
  25. package/assets/esri/core/workers/chunks/936cabf20c526f72d781.js +1 -0
  26. package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +1 -0
  27. package/assets/esri/core/workers/chunks/9535036f5f75b2cf0bba.js +1 -0
  28. package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +1 -0
  29. package/assets/esri/core/workers/chunks/{ae1b6a7bf46bb09d8715.js → a3870723a71513e002ae.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{4104a0585969f8cd524c.js → a40ede4d3375184f21fe.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{2c5ccda8f955e50cd941.js → a533d066cac26124c5ce.js} +1 -1
  32. package/assets/esri/core/workers/chunks/a536904fe6f3b16fdbdc.js +1 -0
  33. package/assets/esri/core/workers/chunks/a55275f861289f7a1d77.js +1 -0
  34. package/assets/esri/core/workers/chunks/a60700012465b22e7515.js +2 -0
  35. package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +1 -0
  36. package/assets/esri/core/workers/chunks/aca13a98ca4a900d2d5b.js +1 -0
  37. package/assets/esri/core/workers/chunks/{ac16016964be3b684e98.js → aded4e704e09a28edc8f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/ae105c2dd49494eed011.js +1 -0
  39. package/assets/esri/core/workers/chunks/b32d181df0959d68ca9a.js +1 -0
  40. package/assets/esri/core/workers/chunks/b7a276b028f192ab7459.js +1 -0
  41. package/assets/esri/core/workers/chunks/{0b522e05668bef729b1b.js → ceb5bd9f2afaa2ea0808.js} +1 -1
  42. package/assets/esri/core/workers/chunks/d07068c44d560e4ce02e.js +1 -0
  43. package/assets/esri/core/workers/chunks/ecd51cb0a428155ea680.js +2 -0
  44. package/assets/esri/core/workers/chunks/{5f63077ec5ba3560491b.js → fb9f8b6cc2b4ae5b60df.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{ecbf84a1f42e6188faab.js → fd629872b5c07853f695.js} +1 -1
  46. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  47. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -1
  48. package/assets/esri/themes/dark/main.css +1 -1
  49. package/assets/esri/themes/light/main.css +1 -1
  50. package/assets/esri/themes/light/view.css +1 -1
  51. package/config.js +1 -1
  52. package/core/date.js +1 -1
  53. package/form/FormTemplate.d.ts +15 -20
  54. package/form/elements/AttachmentElement.d.ts +38 -11
  55. package/form/elements/Element.d.ts +9 -6
  56. package/form/elements/FieldElement.d.ts +0 -1
  57. package/form/elements/GroupElement.d.ts +4 -6
  58. package/form/elements/RelationshipElement.d.ts +8 -8
  59. package/form/elements/inputs/attachments/AttachmentInput.d.ts +34 -18
  60. package/form/elements/inputs/attachments/AudioInput.d.ts +4 -3
  61. package/form/elements/inputs/attachments/DocumentInput.d.ts +2 -6
  62. package/form/elements/inputs/attachments/ImageInput.d.ts +4 -3
  63. package/form/elements/inputs/attachments/Input.d.ts +6 -3
  64. package/form/elements/inputs/attachments/SignatureInput.d.ts +3 -3
  65. package/form/elements/inputs/attachments/VideoInput.d.ts +4 -3
  66. package/form/elements.d.ts +6 -12
  67. package/form/types.d.ts +0 -4
  68. package/geometry/support/geometryUtils.js +1 -1
  69. package/geometry/support/intersects.js +1 -1
  70. package/geometry/support/intersectsBase.js +1 -1
  71. package/kernel.js +1 -1
  72. package/layers/AnnotationFeatureLayer.d.ts +44 -0
  73. package/layers/AnnotationFeatureLayer.js +1 -1
  74. package/layers/DimensionFeatureLayer.d.ts +40 -0
  75. package/layers/DimensionFeatureLayer.js +1 -1
  76. package/layers/DimensionLayer.d.ts +1 -0
  77. package/layers/FeatureLayer.js +1 -1
  78. package/layers/IntegratedMesh3DTilesLayer.d.ts +9 -1
  79. package/layers/OrientedImageryLayer.js +1 -1
  80. package/layers/ParquetLayer.js +1 -1
  81. package/layers/graphics/sources/ParquetSource.js +1 -1
  82. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  83. package/layers/graphics/sources/geojson/geojson.js +1 -1
  84. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  85. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +1 -1
  86. package/layers/graphics/sources/parquet/fileProviderChangedError.js +2 -0
  87. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  88. package/layers/mixins/ArcGISImageService.js +1 -1
  89. package/layers/mixins/EditBusLayer.js +1 -1
  90. package/layers/orientedImagery/core/utils.js +1 -1
  91. package/layers/support/AnnotationFeatureSublayer.d.ts +5 -3
  92. package/layers/support/RasterBandInfo.js +1 -1
  93. package/layers/support/SymbolLayerDrawing.js +1 -1
  94. package/layers/types.d.ts +1 -0
  95. package/package.json +2 -2
  96. package/rest/support/AttachmentQuery.d.ts +13 -1
  97. package/rest/support/AttachmentQuery.js +1 -1
  98. package/rest/support/OutDistance.d.ts +5 -1
  99. package/rest/support/PrintParameters.d.ts +2 -1
  100. package/rest/support/Query.d.ts +2 -0
  101. package/support/basemapUtils.js +1 -1
  102. package/support/revision.js +1 -1
  103. package/symbols/SimpleMarkerSymbol.d.ts +2 -2
  104. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  105. package/views/2d/engine/AFeatureContainer.js +1 -1
  106. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  107. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  108. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  109. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  110. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
  111. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  112. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  113. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  114. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  115. package/views/2d/layers/LayerView2D.js +1 -1
  116. package/views/2d/layers/MediaLayerView2D.js +1 -1
  117. package/views/2d/layers/features/FeatureContainer.js +1 -1
  118. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  119. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  120. package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
  121. package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
  122. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  123. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  124. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  125. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  126. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  127. package/views/2d/layers/support/annodime/cimAnnotations.js +1 -1
  128. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  129. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  130. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  131. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +4 -4
  132. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  133. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  134. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  135. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  136. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  137. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  138. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +6 -6
  139. package/views/PopupView.d.ts +3 -0
  140. package/views/View2D.d.ts +2 -2
  141. package/views/layers/AnnotationFeatureLayerView.d.ts +9 -1
  142. package/views/layers/DimensionFeatureLayerView.d.ts +9 -1
  143. package/views/layers/FeatureLikeLayerView.js +1 -1
  144. package/widgets/BasemapGallery.js +1 -1
  145. package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
  146. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  147. package/widgets/BatchAttributeForm/css.js +1 -1
  148. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  149. package/widgets/BatchAttributeForm.js +1 -1
  150. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  151. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  152. package/widgets/Editor/UpdateWorkflow.js +1 -1
  153. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  154. package/widgets/Editor/types.d.ts +12 -0
  155. package/widgets/Editor/workflowUtils.js +1 -1
  156. package/widgets/Editor.js +1 -1
  157. package/widgets/FeatureForm/FeatureFormViewModel.d.ts +16 -12
  158. package/widgets/FeatureForm.d.ts +14 -16
  159. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  160. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  161. package/widgets/FeatureTable/Grid/types.d.ts +20 -0
  162. package/widgets/FeatureTable.d.ts +14 -2
  163. package/widgets/FeatureTable.js +1 -1
  164. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  165. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  166. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  167. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  168. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  169. package/widgets/OrientedImageryViewer/constants.js +1 -1
  170. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  171. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  172. package/widgets/OrientedImageryViewer/support/panConstraint.js +2 -0
  173. package/widgets/OrientedImageryViewer.js +1 -1
  174. package/widgets/Print/CustomTemplate.d.ts +7 -0
  175. package/widgets/Search/LayerSearchSource.d.ts +3 -0
  176. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  177. package/assets/esri/core/workers/chunks/0a259137932211b80f0e.js +0 -1
  178. package/assets/esri/core/workers/chunks/24dcf2da6ab5d1593daa.js +0 -2
  179. package/assets/esri/core/workers/chunks/26aa8190ac439f634c5b.js +0 -1
  180. package/assets/esri/core/workers/chunks/283934255564d33031de.js +0 -1
  181. package/assets/esri/core/workers/chunks/3192586ec7fc73ed1165.js +0 -1
  182. package/assets/esri/core/workers/chunks/35a508a9311689d8df52.js +0 -1
  183. package/assets/esri/core/workers/chunks/3e89f487c5851c954d8b.js +0 -1
  184. package/assets/esri/core/workers/chunks/45922ec95c7fb704bae1.js +0 -1
  185. package/assets/esri/core/workers/chunks/5d857d2281342f73fd05.js +0 -1
  186. package/assets/esri/core/workers/chunks/5f0bc019add4aff3130c.js +0 -1
  187. package/assets/esri/core/workers/chunks/6ae12ad5afbe97f80854.js +0 -1
  188. package/assets/esri/core/workers/chunks/764c8ba14ab74b66b391.js +0 -1
  189. package/assets/esri/core/workers/chunks/786905f34da9cdad53f0.js +0 -2
  190. package/assets/esri/core/workers/chunks/8159a305578b6c6a1787.js +0 -1
  191. package/assets/esri/core/workers/chunks/897a856c00b2b828efe9.js +0 -2
  192. package/assets/esri/core/workers/chunks/8aeb2d287ce3b7ec7979.js +0 -1
  193. package/assets/esri/core/workers/chunks/9133c1b7cc1c9da27deb.js +0 -1
  194. package/assets/esri/core/workers/chunks/9186c494835707842673.js +0 -1
  195. package/assets/esri/core/workers/chunks/966cd2a6b9ec6665b256.js +0 -1
  196. package/assets/esri/core/workers/chunks/98d0180d2e5d9c73a04a.js +0 -1
  197. package/assets/esri/core/workers/chunks/9def4619d102f1d41578.js +0 -1
  198. package/assets/esri/core/workers/chunks/9eb0bea728ba8ef8a359.js +0 -1
  199. package/assets/esri/core/workers/chunks/ab77c71cb4947204c9f2.js +0 -2
  200. package/assets/esri/core/workers/chunks/c0528b4590e083e2c1ff.js +0 -1
  201. package/assets/esri/core/workers/chunks/d5a0e3a73df827dc7b06.js +0 -1
  202. package/assets/esri/core/workers/chunks/e5471373f89fd7cb9844.js +0 -1
  203. package/assets/esri/core/workers/chunks/ee146d860447a99370a5.js +0 -1
  204. package/assets/esri/core/workers/chunks/f6987cacbc55a68ec7ef.js +0 -2
  205. /package/assets/esri/core/workers/chunks/{ab77c71cb4947204c9f2.js.LICENSE.txt → 144f103b789e1657bad6.js.LICENSE.txt} +0 -0
  206. /package/assets/esri/core/workers/chunks/{f6987cacbc55a68ec7ef.js.LICENSE.txt → 1eef5e0b4c621af0261d.js.LICENSE.txt} +0 -0
  207. /package/assets/esri/core/workers/chunks/{24dcf2da6ab5d1593daa.js.LICENSE.txt → 22fc6de248290e7dd005.js.LICENSE.txt} +0 -0
  208. /package/assets/esri/core/workers/chunks/{786905f34da9cdad53f0.js.LICENSE.txt → a60700012465b22e7515.js.LICENSE.txt} +0 -0
  209. /package/assets/esri/core/workers/chunks/{897a856c00b2b828efe9.js.LICENSE.txt → ecd51cb0a428155ea680.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as n,pt2px as a}from"../../core/screenUtils.js";import{GeometryCursor as o}from"../../geometry/GeometryCursor.js";import{fromValues as l,empty as h,expandPointInPlace as c,center as m,width as f,height as u,diagonal as d,create as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{segmentIntersects as y}from"../../geometry/support/intersectsBase.js";import{isPolygon as P,isPolyline as S,isExtent as x,isMultipoint as w,isPoint as M}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as b}from"./CIMEffects.js";import T from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{getFirstFrame as R}from"./imageUtils.js";import{rotate as z}from"./mathUtils.js";import{addColorStops as L}from"./rasterizingUtils.js";import U from"./Rect.js";import F from"./TextRasterizer.js";import{getNumericValue as A,isSVGImage as j,getRelativeGradientSize as D,getEffectsInflateSize as G,fromCIMFontDecoration as H,fromCIMFontStyle as E,fromCIMHorizontalAlignment as B,fromCIMVerticalAlignment as X,getFillColor as J,getStrokeColor as N,getStrokeWidth as O,getFontWeight as q,getFontStyle as V,isCIMFill as Y,getSize as W}from"./utils.js";import{destroyHiddenSvg as K,createHiddenSvg as $,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as Z,glyphSize as tt,hittestToleranceSmallSymbol as et,hittestSmallSymbolThreshold as rt}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as it}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as st,getLineWidth as nt}from"../../views/2d/layers/graphics/graphicsUtils.js";const at=Math.PI/180,ot=.5,lt=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class ht{constructor(t){this._t=t}static createIdentity(){return new ht([1,0,0,0,1,0])}clone(){const t=this._t;return new ht(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new ht([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new ht([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new ht([e,-r,0,r,e,0])}rotate(t){return ht.multiply(this,ht.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,n=i[0]*s[0]+i[3]*s[1],a=i[1]*s[0]+i[4]*s[1],o=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=n,m[1]=a,m[2]=o,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new ht([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,n=-t[1]*e,a=-t[3]*e,o=t[0]*e;return new ht([s,n,r,a,o,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._textScaling=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||ht.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1),this._textScaling.push(1)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)],this._textScaling=[1]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}scaleText(t){return t*this._textScaling[this._textScaling.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}reverseScaleText(t){return t/this._textScaling[this._textScaling.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e=!1,r=1){const i=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*i),this._textScaling.push(this._textScaling[this._textScaling.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1),this._textScaling.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){const r=this.geomUnitsPerPoint(),i=null,s=G(t),n=!1;let a=new b(o.fromJSONCIM(e));for(const o of t){const t=k(o);t&&(a=t.execute(a,o,{geomUnitsPerPoint:r,tileKey:i,maxInflateSize:s,scale:null,spatialReference:e.spatialReference,preventClipping:n}))}return a}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=dt(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const n=i.execute(o.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(M(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else if(S(e)){for(const i of e.paths)for(const e of i)if(r.tx=e[0],r.ty=e[1],this.drawMarker(t,r),this._earlyReturn)break}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=A(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,n=r.height;if(!s||!n)return;const a=s/n,o=A(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*a*o,r*=i),l.translate(-e,-r)}let c=A(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*at);let m=A(t.offsetX),f=A(t.offsetY);if(m||f){if(this._mapRotation){const t=at*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=A(t.size,I.CIMVectorMarker.size),s=t.frame,n=s?s.ymax-s.ymin:0,a=i&&n?i/n:1,o=ht.createIdentity();s&&o.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=a,r/=a),o.translate(-e,-r)}1!==a&&o.scale(a,a);let h=A(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&o.rotate(h*at);let c=A(t.offsetX),m=A(t.offsetY);if(c||m){if(this._mapRotation){const t=at*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}o.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&o.scale(f,f);const u=e.getAngle();u&&o.rotate(u),o.translate(e.tx,e.ty);const d=t.scaleSymbolsProportionally?1:a;this.push(o,t.scaleSymbolsProportionally,d);for(const g of r){g?.symbol&&g.geometry||lt().error("Invalid marker graphic",g);let t=g.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(g.symbol,g.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!M(e))return;if(A(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=A(t.angle);s=-s,s&&i.rotate(s*at);const n=A(t.offsetX),a=A(t.offsetY);(n||a)&&i.translate(n,a);const o=this.geomUnitsPerPoint();1!==o&&i.scale(o,o),i.translate(e.x,e.y),this.push(i),this.drawText(t,r),this.pop()}}class mt extends ct{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new U(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(x(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(A(r,I.CIMSolidStroke.width)),.5*ot);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(x(t)){const e=yt(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=A(t.scaleX,1);let s=i*e,n=e;const a=this._resourceManager.getResource(r);if(null!=a){const t=a.height/a.width;s=i*(e?t>1?e:e/t:a.width),n=e?t>1?e*t:e:a.height}this._merge(this.transformPt([-s/2,-n/2]),0),this._merge(this.transformPt([-s/2,n/2]),0),this._merge(this.transformPt([s/2,-n/2]),0),this._merge(this.transformPt([s/2,n/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=n(i),s=n(s);const a=this.transformSize(1)*this.reverseTransformScalar(1);i*=a,s*=a;const o=t.horizontalAlignment??I.CIMTextSymbol.horizontalalignment,l=t.verticalAlignment??I.CIMTextSymbol.verticalalignment;let h=0;switch(o){case"Left":h=i/2;break;case"Right":h=-i/2}let c=0;switch(l){case"Bottom":c=s/2;break;case"Top":c=-s/2;break;case"Baseline":c=s/6}this._merge(this.transformPt([-i/2+h,-s/2+c]),0),this._merge(this.transformPt([-i/2+h,s/2+c]),0),this._merge(this.transformPt([i/2+h,-s/2+c]),0),this._merge(this.transformPt([i/2+h,s/2+c]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class ft extends ct{constructor(){super(...arguments),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=K(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i){const{textInfo:s,mapRotation:o,resolution:l,searchDist:h,hittestType:c,isScreenAligned:m}=i;this._resetHittest();const f=l*a(1);switch(this.setGeomUnitsPerPoint(f),c){case"point":if(1!==t.length)return lt().error("Unexpected hittest area",t),!1;this._hittestType="point",this._searchDistPoint=h/2/f,this._searchTarget=[[t[0].x,t[0].y]];break;case"rect":if(4!==t.length)return lt().error("Unexpected hittest area",t),!1;this._hittestType="rect",this._searchDistPoint=0,this._searchTarget=t.map(t=>[t.x,t.y])}if(this._textInfo=s,this._mapRotation=m?o:0,!has("esri-mobile")){const t=n(et*window.devicePixelRatio),r=n(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(Y))&&"CIMMeshSymbol"!==e?.type&&(W(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,n,a){null!=a?this._hittestSvgPath(t,a,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}drawTextSymbol(t,e,r){if(!t||!M(e))return;if(A(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity(),s=this.geomUnitsPerPoint();1!==s&&i.scale(s,s),i.translate(e.x,e.y),this.push(i),this.drawText(t,r),this.pop()}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=A(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const n=e*this.geomUnitsPerPoint(),a=n*i*(s.width/s.height);if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),e=this._searchDistPoint;Math.abs(t[0])<a/2+e&&Math.abs(t[1])<n/2+e&&(this._earlyReturn=!0)}else{const t=a/2,e=n/2,r=[[-t,e],[t,e],[t,-e],[-t,-e],[-t,e]];bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[r])&&(this._earlyReturn=!0)}}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=st(A(t.height,I.CIMTextSymbol.height)),{lineGapType:n,lineGap:a}=t,o=n?Pt(n,A(a),s):0,l=t.horizontalAlignment??I.CIMTextSymbol.horizontalalignment,h=t.verticalAlignment??I.CIMTextSymbol.verticalalignment,c="CIMBackgroundCallout"===t.callout?.type,m=it(i.glyphMosaicItems,{scale:s/tt,angle:A(t.angle),xOffset:A(t.offsetX),yOffset:A(t.offsetY),horizontalAlignment:l,verticalAlignment:h,maxLineWidth:nt(t.lineWidth),lineHeight:Z*Math.max(.25,Math.min(o||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!1,hasBackground:c}),f=this.reverseScaleText(1);for(const u of m.glyphs){const t=u.offsets,e=[[t.topLeft[0]*f,-t.topLeft[1]*f],[t.topRight[0]*f,-t.topRight[1]*f],[t.bottomRight[0]*f,-t.bottomRight[1]*f],[t.bottomLeft[0]*f,-t.bottomLeft[1]*f],[t.topLeft[0]*f,-t.topLeft[1]*f]];if("point"===this._hittestType){gt(this.reverseTransformPt(this._searchTarget[0]),[e])&&(this._earlyReturn=!0)}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[e])&&(this._earlyReturn=!0)}}}_hitTestFill(t){let e=null;if(x(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);if(gt(t,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(t,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,e)&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=$(),this._path??=Q("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=g();p(s,t);const n={x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]},a=this._getSvgPath();a.setAttribute("d",e);const o=a.getBBox();if("point"===this._hittestType){const t=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),s=this.reverseTransformPt(this._searchTarget[0]);let a=Math.max(o.width/n.width,o.height/n.height),l=1;const h=2*t*a;h<1&&(l=2/h,a*=l,o.x*=l,o.y*=l,o.width*=l,o.height*=l);const c=1+i*a/2,m=this._getCanvasContext(o.width+2*c,o.height+2*c);m.setTransform(l,0,0,l,-o.x+c,-o.y+c);const f=new Path2D(e);r?m.fill(f):(m.lineWidth=i*(a/l),m.stroke(f));const u=(n.width*a-o.width)/2,d=(n.height*a-o.height)/2,g=Math.floor((s[0]-n.x-t)*a-u+c),p=Math.floor((n.height-(s[1]-n.y)-t)*a+d+c),_=Math.ceil(2*t*a),y=Math.ceil(2*t*a),P=m.getImageData(g,p,_,y).data;for(let e=3;e<P.length;e+=4)if(P[e]>127.5)return void(this._earlyReturn=!0)}else{const t=[[n.x,n.y],[n.x,n.y+n.height],[n.x+n.width,n.y+n.height],[n.x+n.width,n.y],[n.x,n.y]];if(bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[t]))return void(this._earlyReturn=!0)}}_hitTestStroke(t,e){let r=null;if(x(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}if("point"===this._hittestType){pt(this.reverseTransformPt(this._searchTarget[0]),r,A(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,r)&&(this._earlyReturn=!0)}}_resetHittest(){this.setTransform(),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new T,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(x(t))this._buildPath(yt(t).rings,!0);else{if(!w(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,n){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!x(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const a=this._ctx;a.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",a.lineWidth=Math.max(this.transformSize(r),ot),this._setCapStyle(i),this._setJoinStyle(s),a.miterLimit=n,a.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!x(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,n=A(t.scaleX,1),a=this._resourceManager.getResource(i);if(null==a)return;let o=e*(a.width/a.height),l=e;e||(o=a.width,l=a.height);const h=j(i)||"src"in a&&j(a.src);let c="getFrame"in a?R(a):a;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:n*d*f,m12:n*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-o/2,-l/2,o,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=St(t,this.transformSize(n(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:a,anchorY:o,canvas:l}=i,h=s[0]*(a+.5),c=s[1]*(o-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-g*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:n,rotation:a,scaleX:o,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(x(t))this._buildPath(yt(t).rings,!0);else{if(!w(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=j(h)||"src"in c&&j(c.src);let u,d="getFrame"in c?R(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);a||(a=0),s?s*=t:s=0,n?n*=t:n=0,i&&(i*=t);const e=i?i/c.height:1,r=o&&i?o*i/c.width:1;if(0!==a||1!==e||1!==r||0!==s||0!==n){const t=new DOMMatrix;t.rotateSelf(0,0,-a).translateSelf(s,n).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:n,miterLimit:o,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!x(t))return w(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=j(h)||"src"in m&&j(m.src);let d="getFrame"in m?R(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(a(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(n),void 0!==o&&(_.miterLimit=o),_.lineWidth=g;for(let a of f)if(a=e(a),wt(a),a&&!(a.length<=1)){M=this.transformPt(a[0]);for(let t=1;t<a.length;t++){b=this.transformPt(a[t]);const e=_t(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(r),_.strokeStyle=y,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!x(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:n,gradientSize:o,gradientSizeUnits:l}=e,g=I.CIMGradientFill,p=e.gradientType??g.gradientType,_=-i(s??0),y=h();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==n&&"Rectangular"!==n||(t=z(t,-_)),c(y,t)}}const[w,M,b,T]=y,k=this._ctx;switch(k.save(),n){case"Buffered":lt().error(`Gradient method "${n}" currently unsupported.`);break;case"Linear":{const t=(M+T)/2,r="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(b-w),[i,s]="Discrete"===p?[b,b-r]:[w+r,w],n=z([i,t],_),h=z([s,t],_),c=k.createLinearGradient(n[0],n[1],h[0],h[1]);L(c,e),k.fillStyle=c,k.fill("evenodd");break}case"Circular":{const t=m(y),r=d(y)/2,i="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*r,[s,n]="Discrete"===p?[r,r-i]:[i,0],h=k.createRadialGradient(t[0],t[1],s,t[0],t[1],n);L(h,e),k.fillStyle=h,k.fill("evenodd");break}case"Rectangular":{const r=m(y),i=r[0],s=r[1],n=z(r,_),h=(r,i,s,a,o,l,h,c)=>{k.save(),this.pushClipPath(t);const m=z([o,l],_),f=z([h,c],_);k.beginPath(),k.moveTo(n[0],n[1]),k.lineTo(m[0],m[1]),k.lineTo(f[0],f[1]),k.lineTo(n[0],n[1]),k.clip();const u=z([r,i],_),d=z([s,a],_),g=k.createLinearGradient(u[0],u[1],d[0],d[1]);L(g,e),k.fillStyle=g,k.fill("evenodd"),k.restore()};let c="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(f(y)/2),[d,P]="Discrete"===p?[b,b-c]:[i+c,i];h(d,s,P,s,b,M,b,T),[d,P]="Discrete"===p?[w,w+c]:[i-c,i],h(d,s,P,s,w,T,w,M),c="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(u(y)/2);let[S,x]="Discrete"===p?[T,T-c]:[s+c,s];h(i,S,i,x,b,T,w,T),[S,x]="Discrete"===p?[M,M+c]:[s-c,s],h(i,S,i,x,w,M,b,M);break}}k.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:n,gradientSizeUnits:o,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!x(t))return void lt().error("Unable to draw gradient stroke");m=yt(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(a(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const r=p[0]-g[0],i=p[1]-g[1];t+=Math.sqrt(r*r+i*i),g=p}const i="Absolute"===o?this.transformSize(a(n)):D(n,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const n=p[0]-g[0],a=p[1]-g[1],o=Math.sqrt(n*n+a*a);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=z([n/o,a/o],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=n/o,r=a/o;"Discrete"===f?(h=g[0]-e*l,c=g[1]-r*l,m=h+e*i,y=c+r*i):(m=g[0]+e*(t-l),y=g[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return lt().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);L(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=o,g=p}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=A(t.separation,I.CIMHatchFill.separation)*r,s=A(t.rotation);if(0===i)return null;i<0&&(i=-i);let n=0;const a=.5*i;for(;n>a;)n-=i;for(;n<-a;)n+=i;const o=g();p(o,e),o[0]-=a,o[1]-=a,o[2]+=a,o[3]+=a;const l=[[o[0],o[1]],[o[0],o[3]],[o[2],o[3]],[o[2],o[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*at),c=Math.sin(s*at),m=-i*c,f=i*h;let u,d,_,y;n=A(t.offsetX)*r*c-A(t.offsetY)*r*h,u=_=Number.MAX_VALUE,d=y=-Number.MAX_VALUE;for(const g of l){const t=g[0],e=g[1],r=h*t+c*e,i=-c*t+h*e;u=Math.min(u,r),_=Math.min(_,i),d=Math.max(d,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=h*u-c*_-m*n/i,S=c*u+h*_-f*n/i,x=h*d-c*_-m*n/i,w=c*d+h*_-f*n/i;const M=1+Math.round((y-_)/i),b=[];for(let g=0;g<M;g++)P+=m,S+=f,x+=m,w+=f,b.push([[P,S],[x,w]]);return{paths:b}}function gt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],n=i[s];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],n=i[s];let a=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===a)continue;a=Math.sqrt(a);const o=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/a;if(Math.abs(o)<r){const i=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/a;if(i>-r&&i<a+r)return!0}}}return!1}function _t(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function St(e,r=1){const i=H(e),s=E(e.fontStyleName),n=e.fontFamilyName??t,{weight:a,style:o}=s,l=r*(e.height||5),h=B(e.horizontalAlignment),c=X(e.verticalAlignment),m=J(e),f=J(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=N(e.symbol),g=r*(O(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=J(p),y=O(p),P=N(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:n,style:V(o),weight:q(a),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:o},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const xt=1e-4;function wt(t){let e,r,i,s,n,a=t[0],o=1;for(;o<t.length;)e=t[o][0]-a[0],r=t[o][1]-a[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=xt?(t.splice(o-1,1),a=n):(n=a,a=t[o],o++),i=s}function Mt(t){const e=1e-6,r=t[0],i=t[t.length-1];return Math.abs(r[0]-i[0])<=e&&Math.abs(r[1]-i[1])<=e}function bt(t,e){t.length>1&&!Mt(t)&&(t=[...t,t[0]]);for(let r=0;r<e.length;r++){const i=e[r],s=i.length;for(const e of i)if(gt(e,[t]))return!0;if(Mt(i))for(const r of t)if(gt(r,e))return!0;for(let e=1;e<s;e++){const r=i[e-1],s=i[e];for(let e=0;e<t.length;e++){const i=t[e],n=t[(e+1)%t.length];if(y(r,s,i,n))return!0}}}return!1}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,at as cDegToRad,Pt as lineGapType2LineHeight};
2
+ import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import i from"../../core/Logger.js";import{deg2rad as r}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as a,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as o}from"../../geometry/GeometryCursor.js";import{fromValues as l,empty as h,expandPointInPlace as c,center as m,width as f,height as u,diagonal as d,create as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{targetIntersectsPolygon as y,pointInPolygon as P,nearLine as S}from"../../geometry/support/intersectsBase.js";import{isPolygon as x,isPolyline as w,isExtent as M,isMultipoint as b,isPoint as T}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as k}from"./CIMEffects.js";import C from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as v,getPlacementOperator as I}from"./CIMOperators.js";import{Placement as R}from"./CIMPlacements.js";import{defaultCIMValues as z}from"./defaultCIMValues.js";import{getFirstFrame as L}from"./imageUtils.js";import{rotate as U}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import A from"./Rect.js";import j from"./TextRasterizer.js";import{getNumericValue as D,isSVGImage as G,getRelativeGradientSize as H,getEffectsInflateSize as E,fromCIMFontDecoration as B,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontWeight as Y,getFontStyle as W,isCIMFill as K,getSize as $}from"./utils.js";import{destroyHiddenSvg as Q,createHiddenSvg as Z,createSvgElement as tt}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as et,glyphSize as it,hittestToleranceSmallSymbol as rt,hittestSmallSymbolThreshold as st}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as at}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as nt,getLineWidth as ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const lt=Math.PI/180,ht=.5,ct=()=>i.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class mt{constructor(t){this._t=t}static createIdentity(){return new mt([1,0,0,0,1,0])}clone(){const t=this._t;return new mt(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new mt([t,0,0,0,e,0])}scale(t,e){const i=this._t;return i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new mt([0,0,t,0,0,e])}translate(t,e){const i=this._t;return i[2]+=t,i[5]+=e,this}static createRotate(t){const e=Math.cos(t),i=Math.sin(t);return new mt([e,-i,0,i,e,0])}rotate(t){return mt.multiply(this,mt.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],i=Math.sqrt(t*t+e*e);return[t/i,e/i]}static multiply(t,e,i){const r=t._t,s=e._t,a=r[0]*s[0]+r[3]*s[1],n=r[1]*s[0]+r[4]*s[1],o=r[2]*s[0]+r[5]*s[1]+s[2],l=r[0]*s[3]+r[3]*s[4],h=r[1]*s[3]+r[4]*s[4],c=r[2]*s[3]+r[5]*s[4]+s[5],m=i._t;return m[0]=a,m[1]=n,m[2]=o,m[3]=l,m[4]=h,m[5]=c,i}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new mt([0,0,0,0,0,0]);e=1/e;const i=(t[1]*t[5]-t[2]*t[4])*e,r=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,a=-t[1]*e,n=-t[3]*e,o=t[0]*e;return new mt([s,a,i,n,o,r])}}class ft{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._textScaling=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new R,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||mt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1),this._textScaling.push(1)}setTransform(t,e){this._transfos=[t||mt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)],this._textScaling=[1]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}scaleText(t){return t*this._textScaling[this._textScaling.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}reverseScaleText(t){return t/this._textScaling[this._textScaling.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e=!1,i=1){const r=e?t.scaleRatio():1;mt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r),this._textScaling.push(this._textScaling[this._textScaling.length-1]*i)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1),this._textScaling.splice(-1,1)}drawSymbol(t,e,i){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,i)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const i=t.symbolLayers;if(!i)return;const r=t.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(i,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(i,e)}executeEffects(t,e){const i=this.geomUnitsPerPoint(),r=null,s=E(t),a=!1;let n=new k(o.fromJSONCIM(e));for(const o of t){const t=v(o);t&&(n=t.execute(n,o,{geomUnitsPerPoint:i,tileKey:r,maxInflateSize:s,scale:null,spatialReference:e.spatialReference,preventClipping:a}))}return n}drawSymbolLayers(t,e){let i=t.length;for(;i--;){const r=t[i];if(!r||!1===r.enable)continue;const s=r.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(r,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(r,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const i=pt(e,t,this.geomUnitsPerPoint());i&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,i),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const i=t.markerPlacement;if(i){const r=I(i);if(r){const s="CIMMarkerPlacementInsidePolygon"===i.type||"CIMMarkerPlacementPolygonCenter"===i.type&&i.clipAtBoundary;s&&this.pushClipPath(e);const a=r.execute(o.fromJSONCIM(e),i,this.geomUnitsPerPoint(),null);if(a){let e=null;for(;(e=a.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const i=this._placementPool.acquire();if(T(e))i.tx=e.x,i.ty=e.y,this.drawMarker(t,i);else if(x(e)){const r=_(e);r&&([i.tx,i.ty]=r,this.drawMarker(t,i))}else if(w(e)){for(const r of e.paths)for(const e of r)if(i.tx=e[0],i.ty=e[1],this.drawMarker(t,i),this._earlyReturn)break}else for(const r of e.points)if(i.tx=r[0],i.ty=r[1],this.drawMarker(t,i),this._earlyReturn)break;this._placementPool.release(i)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),r=D(t.size,z.CIMPictureMarker.size);if(null==i||r<=0)return;const s=i.width,a=i.height;if(!s||!a)return;const n=s/a,o=D(t.scaleX,1),l=mt.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,i=h.y;"Absolute"!==t.anchorPointUnits&&(e*=r*n*o,i*=r),l.translate(-e,-i)}let c=D(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*lt);let m=D(t.offsetX),f=D(t.offsetY);if(m||f){if(this._mapRotation){const t=lt*this._mapRotation,e=Math.cos(t),i=Math.sin(t),r=m*i+f*e;m=m*e-f*i,f=r}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l),this.drawImage(t,r),this.pop()}drawVectorMarker(t,e){if(!t)return;const i=t.markerGraphics;if(!i)return;const r=D(t.size,z.CIMVectorMarker.size),s=t.frame,a=s?s.ymax-s.ymin:0,n=r&&a?r/a:1,o=mt.createIdentity();s&&o.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,i=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,i*=s.ymax-s.ymin):(e/=n,i/=n),o.translate(-e,-i)}1!==n&&o.scale(n,n);let h=D(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&o.rotate(h*lt);let c=D(t.offsetX),m=D(t.offsetY);if(c||m){if(this._mapRotation){const t=lt*this._mapRotation,e=Math.cos(t),i=Math.sin(t),r=c*i+m*e;c=c*e-m*i,m=r}o.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&o.scale(f,f);const u=e.getAngle();u&&o.rotate(u),o.translate(e.tx,e.ty);const d=t.scaleSymbolsProportionally?1:n;this.push(o,t.scaleSymbolsProportionally,d);for(const g of i){g?.symbol&&g.geometry||ct().error("Invalid marker graphic",g);let t=g.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(g.symbol,g.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,i){if(!t)return;if(!T(e))return;if(D(t.height,z.CIMTextSymbol.height)<=0)return;const r=mt.createIdentity();let s=D(t.angle);s=-s,s&&r.rotate(s*lt);const a=D(t.offsetX),n=D(t.offsetY);(a||n)&&r.translate(a,n);const o=this.geomUnitsPerPoint();1!==o&&r.scale(o,o),r.translate(e.x,e.y),this.push(r),this.drawText(t,i),this.pop()}}class ut extends ft{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new A(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(x(t))this._processPath(t.rings,0);else if(w(t))this._processPath(t.paths,0);else if(M(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,i){if(!t||this._clipCount>0||null==i||i<=0)return;const r=Math.max(.5*this.transformSize(D(i,z.CIMSolidStroke.width)),.5*ht);if(x(t))this._processPath(t.rings,r);else if(w(t))this._processPath(t.paths,r);else if(M(t)){const e=yt(t);e&&this._processPath(e.rings,r)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){x(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:i}=t,r=D(t.scaleX,1);let s=r*e,a=e;const n=this._resourceManager.getResource(i);if(null!=n){const t=n.height/n.width;s=r*(e?t>1?e:e/t:n.width),a=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-a/2]),0),this._merge(this.transformPt([-s/2,a/2]),0),this._merge(this.transformPt([s/2,-a/2]),0),this._merge(this.transformPt([s/2,a/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new j);const i=St(t);let[r,s]=this._textRasterizer.computeTextSize(e,i);r=a(r),s=a(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);r*=n,s*=n;const o=t.horizontalAlignment??z.CIMTextSymbol.horizontalalignment,l=t.verticalAlignment??z.CIMTextSymbol.verticalalignment;let h=0;switch(o){case"Left":h=r/2;break;case"Right":h=-r/2}let c=0;switch(l){case"Bottom":c=s/2;break;case"Top":c=-s/2;break;case"Baseline":c=s/6}this._merge(this.transformPt([-r/2+h,-s/2+c]),0),this._merge(this.transformPt([-r/2+h,s/2+c]),0),this._merge(this.transformPt([r/2+h,-s/2+c]),0),this._merge(this.transformPt([r/2+h,s/2+c]),0)}_processPath(t,e){if(t)for(const i of t){const t=i?i.length:0;if(t>1){this._merge(this.transformPt(i[0]),e);for(let r=1;r<t;r++)this._merge(this.transformPt(i[r]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class dt extends ft{constructor(){super(...arguments),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=Q(this._svg),this._path=null,this._canvas=null}hitTest(t,e,i,r){const{textInfo:s,mapRotation:o,resolution:l,searchDist:h,hittestType:c,isScreenAligned:m}=r;this._resetHittest();const f=l*n(1);switch(this.setGeomUnitsPerPoint(f),c){case"point":if(1!==t.length)return ct().error("Unexpected hittest area",t),!1;this._hittestType="point",this._searchDistPoint=h/2/f,this._searchTarget=[[t[0].x,t[0].y]];break;case"rect":if(4!==t.length)return ct().error("Unexpected hittest area",t),!1;this._hittestType="rect",this._searchDistPoint=0,this._searchTarget=t.map(t=>[t.x,t.y])}if(this._textInfo=s,this._mapRotation=m?o:0,!has("esri-mobile")){const t=a(rt*window.devicePixelRatio),i=a(st);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(K))&&"CIMMeshSymbol"!==e?.type&&($(e)??0)<i&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,i),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,i){null!=i?this._hittestSvgPath(t,i,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,i,r,s,a,n){null!=n?this._hittestSvgPath(t,n,!1,i):this._hitTestStroke(t,i)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}drawTextSymbol(t,e,i){if(!t||!T(e))return;if(D(t.height,z.CIMTextSymbol.height)<=0)return;const r=mt.createIdentity(),s=this.geomUnitsPerPoint();1!==s&&r.scale(s,s),r.translate(e.x,e.y),this.push(r),this.drawText(t,i),this.pop()}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:i}=t,r=D(t.scaleX,1),s=this._resourceManager.getResource(i);if(null==s||0===s.height||0===e)return;const a=e*this.geomUnitsPerPoint(),n=a*r*(s.width/s.height);if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),e=this._searchDistPoint;Math.abs(t[0])<n/2+e&&Math.abs(t[1])<a/2+e&&(this._earlyReturn=!0)}else{const t=n/2,e=a/2,i=[[-t,e],[t,e],[t,-e],[-t,-e],[-t,e]],r=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(r,[i])&&(this._earlyReturn=!0)}}drawText(t,e){const i=this._textInfo;if(!i)return;const r=i.get(t);if(!r)return;if(!r.glyphMosaicItems.glyphs.length)return;const s=nt(D(t.height,z.CIMTextSymbol.height)),{lineGapType:a,lineGap:n}=t,o=a?Pt(a,D(n),s):0,l=t.horizontalAlignment??z.CIMTextSymbol.horizontalalignment,h=t.verticalAlignment??z.CIMTextSymbol.verticalalignment,c="CIMBackgroundCallout"===t.callout?.type,m=at(r.glyphMosaicItems,{scale:s/it,angle:D(t.angle),xOffset:D(t.offsetX),yOffset:D(t.offsetY),horizontalAlignment:l,verticalAlignment:h,maxLineWidth:ot(t.lineWidth),lineHeight:et*Math.max(.25,Math.min(o||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!1,hasBackground:c}),f=this.reverseScaleText(1);for(const u of m.glyphs){const t=u.offsets,e=[[t.topLeft[0]*f,-t.topLeft[1]*f],[t.topRight[0]*f,-t.topRight[1]*f],[t.bottomRight[0]*f,-t.bottomRight[1]*f],[t.bottomLeft[0]*f,-t.bottomLeft[1]*f],[t.topLeft[0]*f,-t.topLeft[1]*f]];if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);P(t,[e])&&(this._earlyReturn=!0)}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,[e])&&(this._earlyReturn=!0)}}}_hitTestFill(t){let e=null;if(M(t)){const i=t;e=[[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]}else if(x(t))e=t.rings;else{if(!w(t))return;e=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);if(P(t,e)&&(this._earlyReturn=!0),!this._earlyReturn){const i=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint();S(t,e,i)&&(this._earlyReturn=!0)}}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,e)&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=Z(),this._path??=tt("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,i,r=0){const s=g();p(s,t);const a={x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]},n=this._getSvgPath();n.setAttribute("d",e);const o=n.getBBox();if("point"===this._hittestType){const t=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),s=this.reverseTransformPt(this._searchTarget[0]);let n=Math.max(o.width/a.width,o.height/a.height),l=1;const h=2*t*n;h<1&&(l=2/h,n*=l,o.x*=l,o.y*=l,o.width*=l,o.height*=l);const c=1+r*n/2,m=this._getCanvasContext(o.width+2*c,o.height+2*c);m.setTransform(l,0,0,l,-o.x+c,-o.y+c);const f=new Path2D(e);i?m.fill(f):(m.lineWidth=r*(n/l),m.stroke(f));const u=(a.width*n-o.width)/2,d=(a.height*n-o.height)/2,g=Math.floor((s[0]-a.x-t)*n-u+c),p=Math.floor((a.height-(s[1]-a.y)-t)*n+d+c),_=Math.ceil(2*t*n),y=Math.ceil(2*t*n),P=m.getImageData(g,p,_,y).data;for(let e=3;e<P.length;e+=4)if(P[e]>127.5)return void(this._earlyReturn=!0)}else{const t=[[a.x,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height],[a.x+a.width,a.y],[a.x,a.y]],e=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;if(y(e,[t]))return void(this._earlyReturn=!0)}}_hitTestStroke(t,e){let i=null;if(M(t)){const e=t;i=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(x(t))i=t.rings;else{if(!w(t))return;i=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),r=D(e,z.CIMSolidStroke.width)*this.geomUnitsPerPoint(),s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint();S(t,i,r/2+s)&&(this._earlyReturn=!0)}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,i)&&(this._earlyReturn=!0)}}_resetHittest(){this.setTransform(),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null}}class gt extends ft{constructor(t,e,i,r){super(e,i),this._applyAdditionalRenderProps=r,this._colorSubstitutionHelper=new C,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else if(M(t))this._buildPath(yt(t).rings,!0);else{if(!b(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const i=this._ctx;i.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",i.fill("evenodd")}drawSolidStroke(t,e,i,r,s,a){if(!t||!e||0===i)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!1);else{if(!M(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(i),ht),this._setCapStyle(r),this._setJoinStyle(s),n.miterLimit=a,n.stroke()}pushClipPath(t){if(this._ctx.save(),x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else{if(!M(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:i,url:r,tintColor:s}=t,a=D(t.scaleX,1),n=this._resourceManager.getResource(r);if(null==n)return;let o=e*(n.width/n.height),l=e;e||(o=n.width,l=n.height);const h=G(r)||"src"in n&&G(n.src);let c="getFrame"in n?L(n):n;i&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,i)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:a*d*f,m12:a*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-o/2,-l/2,o,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new j);const i=St(t,this.transformSize(a(1))),r=this._textRasterizer.rasterizeText(e,i);if(!r)return;const{size:s,anchorX:n,anchorY:o,canvas:l}=r,h=s[0]*(n+.5),c=s[1]*(o-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-g*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:i,height:r,offsetX:s,offsetY:a,rotation:n,scaleX:o,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else if(M(t))this._buildPath(yt(t).rings,!0);else{if(!b(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=G(h)||"src"in c&&G(c.src);let u,d="getFrame"in c?L(c):c;if(i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,a?a*=t:a=0,r&&(r*=t);const e=r?r/c.height:1,i=o&&r?o*r/c.width:1;if(0!==n||1!==e||1!==i||0!==s||0!==a){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,a).scaleSelf(i,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,i){if(!t)return;let{colorSubstitutions:r,capStyle:s,joinStyle:a,miterLimit:o,tintColor:l,url:h,width:c}=i;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(x(t))f=t.rings;else if(w(t))f=t.paths;else{if(!M(t))return b(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=G(h)||"src"in m&&G(m.src);let d="getFrame"in m?L(m):m;r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let P,S;_.save(),this._setCapStyle(s),this._setJoinStyle(a),void 0!==o&&(_.miterLimit=o),_.lineWidth=g;for(let n of f)if(n=e(n),wt(n),n&&!(n.length<=1)){P=this.transformPt(n[0]);for(let t=1;t<n.length;t++){S=this.transformPt(n[t]);const e=_t(P,S),i=new DOMMatrix;i.translateSelf(0,P[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(i),_.strokeStyle=y,_.beginPath(),_.moveTo(P[0],P[1]),_.lineTo(S[0],S[1]),_.stroke(),P=S}}_.restore()}drawGradientFill(t,e){if(!t)return;let i;if(x(t))i=t.rings;else if(w(t))i=t.paths;else{if(!M(t))return void ct().error("Unable to draw gradient fill");i=yt(t).rings}this._buildPath(i,!0);const{angle:s,gradientMethod:a,gradientSize:o,gradientSizeUnits:l}=e,g=z.CIMGradientFill,p=e.gradientType??g.gradientType,_=-r(s??0),y=h();for(const r of i){const t=r?r.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(r[e]);"Linear"!==a&&"Rectangular"!==a||(t=U(t,-_)),c(y,t)}}const[P,S,b,T]=y,k=this._ctx;switch(k.save(),a){case"Buffered":ct().error(`Gradient method "${a}" currently unsupported.`);break;case"Linear":{const t=(S+T)/2,i="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(b-P),[r,s]="Discrete"===p?[b,b-i]:[P+i,P],a=U([r,t],_),h=U([s,t],_),c=k.createLinearGradient(a[0],a[1],h[0],h[1]);F(c,e),k.fillStyle=c,k.fill("evenodd");break}case"Circular":{const t=m(y),i=d(y)/2,r="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*i,[s,a]="Discrete"===p?[i,i-r]:[r,0],h=k.createRadialGradient(t[0],t[1],s,t[0],t[1],a);F(h,e),k.fillStyle=h,k.fill("evenodd");break}case"Rectangular":{const i=m(y),r=i[0],s=i[1],a=U(i,_),h=(i,r,s,n,o,l,h,c)=>{k.save(),this.pushClipPath(t);const m=U([o,l],_),f=U([h,c],_);k.beginPath(),k.moveTo(a[0],a[1]),k.lineTo(m[0],m[1]),k.lineTo(f[0],f[1]),k.lineTo(a[0],a[1]),k.clip();const u=U([i,r],_),d=U([s,n],_),g=k.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),k.fillStyle=g,k.fill("evenodd"),k.restore()};let c="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(f(y)/2),[d,x]="Discrete"===p?[b,b-c]:[r+c,r];h(d,s,x,s,b,S,b,T),[d,x]="Discrete"===p?[P,P+c]:[r-c,r],h(d,s,x,s,P,T,P,S),c="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(u(y)/2);let[w,M]="Discrete"===p?[T,T-c]:[s+c,s];h(r,w,r,M,b,T,P,T),[w,M]="Discrete"===p?[S,S+c]:[s-c,s],h(r,w,r,M,P,S,b,S);break}}k.restore()}drawGradientStroke(t,i){const{capStyle:r,gradientMethod:s,gradientSize:a,gradientSizeUnits:o,joinStyle:l,miterLimit:h,width:c}=i;if(!t||0===c)return;let m;if(x(t))m=t.rings;else if(w(t))m=t.paths;else{if(!M(t))return void ct().error("Unable to draw gradient stroke");m=yt(t).rings}const f=i.gradientType??z.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(n(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(r),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const i=p[0]-g[0],r=p[1]-g[1];t+=Math.sqrt(i*i+r*r),g=p}const r="Absolute"===o?this.transformSize(n(a)):H(a,z.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const a=p[0]-g[0],n=p[1]-g[1],o=Math.sqrt(a*a+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=U([a/o,n/o],-Math.PI/2),i=u/2,s="Discrete"===f?i:r-i;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*r,y=c-e*r;break}case"AlongLine":{const e=a/o,i=n/o;"Discrete"===f?(h=g[0]-e*l,c=g[1]-i*l,m=h+e*r,y=c+i*r):(m=g[0]+e*(t-l),y=g[1]+i*(t-l),h=m-e*r,c=y-i*r);break}default:return ct().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);F(P,i),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=o,g=p}}d.restore()}_buildPath(t,e){const i=this._ctx;if(i.beginPath(),t)for(const r of t){const t=r?r.length:0;if(t>1){let s=this.transformPt(r[0]);i.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(r[e]),i.lineTo(s[0],s[1]);e&&i.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function pt(t,e,i){let r=D(t.separation,z.CIMHatchFill.separation)*i,s=D(t.rotation);if(0===r)return null;r<0&&(r=-r);let a=0;const n=.5*r;for(;a>n;)a-=r;for(;a<-n;)a+=r;const o=g();p(o,e),o[0]-=n,o[1]-=n,o[2]+=n,o[3]+=n;const l=[[o[0],o[1]],[o[0],o[3]],[o[2],o[3]],[o[2],o[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*lt),c=Math.sin(s*lt),m=-r*c,f=r*h;let u,d,_,y;a=D(t.offsetX)*i*c-D(t.offsetY)*i*h,u=_=Number.MAX_VALUE,d=y=-Number.MAX_VALUE;for(const g of l){const t=g[0],e=g[1],i=h*t+c*e,r=-c*t+h*e;u=Math.min(u,i),_=Math.min(_,r),d=Math.max(d,i),y=Math.max(y,r)}_=Math.floor(_/r)*r;let P=h*u-c*_-m*a/r,S=c*u+h*_-f*a/r,x=h*d-c*_-m*a/r,w=c*d+h*_-f*a/r;const M=1+Math.round((y-_)/r),b=[];for(let g=0;g<M;g++)P+=m,S+=f,x+=m,w+=f,b.push([[P,S],[x,w]]);return{paths:b}}function _t(t,e){const i=e[0]-t[0],r=e[1]-t[1];return 180/Math.PI*Math.atan2(r,i)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,i)=>{switch(t){case"ExtraLeading":return 1+e/i;case"Multiple":return e;case"Exact":return e/i}};function St(e,i=1){const r=B(e),s=X(e.fontStyleName),a=e.fontFamilyName??t,{weight:n,style:o}=s,l=i*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?i*(e.haloSize??0):0,d=q(e.symbol),g=i*(V(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=O(p),y=V(p),P=q(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:a,style:W(o),weight:Y(n),decoration:r},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:o},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const xt=1e-4;function wt(t){let e,i,r,s,a,n=t[0],o=1;for(;o<t.length;)e=t[o][0]-n[0],i=t[o][1]-n[1],s=0!==e?i/e:Math.PI/2,void 0!==r&&Math.abs(s-r)<=xt?(t.splice(o-1,1),n=a):(a=n,n=t[o],o++),r=s}export{ft as CIMSymbolDrawHelper,gt as CanvasDrawHelper,ut as EnvDrawHelper,dt as HittestDrawHelper,mt as Transformation,lt as cDegToRad,Pt as lineGapType2LineHeight};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{AttributeStoreView as e}from"./webgl/AttributeStoreView.js";import t from"./webgl/TileContainer.js";const i=60;class s extends t{constructor(t){super(t),this._statisticsByLevel=new Map,this._entityIndex=new Map,this.attributeView=new e}destroy(){super.destroy(),this.children.forEach(e=>e.destroy()),this.removeAllChildren(),this.attributeView.destroy()}doRender(e){e.context.capabilities.enable("textureFloatLinear"),super.doRender(e)}get hasAnimations(){for(const e of this.children)if(e.hasAnimations)return!0;return!1}_reindexAndUpdateFeaturesIfNeeded(){if(this.hasAnimations&&(this._reindexFeatures(),0!==this.attributeView.size))for(const e of this._entityIndex.values())e.dirty&&(this.attributeView.setData(e.displayId,7,0,e.firstIndexed),e.dirty=!1)}restartAnimation(e){const t=this._entityIndex.get(e);if(!t)return;const i=performance.now()/1e3;t.firstIndexed=i,t.dirty=!0}restartAllAnimations(){const e=performance.now()/1e3;for(const[t,i]of this._entityIndex)i.firstIndexed=e,i.dirty=!0}_reindexFeatures(){const e=performance.now()/1e3;for(const t of this.children)for(const i of t.entityIds){const{objectId:t}=i;let s=this._entityIndex.get(t);s||(s={objectId:t,displayId:0,firstIndexed:e,lastIndexed:0,dirty:!0},this._entityIndex.set(t,s)),s.lastIndexed=e,s.displayId=i.displayId}for(const[t,s]of this._entityIndex)e-s.lastIndexed>i&&this._entityIndex.delete(t)}_updateAttributeView(){this.attributeView.update()&&this.requestRender(),this._reindexAndUpdateFeaturesIfNeeded()}createRenderParams(e){const t=super.createRenderParams(e);return t.attributeView=this.attributeView,t.instanceStore=this._instanceStore,t.statisticsByLevel=this._statisticsByLevel,t}}export{s as AFeatureContainer};
2
+ import{AttributeStoreView as e}from"./webgl/AttributeStoreView.js";import t from"./webgl/TileContainer.js";const i=60;class s extends t{constructor(t){super(t),this._statisticsByLevel=new Map,this._entityIndex=new Map,this.attributeView=new e}destroy(){super.destroy(),this.children.forEach(e=>e.destroy()),this.removeAllChildren(),this.attributeView.destroy()}doRender(e){e.context.capabilities.enable("textureFloatLinear"),super.doRender(e)}get hasAnimations(){for(const e of this.children)if(e.hasAnimations)return!0;return!1}_reindexAndUpdateFeaturesIfNeeded(){if(this.hasAnimations&&(this._reindexFeatures(),0!==this.attributeView.size))for(const e of this._entityIndex.values())e.dirty&&(this.attributeView.setData(e.displayId,7,0,e.firstIndexed),e.dirty=!1)}restartAnimation(e){const t=this._entityIndex.get(e);if(!t)return;const i=performance.now()/1e3;t.firstIndexed=i,t.dirty=!0}restartAllAnimations(){const e=performance.now()/1e3;for(const[t,i]of this._entityIndex)i.firstIndexed=e,i.dirty=!0}_reindexFeatures(){const e=performance.now()/1e3;for(const t of this.children)for(const i of t.entityIds){const{objectId:t}=i;let s=this._entityIndex.get(t);s||(s={objectId:t,displayId:0,firstIndexed:e,lastIndexed:0,dirty:!0},this._entityIndex.set(t,s)),s.lastIndexed=e,s.displayId=i.displayId}for(const[t,s]of this._entityIndex)e-s.lastIndexed>i&&this._entityIndex.delete(t)}_updateAttributeView(){this.attributeView.update()&&(this.requestRender(),this.hasLabels&&this.requestDeclutter()),this._reindexAndUpdateFeaturesIfNeeded()}createRenderParams(e){const t=super.createRenderParams(e);return t.attributeView=this.attributeView,t.instanceStore=this._instanceStore,t.statisticsByLevel=this._statisticsByLevel,t}}export{s as AFeatureContainer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{estimateNumberArrayMemory as i}from"../../../../core/memoryEstimations.js";import{signal as s}from"../../../../core/signal.js";import{dataDrivenUnit2 as r,dataDrivenUnit1 as a,dataDrivenUnit0 as n,visualVariableUnit as u,localTimeOriginUnit as h,gpgpuUnit as o,animationUnit as d,filterFlagsUnit as l}from"./definitions.js";import{getDisplayIdTexel as g}from"./DisplayId.js";import{getPixelArrayCtor as p,getPixelBytes as _}from"./Utils.js";import{SizedPixelFormat as c}from"../../../webgl/enums.js";import{DisposableFramebufferObject as x}from"../../../webgl/FramebufferObject.js";import f from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const m=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class T{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:a}=t,n=p(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=a,a||(this.data=new n(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b(this.size);if(t.wrapMode=33071,t.samplingMode=9728,t.dataType=this.pixelType,2===this.blockIndex)t.pixelFormat=6403,t.internalFormat=c.R8;return t}get usedMemory(){return null!=this.data?i(this.data):0}setData(t,e,i){const s=g(t),r=this.data,a=s*this.texelSize+e;!r||a>=r.length||(r[a]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=g(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const a=this.data.buffer,n=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,d=h,l=this.size,g=o,_=h*this.size*u,c=(l+g*this.size)*u-_,x=p(this.pixelType),f=new x(a,_*x.BYTES_PER_ELEMENT,c),b=this.size,T=g-d+1;if(T>this.size)return void m().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));n.updateData(0,0,d,b,T,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const a=1<<i%this.texelSize;t.layout&a&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=p(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,n=this.getFBO(t),u=_(r),h=new(p(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.boundFramebuffer,{x:d,y:l,width:g,height:c}=t.getViewport();t.bindFramebuffer(n),n.readPixels(0,0,i,s,a,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(d,l,g,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._hasPendingUpdate=s(!1),this._locked=!1}get updating(){return this._hasPendingUpdate.value}get locked(){return this._locked}get usedMemory(){let t=0;for(const e of this._data??[])null!=e&&(t+=e.usedMemory);return t}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map((t,e)=>null!=t?new T(t,this.size,e):null);else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new T(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,0,1,e)}setLocalTimeOrigin(t,e){this.setData(t,7,0,e)}getLabelMinZoom(t){return this.getData(t,0,1,255)}getFilterFlags(t){return this.getData(t,0,0,0)}getVisualVariableData(t,e){return this.getData(t,3,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const a=r.getData(t,i);return null!=a?a:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),this._hasPendingUpdate.value=!0,has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return!1;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];const e=!!t.length;for(const i of t){const{blockData:t,initArgs:e,sendUpdateEpoch:s,version:r}=i;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=e&&this._initialize(e);const a=this._data;for(let i=0;i<t.length;i++){const e=t[i],s=a[i];null!=s&&null!=e&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${i}] AttributeStoreView.update`,{block:e}),s.update(e))}}return this._hasPendingUpdate.value=!1,e}getUniforms(){return{size:this.size}}getTextures(t){return{filterFlags:{texture:this._getTexture(t,0),unit:l},animation:{texture:this._getTexture(t,1),unit:d},gpgpu:{texture:this._getTexture(t,2),unit:o},localTimeOrigin:{texture:this._getTexture(t,7),unit:h},visualVariableData:{texture:this._getTexture(t,3),unit:u},dataDriven0:{texture:this._getTexture(t,4),unit:n},dataDriven1:{texture:this._getTexture(t,5),unit:a},dataDriven2:{texture:this._getTexture(t,6),unit:r}}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b(1);e.wrapMode=33071,e.samplingMode=9728,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
2
+ import t from"../../../../core/Error.js";import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{estimateNumberArrayMemory as i}from"../../../../core/memoryEstimations.js";import{signal as s}from"../../../../core/signal.js";import{dataDrivenUnit2 as r,dataDrivenUnit1 as n,dataDrivenUnit0 as a,visualVariableUnit as u,localTimeOriginUnit as h,gpgpuUnit as o,animationUnit as d,filterFlagsUnit as l}from"./definitions.js";import{getDisplayIdTexel as g}from"./DisplayId.js";import{getPixelArrayCtor as p,getPixelBytes as _}from"./Utils.js";import{SizedPixelFormat as c}from"../../../webgl/enums.js";import{DisposableFramebufferObject as x}from"../../../webgl/FramebufferObject.js";import f from"../../../webgl/Texture.js";import{TextureDescriptor as b}from"../../../webgl/TextureDescriptor.js";const m=()=>e.getLogger("esri.views.2d.engine.webgl.AttributeStoreView");class T{constructor(t,e,i){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;const{buffer:s,pixelType:r,textureOnly:n}=t,a=p(r);this.blockIndex=i,this.pixelType=r,this.size=e,this.textureOnly=n,n||(this.data=new a(s)),this._resetRange()}destroy(){this._texture?.dispose();for(const t in this._fbos){const e=this._fbos[t];e&&("0"===t&&e.detachColorTexture(),e.dispose()),this._fbos[t]=null}this._texture=null}get _textureDesc(){const t=new b(this.size);if(t.wrapMode=33071,t.samplingMode=9728,t.dataType=this.pixelType,2===this.blockIndex)t.pixelFormat=6403,t.internalFormat=c.R8;return t}get usedMemory(){return null!=this.data?i(this.data):0}setData(t,e,i){const s=g(t),r=this.data,n=s*this.texelSize+e;!r||n>=r.length||(r[n]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s))}getData(t,e){if(null==this.data)return null;const i=g(t)*this.texelSize+e;return!this.data||i>=this.data.length?null:this.data[i]}getTexture(t){return this._texture??this._initTexture(t)}getFBO(t,e=0){if(!this._fbos[e]){const i=0===e?this.getTexture(t):this._textureDesc;this._fbos[e]=new x(t,i)}return this._fbos[e]}get hasDirty(){const t=this.dirtyStart;return this.dirtyEnd>=t}updateTexture(e,i){try{const s=this.dirtyStart,r=this.dirtyEnd;if(!this.hasDirty)return;has("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStoreView.updateTexture`,{start:s,end:r,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();const n=this.data.buffer,a=this.getTexture(e),u=4,h=(s-s%this.size)/this.size,o=(r-r%this.size)/this.size,d=h,l=this.size,g=o,_=h*this.size*u,c=(l+g*this.size)*u-_,x=p(this.pixelType),f=new x(n,_*x.BYTES_PER_ELEMENT,c),b=this.size,T=g-d+1;if(T>this.size)return void m().error(new t("mapview-webgl","Out-of-bounds index when updating AttributeData"));a.updateData(0,0,d,b,T,f)}catch(s){}}update(t){const{data:e,start:i,end:s}=t;if(null!=e&&null!=this.data){const s=this.data,r=i*this.texelSize;for(let i=0;i<e.length;i++){const n=1<<i%this.texelSize;t.layout&n&&(s[r+i]=e[i])}}this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,s)}resize(t,e){const i=this.size;if(this.size=e,this.textureOnly)return void(i!==this.size&&(this._lastTexture=this._texture,this._texture=null));const s=p(this.pixelType);this.destroy(),this.data=new s(t.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(t){const e=new f(t,this._textureDesc,this.data??void 0);if(null!=this._lastTexture&&this._fbos[0]){const i=this._lastTexture.descriptor.width,s=this._lastTexture.descriptor.height,r=this._lastTexture.descriptor.dataType,n=this._lastTexture.descriptor.pixelFormat,a=this.getFBO(t),u=_(r),h=new(p(r))(new ArrayBuffer(i*s*u*this.texelSize)),o=t.boundFramebuffer,{x:d,y:l,width:g,height:c}=t.getViewport();t.bindFramebuffer(a),a.readPixels(0,0,i,s,n,r,h),e.updateData(0,0,0,2*i,s/2,h),t.setViewport(d,l,g,c),t.bindFramebuffer(o)}return this.destroy(),this._texture=e,this._texture}}class y{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._hasPendingUpdate=s(!1),this._locked=!1}get updating(){return this._hasPendingUpdate.value}get locked(){return this._locked}get usedMemory(){let t=0;for(const e of this._data??[])null!=e&&(t+=e.usedMemory);return t}_initialize(t){if(!t)throw new Error("InternalError: initArgs must be defined");const e=t.blockDescriptors;if(this.size=t.blockSize,has("esri-2d-update-debug")&&console.debug("AttributeStoreView.initialize",{message:t}),null==this._data)this._data=e.map((t,e)=>null!=t?new T(t,this.size,e):null);else for(let i=0;i<this._data.length;i++){const t=this._data[i],s=e[i];null!=s&&(null==t?this._data[i]=new T(s,this.size,i):t.resize(s,this.size))}}destroy(){for(const t of this._data??[])t?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return null==this._data}getBlock(t){if(null==this._data)return null;return this._data[t]}setLabelMinZoom(t,e){this.setData(t,0,1,e)}setLocalTimeOrigin(t,e){this.setData(t,7,0,e)}getLabelMinZoom(t){return this.getData(t,0,1,255)}getFilterFlags(t){return this.getData(t,0,0,0)}getVisualVariableData(t,e){return this.getData(t,3,e,0)}getData(t,e,i,s){if(!this._data)return 0;const r=this._data[e];if(null==r)return 0;const n=r.getData(t,i);return null!=n?n:s}setData(t,e,i,s){this._data[e].setData(t,i,s)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){return this._locked=!1,this.update()}requestUpdate(t){this._version=t.version,this._pendingAttributeUpdates.push(t),this._hasPendingUpdate.value=!0,has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:t})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return!1;const t=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];const e=!!t.length;for(const i of t){const{blockData:t,initArgs:e,sendUpdateEpoch:s,version:r}=i;has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] Epoch[${s}] AttributeStoreView.applyUpdate`),this._version=r,this._epoch=s,null!=e&&this._initialize(e);const n=this._data;for(let i=0;i<t.length;i++){const e=t[i],s=n[i];null!=s&&null!=e&&(has("esri-2d-update-debug")&&console.debug(`Version[${this._version}] CpuBlock[${i}] AttributeStoreView.update`,{block:e}),s.update(e))}}return this._hasPendingUpdate.value=!1,e}getUniforms(){return{size:this.size}}getTextures(t){return{filterFlags:{texture:this._getTexture(t,0),unit:l},animation:{texture:this._getTexture(t,1),unit:d},gpgpu:{texture:this._getTexture(t,2),unit:o},localTimeOrigin:{texture:this._getTexture(t,7),unit:h},visualVariableData:{texture:this._getTexture(t,3),unit:u},dataDriven0:{texture:this._getTexture(t,4),unit:a},dataDriven1:{texture:this._getTexture(t,5),unit:n},dataDriven2:{texture:this._getTexture(t,6),unit:r}}}_getTexture(t,e){const i=this._data?.[e];return i?(i.updateTexture(t,this._version),i.getTexture(t)):this._getDefaultTexture(t)}_getDefaultTexture(t){if(null==this._defaultTexture){const e=new b(1);e.wrapMode=33071,e.samplingMode=9728,this._defaultTexture=new f(t,e,new Uint8Array(4))}return this._defaultTexture}}export{y as AttributeStoreView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{fromRotation as t,multiply as e,translate as s,rotate as i}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as h}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as a,getYAnchorDirection as f}from"../../alignmentUtils.js";import c from"../../Rect.js";import l from"../../collisions/BoundingBox.js";const d=22,g=4,m=d+g,u=d-6,x=Math.PI/180,p=8,_=1.5;class w{constructor(t,e,s,i){this._rotationT=n(),this._transform=n(),this._angle=0,this._bounds=null;const{mosaicItem:o,rect:h,shaping:r,code:a}=s,f=o.rect;this.width=0===a?h.width:f.width*i,this.height=0===a?h.height:f.height*i,this.x=i*(t+r.xOffset+h.left),this.y=i*(e+r.yOffset-h.top),this.textureBinding=o.textureBinding,this.texcoords={topLeft:[f.x,f.y],topRight:[f.x+f.width,f.y],bottomLeft:[f.x,f.y+f.height],bottomRight:[f.x+f.width,f.y+f.height]}}set angle(e){this._angle=e,t(this._rotationT,-e),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){const{x:s,y:i,width:h,height:r}=this,a=t(n(),-this.angle),f=e(n(),a,this._transform);this._offsets={topLeft:o([0,0],[s,i],f),topRight:o([0,0],[s+h,i],f),bottomLeft:o([0,0],[s,i+r],f),bottomRight:o([0,0],[s+h,i+r],f)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){const t=this.offsets;let e=1/0,s=1/0,i=-1/0,n=-1/0;for(const[f,c]of[t.topLeft,t.topRight,t.bottomLeft,t.bottomRight])e=Math.min(e,f),s=Math.min(s,c),i=Math.max(i,f),n=Math.max(n,c);const o=i-e,h=n-s,r=e+o/2,a=s+h/2;this._bounds=new l(r,a,o,h)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}}const y=(t,e)=>({code:0,mosaicItem:{rect:new c(0,0,11,8),sdf:!0,page:0,textureBinding:e},rect:{height:4,width:t,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function b(t,e){return t.forEach(t=>o(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class M{constructor(t,e,s,i){this._rotation=0,this._decorate(t,e,s,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==s.angle,this._transform=this._createGlyphTransform(this.bounds,s),this._borderLineSizePx=s.borderLineSizePx,(s.borderLineSizePx||s.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const n of t)n.setTransform(this._transform)}setRotation(s){if(0===s&&0===this._rotation)return;this._rotation=s;const i=this._transform,o=t(n(),s);e(i,o,i);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,e,s,i){if(!s.decoration||"none"===s.decoration||!t.length)return;const n=s.scale,o="underline"===s.decoration?i?.baseline??m:i?.midline??u,h=t[0].textureBinding;for(const r of e){const e=r.startX*n,s=r.startY*n,i=(r.width+r.glyphWidthEnd)*n;t.push(new w(e,s+o*n,y(i,h),1))}}shapeBackground(t){const e=this._borderLineSizePx||0,s=(_+e)/2,i=this._borderLineSizePx?s:0,{xmin:n,ymin:o,xmax:h,ymax:r,x:a,y:f,width:c,height:d}=this.bounds,g=[n-p,o-p],m=[h+p,o-p],u=[n-p,r+p],x=[h+p,r+p],w=b([[g[0]-s,g[1]-s],[m[0]+s,m[1]-s],[g[0]+i,g[1]+i],[m[0]-i,m[1]+i]],t),y=b([[u[0]+i,u[1]-i],[x[0]-i,x[1]-i],[u[0]-s,u[1]+s],[x[0]+s,x[1]+s]],t),M=b([[g[0]-s,g[1]-s],[g[0]+i,g[1]+i],[u[0]-s,u[1]+s],[u[0]+i,u[1]-i]],t),L=b([[m[0]-i,m[1]+i],[m[0]+s,m[1]-s],[x[0]-i,x[1]-i],[x[0]+s,x[1]+s]],t),A={main:b([g,m,u,x],t),top:w,bot:y,left:M,right:L};return[new l(a,f,c+2*s,d+2*s),A]}get boundsT(){const t=this.bounds,e=h(r(),t.x,t.y);if(o(e,e,this._transform),this._hasRotation){const s=Math.max(t.width,t.height);return new l(e[0],e[1],s,s)}return new l(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,s=1/0,i=0,n=0;for(const r of t)e=Math.min(e,r.offsets.topLeft[0]),s=Math.min(s,r.offsets.topLeft[1]),i=Math.max(i,r.offsets.bottomRight[0]),n=Math.max(n,r.offsets.bottomRight[1]);const o=i-e,h=n-s;return new l(e+o/2,s+h/2,o,h)}_createGlyphTransform(t,e){const o=x*e.angle,a=n(),f=r();return s(a,a,h(f,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?i(a,a,o):(s(a,a,h(f,t.x,t.y)),i(a,a,o),s(a,a,h(f,-t.x,-t.y))),a}}class L{constructor(t,e,s,i,n,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,s)),this.end=Math.max(0,Math.max(e,s)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].rect.width),this.width=i,this.yMin=n,this.yMax=o}}const A=t=>10===t,R=t=>32===t;function v(t,e,s){const i=new Array,n=1/s.scale,o=s.maxLineWidth*n,h=e?t.length-1:0,r=e?-1:t.length,a=e?-1:1;let f=h,c=0,l=0,d=f,g=d,m=0,u=1/0,x=0;for(;f!==r;){const{code:e,rect:s,shaping:n}=t[f],r=Math.abs(s.top);if(A(e)||R(e)||(u=Math.min(u,r),x=Math.max(x,r+s.height)),A(e))f!==h&&(i.push(new L(t,d,f-a,c,u===1/0?0:u,x)),u=1/0,x=0),c=0,d=f+a,g=f+a,l=0;else if(R(e))g=f+a,l=0,m=n.xAdvance,c+=n.xAdvance;else if(c>o){if(g!==d){const e=g-2*a;c-=m,i.push(new L(t,d,e,c-l,u,x)),u=1/0,x=0,d=g,c=l}else i.push(new L(t,d,f-a,c,u,x)),u=1/0,x=0,d=f,g=f,c=0;c+=n.xAdvance,l+=n.xAdvance}else c+=n.xAdvance,l+=n.xAdvance;f+=a}const p=new L(t,d,f-a,c,u,x);return p.start>=0&&p.end<t.length&&i.push(p),i}function B(t,e){let s=0;for(let o=0;o<t.length;o++){const{width:e}=t[o];s=Math.max(e,s)}const i="underline"===e.decoration?g:0,n=t[0].yMin;return{x:0,y:n,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+i-n,width:s}}function T(t,e,s){let i=0;for(let n=e;n<s;n++)R(t[n].code)&&!A(t[n+1].code)&&i++;return i}function j(t,e){const s=e.scale,i=new Array,n=t.sdfPadding,{faceInfo:o,glyphs:h,isRightToLeft:r}=t,c="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,l=v(h,r,e),g=l.length?B(l,e):{y:0,height:0,width:0},m=c?r?1:-1:a(e.horizontalAlignment),u=f(e.verticalAlignment),x=2===u?1:0,p=x?0:u-1,_=o?.baseline??d,y=l.length>1,b=x?y?-g.y-g.height:-_:-g.y+p*(g.height/2);for(let a=0;a<l.length;a++){const{start:o,end:r,width:f}=l[a],d=c&&a<l.length-1?T(h,o,r):0,u=d>0?(g.width-f)/d:0;let x=-1*(m+1)*((u>0?g.width:f)/2)-n;const p=(t.isRightToLeft?l.length-1-a:a)*e.lineHeight+b-n;l[a].startX=x,l[a].startY=p;for(let t=o;t<=r;t++){const e=h[t];if(A(e.code))continue;const n=new w(x,p,e,s);x+=e.shaping.xAdvance,u>0&&R(e.code)&&(x+=u),i.push(n)}}return new M(i,l,e,o)}function z(t,e){const s=e.scale,{faceInfo:i,glyphs:n}=t,o=n.map(t=>new w(0,0,t,s));return new M(o,[],e,i)}export{w as ShapedGlyph,M as ShapingInfo,j as shapeGlyphs,z as shapeGlyphsForMultipoint};
2
+ import{fromRotation as t,multiply as e,translate as i,rotate as s}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as h}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as a,getYAnchorDirection as f}from"../../alignmentUtils.js";import c from"../../Rect.js";import d from"../../collisions/BoundingBox.js";const l=22,g=4,m=l+g,u=l-6,x=Math.PI/180,p=8,w=1.5;class _{constructor(t,e,i,s){this._rotationT=n(),this._transform=n(),this._angle=0,this._bounds=null;const{mosaicItem:o,rect:h,shaping:r,code:a}=i,f=o.rect;this.width=0===a?h.width:f.width*s,this.height=0===a?h.height:f.height*s,this.x=s*(t+r.xOffset+h.left),this.y=s*(e+r.yOffset-h.top),this.textureBinding=o.textureBinding,this.texcoords={topLeft:[f.x,f.y],topRight:[f.x+f.width,f.y],bottomLeft:[f.x,f.y+f.height],bottomRight:[f.x+f.width,f.y+f.height]}}set angle(e){this._angle=e,t(this._rotationT,-e),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){const{x:i,y:s,width:h,height:r}=this,a=t(n(),-this.angle),f=e(n(),a,this._transform);this._offsets={topLeft:o([0,0],[i,s],f),topRight:o([0,0],[i+h,s],f),bottomLeft:o([0,0],[i,s+r],f),bottomRight:o([0,0],[i+h,s+r],f)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){const t=this.offsets;let e=1/0,i=1/0,s=-1/0,n=-1/0;for(const[f,c]of[t.topLeft,t.topRight,t.bottomLeft,t.bottomRight])e=Math.min(e,f),i=Math.min(i,c),s=Math.max(s,f),n=Math.max(n,c);const o=s-e,h=n-i,r=e+o/2,a=i+h/2;this._bounds=new d(r,a,o,h)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}}const y=(t,e)=>({code:0,mosaicItem:{rect:new c(0,0,11,8),sdf:!0,page:0,textureBinding:e},rect:{height:4,width:t,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function b(t,e){return t.forEach(t=>o(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class M{constructor(t,e,i,s){this._rotation=0,this._decorate(t,e,i,s),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==i.angle,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSizePx=i.borderLineSizePx,(i.borderLineSizePx||i.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const n of t)n.setTransform(this._transform)}setRotation(i){if(0===i&&0===this._rotation)return;this._rotation=i;const s=this._transform,o=t(n(),i);e(s,o,s);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,e,i,s){if(!i.decoration||"none"===i.decoration||!t.length)return;const n=i.scale,o="underline"===i.decoration?s?.baseline??m:s?.midline??u,h=t[0].textureBinding;for(const r of e){const e=r.startX*n,i=r.startY*n,s=(r.width+r.glyphWidthEnd)*n;t.push(new _(e,i+o*n,y(s,h),1))}}shapeBackground(t){const e=this._borderLineSizePx||0,i=(w+e)/2,s=this._borderLineSizePx?i:0,{xmin:n,ymin:o,xmax:h,ymax:r,x:a,y:f,width:c,height:l}=this.bounds,g=[n-p,o-p],m=[h+p,o-p],u=[n-p,r+p],x=[h+p,r+p],_=b([[g[0]-i,g[1]-i],[m[0]+i,m[1]-i],[g[0]+s,g[1]+s],[m[0]-s,m[1]+s]],t),y=b([[u[0]+s,u[1]-s],[x[0]-s,x[1]-s],[u[0]-i,u[1]+i],[x[0]+i,x[1]+i]],t),M=b([[g[0]-i,g[1]-i],[g[0]+s,g[1]+s],[u[0]-i,u[1]+i],[u[0]+s,u[1]-s]],t),L=b([[m[0]-s,m[1]+s],[m[0]+i,m[1]-i],[x[0]-s,x[1]-s],[x[0]+i,x[1]+i]],t),A={main:b([g,m,u,x],t),top:_,bot:y,left:M,right:L};return[new d(a,f,c+2*i,l+2*i),A]}get boundsT(){const t=this.bounds,e=h(r(),t.x,t.y);if(o(e,e,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new d(e[0],e[1],i,i)}return new d(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,i=1/0,s=0,n=0;for(const r of t)e=Math.min(e,r.offsets.topLeft[0]),i=Math.min(i,r.offsets.topLeft[1]),s=Math.max(s,r.offsets.bottomRight[0]),n=Math.max(n,r.offsets.bottomRight[1]);const o=s-e,h=n-i;return new d(e+o/2,i+h/2,o,h)}_createGlyphTransform(t,e){const o=x*e.angle,a=n(),f=r();return i(a,a,h(f,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?s(a,a,o):(i(a,a,h(f,t.x,t.y)),s(a,a,o),i(a,a,h(f,-t.x,-t.y))),a}}class L{constructor(t,e,i,s,n,o){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,i)),this.end=Math.max(0,Math.max(e,i)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].rect.width),this.width=s,this.yMin=n,this.yMax=o}}const A=t=>10===t,R=t=>32===t;function v(t,e,i){const s=new Array,n=1/i.scale,o=i.maxLineWidth*n,h=e?t.length-1:0,r=e?-1:t.length,a=e?-1:1;let f=h,c=0,d=0,l=f,g=l,m=0,u=1/0,x=0;for(;f!==r;){const{code:e,rect:i,shaping:n}=t[f],r=Math.abs(i.top);if(A(e)||R(e)||(u=Math.min(u,r),x=Math.max(x,r+i.height)),A(e))f!==h&&(s.push(new L(t,l,f-a,c,u===1/0?0:u,x)),u=1/0,x=0),c=0,l=f+a,g=f+a,d=0;else if(R(e))g=f+a,d=0,m=n.xAdvance,c+=n.xAdvance;else if(c>o){if(g!==l){const e=g-2*a;c-=m,s.push(new L(t,l,e,c-d,u,x)),u=1/0,x=0,l=g,c=d}else s.push(new L(t,l,f-a,c,u,x)),u=1/0,x=0,l=f,g=f,c=0;c+=n.xAdvance,d+=n.xAdvance}else c+=n.xAdvance,d+=n.xAdvance;f+=a}const p=new L(t,l,f-a,c,u,x);return p.start>=0&&p.end<t.length&&s.push(p),s}function B(t,e){let i=0;for(let o=0;o<t.length;o++){const{width:e}=t[o];i=Math.max(e,i)}const s="underline"===e.decoration?g:0,n=t[0].yMin;return{x:0,y:n,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+s-n,width:i}}function T(t,e,i){let s=0;for(let n=e;n<i;n++)R(t[n].code)&&!A(t[n+1].code)&&s++;return s}function j(t,e){const i=e.scale,s=new Array,n=t.sdfPadding,{faceInfo:o,glyphs:h,isRightToLeft:r}=t,c="justify"===e.horizontalAlignment||"Justify"===e.horizontalAlignment,d=v(h,r,e),g=d.length?B(d,e):{y:0,height:0,width:0},m=c?r?1:-1:a(e.horizontalAlignment),u=f(e.verticalAlignment),x=2===u?1:0,p=x?0:u-1,w=o?.baseline??l,y=d.length>1,b=x?y?-g.y-g.height:-w:-g.y+p*(g.height/2);for(let a=0;a<d.length;a++){const{start:o,end:r,width:f}=d[a],l=c&&a<d.length-1?T(h,o,r):0,u=l>0?(g.width-f)/l:0;let x=-1*(m+1)*((u>0?g.width:f)/2)-n;const p=(t.isRightToLeft?d.length-1-a:a)*e.lineHeight+b-n;d[a].startX=x,d[a].startY=p;for(let t=o;t<=r;t++){const e=h[t];if(A(e.code))continue;const n=new _(x,p,e,i);x+=e.shaping.xAdvance,u>0&&R(e.code)&&(x+=u),s.push(n)}}return new M(s,d,e,o)}function z(t,e){const i=e.scale,{faceInfo:s,glyphs:n}=t,o=n.reduce((t,e)=>Math.max(t,e.rect.height),0),h=n.map(t=>new _(-t.rect.width/2,-o,t,i));return new M(h,[],e,s)}export{_ as ShapedGlyph,M as ShapingInfo,j as shapeGlyphs,z as shapeGlyphsForMultipoint};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as i}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as s}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as o}from"../../../definitions.js";import{AAnimatedMeshWriter as n}from"./AnimatedMeshWriter.js";import{angle as a,sizing as c,animationPointerAndBaseSizeAndReferenceSize as l,uv as m,offset as d,pos as h,bitset as p,id as u,lineLength as f,value1Position2Value2 as y,zoomRange as x}from"./attributes.js";import{createComputedAnimatedMeshParams as M}from"./ComputedAnimatedParams.js";const P=64,g=64,v=2;class b extends n{get vertexSpec(){return{createComputedParams:M,optionalAttributes:{zoomRange:x,value1Position2Value2:y,lineLength:f},attributes:{id:u,bitset:p,pos:h,offset:d.marker,uv:m.marker,animationPointerAndBaseSizeAndReferenceSize:l,sizing:c,angle:a}}}_write(e,{target:i,effectGeometry:s}){const r=this.evaluatedMeshParams.sprite,{textureBinding:o}=r;e.recordStart(this.instanceId,this.attributeLayout,o);const n=i.getDisplayId();if(this.shift&&"esriGeometryPolyline"===i.geometryType){if(!s){const s=t.fromFeatureSetReaderCIM(i);s&&this._writeParticles(e,i,s)}}else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,i);else if("esriGeometryPolygon"===i.geometryType){const t=i.readCentroidForDisplay();if(!t)return;const[s,r]=t.coords;this._writeQuad(e,n,s,r)}else if("esriGeometryPoint"===i.geometryType){const t=i.readXForDisplay(),s=i.readYForDisplay();this._writeQuad(e,n,t,s)}else{const t=i.readGeometryForDisplay();t&&t.forEachVertex((t,i)=>{this._writeQuad(e,n,t,i)})}e.recordEnd()}_writePlacedMarkers(i,o){const n=t.fromFeatureSetReaderCIM(o)?.clone();if(!n)return;const a=-1,c=r.getPlacement(n,a,this.evaluatedMeshParams.placement,e(1),i.id);if(!c)return;const l=o.getDisplayId();let m=c.next(),d=null;for(;null!=m;){const e=m.tx,t=-m.ty;if(Math.abs(e)>s||Math.abs(t)>s){m=c.next();continue}const r=-m.getAngle();i.recordBounds(e,t,P,g),this.shift?d&&this._writeQuad(i,l,d[0],d[1],void 0,r):this._writeQuad(i,l,e,t,void 0,r),d=[e,t],m=c.next()}}_writeParticles(e,t,s){const r=t.getDisplayId(),o=Math.max(this.evaluatedMeshParams.baseSize,this.evaluatedMeshParams.baseSize),n=i(s,2*o,!1);if(n)for(;n.nextPath();){const t=[];for(;n.nextPoint();)t.push([n.x,n.y]);const i=w(t);let s=0;for(let e=1;e<t.length;e++){const i=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1],o=Math.sqrt(i*i+r*r);s+=o}const o=t=>{for(const o of i){const{a:i,b:n}=o;this._writeQuad(e,r,i.position[0],i.position[1],[i.distance-t,n.position[0],n.position[1],n.distance-t],this.evaluatedMeshParams.angleToLine?Math.atan2(i.direction[1],i.direction[0]):0,s,!0)}},{placement:a}=this.evaluatedMeshParams;if(!a||"placementTemplate"in a||"CIMMarkerPlacementOnVertices"===a.type){let e;if(a&&"CIMMarkerPlacementOnVertices"!==a.type)e=a.placementTemplate;else{e=[0];for(const t of i){const{a:i,b:s}=t,r=i.position[0]-s.position[0],o=i.position[1]-s.position[1],n=Math.sqrt(r*r+o*o);e.push(n)}}let t=-1*s;for(;t<(1+v/2)*s;)for(const i of e)t+=i,o(t)}else"CIMMarkerPlacementAtExtremities"===a.type?"JustBegin"===a.extremityPlacement?o(1):"JustEnd"===a.extremityPlacement?(o(s-1),o(-1)):"Both"===a.extremityPlacement&&(o(1),o(s-1)):"CIMMarkerPlacementOnLine"===a.type&&("LineBeginning"===a.relativeTo?o(1):"LineEnd"===a.relativeTo?(o(s-1),o(-1)):"LineMiddle"===a.relativeTo&&o(s/2))}}_writeQuad(e,t,i,s,r,n=0,a=0,c=!1){const l=this.evaluatedMeshParams.sprite,{rect:m}=l,d=m.x+o,h=m.y+o,p=m.x+m.width-o,u=m.y+m.height-o,f=e.vertexCount();c||e.recordBounds(i,s,P,P);const y={texXmin:d,texYmin:h,texXmax:p,texYmax:u,value1Position2Value2:r,angle:n,lineLength:a};for(let o=0;o<4;o++)this._writeVertex(e,t,i,s,y);e.indexEnsureSize(6),e.indexWrite(f),e.indexWrite(f+1),e.indexWrite(f+2),e.indexWrite(f+1),e.indexWrite(f+3),e.indexWrite(f+2)}}function w(e){const t=[];let i=0;for(let s=1;s<e.length;s++){const r=e[s-1],o=e[s],n=o[0]-r[0],a=o[1]-r[1],c=Math.sqrt(n*n+a*a),l=n/c,m=a/c;t.push({a:{position:r,distance:i,direction:[l,m]},b:{position:o,distance:i+c,direction:[l,m]}}),i+=c}return t}class C extends b{constructor(){super(...arguments),this.shift=!1}}class _ extends b{constructor(){super(...arguments),this.shift=!0}}export{C as AnimatedMarkerMeshWriter,_ as AnimatedMarkerShiftMeshWriter};
2
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as i}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as s}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as n}from"../../../definitions.js";import{AAnimatedMeshWriter as o}from"./AnimatedMeshWriter.js";import{angle as a,sizing as c,animationPointerAndBaseSizeAndReferenceSize as l,uv as m,offset as d,pos as p,bitset as h,id as u,lineLength as f,value1Position2Value2 as x,zoomRange as y}from"./attributes.js";import{createComputedAnimatedMeshParams as P}from"./ComputedAnimatedParams.js";const M=64,g=64,v=2;class b extends o{get vertexSpec(){return{createComputedParams:P,optionalAttributes:{zoomRange:y,value1Position2Value2:x,lineLength:f},attributes:{id:u,bitset:h,pos:p,offset:d.marker,uv:m.marker,animationPointerAndBaseSizeAndReferenceSize:l,sizing:c,angle:a}}}_write(e,{target:i,effectGeometry:s}){const r=this.evaluatedMeshParams.sprite,{textureBinding:n}=r;e.recordStart(this.instanceId,this.attributeLayout,n);const o=i.getDisplayId();if(this.shift&&"esriGeometryPolyline"===i.geometryType){if(!s){const s=t.fromFeatureSetReaderCIM(i);s&&this._writeParticles(e,i,s)}}else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,i);else if("esriGeometryPolygon"===i.geometryType){const t=i.readCentroidForDisplay();if(!t)return;const[s,r]=t.coords;this._writeQuad(e,o,s,r)}else if("esriGeometryPoint"===i.geometryType){const t=i.readXForDisplay(),s=i.readYForDisplay();this._writeQuad(e,o,t,s)}else{const t=i.readGeometryForDisplay();t&&t.forEachVertex((t,i)=>{this._writeQuad(e,o,t,i)})}e.recordEnd()}_writePlacedMarkers(i,n){const o=t.fromFeatureSetReaderCIM(n)?.clone();if(!o)return;const a=-1,c=r.getPlacement(o,a,this.evaluatedMeshParams.placement,e(1),i.id);if(!c)return;const l=n.getDisplayId();let m=c.next(),d=null;for(;null!=m;){const e=m.tx,t=-m.ty;if(Math.abs(e)>s||Math.abs(t)>s){m=c.next();continue}const r=-m.getAngle();i.recordBounds(e,t,M,g),this.shift?d&&this._writeQuad(i,l,d[0],d[1],void 0,r):this._writeQuad(i,l,e,t,void 0,r),d=[e,t],m=c.next()}}_writeParticles(e,t,s){const r=t.getDisplayId(),n=Math.max(this.evaluatedMeshParams.baseSize,this.evaluatedMeshParams.baseSize),o=i(s,2*n,!1);if(!o)return;const{placement:a}=this.evaluatedMeshParams,c=w(o,a?.placePerPart??!1);for(const{particles:i,distance:l}of c){const t=t=>{for(const s of i){const{a:i,b:n}=s;this._writeQuad(e,r,i.position[0],i.position[1],[i.distance-t,n.position[0],n.position[1],n.distance-t],this.evaluatedMeshParams.angleToLine?Math.atan2(i.direction[1],i.direction[0]):0,l,!0)}};if(!a||"placementTemplate"in a||"CIMMarkerPlacementOnVertices"===a.type){let e;if(a&&"CIMMarkerPlacementOnVertices"!==a.type)e=a.placementTemplate;else{e=[0];for(const t of i){const{a:i,b:s}=t,r=i.position[0]-s.position[0],n=i.position[1]-s.position[1],o=Math.sqrt(r*r+n*n);e.push(o)}}let s=-1*l;for(;s<(1+v/2)*l;)for(const i of e)s+=i,t(s)}else"CIMMarkerPlacementAtExtremities"===a.type?"JustBegin"===a.extremityPlacement?t(1):"JustEnd"===a.extremityPlacement?(t(l-1),t(-1)):"Both"===a.extremityPlacement&&(t(1),t(l-1)):"CIMMarkerPlacementOnLine"===a.type&&("LineBeginning"===a.relativeTo?t(1):"LineEnd"===a.relativeTo?(t(l-1),t(-1)):"LineMiddle"===a.relativeTo&&t(l/2))}}_writeQuad(e,t,i,s,r,o=0,a=0,c=!1){const l=this.evaluatedMeshParams.sprite,{rect:m}=l,d=m.x+n,p=m.y+n,h=m.x+m.width-n,u=m.y+m.height-n,f=e.vertexCount();c||e.recordBounds(i,s,M,M);const x={texXmin:d,texYmin:p,texXmax:h,texYmax:u,value1Position2Value2:r,angle:o,lineLength:a};for(let n=0;n<4;n++)this._writeVertex(e,t,i,s,x);e.indexEnsureSize(6),e.indexWrite(f),e.indexWrite(f+1),e.indexWrite(f+2),e.indexWrite(f+1),e.indexWrite(f+3),e.indexWrite(f+2)}}function w(e,t){const i=[];if(t)for(;e.nextPath();){const t=[];for(;e.nextPoint();)t.push([e.x,e.y]);const s=[];let r=0;for(let e=1;e<t.length;e++){const i=t[e-1],n=t[e],o=n[0]-i[0],a=n[1]-i[1],c=Math.sqrt(o*o+a*a),l=o/c,m=a/c;s.push({a:{position:i,distance:r,direction:[l,m]},b:{position:n,distance:r+c,direction:[l,m]}}),r+=c}s.length>0&&i.push({particles:s,distance:r})}else{const t=[];let s=0;for(;e.nextPath();){const i=[];for(;e.nextPoint();)i.push([e.x,e.y]);for(let e=1;e<i.length;e++){const r=i[e-1],n=i[e],o=n[0]-r[0],a=n[1]-r[1],c=Math.sqrt(o*o+a*a),l=o/c,m=a/c;t.push({a:{position:r,distance:s,direction:[l,m]},b:{position:n,distance:s+c,direction:[l,m]}}),s+=c}}t.length>0&&i.push({particles:t,distance:s})}return i}class C extends b{constructor(){super(...arguments),this.shift=!1}}class _ extends b{constructor(){super(...arguments),this.shift=!0}}export{C as AnimatedMarkerMeshWriter,_ as AnimatedMarkerShiftMeshWriter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as m,processColorInput as u,getMinMaxZoom as d,getBitMask as p}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as f}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const x=3.14159265359/180,P=128/Math.PI;function g(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return g(e*P,256)}function k(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*x*-n),l}const v={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:M.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=p(f.bitset.isSDF)),1===t&&(a|=p(f.bitset.isMapAligned)),r&&(a|=p(f.bitset.scaleSymbolsProportionally)),o&&(a|=p(f.bitset.overrideOutlineColor)),s&&(a|=p(f.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[m(s,128),m(r,128),m(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends y{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:r}){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),l=Math.max(this.evaluatedMeshParams.computedHeight,a),m=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,u=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,d=this.evaluatedMeshParams.offsetX+m,p=-this.evaluatedMeshParams.offsetY+u;if(null!=this.evaluatedMeshParams.placement){let o=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(o=n(r,2*e,!1),null===o)return}this._writePlacedMarkers(e,t,o,i,l)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+d,o+p,i,l),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+d,a+p,i,l),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+d,o+p,i,l),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+d,r+p,i,l),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,s,t,r)})}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,u=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id);if(!u)return;const d=r.getDisplayId();let p=u.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{_ as MarkerMeshWriter,v as MarkerVertexSpec};
2
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as m,processColorInput as u,getMinMaxZoom as d,getBitMask as p}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as f}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const x=3.14159265359/180,P=128/Math.PI;function g(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return g(e*P,256)}function k(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*x*-n),l}const v={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:M.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=p(f.bitset.isSDF)),1===t&&(a|=p(f.bitset.isMapAligned)),r&&(a|=p(f.bitset.scaleSymbolsProportionally)),o&&(a|=p(f.bitset.overrideOutlineColor)),s&&(a|=p(f.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[m(s,128),m(r,128),m(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends y{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:r,scaleFactor:o}){const s=this.evaluatedMeshParams.sprite?.textureBinding,a=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,s);const i=this.evaluatedMeshParams.minPixelBuffer,l=Math.max(this.evaluatedMeshParams.computedWidth,i),m=Math.max(this.evaluatedMeshParams.computedHeight,i),u=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,d=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,p=this.evaluatedMeshParams.offsetX+u,h=-this.evaluatedMeshParams.offsetY+d;if(null!=this.evaluatedMeshParams.placement){let s=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(s=n(r,2*(e*(o??1)),!1),null===s)return}this._writePlacedMarkers(e,t,s,l,m)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+p,o+h,l,m),this._writeQuad(e,a,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,s]=r.coords;e.recordBounds(o+p,s+h,l,m),this._writeQuad(e,a,o,s)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+p,o+h,l,m),this._writeQuad(e,a,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+p,r+h,l,m),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,a,t,r)})}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,u=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id);if(!u)return;const d=r.getDisplayId();let p=u.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{_ as MarkerMeshWriter,v as MarkerVertexSpec};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t,__param as e}from"tslib";import{location as i,option as o,uniform as s,texture as l,input as r,ComputeVertexInput as a}from"../../GraphShaderModule.js";import{Vec4 as p,Vec2 as n,Float as u,Sampler2D as d,Vec3 as m,min as y,max as h,Mat3 as c,ifElse as x,lessThan as v,equal as w,texture2D as V,clamp as f,abs as S,mix as b,distance as g,greaterThan as C,negate as M}from"../../graph/glsl.js";import{MarkerConstants as z}from"./markerConstants.js";import{FeatureVertexInput as _,AFeatureShader as R,FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{c256ToRad as U,softEdgeRatio as N,trueHit as T,noHit as D}from"../shaders/constants.js";import{isRectHittest as F,hittestMarkerScreenRect as q,distPointTriangle as O,xyToBarycentric as k,inTriangle as A}from"../shaders/hittestUtils.js";import{MosaicInfo as P}from"../shaders/MosaicInfo.js";import{getBit as I,getBitBool as H,rgba2float as G}from"../shaders/utils.js";import{VisualVariableColor as L}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as J}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as K}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Q}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as W}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableOpacity as X,getVisualVariableColor as Y,getVisualVariableSize as Z,getVisualVariableRotation as $}from"../shaders/vvUtils.js";class tt extends _{}t([i(3,p)],tt.prototype,"color",void 0),t([i(4,p)],tt.prototype,"outlineColor",void 0),t([i(5,n)],tt.prototype,"offset",void 0),t([i(6,n)],tt.prototype,"textureUV",void 0),t([i(7,p)],tt.prototype,"sizing",void 0),t([i(8,u)],tt.prototype,"placementAngle",void 0),t([i(9,u)],tt.prototype,"sdfDecodeCoeff",void 0),t([i(10,n)],tt.prototype,"zoomRange",void 0);class et extends a{}t([i(11,n)],et.prototype,"offsetNextVertex1",void 0),t([i(12,n)],et.prototype,"offsetNextVertex2",void 0),t([i(13,n)],et.prototype,"textureUVNextVertex1",void 0),t([i(14,n)],et.prototype,"textureUVNextVertex2",void 0);class it extends j{}function ot(t,e,i,o){return e.multiply(t.x).add(i.multiply(t.y)).add(o.multiply(t.z))}function st(t){return t.multiply(t).divide(128)}class lt extends R{constructor(){super(...arguments),this.type="MarkerShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],textureUV:["textureUVNextVertex1","textureUVNextVertex2"]}}vertex(t,e){const i=st(t.sizing.x),o=st(t.sizing.y),s=st(t.sizing.z),l=t.placementAngle,r=I(t.bitset,z.bitset.isSDF),a=I(t.bitset,z.bitset.isMapAligned),n=I(t.bitset,z.bitset.scaleSymbolsProportionally),d=H(t.bitset,z.bitset.colorLocked),x=X(this,t.id),v=Y(this,t.id,t.color,d).multiply(x),w=this.view.displayViewScreenMat3.multiply(new m(t.pos.xy,1)),V=Z(this,t.id,s).divide(s),f=i.multiply(V),S=t.offset.xy.multiply(V);let b=o.multiply(n.multiply(V.subtract(1)).add(1));b=y(b,h(f.subtract(.99),new u(0)));const g=h(b,new u(1)),C=y(b,new u(1)),M=c.fromRotation(l.multiply(U)),_=$(this,t.id),R=this._getViewRotationMatrix(a).multiply(_).multiply(M).multiply(new m(S.xy,0)).multiply(this.view.scaleFactor),j=this.clip(t.id,t.zoomRange),N=new p(w.xy.add(R.xy),j,1),T=t.textureUV.divide(this.mosaicInfo.size),D=t.outlineColor.multiply(C),F=I(t.bitset,z.bitset.overrideOutlineColor),q=t.sdfDecodeCoeff.multiply(f);return{glPosition:N,color:v,textureUV:T,outlineColor:D,outlineSize:g,distanceToPx:q,isSDF:r,overrideOutlineColor:F,...this.maybeRunHittest(t,e,{pos:t.pos,size:f,sizeCorrection:V,isMapAligned:a,vvRotationMat3:_,placementMat3:M,outlineSize:g,distanceToPx:q,isSDF:r})}}fragment(t){const e=this._getColor(t.textureUV,t);return this.getFragmentOutput(e,t)}hittest(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=F(this.hittestRequest);return x(r,()=>{const{tlbr:t}=this.hittestRequest;return q(o,s,l,t)},()=>x(v(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i)))}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getViewScreenMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getColor(t,e){return x(w(e.isSDF,new u(1)),this._getSDFColor(t,e),this._getSpriteColor(t,e))}_getSpriteColor(t,e){return V(this.mosaicTexture,t).multiply(e.color)}_getSDFColor(t,e){const i=V(this.mosaicTexture,t),o=new u(.5).subtract(G(i)).multiply(e.distanceToPx).multiply(N),s=f(new u(.5).subtract(o),new u(0),new u(1)),l=e.color.multiply(s);let r=e.outlineSize;this.highlight&&(r=h(r,e.overrideOutlineColor.multiply(4)));const a=r.multiply(.5),p=S(o).subtract(a),n=f(new u(.5).subtract(p),new u(0),new u(1)),d=b(e.outlineColor,e.color,e.overrideOutlineColor).multiply(n);return new u(1).subtract(d.a).multiply(l).add(d)}_hittestSmallMarker(t,e,i){const{position:o,distance:s,smallSymbolDistance:l}=this.hittestRequest,r=s.subtract(l),{viewMat3:a,tileMat3:p}=this.view,n=a.multiply(p).multiply(new m(i.pos,1)).xy,d=i.size.multiply(.5),y=g(n,o).subtract(d).add(r);return x(C(y,this.hittestRequest.distance),new u(D),new u(T))}_hittestMarker(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=this.hittestRequest.position,a=this.hittestRequest.distance,p=O(r,o,s,l);return x(C(p,a),new u(D),this._hittestSamples(o,s,l,t,e,i))}computeHittestTriangle(t,e,i){const{pos:o,sizeCorrection:s,isMapAligned:l}=i,r=new m(t.offset.multiply(s),0),a=new m(e.offsetNextVertex1.multiply(s),0),p=new m(e.offsetNextVertex2.multiply(s),0),{viewMat3:n,tileMat3:u}=this.view,d=n.multiply(u).multiply(new m(o,1)),y=this._getViewScreenMatrix(l).multiply(i.vvRotationMat3).multiply(i.placementMat3);return{pos0:d.add(y.multiply(r)).xy,pos1:d.add(y.multiply(a)).xy,pos2:d.add(y.multiply(p)).xy}}_hittestSamples(t,e,i,o,s,l){const{outlineSize:r,isSDF:a,distanceToPx:d}=l,m=this.hittestRequest.position,y=this.hittestRequest.distance,h=k(m.add(new n(M(y),M(y))),t,e,i),c=k(m.add(new n(0,M(y))),t,e,i),v=k(m.add(new n(y,M(y))),t,e,i),w=k(m.add(new n(M(y),0)),t,e,i),V=k(m,t,e,i),f=k(m.add(new n(y,0)),t,e,i),S=k(m.add(new n(M(y),y)),t,e,i),b=k(m.add(new n(0,y)),t,e,i),g=k(m.add(new n(y,y)),t,e,i),z=o.textureUV.divide(this.mosaicInfo.size),_=s.textureUVNextVertex1.divide(this.mosaicInfo.size),R=s.textureUVNextVertex2.divide(this.mosaicInfo.size),j={color:new p(1),outlineColor:new p(1),overrideOutlineColor:new u(1),outlineSize:r,distanceToPx:d,isSDF:a};let U=new u(0);return U=U.add(A(h).multiply(this._getColor(ot(h,z,_,R),j).a)),U=U.add(A(c).multiply(this._getColor(ot(c,z,_,R),j).a)),U=U.add(A(v).multiply(this._getColor(ot(v,z,_,R),j).a)),U=U.add(A(w).multiply(this._getColor(ot(w,z,_,R),j).a)),U=U.add(A(V).multiply(this._getColor(ot(V,z,_,R),j).a)),U=U.add(A(f).multiply(this._getColor(ot(f,z,_,R),j).a)),U=U.add(A(S).multiply(this._getColor(ot(S,z,_,R),j).a)),U=U.add(A(b).multiply(this._getColor(ot(b,z,_,R),j).a)),U=U.add(A(g).multiply(this._getColor(ot(g,z,_,R),j).a)),x(C(U,new u(.05)),new u(T),new u(D))}}t([o(L)],lt.prototype,"visualVariableColor",void 0),t([o(B)],lt.prototype,"visualVariableOpacity",void 0),t([o(E)],lt.prototype,"visualVariableRotation",void 0),t([o(J)],lt.prototype,"visualVariableSizeMinMaxValue",void 0),t([o(K)],lt.prototype,"visualVariableSizeScaleStops",void 0),t([o(Q)],lt.prototype,"visualVariableSizeStops",void 0),t([o(W)],lt.prototype,"visualVariableSizeUnitValue",void 0),t([s(P)],lt.prototype,"mosaicInfo",void 0),t([l(d)],lt.prototype,"mosaicTexture",void 0),t([e(0,r(tt)),e(1,r(et))],lt.prototype,"vertex",null),t([e(0,r(it))],lt.prototype,"fragment",null);export{it as MarkerFragmentInput,lt as MarkerShader,tt as MarkerVertexInput};
2
+ import{__decorate as t,__param as e}from"tslib";import{location as i,option as o,uniform as s,texture as l,input as r,ComputeVertexInput as a}from"../../GraphShaderModule.js";import{Vec4 as p,Vec2 as n,Float as u,Sampler2D as d,Vec3 as m,min as y,max as h,Mat3 as c,ifElse as x,lessThan as v,equal as w,texture2D as V,clamp as f,abs as S,mix as b,distance as g,greaterThan as C,negate as M}from"../../graph/glsl.js";import{MarkerConstants as z}from"./markerConstants.js";import{FeatureVertexInput as _,AFeatureShader as R,FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{c256ToRad as U,softEdgeRatio as F,trueHit as N,noHit as T}from"../shaders/constants.js";import{isRectHittest as D,hittestMarkerScreenRect as q,distPointTriangle as O,xyToBarycentric as k,inTriangle as A}from"../shaders/hittestUtils.js";import{MosaicInfo as P}from"../shaders/MosaicInfo.js";import{getBit as I,getBitBool as H,rgba2float as G}from"../shaders/utils.js";import{VisualVariableColor as L}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as J}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as K}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Q}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as W}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableOpacity as X,getVisualVariableColor as Y,getVisualVariableSize as Z,getVisualVariableRotation as $}from"../shaders/vvUtils.js";class tt extends _{}t([i(3,p)],tt.prototype,"color",void 0),t([i(4,p)],tt.prototype,"outlineColor",void 0),t([i(5,n)],tt.prototype,"offset",void 0),t([i(6,n)],tt.prototype,"textureUV",void 0),t([i(7,p)],tt.prototype,"sizing",void 0),t([i(8,u)],tt.prototype,"placementAngle",void 0),t([i(9,u)],tt.prototype,"sdfDecodeCoeff",void 0),t([i(10,n)],tt.prototype,"zoomRange",void 0);class et extends a{}t([i(11,n)],et.prototype,"offsetNextVertex1",void 0),t([i(12,n)],et.prototype,"offsetNextVertex2",void 0),t([i(13,n)],et.prototype,"textureUVNextVertex1",void 0),t([i(14,n)],et.prototype,"textureUVNextVertex2",void 0);class it extends j{}function ot(t,e,i,o){return e.multiply(t.x).add(i.multiply(t.y)).add(o.multiply(t.z))}function st(t){return t.multiply(t).divide(128)}class lt extends R{constructor(){super(...arguments),this.type="MarkerShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],textureUV:["textureUVNextVertex1","textureUVNextVertex2"]}}vertex(t,e){const i=st(t.sizing.x),o=st(t.sizing.y),s=st(t.sizing.z),l=t.placementAngle,r=I(t.bitset,z.bitset.isSDF),a=I(t.bitset,z.bitset.isMapAligned),n=I(t.bitset,z.bitset.scaleSymbolsProportionally),d=H(t.bitset,z.bitset.colorLocked),x=X(this,t.id),v=Y(this,t.id,t.color,d).multiply(x),w=this.view.displayViewScreenMat3.multiply(new m(t.pos.xy,1)),V=Z(this,t.id,s).divide(s),f=i.multiply(V),S=t.offset.xy.multiply(V);let b=o.multiply(n.multiply(V.subtract(1)).add(1));b=y(b,h(f.subtract(.99),new u(0)));const g=h(b,new u(1)),C=y(b,new u(1)),M=c.fromRotation(l.multiply(U)),_=$(this,t.id),R=this._getViewRotationMatrix(a).multiply(_).multiply(M).multiply(new m(S.xy,0)).multiply(this.view.scaleFactor),j=this.clip(t.id,t.zoomRange),F=new p(w.xy.add(R.xy),j,1),N=t.textureUV.divide(this.mosaicInfo.size),T=t.outlineColor.multiply(C),D=I(t.bitset,z.bitset.overrideOutlineColor),q=t.sdfDecodeCoeff.multiply(f);return{glPosition:F,color:v,textureUV:N,outlineColor:T,outlineSize:g,distanceToPx:q,isSDF:r,overrideOutlineColor:D,...this.maybeRunHittest(t,e,{pos:t.pos,size:f,sizeCorrection:V,scaleFactor:this.view.scaleFactor,isMapAligned:a,vvRotationMat3:_,placementMat3:M,outlineSize:g,distanceToPx:q,isSDF:r})}}fragment(t){const e=this._getColor(t.textureUV,t);return this.getFragmentOutput(e,t)}hittest(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=D(this.hittestRequest);return x(r,()=>{const{tlbr:t}=this.hittestRequest;return q(o,s,l,t)},()=>x(v(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i)))}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getViewScreenMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getColor(t,e){return x(w(e.isSDF,new u(1)),this._getSDFColor(t,e),this._getSpriteColor(t,e))}_getSpriteColor(t,e){return V(this.mosaicTexture,t).multiply(e.color)}_getSDFColor(t,e){const i=V(this.mosaicTexture,t),o=new u(.5).subtract(G(i)).multiply(e.distanceToPx).multiply(F),s=f(new u(.5).subtract(o),new u(0),new u(1)),l=e.color.multiply(s);let r=e.outlineSize;this.highlight&&(r=h(r,e.overrideOutlineColor.multiply(4)));const a=r.multiply(.5),p=S(o).subtract(a),n=f(new u(.5).subtract(p),new u(0),new u(1)),d=b(e.outlineColor,e.color,e.overrideOutlineColor).multiply(n);return new u(1).subtract(d.a).multiply(l).add(d)}_hittestSmallMarker(t,e,i){const{position:o,distance:s,smallSymbolDistance:l}=this.hittestRequest,r=s.subtract(l),{viewMat3:a,tileMat3:p}=this.view,n=a.multiply(p).multiply(new m(i.pos,1)).xy,d=i.size.multiply(.5),y=g(n,o).subtract(d).add(r);return x(C(y,this.hittestRequest.distance),new u(T),new u(N))}_hittestMarker(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=this.hittestRequest.position,a=this.hittestRequest.distance,p=O(r,o,s,l);return x(C(p,a),new u(T),this._hittestSamples(o,s,l,t,e,i))}computeHittestTriangle(t,e,i){const{pos:o,sizeCorrection:s,scaleFactor:l,isMapAligned:r}=i,a=new m(t.offset.multiply(s).multiply(l),0),p=new m(e.offsetNextVertex1.multiply(s).multiply(l),0),n=new m(e.offsetNextVertex2.multiply(s).multiply(l),0),{viewMat3:u,tileMat3:d}=this.view,y=u.multiply(d).multiply(new m(o,1)),h=this._getViewScreenMatrix(r).multiply(i.vvRotationMat3).multiply(i.placementMat3);return{pos0:y.add(h.multiply(a)).xy,pos1:y.add(h.multiply(p)).xy,pos2:y.add(h.multiply(n)).xy}}_hittestSamples(t,e,i,o,s,l){const{outlineSize:r,isSDF:a,distanceToPx:d}=l,m=this.hittestRequest.position,y=this.hittestRequest.distance,h=k(m.add(new n(M(y),M(y))),t,e,i),c=k(m.add(new n(0,M(y))),t,e,i),v=k(m.add(new n(y,M(y))),t,e,i),w=k(m.add(new n(M(y),0)),t,e,i),V=k(m,t,e,i),f=k(m.add(new n(y,0)),t,e,i),S=k(m.add(new n(M(y),y)),t,e,i),b=k(m.add(new n(0,y)),t,e,i),g=k(m.add(new n(y,y)),t,e,i),z=o.textureUV.divide(this.mosaicInfo.size),_=s.textureUVNextVertex1.divide(this.mosaicInfo.size),R=s.textureUVNextVertex2.divide(this.mosaicInfo.size),j={color:new p(1),outlineColor:new p(1),overrideOutlineColor:new u(1),outlineSize:r,distanceToPx:d,isSDF:a};let U=new u(0);return U=U.add(A(h).multiply(this._getColor(ot(h,z,_,R),j).a)),U=U.add(A(c).multiply(this._getColor(ot(c,z,_,R),j).a)),U=U.add(A(v).multiply(this._getColor(ot(v,z,_,R),j).a)),U=U.add(A(w).multiply(this._getColor(ot(w,z,_,R),j).a)),U=U.add(A(V).multiply(this._getColor(ot(V,z,_,R),j).a)),U=U.add(A(f).multiply(this._getColor(ot(f,z,_,R),j).a)),U=U.add(A(S).multiply(this._getColor(ot(S,z,_,R),j).a)),U=U.add(A(b).multiply(this._getColor(ot(b,z,_,R),j).a)),U=U.add(A(g).multiply(this._getColor(ot(g,z,_,R),j).a)),x(C(U,new u(.05)),new u(N),new u(T))}}t([o(L)],lt.prototype,"visualVariableColor",void 0),t([o(B)],lt.prototype,"visualVariableOpacity",void 0),t([o(E)],lt.prototype,"visualVariableRotation",void 0),t([o(J)],lt.prototype,"visualVariableSizeMinMaxValue",void 0),t([o(K)],lt.prototype,"visualVariableSizeScaleStops",void 0),t([o(Q)],lt.prototype,"visualVariableSizeStops",void 0),t([o(W)],lt.prototype,"visualVariableSizeUnitValue",void 0),t([s(P)],lt.prototype,"mosaicInfo",void 0),t([l(d)],lt.prototype,"mosaicTexture",void 0),t([e(0,r(tt)),e(1,r(et))],lt.prototype,"vertex",null),t([e(0,r(it))],lt.prototype,"fragment",null);export{it as MarkerFragmentInput,lt as MarkerShader,tt as MarkerVertexInput};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as a}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as r}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as s}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as i}from"./MeshWriterVertexPack.js";const n=96/72;class c{constructor(e,t,a,r){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=a,this._viewParams=r,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=i.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get placementInfo(){return this._evaluator.inputMeshParams.placement}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await t(e);this.placementInfo&&await a(this.placementInfo.placement)}enqueueRequest(e,t,a){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,a)}write(e,t,a,r,s,i,n,c){this.ensurePacked(t,a,r);const o=e.id||"",f=this.evaluatedMeshParams.effects,u=this._createEffectExecutionContext(a,r,o,n,c),h={target:a,options:r,level:s,viewExtent:i};if(!f||0===f.length)return void this._write(e,h);const l=this.getEffectCursor(a,f,u);if(!l)return;let m;for(;m=l.next();)m.invertY(),this._write(e,{...h,effectGeometry:m})}ensurePacked(e,t,a){if(!this._evaluator.hasDynamicProperties)return;const r=this._evaluator.evaluateMeshParams(e,t,a);this._vertexPack.pack(r,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,a,r,s){const i=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,a,r,i,s)}_createEffectExecutionContext(e,t,a,s,i){return{geomUnitsPerPoint:n,maxInflateSize:r(this.evaluatedMeshParams.effects),scale:t.$view.scale,spatialReference:e.metadata.outSpatialReference??e.metadata.spatialReference,preventClipping:this._preventEffectClipping,tileKey:a,scaleFactor:s,matcher:i,target:e}}getEffectCursor(t,a,r){null==r.scaleFactor&&(r={...r,scaleFactor:1});const i=t.readGeometryForDisplay()?.clone();if(!i)return;const n=e.fromOptimizedCIM(i,t.geometryType);return n.invertY(),s.executeEffects(a,n,r)}}export{c as MeshWriter};
2
+ import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as a}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as r}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as s}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as i}from"./MeshWriterVertexPack.js";const c=96/72;class n{constructor(e,t,a,r){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=a,this._viewParams=r,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=i.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get placementInfo(){return this._evaluator.inputMeshParams.placement}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await t(e);this.placementInfo&&await a(this.placementInfo.placement)}enqueueRequest(e,t,a){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,a)}write(e,t,a,r,s,i,c,n){this.ensurePacked(t,a,r);const o=e.id||"",f=this.evaluatedMeshParams.effects,u=this._createEffectExecutionContext(a,r,o,c,n),h={target:a,options:r,level:s,viewExtent:i};if(!f||0===f.length)return void this._write(e,h);const l=this.getEffectCursor(a,f,u);if(!l)return;let m;for(;m=l.next();)m.invertY(),this._write(e,{...h,effectGeometry:m,scaleFactor:c})}ensurePacked(e,t,a){if(!this._evaluator.hasDynamicProperties)return;const r=this._evaluator.evaluateMeshParams(e,t,a);this._vertexPack.pack(r,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,a,r,s){const i=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,a,r,i,s)}_createEffectExecutionContext(e,t,a,s,i){return{geomUnitsPerPoint:c,maxInflateSize:r(this.evaluatedMeshParams.effects),scale:t.$view.scale,spatialReference:e.metadata.outSpatialReference??e.metadata.spatialReference,preventClipping:this._preventEffectClipping,tileKey:a,scaleFactor:s,matcher:i,target:e}}getEffectCursor(t,a,r){null==r.scaleFactor&&(r={...r,scaleFactor:1});const i=t.readGeometryForDisplay()?.clone();if(!i)return;const c=e.fromOptimizedCIM(i,t.geometryType);return c.invertY(),s.executeEffects(a,c,r)}}export{n as MeshWriter};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as r,UniformGroup as a}from"../../GraphShaderModule.js";import{Vec4 as s,Vec2 as n,Float as p,step as u,min as m,ifElse as d,greaterThan as y,max as c,Vec3 as f,length as h,clamp as v}from"../../graph/glsl.js";import{BaseHittestVertexInput as w,FeatureVertexInput as b,AFeatureShader as V,FeatureFragmentInput as S}from"./AFeatureShader.js";import{noHit as g,trueHit as x,epsilon as j,thinLineWidthFactor as z,thinLineHalfWidth as W}from"./constants.js";import{isRectHittest as M,distPointSegment as R,hittestScreenRect as C}from"./hittestUtils.js";import{VisualVariableColor as H}from"./VisualVariableColor.js";import{VisualVariableOpacity as O}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as U}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as A,getVisualVariableOpacity as T,hasVisualVariableSize as D,getVisualVariableSize as G}from"./vvUtils.js";class L extends b{}t([e(3,s)],L.prototype,"color",void 0),t([e(4,n)],L.prototype,"offset",void 0),t([e(5,n)],L.prototype,"normal",void 0),t([e(6,p)],L.prototype,"halfWidth",void 0),t([e(7,p)],L.prototype,"referenceHalfWidth",void 0),t([e(8,n)],L.prototype,"zoomRange",void 0);class k extends S{}class B extends a{}function E(t){return c(new p(z).multiply(u(t,new p(W))),new p(1))}function I(t,i){const{halfWidth:e,normal:o}=t,l=E(e),r=h(o).multiply(e);return v(l.multiply(e.subtract(r)).divide(i.add(l).subtract(new p(1))),new p(0),new p(1))}function J(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(D(t)){const i=new p(2).multiply(l),r=G(t,e,i);return new p(.5).multiply(o.divide(c(l,new p(j)))).multiply(r)}return o}function K(t,i){const{id:e,offset:o,pos:l,normal:r,zoomRange:a}=i,{displayViewScreenMat3:n,displayViewMat3:m}=t.view,d=A(t,e,i.color),y=T(t,e),h=J(t,i),v=new p(.5).multiply(t.antialiasingControls.antialiasing),w=c(h.add(v),new p(.45)).add(new p(.1).multiply(v)),b=E(w).multiply(w).multiply(o).multiply(t.view.scaleFactor),V=m.multiply(new f(b,new p(0))),S=n.multiply(new f(l,new p(1))).add(V),g=new p(2).multiply(u(h,new p(0))).add(t.clip(e,a)),x=new s(S.xy,g,1);return{color:d,opacity:y,halfWidth:w,normal:r,scaledOffset:b,scaledHalfWidth:h,glPosition:new s(x.xy,g,1)}}function N(t,i){const{opacity:e,color:o}=t,l=I(t,i);return e.multiply(o).multiply(l)}t([o(p)],B.prototype,"antialiasing",void 0),t([o(p)],B.prototype,"blur",void 0);class Q extends V{constructor(){super(...arguments),this.type="LineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,i){const e=K(this,t);return{...e,...this.maybeRunHittest(t,i,e.halfWidth)}}fragment(t){const i=N(t,this.antialiasingControls.blur);return this.getFragmentOutput(i,t)}hittest(t,i,e){const{pos0:o,pos1:l,pos2:r}=this.computeHittestTriangle(t,i,null),a=M(this.hittestRequest),{distance:s,smallSymbolDistance:n,smallSymbolSizeThreshold:c,tlbr:f}=this.hittestRequest,h=u(e,c.multiply(.5)).multiply(s.subtract(n)),v=this.hittestRequest.position,w=m(R(v,o,l),R(v,o,r)).subtract(e).add(h);return d(a,C(o,l,r,f),d(y(w,s),new p(g),new p(x)))}}t([o(B)],Q.prototype,"antialiasingControls",void 0),t([l(H)],Q.prototype,"visualVariableColor",void 0),t([l(O)],Q.prototype,"visualVariableOpacity",void 0),t([l(U)],Q.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(q)],Q.prototype,"visualVariableSizeScaleStops",void 0),t([l(F)],Q.prototype,"visualVariableSizeStops",void 0),t([l(P)],Q.prototype,"visualVariableSizeUnitValue",void 0),t([i(0,r(L)),i(1,r(w))],Q.prototype,"vertex",null),t([i(0,r(k))],Q.prototype,"fragment",null);export{B as AntialiasingControls,k as LineFragmentInput,Q as LineShader,L as LineVertexInput,I as getLineAntialiasing,N as getLineFragmentColor,E as getLineThinFactor,K as getLineVertexData};
2
+ import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as r,UniformGroup as a}from"../../GraphShaderModule.js";import{Vec4 as s,Vec2 as n,Float as p,step as u,min as m,ifElse as d,greaterThan as y,max as c,Vec3 as f,length as h,clamp as v}from"../../graph/glsl.js";import{BaseHittestVertexInput as w,FeatureVertexInput as b,AFeatureShader as V,FeatureFragmentInput as S}from"./AFeatureShader.js";import{noHit as g,trueHit as x,epsilon as j,thinLineWidthFactor as z,thinLineHalfWidth as W}from"./constants.js";import{isRectHittest as M,distPointSegment as R,hittestScreenRect as C}from"./hittestUtils.js";import{VisualVariableColor as H}from"./VisualVariableColor.js";import{VisualVariableOpacity as O}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as U}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as A,getVisualVariableOpacity as T,hasVisualVariableSize as D,getVisualVariableSize as G}from"./vvUtils.js";class L extends b{}t([e(3,s)],L.prototype,"color",void 0),t([e(4,n)],L.prototype,"offset",void 0),t([e(5,n)],L.prototype,"normal",void 0),t([e(6,p)],L.prototype,"halfWidth",void 0),t([e(7,p)],L.prototype,"referenceHalfWidth",void 0),t([e(8,n)],L.prototype,"zoomRange",void 0);class k extends S{}class B extends a{}function E(t){return c(new p(z).multiply(u(t,new p(W))),new p(1))}function I(t,i){const{halfWidth:e,normal:o}=t,l=E(e),r=h(o).multiply(e);return v(l.multiply(e.subtract(r)).divide(i.add(l).subtract(new p(1))),new p(0),new p(1))}function J(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(D(t)){const i=new p(2).multiply(l),r=G(t,e,i),a=new p(j),s=d(y(o,a),o.divide(c(l,a)),new p(1));return new p(.5).multiply(s).multiply(r)}return o}function K(t,i){const{id:e,offset:o,pos:l,normal:r,zoomRange:a}=i,{displayViewScreenMat3:n,displayViewMat3:m}=t.view,d=A(t,e,i.color),y=T(t,e),h=J(t,i),v=new p(.5).multiply(t.antialiasingControls.antialiasing),w=c(h.add(v),new p(.45)).add(new p(.1).multiply(v)),b=E(w).multiply(w).multiply(o).multiply(t.view.scaleFactor),V=m.multiply(new f(b,new p(0))),S=n.multiply(new f(l,new p(1))).add(V),g=new p(2).multiply(u(h,new p(0))).add(t.clip(e,a)),x=new s(S.xy,g,1);return{color:d,opacity:y,halfWidth:w,normal:r,scaledOffset:b,scaledHalfWidth:h,glPosition:new s(x.xy,g,1)}}function N(t,i){const{opacity:e,color:o}=t,l=I(t,i);return e.multiply(o).multiply(l)}t([o(p)],B.prototype,"antialiasing",void 0),t([o(p)],B.prototype,"blur",void 0);class Q extends V{constructor(){super(...arguments),this.type="LineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,i){const e=K(this,t);return{...e,...this.maybeRunHittest(t,i,e.halfWidth)}}fragment(t){const i=N(t,this.antialiasingControls.blur);return this.getFragmentOutput(i,t)}hittest(t,i,e){const{pos0:o,pos1:l,pos2:r}=this.computeHittestTriangle(t,i,null),a=M(this.hittestRequest),{distance:s,smallSymbolDistance:n,smallSymbolSizeThreshold:c,tlbr:f}=this.hittestRequest,h=u(e,c.multiply(.5)).multiply(s.subtract(n)),v=this.hittestRequest.position,w=m(R(v,o,l),R(v,o,r)).subtract(e).add(h);return d(a,C(o,l,r,f),d(y(w,s),new p(g),new p(x)))}}t([o(B)],Q.prototype,"antialiasingControls",void 0),t([l(H)],Q.prototype,"visualVariableColor",void 0),t([l(O)],Q.prototype,"visualVariableOpacity",void 0),t([l(U)],Q.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(q)],Q.prototype,"visualVariableSizeScaleStops",void 0),t([l(F)],Q.prototype,"visualVariableSizeStops",void 0),t([l(P)],Q.prototype,"visualVariableSizeUnitValue",void 0),t([i(0,r(L)),i(1,r(w))],Q.prototype,"vertex",null),t([i(0,r(k))],Q.prototype,"fragment",null);export{B as AntialiasingControls,k as LineFragmentInput,Q as LineShader,L as LineVertexInput,I as getLineAntialiasing,N as getLineFragmentColor,E as getLineThinFactor,K as getLineVertexData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t,__param as e}from"tslib";import{labelPlacementOffsetPadding as i}from"../../../definitions.js";import{location as o,option as s,uniform as l,texture as r,define as a,input as n,ComputeVertexInput as p}from"../../GraphShaderModule.js";import{Vec4 as d,Vec2 as u,Float as y,Sampler2D as m,mod as c,step as f,and as h,lessThan as v,greaterThanEqual as w,Vec3 as b,Mat3 as x,ifElse as V,equal as S,greaterThan as g,Bool as z,texture2D as R,smoothstep as j,Int as A,bitRShift as C,bitAnd as O}from"../../graph/glsl.js";import{FeatureVertexInput as M,AFeatureShader as T,FeatureFragmentInput as L}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as P,bitsetTextIsMapAligned as H,noHit as N,trueHit as U}from"../shaders/constants.js";import{isRectHittest as _,distPointTriangle as k,hittestScreenRect as q}from"../shaders/hittestUtils.js";import{MosaicInfo as D}from"../shaders/MosaicInfo.js";import{getBit as I}from"../shaders/utils.js";import{VisualVariableColor as B}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as F}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as W}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as G}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Z}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as J}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as K,getVisualVariableRotation as Q}from"../shaders/vvUtils.js";const X=360/254;class Y extends M{}t([o(3,d)],Y.prototype,"color",void 0),t([o(4,u)],Y.prototype,"offset",void 0),t([o(5,u)],Y.prototype,"textureUV",void 0),t([o(6,d)],Y.prototype,"fontAndReferenceSize",void 0),t([o(7,d)],Y.prototype,"outlineColor",void 0),t([o(8,d)],Y.prototype,"haloColor",void 0),t([o(9,u)],Y.prototype,"outlineAndHaloSize",void 0),t([o(10,u)],Y.prototype,"zoomRange",void 0),t([o(11,y)],Y.prototype,"clipAngle",void 0),t([o(12,d)],Y.prototype,"referenceSymbol",void 0),t([o(15,y)],Y.prototype,"visibility",void 0);class $ extends p{}t([o(13,u)],$.prototype,"offsetNextVertex1",void 0),t([o(14,u)],$.prototype,"offsetNextVertex2",void 0);class tt extends L{}class et extends T{constructor(){super(...arguments),this.type="TextShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"]},this.textRenderPassType=0,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(t,e){const{clipAngle:i,zoomRange:o,visibility:s}=t,l=i.multiply(X),r=c(l.subtract(this.view.rotation),new y(360));let a=new y(0);const n=this.view.currentZoom,p=o.x,d=o.y,u=new y(1).subtract(f(p,n)).multiply(2),m=new y(h(w(r,new y(90)),v(r,new y(270)))).multiply(2),b=new y(2).multiply(new y(1).subtract(f(n,d)));return a=a.add(e.multiply(u)),a=a.add(e.multiply(m)),a=a.add(b),s&&(a=a.add(s)),a}vertex(t,e){const o=I(t.bitset,P),s=new y(1).subtract(o);let l=t.fontAndReferenceSize[0];const r=t.fontAndReferenceSize[1],a=t.fontAndReferenceSize[2],n=t.fontAndReferenceSize[3];let p=l.divide(a);const m=1===this.textRenderPassType?t.outlineColor:2===this.textRenderPassType?t.haloColor:this._getVertexColor(t),c=this.view.displayViewScreenMat3.multiply(new b(t.pos,1));let f=t.offset,h=new y(1),v=x.identity(),w=new u(0);if(this.isLabel){if(!t.referenceSymbol)throw new Error("InternalError: Optional attribute 'referenceSymbol' expected for labels");const e=t.referenceSymbol,o=e.xy,s=e.z,l=this._unpackDirection(e.w),r=K(this,t.id,s).divide(2),a=l.multiply(r.add(i));w=o.add(a),f=f.add(w)}else{h=K(this,t.id,r).divide(r),l=l.multiply(h),p=p.multiply(h),f=f.multiply(h),v=Q(this,t.id),f=v.multiply(new b(f,0)).xy}const R=I(t.bitset,H),j=this._getViewRotationMatrix(R).multiply(new b(f,0)).multiply(this.view.scaleFactor);let A=this.isLabel?this.clipLabel(t,R):this.clip(t.id,t.zoomRange);A=this.isBackgroundPass?A.add(s.multiply(2)):A.add(o.multiply(2));let C=new y(0);if(1===this.textRenderPassType){A=A.add(V(S(t.outlineAndHaloSize.x,new y(0)),new y(2),new y(0)));C=new y(t.outlineAndHaloSize.x).divide(p).divide(n)}if(2===this.textRenderPassType){const e=t.outlineAndHaloSize.x,i=new y(t.outlineAndHaloSize.y);A=A.add(V(S(i,new y(0)),new y(2),new y(0)));C=i.add(e).divide(p).divide(n)}const O=this.isLabel?g(A,new y(1)):new z(!1);return{glPosition:new d(c.xy.add(j.xy),A,1),color:m,size:p,textureUV:t.textureUV.divide(this.mosaicInfo.size),antialiasingWidth:new y(.105).multiply(a).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:C,...this.maybeRunHittest(t,e,{vvSizeAdjustment:h,vvRotation:v,labelOffset:w,labelClipped:O})}}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new y(1).subtract(t);return e.multiply(t).add(i.multiply(o))}fragment(t){const e=new y(2/8),i=new y(1).subtract(e),o=R(this.mosaicTexture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,r=j(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(r),t)}computeHittestTriangle(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s}){let l,r,a;this.isLabel?(l=new b(t.offset.add(s),0),r=new b(e.offsetNextVertex1.add(s),0),a=new b(e.offsetNextVertex2.add(s),0)):(l=o.multiply(new b(t.offset.multiply(i),0)),r=o.multiply(new b(e.offsetNextVertex1.multiply(i),0)),a=o.multiply(new b(e.offsetNextVertex2.multiply(i),0)));const{viewMat3:n,tileMat3:p}=this.view,d=n.multiply(p).multiply(new b(t.pos,1));return{pos0:d.add(p.multiply(l)).xy,pos1:d.add(p.multiply(r)).xy,pos2:d.add(p.multiply(a)).xy}}hittest(t,e,i){const{vvSizeAdjustment:o,vvRotation:s,labelOffset:l,labelClipped:r}=i,a=_(this.hittestRequest),{pos0:n,pos1:p,pos2:d}=this.computeHittestTriangle(t,e,{vvSizeAdjustment:o,vvRotation:s,labelOffset:l});return V(a,()=>{const{tlbr:t}=this.hittestRequest;return this.isLabel?V(r,new y(N),q(n,p,d,t)):q(n,p,d,t)},()=>{const t=k(this.hittestRequest.position,n,p,d),e=this.isLabel?r:new z(!1);return V(e,new y(N),V(g(t,this.hittestRequest.distance),new y(N),new y(U)))})}_unpackDirection(t){const e=new A(t),i=C(e,new A(2)),o=O(e,new A(3));return new u(new y(i).subtract(1),new y(o).subtract(1))}_getVertexColor(t){let e=t.color;if(this.visualVariableColor){const i=this.getColorValue(t.id);e=this.visualVariableColor.getColor(i,t.color,new z(!1))}if(this.visualVariableOpacity){const i=this.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([s(B)],et.prototype,"visualVariableColor",void 0),t([s(F)],et.prototype,"visualVariableOpacity",void 0),t([s(E)],et.prototype,"visualVariableRotation",void 0),t([s(W)],et.prototype,"visualVariableSizeMinMaxValue",void 0),t([s(G)],et.prototype,"visualVariableSizeScaleStops",void 0),t([s(Z)],et.prototype,"visualVariableSizeStops",void 0),t([s(J)],et.prototype,"visualVariableSizeUnitValue",void 0),t([l(D)],et.prototype,"mosaicInfo",void 0),t([r(m)],et.prototype,"mosaicTexture",void 0),t([a],et.prototype,"textRenderPassType",void 0),t([a],et.prototype,"isBackgroundPass",void 0),t([a],et.prototype,"isLabel",void 0),t([e(0,n(Y)),e(1,n($))],et.prototype,"vertex",null),t([e(0,n(tt))],et.prototype,"fragment",null);export{tt as TextFragmentInput,et as TextShader,Y as TextVertexInput};
2
+ import{__decorate as t,__param as e}from"tslib";import{labelPlacementOffsetPadding as i}from"../../../definitions.js";import{location as o,option as s,uniform as l,texture as a,define as r,input as n,ComputeVertexInput as p}from"../../GraphShaderModule.js";import{Vec4 as d,Vec2 as u,Float as y,Sampler2D as m,mod as c,step as h,and as v,lessThan as f,greaterThanEqual as w,Vec3 as b,Mat3 as x,ifElse as V,equal as S,greaterThan as g,Bool as z,texture2D as R,smoothstep as j,Int as A,bitRShift as M,bitAnd as C}from"../../graph/glsl.js";import{FeatureVertexInput as O,AFeatureShader as T,FeatureFragmentInput as H}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as L,bitsetTextIsMapAligned as P,noHit as F,trueHit as N}from"../shaders/constants.js";import{isRectHittest as U,distPointTriangle as _,hittestScreenRect as k}from"../shaders/hittestUtils.js";import{MosaicInfo as q}from"../shaders/MosaicInfo.js";import{getBit as D}from"../shaders/utils.js";import{VisualVariableColor as I}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as W}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as G}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Z}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as J}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as K,getVisualVariableRotation as Q}from"../shaders/vvUtils.js";const X=360/254;class Y extends O{}t([o(3,d)],Y.prototype,"color",void 0),t([o(4,u)],Y.prototype,"offset",void 0),t([o(5,u)],Y.prototype,"textureUV",void 0),t([o(6,d)],Y.prototype,"fontAndReferenceSize",void 0),t([o(7,d)],Y.prototype,"outlineColor",void 0),t([o(8,d)],Y.prototype,"haloColor",void 0),t([o(9,u)],Y.prototype,"outlineAndHaloSize",void 0),t([o(10,u)],Y.prototype,"zoomRange",void 0),t([o(11,y)],Y.prototype,"clipAngle",void 0),t([o(12,d)],Y.prototype,"referenceSymbol",void 0),t([o(15,y)],Y.prototype,"visibility",void 0);class $ extends p{}t([o(13,u)],$.prototype,"offsetNextVertex1",void 0),t([o(14,u)],$.prototype,"offsetNextVertex2",void 0);class tt extends H{}class et extends T{constructor(){super(...arguments),this.type="TextShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"]},this.textRenderPassType=0,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(t,e){const{clipAngle:i,zoomRange:o,visibility:s}=t,l=i.multiply(X),a=c(l.subtract(this.view.rotation),new y(360));let r=new y(0);const n=this.view.currentZoom,p=o.x,d=o.y,u=new y(1).subtract(h(p,n)).multiply(2),m=new y(v(w(a,new y(90)),f(a,new y(270)))).multiply(2),b=new y(2).multiply(new y(1).subtract(h(n,d)));return r=r.add(e.multiply(u)),r=r.add(e.multiply(m)),r=r.add(b),s&&(r=r.add(s)),r}vertex(t,e){const o=D(t.bitset,L),s=new y(1).subtract(o);let l=t.fontAndReferenceSize[0];const a=t.fontAndReferenceSize[1],r=t.fontAndReferenceSize[2],n=t.fontAndReferenceSize[3];let p=l.divide(r);const m=1===this.textRenderPassType?t.outlineColor:2===this.textRenderPassType?t.haloColor:this._getVertexColor(t),c=this.view.displayViewScreenMat3.multiply(new b(t.pos,1));let h=t.offset,v=new y(1),f=x.identity(),w=new u(0);if(this.isLabel){if(!t.referenceSymbol)throw new Error("InternalError: Optional attribute 'referenceSymbol' expected for labels");const e=t.referenceSymbol,o=e.xy,s=e.z,l=this._unpackDirection(e.w),a=K(this,t.id,s).divide(2),r=l.multiply(a.add(i));w=o.add(r),h=h.add(w)}else{v=K(this,t.id,a).divide(a),l=l.multiply(v),p=p.multiply(v),h=h.multiply(v),f=Q(this,t.id),h=f.multiply(new b(h,0)).xy}const R=D(t.bitset,P),j=this._getViewRotationMatrix(R).multiply(new b(h,0)).multiply(this.view.scaleFactor);let A=this.isLabel?this.clipLabel(t,R):this.clip(t.id,t.zoomRange);A=this.isBackgroundPass?A.add(s.multiply(2)):A.add(o.multiply(2));let M=new y(0);if(1===this.textRenderPassType){A=A.add(V(S(t.outlineAndHaloSize.x,new y(0)),new y(2),new y(0)));M=new y(t.outlineAndHaloSize.x).divide(p).divide(n)}if(2===this.textRenderPassType){const e=t.outlineAndHaloSize.x,i=new y(t.outlineAndHaloSize.y);A=A.add(V(S(i,new y(0)),new y(2),new y(0)));M=i.add(e).divide(p).divide(n)}const C=this.isLabel?g(A,new y(1)):new z(!1);return{glPosition:new d(c.xy.add(j.xy),A,1),color:m,size:p,textureUV:t.textureUV.divide(this.mosaicInfo.size),antialiasingWidth:new y(.105).multiply(r).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:M,...this.maybeRunHittest(t,e,{vvSizeAdjustment:v,vvRotation:f,labelOffset:w,labelClipped:C,scaleFactor:this.view.scaleFactor})}}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new y(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getHittestAlignmentMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new y(1).subtract(t);return e.multiply(t).add(i.multiply(o))}fragment(t){const e=new y(2/8),i=new y(1).subtract(e),o=R(this.mosaicTexture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,a=j(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(a),t)}computeHittestTriangle(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s,scaleFactor:l}){let a,r,n;this.isLabel?(a=new b(t.offset.multiply(l).add(s),0),r=new b(e.offsetNextVertex1.multiply(l).add(s),0),n=new b(e.offsetNextVertex2.multiply(l).add(s),0)):(a=o.multiply(new b(t.offset.multiply(l).multiply(i),0)),r=o.multiply(new b(e.offsetNextVertex1.multiply(l).multiply(i),0)),n=o.multiply(new b(e.offsetNextVertex2.multiply(l).multiply(i),0)));const{viewMat3:p,tileMat3:d}=this.view,u=p.multiply(d).multiply(new b(t.pos,1)),y=D(t.bitset,P),m=this._getHittestAlignmentMatrix(y);return{pos0:u.add(m.multiply(a)).xy,pos1:u.add(m.multiply(r)).xy,pos2:u.add(m.multiply(n)).xy}}hittest(t,e,i){const{vvSizeAdjustment:o,vvRotation:s,labelOffset:l,labelClipped:a,scaleFactor:r}=i,n=U(this.hittestRequest),{pos0:p,pos1:d,pos2:u}=this.computeHittestTriangle(t,e,{vvSizeAdjustment:o,vvRotation:s,labelOffset:l,scaleFactor:r});return V(n,()=>{const{tlbr:t}=this.hittestRequest;return this.isLabel?V(a,new y(F),k(p,d,u,t)):k(p,d,u,t)},()=>{const t=_(this.hittestRequest.position,p,d,u),e=this.isLabel?a:new z(!1);return V(e,new y(F),V(g(t,this.hittestRequest.distance),new y(F),new y(N)))})}_unpackDirection(t){const e=new A(t),i=M(e,new A(2)),o=C(e,new A(3));return new u(new y(i).subtract(1),new y(o).subtract(1))}_getVertexColor(t){let e=t.color;if(this.visualVariableColor){const i=this.getColorValue(t.id);e=this.visualVariableColor.getColor(i,t.color,new z(!1))}if(this.visualVariableOpacity){const i=this.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([s(I)],et.prototype,"visualVariableColor",void 0),t([s(B)],et.prototype,"visualVariableOpacity",void 0),t([s(E)],et.prototype,"visualVariableRotation",void 0),t([s(W)],et.prototype,"visualVariableSizeMinMaxValue",void 0),t([s(G)],et.prototype,"visualVariableSizeScaleStops",void 0),t([s(Z)],et.prototype,"visualVariableSizeStops",void 0),t([s(J)],et.prototype,"visualVariableSizeUnitValue",void 0),t([l(q)],et.prototype,"mosaicInfo",void 0),t([a(m)],et.prototype,"mosaicTexture",void 0),t([r],et.prototype,"textRenderPassType",void 0),t([r],et.prototype,"isBackgroundPass",void 0),t([r],et.prototype,"isLabel",void 0),t([e(0,n(Y)),e(1,n($))],et.prototype,"vertex",null),t([e(0,n(tt))],et.prototype,"fragment",null);export{tt as TextFragmentInput,et as TextShader,Y as TextVertexInput};