@arcgis/core 4.33.0-next.20250306 → 4.33.0-next.20250308

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 (246) hide show
  1. package/arcade/arcadeAsyncRuntime.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/arcade/featureSetUtils.js +1 -1
  4. package/arcade/featureset/actions/GroupBy.js +1 -1
  5. package/arcade/featureset/actions/OrderBy.js +1 -1
  6. package/arcade/functions/aiServices.js +5 -0
  7. package/arcade/functions/date.js +1 -1
  8. package/arcade/functions/feature.js +1 -1
  9. package/arcade/functions/featuresetbase.js +1 -1
  10. package/arcade/functions/featuresetstring.js +1 -1
  11. package/arcade/functions/fieldStats.js +1 -1
  12. package/arcade/functions/geometry.js +1 -1
  13. package/arcade/functions/maths.js +1 -1
  14. package/arcade/functions/string.js +1 -1
  15. package/arcade/languageUtils.js +1 -1
  16. package/arcade/treeAnalysis.js +1 -1
  17. package/arcade.js +1 -1
  18. package/assets/esri/core/workers/RemoteClient.js +1 -1
  19. package/assets/esri/core/workers/chunks/028e2e0fa6971aaaaae8.js +1 -0
  20. package/assets/esri/core/workers/chunks/0576b035c1654a43ad5c.js +1 -0
  21. package/assets/esri/core/workers/chunks/081699532b183db1e7c2.js +1 -0
  22. package/assets/esri/core/workers/chunks/087a09b4c41abef6b516.js +1 -0
  23. package/assets/esri/core/workers/chunks/{7ec2f531217718e76469.js → 0b4e63e705db09dbe171.js} +1 -1
  24. package/assets/esri/core/workers/chunks/0c9e933b392616460e62.js +1 -0
  25. package/assets/esri/core/workers/chunks/{c3d23c45db427a29d596.js → 0f4a2bdf5bb2f4303b7f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{f995a74bd9b58c069c07.js → 10631680abe7607616ca.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{567aa24d7e99e0b5a6cb.js → 1263391920fbb8926ced.js} +1 -1
  28. package/assets/esri/core/workers/chunks/186387a561364a11e574.js +1 -0
  29. package/assets/esri/core/workers/chunks/1cc7bbd0f4a8cf06050a.js +1 -0
  30. package/assets/esri/core/workers/chunks/1d0473dd43c88ab5776d.js +1 -0
  31. package/assets/esri/core/workers/chunks/{ef46613c3aa363dc1cfc.js → 285e573aa6f3acf70b32.js} +1 -1
  32. package/assets/esri/core/workers/chunks/2bb508701ad8ccc3d6ab.js +1 -0
  33. package/assets/esri/core/workers/chunks/36fe6b8228e622407ec2.js +1 -0
  34. package/assets/esri/core/workers/chunks/37a3533f004bf2e888da.js +1 -0
  35. package/assets/esri/core/workers/chunks/3be465c653236d6d8c1f.js +1 -0
  36. package/assets/esri/core/workers/chunks/3e4204502f6e09483c60.js +1 -0
  37. package/assets/esri/core/workers/chunks/3e9cd82325c473ddbf1f.js +1 -0
  38. package/assets/esri/core/workers/chunks/{1e7a70a1871fea29169e.js → 400951e3e742452a5fe2.js} +16 -16
  39. package/assets/esri/core/workers/chunks/{370ab4b33fb7292bb3b8.js → 424e2058228e5f6a183d.js} +1 -1
  40. package/assets/esri/core/workers/chunks/4496ef270c700078df0c.js +1 -0
  41. package/assets/esri/core/workers/chunks/458f4c6c8820c1f62f69.js +1 -0
  42. package/assets/esri/core/workers/chunks/49c346d2fb8538990f45.js +1 -0
  43. package/assets/esri/core/workers/chunks/4bb65ef7b3a02ebe416e.js +1 -0
  44. package/assets/esri/core/workers/chunks/4c765464288b6d096d08.js +1 -0
  45. package/assets/esri/core/workers/chunks/4eb1a2433f675bde12ad.js +1 -0
  46. package/assets/esri/core/workers/chunks/4ffdff269aae8c293cb4.js +1 -0
  47. package/assets/esri/core/workers/chunks/55f7b1de8882569861c0.js +1 -0
  48. package/assets/esri/core/workers/chunks/564cc81c232c97646833.js +1 -0
  49. package/assets/esri/core/workers/chunks/5a6f7360183693f8490d.js +1 -0
  50. package/assets/esri/core/workers/chunks/5f8028928ae8e5d27dda.js +1 -0
  51. package/assets/esri/core/workers/chunks/{c03e6e35082beaec02a6.js → 5fa5bfc70512994f5ec1.js} +1 -1
  52. package/assets/esri/core/workers/chunks/605eddec7aac891ed141.js +1 -0
  53. package/assets/esri/core/workers/chunks/66cba22c09f595bba3bf.js +1 -0
  54. package/assets/esri/core/workers/chunks/6cb5ce0a6bb85c624a21.js +1 -0
  55. package/assets/esri/core/workers/chunks/{bf9b45604249520b596a.js → 74c01de62ccaed0666e0.js} +1 -1
  56. package/assets/esri/core/workers/chunks/7a4413a188a8f1affb2f.js +1 -0
  57. package/assets/esri/core/workers/chunks/{b66e8a48ce7098ca43d5.js → 7c3cd6aefd16fcc1a7fd.js} +1 -1
  58. package/assets/esri/core/workers/chunks/7e0e9ca84490a0c67197.js +1 -0
  59. package/assets/esri/core/workers/chunks/{3315de71eb8791189c05.js → 835fa4484c58d9b31c78.js} +1 -1
  60. package/assets/esri/core/workers/chunks/88a7780b1c689afff8bd.js +1 -0
  61. package/assets/esri/core/workers/chunks/8d636075e5aa053940fc.js +1 -0
  62. package/assets/esri/core/workers/chunks/{7ca33e03a2fd217b9443.js → 9dfdd8e91897d166d888.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{790f86ddf57be50e0dd5.js → 9ef509e0853ad41f7690.js} +1 -1
  64. package/assets/esri/core/workers/chunks/a2377969f76640f1d6fe.js +1 -0
  65. package/assets/esri/core/workers/chunks/aa3a45e8228216c1739b.js +1 -0
  66. package/assets/esri/core/workers/chunks/b2289c18c02c868a2939.js +1 -0
  67. package/assets/esri/core/workers/chunks/b5f44cf03c4e5cc07bc4.js +1 -0
  68. package/assets/esri/core/workers/chunks/b948fe33b4d650eea796.js +1 -0
  69. package/assets/esri/core/workers/chunks/bdeac9196f28aff93e68.js +1 -0
  70. package/assets/esri/core/workers/chunks/c591527543fd75a917d4.js +1 -0
  71. package/assets/esri/core/workers/chunks/{ca4af35af02e3804042e.js → c6580fdcdc33153008b0.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{fe8ee1938d196a70d809.js → ca0572fe5614005acceb.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{67c1e2c17ea3ca27248c.js → cbbbaccc0d3683e1c0fe.js} +1 -1
  74. package/assets/esri/core/workers/chunks/ccc6f6f7052985bebdab.js +1 -0
  75. package/assets/esri/core/workers/chunks/d72d993b36daf6ec2a10.js +1 -0
  76. package/assets/esri/core/workers/chunks/eb9d2bb8b44a93347274.js +1 -0
  77. package/assets/esri/core/workers/chunks/f809cbfb744adb4fad29.js +1 -0
  78. package/assets/esri/core/workers/chunks/fa011ad649c05201e92a.js +1 -0
  79. package/assets/esri/core/workers/chunks/fa7ddf3c89cdb8052b26.js +1 -0
  80. package/assets/esri/core/workers/chunks/fdc9bd8f309af610fa62.js +1 -0
  81. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +2 -2
  82. package/assets/esri/themes/dark/main.css +1 -1
  83. package/assets/esri/themes/light/main.css +1 -1
  84. package/assets/esri/themes/light/view.css +1 -1
  85. package/chunks/LineMarker.glsl.js +2 -2
  86. package/chunks/aiServices.js +5 -0
  87. package/chunks/array.js +1 -1
  88. package/chunks/languageUtils.js +1 -1
  89. package/copyright.txt +38 -0
  90. package/core/MapUtils.js +1 -1
  91. package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
  92. package/interfaces.d.ts +11 -3
  93. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  94. package/layers/graphics/data/AttributesBuilder.js +1 -1
  95. package/layers/graphics/data/QueryEngineResult.js +1 -1
  96. package/layers/graphics/data/queryValidationUtils.js +1 -1
  97. package/layers/graphics/editingSupport.js +1 -1
  98. package/layers/support/TitleCreator.js +1 -1
  99. package/layers/support/fieldUtils.js +1 -1
  100. package/layers/support/labelFormatUtils.js +1 -1
  101. package/package.json +1 -1
  102. package/renderers/ClassBreaksRenderer.js +1 -1
  103. package/renderers/DictionaryRenderer.js +1 -1
  104. package/renderers/UniqueValueRenderer.js +1 -1
  105. package/renderers/support/DictionaryControlString.js +5 -0
  106. package/renderers/support/DictionaryLoader.js +1 -1
  107. package/renderers/support/DictionaryScriptEvaluator.js +5 -0
  108. package/rest/featureService/FeatureService.js +1 -1
  109. package/rest/print.js +1 -1
  110. package/rest/support/TranslateContent.js +5 -0
  111. package/rest/support/TranslateParameters.js +5 -0
  112. package/rest/support/TranslateResult.js +5 -0
  113. package/rest/translate.js +5 -0
  114. package/rest/utils.js +1 -1
  115. package/smartMapping/statistics/support/attributeDensity.js +1 -1
  116. package/smartMapping/statistics/support/utils.js +1 -1
  117. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  118. package/smartMapping/support/utils.js +1 -1
  119. package/support/ArcadeExpression.js +5 -0
  120. package/support/loadArcade.js +5 -0
  121. package/support/revision.js +1 -1
  122. package/symbols/cim/OverrideHelper.js +1 -1
  123. package/symbols/cim/cimAnalyzer.js +1 -1
  124. package/symbols/cim/utils.js +1 -1
  125. package/symbols/support/symbolUtils.js +1 -1
  126. package/views/2d/arcade/callExpressionWithCursor.js +1 -1
  127. package/views/2d/arcade/callExpressionWithFeature.js +1 -1
  128. package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
  129. package/views/2d/engine/webgl/shaderGraph/techniques/GraphicInstanceStore.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js +1 -1
  133. package/views/2d/engine/webgl/util/DictionaryMatcher.js +1 -1
  134. package/views/2d/engine/webgl/util/MatcherContext.js +1 -1
  135. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  136. package/views/2d/layers/MediaLayerView2D.js +1 -1
  137. package/views/2d/layers/TileLayerView2D.js +1 -1
  138. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  139. package/views/2d/layers/features/Processor.js +1 -1
  140. package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
  141. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  142. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  143. package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
  144. package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
  145. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  146. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  147. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  148. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  149. package/views/2d/layers/features/support/ComputedAttributeStorage.js +1 -1
  150. package/views/2d/layers/features/support/ComputedExpression.js +1 -1
  151. package/views/2d/layers/features/support/DictionaryTemplate.js +5 -0
  152. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  153. package/views/3d/environment/EnvironmentManager.js +1 -1
  154. package/views/3d/environment/Precipitation.js +1 -1
  155. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  156. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  157. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  158. package/views/3d/layers/I3SMeshView3D.js +1 -1
  159. package/views/3d/layers/RouteLayerView3D.js +1 -1
  160. package/views/3d/layers/SceneLayerView3D.js +1 -1
  161. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  162. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  163. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  164. package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
  165. package/views/3d/layers/graphics/queryForSymbologySnapping.js +1 -1
  166. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  167. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  168. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +7 -7
  169. package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
  170. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  171. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  172. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  173. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  174. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  175. package/views/VideoView.js +1 -1
  176. package/views/layers/FeatureLayerView.js +1 -1
  177. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  178. package/views/overlay/CrosshairOverlayItem.js +1 -1
  179. package/views/support/projectionUtils.js +1 -1
  180. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  181. package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
  182. package/widgets/Editor/EditorViewModel.js +1 -1
  183. package/widgets/Editor/Edits.js +1 -1
  184. package/widgets/Editor/UpdateWorkflow.js +1 -1
  185. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  186. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  187. package/widgets/Editor/support/dependencySort.js +5 -0
  188. package/widgets/Editor/workflowUtils.js +1 -1
  189. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  190. package/widgets/Feature/FeatureRelationship.js +1 -1
  191. package/widgets/Feature/support/featureUtils.js +1 -1
  192. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  193. package/widgets/FeatureForm/RelationshipInput.js +1 -1
  194. package/widgets/FeatureForm.js +1 -1
  195. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  196. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  197. package/widgets/Popup.js +1 -1
  198. package/widgets/Print.js +1 -1
  199. package/widgets/Sketch.js +1 -1
  200. package/widgets/support/LabeledSwitch.js +1 -1
  201. package/assets/esri/core/workers/chunks/0121702bc9a1f3a85f1f.js +0 -1
  202. package/assets/esri/core/workers/chunks/05b7c739115be0490583.js +0 -1
  203. package/assets/esri/core/workers/chunks/0ce1bfcdcccb679569f8.js +0 -1
  204. package/assets/esri/core/workers/chunks/1007c1a908b6e503e0db.js +0 -1
  205. package/assets/esri/core/workers/chunks/1439f1d84e21e6295e3f.js +0 -1
  206. package/assets/esri/core/workers/chunks/1912d25f8007685c7aee.js +0 -1
  207. package/assets/esri/core/workers/chunks/1bd58eaac6f4906bbdae.js +0 -1
  208. package/assets/esri/core/workers/chunks/2c091edee3601f345f5f.js +0 -1
  209. package/assets/esri/core/workers/chunks/2e40f2527345ad85d800.js +0 -1
  210. package/assets/esri/core/workers/chunks/30f271bbc34f66cbfc23.js +0 -1
  211. package/assets/esri/core/workers/chunks/36b406131cd864567033.js +0 -1
  212. package/assets/esri/core/workers/chunks/4395b7263a299a8020d4.js +0 -1
  213. package/assets/esri/core/workers/chunks/4c15de6b2b8eefd76b61.js +0 -1
  214. package/assets/esri/core/workers/chunks/4c596cb20baaae5166de.js +0 -1
  215. package/assets/esri/core/workers/chunks/4d16b1e50caad0da7838.js +0 -1
  216. package/assets/esri/core/workers/chunks/5802406d0a239a27a9a3.js +0 -1
  217. package/assets/esri/core/workers/chunks/5c86df2a5e16877ba614.js +0 -1
  218. package/assets/esri/core/workers/chunks/62c9171a58160ea099f8.js +0 -1
  219. package/assets/esri/core/workers/chunks/6a4731b47629604a9ca0.js +0 -1
  220. package/assets/esri/core/workers/chunks/7975ada96e4540a37c83.js +0 -1
  221. package/assets/esri/core/workers/chunks/81c507c0d901448835f4.js +0 -1
  222. package/assets/esri/core/workers/chunks/8278d9263e9b7e3bf2d1.js +0 -1
  223. package/assets/esri/core/workers/chunks/8926f672397620591740.js +0 -1
  224. package/assets/esri/core/workers/chunks/8bf623f560b1ed440004.js +0 -1
  225. package/assets/esri/core/workers/chunks/924176d9ab2e070248a8.js +0 -1
  226. package/assets/esri/core/workers/chunks/988efc508c33ca341e49.js +0 -1
  227. package/assets/esri/core/workers/chunks/98cbfc72430a378a9451.js +0 -1
  228. package/assets/esri/core/workers/chunks/9fde9309cb64f1a9301c.js +0 -1
  229. package/assets/esri/core/workers/chunks/a901c445d36f1a9e7df8.js +0 -1
  230. package/assets/esri/core/workers/chunks/ab525991f71240d68471.js +0 -1
  231. package/assets/esri/core/workers/chunks/af27a3f646a4404d3b8d.js +0 -1
  232. package/assets/esri/core/workers/chunks/c15c3fec95f365580902.js +0 -1
  233. package/assets/esri/core/workers/chunks/c1e343cdf85da40ac10e.js +0 -1
  234. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +0 -1
  235. package/assets/esri/core/workers/chunks/c3dc8d1958ddc71e1129.js +0 -1
  236. package/assets/esri/core/workers/chunks/c7b0f58550e63ce6ad5b.js +0 -1
  237. package/assets/esri/core/workers/chunks/ccf8a423eee7ef4ffe4c.js +0 -1
  238. package/assets/esri/core/workers/chunks/d24321b1eeabe9ec553c.js +0 -1
  239. package/assets/esri/core/workers/chunks/dd913cb7cf3bb172b34c.js +0 -1
  240. package/assets/esri/core/workers/chunks/e3e049311bced533c853.js +0 -1
  241. package/assets/esri/core/workers/chunks/e3e5a215dcd531b1196f.js +0 -1
  242. package/assets/esri/core/workers/chunks/e8a19f9144df8f155e30.js +0 -1
  243. package/assets/esri/core/workers/chunks/f31986ea5cadfade8344.js +0 -1
  244. package/assets/esri/core/workers/chunks/f350aefc5e348ebad1da.js +0 -1
  245. package/support/arcadeOnDemand.js +0 -5
  246. package/views/3d/layers/support/projectExtentUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import"../core/has.js";import i from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{createResolver as s}from"../core/promiseUtils.js";import{watch as n,initial as a,whenOnce as r}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as c}from"../layers/support/fieldUtils.js";import{getSubtypesFromLayer as u}from"../layers/support/layerUtils.js";import{isString as p}from"../support/guards.js";import m from"./Widget.js";import{Prompt as h}from"./Editor/components/Prompt.js";import v from"./Feature/FeatureUtilityNetworkAssociations.js";import{css as _}from"./FeatureForm/css.js";import{isGroupInput as b,isFieldInput as g,isRelationshipInput as f,isTextElementInput as y,isUtilityNetworkAssociationInput as C,flattenInputs as F,isInputInGroupInput as w,isFieldElementWithInputType as R,getErrorMessageForFieldInput as k,getIconForFeature as O,isNumberFieldInput as I,subtypeChangeShouldPrompt as N}from"./FeatureForm/featureFormUtils.js";import M from"./FeatureForm/FeatureFormViewModel.js";import L from"./FeatureForm/VisibleElements.js";import T from"./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as A,getIntlOptionsForField as D,numberingSystem as V,prepareISOFieldValueForDateComponents as U,prepareUnixFieldValueForDateComponents as S,normalizeTimeOnlyString as E,getISOFieldValueFromDateComponents as j,getUnixFieldValueFromDateComponents as P}from"./support/dateUtils.js";import{globalCss as $}from"./support/globalCss.js";import{Heading as H,incrementHeadingLevel as Z}from"./support/Heading.js";import{setFocus as G}from"./support/widgetUtils.js";import{messageBundle as W}from"./support/decorators/messageBundle.js";import{vmEvent as B}from"./support/decorators/vmEvent.js";import{tsx as K}from"./support/jsxFactory.js";import{substitute as q}from"../intl/substitute.js";const z="data-field-name";let J=class extends m{constructor(e,t){super(e,t),this._associationsWidgetsMap=new Map,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new M,this.visibleElements=new L,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,callbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,callbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),r((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>[this._featureFormUNAssociationList,this.visibleElements.associationDetails]),(([e,t])=>{e&&(e.visibleElements.associationDetails=t)}),a),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange())),n((()=>this.viewModel.activeAssociationInput),(e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}))])}loadDependencies(){return x({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),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"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){const{callbacks:e}=this;return!(!e?.viewAssociatedLayers||!e.viewAssociatedFeatures)}get _subtypes(){return u(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}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 map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return K("div",{class:this.classes(_.base,$.widget,$.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return K("div",null,K("form",{class:_.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?K(h,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){const e=this.viewModel,{formTitle:t,formDescription:i}=e;if(!e.formHeaderVisible)return;const o=null!=t&&K(H,{key:"title",level:this.headingLevel},t),s=null!=i&&K("p",{class:_.description,key:"description"},i);return K("div",{class:_.formHeader},o,s)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(t).filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return b(e)?this._renderGroup(e):g(e)?this._renderLabeledField(e):f(e)?this._renderRelationshipInput(e):y(e)?this._renderTextElementInput(e):C(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){const{feature:t,callbacks:i}=this;t&&i?.viewAssociatedFeatures&&i.viewAssociatedFeatures({associatedLayer:e.layer})}async _selectAssociatedFeature(e){const{feature:t,callbacks:i}=this;t&&i?.selectAssociatedFeature&&await i.selectAssociatedFeature({parentFeature:t,...e})}_onAddAssociation(e){const{feature:t,callbacks:i}=this;t&&i?.addAssociation&&i.addAssociation(e)}_setUpUtilityNetworkAssociationList(){this._featureFormUNAssociationList||(this._featureFormUNAssociationList=new T({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)}))}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._setUpUtilityNetworkAssociationList(),o(this._associationsWidgetsMap,e,(()=>new v({onSelectAssociationType:({viewModel:t,listType:i})=>{t.activeAssociationType=i;const{feature:o,callbacks:s}=this;o&&s?.viewAssociatedLayers&&s.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel}))).render()}_renderDescriptionOrEmpty(e,t){return null==e?null:K("div",{class:this.classes(_.description),id:t},e)}_renderGroup(e){const{disabled:t,formTemplate:i,headingLevel:o}=this,{description:s,id:n,inputs:a,label:r,open:l}=e,d=a.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),u=c?.group===e,p="sequential"===this.groupDisplay;return K("calcite-block",{class:this.classes(_.group,p?_.groupSequential:null,u?_.groupActive:null,t?_.inputDisabled:null),collapsible:!0,"data-group":e,description:s||void 0,disabled:t,heading:r??"",headingLevel:i?.title?Z(o):o,id:n,key:n,open:l,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},d.map((e=>this._renderInput(e))))}_getFocusableInput(e,t){const i=F(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(b(t)){const e=t.inputs.find((e=>e.visible));o=e?i.indexOf(e):0}else{let s;if(w(t)&&!t.group.open){const i=t.group.inputs.filter(g);s="forward"===e?i[i.length-1]:i[0]}else s=t;o=i.indexOf(s)+1}else o=0;for(let s=o;s<i.length;s++){const e=i[s];if(e.visible&&g(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:s,required:n}=e,a={"aria-label":n?q(this.messages.requiredFieldLabel,{name:o}):o,class:_.label,key:`${s.id}-${i.uid}-${e.name}`},r=[K("div",{class:_.labelTextContent,key:"labelTextContainer"},o,n?K("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?K("label",{...a},r):K("calcite-label",{...a},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s}=e,n=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(s,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),n):this._renderComboBoxComponent(e,t,n):this._renderSwitchComponent(e,n)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,n):"number"===t?this._renderNumberComponent(e,n):this._renderStringComponent(e,n)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?K("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)}):K("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):K("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){const i=c(e.field),o=i&&""!==t.value?Math.round(parseFloat(t.value)).toString():t.value;return K("calcite-input-number",{...t,integer:i,loading:e.updating,type:"number",value:o,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,A(i,t.value,{timeZone:this.timeZone,...D(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:s}=e,{class:n,key:a,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return K("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:n,"data-date-part":"date","data-field-name":t[z],key:`${a}-date-input`,max:p(l)?l:void 0,min:p(d)?d:void 0,numberingSystem:V,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=s?`${s}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:s,key:n,readOnly:a}=t;return K("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:s,"data-date-part":"time","data-field-name":t[z],key:`${n}-time-input`,numberingSystem:V,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:s,valid:n,value:a}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:V,overlayPositioning:"fixed",readOnly:d,[z]:i,onfocus:this._onComponentFocus},m=U(c,s),h=U(u,s),v=U(a,s);return K("div",{class:_.dateInputContainer,key:`${l}-date-time-container`},K("calcite-input-date-picker",{...p,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),K("calcite-input-time-picker",{...p,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:v.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?K("calcite-input-time-zone",{...p,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:s,value:n}=e,{class:a,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:V,overlayPositioning:"fixed",readOnly:c,[z]:o,onfocus:this._onComponentFocus},m=S(n,u),h=S(l,u),v=S(d,u);return K("div",{class:_.dateInputContainer,key:`${r}-date-time-container`},K("calcite-input-date-picker",{...p,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:m.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?K("calcite-input-time-picker",{...p,class:a,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:m.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return K("calcite-input",{...i,class:this.classes(_.fieldInput,_.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{viewModel:n,_inputsWithChanges:a}=this,r="INSERT"===n.arcadeEditType,l=a.has(s),d=null==o&&(!r||l),c=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return K("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:c,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:s,messagesTemplates:n,viewModel:a,_inputsWithChanges:r}=this,[l,d,c]=t.map((e=>e.map((({name:e,value:t})=>K("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))))),u=[];d.length>0&&u.push(K("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&u.push(K("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),u.length>0?u.unshift(K("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):u.push(...l);const p="INSERT"===a.arcadeEditType,m=r.has(o),h=null==i&&(!p||m);return e.showNoValueOptionEnabled&&u.unshift(K("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||s.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:s}=e,n=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===s,props:i})));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:o,value:t,selected:r,props:i}))}return K("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:_.inputRadioGroup,"data-field-name":i[z],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!R(e.element,"switch")&&i===e.element.input.onValue;return K("calcite-switch",{...t,checked:o,class:_.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return K("calcite-label",{class:_.inputRadioLabel,key:e,layout:"inline"},K("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:_.inputRadio,disabled:n.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.submittable?k(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?K("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?K("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{callbacks:s}=this;if(!o||!s?.showAllRelatedRecords)return;const n=this.messages;return K("calcite-list-item",{description:q(n.totalCount,{count:t}),label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},K("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:s,callbacks:n}=this;if(t&&n?.addRelatedRecord&&o)return K("calcite-button",{alignment:"center",appearance:"outline-fill",class:_.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(i,o)},round:!0,scale:"s",width:"full"},e.relatedLayerIsTable?s.addRecord:s.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:s}=e,{feature:n,callbacks:a}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),a?.editRelatedRecord&&n&&a.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,c=r?()=>r.remove(i):void 0;return K("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:s,onclick:l,onmouseenter:d,onmouseleave:c,value:s},K("calcite-icon",{icon:O(i),slot:"content-start"}),K("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,s=o?null:this._renderDescriptionOrEmpty(e.description),n=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return K("calcite-label",{class:this.classes(_.label,_.relatedRecordsLabel),key:`relationship-${i}-container`},K("div",null,this._renderRelatedRecordsHeaderContainer(e),s,n),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return K("div",{class:_.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},K("span",null,e.label),t?K("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return K("calcite-list",{class:_.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,s=this.viewModel.findField(o),n=e.layer?.fieldsIndex.get(o),a=s?.label||n?.alias||o,r=q(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:a});return K("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},K("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return K("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},K("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return K("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:_.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return K("div",{class:_.textElement,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:s,maxLength:n,minLength:a,name:r,range:{max:l,min:d},required:c,valid:u,value:p}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(_.fieldInput,h?_.inputDisabled:null),status:m&&!u?"invalid":"idle",key:r,label:s,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:n>-1?n:void 0,minLength:a>-1?a:void 0,placeholder:o??void 0,readOnly:h,required:c,value:null==p?"":`${p}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[z]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(z))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value&&null!=t.value){const i=new ResizeObserver((()=>{switch(e.value=void 0,t.field.type){case"date":e.value=S(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=U(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);I(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,w(i)&&(i.group.open=!0),G(e))}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null;"readOnly"in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:s,range:n}=i,a=this._dateComponentMap.get(s);if(!a)return;let r=this.viewModel.getValue(s),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=E(r),l=E(e.value)):l="timestamp-offset"===o?null!=e.value?j({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?P({oldValue:r,dateComponent:a.date,timeComponent:a.time,timeZone:t,max:n.max,min:n.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(s,l):this._updateFieldValue(s,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&N(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,t){const{value:i,name:o}=e,{messages:n,viewModel:a,messagesCommon:r,_subtypes:l}=this;if(this._updateFieldValue(o,t),!l?.length)return;const d=l.find((e=>e.code===t)),c=l.find((e=>e.code===i))?.name??`${i}`;if(!d)return;const u=s();a.pendingSubtypeChoice=u;let p="update-fields";const m=[{label:n.subtypes.useDefaultValuesOption,value:"update-fields"},{label:n.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:n.subtypes.changeWarningTitle,message:q(n.subtypes.changeWarning,{originalType:c,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>p=e,actions:{primary:{label:r.apply,action:()=>u.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>u.resolve("undo")}},cancel:()=>u.reject()};try{this.showPrompt(h);switch(await u.promise){case"update-fields":a.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,i)}}finally{a.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&w(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return R(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:o}=e;0===o.length&&t&&"selected"in t?t.selected=!0:i.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([l()],J.prototype,"_listObserverNode",void 0),e([l()],J.prototype,"_relatedRecordsEnabled",null),e([l()],J.prototype,"_utilityNetworkAssociationsEnabled",null),e([l()],J.prototype,"_prompt",void 0),e([l()],J.prototype,"_subtypes",null),e([l()],J.prototype,"associationId",null),e([l()],J.prototype,"associatedLayer",null),e([l()],J.prototype,"disabled",null),e([l()],J.prototype,"feature",null),e([l()],J.prototype,"_featureFormUNAssociationList",void 0),e([l()],J.prototype,"formTemplate",null),e([l()],J.prototype,"groupDisplay",void 0),e([l()],J.prototype,"headingLevel",void 0),e([l()],J.prototype,"icon",null),e([l()],J.prototype,"label",null),e([l()],J.prototype,"layer",null),e([l()],J.prototype,"map",null),e([l(),W("esri/widgets/FeatureForm/t9n/FeatureForm")],J.prototype,"messages",void 0),e([l(),W("esri/t9n/common")],J.prototype,"messagesCommon",void 0),e([l(),W("esri/widgets/Feature/t9n/Feature")],J.prototype,"messagesFeature",void 0),e([l(),W("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],J.prototype,"messagesTemplates",void 0),e([l()],J.prototype,"callbacks",null),e([l()],J.prototype,"relationshipId",null),e([l()],J.prototype,"spatialReference",null),e([l()],J.prototype,"strict",null),e([l()],J.prototype,"timeZone",null),e([l()],J.prototype,"showPrompt",null),e([l()],J.prototype,"clearPrompt",null),e([l(),B(["value-change","submit"])],J.prototype,"viewModel",void 0),e([l({type:L,nonNullable:!0})],J.prototype,"visibleElements",void 0),e([l()],J.prototype,"test",null),J=e([d("esri.widgets.FeatureForm")],J);const Q=J;export{Q as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import"../core/has.js";import i from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{createResolver as s}from"../core/promiseUtils.js";import{watch as n,initial as a,whenOnce as r}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as c}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as u,getSubtypesFromLayer as p}from"../layers/support/layerUtils.js";import{isString as m}from"../support/guards.js";import h from"./Widget.js";import{Prompt as v}from"./Editor/components/Prompt.js";import _ from"./Feature/FeatureUtilityNetworkAssociations.js";import{isRelatableFeatureSupportedLayer as g}from"./Feature/support/featureUtils.js";import{css as b}from"./FeatureForm/css.js";import{isGroupInput as f,isFieldInput as y,isRelationshipInput as C,isTextElementInput as F,isUtilityNetworkAssociationInput as w,flattenInputs as R,isInputInGroupInput as k,isFieldElementWithInputType as I,getErrorMessageForFieldInput as O,getIconForFeature as N,isNumberFieldInput as M,subtypeChangeShouldPrompt as L}from"./FeatureForm/featureFormUtils.js";import T from"./FeatureForm/FeatureFormViewModel.js";import A from"./FeatureForm/VisibleElements.js";import x from"./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js";import{loadCalciteComponents as D}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as V,getIntlOptionsForField as S,numberingSystem as U,prepareISOFieldValueForDateComponents as E,prepareUnixFieldValueForDateComponents as j,normalizeTimeOnlyString as P,getISOFieldValueFromDateComponents as $,getUnixFieldValueFromDateComponents as H}from"./support/dateUtils.js";import{globalCss as Z}from"./support/globalCss.js";import{Heading as G,incrementHeadingLevel as W}from"./support/Heading.js";import{setFocus as B}from"./support/widgetUtils.js";import{messageBundle as K}from"./support/decorators/messageBundle.js";import{vmEvent as q}from"./support/decorators/vmEvent.js";import{tsx as z}from"./support/jsxFactory.js";import{substitute as J}from"../intl/substitute.js";import{formatNumber as Q}from"../intl/number.js";const X="data-field-name";let Y=class extends h{constructor(e,t){super(e,t),this._associationsWidgetsMap=new Map,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new T,this.visibleElements=new A,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,callbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t,i)=>{const{feature:o,callbacks:s}=this;let n=i;if(o&&s?.addRelatedRecord){if(u(i)&&e.activeCategory){const t=e.activeCategory.value,o=i.findSublayerForSubtypeCode(t);o&&g(o)&&(n=o)}s.addRelatedRecord({parentFeature:o,relatedLayer:n,relationshipId:t})}},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),r((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>[this._featureFormUNAssociationList,this.visibleElements.associationDetails]),(([e,t])=>{e&&(e.visibleElements.associationDetails=t)}),a),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange())),n((()=>this.viewModel.activeAssociationInput),(e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}))])}loadDependencies(){return D({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),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"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const{callbacks:e}=this;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){const{callbacks:e}=this;return!(!e?.viewAssociatedLayers||!e.viewAssociatedFeatures)}get _subtypes(){return p(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get icon(){return"form-field"}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 map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return z("div",{class:this.classes(b.base,Z.widget,Z.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return z("div",null,z("form",{class:b.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent()),this._prompt?z(v,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderHeader(){const e=this.viewModel,{formTitle:t,formDescription:i}=e;if(!e.formHeaderVisible)return;const o=null!=t&&z(G,{key:"title",level:this.headingLevel},t),s=null!=i&&z("p",{class:b.description,key:"description"},i);return z("div",{class:b.formHeader},o,s)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(t).filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return f(e)?this._renderGroup(e):y(e)?this._renderLabeledField(e):C(e)?this._renderRelationshipInput(e):F(e)?this._renderTextElementInput(e):w(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){const{feature:t,callbacks:i}=this;t&&i?.viewAssociatedFeatures&&i.viewAssociatedFeatures({associatedLayer:e.layer})}async _selectAssociatedFeature(e){const{feature:t,callbacks:i}=this;t&&i?.selectAssociatedFeature&&await i.selectAssociatedFeature({parentFeature:t,...e})}_onAddAssociation(e){const{feature:t,callbacks:i}=this;t&&i?.addAssociation&&i.addAssociation(e)}_setUpUtilityNetworkAssociationList(){this._featureFormUNAssociationList||(this._featureFormUNAssociationList=new x({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)}))}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._setUpUtilityNetworkAssociationList(),o(this._associationsWidgetsMap,e,(()=>new _({onSelectAssociationType:({viewModel:t,listType:i})=>{t.activeAssociationType=i;const{feature:o,callbacks:s}=this;o&&s?.viewAssociatedLayers&&s.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel}))).render()}_renderDescriptionOrEmpty(e,t){return null==e?null:z("div",{class:this.classes(b.description),id:t},e)}_renderGroup(e){const{disabled:t,formTemplate:i,headingLevel:o}=this,{description:s,id:n,inputs:a,label:r,open:l}=e,d=a.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),u=c?.group===e,p="sequential"===this.groupDisplay;return z("calcite-block",{class:this.classes(b.group,p?b.groupSequential:null,u?b.groupActive:null,t?b.inputDisabled:null),collapsible:!0,"data-group":e,description:s||void 0,disabled:t,heading:r??"",headingLevel:i?.title?W(o):o,id:n,key:n,open:l,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},d.map((e=>this._renderInput(e))))}_getFocusableInput(e,t){const i=R(this.viewModel.inputs);let o;if("backward"===e&&i.reverse(),t)if(f(t)){const e=t.inputs.find((e=>e.visible));o=e?i.indexOf(e):0}else{let s;if(k(t)&&!t.group.open){const i=t.group.inputs.filter(y);s="forward"===e?i[i.length-1]:i[0]}else s=t;o=i.indexOf(s)+1}else o=0;for(let s=o;s<i.length;s++){const e=i[s];if(e.visible&&y(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:s,required:n}=e,a={"aria-label":n?J(this.messages.requiredFieldLabel,{name:o}):o,class:b.label,key:`${s.id}-${i.uid}-${e.name}`},r=[z("div",{class:b.labelTextContent,key:"labelTextContainer"},o,n?z("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?z("label",{...a},r):z("calcite-label",{...a},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:s}=e,n=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(s,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),n):this._renderComboBoxComponent(e,t,n):this._renderSwitchComponent(e,n)}return"datetime-picker"===o||"date"===t?this._renderDateComponents(e,n):"number"===t?this._renderNumberComponent(e,n):this._renderStringComponent(e,n)}_renderStringComponent(e,t){return"text-area"===e.inputType?t.readOnly?z("calcite-input",{...t,loading:e.updating,type:"textarea",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)}):z("calcite-text-area",{...t,resize:"vertical",onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):z("calcite-input",{...t,loading:e.updating,type:"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){const i=c(e.field),o=i&&""!==t.value?Math.round(parseFloat(t.value)).toString():t.value;return z("calcite-input-number",{...t,integer:i,loading:e.updating,type:"number",value:o,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,V(i,t.value,{timeZone:this.timeZone,...S(i)}))}}_renderDateOnlyFieldComponent(e,t){const{range:i,valid:o,value:s}=e,{class:n,key:a,readOnly:r}=t,{rawMax:l,rawMin:d}=i;return z("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,class:n,"data-date-part":"date","data-field-name":t[X],key:`${a}-date-input`,max:m(l)?l:void 0,min:m(d)?d:void 0,numberingSystem:U,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:r,value:null!=s?`${s}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:s,key:n,readOnly:a}=t;return z("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:s,"data-date-part":"time","data-field-name":t[X],key:`${n}-time-input`,numberingSystem:U,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:a,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,range:o,timeZone:s,valid:n,value:a}=e,{class:r,key:l,readOnly:d}=t,{rawMax:c,rawMin:u}=o,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:U,overlayPositioning:"fixed",readOnly:d,[X]:i,onfocus:this._onComponentFocus},m=E(c,s),h=E(u,s),v=E(a,s);return z("div",{class:b.dateInputContainer,key:`${l}-date-time-container`},z("calcite-input-date-picker",{...p,class:r,"data-date-part":"date",key:`${l}-date-input`,max:m?.date??void 0,min:h?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),z("calcite-input-time-picker",{...p,class:r,"data-date-part":"time",key:`${l}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:v.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?z("calcite-input-time-zone",{...p,class:r,"data-date-part":"timeZone",disabled:d,key:`${l}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:v.timeZoneOffset??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){const{includeTime:i,name:o,valid:s,value:n}=e,{class:a,key:r,max:l,min:d,readOnly:c}=t,{timeZone:u}=this,p={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!s,numberingSystem:U,overlayPositioning:"fixed",readOnly:c,[X]:o,onfocus:this._onComponentFocus},m=j(n,u),h=j(l,u),v=j(d,u);return z("div",{class:b.dateInputContainer,key:`${r}-date-time-container`},z("calcite-input-date-picker",{...p,class:a,"data-date-part":"date",key:`${r}-date-input`,max:h?.date??void 0,min:v?.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:m.date??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),i?z("calcite-input-time-picker",{...p,class:a,"data-date-part":"time",key:`${r}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:m.time??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return z("calcite-input",{...i,class:this.classes(b.fieldInput,b.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:s}=e,{viewModel:n,_inputsWithChanges:a}=this,r="INSERT"===n.arcadeEditType,l=a.has(s),d=null==o&&(!r||l),c=r&&e.showNoValueOptionEnabled&&!l?()=>{}:i.onblur;return z("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:c,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:t})=>{d&&0===t.selectedItems.length?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&0===t.selectedItems.length?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){const{value:i,name:o}=e,{messages:s,messagesTemplates:n,viewModel:a,_inputsWithChanges:r}=this,[l,d,c]=t.map((e=>e.map((({name:e,value:t})=>z("calcite-combobox-item",{key:`#${t}`,selected:i===t,textLabel:e,value:`${t}`}))))),u=[];d.length>0&&u.push(z("calcite-combobox-item-group",{key:"other",label:n.other},d)),c.length>0&&u.push(z("calcite-combobox-item-group",{key:"unsupported",label:s.subtypes.unsupportedDomainGroupTitle},c)),u.length>0?u.unshift(z("calcite-combobox-item-group",{key:"recommended",label:s.recommended},l)):u.push(...l);const p="INSERT"===a.arcadeEditType,m=r.has(o),h=null==i&&(!p||m);return e.showNoValueOptionEnabled&&u.unshift(z("calcite-combobox-item",{key:"empty-option",selected:h,textLabel:e.showNoValueLabel||s.empty,value:""})),u}_renderRadioButtonComponents(e,t,i){const{name:o,value:s}=e,n=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===s,props:i})));if(e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=s===t||null===s;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:o,value:t,selected:r,props:i}))}return z("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:b.inputRadioGroup,"data-field-name":i[X],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},n)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!I(e.element,"switch")&&i===e.element.input.onValue;return z("calcite-switch",{...t,checked:o,class:b.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:s,props:n}){return z("calcite-label",{class:b.inputRadioLabel,key:e,layout:"inline"},z("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:o,class:b.inputRadio,disabled:n.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),s)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.submittable?O(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?z("calcite-input-message",{icon:!0,status:"invalid"},i):this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?z("calcite-input-message",{icon:!0,status:"idle"},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){if(!e.showAllActionVisible||!this.callbacks?.showAllRelatedRecords)return;const t=this.messages;return z("calcite-list-item",{description:J(t.totalCount,{count:e.featureCount}),key:"show-all-related-features",label:t.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(e.relationshipId)},z("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:s,callbacks:n}=this;if(t&&n?.addRelatedRecord&&o)return z("calcite-button",{alignment:"center",appearance:"outline-fill",class:b.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,i,o)},round:!0,scale:"s",width:"full"},e.relatedLayerIsTable?s.addRecord:s.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:s}=e,{feature:n,callbacks:a}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),a?.editRelatedRecord&&n&&a.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,c=r?()=>r.remove(i):void 0;return z("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:s,onclick:l,onmouseenter:d,onmouseleave:c,value:s},z("calcite-icon",{icon:N(i),slot:"content-start"}),z("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{relationshipId:t,activeCategory:i}=e,o=i?null:this._renderDescriptionOrEmpty(e.description);return z("calcite-label",{class:this.classes(b.label,b.relatedRecordsLabel),key:`relationship-${t}-container`},z("div",null,this._renderRelatedRecordsHeaderContainer(e),o,this._renderRelationshipInputContent(e)),this._renderAddRelatedRecordButton(e))}_renderRelationshipInputContent(e){return e.featureCount>0?this._renderRelatedRecordsList(e):e.activeCategory&&0===e.featureCount?this._renderNoRelatedRecordsNotice():e.allCategories?.length?this._renderCategoryList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0}_renderCategoryList(e){return z("calcite-list",{displayMode:"flat",label:this.messages.relatedRecordsList,loading:e.updating},e.categories?.map((t=>this._renderCategory(e,t))),this._renderShowAllCategoriesListItem(e))}_renderCategory(e,t){const{count:i,name:o,value:s}=t,n=Q(i);return z("calcite-list-item",{key:`${o}-${s}`,label:o,onCalciteListItemSelect:()=>this._selectCategory(e,t)},z("calcite-chip",{label:n,scale:"s",slot:"content-end"},n),z("calcite-icon",{flipRtl:!0,icon:"chevron-left",scale:"s",slot:"content-end"}))}_selectCategory(e,t){this.relationshipId=e.relationshipId,e.activeCategory=t}_renderShowAllCategoriesListItem(e){if(!e.showAllCategoriesVisible)return;const t=this.messages;return z("calcite-list-item",{description:J(t.totalCount,{count:e.allCategories?.length??0}),key:"show-all-categories",label:t.showAll,value:!0,onCalciteListItemSelect:()=>e.showAllEnabled=!0},z("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return z("div",{class:b.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},z("span",null,e.label),t?z("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return z("calcite-list",{class:b.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,s=this.viewModel.findField(o),n=e.layer?.fieldsIndex.get(o),a=s?.label||n?.alias||o,r=J(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:a});return z("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},r))}_renderNoRelatedRecordsNotice(){return z("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},z("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return z("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:b.listObserver,key:"feature-observer"})}_renderTextElementInput(e){return z("div",{class:b.textElement,innerHTML:e.text,key:e.id})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:s,maxLength:n,minLength:a,name:r,range:{max:l,min:d},required:c,valid:u,value:p}=e,m=this._inputsWithChanges.has(r),h=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(b.fieldInput,h?b.inputDisabled:null),status:m&&!u?"invalid":"idle",key:r,label:s,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:n>-1?n:void 0,minLength:a>-1?a:void 0,placeholder:o??void 0,readOnly:h,required:c,value:null==p?"":`${p}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[X]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(X))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value&&null!=t.value){const i=new ResizeObserver((()=>{switch(e.value=void 0,t.field.type){case"date":e.value=j(t.value,this.timeZone).date??"";break;case"timestamp-offset":e.value=E(t.value,this.timeZone).date??"";break;default:e.value=`${t.value}`}i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);M(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,k(i)&&(i.group.open=!0),B(e))}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null;"readOnly"in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const{timeZone:t}=this,i=this._getFieldInputFromHTMLElement(e),o=i.field.type,{name:s,range:n}=i,a=this._dateComponentMap.get(s);if(!a)return;let r=this.viewModel.getValue(s),l=null;"date-only"===o?l=Array.isArray(e.value)?e.value[0]:e.value:"time-only"===o?(r=P(r),l=P(e.value)):l="timestamp-offset"===o?null!=e.value?$({dateComponent:a.date,timeComponent:a.time,timeZoneComponent:a.timeZone,oldValue:r,defaultTimeZone:t}):null:null!=e.value?H({oldValue:r,dateComponent:a.date,timeComponent:a.time,timeZone:t,max:n.max,min:n.min}):null,null!==l&&e.value?r!==l&&this._updateFieldValue(s,l):this._updateFieldValue(s,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=this._parseValue(e),o=t.value;t.isSubtypeField&&L(this.layer,o,i)?this._pendingSubtypeChoice||i===o||(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,i)):this._updateFieldValue(t.name,i)}async _handleSubtypeChoice(e,t){const{value:i,name:o}=e,{messages:n,viewModel:a,messagesCommon:r,_subtypes:l}=this;if(this._updateFieldValue(o,t),!l?.length)return;const d=l.find((e=>e.code===t)),c=l.find((e=>e.code===i))?.name??`${i}`;if(!d)return;const u=s();a.pendingSubtypeChoice=u;let p="update-fields";const m=[{label:n.subtypes.useDefaultValuesOption,value:"update-fields"},{label:n.subtypes.keepCurrentValuesOption,value:"keep-existing"}],h={context:"info",title:n.subtypes.changeWarningTitle,message:J(n.subtypes.changeWarning,{originalType:c,newType:d.name}),radios:m,defaultRadioSelection:"update-fields",onRadioSelection:e=>p=e,actions:{primary:{label:r.apply,action:()=>u.resolve(p),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>u.resolve("undo")}},cancel:()=>u.reject()};try{this.showPrompt(h);switch(await u.promise){case"update-fields":a.applySubtypeDefaults(d),this._validateContingenciesForNonNullFields();break;case"keep-existing":this._validateContingenciesForNonNullFields();break;case"undo":this._updateFieldValue(e.name,i)}}finally{a.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&k(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){const i=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e);i!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return I(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:o}=e;0===o.length&&t&&"selected"in t?t.selected=!0:i.getLogger(this).warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([l()],Y.prototype,"_listObserverNode",void 0),e([l()],Y.prototype,"_relatedRecordsEnabled",null),e([l()],Y.prototype,"_utilityNetworkAssociationsEnabled",null),e([l()],Y.prototype,"_prompt",void 0),e([l()],Y.prototype,"_subtypes",null),e([l()],Y.prototype,"associationId",null),e([l()],Y.prototype,"associatedLayer",null),e([l()],Y.prototype,"disabled",null),e([l()],Y.prototype,"feature",null),e([l()],Y.prototype,"_featureFormUNAssociationList",void 0),e([l()],Y.prototype,"formTemplate",null),e([l()],Y.prototype,"groupDisplay",void 0),e([l()],Y.prototype,"headingLevel",void 0),e([l()],Y.prototype,"icon",null),e([l()],Y.prototype,"label",null),e([l()],Y.prototype,"layer",null),e([l()],Y.prototype,"map",null),e([l(),K("esri/widgets/FeatureForm/t9n/FeatureForm")],Y.prototype,"messages",void 0),e([l(),K("esri/t9n/common")],Y.prototype,"messagesCommon",void 0),e([l(),K("esri/widgets/Feature/t9n/Feature")],Y.prototype,"messagesFeature",void 0),e([l(),K("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],Y.prototype,"messagesTemplates",void 0),e([l()],Y.prototype,"callbacks",null),e([l()],Y.prototype,"relationshipId",null),e([l()],Y.prototype,"spatialReference",null),e([l()],Y.prototype,"strict",null),e([l()],Y.prototype,"timeZone",null),e([l()],Y.prototype,"showPrompt",null),e([l()],Y.prototype,"clearPrompt",null),e([l(),q(["value-change","submit"])],Y.prototype,"viewModel",void 0),e([l({type:A,nonNullable:!0})],Y.prototype,"visibleElements",void 0),e([l()],Y.prototype,"test",null),Y=e([d("esri.widgets.FeatureForm")],Y);const ee=Y;export{ee as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import s from"../../core/Evented.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as r,when as i,syncAndInitial as a,sync as n}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as d}from"../../editing/templateUtils.js";import{getEffectiveLayerCapabilities as c,isSubtypeGroupLayer as h}from"../../layers/support/layerUtils.js";import{isTemplateItemGroup as y,mapItemsByTemplate as f,isTemplateGroupInfo as g,loadLayerWithTemplates as _,makeTemplateItemInfos as I,makeGroupItemInfos as F,nullGroupBy as b}from"./featureTemplatesUtils.js";import v from"./TemplateItem.js";import T from"./TemplateItemGroup.js";const j=({layer:t})=>({key:t,label:t.title??""}),B=({layer:t})=>({key:t.geometryType,label:t.geometryType??""});let w=class extends s.EventedAccessor{constructor(t){super(t),this._allItems=[],this._updatingHandles=new m,this._updateTask=null,this.disabled=!1,this.disabledItemFunction=null,this.filterFunction=null,this.selectedItem=null,this.templateInfos=null,this.view=null}initialize(){this._get("groupBy")||(this.groupBy="layer"),this.addHandles([r((()=>[this.templateInfos,this.layers]),(([t],e)=>{t&&t===e?.at(0)||(this._updateTask=l(this._updateTask),t?this._updateAllItems(t):this._getTemplatesAndUpdateAllItems())}),a),r((()=>this._groupByFunction),(()=>{null==this.templateInfos&&(this._updateTask=l(this._updateTask),this._getTemplatesAndUpdateAllItems())}),n),r((()=>this.filterFunction),(t=>{for(const e of this._allItems)y(e)&&(e.filterFunction=t)}),n)])}set groupBy(t){if(this._set("groupBy",t),"function"!=typeof t)switch(t){case"layer":this._groupByFunction=j;break;case"geometry":this._groupByFunction=B;break;default:this._groupByFunction=null}else this._groupByFunction=e=>this._ensureGroupByObject(t(e))}get layers(){return this._get("layers")}set layers(t){const e="layers";if(this.removeHandles(e),t){const s=()=>this.notifyChange("state");this.addHandles(t.map((t=>i((()=>t.loadStatus),s))),e)}this._set("layers",t)}get state(){return this.updating?"loading":0!==this.layers.length||this.templateInfos?.length?"ready":"disabled"}get numberOfFeatureTemplates(){return this._allItems.reduce(((t,e)=>y(e)?t+e.allItems.length:t+1),0)}get items(){const{filterFunction:t}=this;return null==t?this._allItems:this._allItems.filter((e=>y(e)?e.items.length>0:t(e)))}get updating(){return this._updatingHandles.updating}refresh(){this.notifyChange("filterFunction");for(const t of this._allItems)y(t)&&t.reapplyFilter()}select(t,{emit:e=!0}={}){const s=this.selectedItem,l=t?.clone()||null;this._set("selectedItem",l),e&&this.emit("select",{item:l,oldItem:s,template:l?.template??null})}_createItem(t,e){return new v({disabledFunction:this.disabledItemFunction,layer:e,template:t})}_ensureGroupByObject(t){return"string"==typeof t?{key:t,label:t}:t}_updateAllItems(t){const e=this._allItems;if(0===t.length)return k(e),void(this._allItems=[]);const[s,l]=f(e),o=t=>{const e=s.get(t.template);return e?(s.delete(t.template),e):this._createItem(t.template,t.layer)},{filterFunction:r}=this,i=t.map((t=>g(t)?new T({filterFunction:r,label:t.label,allItems:t.templateInfos.map((t=>o(t)))}):o(t)));for(const a of[...s.values(),...l])a.destroy();this._allItems=i}async _getTemplatesFromLayers(t){const e=[],s={signal:t};await Promise.all(this.layers.map((async l=>{await _(l,s),o(t);const r=c(l)?.operations;r?.supportsEditing&&r?.supportsAdd&&(h(l)?e.push(...l.sublayers):e.push(l))})));const l=await d(e,this.view,t);o(t);const r=I(l),i=this._groupByFunction;if(null==i)return r;const a=F(r,i);return 1===a.length&&a[0].label===b.label?a[0].templateInfos:a}async _getTemplatesAndUpdateAllItems(){if(0===this.layers.length)return;const t=e((async t=>{const e=await this._getTemplatesFromLayers(t);o(t),this._updateAllItems(e)}));this._updateTask=t,this._updatingHandles.addPromise(t.promise)}};function k(t){for(const e of t){if(y(e))for(const t of e.items)t.destroy();e.destroy()}}t([p()],w.prototype,"_allItems",void 0),t([p()],w.prototype,"_groupByFunction",void 0),t([p()],w.prototype,"_updatingHandles",void 0),t([p()],w.prototype,"disabled",void 0),t([p()],w.prototype,"disabledItemFunction",void 0),t([p({value:null})],w.prototype,"filterFunction",void 0),t([p()],w.prototype,"groupBy",null),t([p({value:[]})],w.prototype,"layers",null),t([p()],w.prototype,"state",null),t([p({readOnly:!0})],w.prototype,"numberOfFeatureTemplates",null),t([p({readOnly:!0})],w.prototype,"items",null),t([p({readOnly:!0})],w.prototype,"selectedItem",void 0),t([p()],w.prototype,"templateInfos",void 0),t([p()],w.prototype,"updating",null),t([p()],w.prototype,"view",void 0),w=t([u("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],w);const A=w;export{A as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{createTask as e}from"../../core/asyncUtils.js";import s from"../../core/Evented.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as r,when as i,syncAndInitial as a,sync as n}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as u}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as d,isSharedTemplateOrMetadata as c}from"../../editing/templateUtils.js";import{getEffectiveLayerCapabilities as h,isSubtypeGroupLayer as y}from"../../layers/support/layerUtils.js";import{isTemplateItemGroup as f,mapItemsByTemplate as g,isTemplateGroupInfo as _,loadLayerWithTemplates as I,makeTemplateItemInfos as F,makeGroupItemInfos as b,nullGroupBy as v}from"./featureTemplatesUtils.js";import T from"./TemplateItem.js";import j from"./TemplateItemGroup.js";const B=({layer:t})=>({key:t,label:t.title??""}),w=({layer:t})=>({key:t.geometryType,label:t.geometryType??""});let k=class extends s.EventedAccessor{constructor(t){super(t),this._allItems=[],this._updatingHandles=new u,this._updateTask=null,this.disabled=!1,this.disabledItemFunction=null,this.filterFunction=null,this.selectedItem=null,this.templateInfos=null,this.view=null}initialize(){this._get("groupBy")||(this.groupBy="layer"),this.addHandles([r((()=>[this.templateInfos,this.layers]),(([t],e)=>{t&&t===e?.at(0)||(this._updateTask=l(this._updateTask),t?this._updateAllItems(t):this._getTemplatesAndUpdateAllItems())}),a),r((()=>this._groupByFunction),(()=>{null==this.templateInfos&&(this._updateTask=l(this._updateTask),this._getTemplatesAndUpdateAllItems())}),n),r((()=>this.filterFunction),(t=>{for(const e of this._allItems)f(e)&&(e.filterFunction=t)}),n)])}set groupBy(t){if(this._set("groupBy",t),"function"!=typeof t)switch(t){case"layer":this._groupByFunction=B;break;case"geometry":this._groupByFunction=w;break;default:this._groupByFunction=null}else this._groupByFunction=e=>this._ensureGroupByObject(t(e))}get layers(){return this._get("layers")}set layers(t){const e="layers";if(this.removeHandles(e),t){const s=()=>this.notifyChange("state");this.addHandles(t.map((t=>i((()=>t.loadStatus),s))),e)}this._set("layers",t)}get state(){return this.updating?"loading":0!==this.layers.length||this.templateInfos?.length?"ready":"disabled"}get numberOfFeatureTemplates(){return this._allItems.reduce(((t,e)=>f(e)?t+e.allItems.length:t+1),0)}get items(){const{filterFunction:t}=this;return null==t?this._allItems:this._allItems.filter((e=>f(e)?e.items.length>0:t(e)))}get updating(){return this._updatingHandles.updating}refresh(){this.notifyChange("filterFunction");for(const t of this._allItems)f(t)&&t.reapplyFilter()}select(t,{emit:e=!0}={}){const s=this.selectedItem,l=t?.clone()||null;this._set("selectedItem",l),e&&this.emit("select",{item:l,oldItem:s,template:l?.template??null})}_createItem(t,e){return new T({disabledFunction:this.disabledItemFunction,layer:e,template:t})}_ensureGroupByObject(t){return"string"==typeof t?{key:t,label:t}:t}_updateAllItems(t){const e=this._allItems;if(0===t.length)return A(e),void(this._allItems=[]);const[s,l]=g(e),o=t=>{const e=s.get(t.template);return e?(s.delete(t.template),e):this._createItem(t.template,t.layer)},{filterFunction:r}=this,i=t.filter(U).map((t=>_(t)?new j({filterFunction:r,label:t.label,allItems:t.templateInfos.filter(U).map((t=>o(t)))}):o(t)));for(const a of[...s.values(),...l])a.destroy();this._allItems=i}async _getTemplatesFromLayers(t){const e=[],s={signal:t};await Promise.all(this.layers.map((async l=>{await I(l,s),o(t);const r=h(l)?.operations;r?.supportsEditing&&r?.supportsAdd&&(y(l)?e.push(...l.sublayers):e.push(l))})));const l=await d(e,this.view,t);o(t);const r=F(l),i=this._groupByFunction;if(null==i)return r;const a=b(r,i);return 1===a.length&&a[0].label===v.label?a[0].templateInfos:a}async _getTemplatesAndUpdateAllItems(){if(0===this.layers.length)return;const t=e((async t=>{const e=await this._getTemplatesFromLayers(t);o(t),this._updateAllItems(e)}));this._updateTask=t,this._updatingHandles.addPromise(t.promise)}};function A(t){for(const e of t){if(f(e))for(const t of e.items)t.destroy();e.destroy()}}function U(t){return _(t)?t.templateInfos.some(U):!c(t.template)||!1!==t.template.visible}t([p()],k.prototype,"_allItems",void 0),t([p()],k.prototype,"_groupByFunction",void 0),t([p()],k.prototype,"_updatingHandles",void 0),t([p()],k.prototype,"disabled",void 0),t([p()],k.prototype,"disabledItemFunction",void 0),t([p({value:null})],k.prototype,"filterFunction",void 0),t([p()],k.prototype,"groupBy",null),t([p({value:[]})],k.prototype,"layers",null),t([p()],k.prototype,"state",null),t([p({readOnly:!0})],k.prototype,"numberOfFeatureTemplates",null),t([p({readOnly:!0})],k.prototype,"items",null),t([p({readOnly:!0})],k.prototype,"selectedItem",void 0),t([p()],k.prototype,"templateInfos",void 0),t([p()],k.prototype,"updating",null),t([p()],k.prototype,"view",void 0),k=t([m("esri.widgets.FeatureTemplates.FeatureTemplatesViewModel")],k);const H=k;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/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import a from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{load as o}from"../../../../geometry/projection.js";import{convertSphereVertexToPixelLocation as n}from"../../../../layers/orientedImagery/transformations/utils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";let l=[],u=[],h=0,m=class extends(c(a)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(o())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},s=n(t,a.imageSize[0],a.imageSize[1]);this.measurementArray.push([s.x,s.y])}const s=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=s}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;const s=e.coordinates;if(l=[...this.polygonVertices],"default"===t)l.push(s);else{const e={x:s[0],y:s[1],z:s[2]},t=n(e,a?.imageSize[0],a?.imageSize[1]);l.push([t.x,t.y])}if(l.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const i=l[0];l=l.filter(((e,t)=>0===t||t===l.length-1||JSON.stringify(e)!==JSON.stringify(i)));const r=await this._getAreaFromTask(l);r?.area&&r?.perimeter&&(h=r.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements();switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements();switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t,a);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=h>0?h:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e,t){const{mode:a,activeViewer:s}=this.viewModel,i=e.added,r=i[i.length-1];if(!Array.isArray(r)||"none"===a||!s?.imageSize)return;if("default"===a)this.polygonVertices.push(r);else{const e={x:r[0],y:r[1],z:r[2]},t=n(e,s?.imageSize[0],s?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;if(t){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}const o=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(o)));const c=await this._getAreaFromTask(this.polygonVertices);if(!c?.area||!c?.perimeter)return;const{area:l}=c;this.pixelAreaMeasurement=l}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&u.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,u=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,h=0}async _getAreaFromTask(e){const{mode:a}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const i=await this.viewModel.calculateAreaMeasurement(e,a,t);s(t),this._areaCalculation=i})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return"none"===e?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){const{mode:a}=this.viewModel;return"none"===a?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const i="default"===a?await this.viewModel.calculateAccuracy(e,"area",t):await this.viewModel.calculateAccuracyPanoramic(e,"area",t);s(t),this._distanceCalculation=i})),await this._calculationTask.promise,this._distanceCalculation)}};e([i()],m.prototype,"type",void 0),e([i()],m.prototype,"measurementArray",void 0),e([i()],m.prototype,"pixelMeasurement",void 0),e([i()],m.prototype,"pixelAreaMeasurement",void 0),e([i()],m.prototype,"polygonVertices",void 0),m=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],m);const d=m;export{d as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{createTask as t}from"../../../../core/asyncUtils.js";import a from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{load as o}from"../../../../geometry/projection.js";import{convertSphereVertexToPixelLocation as n}from"../../../../layers/orientedImagery/transformations/utils.js";import{SketchHandlerMixin as c}from"../../mixins/SketchHandlerMixin.js";let l=[],u=[],h=0,m=class extends(c(a)){constructor(e){super(e),this.type="measurement",this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(o())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":this.handlePolylineEvents(e,t);break;case"polygon":this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},s=n(t,a.imageSize[0],a.imageSize[1]);this.measurementArray.push([s.x,s.y])}const s=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=s}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;const s=e.coordinates;if(l=[...this.polygonVertices],"default"===t)l.push(s);else{const e={x:s[0],y:s[1],z:s[2]},t=n(e,a?.imageSize[0],a?.imageSize[1]);l.push([t.x,t.y])}if(l.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const i=l[0];l=l.filter(((e,t)=>0===t||t===l.length-1||JSON.stringify(e)!==JSON.stringify(i)));const r=await this._getAreaFromTask(l);r?.area&&r?.perimeter&&(h=r.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic)return this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements();switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),a){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}return this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements()}switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=h>0?h:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel,s=e.added,i=s[s.length-1];if(!Array.isArray(i)||"none"===t||!a?.imageSize)return;if("default"===t)this.polygonVertices.push(i);else{const e={x:i[0],y:i[1],z:i[2]},t=n(e,a?.imageSize[0],a?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const r=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter(((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(r)));const o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;const{area:c}=o;this.pixelAreaMeasurement=c}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=u.reduce(((e,t)=>e+t),0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&u.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,u=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,h=0}async _getAreaFromTask(e){const{mode:a}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._areaCalculation=null;const i=await this.viewModel.calculateAreaMeasurement(e,a,t);s(t),this._areaCalculation=i})),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return"none"===e?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);s(t),this._distanceCalculation=a})),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){const{mode:a}=this.viewModel;return"none"===a?null:(this._calculationTask?.abort(),this._calculationTask=t((async t=>{this._distanceCalculation=0;const i="default"===a?await this.viewModel.calculateAccuracy(e,"area",t):await this.viewModel.calculateAccuracyPanoramic(e,"area",t);s(t),this._distanceCalculation=i})),await this._calculationTask.promise,this._distanceCalculation)}};e([i()],m.prototype,"type",void 0),e([i()],m.prototype,"measurementArray",void 0),e([i()],m.prototype,"pixelMeasurement",void 0),e([i()],m.prototype,"pixelAreaMeasurement",void 0),e([i()],m.prototype,"polygonVertices",void 0),m=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],m);const d=m;export{d as default};
package/widgets/Popup.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/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Logger.js";import{ignoreAbortErrors as i,after as o}from"../core/promiseUtils.js";import{watch as s,initial as n,on as r,whenOnce as l}from"../core/reactiveUtils.js";import{waitAnimationFrame as a}from"../core/scheduling.js";import{stripHTML as d}from"../core/string.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import u from"../support/actions/ActionButton.js";import p from"./Features.js";import g from"./Widget.js";import v from"./Features/FeaturesViewModel.js";import{css as m}from"./Popup/css.js";import f from"./Popup/PopupViewModel.js";import w from"./Popup/PopupVisibleElements.js";import{globalCss as b}from"./support/globalCss.js";import{isRTL as _}from"./support/widgetUtils.js";import{messageBundle as k}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as y}from"./support/jsxFactory.js";const E=200,C={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let D=class extends g{constructor(t,e){super(t,e),this._dockAction=new u({id:"popup-dock-action"}),this._featuresWidget=new p({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this._focusAbortController=null,this.alignment="auto",this.dockEnabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new f,this.visibleElements=new w}initialize(){this.addHandles([s((()=>[this.viewModel?.view?.widthBreakpoint,this.dockEnabled]),(()=>this._handleDockIcon()),n),s((()=>[this.dockEnabled,this.messages?.undock,this.messages?.dock]),(()=>this._handleDockEnabled()),n),s((()=>this.dockOptions),(t=>{const{_dockAction:e}=this,i=this._featuresWidget.headerActions;i.remove(e),t.buttonEnabled&&i.add(e)}),n),s((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),s((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),s((()=>[this.viewModel?.screenLocation,this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),s((()=>this.viewModel?.view?.size),((t,e)=>this._updateDockEnabledForViewSize(t,e))),s((()=>this.viewModel?.view),((t,e)=>this._viewChange(t,e))),s((()=>this.viewModel?.view?.ready),((t,e)=>this._viewReadyChange(t??!1,e??!1))),s((()=>this.viewModel),(()=>this._featuresWidget.viewModel=this.viewModel),n),s((()=>this._featureNavigationTop),(t=>this._featuresWidget.featureNavigationTop=t),n),s((()=>this.headingLevel),(t=>this._featuresWidget.headingLevel=t),n),s((()=>this.visibleElements.actionBar),(t=>this._featuresWidget.visibleElements.actionBar=!!t),n),s((()=>this.visibleElements.closeButton),(t=>this._featuresWidget.visibleElements.closeButton=!!t),n),s((()=>this.visibleElements.collapseButton),(t=>this._featuresWidget.visibleElements.collapseButton=!!t),n),s((()=>this.visibleElements.heading),(t=>this._featuresWidget.visibleElements.heading=!!t),n),s((()=>this.visibleElements.spinner),(t=>this._featuresWidget.visibleElements.spinner=!!t),n),s((()=>this.visibleElements.featureNavigation),(t=>this._featuresWidget.visibleElements.featureNavigation=!!t),n),s((()=>this.visibleElements.featureListLayerTitle),(t=>this._featuresWidget.visibleElements.featureListLayerTitle=!!t),n),r((()=>this._featuresWidget),"trigger-header-action",(t=>{t.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)}))])}destroy(){this._dockAction.destroy(),this._featuresWidget&&(this._featuresWidget.viewModel=new v,this._featuresWidget.destroy()),this._focusAbortController?.abort()}get _featureNavigationTop(){const{currentAlignment:t,currentDockPosition:e}=this;return"bottom-left"===t||"bottom-center"===t||"bottom-right"===t||"top-left"===e||"top-center"===e||"top-right"===e}get actions(){return this.viewModel.actions}set actions(t){this.viewModel.actions=t}get active(){return this.viewModel.active}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(t){this.viewModel.autoCloseEnabled=t}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(t){this.viewModel.defaultPopupTemplateEnabled=t}get content(){return this.viewModel.content}set content(t){this.viewModel.content=t}get collapsed(){return this._featuresWidget.collapsed}set collapsed(t){this._featuresWidget.collapsed=t}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||C}set dockOptions(t){const e={...C},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const s={...e,...t},n={...e.breakpoint,...o},{breakpoint:r}=s;"object"==typeof r?s.breakpoint={...n,...r}:r&&(s.breakpoint=n),this._set("dockOptions",s),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(t){this.viewModel.featureMenuOpen=t}get features(){return this.viewModel.features}set features(t){this.viewModel.features=t}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(t){this.viewModel.goToOverride=t}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(t){this.viewModel.highlightEnabled=t}get icon(){return"popup"}set icon(t){this._overrideIfSome("icon",t)}get initialDisplayMode(){return this.viewModel.initialDisplayMode}set initialDisplayMode(t){this.viewModel.initialDisplayMode=t}get location(){return this.viewModel.location}set location(t){this.viewModel.location=t}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get promises(){return this.viewModel.promises}set promises(t){this.viewModel.promises=t}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){return this._featuresWidget.selectedDrillInFeature??null}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(t){this.viewModel.selectedFeatureIndex=t}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(t){this.viewModel.title=t}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(t){this.viewModel.updateLocationEnabled=t}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}blur(){const{active:t}=this.viewModel;t||e.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(t,e){return this.viewModel.fetchFeatures(t,e)}focus(){const{active:t}=this.viewModel;t||e.getLogger(this).warn("Popup can only be focused when currently active."),this._handleFocus()}next(){return this.viewModel.next()}open(t){const e=!!t&&!!t.featureMenuOpen,i={collapsed:!!t&&!!t.collapsed,featureMenuOpen:e};this.set(i),this.viewModel.open(t),t?.shouldFocus&&this._handleFocus(!0)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(t){return this.viewModel.triggerAction(t)}render(){const{dockEnabled:t,currentAlignment:e,currentDockPosition:i}=this,{active:o,screenLocation:s}=this.viewModel,n=o&&t,r=o&&!t,l=this.selectedFeature?.layer?.title,a=this.selectedFeature?.layer?.id,c={[m.alignTopCenter]:"top-center"===e,[m.alignBottomCenter]:"bottom-center"===e,[m.alignTopLeft]:"top-left"===e,[m.alignBottomLeft]:"bottom-left"===e,[m.alignTopRight]:"top-right"===e,[m.alignBottomRight]:"bottom-right"===e,[m.isDocked]:n,[m.shadow]:r,[m.isDockedTopLeft]:"top-left"===i,[m.isDockedTopCenter]:"top-center"===i,[m.isDockedTopRight]:"top-right"===i,[m.isDockedBottomLeft]:"bottom-left"===i,[m.isDockedBottomCenter]:"bottom-center"===i,[m.isDockedBottomRight]:"bottom-right"===i};return y("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,"aria-hidden":(!o).toString(),"aria-label":d(this.title??""),"aria-modal":"false",bind:this,class:this.classes(m.base,c,{[m.baseHidden]:!s&&!t}),"data-layer-id":a,"data-layer-title":l,role:"dialog"},o?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:y("div",{class:m.pointer,key:"popup-pointer",role:"presentation"},y("div",{class:this.classes(m.pointerDirection,m.shadow)}))}_renderMainContainer(){const{dockEnabled:t}=this,e={[m.shadow]:t};return y("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(m.main,b.widget,e)},this._featuresWidget.render())}_getAnimationDurationMS(){const{_containerNode:t}=this;return t?1e3*parseFloat(window.getComputedStyle(t).animationDuration):E}async _handleFocus(t=!1){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const e=this._focusAbortController.signal;t&&await l((()=>!0===this.viewModel?.active),{signal:e}),await i(a(e)),await i(o(this._getAnimationDurationMS(),e)),this._featuresWidget.focus()}_isOutsideView(t){const{popupHeight:e,popupWidth:i,screenLocation:o,side:s,view:n}=t;if(isNaN(i)||isNaN(e)||!n||!o)return!1;const r=n.padding;return"right"===s&&o.x+i/2>n.width-r.right||("left"===s&&o.x-i/2<r.left||("top"===s&&o.y-e<r.top||"bottom"===s&&o.y+e>n.height-r.bottom))}_calculateAutoAlignment(t){if("auto"!==t)return t;const{_pointerOffsetInPx:e,_containerNode:i,_mainContainerNode:o,viewModel:s}=this,{screenLocation:n,view:r}=s;if(null==n||!r||!i)return"top-center";function l(t){return parseInt(t.replaceAll(/[^-\d.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,d=a?l(a.getPropertyValue("max-height")):0,c=a?l(a.getPropertyValue("height")):0,{height:h,width:u}=i.getBoundingClientRect(),p=u+e,g=Math.max(h,d,c)+e,v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"right",view:r}),m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"left",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"top",view:r}),w=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"bottom",view:r});return m?f?"bottom-right":"top-right":v?f?"bottom-left":"top-left":f?w?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(t){return"function"==typeof t?t.call(this):t}_getCurrentAlignment(){const{alignment:t,dockEnabled:e}=this;return e||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(t)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(t){const e=["left","right"];return _(this.container)&&e.reverse(),t?.replace(/leading/gi,e[0]).replaceAll(/trailing/gi,e[1])}_callDockPosition(t){return"function"==typeof t?t.call(this):t}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(t){if("auto"!==t)return t;const e=this.viewModel?.view,i=_(this.container)?"top-left":"top-right";if(!e)return i;const o=e.padding||{left:0,right:0,top:0,bottom:0},s=e.width-o.left-o.right,{breakpoints:n}=e;return n&&s<=n.xsmall?"bottom-center":i}_getDockIcon(){const t=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(t){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){this._dockAction.title=this.dockEnabled?this.messages?.undock:this.messages?.dock}_setMainContainerNode(t){this._mainContainerNode=t}_positionContainer(t=this._containerNode){if(t&&(this._containerNode=t),!this._containerNode)return;const{screenLocation:e}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(e,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(t){const{currentAlignment:e,_pointerOffsetInPx:i}=this;return"top-left"===e||"bottom-left"===e||"top-right"===e||"bottom-right"===e?t+i:t}_calculateAlignmentPosition(t,e,i,o){const{currentAlignment:s,_pointerOffsetInPx:n}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-e,d=i.width-t;return"bottom-center"===s?{top:e+n-r.top,left:t-l-r.left}:"top-left"===s?{bottom:a+n-r.bottom,right:d+n-r.right}:"bottom-left"===s?{top:e+n-r.top,right:d+n-r.right}:"top-right"===s?{bottom:a+n-r.bottom,left:t+n-r.left}:"bottom-right"===s?{top:e+n-r.top,left:t+n-r.left}:"top-center"===s?{bottom:a+n-r.bottom,left:t-l-r.left}:void 0}_calculatePositionStyle(t,e){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==t||!e)return;const s=this._calculateFullWidth(e),n=this._calculateAlignmentPosition(t.x,t.y,o,s);return n?{top:void 0!==n.top?`${n.top}px`:"auto",left:void 0!==n.left?`${n.left}px`:"auto",bottom:void 0!==n.bottom?`${n.bottom}px`:"auto",right:void 0!==n.right?`${n.right}px`:"auto"}:void 0}_viewChange(t,e){t&&e&&(this.close(),this.clear())}_viewReadyChange(t,e){t?this._wireUpView():e&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(t,e,i){const[o,s]=t,[n,r]=e,{width:l=0,height:a=0}=i??{};return o<=l&&n>l||o>l&&n<=l||s<=a&&r>a||s>a&&r<=a}_updateDockEnabledForViewSize(t,e){if(!t||!e)return;const i=this.viewModel?.view?.padding||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,s=i.top+i.bottom,n=[],r=[];n[0]=t[0]-o,n[1]=t[1]-s,r[0]=e[0]-o,r[1]=e[1]-s;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(n,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:t,viewModel:e}=this;if(!e)return;const i=e.active&&!t;e.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(t){const e=t.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:s}=i;if(isNaN(o)||isNaN(s))return!1;if(!e)return!1;const n=e.hasOwnProperty("width")&&o<=(e.width??0),r=e.hasOwnProperty("height")&&s<=(e.height??0);return n||r}_setDockEnabledForViewSize(t){t.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(t))}};t([c({readOnly:!0})],D.prototype,"_featureNavigationTop",null),t([c()],D.prototype,"actions",null),t([c({readOnly:!0})],D.prototype,"active",null),t([c()],D.prototype,"alignment",void 0),t([c()],D.prototype,"autoCloseEnabled",null),t([c()],D.prototype,"defaultPopupTemplateEnabled",null),t([c()],D.prototype,"content",null),t([c()],D.prototype,"collapsed",null),t([c({readOnly:!0})],D.prototype,"currentAlignment",null),t([c({readOnly:!0})],D.prototype,"currentDockPosition",null),t([c()],D.prototype,"dockOptions",null),t([c()],D.prototype,"dockEnabled",void 0),t([c({readOnly:!0})],D.prototype,"featureCount",null),t([c()],D.prototype,"featureMenuOpen",null),t([c()],D.prototype,"features",null),t([c()],D.prototype,"goToOverride",null),t([c()],D.prototype,"headingLevel",void 0),t([c()],D.prototype,"highlightEnabled",null),t([c()],D.prototype,"icon",null),t([c()],D.prototype,"initialDisplayMode",null),t([c()],D.prototype,"location",null),t([c()],D.prototype,"label",null),t([c(),k("esri/widgets/Popup/t9n/Popup")],D.prototype,"messages",void 0),t([c()],D.prototype,"promises",null),t([c({readOnly:!0})],D.prototype,"selectedFeature",null),t([c({readOnly:!0})],D.prototype,"selectedDrillInFeature",null),t([c()],D.prototype,"selectedFeatureIndex",null),t([c({readOnly:!0})],D.prototype,"selectedFeatureWidget",null),t([c()],D.prototype,"title",null),t([c()],D.prototype,"updateLocationEnabled",null),t([c()],D.prototype,"view",null),t([c({type:f}),M(["triggerAction","trigger-action"])],D.prototype,"viewModel",void 0),t([c()],D.prototype,"visible",null),t([c({type:w,nonNullable:!0})],D.prototype,"visibleElements",void 0),D=t([h("esri.widgets.Popup")],D);const P=D;export{P as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Logger.js";import{ignoreAbortErrors as i,after as o}from"../core/promiseUtils.js";import{watch as s,initial as n,on as r,whenOnce as l}from"../core/reactiveUtils.js";import{waitAnimationFrame as a}from"../core/scheduling.js";import{stripHTML as d}from"../core/string.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import u from"../support/actions/ActionButton.js";import p from"./Features.js";import g from"./Widget.js";import v from"./Features/FeaturesViewModel.js";import{css as m}from"./Popup/css.js";import f from"./Popup/PopupViewModel.js";import w from"./Popup/PopupVisibleElements.js";import{globalCss as b}from"./support/globalCss.js";import{isRTL as _}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as k}from"./support/decorators/vmEvent.js";import{tsx as y}from"./support/jsxFactory.js";const E=200,C={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let D=class extends g{constructor(e,t){super(e,t),this._dockAction=new u({id:"popup-dock-action"}),this._featuresWidget=new p({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this._focusAbortController=null,this.alignment="auto",this.dockEnabled=!1,this.headingLevel=2,this.messages=null,this.viewModel=new f,this.visibleElements=new w}initialize(){this.addHandles([s((()=>[this.viewModel?.view?.widthBreakpoint,this.dockEnabled]),(()=>this._handleDockIcon()),n),s((()=>[this.dockEnabled,this.messages?.undock,this.messages?.dock]),(()=>this._handleDockEnabled()),n),s((()=>this.dockOptions),(e=>{const{_dockAction:t}=this,i=this._featuresWidget.headerActions;i.remove(t),e.buttonEnabled&&i.add(t)}),n),s((()=>this.viewModel?.screenLocation),(()=>this._positionContainer())),s((()=>[this.viewModel?.active,this.dockEnabled]),(()=>this._toggleScreenLocationEnabled())),s((()=>[this.viewModel?.screenLocation,this.viewModel?.view?.padding,this.viewModel?.view?.size,this.viewModel?.active,this.viewModel?.location,this.alignment]),(()=>this.reposition())),s((()=>this.viewModel?.view?.size),((e,t)=>this._updateDockEnabledForViewSize(e,t))),s((()=>this.viewModel?.view),((e,t)=>this._viewChange(e,t))),s((()=>this.viewModel?.view?.ready),((e,t)=>this._viewReadyChange(e??!1,t??!1))),s((()=>this.viewModel),(()=>this._featuresWidget.viewModel=this.viewModel),n),s((()=>this._featureNavigationTop),(e=>this._featuresWidget.featureNavigationTop=e),n),s((()=>this.headingLevel),(e=>this._featuresWidget.headingLevel=e),n),s((()=>this.visibleElements.actionBar),(e=>this._featuresWidget.visibleElements.actionBar=!!e),n),s((()=>this.visibleElements.closeButton),(e=>this._featuresWidget.visibleElements.closeButton=!!e),n),s((()=>this.visibleElements.collapseButton),(e=>this._featuresWidget.visibleElements.collapseButton=!!e),n),s((()=>this.visibleElements.heading),(e=>this._featuresWidget.visibleElements.heading=!!e),n),s((()=>this.visibleElements.spinner),(e=>this._featuresWidget.visibleElements.spinner=!!e),n),s((()=>this.visibleElements.featureNavigation),(e=>this._featuresWidget.visibleElements.featureNavigation=!!e),n),s((()=>this.visibleElements.featureMenuHeading),(e=>this._featuresWidget.visibleElements.featureMenuHeading=!!e),n),s((()=>this.visibleElements.featureListLayerTitle),(e=>this._featuresWidget.visibleElements.featureListLayerTitle=!!e),n),r((()=>this._featuresWidget),"trigger-header-action",(e=>{e.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)}))])}destroy(){this._dockAction.destroy(),this._featuresWidget&&(this._featuresWidget.viewModel=new v,this._featuresWidget.destroy()),this._focusAbortController?.abort()}get _featureNavigationTop(){const{currentAlignment:e,currentDockPosition:t}=this;return"bottom-left"===e||"bottom-center"===e||"bottom-right"===e||"top-left"===t||"top-center"===t||"top-right"===t}get actions(){return this.viewModel.actions}set actions(e){this.viewModel.actions=e}get active(){return this.viewModel.active}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(e){this.viewModel.autoCloseEnabled=e}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(e){this.viewModel.defaultPopupTemplateEnabled=e}get content(){return this.viewModel.content}set content(e){this.viewModel.content=e}get collapsed(){return this._featuresWidget.collapsed}set collapsed(e){this._featuresWidget.collapsed=e}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||C}set dockOptions(e){const t={...C},i=this.viewModel?.view?.breakpoints,o={};i&&(o.width=i.xsmall,o.height=i.xsmall);const s={...t,...e},n={...t.breakpoint,...o},{breakpoint:r}=s;"object"==typeof r?s.breakpoint={...n,...r}:r&&(s.breakpoint=n),this._set("dockOptions",s),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(e){this.viewModel.featureMenuOpen=e}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get icon(){return"popup"}set icon(e){this._overrideIfSome("icon",e)}get initialDisplayMode(){return this.viewModel.initialDisplayMode}set initialDisplayMode(e){this.viewModel.initialDisplayMode=e}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get promises(){return this.viewModel.promises}set promises(e){this.viewModel.promises=e}get selectedFeature(){return this.viewModel.selectedFeature}get selectedDrillInFeature(){return this._featuresWidget.selectedDrillInFeature??null}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(e){this.viewModel.selectedFeatureIndex=e}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(e){this.viewModel.updateLocationEnabled=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}blur(){const{active:e}=this.viewModel;e||t.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(e,t){return this.viewModel.fetchFeatures(e,t)}focus(){const{active:e}=this.viewModel;e||t.getLogger(this).warn("Popup can only be focused when currently active."),this._handleFocus()}next(){return this.viewModel.next()}open(e){const t=!!e&&!!e.featureMenuOpen,i={collapsed:!!e&&!!e.collapsed,featureMenuOpen:t};this.set(i),this.viewModel.open(e),e?.shouldFocus&&this._handleFocus(!0)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(e){return this.viewModel.triggerAction(e)}render(){const{dockEnabled:e,currentAlignment:t,currentDockPosition:i}=this,{active:o,screenLocation:s}=this.viewModel,n=o&&e,r=o&&!e,l=this.selectedFeature?.layer?.title,a=this.selectedFeature?.layer?.id,c={[m.alignTopCenter]:"top-center"===t,[m.alignBottomCenter]:"bottom-center"===t,[m.alignTopLeft]:"top-left"===t,[m.alignBottomLeft]:"bottom-left"===t,[m.alignTopRight]:"top-right"===t,[m.alignBottomRight]:"bottom-right"===t,[m.isDocked]:n,[m.shadow]:r,[m.isDockedTopLeft]:"top-left"===i,[m.isDockedTopCenter]:"top-center"===i,[m.isDockedTopRight]:"top-right"===i,[m.isDockedBottomLeft]:"bottom-left"===i,[m.isDockedBottomCenter]:"bottom-center"===i,[m.isDockedBottomRight]:"bottom-right"===i};return y("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,"aria-hidden":(!o).toString(),"aria-label":d(this.title??""),"aria-modal":"false",bind:this,class:this.classes(m.base,c,{[m.baseHidden]:!s&&!e}),"data-layer-id":a,"data-layer-title":l,role:"dialog"},o?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:y("div",{class:m.pointer,key:"popup-pointer",role:"presentation"},y("div",{class:this.classes(m.pointerDirection,m.shadow)}))}_renderMainContainer(){const{dockEnabled:e}=this,t={[m.shadow]:e};return y("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(m.main,b.widget,t)},this._featuresWidget.render())}_getAnimationDurationMS(){const{_containerNode:e}=this;return e?1e3*parseFloat(window.getComputedStyle(e).animationDuration):E}async _handleFocus(e=!1){this._focusAbortController?.abort(),this._focusAbortController=new AbortController;const t=this._focusAbortController.signal;e&&await l((()=>!0===this.viewModel?.active),{signal:t}),await i(a(t)),await i(o(this._getAnimationDurationMS(),t)),this._featuresWidget.focus()}_isOutsideView(e){const{popupHeight:t,popupWidth:i,screenLocation:o,side:s,view:n}=e;if(isNaN(i)||isNaN(t)||!n||!o)return!1;const r=n.padding;return"right"===s&&o.x+i/2>n.width-r.right||("left"===s&&o.x-i/2<r.left||("top"===s&&o.y-t<r.top||"bottom"===s&&o.y+t>n.height-r.bottom))}_calculateAutoAlignment(e){if("auto"!==e)return e;const{_pointerOffsetInPx:t,_containerNode:i,_mainContainerNode:o,viewModel:s}=this,{screenLocation:n,view:r}=s;if(null==n||!r||!i)return"top-center";function l(e){return parseInt(e.replaceAll(/[^-\d.]/g,""),10)}const a=o?window.getComputedStyle(o,null):null,d=a?l(a.getPropertyValue("max-height")):0,c=a?l(a.getPropertyValue("height")):0,{height:h,width:u}=i.getBoundingClientRect(),p=u+t,g=Math.max(h,d,c)+t,v=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"right",view:r}),m=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"left",view:r}),f=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"top",view:r}),w=this._isOutsideView({popupHeight:g,popupWidth:p,screenLocation:n,side:"bottom",view:r});return m?f?"bottom-right":"top-right":v?f?"bottom-left":"top-left":f?w?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(e){return"function"==typeof e?e.call(this):e}_getCurrentAlignment(){const{alignment:e,dockEnabled:t}=this;return t||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(e)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(e){const t=["left","right"];return _(this.container)&&t.reverse(),e?.replace(/leading/gi,t[0]).replaceAll(/trailing/gi,t[1])}_callDockPosition(e){return"function"==typeof e?e.call(this):e}_getDockPosition(){return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition(this.dockOptions?.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(e){if("auto"!==e)return e;const t=this.viewModel?.view,i=_(this.container)?"top-left":"top-right";if(!t)return i;const o=t.padding||{left:0,right:0,top:0,bottom:0},s=t.width-o.left-o.right,{breakpoints:n}=t;return n&&s<=n.xsmall?"bottom-center":i}_getDockIcon(){const e=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(e){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){this._dockAction.title=this.dockEnabled?this.messages?.undock:this.messages?.dock}_setMainContainerNode(e){this._mainContainerNode=e}_positionContainer(e=this._containerNode){if(e&&(this._containerNode=e),!this._containerNode)return;const{screenLocation:t}=this.viewModel,{width:i}=this._containerNode.getBoundingClientRect(),o=this._calculatePositionStyle(t,i);o&&Object.assign(this._containerNode.style,o)}_calculateFullWidth(e){const{currentAlignment:t,_pointerOffsetInPx:i}=this;return"top-left"===t||"bottom-left"===t||"top-right"===t||"bottom-right"===t?e+i:e}_calculateAlignmentPosition(e,t,i,o){const{currentAlignment:s,_pointerOffsetInPx:n}=this;if(!i)return;const{padding:r}=i,l=o/2,a=i.height-t,d=i.width-e;return"bottom-center"===s?{top:t+n-r.top,left:e-l-r.left}:"top-left"===s?{bottom:a+n-r.bottom,right:d+n-r.right}:"bottom-left"===s?{top:t+n-r.top,right:d+n-r.right}:"top-right"===s?{bottom:a+n-r.bottom,left:e+n-r.left}:"bottom-right"===s?{top:t+n-r.top,left:e+n-r.left}:"top-center"===s?{bottom:a+n-r.bottom,left:e-l-r.left}:void 0}_calculatePositionStyle(e,t){const{dockEnabled:i,view:o}=this;if(!o)return;if(i)return{left:"",top:"",right:"",bottom:""};if(null==e||!t)return;const s=this._calculateFullWidth(t),n=this._calculateAlignmentPosition(e.x,e.y,o,s);return n?{top:void 0!==n.top?`${n.top}px`:"auto",left:void 0!==n.left?`${n.left}px`:"auto",bottom:void 0!==n.bottom?`${n.bottom}px`:"auto",right:void 0!==n.right?`${n.right}px`:"auto"}:void 0}_viewChange(e,t){e&&t&&(this.close(),this.clear())}_viewReadyChange(e,t){e?this._wireUpView():t&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(e,t,i){const[o,s]=e,[n,r]=t,{width:l=0,height:a=0}=i??{};return o<=l&&n>l||o>l&&n<=l||s<=a&&r>a||s>a&&r<=a}_updateDockEnabledForViewSize(e,t){if(!e||!t)return;const i=this.viewModel?.view?.padding||{left:0,right:0,top:0,bottom:0},o=i.left+i.right,s=i.top+i.bottom,n=[],r=[];n[0]=e[0]-o,n[1]=e[1]-s,r[0]=t[0]-o,r[1]=t[1]-s;const{dockOptions:l}=this,a=l.breakpoint;this._dockingThresholdCrossed(n,r,a)&&this._setDockEnabledForViewSize(l),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:e,viewModel:t}=this;if(!t)return;const i=t.active&&!e;t.screenLocationEnabled=i}_shouldDockAtCurrentViewSize(e){const t=e.breakpoint,i=this.viewModel?.view?.ui;if(!i)return!1;const{width:o,height:s}=i;if(isNaN(o)||isNaN(s))return!1;if(!t)return!1;const n=t.hasOwnProperty("width")&&o<=(t.width??0),r=t.hasOwnProperty("height")&&s<=(t.height??0);return n||r}_setDockEnabledForViewSize(e){e.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(e))}};e([c({readOnly:!0})],D.prototype,"_featureNavigationTop",null),e([c()],D.prototype,"actions",null),e([c({readOnly:!0})],D.prototype,"active",null),e([c()],D.prototype,"alignment",void 0),e([c()],D.prototype,"autoCloseEnabled",null),e([c()],D.prototype,"defaultPopupTemplateEnabled",null),e([c()],D.prototype,"content",null),e([c()],D.prototype,"collapsed",null),e([c({readOnly:!0})],D.prototype,"currentAlignment",null),e([c({readOnly:!0})],D.prototype,"currentDockPosition",null),e([c()],D.prototype,"dockOptions",null),e([c()],D.prototype,"dockEnabled",void 0),e([c({readOnly:!0})],D.prototype,"featureCount",null),e([c()],D.prototype,"featureMenuOpen",null),e([c()],D.prototype,"features",null),e([c()],D.prototype,"goToOverride",null),e([c()],D.prototype,"headingLevel",void 0),e([c()],D.prototype,"highlightEnabled",null),e([c()],D.prototype,"icon",null),e([c()],D.prototype,"initialDisplayMode",null),e([c()],D.prototype,"location",null),e([c()],D.prototype,"label",null),e([c(),M("esri/widgets/Popup/t9n/Popup")],D.prototype,"messages",void 0),e([c()],D.prototype,"promises",null),e([c({readOnly:!0})],D.prototype,"selectedFeature",null),e([c({readOnly:!0})],D.prototype,"selectedDrillInFeature",null),e([c()],D.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],D.prototype,"selectedFeatureWidget",null),e([c()],D.prototype,"title",null),e([c()],D.prototype,"updateLocationEnabled",null),e([c()],D.prototype,"view",null),e([c({type:f}),k(["triggerAction","trigger-action"])],D.prototype,"viewModel",void 0),e([c()],D.prototype,"visible",null),e([c({type:w,nonNullable:!0})],D.prototype,"visibleElements",void 0),D=e([h("esri.widgets.Popup")],D);const P=D;export{P 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/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as i}from"../core/jsonMap.js";import{watch as a,whenOnce as l}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{ensureInteger as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import{isValid as m}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as u}from"../portal/support/urlUtils.js";import{getToken as h}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import _ from"./Widget.js";import v from"./Print/FileLink.js";import g from"./Print/PrintViewModel.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{Heading as w}from"./support/Heading.js";import{legacyIcon as T}from"./support/legacyIcon.js";import{isRTL as x,isActivationKey as k}from"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as S,tsxFragment as I}from"./support/jsxFactory.js";import{formatNumber as O}from"../intl/number.js";const $=t.ofType(v),E="map-only";var L;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(L||(L={}));const F="esri-print",M=`${F}__advanced-options-button`,P={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,advancedOptionsButton:M,advancedOptionsButtonContainer:`${M}-container`,advancedOptionsButtonTitle:`${M}-title`,advancedOptionsButtonIconOpened:`${M}-icon--opened`,advancedOptionsButtonIconClosed:`${M}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${M}-icon--closed-rtl`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectBlock:`${F}__template-select-block`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,formCheckboxLabel:`${F}__form-checkbox-label`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLink:`${F}__exported-file-link`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileError:`${F}__exported-file--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function A(e,t,i,a){const l=i/t,o=a/t;return{width:Math.round(e*l),height:Math.round(e*o)}}function B(e){return!isNaN(e)&&e>0}function N(e){return e?.toLowerCase()===E}function R(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 i({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 V=class extends _{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=L.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.exportedLinks=new $,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportEnabled=!1,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new g,this._onInput=e=>{this._selectedTab===L.layout?this.templateOptions.title=e.currentTarget.value:this._selectedTab===L.mapOnly&&(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=h(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},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[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=b.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);else{const t=this._formats.find((({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue)))?.value;t&&(this.templateOptions.format=t)}})),a((()=>[this.templateOptions.id,this.viewModel.loaded]),(async()=>{const{layout:e}=this.templateOptions;this._selectedTab=N(e)?L.mapOnly:L.layout,this._selectedTab===L.layout&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);for(const{name:a,extension:l}of this.exportedLinks)a&&l&&this._updateExportedFileNameMap(`${a}${l}`);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 f({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 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 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:p,layout:u,layoutItem:h,legendEnabled:b,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:g,scale:f,width:k}=t,C="ready"!==i.state||this._awaitingServerResponse||!(u||h),I=this._renderTitleOrFileNameSection(),O=S("div",{class:P.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})))))),$=S("calcite-label",{layout:"inline"},S("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),E=S("div",null,S("div",{class:P.formSectionContainer},S("calcite-label",null,e.template,S("calcite-block",{class:P.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",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:P.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?S("calcite-icon",{class:P.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,S("calcite-icon",{class:P.templateSelectArrow,icon:x()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),$),F=S("div",{class:P.formSectionContainer},S("calcite-label",null,e.dpi,S("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._handleDPIChange}))),M=S("div",{class:P.formSectionContainer},S("calcite-label",null,S("div",{class:P.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=c(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new d({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||m(i.outSpatialReference)}}),this._isValidSpatialReference?null:S("div",{class:P.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),A=S("div",{class:this.classes(P.scaleInfoContainer,P.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:P.scaleInputContainer},S("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${f}`,bind:this,class:P.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}))),B=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:P.advancedOptionsContainer,key:"advanced-section-for-layout"},A,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?S("div",{class:P.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:P.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,F,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?S("div",{class:P.formSectionContainer,key:"legend-info"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!b,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?S("div",{class:P.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:P.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),N=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:P.advancedOptionsContainer},A,F,M,S("div",{class:P.formSectionContainer},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),R=this.exportedLinks.toArray(),D=this._renderExportedLinkItems(R),V={[P.exportSectionCentered]:!R.length},U=this._selectedTab===L.layout?S("section",{"aria-labelledby":`${this.id}__layoutTab`,class:P.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},S("div",{class:P.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?I:null,E,this._selectedTab===L.layout?O:null,S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(P.panelContainer,P.advancedOptionsSection),collapsible:!0,disabled:!(u||h?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},B))):this._selectedTab===L.mapOnly?S("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:P.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},S("div",{class:P.panelContainer},I,O,S("div",null,S("div",{class:this.classes(P.sizeContainer,P.formSectionContainer)},S("calcite-label",null,e.width,S("calcite-input-number",{bind:this,"data-input-name":"width",value:`${k}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("calcite-label",null,e.height,S("calcite-input-number",{bind:this,"data-input-name":"height",value:`${p}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("button",{"aria-label":e.swap,bind:this,class:this.classes(y.widgetButton,P.swapButton,T.swap),onclick:this._switchInput,type:"button"})),$),S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(P.panelContainer,P.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},N))):S("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(P.exportSection,V),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},S("div",{class:P.panelContainer},S("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:P.exportedFilesContainer},0===R.length?S("div",{class:P.exportedFilesEmpty},S("calcite-icon",{icon:"file",scale:"l"}),S("div",null,S(w,{class:P.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),S("div",null,e.exportHint))):D))),H="2d"!==a?.type,z=S("div",{class:P.panelError},a?H?e.sceneViewError:e.serviceError:e.noViewError),W=R.some((({state:e})=>"pending"===e)),q=S("div",{class:P.content,key:"panel"},S("div",null,S("ul",{bind:this,class:P.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.layout}`,class:P.layoutTab,"data-tab-id":L.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.mapOnly}`,class:P.layoutTab,"data-tab-id":L.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.export}`,class:P.layoutTab,"data-tab-id":L.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},W?S("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),this._selectedTab!==L.export?S("div",{class:this.classes(P.printButtonSection,!this.saveExportHidden&&this.portal?P.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(P.printButton),disabled:C||!(u||h?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),K=S("calcite-flow",{key:"root-flow"},S("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},S("div",{class:P.printWidgetContainer},this.headerVisible?S("header",{class:P.headerTitle},e.export):null,this.error||H||!a?z:q)),this._renderChooseTemplateFlowItem()),G="initializing"===i.state,J=G?this._renderLoader():K,Q={[P.panelItemsCentered]:G};return S("div",{bind:this,class:this.classes(P.base,y.widget,y.panel,Q)},J)}_getPageSizeLabel(e){if(!e)return;const t=e.layoutTemplateInfo;if(!t)return;const i=D.fromJSON(t.pageUnits.toLowerCase());return`${O(t.pageSize[0])} × ${O(t.pageSize[1])} ${o(this.messagesUnits,i,"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})=>!N(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})=>!(N(t)||i?.id&&e.includes(i.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=>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?j.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:P.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=u.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?P.browseTemplateButtonContainerFilter:P.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:P.templateSelectFlowItemContainer},S("div",{class:P.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:P.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:P.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:P.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:P.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),S("div",{class:P.templateButtonContainer},S("calcite-button",{class:P.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?S("div",{class:P.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=this._selectedTab===L.layout?e:t,o=this._selectedTab===L.layout?i:a,n=this._selectedTab===L.layout?this.templateOptions.title:this.templateOptions.fileName;return S("div",{class:P.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&&this._selectedTab===L.layout||"mapOnlyTab"===t&&this._selectedTab===L.mapOnly||"exportTab"===t&&this._selectedTab===L.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[P.loader]:this._awaitingServerResponse};return S("div",{class:this.classes(e),key:"loader"})}_updateExportedFileNameMap(e){void 0!==this._exportedFileNameMap[e]?this._exportedFileNameMap[e]++:this._exportedFileNameMap[e]=0}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),l=a.includes("png")?"png":a,o=i+l;return this._updateExportedFileNameMap(o),new v({name:i,extension:l,count:this._exportedFileNameMap[o]})}_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))a[i]=l;else{const e=a[i];t.value=`${e}`}}_handleDPIChange(e){const{templateOptions:t}=this,i=t.dpi;this._updateNumberInputValue(e);const a=t.dpi,{height:l,width:o}=A(a,i,t.width,t.height);t.height=l,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e,saveExportEnabled:t}=this,i=this.viewModel.toPrintTemplate(e),a=this._selectedTab===L.layout?i.layoutOptions?.titleText:e.fileName,l=this._createFileLink(i,a);this.exportedLinks.add(l),this.emit("submit",{link:l,saveExportEnabled:t}),this._selectedTab=L.export,this.viewModel.print(i).then((e=>{l.set({url:e&&e.url,state:"ready"})})).catch((e=>{l.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:l,saveExportEnabled:t}),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,o=this.saveAsButtonCallback&&"error"!==a&&this._isFormatAllowedForSaving(e.extension);return"pending"!==a&&o?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&&(l((()=>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,t){const i=this.messages,{url:a,state:l}=e,o=e.formattedName??"";let r=a||null;r&&(r=n(r));const c=s(r,location.href);return S("div",{class:P.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},S("div",null,S("div",{class:P.exportedFileLinkTitle},o),S("div",{class:P.exportedFileLinkDescription},"pending"===l?i.generatingExport:t||(c?i.ready:i.linkReady))),"ready"===l?S("calcite-icon",{"aria-label":`${o}. ${i.linkReady}`,icon:c?"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:P.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:"m",slot:"content-start"}):S("calcite-icon",{icon:R(e),key:`${t}-start-icon`,scale:"s",slot:"content-start"})}_renderExportedLinkItemAction(e,t){const{state:i}=e,a=e.formattedName??"",l=this.saveAsButtonCallback&&"error"!==i&&this._isFormatAllowedForSaving(e.extension);return"pending"!==i?S("calcite-action",{"aria-label":`${t}`,icon:l?"ellipsis":"x",id:l?`${a}-popover-button`:void 0,key:l?`${a}-saveAs-action`:`${a}-action`,onclick:l?void 0:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:`${t}`}):null}_renderExportedLinkItem(e){const t=this.messages,{error:i,state:a}=e,l=e.formattedName??"";let o;switch(a){case"pending":o=t.pending;break;case"ready":o=t.ready;break;case"error":o=t.errorMessage}const n="error"===a?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return S(I,null,S("calcite-list-item",{"aria-label":o,key:l,title:n},this._renderExportedLinkItemContent(e,n),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e,n)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return S("calcite-list",{filterEnabled:e?.length>10,label:this.messages.exportedLinksList},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,this._selectedTab===L.mapOnly)this.templateOptions.reset(),this.templateOptions.layout=E;else if(this._selectedTab===L.layout){const e=this._selectedTemplate??this.viewModel.defaultTemplate;e?this.viewModel.applyTemplate(e):this.templateOptions.reset()}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(k(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case L.layout:this._toggleTab("ArrowLeft"===t?L.export:L.mapOnly);break;case L.mapOnly:this._toggleTab("ArrowLeft"===t?L.layout:L.export);break;case L.export:this._toggleTab("ArrowLeft"===t?L.mapOnly:L.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],V.prototype,"_showTemplates",void 0),e([r()],V.prototype,"_isValidSpatialReference",void 0),e([r()],V.prototype,"allowedFormats",null),e([r()],V.prototype,"allowedFormatsForSaving",void 0),e([r()],V.prototype,"allowedLayouts",null),e([r()],V.prototype,"browseTemplateButtonOnClick",void 0),e([r()],V.prototype,"error",null),e([r({type:$})],V.prototype,"exportedLinks",void 0),e([r()],V.prototype,"extraParameters",null),e([r()],V.prototype,"headerVisible",void 0),e([r()],V.prototype,"headingLevel",void 0),e([r()],V.prototype,"icon",null),e([r()],V.prototype,"includeDefaultTemplates",null),e([r()],V.prototype,"includeOrganizationTemplates",void 0),e([r()],V.prototype,"label",null),e([r(),C("esri/widgets/Print/t9n/Print")],V.prototype,"messages",void 0),e([r(),C("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([r(),C("esri/core/t9n/Units")],V.prototype,"messagesUnits",void 0),e([r({type:d})],V.prototype,"outSpatialReference",null),e([r()],V.prototype,"portal",null),e([r()],V.prototype,"saveExportEnabled",void 0),e([r()],V.prototype,"saveExportHidden",void 0),e([r()],V.prototype,"showPrintAreaEnabled",null),e([r()],V.prototype,"printServiceUrl",null),e([r()],V.prototype,"saveAsButtonCallback",void 0),e([r()],V.prototype,"templateCustomTextElements",null),e([r()],V.prototype,"templateOptions",null),e([r()],V.prototype,"view",null),e([r({type:g})],V.prototype,"viewModel",void 0),V=e([p("esri.widgets.Print")],V);const U=V;export{U as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{JSONMap as i}from"../core/jsonMap.js";import{watch as a,whenOnce as l}from"../core/reactiveUtils.js";import{unitName as o}from"../core/unitFormatUtils.js";import{addProxy as n,hasSameOrigin as s}from"../core/urlUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{ensureInteger as c}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/SpatialReference.js";import{isValid as m}from"../geometry/support/spatialReferenceUtils.js";import{reArcGISOnlineDomain as u}from"../portal/support/urlUtils.js";import{findToken as h}from"../rest/utils.js";import{formatJsonMap as b}from"../rest/support/fileFormat.js";import _ from"./Widget.js";import v from"./Print/FileLink.js";import g from"./Print/PrintViewModel.js";import{loadCalciteComponents as f}from"./support/componentsUtils.js";import{globalCss as y}from"./support/globalCss.js";import{Heading as w}from"./support/Heading.js";import{legacyIcon as T}from"./support/legacyIcon.js";import{isRTL as x,isActivationKey as k}from"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as S,tsxFragment as I}from"./support/jsxFactory.js";import{formatNumber as O}from"../intl/number.js";const $=t.ofType(v),E="map-only";var L;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab",e.export="exportTab"}(L||(L={}));const F="esri-print",M=`${F}__advanced-options-button`,P={base:F,headerTitle:`${F}__header-title`,layoutTabList:`${F}__layout-tab-list`,layoutTab:`${F}__layout-tab`,layoutSection:`${F}__layout-section`,mapOnlySection:`${F}__map-only-section`,panelItemsCentered:`${F}__panel-items--centered`,loader:`${F}__loader`,advancedOptionsButton:M,advancedOptionsButtonContainer:`${M}-container`,advancedOptionsButtonTitle:`${M}-title`,advancedOptionsButtonIconOpened:`${M}-icon--opened`,advancedOptionsButtonIconClosed:`${M}-icon--closed`,advancedOptionsButtonIconClosed_RTL:`${M}-icon--closed-rtl`,swapButton:`${F}__swap-button`,printButton:`${F}__export-button`,printButtonSection:`${F}__export-button-section`,printButtonSectionDivider:`${F}__export-button-section--divider`,templateSelectContainer:`${F}__template-select-container`,templateSelectBlock:`${F}__template-select-block`,templateSelectIcon:`${F}__template-select-icon`,templateSelectError:`${F}__template-select-error`,templateSelectArrow:`${F}__template-select-arrow`,formSectionContainer:`${F}__form-section-container`,formCheckboxLabel:`${F}__form-checkbox-label`,advancedOptionsSection:`${F}__advanced-options-section`,advancedOptionsContainer:`${F}__advanced-options-container`,browseTemplateButtonContainer:`${F}__browse-template-button-container`,browseTemplateButtonContainerFilter:`${F}__browse-template-button-container-filter`,exportedFilesContainer:`${F}__export-panel-container`,exportedFilesTitle:`${F}__export-title`,exportedFile:`${F}__exported-file`,exportedFileLink:`${F}__exported-file-link`,exportedFileLinkTitle:`${F}__exported-file-link-title`,exportedFileLinkDescription:`${F}__exported-file-link-description`,exportedFilesEmpty:`${F}__exported-files-empty`,printWidgetContainer:`${F}__container`,content:`${F}__content`,panelContainer:`${F}__panel-container`,scaleInfoContainer:`${F}__scale-info-container`,scaleInputContainer:`${F}__scale-input-container`,scaleInput:`${F}__scale-input`,sizeContainer:`${F}__size-container`,panelError:`${F}__panel--error`,exportedFileError:`${F}__exported-file--error`,exportedFileLoader:`${F}__exported-file--loader`,exportSection:`${F}__export-section`,exportSectionCentered:`${F}__export-section--centered`,templateButtonContainer:`${F}__template-button-container`,templateDoneButton:`${F}__template-done-button`,templateSelectFlowItemContainer:`${F}__template-select-flow-item-container`,templateSelectFlowItemContent:`${F}__template-select-flow-item-content`,templateSelectFlowItemListHeading:`${F}__template-select-flow-item-list-heading`,srLabel:`${F}__sr-label`,invalidWkidText:`${F}__invalid-wkid-text`};function A(e,t,i,a){const l=i/t,o=a/t;return{width:Math.round(e*l),height:Math.round(e*o)}}function B(e){return!isNaN(e)&&e>0}function N(e){return e?.toLowerCase()===E}function R(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 i({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 V=class extends _{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._selectedTab=L.layout,this._pendingExportScroll=!1,this._rootNode=null,this._selectedTemplate=null,this._formats=[],this._showTemplates=!1,this._isValidSpatialReference=!0,this.allowedFormatsForSaving=null,this.browseTemplateButtonOnClick=null,this.exportedLinks=new $,this.headerVisible=!0,this.headingLevel=3,this.includeOrganizationTemplates=!0,this.messagesCommon=null,this.messagesUnits=null,this.saveExportEnabled=!1,this.saveExportHidden=!0,this.saveAsButtonCallback=null,this.viewModel=new g,this._onInput=e=>{this._selectedTab===L.layout?this.templateOptions.title=e.currentTarget.value:this._selectedTab===L.mapOnly&&(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=h(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},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.addHandles([a((()=>[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=b.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);else{const t=this._formats.find((({value:t})=>new RegExp(`\\b${t}\\b`,"i").test(e.format.defaultValue)))?.value;t&&(this.templateOptions.format=t)}})),a((()=>[this.templateOptions.id,this.viewModel.loaded]),(async()=>{const{layout:e}=this.templateOptions;this._selectedTab=N(e)?L.mapOnly:L.layout,this._selectedTab===L.layout&&this.viewModel.loaded&&(this._selectedTemplate=this.viewModel.getLayoutTemplateById(this.templateOptions.id))})),a((()=>this.templateOptions.dpi),(e=>{e<=0&&(this.templateOptions.dpi=1)})),a((()=>this.viewModel.view?.scale),(e=>{!e||this.templateOptions.scaleEnabled&&this.templateOptions.scale||(this.templateOptions.scale=e)}))]);for(const{name:a,extension:l}of this.exportedLinks)a&&l&&this._updateExportedFileNameMap(`${a}${l}`);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 f({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 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 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:p,layout:u,layoutItem:h,legendEnabled:b,northArrowEnabled:_,scaleBarEnabled:v,scaleEnabled:g,scale:f,width:k}=t,C="ready"!==i.state||this._awaitingServerResponse||!(u||h),I=this._renderTitleOrFileNameSection(),O=S("div",{class:P.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})))))),$=S("calcite-label",{layout:"inline"},S("calcite-switch",{checked:this.showPrintAreaEnabled,onCalciteSwitchChange:e=>{this.showPrintAreaEnabled=!!e.currentTarget.checked}}),e.printPreview),E=S("div",null,S("div",{class:P.formSectionContainer},S("calcite-label",null,e.template,S("calcite-block",{class:P.templateSelectContainer,collapsible:!1,description:this._getPageSizeLabel(this._selectedTemplate),heading:this._getTemplateLabel(this._selectedTemplate,!0),key:"template-select-block",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:P.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?S("calcite-icon",{class:P.templateSelectError,icon:"exclamation-mark-circle",key:"template-select-error",scale:"s",slot:"actions-end"}):null,S("calcite-icon",{class:P.templateSelectArrow,icon:x()?"chevron-left":"chevron-right",key:"template-select-arrow",scale:"s",slot:"actions-end"})))),$),F=S("div",{class:P.formSectionContainer},S("calcite-label",null,e.dpi,S("calcite-input-number",{bind:this,"data-input-name":"dpi",min:1,value:`${s}`,onCalciteInputNumberInput:this._handleDPIChange}))),M=S("div",{class:P.formSectionContainer},S("calcite-label",null,S("div",{class:P.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=c(e.value);i.outSpatialReference=Number.isNaN(t)||null==t?null:new d({wkid:t}),this._isValidSpatialReference=!i.outSpatialReference||m(i.outSpatialReference)}}),this._isValidSpatialReference?null:S("div",{class:P.invalidWkidText,key:`out-sr-${i.outSpatialReference?.wkid}`},e.invalidWkid))),A=S("div",{class:this.classes(P.scaleInfoContainer,P.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:P.scaleInputContainer},S("calcite-input-number",{"aria-label":e.scaleLabel,"aria-valuenow":`${f}`,bind:this,class:P.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}))),B=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:P.advancedOptionsContainer,key:"advanced-section-for-layout"},A,this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText??1?S("div",{class:P.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:P.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,F,M,this._renderCustomTextElementSection(),this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend??1?S("div",{class:P.formSectionContainer,key:"legend-info"},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:!!b,"data-option-name":"legendEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.legend)):null,this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length?S("div",{class:P.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:P.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),N=S("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:P.advancedOptionsContainer},A,F,M,S("div",{class:P.formSectionContainer},S("calcite-label",{layout:"inline"},S("calcite-checkbox",{bind:this,checked:l,"data-option-name":"attributionEnabled",onCalciteCheckboxChange:this._toggleInputValue}),e.attribution)),this._renderCustomTextElementSection()),R=this.exportedLinks.toArray(),D=this._renderExportedLinkItems(R),V={[P.exportSectionCentered]:!R.length},U=this._selectedTab===L.layout?S("section",{"aria-labelledby":`${this.id}__layoutTab`,class:P.layoutSection,id:`${this.id}__layoutContent`,key:"esri-print__layoutContent",role:"tabpanel"},S("div",{class:P.panelContainer},this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText??1?I:null,E,this._selectedTab===L.layout?O:null,S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(P.panelContainer,P.advancedOptionsSection),collapsible:!0,disabled:!(u||h?.id),heading:e.advancedOptions,id:"advancedOptionsForLayout",key:"advanced-options-for-layout"},B))):this._selectedTab===L.mapOnly?S("section",{"aria-labelledby":`${this.id}__mapOnlyTab`,class:P.mapOnlySection,id:`${this.id}__mapOnlyContent`,key:"esri-print__mapOnlyContent",role:"tabpanel"},S("div",{class:P.panelContainer},I,O,S("div",null,S("div",{class:this.classes(P.sizeContainer,P.formSectionContainer)},S("calcite-label",null,e.width,S("calcite-input-number",{bind:this,"data-input-name":"width",value:`${k}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("calcite-label",null,e.height,S("calcite-input-number",{bind:this,"data-input-name":"height",value:`${p}`,onCalciteInputNumberInput:this._updateNumberInputValue})),S("button",{"aria-label":e.swap,bind:this,class:this.classes(y.widgetButton,P.swapButton,T.swap),onclick:this._switchInput,type:"button"})),$),S("calcite-block",{"aria-label":e.advancedOptions,class:this.classes(P.panelContainer,P.advancedOptionsSection),collapsible:!0,heading:e.advancedOptions,id:"advancedOptionsForMapOnly",key:"advanced-options-for-map-only"},N))):S("section",{"aria-labelledby":`${this.id}__exportTab`,class:this.classes(P.exportSection,V),id:`${this.id}__exportContent`,key:"esri-print__exportContent",role:"tabpanel"},S("div",{class:P.panelContainer},S("div",{afterUpdate:this._scrollExportIntoView,bind:this,class:P.exportedFilesContainer},0===R.length?S("div",{class:P.exportedFilesEmpty},S("calcite-icon",{icon:"file",scale:"l"}),S("div",null,S(w,{class:P.exportedFilesTitle,level:this.headingLevel},e.noExportedFiles),S("div",null,e.exportHint))):D))),H="2d"!==a?.type,z=S("div",{class:P.panelError},a?H?e.sceneViewError:e.serviceError:e.noViewError),W=R.some((({state:e})=>"pending"===e)),q=S("div",{class:P.content,key:"panel"},S("div",null,S("ul",{bind:this,class:P.layoutTabList,onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,role:"tablist"},S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.layout}`,class:P.layoutTab,"data-tab-id":L.layout,id:`${this.id}__layoutTab`,role:"tab",tabIndex:0},e.layoutTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.mapOnly}`,class:P.layoutTab,"data-tab-id":L.mapOnly,id:`${this.id}__mapOnlyTab`,role:"tab",tabIndex:0},e.mapOnlyTab),S("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,"aria-selected":`${this._selectedTab===L.export}`,class:P.layoutTab,"data-tab-id":L.export,id:`${this.id}__exportedFilesTab`,role:"tab",tabIndex:0},W?S("calcite-loader",{inline:!0,label:"loading",scale:"s"}):null,e.exportsTab)),U),this._selectedTab!==L.export?S("div",{class:this.classes(P.printButtonSection,!this.saveExportHidden&&this.portal?P.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(P.printButton),disabled:C||!(u||h?.id)&&!r,onclick:this._handlePrintMap,scale:"l",width:"full"},e.export)):null),K=S("calcite-flow",{key:"root-flow"},S("calcite-flow-item",{bind:this,key:"root-flow-item",selected:!this._showTemplates},S("div",{class:P.printWidgetContainer},this.headerVisible?S("header",{class:P.headerTitle},e.export):null,this.error||H||!a?z:q)),this._renderChooseTemplateFlowItem()),G="initializing"===i.state,J=G?this._renderLoader():K,Q={[P.panelItemsCentered]:G};return S("div",{bind:this,class:this.classes(P.base,y.widget,y.panel,Q)},J)}_getPageSizeLabel(e){if(!e)return;const t=e.layoutTemplateInfo;if(!t)return;const i=D.fromJSON(t.pageUnits.toLowerCase());return`${O(t.pageSize[0])} × ${O(t.pageSize[1])} ${o(this.messagesUnits,i,"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})=>!N(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})=>!(N(t)||i?.id&&e.includes(i.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=>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?j.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:P.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=u.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?P.browseTemplateButtonContainerFilter:P.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:P.templateSelectFlowItemContainer},S("div",{class:P.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:P.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:P.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:P.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:P.templateSelectFlowItemListHeading},e.defaultTemplates),this._renderLayoutTemplates(o)):null:this._renderLayoutTemplates(o))),S("div",{class:P.templateButtonContainer},S("calcite-button",{class:P.templateDoneButton,onclick:()=>this._showTemplates=!1},this.messagesCommon.done))))}_renderCustomTextElementSection(){const{customTextElements:e}=this.templateOptions;return e?S("div",{class:P.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=this._selectedTab===L.layout?e:t,o=this._selectedTab===L.layout?i:a,n=this._selectedTab===L.layout?this.templateOptions.title:this.templateOptions.fileName;return S("div",{class:P.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&&this._selectedTab===L.layout||"mapOnlyTab"===t&&this._selectedTab===L.mapOnly||"exportTab"===t&&this._selectedTab===L.export)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[P.loader]:this._awaitingServerResponse};return S("div",{class:this.classes(e),key:"loader"})}_updateExportedFileNameMap(e){void 0!==this._exportedFileNameMap[e]?this._exportedFileNameMap[e]++:this._exportedFileNameMap[e]=0}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),l=a.includes("png")?"png":a,o=i+l;return this._updateExportedFileNameMap(o),new v({name:i,extension:l,count:this._exportedFileNameMap[o]})}_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))a[i]=l;else{const e=a[i];t.value=`${e}`}}_handleDPIChange(e){const{templateOptions:t}=this,i=t.dpi;this._updateNumberInputValue(e);const a=t.dpi,{height:l,width:o}=A(a,i,t.width,t.height);t.height=l,t.width=o}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e,saveExportEnabled:t}=this,i=this.viewModel.toPrintTemplate(e),a=this._selectedTab===L.layout?i.layoutOptions?.titleText:e.fileName,l=this._createFileLink(i,a);this.exportedLinks.add(l),this.emit("submit",{link:l,saveExportEnabled:t}),this._selectedTab=L.export,this.viewModel.print(i).then((e=>{l.set({url:e&&e.url,state:"ready"})})).catch((e=>{l.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:l,saveExportEnabled:t}),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,o=this.saveAsButtonCallback&&"error"!==a&&this._isFormatAllowedForSaving(e.extension);return"pending"!==a&&o?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&&(l((()=>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,t){const i=this.messages,{url:a,state:l}=e,o=e.formattedName??"";let r=a||null;r&&(r=n(r));const c=s(r,location.href);return S("div",{class:P.exportedFile,"data-item":e,onclick:this._handleLinkClick,slot:"content"},S("div",null,S("div",{class:P.exportedFileLinkTitle},o),S("div",{class:P.exportedFileLinkDescription},"pending"===l?i.generatingExport:t||(c?i.ready:i.linkReady))),"ready"===l?S("calcite-icon",{"aria-label":`${o}. ${i.linkReady}`,icon:c?"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:P.exportedFileLoader,inline:!0,key:`${t}-loader`,label:this.messages.generatingExport,scale:"m",slot:"content-start"}):S("calcite-icon",{icon:R(e),key:`${t}-start-icon`,scale:"s",slot:"content-start"})}_renderExportedLinkItemAction(e,t){const{state:i}=e,a=e.formattedName??"",l=this.saveAsButtonCallback&&"error"!==i&&this._isFormatAllowedForSaving(e.extension);return"pending"!==i?S("calcite-action",{"aria-label":`${t}`,icon:l?"ellipsis":"x",id:l?`${a}-popover-button`:void 0,key:l?`${a}-saveAs-action`:`${a}-action`,onclick:l?void 0:()=>{this.exportedLinks.remove(e)},slot:"actions-end",text:`${t}`}):null}_renderExportedLinkItem(e){const t=this.messages,{error:i,state:a}=e,l=e.formattedName??"";let o;switch(a){case"pending":o=t.pending;break;case"ready":o=t.ready;break;case"error":o=t.errorMessage}const n="error"===a?"print-task:cim-symbol-unsupported"===i?.name?t.exportWebMapCIMError:t.exportWebMapError:"";return S(I,null,S("calcite-list-item",{"aria-label":o,key:l,title:n},this._renderExportedLinkItemContent(e,n),this._renderExportedLinkItemIcon(e),this._renderExportedLinkItemAction(e,n)),this._renderExportedLinkItemPopover(e))}_renderExportedLinkItems(e){return S("calcite-list",{filterEnabled:e?.length>10,label:this.messages.exportedLinksList},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,this._selectedTab===L.mapOnly)this.templateOptions.reset(),this.templateOptions.layout=E;else if(this._selectedTab===L.layout){const e=this._selectedTemplate??this.viewModel.defaultTemplate;e?this.viewModel.applyTemplate(e):this.templateOptions.reset()}t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const{key:t}=e,i=e.target.getAttribute("data-tab-id");if(k(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();if("ArrowLeft"===t||"ArrowRight"===t){switch(i){case L.layout:this._toggleTab("ArrowLeft"===t?L.export:L.mapOnly);break;case L.mapOnly:this._toggleTab("ArrowLeft"===t?L.layout:L.export);break;case L.export:this._toggleTab("ArrowLeft"===t?L.mapOnly:L.layout)}e.preventDefault(),e.stopPropagation()}}};e([r()],V.prototype,"_showTemplates",void 0),e([r()],V.prototype,"_isValidSpatialReference",void 0),e([r()],V.prototype,"allowedFormats",null),e([r()],V.prototype,"allowedFormatsForSaving",void 0),e([r()],V.prototype,"allowedLayouts",null),e([r()],V.prototype,"browseTemplateButtonOnClick",void 0),e([r()],V.prototype,"error",null),e([r({type:$})],V.prototype,"exportedLinks",void 0),e([r()],V.prototype,"extraParameters",null),e([r()],V.prototype,"headerVisible",void 0),e([r()],V.prototype,"headingLevel",void 0),e([r()],V.prototype,"icon",null),e([r()],V.prototype,"includeDefaultTemplates",null),e([r()],V.prototype,"includeOrganizationTemplates",void 0),e([r()],V.prototype,"label",null),e([r(),C("esri/widgets/Print/t9n/Print")],V.prototype,"messages",void 0),e([r(),C("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([r(),C("esri/core/t9n/Units")],V.prototype,"messagesUnits",void 0),e([r({type:d})],V.prototype,"outSpatialReference",null),e([r()],V.prototype,"portal",null),e([r()],V.prototype,"saveExportEnabled",void 0),e([r()],V.prototype,"saveExportHidden",void 0),e([r()],V.prototype,"showPrintAreaEnabled",null),e([r()],V.prototype,"printServiceUrl",null),e([r()],V.prototype,"saveAsButtonCallback",void 0),e([r()],V.prototype,"templateCustomTextElements",null),e([r()],V.prototype,"templateOptions",null),e([r()],V.prototype,"view",null),e([r({type:g})],V.prototype,"viewModel",void 0),V=e([p("esri.widgets.Print")],V);const U=V;export{U as default};