@arcgis/core 5.0.0-next.43 → 5.0.0-next.45

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 (329) hide show
  1. package/applications/Components/imageryUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f97a7cb367634353177d.js → 001a7a4cf6fe74432ed6.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{324d66962aeec17d3e28.js → 1e0e7cef7ef947894bbe.js} +1 -1
  5. package/assets/esri/core/workers/chunks/20ad34f9d45c64392022.js +1 -0
  6. package/assets/esri/core/workers/chunks/23396a6318edf9264c1f.js +1 -0
  7. package/assets/esri/core/workers/chunks/{ad891ac388fa6c1c9b94.js → 2b34a010f76e5f289868.js} +1 -1
  8. package/assets/esri/core/workers/chunks/2ef4c0092c59a98a5532.js +1 -0
  9. package/assets/esri/core/workers/chunks/35272810c2ed04eb403d.js +1 -0
  10. package/assets/esri/core/workers/chunks/{d1f4152b2b8d47cbf586.js → 72fbee59d5d909615408.js} +1 -1
  11. package/assets/esri/core/workers/chunks/75c66e38bdc1c786c599.js +1 -0
  12. package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +1 -0
  13. package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +1 -0
  14. package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +1 -0
  15. package/assets/esri/core/workers/chunks/a2442549c5daf3653eb4.js +1 -0
  16. package/assets/esri/core/workers/chunks/a7cd795042ebb8585906.js +1 -0
  17. package/assets/esri/core/workers/chunks/bf5f9da0837ed09729c6.js +316 -0
  18. package/assets/esri/core/workers/chunks/{385cfd3087f00dbd1146.js → ca1c65eb7f5900c60170.js} +1 -1
  19. package/assets/esri/core/workers/chunks/cddce67919e13e2f365e.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7c08c0824ad354177787.js → d7878fba02814adaf19f.js} +1 -1
  21. package/assets/esri/core/workers/chunks/e6784251bbb8b71ead93.js +1 -0
  22. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  23. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  24. package/chunks/GaussianSplat.glsl.js +2 -2
  25. package/config.js +1 -1
  26. package/core/urlUtils.d.ts +1 -0
  27. package/core/workers/workerFactory.js +1 -1
  28. package/interfaces.d.ts +104 -9
  29. package/kernel.js +1 -1
  30. package/layers/ImageryTileLayer.js +1 -1
  31. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  32. package/layers/WCSLayer.js +1 -1
  33. package/layers/mixins/ArcGISImageService.js +1 -1
  34. package/layers/mixins/ImageryTileMixin.js +1 -1
  35. package/layers/mixins/RasterJobHandlerMixin.js +1 -1
  36. package/layers/ogc/wcsUtils.js +1 -1
  37. package/layers/raster/datasets/BaseRaster.js +5 -0
  38. package/layers/raster/datasets/CovJSONRaster.js +5 -0
  39. package/layers/raster/datasets/FunctionRaster.js +5 -0
  40. package/layers/raster/datasets/ImageAuxRaster.js +5 -0
  41. package/layers/raster/datasets/ImageServerRaster.js +5 -0
  42. package/layers/raster/datasets/InMemoryRaster.js +5 -0
  43. package/layers/raster/datasets/MRFRaster.js +5 -0
  44. package/layers/raster/datasets/RawBlockCache.js +5 -0
  45. package/layers/raster/datasets/TIFFRaster.js +5 -0
  46. package/layers/raster/datasets/WCSRaster.js +5 -0
  47. package/layers/raster/datasets/covJSONParser.js +5 -0
  48. package/layers/raster/datasets/multidimensionalUtils.js +5 -0
  49. package/layers/raster/datasets/pamParser.js +5 -0
  50. package/layers/raster/datasets/pixelReader.js +5 -0
  51. package/layers/raster/datasets/wcsCoverageParser.js +5 -0
  52. package/layers/raster/formats/Lerc.js +5 -0
  53. package/layers/raster/formats/Qb3.js +5 -0
  54. package/layers/raster/formats/RasterCodec.js +5 -0
  55. package/layers/raster/formats/TiffDecoder.js +5 -0
  56. package/layers/raster/functions/ArithmeticFunction.js +5 -0
  57. package/layers/{support/rasterFunctions → raster/functions}/ArithmeticFunctionArguments.js +1 -1
  58. package/layers/{support/rasterFunctions → raster/functions}/AspectFunction.js +1 -1
  59. package/layers/{support/rasterFunctions → raster/functions}/AspectFunctionArguments.js +1 -1
  60. package/layers/raster/functions/BandArithmeticFunction.js +5 -0
  61. package/layers/{support/rasterFunctions → raster/functions}/BandArithmeticFunctionArguments.js +1 -1
  62. package/layers/{support/rasterFunctions → raster/functions}/BaseFunctionArguments.js +1 -1
  63. package/layers/raster/functions/BaseRasterFunction.js +5 -0
  64. package/layers/{support/rasterFunctions → raster/functions}/ClipFunction.js +1 -1
  65. package/layers/{support/rasterFunctions → raster/functions}/ClipFunctionArguments.js +1 -1
  66. package/layers/raster/functions/ColormapFunction.js +5 -0
  67. package/layers/{support/rasterFunctions → raster/functions}/ColormapFunctionArguments.js +1 -1
  68. package/layers/raster/functions/ColormapToRGBFunction.js +5 -0
  69. package/layers/{support/rasterFunctions → raster/functions}/ColormapToRGBFunctionArguments.js +1 -1
  70. package/layers/raster/functions/CompositeBandFunction.js +5 -0
  71. package/layers/raster/functions/CompositeBandFunctionArguments.js +5 -0
  72. package/layers/raster/functions/ComputeChangeFunction.js +5 -0
  73. package/layers/{support/rasterFunctions → raster/functions}/ComputeChangeFunctionArguments.js +1 -1
  74. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunction.js +1 -1
  75. package/layers/{support/rasterFunctions → raster/functions}/ContrastBrightnessFunctionArguments.js +1 -1
  76. package/layers/raster/functions/ConvolutionFunction.js +5 -0
  77. package/layers/raster/functions/ConvolutionFunctionArguments.js +5 -0
  78. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunction.js +1 -1
  79. package/layers/{support/rasterFunctions → raster/functions}/CurvatureFunctionArguments.js +1 -1
  80. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunction.js +1 -1
  81. package/layers/{support/rasterFunctions → raster/functions}/ExtractBandFunctionArguments.js +1 -1
  82. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunction.js +1 -1
  83. package/layers/{support/rasterFunctions → raster/functions}/GrayscaleFunctionArguments.js +1 -1
  84. package/layers/raster/functions/HillshadeFunction.js +5 -0
  85. package/layers/{support/rasterFunctions → raster/functions}/HillshadeFunctionArguments.js +1 -1
  86. package/layers/raster/functions/LocalFunction.js +5 -0
  87. package/layers/{support/rasterFunctions → raster/functions}/LocalFunctionArguments.js +1 -1
  88. package/layers/{support/rasterFunctions → raster/functions}/MaskFunction.js +1 -1
  89. package/layers/{support/rasterFunctions → raster/functions}/MaskFunctionArguments.js +1 -1
  90. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunction.js +1 -1
  91. package/layers/{support/rasterFunctions → raster/functions}/NDVIFunctionArguments.js +1 -1
  92. package/layers/raster/functions/RemapFunction.js +5 -0
  93. package/layers/{support/rasterFunctions → raster/functions}/RemapFunctionArguments.js +1 -1
  94. package/layers/raster/functions/ShadedReliefFunction.js +5 -0
  95. package/layers/{support/rasterFunctions → raster/functions}/ShadedReliefFunctionArguments.js +1 -1
  96. package/layers/raster/functions/SlopeFunction.js +5 -0
  97. package/layers/{support/rasterFunctions → raster/functions}/SlopeFunctionArguments.js +1 -1
  98. package/layers/raster/functions/StatisticsFunction.js +5 -0
  99. package/layers/{support/rasterFunctions → raster/functions}/StatisticsFunctionArguments.js +1 -1
  100. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunction.js +1 -1
  101. package/layers/{support/rasterFunctions → raster/functions}/StatisticsHistogramFunctionArguments.js +1 -1
  102. package/layers/raster/functions/StretchFunction.js +5 -0
  103. package/layers/{support/rasterFunctions → raster/functions}/StretchFunctionArguments.js +1 -1
  104. package/layers/{support/rasterFunctions → raster/functions}/TableFunction.js +1 -1
  105. package/layers/{support/rasterFunctions → raster/functions}/TableFunctionArguments.js +1 -1
  106. package/layers/raster/functions/bandIndexUtils.js +5 -0
  107. package/layers/raster/functions/changeDetectionUtils.js +5 -0
  108. package/layers/raster/functions/clipUtils.js +5 -0
  109. package/layers/raster/functions/conversionUtils.js +5 -0
  110. package/layers/raster/functions/convolutionUtils.js +5 -0
  111. package/layers/raster/functions/creators/createDataManagementFunctions.js +5 -0
  112. package/layers/raster/functions/creators/utils.js +5 -0
  113. package/layers/raster/functions/focalStatUtils.js +5 -0
  114. package/layers/raster/functions/localUtils.js +5 -0
  115. package/layers/raster/functions/pixelTransformUtils.js +5 -0
  116. package/layers/raster/functions/pixelUtils.js +5 -0
  117. package/layers/raster/functions/stretchUtils.js +5 -0
  118. package/layers/raster/functions/surfaceUtils.js +5 -0
  119. package/layers/raster/functions/vectorFieldUtils.js +5 -0
  120. package/layers/raster/transforms/BaseRasterTransform.js +5 -0
  121. package/layers/{support/rasterTransforms → raster/transforms}/GCSShiftTransform.js +1 -1
  122. package/layers/{support/rasterTransforms → raster/transforms}/IdentityTransform.js +1 -1
  123. package/layers/{support/rasterTransforms → raster/transforms}/PolynomialTransform.js +1 -1
  124. package/layers/save/imageryUtils.js +1 -1
  125. package/layers/support/PixelBlock.js +1 -1
  126. package/layers/support/RasterWorker.js +1 -1
  127. package/layers/support/imageryRendererUtils.js +1 -1
  128. package/layers/support/rasterFunctionUtils.js +1 -1
  129. package/package.json +2 -2
  130. package/renderers/VectorFieldRenderer.js +1 -1
  131. package/renderers/support/RasterSymbolizer.js +1 -1
  132. package/renderers/support/rasterRendererHelper.js +1 -1
  133. package/rest/locator/addressToLocations.js +1 -1
  134. package/rest/locator/addressesToLocations.js +1 -1
  135. package/rest/locator/suggestLocations.js +1 -1
  136. package/rest/networks/support/Association.js +1 -1
  137. package/rest/print.js +1 -1
  138. package/rest/support/LegendLayer.js +1 -1
  139. package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
  140. package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
  141. package/support/revision.js +1 -1
  142. package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MaskShader.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/RemapShader.js +1 -1
  146. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
  147. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  148. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  149. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  150. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  151. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  152. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  153. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  154. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  155. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  156. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  157. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  158. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  159. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  160. package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
  161. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  162. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  163. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  164. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
  165. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  166. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/DrawParameters.js +1 -1
  168. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  169. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  170. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  171. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  172. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  173. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  174. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  175. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  176. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  177. package/views/3d/webgl-engine/materials/renderers/Instance.js +1 -1
  178. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  179. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  180. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  181. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  182. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  183. package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +5 -0
  184. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
  185. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  186. package/views/DOMContainer.js +1 -1
  187. package/views/GroundView.js +1 -1
  188. package/views/layers/ImageryLayerViewMixin.js +1 -1
  189. package/views/layers/ImageryTileLayerViewMixin.js +1 -1
  190. package/views/support/imageReprojection.js +1 -1
  191. package/widgets/BatchAttributeForm.js +1 -1
  192. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  193. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  194. package/widgets/CoordinateConversion.js +1 -1
  195. package/widgets/DirectLineMeasurement3D.js +1 -1
  196. package/widgets/DistanceMeasurement2D.js +1 -1
  197. package/widgets/Editor/EditorViewModel.js +1 -1
  198. package/widgets/Editor.js +1 -1
  199. package/widgets/ElevationProfile.js +1 -1
  200. package/widgets/Feature.js +1 -1
  201. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  202. package/widgets/FeatureForm.js +1 -1
  203. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  204. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  205. package/widgets/FeatureTable/Grid/Column.js +1 -1
  206. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  207. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  208. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  209. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  210. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  211. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  212. package/widgets/FeatureTable.js +1 -1
  213. package/widgets/FeatureTemplates.js +1 -1
  214. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  215. package/widgets/Legend.js +1 -1
  216. package/widgets/LineOfSight.js +1 -1
  217. package/widgets/Locate.js +1 -1
  218. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  219. package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
  220. package/widgets/PanoramicViewer/support/importUtils.js +1 -1
  221. package/widgets/Print/CustomTemplate.js +1 -1
  222. package/widgets/Print/PrintViewModel.js +1 -1
  223. package/widgets/Print/TemplateOptions.js +1 -1
  224. package/widgets/Print.js +1 -1
  225. package/widgets/ScaleBar.js +1 -1
  226. package/widgets/ScaleRangeSlider.js +1 -1
  227. package/widgets/Search/SearchResultRenderer.js +1 -1
  228. package/widgets/Search/SearchViewModel.js +1 -1
  229. package/widgets/Search/types.js +1 -1
  230. package/widgets/Search.js +1 -1
  231. package/widgets/ShadowCast.js +1 -1
  232. package/widgets/Sketch/SketchViewModel.js +1 -1
  233. package/widgets/Sketch.js +1 -1
  234. package/assets/esri/core/workers/chunks/1f6ead46b723630db897.js +0 -1
  235. package/assets/esri/core/workers/chunks/3a16347e17312556e02c.js +0 -1
  236. package/assets/esri/core/workers/chunks/478def691ae6763686f3.js +0 -1
  237. package/assets/esri/core/workers/chunks/4c4a55be41ba105c091c.js +0 -1
  238. package/assets/esri/core/workers/chunks/4cbf5a97b2b3c6553f6f.js +0 -1
  239. package/assets/esri/core/workers/chunks/646f58b69d2354f1ef27.js +0 -1
  240. package/assets/esri/core/workers/chunks/93d11075f65a5b6625ea.js +0 -1
  241. package/assets/esri/core/workers/chunks/96f798ee286b59396131.js +0 -316
  242. package/assets/esri/core/workers/chunks/9f2a8445a5848502c7e7.js +0 -1
  243. package/assets/esri/core/workers/chunks/a1b08aab73747f4e7e25.js +0 -1
  244. package/assets/esri/core/workers/chunks/ba59568e748f0ba53b78.js +0 -1
  245. package/assets/esri/core/workers/chunks/f21cb5b34d4d1e3af1a9.js +0 -1
  246. package/assets/esri/core/workers/chunks/f93f0586ce10cb5d98b3.js +0 -1
  247. package/layers/support/rasterDatasets/BaseRaster.js +0 -5
  248. package/layers/support/rasterDatasets/CovJSONRaster.js +0 -5
  249. package/layers/support/rasterDatasets/FunctionRaster.js +0 -5
  250. package/layers/support/rasterDatasets/ImageAuxRaster.js +0 -5
  251. package/layers/support/rasterDatasets/ImageServerRaster.js +0 -5
  252. package/layers/support/rasterDatasets/InMemoryRaster.js +0 -5
  253. package/layers/support/rasterDatasets/MRFRaster.js +0 -5
  254. package/layers/support/rasterDatasets/RawBlockCache.js +0 -5
  255. package/layers/support/rasterDatasets/TIFFRaster.js +0 -5
  256. package/layers/support/rasterDatasets/WCSRaster.js +0 -5
  257. package/layers/support/rasterDatasets/covJSONParser.js +0 -5
  258. package/layers/support/rasterDatasets/multidimensionalUtils.js +0 -5
  259. package/layers/support/rasterDatasets/pamParser.js +0 -5
  260. package/layers/support/rasterDatasets/pixelReader.js +0 -5
  261. package/layers/support/rasterDatasets/wcsCoverageParser.js +0 -5
  262. package/layers/support/rasterFormats/Lerc.js +0 -5
  263. package/layers/support/rasterFormats/Qb3.js +0 -5
  264. package/layers/support/rasterFormats/RasterCodec.js +0 -5
  265. package/layers/support/rasterFormats/TiffDecoder.js +0 -5
  266. package/layers/support/rasterFunctions/ArithmeticFunction.js +0 -5
  267. package/layers/support/rasterFunctions/BandArithmeticFunction.js +0 -5
  268. package/layers/support/rasterFunctions/BaseRasterFunction.js +0 -5
  269. package/layers/support/rasterFunctions/ColormapFunction.js +0 -5
  270. package/layers/support/rasterFunctions/ColormapToRGBFunction.js +0 -5
  271. package/layers/support/rasterFunctions/CompositeBandFunction.js +0 -5
  272. package/layers/support/rasterFunctions/CompositeBandFunctionArguments.js +0 -5
  273. package/layers/support/rasterFunctions/ComputeChangeFunction.js +0 -5
  274. package/layers/support/rasterFunctions/ConvolutionFunction.js +0 -5
  275. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +0 -5
  276. package/layers/support/rasterFunctions/HillshadeFunction.js +0 -5
  277. package/layers/support/rasterFunctions/LocalFunction.js +0 -5
  278. package/layers/support/rasterFunctions/RemapFunction.js +0 -5
  279. package/layers/support/rasterFunctions/ShadedReliefFunction.js +0 -5
  280. package/layers/support/rasterFunctions/SlopeFunction.js +0 -5
  281. package/layers/support/rasterFunctions/StatisticsFunction.js +0 -5
  282. package/layers/support/rasterFunctions/StretchFunction.js +0 -5
  283. package/layers/support/rasterFunctions/bandIndexUtils.js +0 -5
  284. package/layers/support/rasterFunctions/changeDetectionUtils.js +0 -5
  285. package/layers/support/rasterFunctions/clipUtils.js +0 -5
  286. package/layers/support/rasterFunctions/conversionUtils.js +0 -5
  287. package/layers/support/rasterFunctions/convolutionUtils.js +0 -5
  288. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +0 -5
  289. package/layers/support/rasterFunctions/creators/utils.js +0 -5
  290. package/layers/support/rasterFunctions/focalStatUtils.js +0 -5
  291. package/layers/support/rasterFunctions/localUtils.js +0 -5
  292. package/layers/support/rasterFunctions/pixelTransformUtils.js +0 -5
  293. package/layers/support/rasterFunctions/pixelUtils.js +0 -5
  294. package/layers/support/rasterFunctions/stretchUtils.js +0 -5
  295. package/layers/support/rasterFunctions/surfaceUtils.js +0 -5
  296. package/layers/support/rasterFunctions/vectorFieldUtils.js +0 -5
  297. package/layers/support/rasterTransforms/BaseRasterTransform.js +0 -5
  298. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/lerc-wasm.wasm +0 -0
  299. /package/assets/esri/layers/{support/rasterFormats → raster/formats}/qb3-wasm.wasm +0 -0
  300. /package/layers/{support/rasterDatasets → raster/datasets}/DBFParser.js +0 -0
  301. /package/layers/{support/rasterDatasets → raster/datasets}/EphemeralBlockCache.js +0 -0
  302. /package/layers/{support/rasterDatasets → raster/datasets}/RasterFactory.js +0 -0
  303. /package/layers/{support/rasterDatasets → raster/datasets}/byteStreamUtils.js +0 -0
  304. /package/layers/{support/rasterDatasets → raster/datasets}/datasetUtils.js +0 -0
  305. /package/layers/{support/rasterDatasets → raster/datasets}/multipartParser.js +0 -0
  306. /package/layers/{support/rasterDatasets → raster/datasets}/wcsCapabilitiesParser.js +0 -0
  307. /package/layers/{support/rasterDatasets → raster/datasets}/xmlUtilities.js +0 -0
  308. /package/layers/{support/rasterFormats → raster/formats}/ImageCanvasDecoder.js +0 -0
  309. /package/layers/{support/rasterFormats → raster/formats}/JpgPlus.js +0 -0
  310. /package/layers/{support/rasterFormats → raster/formats}/Lzw.js +0 -0
  311. /package/layers/{support/rasterFormats → raster/formats}/Raw.js +0 -0
  312. /package/layers/{support/rasterFormats → raster/formats}/pixelRangeUtils.js +0 -0
  313. /package/layers/{support/rasterFormats → raster/formats}/tiffTag.js +0 -0
  314. /package/layers/{support/rasterFormats → raster/formats}/utils.js +0 -0
  315. /package/layers/{support/rasterFunctions → raster/functions}/colormaps.js +0 -0
  316. /package/layers/{support/rasterFunctions → raster/functions}/creators/createAppearenceFunctions.js +0 -0
  317. /package/layers/{support/rasterFunctions → raster/functions}/creators/createBandIndexFunctions.js +0 -0
  318. /package/layers/{support/rasterFunctions → raster/functions}/creators/createChangeFunctions.js +0 -0
  319. /package/layers/{support/rasterFunctions → raster/functions}/creators/createConversionFunctions.js +0 -0
  320. /package/layers/{support/rasterFunctions → raster/functions}/creators/createLocalFunctions.js +0 -0
  321. /package/layers/{support/rasterFunctions → raster/functions}/creators/createMultiRasterAnalysisFunctions.js +0 -0
  322. /package/layers/{support/rasterFunctions → raster/functions}/creators/createStatisticsFunctions.js +0 -0
  323. /package/layers/{support/rasterFunctions → raster/functions}/creators/createSurfaceFunctions.js +0 -0
  324. /package/layers/{support/rasterFunctions → raster/functions}/customBandIndexUtils.js +0 -0
  325. /package/layers/{support/rasterFunctions → raster/functions}/mirror.js +0 -0
  326. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionHelper.js +0 -0
  327. /package/layers/{support/rasterFunctions → raster/functions}/rasterFunctionSchema.js +0 -0
  328. /package/layers/{support/rasterFunctions → raster/functions}/rasterProjectionHelper.js +0 -0
  329. /package/layers/{support/rasterTransforms → raster/transforms}/utils.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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import"../core/has.js";import i from"../core/Logger.js";import{ignoreAbortErrors as s}from"../core/promiseUtils.js";import{property as n,subclass as o}from"../core/accessorSupport/decorators.js";import r from"./Widget.js";import l from"./LineOfSight/LineOfSightViewModel.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import{globalCss as d}from"./support/globalCss.js";import{messageBundle as u,tsx as h}from"./support/widget.js";const p="esri-line-of-sight",c={base:p,actions:`${p}__actions`,container:`${p}__container`,error:`${p}__error`,hint:`${p}__hint`,hintText:`${p}__hint-text`,newAnalysisButton:`${p}__new-analysis-button`},g={newAnalysisButton:`${p}__new-button`,doneButton:`${p}__done-button`};let _=class extends r{constructor(e,n){super(e,n),this.messages=null,this.viewModel=new l({isDefaultViewModel:!0}),this._onNewAnalysis=()=>{s(this.viewModel.start())},this._onDone=()=>{this.viewModel.stop()},this._onContinue=()=>{this.viewModel.continue()},t(i.getLogger(this),"Line Of Sight","arcgis-line-of-sight",{version:"4.33"})}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button")})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"line-of-sight"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){return h("div",{class:this.classes(c.base,d.widget,d.panel),role:"presentation"},this._renderContainerNode())}_renderContainerNode(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const t=[this._renderNewAnalysisButton()];return"creating"===this.viewModel.state?(e=this._renderHint(),t.unshift(this._renderDoneButton())):"created"===this.viewModel.state&&this.viewModel.targets.length>0&&t.unshift(this._renderContinueButton()),h("div",{class:c.container},e,h("div",{class:c.actions},t))}_renderUnsupportedMessage(){return h("div",{class:c.error,key:"esri-line-of-sight__unsupported"},h("p",null,this.messages.unsupported))}_renderHint(){return h("div",{class:c.hint,key:"esri-line-of-sight__hint"},h("p",{class:c.hintText},this.messages.hint))}_renderNewAnalysisButton(){return this._renderButton({className:c.newAnalysisButton,id:g.newAnalysisButton,label:this.messages.newAnalysis,onClick:this._onNewAnalysis,primary:!0})}_renderDoneButton(){return this._renderButton({id:g.doneButton,label:this.messages.done,onClick:this._onDone,primary:!1})}_renderContinueButton(){return this._renderButton({id:g.newAnalysisButton,label:this.messages.continueAnalysis,onClick:this._onContinue,primary:!1})}_renderButton({className:e,id:t,label:i,onClick:s,primary:n}){const o="disabled"===this.viewModel.state;return h("calcite-button",{appearance:n?"solid":"outline-fill",class:e,"data-id":t,disabled:o,key:t,onclick:s},i)}get test(){}};e([n()],_.prototype,"active",null),e([n({nonNullable:!0})],_.prototype,"analysis",null),e([n()],_.prototype,"icon",null),e([n()],_.prototype,"label",null),e([n(),u("esri/widgets/LineOfSight/t9n/LineOfSight")],_.prototype,"messages",void 0),e([n()],_.prototype,"view",null),e([n({type:l})],_.prototype,"viewModel",void 0),e([n()],_.prototype,"visible",null),_=e([o("esri.widgets.LineOfSight")],_);const m=_;export{m as default};
5
+ import{__decorate as e}from"tslib";import t from"../analysis/LineOfSightAnalysis.js";import{deprecateWidget as i}from"../core/deprecate.js";import"../core/has.js";import s from"../core/Logger.js";import{ignoreAbortErrors as n}from"../core/promiseUtils.js";import{property as o,subclass as r}from"../core/accessorSupport/decorators.js";import l from"./Widget.js";import a from"./LineOfSight/LineOfSightViewModel.js";import{loadCalciteComponents as d}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{messageBundle as p,tsx as h}from"./support/widget.js";const c="esri-line-of-sight",g={base:c,actions:`${c}__actions`,container:`${c}__container`,error:`${c}__error`,hint:`${c}__hint`,hintText:`${c}__hint-text`,newAnalysisButton:`${c}__new-analysis-button`},m={newAnalysisButton:`${c}__new-button`,doneButton:`${c}__done-button`};let _=class extends l{constructor(e,t){super(e,t),this.messages=null,this.viewModel=new a({isDefaultViewModel:!0}),this._onNewAnalysis=()=>{n(this.viewModel.start())},this._onDone=()=>{this.viewModel.stop()},this._onContinue=()=>{this.viewModel.continue()},i(s.getLogger(this),"Line Of Sight","arcgis-line-of-sight",{version:"4.33"})}loadDependencies(){return d({button:()=>import("@esri/calcite-components/dist/components/calcite-button")})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get icon(){return"line-of-sight"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){return h("div",{class:this.classes(g.base,u.widget,u.panel),role:"presentation"},this._renderContainerNode())}_renderContainerNode(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const t=[this._renderNewAnalysisButton()];return"creating"===this.viewModel.state?(e=this._renderHint(),t.unshift(this._renderDoneButton())):"created"===this.viewModel.state&&this.viewModel.targets.length>0&&t.unshift(this._renderContinueButton()),h("div",{class:g.container},e,h("div",{class:g.actions},t))}_renderUnsupportedMessage(){return h("div",{class:g.error,key:"esri-line-of-sight__unsupported"},h("p",null,this.messages.unsupported))}_renderHint(){return h("div",{class:g.hint,key:"esri-line-of-sight__hint"},h("p",{class:g.hintText},this.messages.hint))}_renderNewAnalysisButton(){return this._renderButton({className:g.newAnalysisButton,id:m.newAnalysisButton,label:this.messages.newAnalysis,onClick:this._onNewAnalysis,primary:!0})}_renderDoneButton(){return this._renderButton({id:m.doneButton,label:this.messages.done,onClick:this._onDone,primary:!1})}_renderContinueButton(){return this._renderButton({id:m.newAnalysisButton,label:this.messages.continueAnalysis,onClick:this._onContinue,primary:!1})}_renderButton({className:e,id:t,label:i,onClick:s,primary:n}){const o="disabled"===this.viewModel.state;return h("calcite-button",{appearance:n?"solid":"outline-fill",class:e,"data-id":t,disabled:o,key:t,onclick:s},i)}get test(){}};e([o()],_.prototype,"active",null),e([o({type:t,nonNullable:!0})],_.prototype,"analysis",null),e([o()],_.prototype,"icon",null),e([o()],_.prototype,"label",null),e([o(),p("esri/widgets/LineOfSight/t9n/LineOfSight")],_.prototype,"messages",void 0),e([o()],_.prototype,"view",null),e([o({type:a})],_.prototype,"viewModel",void 0),e([o()],_.prototype,"visible",null),_=e([r("esri.widgets.LineOfSight")],_);const w=_;export{w as default};
package/widgets/Locate.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{deprecateWidget as o}from"../core/deprecate.js";import t from"../core/Logger.js";import{property as i,subclass as s}from"../core/accessorSupport/decorators.js";import r from"./Widget.js";import l from"./Locate/LocateViewModel.js";import{loadCalciteComponents as n}from"./support/componentsUtils.js";import{globalCss as a}from"./support/globalCss.js";import{messageBundle as c,vmEvent as p,tsx as d}from"./support/widget.js";const g={base:"esri-locate"};let m=class extends r{constructor(e,i){super(e,i),this.messages=null,this.messagesCommon=null,this.viewModel=new l,this._locate=()=>{const{viewModel:e}=this;"locating"===e.state?e.cancelLocate():e.locate().catch(()=>{})},o(t.getLogger(this),"Locate","arcgis-locate",{version:"4.32"})}loadDependencies(){return n({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(e){this.viewModel.geolocationOptions=e}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(e){this.viewModel.goToLocationEnabled=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"gps-off"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const{viewModel:e,icon:o}=this,{state:t}=e,i="locating"===t,s=i?this.messagesCommon.cancel:this.messages.title,r="feature-unsupported"===t,l=this._localizeError(this.viewModel?.error);return d("div",{class:this.classes(g.base,a.widget)},!r&&d("calcite-button",{class:a.widgetButton,disabled:"disabled"===t,iconStart:i?void 0:o,kind:"neutral",label:s,onclick:this._locate,title:s},i?d("calcite-loader",{inline:!0,label:""}):null),l?d("calcite-tooltip",{open:!0,overlayPositioning:"fixed",placement:this._getPlacement(),referenceElement:this.container},l):null)}_getPlacement(){const{container:e,view:o}=this,t=e&&o?o.ui.getPosition(e):null;if(!t||"manual"===t)return"auto";const[i,s]=t.split("-");return`${"right"===s?"left":"right"}-${"bottom"===i?"end":"start"}`}_localizeError(e){return e instanceof GeolocationPositionError?e.code===GeolocationPositionError.PERMISSION_DENIED?this.messages?.permissionError:e.code===GeolocationPositionError.TIMEOUT?this.messages?.timeoutError:this.messages?.positionUnavailable:e instanceof Error?e.message:void 0}};e([i()],m.prototype,"geolocationOptions",null),e([i()],m.prototype,"goToLocationEnabled",null),e([i()],m.prototype,"goToOverride",null),e([i()],m.prototype,"graphic",null),e([i()],m.prototype,"icon",null),e([i()],m.prototype,"label",null),e([i(),c("esri/widgets/Locate/t9n/Locate")],m.prototype,"messages",void 0),e([i(),c("esri/t9n/common")],m.prototype,"messagesCommon",void 0),e([i()],m.prototype,"popupEnabled",null),e([i()],m.prototype,"scale",null),e([i()],m.prototype,"view",null),e([i({type:l}),p(["locate","locate-error"])],m.prototype,"viewModel",void 0),m=e([s("esri.widgets.Locate")],m);const u=m;export{u as default};
5
+ import{__decorate as e}from"tslib";import o from"../Graphic.js";import{deprecateWidget as t}from"../core/deprecate.js";import i from"../core/Logger.js";import{property as s,subclass as r}from"../core/accessorSupport/decorators.js";import l from"./Widget.js";import n from"./Locate/LocateViewModel.js";import{loadCalciteComponents as a}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{messageBundle as p,vmEvent as d,tsx as g}from"./support/widget.js";const m={base:"esri-locate"};let u=class extends l{constructor(e,o){super(e,o),this.messages=null,this.messagesCommon=null,this.viewModel=new n,this._locate=()=>{const{viewModel:e}=this;"locating"===e.state?e.cancelLocate():e.locate().catch(()=>{})},t(i.getLogger(this),"Locate","arcgis-locate",{version:"4.32"})}loadDependencies(){return a({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(e){this.viewModel.geolocationOptions=e}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(e){this.viewModel.goToLocationEnabled=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"gps-off"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const{viewModel:e,icon:o}=this,{state:t}=e,i="locating"===t,s=i?this.messagesCommon.cancel:this.messages.title,r="feature-unsupported"===t,l=this._localizeError(this.viewModel?.error);return g("div",{class:this.classes(m.base,c.widget)},!r&&g("calcite-button",{class:c.widgetButton,disabled:"disabled"===t,iconStart:i?void 0:o,kind:"neutral",label:s,onclick:this._locate,title:s},i?g("calcite-loader",{inline:!0,label:""}):null),l?g("calcite-tooltip",{open:!0,overlayPositioning:"fixed",placement:this._getPlacement(),referenceElement:this.container},l):null)}_getPlacement(){const{container:e,view:o}=this,t=e&&o?o.ui.getPosition(e):null;if(!t||"manual"===t)return"auto";const[i,s]=t.split("-");return`${"right"===s?"left":"right"}-${"bottom"===i?"end":"start"}`}_localizeError(e){return e instanceof GeolocationPositionError?e.code===GeolocationPositionError.PERMISSION_DENIED?this.messages?.permissionError:e.code===GeolocationPositionError.TIMEOUT?this.messages?.timeoutError:this.messages?.positionUnavailable:e instanceof Error?e.message:void 0}};e([s()],u.prototype,"geolocationOptions",null),e([s()],u.prototype,"goToLocationEnabled",null),e([s()],u.prototype,"goToOverride",null),e([s({type:o})],u.prototype,"graphic",null),e([s()],u.prototype,"icon",null),e([s()],u.prototype,"label",null),e([s(),p("esri/widgets/Locate/t9n/Locate")],u.prototype,"messages",void 0),e([s(),p("esri/t9n/common")],u.prototype,"messagesCommon",void 0),e([s()],u.prototype,"popupEnabled",null),e([s()],u.prototype,"scale",null),e([s()],u.prototype,"view",null),e([s({type:n}),d(["locate","locate-error"])],u.prototype,"viewModel",void 0),u=e([r("esri.widgets.Locate")],u);const h=u;export{h 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../request.js";import e from"../../core/Error.js";import{deg2rad as a}from"../../core/mathUtils.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{getPathExtension as o}from"../../core/urlUtils.js";import{rotatePixel as n}from"../../layers/orientedImagery/transformations/utils.js";import{imageGalleryThumbnailSize as s}from"./constants.js";import{validateTifOrMrfExtension as i,getContentType as m}from"./utils.js";const c=t=>"FA"===t,h=async(t,a,r)=>{const o=new(await import("../../rest/support/AttachmentQuery.js").then(t=>t.default))({objectIds:[a]}),n=await t.queryAttachments(o,r),s=n[`${a}`]?.[0],i=s?.url;if(!i)throw new e("NoAttachmentError","no attachments found",{[t.objectIdField]:a,layer:t});return{datasetFormat:s.contentType.split("/")[1].toUpperCase(),url:i}};async function l(t,e){const a="string"==typeof t,r=a?t:t.url,{pathname:n,searchParams:s,origin:i}=new URL(r);let c=a?o(n):t.datasetFormat;c||(c=await m(r));const h=await import("../../layers/support/rasterDatasets/RasterFactory.js").then(t=>t.default),l=await h.open({ioConfig:{customFetchParameters:Object.fromEntries(s),skipMapInfo:!0},datasetFormat:c?.toUpperCase(),url:`${i}${n}`,signal:e?.signal});return l?u(l,{signal:e?.signal}):null}async function u(t,e){const{level:a,offset:o,size:n}=p(t),{pixelBlock:s}=await t.fetchRawPixels(a,o,n,e);return r(e),s}function p(t){const{storageInfo:e,width:a,height:r}=t.rasterInfo,{maximumPyramidLevel:o,pyramidScalingFactor:n}=e,s=n??2;return{level:o,offset:{x:0,y:0},size:{width:Math.ceil(a/s**o),height:Math.ceil(r/s**o)}}}async function d(a,r,o){if(!a)throw new e("NoLayerError","No layer provided, cannot load image from attachment",{layer:a,objectId:r});const{datasetFormat:n,url:m}=await h(a,+r,o);return i(n)?await l({datasetFormat:n,url:m},o):(await t(m,{...o,useQueue:!0,responseType:"image",query:{w:s}})).data}function f(t,e,a=0){const{height:r,width:o}=t;e.width=o,e.height=r;const n=e.getContext("2d");if(!n)return;const s=g(t,e,n);s.getContext("2d")&&(a>0?w(n,s,o,r,a):n.drawImage(s,0,0))}function g(t,e,a){const r=document.createElement("canvas"),o=r.getContext("2d");if(t instanceof HTMLImageElement)r.width=t.width,r.height=t.height,o?.drawImage(t,0,0);else{const n=a.createImageData(e.width,e.height);n&&(n.data.set(t.getAsRGBA()),r.width=n.width,r.height=n.height,o?.putImageData(n,0,0))}return r}function w(t,e,r,o,s){const i=a(s),m=[n(0,0,i),n(r,0,i),n(r,o,i),n(0,o,i)],c=Math.max(...m.map(t=>t[0]))-Math.min(...m.map(t=>t[0])),h=Math.max(...m.map(t=>t[1]))-Math.min(...m.map(t=>t[1])),l=Math.min(r/c,o/h);t.save(),t.clearRect(0,0,r,o),t.translate(r/2,o/2),t.rotate(i),t.scale(l,l),t.drawImage(e,-r/2,-o/2,r,o),t.restore()}export{h as getImageSourceFromAttachment,l as getThumbnailPixelBlock,c as isFeatureAttachment,d as loadImageForAttachment,f as renderImageWithRotation};
5
+ import t from"../../request.js";import e from"../../core/Error.js";import{deg2rad as a}from"../../core/mathUtils.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{getPathExtension as o}from"../../core/urlUtils.js";import{rotatePixel as n}from"../../layers/orientedImagery/transformations/utils.js";import{imageGalleryThumbnailSize as s}from"./constants.js";import{validateTifOrMrfExtension as i,getContentType as m}from"./utils.js";const c=t=>"FA"===t,h=async(t,a,r)=>{const o=new(await import("../../rest/support/AttachmentQuery.js").then(t=>t.default))({objectIds:[a]}),n=await t.queryAttachments(o,r),s=n[`${a}`]?.[0],i=s?.url;if(!i)throw new e("NoAttachmentError","no attachments found",{[t.objectIdField]:a,layer:t});return{datasetFormat:s.contentType.split("/")[1].toUpperCase(),url:i}};async function l(t,e){const a="string"==typeof t,r=a?t:t.url,{pathname:n,searchParams:s,origin:i}=new URL(r);let c=a?o(n):t.datasetFormat;c||(c=await m(r));const h=await import("../../layers/raster/datasets/RasterFactory.js").then(t=>t.default),l=await h.open({ioConfig:{customFetchParameters:Object.fromEntries(s),skipMapInfo:!0},datasetFormat:c?.toUpperCase(),url:`${i}${n}`,signal:e?.signal});return l?u(l,{signal:e?.signal}):null}async function u(t,e){const{level:a,offset:o,size:n}=d(t),{pixelBlock:s}=await t.fetchRawPixels(a,o,n,e);return r(e),s}function d(t){const{storageInfo:e,width:a,height:r}=t.rasterInfo,{maximumPyramidLevel:o,pyramidScalingFactor:n}=e,s=n??2;return{level:o,offset:{x:0,y:0},size:{width:Math.ceil(a/s**o),height:Math.ceil(r/s**o)}}}async function f(a,r,o){if(!a)throw new e("NoLayerError","No layer provided, cannot load image from attachment",{layer:a,objectId:r});const{datasetFormat:n,url:m}=await h(a,+r,o);return i(n)?await l({datasetFormat:n,url:m},o):(await t(m,{...o,useQueue:!0,responseType:"image",query:{w:s}})).data}function p(t,e,a=0){const{height:r,width:o}=t;e.width=o,e.height=r;const n=e.getContext("2d");if(!n)return;const s=g(t,e,n);s.getContext("2d")&&(a>0?w(n,s,o,r,a):n.drawImage(s,0,0))}function g(t,e,a){const r=document.createElement("canvas"),o=r.getContext("2d");if(t instanceof HTMLImageElement)r.width=t.width,r.height=t.height,o?.drawImage(t,0,0);else{const n=a.createImageData(e.width,e.height);n&&(n.data.set(t.getAsRGBA()),r.width=n.width,r.height=n.height,o?.putImageData(n,0,0))}return r}function w(t,e,r,o,s){const i=a(s),m=[n(0,0,i),n(r,0,i),n(r,o,i),n(0,o,i)],c=Math.max(...m.map(t=>t[0]))-Math.min(...m.map(t=>t[0])),h=Math.max(...m.map(t=>t[1]))-Math.min(...m.map(t=>t[1])),l=Math.min(r/c,o/h);t.save(),t.clearRect(0,0,r,o),t.translate(r/2,o/2),t.rotate(i),t.scale(l,l),t.drawImage(e,-r/2,-o/2,r,o),t.restore()}export{h as getImageSourceFromAttachment,l as getThumbnailPixelBlock,c as isFeatureAttachment,f as loadImageForAttachment,p as renderImageWithRotation};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{Loadable as i}from"../../../core/Loadable.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{property as s,subclass as o}from"../../../core/accessorSupport/decorators.js";import{RasterJobHandlerMixin as h}from"../../../layers/mixins/RasterJobHandlerMixin.js";let a=class extends(h(i)){constructor(t){super(t)}load(t){return this.addResolvingPromise(this._fetchPixels(t)),Promise.resolve(this)}destroy(){this._source=null}get height(){return this._get("height")}get width(){return this._get("width")}async _fetchPixels(t){const i=(await import("../../../layers/support/rasterDatasets/RasterFactory.js")).default,s=await i.open({url:this.url,ioConfig:{skipExtensions:["jgw","aux.xml"],skipMapInfo:!0},signal:t?.signal});if(r(t),null==s)throw new e("depth-image-service:open-error","Failed to open depth image raster.",{url:this.url});const{width:o,height:h}=s.rasterInfo;await this._initJobHandler(),r(t),s.rasterJobHandler=this._rasterJobHandler;const{pixelBlock:a}=await s.fetchPixels(s.rasterInfo.nativeExtent.clone(),o,h,{noClip:!1,signal:t?.signal});if(r(t),null==a)throw new e("depth-image-service:fetch-error","Failed to fetch depth image pixels.");this._set("width",a.width),this._set("height",a.height),this._source=a.pixels[0]}_getDepthValue(t,e){const i=Math.max(1,Math.min(this.width,t)),r=Math.max(1,Math.min(this.height,e));return this._source[(r-1)*this.width+(i-1)]}_interpolateDepth(t,e){const i=Math.floor(e),r=Math.ceil(e),s=Math.floor(t),o=Math.ceil(t),h=e-i,a=t-s;return(this._getDepthValue(i,s)*(1-h)+this._getDepthValue(r,s)*h)*(1-a)+(this._getDepthValue(i,o)*(1-h)+this._getDepthValue(r,o)*h)*a}depthAt(t,e){if(!this.loaded||!this._source)throw new Error("DepthImageService must be loaded before sampling depth.");const i=t.x/e.width*this.width,r=t.y/e.height*this.height;return this._interpolateDepth(r,i)}};t([s({readOnly:!0,value:0})],a.prototype,"height",null),t([s()],a.prototype,"url",void 0),t([s({readOnly:!0,value:0})],a.prototype,"width",null),a=t([o("esri.widgets.OrientedImageryViewer.services.DepthImageService")],a);const l=a;export{l as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{Loadable as i}from"../../../core/Loadable.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{property as s,subclass as h}from"../../../core/accessorSupport/decorators.js";import{RasterJobHandlerMixin as o}from"../../../layers/mixins/RasterJobHandlerMixin.js";let a=class extends(o(i)){constructor(t){super(t)}load(t){return this.addResolvingPromise(this._fetchPixels(t)),Promise.resolve(this)}destroy(){this._source=null}get height(){return this._get("height")}get width(){return this._get("width")}async _fetchPixels(t){const i=(await import("../../../layers/raster/datasets/RasterFactory.js")).default,s=await i.open({url:this.url,ioConfig:{skipExtensions:["jgw","aux.xml"],skipMapInfo:!0},signal:t?.signal});if(r(t),null==s)throw new e("depth-image-service:open-error","Failed to open depth image raster.",{url:this.url});const{width:h,height:o}=s.rasterInfo;await this._initJobHandler(),r(t),s.rasterJobHandler=this._rasterJobHandler;const{pixelBlock:a}=await s.fetchPixels(s.rasterInfo.nativeExtent.clone(),h,o,{noClip:!1,signal:t?.signal});if(r(t),null==a)throw new e("depth-image-service:fetch-error","Failed to fetch depth image pixels.");this._set("width",a.width),this._set("height",a.height),this._source=a.pixels[0]}_getDepthValue(t,e){const i=Math.max(1,Math.min(this.width,t)),r=Math.max(1,Math.min(this.height,e));return this._source[(r-1)*this.width+(i-1)]}_interpolateDepth(t,e){const i=Math.floor(e),r=Math.ceil(e),s=Math.floor(t),h=Math.ceil(t),o=e-i,a=t-s;return(this._getDepthValue(i,s)*(1-o)+this._getDepthValue(r,s)*o)*(1-a)+(this._getDepthValue(i,h)*(1-o)+this._getDepthValue(r,h)*o)*a}depthAt(t,e){if(!this.loaded||!this._source)throw new Error("DepthImageService must be loaded before sampling depth.");const i=t.x/e.width*this.width,r=t.y/e.height*this.height;return this._interpolateDepth(r,i)}};t([s({readOnly:!0,value:0})],a.prototype,"height",null),t([s()],a.prototype,"url",void 0),t([s({readOnly:!0,value:0})],a.prototype,"width",null),a=t([h("esri.widgets.OrientedImageryViewer.services.DepthImageService")],a);const l=a;export{l 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- async function t(t){const e=(await import("./PanoramicMeshManager.js").then(t=>t.default)).getInstance();return await e.load(t)}async function e(){return i(await import("../../../geometry/Mesh.js"))}async function r(){return i(await import("../../../geometry/support/MeshComponent.js"))}async function a(){return i(await import("../../../geometry/support/MeshLocalVertexSpace.js"))}async function n(){return i(await import("../../../geometry/support/MeshMaterial.js"))}async function s(){return i(await import("../../../geometry/support/MeshTexture.js"))}async function o(){return(await import("../../../geometry/support/MeshVertexAttributes.js")).MeshVertexAttributes}function i(t){return t.default??t}async function u(){const[a,i,u,c,p,m]=await Promise.all([e(),r(),n(),s(),o(),t()]);return{Mesh:a,MeshComponent:i,MeshMaterial:u,MeshTexture:c,MeshVertexAttributes:p,panoramicMeshManager:m}}async function c(){return i(await import("./PanoramicTileNode.js"))}async function p(){return i(await import("./PanoramicTilePyramid.js"))}async function m(){return i(await import("../../../layers/support/rasterDatasets/RasterFactory.js"))}export{i as extractDefault,e as loadMesh,r as loadMeshComponent,u as loadMeshDependencies,a as loadMeshLocalVertexSpace,t as loadMeshManager,n as loadMeshMaterial,s as loadMeshTexture,o as loadMeshVertexAttributes,c as loadPanoramicTileNode,p as loadPanoramicTilePyramid,m as loadRasterFactory};
5
+ async function t(t){const e=(await import("./PanoramicMeshManager.js").then(t=>t.default)).getInstance();return await e.load(t)}async function e(){return i(await import("../../../geometry/Mesh.js"))}async function r(){return i(await import("../../../geometry/support/MeshComponent.js"))}async function a(){return i(await import("../../../geometry/support/MeshLocalVertexSpace.js"))}async function n(){return i(await import("../../../geometry/support/MeshMaterial.js"))}async function s(){return i(await import("../../../geometry/support/MeshTexture.js"))}async function o(){return(await import("../../../geometry/support/MeshVertexAttributes.js")).MeshVertexAttributes}function i(t){return t.default??t}async function u(){const[a,i,u,c,p,m]=await Promise.all([e(),r(),n(),s(),o(),t()]);return{Mesh:a,MeshComponent:i,MeshMaterial:u,MeshTexture:c,MeshVertexAttributes:p,panoramicMeshManager:m}}async function c(){return i(await import("./PanoramicTileNode.js"))}async function p(){return i(await import("./PanoramicTilePyramid.js"))}async function m(){return i(await import("../../../layers/raster/datasets/RasterFactory.js"))}export{i as extractDefault,e as loadMesh,r as loadMeshComponent,u as loadMeshDependencies,a as loadMeshLocalVertexSpace,t as loadMeshManager,n as loadMeshMaterial,s as loadMeshTexture,o as loadMeshVertexAttributes,c as loadPanoramicTileNode,p as loadPanoramicTilePyramid,m as loadRasterFactory};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import l from"../../portal/PortalItem.js";import{formatJsonMap as p}from"../../rest/support/fileFormat.js";import{fromJSON as u}from"../../rest/support/layoutTemplate.js";import{valueUnitKebabDict as m,fetchLayoutTemplateInfos as y}from"./utils.js";import{enumeration as d}from"../../core/accessorSupport/decorators/enumeration.js";let h=class extends r{constructor(t){super(t),this.description=null,this.format=null,this.state="not-loaded",this.label=null,this.layoutInfoTaskUrl=null,this.layout=null,this.layoutItem=null,this.layoutOptions=null,this.layoutTemplateInfo=null,this.type=null}get id(){return this.layoutItem?.id??`${this.layout}-${s(JSON.stringify(this.toJSON()))}`}get mapSurroundInfoOptions(){const t=this.layoutTemplateInfo?.layoutOptions?.mapSurroundInfos;if(!t)return null;const o={northArrow:[],scaleBar:[],legend:[]};for(const e of t)switch(e.type){case"CIMMarkerNorthArrow":o.northArrow.push(e);break;case"CIMScaleLine":o.scaleBar.push(e);break;case"CIMGroupElement":e.elements?.some(t=>"CIMScaleLine"===t.type)&&o.scaleBar.push(e);break;case"CIMLegend":o.legend.push(e)}return o}get pageUnits(){return m.fromJSON(this.layoutTemplateInfo?.pageUnits?.toLowerCase())}_updateLayoutOptions(t){const o=this.layoutOptions?.legend??t.layoutOptions?.hasLegend,e=this.layoutOptions?.northArrow??(this.mapSurroundInfoOptions?.northArrow.length?this.mapSurroundInfoOptions?.northArrow.some(({visible:t})=>t):void 0),r=this.layoutOptions?.scaleBar??(this.mapSurroundInfoOptions?.scaleBar.length?this.mapSurroundInfoOptions?.scaleBar.some(({visible:t})=>t):void 0);this._set("layoutOptions",{legend:o,northArrow:e,scaleBar:r})}async fetchLayoutItemTemplateInfo(t){const{layoutItem:r}=this;if(r?.id&&!this.layoutTemplateInfo&&"loaded"!==this.state)try{this._set("state","loading");const s=this.layoutInfoTaskUrl;if(!s)throw new e("print:invalid-layout-info-task-url","Can't fetch layout template info",{url:s});"public"!==r.access&&o&&await o.getCredential(s);const a={Layout_Item_ID:JSON.stringify({id:r.id})},i=(await y(s,a,t))[0];this.setLayoutTemplateInfo(i)}catch(s){this._set("state",a(s)?"not-loaded":"error")}}setLayoutTemplateInfo(t){this._set("layoutTemplateInfo",t),this._updateLayoutOptions(t),this._set("state","loaded")}};t([i({json:{write:!0}})],h.prototype,"description",void 0),t([d(p)],h.prototype,"format",void 0),t([i({readOnly:!0})],h.prototype,"id",null),t([i({readOnly:!0})],h.prototype,"state",void 0),t([i({json:{write:!0}})],h.prototype,"label",void 0),t([i()],h.prototype,"layoutInfoTaskUrl",void 0),t([i({json:{read:u,write:!0}})],h.prototype,"layout",void 0),t([i({type:l,json:{write:!0}})],h.prototype,"layoutItem",void 0),t([i({readOnly:!0,json:{write:!0}})],h.prototype,"layoutOptions",void 0),t([i({readOnly:!0})],h.prototype,"layoutTemplateInfo",void 0),t([i({readOnly:!0})],h.prototype,"mapSurroundInfoOptions",null),t([i({readOnly:!0})],h.prototype,"pageUnits",null),t([i()],h.prototype,"type",void 0),h=t([n("esri.widgets.Print.CustomTemplate")],h);const c=h;export{c as default};
5
+ import{__decorate as t}from"tslib";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as n,subclass as i}from"../../core/accessorSupport/decorators.js";import l from"../../portal/PortalItem.js";import{formatJsonMap as p}from"../../rest/support/fileFormat.js";import{fromJSON as u}from"../../rest/support/layoutTemplate.js";import{valueUnitKebabDict as d,fetchLayoutTemplateInfos as m}from"./utils.js";import{enumeration as y}from"../../core/accessorSupport/decorators/enumeration.js";let h=class extends r{constructor(t){super(t),this.description=null,this.format=null,this.state="not-loaded",this.label=null,this.layoutInfoTaskUrl=null,this.layout=null,this.layoutItem=null,this.layoutOptions=null,this.layoutTemplateInfo=null,this.type=null}get id(){return this.layoutItem?.id??`${this.layout}-${s(JSON.stringify(this.toJSON()))}`}get mapSurroundInfoOptions(){const t=this.layoutTemplateInfo?.layoutOptions?.mapSurroundInfos;if(!t)return null;const o={northArrow:[],scaleBar:[],legend:[]};for(const e of t)switch(e.type){case"CIMMarkerNorthArrow":o.northArrow.push(e);break;case"CIMScaleLine":o.scaleBar.push(e);break;case"CIMGroupElement":e.elements?.some(t=>"CIMScaleLine"===t.type)&&o.scaleBar.push(e);break;case"CIMLegend":o.legend.push(e)}return o}get pageUnits(){return d.fromJSON(this.layoutTemplateInfo?.pageUnits?.toLowerCase())}_updateLayoutOptions(t){const o=this.layoutOptions?.legend??t.layoutOptions?.hasLegend,e=this.layoutOptions?.dynamicLegend??(this.mapSurroundInfoOptions?.legend.length?this.mapSurroundInfoOptions?.legend.some(({defaultLegendItem:t})=>t?.dynamicLegends):void 0),r=this.layoutOptions?.northArrow??(this.mapSurroundInfoOptions?.northArrow.length?this.mapSurroundInfoOptions?.northArrow.some(({visible:t})=>t):void 0),s=this.layoutOptions?.scaleBar??(this.mapSurroundInfoOptions?.scaleBar.length?this.mapSurroundInfoOptions?.scaleBar.some(({visible:t})=>t):void 0);this._set("layoutOptions",{legend:o,northArrow:r,scaleBar:s,dynamicLegend:e})}async fetchLayoutItemTemplateInfo(t){const{layoutItem:r}=this;if(r?.id&&!this.layoutTemplateInfo&&"loaded"!==this.state)try{this._set("state","loading");const s=this.layoutInfoTaskUrl;if(!s)throw new e("print:invalid-layout-info-task-url","Can't fetch layout template info",{url:s});"public"!==r.access&&o&&await o.getCredential(s);const a={Layout_Item_ID:JSON.stringify({id:r.id})},n=(await m(s,a,t))[0];this.setLayoutTemplateInfo(n)}catch(s){this._set("state",a(s)?"not-loaded":"error")}}setLayoutTemplateInfo(t){this._set("layoutTemplateInfo",t),this._updateLayoutOptions(t),this._set("state","loaded")}};t([n({json:{write:!0}})],h.prototype,"description",void 0),t([y(p)],h.prototype,"format",void 0),t([n({readOnly:!0})],h.prototype,"id",null),t([n({readOnly:!0})],h.prototype,"state",void 0),t([n({json:{write:!0}})],h.prototype,"label",void 0),t([n()],h.prototype,"layoutInfoTaskUrl",void 0),t([n({json:{read:u,write:!0}})],h.prototype,"layout",void 0),t([n({type:l,json:{write:!0}})],h.prototype,"layoutItem",void 0),t([n({readOnly:!0,json:{write:!0}})],h.prototype,"layoutOptions",void 0),t([n({readOnly:!0})],h.prototype,"layoutTemplateInfo",void 0),t([n({readOnly:!0})],h.prototype,"mapSurroundInfoOptions",null),t([n({readOnly:!0})],h.prototype,"pageUnits",null),t([n()],h.prototype,"type",void 0),h=t([i("esri.widgets.Print.CustomTemplate")],h);const c=h;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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{isSome as e}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import{clone as a}from"../../core/lang.js";import{LoadableMixin as r}from"../../core/Loadable.js";import{EsriPromiseMixin as l}from"../../core/Promise.js";import n from"../../core/ReactiveMap.js";import{watch as p,initial as m}from"../../core/reactiveUtils.js";import{createScreenPoint as h}from"../../core/screenUtils.js";import{unitType as d,convertUnit as u,getMetersPerUnitForSR as c,inchesPerMeter as f}from"../../core/units.js";import{property as y,subclass as T}from"../../core/accessorSupport/decorators.js";import v from"../../geometry/Extent.js";import w from"../../geometry/SpatialReference.js";import{formatDate as _,convertDateFormatToIntlOptions as I}from"../../intl/date.js";import{getLocaleLanguage as g}from"../../intl/locale.js";import x from"../../portal/Portal.js";import O from"../../portal/PortalQueryParams.js";import{reArcGISOnlineDomain as b}from"../../portal/support/urlUtils.js";import{execute as E,getTaskInfo as P}from"../../rest/print.js";import{formatJsonMap as L}from"../../rest/support/fileFormat.js";import{fromJSON as S}from"../../rest/support/layoutTemplate.js";import U from"../../rest/support/PrintParameters.js";import k from"../../rest/support/PrintTemplate.js";import{getExtent as C}from"../../views/2d/viewpointUtils.js";import{ViewEventPriorities as j}from"../../views/input/InputManager.js";import F from"../../views/overlay/BoxOverlayItem.js";import H from"./CustomTemplate.js";import M from"./FileLink.js";import D from"./TemplateOptions.js";import{fetchLayoutTemplateInfos as A,valueUnitKebabDict as W}from"./utils.js";const R=[30,144,255,255],N=[237,211,23,255],z=[216,48,32,255],V=new Set(["GISProfessionalStdUT","GISProfessionalAdvUT"]),B=/(\/GPServer\/).+/i,G=96,q=s.ofType(H),$=s.ofType(M);function J(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find(t=>e in t)){const{customTextElements:e}=t.layoutOptions;let s=_(Date.now(),I("short-date"));"ar"===g()&&(s="‏"+s),e.push({date:s})}}function Q(t,e,s){if(!e)return;!(e.visible===s)&&t.layoutOptions&&(t.layoutOptions.elementOverrides?t.layoutOptions.elementOverrides[e.name]={visible:s}:t.layoutOptions.elementOverrides={[e.name]:{visible:s}})}let K=class extends(r(l(o))){constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this._templateIdToCustomTemplate=new n,this._isFreeHand=!1,this._freeHandWidth=0,this._freehandHeight=0,this._asyncPrintTaskUrl=null,this._layoutInfoTaskUrl=null,this._portalLayoutInfoTaskUrl=null,this._customLayoutOptions=null,this._exportedFileNameMap={},this._layoutTemplateInfosCache=new Map,this._tasksInfoCache=new Map,this.allowedFormats="all",this.allowedLayouts="all",this.browseTemplates=new q,this.defaultTemplates=new q,this.error=null,this.exportedLinks=new $,this.extraParameters=null,this.includeDefaultTemplates=!0,this.outSpatialReference=null,this.portal=x.getDefault(),this.portalTemplateIds=[],this.printServiceTemplates=new q,this.defaultTemplate=null,this.showPrintAreaEnabled=!1,this.printServiceUrl=null,this.printTimeout=12e4,this.saveExportEnabled=!1,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.templateOptions=new D}initialize(){this.addHandles([p(()=>[this.showPrintAreaEnabled,this.view],()=>{this.showPrintAreaEnabled?this._enablePrintPreview():(this.removeHandles("overlay-handler"),this.view?.overlay?.removeItem(this._getOverlayItem()))}),p(()=>[this.templateOptions.layout,this.templateOptions.layoutItem],()=>{this.loaded&&this._processTemplateOptions()}),p(()=>[this.allowedFormats,this.allowedLayouts],()=>{this.loaded&&this._loadTemplateInfos()}),p(()=>this.exportedLinks,()=>{for(const{name:t,extension:e}of this.exportedLinks)t&&e&&this._updateExportedFileNameMap(`${t}${e}`)},m)])}destroy(){this.removeHandles("overlay-handler"),this.view&&(this._overlayItem&&(this.view.overlay?.removeItem(this._overlayItem),this._overlayItem.destroy(),this._overlayItem=null),this.view=null)}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=a(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach(e=>{const s=t[e];if(s){const t=this.templateCustomTextElements?.[e];s.forEach(e=>{const[s]=Object.entries(e)[0];t?.forEach(t=>{const[i,o]=Object.entries(t)[0];s===i&&(e[s]=o)})})}}),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async print(t){const{view:e,extraParameters:s,updateDelay:o,outSpatialReference:a}=this;if(!e)throw new i("print:view-required","view is not set");J(t);const r=this._getOverlayItem(),l=t.scalePreserved||!this.showPrintAreaEnabled?void 0:C(new v,e.viewpoint,"map-only"===t.layout?[t.exportOptions.width,t.exportOptions.height]:[r.boxWidth,r.boxHeight]),n=new U({view:e,template:t,extent:l,extraParameters:s,updateDelay:o,outSpatialReference:a});try{const e=!!t.layoutItem?.id&&(this.portalTemplateIds.includes(t.layoutItem.id)||this.browseTemplates.some(e=>e.layoutItem?.id===t.layoutItem?.id));return await E(e&&this._asyncPrintTaskUrl?this._asyncPrintTaskUrl:this.effectivePrintServiceUrl,n,{timeout:this.printTimeout})}catch(p){throw new i("print:export-error","An error occurred while exporting the web map.",{error:p})}}async load(t){return this.addResolvingPromise(this._loadResources(t).catch(t=>this.error=t)),this}toPrintTemplate({attributionEnabled:t,author:e,copyright:s,customTextElements:o,dpi:a,forceFeatureAttributes:r,format:l,height:n,id:p,includeTables:m,layout:h,layoutItem:d,legendEnabled:u,northArrowEnabled:c,scale:f,scaleBarEnabled:y,scaleEnabled:T,title:v,width:w}){if(!h&&!d)throw new i("print:layout-required","layout is not set");const _=new k({attributionVisible:t,forceFeatureAttributes:r,format:l,includeTables:m,layout:h,layoutItem:d,layoutOptions:{authorText:e||"",copyrightText:s||"",customTextElements:o,titleText:v||""},outScale:f??0,scalePreserved:T});if(w&&(_.exportOptions.width=w),n&&(_.exportOptions.height=n),a&&(_.exportOptions.dpi=a),_.layoutOptions){u||(_.layoutOptions.legendLayers=[]);const t=this.getLayoutTemplateById(p)?.mapSurroundInfoOptions;if(t){const e=t.northArrow;for(const t of e)Q(_,t,c);const s=t.scaleBar;for(const t of s)Q(_,t,y);const i=t.legend;for(const t of i)Q(_,t,u)}}return _}getLayoutTemplateById(t){return t?this._templateIdToCustomTemplate.get(t):null}async addPortalTemplate(t){if(!this.portal||!t?.id)return;try{t.loaded||await t.load()}catch{return void this.applyTemplate(this.defaultTemplate)}const e=new H({type:"browse-template",layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl,label:t.title,layoutItem:t});this._templateIdToCustomTemplate.set(e.id,e),this.browseTemplates.add(e)}removePortalTemplate(t){t.layoutItem&&this.templateOptions.id===t.layoutItem.id&&(this.defaultTemplate?this.applyTemplate(this.defaultTemplate):this.templateOptions.reset()),this.browseTemplates.remove(t),this._templateIdToCustomTemplate.delete(t.id)}async applyTemplate(t){if(t&&t===this.getLayoutTemplateById(this.templateOptions.id))return;if(this.templateOptions.reset(),!t)return;if("map-only"===t)return void(this.templateOptions.layout="map-only");!t.layout||!this.templatesInfo||this.templatesInfo.layout.choiceList.includes(t.layout)||(this.defaultTemplate?t=this.defaultTemplate:this.templateOptions.reset());const e=t.layout||t.layoutItem?.id,s=e?this.templateCustomTextElements?.[e]:void 0;if(await this.templateOptions.applyTemplate(t,{customTextElements:s,customLayoutOptions:this._customLayoutOptions}),e&&this._serviceTemplateCustomTextElements&&!this._serviceTemplateCustomTextElements[e]&&t.layoutTemplateInfo?.layoutOptions?.customTextElements){const s=a(this._serviceTemplateCustomTextElements);s[e]=t.layoutTemplateInfo.layoutOptions.customTextElements,this._serviceTemplateCustomTextElements=Object.freeze(s)}}createExportedFileLink(t){const e=this.toPrintTemplate(this.templateOptions).format.toLowerCase(),s=e.includes("png")?"png":e,i=t+s;return this._updateExportedFileNameMap(i),new M({name:t,extension:s,count:this._exportedFileNameMap[i]})}export(t){const e=this.createExportedFileLink(t);this.exportedLinks.add(e);const s=this.print(this.toPrintTemplate(this.templateOptions)).then(t=>e.set({url:t?.url,state:"ready"})).catch(t=>e.set({error:t,state:"error"}));return this.emit("submit",{link:e,saveExportEnabled:this.saveExportEnabled}),s.then(t=>this.emit("complete",{link:t,saveExportEnabled:this.saveExportEnabled})),{link:e,promise:s}}async _loadResources(t){this.destroyed||(await this._loadUrls(t),await this._loadTemplateInfos(t),this._updateOverLayItem())}async _loadTemplateInfos(t){const e=[...this.defaultTemplates,...this.printServiceTemplates];for(const{id:o}of e)this._templateIdToCustomTemplate.delete(o);this.defaultTemplates.removeAll(),this.printServiceTemplates.removeAll();const[s,i]=await Promise.all([this._getLayoutToLayoutTemplateInfos(t),this._getPrintServiceTemplatesInfo(t)]);await this._loadAllTemplates(s,i,t),this._processPrintServiceTemplatesInfo(i),await this._processTemplateOptions()}_updateExportedFileNameMap(t){void 0!==this._exportedFileNameMap[t]?this._exportedFileNameMap[t]++:this._exportedFileNameMap[t]=0}async _processTemplateOptions(){const{layout:t,layoutItem:e}=this.templateOptions;if("map-only"!==t)if(this._customLayoutOptions={legend:this.templateOptions.legendEnabled,northArrow:this.templateOptions.northArrowEnabled,scaleBar:this.templateOptions.scaleBarEnabled},e?.id){try{e.loaded||await e.load()}catch{return void this.applyTemplate(this.defaultTemplate)}let t=this._templateIdToCustomTemplate.get(e.id);t||(t=new H({label:e.title,layoutItem:e,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl}),this._templateIdToCustomTemplate.set(t.id,t)),await this.applyTemplate(t)}else if(t){const t=this.defaultTemplates.find(t=>t.layout===this.templateOptions.layout)??this.printServiceTemplates.find(t=>t.layout===this.templateOptions.layout);await this.applyTemplate(t??this.defaultTemplate)}}async _loadPortal(t){try{await this.portal.load(t)}catch(e){throw new i("print:could-not-load-portal","Cannot load print resource information from portal",{error:e,url:this.effectivePrintServiceUrl})}}async _loadUrls(t){if(this.printServiceUrl)this._set("effectivePrintServiceUrl",this.printServiceUrl),this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t);else{await this._loadPortal(t);const{printTask:e,asyncPrintTask:s,layoutInfoTask:i}=this.portal?.helperServices??{};this._set("effectivePrintServiceUrl",e?.url),this._asyncPrintTaskUrl=s?.url,this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t),i?.url&&this.effectivePrintServiceUrl!==i.url?this._portalLayoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(i.url,t):this._portalLayoutInfoTaskUrl=this._layoutInfoTaskUrl}const e=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!e?.includes("gpserver"))throw new i("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl})}async _getLayoutInfoTaskUrl(t,e){if(!t)return null;const s=await P(t,"GetLayoutTemplatesInfo",e);return s?t.replace(B,`$1${encodeURI(s.displayName)}`):null}_getPortalDefaultTemplates(t,e){return this.portal?.helperServices?.printTask?.templates?.filter(t=>"map_only"!==t.layout.toLowerCase()&&(!e||e.includes(S(t.layout))))?.map(e=>{const s=H.fromJSON(e);if(s.type="default-template",s.layoutInfoTaskUrl=this._layoutInfoTaskUrl,s.layout){const e=t.get(s.layout);e&&s.setLayoutTemplateInfo(e)}return s})??[]}async _getPortalCustomTemplates(t){if(this.printServiceUrl||!this.portal)return[];const{layoutGroupQuery:e,user:s}=this.portal,i=b.test(this.portal.url),o=s?.userLicenseTypeId,a=o&&V.has(o);if(!e||i&&!a)return[];const r=new O({query:e,disableExtraQuery:!0}),l=await this.portal.queryGroups(r,t);if(!l.total)return[];const n=l.results[0],p=new O({num:100,query:"type:Layout",sortField:n.sortField,sortOrder:n.sortOrder??void 0}),m=(await n.queryItems(p,t)).results;if(!m.length)return[];return m.map(t=>(this.portalTemplateIds.push(t.id),new H({type:"default-template",label:t.title,layoutItem:t,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl})))}async _loadAllTemplates(t,e,s){let i=!1;const o=e?.layout?.choiceList;if(this.includeDefaultTemplates&&this.portal&&!this.printServiceUrl){const e=this._getPortalDefaultTemplates(t,o);i=!!e.length,this.defaultTemplates.addMany(e);const a=await this._getPortalCustomTemplates(s);this.defaultTemplates.addMany(a);for(const t of this.defaultTemplates)this._templateIdToCustomTemplate.set(t.id,t)}i||t.forEach((t,e)=>{if(!o||o.includes(e)){const s=new H({type:"print-service-template",layout:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl});s.setLayoutTemplateInfo(t),this.printServiceTemplates.add(s),this._templateIdToCustomTemplate.set(s.id,s)}})}_processPrintServiceTemplatesInfo(t){this._set("templatesInfo",t);const e=t?.layout?.defaultValue;if(e&&"map-only"!==e){const t=this.defaultTemplates.find(t=>t.layout===e)??this.printServiceTemplates.find(t=>t.layout===e)??this.defaultTemplates.at(0)??this.printServiceTemplates.at(0);this._set("defaultTemplate",t)}}async _getLayoutToLayoutTemplateInfos(t){const e=this._layoutInfoTaskUrl,s=e?this._layoutTemplateInfosCache.get(e):void 0,i=s??await A(e,void 0,t);s||this._layoutTemplateInfosCache.set(e,i);const o=new Map,a={};for(const r of i){const t=S(r.layoutTemplate);o.set(t,r),a[t]=r.layoutOptions.customTextElements}return this._serviceTemplateCustomTextElements=Object.freeze(a),o}async _getPrintServiceTemplatesInfo(t){const e=this.effectivePrintServiceUrl?this._tasksInfoCache.get(this.effectivePrintServiceUrl):void 0,s=e??await P(this.effectivePrintServiceUrl,"ExportWebMap",t);if(!s)throw new i("print:unavailable-service-info","Can't fetch templates info from service");e||this._tasksInfoCache.set(this.effectivePrintServiceUrl,s);const{parameters:o}=s,a=o.find(({name:t})=>"Format"===t),r=o.find(({name:t})=>"Layout_Template"===t);return{format:this._getFormat(a),layout:this._getLayout(r)}}_getFormat(t){const s="all"===this.allowedFormats?t.choiceList:t.choiceList.filter(t=>"string"!=typeof this.allowedFormats&&this.allowedFormats.some(e=>new RegExp(`\\b${e}\\b`,"i").test(t))),i=(s.length?s:t.choiceList).map(t=>L.fromJSON(t)).filter(e),o=L.fromJSON(t.defaultValue),a=i.some(t=>new RegExp(`\\b${o}\\b`,"i").test(t))?o:i[0];return{choiceList:i,defaultValue:a}}_getLayout(t){const s=t.choiceList.filter(t=>"map_only"!==t.toLowerCase()),i="all"===this.allowedLayouts?s:s.filter(t=>this.allowedLayouts.includes(S(t))),o=(i.length?i:s).map(S).filter(e),a=S(t.defaultValue),r=o.includes(a)?a:o.find(t=>/(?=.*letter)(?=.*landscape)/i.test(t))??o.find(t=>/(?=.*a4)(?=.*landscape)/i.test(t))??o[0];return{choiceList:o,defaultValue:r}}_getOverlayItem(){return this._overlayItem||(this._overlayItem=new F({strokeDash:[5],strokeWidth:2,strokeColor:[30,144,255,255]})),this._overlayItem}_enablePrintPreview(){if(!this.view?.overlay)return;const t=this.templateOptions,e=this._getOverlayItem();this.addHandles([p(()=>[t.width,t.height,t.scaleEnabled,t.scale,t.layout,t.layoutItem,t.id,t.state,t.dpi,this.view?.scale,this.view?.size,this.view?.state.paddedViewState.size,this.view?.state.padding,this.loaded],()=>this._updateOverLayItem(),m),this.view?.on("drag",["Shift"],t=>this._handleDrag(t),j.WIDGET),this.view?.on("key-down",["Escape"],()=>this._resetDrag(),j.WIDGET)],"overlay-handler"),this.view.overlay.addItem(e)}_updateOverLayItem(){if(!this.view)return;const t=this.templateOptions,e=this._getOverlayItem(),s=t.layoutItem?.id??t.layout,i=this.view,o=i.spatialReference,[a,r]=i.state.paddedViewState.size,l=i.state.padding;let n=0,p=0;if("map-only"===s)null!=t.width&&null!=t.height&&(n=t.width,p=t.height);else if(s){const e=t.id?this._templateIdToCustomTemplate.get(t.id):null,{webMapFrameSize:s,pageUnits:i}=e?.layoutTemplateInfo??{};let l=!1;if(s&&i)if(this._isFreeHand){const t=s[0]/s[1];n=this._freeHandWidth,p=this._freehandHeight,n>p?p=n/t:n=p*t}else{const t=W.fromJSON(i.toLowerCase()),e=o.unit;d(t)===d(e)?(n=u(s[0],t,e),p=u(s[1],t,e)):(l=!0,n=s[0],p=s[1])}if(!this._isFreeHand)if(t.scaleEnabled&&t.scale){const e=l?Math.min(a/n,r/p):c(o)*f*t.dpi;n*=e,p*=e}else if(0===n||0===p)n=a,p=r;else{const t=(a-.1*a)/n,e=(r-.1*r)/p,s=Math.min(t,e);n*=s,p*=s}}const{scaleEnabled:m,scale:h}=t,y=m&&h?h/this.view.scale:1,T=m&&h?G/t.dpi:1;if(e.boxWidth=n*y*T||a,e.boxHeight=p*y*T||r,l&&(e.padding=l),e.backgroundWidth=a??0,e.backgroundHeight=r??0,"loading"===this.loadStatus)e.strokeColor=N;else if("loaded"===this.loadStatus)switch(this.templateOptions.state){case"pending":e.strokeColor=N;break;case"ready":e.strokeColor=R;break;case"error":e.strokeColor=z}}_resetDrag(){this._isFreeHand=!1,this._updateOverLayItem()}_handleDrag(t){switch(t.action){case"start":this._start();break;case"update":this._update(t);break;case"end":this._end()}t.stopPropagation()}_start(){this._isFreeHand=!0}_update(t){const e=this._getOverlayItem(),{x:s,y:i}=t,{x:o,y:a}=t.origin;s>o?(e.x=o,e.boxWidth=s-o):(e.x=s,e.boxWidth=o-s),i>a?(e.y=a,e.boxHeight=i-a):(e.y=i,e.boxHeight=a-i)}_end(){const t=this._getOverlayItem();if(!this.view||null==t.x||null==t.y)return;const e=this.view,s=e.toMap(h(t.x+.5*t.boxWidth,t.y+.5*t.boxHeight));t.x=null,t.y=null,e.goTo({center:s}),this._freeHandWidth=t.boxWidth,this._freehandHeight=t.boxHeight,"map-only"===this.templateOptions.layout&&(this.templateOptions.width=this._freeHandWidth,this.templateOptions.height=this._freehandHeight),this.templateOptions.scale=this.view.scale,this._updateOverLayItem()}};t([y()],K.prototype,"_serviceTemplateCustomTextElements",void 0),t([y()],K.prototype,"_templateIdToCustomTemplate",void 0),t([y()],K.prototype,"allowedFormats",void 0),t([y()],K.prototype,"allowedLayouts",void 0),t([y({type:q})],K.prototype,"browseTemplates",void 0),t([y({type:q})],K.prototype,"defaultTemplates",void 0),t([y()],K.prototype,"error",void 0),t([y({type:$})],K.prototype,"exportedLinks",void 0),t([y()],K.prototype,"extraParameters",void 0),t([y()],K.prototype,"includeDefaultTemplates",void 0),t([y({readOnly:!0})],K.prototype,"effectivePrintServiceUrl",null),t([y()],K.prototype,"effectiveTemplateCustomTextElements",null),t([y({type:w})],K.prototype,"outSpatialReference",void 0),t([y({type:x})],K.prototype,"portal",void 0),t([y()],K.prototype,"portalTemplateIds",void 0),t([y({type:q})],K.prototype,"printServiceTemplates",void 0),t([y({readOnly:!0})],K.prototype,"defaultTemplate",void 0),t([y()],K.prototype,"showPrintAreaEnabled",void 0),t([y()],K.prototype,"printServiceUrl",void 0),t([y()],K.prototype,"printTimeout",void 0),t([y()],K.prototype,"saveExportEnabled",void 0),t([y({readOnly:!0})],K.prototype,"state",null),t([y({readOnly:!0})],K.prototype,"templatesInfo",void 0),t([y()],K.prototype,"updateDelay",void 0),t([y()],K.prototype,"view",void 0),t([y()],K.prototype,"templateCustomTextElements",void 0),t([y({type:D})],K.prototype,"templateOptions",void 0),K=t([T("esri.widgets.Print.PrintViewModel")],K);const X=K;export{X as default};
5
+ import{__decorate as t}from"tslib";import{isSome as e}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import{JSONMap as a}from"../../core/jsonMap.js";import{clone as r}from"../../core/lang.js";import{LoadableMixin as l}from"../../core/Loadable.js";import{EsriPromiseMixin as n}from"../../core/Promise.js";import p from"../../core/ReactiveMap.js";import{watch as m,initial as h,whenOnce as d}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{unitType as c,convertUnit as f,getMetersPerUnitForSR as y,inchesPerMeter as v}from"../../core/units.js";import{property as T,subclass as w}from"../../core/accessorSupport/decorators.js";import _ from"../../geometry/Extent.js";import I from"../../geometry/SpatialReference.js";import{formatDate as g,convertDateFormatToIntlOptions as x}from"../../intl/date.js";import{getLocaleLanguage as O}from"../../intl/locale.js";import b from"../../portal/Portal.js";import E from"../../portal/PortalQueryParams.js";import{reArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import{execute as P,getTaskInfo as S}from"../../rest/print.js";import{formatJsonMap as U}from"../../rest/support/fileFormat.js";import{fromJSON as k}from"../../rest/support/layoutTemplate.js";import C from"../../rest/support/LegendLayer.js";import j from"../../rest/support/PrintParameters.js";import{getVisibleLayerViews as F}from"../../rest/support/printTaskUtils.js";import M from"../../rest/support/PrintTemplate.js";import{getExtent as H}from"../../views/2d/viewpointUtils.js";import{ViewEventPriorities as D}from"../../views/input/InputManager.js";import A from"../../views/overlay/BoxOverlayItem.js";import W from"./CustomTemplate.js";import N from"./FileLink.js";import R from"./TemplateOptions.js";import{fetchLayoutTemplateInfos as V,valueUnitKebabDict as z}from"./utils.js";const B=[30,144,255,255],G=[237,211,23,255],q=[216,48,32,255],$=new Set(["GISProfessionalStdUT","GISProfessionalAdvUT"]),J=/(\/GPServer\/).+/i,Q=96,K=i.ofType(W),X=i.ofType(N),Y=new a({Feet:"feet",Miles:"miles",Meters:"meters",Kilometers:"kilometers"});function Z(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find(t=>e in t)){const{customTextElements:e}=t.layoutOptions;let i=g(Date.now(),x("short-date"));"ar"===O()&&(i="‏"+i),e.push({date:i})}}function tt(t,e,i,s){if(!e.layoutOptions)return;if(!i)return void(e.layoutOptions.legendLayers=[]);if(!t)return;const o=F(t);e.layoutOptions.legendLayers=o.map(t=>new C({layerId:t.layer.id,title:t.layer.title||void 0,dynamicLegend:s}))}function et(t,e,i){if(!e)return;!(e.visible===i)&&t.layoutOptions&&(t.layoutOptions.elementOverrides?t.layoutOptions.elementOverrides[e.name]={visible:i}:t.layoutOptions.elementOverrides={[e.name]:{visible:i}})}let it=class extends(l(n(o))){constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this._templateIdToCustomTemplate=new p,this._isFreeHand=!1,this._freeHandWidth=0,this._freehandHeight=0,this._asyncPrintTaskUrl=null,this._layoutInfoTaskUrl=null,this._portalLayoutInfoTaskUrl=null,this._customLayoutOptions=null,this._exportedFileNameMap={},this._layoutTemplateInfosCache=new Map,this._tasksInfoCache=new Map,this.allowedFormats="all",this.allowedLayouts="all",this.browseTemplates=new K,this.defaultTemplates=new K,this.error=null,this.exportedLinks=new X,this.extraParameters=null,this.includeDefaultTemplates=!0,this.outSpatialReference=null,this.portal=b.getDefault(),this.portalTemplateIds=[],this.printServiceTemplates=new K,this.defaultTemplate=null,this.showPrintAreaEnabled=!1,this.printServiceUrl=null,this.printTimeout=12e4,this.saveExportEnabled=!1,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.templateOptions=new R}initialize(){this.addHandles([m(()=>[this.showPrintAreaEnabled,this.view],()=>{this.showPrintAreaEnabled?this._enablePrintPreview():(this.removeHandles("overlay-handler"),this.view?.overlay?.removeItem(this._getOverlayItem()))}),m(()=>[this.templateOptions.layout,this.templateOptions.layoutItem],()=>{this.loaded&&this._processTemplateOptions()}),m(()=>[this.allowedFormats,this.allowedLayouts],()=>{this.loaded&&this._loadTemplateInfos()}),m(()=>this.exportedLinks,()=>{for(const{name:t,extension:e}of this.exportedLinks)t&&e&&this._updateExportedFileNameMap(`${t}${e}`)},h)])}destroy(){this.removeHandles("overlay-handler"),this.view&&(this._overlayItem&&(this.view.overlay?.removeItem(this._overlayItem),this._overlayItem.destroy(),this._overlayItem=null),this.view=null)}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=r(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach(e=>{const i=t[e];if(i){const t=this.templateCustomTextElements?.[e];i.forEach(e=>{const[i]=Object.entries(e)[0];t?.forEach(t=>{const[s,o]=Object.entries(t)[0];i===s&&(e[i]=o)})})}}),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async print(t){const{view:e,extraParameters:i,updateDelay:o,outSpatialReference:a}=this;if(!e)throw new s("print:view-required","view is not set");Z(t);const r=this._getOverlayItem(),l=t.scalePreserved||!this.showPrintAreaEnabled?void 0:H(new _,e.viewpoint,"map-only"===t.layout?[t.exportOptions.width,t.exportOptions.height]:[r.boxWidth,r.boxHeight]),n=new j({view:e,template:t,extent:l,extraParameters:i,updateDelay:o,outSpatialReference:a});try{const e=!!t.layoutItem?.id&&(this.defaultTemplates.some(e=>e.layoutItem?.id===t.layoutItem?.id)||this.browseTemplates.some(e=>e.layoutItem?.id===t.layoutItem?.id));return await P(e&&this._asyncPrintTaskUrl?this._asyncPrintTaskUrl:this.effectivePrintServiceUrl,n,{timeout:this.printTimeout})}catch(p){throw new s("print:export-error","An error occurred while exporting the web map.",{error:p})}}async load(t){return this.addResolvingPromise(this._loadResources(t).catch(t=>this.error=t)),this}toPrintTemplate({attributionEnabled:t,author:e,copyright:i,customTextElements:o,dpi:a,forceFeatureAttributes:r,format:l,height:n,id:p,includeTables:m,layout:h,layoutItem:d,legendEnabled:u,dynamicLegendEnabled:c,northArrowEnabled:f,scale:y,scaleBarEnabled:v,scaleBarUnit:T,scaleEnabled:w,title:_,width:I}){if(!h&&!d)throw new s("print:layout-required","layout is not set");const g=new M({attributionVisible:t,forceFeatureAttributes:r,format:l,includeTables:m,layout:h,layoutItem:d,layoutOptions:{authorText:e||"",copyrightText:i||"",customTextElements:o,titleText:_||"",scalebarUnit:v&&T?Y.toJSON(T):void 0},outScale:y??0,scalePreserved:w});if(I&&(g.exportOptions.width=I),n&&(g.exportOptions.height=n),a&&(g.exportOptions.dpi=a),g.layoutOptions){tt(this.view,g,u,c);const t=this.getLayoutTemplateById(p)?.mapSurroundInfoOptions;if(t){const e=t.northArrow;for(const t of e)et(g,t,f);const i=t.scaleBar;for(const t of i)et(g,t,v);const s=t.legend;for(const t of s)et(g,t,u)}}return g}getLayoutTemplateById(t){return t?this._templateIdToCustomTemplate.get(t):null}async addPortalTemplate(t){if(!this.portal||!t?.id)return;try{if("loading"===this.loadStatus&&await d(()=>this.loaded),!this.loaded)throw new s("print:load-required","PrintViewModel must be loaded before adding portal templates.");t.loaded||await t.load()}catch{return void this.applyTemplate(this.defaultTemplate)}const e=new W({type:"browse-template",layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl,label:t.title,layoutItem:t});this._templateIdToCustomTemplate.set(e.id,e),this.browseTemplates.add(e)}removePortalTemplate(t){t.layoutItem&&this.templateOptions.id===t.layoutItem.id&&(this.defaultTemplate?this.applyTemplate(this.defaultTemplate):this.templateOptions.reset()),this.browseTemplates.remove(t),this._templateIdToCustomTemplate.delete(t.id)}async applyTemplate(t){if(t&&t===this.getLayoutTemplateById(this.templateOptions.id))return;if(this.templateOptions.reset(),!t)return;if("map-only"===t)return void(this.templateOptions.layout="map-only");!t.layout||!this.templatesInfo||this.templatesInfo.layout.choiceList.includes(t.layout)||(this.defaultTemplate?t=this.defaultTemplate:this.templateOptions.reset());const e=t.layout||t.layoutItem?.id,i=e?this.templateCustomTextElements?.[e]:void 0;if(await this.templateOptions.applyTemplate(t,{customTextElements:i,customLayoutOptions:this._customLayoutOptions}),e&&this._serviceTemplateCustomTextElements&&!this._serviceTemplateCustomTextElements[e]&&t.layoutTemplateInfo?.layoutOptions?.customTextElements){const i=r(this._serviceTemplateCustomTextElements);i[e]=t.layoutTemplateInfo.layoutOptions.customTextElements,this._serviceTemplateCustomTextElements=Object.freeze(i)}}createExportedFileLink(t){const e=this.toPrintTemplate(this.templateOptions).format.toLowerCase(),i=e.includes("png")?"png":e,s=t+i;return this._updateExportedFileNameMap(s),new N({name:t,extension:i,count:this._exportedFileNameMap[s]})}export(t){const e=this.createExportedFileLink(t);this.exportedLinks.add(e);const i=this.print(this.toPrintTemplate(this.templateOptions)).then(t=>e.set({url:t?.url,state:"ready"})).catch(t=>e.set({error:t,state:"error"}));return this.emit("submit",{link:e,saveExportEnabled:this.saveExportEnabled}),i.then(t=>this.emit("complete",{link:t,saveExportEnabled:this.saveExportEnabled})),{link:e,promise:i}}async _loadResources(t){this.destroyed||(await this._loadUrls(t),await this._loadTemplateInfos(t),this._updateOverLayItem())}async _loadTemplateInfos(t){const e=[...this.defaultTemplates,...this.printServiceTemplates];for(const{id:o}of e)this._templateIdToCustomTemplate.delete(o);this.defaultTemplates.removeAll(),this.printServiceTemplates.removeAll();const[i,s]=await Promise.all([this._getLayoutToLayoutTemplateInfos(t),this._getPrintServiceTemplatesInfo(t)]);await this._loadAllTemplates(i,s,t),this._processPrintServiceTemplatesInfo(s),await this._processTemplateOptions()}_updateExportedFileNameMap(t){void 0!==this._exportedFileNameMap[t]?this._exportedFileNameMap[t]++:this._exportedFileNameMap[t]=0}async _processTemplateOptions(){const{layout:t,layoutItem:e}=this.templateOptions;if("map-only"!==t)if(this._customLayoutOptions={legend:this.templateOptions.legendEnabled,northArrow:this.templateOptions.northArrowEnabled,scaleBar:this.templateOptions.scaleBarEnabled},e?.id){try{e.loaded||await e.load()}catch{return void this.applyTemplate(this.defaultTemplate)}let t=this._templateIdToCustomTemplate.get(e.id);t||(t=new W({label:e.title,layoutItem:e,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl}),this._templateIdToCustomTemplate.set(t.id,t)),await this.applyTemplate(t)}else if(t){const t=this.defaultTemplates.find(t=>t.layout===this.templateOptions.layout)??this.printServiceTemplates.find(t=>t.layout===this.templateOptions.layout);await this.applyTemplate(t??this.defaultTemplate)}}async _loadPortal(t){try{await this.portal.load(t)}catch(e){throw new s("print:could-not-load-portal","Cannot load print resource information from portal",{error:e,url:this.effectivePrintServiceUrl})}}async _loadUrls(t){if(this.printServiceUrl)this._set("effectivePrintServiceUrl",this.printServiceUrl),this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t);else{await this._loadPortal(t);const{printTask:e,asyncPrintTask:i,layoutInfoTask:s}=this.portal?.helperServices??{};this._set("effectivePrintServiceUrl",e?.url),this._asyncPrintTaskUrl=i?.url,this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t),s?.url&&this.effectivePrintServiceUrl!==s.url?this._portalLayoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(s.url,t):this._portalLayoutInfoTaskUrl=this._layoutInfoTaskUrl}const e=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!e?.includes("gpserver"))throw new s("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl})}async _getLayoutInfoTaskUrl(t,e){if(!t)return null;const i=await S(t,"GetLayoutTemplatesInfo",e);return i?t.replace(J,`$1${encodeURI(i.displayName)}`):null}_getPortalDefaultTemplates(t,e){return this.portal?.helperServices?.printTask?.templates?.filter(t=>"map_only"!==t.layout.toLowerCase()&&(!e||e.includes(k(t.layout))))?.map(e=>{const i=W.fromJSON(e);if(i.type="default-template",i.layoutInfoTaskUrl=this._layoutInfoTaskUrl,i.layout){const e=t.get(i.layout);e&&i.setLayoutTemplateInfo(e)}return i})??[]}async _getPortalCustomTemplates(t){if(this.printServiceUrl||!this.portal)return[];const{layoutGroupQuery:e,user:i}=this.portal,s=L.test(this.portal.url),o=i?.userLicenseTypeId,a=o&&$.has(o);if(!e||s&&!a)return[];const r=new E({query:e,disableExtraQuery:!0}),l=await this.portal.queryGroups(r,t);if(!l.total)return[];const n=l.results[0],p=new E({num:100,query:"type:Layout",sortField:n.sortField,sortOrder:n.sortOrder??void 0}),m=(await n.queryItems(p,t)).results;if(!m.length)return[];return m.map(t=>(this.portalTemplateIds.push(t.id),new W({type:"default-template",label:t.title,layoutItem:t,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl})))}async _loadAllTemplates(t,e,i){let s=!1;const o=e?.layout?.choiceList;if(this.includeDefaultTemplates&&this.portal&&!this.printServiceUrl){const e=this._getPortalDefaultTemplates(t,o);s=!!e.length,this.defaultTemplates.addMany(e);const a=await this._getPortalCustomTemplates(i);this.defaultTemplates.addMany(a);for(const t of this.defaultTemplates)this._templateIdToCustomTemplate.set(t.id,t)}s||t.forEach((t,e)=>{if(!o||o.includes(e)){const i=new W({type:"print-service-template",layout:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl});i.setLayoutTemplateInfo(t),this.printServiceTemplates.add(i),this._templateIdToCustomTemplate.set(i.id,i)}})}_processPrintServiceTemplatesInfo(t){this._set("templatesInfo",t);const e=t?.layout?.defaultValue;if(e&&"map-only"!==e){const t=this.defaultTemplates.find(t=>t.layout===e)??this.printServiceTemplates.find(t=>t.layout===e)??this.defaultTemplates.at(0)??this.printServiceTemplates.at(0);this._set("defaultTemplate",t)}}async _getLayoutToLayoutTemplateInfos(t){const e=this._layoutInfoTaskUrl,i=e?this._layoutTemplateInfosCache.get(e):void 0,s=i??await V(e,void 0,t);i||this._layoutTemplateInfosCache.set(e,s);const o=new Map,a={};for(const r of s){const t=k(r.layoutTemplate);o.set(t,r),a[t]=r.layoutOptions.customTextElements}return this._serviceTemplateCustomTextElements=Object.freeze(a),o}async _getPrintServiceTemplatesInfo(t){const e=this.effectivePrintServiceUrl?this._tasksInfoCache.get(this.effectivePrintServiceUrl):void 0,i=e??await S(this.effectivePrintServiceUrl,"ExportWebMap",t);if(!i)throw new s("print:unavailable-service-info","Can't fetch templates info from service");e||this._tasksInfoCache.set(this.effectivePrintServiceUrl,i);const{parameters:o}=i,a=o.find(({name:t})=>"Format"===t),r=o.find(({name:t})=>"Layout_Template"===t);return{format:this._getFormat(a),layout:this._getLayout(r)}}_getFormat(t){const i="all"===this.allowedFormats?t.choiceList:t.choiceList.filter(t=>"string"!=typeof this.allowedFormats&&this.allowedFormats.some(e=>new RegExp(`\\b${e}\\b`,"i").test(t))),s=(i.length?i:t.choiceList).map(t=>U.fromJSON(t)).filter(e),o=U.fromJSON(t.defaultValue),a=s.some(t=>new RegExp(`\\b${o}\\b`,"i").test(t))?o:s[0];return{choiceList:s,defaultValue:a}}_getLayout(t){const i=t.choiceList.filter(t=>"map_only"!==t.toLowerCase()),s="all"===this.allowedLayouts?i:i.filter(t=>this.allowedLayouts.includes(k(t))),o=(s.length?s:i).map(k).filter(e),a=k(t.defaultValue),r=o.includes(a)?a:o.find(t=>/(?=.*letter)(?=.*landscape)/i.test(t))??o.find(t=>/(?=.*a4)(?=.*landscape)/i.test(t))??o[0];return{choiceList:o,defaultValue:r}}_getOverlayItem(){return this._overlayItem||(this._overlayItem=new A({strokeDash:[5],strokeWidth:2,strokeColor:[30,144,255,255]})),this._overlayItem}_enablePrintPreview(){if(!this.view?.overlay)return;const t=this.templateOptions,e=this._getOverlayItem();this.addHandles([m(()=>[t.width,t.height,t.scaleEnabled,t.scale,t.layout,t.layoutItem,t.id,t.state,t.dpi,this.view?.scale,this.view?.size,this.view?.state.paddedViewState.size,this.view?.state.padding,this.loaded],()=>this._updateOverLayItem(),h),this.view?.on("drag",["Shift"],t=>this._handleDrag(t),D.WIDGET),this.view?.on("key-down",["Escape"],()=>this._resetDrag(),D.WIDGET)],"overlay-handler"),this.view.overlay.addItem(e)}_updateOverLayItem(){if(!this.view)return;const t=this.templateOptions,e=this._getOverlayItem(),i=t.layoutItem?.id??t.layout,s=this.view,o=s.spatialReference,[a,r]=s.state.paddedViewState.size,l=s.state.padding;let n=0,p=0;if("map-only"===i)null!=t.width&&null!=t.height&&(n=t.width,p=t.height);else if(i){const e=t.id?this._templateIdToCustomTemplate.get(t.id):null,{webMapFrameSize:i,pageUnits:s}=e?.layoutTemplateInfo??{};let l=!1;if(i&&s)if(this._isFreeHand){const t=i[0]/i[1];n=this._freeHandWidth,p=this._freehandHeight,n>p?p=n/t:n=p*t}else{const t=z.fromJSON(s.toLowerCase()),e=o.unit;c(t)===c(e)?(n=f(i[0],t,e),p=f(i[1],t,e)):(l=!0,n=i[0],p=i[1])}if(!this._isFreeHand)if(t.scaleEnabled&&t.scale){const t=l?Math.min(a/n,r/p):y(o)*v*Q;n*=t,p*=t}else if(0===n||0===p)n=a,p=r;else{const t=(a-.1*a)/n,e=(r-.1*r)/p,i=Math.min(t,e);n*=i,p*=i}}const{scaleEnabled:m,scale:h}=t,d=m&&h?h/this.view.scale:1;if(e.boxWidth=n*d||a,e.boxHeight=p*d||r,l&&(e.padding=l),e.backgroundWidth=a??0,e.backgroundHeight=r??0,"loading"===this.loadStatus)e.strokeColor=G;else if("loaded"===this.loadStatus)switch(this.templateOptions.state){case"pending":e.strokeColor=G;break;case"ready":e.strokeColor=B;break;case"error":e.strokeColor=q}}_resetDrag(){this._isFreeHand=!1,this._updateOverLayItem()}_handleDrag(t){switch(t.action){case"start":this._start();break;case"update":this._update(t);break;case"end":this._end()}t.stopPropagation()}_start(){this._isFreeHand=!0}_update(t){const e=this._getOverlayItem(),{x:i,y:s}=t,{x:o,y:a}=t.origin;i>o?(e.x=o,e.boxWidth=i-o):(e.x=i,e.boxWidth=o-i),s>a?(e.y=a,e.boxHeight=s-a):(e.y=s,e.boxHeight=a-s)}_end(){const t=this._getOverlayItem();if(!this.view||null==t.x||null==t.y)return;const e=this.view,i=e.toMap(u(t.x+.5*t.boxWidth,t.y+.5*t.boxHeight));t.x=null,t.y=null,e.goTo({center:i}),this._freeHandWidth=t.boxWidth,this._freehandHeight=t.boxHeight,"map-only"===this.templateOptions.layout&&(this.templateOptions.width=this._freeHandWidth,this.templateOptions.height=this._freehandHeight),this.templateOptions.scale=this.view.scale,this._updateOverLayItem()}};t([T()],it.prototype,"_serviceTemplateCustomTextElements",void 0),t([T()],it.prototype,"_templateIdToCustomTemplate",void 0),t([T()],it.prototype,"allowedFormats",void 0),t([T()],it.prototype,"allowedLayouts",void 0),t([T({type:K})],it.prototype,"browseTemplates",void 0),t([T({type:K})],it.prototype,"defaultTemplates",void 0),t([T()],it.prototype,"error",void 0),t([T({type:X})],it.prototype,"exportedLinks",void 0),t([T()],it.prototype,"extraParameters",void 0),t([T()],it.prototype,"includeDefaultTemplates",void 0),t([T({readOnly:!0})],it.prototype,"effectivePrintServiceUrl",null),t([T()],it.prototype,"effectiveTemplateCustomTextElements",null),t([T({type:I})],it.prototype,"outSpatialReference",void 0),t([T({type:b})],it.prototype,"portal",void 0),t([T()],it.prototype,"portalTemplateIds",void 0),t([T({type:K})],it.prototype,"printServiceTemplates",void 0),t([T({readOnly:!0})],it.prototype,"defaultTemplate",void 0),t([T()],it.prototype,"showPrintAreaEnabled",void 0),t([T()],it.prototype,"printServiceUrl",void 0),t([T()],it.prototype,"printTimeout",void 0),t([T()],it.prototype,"saveExportEnabled",void 0),t([T({readOnly:!0})],it.prototype,"state",null),t([T({readOnly:!0})],it.prototype,"templatesInfo",void 0),t([T()],it.prototype,"updateDelay",void 0),t([T()],it.prototype,"view",void 0),t([T()],it.prototype,"templateCustomTextElements",void 0),t([T({type:R})],it.prototype,"templateOptions",void 0),it=t([w("esri.widgets.Print.PrintViewModel")],it);const st=it;export{st 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import o from"../../core/Accessor.js";import{clone as e}from"../../core/lang.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import s from"../../portal/PortalItem.js";let i=class extends o{constructor(t){super(t),this._abortController=null,this.attributionEnabled=!0,this.author=null,this.copyright=null,this.customTextElements=null,this.dpi=96,this.fileName=null,this.forceFeatureAttributes=!1,this.format="pdf",this.height=null,this.includeTables=!0,this.id=null,this.state="ready",this.layout="letter-ansi-a-landscape",this.layoutItem=null,this.legendEnabled=void 0,this.northArrowEnabled=void 0,this.scale=null,this.scaleBarEnabled=void 0,this.scaleEnabled=!1,this.title=null,this.width=null}async applyTemplate(t,o){if(t?.id===this.id&&"error"!==t?.state)return;if(this._abortController&&(this._abortController.abort(),this._abortController=null),!t)return;if(this._set("state","pending"),this._resetMapSurroundInfoOptions(),this._set("id",t.id),this.set({layout:t.layout,layoutItem:t.layoutItem}),!t.layoutOptions&&t.layoutItem){const o=new AbortController;if(this._abortController=o,await t.fetchLayoutItemTemplateInfo({signal:this._abortController.signal}),"loaded"!==t.state){if("error"===t.state&&this._set("state","error"),this._abortController!==o)return;return void(this._abortController=null)}this._abortController=null}const r=o?.customLayoutOptions,l=o?.customTextElements??t.layoutTemplateInfo?.layoutOptions?.customTextElements??this.customTextElements;this.set({customTextElements:l?e(l):void 0,format:this.format??t.format,legendEnabled:r?.legend??t.layoutOptions?.legend??this.legendEnabled,northArrowEnabled:r?.northArrow??t.layoutOptions?.northArrow??this.northArrowEnabled,scaleBarEnabled:r?.scaleBar??t.layoutOptions?.scaleBar??this.scaleBarEnabled}),this._set("state","ready")}reset(){this._set("id",null),this._set("state","ready"),this.set({layout:null,layoutItem:null,customTextElements:null}),this._resetMapSurroundInfoOptions()}_resetMapSurroundInfoOptions(){this.set({legendEnabled:void 0,northArrowEnabled:void 0,scaleBarEnabled:void 0})}};t([r()],i.prototype,"attributionEnabled",void 0),t([r()],i.prototype,"author",void 0),t([r()],i.prototype,"copyright",void 0),t([r()],i.prototype,"customTextElements",void 0),t([r()],i.prototype,"dpi",void 0),t([r()],i.prototype,"fileName",void 0),t([r()],i.prototype,"forceFeatureAttributes",void 0),t([r()],i.prototype,"format",void 0),t([r()],i.prototype,"height",void 0),t([r()],i.prototype,"includeTables",void 0),t([r({readOnly:!0})],i.prototype,"id",void 0),t([r({readOnly:!0})],i.prototype,"state",void 0),t([r()],i.prototype,"layout",void 0),t([r({type:s})],i.prototype,"layoutItem",void 0),t([r()],i.prototype,"legendEnabled",void 0),t([r()],i.prototype,"northArrowEnabled",void 0),t([r()],i.prototype,"scale",void 0),t([r()],i.prototype,"scaleBarEnabled",void 0),t([r()],i.prototype,"scaleEnabled",void 0),t([r()],i.prototype,"title",void 0),t([r()],i.prototype,"width",void 0),i=t([l("esri.widgets.Print.TemplateOptions")],i);const a=i;export{a as default};
5
+ import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{clone as o}from"../../core/lang.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import i from"../../portal/PortalItem.js";let s=class extends e{constructor(t){super(t),this._abortController=null,this.attributionEnabled=!0,this.author=null,this.copyright=null,this.customTextElements=null,this.dpi=96,this.dynamicLegendEnabled=void 0,this.fileName=null,this.forceFeatureAttributes=!1,this.format="pdf",this.height=null,this.includeTables=!0,this.id=null,this.state="ready",this.layout="letter-ansi-a-landscape",this.layoutItem=null,this.legendEnabled=void 0,this.northArrowEnabled=void 0,this.scale=null,this.scaleBarEnabled=void 0,this.scaleBarUnit=null,this.scaleEnabled=!1,this.title=null,this.width=null}async applyTemplate(t,e){if(t?.id===this.id&&"error"!==t?.state)return;if(this._abortController&&(this._abortController.abort(),this._abortController=null),!t)return;if(this._set("state","pending"),this._resetMapSurroundInfoOptions(),this._set("id",t.id),this.set({layout:t.layout,layoutItem:t.layoutItem}),!t.layoutOptions&&t.layoutItem){const e=new AbortController;if(this._abortController=e,await t.fetchLayoutItemTemplateInfo({signal:this._abortController.signal}),"loaded"!==t.state){if("error"===t.state&&this._set("state","error"),this._abortController!==e)return;return void(this._abortController=null)}this._abortController=null}const r=e?.customLayoutOptions,l=e?.customTextElements??t.layoutTemplateInfo?.layoutOptions?.customTextElements??this.customTextElements;this.set({customTextElements:l?o(l):void 0,format:this.format??t.format,legendEnabled:r?.legend??t.layoutOptions?.legend??this.legendEnabled,dynamicLegendEnabled:r?.dynamicLegend??t.layoutOptions?.dynamicLegend??this.dynamicLegendEnabled,northArrowEnabled:r?.northArrow??t.layoutOptions?.northArrow??this.northArrowEnabled,scaleBarEnabled:r?.scaleBar??t.layoutOptions?.scaleBar??this.scaleBarEnabled}),this._set("state","ready")}reset(){this._set("id",null),this._set("state","ready"),this.set({layout:null,layoutItem:null,customTextElements:null}),this._resetMapSurroundInfoOptions()}_resetMapSurroundInfoOptions(){this.set({legendEnabled:void 0,dynamicLegendEnabled:void 0,northArrowEnabled:void 0,scaleBarEnabled:void 0})}};t([r()],s.prototype,"attributionEnabled",void 0),t([r()],s.prototype,"author",void 0),t([r()],s.prototype,"copyright",void 0),t([r()],s.prototype,"customTextElements",void 0),t([r()],s.prototype,"dpi",void 0),t([r()],s.prototype,"dynamicLegendEnabled",void 0),t([r()],s.prototype,"fileName",void 0),t([r()],s.prototype,"forceFeatureAttributes",void 0),t([r()],s.prototype,"format",void 0),t([r()],s.prototype,"height",void 0),t([r()],s.prototype,"includeTables",void 0),t([r({readOnly:!0})],s.prototype,"id",void 0),t([r({readOnly:!0})],s.prototype,"state",void 0),t([r()],s.prototype,"layout",void 0),t([r({type:i})],s.prototype,"layoutItem",void 0),t([r()],s.prototype,"legendEnabled",void 0),t([r()],s.prototype,"northArrowEnabled",void 0),t([r()],s.prototype,"scale",void 0),t([r()],s.prototype,"scaleBarEnabled",void 0),t([r()],s.prototype,"scaleBarUnit",void 0),t([r()],s.prototype,"scaleEnabled",void 0),t([r()],s.prototype,"title",void 0),t([r()],s.prototype,"width",void 0),s=t([l("esri.widgets.Print.TemplateOptions")],s);const a=s;export{a as default};
package/widgets/Print.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import{JSONMap as a}from"../core/jsonMap.js";import l from"../core/Logger.js";import{watch as o,on as n,whenOnce as s}from"../core/reactiveUtils.js";import{unitName as r}from"../core/unitFormatUtils.js";import{addProxy as c,hasSameOrigin as p}from"../core/urlUtils.js";import{property as d,subclass as m}from"../core/accessorSupport/decorators.js";import{ensureInteger as u}from"../core/accessorSupport/ensureType.js";import h from"../geometry/SpatialReference.js";import{isValid as b}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as _}from"../portal/support/urlUtils.js";import{findToken as v}from"../rest/utils.js";import{formatJsonMap as g}from"../rest/support/fileFormat.js";import f from"./Widget.js";import y from"./Print/PrintViewModel.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as w}from"./support/globalCss.js";import{Heading as x}from"./support/Heading.js";import{legacyIcon as k}from"./support/legacyIcon.js";import{messageBundle as C,tsx as S,isRTL as I,tsxFragment as O,isActivationKey as E}from"./support/widget.js";const $="map-only",L="esri-print",M={base:L,headerTitle:`${L}__header-title`,layoutTabList:`${L}__layout-tab-list`,layoutTab:`${L}__layout-tab`,layoutSection:`${L}__layout-section`,mapOnlySection:`${L}__map-only-section`,panelItemsCentered:`${L}__panel-items--centered`,loader:`${L}__loader`,swapButton:`${L}__swap-button`,printButton:`${L}__export-button`,printButtonSection:`${L}__export-button-section`,printButtonSectionDivider:`${L}__export-button-section--divider`,templateSelectContainer:`${L}__template-select-container`,templateSelectIcon:`${L}__template-select-icon`,templateSelectError:`${L}__template-select-error`,templateSelectArrow:`${L}__template-select-arrow`,formSectionContainer:`${L}__form-section-container`,advancedOptionsSection:`${L}__advanced-options-section`,advancedOptionsContainer:`${L}__advanced-options-container`,browseTemplateButtonContainer:`${L}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${L}__browse-template-button-container-filter`,exportedFilesContainer:`${L}__export-panel-container`,exportedFilesTitle:`${L}__export-title`,exportedFile:`${L}__exported-file`,exportedFileLinkTitle:`${L}__exported-file-link-title`,exportedFileLinkDescription:`${L}__exported-file-link-description`,exportedFilesEmpty:`${L}__exported-files-empty`,printWidgetContainer:`${L}__container`,content:`${L}__content`,panelContainer:`${L}__panel-container`,scaleInfoContainer:`${L}__scale-info-container`,scaleInputContainer:`${L}__scale-input-container`,scaleInput:`${L}__scale-input`,sizeContainer:`${L}__size-container`,panelError:`${L}__panel--error`,exportedFileLoader:`${L}__exported-file--loader`,exportSection:`${L}__export-section`,exportSectionCentered:`${L}__export-section--centered`,templateButtonContainer:`${L}__template-button-container`,templateDoneButton:`${L}__template-done-button`,templateSelectFlowItemContainer:`${L}__template-select-flow-item-container`,templateSelectFlowItemContent:`${L}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${L}__template-select-flow-item-list-heading`,srLabel:`${L}__sr-label`,invalidWkidText:`${L}__invalid-wkid-text`};function F(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function P(e){return e?.toLowerCase()===$}function A(e){const{state:t,extension:i}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return i?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}const R=new a({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),B=new Map([["a3-landscape","a3-landscape"],["a3-portrait","a3-portrait"],["a4-landscape","a4-landscape"],["a4-portrait","a4-portrait"],["letter-ansi-a-landscape","ansi-a-landscape"],["letter-ansi-a-portrait","ansi-a-portrait"],["tabloid-ansi-b-landscape","ansi-b-landscape"],["tabloid-ansi-b-portrait","ansi-b-portrait"]]);let N=class extends f{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab="layoutTab",this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new y,this._onInput=e=>{"layoutTab"===this._selectedTab?this.templateOptions.title=e.currentTarget.value:"mapOnlyTab"===this._selectedTab&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const i=v(this.viewModel.effectivePrintServiceUrl),a=t.url,l=document.createElement("a");if(l.target="_blank",l.href=a,l.rel="noreferrer",l.download=t.formattedName??"",!i)return l.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",i),l.href=o.href,l.click(),l.href=a},i(l.getLogger(this),"Print","arcgis-print",{version:"4.33"}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([o(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{const{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){const t=g.apiValues;this._formats=e.format.choiceList.map(e=>{const i=t.find(t=>new RegExp(`\\b${t}\\b`,"i").test(e))??e;return{value:i,label:e===i?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}const t=this._formats.some(({value:e})=>new RegExp(`\\b${e}\\b`,"i").test(this.templateOptions.format));if(e.format.defaultValue&&!t){const t=this._formats.find(({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue))?.value;return void(t&&(this.templateOptions.format=t))}}),o(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{const{layout:e}=this.templateOptions;this._selectedTab=P(e)?"mapOnlyTab":"layoutTab","layoutTab"===this._selectedTab&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),o(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),o(()=>this.viewModel.view?.scale,e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}),n(()=>this.viewModel,"submit",e=>this.emit("submit",e)),n(()=>this.viewModel,"complete",e=>this.emit("complete",e))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(i),this._awaitingServerResponse=!1})}loadDependencies(){return T({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),link:()=>import("@esri/calcite-components/dist/components/calcite-link")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:i,view:a}=this,{attributionEnabled:l,author:o,copyright:n,dpi:s,format:r,height:c,layout:p,layoutItem:d,legendEnabled:m,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:g,scale:f,width:y}=t,T="ready"!==i.state||this._awaitingServerResponse||!(p||d),C=this._renderTitleOrFileNameSection(),O=S("div",{class:M.formSectionContainer},S("calcite-label",null,e.fileFormatTitle,S("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??"pdf"}},this._formats.map(({value:e,label:t},i)=>S("calcite-combobox-item",{key:`file-format-${i}`,selected:e===this.templateOptions.format,textLabel:t,value:e}))))),E=S("calcite-label",{layout:"inline"},S("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),$=S("div",null,S("div",{class:M.formSectionContainer},S("calcite-label",null,e.template,S("calcite-block",{class:M.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",label:e.template,loading:"loading"===this._selectedTemplate?.state,onclick:()=>this._showTemplates=!0,onkeydown:e=>{"Enter"!==e.key&&" "!==e.key||(this._showTemplates=!0)},tabIndex:0},S("calcite-icon",{class:M.templateSelectIcon,icon:(this._selectedTemplate?.layout?B.get(this._selectedTemplate.layout):null)||"custom-print",key:"template-select-icon",scale:"l",slot:"content-start"}),"error"===this._selectedTemplate?.state?S("calcite-icon",{class:M.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,S("calcite-icon",{class:M.templateSelectArrow,icon:I()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),E),L=S("div",{class:M.formSectionContainer},S("calcite-label",null,e.dpi,S("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),F=S("div",{class:M.formSectionContainer},S("calcite-label",null,S("div",{class:M.srLabel},e.outSpatialReference,S("calcite-link",{href:"https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/",target:"_blank"},"(WKID)")),S("calcite-input-number",{bind:this,"data-input-name":"outSpatialReference",integer:!0,numberButtonType:"none",value:i.outSpatialReference?.wkid?.toString()??"",onCalciteInputNumberInput:({currentTarget:e})=>{const t=u(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new h({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||b(i.outSpatialReference)}}),this._isValidSpatialReference?null:S("div",{class:M.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),P=S("div",{class:this.classes(M.scaleInfoContainer,M.formSectionContainer)},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:g,"data-option-name":"scaleEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scale),S("div",{class:M.scaleInputContainer},S("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${f}`,bind:this,class:M.scaleInput,"data-input-name":"scale",disabled:!g,value:`${f}`,onCalciteInputNumberInput:this._updateNumberInputValue}),S("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!g,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale}))),A=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:M.advancedOptionsContainer,key:"advanced-section-for-layout"},P,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?S("div",{class:M.formSectionContainer,key:"author-info"},S("calcite-label",null,e.author,S("calcite-input",{bind:this,"data-input-name":"author",value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?S("div",{class:M.formSectionContainer,key:"copyright-text"},S("calcite-label",null,e.copyright,S("calcite-input",{bind:this,"data-input-name":"copyright",value:n??"",onCalciteInputInput:this._updateInputValue}))):null,L,F,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?S("div",{class:M.formSectionContainer,key:"legend-info"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!m,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?S("div",{class:M.formSectionContainer,key:"north-arrow"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!_,"data-option-name":"northArrowEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?S("div",{class:M.formSectionContainer,key:"scale-bar"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!v,"data-option-name":"scaleBarEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),R=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:M.advancedOptionsContainer},P,L,F,S("div",{class:M.formSectionContainer},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),N=this.exportedLinks.toArray(),V=this._renderExportedLinkItems(N),D={[M.exportSectionCentered]:!N.length},U="layoutTab"===this._selectedTab?S("section",{"aria-labelledby":`${this.id}__layoutTab`,class:M.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},S("div",{class:M.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?C:null,$,"layoutTab"===this._selectedTab?O:null,S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(M.panelContainer,M.advancedOptionsSection),collapsible:!0,disabled:!(p||d?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},A))):"mapOnlyTab"===this._selectedTab?S("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:M.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},S("div",{class:M.panelContainer},C,O,S("div",null,S("div",{class:this.classes(M.sizeContainer,M.formSectionContainer)},S("calcite-label",null,e.width,S("calcite-input-number",{bind:this,"data-input-name":"width",value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("calcite-label",null,e.height,S("calcite-input-number",{bind:this,"data-input-name":"height",value:`${c}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("button",{"aria-label":e.swap,bind:this,class:this.classes(w.widgetButton,M.swapButton,k.swap),onclick:this._switchInput,type:"button"})),E),S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(M.panelContainer,M.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},R))):S("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(M.exportSection,D),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},S("div",{class:M.panelContainer},S("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:M.exportedFilesContainer},0===N.length?S("div",{class:M.exportedFilesEmpty},S("calcite-icon",{icon:"file",scale:"l"}),S("div",null,S(x,{class:M.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),S("div",null,e.exportHint))):V))),j="2d"!==a?.type,H=S("div",{class:M.panelError},a?j?e.sceneViewError:e.serviceError:e.noViewError),z=N.some(({state:e})=>"pending"===e),W=S("div",{class:M.content,key:"panel"},S("div",null,S("ul",{bind:this,class:M.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${"layoutTab"===this._selectedTab}`,class:M.layoutTab,"data-tab-id":"layoutTab",id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${"mapOnlyTab"===this._selectedTab}`,class:M.layoutTab,"data-tab-id":"mapOnlyTab",id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${"exportTab"===this._selectedTab}`,class:M.layoutTab,"data-tab-id":"exportTab",id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},z?S("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),"exportTab"!==this._selectedTab?S("div",{class:this.classes(M.printButtonSection,!this.saveExportHidden&&this.portal?M.printButtonSectionDivider:null),key:"export-button-section"},!this.saveExportHidden&&this.portal?S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,S("calcite-button",{"aria-label":e.exportDescription,bind:this,class:this.classes(M.printButton),disabled:T||!(p||d?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),q=S("calcite-flow",{key:"root-flow"},S("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},S("div",{class:M.printWidgetContainer},this.headerVisible?S("header",{class:M.headerTitle},e.export):null,this.error||j||!a?H:W)),this._renderChooseTemplateFlowItem()),K="initializing"===i.state,J=K?this._renderLoader():q,G={[M.panelItemsCentered]:K};return S("div",{bind:this,class:this.classes(M.base,w.widget,w.panel,G)},J)}_getPageSizeLabel(e){if(!e)return;const i=e.layoutTemplateInfo;if(!i)return;const a=R.fromJSON(i.pageUnits.toLowerCase());return`${t(i.pageSize[0])} × ${t(i.pageSize[1])} ${r(this.messagesUnits,a,"abbr")}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;const{label:i,layout:a,layoutItem:l,type:o}=e;if("print-service-template"===o&&this.messages[a])return this.messages[a];const n=i??a??l?.id;return n?.replaceAll("_"," ")??this.messages.untitled}_getPortalTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:t,layoutItem:i})=>!P(t)&&!!i?.id&&e.includes(i.id)):[]}_getDefaultTemplates(){const{portalTemplateIds:e}=this.viewModel;return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:t,layoutItem:i})=>!(P(t)||i?.id&&e.includes(i.id))):[]}_getPrintServiceTemplates(){return this.includeDefaultTemplates&&this._getDefaultTemplates().length?[]:this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!P(e))}_renderLayoutTemplates(e,t=!1,i=!1){return t&&e.sort((e,t)=>(e.label??"")>(t.label??"")?1:-1),e.map(e=>S("calcite-list-item",{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??"",value:e},S("calcite-icon",{icon:(e.layout?B.get(e.layout):null)||"custom-print",slot:"content-start"}),"loading"===e.state?S("calcite-loader",{inline:!0,key:`template-loader-${e.id}`,label:"loading",scale:"s",slot:"content-end"}):null,"error"===e?.state?S("calcite-icon",{class:M.templateSelectError,icon:"exclamation-mark-circle",key:`template-error-${e.id}`,scale:"s",slot:"content-end"}):null,i?S("calcite-action",{icon:"trash",onclick:()=>this.viewModel.removePortalTemplate(e),slot:"actions-end",text:"delete"}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{messages:e}=this,t=_.test(this.portal?.url),i=this.viewModel.browseTemplates.toArray(),a=this._getPortalTemplates(),l=this._getDefaultTemplates(),o=this._getPrintServiceTemplates(),n=i.length+a.length+l.length+o.length>15,s=this.browseTemplateButtonOnClick?S("calcite-button",{appearance:"outline",class:n?M.browseTemplateButtonContainerFilter:M.browseTemplateButtonContainer,iconStart:"folder",key:"browse-template-button",onclick:this.browseTemplateButtonOnClick,slot:n?"filter-actions-end":"default"},n?null:e.browseTemplates):null;return S("calcite-flow-item",{bind:this,closable:!1,heading:e.chooseTemplate,key:"template-flow-item",selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},S("div",{class:M.templateSelectFlowItemContainer},S("div",{class:M.templateSelectFlowItemContent},n?null:s,S("calcite-list",{filterEnabled:n,filterProps:["label"],key:"template-list",label:e.templateList,selectionMode:"single-persist",onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},n?s:null,i.length?S("div",{key:"my-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.myTemplates,t?S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(i,!0,!0)):null,a.length?S("div",{key:"org-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.organizationTemplates,t?S("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(a)):null,i.length||a.length?l.length?S("div",{key:"default-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(l,!0)):null:this._renderLayoutTemplates(l,!0),i.length||a.length?o.length?S("div",{key:"service-templates"},S("div",{class:M.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),S("div",{class:M.templateButtonContainer},S("calcite-button",{class:M.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?S("div",{class:M.formSectionContainer,key:"custom-text-elements"},e.map((e,t)=>{const[i,a]=Object.entries(e)[0];return"date"===i?null:S("calcite-label",{key:`custom-text-elements-${i}-${t}`},i,S("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":i,value:a??"",onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:i,fileNamePlaceHolder:a}=this.messages,l="layoutTab"===this._selectedTab?e:t,o="layoutTab"===this._selectedTab?i:a,n="layoutTab"===this._selectedTab?this.templateOptions.title:this.templateOptions.fileName;return S("div",{class:M.formSectionContainer,key:l},S("calcite-label",null,l,S("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&"layoutTab"===this._selectedTab||"mapOnlyTab"===t&&"mapOnlyTab"===this._selectedTab||"exportTab"===t&&"exportTab"===this._selectedTab)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[M.loader]:this._awaitingServerResponse};return S("div",{class:this.classes(e),key:"loader"})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find(e=>{const[i]=Object.entries(e)[0];return i===t})[t]=i}_updateInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:l}=this;a?this._updateCustomTextElementValue(l.customTextElements,i,t.value):l[i]=t.value}_updateNumberInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),{templateOptions:a}=this,l=Number(t.value);if(!F(l)){const e=a[i];return void(t.value=`${e}`)}a[i]=l}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t="layoutTab"===this._selectedTab?e.title:e.fileName,{promise:i}=this.viewModel.export(t||this.messages.untitled);this._selectedTab="exportTab",i.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){const t=this.messages,i=e.formattedName??"",{state:a}=e,l=this.saveAsButtonCallback&&"error"!==a&&this._isFormatAllowedForSaving(e.extension);return"pending"!==a&&l?S("calcite-popover",{autoClose:!0,key:`${i}-popover`,label:"Popover",offsetDistance:1,overlayPositioning:"fixed",pointerDisabled:!0,referenceElement:`${i}-popover-button`,scale:"s"},S("calcite-list",{label:""},e.portalItem?S("calcite-list-item",{label:t.openItem,onCalciteListItemSelect:()=>{const t=e.portalItem;if(!t||!t.itemPageUrl)return;const i=document.createElement("a");i.target="_blank",i.href=t.itemPageUrl,i.rel="noreferrer",i.click()}},S("calcite-icon",{icon:"launch2",key:`${i}-launch-icon`,scale:"s",slot:"content-start"})):S("calcite-list-item",{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(s(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},S("calcite-icon",{icon:"save",key:`${i}-save-icon`,scale:"s",slot:"content-start"})),S("calcite-list-item",{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},S("calcite-icon",{icon:"trash",key:`${i}-delete-icon`,scale:"s",slot:"content-start"})))):null}_renderExportedLinkItemContent(e){const t=this.messages,{url:i,state:a,error:l}=e,o=e.formattedName??"";let n=i||null;n&&(n=c(n));const s=p(n,location.href),r="error"===a?"print-task:cim-symbol-unsupported"===l?.name?t.exportWebMapCIMError:t.exportWebMapError:null;return S("div",{class:M.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},S("div",null,S("div",{class:M.exportedFileLinkTitle},o),S("div",{class:M.exportedFileLinkDescription},"pending"===a?t.generatingExport:r||(s?t.ready:t.linkReady))),"ready"===a?S("calcite-icon",{"aria-label":`${o}. ${t.linkReady}`,icon:s?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null)}_renderExportedLinkItemIcon(e){const t=e.formattedName??"";return"pending"===e.state?S("calcite-loader",{class:M.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:"m",slot:"content-start"}):S("calcite-icon",{icon:A(e),key:`${t}-start-icon`,scale:"s",slot:"content-start"})}_renderExportedLinkItemAction(e){const{state:t}=e,i=e.formattedName??"",a=this.saveAsButtonCallback&&"error"!==t&&this._isFormatAllowedForSaving(e.extension);return"pending"!==t?S("calcite-action",{icon:a?"ellipsis":"x",id:a?`${i}-popover-button`:void 0,key:a?`${i}-saveAs-action`:`${i}-action`,onclick:a?void 0:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:a?this.messagesCommon.options:this.messagesCommon.remove}):null}_renderExportedLinkItem(e){const t=e.formattedName??"";return S(O,null,S("calcite-list-item",{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return S("calcite-list",{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:"none"},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||"all"===this.allowedFormatsForSaving||!(!e||!this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,"mapOnlyTab"===this._selectedTab)this.viewModel.applyTemplate($);else if("layoutTab"===this._selectedTab){const e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(E(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case"layoutTab":this._toggleTab("ArrowLeft"===t?"exportTab":"mapOnlyTab");break;case"mapOnlyTab":this._toggleTab("ArrowLeft"===t?"layoutTab":"exportTab");break;case"exportTab":this._toggleTab("ArrowLeft"===t?"mapOnlyTab":"layoutTab")}e.preventDefault(),e.stopPropagation()}}};e([d()],N.prototype,"_showTemplates",void 0),e([d()],N.prototype,"_isValidSpatialReference",void 0),e([d()],N.prototype,"allowedFormats",null),e([d()],N.prototype,"allowedFormatsForSaving",void 0),e([d()],N.prototype,"allowedLayouts",null),e([d()],N.prototype,"browseTemplateButtonOnClick",void 0),e([d()],N.prototype,"error",null),e([d()],N.prototype,"exportedLinks",null),e([d()],N.prototype,"extraParameters",null),e([d()],N.prototype,"headerVisible",void 0),e([d()],N.prototype,"headingLevel",void 0),e([d()],N.prototype,"icon",null),e([d()],N.prototype,"includeDefaultTemplates",null),e([d()],N.prototype,"includeOrganizationTemplates",void 0),e([d()],N.prototype,"label",null),e([d(),C("esri/widgets/Print/t9n/Print")],N.prototype,"messages",void 0),e([d(),C("esri/t9n/common")],N.prototype,"messagesCommon",void 0),e([d(),C("esri/core/t9n/Units")],N.prototype,"messagesUnits",void 0),e([d({type:h})],N.prototype,"outSpatialReference",null),e([d()],N.prototype,"portal",null),e([d()],N.prototype,"saveExportEnabled",null),e([d()],N.prototype,"saveExportHidden",void 0),e([d()],N.prototype,"showPrintAreaEnabled",null),e([d()],N.prototype,"printServiceUrl",null),e([d()],N.prototype,"saveAsButtonCallback",void 0),e([d()],N.prototype,"templateCustomTextElements",null),e([d()],N.prototype,"templateOptions",null),e([d()],N.prototype,"view",null),e([d({type:y})],N.prototype,"viewModel",void 0),N=e([m("esri.widgets.Print")],N);const V=N;export{V as default};
5
+ import{__decorate as e}from"tslib";import{formatNumber as t}from"../intl.js";import i from"../core/Collection.js";import{deprecateWidget as a}from"../core/deprecate.js";import{JSONMap as l}from"../core/jsonMap.js";import o from"../core/Logger.js";import{watch as n,on as s,whenOnce as r}from"../core/reactiveUtils.js";import{unitName as c}from"../core/unitFormatUtils.js";import{addProxy as p,hasSameOrigin as d}from"../core/urlUtils.js";import{property as m,subclass as u}from"../core/accessorSupport/decorators.js";import{ensureInteger as h}from"../core/accessorSupport/ensureType.js";import b from"../geometry/SpatialReference.js";import{isValid as _}from"../geometry/support/spatialReferenceUtils.js";import v from"../portal/Portal.js";import{reArcGISOnlineDomain as g}from"../portal/support/urlUtils.js";import{findToken as f}from"../rest/utils.js";import{formatJsonMap as y}from"../rest/support/fileFormat.js";import T from"./Widget.js";import w from"./Print/FileLink.js";import k from"./Print/PrintViewModel.js";import x from"./Print/TemplateOptions.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{globalCss as S}from"./support/globalCss.js";import{Heading as I}from"./support/Heading.js";import{legacyIcon as O}from"./support/legacyIcon.js";import{messageBundle as E,tsx as L,isRTL as $,tsxFragment as F,isActivationKey as M}from"./support/widget.js";const P="map-only",A="esri-print",R={base:A,headerTitle:`${A}__header-title`,layoutTabList:`${A}__layout-tab-list`,layoutTab:`${A}__layout-tab`,layoutSection:`${A}__layout-section`,mapOnlySection:`${A}__map-only-section`,panelItemsCentered:`${A}__panel-items--centered`,loader:`${A}__loader`,swapButton:`${A}__swap-button`,printButton:`${A}__export-button`,printButtonSection:`${A}__export-button-section`,printButtonSectionDivider:`${A}__export-button-section--divider`,templateSelectContainer:`${A}__template-select-container`,templateSelectIcon:`${A}__template-select-icon`,templateSelectError:`${A}__template-select-error`,templateSelectArrow:`${A}__template-select-arrow`,formSectionContainer:`${A}__form-section-container`,advancedOptionsSection:`${A}__advanced-options-section`,advancedOptionsContainer:`${A}__advanced-options-container`,browseTemplateButtonContainer:`${A}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${A}__browse-template-button-container-filter`,exportedFilesContainer:`${A}__export-panel-container`,exportedFilesTitle:`${A}__export-title`,exportedFile:`${A}__exported-file`,exportedFileLinkTitle:`${A}__exported-file-link-title`,exportedFileLinkDescription:`${A}__exported-file-link-description`,exportedFilesEmpty:`${A}__exported-files-empty`,printWidgetContainer:`${A}__container`,content:`${A}__content`,panelContainer:`${A}__panel-container`,scaleInfoContainer:`${A}__scale-info-container`,scaleInputContainer:`${A}__scale-input-container`,scaleInput:`${A}__scale-input`,sizeContainer:`${A}__size-container`,panelError:`${A}__panel--error`,exportedFileLoader:`${A}__exported-file--loader`,exportSection:`${A}__export-section`,exportSectionCentered:`${A}__export-section--centered`,templateButtonContainer:`${A}__template-button-container`,templateDoneButton:`${A}__template-done-button`,templateSelectFlowItemContainer:`${A}__template-select-flow-item-container`,templateSelectFlowItemContent:`${A}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${A}__template-select-flow-item-list-heading`,srLabel:`${A}__sr-label`,invalidWkidText:`${A}__invalid-wkid-text`};function B(e){return!isNaN(e)&&e>0&&Number.isFinite(e)}function N(e){return e?.toLowerCase()===P}function V(e){const{state:t,extension:i}=e;switch(t){case"pending":return"spinner";case"error":return"exclamation-mark-circle";default:return i?.toLowerCase()?.includes("pdf")?"file-pdf":"file"}}const D=new l({inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"}),j=new Map([["a3-landscape","a3-landscape"],["a3-portrait","a3-portrait"],["a4-landscape","a4-landscape"],["a4-portrait","a4-portrait"],["letter-ansi-a-landscape","ansi-a-landscape"],["letter-ansi-a-portrait","ansi-a-portrait"],["tabloid-ansi-b-landscape","ansi-b-landscape"],["tabloid-ansi-b-portrait","ansi-b-portrait"]]);let U=class extends T{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._selectedTab="layoutTab",this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new k,this._onInput=e=>{"layoutTab"===this._selectedTab?this.templateOptions.title=e.currentTarget.value:"mapOnlyTab"===this._selectedTab&&(this.templateOptions.fileName=e.currentTarget.value)},this._handleLinkClick=e=>{const t=e.currentTarget["data-item"];if(!t||"ready"!==t.state||!t.url)return;const i=f(this.viewModel.effectivePrintServiceUrl),a=t.url,l=document.createElement("a");if(l.target="_blank",l.href=a,l.rel="noreferrer",l.download=t.formattedName??"",!i)return l.click(),void e.stopPropagation();e.preventDefault();const o=new URL(a);o.searchParams.set("token",i),l.href=o.href,l.click(),l.href=a},a(o.getLogger(this),"Print","arcgis-print",{version:"4.33"}),this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([n(()=>[this.templateOptions.format,this.viewModel.templatesInfo?.format],()=>{const{templatesInfo:e}=this.viewModel;if(!e)return;if(this._formats.length!==e.format.choiceList.length){const t=y.apiValues;this._formats=e.format.choiceList.map(e=>{const i=t.find(t=>new RegExp(`\\b${t}\\b`,"i").test(e))??e;return{value:i,label:e===i?e.toUpperCase():e}}).sort((e,t)=>e.label.localeCompare(t.label))}const t=this._formats.some(({value:e})=>new RegExp(`\\b${e}\\b`,"i").test(this.templateOptions.format));if(e.format.defaultValue&&!t){const t=this._formats.find(({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue))?.value;return void(t&&(this.templateOptions.format=t))}}),n(()=>[this.templateOptions.id,this.viewModel.loaded],()=>{const{layout:e}=this.templateOptions;this._selectedTab=N(e)?"mapOnlyTab":"layoutTab","layoutTab"===this._selectedTab&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))}),n(()=>this.templateOptions.dpi,e=>{e<=0&&(this.templateOptions.dpi=1)}),n(()=>this.viewModel.view?.scale,e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}),s(()=>this.viewModel,"submit",e=>this.emit("submit",e)),s(()=>this.viewModel,"complete",e=>this.emit("complete",e))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout(()=>{this._awaitingServerResponse=!0,this.scheduleRender()},500);this.viewModel.load().then(()=>{clearTimeout(i),this._awaitingServerResponse=!1})}loadDependencies(){return C({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),link:()=>import("@esri/calcite-components/dist/components/calcite-link")})}destroy(){this.viewModel.destroy()}get allowedFormats(){return this.viewModel.allowedFormats}set allowedFormats(e){this.viewModel.allowedFormats=e}get allowedLayouts(){return this.viewModel.allowedLayouts}set allowedLayouts(e){this.viewModel.allowedLayouts=e}get error(){return this.viewModel.error}get exportedLinks(){return this.viewModel.exportedLinks}set exportedLinks(e){this.viewModel.exportedLinks=e}get extraParameters(){return this.viewModel.extraParameters}set extraParameters(e){this.viewModel.extraParameters=e}get icon(){return"print"}set icon(e){this._overrideIfSome("icon",e)}get includeDefaultTemplates(){return this.viewModel.includeDefaultTemplates}set includeDefaultTemplates(e){this.viewModel.includeDefaultTemplates=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get outSpatialReference(){return this.viewModel.outSpatialReference}set outSpatialReference(e){this.viewModel.outSpatialReference=e}get portal(){return this.viewModel.portal}set portal(e){this.viewModel.portal=e}get saveExportEnabled(){return this.viewModel.saveExportEnabled}set saveExportEnabled(e){this.viewModel.saveExportEnabled=e}get showPrintAreaEnabled(){return this.viewModel.showPrintAreaEnabled}set showPrintAreaEnabled(e){this.viewModel.showPrintAreaEnabled=e}get printServiceUrl(){return this.viewModel.printServiceUrl}set printServiceUrl(e){this.viewModel.printServiceUrl=e}get templateCustomTextElements(){return this.viewModel.templateCustomTextElements}set templateCustomTextElements(e){this.viewModel.templateCustomTextElements=e}get templateOptions(){return this.viewModel.templateOptions}set templateOptions(e){this.viewModel.templateOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{messages:e,templateOptions:t,viewModel:i,view:a}=this,{attributionEnabled:l,author:o,copyright:n,dpi:s,format:r,height:c,layout:p,layoutItem:d,legendEnabled:m,northArrowEnabled:u,scaleBarEnabled:v,scaleEnabled:g,scale:f,width:y}=t,T="ready"!==i.state||this._awaitingServerResponse||!(p||d),w=this._renderTitleOrFileNameSection(),k=L("div",{class:R.formSectionContainer},L("calcite-label",null,e.fileFormatTitle,L("calcite-combobox",{clearDisabled:!0,label:e.formatDefaultOption,maxItems:6,placeholder:e.formatDefaultOption,selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.templateOptions.format=e.selectedItems[0]?.value??"pdf"}},this._formats.map(({value:e,label:t},i)=>L("calcite-combobox-item",{key:`file-format-${i}`,selected:e===this.templateOptions.format,textLabel:t,value:e}))))),x=L("calcite-label",{layout:"inline"},L("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),C=L("div",null,L("div",{class:R.formSectionContainer},L("calcite-label",null,e.template,L("calcite-block",{class:R.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",label:e.template,loading:"loading"===this._selectedTemplate?.state,onclick:()=>this._showTemplates=!0,onkeydown:e=>{"Enter"!==e.key&&" "!==e.key||(this._showTemplates=!0)},tabIndex:0},L("calcite-icon",{class:R.templateSelectIcon,icon:(this._selectedTemplate?.layout?j.get(this._selectedTemplate.layout):null)||"custom-print",key:"template-select-icon",scale:"l",slot:"content-start"}),"error"===this._selectedTemplate?.state?L("calcite-icon",{class:R.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,L("calcite-icon",{class:R.templateSelectArrow,icon:$()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),x),E=L("div",{class:R.formSectionContainer},L("calcite-label",null,e.dpi,L("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._updateNumberInputValue}))),F=L("div",{class:R.formSectionContainer},L("calcite-label",null,L("div",{class:R.srLabel},e.outSpatialReference,L("calcite-link",{href:"https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references/",target:"_blank"},"(WKID)")),L("calcite-input-number",{bind:this,"data-input-name":"outSpatialReference",integer:!0,numberButtonType:"none",value:i.outSpatialReference?.wkid?.toString()??"",onCalciteInputNumberInput:({currentTarget:e})=>{const t=h(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new b({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||_(i.outSpatialReference)}}),this._isValidSpatialReference?null:L("div",{class:R.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),M=L("div",{class:this.classes(R.scaleInfoContainer,R.formSectionContainer)},L("calcite-label",{layout:"inline"},L("calcite-checkbox",{bind:this,checked:g,"data-option-name":"scaleEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scale),L("div",{class:R.scaleInputContainer},L("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${f}`,bind:this,class:R.scaleInput,"data-input-name":"scale",disabled:!g,value:`${f}`,onCalciteInputNumberInput:this._updateNumberInputValue}),L("calcite-button",{appearance:"outline","aria-label":e.reset,bind:this,disabled:!g,iconStart:"refresh",kind:"neutral",onclick:this._resetToCurrentScale}))),P=L("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:R.advancedOptionsContainer,key:"advanced-section-for-layout"},M,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?L("div",{class:R.formSectionContainer,key:"author-info"},L("calcite-label",null,e.author,L("calcite-input",{bind:this,"data-input-name":"author",value:o??"",onCalciteInputInput:this._updateInputValue}))):null,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText??1?L("div",{class:R.formSectionContainer,key:"copyright-text"},L("calcite-label",null,e.copyright,L("calcite-input",{bind:this,"data-input-name":"copyright",value:n??"",onCalciteInputInput:this._updateInputValue}))):null,E,F,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?L("div",{class:R.formSectionContainer,key:"legend-info"},L("calcite-label",{layout:"inline"},L("calcite-checkbox",{bind:this,checked:!!m,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?L("div",{class:R.formSectionContainer,key:"north-arrow"},L("calcite-label",{layout:"inline"},L("calcite-checkbox",{bind:this,checked:!!u,"data-option-name":"northArrowEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.northArrow)):null,this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length?L("div",{class:R.formSectionContainer,key:"scale-bar"},L("calcite-label",{layout:"inline"},L("calcite-checkbox",{bind:this,checked:!!v,"data-option-name":"scaleBarEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.scaleBar)):null),A=L("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:R.advancedOptionsContainer},M,E,F,L("div",{class:R.formSectionContainer},L("calcite-label",{layout:"inline"},L("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),B=this.exportedLinks.toArray(),N=this._renderExportedLinkItems(B),V={[R.exportSectionCentered]:!B.length},D="layoutTab"===this._selectedTab?L("section",{"aria-labelledby":`${this.id}__layoutTab`,class:R.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},L("div",{class:R.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?w:null,C,"layoutTab"===this._selectedTab?k:null,L("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(R.panelContainer,R.advancedOptionsSection),collapsible:!0,disabled:!(p||d?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},P))):"mapOnlyTab"===this._selectedTab?L("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:R.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},L("div",{class:R.panelContainer},w,k,L("div",null,L("div",{class:this.classes(R.sizeContainer,R.formSectionContainer)},L("calcite-label",null,e.width,L("calcite-input-number",{bind:this,"data-input-name":"width",value:`${y}`,onCalciteInputNumberInput:this._updateNumberInputValue})),L("calcite-label",null,e.height,L("calcite-input-number",{bind:this,"data-input-name":"height",value:`${c}`,onCalciteInputNumberInput:this._updateNumberInputValue})),L("button",{"aria-label":e.swap,bind:this,class:this.classes(S.widgetButton,R.swapButton,O.swap),onclick:this._switchInput,type:"button"})),x),L("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(R.panelContainer,R.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},A))):L("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(R.exportSection,V),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},L("div",{class:R.panelContainer},L("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:R.exportedFilesContainer},0===B.length?L("div",{class:R.exportedFilesEmpty},L("calcite-icon",{icon:"file",scale:"l"}),L("div",null,L(I,{class:R.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),L("div",null,e.exportHint))):N))),U="2d"!==a?.type,H=L("div",{class:R.panelError},a?U?e.sceneViewError:e.serviceError:e.noViewError),z=B.some(({state:e})=>"pending"===e),W=L("div",{class:R.content,key:"panel"},L("div",null,L("ul",{bind:this,class:R.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},L("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${"layoutTab"===this._selectedTab}`,class:R.layoutTab,"data-tab-id":"layoutTab",id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),L("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${"mapOnlyTab"===this._selectedTab}`,class:R.layoutTab,"data-tab-id":"mapOnlyTab",id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),L("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${"exportTab"===this._selectedTab}`,class:R.layoutTab,"data-tab-id":"exportTab",id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},z?L("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),D),"exportTab"!==this._selectedTab?L("div",{class:this.classes(R.printButtonSection,!this.saveExportHidden&&this.portal?R.printButtonSectionDivider:null),key:"export-button-section"},!this.saveExportHidden&&this.portal?L("calcite-label",{layout:"inline"},L("calcite-checkbox",{bind:this,checked:this.saveExportEnabled,onCalciteCheckboxChange:e=>{this.saveExportEnabled=!!e.currentTarget.checked}}),e.saveExportToMyContent):null,L("calcite-button",{"aria-label":e.exportDescription,bind:this,class:this.classes(R.printButton),disabled:T||!(p||d?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),q=L("calcite-flow",{key:"root-flow"},L("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},L("div",{class:R.printWidgetContainer},this.headerVisible?L("header",{class:R.headerTitle},e.export):null,this.error||U||!a?H:W)),this._renderChooseTemplateFlowItem()),K="initializing"===i.state,J=K?this._renderLoader():q,G={[R.panelItemsCentered]:K};return L("div",{bind:this,class:this.classes(R.base,S.widget,S.panel,G)},J)}_getPageSizeLabel(e){if(!e)return;const i=e.layoutTemplateInfo;if(!i)return;const a=D.fromJSON(i.pageUnits.toLowerCase());return`${t(i.pageSize[0])} × ${t(i.pageSize[1])} ${c(this.messagesUnits,a,"abbr")}`}_getTemplateLabel(e,t=!1){if(!e)return t?this.messages.selectTemplate:this.messages.untitled;const{label:i,layout:a,layoutItem:l}=e,o=a&&!l&&this.messages[a]?this.messages[a]:null;if(o)return o;const n=i??a??l?.id;return n?.replaceAll("_"," ")??this.messages.untitled}_getPortalTemplates(){return this.includeDefaultTemplates&&this.includeOrganizationTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!N(e)&&!!t?.id):[]}_getDefaultTemplates(){return this.includeDefaultTemplates?this.viewModel.defaultTemplates.toArray().filter(({layout:e,layoutItem:t})=>!N(e)&&!t?.id):[]}_getPrintServiceTemplates(){return this.includeDefaultTemplates&&this._getDefaultTemplates().length?[]:this.viewModel.printServiceTemplates.toArray().filter(({layout:e})=>!N(e))}_renderLayoutTemplates(e,t=!1,i=!1){return t&&e.sort((e,t)=>(e.label??"")>(t.label??"")?1:-1),e.map(e=>L("calcite-list-item",{description:this._getPageSizeLabel(e),key:`template-${e.id}-${e.id===this.templateOptions.id}`,label:this._getTemplateLabel(e),selected:e.id===this.templateOptions.id,title:e.description??"",value:e},L("calcite-icon",{icon:(e.layout?j.get(e.layout):null)||"custom-print",slot:"content-start"}),"loading"===e.state?L("calcite-loader",{inline:!0,key:`template-loader-${e.id}`,label:"loading",scale:"s",slot:"content-end"}):null,"error"===e?.state?L("calcite-icon",{class:R.templateSelectError,icon:"exclamation-mark-circle",key:`template-error-${e.id}`,scale:"s",slot:"content-end"}):null,i?L("calcite-action",{icon:"trash",onclick:()=>this.viewModel.removePortalTemplate(e),slot:"actions-end",text:"delete"}):null))}_renderChooseTemplateFlowItem(){if(!this._showTemplates)return null;const{messages:e}=this,t=g.test(this.portal?.url),i=this.viewModel.browseTemplates.toArray(),a=this._getPortalTemplates(),l=this._getDefaultTemplates(),o=this._getPrintServiceTemplates(),n=i.length+a.length+l.length+o.length>15,s=this.browseTemplateButtonOnClick?L("calcite-button",{appearance:"outline",class:n?R.browseTemplateButtonContainerFilter:R.browseTemplateButtonContainer,iconStart:"folder",key:"browse-template-button",onclick:this.browseTemplateButtonOnClick,slot:n?"filter-actions-end":"default"},n?null:e.browseTemplates):null;return L("calcite-flow-item",{bind:this,closable:!1,heading:e.chooseTemplate,key:"template-flow-item",selected:this._showTemplates,onCalciteFlowItemBack:e=>{e.preventDefault(),this._showTemplates=!1}},L("div",{class:R.templateSelectFlowItemContainer},L("div",{class:R.templateSelectFlowItemContent},n?null:s,L("calcite-list",{filterEnabled:n,filterProps:["label"],key:"template-list",label:e.templateList,selectionMode:"single-persist",onCalciteListChange:({currentTarget:e})=>this.viewModel.applyTemplate(e.selectedItems[0]?.value)},n?s:null,i.length?L("div",{key:"my-templates"},L("div",{class:R.templateSelectFlowItemListHeading},e.myTemplates,t?L("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(i,!0,!0)):null,a.length?L("div",{key:"org-templates"},L("div",{class:R.templateSelectFlowItemListHeading},e.organizationTemplates,t?L("calcite-chip",{appearance:"outline",kind:"neutral",label:e.beta,scale:"s"},e.beta):null),this._renderLayoutTemplates(a)):null,i.length||a.length?l.length?L("div",{key:"default-templates"},L("div",{class:R.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(l,!0)):null:this._renderLayoutTemplates(l,!0),i.length||a.length?o.length?L("div",{key:"service-templates"},L("div",{class:R.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),L("div",{class:R.templateButtonContainer},L("calcite-button",{class:R.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?L("div",{class:R.formSectionContainer,key:"custom-text-elements"},e.map((e,t)=>{const[i,a]=Object.entries(e)[0];return"date"===i?null:L("calcite-label",{key:`custom-text-elements-${i}-${t}`},i,L("calcite-input",{bind:this,"data-input-custom":!0,"data-input-name":i,value:a??"",onCalciteInputInput:this._updateInputValue}))})):null}_renderTitleOrFileNameSection(){const{title:e,fileName:t,titlePlaceHolder:i,fileNamePlaceHolder:a}=this.messages,l="layoutTab"===this._selectedTab?e:t,o="layoutTab"===this._selectedTab?i:a,n="layoutTab"===this._selectedTab?this.templateOptions.title:this.templateOptions.fileName;return L("div",{class:R.formSectionContainer,key:l},L("calcite-label",null,l,L("calcite-input",{placeholder:o,value:n??"",onCalciteInputInput:this._onInput})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&"layoutTab"===this._selectedTab||"mapOnlyTab"===t&&"mapOnlyTab"===this._selectedTab||"exportTab"===t&&"exportTab"===this._selectedTab)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[R.loader]:this._awaitingServerResponse};return L("div",{class:this.classes(e),key:"loader"})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view?.scale}_updateCustomTextElementValue(e,t,i){e.find(e=>{const[i]=Object.entries(e)[0];return i===t})[t]=i}_updateInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:l}=this;a?this._updateCustomTextElementValue(l.customTextElements,i,t.value):l[i]=t.value}_updateNumberInputValue(e){const t=e.currentTarget,i=t.getAttribute("data-input-name"),{templateOptions:a}=this,l=Number(t.value);if(!B(l)){const e=a[i];return void(t.value=`${e}`)}a[i]=l}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t="layoutTab"===this._selectedTab?e.title:e.fileName,{promise:i}=this.viewModel.export(t||this.messages.untitled);this._selectedTab="exportTab",i.then(()=>this.scheduleRender())}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_scrollExportIntoView(){if(!this._pendingExportScroll)return;this._pendingExportScroll=!1;const e=this._rootNode;if(!e)return;const{clientHeight:t,scrollHeight:i}=e,a=i-t;a>0&&(e.scrollTop=a)}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&this._resetToCurrentScale()}_renderExportedLinkItemPopover(e){const t=this.messages,i=e.formattedName??"",{state:a}=e,l=this.saveAsButtonCallback&&"error"!==a&&this._isFormatAllowedForSaving(e.extension);return"pending"!==a&&l?L("calcite-popover",{autoClose:!0,key:`${i}-popover`,label:"Popover",offsetDistance:1,overlayPositioning:"fixed",pointerDisabled:!0,referenceElement:`${i}-popover-button`,scale:"s"},L("calcite-list",{label:""},e.portalItem?L("calcite-list-item",{label:t.openItem,onCalciteListItemSelect:()=>{const t=e.portalItem;if(!t||!t.itemPageUrl)return;const i=document.createElement("a");i.target="_blank",i.href=t.itemPageUrl,i.rel="noreferrer",i.click()}},L("calcite-icon",{icon:"launch2",key:`${i}-launch-icon`,scale:"s",slot:"content-start"})):L("calcite-list-item",{label:t.saveAs,onCalciteListItemSelect:async()=>{this.saveAsButtonCallback&&(r(()=>e.portalItem).then(e=>{e.itemPageUrl&&this.scheduleRender()}),await this.saveAsButtonCallback(e))}},L("calcite-icon",{icon:"save",key:`${i}-save-icon`,scale:"s",slot:"content-start"})),L("calcite-list-item",{label:this.messagesCommon.delete,onCalciteListItemSelect:()=>this.exportedLinks.remove(e)},L("calcite-icon",{icon:"trash",key:`${i}-delete-icon`,scale:"s",slot:"content-start"})))):null}_renderExportedLinkItemContent(e){const t=this.messages,{url:i,state:a,error:l}=e,o=e.formattedName??"";let n=i||null;n&&(n=p(n));const s=d(n,location.href),r="error"===a?"print-task:cim-symbol-unsupported"===l?.name?t.exportWebMapCIMError:t.exportWebMapError:null;return L("div",{class:R.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},L("div",null,L("div",{class:R.exportedFileLinkTitle},o),L("div",{class:R.exportedFileLinkDescription},"pending"===a?t.generatingExport:r||(s?t.ready:t.linkReady))),"ready"===a?L("calcite-icon",{"aria-label":`${o}. ${t.linkReady}`,icon:s?"download-to":"launch",key:`${o}-end-icon`,scale:"s",slot:"content-end"}):null)}_renderExportedLinkItemIcon(e){const t=e.formattedName??"";return"pending"===e.state?L("calcite-loader",{class:R.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:"m",slot:"content-start"}):L("calcite-icon",{icon:V(e),key:`${t}-start-icon`,scale:"s",slot:"content-start"})}_renderExportedLinkItemAction(e){const{state:t}=e,i=e.formattedName??"",a=this.saveAsButtonCallback&&"error"!==t&&this._isFormatAllowedForSaving(e.extension);return"pending"!==t?L("calcite-action",{icon:a?"ellipsis":"x",id:a?`${i}-popover-button`:void 0,key:a?`${i}-saveAs-action`:`${i}-action`,onclick:a?void 0:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:a?this.messagesCommon.options:this.messagesCommon.remove}):null}_renderExportedLinkItem(e){const t=e.formattedName??"";return L(F,null,L("calcite-list-item",{key:t,label:t},this._renderExportedLinkItemContent(e),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return L("calcite-list",{filterEnabled:e?.length>10,label:this.messages.exportedLinksList,selectionMode:"none"},e.map(this._renderExportedLinkItem.bind(this)))}_isFormatAllowedForSaving(e){return!this.allowedFormatsForSaving||"all"===this.allowedFormatsForSaving||!(!e||!this.allowedFormatsForSaving.includes(e))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._selectedTab=e,"mapOnlyTab"===this._selectedTab)this.viewModel.applyTemplate(P);else if("layoutTab"===this._selectedTab){const e=this._selectedTemplate??this.viewModel.defaultTemplate;this.viewModel.applyTemplate(e)}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(M(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case"layoutTab":this._toggleTab("ArrowLeft"===t?"exportTab":"mapOnlyTab");break;case"mapOnlyTab":this._toggleTab("ArrowLeft"===t?"layoutTab":"exportTab");break;case"exportTab":this._toggleTab("ArrowLeft"===t?"mapOnlyTab":"layoutTab")}e.preventDefault(),e.stopPropagation()}}};e([m()],U.prototype,"_showTemplates",void 0),e([m()],U.prototype,"_isValidSpatialReference",void 0),e([m()],U.prototype,"allowedFormats",null),e([m()],U.prototype,"allowedFormatsForSaving",void 0),e([m()],U.prototype,"allowedLayouts",null),e([m()],U.prototype,"browseTemplateButtonOnClick",void 0),e([m()],U.prototype,"error",null),e([m({type:i.ofType(w)})],U.prototype,"exportedLinks",null),e([m()],U.prototype,"extraParameters",null),e([m()],U.prototype,"headerVisible",void 0),e([m()],U.prototype,"headingLevel",void 0),e([m()],U.prototype,"icon",null),e([m()],U.prototype,"includeDefaultTemplates",null),e([m()],U.prototype,"includeOrganizationTemplates",void 0),e([m()],U.prototype,"label",null),e([m(),E("esri/widgets/Print/t9n/Print")],U.prototype,"messages",void 0),e([m(),E("esri/t9n/common")],U.prototype,"messagesCommon",void 0),e([m(),E("esri/core/t9n/Units")],U.prototype,"messagesUnits",void 0),e([m({type:b})],U.prototype,"outSpatialReference",null),e([m({type:v})],U.prototype,"portal",null),e([m()],U.prototype,"saveExportEnabled",null),e([m()],U.prototype,"saveExportHidden",void 0),e([m()],U.prototype,"showPrintAreaEnabled",null),e([m()],U.prototype,"printServiceUrl",null),e([m()],U.prototype,"saveAsButtonCallback",void 0),e([m()],U.prototype,"templateCustomTextElements",null),e([m({type:x})],U.prototype,"templateOptions",null),e([m()],U.prototype,"view",null),e([m({type:k})],U.prototype,"viewModel",void 0),U=e([u("esri.widgets.Print")],U);const H=U;export{H 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import r from"../core/Logger.js";import{watch as i}from"../core/reactiveUtils.js";import{createScreenPoint as s}from"../core/screenUtils.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{formatNumber as a}from"../intl/number.js";import{defaultUnitPropertyMetadata as n}from"../properties/defaultUnit.js";import d from"./Widget.js";import{css as c}from"./ScaleBar/css.js";import p from"./ScaleBar/ScaleBarViewModel.js";import{globalCss as u}from"./support/globalCss.js";import{messageBundle as m,tsx as h}from"./support/widget.js";function v(e,t){return a(e,{style:"unit",unit:t,unitDisplay:"short"})}let f=class extends d{constructor(e,i){super(e,i),this.messages=null,this.style="line",this.viewModel=new p,t(r.getLogger(this),"Scale Bar","arcgis-scale-bar",{version:"4.32"})}initialize(){this.addHandles(i(()=>{const{view:e}=this;return[e?.stationary,e?.center,e?.scale,e?.zoom]},([e])=>{e&&this.scheduleRender()}))}get icon(){return"actual-size"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get unit(){return this._defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="disabled"===this.viewModel.state,t={[u.disabled]:e};let r,i;if(!e){const{unit:e,style:t}=this,s="metric"===e||"dual"===e,o=100,l="dual"===e?"line":t;if("imperial"===e||"dual"===e){const e=this.viewModel.getScaleBarProperties(o,"imperial");e&&(i="ruler"===l?this._renderRuler(e):this._renderLine(e,"bottom"))}if(s){const e=this.viewModel.getScaleBarProperties(o,"metric");e&&(r="ruler"===l?this._renderRuler(e):this._renderLine(e,"top"))}}return h("div",{afterCreate:this._handleRootCreateOrUpdate,afterUpdate:this._handleRootCreateOrUpdate,bind:this,class:this.classes(c.base,u.widget,t)},r,i)}_renderRuler(e){const{length:t,unit:r,value:i}=e,s=Math.round(t),o=v(i,r);return h("div",{class:this.classes(c.barContainer,c.rulerBarContainer),key:c.rulerBarContainer},h("div",{class:c.ruler,styles:{width:`${s}px`}},h("div",{class:c.rulerBlock}),h("div",{class:c.rulerBlock}),h("div",{class:c.rulerBlock}),h("div",{class:c.rulerBlock})),h("div",{class:this.classes(c.labelContainer,c.rulerLabelContainer)},h("div",{class:c.label},"0"),h("div",{class:c.label},o)))}_renderLine(e,t){const{length:r,unit:i,value:s}=e,o=Math.round(r),l=v(s,i),a={[c.topLabelContainer]:"top"===t,[c.bottomLabelContainer]:"bottom"===t},n=h("div",{class:this.classes(c.labelContainer,c.lineLabelContainer,a),key:c.labelContainer},h("div",{class:c.label},l)),d={[c.topLine]:"top"===t,[c.bottomLine]:"bottom"===t},p=h("div",{class:this.classes(c.line,d),key:c.line,styles:{width:`${o}px`}});return h("div",{class:this.classes(c.barContainer,c.lineBarContainer),key:c.lineBarContainer},[p,n])}_handleRootCreateOrUpdate(e){if(!this.viewModel)return;const{scaleComputedFrom:t}=this.viewModel,r=e.getBoundingClientRect(),i=r.left+window.pageXOffset,o=r.top+window.pageYOffset,l=s(i,o);(l.x!==t.x||l.y!==t.y)&&(this.viewModel.scaleComputedFrom=l)}};e([o(n)],f.prototype,"_defaultUnit",void 0),e([o()],f.prototype,"icon",null),e([o()],f.prototype,"label",null),e([o(),m("esri/widgets/ScaleBar/t9n/ScaleBar")],f.prototype,"messages",void 0),e([o({type:["ruler","line"]})],f.prototype,"style",void 0),e([o({type:["metric","imperial","dual"]})],f.prototype,"unit",null),e([o()],f.prototype,"view",null),e([o()],f.prototype,"viewModel",void 0),f=e([l("esri.widgets.ScaleBar")],f);const b=f;export{b as default};
5
+ import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import r from"../core/Logger.js";import{watch as i}from"../core/reactiveUtils.js";import{createScreenPoint as s}from"../core/screenUtils.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{formatNumber as a}from"../intl/number.js";import{defaultUnitPropertyMetadata as n}from"../properties/defaultUnit.js";import d from"./Widget.js";import{css as c}from"./ScaleBar/css.js";import p from"./ScaleBar/ScaleBarViewModel.js";import{globalCss as u}from"./support/globalCss.js";import{messageBundle as m,tsx as h}from"./support/widget.js";function v(e,t){return a(e,{style:"unit",unit:t,unitDisplay:"short"})}let f=class extends d{constructor(e,i){super(e,i),this.messages=null,this.style="line",this.viewModel=new p,t(r.getLogger(this),"Scale Bar","arcgis-scale-bar",{version:"4.32"})}initialize(){this.addHandles(i(()=>{const{view:e}=this;return[e?.stationary,e?.center,e?.scale,e?.zoom]},([e])=>{e&&this.scheduleRender()}))}get icon(){return"actual-size"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get unit(){return this._defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e="disabled"===this.viewModel.state,t={[u.disabled]:e};let r,i;if(!e){const{unit:e,style:t}=this,s="metric"===e||"dual"===e,o=100,l="dual"===e?"line":t;if("imperial"===e||"dual"===e){const e=this.viewModel.getScaleBarProperties(o,"imperial");e&&(i="ruler"===l?this._renderRuler(e):this._renderLine(e,"bottom"))}if(s){const e=this.viewModel.getScaleBarProperties(o,"metric");e&&(r="ruler"===l?this._renderRuler(e):this._renderLine(e,"top"))}}return h("div",{afterCreate:this._handleRootCreateOrUpdate,afterUpdate:this._handleRootCreateOrUpdate,bind:this,class:this.classes(c.base,u.widget,t)},r,i)}_renderRuler(e){const{length:t,unit:r,value:i}=e,s=Math.round(t),o=v(i,r);return h("div",{class:this.classes(c.barContainer,c.rulerBarContainer),key:c.rulerBarContainer},h("div",{class:c.ruler,styles:{width:`${s}px`}},h("div",{class:c.rulerBlock}),h("div",{class:c.rulerBlock}),h("div",{class:c.rulerBlock}),h("div",{class:c.rulerBlock})),h("div",{class:this.classes(c.labelContainer,c.rulerLabelContainer)},h("div",{class:c.label},"0"),h("div",{class:c.label},o)))}_renderLine(e,t){const{length:r,unit:i,value:s}=e,o=Math.round(r),l=v(s,i),a={[c.topLabelContainer]:"top"===t,[c.bottomLabelContainer]:"bottom"===t},n=h("div",{class:this.classes(c.labelContainer,c.lineLabelContainer,a),key:c.labelContainer},h("div",{class:c.label},l)),d={[c.topLine]:"top"===t,[c.bottomLine]:"bottom"===t},p=h("div",{class:this.classes(c.line,d),key:c.line,styles:{width:`${o}px`}});return h("div",{class:this.classes(c.barContainer,c.lineBarContainer),key:c.lineBarContainer},[p,n])}_handleRootCreateOrUpdate(e){if(!this.viewModel)return;const{scaleComputedFrom:t}=this.viewModel,r=e.getBoundingClientRect(),i=r.left+window.pageXOffset,o=r.top+window.pageYOffset,l=s(i,o);(l.x!==t.x||l.y!==t.y)&&(this.viewModel.scaleComputedFrom=l)}};e([o(n)],f.prototype,"_defaultUnit",void 0),e([o()],f.prototype,"icon",null),e([o()],f.prototype,"label",null),e([o(),m("esri/widgets/ScaleBar/t9n/ScaleBar")],f.prototype,"messages",void 0),e([o({type:["ruler","line"]})],f.prototype,"style",void 0),e([o({type:["metric","imperial","dual"]})],f.prototype,"unit",null),e([o()],f.prototype,"view",null),e([o({type:p})],f.prototype,"viewModel",void 0),f=e([l("esri.widgets.ScaleBar")],f);const b=f;export{b 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{formatNumber as t,substitute as i}from"../intl.js";import{on as l}from"../core/events.js";import{destroyMaybe as a}from"../core/maybe.js";import{watch as s,when as n,initial as o}from"../core/reactiveUtils.js";import{property as r,cast as c,subclass as d}from"../core/accessorSupport/decorators.js";import m from"./Slider.js";import u from"./Widget.js";import{css as p}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as v,getScalePreviewSpriteBackgroundPosition as h}from"./ScaleRangeSlider/scalePreviewUtils.js";import S from"./ScaleRangeSlider/ScaleRanges.js";import M from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{messageBundle as _,tsx as w}from"./support/widget.js";import{storeNode as f,setFocus as y}from"./support/widgetUtils.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},I={maximumFractionDigits:0},L="1:",T=16;let C=class extends u{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new m({thumbCreatedFunction:(e,t,i)=>{0===e?this._minThumbNode=i:1===e&&(this._maxThumbNode=i),this.addHandles([l(i,"mouseenter",()=>{this._activeThumb=e,this.scheduleRender()}),l(i,"mouseleave",()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region="US",this.showWorldValue=!1,this.viewModel=new M,this.visibleElements=x,this._afterInputNumberCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,o),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},o),this._slider.on("thumb-drag",({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},t)}),n(()=>!0===this.view?.stationary,()=>this.scheduleRender())])}destroy(){this._slider=a(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&!0===e?.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&!0===e?.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return"actual-size"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${L}${t(e,I)}`}render(){const{_interactive:e,_slider:t,label:i,view:l,viewModel:{state:a}}=this,s=this._getLabel("min"),n=this._getLabel("max"),{segmentElements:o}=t,r=o.at("min-scale-only"===this.mode?-1:-2);return r&&r.classList.add(p.segmentElementActive),w("div",{"aria-label":i,class:this.classes(p.base,g.widget,e?null:g.disabled)},w("div",{class:p.scaleIndicatorWrapper,dir:"ltr"},"ready"===a&&l?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),w("div",{class:p.scaleMenuContainer},this._minScaleMenuEnabled&&s?this._renderScaleMenuToggle("min",s):null,w("div",{class:p.scaleMenuSeparator}),this._maxScaleMenuEnabled&&n?this._renderScaleMenuToggle("max",n):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return w("calcite-popover",{afterCreate:f,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:T,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,a=0===e||"range"!==this.mode?t.values[0]:t.values[1],s=Object.keys(S.RecommendedScales).indexOf(l.findScaleRangeByIndex(a).id),n={backgroundImage:v(i),backgroundPosition:h(s)};return w("div",{class:p.scalePreview},w("div",{class:p.scalePreviewThumbnail,styles:n}))}_getLabel(e){const{_slider:t,messages:i,mode:l,viewModel:{scaleRanges:a}}=this,[s,n]=t.values,o="min"===e||"range"!==l?s:n,r=i.scaleRangeLabels[a.findScaleRangeByIndex(o).id];switch(l){case"range":return r;case"max-scale-only":return"min"===e?null:r;case"min-scale-only":return"min"===e?r:null}}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,a=i===e;return[w("calcite-dropdown",{closeOnSelectDisabled:!0,"data-type":e,open:a,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",scale:"s",onCalciteDropdownClose:({currentTarget:t})=>{this._activeMenu===e&&this._setActiveMenu(null),y(t.querySelector("calcite-button"))},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},w("calcite-button",{appearance:a?"outline":"transparent","aria-pressed":a.toString(),class:p.scaleMenuToggle,disabled:!l,iconEnd:"chevron-down",scale:"s",slot:"trigger"},t),a&&"max"===e?this._renderMaxScaleMenu():null,a&&"min"===e?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:a})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:a})}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:a,effectiveMinScale:s,messages:n,showWorldValue:o}=this,r="max"===l?a:s,c=S.fromScaleRange({minScale:t,maxScale:i}),d=this.messages.featuredScaleLabels,m=S.RecommendedScales,u=Object.keys(m).filter(e=>c.contains(m[e])).map(e=>this._renderScaleMenuItem({scaleLabel:d[e],scaleValue:m[e],isSelected:r===m[e],valueVisible:"world"!==e||o}));return w("calcite-dropdown-group",{key:`${this.id}__scale-menu--${l}`},this._renderCustomScaleValue({currentScale:r}),null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:r===e,valueVisible:!0}):null,u)}_renderCustomScaleValue({currentScale:e}){const{messages:t}=this,i=Math.round(e).toString();return w("calcite-dropdown-item",{afterCreate:e=>{y(e)},key:"custom-scale",label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>{y(this._customInput)}},w("calcite-label",{scale:"s"},w("span",null,t.featuredScaleLabels.custom),w("calcite-input-number",{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:"numeric",max:S.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:t.customScaleInputTooltip,prefixText:L,scale:"s",step:1,value:i,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(i,e)})))}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:a}=e;return w("calcite-dropdown-item",{key:i,label:i,selected:a,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},i,l?w("div",{class:p.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:l,viewModel:{scaleRanges:a}}=this,s=a.clampScale(l.scale),n=this.viewModel.mapScaleToSlider(s),o=n/e.max,r=t.scaleRangeLabels[a.findScaleRangeByIndex(n).id],c=i(t.currentScaleTooltip,{scaleLabel:r});return w("div",{class:p.scaleIndicatorContainer,key:"scale-indicator"},w("div",{"aria-label":c,class:p.scaleIndicator,styles:{left:100*o+"%"},title:c},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return w("calcite-icon",{class:p.scaleIndicatorIcon,icon:"caret-up",scale:"s"})}_setScale(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([r()],C.prototype,"_activeMenu",void 0),e([r()],C.prototype,"_activeThumb",void 0),e([r()],C.prototype,"_customInput",void 0),e([r()],C.prototype,"_maxScaleMenuEnabled",null),e([r()],C.prototype,"_minScaleMenuEnabled",null),e([r()],C.prototype,"_slider",void 0),e([r({readOnly:!0})],C.prototype,"_interactive",null),e([r()],C.prototype,"disabled",void 0),e([r()],C.prototype,"effectiveMaxScale",null),e([r()],C.prototype,"effectiveMinScale",null),e([r()],C.prototype,"effectiveMaxScaleLimit",null),e([r()],C.prototype,"effectiveMinScaleLimit",null),e([r()],C.prototype,"icon",null),e([r()],C.prototype,"label",null),e([r()],C.prototype,"layer",null),e([r()],C.prototype,"maxScale",null),e([r()],C.prototype,"maxScaleLimit",null),e([r(),_("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],C.prototype,"messages",void 0),e([r()],C.prototype,"mode",null),e([r()],C.prototype,"minScale",null),e([r()],C.prototype,"minScaleLimit",null),e([r()],C.prototype,"region",void 0),e([r()],C.prototype,"showWorldValue",void 0),e([r()],C.prototype,"view",null),e([r()],C.prototype,"viewModel",void 0),e([r()],C.prototype,"visibleElements",void 0),e([c("visibleElements")],C.prototype,"castVisibleElements",null),C=e([d("esri.widgets.ScaleRangeSlider")],C);const R=C;export{R as default};
5
+ import{__decorate as e}from"tslib";import{formatNumber as t,substitute as i}from"../intl.js";import{on as l}from"../core/events.js";import{destroyMaybe as a}from"../core/maybe.js";import{watch as s,when as n,initial as o}from"../core/reactiveUtils.js";import{property as r,cast as c,subclass as d}from"../core/accessorSupport/decorators.js";import m from"./Slider.js";import u from"./Widget.js";import{css as p}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as v,getScalePreviewSpriteBackgroundPosition as h}from"./ScaleRangeSlider/scalePreviewUtils.js";import S from"./ScaleRangeSlider/ScaleRanges.js";import M from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as g}from"./support/globalCss.js";import{messageBundle as _,tsx as w}from"./support/widget.js";import{storeNode as f,setFocus as y}from"./support/widgetUtils.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},I={maximumFractionDigits:0},L="1:",T=16;let C=class extends u{constructor(e,t){super(e,t),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new m({thumbCreatedFunction:(e,t,i)=>{0===e?this._minThumbNode=i:1===e&&(this._maxThumbNode=i),this.addHandles([l(i,"mouseenter",()=>{this._activeThumb=e,this.scheduleRender()}),l(i,"mouseleave",()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())})])}}),this.disabled=!1,this.messages=null,this.region="US",this.showWorldValue=!1,this.viewModel=new M,this.visibleElements=x,this._afterInputNumberCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}initialize(){this.addHandles([s(()=>this.viewModel,e=>this._slider.viewModel=e?.sliderViewModel??null,o),s(()=>this._interactive,e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)},o),this._slider.on("thumb-drag",({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout(()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null},t)}),n(()=>!0===this.view?.stationary,()=>this.scheduleRender())])}destroy(){this._slider=a(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&!0===e?.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&!0===e?.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get icon(){return"actual-size"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${L}${t(e,I)}`}render(){const{_interactive:e,_slider:t,label:i,view:l,viewModel:{state:a}}=this,s=this._getLabel("min"),n=this._getLabel("max"),{segmentElements:o}=t,r=o.at("min-scale-only"===this.mode?-1:-2);return r&&r.classList.add(p.segmentElementActive),w("div",{"aria-label":i,class:this.classes(p.base,g.widget,e?null:g.disabled)},w("div",{class:p.scaleIndicatorWrapper,dir:"ltr"},"ready"===a&&l?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),w("div",{class:p.scaleMenuContainer},this._minScaleMenuEnabled&&s?this._renderScaleMenuToggle("min",s):null,w("div",{class:p.scaleMenuSeparator}),this._maxScaleMenuEnabled&&n?this._renderScaleMenuToggle("max",n):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return w("calcite-popover",{afterCreate:f,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:T,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,a=0===e||"range"!==this.mode?t.values[0]:t.values[1],s=Object.keys(S.RecommendedScales).indexOf(l.findScaleRangeByIndex(a).id),n={backgroundImage:v(i),backgroundPosition:h(s)};return w("div",{class:p.scalePreview},w("div",{class:p.scalePreviewThumbnail,styles:n}))}_getLabel(e){const{_slider:t,messages:i,mode:l,viewModel:{scaleRanges:a}}=this,[s,n]=t.values,o="min"===e||"range"!==l?s:n,r=i.scaleRangeLabels[a.findScaleRangeByIndex(o).id];switch(l){case"range":return r;case"max-scale-only":return"min"===e?null:r;case"min-scale-only":return"min"===e?r:null}}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,a=i===e;return[w("calcite-dropdown",{closeOnSelectDisabled:!0,"data-type":e,open:a,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",scale:"s",onCalciteDropdownClose:({currentTarget:t})=>{this._activeMenu===e&&this._setActiveMenu(null),y(t.querySelector("calcite-button"))},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},w("calcite-button",{appearance:a?"outline":"transparent","aria-pressed":a.toString(),class:p.scaleMenuToggle,disabled:!l,iconEnd:"chevron-down",scale:"s",slot:"trigger"},t),a&&"max"===e?this._renderMaxScaleMenu():null,a&&"min"===e?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:a})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,a=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:a})}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:a,effectiveMinScale:s,messages:n,showWorldValue:o}=this,r="max"===l?a:s,c=S.fromScaleRange({minScale:t,maxScale:i}),d=this.messages.featuredScaleLabels,m=S.RecommendedScales,u=Object.keys(m).filter(e=>c.contains(m[e])).map(e=>this._renderScaleMenuItem({scaleLabel:d[e],scaleValue:m[e],isSelected:r===m[e],valueVisible:"world"!==e||o}));return w("calcite-dropdown-group",{key:`${this.id}__scale-menu--${l}`},this._renderCustomScaleValue({currentScale:r}),null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:r===e,valueVisible:!0}):null,u)}_renderCustomScaleValue({currentScale:e}){const{messages:t}=this,i=Math.round(e).toString();return w("calcite-dropdown-item",{afterCreate:e=>{y(e)},key:"custom-scale",label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>{y(this._customInput)}},w("calcite-label",{scale:"s"},w("span",null,t.featuredScaleLabels.custom),w("calcite-input-number",{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:"numeric",max:S.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:t.customScaleInputTooltip,prefixText:L,scale:"s",step:1,value:i,onCalciteInputNumberChange:({currentTarget:e})=>this._handleCustomScaleInputChange(i,e)})))}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:a}=e;return w("calcite-dropdown-item",{key:i,label:i,selected:a,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},i,l?w("div",{class:p.scaleMenuSubLabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:l,viewModel:{scaleRanges:a}}=this,s=a.clampScale(l.scale),n=this.viewModel.mapScaleToSlider(s),o=n/e.max,r=t.scaleRangeLabels[a.findScaleRangeByIndex(n).id],c=i(t.currentScaleTooltip,{scaleLabel:r});return w("div",{class:p.scaleIndicatorContainer,key:"scale-indicator"},w("div",{"aria-label":c,class:p.scaleIndicator,styles:{left:100*o+"%"},title:c},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return w("calcite-icon",{class:p.scaleIndicatorIcon,icon:"caret-up",scale:"s"})}_setScale(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([r()],C.prototype,"_activeMenu",void 0),e([r()],C.prototype,"_activeThumb",void 0),e([r()],C.prototype,"_customInput",void 0),e([r()],C.prototype,"_maxScaleMenuEnabled",null),e([r()],C.prototype,"_minScaleMenuEnabled",null),e([r()],C.prototype,"_slider",void 0),e([r({readOnly:!0})],C.prototype,"_interactive",null),e([r()],C.prototype,"disabled",void 0),e([r()],C.prototype,"effectiveMaxScale",null),e([r()],C.prototype,"effectiveMinScale",null),e([r()],C.prototype,"effectiveMaxScaleLimit",null),e([r()],C.prototype,"effectiveMinScaleLimit",null),e([r()],C.prototype,"icon",null),e([r()],C.prototype,"label",null),e([r()],C.prototype,"layer",null),e([r()],C.prototype,"maxScale",null),e([r()],C.prototype,"maxScaleLimit",null),e([r(),_("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],C.prototype,"messages",void 0),e([r()],C.prototype,"mode",null),e([r()],C.prototype,"minScale",null),e([r()],C.prototype,"minScaleLimit",null),e([r()],C.prototype,"region",void 0),e([r()],C.prototype,"showWorldValue",void 0),e([r()],C.prototype,"view",null),e([r({type:M})],C.prototype,"viewModel",void 0),e([r()],C.prototype,"visibleElements",void 0),e([c("visibleElements")],C.prototype,"castVisibleElements",null),C=e([d("esri.widgets.ScaleRangeSlider")],C);const R=C;export{R 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import{popupFromView as i}from"../../views/popupAdapter.js";import r from"../Widget.js";import{css as l}from"./searchResultRendererCSS.js";import n from"./SearchViewModel.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{globalCss as p}from"../support/globalCss.js";import{messageBundle as u,tsx as m}from"../support/widget.js";let a=class extends r{constructor(e,t){super(e,t),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return c({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),"list-item-group":()=>import("@esri/calcite-components/dist/components/calcite-list-item-group")})}destroy(){this.viewModel=null}render(){return m("div",{class:this.classes(l.base,p.widget)},this.viewModel?.selectedResult?.name??"",this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;const{resultCount:e,results:s}=this.viewModel;return!e||e<2||!s?null:m("calcite-block",{class:l.moreResults,collapsible:!0,expanded:this.showMoreResultsOpen,heading:t(this.messages.showMoreResults,{count:e-1}),onCalciteBlockClose:()=>this._toggleShowMoreResults(!1),onCalciteBlockOpen:()=>this._toggleShowMoreResults(!0)},s.map(e=>this._renderMoreResultsList(e,s?.length>1)))}_renderListItem(e){return m("calcite-list-item",{key:`result-${e.sourceIndex}-${e.key}`,label:e.name,onCalciteListItemSelect:()=>this._selectResult(e)})}_renderMoreResultsList(e,t){const{results:s}=e;if(!(s?.length??0)||!s)return null;const o=this.viewModel?.selectedResult,i=this._getSourceName(e.source,e.sourceIndex),r=s.filter(e=>e!==o).map(e=>this._renderListItem(e));return m("calcite-list",{label:i},t?m("calcite-list-item-group",{heading:i,key:`group-${e.sourceIndex}`},r):r)}_selectResult(e){this.showMoreResultsOpen=!1,this.viewModel?.select(e)}_toggleShowMoreResults(e){this.showMoreResultsOpen=e;const t=i(this.viewModel?.view);t&&"reposition"in t&&"function"==typeof t.reposition&&t.reposition()}_getSourceName(e,t){return t===n.ALL_INDEX?this.messages.all:e.name}};e([s(),u("esri/widgets/Search/t9n/Search")],a.prototype,"messages",void 0),e([s()],a.prototype,"showMoreResultsOpen",void 0),e([s()],a.prototype,"viewModel",void 0),a=e([o("esri.widgets.Search.SearchResultRenderer")],a);const d=a;export{d as default};
5
+ import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import{popupFromView as i}from"../../views/popupAdapter.js";import r from"../Widget.js";import{css as l}from"./searchResultRendererCSS.js";import n from"./SearchViewModel.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import{globalCss as p}from"../support/globalCss.js";import{messageBundle as u,tsx as m}from"../support/widget.js";let a=class extends r{constructor(e,t){super(e,t),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}loadDependencies(){return c({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),"list-item-group":()=>import("@esri/calcite-components/dist/components/calcite-list-item-group")})}destroy(){this.viewModel=null}render(){return m("div",{class:this.classes(l.base,p.widget)},this.viewModel?.selectedResult?.name??"",this._renderMoreResults())}_renderMoreResults(){if(!this.viewModel)return null;const{resultCount:e,results:s}=this.viewModel;return!e||e<2||!s?null:m("calcite-block",{class:l.moreResults,collapsible:!0,expanded:this.showMoreResultsOpen,heading:t(this.messages.showMoreResults,{count:e-1}),onCalciteBlockClose:()=>this._toggleShowMoreResults(!1),onCalciteBlockOpen:()=>this._toggleShowMoreResults(!0)},s.map(e=>this._renderMoreResultsList(e,s?.length>1)))}_renderListItem(e){return m("calcite-list-item",{key:`result-${e.sourceIndex}-${e.key}`,label:e.name,onCalciteListItemSelect:()=>this._selectResult(e)})}_renderMoreResultsList(e,t){const{results:s}=e;if(!(s?.length??0)||!s)return null;const o=this.viewModel?.selectedResult,i=this._getSourceName(e.source,e.sourceIndex),r=s.filter(e=>e!==o).map(e=>this._renderListItem(e));return m("calcite-list",{label:i},t?m("calcite-list-item-group",{heading:i,key:`group-${e.sourceIndex}`},r):r)}_selectResult(e){this.showMoreResultsOpen=!1,this.viewModel?.select(e)}_toggleShowMoreResults(e){this.showMoreResultsOpen=e;const t=i(this.viewModel?.view);t&&"reposition"in t&&"function"==typeof t.reposition&&t.reposition()}_getSourceName(e,t){return t===n.ALL_INDEX?this.messages.all:e.name}};e([s(),u("esri/widgets/Search/t9n/Search")],a.prototype,"messages",void 0),e([s()],a.prototype,"showMoreResultsOpen",void 0),e([s({type:n})],a.prototype,"viewModel",void 0),a=e([o("esri.widgets.Search.SearchResultRenderer")],a);const d=a;export{d as default};