@arcgis/core 4.26.0-next.20230129 → 4.26.0-next.20230131

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 (288) hide show
  1. package/WebMap.js +1 -1
  2. package/arcade/ArcadeDate.js +1 -1
  3. package/arcade/featureset/actions/Adapted.js +1 -1
  4. package/arcade/featureset/support/errorsupport.js +1 -1
  5. package/arcade/featureset/support/sqlUtils.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/19dbdae6a8653729031f.js +1 -0
  8. package/assets/esri/core/workers/chunks/2b02802fc2dbd210d770.js +1 -0
  9. package/assets/esri/core/workers/chunks/3a7e68ceccd7f24d193a.js +1 -0
  10. package/assets/esri/core/workers/chunks/3d457f987e2089d67e89.js +1 -0
  11. package/assets/esri/core/workers/chunks/3e7d72a30d0cd6d22b0e.js +1 -0
  12. package/assets/esri/core/workers/chunks/4ad56714f4fa710a7217.js +1 -0
  13. package/assets/esri/core/workers/chunks/4d1e1deedbe55eb9654c.js +1 -0
  14. package/assets/esri/core/workers/chunks/553b2c9d1a9a08188740.js +1 -0
  15. package/assets/esri/core/workers/chunks/5760b147672515aabaa1.js +1 -0
  16. package/assets/esri/core/workers/chunks/5b1f4843d71e2ece5e8d.js +1 -0
  17. package/assets/esri/core/workers/chunks/5b33dfcc42d11dd2b904.js +1 -0
  18. package/assets/esri/core/workers/chunks/617be82059e9c1a1df7d.js +1 -0
  19. package/assets/esri/core/workers/chunks/79bd45620f6cb24510bb.js +1 -0
  20. package/assets/esri/core/workers/chunks/7a4ed83fb1ae20ef7459.js +1 -0
  21. package/assets/esri/core/workers/chunks/7b01f2402cf71646a59e.js +1 -0
  22. package/assets/esri/core/workers/chunks/7fe4013754f7795c6759.js +1 -0
  23. package/assets/esri/core/workers/chunks/981de9213fd62cf32f5d.js +1 -0
  24. package/assets/esri/core/workers/chunks/{71a975eb4407cc255c4a.js → 9a6ce40fd90650634c2b.js} +1 -1
  25. package/assets/esri/core/workers/chunks/9dcbecdc884175c417db.js +1 -0
  26. package/assets/esri/core/workers/chunks/{b8d80d8b52c3a86bd0d2.js → a3ae2479e0202bc31b4a.js} +1 -1
  27. package/assets/esri/core/workers/chunks/a76b46a907a6d034519d.js +1 -0
  28. package/assets/esri/core/workers/chunks/e221be8f54b451af08c8.js +1 -0
  29. package/assets/esri/core/workers/chunks/e74429d05bf5f1a0dd3d.js +1 -0
  30. package/assets/esri/core/workers/chunks/{be83f84e219c8d4dba43.js → e8615da06be5e2b1506c.js} +1 -1
  31. package/assets/esri/core/workers/chunks/e95f9324c27d7d480e75.js +1 -0
  32. package/assets/esri/core/workers/chunks/f3954dbccc7578ab8942.js +1 -0
  33. package/assets/esri/core/workers/chunks/f65ebfa496dcd53d957b.js +1 -0
  34. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  35. package/assets/esri/themes/base/_core.scss +2 -0
  36. package/assets/esri/themes/base/widgets/_Editor.scss +0 -11
  37. package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -18
  38. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +41 -0
  39. package/assets/esri/themes/dark/main.css +1 -1
  40. package/assets/esri/themes/light/main.css +1 -1
  41. package/assets/esri/themes/light/view.css +1 -1
  42. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D.json +1 -1
  43. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_ar.json +1 -1
  44. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_bg.json +1 -1
  45. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_bs.json +1 -1
  46. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_ca.json +1 -1
  47. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_cs.json +1 -1
  48. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_da.json +1 -1
  49. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_de.json +1 -1
  50. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_el.json +1 -1
  51. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_en.json +1 -1
  52. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_es.json +1 -1
  53. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_et.json +1 -1
  54. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_fi.json +1 -1
  55. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_fr.json +1 -1
  56. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_he.json +1 -1
  57. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_hr.json +1 -1
  58. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_hu.json +1 -1
  59. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_id.json +1 -1
  60. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_it.json +1 -1
  61. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_ja.json +1 -1
  62. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_ko.json +1 -1
  63. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_lt.json +1 -1
  64. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_lv.json +1 -1
  65. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_nb.json +1 -1
  66. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_nl.json +1 -1
  67. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_pl.json +1 -1
  68. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_pt-BR.json +1 -1
  69. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_pt-PT.json +1 -1
  70. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_ro.json +1 -1
  71. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_ru.json +1 -1
  72. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_sk.json +1 -1
  73. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_sl.json +1 -1
  74. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_sr.json +1 -1
  75. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_sv.json +1 -1
  76. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_th.json +1 -1
  77. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_tr.json +1 -1
  78. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_uk.json +1 -1
  79. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_vi.json +1 -1
  80. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_zh-CN.json +1 -1
  81. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_zh-HK.json +1 -1
  82. package/assets/esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D_zh-TW.json +1 -1
  83. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D.json +1 -1
  84. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_ar.json +1 -1
  85. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_bg.json +1 -1
  86. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_bs.json +1 -1
  87. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_ca.json +1 -1
  88. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_cs.json +1 -1
  89. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_da.json +1 -1
  90. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_de.json +1 -1
  91. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_el.json +1 -1
  92. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_en.json +1 -1
  93. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_es.json +1 -1
  94. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_et.json +1 -1
  95. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_fi.json +1 -1
  96. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_fr.json +1 -1
  97. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_he.json +1 -1
  98. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_hr.json +1 -1
  99. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_hu.json +1 -1
  100. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_id.json +1 -1
  101. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_it.json +1 -1
  102. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_ja.json +1 -1
  103. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_ko.json +1 -1
  104. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_lt.json +1 -1
  105. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_lv.json +1 -1
  106. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_nb.json +1 -1
  107. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_nl.json +1 -1
  108. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_pl.json +1 -1
  109. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_pt-BR.json +1 -1
  110. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_pt-PT.json +1 -1
  111. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_ro.json +1 -1
  112. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_ru.json +1 -1
  113. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_sk.json +1 -1
  114. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_sl.json +1 -1
  115. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_sr.json +1 -1
  116. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_sv.json +1 -1
  117. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_th.json +1 -1
  118. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_tr.json +1 -1
  119. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_uk.json +1 -1
  120. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_vi.json +1 -1
  121. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_zh-CN.json +1 -1
  122. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_zh-HK.json +1 -1
  123. package/assets/esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D_zh-TW.json +1 -1
  124. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  125. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  126. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  127. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  128. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  129. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  130. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  131. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  132. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  133. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  134. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  135. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  136. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  137. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  138. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  139. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  140. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  141. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  142. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  143. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  144. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  145. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  146. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  147. package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
  148. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  149. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  150. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  151. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  152. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  153. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  154. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  155. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  156. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  157. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  158. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  159. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  160. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  161. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  162. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  163. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  164. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  165. package/assets/esri/widgets/Slice/t9n/Slice.json +1 -1
  166. package/assets/esri/widgets/Slice/t9n/Slice_en.json +1 -1
  167. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -0
  168. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -0
  169. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -0
  170. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -0
  171. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -0
  172. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -0
  173. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -0
  174. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -0
  175. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -0
  176. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -0
  177. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -0
  178. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -0
  179. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -0
  180. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -0
  181. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -0
  182. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -0
  183. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -0
  184. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -0
  185. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -0
  186. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -0
  187. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -0
  188. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -0
  189. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -0
  190. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -0
  191. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -0
  192. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -0
  193. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -0
  194. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -0
  195. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -0
  196. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -0
  197. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -0
  198. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -0
  199. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -0
  200. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -0
  201. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -0
  202. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -0
  203. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -0
  204. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -0
  205. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -0
  206. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -0
  207. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -0
  208. package/chunks/RasterColorizer.glsl.js +3 -2
  209. package/chunks/vxlLayer.js +1 -1
  210. package/core/sql/StandardizedFunctions.js +1 -1
  211. package/core/sql/WhereClause.js +1 -1
  212. package/core/sql/WhereGrammar.js +1 -1
  213. package/geometry/support/coordsUtils.js +1 -1
  214. package/layers/FeatureLayer.js +1 -1
  215. package/layers/SubtypeGroupLayer.js +1 -1
  216. package/layers/VoxelWasmPerSceneView.js +1 -1
  217. package/layers/knowledgeGraph/KnowledgeGraphSubLayer.js +1 -1
  218. package/layers/mixins/FeatureLayerBase.js +1 -1
  219. package/layers/support/SubtypeSublayer.js +1 -1
  220. package/layers/support/featureLayerUtils.js +1 -1
  221. package/libs/maquette/projection.js +1 -1
  222. package/package.json +1 -1
  223. package/support/revision.js +1 -1
  224. package/views/2d/engine/brushes.js +1 -1
  225. package/views/2d/engine/imagery/BrushRasterBitmap.js +1 -1
  226. package/views/2d/engine/imagery/processor/rasterProcessor.js +1 -1
  227. package/views/2d/engine/rasterBrushes.js +5 -0
  228. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  229. package/views/2d/interactive/editingTools/MediaTransformToolsWrapper.js +1 -1
  230. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  231. package/views/2d/layers/TileLayerView2D.js +1 -1
  232. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  233. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  234. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  235. package/views/3d/interactive/visualElements/EngineVisualElement.js +5 -0
  236. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  237. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  238. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  239. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  240. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  241. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  242. package/views/3d/layers/graphics/lodResourceUtils.js +1 -1
  243. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  244. package/views/3d/layers/interfaces.js +1 -1
  245. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  246. package/views/3d/terrain/OverlayRenderer.js +1 -1
  247. package/views/3d/webgl-engine/lib/lodRendering/LevelSelector.js +1 -1
  248. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  249. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  250. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  251. package/widgets/AreaMeasurement3D.js +1 -1
  252. package/widgets/DirectLineMeasurement3D.js +1 -1
  253. package/widgets/Editor.js +1 -1
  254. package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
  255. package/widgets/FeatureForm.js +1 -1
  256. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +5 -0
  257. package/widgets/UtilityNetworkAssociations.js +5 -0
  258. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  259. package/widgets/ValuePicker/ValuePickerCollection.js +1 -1
  260. package/widgets/ValuePicker/ValuePickerCombobox.js +1 -1
  261. package/widgets/ValuePicker/ValuePickerSlider.js +1 -1
  262. package/widgets/ValuePicker/ValuePickerViewModel.js +1 -1
  263. package/widgets/ValuePicker.js +1 -1
  264. package/assets/esri/core/workers/chunks/02157c876c0c0886e2f7.js +0 -1
  265. package/assets/esri/core/workers/chunks/09975049ce6c426af5a7.js +0 -1
  266. package/assets/esri/core/workers/chunks/10ed4c92d56a0a4061a6.js +0 -1
  267. package/assets/esri/core/workers/chunks/1891bd626592a8cc3e7e.js +0 -1
  268. package/assets/esri/core/workers/chunks/1cf86638f8e097d8e6e2.js +0 -1
  269. package/assets/esri/core/workers/chunks/330b8c72baa725516ef5.js +0 -1
  270. package/assets/esri/core/workers/chunks/34eff65b53f7770ffa65.js +0 -1
  271. package/assets/esri/core/workers/chunks/3fa91ee5299cd5f470c1.js +0 -1
  272. package/assets/esri/core/workers/chunks/5002d6584996b5a12828.js +0 -1
  273. package/assets/esri/core/workers/chunks/53197e8e017235c5efcb.js +0 -1
  274. package/assets/esri/core/workers/chunks/594674e926a3c245fa84.js +0 -1
  275. package/assets/esri/core/workers/chunks/6fee0bf26d3a142ec75c.js +0 -1
  276. package/assets/esri/core/workers/chunks/83f7e22a12d90ef93e62.js +0 -1
  277. package/assets/esri/core/workers/chunks/889325cf1ae14bbce862.js +0 -1
  278. package/assets/esri/core/workers/chunks/a0922cbd36abd9e734b5.js +0 -1
  279. package/assets/esri/core/workers/chunks/a0a5aace9845eb383667.js +0 -1
  280. package/assets/esri/core/workers/chunks/ba7239089a04098e3619.js +0 -1
  281. package/assets/esri/core/workers/chunks/c49510a48cdf64a0d9fc.js +0 -1
  282. package/assets/esri/core/workers/chunks/c7ea6f1b1a01fc118434.js +0 -1
  283. package/assets/esri/core/workers/chunks/c86eddf3dc51500e98dd.js +0 -1
  284. package/assets/esri/core/workers/chunks/c9a9bb4c8b416f9b042a.js +0 -1
  285. package/assets/esri/core/workers/chunks/e9b43ea40587d2c5d039.js +0 -1
  286. package/assets/esri/core/workers/chunks/eda4c60b34833af1d139.js +0 -1
  287. package/assets/esri/core/workers/chunks/fa059d94d5051ded85b3.js +0 -1
  288. package/assets/esri/core/workers/chunks/fcf033c581f58d006cf6.js +0 -1
package/WebMap.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import a from"./core/Error.js";import s from"./core/Loadable.js";import{loadAll as n}from"./core/loadAll.js";import l from"./core/Logger.js";import{unwrap as p,isSome as m}from"./core/maybe.js";import{MultiOriginJSONMixin as u,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as c}from"./core/Promise.js";import{eachAlways as d}from"./core/promiseUtils.js";import{whenOnce as y}from"./core/reactiveUtils.js";import{urlToObject as w,isDataProtocol as g,dataComponents as f,addQueryParameter as b}from"./core/urlUtils.js";import{property as _}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import"./core/arrayUtils.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as I}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as S}from"./core/accessorSupport/originUtils.js";import{readLoadable as j}from"./core/accessorSupport/read.js";import U from"./geometry/SpatialReference.js";import{equals as P}from"./geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as O,webMercatorToGeographic as L}from"./geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as V}from"./layers/support/arcgisLayerUrl.js";import{isFeatureServiceLayer as R,isFeatureCollectionLayer as F}from"./layers/support/layerUtils.js";import T from"./networks/UtilityNetwork.js";import W from"./portal/Portal.js";import k from"./portal/PortalItem.js";import{removeTypeKeyword as N,addTypeKeyword as C,hasTypeKeyword as M,TypeKeyword as x}from"./portal/support/portalItemUtils.js";import{project as E}from"./rest/geometryService/project.js";import B from"./rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as G,isDeveloperBasemapLayer as J,findSpatialReference as D}from"./support/basemapUtils.js";import K from"./support/MapFloorInfo.js";import $ from"./webdoc/GeotriggersInfo.js";import z from"./webdoc/RangeInfo.js";import q from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as H}from"./webdoc/support/thumbnailUtils.js";import{getLayerJSON as Q}from"./webdoc/support/writeUtils.js";import X from"./webmap/ApplicationProperties.js";import Y from"./webmap/Bookmark.js";import Z from"./webmap/InitialViewProperties.js";import{Version as ee}from"./webmap/Version.js";import te from"./webmap/background/ColorBackground.js";const re=new ee(2,26),ie="Web Map",oe=o.ofType(Y),ae=o.ofType(T),se=new Map;se.set("image/jpeg","jpeg"),se.set("image/jpg","jpg"),se.set("image/png","png"),se.set("image/gif","gif");const ne="ArcGIS Pro",le=x.JSAPI,pe="CollectorDisabled",me="Collector",ue="Data Editing",he="OfflineDisabled",ce="Offline",de="Workforce Project",ye="Workforce Worker",we="Workforce Dispatcher",ge="Offline Map Areas",fe="FieldMapsDisabled",be=x.DEVELOPER_BASEMAP,_e="UtilityNetwork",ve=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));let Ie=class extends(u(s.LoadableMixin(c(r)))){constructor(e){super(e),this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1,this._thumbnailFilename=null,this._updateFromPromise=null,this._resourceReferences={portalItem:null,paths:[]},this.applicationProperties=null,this.bookmarks=new oe,this.floorInfo=null,this.geotriggersInfo=null,this.initialViewProperties=new Z,this.portalItem=null,this.presentation=null,this.sourceVersion=null,this.widgets=null,this.utilityNetworks=null,this.authoringApp=this.authoringAppVersion=null,this._isAuthoringAppSetByUser=this._isAuthoringAppVersionSetByUser=!1}destroy(){const e=this.portalItem;this.portalItem=null,e?.destroy()}initialize(){if(this.when().catch((e=>{l.getLogger(this.declaredClass).error("#load()","Failed to load web map",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t)}}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp=le}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}readInitialViewProperties(e,t){const r=new Z;t.background&&(r.background=te.fromJSON(t.background));const o=t.initialState?.viewpoint;if(o){if(o.rotation){ee.parse(t.version||"","webmap").lessThan(2,20)&&t.authoringApp===ne&&(o.rotation*=-1)}r.viewpoint=i.fromJSON(o)}return t.mapRangeInfo&&(r.rangeInfo=z.fromJSON(t.mapRangeInfo)),t.spatialReference&&(r.spatialReference=U.fromJSON(t.spatialReference)),r}writeInitialViewProperties(e,t,r,i){if(!e)return;const o=e.background;o&&o.color&&(t.background=o.write({},i)),e.viewpoint&&(t.initialState={viewpoint:e.viewpoint.write({},i)}),e.rangeInfo&&(t.mapRangeInfo=e.rangeInfo.toJSON(i)),e.spatialReference&&(t.spatialReference=e.spatialReference.write({},i))}writeLayers(e,t,r,i){t[r]=this._writeLayers(e,i,"operational-layers")}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new ee(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${re.major}.${re.minor}`}writeTables(e,t,r,i){const o=this._writeLayers(e,i,"tables");o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?(this._override("thumbnailUrl",e),this._thumbnailFilename=this._generateCustomThumbnailFilename(e)):this._clearThumbnailOverride()}load(e){return this.addResolvingPromise(this._loadFromSource()),Promise.resolve(this)}loadAll(){return n(this,(e=>{e(this.ground,this.basemap,this.layers,this.tables)}))}read(e,t){t={...t,origin:"web-map"};const r=this._getAuthoringPropsState();j(this,e,(t=>super.read(e,t)),t),this._restoreAuthoringPropsFromState(r)}write(e,t){if("loaded"!==this.loadStatus){const e=new a("webmap:not-loaded","Web map must be loaded before it can be serialized");throw l.getLogger(this.declaredClass).error("#toJSON()","Web map must be loaded before it can be serialized",this.loadError||this.loadStatus),e}return this._removeDanglingLayerRefs(),t={...t,origin:"web-map",restrictedWebMapWriting:!0,webmap:this},super.write(e,t)}async save(e){e=e||{},this._validateItem();const t=import("./webdoc/support/saveUtils.js");await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const r=this.portalItem,i=w(r.itemUrl),o={origin:"web-map",messages:[],writtenProperties:[],url:i,portal:r.portal||W.getDefault(),portalItem:r,verifyItemRelativeUrls:i?{rootPath:i.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},a=this.write({},o);return await Promise.all(o.resources.pendingOperations),this._validateJSONForWriting(o,e),await this._updateItemProperties(r),await this._updateItem(r,a,o),await Promise.all([this._updateItemThumbnail(),t.then((({saveResources:e})=>e(this._resourceReferences,o,null)))]),r}async saveAs(e,t){t=t||{};const r=this._getPortalItem(e),i=import("./webdoc/support/saveUtils.js");await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const o={origin:"web-map",messages:[],writtenProperties:[],url:null,portal:r.portal,portalItem:r,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},a=this.write({},o);await Promise.all(o.resources.pendingOperations),this._validateJSONForWriting(o,t),await this._updateItemPropertiesForSaveAs(r);const s=this._getThumbnailState();return await this._createItem(r,a,o,t),this._restoreThumbnailFromState(s),await Promise.all([this._updateItemThumbnail(),i.then((({saveResources:e})=>e(this._resourceReferences,o,null)))]),r}async updateFrom(e,t){const r=this._updateFromInternal(e,t);this._updateFromPromise=r,await r;r===this._updateFromPromise&&(this._updateFromPromise=null)}getLayerJSONFromResourceInfo(e){const t=this.resourceInfo;return this._collectAllLayersJSON([...t?.baseMap?.baseMapLayers||[],...t?.operationalLayers||[],...this.basemap?.resourceInfo?.data?.baseMapLayers||[]]).find((t=>t.id===e.id))}_collectAllLayersJSON(e){return e.reduce(((e,t)=>(e.push(t),"GroupLayer"===t.layerType&&(e=e.concat(this._collectAllLayersJSON(t.layers||[]))),e)),[])}_writeLayers(e,t,r){t={...t,layerContainerType:r};return e.map((e=>p(Q(e,"tables"===r?null:this.getLayerJSONFromResourceInfo(e),t)))).filter(Boolean).toArray()}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-map"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):Promise.resolve()}async _loadFromItem(e){if(await e.load().catch((e=>{throw new a("webmap:load-portal-item","Failed to load portal item",{error:e})})),"Web Map"!==e.type)throw new a("webmap:invalid-portal-item",`Invalid portal item type '${e.type}', expected 'Web Map'`,{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-map",url:w(e.itemUrl),portal:e.portal||W.getDefault(),portalItem:e,readResourcePaths:[]};return await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]},this._computeInitialViewpoint()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_validateJSON(e){const t=ee.parse(e.version||"","webmap");return re.validate(t),e.version=`${t.major}.${t.minor}`,e}_loadFromJSON(e,t){const r={context:{...t,layerContainerType:"operational-layers"}};return this.portalItem&&(r.context.portal=this.portalItem.portal||W.getDefault()),import("./layers/support/layersCreator.js").then((({populateOperationalLayers:t})=>{const i=[],o=e.operationalLayers;o&&o.length&&i.push(t(this.layers,o,r));const a={...r,context:{...r.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"},s=e.tables;return s&&s.length&&i.push(t(this.tables,s,a)),d(i).then((()=>{}))}))}async _computeInitialViewpoint(){let e=this.initialViewProperties;const t=e?.viewpoint?.targetGeometry;if(t)return;const r=await this._getExtentFromItem();r&&(e=e?e.clone():new Z,e.viewpoint=new i,e.viewpoint.targetGeometry=r,this.initialViewProperties=e)}async _getExtentFromItem(){const e=this.initialViewProperties?.spatialReference,t=this.portalItem?.extent;if(e&&t){if(e.isWGS84)return t.clone();if(e.isWebMercator)return O(t);return(await import("./portal/support/geometryServiceUtils.js")).getGeometryServiceURL(this.portalItem).then((r=>{const i=new B;return i.geometries=[t],i.outSpatialReference=e,E(r,i)})).then((e=>e[0])).catch((e=>(l.getLogger(this.declaredClass).error("Error projecting item's extent:",e),null)))}return null}_removeDanglingLayerRefs(){const e=this.applicationProperties,t=e&&e.viewing&&e.viewing.search,r=e=>this.allLayers.some((t=>t.id===e));t&&t.layers&&(t.layers=t.layers.filter((e=>r(e.id)))),t&&t.tables&&(t.tables=t.tables.filter((e=>this.tables.some((t=>t.id===e.id)))));const i=e&&e.editing&&e.editing.locationTracking;i&&i.info&&!r(i.info.layerId)&&(e.editing=null);const o=this.presentation&&this.presentation.slides;o&&o.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>r(e.id))))}))}async _validateMap(){if(!this.basemap?.baseLayers.length)throw new a("webmap:save","Map does not have a valid basemap with a base layer.");let e=null;if(await y((()=>{const t=D(this.initialViewProperties,this.basemap);return e=t.spatialReference,!t.updating})),!P(e,this.initialViewProperties.spatialReference))throw new a("webmap:save","The spatial reference of the basemap is not compatible with the one from the map.",{expected:this.initialViewProperties.spatialReference,actual:e})}_validateItem(){if(!this.portalItem)throw l.getLogger(this.declaredClass).error("save: requires the portalItem property to be set"),new a("webmap:portal-item-not-set","Portal item to save to has not been set on the WebMap");this._validateItemType(this.portalItem)}_validateItemType(e){if(e.type!==ie)throw new a("webmap:portal-item-wrong-type",`Portal item needs to have type "${ie}"`)}_loadLayerContainers(){const e=[];return this.basemap&&e.push(this.basemap.load()),this.ground&&e.push(this.ground.load()),d(e).then((()=>{}))}async _beforeSave(){const e=[];for(const t of this.allLayers)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await d(e)}_loadAllLayers(){const e=this._getAllLayersAndTables().map((e=>e.load()));return d(e).then((()=>{}))}_getAllLayersAndTables(){return this.allLayers.concat(this.allTables)}_validateJSONForWriting(e,t){let r=(e.messages?e.messages:[]).filter((e=>"error"===e.type)).map((e=>new a(e.name,e.message,e.details)));if(e.blockedRelativeUrls&&(r=r.concat(e.blockedRelativeUrls.map((e=>new a("url:unsupported",`Relative url '${e}' is not supported in Web Map`))))),t.ignoreUnsupported&&(r=r.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name))),r.length>0)throw new a("webmap:save","Failed to save webmap due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}async _updateItemProperties(e){e.extent=await this._getWGS84Extent(this.initialViewProperties.viewpoint.targetGeometry),await this._updateTypeKeywords(e)}async _updateItemPropertiesForSaveAs(e){N(e,pe),N(e,fe),N(e,x.METADATA),N(e,he),N(e,ge),N(e,we),N(e,de),N(e,ye),await this._updateItemProperties(e)}async _getWGS84Extent(e){const t=e.clone().normalize();let r;if(t.length>1)for(const i of t)r?i.width>r.width&&(r=i):r=i;else r=t[0];return this._projectToWGS84(r)}async _projectToWGS84(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return L(e);const r=await import("./portal/support/geometryServiceUtils.js"),i=await r.getGeometryServiceURL(this.portalItem),o=new B;o.geometries=[e],o.outSpatialReference=U.WGS84;return(await E(i,o))[0]}async _updateTypeKeywords(e){C(e,le),await this._loadAllLayers(),this._evalCollectorKeyword(e),this._evalDataEditingKeyword(e),this._evalOfflineKeyword(e),this._evalDeveloperBasemapKeyword(e),this._evalUtilityNetworkKeyword(e),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}_evalCollectorKeyword(e){M(e,pe)||M(e,de)||M(e,ye)||M(e,we)||!this._hasEditableFeatureLayer()?N(e,me):C(e,me)}_evalDataEditingKeyword(e){this._hasEditableFeatureLayer()?C(e,ue):N(e,ue)}_evalOfflineKeyword(e){!M(e,he)&&this._isOfflineCapableMap()?C(e,ce):N(e,ce)}_evalDeveloperBasemapKeyword(e){G(this.basemap)?C(e,be):N(e,be)}_evalUtilityNetworkKeyword(e){this.utilityNetworks?.length?C(e,_e):N(e,_e)}_hasEditableFeatureLayer(){return this._getAllLayersAndTables().some((e=>e.loaded&&R(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled))}_isOfflineCapableMap(){return this._getAllLayersAndTables().filter((e=>"group"!==e.type)).every((e=>e.loaded&&this._isOfflineCapableLayer(e)))}_isFeatureCollectionLike(e){return F(e)||"map-notes"===e.type||"route"===e.type}_isOfflineCapableLayer(e){return R(e)&&e.capabilities.operations.supportsSync||this._isFeatureCollectionLike(e)&&!e.portalItem||("tile"===e.type||"vector-tile"===e.type)&&(e.capabilities.operations.supportsExportTiles||this._isExportableAGOLTileLayer(e)||J(e))&&e.spatialReference.equals(this.initialViewProperties.spatialReference)}_isExportableAGOLTileLayer(e){return"tile"===e.type&&(V(e.url)&&ve.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async _updateItem(e,t,r){await e.update({data:t}),this._syncUpInstanceWithItem(e,t,r)}async _createItem(e,t,r,i){const o=this.portalItem,s=!!(o&&o.id&&o.portal.user),n=e.portal;if(await n.signIn(),!await this._canCopyItem(o,s,n))throw new a("webmap:save-as-copy-not-allowed","Owner of this map does not allow others to save a copy");await(n.user?.addItem({item:e,folder:i.folder,data:t})),this.portalItem=e,this._syncUpInstanceWithItem(e,t,r)}async _canCopyItem(e,t,r){return!(m(e)&&e.id&&e.typeKeywords&&e.typeKeywords.includes("useOnly"))||e.portal.portalHostname===r.portalHostname&&(t||await e.reload(),"admin"===e.itemControl||"update"===e.itemControl)}_syncUpInstanceWithItem(e,t,r){h.prototype.read.call(this,{version:t.version,authoringApp:t.authoringApp,authoringAppVersion:t.authoringAppVersion},{origin:"web-map",ignoreDefaults:!0,url:e.itemUrl&&w(e.itemUrl)}),S(r),this.resourceInfo=t}async _updateItemThumbnail(){this.thumbnailUrl&&this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl,filename:this._thumbnailFilename})),this._clearThumbnailOverride())}_getPortalItem(e){let t=k.from(e);return t.id&&(t=t.clone(),t.id=null),t.type||(t.type=ie),t.portal||(t.portal=W.getDefault()),this._validateItemType(t),t}async _updateFromInternal(e,t){if(t=t||{},await y((()=>e.ready)),this._updateInitialViewProperties(e,t),e.map===this)for(const r of e.allLayerViews)for(const e of["visible","featureEffect"])e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e]);await this._updateThumbnailUrl(e,t)}_updateInitialViewProperties(e,t){if(t.backgroundExcluded||(this.initialViewProperties.background=e.background?.clone()),this.initialViewProperties.spatialReference=e.spatialReference?.clone(),t.viewpointExcluded||(this.initialViewProperties.viewpoint=new i({rotation:e.rotation,scale:t.scalePreserved?e.scale:null,targetGeometry:this._getViewExtent(e)})),!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this)}_getViewExtent(e){const t=e.center.clone().normalize(),r=e.extent.clone(),i=r.width/2;return r.xmin=t.x-i,r.xmax=t.x+i,r}async _updateThumbnailUrl(e,t){if(t.thumbnailExcluded)return;const r=H(e,t.thumbnailSize),i=await e.takeScreenshot({format:"png",width:r.width,height:r.height});this._setAutoGeneratedThumbnail(i.dataUrl)}_setAutoGeneratedThumbnail(e){this.thumbnailUrl=e,this._thumbnailFilename=null}_clearThumbnailOverride(){this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"),this._thumbnailFilename=null}_generateCustomThumbnailFilename(e){if(g(e)){const t=f(e),r=t&&t.mediaType,i=r&&se.get(r.toLowerCase())||null,o=`thumbnail${Date.now()}`;return i?`${o}.${i}`:o}return null}_getThumbnailState(){let e=this.thumbnailUrl;return e&&(e=this._isOverridden("thumbnailUrl")?e:b(e,"w","8192")),{thumbnailUrl:e,filename:this._thumbnailFilename}}_restoreThumbnailFromState(e){this.thumbnailUrl=e.thumbnailUrl,this._thumbnailFilename=e.filename}_getAuthoringPropsState(){return{authoringApp:this.authoringApp,authoringAppVersion:this.authoringAppVersion,isAuthoringAppSetByUser:this._isAuthoringAppSetByUser,isAuthoringAppVersionSetByUser:this._isAuthoringAppVersionSetByUser}}_restoreAuthoringPropsFromState(e){e.isAuthoringAppSetByUser?this.authoringApp=e.authoringApp:this._isAuthoringAppSetByUser=!1,e.isAuthoringAppVersionSetByUser?this.authoringAppVersion=e.authoringAppVersion:this._isAuthoringAppVersionSetByUser=!1}static fromJSON(e){const t=e;if(!t)throw new a("webmap:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:t})}};Ie.VERSION=re,e([_({type:X,json:{write:!0}})],Ie.prototype,"applicationProperties",void 0),e([_({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],Ie.prototype,"authoringApp",null),e([A("authoringApp")],Ie.prototype,"writeAuthoringApp",null),e([_({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],Ie.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],Ie.prototype,"writeAuthoringAppVersion",null),e([_({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Ie.prototype,"basemap",void 0),e([_({type:oe,json:{write:{overridePolicy:e=>({enabled:!!(e&&e.length>0),ignoreOrigin:!0})}}})],Ie.prototype,"bookmarks",void 0),e([_({type:K,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],Ie.prototype,"floorInfo",void 0),e([_({type:$,json:{write:!0}})],Ie.prototype,"geotriggersInfo",void 0),e([_({type:Z,nonNullable:!0,json:{read:{source:["background","initialState.viewpoint","mapRangeInfo","spatialReference"]},write:{ignoreOrigin:!0,target:{background:{type:te},"initialState.viewpoint":{type:i},mapRangeInfo:{type:z},spatialReference:{type:U}}}}})],Ie.prototype,"initialViewProperties",void 0),e([v("initialViewProperties")],Ie.prototype,"readInitialViewProperties",null),e([A("initialViewProperties")],Ie.prototype,"writeInitialViewProperties",null),e([_({json:{read:!1,write:{target:"operationalLayers",ignoreOrigin:!0}}})],Ie.prototype,"layers",void 0),e([A("layers")],Ie.prototype,"writeLayers",null),e([_({type:k})],Ie.prototype,"portalItem",void 0),e([_({json:{write:!0}})],Ie.prototype,"presentation",void 0),e([_()],Ie.prototype,"resourceInfo",void 0),e([_({readOnly:!0,type:ee,json:{read:{source:"version"},write:{allowNull:!0,ignoreOrigin:!0,target:"version",isRequired:!0}}})],Ie.prototype,"sourceVersion",void 0),e([v("sourceVersion")],Ie.prototype,"readSourceVersion",null),e([A("sourceVersion")],Ie.prototype,"writeSourceVersion",null),e([_({json:{read:!1,write:{ignoreOrigin:!0}}})],Ie.prototype,"tables",void 0),e([A("tables")],Ie.prototype,"writeTables",null),e([_()],Ie.prototype,"thumbnailUrl",null),e([_({type:q,json:{write:!0}})],Ie.prototype,"widgets",void 0),e([_({type:ae,json:{read:!0,write:!0}})],Ie.prototype,"utilityNetworks",void 0),Ie=e([I("esri.WebMap")],Ie);const Ae=Ie;export{Ae as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import o from"./core/Collection.js";import a from"./core/Error.js";import s from"./core/Loadable.js";import{loadAll as n}from"./core/loadAll.js";import l from"./core/Logger.js";import{unwrap as p,isSome as m}from"./core/maybe.js";import{MultiOriginJSONMixin as u,MultiOriginJSONSupport as h}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as c}from"./core/Promise.js";import{eachAlways as d}from"./core/promiseUtils.js";import{whenOnce as y}from"./core/reactiveUtils.js";import{urlToObject as w,isDataProtocol as g,dataComponents as f,addQueryParameter as b}from"./core/urlUtils.js";import{property as _}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import"./core/arrayUtils.js";import{reader as v}from"./core/accessorSupport/decorators/reader.js";import{subclass as I}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{updateOrigins as S}from"./core/accessorSupport/originUtils.js";import{readLoadable as j}from"./core/accessorSupport/read.js";import U from"./geometry/SpatialReference.js";import{equals as P}from"./geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as O,webMercatorToGeographic as L}from"./geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as V}from"./layers/support/arcgisLayerUrl.js";import{isFeatureServiceLayer as R,isFeatureCollectionLayer as F}from"./layers/support/layerUtils.js";import T from"./networks/UtilityNetwork.js";import W from"./portal/Portal.js";import k from"./portal/PortalItem.js";import{removeTypeKeyword as N,addTypeKeyword as C,hasTypeKeyword as M,TypeKeyword as x}from"./portal/support/portalItemUtils.js";import{project as E}from"./rest/geometryService/project.js";import B from"./rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as G,isDeveloperBasemapLayer as J,findSpatialReference as D}from"./support/basemapUtils.js";import K from"./support/MapFloorInfo.js";import $ from"./webdoc/GeotriggersInfo.js";import z from"./webdoc/RangeInfo.js";import q from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as H}from"./webdoc/support/thumbnailUtils.js";import{getLayerJSON as Q}from"./webdoc/support/writeUtils.js";import X from"./webmap/ApplicationProperties.js";import Y from"./webmap/Bookmark.js";import Z from"./webmap/InitialViewProperties.js";import{Version as ee}from"./webmap/Version.js";import te from"./webmap/background/ColorBackground.js";const re=new ee(2,27),ie="Web Map",oe=o.ofType(Y),ae=o.ofType(T),se=new Map;se.set("image/jpeg","jpeg"),se.set("image/jpg","jpg"),se.set("image/png","png"),se.set("image/gif","gif");const ne="ArcGIS Pro",le=x.JSAPI,pe="CollectorDisabled",me="Collector",ue="Data Editing",he="OfflineDisabled",ce="Offline",de="Workforce Project",ye="Workforce Worker",we="Workforce Dispatcher",ge="Offline Map Areas",fe="FieldMapsDisabled",be=x.DEVELOPER_BASEMAP,_e="UtilityNetwork",ve=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));let Ie=class extends(u(s.LoadableMixin(c(r)))){constructor(e){super(e),this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1,this._thumbnailFilename=null,this._updateFromPromise=null,this._resourceReferences={portalItem:null,paths:[]},this.applicationProperties=null,this.bookmarks=new oe,this.floorInfo=null,this.geotriggersInfo=null,this.initialViewProperties=new Z,this.portalItem=null,this.presentation=null,this.sourceVersion=null,this.widgets=null,this.utilityNetworks=null,this.authoringApp=this.authoringAppVersion=null,this._isAuthoringAppSetByUser=this._isAuthoringAppVersionSetByUser=!1}destroy(){const e=this.portalItem;this.portalItem=null,e?.destroy()}initialize(){if(this.when().catch((e=>{l.getLogger(this.declaredClass).error("#load()","Failed to load web map",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t)}}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp=le}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}readInitialViewProperties(e,t){const r=new Z;t.background&&(r.background=te.fromJSON(t.background));const o=t.initialState?.viewpoint;if(o){if(o.rotation){ee.parse(t.version||"","webmap").lessThan(2,20)&&t.authoringApp===ne&&(o.rotation*=-1)}r.viewpoint=i.fromJSON(o)}return t.mapRangeInfo&&(r.rangeInfo=z.fromJSON(t.mapRangeInfo)),t.spatialReference&&(r.spatialReference=U.fromJSON(t.spatialReference)),r}writeInitialViewProperties(e,t,r,i){if(!e)return;const o=e.background;o&&o.color&&(t.background=o.write({},i)),e.viewpoint&&(t.initialState={viewpoint:e.viewpoint.write({},i)}),e.rangeInfo&&(t.mapRangeInfo=e.rangeInfo.toJSON(i)),e.spatialReference&&(t.spatialReference=e.spatialReference.write({},i))}writeLayers(e,t,r,i){t[r]=this._writeLayers(e,i,"operational-layers")}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new ee(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${re.major}.${re.minor}`}writeTables(e,t,r,i){const o=this._writeLayers(e,i,"tables");o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?(this._override("thumbnailUrl",e),this._thumbnailFilename=this._generateCustomThumbnailFilename(e)):this._clearThumbnailOverride()}load(e){return this.addResolvingPromise(this._loadFromSource()),Promise.resolve(this)}loadAll(){return n(this,(e=>{e(this.ground,this.basemap,this.layers,this.tables)}))}read(e,t){t={...t,origin:"web-map"};const r=this._getAuthoringPropsState();j(this,e,(t=>super.read(e,t)),t),this._restoreAuthoringPropsFromState(r)}write(e,t){if("loaded"!==this.loadStatus){const e=new a("webmap:not-loaded","Web map must be loaded before it can be serialized");throw l.getLogger(this.declaredClass).error("#toJSON()","Web map must be loaded before it can be serialized",this.loadError||this.loadStatus),e}return this._removeDanglingLayerRefs(),t={...t,origin:"web-map",restrictedWebMapWriting:!0,webmap:this},super.write(e,t)}async save(e){e=e||{},this._validateItem();const t=import("./webdoc/support/saveUtils.js");await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const r=this.portalItem,i=w(r.itemUrl),o={origin:"web-map",messages:[],writtenProperties:[],url:i,portal:r.portal||W.getDefault(),portalItem:r,verifyItemRelativeUrls:i?{rootPath:i.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},a=this.write({},o);return await Promise.all(o.resources.pendingOperations),this._validateJSONForWriting(o,e),await this._updateItemProperties(r),await this._updateItem(r,a,o),await Promise.all([this._updateItemThumbnail(),t.then((({saveResources:e})=>e(this._resourceReferences,o,null)))]),r}async saveAs(e,t){t=t||{};const r=this._getPortalItem(e),i=import("./webdoc/support/saveUtils.js");await this._updateFromPromise,await this.load(),await this._loadLayerContainers(),await this._beforeSave(),await this._validateMap();const o={origin:"web-map",messages:[],writtenProperties:[],url:null,portal:r.portal,portalItem:r,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},a=this.write({},o);await Promise.all(o.resources.pendingOperations),this._validateJSONForWriting(o,t),await this._updateItemPropertiesForSaveAs(r);const s=this._getThumbnailState();return await this._createItem(r,a,o,t),this._restoreThumbnailFromState(s),await Promise.all([this._updateItemThumbnail(),i.then((({saveResources:e})=>e(this._resourceReferences,o,null)))]),r}async updateFrom(e,t){const r=this._updateFromInternal(e,t);this._updateFromPromise=r,await r;r===this._updateFromPromise&&(this._updateFromPromise=null)}getLayerJSONFromResourceInfo(e){const t=this.resourceInfo;return this._collectAllLayersJSON([...t?.baseMap?.baseMapLayers||[],...t?.operationalLayers||[],...this.basemap?.resourceInfo?.data?.baseMapLayers||[]]).find((t=>t.id===e.id))}_collectAllLayersJSON(e){return e.reduce(((e,t)=>(e.push(t),"GroupLayer"===t.layerType&&(e=e.concat(this._collectAllLayersJSON(t.layers||[]))),e)),[])}_writeLayers(e,t,r){t={...t,layerContainerType:r};return e.map((e=>p(Q(e,"tables"===r?null:this.getLayerJSONFromResourceInfo(e),t)))).filter(Boolean).toArray()}_loadFromSource(){return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-map"}):this.portalItem&&this.portalItem.id?this._loadFromItem(this.portalItem):Promise.resolve()}async _loadFromItem(e){if(await e.load().catch((e=>{throw new a("webmap:load-portal-item","Failed to load portal item",{error:e})})),"Web Map"!==e.type)throw new a("webmap:invalid-portal-item",`Invalid portal item type '${e.type}', expected 'Web Map'`,{type:e.type});const t=await e.fetchData();this.resourceInfo=t;const r={origin:"web-map",url:w(e.itemUrl),portal:e.portal||W.getDefault(),portalItem:e,readResourcePaths:[]};return await this._readAndLoadFromJSON(t,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]},this._computeInitialViewpoint()}_readAndLoadFromJSON(e,t){const r=this._validateJSON(e);return this.read(r,t),this._loadFromJSON(r,t)}_validateJSON(e){const t=ee.parse(e.version||"","webmap");return re.validate(t),e.version=`${t.major}.${t.minor}`,e}_loadFromJSON(e,t){const r={context:{...t,layerContainerType:"operational-layers"}};return this.portalItem&&(r.context.portal=this.portalItem.portal||W.getDefault()),import("./layers/support/layersCreator.js").then((({populateOperationalLayers:t})=>{const i=[],o=e.operationalLayers;o&&o.length&&i.push(t(this.layers,o,r));const a={...r,context:{...r.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"},s=e.tables;return s&&s.length&&i.push(t(this.tables,s,a)),d(i).then((()=>{}))}))}async _computeInitialViewpoint(){let e=this.initialViewProperties;const t=e?.viewpoint?.targetGeometry;if(t)return;const r=await this._getExtentFromItem();r&&(e=e?e.clone():new Z,e.viewpoint=new i,e.viewpoint.targetGeometry=r,this.initialViewProperties=e)}async _getExtentFromItem(){const e=this.initialViewProperties?.spatialReference,t=this.portalItem?.extent;if(e&&t){if(e.isWGS84)return t.clone();if(e.isWebMercator)return O(t);return(await import("./portal/support/geometryServiceUtils.js")).getGeometryServiceURL(this.portalItem).then((r=>{const i=new B;return i.geometries=[t],i.outSpatialReference=e,E(r,i)})).then((e=>e[0])).catch((e=>(l.getLogger(this.declaredClass).error("Error projecting item's extent:",e),null)))}return null}_removeDanglingLayerRefs(){const e=this.applicationProperties,t=e&&e.viewing&&e.viewing.search,r=e=>this.allLayers.some((t=>t.id===e));t&&t.layers&&(t.layers=t.layers.filter((e=>r(e.id)))),t&&t.tables&&(t.tables=t.tables.filter((e=>this.tables.some((t=>t.id===e.id)))));const i=e&&e.editing&&e.editing.locationTracking;i&&i.info&&!r(i.info.layerId)&&(e.editing=null);const o=this.presentation&&this.presentation.slides;o&&o.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>r(e.id))))}))}async _validateMap(){if(!this.basemap?.baseLayers.length)throw new a("webmap:save","Map does not have a valid basemap with a base layer.");let e=null;if(await y((()=>{const t=D(this.initialViewProperties,this.basemap);return e=t.spatialReference,!t.updating})),!P(e,this.initialViewProperties.spatialReference))throw new a("webmap:save","The spatial reference of the basemap is not compatible with the one from the map.",{expected:this.initialViewProperties.spatialReference,actual:e})}_validateItem(){if(!this.portalItem)throw l.getLogger(this.declaredClass).error("save: requires the portalItem property to be set"),new a("webmap:portal-item-not-set","Portal item to save to has not been set on the WebMap");this._validateItemType(this.portalItem)}_validateItemType(e){if(e.type!==ie)throw new a("webmap:portal-item-wrong-type",`Portal item needs to have type "${ie}"`)}_loadLayerContainers(){const e=[];return this.basemap&&e.push(this.basemap.load()),this.ground&&e.push(this.ground.load()),d(e).then((()=>{}))}async _beforeSave(){const e=[];for(const t of this.allLayers)if("beforeSave"in t&&"function"==typeof t.beforeSave){const r=t.beforeSave();r&&e.push(r)}await d(e)}_loadAllLayers(){const e=this._getAllLayersAndTables().map((e=>e.load()));return d(e).then((()=>{}))}_getAllLayersAndTables(){return this.allLayers.concat(this.allTables)}_validateJSONForWriting(e,t){let r=(e.messages?e.messages:[]).filter((e=>"error"===e.type)).map((e=>new a(e.name,e.message,e.details)));if(e.blockedRelativeUrls&&(r=r.concat(e.blockedRelativeUrls.map((e=>new a("url:unsupported",`Relative url '${e}' is not supported in Web Map`))))),t.ignoreUnsupported&&(r=r.filter((e=>"layer:unsupported"!==e.name&&"symbol:unsupported"!==e.name&&"symbol-layer:unsupported"!==e.name&&"property:unsupported"!==e.name&&"url:unsupported"!==e.name))),r.length>0)throw new a("webmap:save","Failed to save webmap due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}async _updateItemProperties(e){e.extent=await this._getWGS84Extent(this.initialViewProperties.viewpoint.targetGeometry),await this._updateTypeKeywords(e)}async _updateItemPropertiesForSaveAs(e){N(e,pe),N(e,fe),N(e,x.METADATA),N(e,he),N(e,ge),N(e,we),N(e,de),N(e,ye),await this._updateItemProperties(e)}async _getWGS84Extent(e){const t=e.clone().normalize();let r;if(t.length>1)for(const i of t)r?i.width>r.width&&(r=i):r=i;else r=t[0];return this._projectToWGS84(r)}async _projectToWGS84(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return L(e);const r=await import("./portal/support/geometryServiceUtils.js"),i=await r.getGeometryServiceURL(this.portalItem),o=new B;o.geometries=[e],o.outSpatialReference=U.WGS84;return(await E(i,o))[0]}async _updateTypeKeywords(e){C(e,le),await this._loadAllLayers(),this._evalCollectorKeyword(e),this._evalDataEditingKeyword(e),this._evalOfflineKeyword(e),this._evalDeveloperBasemapKeyword(e),this._evalUtilityNetworkKeyword(e),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}_evalCollectorKeyword(e){M(e,pe)||M(e,de)||M(e,ye)||M(e,we)||!this._hasEditableFeatureLayer()?N(e,me):C(e,me)}_evalDataEditingKeyword(e){this._hasEditableFeatureLayer()?C(e,ue):N(e,ue)}_evalOfflineKeyword(e){!M(e,he)&&this._isOfflineCapableMap()?C(e,ce):N(e,ce)}_evalDeveloperBasemapKeyword(e){G(this.basemap)?C(e,be):N(e,be)}_evalUtilityNetworkKeyword(e){this.utilityNetworks?.length?C(e,_e):N(e,_e)}_hasEditableFeatureLayer(){return this._getAllLayersAndTables().some((e=>e.loaded&&R(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled))}_isOfflineCapableMap(){return this._getAllLayersAndTables().filter((e=>"group"!==e.type)).every((e=>e.loaded&&this._isOfflineCapableLayer(e)))}_isFeatureCollectionLike(e){return F(e)||"map-notes"===e.type||"route"===e.type}_isOfflineCapableLayer(e){return R(e)&&e.capabilities.operations.supportsSync||this._isFeatureCollectionLike(e)&&!e.portalItem||("tile"===e.type||"vector-tile"===e.type)&&(e.capabilities.operations.supportsExportTiles||this._isExportableAGOLTileLayer(e)||J(e))&&e.spatialReference.equals(this.initialViewProperties.spatialReference)}_isExportableAGOLTileLayer(e){return"tile"===e.type&&(V(e.url)&&ve.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async _updateItem(e,t,r){await e.update({data:t}),this._syncUpInstanceWithItem(e,t,r)}async _createItem(e,t,r,i){const o=this.portalItem,s=!!(o&&o.id&&o.portal.user),n=e.portal;if(await n.signIn(),!await this._canCopyItem(o,s,n))throw new a("webmap:save-as-copy-not-allowed","Owner of this map does not allow others to save a copy");await(n.user?.addItem({item:e,folder:i.folder,data:t})),this.portalItem=e,this._syncUpInstanceWithItem(e,t,r)}async _canCopyItem(e,t,r){return!(m(e)&&e.id&&e.typeKeywords&&e.typeKeywords.includes("useOnly"))||e.portal.portalHostname===r.portalHostname&&(t||await e.reload(),"admin"===e.itemControl||"update"===e.itemControl)}_syncUpInstanceWithItem(e,t,r){h.prototype.read.call(this,{version:t.version,authoringApp:t.authoringApp,authoringAppVersion:t.authoringAppVersion},{origin:"web-map",ignoreDefaults:!0,url:e.itemUrl&&w(e.itemUrl)}),S(r),this.resourceInfo=t}async _updateItemThumbnail(){this.thumbnailUrl&&this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl,filename:this._thumbnailFilename})),this._clearThumbnailOverride())}_getPortalItem(e){let t=k.from(e);return t.id&&(t=t.clone(),t.id=null),t.type||(t.type=ie),t.portal||(t.portal=W.getDefault()),this._validateItemType(t),t}async _updateFromInternal(e,t){if(t=t||{},await y((()=>e.ready)),this._updateInitialViewProperties(e,t),e.map===this)for(const r of e.allLayerViews)for(const e of["visible","featureEffect"])e in r&&e in r.layer&&r._isOverridden(e)&&(r.layer[e]=r[e]);await this._updateThumbnailUrl(e,t)}_updateInitialViewProperties(e,t){if(t.backgroundExcluded||(this.initialViewProperties.background=e.background?.clone()),this.initialViewProperties.spatialReference=e.spatialReference?.clone(),t.viewpointExcluded||(this.initialViewProperties.viewpoint=new i({rotation:e.rotation,scale:t.scalePreserved?e.scale:null,targetGeometry:this._getViewExtent(e)})),!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this)}_getViewExtent(e){const t=e.center.clone().normalize(),r=e.extent.clone(),i=r.width/2;return r.xmin=t.x-i,r.xmax=t.x+i,r}async _updateThumbnailUrl(e,t){if(t.thumbnailExcluded)return;const r=H(e,t.thumbnailSize),i=await e.takeScreenshot({format:"png",width:r.width,height:r.height});this._setAutoGeneratedThumbnail(i.dataUrl)}_setAutoGeneratedThumbnail(e){this.thumbnailUrl=e,this._thumbnailFilename=null}_clearThumbnailOverride(){this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"),this._thumbnailFilename=null}_generateCustomThumbnailFilename(e){if(g(e)){const t=f(e),r=t&&t.mediaType,i=r&&se.get(r.toLowerCase())||null,o=`thumbnail${Date.now()}`;return i?`${o}.${i}`:o}return null}_getThumbnailState(){let e=this.thumbnailUrl;return e&&(e=this._isOverridden("thumbnailUrl")?e:b(e,"w","8192")),{thumbnailUrl:e,filename:this._thumbnailFilename}}_restoreThumbnailFromState(e){this.thumbnailUrl=e.thumbnailUrl,this._thumbnailFilename=e.filename}_getAuthoringPropsState(){return{authoringApp:this.authoringApp,authoringAppVersion:this.authoringAppVersion,isAuthoringAppSetByUser:this._isAuthoringAppSetByUser,isAuthoringAppVersionSetByUser:this._isAuthoringAppVersionSetByUser}}_restoreAuthoringPropsFromState(e){e.isAuthoringAppSetByUser?this.authoringApp=e.authoringApp:this._isAuthoringAppSetByUser=!1,e.isAuthoringAppVersionSetByUser?this.authoringAppVersion=e.authoringAppVersion:this._isAuthoringAppVersionSetByUser=!1}static fromJSON(e){const t=e;if(!t)throw new a("webmap:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:t})}};Ie.VERSION=re,e([_({type:X,json:{write:!0}})],Ie.prototype,"applicationProperties",void 0),e([_({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],Ie.prototype,"authoringApp",null),e([A("authoringApp")],Ie.prototype,"writeAuthoringApp",null),e([_({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],Ie.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],Ie.prototype,"writeAuthoringAppVersion",null),e([_({json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Ie.prototype,"basemap",void 0),e([_({type:oe,json:{write:{overridePolicy:e=>({enabled:!!(e&&e.length>0),ignoreOrigin:!0})}}})],Ie.prototype,"bookmarks",void 0),e([_({type:K,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],Ie.prototype,"floorInfo",void 0),e([_({type:$,json:{write:!0}})],Ie.prototype,"geotriggersInfo",void 0),e([_({type:Z,nonNullable:!0,json:{read:{source:["background","initialState.viewpoint","mapRangeInfo","spatialReference"]},write:{ignoreOrigin:!0,target:{background:{type:te},"initialState.viewpoint":{type:i},mapRangeInfo:{type:z},spatialReference:{type:U}}}}})],Ie.prototype,"initialViewProperties",void 0),e([v("initialViewProperties")],Ie.prototype,"readInitialViewProperties",null),e([A("initialViewProperties")],Ie.prototype,"writeInitialViewProperties",null),e([_({json:{read:!1,write:{target:"operationalLayers",ignoreOrigin:!0}}})],Ie.prototype,"layers",void 0),e([A("layers")],Ie.prototype,"writeLayers",null),e([_({type:k})],Ie.prototype,"portalItem",void 0),e([_({json:{write:!0}})],Ie.prototype,"presentation",void 0),e([_()],Ie.prototype,"resourceInfo",void 0),e([_({readOnly:!0,type:ee,json:{read:{source:"version"},write:{allowNull:!0,ignoreOrigin:!0,target:"version",isRequired:!0}}})],Ie.prototype,"sourceVersion",void 0),e([v("sourceVersion")],Ie.prototype,"readSourceVersion",null),e([A("sourceVersion")],Ie.prototype,"writeSourceVersion",null),e([_({json:{read:!1,write:{ignoreOrigin:!0}}})],Ie.prototype,"tables",void 0),e([A("tables")],Ie.prototype,"writeTables",null),e([_()],Ie.prototype,"thumbnailUrl",null),e([_({type:q,json:{write:!0}})],Ie.prototype,"widgets",void 0),e([_({type:ae,json:{read:!0,write:!0}})],Ie.prototype,"utilityNetworks",void 0),Ie=e([I("esri.WebMap")],Ie);const Ae=Ie;export{Ae as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{doSubstitutions as e}from"./executionError.js";import{IANAZone as t,DateTime as n,Zone as r,FixedOffsetZone as s}from"luxon";class i{}var a;i.instance=new t("Etc/UTC"),function(e){e.TimeZoneNotRecognised="TimeZoneNotRecognised"}(a||(a={}));const o={[a.TimeZoneNotRecognised]:"Timezone identifier has not been recognised."};class d extends Error{constructor(t,n){super(e(o[t],n)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class c{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,s=0,i=0,a=0,o=0,d){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(s)||isNaN(i)||isNaN(a)||isNaN(o))return null;let m=0;const h=n.local(e,t).daysInMonth;r<1&&(m=r-1,r=1),r>h&&(m=r-h,r=h);let l=0;t>12?(l=t-12,t=12):t<1&&(l=t-1,t=1);let f=0;i>59?(f=i-59,i=59):i<0&&(f=i,i=0);let T=0;a>59?(T=a-59,a=59):a<0&&(T=a,a=0);let w=0;o>999?(w=o-999,o=999):o<0&&(w=o,o=0);let y=n.fromObject({day:r,year:e,month:t,hour:s,minute:i,second:a,millisecond:o},{zone:u(d)});return 0!==l&&(y=y.plus({months:l})),0!==m&&(y=y.plus({days:m})),0!==f&&(y=y.plus({minutes:f})),0!==T&&(y=y.plus({seconds:T})),0!==w&&(y=y.plus({milliseconds:w})),new c(y)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,t){const n=u(t);return e.isUnknownTimeZone||n===i.instance?c.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e._date.setZone(t))}static dateJSToArcadeDate(e){return new c(n.fromJSDate(e))}static dateJSAndZoneToArcadeDate(e,t="system"){return new c(n.fromJSDate(e,{zone:t}))}static unknownEpochToArcadeDate(e){return new c(n.fromMillis(e,{zone:i.instance}))}static unknownDateJSToArcadeDate(e){return c.arcadeDateAndZoneToArcadeDate(c.dateJSToArcadeDate(e),i.instance)}static epochToArcadeDate(e){return new c(n.fromMillis(e))}static dateTimeToArcadeDate(e){return new c(e)}changeTimeZone(e){const t=u(e);return c.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,t){const n=u(t);return e.zone===i.instance||n===i.instance?c.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e.setZone(n))}static nowToArcadeDate(e){return new c(n.fromJSDate(new Date,{zone:e}))}static nowUTCToArcadeDate(){return new c(n.utc())}get isSystem(){return"system"===this.timeZone||this.timeZone===c.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===i.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if("system"===this._date.zone.type)return"system";const e=this.zone;return"fixed"===e.type?0===e.fixed?"utc":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new c(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toFormat(e,t){return this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLString(){return"timestamp '"+this._date.toFormat("yyyy-LL-dd HH:mm:ss")+"'"}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new c(this._date.toUTC())}toLocal(){return new c(this._date.toLocal())}}function u(e){if(e instanceof r)return e;if("system"===e.toLowerCase())return"system";if("utc"===e.toLowerCase())return"utc";if("unknown"===e.toLowerCase())return i.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(e)){const t=s.parseSpecifier("UTC"+(e.startsWith("+")||e.startsWith("-")?"":"+")+e);if(t)return t}const n=t.create(e);if(!n.isValid)throw new d(a.TimeZoneNotRecognised);return n}export{c as ArcadeDate,d as ArcadeDateError,a as ArcadeDateErrorCodes,o as ArcadeDateErrorMessages,i as UnknownTimeZone,u as createDateTimeZone};
5
+ import{doSubstitutions as e}from"./executionError.js";import{IANAZone as t,DateTime as n,Zone as r,FixedOffsetZone as s}from"luxon";class i{}var o;i.instance=new t("Etc/UTC"),function(e){e.TimeZoneNotRecognised="TimeZoneNotRecognised"}(o||(o={}));const a={[o.TimeZoneNotRecognised]:"Timezone identifier has not been recognised."};class d extends Error{constructor(t,n){super(e(a[t],n)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class c{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,s=0,i=0,o=0,a=0,d){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(s)||isNaN(i)||isNaN(o)||isNaN(a))return null;let m=0;const h=n.local(e,t).daysInMonth;r<1&&(m=r-1,r=1),r>h&&(m=r-h,r=h);let l=0;t>12?(l=t-12,t=12):t<1&&(l=t-1,t=1);let f=0;i>59?(f=i-59,i=59):i<0&&(f=i,i=0);let T=0;o>59?(T=o-59,o=59):o<0&&(T=o,o=0);let w=0;a>999?(w=a-999,a=999):a<0&&(w=a,a=0);let y=n.fromObject({day:r,year:e,month:t,hour:s,minute:i,second:o,millisecond:a},{zone:u(d)});return 0!==l&&(y=y.plus({months:l})),0!==m&&(y=y.plus({days:m})),0!==f&&(y=y.plus({minutes:f})),0!==T&&(y=y.plus({seconds:T})),0!==w&&(y=y.plus({milliseconds:w})),new c(y)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,t){const n=u(t);return e.isUnknownTimeZone||n===i.instance?c.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e._date.setZone(t))}static dateJSToArcadeDate(e){return new c(n.fromJSDate(e))}static dateJSAndZoneToArcadeDate(e,t="system"){return new c(n.fromJSDate(e,{zone:t}))}static unknownEpochToArcadeDate(e){return new c(n.fromMillis(e,{zone:i.instance}))}static unknownDateJSToArcadeDate(e){return c.arcadeDateAndZoneToArcadeDate(c.dateJSToArcadeDate(e),i.instance)}static epochToArcadeDate(e){return new c(n.fromMillis(e))}static dateTimeToArcadeDate(e){return new c(e)}changeTimeZone(e){const t=u(e);return c.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,t){const n=u(t);return e.zone===i.instance||n===i.instance?c.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,n):new c(e.setZone(n))}static nowToArcadeDate(e){return new c(n.fromJSDate(new Date,{zone:e}))}static nowUTCToArcadeDate(){return new c(n.utc())}get isSystem(){return"system"===this.timeZone||this.timeZone===c.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===i.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if("system"===this._date.zone.type)return"system";const e=this.zone;return"fixed"===e.type?0===e.fixed?"utc":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new c(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toFormat(e,t){return this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLString(){return"timestamp '"+this._date.toFormat("yyyy-LL-dd HH:mm:ss")+"'"}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new c(this._date.toUTC())}toLocal(){return new c(this._date.toLocal())}toString(){return this.toISOString(!0)}}function u(e){if(e instanceof r)return e;if("system"===e.toLowerCase())return"system";if("utc"===e.toLowerCase())return"utc";if("unknown"===e.toLowerCase())return i.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(e)){const t=s.parseSpecifier("UTC"+(e.startsWith("+")||e.startsWith("-")?"":"+")+e);if(t)return t}const n=t.create(e);if(!n.isValid)throw new d(o.TimeZoneNotRecognised);return n}export{c as ArcadeDate,d as ArcadeDateError,o as ArcadeDateErrorCodes,a as ArcadeDateErrorMessages,i as UnknownTimeZone,u as createDateTimeZone};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../Graphic.js";import{ArcadeDate as t}from"../../ArcadeDate.js";import{cloneGeometry as r}from"../../kernel.js";import{SqlError as s,SqlErrorCodes as a,FeatureSetError as i,FeatureSetErrorCodes as l}from"../support/errorsupport.js";import n from"../support/FeatureSet.js";import o from"../support/IdSet.js";import{cloneField as h,FeatureServiceDatabaseType as u,layerGeometryEsriConstants as c}from"../support/shared.js";import{reformulateWithoutField as d,toWhereClause as p,translateFunctionToDatabaseSpecific as f,makeToday as g,makeDateString as N,arcadeDateToSqlString as _,convertIntervalToSql as S,combine as w,scanForField as m}from"../support/sqlUtils.js";import{unwrapOrThrow as v,assertIsSome as C}from"../../../core/maybe.js";import{WhereClause as T}from"../../../core/sql/WhereClause.js";import F from"../../../geometry/SpatialReference.js";class W{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class E extends W{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class x extends W{constructor(e,t,r){super(h(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:d(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class A extends W{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const s in r)this.reverseLkp[r[s]]=s;this.sqlRewritable=!0}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,u.Standardised,this.field.name,this.codefield instanceof T?p(this.codefield,u.Standardised):this.codefield,e.parameters);return r.includes(A.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:T.create(r,v(t._parent).getFieldsIndex())}}evaluateNodeToWhereClause(e,r,i=null,l=null,n){let o,h,u,c;switch(e.type){case"interval":return S(this.evaluateNodeToWhereClause(e.value,r,i,l,n),e.qualifier,e.op);case"case-expression":{let t=" CASE ";"simple"===e.format&&(t+=this.evaluateNodeToWhereClause(e.operand,r,i,A.BADNESS,n));for(let s=0;s<e.clauses.length;s++)t+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[s].operand,r,i,A.BADNESS,n)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[s].value,r,i,A.BADNESS,n);return null!==e.else&&(t+=" ELSE "+this.evaluateNodeToWhereClause(e.else,r,i,A.BADNESS,n)),t+=" END ",t}case"parameter":{const s=n[e.value.toLowerCase()];if("string"==typeof s)return"'"+s.toString().replace(/'/g,"''")+"'";if(s instanceof Date)return N(s,r,null);if(s instanceof t)return _(s,r,null);if(s instanceof Array){const e=[];for(let a=0;a<s.length;a++)"string"==typeof s[a]?e.push("'"+s[a].toString().replace(/'/g,"''")+"'"):s[a]instanceof Date?e.push(N(s[a],r,null)):s[a]instanceof t?e.push(_(s[a],r,null)):e.push(s[a].toString());return e}return s.toString()}case"expression-list":h=[];for(const t of e.value)h.push(this.evaluateNodeToWhereClause(t,r,i,l,n));return h;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,r,i,A.BADNESS,n)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" AND "+this.evaluateNodeToWhereClause(e.right,r,i,l,n)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" OR "+this.evaluateNodeToWhereClause(e.right,r,i,l,n)+") ";case"IS":if("null"!==e.right.type)throw new s(a.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new s(a.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IS NOT NULL )";case"IN":if(o=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const t=[];let s=!0;for(const r of e.right.value){if("string"!==r.type){s=!1;break}if(void 0===this.lkp[r.value]){s=!1;break}t.push(this.lkp[r.value].toString())}if(s)return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+t.join(",")+")) "}return o=this.evaluateNodeToWhereClause(e.right,r,i,l,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+o.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,r,i,l,n),c instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+c+")) ";case"NOT IN":if(o=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const t=[];let s=!0;for(const r of e.right.value){if("string"!==r.type){s=!1;break}if(void 0===this.lkp[r.value]){s=!1;break}t.push(this.lkp[r.value].toString())}if(s)return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+t.join(",")+")) "}return o=this.evaluateNodeToWhereClause(e.right,r,i,l,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+o.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,r,i,l,n),c instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+c+")) ";case"BETWEEN":return u=this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"NOTBETWEEN":return u=this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" NOT BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+l+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+l+") ";return" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":return" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return N(e.value,r,null);case"number":return e.value.toString();case"current-time":return g("date"===e.mode,r);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+l+")":e.column;case"function":{const t=this.evaluateNodeToWhereClause(e.args,r,i,A.BADNESS,n);return f(e.name,t,r)}}throw new s(a.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof T?this.reverseLkp[this.codefield.calculateValueCompiled(e)]:this.reverseLkp[e.attributes[this.codefield]]}}A.BADNESS="_!!!_BAD_LKP_!!!!";class y extends W{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:d(e,this.field.name,p(this._sql,u.Standardised),t.getFieldsIndex())}}extractValue(e){return this._sql.calculateValueCompiled(e)}}class D extends n{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new F({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=c.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),C(t),this._wset=new o(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return v(this._parent)._isInFeatureSet(e)}async _getFeatures(t,s,a,i){const l=[];-1!==s&&void 0===this._featureCache[s]&&l.push(s);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(t,n))return await this._expandPagedSet(t,n,0,0,i),this._getFeatures(t,s,a,i);let h=0;for(let e=t._lastFetchedIndex;e<t._known.length&&(h++,h<=a&&(t._lastFetchedIndex+=1),!(void 0===this._featureCache[t._known[e]]&&(t._known[e]!==s&&l.push(t._known[e]),l.length>=n)));e++);if(0===l.length)return"success";t=new o([],l,t._ordered,null);const u=Math.min(l.length,a);await(this._parent?._getFeatures(t,-1,u,i)),this._checkCancelled(i);const c=[];for(let e=0;e<u;e++){const t=this._parent?._featureFromCache(l[e]);void 0!==t&&c.push({geometry:t.geometry,attributes:t.attributes,id:l[e]})}for(const o of c){const t=[];for(const e of this.adaptedFields)t[e.field.name]=e.extractValue(o);this._featureCache[o.id]=new e({attributes:t,geometry:r(o.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new i(l.NeverReach)}async _getFilteredSet(e,t,r,s,a){let i=!1;const l=this._reformulateWithoutAdaptions(r);i=l.cannot,r=l.where;let n=!1;if(null!==s){n=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof E)&&!0===s.scanForField(t.field.name)){if(!(t instanceof x)){s=null,n=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=w(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const h=await v(this._parent)._getFilteredSet(e,t,r,s,a);let u;return this._checkCancelled(a),u=!0===i?new o(h._candidates.slice(0).concat(h._known.slice(0)),[],!0===n&&h._ordered,this._clonePageDefinition(h.pagesDefinition)):new o(h._candidates.slice(0),h._known.slice(0),!0===n&&h._ordered,this._clonePageDefinition(h.pagesDefinition)),u}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this.adaptedFields)if(!0===m(e,r.field.name)){const s=r.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,r,s,a,i,l){let n=!1,o=this._reformulateWithoutAdaptions(t);if(n=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(a),n=n||o.cannot,null!==(a=o.where)?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,!0===n)return null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1};const h=await v(this._parent)._stat(e,t,r,s,a,i,l);return!1===h.calculated?null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1}:h}async _canDoAggregates(e,t,r,s,a){if(null===this._parent)return!1;for(let n=0;n<e.length;n++)for(const t of this.adaptedFields)if(e[n].toLowerCase()===t.field.name.toLowerCase()&&!(t instanceof E))return!1;const i=[];for(let n=0;n<t.length;n++){const e=t[n];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)return!1;const r=e.clone();r.workingexpr=t.where,i.push(r)}else i.push(e)}const l=this._reformulateWithoutAdaptions(a);return!l.cannot&&(null!==(a=l.where)?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,this._parent._canDoAggregates(e,i,r,s,a))}async _getAggregatePagesDataSourceDefinition(e,t,r,s,a,n,o){if(null===this._parent)throw new i(l.NeverReach);const h=[];for(let c=0;c<t.length;c++){const e=t[c];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)throw new i(l.NeverReach);const r=e.clone();r.workingexpr=t.where,h.push(r)}else h.push(e)}const u=this._reformulateWithoutAdaptions(a);if(u.cannot)throw new i(l.NeverReach);return null!==(a=u.where)?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,h,r,s,a,n,o)}}export{D as AdaptedFeatureSet,W as AdaptedField,x as FieldRename,E as OriginalField,y as SqlExpressionAdapted,A as StringToCodeAdapted};
5
+ import e from"../../../Graphic.js";import{ArcadeDate as t}from"../../ArcadeDate.js";import{cloneGeometry as r}from"../../kernel.js";import{SqlError as s,SqlErrorCodes as a,FeatureSetError as i,FeatureSetErrorCodes as l}from"../support/errorsupport.js";import n from"../support/FeatureSet.js";import o from"../support/IdSet.js";import{cloneField as h,FeatureServiceDatabaseType as u,layerGeometryEsriConstants as c}from"../support/shared.js";import{reformulateWithoutField as d,toWhereClause as p,translateFunctionToDatabaseSpecific as f,makeToday as g,makeDateString as N,arcadeDateToSqlString as _,convertIntervalToSql as S,combine as w,scanForField as m}from"../support/sqlUtils.js";import{unwrapOrThrow as v,assertIsSome as C}from"../../../core/maybe.js";import{WhereClause as T}from"../../../core/sql/WhereClause.js";import F from"../../../geometry/SpatialReference.js";class W{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class E extends W{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class x extends W{constructor(e,t,r){super(h(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:d(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class A extends W{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const s in r)this.reverseLkp[r[s]]=s;this.sqlRewritable=!0}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,u.Standardised,this.field.name,this.codefield instanceof T?p(this.codefield,u.Standardised):this.codefield,e.parameters);return r.includes(A.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:T.create(r,v(t._parent).getFieldsIndex())}}evaluateNodeToWhereClause(e,r,i=null,l=null,n){let o,h,u,c;switch(e.type){case"interval":return S(this.evaluateNodeToWhereClause(e.value,r,i,l,n),e.qualifier,e.op);case"case-expression":{let t=" CASE ";"simple"===e.format&&(t+=this.evaluateNodeToWhereClause(e.operand,r,i,A.BADNESS,n));for(let s=0;s<e.clauses.length;s++)t+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[s].operand,r,i,A.BADNESS,n)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[s].value,r,i,A.BADNESS,n);return null!==e.else&&(t+=" ELSE "+this.evaluateNodeToWhereClause(e.else,r,i,A.BADNESS,n)),t+=" END ",t}case"parameter":{const s=n[e.value.toLowerCase()];if("string"==typeof s)return"'"+s.toString().replace(/'/g,"''")+"'";if(s instanceof Date)return N(s,r,null);if(s instanceof t)return _(s,r,null);if(s instanceof Array){const e=[];for(let a=0;a<s.length;a++)"string"==typeof s[a]?e.push("'"+s[a].toString().replace(/'/g,"''")+"'"):s[a]instanceof Date?e.push(N(s[a],r,null)):s[a]instanceof t?e.push(_(s[a],r,null)):e.push(s[a].toString());return e}return s.toString()}case"expression-list":h=[];for(const t of e.value)h.push(this.evaluateNodeToWhereClause(t,r,i,l,n));return h;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,r,i,A.BADNESS,n)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" AND "+this.evaluateNodeToWhereClause(e.right,r,i,l,n)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" OR "+this.evaluateNodeToWhereClause(e.right,r,i,l,n)+") ";case"IS":if("null"!==e.right.type)throw new s(a.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new s(a.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IS NOT NULL )";case"IN":if(o=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const t=[];let s=!0;for(const r of e.right.value){if("string"!==r.type){s=!1;break}if(void 0===this.lkp[r.value]){s=!1;break}t.push(this.lkp[r.value].toString())}if(s)return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+t.join(",")+")) "}return o=this.evaluateNodeToWhereClause(e.right,r,i,l,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+o.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,r,i,l,n),c instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" IN ("+c+")) ";case"NOT IN":if(o=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const t=[];let s=!0;for(const r of e.right.value){if("string"!==r.type){s=!1;break}if(void 0===this.lkp[r.value]){s=!1;break}t.push(this.lkp[r.value].toString())}if(s)return" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+t.join(",")+")) "}return o=this.evaluateNodeToWhereClause(e.right,r,i,l,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+o.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,r,i,l,n),c instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,l,n)+" NOT IN ("+c+")) ";case"BETWEEN":return u=this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"NOTBETWEEN":return u=this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" NOT BETWEEN "+u[0]+" AND "+u[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+l+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+l+") ";return" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,r,i,A.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,r,i,A.BADNESS,n)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return N(e.value,r,null);case"number":return e.value.toString();case"current-time":return g("date"===e.mode,r);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+l+")":e.column;case"data-type":return e.value;case"function":{const t=this.evaluateNodeToWhereClause(e.args,r,i,A.BADNESS,n);return f(e.name,t,r)}}throw new s(a.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof T?this.reverseLkp[this.codefield.calculateValueCompiled(e)]:this.reverseLkp[e.attributes[this.codefield]]}}A.BADNESS="_!!!_BAD_LKP_!!!!";class y extends W{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:d(e,this.field.name,p(this._sql,u.Standardised),t.getFieldsIndex())}}extractValue(e){return this._sql.calculateValueCompiled(e)}}class D extends n{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new F({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=c.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),C(t),this._wset=new o(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return v(this._parent)._isInFeatureSet(e)}async _getFeatures(t,s,a,i){const l=[];-1!==s&&void 0===this._featureCache[s]&&l.push(s);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(t,n))return await this._expandPagedSet(t,n,0,0,i),this._getFeatures(t,s,a,i);let h=0;for(let e=t._lastFetchedIndex;e<t._known.length&&(h++,h<=a&&(t._lastFetchedIndex+=1),!(void 0===this._featureCache[t._known[e]]&&(t._known[e]!==s&&l.push(t._known[e]),l.length>=n)));e++);if(0===l.length)return"success";t=new o([],l,t._ordered,null);const u=Math.min(l.length,a);await(this._parent?._getFeatures(t,-1,u,i)),this._checkCancelled(i);const c=[];for(let e=0;e<u;e++){const t=this._parent?._featureFromCache(l[e]);void 0!==t&&c.push({geometry:t.geometry,attributes:t.attributes,id:l[e]})}for(const o of c){const t=[];for(const e of this.adaptedFields)t[e.field.name]=e.extractValue(o);this._featureCache[o.id]=new e({attributes:t,geometry:r(o.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new i(l.NeverReach)}async _getFilteredSet(e,t,r,s,a){let i=!1;const l=this._reformulateWithoutAdaptions(r);i=l.cannot,r=l.where;let n=!1;if(null!==s){n=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof E)&&!0===s.scanForField(t.field.name)){if(!(t instanceof x)){s=null,n=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=w(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const h=await v(this._parent)._getFilteredSet(e,t,r,s,a);let u;return this._checkCancelled(a),u=!0===i?new o(h._candidates.slice(0).concat(h._known.slice(0)),[],!0===n&&h._ordered,this._clonePageDefinition(h.pagesDefinition)):new o(h._candidates.slice(0),h._known.slice(0),!0===n&&h._ordered,this._clonePageDefinition(h.pagesDefinition)),u}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this.adaptedFields)if(!0===m(e,r.field.name)){const s=r.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,r,s,a,i,l){let n=!1,o=this._reformulateWithoutAdaptions(t);if(n=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(a),n=n||o.cannot,null!==(a=o.where)?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,!0===n)return null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1};const h=await v(this._parent)._stat(e,t,r,s,a,i,l);return!1===h.calculated?null===a&&""===r&&null===s?this._manualStat(e,t,i,l):{calculated:!1}:h}async _canDoAggregates(e,t,r,s,a){if(null===this._parent)return!1;for(let n=0;n<e.length;n++)for(const t of this.adaptedFields)if(e[n].toLowerCase()===t.field.name.toLowerCase()&&!(t instanceof E))return!1;const i=[];for(let n=0;n<t.length;n++){const e=t[n];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)return!1;const r=e.clone();r.workingexpr=t.where,i.push(r)}else i.push(e)}const l=this._reformulateWithoutAdaptions(a);return!l.cannot&&(null!==(a=l.where)?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,this._parent._canDoAggregates(e,i,r,s,a))}async _getAggregatePagesDataSourceDefinition(e,t,r,s,a,n,o){if(null===this._parent)throw new i(l.NeverReach);const h=[];for(let c=0;c<t.length;c++){const e=t[c];if(null!==e.workingexpr){const t=this._reformulateWithoutAdaptions(e.workingexpr);if(t.cannot)throw new i(l.NeverReach);const r=e.clone();r.workingexpr=t.where,h.push(r)}else h.push(e)}const u=this._reformulateWithoutAdaptions(a);if(u.cannot)throw new i(l.NeverReach);return null!==(a=u.where)?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,h,r,s,a,n,o)}}export{D as AdaptedFeatureSet,W as AdaptedField,x as FieldRename,E as OriginalField,y as SqlExpressionAdapted,A as StringToCodeAdapted};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{doSubstitutions as e}from"../../executionError.js";var t;!function(e){e.InvalidFunctionParameters="InvalidFunctionParameters",e.UnsupportedSqlFunction="UnsupportedSqlFunction",e.UnsupportedOperator="UnsupportedOperator",e.UnsupportedSyntax="UnsupportedSyntax",e.UnsupportedIsRhs="UnsupportedIsRhs",e.UnsupportedIsLhs="UnsupportedIsLhs",e.MissingStatisticParameters="MissingStatisticParameters"}(t||(t={}));const r={[t.MissingStatisticParameters]:"Statistic does not have 1 or 0 Parameters",[t.InvalidFunctionParameters]:"Invalid parameters for call to {function}",[t.UnsupportedIsLhs]:"Unsupported left hand expression in is statement",[t.UnsupportedIsRhs]:"Unsupported right hand expression in is statement",[t.UnsupportedOperator]:"Unsupported operator - {operator}",[t.UnsupportedSyntax]:"Unsupported syntax - {node}",[t.UnsupportedSqlFunction]:"Sql function not found = {function}"};class s extends Error{constructor(t,n){super(e(r[t],n)),this.declaredRootClass="esri.arcade.featureset.support.sqlerror",Error.captureStackTrace&&Error.captureStackTrace(this,s)}}var n;!function(e){e.NeverReach="NeverReach",e.NotImplemented="NotImplemented",e.Cancelled="Cancelled",e.InvalidStatResponse="InvalidStatResponse",e.InvalidRequest="InvalidRequest",e.RequestFailed="RequestFailed",e.MissingFeatures="MissingFeatures",e.AggregationFieldNotFound="AggregationFieldNotFound",e.DataElementsNotFound="DataElementsNotFound"}(n||(n={}));const a={[n.Cancelled]:"Cancelled",[n.InvalidStatResponse]:"Invalid statistics response from service",[n.InvalidRequest]:"Invalid request",[n.RequestFailed]:"Request failed - {reason}",[n.MissingFeatures]:"Missing features",[n.AggregationFieldNotFound]:"Aggregation field not found",[n.DataElementsNotFound]:"Data elements not found on service",[n.NeverReach]:"Encountered unreachable logic",[n.NotImplemented]:"Not implemented"};class o extends Error{constructor(t,r){super(e(a[t],r)),this.declaredRootClass="esri.arcade.featureset.support.featureseterror",Error.captureStackTrace&&Error.captureStackTrace(this,o)}}export{o as FeatureSetError,n as FeatureSetErrorCodes,a as FeatureSetErrorMessages,s as SqlError,t as SqlErrorCodes,r as SqlErrorMessages};
5
+ import{doSubstitutions as e}from"../../executionError.js";var t;!function(e){e.InvalidFunctionParameters="InvalidFunctionParameters",e.UnsupportedSqlFunction="UnsupportedSqlFunction",e.UnsupportedOperator="UnsupportedOperator",e.UnsupportedSyntax="UnsupportedSyntax",e.UnsupportedIsRhs="UnsupportedIsRhs",e.UnsupportedIsLhs="UnsupportedIsLhs",e.InvalidDataType="InvalidDataType",e.CannotCastValue="CannotCastValue",e.MissingStatisticParameters="MissingStatisticParameters"}(t||(t={}));const a={[t.MissingStatisticParameters]:"Statistic does not have 1 or 0 Parameters",[t.InvalidFunctionParameters]:"Invalid parameters for call to {function}",[t.UnsupportedIsLhs]:"Unsupported left hand expression in is statement",[t.UnsupportedIsRhs]:"Unsupported right hand expression in is statement",[t.UnsupportedOperator]:"Unsupported operator - {operator}",[t.UnsupportedSyntax]:"Unsupported syntax - {node}",[t.UnsupportedSqlFunction]:"Sql function not found = {function}",[t.InvalidDataType]:"Invalid sql data type",[t.CannotCastValue]:"Cannot cast value to the required data type"};class s extends Error{constructor(t,n){super(e(a[t],n)),this.declaredRootClass="esri.arcade.featureset.support.sqlerror",Error.captureStackTrace&&Error.captureStackTrace(this,s)}}var n;!function(e){e.NeverReach="NeverReach",e.NotImplemented="NotImplemented",e.Cancelled="Cancelled",e.InvalidStatResponse="InvalidStatResponse",e.InvalidRequest="InvalidRequest",e.RequestFailed="RequestFailed",e.MissingFeatures="MissingFeatures",e.AggregationFieldNotFound="AggregationFieldNotFound",e.DataElementsNotFound="DataElementsNotFound"}(n||(n={}));const r={[n.Cancelled]:"Cancelled",[n.InvalidStatResponse]:"Invalid statistics response from service",[n.InvalidRequest]:"Invalid request",[n.RequestFailed]:"Request failed - {reason}",[n.MissingFeatures]:"Missing features",[n.AggregationFieldNotFound]:"Aggregation field not found",[n.DataElementsNotFound]:"Data elements not found on service",[n.NeverReach]:"Encountered unreachable logic",[n.NotImplemented]:"Not implemented"};class o extends Error{constructor(t,a){super(e(r[t],a)),this.declaredRootClass="esri.arcade.featureset.support.featureseterror",Error.captureStackTrace&&Error.captureStackTrace(this,o)}}export{o as FeatureSetError,n as FeatureSetErrorCodes,r as FeatureSetErrorMessages,s as SqlError,t as SqlErrorCodes,a as SqlErrorMessages};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeDate as e}from"../../ArcadeDate.js";import{FeatureServiceDatabaseType as r,isDate as t,isArcadeDate as n}from"./shared.js";import{WhereClause as a}from"../../../core/sql/WhereClause.js";import{SqlError as s,SqlErrorCodes as o}from"./errorsupport.js";import{convertTimeReference as c}from"../../arcadeTimeUtils.js";import{DateTime as i}from"luxon";function u(e,r){return m(e?.parseTree,r,e?.parameters)}function l(e,r,t,n){return d(a.create(e,r.fieldsIndex),t,n)}function d(e,t,n){const a=c(t),s=c(n);return m(e.parseTree,r.Standardised,null,null,null,{inputTimeReference:a,outputTimeReference:s})}function f(e,r,t){return m(e,r,t)}function p(e,t,n,s){return a.create(m(e.parseTree,r.Standardised,e.parameters,t,n),s)}function y(e,t,n="AND"){return a.create("(("+u(e,r.Standardised)+")"+n+"("+u(t,r.Standardised)+"))",e.fieldsIndex)}function m(e,r,a,c=null,i=null,u=null){let l,d,f,p;switch(e.type){case"interval":return D(m(e.value,r,a,c,i,u),e.qualifier,e.op);case"case-expression":{let t=" CASE ";"simple"===e.format&&(t+=m(e.operand,r,a,c,i,u));for(let n=0;n<e.clauses.length;n++)t+=" WHEN "+m(e.clauses[n].operand,r,a,c,i,u)+" THEN "+m(e.clauses[n].value,r,a,c,i,u);return null!==e.else&&(t+=" ELSE "+m(e.else,r,a,c,i,u)),t+=" END ",t}case"parameter":{const s=a[e.value.toLowerCase()];if("string"==typeof s){return"'"+a[e.value.toLowerCase()].toString().replace(/'/g,"''")+"'"}if(t(s))return T(s,r,u);if(n(s))return h(s,r,u);if(s instanceof Array){const e=[];for(let a=0;a<s.length;a++)"string"==typeof s[a]?e.push("'"+s[a].toString().replace(/'/g,"''")+"'"):t(s[a])?e.push(T(s[a],r,u)):n(s[a])?e.push(h(s[a],r,u)):e.push(s[a].toString());return e}return s.toString()}case"expression-list":d=[];for(const t of e.value)d.push(m(t,r,a,c,i,u));return d;case"unary-expression":return" ( NOT "+m(e.expr,r,a,c,i,u)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+m(e.left,r,a,c,i,u)+" AND "+m(e.right,r,a,c,i,u)+") ";case"OR":return" ("+m(e.left,r,a,c,i,u)+" OR "+m(e.right,r,a,c,i,u)+") ";case"IS":if("null"!==e.right.type)throw new s(o.UnsupportedIsRhs);return" ("+m(e.left,r,a,c,i,u)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new s(o.UnsupportedIsRhs);return" ("+m(e.left,r,a,c,i,u)+" IS NOT NULL )";case"IN":return l=[],"expression-list"===e.right.type?(l=m(e.right,r,a,c,i)," ("+m(e.left,r,a,c,i,u)+" IN ("+l.join(",")+")) "):(p=m(e.right,r,a,c,i,u),p instanceof Array?" ("+m(e.left,r,a,c,i,u)+" IN ("+p.join(",")+")) ":" ("+m(e.left,r,a,c,i,u)+" IN ("+p+")) ");case"NOT IN":return l=[],"expression-list"===e.right.type?(l=m(e.right,r,a,c,i)," ("+m(e.left,r,a,c,i,u)+" NOT IN ("+l.join(",")+")) "):(p=m(e.right,r,a,c,i,u),p instanceof Array?" ("+m(e.left,r,a,c,i,u)+" NOT IN ("+p.join(",")+")) ":" ("+m(e.left,r,a,c,i,u)+" NOT IN ("+p+")) ");case"BETWEEN":return f=m(e.right,r,a,c,i,u)," ("+m(e.left,r,a,c,i,u)+" BETWEEN "+f[0]+" AND "+f[1]+" ) ";case"NOTBETWEEN":return f=m(e.right,r,a,c,i,u)," ("+m(e.left,r,a,c,i,u)+" NOT BETWEEN "+f[0]+" AND "+f[1]+" ) ";case"LIKE":return""!==e.escape?" ("+m(e.left,r,a,c,i,u)+" LIKE "+m(e.right,r,a,c,i,u)+" ESCAPE '"+e.escape+"') ":" ("+m(e.left,r,a,c,i,u)+" LIKE "+m(e.right,r,a,c,i,u)+") ";case"NOT LIKE":return""!==e.escape?" ("+m(e.left,r,a,c,i,u)+" NOT LIKE "+m(e.right,r,a,c,i,u)+" ESCAPE '"+e.escape+"') ":" ("+m(e.left,r,a,c,i,u)+" NOT LIKE "+m(e.right,r,a,c,i,u)+") ";case"<>":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":return" ("+m(e.left,r,a,c,i,u)+" "+e.operator+" "+m(e.right,r,a,c,i,u)+") "}throw new s(o.UnsupportedOperator,{operator:e.operator});case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return T(e.value,r,u);case"number":return e.value.toString();case"current-time":return L("date"===e.mode,r);case"column-reference":return c&&c.toLowerCase()===e.column.toLowerCase()?"("+i+")":e.column;case"function":{const t=m(e.args,r,a,c,i,u);return g(e.name,t,r)}}throw new s(o.UnsupportedSyntax,{node:e.type})}function g(e,t,n){switch(e.toLowerCase().trim()){case"abs":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"abs"});return"abs("+t[0]+")";case"ceiling":case"ceil":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"ceiling"});switch(n){case r.Standardised:case r.StandardisedNoInterval:}return"CEILING("+t[0]+")";case"floor":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"floor"});return"FLOOR("+t[0]+")";case"log":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"log"});return"LOG("+t[0]+")";case"log10":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"log10"});return"LOG10("+t[0]+")";case"power":if(2!==t.length)throw new s(o.InvalidFunctionParameters,{function:"power"});return"POWER("+t[0]+","+t[1]+")";case"round":if(2===t.length)return"ROUND("+t[0]+","+t[1]+")";if(1===t.length)return"ROUND("+t[0]+")";throw new s(o.InvalidFunctionParameters,{function:"round"});case"truncate":if(t.length<1||t.length>2)throw new s(o.InvalidFunctionParameters,{function:"truncate"});return n===r.SqlServer?"ROUND("+t[0]+(1===t.length?"0":","+t[1])+",1)":"TRUNCATE("+t[0]+(1===t.length?")":","+t[1]+")");case"char_length":case"len":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"char_length"});switch(n){case r.SqlServer:return"LEN("+t[0]+")";case r.Oracle:return"LENGTH("+t[0]+")";default:return"CHAR_LENGTH("+t[0]+")"}case"concat":if(t.length<1)throw new s(o.InvalidFunctionParameters,{function:"concat"});{let e="CONCAT(";for(let r=0;r<t.length;r++)0!==r&&(e+=","),e+=t[r];return e+=")",e}case"lower":case"lcase":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"lower"});return"LOWER("+t[0]+")";case"upper":case"ucase":if(1!==t.length)throw new s(o.InvalidFunctionParameters,{function:"upper"});return"UPPER("+t[0]+")";case"substring":{let e="";switch(n){case r.Oracle:return e="SUBSTR("+t[0]+","+t[1],3===t.length&&(e+=","+t[2]),e+=")",e;case r.SqlServer:return e=3===t.length?"SUBSTRING("+t[0]+","+t[1]+","+t[2]+")":"SUBSTRING("+t[0]+", "+t[1]+", LEN("+t[0]+") - "+t[1]+")",e;default:return e="SUBSTRING("+t[0]+" FROM "+t[1],3===t.length&&(e+=" FOR "+t[2]),e+=")",e}}case"extract":return"EXTRACT("+t[0].replace(/\'/g,"")+" FROM "+t[1]+")"}throw new s(o.InvalidFunctionParameters,{function:e})}function h(t,n,a,s){a?.outputTimeReference&&(t=e.arcadeDateAndZoneToArcadeDate(t,a?.outputTimeReference));const o=t.toDateTime(),c=0===o.hour&&0===o.minute&&0===o.second&&0===o.millisecond;switch(n){case r.FILEGDB:case r.Standardised:case r.StandardisedNoInterval:return c?`date '${o.toFormat("yyyy-LL-dd")}'`:`date '${o.toFormat("yyyy-LL-dd HH:mm:ss")}'`;case r.Oracle:return c?`TO_DATE('${o.toFormat("yyyy-LL-dd")}','YYYY-MM-DD')`:`TO_DATE('${o.toFormat("yyyy-LL-dd HH:mm:ss")}','YYYY-MM-DD HH24:MI:SS')`;case r.SqlServer:return`'${o.toFormat(c?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;case r.PGDB:return`#${o.toFormat(c?"LL-dd-yyyy":"LL-dd-yyyy HH:mm:ss")}#`;case r.Postgres:return`TIMESTAMP '${o.toFormat(c?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;default:return`date '${o.toFormat("yyyy-LL-dd HH:mm:ss")}'`}}function T(e,n,a,s){let o=t(e)?i.fromJSDate(e):i.fromSQL(e);const c=0===o.hour&&0===o.minute&&0===o.second&&0===o.millisecond;switch(a?.inputTimeReference&&(o=i.fromObject({day:o.day,year:o.year,month:o.month,hour:o.hour,minute:o.minute,second:o.second,millisecond:o.millisecond},{zone:a.inputTimeReference})),a?.outputTimeReference&&(o=o.setZone(a.outputTimeReference)),n){case r.FILEGDB:case r.Standardised:case r.StandardisedNoInterval:return c?`date '${o.toFormat("yyyy-LL-dd")}'`:`date '${o.toFormat("yyyy-LL-dd HH:mm:ss")}'`;case r.Oracle:return c?`TO_DATE('${o.toFormat("yyyy-LL-dd")}','YYYY-MM-DD')`:`TO_DATE('${o.toFormat("yyyy-LL-dd HH:mm:ss")}','YYYY-MM-DD HH24:MI:SS')`;case r.SqlServer:return`'${o.toFormat(c?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;case r.PGDB:return`#${o.toFormat(c?"LL-dd-yyyy":"LL-dd-yyyy HH:mm:ss")}#`;case r.Postgres:return`TIMESTAMP '${o.toFormat(c?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;default:return`date '${o.toFormat("yyyy-LL-dd HH:mm:ss")}'`}}function L(e,t){switch(t){case r.FILEGDB:case r.Standardised:case r.StandardisedNoInterval:case r.Oracle:return e?"CURRENT_DATE":"CURRENT_TIMESTAMP";case r.SqlServer:return e?"CAST(GETDATE() AS DATE)":"GETDATE()";case r.PGDB:case r.Postgres:default:return e?"CURRENT_DATE":"CURRENT_TIMESTAMP"}}function w(e,r,t={}){const n={},a={},s={esriFieldTypeSmallInteger:"integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"double",esriFieldTypeDouble:"double",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"integer",oid:"integer",long:"integer","small-integer":"integer",integer:"integer",single:"double",double:"double",date:"date",string:"string"};for(const o of r){const e=o.type?s[o.type]:void 0;n[o.name.toLowerCase()]=void 0===e?"":e}for(const o in t){const e=s[t[o]];a[o.toLowerCase()]=void 0===e?"":e}switch(E(n,e.parseTree,e.parameters,a)){case"double":return"double";case"integer":return"integer";case"date":return"date";case"string":return"string"}return""}function E(e,r,a,c){let i;switch(r.type){case"interval":return"integer";case"case-expression":{const t=[];if("simple"===r.format){for(let n=0;n<r.clauses.length;n++)t.push(E(e,r.clauses[n].value,a,c));null!==r.else&&t.push(E(e,r.else,a,c))}else{for(let n=0;n<r.clauses.length;n++)t.push(E(e,r.else,a,c));null!==r.else&&t.push(E(e,r.else,a,c))}return N(t)}case"parameter":{const e=c[r.value.toLowerCase()];if(void 0===e&&a){const e=a[r.value.toLowerCase()];if(void 0===e)return"";if(null===e)return"";if("string"==typeof e||e instanceof String)return"string";if("boolean"==typeof e)return"boolean";if(t(e))return"date";if(n(e))return"date";if("number"==typeof e)return e%1==0?"integer":"double"}return void 0===e?"":e}case"expression-list":{const t=[];for(const n of r.value)t.push(E(e,n,a,c));return t}case"unary-expression":return"boolean";case"binary-expression":switch(r.operator){case"AND":case"OR":case"IN":case"NOT IN":case"BETWEEN":case"NOTBETWEEN":case"LIKE":case"NOT LIKE":case"<>":case"<":case">":case">=":case"<=":case"=":return"boolean";case"IS":case"ISNOT":if("null"!==r.right.type)throw new s(o.UnsupportedIsRhs);return"boolean";case"*":case"-":case"+":case"/":return N([E(e,r.left,a,c),E(e,r.right,a,c)]);default:throw new s(o.UnsupportedOperator,{operator:r.operator})}case"null":return"";case"boolean":return"boolean";case"string":return"string";case"number":return null===r.value?"":r.value%1==0?"integer":"double";case"date":case"timestamp":case"current-time":return"date";case"column-reference":{const t=e[r.column.toLowerCase()];return void 0===t?"":t}case"function":switch(r.name.toLowerCase()){case"position":case"extract":case"char_length":return"integer";case"round":return i=E(e,r.args,a,c),i instanceof Array?i.length>0?i[0]:"":i;case"sign":return i=E(e,r.args,a,c),i instanceof Array&&(i=N(i)),"integer"===i||"double"===i?i:"double";case"ceiling":case"floor":case"abs":{const t=E(e,r.args,a,c);return t instanceof Array?N(t):t}case"area":case"length":case"log":case"log10":case"sin":case"cos":case"tan":case"asin":case"acos":case"atan":case"power":case"truncate":return"double";case"substring":case"trim":case"concat":case"lower":case"upper":return"string"}return""}throw new s(o.UnsupportedSyntax,{node:r.type})}const S={boolean:1,string:2,integer:3,double:4,date:5};function N(e){if(e){let r="";for(const t of e)""!==t&&(r=""===r||S[r]<S[t]?t:r);return r}return""}function I(e,r){return O(e.parseTree,r)}function v(e){return"column-reference"===e?.parseTree.type}function O(e,r){if(null==e)return!1;switch(e.type){case"when-clause":return O(e.operand,r)||O(e.value,r);case"case-expression":for(const t of e.clauses)if(O(t,r))return!0;return!("simple"!==e.format||!O(e.operand,r))||!(null===e.else||!O(e.else,r));case"parameter":case"null":case"boolean":case"date":case"timestamp":case"string":case"number":return!1;case"expression-list":for(const t of e.value)if(O(t,r))return!0;return!1;case"unary-expression":return O(e.expr,r);case"binary-expression":return O(e.left,r)||O(e.right,r);case"column-reference":return r.toLowerCase()===e.column.toLowerCase();case"function":return O(e.args,r)}return!1}function F(e){let r="";return r+=e.period.toUpperCase(),r}function D(e,r,t){let n="";return n="interval-period"===r.type?F(r):F(r.start)+" TO "+F(r.end),"INTERVAL "+t+" "+e+" "+n}export{h as arcadeDateToSqlString,l as changeSqlTimeZones,d as changeWhereClauseTimeZone,y as combine,D as convertIntervalToSql,v as isSingleField,T as makeDateString,L as makeToday,w as predictType,p as reformulateWithoutField,I as scanForField,u as toWhereClause,f as toWhereClauseFromTree,g as translateFunctionToDatabaseSpecific};
5
+ import{ArcadeDate as e}from"../../ArcadeDate.js";import{FeatureServiceDatabaseType as r,isDate as t,isArcadeDate as a}from"./shared.js";import{WhereClause as n}from"../../../core/sql/WhereClause.js";import{SqlError as s,SqlErrorCodes as c}from"./errorsupport.js";import{convertTimeReference as o}from"../../arcadeTimeUtils.js";import{DateTime as i}from"luxon";function u(e,r){return y(e?.parseTree,r,e?.parameters)}function l(e,r,t,a){return d(n.create(e,r.fieldsIndex),t,a)}function d(e,t,a){const n=o(t),s=o(a);return y(e.parseTree,r.Standardised,null,null,null,{inputTimeReference:n,outputTimeReference:s})}function f(e,r,t){return y(e,r,t)}function p(e,t,a,s){return n.create(y(e.parseTree,r.Standardised,e.parameters,t,a),s)}function m(e,t,a="AND"){return n.create("(("+u(e,r.Standardised)+")"+a+"("+u(t,r.Standardised)+"))",e.fieldsIndex)}function y(e,n,o,i=null,u=null,l=null){let d,f,p,m;switch(e.type){case"interval":return R(y(e.value,n,o,i,u,l),e.qualifier,e.op);case"case-expression":{let r=" CASE ";"simple"===e.format&&(r+=y(e.operand,n,o,i,u,l));for(let t=0;t<e.clauses.length;t++)r+=" WHEN "+y(e.clauses[t].operand,n,o,i,u,l)+" THEN "+y(e.clauses[t].value,n,o,i,u,l);return null!==e.else&&(r+=" ELSE "+y(e.else,n,o,i,u,l)),r+=" END ",r}case"parameter":{const r=o[e.value.toLowerCase()];if("string"==typeof r){return"'"+o[e.value.toLowerCase()].toString().replace(/'/g,"''")+"'"}if(t(r))return T(r,n,l);if(a(r))return h(r,n,l);if(r instanceof Array){const e=[];for(let s=0;s<r.length;s++)"string"==typeof r[s]?e.push("'"+r[s].toString().replace(/'/g,"''")+"'"):t(r[s])?e.push(T(r[s],n,l)):a(r[s])?e.push(h(r[s],n,l)):e.push(r[s].toString());return e}return r.toString()}case"expression-list":f=[];for(const r of e.value)f.push(y(r,n,o,i,u,l));return f;case"unary-expression":return" ( NOT "+y(e.expr,n,o,i,u,l)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+y(e.left,n,o,i,u,l)+" AND "+y(e.right,n,o,i,u,l)+") ";case"OR":return" ("+y(e.left,n,o,i,u,l)+" OR "+y(e.right,n,o,i,u,l)+") ";case"IS":if("null"!==e.right.type)throw new s(c.UnsupportedIsRhs);return" ("+y(e.left,n,o,i,u,l)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new s(c.UnsupportedIsRhs);return" ("+y(e.left,n,o,i,u,l)+" IS NOT NULL )";case"IN":return d=[],"expression-list"===e.right.type?(d=y(e.right,n,o,i,u)," ("+y(e.left,n,o,i,u,l)+" IN ("+d.join(",")+")) "):(m=y(e.right,n,o,i,u,l),m instanceof Array?" ("+y(e.left,n,o,i,u,l)+" IN ("+m.join(",")+")) ":" ("+y(e.left,n,o,i,u,l)+" IN ("+m+")) ");case"NOT IN":return d=[],"expression-list"===e.right.type?(d=y(e.right,n,o,i,u)," ("+y(e.left,n,o,i,u,l)+" NOT IN ("+d.join(",")+")) "):(m=y(e.right,n,o,i,u,l),m instanceof Array?" ("+y(e.left,n,o,i,u,l)+" NOT IN ("+m.join(",")+")) ":" ("+y(e.left,n,o,i,u,l)+" NOT IN ("+m+")) ");case"BETWEEN":return p=y(e.right,n,o,i,u,l)," ("+y(e.left,n,o,i,u,l)+" BETWEEN "+p[0]+" AND "+p[1]+" ) ";case"NOTBETWEEN":return p=y(e.right,n,o,i,u,l)," ("+y(e.left,n,o,i,u,l)+" NOT BETWEEN "+p[0]+" AND "+p[1]+" ) ";case"LIKE":return""!==e.escape?" ("+y(e.left,n,o,i,u,l)+" LIKE "+y(e.right,n,o,i,u,l)+" ESCAPE '"+e.escape+"') ":" ("+y(e.left,n,o,i,u,l)+" LIKE "+y(e.right,n,o,i,u,l)+") ";case"NOT LIKE":return""!==e.escape?" ("+y(e.left,n,o,i,u,l)+" NOT LIKE "+y(e.right,n,o,i,u,l)+" ESCAPE '"+e.escape+"') ":" ("+y(e.left,n,o,i,u,l)+" NOT LIKE "+y(e.right,n,o,i,u,l)+") ";case"<>":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":return" ("+y(e.left,n,o,i,u,l)+" "+e.operator+" "+y(e.right,n,o,i,u,l)+") ";case"||":return" ("+y(e.left,n,o,i,u,l)+" "+(n===r.SqlServer?"+":e.operator)+" "+y(e.right,n,o,i,u,l)+") "}throw new s(c.UnsupportedOperator,{operator:e.operator});case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return T(e.value,n,l);case"number":return e.value.toString();case"current-time":return L("date"===e.mode,n);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+u+")":e.column;case"data-type":return e.value;case"function":{const r=y(e.args,n,o,i,u,l);return g(e.name,r,n)}}throw new s(c.UnsupportedSyntax,{node:e.type})}function g(e,t,a){switch(e.toLowerCase().trim()){case"cos":case"sin":case"tan":case"cosh":case"tanh":case"sinh":case"acos":case"asin":case"atan":case"floor":case"log10":case"log":case"abs":if(1!==t.length)throw new s(c.InvalidFunctionParameters,{function:e.toLowerCase().trim()});return`${e.toUpperCase().trim()}(${t[0]})`;case"ceiling":case"ceil":if(1!==t.length)throw new s(c.InvalidFunctionParameters,{function:"ceiling"});switch(a){case r.Standardised:case r.StandardisedNoInterval:}return"CEILING("+t[0]+")";case"mod":case"power":case"nullif":if(2!==t.length)throw new s(c.InvalidFunctionParameters,{function:e.toLowerCase().trim()});return`${e.toUpperCase().trim()}(${t[0]},${t[1]})`;case"round":if(2===t.length)return"ROUND("+t[0]+","+t[1]+")";if(1===t.length)return"ROUND("+t[0]+")";throw new s(c.InvalidFunctionParameters,{function:"round"});case"truncate":if(t.length<1||t.length>2)throw new s(c.InvalidFunctionParameters,{function:"truncate"});return a===r.SqlServer?"ROUND("+t[0]+(1===t.length?"0":","+t[1])+",1)":"TRUNCATE("+t[0]+(1===t.length?")":","+t[1]+")");case"char_length":case"len":if(1!==t.length)throw new s(c.InvalidFunctionParameters,{function:"char_length"});switch(a){case r.SqlServer:return"LEN("+t[0]+")";case r.Oracle:return"LENGTH("+t[0]+")";default:return"CHAR_LENGTH("+t[0]+")"}case"coalesce":case"concat":{if(t.length<1)throw new s(c.InvalidFunctionParameters,{function:e.toLowerCase()});let r=e.toUpperCase().trim()+"(";for(let e=0;e<t.length;e++)0!==e&&(r+=","),r+=t[e];return r+=")",r}case"lower":case"lcase":if(1!==t.length)throw new s(c.InvalidFunctionParameters,{function:"lower"});return"LOWER("+t[0]+")";case"upper":case"ucase":if(1!==t.length)throw new s(c.InvalidFunctionParameters,{function:"upper"});return"UPPER("+t[0]+")";case"substring":{let e="";switch(a){case r.Oracle:return e="SUBSTR("+t[0]+","+t[1],3===t.length&&(e+=","+t[2]),e+=")",e;case r.SqlServer:return e=3===t.length?"SUBSTRING("+t[0]+","+t[1]+","+t[2]+")":"SUBSTRING("+t[0]+", "+t[1]+", LEN("+t[0]+") - "+t[1]+")",e;default:return e="SUBSTRING("+t[0]+" FROM "+t[1],3===t.length&&(e+=" FOR "+t[2]),e+=")",e}}case"extract":return"EXTRACT("+t[0].replace(/\'/g,"")+" FROM "+t[1]+")";case"cast":{let e="";switch(a){case r.Oracle:switch(t[1].type){case"date":e="DATE";break;case"float":e="DOUBLE";break;case"integer":e="INTEGER";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`;case r.Postgres:switch(t[1].type){case"date":e="DATE";break;case"float":e="DOUBLE PRECISION";break;case"integer":e="INT";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`;case r.SqlServer:switch(t[1].type){case"date":e="DATE";break;case"float":e="FLOAT";break;case"integer":e="INT";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="DATETIME";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`;default:switch(t[1].type){case"date":e="DATE";break;case"float":e="FLOAT";break;case"integer":e="INTEGER";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+t[1].size.toString()+")"}return`CAST(${t[0]} AS ${e})`}}}throw new s(c.InvalidFunctionParameters,{function:e})}function h(t,a,n,s){n?.outputTimeReference&&(t=e.arcadeDateAndZoneToArcadeDate(t,n?.outputTimeReference));const c=t.toDateTime(),o=0===c.hour&&0===c.minute&&0===c.second&&0===c.millisecond;switch(a){case r.FILEGDB:case r.Standardised:case r.StandardisedNoInterval:return o?`date '${c.toFormat("yyyy-LL-dd")}'`:`date '${c.toFormat("yyyy-LL-dd HH:mm:ss")}'`;case r.Oracle:return o?`TO_DATE('${c.toFormat("yyyy-LL-dd")}','YYYY-MM-DD')`:`TO_DATE('${c.toFormat("yyyy-LL-dd HH:mm:ss")}','YYYY-MM-DD HH24:MI:SS')`;case r.SqlServer:return`'${c.toFormat(o?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;case r.PGDB:return`#${c.toFormat(o?"LL-dd-yyyy":"LL-dd-yyyy HH:mm:ss")}#`;case r.Postgres:return`TIMESTAMP '${c.toFormat(o?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;default:return`date '${c.toFormat("yyyy-LL-dd HH:mm:ss")}'`}}function T(e,a,n,s){let c=t(e)?i.fromJSDate(e):i.fromSQL(e);const o=0===c.hour&&0===c.minute&&0===c.second&&0===c.millisecond;switch(n?.inputTimeReference&&(c=i.fromObject({day:c.day,year:c.year,month:c.month,hour:c.hour,minute:c.minute,second:c.second,millisecond:c.millisecond},{zone:n.inputTimeReference})),n?.outputTimeReference&&(c=c.setZone(n.outputTimeReference)),a){case r.FILEGDB:case r.Standardised:case r.StandardisedNoInterval:return o?`date '${c.toFormat("yyyy-LL-dd")}'`:`date '${c.toFormat("yyyy-LL-dd HH:mm:ss")}'`;case r.Oracle:return o?`TO_DATE('${c.toFormat("yyyy-LL-dd")}','YYYY-MM-DD')`:`TO_DATE('${c.toFormat("yyyy-LL-dd HH:mm:ss")}','YYYY-MM-DD HH24:MI:SS')`;case r.SqlServer:return`'${c.toFormat(o?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;case r.PGDB:return`#${c.toFormat(o?"LL-dd-yyyy":"LL-dd-yyyy HH:mm:ss")}#`;case r.Postgres:return`TIMESTAMP '${c.toFormat(o?"yyyy-LL-dd":"yyyy-LL-dd HH:mm:ss")}'`;default:return`date '${c.toFormat("yyyy-LL-dd HH:mm:ss")}'`}}function L(e,t){switch(t){case r.FILEGDB:case r.Standardised:case r.StandardisedNoInterval:case r.Oracle:return e?"CURRENT_DATE":"CURRENT_TIMESTAMP";case r.SqlServer:return e?"CAST(GETDATE() AS DATE)":"GETDATE()";case r.PGDB:case r.Postgres:default:return e?"CURRENT_DATE":"CURRENT_TIMESTAMP"}}function S(e,r,t={}){const a={},n={},s={esriFieldTypeSmallInteger:"integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"double",esriFieldTypeDouble:"double",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"integer",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"guid",oid:"integer",long:"integer","small-integer":"integer",integer:"integer",single:"double",double:"double",date:"date",guid:"guid",globalid:"guid",string:"string"};for(const c of r){const e=c.type?s[c.type]:void 0;a[c.name.toLowerCase()]=void 0===e?"":e}for(const c in t){const e=s[t[c]];n[c.toLowerCase()]=void 0===e?"":e}switch(E(a,e.parseTree,e.parameters,n)){case"double":return"double";case"integer":return"integer";case"date":return"date";case"string":return"string";case"global-id":case"guid":return"guid"}return""}function E(e,r,n,o){let i;switch(r.type){case"interval":return"integer";case"case-expression":{const t=[];if("simple"===r.format){for(let a=0;a<r.clauses.length;a++)t.push(E(e,r.clauses[a].value,n,o));null!==r.else&&t.push(E(e,r.else,n,o))}else{for(let a=0;a<r.clauses.length;a++)t.push(E(e,r.else,n,o));null!==r.else&&t.push(E(e,r.else,n,o))}return w(t)}case"parameter":{const e=o[r.value.toLowerCase()];if(void 0===e&&n){const e=n[r.value.toLowerCase()];if(void 0===e)return"";if(null===e)return"";if("string"==typeof e||e instanceof String)return"string";if("boolean"==typeof e)return"boolean";if(t(e))return"date";if(a(e))return"date";if("number"==typeof e)return e%1==0?"integer":"double"}return void 0===e?"":e}case"expression-list":{const t=[];for(const a of r.value)t.push(E(e,a,n,o));return t}case"unary-expression":return"boolean";case"binary-expression":switch(r.operator){case"AND":case"OR":case"IN":case"NOT IN":case"BETWEEN":case"NOTBETWEEN":case"LIKE":case"NOT LIKE":case"<>":case"<":case">":case">=":case"<=":case"=":return"boolean";case"IS":case"ISNOT":if("null"!==r.right.type)throw new s(c.UnsupportedIsRhs);return"boolean";case"*":case"-":case"+":case"/":return w([E(e,r.left,n,o),E(e,r.right,n,o)]);case"||":return"string";default:throw new s(c.UnsupportedOperator,{operator:r.operator})}case"null":return"";case"boolean":return"boolean";case"string":return"string";case"number":return null===r.value?"":r.value%1==0?"integer":"double";case"date":case"timestamp":case"current-time":return"date";case"column-reference":{const t=e[r.column.toLowerCase()];return void 0===t?"":t}case"function":switch(r.name.toLowerCase()){case"cast":switch(r.args?.value[1]?.value.type??""){case"integer":case"smallint":return"integer";case"real":case"float":return"double";case"date":case"timestamp":return"date";case"varchar":return"string";default:return""}case"position":case"extract":case"char_length":case"mod":return"integer";case"round":if(i=E(e,r.args,n,o),i instanceof Array){if(i.length<=0)return"double";i=i[0]}return i;case"sign":return"integer";case"ceiling":case"floor":case"abs":return i=E(e,r.args,n,o),i instanceof Array&&(i=w(i)),"integer"===i||"double"===i?i:"double";case"area":case"length":case"log":case"log10":case"sin":case"cos":case"tan":case"asin":case"acos":case"atan":case"cosh":case"sinh":case"tanh":case"power":return"double";case"substring":case"trim":case"concat":case"lower":case"upper":return"string";case"truncate":return"double";case"nullif":case"coalesce":return i=E(e,r.args,n,o),i instanceof Array?i.length>0?i[0]:"":i}return""}throw new s(c.UnsupportedSyntax,{node:r.type})}const I={boolean:1,string:2,integer:3,double:4,date:5};function w(e){if(e){let r="";for(const t of e)""!==t&&(r=""===r||I[r]<I[t]?t:r);return r}return""}function N(e,r){return b(e.parseTree,r)}function A(e){return"column-reference"===e?.parseTree.type}function b(e,r){if(null==e)return!1;switch(e.type){case"when-clause":return b(e.operand,r)||b(e.value,r);case"case-expression":for(const t of e.clauses)if(b(t,r))return!0;return!("simple"!==e.format||!b(e.operand,r))||!(null===e.else||!b(e.else,r));case"parameter":case"null":case"boolean":case"date":case"timestamp":case"string":case"number":return!1;case"expression-list":for(const t of e.value)if(b(t,r))return!0;return!1;case"unary-expression":return b(e.expr,r);case"binary-expression":return b(e.left,r)||b(e.right,r);case"column-reference":return r.toLowerCase()===e.column.toLowerCase();case"function":return b(e.args,r)}return!1}function v(e){let r="";return r+=e.period.toUpperCase(),r}function R(e,r,t){let a="";return a="interval-period"===r.type?v(r):v(r.start)+" TO "+v(r.end),"INTERVAL "+t+" "+e+" "+a}export{h as arcadeDateToSqlString,l as changeSqlTimeZones,d as changeWhereClauseTimeZone,m as combine,R as convertIntervalToSql,A as isSingleField,T as makeDateString,L as makeToday,S as predictType,p as reformulateWithoutField,N as scanForField,u as toWhereClause,f as toWhereClauseFromTree,g as translateFunctionToDatabaseSpecific};