@arcgis/core 5.0.0-next.10 → 5.0.0-next.12

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 (414) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/analysis/AreaMeasurementAnalysis.js +1 -1
  3. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  4. package/applications/KnowledgeStudio/generalSdkInternalAccess.js +1 -1
  5. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  6. package/arcade/functions/geomasync.js +1 -1
  7. package/arcade/functions/geomsync.js +1 -1
  8. package/arcade/functions/knowledgegraph.js +1 -1
  9. package/arcade/geometry/nearestVertex.js +5 -0
  10. package/arcade/geometry/operators.js +1 -1
  11. package/arcade/geometry/operatorsWorker.js +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/{af47272aaaef0ea57e71.js → 00ea3052170e831c6bc8.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{91dfd29e2dba200eab09.js → 0105d814fb51c366d1da.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{125e71b0e29d1d132777.js → 02a22dd6d208a925cc5a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/02e7359162cf974b41b6.js +1 -0
  17. package/assets/esri/core/workers/chunks/{ead8d0cbcebd12dbfad7.js → 04211fba145d9f06b3ec.js} +1 -1
  18. package/assets/esri/core/workers/chunks/0441ea7c89266a68b6f0.js +1 -0
  19. package/assets/esri/core/workers/chunks/07f2a75431dd8fc502ef.js +1 -0
  20. package/assets/esri/core/workers/chunks/092d72caf3269e696d1c.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d1e97cce5047f1791e22.js → 0ac13de43438f572f59c.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{629127877042ad784ad2.js → 0c8aeb6262e9ec7c87d0.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{d07f911d40bf05fc0306.js → 1008e3d64f5880e3dbf2.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{c29486c4eeb3e72effff.js → 110429583b28c28c36ee.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{61d970ed75c2c358b1e9.js → 14d601e0fe7a0538c7c1.js} +1 -1
  26. package/assets/esri/core/workers/chunks/18474c017ddacd1d3d2c.js +1 -0
  27. package/assets/esri/core/workers/chunks/{1257c37bf04d39c27b62.js → 1c3bee704bafb64bba70.js} +1 -1
  28. package/assets/esri/core/workers/chunks/1d07846bcaac47df0644.js +1 -0
  29. package/assets/esri/core/workers/chunks/{509392131ec473d6b988.js → 1dfca37f95f2b968aa54.js} +1 -1
  30. package/assets/esri/core/workers/chunks/2132ccc45da90f6208b2.js +1 -0
  31. package/assets/esri/core/workers/chunks/2166238a7ad63a2d43c7.js +1 -0
  32. package/assets/esri/core/workers/chunks/2214d3b1f11658a85d0f.js +1 -0
  33. package/assets/esri/core/workers/chunks/2266a8f2c2ec37c19bb4.js +1 -0
  34. package/assets/esri/core/workers/chunks/22ca80f491e070b2a5e7.js +1 -0
  35. package/assets/esri/core/workers/chunks/{f80f5dbf96c343ac4df6.js → 24d8922ac9cd48621357.js} +1 -1
  36. package/assets/esri/core/workers/chunks/257f17b3836a623a9dbe.js +1 -0
  37. package/assets/esri/core/workers/chunks/2b27499fa9de22970b7a.js +1 -0
  38. package/assets/esri/core/workers/chunks/2e76fbd3c874300fc4a7.js +1 -0
  39. package/assets/esri/core/workers/chunks/31b5900119dd7cd9e7d3.js +1 -0
  40. package/assets/esri/core/workers/chunks/34bb4852ebef0f529c96.js +1 -0
  41. package/assets/esri/core/workers/chunks/{9698f36c143953a975d4.js → 353d447f3745942c88a8.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{52282f767bd0e99ddca0.js → 3545dce74bb6b0354cb7.js} +1 -1
  43. package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
  44. package/assets/esri/core/workers/chunks/38810e3f298e8a0b64a6.js +1 -0
  45. package/assets/esri/core/workers/chunks/{7290e7a819eb291b1df2.js → 38fa50336983265c73a4.js} +3 -3
  46. package/assets/esri/core/workers/chunks/{fe49321dca22dc60d105.js → 3b1982bf7b44ff897a35.js} +1 -1
  47. package/assets/esri/core/workers/chunks/3bacd904cd93c8013f6a.js +1 -0
  48. package/assets/esri/core/workers/chunks/{588533c3abe876f20f62.js → 3d5b157bd9060b07670b.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{06e60fc7715d08ede59d.js → 3edffdb0e282ed562ac7.js} +1 -1
  50. package/assets/esri/core/workers/chunks/3fa15d4ee5fab8fff76e.js +1 -0
  51. package/assets/esri/core/workers/chunks/487e1c592f1b6fd03a7d.js +1 -0
  52. package/assets/esri/core/workers/chunks/{ee5aa11750c51b220f1e.js → 4bcb83119481453dbb90.js} +1 -1
  53. package/assets/esri/core/workers/chunks/4ca5d58117e7a5f73e1e.js +1 -0
  54. package/assets/esri/core/workers/chunks/{826fa0dfb63df77bfd95.js → 4f0016111fd84c612f41.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{24cd7b84cd0f3de4bff2.js → 4f14fed0ec885c3c33d5.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{4baf6f6e7ddedb25f806.js → 5299ec59c86022ca37e2.js} +1 -1
  57. package/assets/esri/core/workers/chunks/53a9c34cb3f6ac06cd50.js +1 -0
  58. package/assets/esri/core/workers/chunks/5415fbcc7ed203fc5575.js +1 -0
  59. package/assets/esri/core/workers/chunks/54c49a768147720c3c56.js +1 -0
  60. package/assets/esri/core/workers/chunks/558822b700e8bd844052.js +1 -0
  61. package/assets/esri/core/workers/chunks/{da24ad57747714ac5eda.js → 55adbd7481f8dfb1067e.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{7803495f8862d9025bcd.js → 56e06c9c1120bea2c641.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{dc66490520f97eef15bf.js → 57806a01f33074b601e7.js} +24 -24
  64. package/assets/esri/core/workers/chunks/{67f03d042455cd0f7009.js → 57b410198d83bf0ab708.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{0a5d74414dd02a2fb8e1.js → 5bc4140333d0db904949.js} +1 -1
  66. package/assets/esri/core/workers/chunks/5e08b19e6d7202ea38d7.js +1 -0
  67. package/assets/esri/core/workers/chunks/{0d5212f59e9b62c16164.js → 5f6df4a3376b52ead53f.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{15c7c10ff9ac63f0e792.js → 5fb2edf942b1cd8d7336.js} +1 -1
  69. package/assets/esri/core/workers/chunks/600e2e6b51e2fb9c598c.js +1 -0
  70. package/assets/esri/core/workers/chunks/{dc51438b832551924a9e.js → 6238ca7541800eb2566b.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{731f7b552dde0fb325cd.js → 62c2bd082a0c669bc857.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{b8a3f1e60e24a13749c1.js → 631fb2e62e48f8be4051.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{c8e686efe344a33a0258.js → 6490bc392a4b4f9e24f9.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{e767f83f9e2de6650f80.js → 6581b94e796781c0ad4a.js} +1 -1
  75. package/assets/esri/core/workers/chunks/{53654edd766d9b4ef750.js → 658cd45b5fb304fd840a.js} +1 -1
  76. package/assets/esri/core/workers/chunks/67f305b0c72e77a6331a.js +1 -0
  77. package/assets/esri/core/workers/chunks/6922351c001fdb4cb757.js +1 -0
  78. package/assets/esri/core/workers/chunks/{6e22b02a9715c10578d0.js → 69cca5d3f715876c6b32.js} +1 -1
  79. package/assets/esri/core/workers/chunks/6c13c01c47abc1939f96.js +1 -0
  80. package/assets/esri/core/workers/chunks/{c37f7756d48ff9af2656.js → 736035c0069ccb03bee6.js} +1 -1
  81. package/assets/esri/core/workers/chunks/7c14f99e6cfff2a8ef4a.js +1 -0
  82. package/assets/esri/core/workers/chunks/812f2ccc01f44e3cfd41.js +1 -0
  83. package/assets/esri/core/workers/chunks/82338cdd56aa1de28db3.js +1 -0
  84. package/assets/esri/core/workers/chunks/{51ab2acac4ecc1ca9c34.js → 86830fcb5475502dac65.js} +1 -1
  85. package/assets/esri/core/workers/chunks/{11e96a312f1294d34c50.js → 881df4fd1dc594576457.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{d1ca7c3a32ce00ed8b81.js → 8be16b03caa947ac7631.js} +1 -1
  87. package/assets/esri/core/workers/chunks/8cd03b54b2859b52fb81.js +1 -0
  88. package/assets/esri/core/workers/chunks/8d9ccc9a43a315cb6b04.js +1 -0
  89. package/assets/esri/core/workers/chunks/{042cd64e1f4eb326c30f.js → 8fc82fe1fcbcedf35400.js} +1 -1
  90. package/assets/esri/core/workers/chunks/91afee11072471e4eefe.js +1 -0
  91. package/assets/esri/core/workers/chunks/{fbd8d2f61f8a15bcf3db.js → 9595aabbaf411eceea1e.js} +1 -1
  92. package/assets/esri/core/workers/chunks/9978ec6c67e87dc08a1d.js +1 -0
  93. package/assets/esri/core/workers/chunks/9cdd087c43a601ec331d.js +1 -0
  94. package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +1 -0
  95. package/assets/esri/core/workers/chunks/{5e2ce34def5e053913b2.js → a10e533f336c035d8d40.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{311b564e44ae637c960d.js → a3ade7e8b9ddadb5f800.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{18c5d79d5ee1136e0a57.js → a57751f3d78524c876cd.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{0030d68d9edf42b4af57.js → a6a87f92f453204e9bdb.js} +1 -1
  99. package/assets/esri/core/workers/chunks/a6ee40dfc471d6612f3c.js +1 -0
  100. package/assets/esri/core/workers/chunks/a8ea050090c351e3b6d6.js +1 -0
  101. package/assets/esri/core/workers/chunks/adf7ccf4ef629211c7ee.js +1 -0
  102. package/assets/esri/core/workers/chunks/ae6066ea6cb373dc6db3.js +1 -0
  103. package/assets/esri/core/workers/chunks/af5fc5d6c1d072a27df1.js +1 -0
  104. package/assets/esri/core/workers/chunks/b193de09e005b0976a6a.js +1 -0
  105. package/assets/esri/core/workers/chunks/b328635d191f5424c047.js +1 -0
  106. package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
  107. package/assets/esri/core/workers/chunks/{664ae441617afe4b17ec.js → b87bc987983b31c13f64.js} +1 -1
  108. package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
  109. package/assets/esri/core/workers/chunks/bbdfa8ffcf084cbd9938.js +1 -0
  110. package/assets/esri/core/workers/chunks/bc19a232076d98825eef.js +1 -0
  111. package/assets/esri/core/workers/chunks/bc29c29bfa5be3ebafb1.js +1 -0
  112. package/assets/esri/core/workers/chunks/{ddfd01bb9ba8577c3ffc.js → c3dcfe26c2c3c829762d.js} +1 -1
  113. package/assets/esri/core/workers/chunks/c3ddcf9148dd2640c402.js +1 -0
  114. package/assets/esri/core/workers/chunks/{6d9f2b113d6bde936a04.js → c4dfd897bcab20dee43b.js} +1 -1
  115. package/assets/esri/core/workers/chunks/{0f30a9514571c7be9978.js → c5c02ace54fe4ab9214b.js} +1 -1
  116. package/assets/esri/core/workers/chunks/{87921f3fa9001f5801ed.js → c68935ed44eb0702a6ba.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{4fb5f1c671892001a4fd.js → c9579d607e59bae214da.js} +1 -1
  118. package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
  119. package/assets/esri/core/workers/chunks/{773f2c6c9d38db76dfed.js → d42f7e48d694b2427c0d.js} +1 -1
  120. package/assets/esri/core/workers/chunks/d466f3f0d3824c77da7c.js +1 -0
  121. package/assets/esri/core/workers/chunks/d4a91f2256e48316a8f0.js +1 -0
  122. package/assets/esri/core/workers/chunks/d69265ceabfa92b40bb7.js +1 -0
  123. package/assets/esri/core/workers/chunks/d7755c4c8d1d3059efca.js +1 -0
  124. package/assets/esri/core/workers/chunks/{eb9c166db0db6fa60e95.js → d7b0fcce847f563ea255.js} +1 -1
  125. package/assets/esri/core/workers/chunks/d87f0116ee53ec5f98e9.js +1 -0
  126. package/assets/esri/core/workers/chunks/d888ae5ac1810a486919.js +1 -0
  127. package/assets/esri/core/workers/chunks/db54552def7bc6cef9bd.js +1 -0
  128. package/assets/esri/core/workers/chunks/dc4d29cfce12ac599888.js +1 -0
  129. package/assets/esri/core/workers/chunks/dda6ca9af35518652d0f.js +1 -0
  130. package/assets/esri/core/workers/chunks/{7005d956c990a04ee8b2.js → dec336700cfb83abbbeb.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{b3613a38178cad2ebc82.js → dee9867b3379e024ae96.js} +1 -1
  132. package/assets/esri/core/workers/chunks/df130abb76713a85b4f9.js +1 -0
  133. package/assets/esri/core/workers/chunks/e0aa036c56ecdfe01503.js +1 -0
  134. package/assets/esri/core/workers/chunks/e2e4f6b58763fae51ae5.js +1 -0
  135. package/assets/esri/core/workers/chunks/e8a9c56fd0e7fd2558ef.js +1 -0
  136. package/assets/esri/core/workers/chunks/{1d06fcae4c2f02fb1c95.js → eb7eb3b3b8800fd73f3e.js} +1 -1
  137. package/assets/esri/core/workers/chunks/{37c1f155da14de91565a.js → edf58513f789856cd1db.js} +1 -1
  138. package/assets/esri/core/workers/chunks/{f34e3fa0c5b28531e289.js → ef789e8487deab916fad.js} +1 -1
  139. package/assets/esri/core/workers/chunks/f28ffda9a95c6568503d.js +1 -0
  140. package/assets/esri/core/workers/chunks/f98689562017583f73ee.js +1 -0
  141. package/assets/esri/core/workers/chunks/{292daac70bb828e4923f.js → f9cd068d184cab66dc33.js} +1 -1
  142. package/assets/esri/core/workers/chunks/{dff2df259f140b7d97a9.js → fd88e07cba5964f80e9e.js} +1 -1
  143. package/assets/esri/core/workers/chunks/{c9b16fd41cd59d452522.js → fdbe16e3b23e01655c0c.js} +1 -1
  144. package/assets/esri/core/workers/chunks/{063905fbf9a0c6586949.js → ffdba51e7256ebf8ebd3.js} +1 -1
  145. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  146. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  147. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  148. package/assets/esri/themes/base/widgets/_Editor.scss +35 -2
  149. package/assets/esri/themes/base/widgets/_FeatureTable.scss +2 -0
  150. package/assets/esri/themes/dark/main.css +1 -1
  151. package/assets/esri/themes/light/main.css +1 -1
  152. package/assets/esri/themes/light/view.css +1 -1
  153. package/chunks/Envelope.js +1 -1
  154. package/chunks/Geometry.js +1 -1
  155. package/chunks/MultiPathImpl.js +1 -1
  156. package/chunks/Point2D.js +1 -1
  157. package/chunks/UnitFactory.js +1 -1
  158. package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
  159. package/chunks/arcgis-knowledge-client-core.js +1 -1
  160. package/chunks/containsOperator.js +1 -1
  161. package/chunks/densifyOperator.js +1 -1
  162. package/chunks/differenceOperator.js +1 -1
  163. package/chunks/intersectsOperator.js +1 -1
  164. package/chunks/persistableUrlUtils.js +1 -1
  165. package/config.js +1 -1
  166. package/core/XHRAdapter.js +1 -1
  167. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  168. package/core/quantityFormatUtils.js +1 -1
  169. package/core/unitFormatUtils.js +1 -1
  170. package/core/unitUtils.js +1 -1
  171. package/editing/fieldUtils.js +5 -0
  172. package/geometry/Extent.js +1 -1
  173. package/geometry/Geometry.js +1 -1
  174. package/geometry/Mesh.js +1 -1
  175. package/geometry/Point.js +1 -1
  176. package/geometry/SpatialReference.js +1 -1
  177. package/geometry/ellipsoidUtils.js +1 -1
  178. package/geometry/operators/support/jsonConverter.js +1 -1
  179. package/geometry/support/MeshTransform.js +1 -1
  180. package/geometry/support/axisAngleDegrees.js +1 -1
  181. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  182. package/geometry/support/meshUtils/rotate.js +1 -1
  183. package/geometry/support/meshUtils/scale.js +1 -1
  184. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  185. package/geometry/support/plane.js +1 -1
  186. package/geometry/support/polygonUtils.js +1 -1
  187. package/interfaces.d.ts +114 -11
  188. package/kernel.js +1 -1
  189. package/layers/KnowledgeGraphLayer.js +1 -1
  190. package/layers/Layer.js +1 -1
  191. package/layers/LinkChartLayer.js +1 -1
  192. package/layers/MapNotesLayer.js +1 -1
  193. package/layers/graphics/data/QueryEngine.js +1 -1
  194. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  195. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  196. package/layers/save/groupLayerUtils.js +1 -1
  197. package/layers/save/imageryUtils.js +1 -1
  198. package/layers/save/streamLayerUtils.js +1 -1
  199. package/layers/support/DateTimeFieldFormat.js +1 -1
  200. package/layers/support/FieldFormat.js +1 -1
  201. package/layers/support/LayerLoadContext.js +1 -1
  202. package/layers/support/NumberFieldFormat.js +1 -1
  203. package/layers/support/arcgisLayerUrl.js +1 -1
  204. package/layers/support/arcgisLayers.js +1 -1
  205. package/layers/support/fetchService.js +1 -1
  206. package/layers/support/fieldFormatUtils.js +1 -1
  207. package/layers/support/fieldUtils.js +1 -1
  208. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  209. package/layers/video/VideoCameraSensorModel.js +1 -1
  210. package/networks/support/UNTraceConfiguration.js +1 -1
  211. package/package.json +1 -1
  212. package/popup/ExpressionInfo.js +1 -1
  213. package/popup/FieldInfo.js +1 -1
  214. package/popup/content/AttachmentsContent.js +1 -1
  215. package/popup/content/BarChartMediaInfo.js +1 -1
  216. package/popup/content/ColumnChartMediaInfo.js +1 -1
  217. package/popup/content/Content.js +1 -1
  218. package/popup/content/CustomContent.js +1 -1
  219. package/popup/content/ExpressionContent.js +1 -1
  220. package/popup/content/FieldsContent.js +1 -1
  221. package/popup/content/ImageMediaInfo.js +1 -1
  222. package/popup/content/LineChartMediaInfo.js +1 -1
  223. package/popup/content/MediaContent.js +1 -1
  224. package/popup/content/PieChartMediaInfo.js +1 -1
  225. package/popup/content/RelationshipContent.js +1 -1
  226. package/popup/content/TextContent.js +1 -1
  227. package/popup/content/UtilityNetworkAssociationsContent.js +1 -1
  228. package/popup/content/mixins/ChartMediaInfo.js +1 -1
  229. package/popup/content/mixins/MediaInfo.js +1 -1
  230. package/popup/content.js +1 -1
  231. package/popup/support/FieldInfoFormat.js +1 -1
  232. package/portal/support/layersLoader.js +1 -1
  233. package/request/cors.js +5 -0
  234. package/request/loadImage.js +5 -0
  235. package/request/preferredHosts.js +5 -0
  236. package/request/process.js +5 -0
  237. package/request/queue.js +5 -0
  238. package/request/serviceJSON.js +5 -0
  239. package/request.js +1 -1
  240. package/rest/geometryService/utils.js +1 -1
  241. package/rest/knowledgeGraphService.d.ts +1 -0
  242. package/support/getDefaultUnitForView.js +1 -1
  243. package/support/popupUtils.js +1 -1
  244. package/support/revision.js +1 -1
  245. package/symbols/support/symbolUtils.js +1 -1
  246. package/time/TimeExtent.js +1 -1
  247. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +5 -0
  248. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +5 -0
  249. package/views/2d/analysis/AreaMeasurement/AreaMeasurementLabelVisualization.js +5 -0
  250. package/views/2d/analysis/AreaMeasurement/AreaMeasurementManipulatorVisualization.js +5 -0
  251. package/views/2d/analysis/AreaMeasurement/AreaMeasurementSketchVisualization.js +5 -0
  252. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +5 -0
  253. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +5 -0
  254. package/views/2d/analysis/analysisViewModuleImportUtils.js +1 -1
  255. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  256. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  257. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  258. package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
  259. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  260. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  261. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  262. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  263. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  264. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  265. package/views/3d/environment/CloudsRenderer.js +1 -1
  266. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  267. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  268. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  269. package/views/3d/layers/FlowSubView3D.js +1 -1
  270. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  271. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  272. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  273. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  274. package/views/3d/layers/i3s/I3SDataRequester.js +1 -1
  275. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  276. package/views/3d/support/StreamTextureCollection.js +1 -1
  277. package/views/3d/support/flow/geometryUtils.js +1 -1
  278. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  279. package/views/3d/terrain/TerrainSurface.js +1 -1
  280. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  281. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  282. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  283. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  284. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  285. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  286. package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
  287. package/views/3d/webgl-engine/lib/TextureBackedBuffer/ManagedTextureBackedBuffer.js +1 -1
  288. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  289. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  290. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  291. package/views/View2D.js +1 -1
  292. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  293. package/views/analysis/ElevationProfile/constants.js +1 -1
  294. package/views/analysis/ElevationProfile/elevationProfileErrors.js +1 -1
  295. package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
  296. package/views/draw/DrawOperation.js +1 -1
  297. package/views/draw/support/tooltipUtils.js +1 -1
  298. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  299. package/views/interactive/tooltip/fields/TooltipField.js +1 -1
  300. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  301. package/views/magnifier/resources.js +1 -1
  302. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  303. package/webdoc/support/webdocSaveUtils.js +1 -1
  304. package/widgets/BasemapLayerList.js +1 -1
  305. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  306. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  307. package/widgets/Editor/EditorViewModel.js +1 -1
  308. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  309. package/widgets/Editor/MergeFeaturesWorkflowData.js +1 -1
  310. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  311. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  312. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  313. package/widgets/Editor/UpdateWorkflow.js +1 -1
  314. package/widgets/Editor/Workflow.js +1 -1
  315. package/widgets/Editor/components/FeatureList.js +1 -1
  316. package/widgets/Editor/components/MergeFeaturesList.js +5 -0
  317. package/widgets/Editor/components/Notices.js +1 -1
  318. package/widgets/Editor/components/PanelContent.js +1 -1
  319. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  320. package/widgets/Editor/css.js +1 -1
  321. package/widgets/Editor/support/EditorItem.js +1 -1
  322. package/widgets/Editor/support/SketchController.js +1 -1
  323. package/widgets/Editor/support/errors.js +1 -1
  324. package/widgets/Editor/support/mergeFeaturesUtils.js +1 -1
  325. package/widgets/Editor/support/splitFeatureUtils.js +1 -1
  326. package/widgets/Editor/workflowUtils.js +1 -1
  327. package/widgets/Editor.js +1 -1
  328. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  329. package/widgets/FeatureForm/FieldInput.js +1 -1
  330. package/widgets/FeatureForm.js +1 -1
  331. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  332. package/widgets/FeatureTable/FieldColumn.js +1 -1
  333. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  334. package/widgets/LayerList.js +1 -1
  335. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  336. package/widgets/Legend/support/utils.js +1 -1
  337. package/widgets/PanoramicVideoViewer.js +1 -1
  338. package/widgets/TimeSlider.js +1 -1
  339. package/widgets/support/FilterCondition.js +1 -1
  340. package/assets/esri/core/workers/chunks/0200637e0503556a3b97.js +0 -1
  341. package/assets/esri/core/workers/chunks/022c854eff2c2c2aed6b.js +0 -1
  342. package/assets/esri/core/workers/chunks/066a0ea67688361e85a5.js +0 -1
  343. package/assets/esri/core/workers/chunks/06f75c5b6b50934d72a6.js +0 -1
  344. package/assets/esri/core/workers/chunks/15f969836d63c7fe2d9d.js +0 -1
  345. package/assets/esri/core/workers/chunks/2857bcb68df874e9aa62.js +0 -1
  346. package/assets/esri/core/workers/chunks/2a9fc0301268ff909246.js +0 -1
  347. package/assets/esri/core/workers/chunks/2ddcf3cea0efe4052618.js +0 -1
  348. package/assets/esri/core/workers/chunks/2e8a4df83c43f86d7361.js +0 -1
  349. package/assets/esri/core/workers/chunks/2f2e4f81f3daa3fb8527.js +0 -1
  350. package/assets/esri/core/workers/chunks/3109f0a6914e7be088ed.js +0 -1
  351. package/assets/esri/core/workers/chunks/31bb1ee9370c2753ce9d.js +0 -1
  352. package/assets/esri/core/workers/chunks/329fccd7f5cb8401e0c3.js +0 -1
  353. package/assets/esri/core/workers/chunks/38f6b9288c82dac9a800.js +0 -1
  354. package/assets/esri/core/workers/chunks/3b1848713ee25f750242.js +0 -1
  355. package/assets/esri/core/workers/chunks/42a1e71d09e8583a7327.js +0 -1
  356. package/assets/esri/core/workers/chunks/44f27eac92c5ccc57e12.js +0 -1
  357. package/assets/esri/core/workers/chunks/4941bfd3aae7f6bdac97.js +0 -1
  358. package/assets/esri/core/workers/chunks/4bd2cc65f7db0d261543.js +0 -1
  359. package/assets/esri/core/workers/chunks/4fa230dc6e5e87b0dec1.js +0 -1
  360. package/assets/esri/core/workers/chunks/4fbe2a8d742065cbaea3.js +0 -1
  361. package/assets/esri/core/workers/chunks/4fe4feeb251f2916a339.js +0 -1
  362. package/assets/esri/core/workers/chunks/55eb6a0f1e4569a65f2a.js +0 -1
  363. package/assets/esri/core/workers/chunks/57e04e2d8721bbdc029a.js +0 -1
  364. package/assets/esri/core/workers/chunks/591e459f9fce34f519ca.js +0 -1
  365. package/assets/esri/core/workers/chunks/59514624daf188a8030f.js +0 -1
  366. package/assets/esri/core/workers/chunks/5c09d98b41f71a036e2a.js +0 -1
  367. package/assets/esri/core/workers/chunks/605b9643b1baeff16149.js +0 -1
  368. package/assets/esri/core/workers/chunks/6293e33f304c4952f88c.js +0 -1
  369. package/assets/esri/core/workers/chunks/6e25ef5ad6d6b3f88343.js +0 -1
  370. package/assets/esri/core/workers/chunks/759321045c264bc6964e.js +0 -1
  371. package/assets/esri/core/workers/chunks/7e3f27ebf366d4266350.js +0 -1
  372. package/assets/esri/core/workers/chunks/826072cfc0ac8e36f03c.js +0 -1
  373. package/assets/esri/core/workers/chunks/8ce608013b353155ee5a.js +0 -1
  374. package/assets/esri/core/workers/chunks/8d9d3797c6d62fdfff9d.js +0 -1
  375. package/assets/esri/core/workers/chunks/9b0c2f4311fe9bca370a.js +0 -1
  376. package/assets/esri/core/workers/chunks/9c48d8d17831aa57f8a4.js +0 -1
  377. package/assets/esri/core/workers/chunks/9f21436016ff7a899e79.js +0 -1
  378. package/assets/esri/core/workers/chunks/9f28b2800945903bc165.js +0 -1
  379. package/assets/esri/core/workers/chunks/a27e74117c37f3efcbca.js +0 -1
  380. package/assets/esri/core/workers/chunks/a41ba05c09a59d1eb35f.js +0 -1
  381. package/assets/esri/core/workers/chunks/a5a67216e0d0cee95a55.js +0 -1
  382. package/assets/esri/core/workers/chunks/a93ebd076bc55aa6eab0.js +0 -1
  383. package/assets/esri/core/workers/chunks/aaed35a6414859233678.js +0 -1
  384. package/assets/esri/core/workers/chunks/acd0564ad1544f452f3f.js +0 -1
  385. package/assets/esri/core/workers/chunks/b0f43191a431c9de16e5.js +0 -1
  386. package/assets/esri/core/workers/chunks/b320bb76c7e9998fe53b.js +0 -1
  387. package/assets/esri/core/workers/chunks/ba4571d2637a74a59552.js +0 -1
  388. package/assets/esri/core/workers/chunks/c4090a60d149a5962179.js +0 -1
  389. package/assets/esri/core/workers/chunks/c61c61dac1e8d6188749.js +0 -1
  390. package/assets/esri/core/workers/chunks/c84caf81bfaa4a8b5aa1.js +0 -1
  391. package/assets/esri/core/workers/chunks/c8c8cf43fd640d2f5cb1.js +0 -1
  392. package/assets/esri/core/workers/chunks/d28670cb11164e318e45.js +0 -1
  393. package/assets/esri/core/workers/chunks/d48af7bc06b4bb176534.js +0 -1
  394. package/assets/esri/core/workers/chunks/d56ac52a5288e06365e7.js +0 -1
  395. package/assets/esri/core/workers/chunks/ddca92e18e96ea1c9d89.js +0 -1
  396. package/assets/esri/core/workers/chunks/ded9747ae04ab889d52a.js +0 -1
  397. package/assets/esri/core/workers/chunks/df5afa06c6deb6b40109.js +0 -1
  398. package/assets/esri/core/workers/chunks/df8279e1baf378faf85f.js +0 -1
  399. package/assets/esri/core/workers/chunks/e3434f91f47f551d9e02.js +0 -1
  400. package/assets/esri/core/workers/chunks/eb6c3dd440ede4adf603.js +0 -1
  401. package/assets/esri/core/workers/chunks/edc671b9b83c8e19cb42.js +0 -1
  402. package/assets/esri/core/workers/chunks/f141c9f7f0d9b2322bf6.js +0 -1
  403. package/assets/esri/core/workers/chunks/f7a1f48c53422c6e2028.js +0 -1
  404. package/assets/esri/core/workers/chunks/f7f002ea5ff5fe7f6249.js +0 -1
  405. package/assets/esri/core/workers/chunks/f8e889be4b45f6f0667e.js +0 -1
  406. package/assets/esri/core/workers/chunks/fbd796c88f07bb6755dc.js +0 -1
  407. package/assets/esri/core/workers/chunks/fec3897ed7e8691387ed.js +0 -1
  408. package/processRequest.js +0 -5
  409. package/requestQueue.js +0 -5
  410. package/support/requestPresets.js +0 -5
  411. package/support/requestUtils.js +0 -5
  412. /package/{rest/support → request}/ImageWithType.js +0 -0
  413. /package/{requestConfig.js → request/config.js} +0 -0
  414. /package/{support/requestImageUtils.js → request/image.js} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as r,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{idToName as y}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Extent.js";import m from"../geometry/Point.js";import f from"../geometry/Polyline.js";import{polygonCentroidPoint as w}from"../geometry/support/centroid.js";import L from"./Layer.js";import{convertFromGeometry as b}from"./graphics/featureConversionUtils.js";import{systemOidFieldName as M,systemOriginIdFieldName as k,systemDestinationIdFieldName as C,systemLayoutGeometryFieldName as T,systemAggregationCountFieldName as N}from"./knowledgeGraph/constants.js";import{IdealEdgeLengthTypeOptions as D}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as x}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import v from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{createCapabilitiesFromKnowledgeGraph as I,initializeLayersFromClientData as E}from"./knowledgeGraph/layerUtils.js";import S from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as _,getRelationshipEndNodeIds as A}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as R}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as G}from"./mixins/ScaleRangeLayer.js";import{url as z}from"./support/commonProperties.js";import{LCChronologicalLayout as O,LCSimpleLayout as P,LCSmartTreeLayout as F,LCRadialTreeLayout as B,LCHierarchicalLayout as U,LCCommunityLayout as Q,LCForceDirectedLayout as W,load as $}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as H}from"../rest/knowledgeGraphService.js";let K=class extends(j(R(G(s(L))))){constructor(e){if(super(e),this.url=null,this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"organic-standard"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(v)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new g({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(v)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new i("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d(()=>this.layers.concat(this.tables),(e,t)=>this._handleSublayersChange(e,t),p))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach((i,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),a.push(r)):(n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))}):(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new x({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=o,this.dataManager=s}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await E(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(e=>{e.useAllData=!1}),await this._initializeDiagram(),this.layers.forEach(a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise(e=>{a.on("layerview-create",()=>{e(null)})}))}),this.tables.forEach(e=>{t.push(e.refreshCachedQueryEngine())}),await Promise.all(t)};return this.addResolvingPromise(new Promise(i=>{H(this.url).then(async n=>{n.dataModel.entityTypes?.forEach(e=>{e.name&&this._graphTypeLookup.set(e.name,e)}),n.dataModel.relationshipTypes?.forEach(e=>{e.name&&this._graphTypeLookup.set(e.name,e)});const s=this.linkChart?.linkChartProperties;if(6===s?.originIdOf("entitiesUrl")&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:s?.entitiesUrl,relationshipsUrl:s?.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(n.dataModel),this.initializationLinkChartConfig={layoutSettings:s?.layoutSettings??void 0,layoutMode:_(s.layoutType)}),this._initializeLayerProperties({knowledgeGraph:n,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach(e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataPreloadedInLocalCache){const e=S.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){o(this.dataManager.sublayerCaches,t,()=>new Map).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then(async()=>{r(e),await a()}))}i(null)})})),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):n.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}get linkChart(){return this.parent}get sublayerCapabilities(){return I(this.knowledgeGraph)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await A(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter(e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async createSublayerForNamedType(e){await this.load();const t=this._graphTypeLookup.get(e);if(!t)throw new i("knowledge-graph:missing-type","The specified type does not exist in the knowledge graph.");if(this.dataManager.sublayerCaches.has(e))throw new i("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),o(this.sublayerIdsCache,e,()=>new Set);const a=this._createSublayer(t);return"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.set(e,{useAllData:!1,members:new Map}),a.geometryType?this.layers.push(a):this.tables.push(a),await E(this,[e]),this._refreshNamedTypes(),a}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&n.push(r);if(t){const e=new Set,t=[];for(const a of n)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const r of n)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);const o=a?void 0:this.getCurrentNodeLocations();await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:o}),n.length>0&&(this.membershipModified=!0);const s=[];return this.layers.forEach(e=>{s.push(e.refreshCachedQueryEngine())}),await Promise.all(s),this._refreshNamedTypes(),n}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter(e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)),await this._handleNewRecords(a,t),i.length>0&&(this.membershipModified=!0),r(t?.signal)}catch(i){throw l(i)&&a.length>0&&await this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.layers.length||0===this.originIdOf("tables")?0===this.originIdOf("layers")?this._createSublayers(e,this.layers,e=>!!e.geometryType):this._updateSublayers(e,this.layers):this.layers=new a,this.tables.length||0===this.originIdOf("layers")?0===this.originIdOf("tables")?this._createSublayers(e,this.tables,e=>!e.geometryType):this._updateSublayers(e,this.tables):this.tables=new a,this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{const a=o(this.sublayerIdsCache,t,()=>new Set);e.members?.forEach(({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}})})}async calculateLinkChartLayout(e="organic-standard",t){const a=[],s=[],l=[];this.dataManager.sublayerCaches.forEach((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach(e=>{a.push({typeName:t,feature:e})}):this.dataManager.relationshipTypeNames.has(t)&&e.forEach(e=>{s.push({typeName:t,feature:e})})}),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,p=new Map,c=new Map,u=new Map,y=new Uint8Array(a.length),L=new Float64Array(a.length),D=new Float64Array(a.length),x=new Float64Array(a.length),v=new Float64Array(a.length),I=new Uint32Array(s.length),E=new Uint32Array(s.length),S=new Float64Array(s.length),_=new Float64Array(s.length),A=[],R="organic-standard";let j=!1;const G=new g({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let z,H="organic-standard",K=0,J=0;const V=O.apply;switch(H="geographic-organic-standard"===e?R:e,H){case"organic-standard":z=W.apply;break;case"organic-community":z=Q.apply;break;case"hierarchical-bottom-to-top":z=U.apply;break;case"radial-root-centric":z=B.apply;break;case"tree-left-to-right":z=F.apply;break;default:z=P.apply}let q=!1;a.forEach(({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[M])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?y[K]=2:y[K]=0;const n=t.lockedNodeLocations.get(i.attributes[M]);L[K]=n.x,D[K]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[K]=2;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[K]=t?.x,D[K]=t?.y;break;case"esriGeometryPolygon":{const a=w(t);e=a?m.fromJSON(a):null,null!=e?.x&&null!=e?.y?(L[K]=e.x,D[K]=e.y):y[K]=1;break}case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[K]=e.x,D[K]=e.y):y[K]=1;break;default:y[K]=1}(null==L[K]||null==D[K]||Number.isNaN(L[K])||Number.isNaN(D[K]))&&(y[K]=1,L[K]=0,D[K]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!q&&t?.lockedNodeLocations?.has(i.attributes[M])&&(q=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;x[K]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;v[K]=r?new Date(r).getTime():NaN,L[K]=0,D[K]=0,y[K]=1}else y[K]=1,L[K]=0,D[K]=0;u.set(i.attributes[M],K),A[K]={feature:i,typeName:a},K++}),q&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let X=!1;const Y=new Map;s.forEach(a=>{const i=a.feature.attributes[k],n=a.feature.attributes[C],o=u.get(i),s=u.get(n),r=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?r?.startField:null,d=h?a.feature.attributes[h]:null,p=r?.endField,c=p?a.feature.attributes[p]:null;if(void 0!==o&&void 0!==s){let t=i+"-"+n;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+c);const r=Y.get(t),h=r?.has(a.typeName);h||(I[J]=o,E[J]=s,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(S[J]=d?new Date(d).getTime():NaN,_[J]=c?new Date(c).getTime():NaN),void 0===r?Y.set(t,new Map([[a.typeName,J]])):r.set(a.typeName,J),J++),l.push(a)}else X=!0,this.relationshipLinkChartDiagramLookup.set(i,null)}),X&&n.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const Z=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),ee=this._convertValidatedOrganicSettingsToCalculationSettings(Z);await $();let te=1,ae=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:te,links:ae,graphics:a}=V(()=>t?.signal?.aborted??!1,y,L,D,x,v,I.subarray(0,J),E.subarray(0,J),S.subarray(0,J),_.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),0===te&&(this.chronologicalAuxiliaryGraphics=a)}else({status:te,links:ae}=z(()=>t?.signal?.aborted??!1,y,L,D,I.subarray(0,J),E.subarray(0,J),ee.computationBudgetTime,ee.idealEdgeLengthMultiplier,ee.repulsionRadiusMultiplier));if(r(t?.signal),1===te)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(2===te)throw h();for(let i=0;i<A.length;i++){if(D[i]>84.9999?D[i]=84.9999:D[i]<-84.9999&&(D[i]=-84.9999),L[i]>179.9999?L[i]=179.9999:L[i]<-179.9999&&(L[i]=-179.9999),A[i].feature.attributes[T]=new m(L[i],D[i]),d.has(A[i].typeName)){const e=d.get(A[i].typeName);e?.set(A[i].feature.attributes[M],A[i].feature)}else{const e=new Map;e.set(A[i].feature.attributes[M],A[i].feature),d.set(A[i].typeName,e)}c.set(A[i].feature.attributes[M],A[i].feature);const e=b(A[i].feature.attributes[T]);this.entityLinkChartDiagramLookup.set(A[i].feature.attributes[M],A[i].feature.attributes[T]?e:null);const t=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,A[i].typeName,()=>({useAllData:!1,members:new Map}));o(t.members,A[i].feature.attributes[M],()=>({id:A[i].feature.attributes[M],linkChartLocation:void 0})).linkChartLocation=A[i].feature.attributes[T];const{x:a,y:n}=A[i].feature.attributes[T];if(j)G.xmin=Math.min(G.xmin,a),G.xmax=Math.max(G.xmax,a),G.ymin=Math.min(G.ymin,n),G.ymax=Math.max(G.ymax,n);else{const e=1e-7;G.xmin=a-e,G.xmax=a+e,G.ymin=n-e,G.ymax=n+e,j=!0}}if(this.linkChartExtent.xmin=G.xmin,this.linkChartExtent.xmax=G.xmax,this.linkChartExtent.ymin=G.ymin,this.linkChartExtent.ymax=G.ymax,!ae)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ie=new Map,ne=new Map,oe=new Map,se=new Set;for(let i=0;i<l.length;i++){const a=[],s=l[i],r=s.feature.attributes[k],h=s.feature.attributes[C];let d=r+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(s.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?s.feature.attributes[a]:null,n=e?.endField;d+="-"+i+"-"+(n?s.feature.attributes[n]:null)}const y=Y.get(d).get(s.typeName),g=0===y?0:ae?.vertexEndIndex[y-1];if(!se.has(y)){if(se.add(y),2===ae.types[y]){const e=[ae.vertices[2*g],ae.vertices[2*g+1]],t=[ae.vertices[2*(g+1)],ae.vertices[2*(g+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[i[0]-e[0],i[1]-e[1]],o=[i[0]+n[1],i[1]-n[0]],s=[i[0]-n[1],i[1]+n[0]];a.push(e),a.push(o),a.push(t),a.push(s),a.push(e)}else{if(0!==ae.types[y]){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<ae.vertexEndIndex[y];e++)a.push([ae.vertices[2*e],ae.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=A[u.get(r)]?.feature.attributes[T],t=A[u.get(h)]?.feature.attributes[T];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);ie.has(d)?ie.get(d).push(a):ie.set(d,[a])}const m=ie.get(d);ne.has(d)||(ne.set(d,new Map),oe.set(d,new Map));const w=ne.get(d),L=oe.get(d);w.has(s.typeName)||(w.set(s.typeName,m.shift()),L.set(s.typeName,0));const N=w.get(s.typeName);L.set(s.typeName,L.get(s.typeName)+1);const D=new f({paths:[N]});if(s.feature.attributes[T]=D,p.has(s.typeName)){const e=p.get(s.typeName);e?.set(s.feature.attributes[M],s.feature)}else{const e=new Map;e.set(s.feature.attributes[M],s.feature),p.set(s.typeName,e)}c.set(s.feature.attributes[M],s.feature);const x=b(s.feature.attributes[T]);this.relationshipLinkChartDiagramLookup.set(s.feature.attributes[M],s.feature.attributes[T]?x:null);const v=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,s.typeName,()=>({useAllData:!1,members:new Map}));o(v.members,s.feature.attributes[M],()=>({id:s.feature.attributes[M],linkChartLocation:void 0})).linkChartLocation=x}for(const i of l)i.feature.attributes[N]=oe.get(i.feature.attributes[k]+"-"+i.feature.attributes[C])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:t?.layoutSettings?.clone()},{nodes:d,links:p,idMap:c}}async applyNewLinkChartLayout(e="organic-standard",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach(e=>{a.push(e.refreshCachedQueryEngine())}),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach(t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new m({x:i.x,y:i.y})))});return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach(e=>{t.push(e.refreshCachedQueryEngine())}),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),r(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,n,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),r(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="organic-standard",t){const a=new Map;this.layers.forEach(e=>{a.set(e.objectType.name,e.timeInfo)}),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t}),this.linkChart?.handleChronologicalOverlay()}async _handleNewRecords(e,t){const a=new Set,i=[],n=this.layers.concat(this.tables);for(const r of e){if(!this._graphTypeLookup.has(r.typeName))continue;!1===n.some(e=>e.objectType.name===r.typeName)&&(this.dataManager.sublayerCaches.set(r.typeName,new Map),a.add(r.typeName));o(this.sublayerIdsCache,r.typeName,()=>new Set).add(r.id),i.push(r)}this.dataManager.addToLayer(i);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t)}}await E(this,Array.from(a),t),await this.dataManager.refreshCacheContent(e.map(e=>e.id),void 0,void 0,void 0,t);const s={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[o,r]of this.entityLinkChartDiagramLookup.entries())r&&s.lockedNodeLocations.set(o,new m(r.coords[0],r.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,s)}_createSublayers(e,t,a){e.forEach(e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)})}_updateSublayers(e,t){t.forEach(t=>{t.parentCompositeLayer=this;const a=e.find(e=>e.type===t.graphType&&e.name===t.graphTypeName);a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))})}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=3&&e<7}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{e?.members?.forEach(e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)})}),this.memberRelationshipTypes.forEach(e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach(e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[C]);if(t&&a){const i=b(new f({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[M],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[M],null)})})):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig}):await this._calculateLayoutWithSublayerTimeInfo("organic-standard",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateOrganicLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(D).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;const{computationBudgetTime:h,autoRepulsionRadius:d,repulsionRadiusMultiplier:p,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:u,idealEdgeLengthType:y}=t;return o(h)?l.computationBudgetTime=h:h&&n.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),l.autoRepulsionRadius=d,!d&&i(p)?l.repulsionRadiusMultiplier=p:d||(l.autoRepulsionRadius=!0,n.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting")),"geographic-organic-standard"===e&&(s(y)?l.idealEdgeLengthType=y:void 0!==y&&n.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===y&&r(c)?l.absoluteIdealEdgeLength=c:"absolute-value"===y&&void 0!==c?n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===y&&r(u)?l.multiplicativeIdealEdgeLength=u:"multiplier"===y&&void 0!==u&&n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertValidatedOrganicSettingsToCalculationSettings(e){let t=e.idealEdgeLengthType===D.ABSOLUTE?e.absoluteIdealEdgeLength:e.multiplicativeIdealEdgeLength;return e.idealEdgeLengthType===D.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier&&!e.autoRepulsionRadius?e.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new v({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach(e=>{e.parent=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this}),e.on("after-remove",({item:e})=>{e.parent=null})],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map(e=>e.name).concat((e.relationshipTypes??[]).map(e=>e.name))),i=new Set((e.entityTypes??[]).map(e=>e.name)),o=new Set((e.relationshipTypes??[]).map(e=>e.name));if(this.layers){for(const a of this.layers)!a.graphType&&t.has(a.graphTypeName)&&(a.graphType=i.has(a.graphTypeName)?"entity":"relationship");const e=this.layers.filter(e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):o.has(e.graphTypeName)));this.setAtOrigin("layers",e,y(this.originIdOf("layers")))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map(e=>e.graphTypeName)??[],a=this.layers.map(e=>e.graphTypeName).concat(t);for(const n of a)e.has(n)||this._originalInclusionList.namedTypeDefinitions.set(n,{useAllData:!1,members:new Map});const i=[];for(const o of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(o)||(n.getLogger(this).warn(`A named type, ${o}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(o));for(const n of i)this._originalInclusionList.namedTypeDefinitions.delete(n)}}};e([c(z)],K.prototype,"url",void 0),e([c()],K.prototype,"dataPreloadedInLocalCache",void 0),e([c()],K.prototype,"initializationLinkChartConfig",void 0),e([c()],K.prototype,"membershipModified",void 0),e([c()],K.prototype,"dataManager",void 0),e([c()],K.prototype,"initializationInclusionModeDefinition",null),e([c()],K.prototype,"knowledgeGraph",void 0),e([c({type:a.ofType(v),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([c({readOnly:!0})],K.prototype,"linkChart",null),e([c()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([c()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([c()],K.prototype,"linkChartExtent",void 0),e([c()],K.prototype,"memberEntityTypes",void 0),e([c()],K.prototype,"memberRelationshipTypes",void 0),e([c({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([c()],K.prototype,"sublayerCapabilities",null),e([c()],K.prototype,"sublayerIdsCache",void 0),e([c({type:a.ofType(v),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([c({json:{read:!1}})],K.prototype,"type",void 0),e([c({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const J=K;export{J as default};
5
+ import{__decorate as e}from"tslib";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as r,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{idToName as y}from"../core/accessorSupport/PropertyOrigin.js";import g from"../geometry/Extent.js";import m from"../geometry/Point.js";import f from"../geometry/Polyline.js";import{polygonCentroidPoint as w}from"../geometry/support/centroid.js";import L from"./Layer.js";import{convertFromGeometry as b}from"./graphics/featureConversionUtils.js";import{systemOidFieldName as M,systemOriginIdFieldName as k,systemDestinationIdFieldName as C,systemLayoutGeometryFieldName as T,systemAggregationCountFieldName as N}from"./knowledgeGraph/constants.js";import{IdealEdgeLengthTypeOptions as D}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as x}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import v from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{createCapabilitiesFromKnowledgeGraph as I,initializeLayersFromClientData as E}from"./knowledgeGraph/layerUtils.js";import S from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as _,getRelationshipEndNodeIds as A}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as R}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as G}from"./mixins/ScaleRangeLayer.js";import{url as z}from"./support/commonProperties.js";import{LCChronologicalLayout as O,LCSimpleLayout as P,LCSmartTreeLayout as F,LCRadialTreeLayout as B,LCHierarchicalLayout as U,LCCommunityLayout as Q,LCForceDirectedLayout as W,load as $}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as H}from"../rest/knowledgeGraphService.js";let K=class extends(j(R(G(s(L))))){constructor(e){if(super(e),this.url=null,this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"organic-standard"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(v)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new g({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(v)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new i("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d(()=>this.layers.concat(this.tables),(e,t)=>this._handleSublayersChange(e,t),p))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach((i,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),a.push(r)):(n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))}):(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new x({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=o,this.dataManager=s}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await E(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(e=>{e.useAllData=!1}),await this._initializeDiagram(),this.layers.forEach(a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise(e=>{a.on("layerview-create",()=>{e(null)})}))}),this.tables.forEach(e=>{t.push(e.refreshCachedQueryEngine())}),await Promise.all(t)};return this.addResolvingPromise(new Promise(i=>{H(this.url).then(async n=>{n.dataModel.entityTypes?.forEach(e=>{e.name&&this._graphTypeLookup.set(e.name,e)}),n.dataModel.relationshipTypes?.forEach(e=>{e.name&&this._graphTypeLookup.set(e.name,e)});const s=this.linkChart?.linkChartProperties;if(6===s?.originIdOf("entitiesUrl")&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:s?.entitiesUrl,relationshipsUrl:s?.relationshipsUrl},{signal:e?.signal}),this._alignLayersDataModelAndInclusionDefinition(n.dataModel),this.initializationLinkChartConfig={layoutSettings:s?.layoutSettings??void 0,layoutMode:_(s.layoutType)}),this._initializeLayerProperties({knowledgeGraph:n,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach(e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach(e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataPreloadedInLocalCache){const e=S.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){o(this.dataManager.sublayerCaches,t,()=>new Map).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then(async()=>{r(e),await a()}))}i(null)})})),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):n.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}get linkChart(){return this.parent}get sublayerCapabilities(){return I(this.knowledgeGraph)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await A(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter(e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async createSublayerForNamedType(e){await this.load();const t=this._graphTypeLookup.get(e);if(!t)throw new i("knowledge-graph:missing-type","The specified type does not exist in the knowledge graph.");if(this.dataManager.sublayerCaches.has(e))throw new i("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),o(this.sublayerIdsCache,e,()=>new Set);const a=this._createSublayer(t);return"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.set(e,{useAllData:!1,members:new Map}),a.geometryType?this.layers.push(a):this.tables.push(a),await E(this,[e]),this._refreshNamedTypes(),a}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&n.push(r);if(t){const e=new Set,t=[];for(const a of n)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const r of n)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);const o=a?void 0:this.getCurrentNodeLocations();await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:o}),n.length>0&&(this.membershipModified=!0);const s=[];return this.layers.forEach(e=>{s.push(e.refreshCachedQueryEngine())}),await Promise.all(s),this._refreshNamedTypes(),n}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter(e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)),await this._handleNewRecords(a,t),i.length>0&&(this.membershipModified=!0),r(t?.signal)}catch(i){throw l(i)&&a.length>0&&await this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.layers.length||0===this.originIdOf("tables")?0===this.originIdOf("layers")?this._createSublayers(e,this.layers,e=>!!e.geometryType):this._updateSublayers(e,this.layers):this.layers=new a,this.tables.length||0===this.originIdOf("layers")?0===this.originIdOf("tables")?this._createSublayers(e,this.tables,e=>!e.geometryType):this._updateSublayers(e,this.tables):this.tables=new a,this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{const a=o(this.sublayerIdsCache,t,()=>new Set);e.members?.forEach(({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}})})}async calculateLinkChartLayout(e="organic-standard",t){const a=[],s=[],l=[];this.dataManager.sublayerCaches.forEach((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach(e=>{a.push({typeName:t,feature:e})}):this.dataManager.relationshipTypeNames.has(t)&&e.forEach(e=>{s.push({typeName:t,feature:e})})}),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,p=new Map,c=new Map,u=new Map,y=new Uint8Array(a.length),L=new Float64Array(a.length),D=new Float64Array(a.length),x=new Float64Array(a.length),v=new Float64Array(a.length),I=new Uint32Array(s.length),E=new Uint32Array(s.length),S=new Float64Array(s.length),_=new Float64Array(s.length),A=[],R="organic-standard";let j=!1;const G=new g({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let z,H="organic-standard",K=0,J=0;const V=O.apply;switch(H="geographic-organic-standard"===e?R:e,H){case"organic-standard":z=W.apply;break;case"organic-community":z=Q.apply;break;case"hierarchical-bottom-to-top":z=U.apply;break;case"radial-root-centric":z=B.apply;break;case"tree-left-to-right":z=F.apply;break;default:z=P.apply}let q=!1;a.forEach(({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[M])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?y[K]=2:y[K]=0;const n=t.lockedNodeLocations.get(i.attributes[M]);L[K]=n.x,D[K]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[K]=2;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[K]=t?.x,D[K]=t?.y;break;case"esriGeometryPolygon":{const a=w(t);e=a?m.fromJSON(a):null,null!=e?.x&&null!=e?.y?(L[K]=e.x,D[K]=e.y):y[K]=1;break}case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[K]=e.x,D[K]=e.y):y[K]=1;break;default:y[K]=1}(null==L[K]||null==D[K]||Number.isNaN(L[K])||Number.isNaN(D[K]))&&(y[K]=1,L[K]=0,D[K]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!q&&t?.lockedNodeLocations?.has(i.attributes[M])&&(q=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;x[K]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;v[K]=r?new Date(r).getTime():NaN,L[K]=0,D[K]=0,y[K]=1}else y[K]=1,L[K]=0,D[K]=0;u.set(i.attributes[M],K),A[K]={feature:i,typeName:a},K++}),q&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let X=!1;const Y=new Map;s.forEach(a=>{const i=a.feature.attributes[k],n=a.feature.attributes[C],o=u.get(i),s=u.get(n),r=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?r?.startField:null,d=h?a.feature.attributes[h]:null,p=r?.endField,c=p?a.feature.attributes[p]:null;if(void 0!==o&&void 0!==s){let t=i+"-"+n;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+c);const r=Y.get(t),h=r?.has(a.typeName);h||(I[J]=o,E[J]=s,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(S[J]=d?new Date(d).getTime():NaN,_[J]=c?new Date(c).getTime():NaN),void 0===r?Y.set(t,new Map([[a.typeName,J]])):r.set(a.typeName,J),J++),l.push(a)}else X=!0,this.relationshipLinkChartDiagramLookup.set(i,null)}),X&&n.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const Z=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),ee=this._convertValidatedOrganicSettingsToCalculationSettings(Z);await $();let te=1,ae=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:te,links:ae,graphics:a}=V(()=>t?.signal?.aborted??!1,y,L,D,x,v,I.subarray(0,J),E.subarray(0,J),S.subarray(0,J),_.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),0===te&&(this.chronologicalAuxiliaryGraphics=a)}else({status:te,links:ae}=z(()=>t?.signal?.aborted??!1,y,L,D,I.subarray(0,J),E.subarray(0,J),ee.computationBudgetTime,ee.idealEdgeLengthMultiplier,ee.repulsionRadiusMultiplier));if(r(t?.signal),1===te)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(2===te)throw h();for(let i=0;i<A.length;i++){if(D[i]>84.9999?D[i]=84.9999:D[i]<-84.9999&&(D[i]=-84.9999),L[i]>179.9999?L[i]=179.9999:L[i]<-179.9999&&(L[i]=-179.9999),A[i].feature.attributes[T]=new m(L[i],D[i]),d.has(A[i].typeName)){const e=d.get(A[i].typeName);e?.set(A[i].feature.attributes[M],A[i].feature)}else{const e=new Map;e.set(A[i].feature.attributes[M],A[i].feature),d.set(A[i].typeName,e)}c.set(A[i].feature.attributes[M],A[i].feature);const e=b(A[i].feature.attributes[T]);this.entityLinkChartDiagramLookup.set(A[i].feature.attributes[M],A[i].feature.attributes[T]?e:null);const t=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,A[i].typeName,()=>({useAllData:!1,members:new Map}));o(t.members,A[i].feature.attributes[M],()=>({id:A[i].feature.attributes[M],linkChartLocation:void 0})).linkChartLocation=A[i].feature.attributes[T];const{x:a,y:n}=A[i].feature.attributes[T];if(j)G.xmin=Math.min(G.xmin,a),G.xmax=Math.max(G.xmax,a),G.ymin=Math.min(G.ymin,n),G.ymax=Math.max(G.ymax,n);else{const e=1e-7;G.xmin=a-e,G.xmax=a+e,G.ymin=n-e,G.ymax=n+e,j=!0}}if(this.linkChartExtent.xmin=G.xmin,this.linkChartExtent.xmax=G.xmax,this.linkChartExtent.ymin=G.ymin,this.linkChartExtent.ymax=G.ymax,!ae)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ie=new Map,ne=new Map,oe=new Map,se=new Set;for(let i=0;i<l.length;i++){const a=[],s=l[i],r=s.feature.attributes[k],h=s.feature.attributes[C];let d=r+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(s.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?s.feature.attributes[a]:null,n=e?.endField;d+="-"+i+"-"+(n?s.feature.attributes[n]:null)}const y=Y.get(d).get(s.typeName),g=0===y?0:ae?.vertexEndIndex[y-1];if(!se.has(y)){if(se.add(y),2===ae.types[y]){const e=[ae.vertices[2*g],ae.vertices[2*g+1]],t=[ae.vertices[2*(g+1)],ae.vertices[2*(g+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[i[0]-e[0],i[1]-e[1]],o=[i[0]+n[1],i[1]-n[0]],s=[i[0]-n[1],i[1]+n[0]];a.push(e),a.push(o),a.push(t),a.push(s),a.push(e)}else{if(0!==ae.types[y]){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<ae.vertexEndIndex[y];e++)a.push([ae.vertices[2*e],ae.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=A[u.get(r)]?.feature.attributes[T],t=A[u.get(h)]?.feature.attributes[T];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);ie.has(d)?ie.get(d).push(a):ie.set(d,[a])}const m=ie.get(d);ne.has(d)||(ne.set(d,new Map),oe.set(d,new Map));const w=ne.get(d),L=oe.get(d);w.has(s.typeName)||(w.set(s.typeName,m.shift()),L.set(s.typeName,0));const N=w.get(s.typeName);L.set(s.typeName,L.get(s.typeName)+1);const D=new f({paths:[N]});if(s.feature.attributes[T]=D,p.has(s.typeName)){const e=p.get(s.typeName);e?.set(s.feature.attributes[M],s.feature)}else{const e=new Map;e.set(s.feature.attributes[M],s.feature),p.set(s.typeName,e)}c.set(s.feature.attributes[M],s.feature);const x=b(s.feature.attributes[T]);this.relationshipLinkChartDiagramLookup.set(s.feature.attributes[M],s.feature.attributes[T]?x:null);const v=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,s.typeName,()=>({useAllData:!1,members:new Map}));o(v.members,s.feature.attributes[M],()=>({id:s.feature.attributes[M],linkChartLocation:void 0})).linkChartLocation=x}for(const i of l)i.feature.attributes[N]=oe.get(i.feature.attributes[k]+"-"+i.feature.attributes[C])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:t?.layoutSettings?.clone()},{nodes:d,links:p,idMap:c}}async applyNewLinkChartLayout(e="organic-standard",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach(e=>{a.push(e.refreshCachedQueryEngine())}),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach(t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new m({x:i.x,y:i.y})))});return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach(e=>{t.push(e.refreshCachedQueryEngine())}),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),r(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,n,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),r(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="organic-standard",t){const a=new Map;this.layers.forEach(e=>{a.set(e.objectType.name,e.timeInfo)}),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t}),this.linkChart?.handleChronologicalOverlay()}async _handleNewRecords(e,t){const a=new Set,i=[],n=this.layers.concat(this.tables);for(const r of e){if(!this._graphTypeLookup.has(r.typeName))continue;!1===n.some(e=>e.objectType.name===r.typeName)&&(this.dataManager.sublayerCaches.set(r.typeName,new Map),a.add(r.typeName));o(this.sublayerIdsCache,r.typeName,()=>new Set).add(r.id),i.push(r)}this.dataManager.addToLayer(i);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t)}}await E(this,Array.from(a),t),await this.dataManager.refreshCacheContent(e.map(e=>e.id),void 0,void 0,void 0,t);const s={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[o,r]of this.entityLinkChartDiagramLookup.entries())r&&s.lockedNodeLocations.set(o,new m(r.coords[0],r.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,s)}_createSublayers(e,t,a){e.forEach(e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)})}_updateSublayers(e,t){t.forEach(t=>{t.parentCompositeLayer=this;const a=e.find(e=>e.type===t.graphType&&e.name===t.graphTypeName);a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))})}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=3&&e<7}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,t)=>{e?.members?.forEach(e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)})}),this.memberRelationshipTypes.forEach(e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach(e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[C]);if(t&&a){const i=b(new f({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[M],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[M],null)})})):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig}):await this._calculateLayoutWithSublayerTimeInfo("organic-standard",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateOrganicLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(D).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;const{computationBudgetTime:h,autoRepulsionRadius:d,repulsionRadiusMultiplier:p,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:u,idealEdgeLengthType:y}=t;return o(h)?l.computationBudgetTime=h:h&&n.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),l.autoRepulsionRadius=d,!d&&i(p)?l.repulsionRadiusMultiplier=p:d||(l.autoRepulsionRadius=!0,n.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting")),"geographic-organic-standard"===e&&(s(y)?l.idealEdgeLengthType=y:void 0!==y&&n.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===y&&r(c)?l.absoluteIdealEdgeLength=c:"absolute-value"===y&&void 0!==c?n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===y&&r(u)?l.multiplicativeIdealEdgeLength=u:"multiplier"===y&&void 0!==u&&n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertValidatedOrganicSettingsToCalculationSettings(e){let t=e.idealEdgeLengthType===D.ABSOLUTE?e.absoluteIdealEdgeLength:e.multiplicativeIdealEdgeLength;return e.idealEdgeLengthType===D.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier&&!e.autoRepulsionRadius?e.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new v({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach(e=>{e.parent=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this}),e.on("after-remove",({item:e})=>{e.parent=null})],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map(e=>e.name).concat((e.relationshipTypes??[]).map(e=>e.name))),i=new Set((e.entityTypes??[]).map(e=>e.name)),o=new Set((e.relationshipTypes??[]).map(e=>e.name));if(this.layers){for(const a of this.layers)!a.graphType&&t.has(a.graphTypeName)&&(a.graphType=i.has(a.graphTypeName)?"entity":"relationship");const e=this.layers.filter(e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):o.has(e.graphTypeName)));this.setAtOrigin("layers",e,y(this.originIdOf("layers")))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map(e=>e.graphTypeName)??[],a=this.layers.map(e=>e.graphTypeName).concat(t);for(const n of a)e.has(n)||this._originalInclusionList.namedTypeDefinitions.set(n,{useAllData:!1,members:new Map});const i=[];for(const o of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(o)||(n.getLogger(this).warn(`A named type, ${o}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(o));for(const n of i)this._originalInclusionList.namedTypeDefinitions.delete(n)}}};e([c(z)],K.prototype,"url",void 0),e([c()],K.prototype,"dataPreloadedInLocalCache",void 0),e([c()],K.prototype,"initializationLinkChartConfig",void 0),e([c()],K.prototype,"membershipModified",void 0),e([c()],K.prototype,"dataManager",void 0),e([c()],K.prototype,"initializationInclusionModeDefinition",null),e([c()],K.prototype,"knowledgeGraph",void 0),e([c({type:a.ofType(v),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([c({readOnly:!0})],K.prototype,"linkChart",null),e([c()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([c()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([c()],K.prototype,"linkChartExtent",void 0),e([c()],K.prototype,"memberEntityTypes",void 0),e([c()],K.prototype,"memberRelationshipTypes",void 0),e([c({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([c()],K.prototype,"sublayerCapabilities",null),e([c()],K.prototype,"sublayerIdsCache",void 0),e([c({type:a.ofType(v),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([c({json:{read:!1}})],K.prototype,"type",void 0),e([c({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const J=K;export{J as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../core/Collection.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as n}from"../core/object.js";import a from"../core/Warning.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import u from"../geometry/Extent.js";import{projectOrLoad as c,canProjectWithoutEngine as f,load as d,project as g,isLoaded as b}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{empty as S,expand as O,equals as w,toExtent as N,negativeInfinity as j}from"../geometry/support/aaBoundingRect.js";import{normalizeCentralMeridian as L}from"../geometry/support/normalizeUtils.js";import{equals as x}from"../geometry/support/spatialReferenceUtils.js";import J from"../graphic/MapNotesGraphicOrigin.js";import v from"./FeatureLayer.js";import T from"./GraphicsLayer.js";import C from"./Layer.js";import{findLastObjectIdFromFeatures as M}from"./graphics/objectIdUtils.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{OperationalLayer as R}from"./mixins/OperationalLayer.js";import{PortalLayer as E}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as D}from"./mixins/ScaleRangeLayer.js";import G from"./support/Field.js";import P from"../symbols/SimpleFillSymbol.js";import _ from"../symbols/SimpleLineSymbol.js";import F from"../symbols/SimpleMarkerSymbol.js";import B from"../symbols/TextSymbol.js";function k(e){return"markup"===e.featureCollectionType||e.layers.some(e=>null!=e.layerDefinition.visibilityField||!z(e))}function z({layerDefinition:e,featureSet:t}){const r=e.geometryType??t.geometryType;return $.find(t=>r===t.geometryTypeJSON&&e.drawingInfo?.renderer?.symbol?.type===t.identifyingSymbol.type)}function U(){return new u({xmin:-180,ymin:-90,xmax:180,ymax:90})}const W=new G({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),A=new G({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255}),$=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:(new P).toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:(new _).toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:(new F).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:(new F).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:(new B).toJSON()}];let q=class extends(I(D(R(E(l(C)))))){constructor(e){super(e),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=h.WGS84,this.sublayers=new r($.map(e=>new H({id:e.id,layerId:e.layerId,title:e.title,layer:this}))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(e,t,r){return{operations:{supportsMapNotesEditing:!k(t)&&"portal-item"!==r?.origin}}}readFeatureCollections(e,t,o){if(!k(t))return null;const i=t.layers.map(e=>{const t=new v;return t.read(e,o),t});return new r({items:i})}readLegacyfeatureCollectionJSON(e,t){return k(t)?i(t.featureCollection):null}get fullExtent(){const e=this.spatialReference,t=S();if(null!=this.sublayers)this.sublayers.forEach(({fullBounds:e})=>null!=e?O(t,e,t):t,t);else if(this.featureCollectionJSON?.layers.some(e=>e.layerDefinition.extent)){this.featureCollectionJSON.layers.forEach(r=>{const o=c(r.layerDefinition.extent,e).geometry;null!=o&&O(t,o,t)})}return w(t,j)?c(U(),e).geometry:N(t,e)}readMinScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.minScale)return r.layerDefinition.minScale;return 0}readMaxScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.maxScale)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(e,t){return t.layers.length?h.fromJSON(t.layers[0].layerDefinition.spatialReference):h.WGS84}readSublayers(e,o,i){if(k(o))return null;const l=[];let n=o.layers.reduce((e,t)=>Math.max(e,t.layerDefinition.id??-1),-1)+1;for(const r of o.layers){const{layerDefinition:e,featureSet:o}=r,i=e.id??n++,a=z(r);if(null!=a){const r=new H({id:a.id,title:e.name,layerId:i,layer:this,graphics:o.features.map(({geometry:e,symbol:r,attributes:o,popupInfo:i})=>t.fromJSON({attributes:o,geometry:e,symbol:r,popupTemplate:i}))});l.push(r)}}return new r(l)}writeSublayers(e,t,r,i){const{minScale:l,maxScale:a}=this;if(null==e)return;const s=e.some(e=>e.graphics.length>0);if(!this.capabilities.operations.supportsMapNotesEditing)return void(s&&i?.messages?.push(new o("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer")));const p=[];let y=this.spatialReference.toJSON();e:for(const o of e)for(const e of o.graphics)if(null!=e.geometry){y=e.geometry.spatialReference.toJSON();break e}for(const o of $){const t=e.find(e=>o.id===e.id);this._writeMapNoteSublayer(p,t,o,l,a,y,i)}n("featureCollection.layers",p,t)}get textLayer(){return this._findSublayer("textLayer")}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}read(e,t){"featureCollection"in e&&(e=i(e),Object.assign(e,e.featureCollection)),super.read(e,t)}async beforeSave(){if(null==this.sublayers)return;let e=null;const t=[];for(const o of this.sublayers)for(const r of o.graphics)if(null!=r.geometry){const o=r.geometry;e?x(o.spatialReference,e)||(f(o.spatialReference,e)||b()||await d(),r.geometry=g(o,e)):e=o.spatialReference,t.push(r)}const r=await L(t.map(e=>e.geometry));t.forEach((e,t)=>e.geometry=r[t])}_findSublayer(e){return null==this.sublayers?null:this.sublayers?.find(t=>t.id===e)??null}_writeMapNoteSublayer(e,t,r,o,l,n,a){const s=[];if(null!=t){for(const e of t.graphics)this._writeMapNote(s,e,r.geometryType,a);this._normalizeObjectIds(s,W),e.push({layerDefinition:{name:t.title,drawingInfo:{renderer:{type:"simple",symbol:i(r.identifyingSymbol)}},id:t.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[W.toJSON(),A.toJSON()],spatialReference:n},featureSet:{features:s,geometryType:r.geometryTypeJSON}})}}_writeMapNote(e,t,r,o){if(null==t)return;const{geometry:i,symbol:l,popupTemplate:n}=t;if(null==i)return;if(i.type!==r)return void o?.messages?.push(new a("map-notes-layer:invalid-geometry-type",`Geometry "${i.type}" cannot be saved in "${r}" layer`,{graphic:t}));if(null==l)return void o?.messages?.push(new a("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:t}));const s={attributes:{...t.attributes},geometry:i.toJSON(),symbol:l.toJSON()};null!=n&&(s.popupInfo=n.toJSON()),e.push(s)}_normalizeObjectIds(e,t){const r=t.name;let o=M(r,e)+1;const i=new Set;for(const l of e){l.attributes||(l.attributes={});const{attributes:e}=l;(null==e[r]||i.has(e[r]))&&(e[r]=o++),i.add(e[r])}}};e([s({readOnly:!0})],q.prototype,"capabilities",void 0),e([p(["portal-item","web-map"],"capabilities",["layers"])],q.prototype,"readCapabilities",null),e([s({readOnly:!0})],q.prototype,"featureCollections",void 0),e([p(["web-map","portal-item"],"featureCollections",["layers"])],q.prototype,"readFeatureCollections",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],q.prototype,"featureCollectionJSON",void 0),e([p(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],q.prototype,"readLegacyfeatureCollectionJSON",null),e([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],q.prototype,"featureCollectionType",void 0),e([s({readOnly:!0})],q.prototype,"fullExtent",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:null!=this.featureCollectionJSON}}}}}}})],q.prototype,"legendEnabled",void 0),e([s({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"minScale",void 0),e([p(["web-map","portal-item"],"minScale",["layers"])],q.prototype,"readMinScale",null),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"maxScale",void 0),e([p(["web-map","portal-item"],"maxScale",["layers"])],q.prototype,"readMaxScale",null),e([s({readOnly:!0})],q.prototype,"multipointLayer",null),e([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],q.prototype,"operationalLayerType",void 0),e([s({readOnly:!0})],q.prototype,"pointLayer",null),e([s({readOnly:!0})],q.prototype,"polygonLayer",null),e([s({readOnly:!0})],q.prototype,"polylineLayer",null),e([s({type:h})],q.prototype,"spatialReference",void 0),e([p(["web-map","portal-item"],"spatialReference",["layers"])],q.prototype,"readSpatialReference",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],q.prototype,"sublayers",void 0),e([p("web-map","sublayers",["layers"])],q.prototype,"readSublayers",null),e([m("web-map","sublayers")],q.prototype,"writeSublayers",null),e([s({readOnly:!0})],q.prototype,"textLayer",null),e([s()],q.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=e([y("esri.layers.MapNotesLayer")],q);let H=class extends T{constructor(e){super(e),this.visibilityMode="inherited"}initialize(){for(const e of this.graphics)e.sourceLayer=this.layer;this.graphics.on("after-add",e=>{e.item.sourceLayer=this.layer,e.item.origin=this.graphicOrigin}),this.graphics.on("after-remove",e=>{e.item.sourceLayer=null,e.item.origin=null})}get fullExtent(){const e=this.layer?.spatialReference,t=this.fullBounds;return e?null==t?c(U(),e).geometry:N(t,e):null}get fullBounds(){const e=this.layer?.spatialReference;if(!e)return null;const t=S();return this.graphics.forEach(r=>{const o=null!=r.geometry?c(r.geometry,e).geometry:null;null!=o&&O(t,"point"===o.type?o:o.extent,t)}),w(t,j)?null:t}get graphicOrigin(){return new J(this.layer,this)}get sublayers(){return this.graphics}};e([s({readOnly:!0})],H.prototype,"fullExtent",null),e([s({readOnly:!0})],H.prototype,"fullBounds",null),e([s({readOnly:!0})],H.prototype,"graphicOrigin",null),e([s({readOnly:!0})],H.prototype,"sublayers",null),e([s()],H.prototype,"layer",void 0),e([s()],H.prototype,"layerId",void 0),e([s({readOnly:!0})],H.prototype,"visibilityMode",void 0),H=e([y("esri.layers.MapNotesLayer.MapNotesSublayer")],H);const K=q;export{K as default};
5
+ import{__decorate as e}from"tslib";import t from"../Graphic.js";import r from"../core/Collection.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as n}from"../core/object.js";import a from"../core/Warning.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import u from"../geometry/Extent.js";import{projectOrLoad as c,canProjectWithoutEngine as f,isLoaded as d,load as g,project as b}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{empty as S,expand as O,equals as w,toExtent as N,negativeInfinity as j}from"../geometry/support/aaBoundingRect.js";import{normalizeCentralMeridian as L}from"../geometry/support/normalizeUtils.js";import{equals as x}from"../geometry/support/spatialReferenceUtils.js";import J from"../graphic/MapNotesGraphicOrigin.js";import v from"./FeatureLayer.js";import T from"./GraphicsLayer.js";import C from"./Layer.js";import{findLastObjectIdFromFeatures as M}from"./graphics/objectIdUtils.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{OperationalLayer as R}from"./mixins/OperationalLayer.js";import{PortalLayer as E}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as D}from"./mixins/ScaleRangeLayer.js";import G from"./support/Field.js";import P from"../symbols/SimpleFillSymbol.js";import _ from"../symbols/SimpleLineSymbol.js";import F from"../symbols/SimpleMarkerSymbol.js";import B from"../symbols/TextSymbol.js";function k(e){return"markup"===e.featureCollectionType||e.layers.some(e=>null!=e.layerDefinition.visibilityField||!z(e))}function z({layerDefinition:e,featureSet:t}){const r=e.geometryType??t.geometryType;return $.find(t=>r===t.geometryTypeJSON&&e.drawingInfo?.renderer?.symbol?.type===t.identifyingSymbol.type)}function U(){return new u({xmin:-180,ymin:-90,xmax:180,ymax:90})}const W=new G({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),A=new G({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255}),$=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:(new P).toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:(new _).toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:(new F).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:(new F).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:(new B).toJSON()}];let q=class extends(I(D(R(E(l(C)))))){constructor(e){super(e),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=h.WGS84,this.sublayers=new r($.map(e=>new H({id:e.id,layerId:e.layerId,title:e.title,layer:this}))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(e,t,r){return{operations:{supportsMapNotesEditing:!k(t)&&"portal-item"!==r?.origin}}}readFeatureCollections(e,t,o){if(!k(t))return null;const i=t.layers.map(e=>{const t=new v;return t.read(e,o),t});return new r({items:i})}readLegacyfeatureCollectionJSON(e,t){return k(t)?i(t.featureCollection):null}get fullExtent(){const e=this.spatialReference,t=S();if(null!=this.sublayers)this.sublayers.forEach(({fullBounds:e})=>null!=e?O(t,e,t):t,t);else if(this.featureCollectionJSON?.layers.some(e=>e.layerDefinition.extent)){this.featureCollectionJSON.layers.forEach(r=>{const o=c(r.layerDefinition.extent,e).geometry;null!=o&&O(t,o,t)})}return w(t,j)?c(U(),e).geometry:N(t,e)}readMinScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.minScale)return r.layerDefinition.minScale;return 0}readMaxScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.maxScale)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(e,t){return t.layers.length?h.fromJSON(t.layers[0].layerDefinition.spatialReference):h.WGS84}readSublayers(e,o,i){if(k(o))return null;const l=[];let n=o.layers.reduce((e,t)=>Math.max(e,t.layerDefinition.id??-1),-1)+1;for(const r of o.layers){const{layerDefinition:e,featureSet:o}=r,i=e.id??n++,a=z(r);if(null!=a){const r=new H({id:a.id,title:e.name,layerId:i,layer:this,graphics:o.features.map(({geometry:e,symbol:r,attributes:o,popupInfo:i})=>t.fromJSON({attributes:o,geometry:e,symbol:r,popupTemplate:i}))});l.push(r)}}return new r(l)}writeSublayers(e,t,r,i){const{minScale:l,maxScale:a}=this;if(null==e)return;const s=e.some(e=>e.graphics.length>0);if(!this.capabilities.operations.supportsMapNotesEditing)return void(s&&i?.messages?.push(new o("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer")));const p=[];let y=this.spatialReference.toJSON();e:for(const o of e)for(const e of o.graphics)if(null!=e.geometry){y=e.geometry.spatialReference.toJSON();break e}for(const o of $){const t=e.find(e=>o.id===e.id);this._writeMapNoteSublayer(p,t,o,l,a,y,i)}n("featureCollection.layers",p,t)}get textLayer(){return this._findSublayer("textLayer")}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}read(e,t){"featureCollection"in e&&(e=i(e),Object.assign(e,e.featureCollection)),super.read(e,t)}async beforeSave(){if(null==this.sublayers)return;let e=null;const t=[];for(const o of this.sublayers)for(const r of o.graphics)if(null!=r.geometry){const o=r.geometry;e?x(o.spatialReference,e)||(f(o.spatialReference,e)||d()||await g(),r.geometry=b(o,e)):e=o.spatialReference,t.push(r)}const r=await L(t.map(e=>e.geometry));t.forEach((e,t)=>e.geometry=r[t])}_findSublayer(e){return null==this.sublayers?null:this.sublayers?.find(t=>t.id===e)??null}_writeMapNoteSublayer(e,t,r,o,l,n,a){const s=[];if(null!=t){for(const e of t.graphics)this._writeMapNote(s,e,r.geometryType,a);this._normalizeObjectIds(s,W),e.push({layerDefinition:{name:t.title,drawingInfo:{renderer:{type:"simple",symbol:i(r.identifyingSymbol)}},id:t.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[W.toJSON(),A.toJSON()],spatialReference:n},featureSet:{features:s,geometryType:r.geometryTypeJSON}})}}_writeMapNote(e,t,r,o){if(null==t)return;const{geometry:i,symbol:l,popupTemplate:n}=t;if(null==i)return;if(i.type!==r)return void o?.messages?.push(new a("map-notes-layer:invalid-geometry-type",`Geometry "${i.type}" cannot be saved in "${r}" layer`,{graphic:t}));if(null==l)return void o?.messages?.push(new a("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:t}));const s={attributes:{...t.attributes},geometry:i.toJSON(),symbol:l.toJSON()};null!=n&&(s.popupInfo=n.toJSON()),e.push(s)}_normalizeObjectIds(e,t){const r=t.name;let o=M(r,e)+1;const i=new Set;for(const l of e){l.attributes||(l.attributes={});const{attributes:e}=l;(null==e[r]||i.has(e[r]))&&(e[r]=o++),i.add(e[r])}}};e([s({readOnly:!0})],q.prototype,"capabilities",void 0),e([p(["portal-item","web-map"],"capabilities",["layers"])],q.prototype,"readCapabilities",null),e([s({readOnly:!0})],q.prototype,"featureCollections",void 0),e([p(["web-map","portal-item"],"featureCollections",["layers"])],q.prototype,"readFeatureCollections",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],q.prototype,"featureCollectionJSON",void 0),e([p(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],q.prototype,"readLegacyfeatureCollectionJSON",null),e([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],q.prototype,"featureCollectionType",void 0),e([s({readOnly:!0})],q.prototype,"fullExtent",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:null!=this.featureCollectionJSON}}}}}}})],q.prototype,"legendEnabled",void 0),e([s({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"minScale",void 0),e([p(["web-map","portal-item"],"minScale",["layers"])],q.prototype,"readMinScale",null),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"maxScale",void 0),e([p(["web-map","portal-item"],"maxScale",["layers"])],q.prototype,"readMaxScale",null),e([s({readOnly:!0})],q.prototype,"multipointLayer",null),e([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],q.prototype,"operationalLayerType",void 0),e([s({readOnly:!0})],q.prototype,"pointLayer",null),e([s({readOnly:!0})],q.prototype,"polygonLayer",null),e([s({readOnly:!0})],q.prototype,"polylineLayer",null),e([s({type:h})],q.prototype,"spatialReference",void 0),e([p(["web-map","portal-item"],"spatialReference",["layers"])],q.prototype,"readSpatialReference",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],q.prototype,"sublayers",void 0),e([p("web-map","sublayers",["layers"])],q.prototype,"readSublayers",null),e([m("web-map","sublayers")],q.prototype,"writeSublayers",null),e([s({readOnly:!0})],q.prototype,"textLayer",null),e([s()],q.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=e([y("esri.layers.MapNotesLayer")],q);let H=class extends T{constructor(e){super(e),this.visibilityMode="inherited"}initialize(){for(const e of this.graphics)e.sourceLayer=this.layer;this.graphics.on("after-add",e=>{e.item.sourceLayer=this.layer,e.item.origin=this.graphicOrigin}),this.graphics.on("after-remove",e=>{e.item.sourceLayer=null,e.item.origin=null})}get fullExtent(){const e=this.layer?.spatialReference,t=this.fullBounds;return e?null==t?c(U(),e).geometry:N(t,e):null}get fullBounds(){const e=this.layer?.spatialReference;if(!e)return null;const t=S();return this.graphics.forEach(r=>{const o=null!=r.geometry?c(r.geometry,e).geometry:null;null!=o&&O(t,"point"===o.type?o:o.extent,t)}),w(t,j)?null:t}get graphicOrigin(){return new J(this.layer,this)}get sublayers(){return this.graphics}};e([s({readOnly:!0})],H.prototype,"fullExtent",null),e([s({readOnly:!0})],H.prototype,"fullBounds",null),e([s({readOnly:!0})],H.prototype,"graphicOrigin",null),e([s({readOnly:!0})],H.prototype,"sublayers",null),e([s()],H.prototype,"layer",void 0),e([s()],H.prototype,"layerId",void 0),e([s({readOnly:!0})],H.prototype,"visibilityMode",void 0),H=e([y("esri.layers.MapNotesLayer.MapNotesSublayer")],H);const K=q;export{K as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as u}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{fromJSON as _,isExtent as F,isPolygon as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as b,cleanFromGeometryEngine as E}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as N}from"./spatialQuerySupport.js";import{getTimeExtent as Z,getTimeOperator as J}from"./timeSupport.js";import L from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,"object-id"===e.featureIdInfo.type&&(this.objectIdField=e.featureIdInfo.fieldName),this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:L.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=Z(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return u(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const u=!S(i.spatialReference,this.spatialReference);u&&(await T(i.spatialReference,this.spatialReference),yield);const o="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-o,xmax:i.x+o,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=u?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(_(i),null,{signal:t}))[0];yield;const m=(await Q(_(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=u?A(x,this.spatialReference):x,F=u?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:F},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,u=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const o=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(o.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(o.getObjectId(e))||r(o.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await u(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await u(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(o.getGeometry(e)));return yield,await u(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,u=r?null:this._getCacheKey(i),o=u?this._cache.get(u):null;if(o)return new C(o,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),u&&this._cache.put(u,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return u&&this._cache.put(u,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=J(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const u=r||s;return R(a)&&!S(this.spatialReference,a)&&u?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return N(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>b(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM)))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(N(e)){if(F(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(w(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:E(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=E(i),n.xmax-n.xmin===0){const e=o(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=o(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=o(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,Y as getQueryResultExtent};
5
+ import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as u}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,negativeInfinity as d,create as m,expandWithAABB as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{fromJSON as _,isExtent as F,isPolygon as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{cleanFromGeometryEngine as b,getGeometry as E}from"./geometryUtils.js";import{project as T,checkProjectionSupport as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as N}from"./spatialQuerySupport.js";import{getTimeExtent as Z,getTimeOperator as J}from"./timeSupport.js";import L from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,"object-id"===e.featureIdInfo.type&&(this.objectIdField=e.featureIdInfo.fieldName),this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:L.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=Z(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return u(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const u=!S(i.spatialReference,this.spatialReference);u&&(await A(i.spatialReference,this.spatialReference),yield);const o="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-o,xmax:i.x+o,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=u?T(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(_(i),null,{signal:t}))[0];yield;const m=(await Q(_(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=u?T(x,this.spatialReference):x,F=u?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:F},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(m(),d);return await this.featureStore.forEachBounds(e,e=>f(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:T(a,s);if(!n)return null;const l=i||r,u=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const o=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(o.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(o.getObjectId(e))||r(o.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await u(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await u(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(o.getGeometry(e)));return yield,await u(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,u=r?null:this._getCacheKey(i),o=u?this._cache.get(u):null;if(o)return new C(o,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),u&&this._cache.put(u,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:T(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return u&&this._cache.put(u,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=J(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const u=r||s;return R(a)&&!S(this.spatialReference,a)&&u?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return N(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM)))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(N(e)){if(F(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(w(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=T(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=o(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=o(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=o(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,Y as getQueryResultExtent};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import r from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as s}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import d from"../../geometry/Polygon.js";import u from"../../geometry/Polyline.js";import{initializeProjection as m,project as h}from"../../geometry/projectionUtils.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as g}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import b from"../../graphic/KnowledgeGraphGraphicOrigin.js";import j from"../../graphic/LinkChartGraphicOrigin.js";import w from"../Layer.js";import T from"../graphics/data/FeatureStore.js";import{QueryEngine as v}from"../graphics/data/QueryEngine.js";import{createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as O,systemAggregationCountFieldName as E,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as x,systemOriginIdFieldName as L,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as _}from"./KnowledgeGraphSublayerBase.js";import{createCapabilitiesFromKnowledgeGraph as F,createDefaultKGSLFormTemplate as R,getDisplayLabelProperty as C,getLinkChartDefaultLabelingInfo as k,getMapDefaultLabelingInfo as Q,getKGSublayerSymbolColor as M,getDefaultLCRelationshipSublayerSymbol as P,createDefaultKGSLFeatureTemplates as G,convertLayerEditsToGraphEdits as D,convertGraphEditsResultToFeatureEdits as J}from"./layerUtils.js";import{BlendLayer as q,blendModeProperty as U,effectProperty as A}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as B,displayFilterEnabledProperty as Z,displayFilterInfoProperty as K}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as V,featureEffectProperty as H}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as W}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Y,orderByProperty as z}from"../mixins/OrderedLayer.js";import{RefreshableLayer as X}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as $}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as ee,useViewTimeProperty as te}from"../mixins/TemporalLayer.js";import{legendEnabled as re,maxScale as ie,minScale as oe,opacity as se,popupEnabled as ne}from"../support/commonProperties.js";import{featureReductionProperty as ae}from"../support/featureReductionUtils.js";import pe from"../support/Field.js";import{fixRendererFields as le,fixTimeInfoFields as ye}from"../support/fieldUtils.js";import de from"../support/LabelClass.js";import{reader as ue}from"../support/labelingInfo.js";import me from"../support/TimeInfo.js";import he from"../../renderers/SimpleRenderer.js";import{fromJSON as ce}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ge}from"../../renderers/support/typeUtils.js";import{executeApplyEdits as fe}from"../../rest/knowledgeGraphService.js";import be from"../../rest/support/FeatureSet.js";import je from"../../rest/support/Query.js";import{createPopupTemplate as we}from"../../support/popupUtils.js";import{applyColorToSymbol as Te}from"../../symbols/support/utils.js";import ve from"../../core/workers/RemoteClient.js";function Ie(e){if(!e.json)return e;e.json.write=Oe(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=Oe(e.write))}return e}function Oe(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=Ee(e)),e):!0===e?Se():e}function Ee(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=xe.call(this,e,t);return r.enabled?{...o,...r}:r}}function Se(){return{overridePolicy:xe}}function xe(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,...Le.call(this,e,t)}),i}function Le(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}let Ne=class extends(_(B(W(V(q(Y(ee($(X(s(w))))))))))){constructor(e){super(e),this.blendMode="normal",this.charts=null,this.definitionExpression=null,this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=O,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{const e=new MessageChannel;return new ve(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=je.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get capabilities(){return this.parent?this.parent.sublayerCapabilities:F(null)}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.capabilities.operations.supportsEditing}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get isTable(){return"link-chart"!==this.parentCompositeLayer.type&&null==this.geometryFieldName}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach(t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(pe.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))}),e.push(pe.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),pe.fromJSON({name:E,type:"esriFieldTypeInteger",alias:E,editable:!1}),pe.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get formTemplate(){return this._isOverridden("formTemplate")?this._get("formTemplate"):R(this)}set formTemplate(e){this._overrideIfSome("formTemplate",e)}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?f.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return x;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphicOrigin(){if(!this.parent)return null;switch(this.parent.type){case"knowledge-graph":return new b(this.parent,this);case"link-chart":return new j(this.parent,this)}}get graphTypeName(){return this.objectType?.name}set graphTypeName(e){this._set("graphTypeName",e)}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?C(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?k(this.graphType,this.graphTypeName,e):Q(this.graphTypeName,this.geometryType,e)}set renderer(e){le(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=M(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new he({type:"simple",symbol:P(r)});const e=ce(I(f.toJSON("point")).renderer);return Te(e.symbol,r),e}const i=ce(I(f.toJSON(this.geometryType)).renderer);return Te(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}get templates(){return this._isOverridden("templates")?this._get("templates"):G(this)}set templates(e){this._overrideIfSome("templates",e)}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return we(this,e)}createQuery(){return new je({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=this.graphicOrigin,s=be.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return s.features.forEach(e=>{e.sourceLayer=this,e.origin=o}),s}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new l(s.extent):new l,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=je.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}async applyEdits(e){if(!this.parentCompositeLayer.dataManager.knowledgeGraph)throw new r("knowledge-graph-sublayer:no-knowledge-graph","ApplyEdits cannot be executed because the parent does not have a Knowledge Graph model. This is usually caused by the layer not yet being loaded");const t=await D(e,this);t.options={cascadeDelete:!0,cascadeProvenanceDelete:!!this.parent?.knowledgeGraph.serviceDefinition.supportsProvenance||void 0};const i=await fe(this.parentCompositeLayer.dataManager.knowledgeGraph,t),o=J(i,this.graphTypeName),s={addedFeatures:o.addFeatureResults,updatedFeatures:o.updateFeatureResults,deletedFeatures:o.deleteFeatureResults,addedAttachments:o.addAttachmentResults,deletedAttachments:o.deleteAttachmentResults,updatedAttachments:o.updateAttachmentResults,exceededTransferLimit:!1,historicMoment:new Date,edits:void 0};return this.emit("edits",s),this.emit("apply-edits",{result:Promise.resolve(s)}),"link-chart"===this.parentCompositeLayer.type&&await this.parentCompositeLayer.refreshLinkChartCache([...s.addedFeatures.map(e=>e.globalId),...s.updatedFeatures.map(e=>e.globalId),...s.deletedFeatures.map(e=>e.globalId)]),o}loadQueryEngine(e){const t=new T({geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new v({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new je({where:"1=1",outFields:[O]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>ye(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=je.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await m(i.spatialReference,g),r.geometry=h(i instanceof d||i instanceof u||i instanceof y?i:i.extent,g)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function _e(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",E],["ESRI__ORIGIN_ID",L],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",x]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){o.getLogger(this).warn("Error updating labelingInfo",s)}return ue(e,t,r)}e([n(Ie(i(U)))],Ne.prototype,"blendMode",void 0),e([n({readOnly:!0})],Ne.prototype,"capabilities",null),e([n({readOnly:!0})],Ne.prototype,"userHasUpdateItemPrivileges",null),e([n({type:Boolean})],Ne.prototype,"editingEnabled",null),e([n()],Ne.prototype,"isTable",null),e([n({json:{origins:{"web-scene":{write:!1}},write:Se()}})],Ne.prototype,"charts",void 0),e([n({readOnly:!0})],Ne.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ne.prototype,"definitionExpression",void 0),e([n(Ie(i(Z)))],Ne.prototype,"displayFilterEnabled",void 0),e([n(Ie(i(K)))],Ne.prototype,"displayFilterInfo",void 0),e([n(Ie(i(A)))],Ne.prototype,"effect",void 0),e([n()],Ne.prototype,"elevationInfo",void 0),e([n(Ie(i(H)))],Ne.prototype,"featureEffect",void 0),e([n(Ie(i(ae)))],Ne.prototype,"featureReduction",null),e([n()],Ne.prototype,"fields",null),e([n()],Ne.prototype,"formTemplate",null),e([n()],Ne.prototype,"geometryType",null),e([n()],Ne.prototype,"geometryFieldName",null),e([n({readOnly:!0})],Ne.prototype,"graphicOrigin",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ne.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ne.prototype,"graphTypeName",null),e([n()],Ne.prototype,"hasM",null),e([n()],Ne.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ne.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ne.prototype,"labelsVisible",void 0),e([n({type:[de],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:_e,write:Se()}})],Ne.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ne.prototype,"layerType",void 0),e([n(Ie(i(re)))],Ne.prototype,"legendEnabled",void 0),e([n(Ie(i(ie)))],Ne.prototype,"maxScale",void 0),e([n(Ie(i(oe)))],Ne.prototype,"minScale",void 0),e([n()],Ne.prototype,"objectIdField",void 0),e([n()],Ne.prototype,"objectType",void 0),e([n(Ie(i(se)))],Ne.prototype,"opacity",void 0),e([n(Ie(i(z)))],Ne.prototype,"orderBy",void 0),e([n({clonable:!1})],Ne.prototype,"parent",void 0),e([n()],Ne.prototype,"parentCompositeLayer",void 0),e([n(Ie(i(ne)))],Ne.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ne.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Le}}})],Ne.prototype,"refreshInterval",void 0),e([n({types:ge,json:{name:"layerDefinition.drawingInfo.renderer",write:Se()}})],Ne.prototype,"renderer",null),e([n()],Ne.prototype,"source",void 0),e([n()],Ne.prototype,"spatialReference",null),e([n()],Ne.prototype,"templates",null),e([n({type:me,json:{name:"layerDefinition.timeInfo",write:{overridePolicy:Le},origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:Le}},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:Le}}}}})],Ne.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ne.prototype,"title",null),e([p("title")],Ne.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ne.prototype,"type",void 0),e([n(Ie(i(te)))],Ne.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:Se()}})],Ne.prototype,"visible",void 0),Ne=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ne);export{Ne as default};
5
+ import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import r from"../../core/Error.js";import{clone as i}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as s}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import d from"../../geometry/Polygon.js";import u from"../../geometry/Polyline.js";import{initializeProjection as m,project as h}from"../../geometry/projectionUtils.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as g}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as f}from"../../geometry/support/typeUtils.js";import b from"../../graphic/KnowledgeGraphGraphicOrigin.js";import j from"../../graphic/LinkChartGraphicOrigin.js";import w from"../Layer.js";import T from"../graphics/data/FeatureStore.js";import{QueryEngine as v}from"../graphics/data/QueryEngine.js";import{createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as O,systemAggregationCountFieldName as E,systemIsSpatialFieldName as S,systemLayoutGeometryFieldName as x,systemOriginIdFieldName as L,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as _}from"./KnowledgeGraphSublayerBase.js";import{createCapabilitiesFromKnowledgeGraph as F,createDefaultKGSLFormTemplate as R,getDisplayLabelProperty as C,getLinkChartDefaultLabelingInfo as k,getMapDefaultLabelingInfo as Q,getKGSublayerSymbolColor as M,getDefaultLCRelationshipSublayerSymbol as P,createDefaultKGSLFeatureTemplates as G,convertLayerEditsToGraphEdits as D,convertGraphEditsResultToFeatureEdits as J}from"./layerUtils.js";import{BlendLayer as q,blendModeProperty as U,effectProperty as A}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as B,displayFilterEnabledProperty as Z,displayFilterInfoProperty as K}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as V,featureEffectProperty as H}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as W}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Y,orderByProperty as z}from"../mixins/OrderedLayer.js";import{RefreshableLayer as X}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as $}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as ee,useViewTimeProperty as te}from"../mixins/TemporalLayer.js";import{legendEnabled as re,maxScale as ie,minScale as oe,opacity as se,popupEnabled as ne}from"../support/commonProperties.js";import{featureReductionProperty as ae}from"../support/featureReductionUtils.js";import pe from"../support/Field.js";import{fixRendererFields as le,fixTimeInfoFields as ye}from"../support/fieldUtils.js";import de from"../support/LabelClass.js";import{reader as ue}from"../support/labelingInfo.js";import me from"../support/TimeInfo.js";import he from"../../renderers/SimpleRenderer.js";import{fromJSON as ce}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ge}from"../../renderers/support/typeUtils.js";import{executeApplyEdits as fe}from"../../rest/knowledgeGraphService.js";import be from"../../rest/support/FeatureSet.js";import je from"../../rest/support/Query.js";import{createPopupTemplate as we}from"../../support/popupUtils.js";import{applyColorToSymbol as Te}from"../../symbols/support/utils.js";import ve from"../../core/workers/RemoteClient.js";function Ie(e){if(!e.json)return e;e.json.write=Oe(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=Oe(e.write))}return e}function Oe(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=Ee(e)),e):!0===e?Se():e}function Ee(e){const{target:t,writer:r,overridePolicy:i,...o}=e;return function(e,t){const r=xe.call(this,e,t);return r.enabled?{...o,...r}:r}}function Se(){return{overridePolicy:xe}}function xe(e,t){const r=!!this.geometryType;let i={enabled:r};return r&&(i={...i,...Le.call(this,e,t)}),i}function Le(e,t){return{ignoreOrigin:this.originIdOf(t)>0}}let Ne=class extends(_(B(W(V(q(Y(ee($(X(s(w))))))))))){constructor(e){super(e),this.blendMode="normal",this.charts=null,this.definitionExpression=null,this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=O,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then(()=>{const e=new MessageChannel;return new ve(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=je.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]})},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get capabilities(){return this.parent?this.parent.sublayerCapabilities:F(null)}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.capabilities.operations.supportsEditing}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get isTable(){return"link-chart"!==this.parentCompositeLayer?.type&&null==this.geometryFieldName}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach(t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(pe.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))}),e.push(pe.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),pe.fromJSON({name:E,type:"esriFieldTypeInteger",alias:E,editable:!1}),pe.fromJSON({name:S,type:"esriFieldTypeInteger",alias:S,editable:!1})),e}get formTemplate(){return this._isOverridden("formTemplate")?this._get("formTemplate"):R(this)}set formTemplate(e){this._overrideIfSome("formTemplate",e)}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?f.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return x;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphicOrigin(){if(!this.parent)return null;switch(this.parent.type){case"knowledge-graph":return new b(this.parent,this);case"link-chart":return new j(this.parent,this)}}get graphTypeName(){return this.objectType?.name}set graphTypeName(e){this._set("graphTypeName",e)}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");if(!this.objectType||!this.parentCompositeLayer||!this.graphTypeName)return null;const e=this.objectType.properties?C(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?k(this.graphType,this.graphTypeName,e):Q(this.graphTypeName,this.geometryType,e)}set renderer(e){le(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map(e=>e.name).indexOf(this.graphTypeName),r=M(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new he({type:"simple",symbol:P(r)});const e=ce(I(f.toJSON("point")).renderer);return Te(e.symbol,r),e}const i=ce(I(f.toJSON(this.geometryType)).renderer);return Te(i.symbol,r),i}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}get templates(){return this._isOverridden("templates")?this._get("templates"):G(this)}set templates(e){this._overrideIfSome("templates",e)}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return we(this,e)}createQuery(){return new je({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),o=this.graphicOrigin,s=be.fromJSON(await i.executeQuery(r.toJSON(),t?.signal));return s.features.forEach(e=>{e.sourceLayer=this,e.origin=o}),s}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:o}=await this._setupQueryObjects(r),s=await o.executeQueryForExtent(i.toJSON(),t?.signal);let n;return n=null!=s.extent?.xmin&&null!=s.extent?.xmax&&null!=s.extent?.ymin&&null!=s.extent?.ymax?new l(s.extent):new l,{count:s.count,extent:n}}async queryObjectIds(e,t){await this.load();const r=je.from(e);let i;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(e)}return await i.executeQueryForIds(r.toJSON(),t?.signal)}async applyEdits(e){if(!this.parentCompositeLayer.dataManager.knowledgeGraph)throw new r("knowledge-graph-sublayer:no-knowledge-graph","ApplyEdits cannot be executed because the parent does not have a Knowledge Graph model. This is usually caused by the layer not yet being loaded");const t=await D(e,this);t.options={cascadeDelete:!0,cascadeProvenanceDelete:!!this.parent?.knowledgeGraph.serviceDefinition.supportsProvenance||void 0};const i=await fe(this.parentCompositeLayer.dataManager.knowledgeGraph,t),o=J(i,this.graphTypeName),s={addedFeatures:o.addFeatureResults,updatedFeatures:o.updateFeatureResults,deletedFeatures:o.deleteFeatureResults,addedAttachments:o.addAttachmentResults,deletedAttachments:o.deleteAttachmentResults,updatedAttachments:o.updateAttachmentResults,exceededTransferLimit:!1,historicMoment:new Date,edits:void 0};return this.emit("edits",s),this.emit("apply-edits",{result:Promise.resolve(s)}),"link-chart"===this.parentCompositeLayer.type&&await this.parentCompositeLayer.refreshLinkChartCache([...s.addedFeatures.map(e=>e.globalId),...s.updatedFeatures.map(e=>e.globalId),...s.deletedFeatures.map(e=>e.globalId)]),o}loadQueryEngine(e){const t=new T({geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new v({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:f.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,featureIdInfo:{type:"object-id",fieldName:this.objectIdField},spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new je({where:"1=1",outFields:[O]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then(()=>ye(this.timeInfo,this.fieldsIndex))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=je.from(e),i=r.geometry;if(i&&!i.spatialReference?.isWGS84&&(await m(i.spatialReference,g),r.geometry=h(i instanceof d||i instanceof u||i instanceof y?i:i.extent,g)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(o)}}};function _e(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",E],["ESRI__ORIGIN_ID",L],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",x]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(s){o.getLogger(this).warn("Error updating labelingInfo",s)}return ue(e,t,r)}e([n(Ie(i(U)))],Ne.prototype,"blendMode",void 0),e([n({readOnly:!0})],Ne.prototype,"capabilities",null),e([n({readOnly:!0})],Ne.prototype,"userHasUpdateItemPrivileges",null),e([n({type:Boolean})],Ne.prototype,"editingEnabled",null),e([n()],Ne.prototype,"isTable",null),e([n({json:{origins:{"web-scene":{write:!1}},write:Se()}})],Ne.prototype,"charts",void 0),e([n({readOnly:!0})],Ne.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ne.prototype,"definitionExpression",void 0),e([n(Ie(i(Z)))],Ne.prototype,"displayFilterEnabled",void 0),e([n(Ie(i(K)))],Ne.prototype,"displayFilterInfo",void 0),e([n(Ie(i(A)))],Ne.prototype,"effect",void 0),e([n()],Ne.prototype,"elevationInfo",void 0),e([n(Ie(i(H)))],Ne.prototype,"featureEffect",void 0),e([n(Ie(i(ae)))],Ne.prototype,"featureReduction",null),e([n()],Ne.prototype,"fields",null),e([n()],Ne.prototype,"formTemplate",null),e([n()],Ne.prototype,"geometryType",null),e([n()],Ne.prototype,"geometryFieldName",null),e([n({readOnly:!0})],Ne.prototype,"graphicOrigin",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ne.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ne.prototype,"graphTypeName",null),e([n()],Ne.prototype,"hasM",null),e([n()],Ne.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ne.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ne.prototype,"labelsVisible",void 0),e([n({type:[de],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:_e,write:Se()}})],Ne.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ne.prototype,"layerType",void 0),e([n(Ie(i(re)))],Ne.prototype,"legendEnabled",void 0),e([n(Ie(i(ie)))],Ne.prototype,"maxScale",void 0),e([n(Ie(i(oe)))],Ne.prototype,"minScale",void 0),e([n()],Ne.prototype,"objectIdField",void 0),e([n()],Ne.prototype,"objectType",void 0),e([n(Ie(i(se)))],Ne.prototype,"opacity",void 0),e([n(Ie(i(z)))],Ne.prototype,"orderBy",void 0),e([n({clonable:!1})],Ne.prototype,"parent",void 0),e([n()],Ne.prototype,"parentCompositeLayer",void 0),e([n(Ie(i(ne)))],Ne.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ne.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Le}}})],Ne.prototype,"refreshInterval",void 0),e([n({types:ge,json:{name:"layerDefinition.drawingInfo.renderer",write:Se()}})],Ne.prototype,"renderer",null),e([n()],Ne.prototype,"source",void 0),e([n()],Ne.prototype,"spatialReference",null),e([n()],Ne.prototype,"templates",null),e([n({type:me,json:{name:"layerDefinition.timeInfo",write:{overridePolicy:Le},origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:Le}},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:{overridePolicy:Le}}}}})],Ne.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ne.prototype,"title",null),e([p("title")],Ne.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ne.prototype,"type",void 0),e([n(Ie(i(te)))],Ne.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:Se()}})],Ne.prototype,"visible",void 0),Ne=e([a("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ne);export{Ne as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import o from"../../../geometry/Extent.js";import{projectWithZConversion as n}from"../../../geometry/projectionUtils.js";import{load as i,execute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as l}from"../../../geometry/support/aaBoundingRect.js";import c from"../../ElevationLayer.js";import p from"../../ImageryLayer.js";import{getMetersPerUnitOfSR as m}from"../core/utils.js";import{defaultOptions as u}from"../../support/ElevationQuery.js";import{ElevationTile as f}from"../../support/ElevationTile.js";import{ElevationTileData as y}from"../../support/ElevationTileData.js";import w from"../../support/RasterFunction.js";import{TileElevationSampler as g}from"../../support/TileElevationSampler.js";import d from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{fetchArcGISServiceJSON as j}from"../../../support/requestPresets.js";import{logAndThrow as R}from"../../../widgets/OrientedImageryViewer/utils.js";async function h(t,r,a){if(!r.extent||!r.url)throw R("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await E(r);if(!o)throw R("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return x(t,o,a)}async function x(e,t,r){await a(r);const o=z(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}async function E(e,a){let o;const{extent:n,rasterFunction:i,url:s,lod:l}=e;try{o=await q(s)}catch(c){if(r(c))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",c)}switch(o){case 0:return await L(s,n,i,a);case 1:return await I(s,n,l,a);default:return}}async function I(e,a,o,n){const i=new c(e);let s;try{const{tileInfo:e}=await i.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";s=await i.createElevationSampler(a,{...n,demResolution:t})}catch(l){if(r(l))return;t.getLogger(i).error(l)}finally{i.destroy()}return s}async function L(e,t,r,a){const n=r?new w({functionName:r}):void 0,c=new p({url:e,rasterFunction:n,format:"lerc"});await c.load(a);const m=512,j=t.center,R=Math.max(t.width,t.height);let h=new o({xmin:j.x-R/2,ymin:j.y-R/2,xmax:j.x+R/2,ymax:j.y+R/2,spatialReference:t.spatialReference});c.spatialReference.equals(h.spatialReference)||(await i(),h=s(h,c.spatialReference));const x=await c.fetchPixels(h,m,m,a),E=d.create({scales:[R/m],size:m,spatialReference:h.spatialReference}),I=new v(0,0,0,l(h)),L=new y(x.pixelBlock.pixels[0],m,m,0),q=[new f(I,L)],z=u.noDataValue;return new g({tiles:q,tileInfo:E,noDataValue:z})}async function q(t,r){await a(r);const o=await j(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?2:1:0}function z(e,t){return async r=>{let a=r.clone();const o=r.spatialReference.equals(e.spatialReference)?a:await n(r,e.spatialReference,t),i=e.queryElevation(o);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function P(e,t,r){return await a(r),e.map(e=>(e.z=t,e))}function T(e,t){const{averageGroundElevation:r,spatialReference:a}=t,o=m(a);return e.map(e=>{const t=e.clone();return t.z=r*o/e.spatialReference.metersPerUnit,t})}export{E as getElevationSampler,L as getElevationSamplerFromDynamicImageService,T as updateUsingAverageGroundElevation,P as updateUsingConstant,x as updateUsingElevationSampler,h as updateUsingElevationSource,q as validateElevationSourceURL};
5
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{isAbortError as r,waitTick as a}from"../../../core/promiseUtils.js";import o from"../../../geometry/Extent.js";import{projectWithZConversion as n}from"../../../geometry/projectionUtils.js";import{load as i,execute as s}from"../../../geometry/operators/projectOperator.js";import{fromExtent as l}from"../../../geometry/support/aaBoundingRect.js";import c from"../../ElevationLayer.js";import p from"../../ImageryLayer.js";import{getMetersPerUnitOfSR as m}from"../core/utils.js";import{defaultOptions as u}from"../../support/ElevationQuery.js";import{ElevationTile as f}from"../../support/ElevationTile.js";import{ElevationTileData as y}from"../../support/ElevationTileData.js";import w from"../../support/RasterFunction.js";import{TileElevationSampler as g}from"../../support/TileElevationSampler.js";import d from"../../support/TileInfo.js";import{TileKey as v}from"../../support/TileKey.js";import{requestServiceJSON as j}from"../../../request/serviceJSON.js";import{logAndThrow as R}from"../../../widgets/OrientedImageryViewer/utils.js";async function h(t,r,a){if(!r.extent||!r.url)throw R("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await E(r);if(!o)throw R("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return x(t,o,a)}async function x(e,t,r){await a(r);const o=z(t,r),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}async function E(e,a){let o;const{extent:n,rasterFunction:i,url:s,lod:l}=e;try{o=await q(s)}catch(c){if(r(c))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",c)}switch(o){case 0:return await L(s,n,i,a);case 1:return await I(s,n,l,a);default:return}}async function I(e,a,o,n){const i=new c(e);let s;try{const{tileInfo:e}=await i.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";s=await i.createElevationSampler(a,{...n,demResolution:t})}catch(l){if(r(l))return;t.getLogger(i).error(l)}finally{i.destroy()}return s}async function L(e,t,r,a){const n=r?new w({functionName:r}):void 0,c=new p({url:e,rasterFunction:n,format:"lerc"});await c.load(a);const m=512,j=t.center,R=Math.max(t.width,t.height);let h=new o({xmin:j.x-R/2,ymin:j.y-R/2,xmax:j.x+R/2,ymax:j.y+R/2,spatialReference:t.spatialReference});c.spatialReference.equals(h.spatialReference)||(await i(),h=s(h,c.spatialReference));const x=await c.fetchPixels(h,m,m,a),E=d.create({scales:[R/m],size:m,spatialReference:h.spatialReference}),I=new v(0,0,0,l(h)),L=new y(x.pixelBlock.pixels[0],m,m,0),q=[new f(I,L)],z=u.noDataValue;return new g({tiles:q,tileInfo:E,noDataValue:z})}async function q(t,r){await a(r);const o=await j(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?2:1:0}function z(e,t){return async r=>{let a=r.clone();const o=r.spatialReference.equals(e.spatialReference)?a:await n(r,e.spatialReference,t),i=e.queryElevation(o);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await n(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function S(e,t,r){return await a(r),e.map(e=>(e.z=t,e))}function T(e,t){const{averageGroundElevation:r,spatialReference:a}=t,o=m(a);return e.map(e=>{const t=e.clone();return t.z=r*o/e.spatialReference.metersPerUnit,t})}export{E as getElevationSampler,L as getElevationSamplerFromDynamicImageService,T as updateUsingAverageGroundElevation,S as updateUsingConstant,x as updateUsingElevationSampler,h as updateUsingElevationSource,q as validateElevationSourceURL};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{save as e,saveAs as r}from"./utils.js";import{createForItemWrite as t}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as o,typeKeyword as a,addTypeKeyword as s,hasTypeKeyword as n}from"../../portal/support/portalItemUtils.js";import{saveResources as i}from"../../webdoc/support/resourceUtils.js";const u="Group Layer",c="group-layer-save",l="group-layer-save-as",p=a.GROUP_LAYER_MAP;function m(e){return{isValid:"group"===e.type,errorMessage:"Layer.type should be 'group'"}}function y(e){return{isValid:n(e,p),errorMessage:`Layer.portalItem.typeKeywords should have '${p}'`}}function f(e,r){return{...t(e,"web-map",!0),initiator:r}}function v(e){const r=e.layerJSON;return Promise.resolve(r&&Object.keys(r).length?r:null)}async function d(e,r){r.title||=e.title,o(r,a.METADATA),s(r,p)}async function I(r,t){return e({layer:r,itemType:u,validateLayer:m,validateItem:y,createJSONContext:e=>f(e,r),createItemData:v,errorNamePrefix:c,saveResources:async(e,t)=>(r.sourceIsPortalItem||await e.removeAllResources().catch(()=>{}),i(r.resourceReferences,t))},t)}async function g(e,t,o){return r({layer:e,itemType:u,validateLayer:m,createJSONContext:r=>f(r,e),createItemData:v,errorNamePrefix:l,newItem:t,setItemProperties:d,saveResources:(r,t)=>i(e.resourceReferences,t)},o)}export{I as save,g as saveAs};
5
+ import{save as e,saveAs as r}from"./utils.js";import{createForItemWrite as t}from"../../portal/support/jsonContext.js";import{typeKeyword as o,hasTypeKeyword as a,removeTypeKeyword as s,addTypeKeyword as n}from"../../portal/support/portalItemUtils.js";import{saveResources as i}from"../../webdoc/support/resourceUtils.js";const u="Group Layer",c="group-layer-save",l="group-layer-save-as",p=o.GROUP_LAYER_MAP;function m(e){return{isValid:"group"===e.type,errorMessage:"Layer.type should be 'group'"}}function y(e){return{isValid:a(e,p),errorMessage:`Layer.portalItem.typeKeywords should have '${p}'`}}function f(e,r){return{...t(e,"web-map",!0),initiator:r}}function v(e){const r=e.layerJSON;return Promise.resolve(r&&Object.keys(r).length?r:null)}async function d(e,r){r.title||=e.title,s(r,o.METADATA),n(r,p)}async function I(r,t){return e({layer:r,itemType:u,validateLayer:m,validateItem:y,createJSONContext:e=>f(e,r),createItemData:v,errorNamePrefix:c,saveResources:async(e,t)=>(r.sourceIsPortalItem||await e.removeAllResources().catch(()=>{}),i(r.resourceReferences,t))},t)}async function g(e,t,o){return r({layer:e,itemType:u,validateLayer:m,createJSONContext:r=>f(r,e),createItemData:v,errorNamePrefix:l,newItem:t,setItemProperties:d,saveResources:(r,t)=>i(e.resourceReferences,t)},o)}export{I as save,g as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{save as e,saveAs as t}from"./utils.js";import{getPrimaryRasters as r}from"../support/rasterDatasets/datasetUtils.js";import{getWGS84ExtentForItem as a,removeTypeKeyword as s,typeKeyword as i,toggleTypeKeyword as y}from"../../portal/support/portalItemUtils.js";const l="Image Service",o="imagery-layer-save",m="imagery-layer-save-as",n="imagery-tile-layer-save",c="imagery-tile-layer-save-as",p="WCS",u="wcs-layer-save",g="wcs-layer-save-as";function v(e){if("imagery"===e.type||"wcs"===e.type)return{isValid:!0};const{raster:t}=e,a=r(t)[0];return{isValid:"RasterTileServer"===a?.datasetFormat&&("Raster"===a.tileType||"Map"===a.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function f(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function d(e,t){const{parsedUrl:r,title:l,fullExtent:o}=e;t.url=r.path,t.title||=l;try{t.extent=await a(o)}catch{t.extent=void 0}s(t,i.METADATA),y(t,i.TILED_IMAGERY,"imagery-tile"===e.type)}async function I(t,r){const a="imagery"===t.type?o:"imagery-tile"===t.type?n:u,s="wcs"===t.type?p:l;return e({layer:t,itemType:s,validateLayer:v,createItemData:f,errorNamePrefix:a},r)}async function T(e,r,a){const s="imagery"===e.type?m:"imagery-tile"===e.type?c:g,i="wcs"===e.type?p:l;return t({layer:e,itemType:i,validateLayer:v,createItemData:f,errorNamePrefix:s,newItem:r,setItemProperties:d},a)}export{I as save,T as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getPrimaryRasters as r}from"../support/rasterDatasets/datasetUtils.js";import{getWGS84ExtentForItem as a,removeTypeKeyword as s,toggleTypeKeyword as i,typeKeyword as y}from"../../portal/support/portalItemUtils.js";const l="Image Service",o="imagery-layer-save",m="imagery-layer-save-as",n="imagery-tile-layer-save",c="imagery-tile-layer-save-as",p="WCS",u="wcs-layer-save",g="wcs-layer-save-as";function v(e){if("imagery"===e.type||"wcs"===e.type)return{isValid:!0};const{raster:t}=e,a=r(t)[0];return{isValid:"RasterTileServer"===a?.datasetFormat&&("Raster"===a.tileType||"Map"===a.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function f(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function d(e,t){const{parsedUrl:r,title:l,fullExtent:o}=e;t.url=r.path,t.title||=l;try{t.extent=await a(o)}catch{t.extent=void 0}s(t,y.METADATA),i(t,y.TILED_IMAGERY,"imagery-tile"===e.type)}async function I(t,r){const a="imagery"===t.type?o:"imagery-tile"===t.type?n:u,s="wcs"===t.type?p:l;return e({layer:t,itemType:s,validateLayer:v,createItemData:f,errorNamePrefix:a},r)}async function T(e,r,a){const s="imagery"===e.type?m:"imagery-tile"===e.type?c:g,i="wcs"===e.type?p:l;return t({layer:e,itemType:i,validateLayer:v,createItemData:f,errorNamePrefix:s,newItem:r,setItemProperties:d},a)}export{I as save,T as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,removeTypeKeyword as a,typeKeyword as s,addTypeKeyword as l}from"../../portal/support/portalItemUtils.js";const n="Stream Service",i="Feed",o="stream-layer-save",m="stream-layer-save-as";function u(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function c(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function y(e,t){const{parsedUrl:n,title:i,fullExtent:o}=e;t.url=n.path,t.title||=i,t.extent=null,null!=o&&(t.extent=await r(o)),a(t,s.METADATA),l(t,s.SINGLE_LAYER)}async function p(t,r){return e({layer:t,itemType:n,additionalItemType:i,validateLayer:u,createItemData:c,errorNamePrefix:o},r)}async function f(e,r,a){return t({layer:e,itemType:n,validateLayer:u,createItemData:c,errorNamePrefix:m,newItem:r,setItemProperties:y},a)}export{p as save,f as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,removeTypeKeyword as a,addTypeKeyword as s,typeKeyword as l}from"../../portal/support/portalItemUtils.js";const n="Stream Service",i="Feed",o="stream-layer-save",m="stream-layer-save-as";function u(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function c(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function y(e,t){const{parsedUrl:n,title:i,fullExtent:o}=e;t.url=n.path,t.title||=i,t.extent=null,null!=o&&(t.extent=await r(o)),a(t,l.METADATA),s(t,l.SINGLE_LAYER)}async function p(t,r){return e({layer:t,itemType:n,additionalItemType:i,validateLayer:u,createItemData:c,errorNamePrefix:o},r)}async function f(e,r,a){return t({layer:e,itemType:n,validateLayer:u,createItemData:c,errorNamePrefix:m,newItem:r,setItemProperties:y},a)}export{p as save,f as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import r from"./FieldFormat.js";const s="auto";let p=class extends r{constructor(t){super(t),this.dateStyle=null,this.hour12=s,this.month=null,this.timeStyle=null,this.type="date-time",this.year=null}};t([o({type:["full","long","medium","short"],json:{write:!0}})],p.prototype,"dateStyle",void 0),t([o({type:["always","auto","never"],nonNullable:!0,json:{default:s,write:!0}})],p.prototype,"hour12",void 0),t([o({type:["long","short"],json:{write:!0}})],p.prototype,"month",void 0),t([o({type:["full","long","medium","short"],json:{write:!0}})],p.prototype,"timeStyle",void 0),t([o({type:["date-time"]})],p.prototype,"type",void 0),t([o({type:["numeric"],json:{write:!0}})],p.prototype,"year",void 0),p=t([e("esri.layers.support.DateTimeFieldFormat")],p);export{p as default};
5
+ import{__decorate as t}from"tslib";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import r from"./FieldFormat.js";const s="auto";let p=class extends r{constructor(t){super(t),this.dateStyle=null,this.hour12=s,this.month=null,this.timeStyle=null,this.type="date-time",this.year=null}};t([o({type:["full","long","medium","short"],json:{write:!0}})],p.prototype,"dateStyle",void 0),t([o({type:["always","auto","never"],nonNullable:!0,json:{default:s,write:!0}})],p.prototype,"hour12",void 0),t([o({type:["long","short"],json:{write:!0}})],p.prototype,"month",void 0),t([o({type:["full","long","medium","short"],json:{write:!0}})],p.prototype,"timeStyle",void 0),t([o({type:["date-time"]})],p.prototype,"type",void 0),t([o({type:["numeric"],json:{write:!0}})],p.prototype,"year",void 0),p=t([e("esri.layers.support.DateTimeFieldFormat")],p);const i=p;export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as r}from"tslib";import{ClonableMixin as o}from"../../core/Clonable.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(o(e)){constructor(r){super(r),this.type=null}};r([t({type:["date-time","number"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],p.prototype,"type",void 0),p=r([s("esri.layers.support.FieldFormat")],p);export{p as default};
5
+ import{__decorate as r}from"tslib";import{ClonableMixin as o}from"../../core/Clonable.js";import{JSONSupport as e}from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(o(e)){constructor(r){super(r),this.type=null}};r([t({type:["date-time","number"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],p.prototype,"type",void 0),p=r([s("esri.layers.support.FieldFormat")],p);const a=p;export{a as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{fetchArcGISServiceJSON as t}from"../../support/requestPresets.js";class e{constructor(){this._serviceMetadatas=new Map,this._itemDatas=new Map}async fetchServiceMetadata(e,a){const s=this._serviceMetadatas.get(e);if(s)return s;const r=await t(e,a);return this._serviceMetadatas.set(e,r),r}async fetchItemData(t){const{id:e}=t;if(!e)return null;const{_itemDatas:a}=this;if(a.has(e))return a.get(e);const s=await t.fetchData();return a.set(e,s),s}async fetchCustomParameters(t,e){const a=await this.fetchItemData(t);return a&&"object"==typeof a&&(e?e(a):a.customParameters)||null}}export{e as LayerLoadContext};
5
+ import{requestServiceJSON as t}from"../../request/serviceJSON.js";class e{constructor(){this._serviceMetadatas=new Map,this._itemDatas=new Map}async fetchServiceMetadata(e,a){const s=this._serviceMetadatas.get(e);if(s)return s;const r=await t(e,a);return this._serviceMetadatas.set(e,r),r}async fetchItemData(t){const{id:e}=t;if(!e)return null;const{_itemDatas:a}=this;if(a.has(e))return a.get(e);const s=await t.fetchData();return a.set(e,s),s}async fetchCustomParameters(t,e){const a=await this.fetchItemData(t);return a&&"object"==typeof a&&(e?e(a):a.customParameters)||null}}export{e as LayerLoadContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{Integer as o}from"../../core/accessorSupport/ensureType.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"./FieldFormat.js";const s={min:0,max:20},p=3,a=0,m="decimal",n="auto";let u=class extends i{constructor(t){super(t),this.maximumFractionDigits=p,this.minimumFractionDigits=a,this.style=m,this.type="number",this.useGrouping=n}};t([e({type:o,nonNullable:!0,range:s,json:{default:p,write:!0}})],u.prototype,"maximumFractionDigits",void 0),t([e({type:o,nonNullable:!0,range:s,json:{default:a,write:!0}})],u.prototype,"minimumFractionDigits",void 0),t([e({type:["decimal"],nonNullable:!0,json:{default:m,write:!0}})],u.prototype,"style",void 0),t([e({type:["number"]})],u.prototype,"type",void 0),t([e({type:["always","auto","never"],nonNullable:!0,json:{default:n,write:!0}})],u.prototype,"useGrouping",void 0),u=t([r("esri.layers.support.NumberFieldFormat")],u);export{u as default};
5
+ import{__decorate as t}from"tslib";import{Integer as o}from"../../core/accessorSupport/ensureType.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"./FieldFormat.js";const s={min:0,max:20},p=3,a=0,m="decimal",n="auto";let u=class extends i{constructor(t){super(t),this.maximumFractionDigits=p,this.minimumFractionDigits=a,this.style=m,this.type="number",this.useGrouping=n}};t([e({type:o,nonNullable:!0,range:s,json:{default:p,write:!0}})],u.prototype,"maximumFractionDigits",void 0),t([e({type:o,nonNullable:!0,range:s,json:{default:a,write:!0}})],u.prototype,"minimumFractionDigits",void 0),t([e({type:["decimal"],nonNullable:!0,json:{default:m,write:!0}})],u.prototype,"style",void 0),t([e({type:["number"]})],u.prototype,"type",void 0),t([e({type:["always","auto","never"],nonNullable:!0,json:{default:n,write:!0}})],u.prototype,"useGrouping",void 0),u=t([r("esri.layers.support.NumberFieldFormat")],u);const l=u;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{urlToObject as e,removeTrailingSlash as r,removeQueryParameters as t,getOrigin as s,join as n,Url as l,makeAbsolute as i}from"../../core/urlUtils.js";import{w as u}from"../../chunks/persistableUrlUtils.js";const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",knowledgegraphserver:"KnowledgeGraphServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer",videoserver:"VideoServer"},a=Object.values(o),c=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),v=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),d=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function f(e){return c.test(e)}function p(r){if(null==r)return null;const t=e(r),s=t?.path.match(c)||t?.path.match(v);if(!s)return null;const[,n,l,i,u]=s,a=l.indexOf("/");return{title:h(-1!==a?l.slice(a+1):l),serverType:o[i.toLowerCase()],sublayer:null!=u&&""!==u?parseInt(u,10):null,url:{path:n}}}function m(r){const t=e(r).path.match(d);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function h(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function w(e,r){const t=[];if(e){const r=p(e);null!=r&&r.title&&t.push(r.title)}if(r){const e=h(r);t.push(e)}if(2===t.length){if(t[0].toLowerCase().includes(t[1].toLowerCase()))return t[0];if(t[1].toLowerCase().includes(t[0].toLowerCase()))return t[1]}return t.join(" - ")}const g=["services","features","tiles","elevation3d","basemaps3d"];function y(e){let r=s(e,!0);return!!r&&(r=r.toLowerCase(),!!r.endsWith(".arcgis.com")&&(!!g.some(e=>r.startsWith(e))||/^[a-z\d-]+\.svcs[a-z\d-]*\./.test(r)))}function S(e,s){return e?r(t(e,s)):e}function b(s){let{url:n}=s;if(!n)return{url:n};n=t(n,s.logger);const l=e(n),i=p(l.path);let u;if(null!=i)null!=i.sublayer&&null==s.layer.layerId&&(u=i.sublayer),n=i.url.path;else if(s.nonStandardUrlAllowed){const e=m(l.path);null!=e&&(n=e.serviceUrl,u=e.sublayerId)}return{url:r(n),layerId:u}}function C(e,r,t,s,l){u(r,s,"url",l),s.url&&null!=e.layerId&&(s.url=n(s.url,t,e.layerId.toString()))}function I(e){if(!e)return!1;const r=e.toLowerCase(),t=r.includes("/services/"),s=r.includes("/mapserver/wmsserver"),n=r.includes("/imageserver/wmsserver"),l=r.includes("/wmsserver");return t&&(s||n||l)}function L(e){if(!e)return!1;const r=new l(i(e)),t=r.authority?.toLowerCase();return"server.arcgisonline.com"===t||"services.arcgisonline.com"===t}export{h as cleanTitle,f as isArcGISUrl,y as isHostedAgolService,L as isServerOrServicesAGOLUrl,I as isWmsServer,p as parse,m as parseNonStandardSublayerUrl,S as sanitizeUrl,b as sanitizeUrlWithLayerId,a as serverTypes,w as titleFromUrlAndName,C as writeUrlWithLayerId};
5
+ import{urlToObject as e,getOrigin as r,join as t,removeQueryParameters as s,removeTrailingSlash as n,Url as l,makeAbsolute as i}from"../../core/urlUtils.js";import{w as u}from"../../chunks/persistableUrlUtils.js";const o={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",knowledgegraphserver:"KnowledgeGraphServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer","3dtilesserver":"3DTilesServer",videoserver:"VideoServer"},a=Object.values(o),c=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),v=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^/\\n]+)\\/(${a.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),d=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function f(e){return c.test(e)}function p(r){if(null==r)return null;const t=e(r),s=t?.path.match(c)||t?.path.match(v);if(!s)return null;const[,n,l,i,u]=s,a=l.indexOf("/");return{title:h(-1!==a?l.slice(a+1):l),serverType:o[i.toLowerCase()],sublayer:null!=u&&""!==u?parseInt(u,10):null,url:{path:n}}}function m(r){const t=e(r).path.match(d);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function h(e){return(e=e.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function w(e,r){const t=[];if(e){const r=p(e);null!=r&&r.title&&t.push(r.title)}if(r){const e=h(r);t.push(e)}if(2===t.length){if(t[0].toLowerCase().includes(t[1].toLowerCase()))return t[0];if(t[1].toLowerCase().includes(t[0].toLowerCase()))return t[1]}return t.join(" - ")}const g=["services","features","tiles","elevation3d","basemaps3d"];function y(e){let t=r(e,!0);return!!t&&(t=t.toLowerCase(),!!t.endsWith(".arcgis.com")&&(!!g.some(e=>t.startsWith(e))||/^[a-z\d-]+\.svcs[a-z\d-]*\./.test(t)))}function S(e,r){return e?n(s(e,r)):e}function b(r){let{url:t}=r;if(!t)return{url:t};t=s(t,r.logger);const l=e(t),i=p(l.path);let u;if(null!=i)null!=i.sublayer&&null==r.layer.layerId&&(u=i.sublayer),t=i.url.path;else if(r.nonStandardUrlAllowed){const e=m(l.path);null!=e&&(t=e.serviceUrl,u=e.sublayerId)}return{url:n(t),layerId:u}}function C(e,r,s,n,l){u(r,n,"url",l),n.url&&null!=e.layerId&&(n.url=t(n.url,s,e.layerId.toString()))}function I(e){if(!e)return!1;const r=e.toLowerCase(),t=r.includes("/services/"),s=r.includes("/mapserver/wmsserver"),n=r.includes("/imageserver/wmsserver"),l=r.includes("/wmsserver");return t&&(s||n||l)}function L(e){if(!e)return!1;const r=new l(i(e)),t=r.authority?.toLowerCase();return"server.arcgisonline.com"===t||"services.arcgisonline.com"===t}export{h as cleanTitle,f as isArcGISUrl,y as isHostedAgolService,L as isServerOrServicesAGOLUrl,I as isWmsServer,p as parse,m as parseNonStandardSublayerUrl,S as sanitizeUrl,b as sanitizeUrlWithLayerId,a as serverTypes,w as titleFromUrlAndName,C as writeUrlWithLayerId};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{urlToObject as r,getFilename as a}from"../../core/urlUtils.js";import{parse as t,parseNonStandardSublayerUrl as s}from"./arcgisLayerUrl.js";import{findAssociatedFeatureService as l}from"./associatedFeatureServiceUtils.js";import{getLayerModuleType as o,fetchFeatureService as n}from"./fetchService.js";import{getPreferredUrl as c,sceneServiceLayerTypeToClassName as i}from"./layerUtils.js";import{layerLookupMap as u}from"./lazyLayerLoader.js";import{fetchArcGISServiceJSON as y}from"../../support/requestPresets.js";const f={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function p(e){const{properties:r,url:a}=e,t={...r,url:a},s=await v(a,r?.customParameters),{Constructor:l,layerId:o,sourceJSON:n,parsedUrl:c,layers:i,tables:u}=s;if(i.length+u.length===0)return null!=o&&(t.layerId=o),null!=n&&(t.sourceJSON=n),new l(t);const y=new(0,(await import("../GroupLayer.js")).default)({title:c.title});return await w(y,s,t),y}function m(e,r){return e?e.find(({id:e})=>e===r):null}function d(e,r,a,t,s){const l={...s,layerId:r};return null!=e&&(l.url=e),null!=a&&(l.sourceJSON=a),"sublayerTitleMode"in t.prototype&&(l.sublayerTitleMode="service-name"),new t(l)}async function w(e,r,a){const t=r.sublayerConstructorProvider;for(const{id:s,serverUrl:l}of r.layers){const o=m(r.sublayerInfos,s),n=d(l,s,o,(o&&t?.(o))??r.Constructor,a);e.add(n)}if(r.tables.length){const t=await L("FeatureLayer");r.tables.forEach(({id:s,serverUrl:l})=>{const o=d(l,s,m(r.tableInfos,s),t,a);e.tables.add(o)})}}async function v(r,a){let s=t(r);if(null==s&&(s=await S(r,a)),null==s)throw new e("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:l,sublayer:n}=s;let u;const p={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},m="FeatureServer"===l,d="SceneServer"===l,w={parsedUrl:s,Constructor:null,layerId:m||d?n??void 0:void 0,layers:[],tables:[]};switch(l){case"MapServer":if(null!=n){const{type:t}=await y(r,{customParameters:a});switch(u="FeatureLayer",t){case"Catalog Layer":u="CatalogLayer";break;case"Catalog Dynamic Group Layer":throw new e("arcgis-layers:unsupported",`fromUrl() not supported for "${t}" layers`)}}else{u=await g(r,a)?"TileLayer":"MapImageLayer"}break;case"ImageServer":{const e=await y(r,{customParameters:a}),{tileInfo:t,cacheType:s}=e;u=t?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await y(s.url.path,{customParameters:a});if(u="SceneLayer",e){const r=e?.layers;if("Voxel"===e?.layerType)u="VoxelLayer";else if(r?.length){const e=r[0]?.layerType;null!=e&&null!=i[e]&&(u=i[e])}}break}case"3DTilesServer":throw new e("arcgis-layers:unsupported","fromUrl() not supported for 3DTiles layers");case"FeatureServer":if(u="FeatureLayer",null!=n){const e=await y(r,{customParameters:a});w.sourceJSON=e,w.preferredUrl=c(),u=o(e.type)}break;default:u=p[l]}if(f[u]&&null==n){const e=await h(r,l,a);m&&(w.preferredUrl=e.preferredUrl,w.sublayerInfos=e.layerInfos,w.tableInfos=e.tableInfos);if(1!==e.layers.length+e.tables.length)w.layers=e.layers,w.tables=e.tables,m&&e.layerInfos?.length&&(w.sublayerConstructorProvider=await P(e.layerInfos));else if(m||d){const r=e.layerInfos?.[0]??e.tableInfos?.[0];if(w.layerId=e.layers[0]?.id??e.tables[0]?.id,w.sourceJSON=r,m){const e=r?.type;u=o(e)}}}return w.Constructor=await L(u),w}async function S(e,t){const l=await y(e,{customParameters:t});let o=null,n=null;const c=l.type;if("Feature Layer"===c||"Table"===c?(o="FeatureServer",n=l.id??null):"indexedVector"===c?o="VectorTileServer":l.hasOwnProperty("mapName")?o="MapServer":l.hasOwnProperty("bandCount")&&l.hasOwnProperty("pixelSizeX")?o="ImageServer":l.hasOwnProperty("maxRecordCount")&&l.hasOwnProperty("allowGeometryUpdates")?o="FeatureServer":l.hasOwnProperty("streamUrls")?o="StreamServer":b(l)?(o="SceneServer",n=l.id):l.hasOwnProperty("layers")&&b(l.layers?.[0])&&(o="SceneServer"),!o)return null;const i=null!=n?s(e):null;return{title:null!=i&&l.name||a(e),serverType:o,sublayer:n,url:{path:null!=i?i.serviceUrl:r(e).path}}}function b(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function h(e,r,a){let t,s,l,o=!1;switch(r){case"FeatureServer":{const r=await n(e,{customParameters:a});l=c(e,{preferredHost:r.preferredHost}),o=!!r.layersJSON,t=r.layersJSON||r.serviceJSON;break}case"SceneServer":{const r=await I(e,a);t=r.serviceInfo,s=r.tableServerUrl;break}default:t=await y(e,{customParameters:a})}const i=t?.layers,u=t?.tables;return{preferredUrl:l,layers:i?.map(e=>({id:e.id})).reverse()||[],tables:u?.map(e=>({serverUrl:s,id:e.id})).reverse()||[],layerInfos:o?i:[],tableInfos:o?u:[]}}async function I(e,r){const a=await y(e,{customParameters:r}),t=a.layers?.[0];if(!t)return{serviceInfo:a};try{const{serverUrl:t}=await l(e),s=await y(t,{customParameters:r}).catch(()=>null);return s&&(a.tables=s.tables),{serviceInfo:a,tableServerUrl:t}}catch{return{serviceInfo:a}}}async function L(e){return(0,u[e])()}async function g(e,r){return(await y(e,{customParameters:r})).tileInfo}async function P(e){if(!e.length)return;const r=new Set,a=[];for(const{type:l}of e)r.has(l)||(r.add(l),a.push(L(o(l))));const t=await Promise.all(a),s=new Map;return Array.from(r).forEach((e,r)=>{s.set(e,t[r])}),e=>s.get(e.type)}export{p as fromUrl};
5
+ import e from"../../core/Error.js";import{urlToObject as r,getFilename as a}from"../../core/urlUtils.js";import{parse as t,parseNonStandardSublayerUrl as s}from"./arcgisLayerUrl.js";import{findAssociatedFeatureService as l}from"./associatedFeatureServiceUtils.js";import{getLayerModuleType as o,fetchFeatureService as n}from"./fetchService.js";import{getPreferredUrl as c,sceneServiceLayerTypeToClassName as i}from"./layerUtils.js";import{layerLookupMap as u}from"./lazyLayerLoader.js";import{requestServiceJSON as y}from"../../request/serviceJSON.js";const f={FeatureLayer:!0,SceneLayer:!0,VideoLayer:!0};async function p(e){const{properties:r,url:a}=e,t={...r,url:a},s=await w(a,r?.customParameters),{Constructor:l,layerId:o,sourceJSON:n,parsedUrl:c,layers:i,tables:u}=s;if(i.length+u.length===0)return null!=o&&(t.layerId=o),null!=n&&(t.sourceJSON=n),new l(t);const y=new(0,(await import("../GroupLayer.js")).default)({title:c.title});return await v(y,s,t),y}function m(e,r){return e?e.find(({id:e})=>e===r):null}function d(e,r,a,t,s){const l={...s,layerId:r};return null!=e&&(l.url=e),null!=a&&(l.sourceJSON=a),"sublayerTitleMode"in t.prototype&&(l.sublayerTitleMode="service-name"),new t(l)}async function v(e,r,a){const t=r.sublayerConstructorProvider;for(const{id:s,serverUrl:l}of r.layers){const o=m(r.sublayerInfos,s),n=d(l,s,o,(o&&t?.(o))??r.Constructor,a);e.add(n)}if(r.tables.length){const t=await L("FeatureLayer");r.tables.forEach(({id:s,serverUrl:l})=>{const o=d(l,s,m(r.tableInfos,s),t,a);e.tables.add(o)})}}async function w(r,a){let s=t(r);if(null==s&&(s=await S(r,a)),null==s)throw new e("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:l,sublayer:n}=s;let u;const p={FeatureServer:"FeatureLayer",KnowledgeGraphServer:"KnowledgeGraphLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer",VideoServer:"VideoLayer"},m="FeatureServer"===l,d="SceneServer"===l,v={parsedUrl:s,Constructor:null,layerId:m||d?n??void 0:void 0,layers:[],tables:[]};switch(l){case"MapServer":if(null!=n){const{type:t}=await y(r,{customParameters:a});switch(u="FeatureLayer",t){case"Catalog Layer":u="CatalogLayer";break;case"Catalog Dynamic Group Layer":throw new e("arcgis-layers:unsupported",`fromUrl() not supported for "${t}" layers`)}}else{u=await g(r,a)?"TileLayer":"MapImageLayer"}break;case"ImageServer":{const e=await y(r,{customParameters:a}),{tileInfo:t,cacheType:s}=e;u=t?"LERC"!==t?.format?.toUpperCase()||s&&"elevation"!==s.toLowerCase()?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const e=await y(s.url.path,{customParameters:a});if(u="SceneLayer",e){const r=e?.layers;if("Voxel"===e?.layerType)u="VoxelLayer";else if(r?.length){const e=r[0]?.layerType;null!=e&&null!=i[e]&&(u=i[e])}}break}case"3DTilesServer":throw new e("arcgis-layers:unsupported","fromUrl() not supported for 3DTiles layers");case"FeatureServer":if(u="FeatureLayer",null!=n){const e=await y(r,{customParameters:a});v.sourceJSON=e,v.preferredUrl=c(),u=o(e.type)}break;default:u=p[l]}if(f[u]&&null==n){const e=await h(r,l,a);m&&(v.preferredUrl=e.preferredUrl,v.sublayerInfos=e.layerInfos,v.tableInfos=e.tableInfos);if(1!==e.layers.length+e.tables.length)v.layers=e.layers,v.tables=e.tables,m&&e.layerInfos?.length&&(v.sublayerConstructorProvider=await P(e.layerInfos));else if(m||d){const r=e.layerInfos?.[0]??e.tableInfos?.[0];if(v.layerId=e.layers[0]?.id??e.tables[0]?.id,v.sourceJSON=r,m){const e=r?.type;u=o(e)}}}return v.Constructor=await L(u),v}async function S(e,t){const l=await y(e,{customParameters:t});let o=null,n=null;const c=l.type;if("Feature Layer"===c||"Table"===c?(o="FeatureServer",n=l.id??null):"indexedVector"===c?o="VectorTileServer":l.hasOwnProperty("mapName")?o="MapServer":l.hasOwnProperty("bandCount")&&l.hasOwnProperty("pixelSizeX")?o="ImageServer":l.hasOwnProperty("maxRecordCount")&&l.hasOwnProperty("allowGeometryUpdates")?o="FeatureServer":l.hasOwnProperty("streamUrls")?o="StreamServer":b(l)?(o="SceneServer",n=l.id):l.hasOwnProperty("layers")&&b(l.layers?.[0])&&(o="SceneServer"),!o)return null;const i=null!=n?s(e):null;return{title:null!=i&&l.name||a(e),serverType:o,sublayer:n,url:{path:null!=i?i.serviceUrl:r(e).path}}}function b(e){return null!=e&&e.hasOwnProperty("store")&&e.hasOwnProperty("id")&&"number"==typeof e.id}async function h(e,r,a){let t,s,l,o=!1;switch(r){case"FeatureServer":{const r=await n(e,{customParameters:a});l=c(e,{preferredHost:r.preferredHost}),o=!!r.layersJSON,t=r.layersJSON||r.serviceJSON;break}case"SceneServer":{const r=await I(e,a);t=r.serviceInfo,s=r.tableServerUrl;break}default:t=await y(e,{customParameters:a})}const i=t?.layers,u=t?.tables;return{preferredUrl:l,layers:i?.map(e=>({id:e.id})).reverse()||[],tables:u?.map(e=>({serverUrl:s,id:e.id})).reverse()||[],layerInfos:o?i:[],tableInfos:o?u:[]}}async function I(e,r){const a=await y(e,{customParameters:r}),t=a.layers?.[0];if(!t)return{serviceInfo:a};try{const{serverUrl:t}=await l(e),s=await y(t,{customParameters:r}).catch(()=>null);return s&&(a.tables=s.tables),{serviceInfo:a,tableServerUrl:t}}catch{return{serviceInfo:a}}}async function L(e){return(0,u[e])()}async function g(e,r){return(await y(e,{customParameters:r})).tileInfo}async function P(e){if(!e.length)return;const r=new Set,a=[];for(const{type:l}of e)r.has(l)||(r.add(l),a.push(L(o(l))));const t=await Promise.all(a),s=new Map;return Array.from(r).forEach((e,r)=>{s.set(e,t[r])}),e=>s.get(e.type)}export{p as fromUrl};