@arcgis/core 4.32.0-next.20250203 → 4.32.0-next.20250204

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/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{d3a8aabdbfb59dd433e3.js → 01c3507d78398baaf61b.js} +1 -1
  4. package/assets/esri/core/workers/chunks/06f693780f70e5a627c4.js +1 -0
  5. package/assets/esri/core/workers/chunks/{c4b0e3f7dcad6c7ea620.js → 08f76c75758a29158b13.js} +34 -34
  6. package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js +2 -0
  7. package/assets/esri/core/workers/chunks/{bf9bc52a3c559108c19a.js.LICENSE.txt → 1a2e1a414e651e988435.js.LICENSE.txt} +1 -1
  8. package/assets/esri/core/workers/chunks/{6e25742ceedea7fb1b97.js → 287362f9af132fafe4de.js} +1 -1
  9. package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
  10. package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js +2 -0
  11. package/assets/esri/core/workers/chunks/{6e8905f20101c1f4509d.js.LICENSE.txt → 354531dc2f0dea2ad96f.js.LICENSE.txt} +1 -1
  12. package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +1 -0
  13. package/assets/esri/core/workers/chunks/44abd2cd17aae3299ede.js +1 -0
  14. package/assets/esri/core/workers/chunks/{af2a70d33afb12bb536f.js → 4d0a6ccb8434f8898377.js} +44 -44
  15. package/assets/esri/core/workers/chunks/{e9f0402fa3ac5a249807.js → 5196c43dbce48d1b81ae.js} +1 -1
  16. package/assets/esri/core/workers/chunks/568bcf809fcfd4d9c713.js +1 -0
  17. package/assets/esri/core/workers/chunks/{f2fae056a81f12b56b04.js → 5e7f16b312077ca8c18d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/61243217aed5de012e93.js +1 -0
  19. package/assets/esri/core/workers/chunks/69d307758262e5d7a32e.js +1 -0
  20. package/assets/esri/core/workers/chunks/6d5bfcc7856cafe7b043.js +2 -0
  21. package/assets/esri/core/workers/chunks/{7d3a441d2eb18d709ef9.js.LICENSE.txt → 6d5bfcc7856cafe7b043.js.LICENSE.txt} +1 -1
  22. package/assets/esri/core/workers/chunks/72cf9192292e5c85c6df.js.LICENSE.txt +1 -1
  23. package/assets/esri/core/workers/chunks/{bc50585615f07d5ec1a9.js → 746c964cf07e4306f21f.js} +1 -1
  24. package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js +2 -0
  25. package/assets/esri/core/workers/chunks/{25c8cc30faade043c8dc.js.LICENSE.txt → 77764ca90bdd13ee2167.js.LICENSE.txt} +1 -1
  26. package/assets/esri/core/workers/chunks/{07360fde6ea65664e6ca.js → 82d26884127ed772cc4b.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{ba3c18d1efde46461231.js → 8438fba57e82e4cc7c11.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{d1678945cf6a58f76863.js → 858b191c078d04232342.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{0ef5b0f8aa8a09acd6e0.js → 8e90c5fee4ad7c7275dc.js} +1 -1
  30. package/assets/esri/core/workers/chunks/918bdba41fa470cf77fd.js +1 -0
  31. package/assets/esri/core/workers/chunks/{3ec51b75d1a86dad6cb1.js → 91d2bdfa6e34c10b7f50.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{12dd892cf61a76fb40ad.js → 991e0f619f1f81f94d56.js} +1 -1
  33. package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +1 -0
  34. package/assets/esri/core/workers/chunks/a2409d4921c02614169a.js +1 -0
  35. package/assets/esri/core/workers/chunks/{7810579a5a780933cdc9.js → ad3e692681b50bd1acc2.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{adfa126cea32298c28e9.js → b1269b51cef3e11c85e3.js} +1 -1
  37. package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
  38. package/assets/esri/core/workers/chunks/{c7a94e569c905f97244a.js → b33122adfd1fb68f7c0f.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{da77eefaad83c0644380.js → b8fae500c69ca2cff62a.js} +1 -1
  40. package/assets/esri/core/workers/chunks/b9d9a1dc3c5d799e2685.js +1 -0
  41. package/assets/esri/core/workers/chunks/{79afe4674a0557eb26e4.js → bf26f58210755875748c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{5adeb979f178944b9ce5.js → c4c2b94e5cee7b824093.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{3e872e5e528dca7bee0c.js → cc75bbfd779f409943a3.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{4c5279fedf982a174706.js → d175953337fa655dc6b0.js} +1 -1
  45. package/assets/esri/core/workers/chunks/d35efcbe439500bf18bc.js +1 -0
  46. package/assets/esri/core/workers/chunks/d3d1dcb440588a295eba.js +1 -0
  47. package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +1 -0
  48. package/assets/esri/core/workers/chunks/{448ee44c7f594e5b2551.js → e410a09650530d7aad10.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{2345344be4b0e487d3a6.js → f198f4ba7d3d52882d98.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{881ddbdeb40336208e90.js → f29715459ecd46180829.js} +1 -1
  51. package/assets/esri/core/workers/chunks/f4e48bbdbc9da10ec71a.js +1 -0
  52. package/assets/esri/themes/base/widgets/_Directions.scss +59 -11
  53. package/assets/esri/themes/dark/main.css +1 -1
  54. package/assets/esri/themes/light/main.css +1 -1
  55. package/assets/esri/themes/light/view.css +1 -1
  56. package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
  57. package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
  58. package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
  59. package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
  60. package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
  61. package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
  62. package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
  63. package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
  64. package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
  65. package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
  66. package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
  67. package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
  68. package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
  69. package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
  70. package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
  71. package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
  72. package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
  73. package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
  74. package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
  75. package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
  76. package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
  77. package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
  78. package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
  79. package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
  80. package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
  81. package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
  82. package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
  83. package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
  84. package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
  85. package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
  86. package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
  87. package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
  88. package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
  89. package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
  90. package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
  91. package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
  92. package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
  93. package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
  94. package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
  95. package/chunks/ComponentShader.glsl.js +30 -30
  96. package/chunks/DefaultMaterial.glsl.js +19 -19
  97. package/chunks/HUDMaterial.glsl.js +34 -34
  98. package/chunks/MeasurementArrow.glsl.js +6 -6
  99. package/chunks/NativeLine.glsl.js +4 -4
  100. package/chunks/QuadraticBezier.js +1 -1
  101. package/chunks/RealisticTree.glsl.js +14 -14
  102. package/chunks/RibbonLine.glsl.js +32 -32
  103. package/chunks/Terrain.glsl.js +31 -31
  104. package/chunks/WaterSurface.glsl.js +15 -15
  105. package/copyright.txt +0 -29
  106. package/core/Collection.js +1 -1
  107. package/core/has.js +1 -1
  108. package/geometry/support/centroid.js +1 -1
  109. package/interfaces.d.ts +107 -13
  110. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  111. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  112. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  113. package/layers/mixins/ArcGISImageService.js +1 -1
  114. package/layers/mixins/ImageryTileMixin.js +1 -1
  115. package/layers/support/Sublayer.js +1 -1
  116. package/layers/support/capabilities.js +1 -1
  117. package/layers/support/featureLayerUtils.js +1 -1
  118. package/layers/support/labelUtils.js +1 -1
  119. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  120. package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
  121. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  122. package/package.json +4 -5
  123. package/popup/content/AttachmentsContent.js +1 -1
  124. package/popup/support/AttachmentsOrderByInfo.d.ts +4 -0
  125. package/popup/support/AttachmentsOrderByInfo.js +5 -0
  126. package/portal/schemas/definitions.js +1 -1
  127. package/rest/imageService/fetchRasterInfo.js +1 -1
  128. package/rest/query/operations/queryAttachments.js +1 -1
  129. package/rest/support/AttachmentQuery.js +1 -1
  130. package/support/revision.js +1 -1
  131. package/support/timeUtils.d.ts +0 -1
  132. package/support/timeUtils.js +1 -1
  133. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  134. package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedShader.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/line/gradientStrokeConstants.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
  139. package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
  140. package/views/2d/engine/webgl/util/createMatcher.js +1 -1
  141. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  142. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  144. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  145. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  146. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  147. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  148. package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
  149. package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
  150. package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
  151. package/views/3d/terrain/PatchRenderData.js +1 -1
  152. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  153. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  154. package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +3 -3
  155. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  156. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  157. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  160. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  166. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  168. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  169. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  170. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  171. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  172. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  173. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +8 -8
  174. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  175. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  176. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  177. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  178. package/views/layers/FeatureLayerView.js +1 -1
  179. package/views/layers/ImageryTileLayerView.d.ts +4 -0
  180. package/views/layers/ImageryTileLayerView.js +1 -1
  181. package/webscene/spec-certification/index.js +1 -1
  182. package/widgets/BasemapLayerList.js +1 -1
  183. package/widgets/Directions/DirectionsViewModel.js +1 -1
  184. package/widgets/Directions.js +1 -1
  185. package/widgets/LayerList.js +1 -1
  186. package/widgets/Legend/LegendViewModel.js +1 -1
  187. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  188. package/widgets/Legend.js +1 -1
  189. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  190. package/widgets/support/geolocationUtils.js +1 -1
  191. package/assets/esri/core/workers/chunks/06d72622590dbd38c5de.js +0 -1
  192. package/assets/esri/core/workers/chunks/0a19e1aec6a5502e391a.js +0 -1
  193. package/assets/esri/core/workers/chunks/12964a4b16113cdc9c93.js +0 -1
  194. package/assets/esri/core/workers/chunks/1e3ab66d0e8a7f160f33.js +0 -1
  195. package/assets/esri/core/workers/chunks/25c8cc30faade043c8dc.js +0 -2
  196. package/assets/esri/core/workers/chunks/34d464dacee52739c98c.js +0 -1
  197. package/assets/esri/core/workers/chunks/402de76b5de05615e111.js +0 -1
  198. package/assets/esri/core/workers/chunks/4cab082b8432ddc05345.js +0 -1
  199. package/assets/esri/core/workers/chunks/613db14d698741886753.js +0 -1
  200. package/assets/esri/core/workers/chunks/6e8905f20101c1f4509d.js +0 -2
  201. package/assets/esri/core/workers/chunks/7d3a441d2eb18d709ef9.js +0 -2
  202. package/assets/esri/core/workers/chunks/ba37ab9e560644dc1f18.js +0 -1
  203. package/assets/esri/core/workers/chunks/bf9bc52a3c559108c19a.js +0 -2
  204. package/assets/esri/core/workers/chunks/c74441fbe0f63633796f.js +0 -1
  205. package/assets/esri/core/workers/chunks/dd46ec81cebe1a0a7b9c.js +0 -1
  206. package/assets/esri/core/workers/chunks/e444ec05a8a1dfbd21a8.js +0 -1
  207. package/assets/esri/core/workers/chunks/f8367c21fa91435c7c53.js +0 -1
  208. package/assets/esri/core/workers/chunks/ffa2b9d70830aed03a8f.js +0 -1
  209. /package/{views/3d/webgl-engine/core/shaderLibrary/util → webscene/support}/AlphaCutoff.js +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import t from"../../geometry/Extent.js";import a from"../../geometry/Point.js";import l from"../../geometry/SpatialReference.js";import i from"../../layers/support/RasterInfo.js";import n from"../../layers/support/RasterStorageInfo.js";import{parseUrl as s,encode as r,asValidOptions as o}from"../utils.js";import u from"../support/FeatureSet.js";async function m(m,f,p){const c=s(m),{rasterFunction:d,sourceJSON:h}=f||{},g=d?JSON.stringify(d.rasterFunctionDefinition||d):null,y=r({...c.query,renderingRule:g,f:"json"}),x=o(y,p);m=c.path;const b=h||await e(m,x).then((e=>e.data)),v=b.hasRasterAttributeTable?e(`${m}/rasterAttributeTable`,x):null,S=b.hasColormap?e(`${m}/colormap`,x):null,V=b.hasHistograms?e(`${m}/histograms`,x):null,D=b.currentVersion>=10.3?e(`${m}/keyProperties`,x):null,I=b.hasMultidimensions?e(`${m}/multidimensionalInfo`,x):null,T=await Promise.allSettled([v,S,V,D,I]);let R=null;if(b.minValues&&b.minValues.length===b.bandCount){R=[];for(let e=0;e<b.minValues.length;e++)R.push({min:b.minValues[e],max:b.maxValues[e],avg:b.meanValues[e],stddev:b.stdvValues[e]})}const j=t.fromJSON(b.extent),w=Math.ceil(j.width/b.pixelSizeX-.1),M=Math.ceil(j.height/b.pixelSizeY-.1),N=l.fromJSON(b.spatialReference||b.extent.spatialReference),J="fulfilled"===T[0].status?T[0].value?.data:null,O=J?.features?.length?u.fromJSON(J):null,k="fulfilled"===T[1].status?T[1].value?.data.colormap:null,C=k?.length?k:null,P="fulfilled"===T[2].status?T[2].value?.data.histograms:null,z=P?.[0]?.counts?.length?P:null,F="fulfilled"===T[3].status?T[3].value?.data??{}:{},$="fulfilled"===T[4].status?T[4].value?.data.multidimensionalInfo:null,H=$?.variables?.length?$:null;H&&H.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))}));const{defaultVariable:L,serviceDataType:A}=b;L&&L!==F.DefaultVariable&&(F.DefaultVariable=L),A?.includes("esriImageServiceDataTypeVector")&&!A.includes(F.DataType)&&(F.DataType=A.replace("esriImageServiceDataType",""));let E=b.noDataValue;b.noDataValues?.length&&b.noDataValues.some((e=>e!==E))&&(E=b.noDataValues);const q=b.transposeInfo?new n({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a({x:b.extent.xmin,y:b.extent.ymax,spatialReference:N}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(w,M))/Math.LN2-8)),transposeInfo:b.transposeInfo}):void 0;return new i({width:w,height:M,bandCount:b.bandCount,extent:t.fromJSON(b.extent),spatialReference:N,pixelSize:new a({x:b.pixelSizeX,y:b.pixelSizeY,spatialReference:N}),pixelType:b.pixelType.toLowerCase(),statistics:R,attributeTable:O,colormap:C,histograms:z,keyProperties:F,noDataValue:E,multidimensionalInfo:H,storageInfo:q})}function f(e,t,a){return m(e,{sourceJSON:t},a)}function p(e,t,a){return m(e,{rasterFunction:t},a)}function c(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}export{f as fetchServiceRasterInfo,p as generateRasterInfo,c as patchServiceInfo};
5
+ import e from"../../request.js";import t from"../../geometry/Extent.js";import a from"../../geometry/Point.js";import i from"../../geometry/SpatialReference.js";import l from"../../layers/support/RasterInfo.js";import n from"../../layers/support/RasterStorageInfo.js";import{parseUrl as s,encode as r,asValidOptions as o}from"../utils.js";import u from"../support/FeatureSet.js";async function m(m,f,p){const c=s(m),{rasterFunction:d,sourceJSON:h}=f||{},g=d?JSON.stringify(d.rasterFunctionDefinition||d):null,y=r({...c.query,renderingRule:g,f:"json"}),x=o(y,p);m=c.path;const S=h||await e(m,x).then((e=>e.data)),b=S.hasRasterAttributeTable?e(`${m}/rasterAttributeTable`,x):null,v=S.hasColormap?e(`${m}/colormap`,x):null,V=S.hasHistograms?e(`${m}/histograms`,x):null,D=S.currentVersion>=10.3?e(`${m}/keyProperties`,x):null,I=S.hasMultidimensions?e(`${m}/multidimensionalInfo`,x):null,T=await Promise.allSettled([b,v,V,D,I]);let R=null;if(S.minValues&&S.minValues.length===S.bandCount){R=[];for(let e=0;e<S.minValues.length;e++)R.push({min:S.minValues[e],max:S.maxValues[e],avg:S.meanValues[e],stddev:S.stdvValues[e]})}const j=t.fromJSON(S.extent),w=Math.ceil(j.width/S.pixelSizeX-.1),M=Math.ceil(j.height/S.pixelSizeY-.1),N=i.fromJSON(S.spatialReference||S.extent.spatialReference),O="fulfilled"===T[0].status?T[0].value?.data:null,J=O?.features?.length?u.fromJSON(O):null,k="fulfilled"===T[1].status?T[1].value?.data.colormap:null,C=k?.length?k:null,P="fulfilled"===T[2].status?T[2].value?.data.histograms:null,z=P?.[0]?.counts?.length?P:null,F="fulfilled"===T[3].status?T[3].value?.data??{}:{},$="fulfilled"===T[4].status?T[4].value?.data.multidimensionalInfo:null,E=$?.variables?.length?$:null;E&&E.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),e.dimensions?.forEach((e=>{"StdTime"!==e.name||e.recurring||e.unit||(e.unit="ISO8601")}))}));const{defaultVariable:H,serviceDataType:L}=S;H&&H!==F.DefaultVariable&&(F.DefaultVariable=H),L?.includes("esriImageServiceDataTypeVector")&&!L.includes(F.DataType)&&(F.DataType=L.replace("esriImageServiceDataType",""));let A=S.noDataValue;S.noDataValues?.length&&S.noDataValues.some((e=>e!==A))&&(A=S.noDataValues);const q=S.transposeInfo?new n({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new a({x:S.extent.xmin,y:S.extent.ymax,spatialReference:N}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(w,M))/Math.LN2-8)),transposeInfo:S.transposeInfo}):void 0;return new l({width:w,height:M,bandCount:S.bandCount,extent:t.fromJSON(S.extent),spatialReference:N,pixelSize:new a({x:S.pixelSizeX,y:S.pixelSizeY,spatialReference:N}),pixelType:S.pixelType.toLowerCase(),statistics:R,attributeTable:J,colormap:C,histograms:z,keyProperties:F,noDataValue:A,multidimensionalInfo:E,storageInfo:q})}function f(e,t,a){return m(e,{sourceJSON:t},a)}function p(e,t,a){return m(e,{rasterFunction:t},a)}function c(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}export{f as fetchServiceRasterInfo,p as generateRasterInfo,c as patchServiceInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{addTokenParameter as t}from"../../../kernel.js";import o from"../../../request.js";import{addProxy as e}from"../../../core/urlUtils.js";import{mapParameters as n}from"../../operations/urlUtils.js";import r from"../support/AttachmentInfo.js";function s(t){const o=t.toJSON();return o.attachmentTypes&&(o.attachmentTypes=o.attachmentTypes.join(",")),o.keywords&&(o.keywords=o.keywords.join(",")),o.globalIds&&(o.globalIds=o.globalIds.join(",")),o.objectIds&&(o.objectIds=o.objectIds.join(",")),o.size&&(o.size=o.size.join(",")),o}function a(o,n){const s={};for(const a of n){const{parentObjectId:n,parentGlobalId:c,attachmentInfos:m}=a;for(const a of m){const{id:m}=a,p=e(t(`${o.path}/${n}/attachments/${m}`)),i=r.fromJSON(a);i.set({url:p,parentObjectId:n,parentGlobalId:c}),s[n]?s[n].push(i):s[n]=[i]}}return s}function c(t,e,r){let a={query:n({...t.query,f:"json",...s(e)})};return r&&(a={...r,...a,query:{...r.query,...a.query}}),o(t.path+"/queryAttachments",a).then((t=>t.data.attachmentGroups))}async function m(t,e,n){const{objectIds:r}=e,s=[];for(const a of r)s.push(o(t.path+"/"+a+"/attachments",n));return Promise.all(s).then((t=>r.map(((o,e)=>({parentObjectId:o,attachmentInfos:t[e].data.attachmentInfos})))))}export{c as executeAttachmentQuery,m as fetchAttachments,a as processAttachmentQueryResult};
5
+ import{addTokenParameter as t}from"../../../kernel.js";import o from"../../../request.js";import{addProxy as e}from"../../../core/urlUtils.js";import{mapParameters as r}from"../../operations/urlUtils.js";import n from"../support/AttachmentInfo.js";function s(t){const o=t.toJSON();return o.attachmentTypes&&(o.attachmentTypes=o.attachmentTypes.join(",")),o.keywords&&(o.keywords=o.keywords.join(",")),o.globalIds&&(o.globalIds=o.globalIds.join(",")),o.objectIds&&(o.objectIds=o.objectIds.join(",")),o.size&&(o.size=o.size.join(",")),o.orderByFields&&(o.orderByFields=o.orderByFields.join(",")),o}function a(o,r){const s={};for(const a of r){const{parentObjectId:r,parentGlobalId:c,attachmentInfos:i}=a;for(const a of i){const{id:i}=a,d=e(t(`${o.path}/${r}/attachments/${i}`)),m=n.fromJSON(a);m.set({url:d,parentObjectId:r,parentGlobalId:c}),s[r]?s[r].push(m):s[r]=[m]}}return s}function c(t,e,n){let a={query:r({...t.query,f:"json",...s(e)})};return n&&(a={...n,...a,query:{...n.query,...a.query}}),o(t.path+"/queryAttachments",a).then((t=>t.data.attachmentGroups))}async function i(t,e,r){const{objectIds:n}=e,s=[];for(const a of n)s.push(o(t.path+"/"+a+"/attachments",r));return Promise.all(s).then((t=>n.map(((o,e)=>({parentObjectId:o,attachmentInfos:t[e].data.attachmentInfos})))))}export{c as executeAttachmentQuery,i as fetchAttachments,a as processAttachmentQueryResult};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../../core/accessorSupport/decorators/writer.js";var a;let p=a=class extends e{constructor(t){super(t),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new a(r({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};t([o({type:[String],json:{write:!0}})],p.prototype,"attachmentTypes",void 0),t([o({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],p.prototype,"attachmentsWhere",void 0),t([o({type:Boolean,json:{write:!0}})],p.prototype,"cacheHint",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"keywords",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"globalIds",void 0),t([o({json:{write:!0}})],p.prototype,"name",void 0),t([o({type:Number,json:{read:{source:"resultRecordCount"}}})],p.prototype,"num",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"objectIds",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],p.prototype,"returnMetadata",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"size",void 0),t([o({type:Number,json:{read:{source:"resultOffset"}}})],p.prototype,"start",void 0),t([n("start"),n("num")],p.prototype,"writeStart",null),t([o({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],p.prototype,"where",void 0),p=a=t([i("esri.rest.support.AttachmentQuery")],p),p.from=s(p);const c=p;export{c as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/JSONSupport.js";import{clone as r}from"../../core/lang.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as n}from"../../core/accessorSupport/decorators/writer.js";var a;let p=a=class extends e{constructor(t){super(t),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.orderByFields=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new a(r({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};t([o({type:[String],json:{write:!0}})],p.prototype,"attachmentTypes",void 0),t([o({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],p.prototype,"attachmentsWhere",void 0),t([o({type:Boolean,json:{write:!0}})],p.prototype,"cacheHint",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"keywords",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"globalIds",void 0),t([o({json:{write:!0}})],p.prototype,"name",void 0),t([o({type:Number,json:{read:{source:"resultRecordCount"}}})],p.prototype,"num",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"objectIds",void 0),t([o({type:[String],json:{write:!0}})],p.prototype,"orderByFields",void 0),t([o({type:Boolean,json:{default:!1,write:!0}})],p.prototype,"returnMetadata",void 0),t([o({type:[Number],json:{write:!0}})],p.prototype,"size",void 0),t([o({type:Number,json:{read:{source:"resultOffset"}}})],p.prototype,"start",void 0),t([n("start"),n("num")],p.prototype,"writeStart",null),t([o({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],p.prototype,"where",void 0),p=a=t([i("esri.rest.support.AttachmentQuery")],p),p.from=s(p);const c=p;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const d="20250203",e="e492d27b68c928b298745dd02a8e98dfaf004fe0";export{d as buildDate,e as commitHash};
5
+ const e="20250204",b="601f1abcea1ede2e6fb4b4be6876533deac91e21";export{e as buildDate,b as commitHash};
@@ -2,4 +2,3 @@ import "../interfaces";
2
2
 
3
3
  export const getTimeExtentFromLayers: __esri.timeUtils["getTimeExtentFromLayers"];
4
4
  export const getTimeSliderSettingsFromWebDocument: __esri.timeUtils["getTimeSliderSettingsFromWebDocument"];
5
- export const getTimeSliderSettingsFromWebMap: __esri.timeUtils["getTimeSliderSettingsFromWebMap"];
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as t}from"../core/arrayUtils.js";import{deprecatedFunction as e}from"../core/deprecate.js";import{clone as n}from"../core/lang.js";import i from"../core/Logger.js";import{offsetDate as r}from"../core/timeUtils.js";import s from"../time/TimeExtent.js";import{isWebMap as l}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function m(t){return void 0!==t.timeInfo}async function u(t,e){return t.widgets?.timeSlider?.fullTimeExtent??f(t.allLayers,e)}function a(t){const e=t.numThumbs??2,n=t.currentTimeExtent;if(n){const{start:t,end:i}=n;return null!=t&&null!=i&&t.getTime()===i.getTime()?"instant":2===e?"time-window":null==t||0===t.getTime()?"cumulative-from-start":"cumulative-from-end"}return 2===e?"time-window":"cumulative-from-start"}function c(t){const{numStops:e,stopInterval:i,stops:r}=t;return r?{dates:n(r)}:i?{interval:i.clone()}:{count:e??5}}async function f(e,n){if(0===e.length)return s.allTime;await Promise.all(e.map((t=>t.load({signal:n}))));const i=e.filter(m),r=e.filter((t=>!m(t)&&null!=t.visibilityTimeExtent));if(0===i.length&&0===r.length)return s.allTime;const l=[],o=[];for(const t of i)"feature"!==t?.type&&"map-image"!==t?.type||!t.timeInfo?.hasLiveData?o.push(t):l.push(t);const u=t=>null==t||t.isAllTime,a=[...o.map((t=>{const e=t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=t;return e?.intersection(n)??n})),...r.map((t=>t.visibilityTimeExtent))];if(a.some(u))return s.allTime;const c=l.map((async t=>{const e=(await t.fetchRecomputedExtents({signal:n}))?.timeExtent??t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:i}=t;return e?.intersection(i)??i})),f=(await Promise.allSettled(c)).map((t=>"fulfilled"===t.status?t.value:null));if(f.some(u))return s.allTime;const p=[...f,...a].filter(t);if(0===p.length)return s.allTime;return p.reduce(((t,e)=>t.union(e)))}function p(t,e){const n=t.currentTimeExtent;if(!n)return null;const{start:i,end:r}=n,l=i??r??null;switch(e){case"time-window":return new s({start:i,end:r});case"cumulative-from-start":return new s({start:null,end:l});case"cumulative-from-end":return new s({start:l,end:null});case"instant":return new s({start:l,end:l})}}async function d(t,n){return e(i.getLogger("esri.support.timeUtils.getTimeSliderSettingsFromWebMap"),"`timeUtils.getTimeSliderSettingsFromWebMap` is deprecated in favor of 'timeUtils.getTimeSliderSettingsFromWebDocument'",{replacement:"timeUtils.getTimeSliderSettingsFromWebDocument",version:"4.30",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-support-timeUtils.html#getTimeSliderSettingsFromWebDocument",warnOnce:!0}),null!=t&&l(t)?await g(t,n):null}async function g(t,e){if(!l(t)&&!o(t))return null;await t.load({signal:e});const n=t?.widgets?.timeSlider;if(!n)return null;const i=await u(t,e),r=n.loop,s=a(n);return{fullTimeExtent:i,loop:r,mode:s,playRate:n.stopDelay??2e3,stops:c(n),timeExtent:p(n,s)}}function T(t){if(!t)return t;const{start:e,end:n}=t;return new s({start:null!=e?r(e,-e.getTimezoneOffset(),"minutes"):e,end:null!=n?r(n,-n.getTimezoneOffset(),"minutes"):n})}function w(t){if(!t)return t;const{start:e,end:n}=t;return new s({start:null!=e?r(e,e.getTimezoneOffset(),"minutes"):e,end:null!=n?r(n,n.getTimezoneOffset(),"minutes"):n})}export{f as getTimeExtentFromLayers,g as getTimeSliderSettingsFromWebDocument,d as getTimeSliderSettingsFromWebMap,w as toLocalTimeExtent,T as toUTCTimeExtent};
5
+ import{isSome as t}from"../core/arrayUtils.js";import{clone as e}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import i from"../time/TimeExtent.js";import{isWebMap as r}from"../webmap/utils.js";import{isWebScene as l}from"../webscene/utils.js";function s(t){return void 0!==t.timeInfo}async function u(t,e){return t.widgets?.timeSlider?.fullTimeExtent??a(t.allLayers,e)}function o(t){const e=t.numThumbs??2,n=t.currentTimeExtent;if(n){const{start:t,end:i}=n;return null!=t&&null!=i&&t.getTime()===i.getTime()?"instant":2===e?"time-window":null==t||0===t.getTime()?"cumulative-from-start":"cumulative-from-end"}return 2===e?"time-window":"cumulative-from-start"}function m(t){const{numStops:n,stopInterval:i,stops:r}=t;return r?{dates:e(r)}:i?{interval:i.clone()}:{count:n??5}}async function a(e,n){if(0===e.length)return i.allTime;await Promise.all(e.map((t=>t.load({signal:n}))));const r=e.filter(s),l=e.filter((t=>!s(t)&&null!=t.visibilityTimeExtent));if(0===r.length&&0===l.length)return i.allTime;const u=[],o=[];for(const t of r)"feature"!==t?.type&&"map-image"!==t?.type||!t.timeInfo?.hasLiveData?o.push(t):u.push(t);const m=t=>null==t||t.isAllTime,a=[...o.map((t=>{const e=t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=t;return e?.intersection(n)??n})),...l.map((t=>t.visibilityTimeExtent))];if(a.some(m))return i.allTime;const f=u.map((async t=>{const e=(await t.fetchRecomputedExtents({signal:n}))?.timeExtent??t.timeInfo?.fullTimeExtent,{visibilityTimeExtent:i}=t;return e?.intersection(i)??i})),c=(await Promise.allSettled(f)).map((t=>"fulfilled"===t.status?t.value:null));if(c.some(m))return i.allTime;const d=[...c,...a].filter(t);if(0===d.length)return i.allTime;return d.reduce(((t,e)=>t.union(e)))}function f(t,e){const n=t.currentTimeExtent;if(!n)return null;const{start:r,end:l}=n,s=r??l??null;switch(e){case"time-window":return new i({start:r,end:l});case"cumulative-from-start":return new i({start:null,end:s});case"cumulative-from-end":return new i({start:s,end:null});case"instant":return new i({start:s,end:s})}}async function c(t,e){if(!r(t)&&!l(t))return null;await t.load({signal:e});const n=t?.widgets?.timeSlider;if(!n)return null;const i=await u(t,e),s=n.loop,a=o(n);return{fullTimeExtent:i,loop:s,mode:a,playRate:n.stopDelay??2e3,stops:m(n),timeExtent:f(n,a)}}function d(t){if(!t)return t;const{start:e,end:r}=t;return new i({start:null!=e?n(e,-e.getTimezoneOffset(),"minutes"):e,end:null!=r?n(r,-r.getTimezoneOffset(),"minutes"):r})}function p(t){if(!t)return t;const{start:e,end:r}=t;return new i({start:null!=e?n(e,e.getTimezoneOffset(),"minutes"):e,end:null!=r?n(r,r.getTimezoneOffset(),"minutes"):r})}export{a as getTimeExtentFromLayers,c as getTimeSliderSettingsFromWebDocument,p as toLocalTimeExtent,d as toUTCTimeExtent};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- 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 o,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as a}from"../../geometry/GeometryCursor.js";import{fromValues as l,create as h,empty as c,expandPointInPlace as m,center as f,width as u,height as d,diagonal 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{isPoint as y,isPolygon as P,isPolyline as S,isExtent as w,isMultipoint as x}from"../../geometry/support/jsonUtils.js";import{SimpleEffectCursor as M}from"./CIMEffects.js";import b 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{LineCapStyle as T,LineJoinStyle as R}from"./enums.js";import{getFirstFrame as z}from"./imageUtils.js";import{rotate as L}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import U from"./Rect.js";import A from"./TextRasterizer.js";import{getNumericValue as j,isCIMFill as G,getSize as D,isSVGImage as H,getRelativeGradientSize as B,fromCIMFontDecoration as E,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontStyle as W,getFontWeight as Y}from"./utils.js";import{destroyHiddenSvg as $,createHiddenSvg as K,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{glyphSize as Z,magicLabelLineHeight 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 ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const nt=Math.PI/180,at=.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,o=i[0]*s[0]+i[3]*s[1],n=i[1]*s[0]+i[4]*s[1],a=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]=o,m[1]=n,m[2]=a,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,o=-t[1]*e,n=-t[3]*e,a=t[0]*e;return new ht([s,o,r,n,a,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new s(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)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():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]}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()}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){const r=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.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._resourceManager.geometryEngine;let i=new M(a.fromJSONCIM(e));for(const s of t){const t=k(s);t&&(i=t.execute(i,s,this.geomUnitsPerPoint(),null,r))}return i}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 o=i.execute(a.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(o){let e=null;for(;(e=o.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(y(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 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=j(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,o=r.height;if(!s||!o)return;const n=s/o,a=j(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*n*a,r*=i),l.translate(-e,-r)}let c=j(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*nt);let m=j(t.offsetX),f=j(t.offsetY);if(m||f){if(this._mapRotation){const t=nt*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,!1),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=j(t.size,I.CIMVectorMarker.size),s=t.frame,o=s?s.ymax-s.ymin:0,n=i&&o?i/o:1,a=ht.createIdentity();s&&a.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/=n,r/=n),a.translate(-e,-r)}1!==n&&a.scale(n,n);let h=j(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*nt);let c=j(t.offsetX),m=j(t.offsetY);if(c||m){if(this._mapRotation){const t=nt*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const d of r){d?.symbol&&d.geometry||lt().error("Invalid marker graphic",d);let t=d.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(d.symbol,d.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!y(e))return;if(j(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=j(t.angle);s=-s,s&&i.rotate(s*nt);const o=j(t.offsetX),n=j(t.offsetY);(o||n)&&i.translate(o,n);const a=this.geomUnitsPerPoint();1!==a&&i.scale(a,a),i.translate(e.x,e.y),this.push(i,!1),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(w(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(j(r,I.CIMSolidStroke.width)),.5*at);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(w(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=j(t.scaleX,1);let s=i*e,o=e;const n=this._resourceManager.getResource(r);if(null!=n){const t=n.height/n.width;s=i*(e?t>1?e:e/t:n.width),o=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-o/2]),0),this._merge(this.transformPt([-s/2,o/2]),0),this._merge(this.transformPt([s/2,-o/2]),0),this._merge(this.transformPt([s/2,o/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=o(i),s=o(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);i*=n,s*=n;let a=0;switch(t.horizontalAlignment){case"Left":a=i/2;break;case"Right":a=-i/2}let l=0;switch(t.verticalAlignment){case"Bottom":l=s/2;break;case"Top":l=-s/2;break;case"Baseline":l=s/6}this._merge(this.transformPt([-i/2+a,-s/2+l]),0),this._merge(this.transformPt([-i/2+a,s/2+l]),0),this._merge(this.transformPt([i/2+a,-s/2+l]),0),this._merge(this.transformPt([i/2+a,s/2+l]),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._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=$(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i,s,a){const l=a*n(1);this.setTransform(),this.setGeomUnitsPerPoint(l),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/l,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);if(this._mapRotation=h?s:0,!has("esri-mobile")){const t=o(et*window.devicePixelRatio),r=o(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(G))&&"CIMMeshSymbol"!==e?.type&&(D(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,o,n){null!=n?this._hittestSvgPath(t,n,!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)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=j(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const o=e*this.geomUnitsPerPoint(),n=o*i*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<n/2+l&&Math.abs(a[1])<o/2+l&&(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(j(t.height,I.CIMTextSymbol.height)),{lineGapType:o,lineGap:n}=t,a=o?Pt(o,j(n),s):0,l="CIMBackgroundCallout"===t.callout?.type,h=it(i.glyphMosaicItems,{scale:s/Z,angle:0,xOffset:0,yOffset:0,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:ot(t.lineWidth),lineHeight:tt*Math.max(.25,Math.min(a||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}),c=this.reverseTransformPt(this._searchPoint),m=c[0],f=c[1];for(const u of h.glyphs)if(m>u.xTopLeft&&m<u.xBottomRight&&f>-u.yBottomRight&&f<-u.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(w(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}const r=this.reverseTransformPt(this._searchPoint);if(gt(r,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(r,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=K(),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=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),o=this.reverseTransformPt(this._searchPoint),n=h();p(n,t);const a={x:n[0],y:n[1],width:n[2]-n[0],height:n[3]-n[1]},l=this._getSvgPath();l.setAttribute("d",e);const c=l.getBBox();let m=Math.max(c.width/a.width,c.height/a.height),f=1;const u=2*s*m;u<1&&(f=2/u,m*=f,c.x*=f,c.y*=f,c.width*=f,c.height*=f);const d=1+i*m/2,g=this._getCanvasContext(c.width+2*d,c.height+2*d);g.setTransform(f,0,0,f,-c.x+d,-c.y+d);const _=new Path2D(e);r?g.fill(_):(g.lineWidth=i*(m/f),g.stroke(_));const y=(a.width*m-c.width)/2,P=(a.height*m-c.height)/2,S=Math.floor((o[0]-a.x-s)*m-y+d),w=Math.floor((a.height-(o[1]-a.y)-s)*m+P+d),x=Math.ceil(2*s*m),M=Math.ceil(2*s*m),b=g.getImageData(S,w,x,M).data;for(let h=3;h<b.length;h+=4)if(b[h]>127.5)return void(this._earlyReturn=!0)}_hitTestStroke(t,e){let r=null;if(w(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}pt(this.reverseTransformPt(this._searchPoint),r,j(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new b,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(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(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,o){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(!w(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(r),at),this._setCapStyle(i),this._setJoinStyle(s),n.miterLimit=o,n.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(!w(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,o=j(t.scaleX,1),n=this._resourceManager.getResource(i);if(null==n)return;let a=e*(n.width/n.height),l=e;e||(a=n.width,l=n.height);const h=H(i)||"src"in n&&H(n.src);let c="getFrame"in n?z(n):n;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:o*d*f,m12:o*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-a/2,-l/2,a,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t,this.transformSize(o(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:n,anchorY:a,canvas:l}=i,h=s[0]*(n+.5),c=s[1]*(a-.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:-1*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:o,rotation:n,scaleX:a,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(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=H(h)||"src"in c&&H(c.src);let u,d="getFrame"in c?z(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);n||(n=0),s?s*=t:s=0,o?o*=t:o=0,i&&(i*=t);const e=i?i/c.height:1,r=a&&i?a*i/c.width:1;if(0!==n||1!==e||1!==r||0!==s||0!==o){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,o).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:o,miterLimit:a,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(!w(t))return x(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=H(h)||"src"in m&&H(m.src);let d="getFrame"in m?z(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(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(o),void 0!==a&&(_.miterLimit=a),_.lineWidth=g;for(let n of f)if(n=e(n),xt(n),n&&!(n.length<=1)){M=this.transformPt(n[0]);for(let t=1;t<n.length;t++){b=this.transformPt(n[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(!w(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:o,gradientSize:a,gradientSizeUnits:l}=e,h=I.CIMGradientFill,p=e.gradientType??h.gradientType,_=-i(s??0),y=c();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"!==o&&"Rectangular"!==o||(t=L(t,-_)),m(y,t)}}const[x,M,b,k]=y,C=this._ctx;switch(C.save(),o){case"Buffered":lt().error(`Gradient method "${o}" currently unsupported.`);break;case"Linear":{const t=(M+k)/2,r="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(b-x),[i,s]="Discrete"===p?[b,b-r]:[x+r,x],o=L([i,t],_),c=L([s,t],_),m=C.createLinearGradient(o[0],o[1],c[0],c[1]);F(m,e),C.fillStyle=m,C.fill("evenodd");break}case"Circular":{const t=f(y),r=g(y)/2,i="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*r,[s,o]="Discrete"===p?[r,r-i]:[i,0],c=C.createRadialGradient(t[0],t[1],s,t[0],t[1],o);F(c,e),C.fillStyle=c,C.fill("evenodd");break}case"Rectangular":{const r=f(y),i=r[0],s=r[1],o=L(r,_),c=(r,i,s,n,a,l,h,c)=>{C.save(),this.pushClipPath(t);const m=L([a,l],_),f=L([h,c],_);C.beginPath(),C.moveTo(o[0],o[1]),C.lineTo(m[0],m[1]),C.lineTo(f[0],f[1]),C.lineTo(o[0],o[1]),C.clip();const u=L([r,i],_),d=L([s,n],_),g=C.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),C.fillStyle=g,C.fill("evenodd"),C.restore()};let m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(u(y)/2),[g,P]="Discrete"===p?[b,b-m]:[i+m,i];c(g,s,P,s,b,M,b,k),[g,P]="Discrete"===p?[x,x+m]:[i-m,i],c(g,s,P,s,x,k,x,M),m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(d(y)/2);let[S,w]="Discrete"===p?[k,k-m]:[s+m,s];c(i,S,i,w,b,k,x,k),[S,w]="Discrete"===p?[M,M+m]:[s-m,s],c(i,S,i,w,x,M,b,M);break}}C.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:o,gradientSizeUnits:a,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(!w(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(n(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(_),xt(_),!_||_.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"===a?this.transformSize(n(o)):B(o,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 o=p[0]-g[0],n=p[1]-g[1],a=Math.sqrt(o*o+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=L([o/a,n/a],-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=o/a,r=n/a;"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);F(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=a,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 T.Butt:this._ctx.lineCap="butt";break;case T.Round:this._ctx.lineCap="round";break;case T.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case R.Bevel:this._ctx.lineJoin="bevel";break;case R.Round:this._ctx.lineJoin="round";break;case R.Miter:this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=j(t.separation,I.CIMHatchFill.separation)*r,s=j(t.rotation);if(0===i)return null;i<0&&(i=-i);let o=0;const n=.5*i;for(;o>n;)o-=i;for(;o<-n;)o+=i;const a=h();p(a,e),a[0]-=n,a[1]-=n,a[2]+=n,a[3]+=n;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const c=Math.cos(s*nt),m=Math.sin(s*nt),f=-i*m,u=i*c;let d,g,_,y;o=j(t.offsetX)*r*m-j(t.offsetY)*r*c,d=_=Number.MAX_VALUE,g=y=-Number.MAX_VALUE;for(const h of l){const t=h[0],e=h[1],r=c*t+m*e,i=-m*t+c*e;d=Math.min(d,r),_=Math.min(_,i),g=Math.max(g,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=c*d-m*_-f*o/i,S=m*d+c*_-u*o/i,w=c*g-m*_-f*o/i,x=m*g+c*_-u*o/i;const M=1+Math.round((y-_)/i),b=[];for(let h=0;h<M;h++)P+=f,S+=u,w+=f,x+=u,b.push([[P,S],[w,x]]);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],o=i[s];if(e[1]>t[1]==o[1]>t[1])continue;(o[0]-e[0])*(t[1]-e[1])-(o[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],o=i[s];let n=(o[0]-e[0])*(o[0]-e[0])+(o[1]-e[1])*(o[1]-e[1]);if(0===n)continue;n=Math.sqrt(n);const a=((o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0]))/n;if(Math.abs(a)<r){const i=((o[0]-e[0])*(t[0]-e[0])+(o[1]-e[1])*(t[1]-e[1]))/n;if(i>-r&&i<n+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=E(e),s=X(e.fontStyleName),o=e.fontFamilyName??t,{weight:n,style:a}=s,l=r*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=q(e.symbol),g=r*(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:o,style:W(a),weight:Y(n),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:a},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const wt=1e-4;function xt(t){let e,r,i,s,o,n=t[0],a=1;for(;a<t.length;)e=t[a][0]-n[0],r=t[a][1]-n[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=wt?(t.splice(a-1,1),n=o):(o=n,n=t[a],a++),i=s}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,nt as cDegToRad,Pt as lineGapType2LineHeight};
5
+ 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 o,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as a}from"../../geometry/GeometryCursor.js";import{fromValues as l,create as h,empty as c,expandPointInPlace as m,center as f,width as u,height as d,diagonal 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{isPoint as y,isPolygon as P,isPolyline as S,isExtent as w,isMultipoint as x}from"../../geometry/support/jsonUtils.js";import{SimpleEffectCursor as M}from"./CIMEffects.js";import b 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{LineCapStyle as T,LineJoinStyle as R}from"./enums.js";import{getFirstFrame as z}from"./imageUtils.js";import{rotate as L}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import U from"./Rect.js";import A from"./TextRasterizer.js";import{getNumericValue as j,isCIMFill as G,getSize as D,isSVGImage as H,getRelativeGradientSize as B,fromCIMFontDecoration as E,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontStyle as W,getFontWeight as Y}from"./utils.js";import{destroyHiddenSvg as $,createHiddenSvg as K,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{glyphSize as Z,magicLabelLineHeight 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 ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const nt=Math.PI/180,at=.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,o=i[0]*s[0]+i[3]*s[1],n=i[1]*s[0]+i[4]*s[1],a=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]=o,m[1]=n,m[2]=a,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,o=-t[1]*e,n=-t[3]*e,a=t[0]*e;return new ht([s,o,r,n,a,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new s(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)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():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]}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()}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){const r=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.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._resourceManager.geometryEngine;let i=new M(a.fromJSONCIM(e));for(const s of t){const t=k(s);t&&(i=t.execute(i,s,this.geomUnitsPerPoint(),null,r))}return i}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 o=i.execute(a.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(o){let e=null;for(;(e=o.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(y(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=j(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,o=r.height;if(!s||!o)return;const n=s/o,a=j(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*n*a,r*=i),l.translate(-e,-r)}let c=j(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*nt);let m=j(t.offsetX),f=j(t.offsetY);if(m||f){if(this._mapRotation){const t=nt*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,!1),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=j(t.size,I.CIMVectorMarker.size),s=t.frame,o=s?s.ymax-s.ymin:0,n=i&&o?i/o:1,a=ht.createIdentity();s&&a.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/=n,r/=n),a.translate(-e,-r)}1!==n&&a.scale(n,n);let h=j(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*nt);let c=j(t.offsetX),m=j(t.offsetY);if(c||m){if(this._mapRotation){const t=nt*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const d of r){d?.symbol&&d.geometry||lt().error("Invalid marker graphic",d);let t=d.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(d.symbol,d.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!y(e))return;if(j(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=j(t.angle);s=-s,s&&i.rotate(s*nt);const o=j(t.offsetX),n=j(t.offsetY);(o||n)&&i.translate(o,n);const a=this.geomUnitsPerPoint();1!==a&&i.scale(a,a),i.translate(e.x,e.y),this.push(i,!1),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(w(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(j(r,I.CIMSolidStroke.width)),.5*at);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(w(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=j(t.scaleX,1);let s=i*e,o=e;const n=this._resourceManager.getResource(r);if(null!=n){const t=n.height/n.width;s=i*(e?t>1?e:e/t:n.width),o=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-o/2]),0),this._merge(this.transformPt([-s/2,o/2]),0),this._merge(this.transformPt([s/2,-o/2]),0),this._merge(this.transformPt([s/2,o/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=o(i),s=o(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);i*=n,s*=n;let a=0;switch(t.horizontalAlignment){case"Left":a=i/2;break;case"Right":a=-i/2}let l=0;switch(t.verticalAlignment){case"Bottom":l=s/2;break;case"Top":l=-s/2;break;case"Baseline":l=s/6}this._merge(this.transformPt([-i/2+a,-s/2+l]),0),this._merge(this.transformPt([-i/2+a,s/2+l]),0),this._merge(this.transformPt([i/2+a,-s/2+l]),0),this._merge(this.transformPt([i/2+a,s/2+l]),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._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=$(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i,s,a){const l=a*n(1);this.setTransform(),this.setGeomUnitsPerPoint(l),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/l,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type);if(this._mapRotation=h?s:0,!has("esri-mobile")){const t=o(et*window.devicePixelRatio),r=o(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(G))&&"CIMMeshSymbol"!==e?.type&&(D(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,o,n){null!=n?this._hittestSvgPath(t,n,!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)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=j(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const o=e*this.geomUnitsPerPoint(),n=o*i*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<n/2+l&&Math.abs(a[1])<o/2+l&&(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(j(t.height,I.CIMTextSymbol.height)),{lineGapType:o,lineGap:n}=t,a=o?Pt(o,j(n),s):0,l="CIMBackgroundCallout"===t.callout?.type,h=it(i.glyphMosaicItems,{scale:s/Z,angle:0,xOffset:0,yOffset:0,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:ot(t.lineWidth),lineHeight:tt*Math.max(.25,Math.min(a||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}),c=this.reverseTransformPt(this._searchPoint),m=c[0],f=c[1];for(const u of h.glyphs)if(m>u.xTopLeft&&m<u.xBottomRight&&f>-u.yBottomRight&&f<-u.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(w(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}const r=this.reverseTransformPt(this._searchPoint);if(gt(r,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(r,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=K(),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=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),o=this.reverseTransformPt(this._searchPoint),n=h();p(n,t);const a={x:n[0],y:n[1],width:n[2]-n[0],height:n[3]-n[1]},l=this._getSvgPath();l.setAttribute("d",e);const c=l.getBBox();let m=Math.max(c.width/a.width,c.height/a.height),f=1;const u=2*s*m;u<1&&(f=2/u,m*=f,c.x*=f,c.y*=f,c.width*=f,c.height*=f);const d=1+i*m/2,g=this._getCanvasContext(c.width+2*d,c.height+2*d);g.setTransform(f,0,0,f,-c.x+d,-c.y+d);const _=new Path2D(e);r?g.fill(_):(g.lineWidth=i*(m/f),g.stroke(_));const y=(a.width*m-c.width)/2,P=(a.height*m-c.height)/2,S=Math.floor((o[0]-a.x-s)*m-y+d),w=Math.floor((a.height-(o[1]-a.y)-s)*m+P+d),x=Math.ceil(2*s*m),M=Math.ceil(2*s*m),b=g.getImageData(S,w,x,M).data;for(let h=3;h<b.length;h+=4)if(b[h]>127.5)return void(this._earlyReturn=!0)}_hitTestStroke(t,e){let r=null;if(w(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}pt(this.reverseTransformPt(this._searchPoint),r,j(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new b,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(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(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,o){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(!w(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(r),at),this._setCapStyle(i),this._setJoinStyle(s),n.miterLimit=o,n.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(!w(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,o=j(t.scaleX,1),n=this._resourceManager.getResource(i);if(null==n)return;let a=e*(n.width/n.height),l=e;e||(a=n.width,l=n.height);const h=H(i)||"src"in n&&H(n.src);let c="getFrame"in n?z(n):n;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:o*d*f,m12:o*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-a/2,-l/2,a,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new A);const r=St(t,this.transformSize(o(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:n,anchorY:a,canvas:l}=i,h=s[0]*(n+.5),c=s[1]*(a-.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:-1*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:o,rotation:n,scaleX:a,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(w(t))this._buildPath(yt(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=H(h)||"src"in c&&H(c.src);let u,d="getFrame"in c?z(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);n||(n=0),s?s*=t:s=0,o?o*=t:o=0,i&&(i*=t);const e=i?i/c.height:1,r=a&&i?a*i/c.width:1;if(0!==n||1!==e||1!==r||0!==s||0!==o){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,o).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:o,miterLimit:a,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(!w(t))return x(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=H(h)||"src"in m&&H(m.src);let d="getFrame"in m?z(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(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(o),void 0!==a&&(_.miterLimit=a),_.lineWidth=g;for(let n of f)if(n=e(n),xt(n),n&&!(n.length<=1)){M=this.transformPt(n[0]);for(let t=1;t<n.length;t++){b=this.transformPt(n[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(!w(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:o,gradientSize:a,gradientSizeUnits:l}=e,h=I.CIMGradientFill,p=e.gradientType??h.gradientType,_=-i(s??0),y=c();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"!==o&&"Rectangular"!==o||(t=L(t,-_)),m(y,t)}}const[x,M,b,k]=y,C=this._ctx;switch(C.save(),o){case"Buffered":lt().error(`Gradient method "${o}" currently unsupported.`);break;case"Linear":{const t=(M+k)/2,r="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(b-x),[i,s]="Discrete"===p?[b,b-r]:[x+r,x],o=L([i,t],_),c=L([s,t],_),m=C.createLinearGradient(o[0],o[1],c[0],c[1]);F(m,e),C.fillStyle=m,C.fill("evenodd");break}case"Circular":{const t=f(y),r=g(y)/2,i="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*r,[s,o]="Discrete"===p?[r,r-i]:[i,0],c=C.createRadialGradient(t[0],t[1],s,t[0],t[1],o);F(c,e),C.fillStyle=c,C.fill("evenodd");break}case"Rectangular":{const r=f(y),i=r[0],s=r[1],o=L(r,_),c=(r,i,s,n,a,l,h,c)=>{C.save(),this.pushClipPath(t);const m=L([a,l],_),f=L([h,c],_);C.beginPath(),C.moveTo(o[0],o[1]),C.lineTo(m[0],m[1]),C.lineTo(f[0],f[1]),C.lineTo(o[0],o[1]),C.clip();const u=L([r,i],_),d=L([s,n],_),g=C.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),C.fillStyle=g,C.fill("evenodd"),C.restore()};let m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(u(y)/2),[g,P]="Discrete"===p?[b,b-m]:[i+m,i];c(g,s,P,s,b,M,b,k),[g,P]="Discrete"===p?[x,x+m]:[i-m,i],c(g,s,P,s,x,k,x,M),m="Absolute"===l?this.transformSize(n(a)):B(a,h.gradientSize)*(d(y)/2);let[S,w]="Discrete"===p?[k,k-m]:[s+m,s];c(i,S,i,w,b,k,x,k),[S,w]="Discrete"===p?[M,M+m]:[s-m,s],c(i,S,i,w,x,M,b,M);break}}C.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:o,gradientSizeUnits:a,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(!w(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(n(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(_),xt(_),!_||_.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"===a?this.transformSize(n(o)):B(o,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 o=p[0]-g[0],n=p[1]-g[1],a=Math.sqrt(o*o+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=L([o/a,n/a],-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=o/a,r=n/a;"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);F(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=a,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 T.Butt:this._ctx.lineCap="butt";break;case T.Round:this._ctx.lineCap="round";break;case T.Square:this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case R.Bevel:this._ctx.lineJoin="bevel";break;case R.Round:this._ctx.lineJoin="round";break;case R.Miter:this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=j(t.separation,I.CIMHatchFill.separation)*r,s=j(t.rotation);if(0===i)return null;i<0&&(i=-i);let o=0;const n=.5*i;for(;o>n;)o-=i;for(;o<-n;)o+=i;const a=h();p(a,e),a[0]-=n,a[1]-=n,a[2]+=n,a[3]+=n;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const c=Math.cos(s*nt),m=Math.sin(s*nt),f=-i*m,u=i*c;let d,g,_,y;o=j(t.offsetX)*r*m-j(t.offsetY)*r*c,d=_=Number.MAX_VALUE,g=y=-Number.MAX_VALUE;for(const h of l){const t=h[0],e=h[1],r=c*t+m*e,i=-m*t+c*e;d=Math.min(d,r),_=Math.min(_,i),g=Math.max(g,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=c*d-m*_-f*o/i,S=m*d+c*_-u*o/i,w=c*g-m*_-f*o/i,x=m*g+c*_-u*o/i;const M=1+Math.round((y-_)/i),b=[];for(let h=0;h<M;h++)P+=f,S+=u,w+=f,x+=u,b.push([[P,S],[w,x]]);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],o=i[s];if(e[1]>t[1]==o[1]>t[1])continue;(o[0]-e[0])*(t[1]-e[1])-(o[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],o=i[s];let n=(o[0]-e[0])*(o[0]-e[0])+(o[1]-e[1])*(o[1]-e[1]);if(0===n)continue;n=Math.sqrt(n);const a=((o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0]))/n;if(Math.abs(a)<r){const i=((o[0]-e[0])*(t[0]-e[0])+(o[1]-e[1])*(t[1]-e[1]))/n;if(i>-r&&i<n+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=E(e),s=X(e.fontStyleName),o=e.fontFamilyName??t,{weight:n,style:a}=s,l=r*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=q(e.symbol),g=r*(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:o,style:W(a),weight:Y(n),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:a},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const wt=1e-4;function xt(t){let e,r,i,s,o,n=t[0],a=1;for(;a<t.length;)e=t[a][0]-n[0],r=t[a][1]-n[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=wt?(t.splice(a-1,1),n=o):(o=n,n=t[a],a++),i=s}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,nt as cDegToRad,Pt as lineGapType2LineHeight};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{AMeshFactory as e}from"./MeshFactory.js";import{createMatcher as t}from"../../util/createMatcher.js";class s extends e{static async create(e,o){const r=await t(e,o.symbology),c=o.labels?await t(e,o.labels):null;return new s(r,c)}constructor(e,t){super(),this._symbology=e,this._labels=t}destroy(){}async enqueueMatcherRequests(e,t){await Promise.all([this._symbology.fetchResources(e,t),this._labels?.fetchResources(e,t)])}enqueueWriterRequests(e,t,s,o){const r=this._symbology.match(t,s,o);if(r){for(const o of r)o.enqueueRequest(e,t,s);if(this._labels){const r=this._labels.match(t,s,o);if(!r)return;for(const o of r)o.enqueueRequest(e,t,s)}}}write(e,t,s,o,r,c){const a=this._symbology.match(s,o,r);if(!a)return;for(const n of a)n.write(e,t,s,o,c);if(e.entityRecordCount()>=1&&this._labels){const n=this._labels.match(s,o,r);if(!n)return;for(const r of n)r.setReferences(a),r.write(e,t,s,o,c)}}getSortKey(e,t){return this._symbology.getSortKey(e,t)}hasArcadeDependency(e){return this._symbology.hasArcadeDependency(e)}}export{s as FeatureMeshFactory};
5
+ import{AMeshFactory as e}from"./MeshFactory.js";import{createMatcher as t}from"../../util/createMatcher.js";class s extends e{static async create(e,o){const r=await t(e,o.symbology),c=o.labels?await t(e,o.labels):null;return new s(r,c)}constructor(e,t){super(),this._symbology=e,this._labels=t}destroy(){}async enqueueMatcherRequests(e,t){await Promise.all([this._symbology.fetchResources(e,t),this._labels?.fetchResources(e,t)])}enqueueWriterRequests(e,t,s,o){const r=this._symbology.match(t,s,o);if(r){for(const o of r)o.enqueueRequest(e,t,s);if(this._labels){const r=this._labels.match(t,s,o);if(!r)return;for(const o of r)o.enqueueRequest(e,t,s)}}}write(e,t,s,o,r,c){const a=this._symbology.match(s,o,r);if(!a)return;for(const n of a)n.write(e,t,s,o,c);if(e.entityRecordCount()>=1&&this._labels){const n=this._labels.match(s,o,r);if(!n)return;for(const r of n)r.setReferences(a),r.write(e,t,s,o,c)}}getSortKey(e,t){return this._symbology.getSortKey(e,t)}hasArcadeDependency(e){return!(!this._symbology.hasArcadeDependency(e)&&!this._labels?.hasArcadeDependency(e))}}export{s as FeatureMeshFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../../../../chunks/tslib.es6.js";import{animationDebugFlags as t}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{generateVirtualMachineSource as o}from"../../../animations/instructions.js";import{location as e,uniform as r,option as a}from"../../GraphShaderModule.js";import{sin as s,cos as l,Float as n,Mat3 as m,Vec3 as u,lessThanEqual as p,cond as d,ifElse as c,equal as y,texture2D as f,clamp as h,abs as S,Vec2 as b,block as g,Vec4 as V}from"../../graph/glsl.js";import{AnimationUniformInfo as v}from"./AnimationUniformInfo.js";import{FeatureVertexInput as w,FeatureFragmentInput as x,AFeatureShader as j}from"../shaders/AFeatureShader.js";import{softEdgeRatio as z}from"../shaders/constants.js";import{MosaicInfo as T}from"../shaders/MosaicInfo.js";import{rgba2float as _}from"../shaders/utils.js";import{VisualVariableColor as I}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as C}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as O}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as M}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as P}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as D}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as F}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableAngle as R}from"../shaders/vvUtils.js";class A extends w{}i([e(3,V)],A.prototype,"animationPointerAndBaseSizeAndReferenceSize",void 0),i([e(4,b)],A.prototype,"zoomRange",void 0);class L extends x{}class U extends j{_getScreenPosition(i){const{pos:t,translation:o,rotation:e,scale:r,offset:a,id:p,vvScale:d}=i,c=R(this,p).multiply(Math.PI/180),y=o.x.multiply(4/3),f=o.y.multiply(-1).multiply(4/3),h=s(e.subtract(c)),S=l(e.subtract(c)),b=new n(0),g=new n(1),{pixelRatio:V}=this.animationInfo,v=new m(g,b,b,b,g,b,y.multiply(V),f.multiply(V),g),w=new m(S,h.multiply(-1),b,h,S,b,0,0,g),x=r.multiply(d).multiply(V).multiply(4/3),j=w.multiply(x),z=this.animationInfo.toScreen.multiply(new u(t,1)),T=v.multiply(z).xy,_=j.multiply(new u(a,0)).xy;return T.add(_)}_clip(i,o){let e=super.clip(i,o);const r=p(this._getLocalTimeOrigin(i),new n(0));return t.forceGlobalTimeOrigin||(e=e.add(d([r,()=>new n(2)],[!0,()=>new n(0)]))),e}_getLocalTimeOrigin(i){return this.storage.getLocalTimeOrigin(i)}_toNdc(i){return this.animationInfo.toNdc.multiply(new u(i,1)).xy}_getEvalParams(i,t){const{globalTime:o,animationTextureSize:e,animationTexture:r}=this.animationInfo;return{globalTime:o,localTimeOrigin:this._getLocalTimeOrigin(i.id),animationTextureSize:e,animationTexture:r,pixelDimensions:t}}_getColor(i,t){return c(y(t.isSDF,new n(1)),this._getSDFColor(i,t),this._getSpriteColor(i,t))}_getSpriteColor(i,t){return f(this.mosaicInfo.texture,i).multiply(t.color)}_getSDFColor(i,t){const o=f(this.mosaicInfo.texture,i),e=new n(.5).subtract(_(o)).multiply(t.distanceToPx).multiply(z),r=h(new n(.5).subtract(e),new n(0),new n(1)),a=t.color.multiply(r),s=t.outlineSize.multiply(.5),l=S(e).subtract(s),m=h(new n(.5).subtract(l),new n(0),new n(1)),u=t.outlineColor.multiply(m);return new n(1).subtract(u.a).multiply(a).add(u)}}function E(i,t,e){const r=i.add(new b(t,0)),a=f(e.animationTexture,r.add(.5).divide(e.animationTextureSize)).xy;return i=i.add(a),g({animationPointer:i,...e},V,null,(i=>{const{out:t}=i;if(!t)throw new Error("out is null");return o({...i,out:t})}))}i([r(T)],U.prototype,"mosaicInfo",void 0),i([r(v)],U.prototype,"animationInfo",void 0),i([a(I)],U.prototype,"visualVariableColor",void 0),i([a(C)],U.prototype,"visualVariableOpacity",void 0),i([a(M)],U.prototype,"visualVariableSizeMinMaxValue",void 0),i([a(P)],U.prototype,"visualVariableSizeScaleStops",void 0),i([a(D)],U.prototype,"visualVariableSizeStops",void 0),i([a(F)],U.prototype,"visualVariableSizeUnitValue",void 0),i([a(O)],U.prototype,"visualVariableRotation",void 0);export{L as AAnimatedFragmentInput,U as AAnimatedShader,A as AAnimatedVertexInput,E as getValue};
5
+ import{_ as i}from"../../../../../../../chunks/tslib.es6.js";import{animationDebugFlags as t}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{generateVirtualMachineSource as o}from"../../../animations/instructions.js";import{location as e,uniform as a,option as r}from"../../GraphShaderModule.js";import{sin as l,cos as s,negate as n,Float as m,Mat3 as u,Vec3 as p,lessThanEqual as d,cond as c,ifElse as y,equal as f,texture2D as h,clamp as S,abs as b,Vec2 as g,block as V,Vec4 as v}from"../../graph/glsl.js";import{AnimationUniformInfo as w}from"./AnimationUniformInfo.js";import{FeatureVertexInput as x,FeatureFragmentInput as j,AFeatureShader as z}from"../shaders/AFeatureShader.js";import{softEdgeRatio as T}from"../shaders/constants.js";import{MosaicInfo as _}from"../shaders/MosaicInfo.js";import{rgba2float as I}from"../shaders/utils.js";import{VisualVariableColor as C}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as O}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as M}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as P}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as D}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as R}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableAngle as A}from"../shaders/vvUtils.js";class L extends x{}i([e(3,v)],L.prototype,"animationPointerAndBaseSizeAndReferenceSize",void 0),i([e(4,g)],L.prototype,"zoomRange",void 0);class U extends j{}class E extends z{_getScreenPosition(i){const{pos:t,translation:o,rotation:e,scale:a,offset:r,id:d,vvScale:c}=i,y=A(this,d).multiply(Math.PI/180),f=o.x.multiply(4/3),h=o.y.multiply(-1).multiply(4/3),S=l(y),b=s(y),g=b.multiply(f).add(n(S).multiply(h)),V=S.multiply(f).add(b.multiply(h)),v=l(e.subtract(y)),w=s(e.subtract(y)),x=new m(0),j=new m(1),{pixelRatio:z}=this.animationInfo,T=new u(j,x,x,x,j,x,g.multiply(z),V.multiply(z),j),_=new u(w,v.multiply(-1),x,v,w,x,0,0,j),I=a.multiply(c).multiply(z).multiply(4/3),C=_.multiply(I),O=this.animationInfo.toScreen.multiply(new p(t,1)),M=T.multiply(O).xy,P=C.multiply(new p(r,0)).xy;return M.add(P)}_clip(i,o){let e=super.clip(i,o);const a=d(this._getLocalTimeOrigin(i),new m(0));return t.forceGlobalTimeOrigin||(e=e.add(c([a,()=>new m(2)],[!0,()=>new m(0)]))),e}_getLocalTimeOrigin(i){return this.storage.getLocalTimeOrigin(i)}_toNdc(i){return this.animationInfo.toNdc.multiply(new p(i,1)).xy}_getEvalParams(i,t){const{globalTime:o,animationTextureSize:e,animationTexture:a}=this.animationInfo;return{globalTime:o,localTimeOrigin:this._getLocalTimeOrigin(i.id),animationTextureSize:e,animationTexture:a,pixelDimensions:t}}_getColor(i,t){return y(f(t.isSDF,new m(1)),this._getSDFColor(i,t),this._getSpriteColor(i,t))}_getSpriteColor(i,t){return h(this.mosaicInfo.texture,i).multiply(t.color)}_getSDFColor(i,t){const o=h(this.mosaicInfo.texture,i),e=new m(.5).subtract(I(o)).multiply(t.distanceToPx).multiply(T),a=S(new m(.5).subtract(e),new m(0),new m(1)),r=t.color.multiply(a),l=t.outlineSize.multiply(.5),s=b(e).subtract(l),n=S(new m(.5).subtract(s),new m(0),new m(1)),u=t.outlineColor.multiply(n);return new m(1).subtract(u.a).multiply(r).add(u)}}function G(i,t,e){const a=i.add(new g(t,0)),r=h(e.animationTexture,a.add(.5).divide(e.animationTextureSize)).xy;return i=i.add(r),V({animationPointer:i,...e},v,null,(i=>{const{out:t}=i;if(!t)throw new Error("out is null");return o({...i,out:t})}))}i([a(_)],E.prototype,"mosaicInfo",void 0),i([a(w)],E.prototype,"animationInfo",void 0),i([r(C)],E.prototype,"visualVariableColor",void 0),i([r(O)],E.prototype,"visualVariableOpacity",void 0),i([r(P)],E.prototype,"visualVariableSizeMinMaxValue",void 0),i([r(D)],E.prototype,"visualVariableSizeScaleStops",void 0),i([r(F)],E.prototype,"visualVariableSizeStops",void 0),i([r(R)],E.prototype,"visualVariableSizeUnitValue",void 0),i([r(M)],E.prototype,"visualVariableRotation",void 0);export{U as AAnimatedFragmentInput,E as AAnimatedShader,L as AAnimatedVertexInput,G as getValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{resolveDynamicUniforms as r,getFeatureUniforms as s,getSelectionDefines as i,isHittest as o,isHighlight as a,getFeaturePipelineState as n}from"../featureTechniqueUtils.js";import{TechniqueType as m}from"../TechniqueType.js";import{getAntialiasingControls as p}from"./utils.js";import{GradientStrokeShader as l}from"../shaders/GradientStrokeShader.js";import{FramebufferBit as c,CompareFunction as u,StencilOperation as f}from"../../../../../../webgl/enums.js";class E extends t{constructor(){super(...arguments),this.type=m.GradientStroke,this.shaders={geometry:new l},this.symbologyPlane=e.LINE}render(e,t){const{context:m,painter:l,pixelRatio:E}=e,d=t.instance.getInput();if(l.setShader({shader:this.shaders.geometry,uniforms:{...r(e,t.target,d.uniforms),...s(e,t.target),antialiasingControls:p(E),mosaicInfo:l.textureManager.getMosaicInfo(m,t.textureKey)},defines:{...i(e)},optionalAttributes:d.optionalAttributes,useComputeBuffer:o(e)}),o(e)||a(e)){const r=n(e);return l.setPipelineState(r),void l.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(c.DEPTH);const h={color:!1,depth:{write:{zNear:0,zFar:1},test:u.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:u.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setPipelineState(h),l.submitDraw(e,t);const P={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:u.EQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:u.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setPipelineState(P),l.submitDraw(e,t)}}export{E as GradientStrokeTechnique};
5
+ import{FeatureSymbologyDrawOrder as e}from"../../../enums.js";import{FeatureTechnique as t}from"../FeatureTechnique.js";import{isHittest as s,isHighlight as r,getFeaturePipelineState as i,resolveDynamicUniforms as o,getFeatureUniforms as a,getSelectionDefines as n}from"../featureTechniqueUtils.js";import{TechniqueType as m}from"../TechniqueType.js";import{getAntialiasingControls as u}from"./utils.js";import{GradientStrokeShader as l}from"../shaders/GradientStrokeShader.js";import{FramebufferBit as p,CompareFunction as c,StencilOperation as f}from"../../../../../../webgl/enums.js";class h extends t{constructor(){super(...arguments),this.type=m.GradientStroke,this.shaders={geometry:new l},this.symbologyPlane=e.LINE}render(e,t){const{context:m,painter:l,pixelRatio:h}=e,d=t.instance.getInput();if(s(e)||r(e)){const s=i(e);return l.setPipelineState(s),void l.submitDraw(e,t)}e.context.setClearDepth(1),e.context.clear(p.DEPTH);const E={color:!1,depth:{write:{zNear:0,zFar:1},test:c.LESS},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:c.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setShader({shader:this.shaders.geometry,uniforms:{...o(e,t.target,d.uniforms),...a(e,t.target),antialiasingControls:u(h),mosaicInfo:l.textureManager.getMosaicInfo(m,t.textureKey),technique:{isColorPass:0}},defines:{...n(e)},optionalAttributes:d.optionalAttributes,useComputeBuffer:s(e)}),l.setPipelineState(E),l.submitDraw(e,t);const g={color:{write:[!0,!0,!0,!0],blendMode:"composite"},depth:{write:!1,test:c.LEQUAL},stencil:{write:!1,test:{ref:e=>e.stencilRef,compare:c.EQUAL,mask:255,op:{fail:f.KEEP,zFail:f.KEEP,zPass:f.KEEP}}}};l.setShader({shader:this.shaders.geometry,uniforms:{...o(e,t.target,d.uniforms),...a(e,t.target),antialiasingControls:u(h),mosaicInfo:l.textureManager.getMosaicInfo(m,t.textureKey),technique:{isColorPass:1}},defines:{...n(e)},optionalAttributes:d.optionalAttributes,useComputeBuffer:s(e)}),l.setPipelineState(g),l.submitDraw(e,t)}}export{h as GradientStrokeTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- const e={isAlongLine:0,isAbsoluteSize:1,isDiscrete:2},i=.01;export{e as bitset,i as interiorBias};
5
+ const e={isAlongLine:0,isAbsoluteSize:1,isDiscrete:2};export{e as bitset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{location as i,uniform as o,input as s}from"../../GraphShaderModule.js";import{ifElse as r,greaterThan as n,Float as a,dot as l,mix as d,Vec2 as p,clamp as m,texture2D as c,length as u,sign as g,Vec4 as h}from"../../graph/glsl.js";import{bitset as v,interiorBias as y}from"../line/gradientStrokeConstants.js";import{BaseHittestVertexInput as f}from"./AFeatureShader.js";import{LineVertexInput as b,LineFragmentInput as w,LineShader as x,getLineVertexData as L,getLineAntialiasing as S}from"./LineShader.js";import{MosaicInfo as j}from"./MosaicInfo.js";import{getBit as A,getBitBool as D,oneMinus as z}from"./utils.js";class F extends b{}t([i(9,a)],F.prototype,"accumulatedDistance",void 0),t([i(10,a)],F.prototype,"totalLength",void 0),t([i(11,a)],F.prototype,"gradientSize",void 0),t([i(12,p)],F.prototype,"segmentDirection",void 0),t([i(13,h)],F.prototype,"tlbr",void 0);class I extends w{}class G extends x{vertex(t,e){const{totalLength:i,gradientSize:o,segmentDirection:s,tlbr:d}=t,p=L(this,t),m=A(t.bitset,v.isAlongLine),c=i.divide(this.view.displayZoomFactor),u=r(D(t.bitset,v.isAbsoluteSize),(()=>{const t=r(n(m,new a(.5)),c,p.halfWidth);return o.divide(t)}),o),g=t.accumulatedDistance.divide(this.view.displayZoomFactor).add(l(s,p.scaledOffset)).divide(c),h=d.divide(this.mosaicInfo.size.xyxy);return{...p,tlbr:h,relativePositionAlongLine:g,relativeGradientSize:u,isAlongLine:A(t.bitset,v.isAlongLine),isDiscrete:A(t.bitset,v.isDiscrete),...this.maybeRunHittest(t,e,p.halfWidth)}}fragment(t){const{isAlongLine:e,isDiscrete:i,relativePositionAlongLine:o,relativeGradientSize:s,normal:l,tlbr:h}=t,v=S(t,this.antialiasingControls.blur),f=new a(.5).multiply(l.y).add(new a(.5)),b=r(n(e,new a(.5)),o,f),w=r(n(i,new a(.5)),s.subtract(1),new a(0)),x=z(b.add(w).divide(s)),L=d(h.xy,h.zw,new p(m(x,new a(0),new a(1)),.5)),j=c(this.mosaicInfo.texture,L),A=t.opacity.multiply(v),D=this.getFragmentOutput(j.multiply(A),t);return D.glFragDepth=u(l).add(g(l.y).multiply(y)),D}}t([o(j)],G.prototype,"mosaicInfo",void 0),t([e(0,s(F)),e(1,s(f))],G.prototype,"vertex",null);export{I as GradientStrokeFragmentInput,G as GradientStrokeShader,F as GradientStrokeVertexInput};
5
+ import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import has from"../../../../../../../core/has.js";import{location as i,uniform as o,UniformGroup as s,input as r}from"../../GraphShaderModule.js";import{ifElse as n,greaterThan as a,Float as l,dot as d,mix as p,Vec2 as m,clamp as c,texture2D as h,step as u,length as g,Vec4 as y}from"../../graph/glsl.js";import{bitset as v}from"../line/gradientStrokeConstants.js";import{BaseHittestVertexInput as f}from"./AFeatureShader.js";import{LineVertexInput as w,LineFragmentInput as b,LineShader as x,getLineVertexData as j,getLineAntialiasing as L}from"./LineShader.js";import{MosaicInfo as S}from"./MosaicInfo.js";import{getBit as A,getBitBool as D,oneMinus as z}from"./utils.js";class F extends w{}t([i(9,l)],F.prototype,"accumulatedDistance",void 0),t([i(10,l)],F.prototype,"totalLength",void 0),t([i(11,l)],F.prototype,"gradientSize",void 0),t([i(12,m)],F.prototype,"segmentDirection",void 0),t([i(13,y)],F.prototype,"tlbr",void 0);class C extends b{}class I extends s{}t([o(l)],I.prototype,"isColorPass",void 0);class P extends x{vertex(t,e){const{totalLength:i,gradientSize:o,segmentDirection:s,tlbr:r}=t,p=j(this,t),m=A(t.bitset,v.isAlongLine),c=i.divide(this.view.displayZoomFactor),h=n(D(t.bitset,v.isAbsoluteSize),(()=>{const t=n(a(m,new l(.5)),c,p.halfWidth);return o.divide(t)}),o),u=t.accumulatedDistance.divide(this.view.displayZoomFactor).add(d(s,p.scaledOffset)).divide(c),g=r.divide(this.mosaicInfo.size.xyxy);return{...p,tlbr:g,relativePositionAlongLine:u,relativeGradientSize:h,isAlongLine:A(t.bitset,v.isAlongLine),isDiscrete:A(t.bitset,v.isDiscrete),...this.maybeRunHittest(t,e,p.halfWidth)}}fragment(t){const{isAlongLine:e,isDiscrete:i,relativePositionAlongLine:o,relativeGradientSize:s,normal:r,tlbr:d}=t,y=L(t,this.antialiasingControls.blur),v=new l(.5).multiply(r.y).add(new l(.5)),f=n(a(e,new l(.5)),o,v),w=n(a(i,new l(.5)),s.subtract(1),new l(0)),b=z(f.add(w).divide(s)),x=p(d.xy,d.zw,new m(c(b,new l(0),new l(1)),.5)),j=h(this.mosaicInfo.texture,x),S=t.opacity.multiply(y),A=this.getFragmentOutput(j.multiply(S),t),D=u(new l(.5),this.technique.isColorPass).multiply(has("gradient-depth-epsilon")),F=u(new l(0),r.y).multiply(new l(has("gradient-depth-bias")).subtract(D));return A.glFragDepth=c(g(r).add(F),new l(0),new l(1)),A}}t([o(S)],P.prototype,"mosaicInfo",void 0),t([o(I)],P.prototype,"technique",void 0),t([e(0,r(F)),e(1,r(f))],P.prototype,"vertex",null);export{C as GradientStrokeFragmentInput,P as GradientStrokeShader,F as GradientStrokeVertexInput};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{FeatureMatcher as e}from"./Matcher.js";class a extends e{static async fromLabelSchema(e,s){const r=s.classes.map((async a=>{const s=await e.createMeshWriters(a.meshes);return{minScale:a.minScale,maxScale:a.maxScale,meshes:s,expression:null,where:await e.storage.createWhereClause(a.where)}})),t=await Promise.all(r);return new a(t)}constructor(e){super(),this._labels=e}match(e,a,s){if(!this._labels.length)return null;const r=this._getLabels(a.$view.scale),t=[];for(const l of r)l.where&&!l.where(e,s)||t.push(...l.meshes);return t}_getLabels(e){return this._labels.filter((a=>this._validForTileScale(a,e)))}_validForTileScale(e,a){const s=a-a/4,r=a+a/2;return(!e.minScale||e.minScale>=s)&&(!e.maxScale||e.maxScale<=r)}}export{a as LabelMatcher};
5
+ import{FeatureMatcher as e}from"./Matcher.js";class s extends e{static async fromLabelSchema(e,a){const r=a.classes.map((async s=>{const a=await e.createMeshWriters(s.meshes);return{minScale:s.minScale,maxScale:s.maxScale,meshes:a,expression:null,where:await e.storage.createWhereClause(s.where)}})),t=await Promise.all(r);return new s(t)}constructor(e){super(),this._labels=e}match(e,s,a){if(!this._labels.length)return null;const r=this._getLabels(s.$view.scale),t=[];for(const l of r)l.where&&!l.where(e,a)||t.push(...l.meshes);return t}hasArcadeDependency(e){return this._labels.some((s=>s.meshes.some((s=>s.hasArcadeDependency(e)))))}_getLabels(e){return this._labels.filter((s=>this._validForTileScale(s,e)))}_validForTileScale(e,s){const a=s-s/4,r=s+s/2;return(!e.minScale||e.minScale>=a)&&(!e.maxScale||e.maxScale<=r)}}export{s as LabelMatcher};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{internalTrackPartField as t,TrackPart as e}from"../../../../../layers/support/streamLayerUtils.js";import{DictionaryMatcher as r}from"./DictionaryMatcher.js";import{IntervalMatcher as a}from"./IntervalMatcher.js";import{LabelMatcher as s}from"./LabelMatcher.js";import{MapMatcher as c}from"./MapMatcher.js";import{FeatureMatcher as n}from"./Matcher.js";async function i(t,e){switch(e.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return n.from(t,e);case"interval":return a.fromIntervalSchema(t,e);case"dictionary":return r.fromDictionaryRenderer(t,e);case"label":return s.fromLabelSchema(t,e);case"map":return c.fromMatcherSchema(t,e);case"subtype":return o.fromSubtypes(t,e);case"cluster":return h.fromClusterSchema(t,e);case"track":return u.fromTrackSchema(t,e);default:throw new Error("Impl")}}class o extends n{constructor(t,e){super(),this._subMatchers=t,this._subtypeField=e}static async fromSubtypes(t,e){const r=new Map,a=[];for(const s in e.renderers){const c=parseInt(s,10),n=i(t,e.renderers[s]).then((t=>r.set(c,t)));a.push(n)}return await Promise.all(a),new o(r,e.subtypeField)}match(t,e,r){const a=t.readAttribute(this._subtypeField),s=this._subMatchers.get(a);return s?s.match(t,e,r):null}}class h extends n{static async fromClusterSchema(t,e){const[r,a]=await Promise.all([i(t,e.feature),i(t,e.cluster)]);return new h(r,a)}constructor(t,e){super(),this._featureMatcher=t,this._clusterMatcher=e}match(t,e,r){return 1===t.readAttribute("cluster_count")?this._featureMatcher.match(t,e,r):this._clusterMatcher.match(t,e,r)}}class u extends n{static async fromTrackSchema(t,e){const[r,a,s]=await Promise.all([i(t,e.previousObservation),i(t,e.latestObservation),i(t,e.trackLine)]);return new u(r,a,s)}constructor(t,e,r){super(),this._previousObservationMatcher=t,this._latestObservationMatcher=e,this._trackLineMatcher=r}match(r,a,s){switch(r.readAttribute(t)){case e.TrackLine:return this._trackLineMatcher.match(r,a,s);case e.LatestObservation:return this._latestObservationMatcher.match(r,a,s);case e.PreviousObservation:return this._previousObservationMatcher.match(r,a,s)}return null}}export{h as ClusterMatcher,o as SubtypeMatcher,i as createMatcher};
5
+ import{internalTrackPartField as e,TrackPart as t}from"../../../../../layers/support/streamLayerUtils.js";import{DictionaryMatcher as r}from"./DictionaryMatcher.js";import{IntervalMatcher as a}from"./IntervalMatcher.js";import{LabelMatcher as s}from"./LabelMatcher.js";import{MapMatcher as c}from"./MapMatcher.js";import{FeatureMatcher as n}from"./Matcher.js";async function i(e,t){switch(t.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return n.from(e,t);case"interval":return a.fromIntervalSchema(e,t);case"dictionary":return r.fromDictionaryRenderer(e,t);case"label":return s.fromLabelSchema(e,t);case"map":return c.fromMatcherSchema(e,t);case"subtype":return h.fromSubtypes(e,t);case"cluster":return o.fromClusterSchema(e,t);case"track":return u.fromTrackSchema(e,t);default:throw new Error("Impl")}}class h extends n{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t){const r=new Map,a=[];for(const s in t.renderers){const c=parseInt(s,10),n=i(e,t.renderers[s]).then((e=>r.set(c,e)));a.push(n)}return await Promise.all(a),new h(r,t.subtypeField)}match(e,t,r){const a=e.readAttribute(this._subtypeField),s=this._subMatchers.get(a);return s?s.match(e,t,r):null}hasArcadeDependency(e){for(const t of this._subMatchers.values())if(t.hasArcadeDependency(e))return!0;return!1}}class o extends n{static async fromClusterSchema(e,t){const[r,a]=await Promise.all([i(e,t.feature),i(e,t.cluster)]);return new o(r,a)}constructor(e,t){super(),this._featureMatcher=e,this._clusterMatcher=t}match(e,t,r){return 1===e.readAttribute("cluster_count")?this._featureMatcher.match(e,t,r):this._clusterMatcher.match(e,t,r)}hasArcadeDependency(e){return this._featureMatcher.hasArcadeDependency(e)||this._clusterMatcher.hasArcadeDependency(e)}}class u extends n{static async fromTrackSchema(e,t){const[r,a,s]=await Promise.all([i(e,t.previousObservation),i(e,t.latestObservation),i(e,t.trackLine)]);return new u(r,a,s)}constructor(e,t,r){super(),this._previousObservationMatcher=e,this._latestObservationMatcher=t,this._trackLineMatcher=r}match(r,a,s){switch(r.readAttribute(e)){case t.TrackLine:return this._trackLineMatcher.match(r,a,s);case t.LatestObservation:return this._latestObservationMatcher.match(r,a,s);case t.PreviousObservation:return this._previousObservationMatcher.match(r,a,s)}return null}hasArcadeDependency(e){return this._trackLineMatcher.hasArcadeDependency(e)||this._latestObservationMatcher.hasArcadeDependency(e)||this._previousObservationMatcher.hasArcadeDependency(e)}}export{o as ClusterMatcher,h as SubtypeMatcher,i as createMatcher};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import t from"../../../../../../core/Accessor.js";import{watch as r,initial as i}from"../../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{TileKey as n}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as l}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let c=class extends t{get tiles(){const e=this.tilesCoveringView,t=this._effectivePointOfInterest;if(null!=t){const r=e.map((e=>l(t,e)));for(let i=1;i<r.length;i++)if(r[i-1]>r[i])return e.sort(((e,r)=>l(t,e)-l(t,r))),e.slice()}return e}get tilesCoveringView(){return(this.view.featureTiles?.tiles?.toArray()??[]).map(p)}get tileInfo(){return this.view.featureTiles?.tilingScheme?.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return null!=e?e:this.view.pointsOfInterest?.focus.location}constructor(e){super(e),this.pointOfInterest=null}initialize(){this.addHandles(r((()=>this.view.featureTiles),(e=>{this.removeHandles(a),e&&this.addHandles(e.addClient(),a)}),i))}};function p({lij:[e,t,r],extent:i}){return new n(`${e}/${t}/${r}`,e,t,r,i)}e([o({readOnly:!0})],c.prototype,"tiles",null),e([o({readOnly:!0})],c.prototype,"tilesCoveringView",null),e([o({readOnly:!0})],c.prototype,"tileInfo",null),e([o({readOnly:!0})],c.prototype,"tileSize",null),e([o({constructOnly:!0})],c.prototype,"view",void 0),e([o()],c.prototype,"pointOfInterest",void 0),e([o()],c.prototype,"_effectivePointOfInterest",null),c=e([s("esri.views.3d.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],c);const a="feature-tiles";export{c as FeatureServiceTiles3D};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import t from"../../../../../../core/Accessor.js";import{equals as r}from"../../../../../../core/arrayUtils.js";import{watch as i,initial as s}from"../../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/has.js";import"../../../../../../core/Logger.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{TileKey as l}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as p}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let a=class extends t{get _sortedTilesCoveringView(){const e=(this.view.featureTiles?.tiles?.toArray()??[]).map(c),t=this._effectivePointOfInterest;return null!=t&&e.sort(((e,r)=>p(t,e)-p(t,r))),e}get tileInfo(){return this.view.featureTiles?.tilingScheme?.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return null!=e?e:this.view.pointsOfInterest?.focus.location}constructor(e){super(e),this.tiles=[],this.pointOfInterest=null}initialize(){this.addHandles([i((()=>this.view.featureTiles),(e=>{this.removeHandles(u),e&&this.addHandles(e.addClient(),u)}),s),i((()=>this._sortedTilesCoveringView),(e=>this._set("tiles",e)),{initial:!0,equals:(e,t)=>r(e,t,((e,t)=>e.id===t.id))})])}};function c({lij:[e,t,r],extent:i}){return new l(`${e}/${t}/${r}`,e,t,r,i)}e([o({readOnly:!0})],a.prototype,"tiles",void 0),e([o({readOnly:!0})],a.prototype,"_sortedTilesCoveringView",null),e([o({readOnly:!0})],a.prototype,"tileInfo",null),e([o({readOnly:!0})],a.prototype,"tileSize",null),e([o({constructOnly:!0})],a.prototype,"view",void 0),e([o()],a.prototype,"pointOfInterest",void 0),e([o()],a.prototype,"_effectivePointOfInterest",null),a=e([n("esri.views.3d.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],a);const u="feature-tiles";export{a as FeatureServiceTiles3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as f}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,q as y}from"../../../chunks/vec32.js";import{fromArray as w,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec4f as M,BufferViewVec4u8 as P,BufferViewVec4u16 as O,BufferViewVec3f as U,BufferViewVec3u8 as E,BufferViewVec3u16 as I,BufferViewVec2f as V,BufferViewInt16 as A,BufferViewUint32 as H,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as R,wasmFailedToInit as F,Lyr3DLightingModel as D,Lyr3DUvWrapMode as L,Lyr3DImageFormat as k,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as N,Lyr3DType as G}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as z}from"../../../support/elevationInfoUtils.js";import{ViewingMode as W}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as $}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as J}from"./LayerView3D.js";import{addLayerViewToWasm as K,removeLayerViewFromWasm as X,getLyr3DWasm as Q}from"./Lyr3DWasm.js";import{LayerElevationProvider as Y}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as ee,faceCullingConversion as te,wrapModeConversion as re,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as ie}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as oe}from"../support/ElevationRange.js";import{Obb as ae,compute as ne}from"../support/orientedBoundingBox.js";import{ObjectParameters as le}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ce,createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{alphaCutoff as ge}from"../webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{getEllipsoidMode as fe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as be}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as ye,AlphaDiscardMode as we,TextureEncodingMimeType as _e}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as ve}from"../webgl-engine/lib/Normals.js";import{Texture as xe}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as je}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as Ce}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Te from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Me}from"../../support/layerViewUtils.js";var Pe;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Pe||(Pe={}));class Oe{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ue(e){return Math.round(e/1048.576)/1e3}let Ee=class extends(J(Te)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Pe.Error),this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=K(this).then((e=>{this._intersectionHandler=new ie(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Y({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([i((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=i((()=>this.suspended),(e=>this._wasm?.setEnabled(this,!e)),o)})).catch((e=>{if(X(this),this._wasmLayerId=-1,e===R)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=s(this._memCache),this._updatingHandles=s(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?ye.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,z(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get _wasm(){return Q(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.usedMemory)})),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.usedMemory)})),e}get visibleAtCurrentScale(){return Me(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,s=0,i=0,o=0;return this._lyrHandleToObjects.forEach((a=>{a.isVisible?(e+=a.texMemoryUsage,t+=a.vboMemoryUsage,i++):(r+=a.texMemoryUsage,s+=a.vboMemoryUsage,o++)})),new $(this.usedMemory,i,o,Ue(t),Ue(e),Ue(s),Ue(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===W.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view._stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new oe(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),s=new Array,i=new Map,o=new Oe;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const a=this.view.basemapTerrain.spatialReference;let n,l;if("global"===this.view.viewingMode){const e=g();j(x,r,e,a),n=c(h(),e),l=m(h(),n)}else n=d,l=d;const M=g();u(M,M,r);const P=p(_(),M);let O=null;const U=_();if(t.desc.obb){const e=t.desc.obb.quaternion;O=new ae(t.desc.obb.center,t.desc.obb.halfSize,f(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Pe.VerboseAPI,JSON.stringify(e));if(null==Z[e.ptype]||null==t.data){this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,{positionView:u,positionAttr:p,normalsView:g,normalsAttr:f,colorAttr:w,texCoord0Attr:x,indicesView:j}=this.getBufferViews(e,t.data.buffer,n);if(null==p||null==u||null==j)continue;const M=new ce(null!=w,null!=x?pe.Default:pe.None,null!=g,this._shadeNormals,this._applySSAO),E=p.data.length/p.size,I=(e,t)=>!e||e.data.length/e.size===E||(this._dbg(Pe.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!I(x,"numTexcoord")||!I(w,"numColors")||!I(f,"normals"))continue;const V=me(M);if(null!=O?O=O.clone():(O=ne(p),b(U,O.center,r),O.center=U),n!==d)for(let t=0;t<u.count;t++)u.getVec(t,U),y(U,U,n),u.setVec(t,U);const A=V.createBuffer(p.data.length),H=new Map([[je.POSITION,p]]);null!=x&&H.set(je.UV0,x),null!=w&&H.set(je.COLOR,w),null!=f&&H.set(je.NORMALCOMPRESSED,f),H.forEach(((e,t)=>{null!=e&&Ce(t,e,null,null,A,0)}));const S=new Uint32Array([0,j.typedBuffer.length]),R={vertices:{data:A.buffer,count:A.byteLength/V.stride,layoutParameters:M},positionData:{positions:u.typedBuffer,indices:j.typedBuffer},indices:j.typedBuffer,componentOffsets:S};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=j.count;const F=this.view.renderSpatialReference,L=_(),k=[1,1,1];C(P,F,k,a)||this._dbg(Pe.Error,"Unsupported coordinate system for IM overlay"),T(P,F,L,a);const B=this._collection.createObject(new le(v(L[0],L[1],k[0],k[1]),new de(P,l),O,R));m&&this._collection.updateMaterial(B,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,i),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveFactor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,i),e.emissionTexture=this._getTexture(m.emissiveTex,t,i),e.occlusionTexture=this._getTexture(m.occlusionTex,t,i),e.normalTexture=this._getTexture(m.normalTex,t,i)),e.objectOpacity=0,e.alphaDiscardMode=we.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const a=Promise.all(r);s.push(a),a.then((()=>{e.alphaDiscardMode=ee[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?te[m.faceCulling]:ye.Back,this._initialCullFace.set(B,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??ge,e.alphaDiscardMode=ee[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=fe(this.view.spatialReference)})),o.components.push(B),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(B)}if(await Promise.all(s),i.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let s=0;s<r;++s){const r=e[s],i=t[s];if(!i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let s=0;s<r;++s){const r=e[s],i=t[s];if(i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r){let s=null;if(e&&t.desc?.images&&t.data?.buffer){const i=t.desc.images[e?.imageId];if(s=r.get(i),!s&&i){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!i.mipCount||o>1,n=re[e.wrapMode??L.None];let l=i.alpha?4:3;const c=new Uint8Array(t.data.buffer,i.data.byteOffset,i.data.byteCount);let m=null,d=null,h=null;switch(i.format){case k.Raw:i.pixelFormat===B.R8?(m=c,l=1,d=""):i.pixelFormat===B.Rgb8?(m=c,l=3,d=""):i.pixelFormat===B.Rgba8&&(m=c,l=4,d="");break;case k.Dxt1:m=c,l=3,d=_e.DDS_ENCODING;break;case k.Dxt5:m=c,l=4,d=_e.DDS_ENCODING;break;case k.Basis:m=c,l=3,d=_e.KTX2_ENCODING;break;case k.Png:d="image/png",h=document.createElement("img");break;case k.Jpeg:d="image/jpeg",h=document.createElement("img");break;case k.Etc2:d="image/ktx",h=document.createElement("img");break;case k.Astc:this._dbg(Pe.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Pe.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(s=new xe(m,{mipmap:a,maxAnisotropy:o,encoding:d,wrap:n,components:l,noUnpackFlip:!0,width:i.mip0Width,height:i.mip0Height}),this._stage.add(s),r.set(i,s))}}return s?new ue(this.view._stage.renderView.textures,s.id):null}getBufferViews(e,t,r){let s,i,o,a,n,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,g=u.byteOffset+u.byteCount,f=u.byteCount/se[u.type],b=[...Array(f).keys()].map((e=>e));try{switch(c.sem){case N.Position:3!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new U(t,u.byteOffset,p,g),i=new be(s.typedBuffer,b,3));break;case N.Normal:if(3!==u.ncomp||u.type!==G.F32)this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new U(t,u.byteOffset,p,g),s=ve(e.typedBuffer,r);n=new A(s),l=new be(n.typedBuffer,b,2)}break;case N.TexCoord:2!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new be(new V(t,u.byteOffset,p,g).typedBuffer,b,2));break;case N.Color:4===u.ncomp?(u.type===G.F32&&(m=new M(t,u.byteOffset,p,g)),u.type===G.U8&&(m=new P(t,u.byteOffset,p,g)),u.type===G.U16&&(m=new O(t,u.byteOffset,p,g))):3===u.ncomp&&(u.type===G.F32&&(m=new U(t,u.byteOffset,p,g)),u.type===G.U8&&(m=new E(t,u.byteOffset,p,g)),u.type===G.U16&&(m=new I(t,u.byteOffset,p,g))),null==m?this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new be(m.typedBuffer,b,u.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Pe.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,s=void 0,i=r.byteOffset+r.byteCount;switch(e.index.view.type){case G.U16:c=new S(t,r.byteOffset,s,i);break;case G.U32:c=new H(t,r.byteOffset,s,i);break;case G.U8:default:this._dbg(Pe.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new H(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:i,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Pe.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([n()],Ee.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],Ee.prototype,"layer",void 0),e([n({readOnly:!0})],Ee.prototype,"visibleAtCurrentScale",null),e([n()],Ee.prototype,"elevationOffset",null),Ee=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ee);const Ie=Ee;export{Ie as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import{schedule as a}from"../../../core/scheduling.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,q as y}from"../../../chunks/vec32.js";import{fromArray as w,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec4f as M,BufferViewVec4u8 as P,BufferViewVec4u16 as O,BufferViewVec3f as U,BufferViewVec3u8 as E,BufferViewVec3u16 as I,BufferViewVec2f as V,BufferViewInt16 as A,BufferViewUint32 as H,BufferViewUint16 as S}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as R,wasmFailedToInit as F,Lyr3DLightingModel as D,Lyr3DUvWrapMode as L,Lyr3DImageFormat as k,Lyr3DPixelFormat as B,Lyr3DVtxAtrbSemantic as N,Lyr3DType as G}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as z}from"../../../support/elevationInfoUtils.js";import{ViewingMode as W}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as $}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as J}from"./LayerView3D.js";import{addLayerViewToWasm as K,removeLayerViewFromWasm as X,getLyr3DWasm as Q}from"./Lyr3DWasm.js";import{LayerElevationProvider as Y}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as Z,alphaModeConversion as ee,faceCullingConversion as te,wrapModeConversion as re,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as ie}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as oe}from"../support/ElevationRange.js";import{Obb as ae,compute as ne}from"../support/orientedBoundingBox.js";import{ObjectParameters as le}from"../webgl-engine/collections/Component/ObjectParameters.js";import{GeometryParameters as ce,createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{getEllipsoidMode as fe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ge}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as be,AlphaDiscardMode as ye,TextureEncodingMimeType as we}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as _e}from"../webgl-engine/lib/Normals.js";import{Texture as ve}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as xe}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as je}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Ce from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Te}from"../../support/layerViewUtils.js";import{alphaCutoff as Me}from"../../../webscene/support/AlphaCutoff.js";var Pe;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Pe||(Pe={}));class Oe{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}get usedMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get cachedMemory(){return this.usedMemory}}function Ue(e){return Math.round(e/1048.576)/1e3}let Ee=class extends(J(Ce)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._applySSAO=!has("disable-feature:im-ssao"),this._shadeNormals=!!has("enable-feature:im-shading"),this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Pe.Error),this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=K(this).then((e=>{this._intersectionHandler=new ie(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Y({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([i((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=i((()=>this.suspended),(e=>this._wasm?.setEnabled(this,!e)),o)})).catch((e=>{if(X(this),this._wasmLayerId=-1,e===R)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=s(this._memCache),this._updatingHandles=s(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=a((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?be.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,z(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get _wasm(){return Q(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.usedMemory)})),e}get unloadedMemory(){return 0}get cachedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.usedMemory)})),e}get visibleAtCurrentScale(){return Te(this.layer.effectiveScaleRange,this.view.scale)}get performanceInfo(){let e=0,t=0,r=0,s=0,i=0,o=0;return this._lyrHandleToObjects.forEach((a=>{a.isVisible?(e+=a.texMemoryUsage,t+=a.vboMemoryUsage,i++):(r+=a.texMemoryUsage,s+=a.vboMemoryUsage,o++)})),new $(this.usedMemory,i,o,Ue(t),Ue(e),Ue(s),Ue(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===W.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view._stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return z(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new oe(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),s=new Array,i=new Map,o=new Oe;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const a=this.view.basemapTerrain.spatialReference;let n,l;if("global"===this.view.viewingMode){const e=f();j(x,r,e,a),n=c(h(),e),l=m(h(),n)}else n=d,l=d;const M=f();u(M,M,r);const P=p(_(),M);let O=null;const U=_();if(t.desc.obb){const e=t.desc.obb.quaternion;O=new ae(t.desc.obb.center,t.desc.obb.halfSize,g(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];this._dbg(Pe.VerboseAPI,JSON.stringify(e));if(null==Z[e.ptype]||null==t.data){this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,{positionView:u,positionAttr:p,normalsView:f,normalsAttr:g,colorAttr:w,texCoord0Attr:x,indicesView:j}=this.getBufferViews(e,t.data.buffer,n);if(null==p||null==u||null==j)continue;const M=new ce(null!=w,null!=x?pe.Default:pe.None,null!=f,this._shadeNormals,this._applySSAO),E=p.data.length/p.size,I=(e,t)=>!e||e.data.length/e.size===E||(this._dbg(Pe.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!I(x,"numTexcoord")||!I(w,"numColors")||!I(g,"normals"))continue;const V=me(M);if(null!=O?O=O.clone():(O=ne(p),b(U,O.center,r),O.center=U),n!==d)for(let t=0;t<u.count;t++)u.getVec(t,U),y(U,U,n),u.setVec(t,U);const A=V.createBuffer(p.data.length),H=new Map([[xe.POSITION,p]]);null!=x&&H.set(xe.UV0,x),null!=w&&H.set(xe.COLOR,w),null!=g&&H.set(xe.NORMALCOMPRESSED,g),H.forEach(((e,t)=>{null!=e&&je(t,e,null,null,A,0)}));const S=new Uint32Array([0,j.typedBuffer.length]),R={vertices:{data:A.buffer,count:A.byteLength/V.stride,layoutParameters:M},positionData:{positions:u.typedBuffer,indices:j.typedBuffer},indices:j.typedBuffer,componentOffsets:S};o.cpuMemoryUsage+=u.count,o.cpuMemoryUsage+=j.count;const F=this.view.renderSpatialReference,L=_(),k=[1,1,1];C(P,F,k,a)||this._dbg(Pe.Error,"Unsupported coordinate system for IM overlay"),T(P,F,L,a);const B=this._collection.createObject(new le(v(L[0],L[1],k[0],k[1]),new de(P,l),O,R));m&&this._collection.updateMaterial(B,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,i),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveFactor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,i),e.emissionTexture=this._getTexture(m.emissiveTex,t,i),e.occlusionTexture=this._getTexture(m.occlusionTex,t,i),e.normalTexture=this._getTexture(m.normalTex,t,i)),e.objectOpacity=0,e.alphaDiscardMode=ye.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const a=Promise.all(r);s.push(a),a.then((()=>{e.alphaDiscardMode=ee[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?te[m.faceCulling]:be.Back,this._initialCullFace.set(B,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??Me,e.alphaDiscardMode=ee[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=fe(this.view.spatialReference)})),o.components.push(B),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(B)}if(await Promise.all(s),i.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o),{memUsageBytes:o.usedMemory}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let s=0;s<r;++s){const r=e[s],i=t[s];if(!i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let s=0;s<r;++s){const r=e[s],i=t[s];if(i)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=i,o.components.forEach((e=>{this._collection.setObjectVisibility(e,i),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o))}}}_getTexture(e,t,r){let s=null;if(e&&t.desc?.images&&t.data?.buffer){const i=t.desc.images[e?.imageId];if(s=r.get(i),!s&&i){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!i.mipCount||o>1,n=re[e.wrapMode??L.None];let l=i.alpha?4:3;const c=new Uint8Array(t.data.buffer,i.data.byteOffset,i.data.byteCount);let m=null,d=null,h=null;switch(i.format){case k.Raw:i.pixelFormat===B.R8?(m=c,l=1,d=""):i.pixelFormat===B.Rgb8?(m=c,l=3,d=""):i.pixelFormat===B.Rgba8&&(m=c,l=4,d="");break;case k.Dxt1:m=c,l=3,d=we.DDS_ENCODING;break;case k.Dxt5:m=c,l=4,d=we.DDS_ENCODING;break;case k.Basis:m=c,l=3,d=we.KTX2_ENCODING;break;case k.Png:d="image/png",h=document.createElement("img");break;case k.Jpeg:d="image/jpeg",h=document.createElement("img");break;case k.Etc2:d="image/ktx",h=document.createElement("img");break;case k.Astc:this._dbg(Pe.Error,"Astc texture not supported");break;case k.Pvrtc:this._dbg(Pe.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(s=new ve(m,{mipmap:a,maxAnisotropy:o,encoding:d,wrap:n,components:l,noUnpackFlip:!0,width:i.mip0Width,height:i.mip0Height}),this._stage.add(s),r.set(i,s))}}return s?new ue(this.view._stage.renderView.textures,s.id):null}getBufferViews(e,t,r){let s,i,o,a,n,l,c,m=null;for(let h=0;h<e.atrbs.length;h++){const c=e.atrbs[h],u=c.view,p=void 0,f=u.byteOffset+u.byteCount,g=u.byteCount/se[u.type],b=[...Array(g).keys()].map((e=>e));try{switch(c.sem){case N.Position:3!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new U(t,u.byteOffset,p,f),i=new ge(s.typedBuffer,b,3));break;case N.Normal:if(3!==u.ncomp||u.type!==G.F32)this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new U(t,u.byteOffset,p,f),s=_e(e.typedBuffer,r);n=new A(s),l=new ge(n.typedBuffer,b,2)}break;case N.TexCoord:2!==u.ncomp||u.type!==G.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===a&&(a=new ge(new V(t,u.byteOffset,p,f).typedBuffer,b,2));break;case N.Color:4===u.ncomp?(u.type===G.F32&&(m=new M(t,u.byteOffset,p,f)),u.type===G.U8&&(m=new P(t,u.byteOffset,p,f)),u.type===G.U16&&(m=new O(t,u.byteOffset,p,f))):3===u.ncomp&&(u.type===G.F32&&(m=new U(t,u.byteOffset,p,f)),u.type===G.U8&&(m=new E(t,u.byteOffset,p,f)),u.type===G.U16&&(m=new I(t,u.byteOffset,p,f))),null==m?this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new ge(m.typedBuffer,b,u.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(d){this._dbg(Pe.VerboseAPI,"Error Creating buffer ("+d+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,s=void 0,i=r.byteOffset+r.byteCount;switch(e.index.view.type){case G.U16:c=new S(t,r.byteOffset,s,i);break;case G.U32:c=new H(t,r.byteOffset,s,i);break;case G.U8:default:this._dbg(Pe.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==c&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);c=new S(t)}else{const t=new Uint32Array(e);c=new H(t)}for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:i,colorAttr:o,texCoord0Attr:a,indicesView:c,normalsView:n,normalsAttr:l}}_onRemoveFromCache(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Pe.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([n()],Ee.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([n()],Ee.prototype,"layer",void 0),e([n({readOnly:!0})],Ee.prototype,"visibleAtCurrentScale",null),e([n()],Ee.prototype,"elevationOffset",null),Ee=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ee);const Ie=Ee;export{Ie as default};