@arcgis/core 6.0.0-next.42 → 6.0.0-next.43

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 (489) hide show
  1. package/Basemap.js +1 -1
  2. package/Graphic.js +1 -1
  3. package/Ground.js +1 -1
  4. package/WebDocument2D.js +1 -1
  5. package/WebScene.js +1 -1
  6. package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +1 -0
  7. package/analysis/ElevationProfileAnalysis.d.ts +15 -0
  8. package/analysis/LineOfSightAnalysis.d.ts +6 -1
  9. package/analysis/ShadowCastAnalysis.d.ts +18 -22
  10. package/analysis/ShadowCastAnalysis.js +1 -1
  11. package/analysis/ViewshedAnalysis.d.ts +6 -1
  12. package/applications/Components/analysisUtils.d.ts +6 -0
  13. package/applications/Components/analysisUtils.js +1 -1
  14. package/arcade/ArcadeModuleResolver.js +1 -1
  15. package/arcade/arcadeCompiler.js +1 -1
  16. package/arcade/featureset/actions/Adapted.js +1 -1
  17. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  18. package/arcade/featureset/support/FeatureSet.js +1 -1
  19. package/arcade/featureset/support/shared.js +1 -1
  20. package/arcade/featureset/support/sqlUtils.js +1 -1
  21. package/arcade/functions/knowledgegraph.js +1 -1
  22. package/arcade/functions/maths.js +1 -1
  23. package/assets/esri/core/workers/RemoteClient.js +1 -1
  24. package/assets/esri/core/workers/chunks/{2f54e4feb554c1a7b9c4.js → 02debe67e6fef9d88bdd.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{bd046399e05e759e0bc2.js → 035204000954973b0ebc.js} +1 -1
  26. package/assets/esri/core/workers/chunks/05225506fdba0c827407.js +1 -0
  27. package/assets/esri/core/workers/chunks/{4c73c493dabe949c2512.js → 077b755688346e0dc8d3.js} +1 -1
  28. package/assets/esri/core/workers/chunks/0c1d8e0c2eae21f97fc0.js +1 -0
  29. package/assets/esri/core/workers/chunks/105865a4d8cb4ddf8a8a.js +1 -0
  30. package/assets/esri/core/workers/chunks/{afe3e89737fb45189a99.js → 14ed0c34b910eba3434e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{f67b37253d6d05d1e339.js → 14ef986665b4a1f6ccdc.js} +1 -1
  32. package/assets/esri/core/workers/chunks/158cbf4075d3eca83a6a.js +1 -0
  33. package/assets/esri/core/workers/chunks/{a03f15f2cbc3fed291c2.js → 15f2b27b8edc0d53e399.js} +1 -1
  34. package/assets/esri/core/workers/chunks/181d24ced5ef6b1f959b.js +1 -0
  35. package/assets/esri/core/workers/chunks/18dbee576b7b9dbe69fb.js +1 -0
  36. package/assets/esri/core/workers/chunks/1aebb8fe0692058bf2fb.js +1 -0
  37. package/assets/esri/core/workers/chunks/1cdb55d9a5ab1a5e3f08.js +1 -0
  38. package/assets/esri/core/workers/chunks/{cf2e5f827cea7d7319ce.js → 1e5c5029b0653047a769.js} +1 -1
  39. package/assets/esri/core/workers/chunks/20db6e844708d3e71437.js +1 -0
  40. package/assets/esri/core/workers/chunks/21a4c3d8265aca775616.js +1 -0
  41. package/assets/esri/core/workers/chunks/23fff0505e02fd364909.js +1 -0
  42. package/assets/esri/core/workers/chunks/286e3e050b29e6158e6f.js +1 -0
  43. package/assets/esri/core/workers/chunks/29ef9d357e30082d267a.js +1 -0
  44. package/assets/esri/core/workers/chunks/29feef121b0916fb90bf.js +1 -0
  45. package/assets/esri/core/workers/chunks/2ef91e8da260454f46d8.js +1 -0
  46. package/assets/esri/core/workers/chunks/32b9bedd4bb0504f0b1d.js +1 -0
  47. package/assets/esri/core/workers/chunks/{279089a6a3f08022c678.js → 361d620b3f91868b1490.js} +1 -1
  48. package/assets/esri/core/workers/chunks/37c16e20f022ca27cdae.js +1 -0
  49. package/assets/esri/core/workers/chunks/380aefa522dfeccb8c65.js +1 -0
  50. package/assets/esri/core/workers/chunks/394ae3199c78a94c6a2a.js +1 -0
  51. package/assets/esri/core/workers/chunks/{fdd2b35388f9fe42b623.js → 3a90b6eafa92f1a68ac5.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{6a65fc1a2931230fe994.js → 3bb1e06861cd0563ed9f.js} +1 -1
  53. package/assets/esri/core/workers/chunks/3f92afa58c895bf87e62.js +1 -0
  54. package/assets/esri/core/workers/chunks/422784ceae0d511868a0.js +1 -0
  55. package/assets/esri/core/workers/chunks/44782e8318dc47cb08a0.js +1 -0
  56. package/assets/esri/core/workers/chunks/{5882f349f3771868e67f.js → 4521f72ab0ea872e5d7c.js} +1 -1
  57. package/assets/esri/core/workers/chunks/45b5a61c4e9fbd9ca0b3.js +1 -0
  58. package/assets/esri/core/workers/chunks/47af220003adfca2167e.js +1 -0
  59. package/assets/esri/core/workers/chunks/487500443a6037d3599f.js +1 -0
  60. package/assets/esri/core/workers/chunks/4a4fab74442c3d914505.js +1 -0
  61. package/assets/esri/core/workers/chunks/4a8903fb1a5d30a68df9.js +1 -0
  62. package/assets/esri/core/workers/chunks/4d818b231e6d1fa73cc5.js +1 -0
  63. package/assets/esri/core/workers/chunks/{e0cf6e1e21d0ee739009.js → 4e03aa5518d46a36661c.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{1a614bac5db42c6263f8.js → 4fe10650ba3cd30aa9a2.js} +1 -1
  65. package/assets/esri/core/workers/chunks/50b8b1cce0a5f77c8372.js +1 -0
  66. package/assets/esri/core/workers/chunks/5470a29a69010c8361c4.js +1 -0
  67. package/assets/esri/core/workers/chunks/564d7f2e58fbc16853c0.js +1 -0
  68. package/assets/esri/core/workers/chunks/5c2e79f2ca401741bf3e.js +1 -0
  69. package/assets/esri/core/workers/chunks/5c9ab86bec07264dc9f2.js +1 -0
  70. package/assets/esri/core/workers/chunks/{04d55ed51e8b2683c4b4.js → 5d908a823b324bafda1e.js} +1 -1
  71. package/assets/esri/core/workers/chunks/5e6d6676a5c47c0e132a.js +1 -0
  72. package/assets/esri/core/workers/chunks/5fd4d3cb3c9350131a59.js +1 -0
  73. package/assets/esri/core/workers/chunks/60637f38159e9bf68d4e.js +1 -0
  74. package/assets/esri/core/workers/chunks/69b73251257088ce7099.js +1 -0
  75. package/assets/esri/core/workers/chunks/6cd17c3a254a0b5c2476.js +1 -0
  76. package/assets/esri/core/workers/chunks/{06102715e9a8f218e07c.js → 6f3732e7ba2d031ba789.js} +1 -1
  77. package/assets/esri/core/workers/chunks/7191ab31fa040a7c561e.js +1 -0
  78. package/assets/esri/core/workers/chunks/71ba848c3352ea3ff96f.js +1 -0
  79. package/assets/esri/core/workers/chunks/76dc8e3264a456f33e61.js +1 -0
  80. package/assets/esri/core/workers/chunks/77d80b6d65d761214a7c.js +1 -0
  81. package/assets/esri/core/workers/chunks/{e2430bc3a1edeb5c3266.js → 78a69594c82d37aecbfb.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{787c1a8bda7d745633f2.js → 81b9894e81cce3490984.js} +1 -1
  83. package/assets/esri/core/workers/chunks/85cd525705eec6803dd3.js +1 -0
  84. package/assets/esri/core/workers/chunks/863f04cacdc843d3f208.js +1 -0
  85. package/assets/esri/core/workers/chunks/8766832c7253557da8fe.js +1 -0
  86. package/assets/esri/core/workers/chunks/87992070008812f8ae6f.js +1 -0
  87. package/assets/esri/core/workers/chunks/892fd2c3533ce46a9258.js +1 -0
  88. package/assets/esri/core/workers/chunks/89b9d716d96135d4f057.js +1 -0
  89. package/assets/esri/core/workers/chunks/{4b2d392ad8e381bfd6b3.js → 89e9ebc8d5c1022cb265.js} +1 -1
  90. package/assets/esri/core/workers/chunks/8b38798ac6d774185238.js +1 -0
  91. package/assets/esri/core/workers/chunks/8b53369cace136ed1329.js +1 -0
  92. package/assets/esri/core/workers/chunks/8ba4f5e1912edf397947.js +1 -0
  93. package/assets/esri/core/workers/chunks/{987424121cf30b0f3c50.js → 8d3e92a3367a3ddc02bd.js} +1 -1
  94. package/assets/esri/core/workers/chunks/8e7a3b1b088c160f4db7.js +1 -0
  95. package/assets/esri/core/workers/chunks/8f4fba4d2339c91c8b3f.js +1 -0
  96. package/assets/esri/core/workers/chunks/{45aaefbdffe5e15dfb24.js → 919a6aedf38e9631ee09.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{487c46d5245cfb35c4bb.js → 921917e53bac82693ec8.js} +1 -1
  98. package/assets/esri/core/workers/chunks/92809b209b68abcb97ee.js +1 -0
  99. package/assets/esri/core/workers/chunks/{beccbfff549902733c4e.js → 9869c696e6321c8db0a9.js} +1 -1
  100. package/assets/esri/core/workers/chunks/98957dba728c93506e50.js +1 -0
  101. package/assets/esri/core/workers/chunks/99ffb839407cb3c26ad8.js +1 -0
  102. package/assets/esri/core/workers/chunks/9b517c8d26a86dedb921.js +1 -0
  103. package/assets/esri/core/workers/chunks/{cb2329d1ea72ce5cc057.js → 9c3f56f22e9baa80a387.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{1860104c2b33f68785dd.js → 9d0976f5979c4f9154dc.js} +1 -1
  105. package/assets/esri/core/workers/chunks/9fe1812aad6e566aea31.js +1 -0
  106. package/assets/esri/core/workers/chunks/a1602995ef96beb7df29.js +1 -0
  107. package/assets/esri/core/workers/chunks/{dff845574c0037a1dca6.js → a332e31165b65a6fb92e.js} +1 -1
  108. package/assets/esri/core/workers/chunks/a553478664a688f32488.js +1 -0
  109. package/assets/esri/core/workers/chunks/a7937b06f4b0860c7671.js +1 -0
  110. package/assets/esri/core/workers/chunks/{1980fd7ae1617ef4d19d.js → a95186214f1206efd8ed.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{853563c66ecf58d53d36.js → ab60e8fbe0f92340616a.js} +1 -1
  112. package/assets/esri/core/workers/chunks/acea0946049136578354.js +1 -0
  113. package/assets/esri/core/workers/chunks/{342a97974a78007b25e0.js → ad94f54b4c88b3a047bc.js} +1 -1
  114. package/assets/esri/core/workers/chunks/ae29fec228e70a93ced1.js +1 -0
  115. package/assets/esri/core/workers/chunks/ae6dc159be974ca0e8da.js +1 -0
  116. package/assets/esri/core/workers/chunks/ae70972bf88d586fd453.js +1 -0
  117. package/assets/esri/core/workers/chunks/b021fa4654ede1d04279.js +1 -0
  118. package/assets/esri/core/workers/chunks/b03f32f02858244c6cd0.js +1 -0
  119. package/assets/esri/core/workers/chunks/b2d922ecc2c4899dbee1.js +1 -0
  120. package/assets/esri/core/workers/chunks/b42e50ec6b819f669400.js +1 -0
  121. package/assets/esri/core/workers/chunks/b6a82775b83d20599635.js +1 -0
  122. package/assets/esri/core/workers/chunks/b6d365b9198b74b05338.js +1 -0
  123. package/assets/esri/core/workers/chunks/{48c6230b8a6d3a8a7906.js → bc21241bc9acb83d1b1c.js} +1 -1
  124. package/assets/esri/core/workers/chunks/bd02d927b0b4991b61c5.js +1 -0
  125. package/assets/esri/core/workers/chunks/bdf1c4c038d556527483.js +1 -0
  126. package/assets/esri/core/workers/chunks/c1273f14a5ef3d81de0d.js +1 -0
  127. package/assets/esri/core/workers/chunks/c752f1e732bb019f657d.js +1 -0
  128. package/assets/esri/core/workers/chunks/{3f74c61359b4bd6dcf00.js → c7f49493bd548d5dc1e0.js} +1 -1
  129. package/assets/esri/core/workers/chunks/{36bafcc29ac133a05558.js → c86d3af148b28ded5875.js} +10 -10
  130. package/assets/esri/core/workers/chunks/{692f0093c444fcc752b5.js → cadd60fa4370284c7ae3.js} +1 -1
  131. package/assets/esri/core/workers/chunks/{d5e251cddd41d643510c.js → cb62326b6526cde429c1.js} +1 -1
  132. package/assets/esri/core/workers/chunks/cd8304b1db83d48c57db.js +1 -0
  133. package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +1 -0
  134. package/assets/esri/core/workers/chunks/d00dd961a5b79f563123.js +1 -0
  135. package/assets/esri/core/workers/chunks/d893c3bb093104d3db95.js +1 -0
  136. package/assets/esri/core/workers/chunks/d8fb1d9da16492574a11.js +1 -0
  137. package/assets/esri/core/workers/chunks/{520f499d79fa71f262c7.js → dd7e4c94a88452425750.js} +1 -1
  138. package/assets/esri/core/workers/chunks/ddb4689624d091922471.js +1 -0
  139. package/assets/esri/core/workers/chunks/df32a3fe81d60f0d7462.js +1 -0
  140. package/assets/esri/core/workers/chunks/dfc6b33f51dc81f3a7be.js +1 -0
  141. package/assets/esri/core/workers/chunks/e55934eb4a17a5b24c94.js +1 -0
  142. package/assets/esri/core/workers/chunks/{5473409fee59db80f87d.js → e5bdfef7c2cc5354be52.js} +1 -1
  143. package/assets/esri/core/workers/chunks/e8cdec961e9cff1cb73b.js +1 -0
  144. package/assets/esri/core/workers/chunks/{446d172834f8675f1202.js → eaf720dfdf6ceca31249.js} +1 -1
  145. package/assets/esri/core/workers/chunks/ef274db3fa260eadf371.js +1 -0
  146. package/assets/esri/core/workers/chunks/efca82a4dc494f57380b.js +1 -0
  147. package/assets/esri/core/workers/chunks/f05990e6fb378e2e1a3b.js +1 -0
  148. package/assets/esri/core/workers/chunks/f0fc89cdf50a40913c02.js +1 -0
  149. package/assets/esri/core/workers/chunks/{8b5dcc4282772bf6b675.js → f11eaab5354cc6aa9569.js} +1 -1
  150. package/assets/esri/core/workers/chunks/f1c2f7c7ce4bd4096eb0.js +1 -0
  151. package/assets/esri/core/workers/chunks/f4e63c5f82b8c2bbfacb.js +1 -0
  152. package/assets/esri/core/workers/chunks/f86ff791a10c802879ec.js +1 -0
  153. package/assets/esri/core/workers/chunks/{7452b5ae971a9ff2e6e9.js → fdffefd7de540272a8a6.js} +1 -1
  154. package/assets/esri/core/workers/chunks/fe0248af95d3f37e099e.js +1 -0
  155. package/chunks/languageUtils.js +1 -1
  156. package/config.js +1 -1
  157. package/core/Accessor.js +1 -1
  158. package/core/Collection.js +1 -1
  159. package/core/LRUCache.js +1 -1
  160. package/core/MapUtils.js +1 -1
  161. package/core/Version.js +1 -1
  162. package/core/asyncUtils.js +1 -1
  163. package/core/fontUtils.js +1 -1
  164. package/core/has.js +1 -1
  165. package/core/sql/SqlInterval.js +1 -1
  166. package/core/sql/WhereClause.js +1 -1
  167. package/core/sql/writeUtils.js +1 -1
  168. package/core/sql.js +1 -1
  169. package/core/urlUtils.js +1 -1
  170. package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
  171. package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
  172. package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
  173. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  174. package/geometry/Point.js +1 -1
  175. package/geometry/Polygon.js +1 -1
  176. package/geometry/SpatialReference.js +1 -1
  177. package/geometry/support/webMercatorUtils.js +1 -1
  178. package/kernel.js +1 -1
  179. package/layers/FeatureLayer.js +1 -1
  180. package/layers/GeoJSONLayer.d.ts +5 -1
  181. package/layers/GeospatialPDFLayer.js +1 -1
  182. package/layers/KnowledgeGraphLayer.js +1 -1
  183. package/layers/LineOfSightLayer.d.ts +6 -1
  184. package/layers/LinkChartLayer.js +1 -1
  185. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  186. package/layers/SubtypeGroupLayer.js +1 -1
  187. package/layers/TileLayer.js +1 -1
  188. package/layers/VectorTileLayer.d.ts +53 -0
  189. package/layers/VectorTileLayer.js +1 -1
  190. package/layers/VideoLayer.js +1 -1
  191. package/layers/ViewshedLayer.d.ts +6 -1
  192. package/layers/VoxelLayer.js +1 -1
  193. package/layers/effects/jsonUtils.js +1 -1
  194. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  195. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  196. package/layers/graphics/data/QueryEngineResult.js +1 -1
  197. package/layers/graphics/data/projectionSupport.js +1 -1
  198. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  199. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  200. package/layers/graphics/sources/geojson/geojson.js +1 -1
  201. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  202. package/layers/graphics/sources/support/QueryTask.js +1 -1
  203. package/layers/graphics/sources/support/uploads.js +1 -1
  204. package/layers/knowledgeGraph/cypherUtils.js +1 -1
  205. package/layers/mixins/refresh.js +1 -1
  206. package/layers/ogc/ogcFeatureUtils.js +1 -1
  207. package/layers/ogc/wfsUtils.js +1 -1
  208. package/layers/parquet.js +1 -1
  209. package/layers/raster/datasets/BaseRaster.js +1 -1
  210. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  211. package/layers/raster/datasets/TIFFRaster.js +1 -1
  212. package/layers/raster/datasets/wcsCoverageParser.js +1 -1
  213. package/layers/raster/formats/Lerc.js +1 -1
  214. package/layers/support/ClientSideConnection.js +1 -1
  215. package/layers/support/ElevationSampler.js +1 -1
  216. package/layers/support/MultidimensionalSubset.js +1 -1
  217. package/layers/support/SpriteSource.js +1 -1
  218. package/layers/support/TileInfo.js +1 -1
  219. package/layers/support/fieldUtils.js +1 -1
  220. package/layers/support/infoFor3D.js +1 -1
  221. package/layers/support/vectorTileLayerLoader.js +1 -1
  222. package/layers/support/wmsUtils.js +1 -1
  223. package/layers/support/wmtsUtils.js +1 -1
  224. package/layers/video/videoUtils.js +1 -1
  225. package/libs/lyr3d/Lyr3DModule.js +1 -1
  226. package/linkChart/utils.js +1 -1
  227. package/networks/support/Circuit.js +1 -1
  228. package/networks/support/CircuitSection.js +1 -1
  229. package/package.json +2 -2
  230. package/portal/Portal.js +1 -1
  231. package/portal/PortalItemResource.js +1 -1
  232. package/portal/PortalQueryParams.js +1 -1
  233. package/renderers/HeatmapRenderer.js +1 -1
  234. package/renderers/UniqueValueRenderer.js +1 -1
  235. package/rest/knowledgeGraphService.js +1 -1
  236. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  237. package/rest/query/operations/queryAttachments.js +1 -1
  238. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  239. package/symbols/cim/types.d.ts +15 -11
  240. package/symbols/support/previewSymbol3D.js +1 -1
  241. package/tables/support/templateUtils.js +1 -1
  242. package/views/2d/engine/vectorTiles/SourceLayerData.js +1 -1
  243. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  244. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  245. package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
  246. package/views/2d/engine/vectorTiles/TileManager.js +1 -1
  247. package/views/2d/engine/vectorTiles/TileParser.js +1 -1
  248. package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
  249. package/views/2d/engine/vectorTiles/VectorTileSourceData.js +2 -0
  250. package/views/2d/engine/vectorTiles/WorkerTile.js +1 -1
  251. package/views/2d/engine/vectorTiles/WorkerTileHandler.js +1 -1
  252. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
  253. package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
  254. package/views/2d/engine/vectorTiles/style/Filter.js +1 -1
  255. package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
  256. package/views/2d/engine/vectorTiles/style/StyleProperty.js +1 -1
  257. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  258. package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
  259. package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +4 -4
  260. package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
  261. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  262. package/views/2d/layers/features/Processor.js +1 -1
  263. package/views/2d/layers/features/support/TileStore.js +1 -1
  264. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  265. package/views/2d/tiling/TileKey.js +1 -1
  266. package/views/2d/tiling/TileStrategy.js +1 -1
  267. package/views/3d/analysis/Dimension/LengthDimensionComputation.js +1 -1
  268. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  269. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  270. package/views/3d/analysis/images/generateTextures.js +1 -1
  271. package/views/3d/environment/EnvironmentView.js +1 -1
  272. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  273. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  274. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  275. package/views/3d/layers/I3SMeshView3D.js +1 -1
  276. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  277. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  278. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  279. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  280. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  281. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  282. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  283. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  284. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  285. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  286. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  287. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  288. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  289. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  290. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  291. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  292. package/views/3d/layers/i3s/I3SAsyncElevationUpdater.js +1 -1
  293. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  294. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  295. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  296. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  297. package/views/3d/state/ConstraintsManager.js +1 -1
  298. package/views/3d/state/controllers/GroundNavigationController.js +1 -1
  299. package/views/3d/support/QualityProfile.js +1 -1
  300. package/views/3d/support/TextureCollection.js +1 -1
  301. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  302. package/views/3d/terrain/TerrainRenderer.js +1 -1
  303. package/views/3d/terrain/Tile.js +1 -1
  304. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  305. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  306. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  307. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  308. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  309. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  310. package/views/3d/webgl-engine/lib/CutFill.js +1 -1
  311. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  312. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  313. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  314. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  315. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  316. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  317. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  318. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
  319. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  320. package/views/SceneView.js +1 -1
  321. package/views/SelectionManager.js +1 -1
  322. package/views/analysis/ElevationProfile/ElevationProfileChart.js +2 -2
  323. package/views/analysis/ElevationProfile/elevationProfileChartBoundsUtils.js +1 -1
  324. package/views/draw/DrawAction.js +1 -1
  325. package/views/draw/support/PluginContext.js +1 -1
  326. package/views/interactive/sketch/normalizedPoint.js +1 -1
  327. package/views/interactive/tooltip/fields/TooltipFieldElevation.js +1 -1
  328. package/views/interactive/tooltip/fields/TooltipFieldOrientation.js +1 -1
  329. package/views/interactive/tooltip/fields/TooltipFieldSize.js +1 -1
  330. package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
  331. package/widgets/Attachments.js +1 -1
  332. package/widgets/Attribution/AttributionViewModel.js +1 -1
  333. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  334. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  335. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  336. package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +1 -1
  337. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  338. package/widgets/BatchAttributeForm.js +1 -1
  339. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  340. package/widgets/BuildingExplorer/BuildingExplorerViewModel.js +1 -1
  341. package/widgets/BuildingExplorer/BuildingNumericFilterViewModel.js +1 -1
  342. package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
  343. package/widgets/CatalogLayerList.js +1 -1
  344. package/widgets/Compass/CompassViewModel.js +1 -1
  345. package/widgets/CoordinateConversion/support/Format.js +1 -1
  346. package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
  347. package/widgets/Daylight/DaylightViewModel.js +1 -1
  348. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
  349. package/widgets/Editor/support/SketchController.js +1 -1
  350. package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
  351. package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
  352. package/widgets/Expand/ExpandViewModel.js +1 -1
  353. package/widgets/Expand.js +1 -1
  354. package/widgets/Feature/FeatureMedia.js +1 -1
  355. package/widgets/Feature/FeatureViewModel.js +1 -1
  356. package/widgets/Feature.js +1 -1
  357. package/widgets/FeatureForm.js +1 -1
  358. package/widgets/FeatureTemplates.js +1 -1
  359. package/widgets/Features/FeaturesViewModel.js +1 -1
  360. package/widgets/Features.js +1 -1
  361. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  362. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  363. package/widgets/Histogram/HistogramViewModel.js +1 -1
  364. package/widgets/Histogram.js +1 -1
  365. package/widgets/HistogramRangeSlider/HistogramRangeSliderViewModel.js +1 -1
  366. package/widgets/Home/HomeViewModel.js +1 -1
  367. package/widgets/LayerList/LayerListViewModel.js +1 -1
  368. package/widgets/Legend/LegendViewModel.js +1 -1
  369. package/widgets/Legend/styles/card/CardView.js +1 -1
  370. package/widgets/Legend/styles/classic/ClassicView.js +1 -1
  371. package/widgets/Locate/LocateViewModel.js +1 -1
  372. package/widgets/Locate.js +1 -1
  373. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  374. package/widgets/NavigationToggle.js +1 -1
  375. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  376. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  377. package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
  378. package/widgets/OrientedImageryViewer/support/urlUtils.js +1 -1
  379. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  380. package/widgets/Search.js +1 -1
  381. package/widgets/ShadowCast/DiscreteOptions.js +1 -1
  382. package/widgets/ShadowCast/DurationOptions.js +1 -1
  383. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  384. package/widgets/ShadowCast/ThresholdOptions.js +1 -1
  385. package/widgets/Sketch.js +1 -1
  386. package/widgets/Slider/SliderViewModel.js +1 -1
  387. package/widgets/Slider.js +1 -1
  388. package/widgets/TableList/TableListViewModel.js +1 -1
  389. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  390. package/widgets/Weather/WeatherViewModel.js +1 -1
  391. package/widgets/Widget.js +1 -1
  392. package/widgets/Zoom/ZoomViewModel.js +1 -1
  393. package/widgets/support/AnalysisViewModelMixin.js +1 -1
  394. package/widgets/support/GridControls.js +1 -1
  395. package/widgets/support/dateUtils.js +1 -1
  396. package/assets/esri/core/workers/chunks/00d43f02119167531d1b.js +0 -1
  397. package/assets/esri/core/workers/chunks/0696fa44a04b99738d7b.js +0 -1
  398. package/assets/esri/core/workers/chunks/091ec4fe83038f3558f4.js +0 -1
  399. package/assets/esri/core/workers/chunks/098ac10877d92fde1006.js +0 -1
  400. package/assets/esri/core/workers/chunks/0a29d87b6e58a3c6df8f.js +0 -1
  401. package/assets/esri/core/workers/chunks/0d04353843ccb7440342.js +0 -1
  402. package/assets/esri/core/workers/chunks/0d87cb6417672de95d53.js +0 -1
  403. package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +0 -1
  404. package/assets/esri/core/workers/chunks/1380cec385426673f294.js +0 -1
  405. package/assets/esri/core/workers/chunks/1b24a40c0fa197014873.js +0 -1
  406. package/assets/esri/core/workers/chunks/1c7096eb48a3a7f27d4f.js +0 -1
  407. package/assets/esri/core/workers/chunks/1cc03067f8405285057c.js +0 -1
  408. package/assets/esri/core/workers/chunks/1f76f6dcdae9f55389cb.js +0 -1
  409. package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +0 -1
  410. package/assets/esri/core/workers/chunks/247617c0dbae2386ab3b.js +0 -1
  411. package/assets/esri/core/workers/chunks/25657f70c5f04a4ed978.js +0 -1
  412. package/assets/esri/core/workers/chunks/2690d5fcd9d5ca92ebf6.js +0 -1
  413. package/assets/esri/core/workers/chunks/2853606099602f73d379.js +0 -1
  414. package/assets/esri/core/workers/chunks/28ed020d9995b6577be5.js +0 -1
  415. package/assets/esri/core/workers/chunks/2b27d3bc492e000bbe58.js +0 -1
  416. package/assets/esri/core/workers/chunks/2d64a13c2303e9cae613.js +0 -1
  417. package/assets/esri/core/workers/chunks/36e5f070009b29b7ac3d.js +0 -1
  418. package/assets/esri/core/workers/chunks/3b5e9e0b180dc10491ec.js +0 -1
  419. package/assets/esri/core/workers/chunks/46edd6c9ed6701e6b975.js +0 -1
  420. package/assets/esri/core/workers/chunks/4e17665dd9048c300d87.js +0 -1
  421. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +0 -1
  422. package/assets/esri/core/workers/chunks/4e8e322b469657ac22e2.js +0 -1
  423. package/assets/esri/core/workers/chunks/5396b6e99a0546a25d19.js +0 -1
  424. package/assets/esri/core/workers/chunks/553a8bf5bc5c56d1bcaf.js +0 -1
  425. package/assets/esri/core/workers/chunks/55c0c074e4afe05f5d4d.js +0 -1
  426. package/assets/esri/core/workers/chunks/5bfb962ca192f90a2724.js +0 -1
  427. package/assets/esri/core/workers/chunks/60c8eedd06080edab3e3.js +0 -1
  428. package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +0 -1
  429. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +0 -1
  430. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +0 -1
  431. package/assets/esri/core/workers/chunks/6699fac01ccd842851ba.js +0 -1
  432. package/assets/esri/core/workers/chunks/672a5390182b20d632be.js +0 -1
  433. package/assets/esri/core/workers/chunks/67caef2ecf0dc5f2eed3.js +0 -1
  434. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +0 -1
  435. package/assets/esri/core/workers/chunks/68fd7b314377d27aaa54.js +0 -1
  436. package/assets/esri/core/workers/chunks/69627b2634da64dd885f.js +0 -1
  437. package/assets/esri/core/workers/chunks/6f2e7e663229b223b4df.js +0 -1
  438. package/assets/esri/core/workers/chunks/7390af96250e89194332.js +0 -1
  439. package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +0 -1
  440. package/assets/esri/core/workers/chunks/7e0ed6e8f7b77e43f628.js +0 -1
  441. package/assets/esri/core/workers/chunks/832c887fdc5af4c08cf2.js +0 -1
  442. package/assets/esri/core/workers/chunks/84fb27e3425515cd0e3f.js +0 -1
  443. package/assets/esri/core/workers/chunks/8502274806ea52308822.js +0 -1
  444. package/assets/esri/core/workers/chunks/867502158997cb2d6406.js +0 -1
  445. package/assets/esri/core/workers/chunks/8ceb6697e8adbeffe019.js +0 -1
  446. package/assets/esri/core/workers/chunks/8e391b5b82429f39791e.js +0 -1
  447. package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +0 -1
  448. package/assets/esri/core/workers/chunks/8fe22c2370219f25c15b.js +0 -1
  449. package/assets/esri/core/workers/chunks/90d797ab82d4a68ba32f.js +0 -1
  450. package/assets/esri/core/workers/chunks/91586bf29492735e692d.js +0 -1
  451. package/assets/esri/core/workers/chunks/96f87c8efd4b11b37686.js +0 -1
  452. package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +0 -1
  453. package/assets/esri/core/workers/chunks/9c3de54513bf8619271c.js +0 -1
  454. package/assets/esri/core/workers/chunks/a125650edbed802e419a.js +0 -1
  455. package/assets/esri/core/workers/chunks/a18c3cbe505a19d29569.js +0 -1
  456. package/assets/esri/core/workers/chunks/a422a801e55fa125546e.js +0 -1
  457. package/assets/esri/core/workers/chunks/a5f17e9a025ac2b6e1bf.js +0 -1
  458. package/assets/esri/core/workers/chunks/a6e846361bf5dd3a11c7.js +0 -1
  459. package/assets/esri/core/workers/chunks/a91dc05a6a609d04ed04.js +0 -1
  460. package/assets/esri/core/workers/chunks/a99c50b4e1c7568210e1.js +0 -1
  461. package/assets/esri/core/workers/chunks/ab48faea5432e2dbd45c.js +0 -1
  462. package/assets/esri/core/workers/chunks/ac107079342251a984dd.js +0 -1
  463. package/assets/esri/core/workers/chunks/acf4737ba509cbd73cce.js +0 -1
  464. package/assets/esri/core/workers/chunks/b7205620ca248f4efc88.js +0 -1
  465. package/assets/esri/core/workers/chunks/bbddeb1c893ff8bbae5d.js +0 -1
  466. package/assets/esri/core/workers/chunks/bc2e2bdf1194e6e9eb5e.js +0 -1
  467. package/assets/esri/core/workers/chunks/c0eb27263f608dc3684b.js +0 -1
  468. package/assets/esri/core/workers/chunks/c3ba1a3247e14f6b7b3a.js +0 -1
  469. package/assets/esri/core/workers/chunks/c5d0a034ff31d5954571.js +0 -1
  470. package/assets/esri/core/workers/chunks/c8057b47c7c6c02a0bda.js +0 -1
  471. package/assets/esri/core/workers/chunks/ca21786e519c914fc9e1.js +0 -1
  472. package/assets/esri/core/workers/chunks/cd46d9b4a8de644e7332.js +0 -1
  473. package/assets/esri/core/workers/chunks/d4c8673ca65df874a7ce.js +0 -1
  474. package/assets/esri/core/workers/chunks/da1e6962ba0c85c37953.js +0 -1
  475. package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +0 -1
  476. package/assets/esri/core/workers/chunks/e0864ca82ffa3c9a0776.js +0 -1
  477. package/assets/esri/core/workers/chunks/e69cd62f824ce7a22fa0.js +0 -1
  478. package/assets/esri/core/workers/chunks/e9457a67befc61e11095.js +0 -1
  479. package/assets/esri/core/workers/chunks/f190a3124d6d03417d73.js +0 -1
  480. package/assets/esri/core/workers/chunks/f4135779bfdaf349352a.js +0 -1
  481. package/assets/esri/core/workers/chunks/f6bd7b52745b82ba73dc.js +0 -1
  482. package/assets/esri/core/workers/chunks/fbe3a3b9d6c8c0b52f65.js +0 -1
  483. package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +0 -1
  484. package/assets/esri/core/workers/chunks/fe7184993ef5713d13fb.js +0 -1
  485. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +0 -1
  486. package/views/2d/engine/vectorTiles/style/VectorTilePbfWriter.js +0 -2
  487. package/views/2d/engine/vectorTiles/style/encodeVectorTileFeatures.js +0 -2
  488. package/views/2d/layers/features/support/FeatureSetReaderVectorTileFeatureCursor.js +0 -2
  489. /package/views/2d/engine/vectorTiles/{Feature.js → PbfFeature.js} +0 -0
@@ -2,4 +2,4 @@
2
2
  import has from"../has.js";import{some as e}from"../iteratorUtils.js";import{isAggregate as t,aggregateFunction as n}from"./AggregateFunctions.js";import{DateOnly as r}from"./DateOnly.js";import{SqlError as i}from"./errorSupport.js";import{sqlCalculateFunction as a}from"./sqlArithmeticUtils.js";import{sqlCompare as o,flipSqlComparisonOperator as s,prepareDateFieldToTimestampLiteralComparisonData as c,isDateOrTimeValue as l}from"./sqlCompareUtils.js";import{isDateTime as u,isTimestampOffset as d,isTimeOnly as f,isDateOnly as p,parseTime as m,parseTimestamp as h,parseDate as g,convertToExecutingTimeZone as _}from"./sqlDateParsingUtils.js";import{SqlInterval as v}from"./SqlInterval.js";import{SqlTimeStampOffset as y}from"./SqlTimestampOffset.js";import{iterateSqlNodes as b}from"./sqlVisitor.js";import{isStandardized as ee,evaluateFunction as x}from"./StandardizedFunctions.js";import{TimeOnly as S}from"./TimeOnly.js";import{WhereGrammar as te}from"./WhereGrammar.js";import{isDate as C}from"../../support/guards.js";import{getLuxonTimeZone as w}from"../../time/timeZoneUtils.js";import{DateTime as T,FixedOffsetZone as E}from"luxon";const D=new Set([`current_timestamp`,`current_date`,`current_time`]);class ne{constructor(e){this.staticData=e}makeBool(e){return B(e)}featureValue(e,t,n,r){return Q(e,t,n,r)}equalsNull(e){return e===null}applyLike(e,t,n){return X(e,t,n)}ensureArray(e){return V(e)}applyIn(e,t){return G(e,t)}currentTimestamp(e){return K(e)}currentDate(e){return q(e)}currentTime(e){return J(e)}makeSqlInterval(e,t,n){return v.createFromValueAndQualifier(e,t,n)}convertInterval(e){return v.isInterval(e)?e.valueInMilliseconds():e}compare(e,t,n){return o(t,n,e)}calculate(e,t,n,r){return a(e,t,n,r)}evaluateTime(e){return m(e)}evaluateTimestamp(e,t){return h(e,t)}evaluateDate(e,t){return g(e,t)}evaluateFunction(e,t,n){return x(e,t,n)}lookup(e,t){let n=t[e];return n===void 0?null:n}between(e,t){return e==null||t[0]==null||t[1]==null?null:o(e,t[0],`>=`)&&o(e,t[1],`<=`)}notbetween(e,t){return e==null||t[0]==null||t[1]==null?null:o(e,t[0],`<`)||o(e,t[1],`>`)}ternaryNot(e){return H(e)}ternaryAnd(e,t){return U(e,t)}ternaryOr(e,t){return W(e,t)}}function O(e,...t){return`this.${e}(${t.join(`, `)})`}function k(e){return e===void 0?`void 0`:JSON.stringify(e)}function re({type:e,start:t,end:n}){return`{type: ${k(e)}, start: ${A(t)}, end: ${A(n)}}`}function A({type:e,period:t,precision:n,secondary:r}){return JSON.stringify({type:e,period:t,precision:n,secondary:r})}function j({type:e,size:t,withtimezone:n}){return JSON.stringify({type:e,size:t,withtimezone:n})}const M=`feature`,N=`lookups`,P=`attributeAdapter`,F=`fieldsIndex`,I=`timeZone`,L=`currentUser`;class R{constructor(e,t){this._parseTree=e,this._fieldsIndex=t,this._staticData=Object.create(null),this._nextStaticDataId=0,this._tempVars=new Set,this._nextTempVarId=0}compile(){let e=this._compileNode(this._parseTree),t=`
3
3
  ${this._tempVars.size>0?`var ${Array.from(this._tempVars).join(`, `)};`:``}
4
4
  return this.convertInterval(${e});
5
- `;return Function(M,N,P,F,I,L,t).bind(new ne(this._staticData))}_storeStaticData(e){let t=`static$${this._nextStaticDataId++}`;return this._staticData[t]=e,t}_compileRefStaticData(e){return`this.staticData[${k(e)}]`}_generateTempVar(){let e=`temp$${this._nextTempVarId++}`;return this._tempVars.add(e),e}_compileSimpleCase(e){let t=this._compileNode(e.operand),n=this._generateTempVar(),r=[];for(let t of e.clauses){let e=O(`compare`,k(`=`),n,this._compileNode(t.operand)),i=this._compileNode(t.value);r.push(`${e} ? (${i}) :`)}return e.else==null?r.push(k(null)):r.push(this._compileNode(e.else)),`(${n} = ${t}, ${r.join(` `)})`}_compileSearchedCase(e){let t=[];for(let n of e.clauses){let e=O(`makeBool`,this._compileNode(n.operand)),r=this._compileNode(n.value);t.push(`${e} ? (${r}) :`)}return e.else==null?t.push(k(null)):t.push(this._compileNode(e.else)),t.join(` `)}_compileInExpr(e,t){let n=new Set,r=[];for(let e of t.value)e.type===`number`||e.type===`string`?n.add(e.value):r.push(e);let i=this._compileNode(e),a=O(`ensureArray`,this._compileNode({type:`expression-list`,location:t.location,value:r}));if(n.size>0){let e=this._compileRefStaticData(this._storeStaticData(n)),t=this._generateTempVar();return r.length>0?`(${t} = ${i}, ${e}.has(${t}) || ${O(`applyIn`,t,a)})`:`(${t} = ${i}, ${t} == null ? null : ${e}.has(${t}))`}return O(`applyIn`,i,a)}_compileNode(e){switch(e.type){case`interval`:return O(`makeSqlInterval`,this._compileNode(e.value),e.qualifier.type===`interval-qualifier`?re(e.qualifier):A(e.qualifier),k(e.op));case`case-expression`:return e.format===`simple`?this._compileSimpleCase(e):this._compileSearchedCase(e);case`parameter`:return O(`lookup`,k(e.value.toLowerCase()),N);case`expression-list`:return`[${e.value.map(e=>this._compileNode(e)).join(`, `)}]`;case`unary-expression`:return O(`ternaryNot`,this._compileNode(e.expr));case`binary-expression`:switch(e.operator){case`AND`:return O(`ternaryAnd`,this._compileNode(e.left),this._compileNode(e.right));case`OR`:return O(`ternaryOr`,this._compileNode(e.left),this._compileNode(e.right));case`IS`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return O(`equalsNull`,this._compileNode(e.left));case`ISNOT`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return`!${O(`equalsNull`,this._compileNode(e.left))}`;case`IN`:return this._compileInExpr(e.left,e.right);case`NOT IN`:return O(`ternaryNot`,this._compileInExpr(e.left,e.right));case`BETWEEN`:return O(`between`,this._compileNode(e.left),this._compileNode(e.right));case`NOTBETWEEN`:return O(`notbetween`,this._compileNode(e.left),this._compileNode(e.right));case`LIKE`:return O(`applyLike`,this._compileNode(e.left),this._compileNode(e.right),k(e.escape));case`NOT LIKE`:return O(`ternaryNot`,O(`applyLike`,this._compileNode(e.left),this._compileNode(e.right),k(e.escape)));case`<>`:case`<`:case`>`:case`>=`:case`<=`:case`=`:if(Z(e,e.operator,this._fieldsIndex)){let t=e.comparisonData;return O(`compare`,k(t.op),O(`featureValue`,M,k(t.fieldName),k(null),P),this._compileRefStaticData(this._storeStaticData(t.comparisonEpochMs)))}return O(`compare`,k(e.operator),this._compileNode(e.left),this._compileNode(e.right));case`*`:case`-`:case`+`:case`/`:case`||`:return O(`calculate`,k(e.operator),this._compileNode(e.left),this._compileNode(e.right),I);default:throw new i(`UnsupportedOperator`,{operator:e.operator})}case`null`:case`boolean`:case`string`:case`number`:return k(e.value);case`time`:try{return this._compileRefStaticData(this._storeStaticData(m(e.value)))}catch{return O(`evaluateTime`,k(e.value))}case`date`:try{return this._compileRefStaticData(this._storeStaticData(g(e.value,`unknown`)))}catch{return O(`evaluateDate`,k(e.value),k(`unknown`))}case`timestamp`:try{return this._compileRefStaticData(this._storeStaticData(h(e.value,`unknown`)))}catch{return O(`evaluateTimestamp`,k(e.value),k(`unknown`))}case`current-time`:return e.mode===`date`?O(`currentDate`,I):e.mode===`time`?O(`currentTime`,I):O(`currentTimestamp`,I);case`current-user`:return L;case`column-reference`:return O(`featureValue`,M,k(e.column),F,P);case`data-type`:return j(e.value);case`function`:return O(`evaluateFunction`,k(e.name),this._compileNode(e.args),I)}throw new i(`UnsupportedSyntax`,{node:e.type})}}class z{static create(e,t={}){return new z(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}constructor(e,t,n=`UTC`,r=null){this.fieldsIndex=t,this.timeZone=n,this.currentUser=r,this.parameters={},this._compiledExecutor=null,this._hasDateFunctions=void 0,this.parseTree=te.parse(e);let{isStandardized:i,isAggregate:a,currentUserRequired:o,referencedFieldNames:s}=this._extractExpressionInfo(t);this._referencedFieldNames=s,this.isStandardized=i,this.isAggregate=a,this.currentUserRequired=o}static convertValueToStorageFormat(e,t=null){if(t===null)return C(e)?e.getTime():u(e)?e.toMillis():d(e)?e.toStorageFormat():f(e)?e.toStorageString():p(e)?e.toStorageFormat():e;switch(t){case`date`:return C(e)?e.getTime():u(e)?e.toMillis():d(e)?e.toMilliseconds():p(e)?e.toNumber():e;case`date-only`:return C(e)?r.fromDateJS(e).toString():d(e)?r.fromSqlTimeStampOffset(e).toString():u(e)?r.fromDateTime(e).toString():e;case`time-only`:return C(e)?S.fromDateJS(e).toStorageString():u(e)?S.fromDateTime(e).toStorageString():d(e)?S.fromSqlTimeStampOffset(e).toStorageString():f(e)?e.toStorageString():e;case`timestamp-offset`:if(C(e))return y.fromJSDate(e).toStorageFormat();if(u(e))return y.fromDateTime(e).toStorageFormat();if(d(e))return e.toStorageFormat()}return e}get fieldNames(){return this._referencedFieldNames}testSet(e,t=$,n=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,n)}calculateValue(e,t=$,n=this.currentUser){let r=this._evaluateNode(this.parseTree,e,t,null,n);return v.isInterval(r)?r.valueInMilliseconds()/864e5:r}tryGetCompiledExecutor(){if(this._compiledExecutor!=null)return this._compiledExecutor;if(has(`esri-csp-restrictions`))return null;let e=new R(this.parseTree,this.fieldsIndex);return this._compiledExecutor=e.compile(),this._compiledExecutor}calculateValueCompiled(e,t=$,n=this.currentUser){let r=this.tryGetCompiledExecutor();return r==null?this.calculateValue(e,t):r(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null)}testFeature(e,t=$,n=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,n)}testFeatureCompiled(e,t=$,n=this.currentUser){let r=this.tryGetCompiledExecutor();return r==null?this.testFeature(e,t):!!r(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null)}get hasDateFunctions(){return this._hasDateFunctions??=e(b(this.parseTree),e=>e.type===`current-time`||e.type===`function`&&D.has(e.name.toLowerCase())),this._hasDateFunctions}getFunctions(){let e=new Set;for(let t of b(this.parseTree))t.type===`function`&&e.add(t.name.toLowerCase());return Array.from(e)}getExpressions(){let e=new Map;for(let t of b(this.parseTree))if(t.type===`function`){let n=t.name.toLowerCase(),r=t.args.value[0];if(r.type===`column-reference`){let t=r.column,i=`${n}-${t}`;e.has(i)||e.set(i,{aggregateType:n,field:t})}}return Array.from(e.values())}getVariables(){let e=new Set;for(let t of b(this.parseTree))t.type===`parameter`&&e.add(t.value.toLowerCase());return Array.from(e)}_extractExpressionInfo(e){let n=[],r=new Set,i=!0,a=!1,o=!1;for(let s of b(this.parseTree))switch(s.type){case`column-reference`:{let t=e?.get(s.column),i,a;t?i=a=t.name??``:(a=s.column,i=a.toLowerCase()),r.has(i)||(r.add(i),n.push(a)),s.column=a;break}case`current-user`:o=!0;break;case`function`:{let{name:e,args:n}=s,r=n.value.length;i&&=ee(e,r),a===!1&&(a=t(e,r));break}}return{referencedFieldNames:Array.from(n),isStandardized:i,isAggregate:a,currentUserRequired:o}}_evaluateNode(e,r,s,c,l){let u;switch(e.type){case`interval`:{let t=this._evaluateNode(e.value,r,s,c,l);return v.createFromValueAndQualifier(t,e.qualifier,e.op)}case`case-expression`:if(e.format===`simple`){let t=this._evaluateNode(e.operand,r,s,c,l);for(let n=0;n<e.clauses.length;n++)if(o(t,this._evaluateNode(e.clauses[n].operand,r,s,c,l),`=`))return this._evaluateNode(e.clauses[n].value,r,s,c,l);if(e.else!==null)return this._evaluateNode(e.else,r,s,c,l)}else{for(let t=0;t<e.clauses.length;t++)if(B(this._evaluateNode(e.clauses[t].operand,r,s,c,l)))return this._evaluateNode(e.clauses[t].value,r,s,c,l);if(e.else!==null)return this._evaluateNode(e.else,r,s,c,l)}return null;case`parameter`:return u=this.parameters[e.value.toLowerCase()],C(u)?T.fromJSDate(u):typeof u==`object`&&u&&`toDateTime`in u?u.toDateTime():u;case`expression-list`:{let t=[];for(let n of e.value)t.push(this._evaluateNode(n,r,s,c,l));return t}case`unary-expression`:return H(this._evaluateNode(e.expr,r,s,c,l));case`binary-expression`:switch(e.operator){case`AND`:return U(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l));case`OR`:return W(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l));case`IS`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return this._evaluateNode(e.left,r,s,c,l)===null;case`ISNOT`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return this._evaluateNode(e.left,r,s,c,l)!==null;case`IN`:{let t=V(this._evaluateNode(e.right,r,s,c,l));return G(this._evaluateNode(e.left,r,s,c,l),t)}case`NOT IN`:{let t=V(this._evaluateNode(e.right,r,s,c,l));return H(G(this._evaluateNode(e.left,r,s,c,l),t))}case`BETWEEN`:{let t=this._evaluateNode(e.left,r,s,c,l),n=this._evaluateNode(e.right,r,s,c,l);return t==null||n[0]==null||n[1]==null?null:o(t,n[0],`>=`)&&o(t,n[1],`<=`)}case`NOTBETWEEN`:{let t=this._evaluateNode(e.left,r,s,c,l),n=this._evaluateNode(e.right,r,s,c,l);return t==null||n[0]==null||n[1]==null?null:o(t,n[0],`<`)||o(t,n[1],`>`)}case`LIKE`:return X(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),e.escape);case`NOT LIKE`:return H(X(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),e.escape));case`<>`:case`<`:case`>`:case`>=`:case`<=`:case`=`:if(Z(e,e.operator,this.fieldsIndex)){let t=e.comparisonData;return o(Q(r,t.fieldName,null,s),t.comparisonEpochMs,t.op)}return o(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),e.operator);case`-`:case`+`:case`*`:case`/`:case`||`:return a(e.operator,this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),this.timeZone)}case`null`:case`boolean`:case`string`:case`number`:return e.value;case`date`:return e.parsedValue??=g(e.value,`unknown`),e.parsedValue;case`timestamp`:return e.parsedValue??=h(e.value,`unknown`),e.parsedValue;case`time`:return e.parsedValue??=m(e.value),e.parsedValue;case`current-time`:return e.mode===`date`?q(this.timeZone):e.mode===`time`?J(this.timeZone):K(this.timeZone);case`current-user`:return l??null;case`column-reference`:return Q(r,e.column,this.fieldsIndex,s);case`data-type`:return e.value;case`function`:{if(this.isAggregate&&t(e.name,e.args.value.length)){let t=[];for(let n of e.args?.value||[]){let e=[];for(let t of c||[])e.push(this._evaluateNode(n,t,s,null,l));t.push(e)}return n(e.name,t)}let i=this._evaluateNode(e.args,r,s,c,l);return x(e.name,i,this.timeZone)}}throw new i(`UnsupportedSyntax`,{node:e.type})}}function B(e){return e===!0}function V(e){return Array.isArray(e)?e:[e]}function H(e){return e===null?null:e!==!0}function U(e,t){return e!=null&&t!=null?e===!0&&t===!0:e===!1||t===!1?!1:null}function W(e,t){return e!=null&&t!=null?e===!0||t===!0:e===!0||t===!0||null}function G(e,t){if(e==null)return null;let n=!1;for(let r of t)if(r==null)n=null;else if(e===r){n=!0;break}else if(l(e)&&l(r)&&(n=o(e,r,`=`),n))break;return n}function K(e){return _(new Date,e)}function q(e){return r.fromNow(e)}function J(e){let t=_(new Date,e);return S.fromDateTime(t)}const Y=`-[]/{}()*+?.\\^$|`;function ie(e,t){let n=t,r=``,i=0;for(let t=0;t<e.length;t++){let a=e.charAt(t);switch(i){case 0:a===n?i=1:Y.includes(a)?r+=`\\`+a:r+=a===`%`?`.*`:a===`_`?`.`:a;break;case 1:Y.includes(a)?r+=`\\`+a:r+=a,i=0}}return RegExp(`^`+r+`$`,`m`)}function X(e,t,n){return e==null?null:ie(t,n).test(e)}function Z(e,t,n){if(`comparisonData`in e)return e.comparisonData!=null;try{if(n==null)return!1;let r,i;if(e.left.type===`column-reference`&&e.right.type===`timestamp`)r=e.left,i=e.right;else if(e.left.type===`timestamp`&&e.right.type===`column-reference`)r=e.right,i=e.left,t=s(t);else return!1;let a=n.get(r.column);if(a?.type!==`esriFieldTypeDate`&&a?.type!==`date`)return!1;let o=n.getTimeZone(a.name),l=o==null?E.utcInstance:w(o);return l.isUniversal?(e.comparisonData=c(a.name,l,t,i.value),!0):!1}finally{`comparisonData`in e||(e.comparisonData=null)}}function ae(e){return e&&typeof e.attributes==`object`}function Q(e,t,n,i){if(`getAttributeSQL`in i)return i.getAttributeSQL(e,t);let a=i.getAttribute(e,t);if(a==null)return a;let o=n?.get(t);switch(o?.type){case`esriFieldTypeDate`:case`date`:{let e=n?.getTimeZone(o.name);return _(new Date(a),e==null?E.utcInstance:w(e))}case`esriFieldTypeDateOnly`:case`date-only`:return r.fromReader(a);case`esriFieldTypeTimeOnly`:case`time-only`:return S.fromReader(a);case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return new y(a)}return a}const $={getAttribute(e,t){return(ae(e)?e.attributes:e)[t]}};export{z as default};
5
+ `;return Function(M,N,P,F,I,L,t).bind(new ne(this._staticData))}_storeStaticData(e){let t=`static$${this._nextStaticDataId++}`;return this._staticData[t]=e,t}_compileRefStaticData(e){return`this.staticData[${k(e)}]`}_generateTempVar(){let e=`temp$${this._nextTempVarId++}`;return this._tempVars.add(e),e}_compileSimpleCase(e){let t=this._compileNode(e.operand),n=this._generateTempVar(),r=[];for(let t of e.clauses){let e=O(`compare`,k(`=`),n,this._compileNode(t.operand)),i=this._compileNode(t.value);r.push(`${e} ? (${i}) :`)}return e.else==null?r.push(k(null)):r.push(this._compileNode(e.else)),`(${n} = ${t}, ${r.join(` `)})`}_compileSearchedCase(e){let t=[];for(let n of e.clauses){let e=O(`makeBool`,this._compileNode(n.operand)),r=this._compileNode(n.value);t.push(`${e} ? (${r}) :`)}return e.else==null?t.push(k(null)):t.push(this._compileNode(e.else)),t.join(` `)}_compileInExpr(e,t){let n=new Set,r=[];for(let e of t.value)e.type===`number`||e.type===`string`?n.add(e.value):r.push(e);let i=this._compileNode(e),a=O(`ensureArray`,this._compileNode({type:`expression-list`,location:t.location,value:r}));if(n.size>0){let e=this._compileRefStaticData(this._storeStaticData(n)),t=this._generateTempVar();return r.length>0?`(${t} = ${i}, ${e}.has(${t}) || ${O(`applyIn`,t,a)})`:`(${t} = ${i}, ${t} == null ? null : ${e}.has(${t}))`}return O(`applyIn`,i,a)}_compileNode(e){switch(e.type){case`interval`:return O(`makeSqlInterval`,this._compileNode(e.value),e.qualifier.type===`interval-qualifier`?re(e.qualifier):A(e.qualifier),k(e.op));case`case-expression`:return e.format===`simple`?this._compileSimpleCase(e):this._compileSearchedCase(e);case`parameter`:return O(`lookup`,k(e.value.toLowerCase()),N);case`expression-list`:return`[${e.value.map(e=>this._compileNode(e)).join(`, `)}]`;case`unary-expression`:return O(`ternaryNot`,this._compileNode(e.expr));case`binary-expression`:switch(e.operator){case`AND`:return O(`ternaryAnd`,this._compileNode(e.left),this._compileNode(e.right));case`OR`:return O(`ternaryOr`,this._compileNode(e.left),this._compileNode(e.right));case`IS`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return O(`equalsNull`,this._compileNode(e.left));case`ISNOT`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return`!${O(`equalsNull`,this._compileNode(e.left))}`;case`IN`:return this._compileInExpr(e.left,e.right);case`NOT IN`:return O(`ternaryNot`,this._compileInExpr(e.left,e.right));case`BETWEEN`:return O(`between`,this._compileNode(e.left),this._compileNode(e.right));case`NOTBETWEEN`:return O(`notbetween`,this._compileNode(e.left),this._compileNode(e.right));case`LIKE`:return O(`applyLike`,this._compileNode(e.left),this._compileNode(e.right),k(e.escape));case`NOT LIKE`:return O(`ternaryNot`,O(`applyLike`,this._compileNode(e.left),this._compileNode(e.right),k(e.escape)));case`<>`:case`<`:case`>`:case`>=`:case`<=`:case`=`:if(Z(e,e.operator,this._fieldsIndex)){let t=e.comparisonData;return O(`compare`,k(t.op),O(`featureValue`,M,k(t.fieldName),k(null),P),this._compileRefStaticData(this._storeStaticData(t.comparisonEpochMs)))}return O(`compare`,k(e.operator),this._compileNode(e.left),this._compileNode(e.right));case`*`:case`-`:case`+`:case`/`:case`||`:return O(`calculate`,k(e.operator),this._compileNode(e.left),this._compileNode(e.right),I);default:throw new i(`UnsupportedOperator`,{operator:e.operator})}case`null`:case`boolean`:case`string`:case`number`:return k(e.value);case`time`:try{return this._compileRefStaticData(this._storeStaticData(m(e.value)))}catch{return O(`evaluateTime`,k(e.value))}case`date`:try{return this._compileRefStaticData(this._storeStaticData(g(e.value,`unknown`)))}catch{return O(`evaluateDate`,k(e.value),k(`unknown`))}case`timestamp`:try{return this._compileRefStaticData(this._storeStaticData(h(e.value,`unknown`)))}catch{return O(`evaluateTimestamp`,k(e.value),k(`unknown`))}case`current-time`:return e.mode===`date`?O(`currentDate`,I):e.mode===`time`?O(`currentTime`,I):O(`currentTimestamp`,I);case`current-user`:return L;case`column-reference`:return O(`featureValue`,M,k(e.column),F,P);case`data-type`:return j(e.value);case`function`:return O(`evaluateFunction`,k(e.name),this._compileNode(e.args),I)}throw new i(`UnsupportedSyntax`,{node:e.type})}}class z{static create(e,t={}){return new z(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}constructor(e,t,n=`UTC`,r=null){this.fieldsIndex=t,this.timeZone=n,this.currentUser=r,this.parameters={},this._compiledExecutor=null,this._hasDateFunctions=void 0,this.parseTree=te.parse(e);let{isStandardized:i,isAggregate:a,currentUserRequired:o,referencedFieldNames:s}=this._extractExpressionInfo(t);this._referencedFieldNames=s,this.isStandardized=i,this.isAggregate=a,this.currentUserRequired=o}static convertValueToStorageFormat(e,t=null){if(t===null)return C(e)?e.getTime():u(e)?e.toMillis():d(e)?e.toStorageFormat():f(e)?e.toStorageString():p(e)?e.toStorageFormat():e;switch(t){case`date`:return C(e)?e.getTime():u(e)?e.toMillis():d(e)?e.toMilliseconds():p(e)?e.toNumber():e;case`date-only`:return C(e)?r.fromDateJS(e).toString():d(e)?r.fromSqlTimeStampOffset(e).toString():u(e)?r.fromDateTime(e).toString():e;case`time-only`:return C(e)?S.fromDateJS(e).toStorageString():u(e)?S.fromDateTime(e).toStorageString():d(e)?S.fromSqlTimeStampOffset(e).toStorageString():f(e)?e.toStorageString():e;case`timestamp-offset`:if(C(e))return y.fromJSDate(e).toStorageFormat();if(u(e))return y.fromDateTime(e).toStorageFormat();if(d(e))return e.toStorageFormat()}return e}get fieldNames(){return this._referencedFieldNames}testSet(e,t=$,n=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,n)}calculateValue(e,t=$,n=this.currentUser){let r=this._evaluateNode(this.parseTree,e,t,null,n);return v.isInterval(r)?r.valueInMilliseconds()/864e5:r}tryGetCompiledExecutor(){if(this._compiledExecutor!=null)return this._compiledExecutor;if(has(`esri-csp-restrictions`))return null;let e=new R(this.parseTree,this.fieldsIndex);return this._compiledExecutor=e.compile(),this._compiledExecutor}calculateValueCompiled(e,t=$,n=this.currentUser){let r=this.tryGetCompiledExecutor();return r==null?this.calculateValue(e,t):r(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null)}testFeature(e,t=$,n=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,n)}testFeatureCompiled(e,t=$,n=this.currentUser){let r=this.tryGetCompiledExecutor();return r==null?this.testFeature(e,t):!!r(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null)}get hasDateFunctions(){return this._hasDateFunctions??=e(b(this.parseTree),e=>e.type===`current-time`||e.type===`function`&&D.has(e.name.toLowerCase())),this._hasDateFunctions}getFunctions(){let e=new Set;for(let t of b(this.parseTree))t.type===`function`&&e.add(t.name.toLowerCase());return Array.from(e)}getExpressions(){let e=new Map;for(let t of b(this.parseTree))if(t.type===`function`){let n=t.name.toLowerCase(),r=t.args.value[0];if(r.type===`column-reference`){let t=r.column,i=`${n}-${t}`;e.has(i)||e.set(i,{aggregateType:n,field:t})}}return Array.from(e.values())}getVariables(){let e=new Set;for(let t of b(this.parseTree))t.type===`parameter`&&e.add(t.value.toLowerCase());return Array.from(e)}_extractExpressionInfo(e){let n=[],r=new Set,i=!0,a=!1,o=!1;for(let s of b(this.parseTree))switch(s.type){case`column-reference`:{let t=e?.get(s.column),i,a;t?i=a=t.name??``:(a=s.column,i=a.toLowerCase()),r.has(i)||(r.add(i),n.push(a)),s.column=a;break}case`current-user`:o=!0;break;case`function`:{let{name:e,args:n}=s,r=n.value.length;i&&=ee(e,r),a===!1&&(a=t(e,r));break}}return{referencedFieldNames:Array.from(n),isStandardized:i,isAggregate:a,currentUserRequired:o}}_evaluateNode(e,r,s,c,l){let u;switch(e.type){case`interval`:{let t=this._evaluateNode(e.value,r,s,c,l);return v.createFromValueAndQualifier(t,e.qualifier,e.op)}case`case-expression`:if(e.format===`simple`){let t=this._evaluateNode(e.operand,r,s,c,l);for(let n=0;n<e.clauses.length;n++)if(o(t,this._evaluateNode(e.clauses[n].operand,r,s,c,l),`=`))return this._evaluateNode(e.clauses[n].value,r,s,c,l);if(e.else!==null)return this._evaluateNode(e.else,r,s,c,l)}else{for(let t=0;t<e.clauses.length;t++)if(B(this._evaluateNode(e.clauses[t].operand,r,s,c,l)))return this._evaluateNode(e.clauses[t].value,r,s,c,l);if(e.else!==null)return this._evaluateNode(e.else,r,s,c,l)}return null;case`parameter`:return u=this.parameters[e.value.toLowerCase()],C(u)?T.fromJSDate(u):typeof u==`object`&&u&&`toDateTime`in u?u.toDateTime():u;case`expression-list`:return Array.from(e.value,e=>this._evaluateNode(e,r,s,c,l));case`unary-expression`:return H(this._evaluateNode(e.expr,r,s,c,l));case`binary-expression`:switch(e.operator){case`AND`:return U(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l));case`OR`:return W(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l));case`IS`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return this._evaluateNode(e.left,r,s,c,l)===null;case`ISNOT`:if(e.right.type!==`null`)throw new i(`UnsupportedIsRhs`);return this._evaluateNode(e.left,r,s,c,l)!==null;case`IN`:{let t=V(this._evaluateNode(e.right,r,s,c,l));return G(this._evaluateNode(e.left,r,s,c,l),t)}case`NOT IN`:{let t=V(this._evaluateNode(e.right,r,s,c,l));return H(G(this._evaluateNode(e.left,r,s,c,l),t))}case`BETWEEN`:{let t=this._evaluateNode(e.left,r,s,c,l),n=this._evaluateNode(e.right,r,s,c,l);return t==null||n[0]==null||n[1]==null?null:o(t,n[0],`>=`)&&o(t,n[1],`<=`)}case`NOTBETWEEN`:{let t=this._evaluateNode(e.left,r,s,c,l),n=this._evaluateNode(e.right,r,s,c,l);return t==null||n[0]==null||n[1]==null?null:o(t,n[0],`<`)||o(t,n[1],`>`)}case`LIKE`:return X(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),e.escape);case`NOT LIKE`:return H(X(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),e.escape));case`<>`:case`<`:case`>`:case`>=`:case`<=`:case`=`:if(Z(e,e.operator,this.fieldsIndex)){let t=e.comparisonData;return o(Q(r,t.fieldName,null,s),t.comparisonEpochMs,t.op)}return o(this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),e.operator);case`-`:case`+`:case`*`:case`/`:case`||`:return a(e.operator,this._evaluateNode(e.left,r,s,c,l),this._evaluateNode(e.right,r,s,c,l),this.timeZone)}case`null`:case`boolean`:case`string`:case`number`:return e.value;case`date`:return e.parsedValue??=g(e.value,`unknown`),e.parsedValue;case`timestamp`:return e.parsedValue??=h(e.value,`unknown`),e.parsedValue;case`time`:return e.parsedValue??=m(e.value),e.parsedValue;case`current-time`:return e.mode===`date`?q(this.timeZone):e.mode===`time`?J(this.timeZone):K(this.timeZone);case`current-user`:return l??null;case`column-reference`:return Q(r,e.column,this.fieldsIndex,s);case`data-type`:return e.value;case`function`:{if(this.isAggregate&&t(e.name,e.args.value.length)){let t=[];for(let n of e.args?.value||[]){let e=Array.from(c||[],e=>this._evaluateNode(n,e,s,null,l));t.push(e)}return n(e.name,t)}let i=this._evaluateNode(e.args,r,s,c,l);return x(e.name,i,this.timeZone)}}throw new i(`UnsupportedSyntax`,{node:e.type})}}function B(e){return e===!0}function V(e){return Array.isArray(e)?e:[e]}function H(e){return e===null?null:e!==!0}function U(e,t){return e!=null&&t!=null?e===!0&&t===!0:e===!1||t===!1?!1:null}function W(e,t){return e!=null&&t!=null?e===!0||t===!0:e===!0||t===!0||null}function G(e,t){if(e==null)return null;let n=!1;for(let r of t)if(r==null)n=null;else if(e===r){n=!0;break}else if(l(e)&&l(r)&&(n=o(e,r,`=`),n))break;return n}function K(e){return _(new Date,e)}function q(e){return r.fromNow(e)}function J(e){let t=_(new Date,e);return S.fromDateTime(t)}const Y=`-[]/{}()*+?.\\^$|`;function ie(e,t){let n=t,r=``,i=0;for(let t=0;t<e.length;t++){let a=e.charAt(t);switch(i){case 0:a===n?i=1:Y.includes(a)?r+=`\\`+a:r+=a===`%`?`.*`:a===`_`?`.`:a;break;case 1:Y.includes(a)?r+=`\\`+a:r+=a,i=0}}return RegExp(`^`+r+`$`,`m`)}function X(e,t,n){return e==null?null:ie(t,n).test(e)}function Z(e,t,n){if(`comparisonData`in e)return e.comparisonData!=null;try{if(n==null)return!1;let r,i;if(e.left.type===`column-reference`&&e.right.type===`timestamp`)r=e.left,i=e.right;else if(e.left.type===`timestamp`&&e.right.type===`column-reference`)r=e.right,i=e.left,t=s(t);else return!1;let a=n.get(r.column);if(a?.type!==`esriFieldTypeDate`&&a?.type!==`date`)return!1;let o=n.getTimeZone(a.name),l=o==null?E.utcInstance:w(o);return l.isUniversal?(e.comparisonData=c(a.name,l,t,i.value),!0):!1}finally{`comparisonData`in e||(e.comparisonData=null)}}function ae(e){return e&&typeof e.attributes==`object`}function Q(e,t,n,i){if(`getAttributeSQL`in i)return i.getAttributeSQL(e,t);let a=i.getAttribute(e,t);if(a==null)return a;let o=n?.get(t);switch(o?.type){case`esriFieldTypeDate`:case`date`:{let e=n?.getTimeZone(o.name);return _(new Date(a),e==null?E.utcInstance:w(e))}case`esriFieldTypeDateOnly`:case`date-only`:return r.fromReader(a);case`esriFieldTypeTimeOnly`:case`time-only`:return S.fromReader(a);case`esriFieldTypeTimestampOffset`:case`timestamp-offset`:return new y(a)}return a}const $={getAttribute(e,t){return(ae(e)?e.attributes:e)[t]}};export{z as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{SqlError as e}from"./errorSupport.js";function t(e){return n(e).trim()}function n(t){let a,c,l,u;switch(t.type){case`interval`:return i(n(t.value),t.qualifier,t.op);case`case-expression`:{let e=`CASE `;t.format===`simple`&&(e+=n(t.operand));for(let r=0;r<t.clauses.length;r++)e+=` WHEN ${n(t.clauses[r].operand)} THEN ${n(t.clauses[r].value)}`;return t.else!==null&&(e+=` ELSE ${n(t.else)}`),e+=` END`,e}case`expression-list`:c=[];for(let e of t.value)c.push(n(e));return c;case`unary-expression`:return`(NOT ${n(t.expr)})`;case`binary-expression`:switch(t.operator){case`AND`:return`(${n(t.left)} AND ${n(t.right)})`;case`OR`:return`(${n(t.left)} OR ${n(t.right)})`;case`IS`:if(t.right.type!==`null`)throw new e(`UnsupportedIsRhs`);return`(${n(t.left)} IS NULL)`;case`ISNOT`:if(t.right.type!==`null`)throw new e(`UnsupportedIsRhs`);return`(${n(t.left)} IS NOT NULL)`;case`IN`:return a=[],t.right.type===`expression-list`?(a=n(t.right),`(${n(t.left)} IN (${a.join(`,`)}))`):(u=n(t.right),Array.isArray(u)?`(${n(t.left)} IN (${u.join(`,`)}))`:`(${n(t.left)} IN (${u}))`);case`NOT IN`:return a=[],t.right.type===`expression-list`?(a=n(t.right),`(${n(t.left)} NOT IN (${a.join(`,`)}))`):(u=n(t.right),Array.isArray(u)?`(${n(t.left)} NOT IN (${u.join(`,`)}))`:`(${n(t.left)} NOT IN (${u}))`);case`BETWEEN`:case`NOTBETWEEN`:return l=n(t.right),`(${n(t.left)} ${t.operator} ${l[0]} AND ${l[1]})`;case`LIKE`:return t.escape===``?`(${n(t.left)} LIKE ${n(t.right)})`:`(${n(t.left)} LIKE ${n(t.right)} ESCAPE '${t.escape}')`;case`NOT LIKE`:return t.escape===``?`(${n(t.left)} NOT LIKE ${n(t.right)})`:`(${n(t.left)} NOT LIKE ${n(t.right)} ESCAPE '${t.escape}')`;case`<>`:case`<`:case`>`:case`>=`:case`<=`:case`=`:case`*`:case`-`:case`+`:case`/`:case`||`:return`(${n(t.left)} ${t.operator} ${n(t.right)})`;default:throw new e(`UnsupportedOperator`,{operator:t.operator})}case`null`:return`null`;case`boolean`:return t.value===!0?`1`:`0`;case`string`:return`'${t.value.toString().replaceAll(`'`,`''`)}'`;case`timestamp`:return`timestamp '${t.value}'`;case`date`:return`date '${t.value}'`;case`time`:return`time '${t.value}'`;case`number`:return t.value.toString();case`current-time`:return r(t.mode);case`current-user`:return`CURRENT_USER`;case`column-reference`:return o(t);case`data-type`:return t.value;case`function`:{let e=n(t.args);return s(t.name,e)}}throw new e(`UnsupportedSyntax`,{node:t.type})}function r(e){return e===`date`?`CURRENT_DATE`:e===`time`?`CURRENT_TIME`:`CURRENT_TIMESTAMP`}function i(e,t,n){let r=``;return r=t.type===`interval-period`?a(t):a(t.start)+` TO `+a(t.end),`INTERVAL${n===``?``:n+` `} ${e} ${r}`}function a(e){return e.period.toUpperCase()}function o(e){return e.delimited===!0?`"${e.column.split(`"`).join(`""`)}"`:e.column}function s(t,n){switch(t.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(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:t.toLowerCase().trim()});return`${t.toUpperCase().trim()}(${n[0]})`;case`ceiling`:case`ceil`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`ceiling`});return`CEILING(`+n[0]+`)`;case`mod`:case`power`:case`nullif`:if(n.length!==2)throw new e(`InvalidFunctionParameters`,{function:t.toLowerCase().trim()});return`${t.toUpperCase().trim()}(${n[0]},${n[1]})`;case`round`:if(n.length===2)return`ROUND(`+n[0]+`,`+n[1]+`)`;if(n.length===1)return`ROUND(`+n[0]+`)`;throw new e(`InvalidFunctionParameters`,{function:`round`});case`truncate`:if(n.length<1||n.length>2)throw new e(`InvalidFunctionParameters`,{function:`truncate`});return`TRUNCATE(`+n[0]+(n.length===1?`)`:`,`+n[1]+`)`);case`char_length`:case`len`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`char_length`});return`CHAR_LENGTH(`+n[0]+`)`;case`coalesce`:case`concat`:{if(n.length<1)throw new e(`InvalidFunctionParameters`,{function:t.toLowerCase()});let r=t.toUpperCase().trim()+`(`;for(let e=0;e<n.length;e++)e!==0&&(r+=`,`),r+=n[e];return r+=`)`,r}case`lower`:case`lcase`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`lower`});return`LOWER(`+n[0]+`)`;case`upper`:case`ucase`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`upper`});return`UPPER(`+n[0]+`)`;case`substring`:{let e=`SUBSTRING(`+n[0]+` FROM `+n[1];return n.length===3&&(e+=` FOR `+n[2]),e+=`)`,e}case`extract`:return`EXTRACT(`+n[0].replaceAll(`'`,``)+` FROM `+n[1]+`)`;case`cast`:{let e=``;switch(n[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(`+n[1].size.toString()+`)`}return`CAST(${n[0]} AS ${e})`}}throw new e(`InvalidFunctionParameters`,{function:t})}export{t as sqlNodeToString,s as translateFunctionToDatabaseSpecific};
2
+ import{SqlError as e}from"./errorSupport.js";function t(e){return n(e).trim()}function n(t){let a,c,l,u;switch(t.type){case`interval`:return i(n(t.value),t.qualifier,t.op);case`case-expression`:{let e=`CASE `;t.format===`simple`&&(e+=n(t.operand));for(let r=0;r<t.clauses.length;r++)e+=` WHEN ${n(t.clauses[r].operand)} THEN ${n(t.clauses[r].value)}`;return t.else!==null&&(e+=` ELSE ${n(t.else)}`),e+=` END`,e}case`expression-list`:c=[];for(let e of t.value)c.push(n(e));return c;case`unary-expression`:return`(NOT ${n(t.expr)})`;case`binary-expression`:switch(t.operator){case`AND`:return`(${n(t.left)} AND ${n(t.right)})`;case`OR`:return`(${n(t.left)} OR ${n(t.right)})`;case`IS`:if(t.right.type!==`null`)throw new e(`UnsupportedIsRhs`);return`(${n(t.left)} IS NULL)`;case`ISNOT`:if(t.right.type!==`null`)throw new e(`UnsupportedIsRhs`);return`(${n(t.left)} IS NOT NULL)`;case`IN`:return a=[],t.right.type===`expression-list`?(a=n(t.right),`(${n(t.left)} IN (${a.join(`,`)}))`):(u=n(t.right),Array.isArray(u)?`(${n(t.left)} IN (${u.join(`,`)}))`:`(${n(t.left)} IN (${u}))`);case`NOT IN`:return a=[],t.right.type===`expression-list`?(a=n(t.right),`(${n(t.left)} NOT IN (${a.join(`,`)}))`):(u=n(t.right),Array.isArray(u)?`(${n(t.left)} NOT IN (${u.join(`,`)}))`:`(${n(t.left)} NOT IN (${u}))`);case`BETWEEN`:case`NOTBETWEEN`:return l=n(t.right),`(${n(t.left)} ${t.operator} ${l[0]} AND ${l[1]})`;case`LIKE`:return t.escape===``?`(${n(t.left)} LIKE ${n(t.right)})`:`(${n(t.left)} LIKE ${n(t.right)} ESCAPE '${t.escape}')`;case`NOT LIKE`:return t.escape===``?`(${n(t.left)} NOT LIKE ${n(t.right)})`:`(${n(t.left)} NOT LIKE ${n(t.right)} ESCAPE '${t.escape}')`;case`<>`:case`<`:case`>`:case`>=`:case`<=`:case`=`:case`*`:case`-`:case`+`:case`/`:case`||`:return`(${n(t.left)} ${t.operator} ${n(t.right)})`;default:throw new e(`UnsupportedOperator`,{operator:t.operator})}case`null`:return`null`;case`boolean`:return t.value===!0?`1`:`0`;case`string`:return`'${t.value.toString().replaceAll(`'`,`''`)}'`;case`timestamp`:return`timestamp '${t.value}'`;case`date`:return`date '${t.value}'`;case`time`:return`time '${t.value}'`;case`number`:return t.value.toString();case`current-time`:return r(t.mode);case`current-user`:return`CURRENT_USER`;case`column-reference`:return o(t);case`data-type`:return t.value;case`function`:{let e=n(t.args);return s(t.name,e)}}throw new e(`UnsupportedSyntax`,{node:t.type})}function r(e){return e===`date`?`CURRENT_DATE`:e===`time`?`CURRENT_TIME`:`CURRENT_TIMESTAMP`}function i(e,t,n){let r=``;return r=t.type===`interval-period`?a(t):a(t.start)+` TO `+a(t.end),`INTERVAL${n===``?``:n+` `} ${e} ${r}`}function a(e){return e.period.toUpperCase()}function o(e){return e.delimited===!0?`"${e.column.replaceAll(`"`,`""`)}"`:e.column}function s(t,n){switch(t.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(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:t.toLowerCase().trim()});return`${t.toUpperCase().trim()}(${n[0]})`;case`ceiling`:case`ceil`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`ceiling`});return`CEILING(`+n[0]+`)`;case`mod`:case`power`:case`nullif`:if(n.length!==2)throw new e(`InvalidFunctionParameters`,{function:t.toLowerCase().trim()});return`${t.toUpperCase().trim()}(${n[0]},${n[1]})`;case`round`:if(n.length===2)return`ROUND(`+n[0]+`,`+n[1]+`)`;if(n.length===1)return`ROUND(`+n[0]+`)`;throw new e(`InvalidFunctionParameters`,{function:`round`});case`truncate`:if(n.length<1||n.length>2)throw new e(`InvalidFunctionParameters`,{function:`truncate`});return`TRUNCATE(`+n[0]+(n.length===1?`)`:`,`+n[1]+`)`);case`char_length`:case`len`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`char_length`});return`CHAR_LENGTH(`+n[0]+`)`;case`coalesce`:case`concat`:{if(n.length<1)throw new e(`InvalidFunctionParameters`,{function:t.toLowerCase()});let r=t.toUpperCase().trim()+`(`;for(let e=0;e<n.length;e++)e!==0&&(r+=`,`),r+=n[e];return r+=`)`,r}case`lower`:case`lcase`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`lower`});return`LOWER(`+n[0]+`)`;case`upper`:case`ucase`:if(n.length!==1)throw new e(`InvalidFunctionParameters`,{function:`upper`});return`UPPER(`+n[0]+`)`;case`substring`:{let e=`SUBSTRING(`+n[0]+` FROM `+n[1];return n.length===3&&(e+=` FOR `+n[2]),e+=`)`,e}case`extract`:return`EXTRACT(`+n[0].replaceAll(`'`,``)+` FROM `+n[1]+`)`;case`cast`:{let e=``;switch(n[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(`+n[1].size.toString()+`)`}return`CAST(${n[0]} AS ${e})`}}throw new e(`InvalidFunctionParameters`,{function:t})}export{t as sqlNodeToString,s as translateFunctionToDatabaseSpecific};
package/core/sql.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isUnknownTimeZone as e}from"./sql/UnknownTimeZone.js";import{isDate as t}from"../support/guards.js";import{getLuxonTimeZone as n}from"../time/timeZoneUtils.js";import{FixedOffsetZone as r,DateTime as i}from"luxon";let a;async function o(){return a??=import(`./sql/WhereClauseCache.js`).then(e=>new e.WhereClauseCache(500,500)),a}function s(){a=null}async function c(e,t){let n=await o(),r=n.get(e,t);if(r==null)throw n.getError(e,t);return r}function l(e,t){return e||=null,t||=null,e===`1=1`?t??e:t===`1=1`?e??t:e&&t?`(${e}) AND (${t})`:e??t}function u(e,t,n){return`${e} BETWEEN ${t} AND ${n}`}function d(e,t,n){return`${e} NOT BETWEEN ${t} AND ${n}`}function f(e,t){return e||=null,t||=null,e===`1=1`||t===`1=1`||e===t?e===`1=1`?e:t:e&&t?`(${e}) OR (${t})`:e??t}function p(e,t){return t.length===0?null:`${e} IN (${h(t)})`}function m(e,t){return t.length===0?null:`${e} NOT IN (${h(t)})`}function h(e){return e.map(e=>typeof e==`string`?g(e):e).join(`,`)}function g(e,t){return e==null?`NULL`:`${t??``}'${e.replaceAll(`'`,`''`)}'`}function _(e){return Number.isFinite(e)?String(e):`NULL`}function v(e){let[t,n]=e.split(`T`);return`${t} ${n.replace(`Z`,`+00:00`).replace(/[+-]/,e=>` ${e}`)}`}function y(e){return e.split(`T`)[0]}function b(e){let t=e.indexOf(`T`)+1,n=Math.max(e.indexOf(`-`,t),e.indexOf(`+`,t),e.indexOf(`Z`,t));return e.slice(t,n>0?n:void 0)}function x(e,t){let a=t==null?r.utcInstance:n(t),o=i.fromMillis(e,{zone:a});return o.isValid?o:null}function S(e,t){return x(e,t)?.toSQL({includeOffset:!1})}function C(e,t){return x(e,t)?.toSQL({includeOffset:!0})?.replace(`Z`,`+00:00`)}function w(e,t){return x(e,t)?.toSQLDate()}function T(e,t){return x(e,t)?.toSQLTime({includeOffset:!1})}function E(e){return typeof e==`string`?e:e?.type}function D(e){return e==null?`NULL`:e?`TRUE`:`FALSE`}function O(e,t){if(e==null)return`NULL`;let n=E(t);switch(typeof e){case`string`:switch(n){case`string`:case`esriFieldTypeString`:case void 0:return _(Number(e));default:throw Error(`Cannot convert ${n} to sql numeric literal.`)}case`boolean`:return e?`1`:`0`;case`number`:switch(n){case`small-integer`:case`esriFieldTypeSmallInteger`:case`integer`:case`esriFieldTypeInteger`:case`single`:case`esriFieldTypeSingle`:case`double`:case`esriFieldTypeDouble`:case`big-integer`:case`esriFieldTypeBigInteger`:case`long`:case`esriFieldTypeLong`:case`oid`:case`esriFieldTypeOID`:case void 0:return _(e);default:throw Error(`Cannot convert ${n} to sql numeric literal.`)}}throw Error(`Cannot convert value to sql numeric literal.`)}function k(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(v(e));case`date-only`:case`esriFieldTypeDateOnly`:case`time-only`:case`esriFieldTypeTimeOnly`:case`string`:case`esriFieldTypeString`:case`global-id`:case`esriFieldTypeGlobalID`:case`guid`:case`esriFieldTypeGUID`:case`xml`:case`esriFieldTypeXML`:case void 0:return g(e);default:throw Error(`Cannot convert ${i} to sql string literal.`)}case`boolean`:return e?`'true'`:`'false'`;case`number`:switch(i){case`date`:case`esriFieldTypeDate`:return g(S(e,r));case`small-integer`:case`esriFieldTypeSmallInteger`:case`integer`:case`esriFieldTypeInteger`:case`single`:case`esriFieldTypeSingle`:case`double`:case`esriFieldTypeDouble`:case`big-integer`:case`esriFieldTypeBigInteger`:case`long`:case`esriFieldTypeLong`:case`oid`:case`esriFieldTypeOID`:case void 0:return Number.isFinite(e)?`'${e}'`:`NULL`;default:throw Error(`Cannot convert ${i} to sql string literal.`)}case`object`:if(t(e))return g(S(e.valueOf(),r))}throw Error(`Cannot convert value to sql string literal.`)}function A(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(y(e),`DATE`);case`date-only`:case`esriFieldTypeDateOnly`:case`string`:case`esriFieldTypeString`:case void 0:return g(e,`DATE`);default:throw Error(`Cannot convert ${i} to sql date literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(w(e,r),`DATE`);default:throw Error(`Cannot convert ${i} to sql date literal.`)}case`object`:if(t(e))return g(w(e.valueOf(),r),`DATE`)}throw Error(`Cannot convert value to sql date literal.`)}function j(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(b(e),`TIME`);case`time-only`:case`esriFieldTypeTimeOnly`:case`string`:case`esriFieldTypeString`:case void 0:return g(e,`TIME`);default:throw Error(`Cannot convert ${i} to sql time literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(T(e,r),`TIME`);default:throw Error(`Cannot convert ${i} to sql time literal.`)}case`object`:if(t(e))return g(T(e.valueOf(),r),`TIME`)}throw Error(`Cannot convert value to sql time literal.`)}function M(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(v(e),`TIMESTAMP`);case`date-only`:case`esriFieldTypeDateOnly`:return g(`${e} 00:00:00`,`TIMESTAMP`);case`string`:case`esriFieldTypeString`:case void 0:return g(e,`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(S(e,r),`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp literal.`)}case`object`:if(t(e))return g(S(e.valueOf(),r),`TIMESTAMP`)}throw Error(`Cannot convert value to sql timestamp literal.`)}function N(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(v(e),`TIMESTAMP`);case`string`:case`esriFieldTypeString`:case void 0:return g(e,`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp offset literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(C(e,r),`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp offset literal.`)}case`object`:if(t(e))return g(C(e.valueOf(),r),`TIMESTAMP`)}throw Error(`Cannot convert value to sql timestamp offset literal.`)}function P(t,n){return t==null?n:n==null||e(t)||e(n)?t:n}function F(e,n,r){if(e==null)return`NULL`;if(n==null&&r==null){switch(typeof e){case`string`:return k(e);case`number`:return O(e);case`boolean`:return D(e);case`object`:if(t(e))return M(e)}throw Error(`Cannot convert value to sql literal.`)}let i=P(n?.timeZone,r?.timeZone),a=E(n?.type);switch(E(r?.type)??a){case`small-integer`:case`esriFieldTypeSmallInteger`:case`integer`:case`esriFieldTypeInteger`:case`single`:case`esriFieldTypeSingle`:case`double`:case`esriFieldTypeDouble`:case`big-integer`:case`esriFieldTypeBigInteger`:case`long`:case`esriFieldTypeLong`:case`oid`:case`esriFieldTypeOID`:return O(e,a);case`global-id`:case`esriFieldTypeGlobalID`:case`guid`:case`esriFieldTypeGUID`:case`xml`:case`esriFieldTypeXML`:case`string`:case`esriFieldTypeString`:return k(e,a,i);case`date`:case`esriFieldTypeDate`:return M(e,a,i);case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return N(e,a,i);case`date-only`:case`esriFieldTypeDateOnly`:return A(e,a,i);case`time-only`:case`esriFieldTypeTimeOnly`:return j(e,a,i);default:throw Error(`Unsupported sql target type: `+a)}}function I(e){return/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(e)?e:`"${e.replaceAll(`"`,`""`)}"`}export{s as cleanupWhereClauseCache,c as parseWhereClause,l as sqlAnd,u as sqlBetween,D as sqlBooleanLiteral,A as sqlDateLiteral,p as sqlIn,F as sqlLiteral,I as sqlName,d as sqlNotBetween,m as sqlNotIn,O as sqlNumericLiteral,f as sqlOr,k as sqlStringLiteral,j as sqlTimeLiteral,M as sqlTimestampLiteral,N as sqlTimestampOffsetLiteral};
2
+ import{isUnknownTimeZone as e}from"./sql/UnknownTimeZone.js";import{isDate as t}from"../support/guards.js";import{getLuxonTimeZone as n}from"../time/timeZoneUtils.js";import{FixedOffsetZone as r,DateTime as i}from"luxon";let a;async function o(){return a??=import(`./sql/WhereClauseCache.js`).then(e=>new e.WhereClauseCache(500,500)),a}function s(){a=null}async function c(e,t){let n=await o(),r=n.get(e,t);if(r==null)throw n.getError(e,t);return r}function l(e,t){return e||=null,t||=null,e===`1=1`?t??e:t===`1=1`?e??t:e&&t?`(${e}) AND (${t})`:e??t}function u(e,t,n){return`${e} BETWEEN ${t} AND ${n}`}function d(e,t,n){return`${e} NOT BETWEEN ${t} AND ${n}`}function f(e,t){return e||=null,t||=null,e===`1=1`||t===`1=1`||e===t?e===`1=1`?e:t:e&&t?`(${e}) OR (${t})`:e??t}function p(e,t){return t.length===0?null:`${e} IN (${h(t)})`}function m(e,t){return t.length===0?null:`${e} NOT IN (${h(t)})`}function h(e){return e.map(e=>typeof e==`string`?g(e):e).join(`,`)}function g(e,t){return e==null?`NULL`:`${t??``}'${e.replaceAll(`'`,`''`)}'`}function _(e){return Number.isFinite(e)?String(e):`NULL`}function v(e){let[t,n]=e.split(`T`,2);return`${t} ${n.replace(`Z`,`+00:00`).replace(/[+-]/,e=>` ${e}`)}`}function y(e){return e.split(`T`,1)[0]}function b(e){let t=e.indexOf(`T`)+1,n=Math.max(e.indexOf(`-`,t),e.indexOf(`+`,t),e.indexOf(`Z`,t));return e.slice(t,n>0?n:void 0)}function x(e,t){let a=t==null?r.utcInstance:n(t),o=i.fromMillis(e,{zone:a});return o.isValid?o:null}function S(e,t){return x(e,t)?.toSQL({includeOffset:!1})}function C(e,t){return x(e,t)?.toSQL({includeOffset:!0})?.replace(`Z`,`+00:00`)}function w(e,t){return x(e,t)?.toSQLDate()}function T(e,t){return x(e,t)?.toSQLTime({includeOffset:!1})}function E(e){return typeof e==`string`?e:e?.type}function D(e){return e==null?`NULL`:e?`TRUE`:`FALSE`}function O(e,t){if(e==null)return`NULL`;let n=E(t);switch(typeof e){case`string`:switch(n){case`string`:case`esriFieldTypeString`:case void 0:return _(Number(e));default:throw Error(`Cannot convert ${n} to sql numeric literal.`)}case`boolean`:return e?`1`:`0`;case`number`:switch(n){case`small-integer`:case`esriFieldTypeSmallInteger`:case`integer`:case`esriFieldTypeInteger`:case`single`:case`esriFieldTypeSingle`:case`double`:case`esriFieldTypeDouble`:case`big-integer`:case`esriFieldTypeBigInteger`:case`long`:case`esriFieldTypeLong`:case`oid`:case`esriFieldTypeOID`:case void 0:return _(e);default:throw Error(`Cannot convert ${n} to sql numeric literal.`)}}throw Error(`Cannot convert value to sql numeric literal.`)}function k(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(v(e));case`date-only`:case`esriFieldTypeDateOnly`:case`time-only`:case`esriFieldTypeTimeOnly`:case`string`:case`esriFieldTypeString`:case`global-id`:case`esriFieldTypeGlobalID`:case`guid`:case`esriFieldTypeGUID`:case`xml`:case`esriFieldTypeXML`:case void 0:return g(e);default:throw Error(`Cannot convert ${i} to sql string literal.`)}case`boolean`:return e?`'true'`:`'false'`;case`number`:switch(i){case`date`:case`esriFieldTypeDate`:return g(S(e,r));case`small-integer`:case`esriFieldTypeSmallInteger`:case`integer`:case`esriFieldTypeInteger`:case`single`:case`esriFieldTypeSingle`:case`double`:case`esriFieldTypeDouble`:case`big-integer`:case`esriFieldTypeBigInteger`:case`long`:case`esriFieldTypeLong`:case`oid`:case`esriFieldTypeOID`:case void 0:return Number.isFinite(e)?`'${e}'`:`NULL`;default:throw Error(`Cannot convert ${i} to sql string literal.`)}case`object`:if(t(e))return g(S(e.valueOf(),r))}throw Error(`Cannot convert value to sql string literal.`)}function A(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(y(e),`DATE`);case`date-only`:case`esriFieldTypeDateOnly`:case`string`:case`esriFieldTypeString`:case void 0:return g(e,`DATE`);default:throw Error(`Cannot convert ${i} to sql date literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(w(e,r),`DATE`);default:throw Error(`Cannot convert ${i} to sql date literal.`)}case`object`:if(t(e))return g(w(e.valueOf(),r),`DATE`)}throw Error(`Cannot convert value to sql date literal.`)}function j(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(b(e),`TIME`);case`time-only`:case`esriFieldTypeTimeOnly`:case`string`:case`esriFieldTypeString`:case void 0:return g(e,`TIME`);default:throw Error(`Cannot convert ${i} to sql time literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(T(e,r),`TIME`);default:throw Error(`Cannot convert ${i} to sql time literal.`)}case`object`:if(t(e))return g(T(e.valueOf(),r),`TIME`)}throw Error(`Cannot convert value to sql time literal.`)}function M(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(v(e),`TIMESTAMP`);case`date-only`:case`esriFieldTypeDateOnly`:return g(`${e} 00:00:00`,`TIMESTAMP`);case`string`:case`esriFieldTypeString`:case void 0:return g(e,`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(S(e,r),`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp literal.`)}case`object`:if(t(e))return g(S(e.valueOf(),r),`TIMESTAMP`)}throw Error(`Cannot convert value to sql timestamp literal.`)}function N(e,n,r){if(e==null)return`NULL`;let i=E(n);switch(typeof e){case`string`:switch(i){case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return g(v(e),`TIMESTAMP`);case`string`:case`esriFieldTypeString`:case void 0:return g(e,`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp offset literal.`)}case`number`:switch(i){case`date`:case`esriFieldTypeDate`:case void 0:return g(C(e,r),`TIMESTAMP`);default:throw Error(`Cannot convert ${i} to sql timestamp offset literal.`)}case`object`:if(t(e))return g(C(e.valueOf(),r),`TIMESTAMP`)}throw Error(`Cannot convert value to sql timestamp offset literal.`)}function P(t,n){return t==null?n:n==null||e(t)||e(n)?t:n}function F(e,n,r){if(e==null)return`NULL`;if(n==null&&r==null){switch(typeof e){case`string`:return k(e);case`number`:return O(e);case`boolean`:return D(e);case`object`:if(t(e))return M(e)}throw Error(`Cannot convert value to sql literal.`)}let i=P(n?.timeZone,r?.timeZone),a=E(n?.type);switch(E(r?.type)??a){case`small-integer`:case`esriFieldTypeSmallInteger`:case`integer`:case`esriFieldTypeInteger`:case`single`:case`esriFieldTypeSingle`:case`double`:case`esriFieldTypeDouble`:case`big-integer`:case`esriFieldTypeBigInteger`:case`long`:case`esriFieldTypeLong`:case`oid`:case`esriFieldTypeOID`:return O(e,a);case`global-id`:case`esriFieldTypeGlobalID`:case`guid`:case`esriFieldTypeGUID`:case`xml`:case`esriFieldTypeXML`:case`string`:case`esriFieldTypeString`:return k(e,a,i);case`date`:case`esriFieldTypeDate`:return M(e,a,i);case`timestamp-offset`:case`esriFieldTypeTimestampOffset`:return N(e,a,i);case`date-only`:case`esriFieldTypeDateOnly`:return A(e,a,i);case`time-only`:case`esriFieldTypeTimeOnly`:return j(e,a,i);default:throw Error(`Unsupported sql target type: `+a)}}function I(e){return/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(e)?e:`"${e.replaceAll(`"`,`""`)}"`}export{s as cleanupWhereClauseCache,c as parseWhereClause,l as sqlAnd,u as sqlBetween,D as sqlBooleanLiteral,A as sqlDateLiteral,p as sqlIn,F as sqlLiteral,I as sqlName,d as sqlNotBetween,m as sqlNotIn,O as sqlNumericLiteral,f as sqlOr,k as sqlStringLiteral,j as sqlTimeLiteral,M as sqlTimestampLiteral,N as sqlTimestampOffsetLiteral};
package/core/urlUtils.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../config.js";import{isSome as t}from"./arrayUtils.js";import n from"./Error.js";import r from"./Logger.js";import{isSerializable as i}from"./support/jsonUtils.js";import{parseKnownArcGISOnlineDomain as a}from"../portal/support/urlUtils.js";import{base64ToArrayBuffer as o,arrayBufferToBase64 as s}from"../support/base64Utils.js";const c=()=>r.getLogger(`esri.core.urlUtils`),l=e.request,u=`esri/config: esriConfig.request.proxyUrl is not set.`,d=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,f=/^\s*http:/i,p=/^\s*https:/i,ee=/^\s*file:/i,m=/:\d+$/,te=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,ne=RegExp(`^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$`),re=RegExp(`^((([^[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^[:]*))(:([0-9]+))?$`);class h{constructor(e=``){this.uri=e,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let t=this.uri.match(ne);this.scheme=t[2]||(t[1]?``:null),this.authority=t[4]||(t[3]?``:null),this.path=t[5],this.query=t[7]||(t[6]?``:null),this.fragment=t[9]||(t[8]?``:null),this.authority!=null&&(t=this.authority.match(re),this.user=t[3]||null,this.password=t[4]||null,this.host=t[6]||t[7],this.port=t[9]||null)}toString(){return this.uri}}const g={},_=new h(e.applicationUrl);let v=_;const y=oe();let b=y;const ie=()=>v,ae=()=>b;function oe(){let e=v.path,t=e.slice(0,e.lastIndexOf(`/`)+1);return`${`${v.scheme}://${v.host}${v.port==null?``:`:${v.port}`}`}${t}`}const se={setAppUrl:e=>v=e,setAppBaseUrl:e=>b=e,restoreUrls:()=>{v=_,b=y}};function x(e){if(!e)return null;let t={path:null,query:null},n=new h(e),r=e.indexOf(`?`);return n.query===null?t.path=e:(t.path=e.slice(0,r),t.query=S(n.query)),n.fragment&&(t.hash=n.fragment,n.query===null&&(t.path=t.path.slice(0,t.path.length-(n.fragment.length+1)))),t}function S(e){let t=e.split(`&`),n={};for(let e of t){if(!e)continue;let t=e.indexOf(`=`),r,i;t<0?(r=decodeURIComponent(e),i=``):(r=decodeURIComponent(e.slice(0,t)),i=decodeURIComponent(e.slice(t+1)));let a=n[r];typeof a==`string`&&(a=n[r]=[a]),Array.isArray(a)?a.push(i):n[r]=i}return n}function C(e,t){return e?t&&typeof t==`function`?Object.keys(e).map(n=>encodeURIComponent(n)+`=`+encodeURIComponent(t(n,e[n]))).join(`&`):Object.keys(e).map(n=>{let r=e[n];if(r==null)return``;let a=encodeURIComponent(n)+`=`,o=t?.[n];return o?a+encodeURIComponent(o(r)):Array.isArray(r)?r.map(e=>i(e)?a+encodeURIComponent(JSON.stringify(e)):a+encodeURIComponent(e)).join(`&`):i(r)?a+encodeURIComponent(JSON.stringify(r)):a+encodeURIComponent(r)}).filter(e=>e).join(`&`):``}function w(e=!1){let t,r=l.proxyUrl;if(typeof e==`string`){t=K(e);let n=O(e);n&&(r=n.proxyUrl)}else t=!!e;if(!r)throw c().warn(u),new n(`urlUtils:proxy-not-set`,u);return t&&Y()&&(r=J(r)),x(r)}function ce(e,t=!1){let n=O(e),r,i;if(n){let e=E(n.proxyUrl);r=e.path,i=e.query?S(e.query):null}else if(t){let t=w(e);r=t.path,i=t.query}if(r){let t=x(e);e=r+`?`+t.path;let n=C({...i,...t.query});n&&(e=`${e}?${n}`)}return e}const T={path:``,query:``};function E(e){let t=e.indexOf(`?`);return t===-1?(T.path=e,T.query=null):(T.path=e.slice(0,t),T.query=e.slice(t+1)),T}function D(e){return e=E(e).path,e=Z(e),e=X(e,!0),e=e.toLowerCase(),e}function le(e){let t={proxyUrl:e.proxyUrl,urlPrefix:D(e.urlPrefix)},n=l.proxyRules,r=t.urlPrefix,i=n.length;for(let e=0;e<n.length;e++){let t=n[e].urlPrefix;if(r.startsWith(t)){if(r.length===t.length)return-1;i=e;break}t.startsWith(r)&&(i=e+1)}return n.splice(i,0,t),i}function O(e){let t=l.proxyRules,n=D(e);for(let e=0;e<t.length;e++)if(n.startsWith(t[e].urlPrefix))return t[e]}function k(e,t){if(!e||!t)return!1;e=A(e),t=A(t);let n=a(e),r=a(t);return n!=null&&r!=null?n.portalHostname===r.portalHostname:n!=null||r!=null?!1:M(e,t,!0)}function ue(e,t){if(!e||!t)return!1;e=A(e),t=A(t);let n=a(e),r=a(t);return n!=null&&r!=null&&n.portalHostname===r.portalHostname}function de(e,t){return e=A(e),t=A(t),X(e)===X(t)}function A(e){e=P(e);let t=e.indexOf(`/sharing`);return t>0?e.slice(0,t):e.replace(/\/+$/,``)}function j(e,t=l.interceptors){let n=t=>t instanceof RegExp?t.test(e):typeof t==`string`?e.startsWith(t):t==null;if(t){for(let e of t)if(Array.isArray(e.urls)){if(e.urls.some(n))return e}else if(n(e.urls))return e}return null}function M(e,t,n=!1){if(!e||!t)return!1;let r=Q(e),i=Q(t);return!n&&r.scheme!==i.scheme||r.host==null||i.host==null?!1:r.host.toLowerCase()===i.host.toLowerCase()&&r.port===i.port}function fe(e){if(typeof e==`string`){if(L(e))e=Q(e);else return!0}if(M(e,v))return!0;let t=l.trustedServers||[];for(let n=0;n<t.length;n++){let r=t[n],i=pe(r);for(let t=0;t<i.length;t++)if(M(e,i[t]))return!0}return!1}function pe(e){return g[e]||(!G(e)&&!W(e)?g[e]=[new h(`http://${e}`),new h(`https://${e}`)]:g[e]=[new h(N(e))]),g[e]}function N(e,t=b,n){return W(e)?n?.preserveProtocolRelative?e:v.scheme===`http`&&v.authority===I(e).slice(2)?`http:${e}`:`https:${e}`:G(e)?e:F(e.startsWith(`/`)?Te(t):t,e)}function me(e,t=b,n){if(e==null||!L(e))return e;let r=P(e),i=r.toLowerCase(),a=P(t).toLowerCase().replace(/\/+$/,``),o=n?P(n).toLowerCase().replace(/\/+$/,``):null;if(o&&!a.startsWith(o))return e;let s=(e,t,n)=>(n=e.indexOf(t,n),n===-1?e.length:n),c=s(i,`/`,i.indexOf(`//`)+2),l=-1;for(;i.slice(0,c+1)===a.slice(0,c)+`/`&&(l=c+1,c!==i.length);)c=s(i,`/`,c+1);if(l===-1||o&&l<o.length)return e;e=r.slice(l);let u=a.slice(l-1).replaceAll(/[^/]+/g,``).length;if(u>0)for(let t=0;t<u;t++)e=`../${e}`;else e=`./${e}`;return e}function P(e){return e=e.trim(),e=N(e),e=ke(e),e=Ae(e),e=je(e),e}function F(...e){let n=e.filter(t);if(!n?.length)return;let r=[];if(L(n[0])){let e=n[0],t=e.indexOf(`//`);t!==-1&&(r.push(e.slice(0,t+1)),q(n[0])&&(r[0]+=`/`),n[0]=e.slice(t+2))}else n[0].startsWith(`/`)&&r.push(``);let i=n.reduce((e,t)=>t?e.concat(t.split(`/`)):e,[]);for(let e=0;e<i.length;e++){let t=i[e];t===`..`&&r.length>0&&r[r.length-1]!==`..`?r.pop():(!t&&e===i.length-1||t&&(t!==`.`||r.length===0))&&r.push(t)}return r.join(`/`)}function I(e,t=!1){if(e==null||R(e)||z(e))return null;let n=e.indexOf(`://`);if(n===-1&&W(e))n=2;else if(n!==-1)n+=3;else return null;let r=e.indexOf(`/`,n);return r!==-1&&(e=e.slice(0,r)),t&&(e=X(e,!0)),e}function L(e){return W(e)||G(e)}function R(e){return e!=null&&e.startsWith(`blob:`)}function z(e){return e!=null&&e.startsWith(`data:`)}function B(e){let t=V(e);return t?.isBase64?o(t.data):null}function he(e){return s(e).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}const ge=/^data:(.*?)(;base64)?,(.*)$/;function V(e){let t=e.match(ge);if(!t)return null;let[,n,r,i]=t;return{mediaType:n,isBase64:!!r,data:i}}function _e(e){return e.isBase64?`data:${e.mediaType};base64,${e.data}`:`data:${e.mediaType},${e.data}`}async function ve(e){return(await fetch(e)).blob()}function H(e){let t=B(e);if(!t)return null;let n=V(e);return new Blob([t],{type:n.mediaType})}function ye(e,t){xe(e,t)}function be(e,t){U(e,t)}function xe(e,t){let n=H(e);return n?U(n,t):!1}function U(e,t){if(!e)return!1;let n=document.createElement(`a`);if(!(`download`in n))return!1;let r=URL.createObjectURL(e);return n.download=t,n.href=r,n.style.display=`none`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r),!0}function W(e){return e!=null&&e.startsWith(`/`)&&e[1]===`/`}function G(e){return e!=null&&d.test(e)}function K(e){return e!=null&&p.test(e)||v.scheme===`https`&&W(e)}function Se(e){return e!=null&&f.test(e)||v.scheme===`http`&&W(e)}function q(e){return e!=null&&ee.test(e)}function Ce(e){return W(e)?`http:${e}`:e.replace(p,`http:`)}function J(e){return W(e)?`https:${e}`:e.replace(f,`https:`)}function we(){return v.scheme===`http`}function Y(){return v.scheme===`https`}function X(e,t=!1){return W(e)?e.slice(2):(e=e.replace(d,``),t&&e.length>1&&e.startsWith(`/`)&&e[1]===`/`&&(e=e.slice(2)),e)}function Te(e){let t=e.indexOf(`//`),n=e.indexOf(`/`,t+2);return n===-1?e:e.slice(0,n)}function Ee(e){let t=0;if(L(e)){let n=e.indexOf(`//`);n!==-1&&(t=n+2)}let n=e.lastIndexOf(`/`);return n<t?e:e.slice(0,n+1)}function De(e,t){if(!e)return``;let n=x(e).path.replace(/\/+$/,``),r=n.slice(n.lastIndexOf(`/`)+1);if(!t?.length)return r;let i=RegExp(`\\.(${t.join(`|`)})$`,`i`);return r.replace(i,``)}function Z(e){return e.endsWith(`/`)?e:`${e}/`}function Oe(e){return e.replace(/\/+$/,``)}function ke(e){if(/^https?:\/\//i.test(e)){let t=E(e);e=t.path.replaceAll(/\/{2,}/g,`/`),e=e.replace(`/`,`//`),t.query&&(e+=`?${t.query}`)}return e}function Ae(e){return e.replace(/^(https?:\/\/)(arcgis\.com)/i,`$1www.$2`)}function je(e){let t=l.httpsDomains;if(!Se(e))return e;let n=e.indexOf(`/`,7),r;if(r=n===-1?e:e.slice(0,n),r=r.toLowerCase().slice(7),m.test(r)){if(r.endsWith(`:80`))r=r.slice(0,-3),e=e.replace(`:80`,``);else return e}return we()&&r===v.authority&&!te.test(e)||(Y()&&r===v.authority||t&&t.some(e=>r===e||r.endsWith(`.${e}`))||Y()&&!O(e))&&(e=J(e)),e}function Me(e,t,n){if(!t||!n||!e||!L(e))return e;let r=e.indexOf(`//`),i=e.indexOf(`/`,r+2),a=e.indexOf(`:`,r+2),o=Math.min(i<0?e.length:i,a<0?e.length:a);return e.slice(r+2,o).toLowerCase()===t.toLowerCase()?`${e.slice(0,r+2)}${n}${e.slice(o)}`:e}function Ne(e,t){let n=new URL(e);return n.host=t,n.port&&!m.test(t)&&(n.port=``),n.toString()}function Pe(e){return new URL(e).host}function Q(e){return typeof e==`string`?new h(N(e)):(e.scheme||=v.scheme,e)}function Fe(e){return Ue.test(e)}function Ie(e,t){let n=x(e),r=Object.keys(n.query||{});return r.length>0&&t&&t.warn(`removeQueryParameters()`,`Url query parameters are not supported, the following parameters have been removed: ${r.join(`, `)}.`),n.path}function Le(e,t,n){let r=x(e),i=r.query||{};return i[t]=String(n),`${r.path}?${C(i)}`}function Re(e,t){if(!t)return e;let n=x(e),r=n.query||{};for(let[e,n]of Object.entries(t))n!=null&&(r[e]=n);let i=C(r);return i?`${n.path}?${i}`:n.path}function ze(e,t){let{path:n,query:r}=x(e);if(!r)return e;delete r[t];let i=C(r);return i?`${n}?${i}`:n}function Be(e){if(e==null)return null;let t=e.match($);return t?t[2]:null}function Ve(e){if(e==null)return null;let t=e.match($);return t?{path:t[1],extension:t[2]}:{path:e,extension:null}}async function He(e){return typeof e==`string`?V(e)??{data:e}:new Promise((t,n)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(V(r.result)),r.onerror=e=>n(e)})}const $=/([^.]*)\.([^/]*)$/,Ue=/(^data:image\/svg|\.svg$)/i;export{h as Url,ce as addProxy,le as addProxyRule,Le as addQueryParameter,Re as addQueryParameters,he as base64UrlEncode,ve as blobUrlToBlob,Me as changeDomain,Ne as changeHost,V as dataComponents,B as dataToArrayBuffer,H as dataToBlob,be as downloadBlobAsFile,ye as downloadDataAsFile,Z as ensureTrailingSlash,ae as getAppBaseUrl,ie as getAppUrl,De as getFilename,Pe as getHost,j as getInterceptor,I as getOrigin,Be as getPathExtension,O as getProxyRule,w as getProxyUrl,G as hasProtocol,ue as hasSameCanonicalArcGISOnlinePortal,k as hasSameCanonicalPortal,M as hasSameOrigin,de as hasSamePortal,L as isAbsolute,Y as isAppHTTPS,R as isBlobProtocol,z as isDataProtocol,K as isHTTPSProtocol,W as isProtocolRelative,Fe as isSVG,fe as isTrustedServer,F as join,N as makeAbsolute,_e as makeData,me as makeRelative,P as normalize,C as objectToQuery,He as parseData,S as queryToObject,Ee as removeFile,ze as removeQueryParameter,Ie as removeQueryParameters,Oe as removeTrailingSlash,Ve as splitPathExtension,se as test,Ce as toHTTP,J as toHTTPS,g as trustedServersUrlCache,x as urlToObject};
2
+ import e from"../config.js";import{isSome as t}from"./arrayUtils.js";import n from"./Error.js";import r from"./Logger.js";import{isSerializable as i}from"./support/jsonUtils.js";import{parseKnownArcGISOnlineDomain as a}from"../portal/support/urlUtils.js";import{base64ToArrayBuffer as o,arrayBufferToBase64 as s}from"../support/base64Utils.js";const c=()=>r.getLogger(`esri.core.urlUtils`),l=e.request,u=`esri/config: esriConfig.request.proxyUrl is not set.`,d=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,f=/^\s*http:/i,p=/^\s*https:/i,ee=/^\s*file:/i,m=/:\d+$/,te=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,ne=RegExp(`^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$`),re=RegExp(`^((([^[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^[:]*))(:([0-9]+))?$`);class h{constructor(e=``){this.uri=e,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let t=this.uri.match(ne);this.scheme=t[2]||(t[1]?``:null),this.authority=t[4]||(t[3]?``:null),this.path=t[5],this.query=t[7]||(t[6]?``:null),this.fragment=t[9]||(t[8]?``:null),this.authority!=null&&(t=this.authority.match(re),this.user=t[3]||null,this.password=t[4]||null,this.host=t[6]||t[7],this.port=t[9]||null)}toString(){return this.uri}}const g={},_=new h(e.applicationUrl);let v=_;const y=oe();let b=y;const ie=()=>v,ae=()=>b;function oe(){let e=v.path,t=e.slice(0,e.lastIndexOf(`/`)+1);return`${`${v.scheme}://${v.host}${v.port==null?``:`:${v.port}`}`}${t}`}const se={setAppUrl:e=>v=e,setAppBaseUrl:e=>b=e,restoreUrls:()=>{v=_,b=y}};function x(e){if(!e)return null;let t={path:null,query:null},n=new h(e),r=e.indexOf(`?`);return n.query===null?t.path=e:(t.path=e.slice(0,r),t.query=S(n.query)),n.fragment&&(t.hash=n.fragment,n.query===null&&(t.path=t.path.slice(0,t.path.length-(n.fragment.length+1)))),t}function S(e){let t=e.split(`&`),n={};for(let e of t){if(!e)continue;let t=e.indexOf(`=`),r,i;t<0?(r=decodeURIComponent(e),i=``):(r=decodeURIComponent(e.slice(0,t)),i=decodeURIComponent(e.slice(t+1)));let a=n[r];typeof a==`string`&&(a=n[r]=[a]),Array.isArray(a)?a.push(i):n[r]=i}return n}function C(e,t){return e?t&&typeof t==`function`?Object.keys(e).map(n=>encodeURIComponent(n)+`=`+encodeURIComponent(t(n,e[n]))).join(`&`):Object.keys(e).map(n=>{let r=e[n];if(r==null)return``;let a=encodeURIComponent(n)+`=`,o=t?.[n];return o?a+encodeURIComponent(o(r)):Array.isArray(r)?r.map(e=>i(e)?a+encodeURIComponent(JSON.stringify(e)):a+encodeURIComponent(e)).join(`&`):i(r)?a+encodeURIComponent(JSON.stringify(r)):a+encodeURIComponent(r)}).filter(e=>e).join(`&`):``}function w(e=!1){let t,r=l.proxyUrl;if(typeof e==`string`){t=K(e);let n=O(e);n&&(r=n.proxyUrl)}else t=!!e;if(!r)throw c().warn(u),new n(`urlUtils:proxy-not-set`,u);return t&&Y()&&(r=J(r)),x(r)}function ce(e,t=!1){let n=O(e),r,i;if(n){let e=E(n.proxyUrl);r=e.path,i=e.query?S(e.query):null}else if(t){let t=w(e);r=t.path,i=t.query}if(r){let t=x(e);e=r+`?`+t.path;let n=C({...i,...t.query});n&&(e=`${e}?${n}`)}return e}const T={path:``,query:``};function E(e){let t=e.indexOf(`?`);return t===-1?(T.path=e,T.query=null):(T.path=e.slice(0,t),T.query=e.slice(t+1)),T}function D(e){return e=E(e).path,e=Z(e),e=X(e,!0),e=e.toLowerCase(),e}function le(e){let t={proxyUrl:e.proxyUrl,urlPrefix:D(e.urlPrefix)},n=l.proxyRules,r=t.urlPrefix,i=n.length;for(let e=0;e<n.length;e++){let t=n[e].urlPrefix;if(r.startsWith(t)){if(r.length===t.length)return-1;i=e;break}t.startsWith(r)&&(i=e+1)}return n.splice(i,0,t),i}function O(e){let t=l.proxyRules,n=D(e);for(let e=0;e<t.length;e++)if(n.startsWith(t[e].urlPrefix))return t[e]}function k(e,t){if(!e||!t)return!1;e=A(e),t=A(t);let n=a(e),r=a(t);return n!=null&&r!=null?n.portalHostname===r.portalHostname:n!=null||r!=null?!1:M(e,t,!0)}function ue(e,t){if(!e||!t)return!1;e=A(e),t=A(t);let n=a(e),r=a(t);return n!=null&&r!=null&&n.portalHostname===r.portalHostname}function de(e,t){return e=A(e),t=A(t),X(e)===X(t)}function A(e){e=P(e);let t=e.indexOf(`/sharing`);return t>0?e.slice(0,t):e.replace(/\/+$/,``)}function j(e,t=l.interceptors){let n=t=>t instanceof RegExp?t.test(e):typeof t==`string`?e.startsWith(t):t==null;if(t){for(let e of t)if(Array.isArray(e.urls)){if(e.urls.some(n))return e}else if(n(e.urls))return e}return null}function M(e,t,n=!1){if(!e||!t)return!1;let r=Q(e),i=Q(t);return!n&&r.scheme!==i.scheme||r.host==null||i.host==null?!1:r.host.toLowerCase()===i.host.toLowerCase()&&r.port===i.port}function fe(e){if(typeof e==`string`){if(L(e))e=Q(e);else return!0}if(M(e,v))return!0;let t=l.trustedServers||[];for(let n=0;n<t.length;n++){let r=t[n],i=pe(r);for(let t=0;t<i.length;t++)if(M(e,i[t]))return!0}return!1}function pe(e){return g[e]||(!G(e)&&!W(e)?g[e]=[new h(`http://${e}`),new h(`https://${e}`)]:g[e]=[new h(N(e))]),g[e]}function N(e,t=b,n){return W(e)?n?.preserveProtocolRelative?e:v.scheme===`http`&&v.authority===I(e).slice(2)?`http:${e}`:`https:${e}`:G(e)?e:F(e.startsWith(`/`)?Te(t):t,e)}function me(e,t=b,n){if(e==null||!L(e))return e;let r=P(e),i=r.toLowerCase(),a=P(t).toLowerCase().replace(/\/+$/,``),o=n?P(n).toLowerCase().replace(/\/+$/,``):null;if(o&&!a.startsWith(o))return e;let s=(e,t,n)=>(n=e.indexOf(t,n),n===-1?e.length:n),c=s(i,`/`,i.indexOf(`//`)+2),l=-1;for(;i.slice(0,c+1)===a.slice(0,c)+`/`&&(l=c+1,c!==i.length);)c=s(i,`/`,c+1);if(l===-1||o&&l<o.length)return e;e=r.slice(l);let u=a.slice(l-1).replaceAll(/[^/]+/g,``).length;if(u>0)for(let t=0;t<u;t++)e=`../${e}`;else e=`./${e}`;return e}function P(e){return e=e.trim(),e=N(e),e=ke(e),e=Ae(e),e=je(e),e}function F(...e){let n=e.filter(t);if(!n?.length)return;let r=[];if(L(n[0])){let e=n[0],t=e.indexOf(`//`);t!==-1&&(r.push(e.slice(0,t+1)),q(n[0])&&(r[0]+=`/`),n[0]=e.slice(t+2))}else n[0].startsWith(`/`)&&r.push(``);let i=n.reduce((e,t)=>t?e.concat(t.split(`/`)):e,[]);for(let e=0;e<i.length;e++){let t=i[e];t===`..`&&r.length>0&&r[r.length-1]!==`..`?r.pop():(!t&&e===i.length-1||t&&(t!==`.`||r.length===0))&&r.push(t)}return r.join(`/`)}function I(e,t=!1){if(e==null||R(e)||z(e))return null;let n=e.indexOf(`://`);if(n===-1&&W(e))n=2;else if(n!==-1)n+=3;else return null;let r=e.indexOf(`/`,n);return r!==-1&&(e=e.slice(0,r)),t&&(e=X(e,!0)),e}function L(e){return W(e)||G(e)}function R(e){return e!=null&&e.startsWith(`blob:`)}function z(e){return e!=null&&e.startsWith(`data:`)}function B(e){let t=V(e);return t?.isBase64?o(t.data):null}function he(e){return s(e).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}const ge=/^data:(.*?)(;base64)?,(.*)$/;function V(e){let t=e.match(ge);if(!t)return null;let[,n,r,i]=t;return{mediaType:n,isBase64:!!r,data:i}}function _e(e){return e.isBase64?`data:${e.mediaType};base64,${e.data}`:`data:${e.mediaType},${e.data}`}async function ve(e){return(await fetch(e)).blob()}function H(e){let t=B(e);if(!t)return null;let n=V(e);return new Blob([t],{type:n.mediaType})}function ye(e,t){xe(e,t)}function be(e,t){U(e,t)}function xe(e,t){let n=H(e);return n?U(n,t):!1}function U(e,t){if(!e)return!1;let n=document.createElement(`a`);if(!(`download`in n))return!1;let r=URL.createObjectURL(e);return n.download=t,n.href=r,n.style.display=`none`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r),!0}function W(e){return e!=null&&e.startsWith(`/`)&&e[1]===`/`}function G(e){return e!=null&&d.test(e)}function K(e){return e!=null&&p.test(e)||v.scheme===`https`&&W(e)}function Se(e){return e!=null&&f.test(e)||v.scheme===`http`&&W(e)}function q(e){return e!=null&&ee.test(e)}function Ce(e){return W(e)?`http:${e}`:e.replace(p,`http:`)}function J(e){return W(e)?`https:${e}`:e.replace(f,`https:`)}function we(){return v.scheme===`http`}function Y(){return v.scheme===`https`}function X(e,t=!1){return W(e)?e.slice(2):(e=e.replace(d,``),t&&e.length>1&&e.startsWith(`/`)&&e[1]===`/`&&(e=e.slice(2)),e)}function Te(e){let t=e.indexOf(`//`),n=e.indexOf(`/`,t+2);return n===-1?e:e.slice(0,n)}function Ee(e){let t=0;if(L(e)){let n=e.indexOf(`//`);n!==-1&&(t=n+2)}let n=e.lastIndexOf(`/`);return n<t?e:e.slice(0,n+1)}function De(e,t){if(!e)return``;let n=x(e).path.replace(/\/+$/,``),r=n.slice(n.lastIndexOf(`/`)+1);if(!t?.length)return r;let i=RegExp(`\\.(${t.join(`|`)})$`,`i`);return r.replace(i,``)}function Z(e){return e.endsWith(`/`)?e:`${e}/`}function Oe(e){return e.replace(/\/+$/,``)}function ke(e){if(/^https?:\/\//i.test(e)){let t=E(e);e=t.path.replaceAll(/\/{2,}/g,`/`),e=e.replace(`/`,`//`),t.query&&(e+=`?${t.query}`)}return e}function Ae(e){return e.replace(/^(https?:\/\/)(arcgis\.com)/i,`$1www.$2`)}function je(e){let t=l.httpsDomains;if(!Se(e))return e;let n=e.indexOf(`/`,7),r;if(r=n===-1?e:e.slice(0,n),r=r.toLowerCase().slice(7),m.test(r)){if(r.endsWith(`:80`))r=r.slice(0,-3),e=e.replace(`:80`,``);else return e}return we()&&r===v.authority&&!te.test(e)||(Y()&&r===v.authority||t&&t.some(e=>r===e||r.endsWith(`.${e}`))||Y()&&!O(e))&&(e=J(e)),e}function Me(e,t,n){if(!t||!n||!e||!L(e))return e;let r=e.indexOf(`//`),i=e.indexOf(`/`,r+2),a=e.indexOf(`:`,r+2),o=Math.min(i<0?e.length:i,a<0?e.length:a);return e.slice(r+2,o).toLowerCase()===t.toLowerCase()?`${e.slice(0,r+2)}${n}${e.slice(o)}`:e}function Ne(e,t){let n=new URL(e);return n.host=t,n.port&&!m.test(t)&&(n.port=``),n.href}function Pe(e){return new URL(e).host}function Q(e){return typeof e==`string`?new h(N(e)):(e.scheme||=v.scheme,e)}function Fe(e){return Ue.test(e)}function Ie(e,t){let n=x(e),r=Object.keys(n.query||{});return r.length>0&&t&&t.warn(`removeQueryParameters()`,`Url query parameters are not supported, the following parameters have been removed: ${r.join(`, `)}.`),n.path}function Le(e,t,n){let r=x(e),i=r.query||{};return i[t]=String(n),`${r.path}?${C(i)}`}function Re(e,t){if(!t)return e;let n=x(e),r=n.query||{};for(let[e,n]of Object.entries(t))n!=null&&(r[e]=n);let i=C(r);return i?`${n.path}?${i}`:n.path}function ze(e,t){let{path:n,query:r}=x(e);if(!r)return e;delete r[t];let i=C(r);return i?`${n}?${i}`:n}function Be(e){if(e==null)return null;let t=e.match($);return t?t[2]:null}function Ve(e){if(e==null)return null;let t=e.match($);return t?{path:t[1],extension:t[2]}:{path:e,extension:null}}async function He(e){return typeof e==`string`?V(e)??{data:e}:new Promise((t,n)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(V(r.result)),r.onerror=e=>n(e)})}const $=/([^.]*)\.([^/]*)$/,Ue=/(^data:image\/svg|\.svg$)/i;export{h as Url,ce as addProxy,le as addProxyRule,Le as addQueryParameter,Re as addQueryParameters,he as base64UrlEncode,ve as blobUrlToBlob,Me as changeDomain,Ne as changeHost,V as dataComponents,B as dataToArrayBuffer,H as dataToBlob,be as downloadBlobAsFile,ye as downloadDataAsFile,Z as ensureTrailingSlash,ae as getAppBaseUrl,ie as getAppUrl,De as getFilename,Pe as getHost,j as getInterceptor,I as getOrigin,Be as getPathExtension,O as getProxyRule,w as getProxyUrl,G as hasProtocol,ue as hasSameCanonicalArcGISOnlinePortal,k as hasSameCanonicalPortal,M as hasSameOrigin,de as hasSamePortal,L as isAbsolute,Y as isAppHTTPS,R as isBlobProtocol,z as isDataProtocol,K as isHTTPSProtocol,W as isProtocolRelative,Fe as isSVG,fe as isTrustedServer,F as join,N as makeAbsolute,_e as makeData,me as makeRelative,P as normalize,C as objectToQuery,He as parseData,S as queryToObject,Ee as removeFile,ze as removeQueryParameter,Ie as removeQueryParameters,Oe as removeTrailingSlash,Ve as splitPathExtension,se as test,Ce as toHTTP,J as toHTTPS,g as trustedServersUrlCache,x as urlToObject};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{segmentLength as e}from"../../../../arcade/functions/measures.js";import{getHeightUnitCorrectionFactor as t}from"../../../geometry/coordUtils.js";import{readOffsetDistance as n,readIsProportional as r,readVertexBeforeOffset as i,readDistance as a,makeFeatureFromGroupPart as o}from"./support/builderUtils.js";import{modeBasedOffset as s}from"./support/offsetUtils.js";import{pointAlongLineWithZAndOffset as c,pointAlongLineAndOffset as l,offsetPointFromSegment as u}from"./support/shapeUtils.js";import{isPolyline as d,maxDigitizingDisplayEdits as f}from"../support/executorUtils.js";import p from"../../../../geometry/Multipoint.js";import m from"../../../../geometry/Point.js";import{intersectsExecute as h}from"../../../../geometry/operators/intersectsOperator.js";import{fromSpatialReference as g}from"../../../../geometry/operators/support/apiConverter.js";import{getPaths as _,getEndpoint as v}from"../../../../geometry/support/curves/curveUtils.js";function y(e){if(S(e)&&e.mode!==`digitizing`)return b(e)}async function b({templatePart:d,parentTemplate:p,shape:y,edits:b,relationships:S,mode:C,xyTolerance:w,associationFeaturesByTemplate:T}){let{builderConfig:E}=d,D=n(E),O=r(E),k=i(E),A=a(E,O),j=k||D===0?y:s(y,D,C,w);if(j===null)return;let M=p.layer.createQuery();M.geometry=j,M.spatialRelationship=`intersects`,M.returnM=!0,M.returnZ=!0,M.returnTrueCurves=!0,M.outSpatialReference=j.spatialReference,M.cacheHint=!1,M.returnGeometry=!0,M.historicMoment=p.layer.historicMoment,M.gdbVersion=p.layer.gdbVersion,M.distance=(g(j.spatialReference)?.getTolerance()??.001)*2;let{features:N}=await p.layer.queryFeatures(M);if(N.length===0)return;let P=[];for(let e of N)P.push(x(e.geometry));let F=t(j.spatialReference),I=0,L=0,R=_(j);for(let t=0;t<R.length&&!(b.length>f);t++){let n=R[t],r=n.length;for(let i=0;i<r;i++){let a=v(n[i]),s=new m({x:a[0],y:a[1],spatialReference:j.spatialReference,hasZ:j.hasZ,hasM:j.hasM,...j.hasZ?{z:a[2]}:{},...j.hasM?{m:a[j.hasZ?3:2]}:{}});for(let n of P)if(h(s,n)){if(i>0&&A!==0&&(I+=e(v(R[t][i-1]),R[t][i],j.hasZ,F)),A!==0){let n=1;if(O){let a=A<0?i-1:i+1;if(a>=r||a<0)return;n=e(v(R[t][i]),R[t][a],j.hasZ,F)}let a=I+n*A;s=j.hasZ?c(j,a,D,F,w):l(j,a,D,w)}else D!==0&&(s=i===r-1?u(s,v(R[t][i-1]),R[t][i],D,w):u(s,v(R[t][i]),R[t][i+1],D,w));s&&o({templatePart:d,shape:s,edits:b,relationships:S,mode:C,associationFeaturesByTemplate:T},`V${L.toString()}`);break}L++}}}function x(e){let t=[];for(let n of _(e))for(let e of n){let n=v(e);t.push([...n])}return new p({spatialReference:e.spatialReference,points:t})}function S(e){return e.parentTemplate!=null&&d(e.shape)}const C=!0;export{y as execute,C as isAsync};
2
+ import{segmentLength as e}from"../../../../arcade/functions/measures.js";import{getHeightUnitCorrectionFactor as t}from"../../../geometry/coordUtils.js";import{readOffsetDistance as n,readIsProportional as r,readVertexBeforeOffset as i,readDistance as a,makeFeatureFromGroupPart as o}from"./support/builderUtils.js";import{modeBasedOffset as s}from"./support/offsetUtils.js";import{pointAlongLineWithZAndOffset as c,pointAlongLineAndOffset as l,offsetPointFromSegment as u}from"./support/shapeUtils.js";import{isPolyline as d,maxDigitizingDisplayEdits as f}from"../support/executorUtils.js";import p from"../../../../geometry/Multipoint.js";import m from"../../../../geometry/Point.js";import{intersectsExecute as h}from"../../../../geometry/operators/intersectsOperator.js";import{fromSpatialReference as g}from"../../../../geometry/operators/support/apiConverter.js";import{getPaths as _,getEndpoint as v}from"../../../../geometry/support/curves/curveUtils.js";function y(e){if(S(e)&&e.mode!==`digitizing`)return b(e)}async function b({templatePart:d,parentTemplate:p,shape:y,edits:b,relationships:S,mode:C,xyTolerance:w,associationFeaturesByTemplate:T}){let{builderConfig:E}=d,D=n(E),O=r(E),k=i(E),A=a(E,O),j=k||D===0?y:s(y,D,C,w);if(j===null)return;let M=p.layer.createQuery();M.geometry=j,M.spatialRelationship=`intersects`,M.returnM=!0,M.returnZ=!0,M.returnTrueCurves=!0,M.outSpatialReference=j.spatialReference,M.cacheHint=!1,M.returnGeometry=!0,M.historicMoment=p.layer.historicMoment,M.gdbVersion=p.layer.gdbVersion,M.distance=(g(j.spatialReference)?.getTolerance()??.001)*2;let{features:N}=await p.layer.queryFeatures(M);if(N.length===0)return;let P=Array.from(N,e=>x(e.geometry)),F=t(j.spatialReference),I=0,L=0,R=_(j);for(let t=0;t<R.length&&!(b.length>f);t++){let n=R[t],r=n.length;for(let i=0;i<r;i++){let a=v(n[i]),s=new m({x:a[0],y:a[1],spatialReference:j.spatialReference,hasZ:j.hasZ,hasM:j.hasM,...j.hasZ?{z:a[2]}:{},...j.hasM?{m:a[j.hasZ?3:2]}:{}});for(let n of P)if(h(s,n)){if(i>0&&A!==0&&(I+=e(v(R[t][i-1]),R[t][i],j.hasZ,F)),A!==0){let n=1;if(O){let a=A<0?i-1:i+1;if(a>=r||a<0)return;n=e(v(R[t][i]),R[t][a],j.hasZ,F)}let a=I+n*A;s=j.hasZ?c(j,a,D,F,w):l(j,a,D,w)}else D!==0&&(s=i===r-1?u(s,v(R[t][i-1]),R[t][i],D,w):u(s,v(R[t][i]),R[t][i+1],D,w));s&&o({templatePart:d,shape:s,edits:b,relationships:S,mode:C,associationFeaturesByTemplate:T},`V${L.toString()}`);break}L++}}}function x(e){let t=[];for(let n of _(e))for(let e of n){let n=v(e);t.push([...n])}return new p({spatialReference:e.spatialReference,points:t})}function S(e){return e.parentTemplate!=null&&d(e.shape)}const C=!0;export{y as execute,C as isAsync};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{makeFeatureFromGroupPart as e}from"./support/builderUtils.js";import{sameStartEndPoint as t}from"./support/shapeUtils.js";import{isPolygon as n,maxDigitizingDisplayEdits as r}from"../support/executorUtils.js";import i from"../../../../geometry/Polyline.js";import{getPaths as a,cloneCurve as o,pathHasCurves as s}from"../../../../geometry/support/curves/curveUtils.js";function c({templatePart:c,shape:l,edits:u,relationships:d,mode:f,xyTolerance:p,associationFeaturesByTemplate:m}){if(!n(l))return;let h=l.clone(),g=[];for(let e of a(h)){let n=e.slice();t(e)||n.push(o(n[0])),g.push(n)}if(g.length>0)for(let t of g){if(f===`digitizing`&&u.length>r)break;let n=new i({...s(t)?{curvePaths:[t]}:{paths:[t]},spatialReference:h.spatialReference,hasZ:h.hasZ,hasM:h.hasM});e({templatePart:c,shape:n,edits:u,relationships:d,mode:f,associationFeaturesByTemplate:m})}}const l=!1;export{c as execute,l as isAsync};
2
+ import{makeFeatureFromGroupPart as e}from"./support/builderUtils.js";import{sameStartEndPoint as t}from"./support/shapeUtils.js";import{isPolygon as n,maxDigitizingDisplayEdits as r}from"../support/executorUtils.js";import i from"../../../../geometry/Polyline.js";import{getPaths as a,cloneCurve as o,pathHasCurves as s}from"../../../../geometry/support/curves/curveUtils.js";function c({templatePart:c,shape:l,edits:u,relationships:d,mode:f,xyTolerance:p,associationFeaturesByTemplate:m}){if(!n(l))return;let h=l.clone(),g=[];for(let e of a(h)){let n=e.slice();t(e)||n.push(o(n[0])),g.push(n)}for(let t of g){if(f===`digitizing`&&u.length>r)break;let n=new i({...s(t)?{curvePaths:[t]}:{paths:[t]},spatialReference:h.spatialReference,hasZ:h.hasZ,hasM:h.hasM});e({templatePart:c,shape:n,edits:u,relationships:d,mode:f,associationFeaturesByTemplate:m})}}const l=!1;export{c as execute,l as isAsync};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../core/Error.js";import{isLoadedSharedTemplate as t,isSharedPresetTemplate as n,isSharedFeatureTemplate as r}from"../../../../templateUtils.js";import{createFeatureServiceEdit as i}from"../../support/createFeatureServiceEdit.js";import{createPresetServiceEdit as a}from"../../support/createPresetServiceEdit.js";import o from"../../../../../geometry/Polygon.js";import{isPoint as s,isPolygon as c}from"../../../../../geometry/support/jsonTypeUtils.js";import{getPaths as l,getEndpoint as u,isCurvedGeometry as d,cloneCurve as f}from"../../../../../geometry/support/curves/curveUtils.js";function p({edits:o,mode:c,relationships:l,shape:u,templatePart:d,associationFeaturesByTemplate:f},p=``){if(d===null)return;let{template:m}=d;if(!t(m))throw new e(`shared-template:template-not-loaded`,`A template part's template must be loaded before use`);if(n(m)){if(!s(u))throw new e(`shared-template:invalid-geometry`,`Preset templates must have a point geometry`);a({geometry:u,template:m,edits:o,relationships:l,rotation:0,mode:c,tag:p,associationFeaturesByTemplate:f})}else r(m)&&i({geometry:u,template:m,edits:o,relationships:l,tag:p})}function m(e,t){if(!e||!c(e))return null;if(!t.hasZ&&!t.hasM)return e;let n=null,r=null,i=t.hasZ&&t.hasM?3:2;switch(t.type){case`point`:n=t.hasZ?t.z:null,r=t.hasM?t.m:null;break;case`polygon`:case`polyline`:{let e=l(t);for(let a of e)for(let e of a){let a=u(e);t.hasZ&&(n===null||a[2]>n)&&(n=a[2]),t.hasM&&(r===null||a[i]>r)&&(r=a[i])}}break;case`multipoint`:for(let e of t.points)t.hasZ&&(n===null||e[2]>n)&&(n=e[2]),t.hasM&&(r===null||e[i]>r)&&(r=e[i]);break;default:return e}return d(e)?new o({curveRings:w(e.curveRings,t.hasZ,t.hasM,n,r),spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM}):new o({rings:S(e.rings,t.hasZ,t.hasM,n,r),spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM})}function h(e){let t=!1;return e.byNumber!==void 0&&(t=e.byNumber===!0),t}function g(e){let t=0;return e.count!==void 0&&(t=e.count),t}function _(e,t){let n=0;return t?e.proportional!==void 0&&(n=e.proportional):e.distanceValue!==void 0&&(n=e.distanceValue),t&&(n/=100),n}function v(e){return e.isProportional===!0}function y(e){return e.createUnique!==!1}function b(e){let t=0;return e.offsetDistance!==void 0&&(t=e.offsetDistance),e.side!==void 0&&e.side===1&&(t*=-1),t}function x(e){return e.vertexBeforeOffset!==0}function S(e,t,n,r,i){let a=[];for(let o of e)a.push(C(o,t,n,r,i));return a}function C(e,t,n,r,i){let a=[];for(let o of e){let e=[o[0],o[1]];t&&(e[2]=r),n&&(e[t?3:2]=i),a.push(e)}return a}function w(e,t,n,r,i){let a=[];for(let o of e)a.push(T(o,t,n,r,i));return a}function T(e,t,n,r,i){let a=[];for(let o of e){let e=f(o),s=u(e);t&&(s[2]=r),n&&(s[t?3:2]=i),a.push(e)}return a}export{m as correctZandMFollowingBuffer,p as makeFeatureFromGroupPart,h as readByNumber,g as readCount,_ as readDistance,v as readIsProportional,y as readIsUnique,b as readOffsetDistance,x as readVertexBeforeOffset};
2
+ import e from"../../../../../core/Error.js";import{isLoadedSharedTemplate as t,isSharedPresetTemplate as n,isSharedFeatureTemplate as r}from"../../../../templateUtils.js";import{createFeatureServiceEdit as i}from"../../support/createFeatureServiceEdit.js";import{createPresetServiceEdit as a}from"../../support/createPresetServiceEdit.js";import o from"../../../../../geometry/Polygon.js";import{isPoint as s,isPolygon as c}from"../../../../../geometry/support/jsonTypeUtils.js";import{getPaths as l,getEndpoint as u,isCurvedGeometry as d,cloneCurve as f}from"../../../../../geometry/support/curves/curveUtils.js";function p({edits:o,mode:c,relationships:l,shape:u,templatePart:d,associationFeaturesByTemplate:f},p=``){if(d===null)return;let{template:m}=d;if(!t(m))throw new e(`shared-template:template-not-loaded`,`A template part's template must be loaded before use`);if(n(m)){if(!s(u))throw new e(`shared-template:invalid-geometry`,`Preset templates must have a point geometry`);a({geometry:u,template:m,edits:o,relationships:l,rotation:0,mode:c,tag:p,associationFeaturesByTemplate:f})}else r(m)&&i({geometry:u,template:m,edits:o,relationships:l,tag:p})}function m(e,t){if(!e||!c(e))return null;if(!t.hasZ&&!t.hasM)return e;let n=null,r=null,i=t.hasZ&&t.hasM?3:2;switch(t.type){case`point`:n=t.hasZ?t.z:null,r=t.hasM?t.m:null;break;case`polygon`:case`polyline`:{let e=l(t);for(let a of e)for(let e of a){let a=u(e);t.hasZ&&(n===null||a[2]>n)&&(n=a[2]),t.hasM&&(r===null||a[i]>r)&&(r=a[i])}}break;case`multipoint`:for(let e of t.points)t.hasZ&&(n===null||e[2]>n)&&(n=e[2]),t.hasM&&(r===null||e[i]>r)&&(r=e[i]);break;default:return e}return d(e)?new o({curveRings:w(e.curveRings,t.hasZ,t.hasM,n,r),spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM}):new o({rings:S(e.rings,t.hasZ,t.hasM,n,r),spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM})}function h(e){let t=!1;return e.byNumber!==void 0&&(t=e.byNumber===!0),t}function g(e){let t=0;return e.count!==void 0&&(t=e.count),t}function _(e,t){let n=0;return t?e.proportional!==void 0&&(n=e.proportional):e.distanceValue!==void 0&&(n=e.distanceValue),t&&(n/=100),n}function v(e){return e.isProportional===!0}function y(e){return e.createUnique!==!1}function b(e){let t=0;return e.offsetDistance!==void 0&&(t=e.offsetDistance),e.side!==void 0&&e.side===1&&(t*=-1),t}function x(e){return e.vertexBeforeOffset!==0}function S(e,t,n,r,i){return Array.from(e,e=>C(e,t,n,r,i))}function C(e,t,n,r,i){let a=[];for(let o of e){let e=[o[0],o[1]];t&&(e[2]=r),n&&(e[t?3:2]=i),a.push(e)}return a}function w(e,t,n,r,i){return Array.from(e,e=>T(e,t,n,r,i))}function T(e,t,n,r,i){let a=[];for(let o of e){let e=f(o),s=u(e);t&&(s[2]=r),n&&(s[t?3:2]=i),a.push(e)}return a}export{m as correctZandMFollowingBuffer,p as makeFeatureFromGroupPart,h as readByNumber,g as readCount,_ as readDistance,v as readIsProportional,y as readIsUnique,b as readOffsetDistance,x as readVertexBeforeOffset};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../Graphic.js";import t from"../../../../core/Error.js";import{generateBracedUUID as n}from"../../../../core/uuid.js";import{getCreationAttributes as r,isLoadedSharedTemplate as i}from"../../../templateUtils.js";import{isRadial as a}from"./executorUtils.js";import o from"../../../../geometry/Multipoint.js";import s from"../../../../geometry/Point.js";import c from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{isCurvedGeometry as u,isCoordinate as d,cloneCurve as f,isBezierCurve as p,isCircularArc as m}from"../../../../geometry/support/curves/curveUtils.js";import{isSubtypeGroupLayer as h}from"../../../../layers/support/layerUtils.js";import{isNumber as g}from"../../../../support/guards.js";function _({edits:o,geometry:s,relationships:c,tag:u=``,template:d}){if(a(s)){let e=s.geometry.clone();for(let t of e.paths)_({geometry:new l({spatialReference:e.spatialReference,paths:[t],hasZ:e.hasZ,hasM:e.hasM}),template:d,edits:o,relationships:c,tag:u});return}let{definition:f,layer:p}=d;s=v(s,p);let m=h(p)?E(d,p):p,g=new e({attributes:r(d,{},m),geometry:s,sourceLayer:m});if(p.globalIdField&&(g.attributes[p.globalIdField]=n()),o.push({id:p.layerId,graphic:g,tag:u,layer:p}),f.relationships.length!==0)for(let a of f.relationships||[]){let s=a.template;if(a.relationshipMetadata==null||!i(s))throw new t(`shared-template:missing-relationship-metadata-or-definition`,`Relationship part must have metadata and a fully loaded template with definition`);let{layer:l}=s,u=h(l)?E(s,l):l,d=new e({attributes:r(s,{},u),sourceLayer:u});l.globalIdField&&(d.attributes[l.globalIdField]=n()),o.push({graphic:d,id:l.layerId,tag:``,layer:l}),c.push({...a.relationshipMetadata,sourceGraphic:g,destinationGraphic:d})}}function v(e,t){if(!e)return null;if(e.hasZ===t.hasZ&&e.hasM===t.hasM)return e;switch(e.type){case`point`:return new s({spatialReference:e.spatialReference,x:e.x,y:e.y,...t.hasZ?e.hasZ?{z:e.z}:{z:w(t)}:{},...t.hasM?e.hasM?{m:e.m}:{m:T(t)??void 0}:{}});case`polygon`:return new c({spatialReference:e.spatialReference,...u(e)?{curveRings:x(e.curveRings,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})}:{rings:y(e.rings,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})},hasZ:t.hasZ,hasM:t.hasM});case`polyline`:return new l({spatialReference:e.spatialReference,...u(e)?{curvePaths:x(e.curvePaths,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})}:{paths:y(e.paths,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})},hasZ:t.hasZ,hasM:t.hasM});case`multipoint`:return new o({spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM,points:b(e.points,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})});default:return e}}function y(e,t){let n=[];for(let r of e)n.push(b(r,t));return n}function b(e,t){let n=[];for(let r of e){let e=[r[0],r[1]];t.hasZ&&(e[2]=t.zIndex>-1?r[2]:t.defaultZ),t.hasM&&(t.mIndex>-1?e[t.hasZ?3:2]=r[t.mIndex]:e[t.hasZ?3:2]=t.defaultM),n.push(e)}return n}function x(e,t){return e.map(e=>S(e,t))}function S(e,t){let n=[];for(let r of e)if(d(r)){let e=C(r,t);n.push(e)}else{let e=f(r);p(e)?e.b[0]=C(e.b[0],t):m(e)?e.c[0]=C(e.c[0],t):e.a[0]=C(e.a[0],t),n.push(e)}return n}function C(e,t){let n=[e[0],e[1]];return t.hasZ&&(n[2]=t.zIndex>-1?e[2]:t.defaultZ),t.hasM&&(t.mIndex>-1?n[t.hasZ?3:2]=e[t.mIndex]:n[t.hasZ?3:2]=t.defaultM),n}function w(e){return e.capabilities.editing?.zDefault??0}function T(e){return e.capabilities.editing.supportsUpdateWithoutM?void 0:0}function E(e,t){let n=t.fieldsIndex.get(t.subtypeField),{defaultValues:r}=e.definition,i=(g(r?.[n.name])?r[n.name]:null)??e.subtypeCode;return i==null?t.sublayers.at(0):t.findSublayerForSubtypeCode(i)}export{_ as createFeatureServiceEdit};
2
+ import e from"../../../../Graphic.js";import t from"../../../../core/Error.js";import{generateBracedUUID as n}from"../../../../core/uuid.js";import{getCreationAttributes as r,isLoadedSharedTemplate as i}from"../../../templateUtils.js";import{isRadial as a}from"./executorUtils.js";import o from"../../../../geometry/Multipoint.js";import s from"../../../../geometry/Point.js";import c from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{isCurvedGeometry as u,isCoordinate as d,cloneCurve as f,isBezierCurve as p,isCircularArc as m}from"../../../../geometry/support/curves/curveUtils.js";import{isSubtypeGroupLayer as h}from"../../../../layers/support/layerUtils.js";import{isNumber as g}from"../../../../support/guards.js";function _({edits:o,geometry:s,relationships:c,tag:u=``,template:d}){if(a(s)){let e=s.geometry.clone();for(let t of e.paths)_({geometry:new l({spatialReference:e.spatialReference,paths:[t],hasZ:e.hasZ,hasM:e.hasM}),template:d,edits:o,relationships:c,tag:u});return}let{definition:f,layer:p}=d;s=v(s,p);let m=h(p)?E(d,p):p,g=new e({attributes:r(d,{},m),geometry:s,sourceLayer:m});if(p.globalIdField&&(g.attributes[p.globalIdField]=n()),o.push({id:p.layerId,graphic:g,tag:u,layer:p}),f.relationships.length!==0)for(let a of f.relationships||[]){let s=a.template;if(a.relationshipMetadata==null||!i(s))throw new t(`shared-template:missing-relationship-metadata-or-definition`,`Relationship part must have metadata and a fully loaded template with definition`);let{layer:l}=s,u=h(l)?E(s,l):l,d=new e({attributes:r(s,{},u),sourceLayer:u});l.globalIdField&&(d.attributes[l.globalIdField]=n()),o.push({graphic:d,id:l.layerId,tag:``,layer:l}),c.push({...a.relationshipMetadata,sourceGraphic:g,destinationGraphic:d})}}function v(e,t){if(!e)return null;if(e.hasZ===t.hasZ&&e.hasM===t.hasM)return e;switch(e.type){case`point`:return new s({spatialReference:e.spatialReference,x:e.x,y:e.y,...t.hasZ?e.hasZ?{z:e.z}:{z:w(t)}:{},...t.hasM?e.hasM?{m:e.m}:{m:T(t)??void 0}:{}});case`polygon`:return new c({spatialReference:e.spatialReference,...u(e)?{curveRings:x(e.curveRings,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})}:{rings:y(e.rings,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})},hasZ:t.hasZ,hasM:t.hasM});case`polyline`:return new l({spatialReference:e.spatialReference,...u(e)?{curvePaths:x(e.curvePaths,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})}:{paths:y(e.paths,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})},hasZ:t.hasZ,hasM:t.hasM});case`multipoint`:return new o({spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM,points:b(e.points,{hasZ:t.hasZ,hasM:t.hasM,defaultZ:w(t),defaultM:T(t),mIndex:e.hasM?e.hasZ?3:2:-1,zIndex:e.hasZ?2:-1})});default:return e}}function y(e,t){return Array.from(e,e=>b(e,t))}function b(e,t){let n=[];for(let r of e){let e=[r[0],r[1]];t.hasZ&&(e[2]=t.zIndex>-1?r[2]:t.defaultZ),t.hasM&&(t.mIndex>-1?e[t.hasZ?3:2]=r[t.mIndex]:e[t.hasZ?3:2]=t.defaultM),n.push(e)}return n}function x(e,t){return e.map(e=>S(e,t))}function S(e,t){let n=[];for(let r of e)if(d(r)){let e=C(r,t);n.push(e)}else{let e=f(r);p(e)?e.b[0]=C(e.b[0],t):m(e)?e.c[0]=C(e.c[0],t):e.a[0]=C(e.a[0],t),n.push(e)}return n}function C(e,t){let n=[e[0],e[1]];return t.hasZ&&(n[2]=t.zIndex>-1?e[2]:t.defaultZ),t.hasM&&(t.mIndex>-1?n[t.hasZ?3:2]=e[t.mIndex]:n[t.hasZ?3:2]=t.defaultM),n}function w(e){return e.capabilities.editing?.zDefault??0}function T(e){return e.capabilities.editing.supportsUpdateWithoutM?void 0:0}function E(e,t){let n=t.fieldsIndex.get(t.subtypeField),{defaultValues:r}=e.definition,i=(g(r?.[n.name])?r[n.name]:null)??e.subtypeCode;return i==null?t.sublayers.at(0):t.findSublayerForSubtypeCode(i)}export{_ as createFeatureServiceEdit};
package/geometry/Point.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import n from"../core/Logger.js";import{property as r,cast as i,subclass as a}from"../core/accessorSupport/decorators.js";import{ensureNumber as o}from"../core/accessorSupport/ensureType.js";import s from"./Geometry.js";import c from"./SpatialReference.js";import{getLatitude as l,getLongitude as u,distance as d}from"./support/pointUtils.js";import{getInfo as f}from"./support/spatialReferenceUtils.js";import{lngLatToXY as p,xyToLngLat as m}from"./support/webMercatorUtils.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{reader as g}from"../core/accessorSupport/decorators/reader.js";var _;const v=[0,0];let y=_=class extends s{static copy(e,n){n._set(`x`,e._get(`x`)),n._set(`y`,e._get(`y`)),n._set(`z`,e._get(`z`)),n._set(`m`,e._get(`m`));let r=e._get(`spatialReference`);n._set(`spatialReference`,t.isFrozen(r)?r:r.clone())}constructor(e){super(e),this.x=0,this.y=0,this.z=void 0,this.m=void 0,this.type=`point`}normalizeCtorArgs(e){if(e===void 0)return{};let t,r,i,a,o;if(Array.isArray(e))[t,r,i,a]=e;else if(e&&typeof e==`object`){let s=e;if(t=s.x==null?s.longitude:s.x,r=s.y==null?s.latitude:s.y,i=s.z,a=s.m,o=s.spatialReference,o&&o.declaredClass!==`esri.geometry.SpatialReference`&&(o=new c(o)),s.longitude!=null||s.latitude!=null){if(s.longitude==null)n.getLogger(this).warn(`.longitude=`,`Latitude was defined without longitude`);else if(s.latitude==null)n.getLogger(this).warn(`.latitude=`,`Longitude was defined without latitude`);else if(!s.declaredClass&&o?.isWebMercator){let e=p(s.longitude,s.latitude,v);t=e[0],r=e[1]}}}let s={x:t,y:r};return s.x==null&&s.y!=null?n.getLogger(this).warn(`.y=`,`Y coordinate was defined without an X coordinate`):s.y==null&&s.x!=null&&n.getLogger(this).warn(`.x=`,`X coordinate was defined without a Y coordinate`),o!=null&&(s.spatialReference=o),i!=null&&(s.z=i),a!=null&&(s.m=a),s}get cache(){return this.commitProperty(`x`),this.commitProperty(`y`),this.commitProperty(`z`),this.commitProperty(`m`),this.commitProperty(`spatialReference`),{}}get hasM(){return this.m!==void 0}set hasM(e){e!==(this._get(`m`)!==void 0)&&(this._set(`m`,e?0:void 0),this._set(`hasM`,e))}get hasZ(){return this.z!==void 0}set hasZ(e){e!==(this._get(`z`)!==void 0)&&(this._set(`z`,e?0:void 0),this._set(`hasZ`,e))}get latitude(){return l(this)}set latitude(e){let{spatialReference:t,x:n}=this;e!=null&&t&&(t.isWebMercator?this._set(`y`,p(n,e,v)[1]):t.isGeographic&&this._set(`y`,e),this._set(`latitude`,e))}get longitude(){return u(this)}set longitude(e){let{y:t,spatialReference:n}=this;e!=null&&n&&(n.isWebMercator?this._set(`x`,p(e,t,v)[0]):n.isGeographic&&this._set(`x`,e),this._set(`longitude`,e))}writeX(e,t,n){t[n]=isNaN(e)?`NaN`:e}readX(e){return typeof e==`string`?NaN:e}clone(){let e=new _;return e.x=this.x,e.y=this.y,e.z=this.z,e.m=this.m,e.spatialReference=this.spatialReference,e}copy(e){return _.copy(e,this),this}equals(e){if(e==null)return!1;let{x:t,y:n,z:r,m:i,spatialReference:a}=this,{z:o,m:s}=e,{x:c,y:l,spatialReference:u}=e;if(!a.equals(u)){if(a.isWebMercator&&u.isWGS84)[c,l]=p(c,l),u=a;else if(a.isWGS84&&u.isWebMercator)[c,l]=m(c,l),u=a;else return!1}return t===c&&n===l&&r===o&&i===s&&a.wkid===u.wkid}offset(e,t,n){return this.x+=e,this.y+=t,n!=null&&(this.z=(this.z??0)+n),this}normalize(){if(!this.spatialReference)return this;let e=f(this.spatialReference);if(!e)return this;let t=this.x,[n,r]=e.valid,i=2*r,a;return t>r?(a=Math.ceil(Math.abs(t-r)/i),t-=a*i):t<n&&(a=Math.ceil(Math.abs(t-n)/i),t+=a*i),this._set(`x`,t),this}distance(e){return d(this,e)}toArray(){let e=this.hasZ,t=this.hasM;return e&&t?[this.x,this.y,this.z,this.m]:e?[this.x,this.y,this.z]:t?[this.x,this.y,this.m]:[this.x,this.y]}toJSON(e){return this.write({},e)}};e([r({readOnly:!0})],y.prototype,`cache`,null),e([r({type:Boolean,json:{read:!1,write:{enabled:!1,overridePolicy:null}}})],y.prototype,`hasM`,null),e([r({type:Boolean,json:{read:!1,write:{enabled:!1,overridePolicy:null}}})],y.prototype,`hasZ`,null),e([r({type:Number})],y.prototype,`latitude`,null),e([r({type:Number})],y.prototype,`longitude`,null),e([r({type:Number,json:{type:[Number,String],write:{isRequired:!0,allowNull:!0}}}),i(e=>isNaN(e)?e:o(e))],y.prototype,`x`,void 0),e([h(`x`)],y.prototype,`writeX`,null),e([g(`x`)],y.prototype,`readX`,null),e([r({type:Number,json:{write:!0}})],y.prototype,`y`,void 0),e([r({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasZ}}}}})],y.prototype,`z`,void 0),e([r({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasM}}}}})],y.prototype,`m`,void 0),y=_=e([a(`esri.geometry.Point`)],y),y.prototype.toJSON.isDefaultToJSON=!0;export{y as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import n from"../core/Logger.js";import{property as r,cast as i,subclass as a}from"../core/accessorSupport/decorators.js";import{ensureNumber as o}from"../core/accessorSupport/ensureType.js";import s from"./Geometry.js";import c from"./SpatialReference.js";import{getLatitude as l,getLongitude as u,distance as d}from"./support/pointUtils.js";import{getInfo as f}from"./support/spatialReferenceUtils.js";import{lngLatToXY as p,xyToLngLat as m}from"./support/webMercatorUtils.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import{reader as g}from"../core/accessorSupport/decorators/reader.js";var _;const v=()=>n.getLogger(`esri.geometry.Point`),y=[0,0];let b=_=class extends s{static copy(e,n){n._set(`x`,e._get(`x`)),n._set(`y`,e._get(`y`)),n._set(`z`,e._get(`z`)),n._set(`m`,e._get(`m`));let r=e._get(`spatialReference`);n._set(`spatialReference`,t.isFrozen(r)?r:r.clone())}constructor(e){super(x(e)),this.x=0,this.y=0,this.z=void 0,this.m=void 0,this.type=`point`}get cache(){return this.commitProperty(`x`),this.commitProperty(`y`),this.commitProperty(`z`),this.commitProperty(`m`),this.commitProperty(`spatialReference`),{}}get hasM(){return this.m!==void 0}set hasM(e){e!==(this._get(`m`)!==void 0)&&(this._set(`m`,e?0:void 0),this._set(`hasM`,e))}get hasZ(){return this.z!==void 0}set hasZ(e){e!==(this._get(`z`)!==void 0)&&(this._set(`z`,e?0:void 0),this._set(`hasZ`,e))}get latitude(){return l(this)}set latitude(e){let{spatialReference:t,x:n}=this;e!=null&&t&&(t.isWebMercator?this._set(`y`,p(n,e,y)[1]):t.isGeographic&&this._set(`y`,e),this._set(`latitude`,e))}get longitude(){return u(this)}set longitude(e){let{y:t,spatialReference:n}=this;e!=null&&n&&(n.isWebMercator?this._set(`x`,p(e,t,y)[0]):n.isGeographic&&this._set(`x`,e),this._set(`longitude`,e))}writeX(e,t,n){t[n]=isNaN(e)?`NaN`:e}readX(e){return typeof e==`string`?NaN:e}clone(){let e=new _;return e.x=this.x,e.y=this.y,e.z=this.z,e.m=this.m,e.spatialReference=this.spatialReference,e}copy(e){return _.copy(e,this),this}equals(e){if(e==null)return!1;let{x:t,y:n,z:r,m:i,spatialReference:a}=this,{z:o,m:s}=e,{x:c,y:l,spatialReference:u}=e;if(!a.equals(u)){if(a.isWebMercator&&u.isWGS84)[c,l]=p(c,l),u=a;else if(a.isWGS84&&u.isWebMercator)[c,l]=m(c,l),u=a;else return!1}return t===c&&n===l&&r===o&&i===s&&a.wkid===u.wkid}offset(e,t,n){return this.x+=e,this.y+=t,n!=null&&(this.z=(this.z??0)+n),this}normalize(){if(!this.spatialReference)return this;let e=f(this.spatialReference);if(!e)return this;let t=this.x,[n,r]=e.valid,i=2*r,a;return t>r?(a=Math.ceil(Math.abs(t-r)/i),t-=a*i):t<n&&(a=Math.ceil(Math.abs(t-n)/i),t+=a*i),this._set(`x`,t),this}distance(e){return d(this,e)}toArray(){let e=this.hasZ,t=this.hasM;return e&&t?[this.x,this.y,this.z,this.m]:e?[this.x,this.y,this.z]:t?[this.x,this.y,this.m]:[this.x,this.y]}toJSON(e){return this.write({},e)}};e([r({readOnly:!0})],b.prototype,`cache`,null),e([r({type:Boolean,json:{read:!1,write:{enabled:!1,overridePolicy:null}}})],b.prototype,`hasM`,null),e([r({type:Boolean,json:{read:!1,write:{enabled:!1,overridePolicy:null}}})],b.prototype,`hasZ`,null),e([r({type:Number})],b.prototype,`latitude`,null),e([r({type:Number})],b.prototype,`longitude`,null),e([r({type:Number,json:{type:[Number,String],write:{isRequired:!0,allowNull:!0}}}),i(e=>isNaN(e)?e:o(e))],b.prototype,`x`,void 0),e([h(`x`)],b.prototype,`writeX`,null),e([g(`x`)],b.prototype,`readX`,null),e([r({type:Number,json:{write:!0}})],b.prototype,`y`,void 0),e([r({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasZ}}}}})],b.prototype,`z`,void 0),e([r({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasM}}}}})],b.prototype,`m`,void 0),b=_=e([a(`esri.geometry.Point`)],b),b.prototype.toJSON.isDefaultToJSON=!0;function x(e){if(e===void 0)return{};let t,n,r,i,a;if(Array.isArray(e))[t,n,r,i]=e;else if(e&&typeof e==`object`){let o=e;if(t=o.x??o.longitude,n=o.y??o.latitude,r=o.z,i=o.m,a=o.spatialReference,a&&a.declaredClass!==`esri.geometry.SpatialReference`&&(a=new c(a)),o.longitude!=null||o.latitude!=null){if(o.longitude==null)v().warn(`.longitude=`,`Latitude was defined without longitude`);else if(o.latitude==null)v().warn(`.latitude=`,`Longitude was defined without latitude`);else if(!o.declaredClass&&a?.isWebMercator){let e=p(o.longitude,o.latitude,y);t=e[0],n=e[1]}}}let o={x:t,y:n};return o.x==null&&o.y!=null?v().warn(`.y=`,`Y coordinate was defined without an X coordinate`):o.y==null&&o.x!=null&&v().warn(`.x=`,`X coordinate was defined without a Y coordinate`),a!=null&&(o.spatialReference=a),r!=null&&(o.z=r),i!=null&&(o.m=i),o}export{b as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{equals as t}from"../core/arrayUtils.js";import{deprecatedProperty as n}from"../core/deprecate.js";import{clone as r}from"../core/lang.js";import i from"../core/Logger.js";import{property as a,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Extent.js";import c from"./Geometry.js";import l from"./Point.js";import u from"./SpatialReference.js";import{polygonCentroidPoint as d}from"./support/centroid.js";import{polygonContainsPoint as f}from"./support/contains.js";import{isClockwise as p}from"./support/coordsUtils.js";import{getPolygonExtent as m}from"./support/extentUtils.js";import{comparePoints as h}from"./support/geometryUtils.js";import{project as g}from"./support/webMercatorUtils.js";import{updateSupportFromPoint as _}from"./support/zmUtils.js";import{writer as v}from"../core/accessorSupport/decorators/writer.js";var y;function b(e){return!Array.isArray(e[0])}function x(e){return typeof e[0]?.[0]==`number`}function S(e){if(!e)return;let{rings:t,hasM:n,hasZ:r,spatialReference:i}=e;switch(t??=[],x(t)&&(t=[t]),t[0]?.[0]?.length){case 4:r??=!0,n??=!0;break;case 3:r??=n!==!0,n??=!r;break;default:r??=!1,n??=!1}return i??=u.WGS84,{...e,hasM:n,hasZ:r,rings:t,spatialReference:i}}let C=y=class extends c{static fromExtent(e){let t=e.clone().normalize(),{spatialReference:n}=e,r=!1,i=!1;for(let e of t)e.hasZ&&(r=!0),e.hasM&&(i=!0);let a={rings:t.map(e=>{let t=[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]];if(r&&e.hasZ){let n=e.zmin+(e.zmax-e.zmin)*.5;for(let e=0;e<t.length;e++)t[e].push(n)}if(i&&e.hasM){let n=e.mmin+(e.mmax-e.mmin)*.5;for(let e=0;e<t.length;e++)t[e].push(n)}return t}),spatialReference:n};return r&&(a.hasZ=!0),i&&(a.hasM=!0),new y(a)}constructor(e){super(S(e)),this.curveRings=void 0,this.rings=[],this.type=`polygon`}get cache(){return this.commitProperty(`curveRings`),this.commitProperty(`hasM`),this.commitProperty(`hasZ`),this.commitProperty(`rings`),this.commitProperty(`spatialReference`),{}}get centroid(){n(i.getLogger(this),`centroid`,{replacement:`Please use centroidExecute() instead.`,version:`4.34`,warnOnce:!0});let e=d(this);return e?l.fromJSON(e):null}writeCurveRings(e,t){t.curveRings=r(e)}get extent(){let e=m(this),{spatialReference:t}=this;return e?new s({...e,spatialReference:t}):null}writeRings(e,t){t.rings=r(this.rings)}addRing(e){if(!e)return;let t=this.rings,n=t.length;if(b(e)){let r=[];for(let t=0,n=e.length;t<n;t++)r[t]=e[t].toArray();t[n]=r}else t[n]=e.slice();return this.notifyChange(`rings`),this}clone(){let e=new y;return e.spatialReference=this.spatialReference,e.rings=r(this.rings),e.curveRings=r(this.curveRings),e.hasZ=this.hasZ,e.hasM=this.hasM,e}equals(e){if(this===e)return!0;if(e==null)return!1;let n=this.spatialReference,r=e.spatialReference;if(n!=null!=(r!=null)||n!=null&&r!=null&&!n.equals(r)||this.rings.length!==e.rings.length)return!1;for(let n=0;n<this.rings.length;n++){let r=this.rings[n],i=e.rings[n];if(!t(r,i,h))return!1}return!0}contains(e){if(!e)return!1;let t=g(e,this.spatialReference);return f(this,t??e)}isClockwise(e){let t=b(e)?e.map(e=>this.hasZ?this.hasM?[e.x,e.y,e.z,e.m]:[e.x,e.y,e.z]:[e.x,e.y]):e;return p(t)}getPoint(e,t){if(!this._validateInputs(e,t))return null;let n=this.rings[e][t],r=this.hasZ,i=this.hasM;return r&&!i?new l({x:n[0],y:n[1],z:n[2],spatialReference:this.spatialReference}):i&&!r?new l({x:n[0],y:n[1],m:n[2],spatialReference:this.spatialReference}):r&&i?new l({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:this.spatialReference}):new l({x:n[0],y:n[1],spatialReference:this.spatialReference})}insertPoint(e,t,n){return this._validateInputs(e,t,!0)&&(_(this,n),Array.isArray(n)||(n=n.toArray()),this.rings[e].splice(t,0,n),this.notifyChange(`rings`)),this}removePoint(e,t){if(!this._validateInputs(e,t))return null;let[n,r,i,a]=this.rings[e].splice(t,1)[0],o=new l({x:n,y:r,z:i,m:a,spatialReference:this.spatialReference});return this.notifyChange(`rings`),o}removeRing(e){if(!this._validateInputs(e,null))return null;let t=this.rings.splice(e,1)[0],n=this.spatialReference,r=t.map(e=>new l({x:e[0],y:e[1],z:e[2],m:e[3],spatialReference:n}));return this.notifyChange(`rings`),r}setPoint(e,t,n){return this._validateInputs(e,t)&&(_(this,n),Array.isArray(n)||(n=n.toArray()),this.rings[e][t]=n,this.notifyChange(`rings`)),this}_validateInputs(e,t,n=!1){if(e==null||e<0||e>=this.rings.length)return!1;if(t!=null){let r=this.rings[e];if(n&&(t<0||t>r.length)||!n&&(t<0||t>=r.length))return!1}return!0}toJSON(e){return this.write({},e)}};e([a({readOnly:!0})],C.prototype,`cache`,null),e([a({readOnly:!0})],C.prototype,`centroid`,null),e([a({json:{write:!0,origins:{"portal-item":{write:!1},"web-map":{write:!1},"web-scene":{write:!1}}}})],C.prototype,`curveRings`,void 0),e([v(`curveRings`)],C.prototype,`writeCurveRings`,null),e([a({readOnly:!0})],C.prototype,`extent`,null),e([a({type:[[[Number]]],json:{write:{isRequired:!0}}})],C.prototype,`rings`,void 0),e([v(`rings`)],C.prototype,`writeRings`,null),C=y=e([o(`esri.geometry.Polygon`)],C),C.prototype.toJSON.isDefaultToJSON=!0;export{C as default};
2
+ import{__decorate as e}from"tslib";import{equals as t}from"../core/arrayUtils.js";import{deprecatedProperty as n}from"../core/deprecate.js";import{clone as r}from"../core/lang.js";import i from"../core/Logger.js";import{property as a,subclass as o}from"../core/accessorSupport/decorators.js";import s from"./Extent.js";import c from"./Geometry.js";import l from"./Point.js";import u from"./SpatialReference.js";import{polygonCentroidPoint as d}from"./support/centroid.js";import{polygonContainsPoint as f}from"./support/contains.js";import{isClockwise as p}from"./support/coordsUtils.js";import{getPolygonExtent as m}from"./support/extentUtils.js";import{comparePoints as h}from"./support/geometryUtils.js";import{projectIfNeeded as g}from"./support/webMercatorUtils.js";import{updateSupportFromPoint as _}from"./support/zmUtils.js";import{writer as v}from"../core/accessorSupport/decorators/writer.js";var y;function b(e){return!Array.isArray(e[0])}function x(e){return typeof e[0]?.[0]==`number`}function S(e){if(!e)return;let{rings:t,hasM:n,hasZ:r,spatialReference:i}=e;switch(t??=[],x(t)&&(t=[t]),t[0]?.[0]?.length){case 4:r??=!0,n??=!0;break;case 3:r??=n!==!0,n??=!r;break;default:r??=!1,n??=!1}return i??=u.WGS84,{...e,hasM:n,hasZ:r,rings:t,spatialReference:i}}let C=y=class extends c{static fromExtent(e){let t=e.clone().normalize(),{spatialReference:n}=e,r=!1,i=!1;for(let e of t)e.hasZ&&(r=!0),e.hasM&&(i=!0);let a={rings:t.map(e=>{let t=[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]];if(r&&e.hasZ){let n=e.zmin+(e.zmax-e.zmin)*.5;for(let e=0;e<t.length;e++)t[e].push(n)}if(i&&e.hasM){let n=e.mmin+(e.mmax-e.mmin)*.5;for(let e=0;e<t.length;e++)t[e].push(n)}return t}),spatialReference:n};return r&&(a.hasZ=!0),i&&(a.hasM=!0),new y(a)}constructor(e){super(S(e)),this.curveRings=void 0,this.rings=[],this.type=`polygon`}get cache(){return this.commitProperty(`curveRings`),this.commitProperty(`hasM`),this.commitProperty(`hasZ`),this.commitProperty(`rings`),this.commitProperty(`spatialReference`),{}}get centroid(){n(i.getLogger(this),`centroid`,{replacement:`Please use centroidExecute() instead.`,version:`4.34`,warnOnce:!0});let e=d(this);return e?l.fromJSON(e):null}writeCurveRings(e,t){t.curveRings=r(e)}get extent(){let e=m(this),{spatialReference:t}=this;return e?new s({...e,spatialReference:t}):null}writeRings(e,t){t.rings=r(this.rings)}addRing(e){if(!e)return;let t=this.rings,n=t.length;if(b(e)){let r=[];for(let t=0,n=e.length;t<n;t++)r[t]=e[t].toArray();t[n]=r}else t[n]=e.slice();return this.notifyChange(`rings`),this}clone(){let e=new y;return e.spatialReference=this.spatialReference,e.rings=r(this.rings),e.curveRings=r(this.curveRings),e.hasZ=this.hasZ,e.hasM=this.hasM,e}equals(e){if(this===e)return!0;if(e==null)return!1;let n=this.spatialReference,r=e.spatialReference;if(n!=null!=(r!=null)||n!=null&&r!=null&&!n.equals(r)||this.rings.length!==e.rings.length)return!1;for(let n=0;n<this.rings.length;n++){let r=this.rings[n],i=e.rings[n];if(!t(r,i,h))return!1}return!0}contains(e){if(!e)return!1;let t=g(e,this.spatialReference);return f(this,t??e)}isClockwise(e){let t=b(e)?e.map(e=>this.hasZ?this.hasM?[e.x,e.y,e.z,e.m]:[e.x,e.y,e.z]:[e.x,e.y]):e;return p(t)}getPoint(e,t){if(!this._validateInputs(e,t))return null;let n=this.rings[e][t],r=this.hasZ,i=this.hasM;return r&&!i?new l({x:n[0],y:n[1],z:n[2],spatialReference:this.spatialReference}):i&&!r?new l({x:n[0],y:n[1],m:n[2],spatialReference:this.spatialReference}):r&&i?new l({x:n[0],y:n[1],z:n[2],m:n[3],spatialReference:this.spatialReference}):new l({x:n[0],y:n[1],spatialReference:this.spatialReference})}insertPoint(e,t,n){return this._validateInputs(e,t,!0)&&(_(this,n),Array.isArray(n)||(n=n.toArray()),this.rings[e].splice(t,0,n),this.notifyChange(`rings`)),this}removePoint(e,t){if(!this._validateInputs(e,t))return null;let[n,r,i,a]=this.rings[e].splice(t,1)[0],o=new l({x:n,y:r,z:i,m:a,spatialReference:this.spatialReference});return this.notifyChange(`rings`),o}removeRing(e){if(!this._validateInputs(e,null))return null;let t=this.rings.splice(e,1)[0],n=this.spatialReference,r=t.map(e=>new l({x:e[0],y:e[1],z:e[2],m:e[3],spatialReference:n}));return this.notifyChange(`rings`),r}setPoint(e,t,n){return this._validateInputs(e,t)&&(_(this,n),Array.isArray(n)||(n=n.toArray()),this.rings[e][t]=n,this.notifyChange(`rings`)),this}_validateInputs(e,t,n=!1){if(e==null||e<0||e>=this.rings.length)return!1;if(t!=null){let r=this.rings[e];if(n&&(t<0||t>r.length)||!n&&(t<0||t>=r.length))return!1}return!0}toJSON(e){return this.write({},e)}};e([a({readOnly:!0})],C.prototype,`cache`,null),e([a({readOnly:!0})],C.prototype,`centroid`,null),e([a({json:{write:!0,origins:{"portal-item":{write:!1},"web-map":{write:!1},"web-scene":{write:!1}}}})],C.prototype,`curveRings`,void 0),e([v(`curveRings`)],C.prototype,`writeCurveRings`,null),e([a({readOnly:!0})],C.prototype,`extent`,null),e([a({type:[[[Number]]],json:{write:{isRequired:!0}}})],C.prototype,`rings`,void 0),e([v(`rings`)],C.prototype,`writeRings`,null),C=y=e([o(`esri.geometry.Polygon`)],C),C.prototype.toJSON.isDefaultToJSON=!0;export{C as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import{JSONSupport as n}from"../core/JSONSupport.js";import{clone as r}from"../core/lang.js";import{getMetersPerUnitForSR as i,getUnitString as a}from"../core/units.js";import{Integer as o}from"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{isWGS84 as u,isWebMercator as d,isGeographic as f,isWrappable as p,wgs84 as m,webMercator as h,equals as g,plateCarree as _}from"./support/spatialReferenceUtils.js";var v;let y=class extends n{static{v=this}static{this.GCS_NAD_1927=null}static{this.WGS84=null}static{this.WebMercator=null}static{this.PlateCarree=null}static fromJSON(e){if(!e)return null;if(e.wkid===102100||e.wkid===4326){let t=Object.keys(e).length;if(t===1||e.wkid===102100&&e.latestWkid===3857&&t===2)return e.wkid===102100?v.WebMercator:v.WGS84}let t=new v;return t.read(e),t}constructor(e){super(e),this.latestWkid=null,this.wkid=null,this.wkt=null,this.wkt2=null,this.vcsWkid=null,this.latestVcsWkid=null,this.falseM=null,this.falseX=null,this.falseY=null,this.falseZ=null,this.mTolerance=null,this.mUnits=null,this.xyTolerance=null,this.xyUnits=null,this.zTolerance=null,this.zUnits=null,this.imageCoordinateSystem=null}normalizeCtorArgs(e){return e&&typeof e==`object`?e:typeof e==`string`?{wkt:e}:{wkid:e}}get cache(){return this.commitProperty(`wkid`),this.commitProperty(`latestWkid`),this.commitProperty(`vcsWkid`),this.commitProperty(`latestVcsWkid`),this.commitProperty(`wkt`),this.commitProperty(`wkt2`),this.commitProperty(`imageCoordinateSystem`),this.commitProperty(`falseM`),this.commitProperty(`falseX`),this.commitProperty(`falseY`),this.commitProperty(`falseZ`),this.commitProperty(`mTolerance`),this.commitProperty(`mUnits`),this.commitProperty(`xyTolerance`),this.commitProperty(`xyUnits`),this.commitProperty(`zTolerance`),this.commitProperty(`zUnits`),{}}get isWGS84(){return u(this)}get isWebMercator(){return d(this)}get isGeographic(){return f(this)}get isWrappable(){return p(this)}get metersPerUnit(){return i(this)}get unit(){return a(this)||(this.isGeographic?`degrees`:null)}writeWkt(e,t){this.wkid||(t.wkt=e)}clone(){if(this===v.WGS84)return new v(m);if(this===v.WebMercator)return new v(h);let e=new v;return this.wkid==null?(this.wkt!=null&&(e.wkt=this.wkt),this.wkt2!=null&&(e.wkt2=this.wkt2)):(e.wkid=this.wkid,this.latestWkid!=null&&(e.latestWkid=this.latestWkid),this.vcsWkid!=null&&(e.vcsWkid=this.vcsWkid),this.latestVcsWkid!=null&&(e.latestVcsWkid=this.latestVcsWkid)),this.imageCoordinateSystem&&(e.imageCoordinateSystem=r(this.imageCoordinateSystem)),this.falseM!=null&&(e.falseM=this.falseM),this.falseX!=null&&(e.falseX=this.falseX),this.falseY!=null&&(e.falseY=this.falseY),this.falseZ!=null&&(e.falseZ=this.falseZ),this.mTolerance!=null&&(e.mTolerance=this.mTolerance),this.mUnits!=null&&(e.mUnits=this.mUnits),this.xyTolerance!=null&&(e.xyTolerance=this.xyTolerance),this.xyUnits!=null&&(e.xyUnits=this.xyUnits),this.zTolerance!=null&&(e.zTolerance=this.zTolerance),this.zUnits!=null&&(e.zUnits=this.zUnits),e}equals(e){if(e==null)return!1;if(this.imageCoordinateSystem||e.imageCoordinateSystem){if(this.imageCoordinateSystem==null||e.imageCoordinateSystem==null)return!1;let{id:t,referenceServiceName:n}=e.imageCoordinateSystem,{geodataXform:r}=e.imageCoordinateSystem,i=this.imageCoordinateSystem;return t!=null&&!r?n?i.id===t&&i.referenceServiceName===n:i.id===t:JSON.stringify(i)===JSON.stringify(e.imageCoordinateSystem)}return g(this,e)}toJSON(e){return this.write(void 0,e)}};e([s({readOnly:!0})],y.prototype,`cache`,null),e([s({readOnly:!0})],y.prototype,`isWGS84`,null),e([s({readOnly:!0})],y.prototype,`isWebMercator`,null),e([s({readOnly:!0})],y.prototype,`isGeographic`,null),e([s({readOnly:!0})],y.prototype,`isWrappable`,null),e([s({type:o,json:{write:!0}})],y.prototype,`latestWkid`,void 0),e([s({readOnly:!0})],y.prototype,`metersPerUnit`,null),e([s({readOnly:!0})],y.prototype,`unit`,null),e([s({type:o,json:{write:!0,origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkt==null}}}}}}})],y.prototype,`wkid`,void 0),e([s({type:String,json:{origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkid==null}}}}}}})],y.prototype,`wkt`,void 0),e([l(`wkt`),l(`web-scene`,`wkt`)],y.prototype,`writeWkt`,null),e([s({type:String,json:{write:!1}})],y.prototype,`wkt2`,void 0),e([s({type:o,json:{write:!0}})],y.prototype,`vcsWkid`,void 0),e([s({type:o,json:{write:!0}})],y.prototype,`latestVcsWkid`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseM`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseX`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseY`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseZ`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`mTolerance`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`mUnits`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`xyTolerance`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`xyUnits`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`zTolerance`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`zUnits`,void 0),e([s()],y.prototype,`imageCoordinateSystem`,void 0),y=v=e([c(`esri.geometry.SpatialReference`)],y),y.prototype.toJSON.isDefaultToJSON=!0,y.GCS_NAD_1927=t.freeze(new y({wkid:4267,wkt:`GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]`})),y.WGS84=t.freeze(new y(m)),y.WebMercator=t.freeze(new y(h)),y.PlateCarree=t.freeze(new y(_));export{y as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import{JSONSupport as n}from"../core/JSONSupport.js";import{clone as r}from"../core/lang.js";import{getMetersPerUnitForSR as i,getUnitString as a}from"../core/units.js";import{Integer as o}from"../core/accessorSupport/ensureType.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{isWGS84 as u,isWebMercator as d,isGeographic as f,isWrappable as p,wgs84 as m,webMercator as h,equals as g,plateCarree as _}from"./support/spatialReferenceUtils.js";var v;let y=class extends n{static{v=this}static{this.GCS_NAD_1927=null}static{this.WGS84=null}static{this.WebMercator=null}static{this.PlateCarree=null}static fromJSON(e){if(!e)return null;if(e.wkid===102100||e.wkid===4326){let t=Object.keys(e).length;if(t===1||e.wkid===102100&&e.latestWkid===3857&&t===2)return e.wkid===102100?v.WebMercator:v.WGS84}let t=new v;return t.read(e),t}constructor(e){super(b(e)),this.latestWkid=null,this.wkid=null,this.wkt=null,this.wkt2=null,this.vcsWkid=null,this.latestVcsWkid=null,this.falseM=null,this.falseX=null,this.falseY=null,this.falseZ=null,this.mTolerance=null,this.mUnits=null,this.xyTolerance=null,this.xyUnits=null,this.zTolerance=null,this.zUnits=null,this.imageCoordinateSystem=null}get cache(){return this.commitProperty(`wkid`),this.commitProperty(`latestWkid`),this.commitProperty(`vcsWkid`),this.commitProperty(`latestVcsWkid`),this.commitProperty(`wkt`),this.commitProperty(`wkt2`),this.commitProperty(`imageCoordinateSystem`),this.commitProperty(`falseM`),this.commitProperty(`falseX`),this.commitProperty(`falseY`),this.commitProperty(`falseZ`),this.commitProperty(`mTolerance`),this.commitProperty(`mUnits`),this.commitProperty(`xyTolerance`),this.commitProperty(`xyUnits`),this.commitProperty(`zTolerance`),this.commitProperty(`zUnits`),{}}get isWGS84(){return u(this)}get isWebMercator(){return d(this)}get isGeographic(){return f(this)}get isWrappable(){return p(this)}get metersPerUnit(){return i(this)}get unit(){return a(this)||(this.isGeographic?`degrees`:null)}writeWkt(e,t){this.wkid||(t.wkt=e)}clone(){if(this===v.WGS84)return new v(m);if(this===v.WebMercator)return new v(h);let e=new v;return this.wkid==null?(this.wkt!=null&&(e.wkt=this.wkt),this.wkt2!=null&&(e.wkt2=this.wkt2)):(e.wkid=this.wkid,this.latestWkid!=null&&(e.latestWkid=this.latestWkid),this.vcsWkid!=null&&(e.vcsWkid=this.vcsWkid),this.latestVcsWkid!=null&&(e.latestVcsWkid=this.latestVcsWkid)),this.imageCoordinateSystem&&(e.imageCoordinateSystem=r(this.imageCoordinateSystem)),this.falseM!=null&&(e.falseM=this.falseM),this.falseX!=null&&(e.falseX=this.falseX),this.falseY!=null&&(e.falseY=this.falseY),this.falseZ!=null&&(e.falseZ=this.falseZ),this.mTolerance!=null&&(e.mTolerance=this.mTolerance),this.mUnits!=null&&(e.mUnits=this.mUnits),this.xyTolerance!=null&&(e.xyTolerance=this.xyTolerance),this.xyUnits!=null&&(e.xyUnits=this.xyUnits),this.zTolerance!=null&&(e.zTolerance=this.zTolerance),this.zUnits!=null&&(e.zUnits=this.zUnits),e}equals(e){if(e==null)return!1;if(this.imageCoordinateSystem||e.imageCoordinateSystem){if(this.imageCoordinateSystem==null||e.imageCoordinateSystem==null)return!1;let{id:t,referenceServiceName:n}=e.imageCoordinateSystem,{geodataXform:r}=e.imageCoordinateSystem,i=this.imageCoordinateSystem;return t!=null&&!r?n?i.id===t&&i.referenceServiceName===n:i.id===t:JSON.stringify(i)===JSON.stringify(e.imageCoordinateSystem)}return g(this,e)}toJSON(e){return this.write(void 0,e)}};e([s({readOnly:!0})],y.prototype,`cache`,null),e([s({readOnly:!0})],y.prototype,`isWGS84`,null),e([s({readOnly:!0})],y.prototype,`isWebMercator`,null),e([s({readOnly:!0})],y.prototype,`isGeographic`,null),e([s({readOnly:!0})],y.prototype,`isWrappable`,null),e([s({type:o,json:{write:!0}})],y.prototype,`latestWkid`,void 0),e([s({readOnly:!0})],y.prototype,`metersPerUnit`,null),e([s({readOnly:!0})],y.prototype,`unit`,null),e([s({type:o,json:{write:!0,origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkt==null}}}}}}})],y.prototype,`wkid`,void 0),e([s({type:String,json:{origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkid==null}}}}}}})],y.prototype,`wkt`,void 0),e([l(`wkt`),l(`web-scene`,`wkt`)],y.prototype,`writeWkt`,null),e([s({type:String,json:{write:!1}})],y.prototype,`wkt2`,void 0),e([s({type:o,json:{write:!0}})],y.prototype,`vcsWkid`,void 0),e([s({type:o,json:{write:!0}})],y.prototype,`latestVcsWkid`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseM`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseX`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseY`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`falseZ`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`mTolerance`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`mUnits`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`xyTolerance`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`xyUnits`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`zTolerance`,void 0),e([s({type:Number,json:{write:!0}})],y.prototype,`zUnits`,void 0),e([s()],y.prototype,`imageCoordinateSystem`,void 0),y=v=e([c(`esri.geometry.SpatialReference`)],y),y.prototype.toJSON.isDefaultToJSON=!0,y.GCS_NAD_1927=t.freeze(new y({wkid:4267,wkt:`GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]`})),y.WGS84=t.freeze(new y(m)),y.WebMercator=t.freeze(new y(h)),y.PlateCarree=t.freeze(new y(_));function b(e){return e&&typeof e==`object`?e:typeof e==`string`?{wkt:e}:{wkid:e}}export{y as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clone as e}from"../../core/lang.js";import{assertNotMesh as t}from"../asserts.js";import n from"../SpatialReference.js";import{earth as r}from"./Ellipsoid.js";import{equals as i,isWebMercator as a,isWGS84 as o,webMercatorValid as s}from"./spatialReferenceUtils.js";function c(e){return e*57.29577951308232}function l(e){return e*.017453292519943}function u(e){return e/r.radius}function d(e){return Math.PI/2-2*Math.atan(Math.exp(-e/r.radius))}function f(e){return e.wkid!=null||e.wkt!=null}const p=[0,0];function m(e,t,n,r,i){let a=e,o=i;if(o.spatialReference=n,`x`in a&&`x`in o)[o.x,o.y]=t(a.x,a.y,p,r);else if(`xmin`in a&&`xmin`in o)[o.xmin,o.ymin]=t(a.xmin,a.ymin,p,r),[o.xmax,o.ymax]=t(a.xmax,a.ymax,p,r);else if(`paths`in a&&`paths`in o||`rings`in a&&`rings`in o){let e=`paths`in a?a.paths:a.rings,n=[],i;for(let a=0;a<e.length;a++){let o=e[a];i=[],n.push(i);for(let e=0;e<o.length;e++)i.push(t(o[e][0],o[e][1],[0,0],r)),o[e].length>2&&i[e].push(o[e][2]),o[e].length>3&&i[e].push(o[e][3])}`paths`in o?o.paths=n:o.rings=n}else if(`points`in a&&`points`in o){let e=a.points,n=[];for(let i=0;i<e.length;i++)n[i]=t(e[i][0],e[i][1],[0,0],r),e[i].length>2&&n[i].push(e[i][2]),e[i].length>3&&n[i].push(e[i][3]);o.points=n}return i}function h(e,t){let n=e&&(f(e)?e:e.spatialReference),r=t&&(f(t)?t:t.spatialReference);return e&&`type`in e&&e.type===`mesh`||t&&`type`in t&&t.type===`mesh`||!n||!r?!1:i(r,n)?!0:a(r)&&o(n)||a(n)&&o(r)}function g(t,r){if(t==null)return null;let s=t.spatialReference,c=r&&(f(r)?r:r.spatialReference);return h(s,c)?i(s,c)?e(t):a(c)?m(t,_,n.WebMercator,!1,e(t)):o(c)?m(t,v,n.WGS84,!1,e(t)):null:null}function _(e,t,n=[0,0]){t>89.99999?t=89.99999:t<-89.99999&&(t=-89.99999);let i=l(t);return n[0]=l(e)*r.radius,n[1]=r.halfSemiMajorAxis*Math.log((1+Math.sin(i))/(1-Math.sin(i))),n}function v(e,t,n=[0,0],i=!1){if(e===s[0])n[0]=-180;else if(e===s[1])n[0]=180;else{let t=c(e/r.radius);n[0]=i?t:t-Math.floor((t+180)/360)*360}return n[1]=c(Math.PI/2-2*Math.atan(Math.exp(-t/r.radius))),n}function y(r,i=!1,a=e(r)){return t(r),t(a),m(r,_,n.WebMercator,i,a)}function b(r,i=!1,a=e(r)){return t(r),t(a),m(r,v,n.WGS84,i,a)}export{h as canProject,y as geographicToWebMercator,_ as lngLatToXY,g as project,b as webMercatorToGeographic,u as x2lon,v as xyToLngLat,d as y2lat};
2
+ import{clone as e}from"../../core/lang.js";import{assertNotMesh as t}from"../asserts.js";import n from"../SpatialReference.js";import{earth as r}from"./Ellipsoid.js";import{equals as i,isWebMercator as a,isWGS84 as o,webMercatorValid as s}from"./spatialReferenceUtils.js";function c(e){return e*57.29577951308232}function l(e){return e*.017453292519943}function u(e){return e/r.radius}function d(e){return Math.PI/2-2*Math.atan(Math.exp(-e/r.radius))}function f(e){return e.wkid!=null||e.wkt!=null}const p=[0,0];function m(e,t,n,r,i){let a=e,o=i;if(o.spatialReference=n,`x`in a&&`x`in o)[o.x,o.y]=t(a.x,a.y,p,r);else if(`xmin`in a&&`xmin`in o)[o.xmin,o.ymin]=t(a.xmin,a.ymin,p,r),[o.xmax,o.ymax]=t(a.xmax,a.ymax,p,r);else if(`paths`in a&&`paths`in o||`rings`in a&&`rings`in o){let e=`paths`in a?a.paths:a.rings,n=[],i;for(let a=0;a<e.length;a++){let o=e[a];i=[],n.push(i);for(let e=0;e<o.length;e++)i.push(t(o[e][0],o[e][1],[0,0],r)),o[e].length>2&&i[e].push(o[e][2]),o[e].length>3&&i[e].push(o[e][3])}`paths`in o?o.paths=n:o.rings=n}else if(`points`in a&&`points`in o){let e=a.points,n=[];for(let i=0;i<e.length;i++)n[i]=t(e[i][0],e[i][1],[0,0],r),e[i].length>2&&n[i].push(e[i][2]),e[i].length>3&&n[i].push(e[i][3]);o.points=n}return i}function h(e,t){let n=e&&(f(e)?e:e.spatialReference),r=t&&(f(t)?t:t.spatialReference);return e&&`type`in e&&e.type===`mesh`||t&&`type`in t&&t.type===`mesh`||!n||!r?!1:i(r,n)?!0:a(r)&&o(n)||a(n)&&o(r)}function g(t,n){let r=_(t,n);return r===t?e(r):r}function _(t,r){if(t==null)return null;let s=t.spatialReference,c=r&&(f(r)?r:r.spatialReference);return h(s,c)?i(s,c)?t:a(c)?m(t,v,n.WebMercator,!1,e(t)):o(c)?m(t,y,n.WGS84,!1,e(t)):null:null}function v(e,t,n=[0,0]){t>89.99999?t=89.99999:t<-89.99999&&(t=-89.99999);let i=l(t);return n[0]=l(e)*r.radius,n[1]=r.halfSemiMajorAxis*Math.log((1+Math.sin(i))/(1-Math.sin(i))),n}function y(e,t,n=[0,0],i=!1){if(e===s[0])n[0]=-180;else if(e===s[1])n[0]=180;else{let t=c(e/r.radius);n[0]=i?t:t-Math.floor((t+180)/360)*360}return n[1]=c(Math.PI/2-2*Math.atan(Math.exp(-t/r.radius))),n}function b(r,i=!1,a=e(r)){return t(r),t(a),m(r,v,n.WebMercator,i,a)}function x(r,i=!1,a=e(r)){return t(r),t(a),m(r,y,n.WGS84,i,a)}export{h as canProject,b as geographicToWebMercator,v as lngLatToXY,g as project,_ as projectIfNeeded,x as webMercatorToGeographic,u as x2lon,y as xyToLngLat,d as y2lat};
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`6.0`;let n=`6.0`;n=`6.0.0-next.42`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
2
+ import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`6.0`;let n=`6.0`;n=`6.0.0-next.43`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import r from"../PopupTemplate.js";import i from"../request.js";import{ClonableMixin as a}from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{disposable as ee,makeHandle as te}from"../core/handleUtils.js";import{clone as c}from"../core/lang.js";import ne from"../core/Logger.js";import{destroyMaybe as re}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as ie}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{debounce as ae,throwIfAbortError as oe,whenOrAbort as se,onAbort as ce}from"../core/promiseUtils.js";import{sqlAnd as le}from"../core/sql.js";import{property as u,subclass as ue}from"../core/accessorSupport/decorators.js";import{excludeTables as d}from"../core/accessorSupport/layerContainerType.js";import de from"../form/FormTemplate.js";import fe from"../geometry/SpatialReference.js";import pe from"../graphic/FeatureGraphicOrigin.js";import me from"./Layer.js";import{MemorySource as f}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as he}from"./mixins/APIKeyMixin.js";import{ArcGISService as p}from"./mixins/ArcGISService.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DataSeriesLayer as g}from"./mixins/DataSeriesLayer.js";import{DisplayFilteredLayer as _}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as v}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as y}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as b}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as x}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{OrderedLayer as C}from"./mixins/OrderedLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{PublishableLayer as T}from"./mixins/PublishableLayer.js";import{RefreshableLayer as E}from"./mixins/RefreshableLayer.js";import{ReloadableLayer as D}from"./mixins/ReloadableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as k}from"./mixins/TemporalLayer.js";import{TrackableLayer as A}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as j,parse as M,cleanTitle as N}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as P,id as F,labelsVisible as I,opacityDrawingInfo as L,legendEnabled as R,listMode as ge,popupEnabled as _e,screenSizePerspectiveEnabled as ve}from"./support/commonProperties.js";import{ensureLayerCredential as ye,computeEffectiveEditingEnabled as be,readGlobalIdField as xe,readObjectIdField as Se,createDefaultRenderer as Ce,addAttachment as we,updateAttachment as Te,applyEdits as Ee,uploadAssets as De,createQuery as Oe,deleteAttachments as ke,fetchRecomputedExtents as Ae,getFeatureType as je,getFieldDomain as Me,queryAttachments as Ne,queryObjectIds as Pe,queryFeatureCount as Fe,queryExtent as Ie,queryRelatedFeatures as Le,queryRelatedFeaturesCount as Re,validateBinsQuery as ze,hasDataChanged as Be,geometryTypeKebabDict as z}from"./support/featureLayerUtils.js";import B from"./support/FeatureTemplate.js";import V from"./support/FeatureType.js";import Ve from"./support/FieldConfiguration.js";import{popupTemplateWithFieldConfigurations as He,fieldConfigurationsFromPopupTemplate as Ue,fieldConfigurationsFromFields as We}from"./support/fieldConfigUtils.js";import{defineFieldProperties as Ge}from"./support/fieldProperties.js";import{fixRendererFields as H,fixTimeInfoFields as Ke}from"./support/fieldUtils.js";import qe from"./support/LabelClass.js";import{reader as U}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Je}from"./support/serviceCapabilitiesUtils.js";import W from"./support/SymbolLayerDrawing.js";import Ye from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Xe}from"./support/versionUtils.js";import{read as Ze}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Qe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as $e,rendererTypes as et}from"../renderers/support/typeUtils.js";import{dynamicDataSourceTypes as tt}from"../rest/layerSources/typeUtils.js";import nt from"../rest/support/FeatureSet.js";import G from"../rest/support/Query.js";import{isNumber as rt}from"../support/guards.js";import{createPopupTemplate as it}from"../support/popupUtils.js";import{symbolTypes as at}from"../symbols/support/typeUtils.js";import{opacityToTransparency as ot}from"../webdoc/support/opacityUtils.js";import{addLayerUnsupportedError as K}from"../webdoc/support/unsupportedErrors.js";import{reader as q}from"../core/accessorSupport/decorators/reader.js";import{writer as J}from"../core/accessorSupport/decorators/writer.js";const Y=`FeatureLayer`;function X(e){return e&&e instanceof o}const Z=Ge();function Q(e,t,n){let r=!!n?.writeLayerSchema;return{enabled:r,ignoreOrigin:r}}let $=class extends D(b(x(y(T(v(_(m(C(k(g(A(O(E(p(S(w(ie(h(he(a(me))))))))))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new pe(this),this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.symbolLayerDrawing=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType=`ArcGISFeatureLayer`,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=fe.WGS84,this.subtypeCode=null,this.subtypeField=null,this.subtypes=null,this.supportedPortalItemTypes=[`Feature Service`,`Feature Collection`,`Scene Service`],this.supportedSourceTypes=new Set([`Feature Layer`,`Oriented Imagery Layer`,`Table`,`Catalog Layer`]),this.templates=null,this.title=null,this.sublayerTitleMode=`item-title`,this.type=`feature`,this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=ae(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/featureLayerUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}})}destroy(){this.source?.destroy()}load(e){let t=e==null?null:e.signal;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then(e=>this.initLayerProperties(e))),Promise.resolve(this);let n=this.loadFromPortal({supportedTypes:this.supportedPortalItemTypes},e).catch(oe).then(async()=>{if(this.url&&this.layerId==null&&/FeatureServer|MapServer\/*$/i.test(this.url)){let e=await this._fetchFirstValidLayerId(t);e!=null&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s(`feature-layer:missing-url-or-source`,`Feature layer must be created with either a url or a source`);return this.initLayerProperties(await this.createGraphicsSource(t))}).then(()=>ye(this,`load`,e));return this.addResolvingPromise(n),Promise.resolve(this)}get _titleCreator(){let e=this._get(`_titleCreator`);return re(e),new Ye({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Je(t,this.url)}get createQueryVersion(){return this.commitProperty(`definitionExpression`),this.commitProperty(`dynamicDataSource`),this.commitProperty(`timeExtent`),this.commitProperty(`timeOffset`),this.commitProperty(`geometryType`),this.commitProperty(`gdbVersion`),this.commitProperty(`historicMoment`),this.commitProperty(`returnZ`),this.commitProperty(`capabilities`),this.commitProperty(`returnM`),(this._get(`createQueryVersion`)??0)+1}get editingEnabled(){return this.loaded&&!this.capabilities?.operations.supportsEditing?!1:this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this._hasMemorySource()||this.userHasEditingPrivileges}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,n){return this._readEditingEnabled(t,!0,n)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,n,r){this._writeEditingEnabled(e,t,!0,r)}get effectiveEditingEnabled(){return be(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}set fieldConfigurations(e){if(this._hasMemorySource()||(this._override(`fieldConfigurations`,e),!this.loaded))return;let t=He(this,e);t&&this._set(`popupTemplate`,t)}get fieldConfigurations(){if(!this._hasMemorySource())return this._isOverridden(`fieldConfigurations`)?this._get(`fieldConfigurations`):Ue(this)||null}readIsTable(e,t){return t=t?.layerDefinition??t,t.type===`Table`||!t.geometryType}writeIsTable(e,t,n,r){r?.writeLayerSchema&&l(n,e?`Table`:`Feature Layer`,t)}readSymbolLayerDrawing(e,t){let n=t.layerDefinition?.drawingInfo,r=n?.renderer,i=n?.symbolLayerDrawing;return r&&i?new W(i):null}readGlobalIdField(e,t){return xe(t.layerDefinition||t)}readObjectIdField(e,t){return Se(t.layerDefinition||t)}writePopupTemplate(e,t,n,r){e&&(t[n]=e.toJSON({...r,writeFieldFormat:!r?.writeLayerSchema}))}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){H(e,this.fieldsIndex),this._set(`renderer`,e)}readRenderer(e,t,n){t=t.layerDefinition||t;let r=t.drawingInfo?.renderer;if(r){let e=Ze(r,t,n)??void 0;return e||ne.getLogger(this).error(`Failed to create renderer`,{rendererDefinition:t.drawingInfo.renderer,layer:this,context:n}),e}return Ce(t,n)}get source(){return this._get(`source`)}set source(e){e||=null;let t=this._get(`source`);t!==e&&((Array.isArray(e)||e instanceof o)&&(e=new f({layer:this,items:e})),X(t)&&this._resetMemorySource(t),X(e)&&this._initMemorySource(e),this._set(`source`,e))}readSource(e,t){let n=nt.fromJSON(t.featureSet);return new f({layer:this,items:n?.features??[]})}readTemplates(e,t){let n=t.editFieldsInfo,r=n?.creatorField,i=n?.editorField;return e=e?.map(e=>B.fromJSON(e)),this._fixTemplates(e,r),this._fixTemplates(e,i),e}readTitle(e,t){let n=t.layerDefinition?.name??t.name,r=t.title||t.layerDefinition?.title;if(n){if(this.sublayerTitleMode===`item-title`)return this.url?j(this.url,n):n;let e=n;if(!e&&this.url){let t=M(this.url);t!=null&&(e=t.title)}if(!e)return;let t=this.portalItem?.title;return this.sublayerTitleMode===`item-title-and-service-name`&&t&&t!==e&&(e=t+` - `+e),N(e)}if(this.sublayerTitleMode===`item-title`&&r)return r}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){t=t.layerDefinition||t;let n=t.typeIdField;if(n&&t.fields){n=n.toLowerCase();let e=t.fields.find(e=>e.name.toLowerCase()===n);e&&(n=e.name)}return n}readTypes(e,t){t=t.layerDefinition||t,e=t.types;let n=t.editFieldsInfo,r=n?.creatorField,i=n?.editorField;return e?.map(e=>(e=V.fromJSON(e),this._fixTemplates(e.templates,r),this._fixTemplates(e.templates,i),e))}readVisible(e,t){if(t.layerDefinition?.defaultVisibility!=null)return!!t.layerDefinition.defaultVisibility;if(t.visibility!=null)return!!t.visibility}async addAttachment(e,t,n){let r=await we(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,n,r){let i=await Te(this,e,t,n,Y,r);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return Ee(this,e,t)}async uploadAssets(e,t){return De(this,e,t)}createFieldConfigurations(){return We(this)}createPopupTemplate(e){return it(this,e)}async createGraphicsSource(n){let r={stack:[],error:void 0,hasError:!1};try{if(this._hasMemorySource()&&this.source)return this.source.load({signal:n});let{default:t}=await se(import(`./graphics/sources/FeatureLayerSource.js`),n),i=new t({layer:this,supportedSourceTypes:this.supportedSourceTypes});return e(r,ee(ce(n,()=>i.cancelLoad())??te()),!1),await i.load({signal:n}),i}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}createQuery(){let e=Oe(this);e.dynamicDataSource=this.dynamicDataSource;let t=this.subtypeCode==null?null:`${this.subtypeField} = ${this.subtypeCode}`;return e.where=le(this.definitionExpression,t)||`1=1`,e}async deleteAttachments(e,t,n){let r=await ke(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return Ae(this,e,Y)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return je(this.types,this.typeIdField,e)}getFieldAlias(e){let t=this.getField(e);if(t)return this.getFieldConfiguration(t.name)?.alias||t.alias}getFieldConfiguration(e){return e=e.toLowerCase(),this.fieldConfigurations?.find(t=>t.name.toLowerCase()===e)}getFieldDomain(e,t){return Me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return Ne(this,e,t,Y)}async queryFeatures(e,t){let n=await this.load(),r=await n.source.queryFeatures(G.from(e)??n.createQuery(),t),i=this.graphicOrigin;if(r?.features)for(let e of r.features)e.layer=e.sourceLayer=n,e.origin=i;return r}async queryObjectIds(e,t){return await Pe(this,e,t,Y)}async queryFeatureCount(e,t){return Fe(this,e,t,Y)}async queryExtent(e,t){return Ie(this,e,t,Y)}async queryRelatedFeatures(e,t){return Le(this,e,t,Y)}async queryRelatedFeaturesCount(e,t){return Re(this,e,t,Y)}async queryPivot(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryPivot||!r?.operations?.supportsQueryPivot)throw new s(Y,`Layer source does not support queryPivot capability`);let i=await import(`../rest/support/PivotQuery.js`),a=await n.queryPivot(i.default.from(e),t),o=this.graphicOrigin;if(a?.features)for(let e of a.features)e.layer=e.sourceLayer=this,e.origin=o;return a}async queryTopFeatures(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopFeatures||!r?.query?.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryTopFeatures capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`),a=await n.queryTopFeatures(i.default.from(e),t),o=this.graphicOrigin;if(a?.features)for(let e of a.features)e.layer=e.sourceLayer=this,e.origin=o;return a}async queryAttributeBins(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryAttributeBins)throw new s(Y,`Layer source does not support queryAttributeBins capability`);ze(e,r,Y);let i=await import(`../rest/support/AttributeBinsQuery.js`),a=await n.queryAttributeBins(i.default.from(e),t),o=this.graphicOrigin;if(a.features)for(let e of a.features)e.layer=e.sourceLayer=this,e.origin=o;return a}async queryTopObjectIds(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopObjectIds||!r?.query.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryTopObjectIds capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`);return(await n.queryTopObjectIds(i.default.from(e),t)).filter(rt)}async queryTopFeaturesExtent(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopExtents||!r?.query?.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryTopExtents capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`);return n.queryTopExtents(i.default.from(e),t)}async queryTopFeatureCount(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopCount||!r?.query?.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryFeatureCount capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`);return n.queryTopCount(i.default.from(e),t)}read(e,t){let n=e.featureCollection;if((n||e.type===`Feature Collection`)&&(this.resourceInfo=e),n){let{layers:e,showLegend:r}=n;e?.length===1&&(super.read(e[0],t),r!=null&&super.read({showLegend:r},t))}super.read(e,t),X(this.source)&&t?.origin===`service`&&([`objectIdField`,`fields`,`timeInfo`,`dateFieldsTimeZone`,`uniqueIdFields`].forEach(e=>{this.revertToOrigin(e,`service`)}),this.spatialReference||this.revertToOrigin(`spatialReference`,`service`))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};let{origin:n,layerContainerType:r}=t;if(this.dynamicDataSource)return K(t,this,`a dynamic data source cannot be written to web scenes, web maps and feature service items`),null;if(this.isTable){if((n===`web-map`||n===`web-scene`)&&r!==`tables`)return K(t,this,`a table source can only be written to tables`),null;if(this._hasMemorySource())return K(t,this,`an in-memory table source cannot be written to web scenes and web maps`),null}else if(this.loaded&&(n===`web-map`||n===`web-scene`)&&r===`tables`)return K(t,this,`a non-table source cannot be written to tables in web maps or web scenes`),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Y,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return this.loaded?this.source?.type===`memory`||Xe(this,e):!1}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}_readEditingEnabled(e,t,n){let r=e.layerDefinition?.capabilities;if(r||(r=e.capabilities,t&&n?.origin===`web-map`&&!this._hasMemorySource()&&r))return this._hasEditingCapability(r)}_hasEditingCapability(e){return e.toLowerCase().split(`,`).map(e=>e.trim()).includes(`editing`)}_writeEditingEnabled(e,t,n,r){if(!e){let e=this.capabilities?.operations?.supportsSync?`Query,Sync`:`Query`;l(`layerDefinition.capabilities`,e,t),n&&!r?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return i(this.url??``,{query:{f:`json`,...this.customParameters,token:this.apiKey},responseType:`json`,signal:e}).then(e=>{let t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)})}async initLayerProperties(e){return this._set(`source`,e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:`service`,portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),H(this.renderer,this.fieldsIndex),Ke(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&this.geometryType===`mesh`&&(this.capabilities.query.supportsReturnMesh=!0),Qe(this,{origin:`service`})}canReload(){return super.canReload()&&!this._hasMemorySource()}async reloadFromService(e){let t=this.source;await t.reload({signal:e}),await this.initLayerProperties(t)}async hasDataChanged(){return Be(this)}async fetchPublishingStatus(){let e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():`unavailable`}_verifyFields(){let e=this.parsedUrl?.path??`undefined`;this.objectIdField||console.log(`FeatureLayer: 'objectIdField' property is not defined (url: `+e+`)`),this.isTable||this._hasMemorySource()||e.search(/\/FeatureServer\//i)!==-1||this.fields?.some(e=>e.type===`geometry`)||console.log(`FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: `+e+`)`)}_fixTemplates(e,t){e&&e.forEach(e=>{let n=e.prototype?.attributes;n&&t&&delete n[t]})}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s(`feature-layer:mixed-source-and-url`,`FeatureLayer cannot be created with both an in-memory source and a url`)}else if(!this.url)throw new s(`feature-layer:source-or-url-required`,`FeatureLayer requires either a url, a valid portal item or a source`)}_initMemorySource(e){e.forEach(e=>{e.layer=this,e.sourceLayer=this}),this.addHandles([e.on(`after-add`,e=>{e.item.layer=this,e.item.sourceLayer=this}),e.on(`after-remove`,e=>{e.item.layer=null,e.item.sourceLayer=null})],`fl-source`)}_resetMemorySource(e){e.forEach(e=>{e.layer=null,e.sourceLayer=null}),this.removeHandles(`fl-source`)}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return[...e.layers||[],...e.tables||[]].find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id}};n([u({clonable:!1,readOnly:!0})],$.prototype,`_titleCreator`,null),n([u(P)],$.prototype,`attributeTableTemplate`,void 0),n([q(`service`,`capabilities`)],$.prototype,`readCapabilities`,null),n([u({json:{origins:{"web-scene":{write:!1}},write:!0}})],$.prototype,`charts`,void 0),n([u({readOnly:!0})],$.prototype,`createQueryVersion`,null),n([u({json:{read:{source:`layerDefinition.copyrightText`}}})],$.prototype,`copyright`,void 0),n([u({json:{read:{source:`layerDefinition.displayField`}}})],$.prototype,`displayField`,void 0),n([u({types:at,readOnly:!0})],$.prototype,`defaultSymbol`,void 0),n([u({types:tt})],$.prototype,`dynamicDataSource`,void 0),n([u({type:Boolean})],$.prototype,`editingEnabled`,null),n([q([`portal-item`,`web-scene`],`editingEnabled`,[`layerDefinition.capabilities`])],$.prototype,`readEditingEnabled`,null),n([q(`web-map`,`editingEnabled`,[`capabilities`,`layerDefinition.capabilities`])],$.prototype,`readEditingEnabledFromWebMap`,null),n([J([`portal-item`,`web-scene`],`editingEnabled`,{"layerDefinition.capabilities":{type:String}})],$.prototype,`writeEditingEnabled`,null),n([J(`web-map`,`editingEnabled`,{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],$.prototype,`writeEditingEnabledToWebMap`,null),n([u({readOnly:!0})],$.prototype,`effectiveEditingEnabled`,null),n([u({clonable:!1,readOnly:!0})],$.prototype,`featureTitleFields`,null),n([u({type:[Ve],json:{name:`layerDefinition.fieldConfigurations`,write:{overridePolicy(e,t,n){return{enabled:!n?.writeLayerSchema,ignoreOrigin:this.originIdOf(t)===1}}}}})],$.prototype,`fieldConfigurations`,null),n([u({...Z.fields,json:{read:{source:`layerDefinition.fields`},origins:{service:{name:`fields`},"web-map":{write:{target:`layerDefinition.fields`,overridePolicy:Q}}}}})],$.prototype,`fields`,void 0),n([u(Z.fieldsIndex)],$.prototype,`fieldsIndex`,void 0),n([u({type:de,json:{name:`formInfo`,write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],$.prototype,`formTemplate`,void 0),n([u({json:{read:{source:`layerDefinition.extent`}}})],$.prototype,`fullExtent`,void 0),n([u({json:{origins:{"web-map":{write:{target:`layerDefinition.geometryType`,overridePolicy:Q,writer(e,t,n){let r=e?z.toJSON(e):null;r&&l(n,r,t)}}}},read:{source:`layerDefinition.geometryType`,reader:z.read}}})],$.prototype,`geometryType`,void 0),n([u({readOnly:!0,clonable:!1})],$.prototype,`graphicOrigin`,void 0),n([u({json:{read:{source:`layerDefinition.hasM`}}})],$.prototype,`hasM`,void 0),n([u({json:{read:{source:`layerDefinition.hasZ`}}})],$.prototype,`hasZ`,void 0),n([u(F)],$.prototype,`id`,void 0),n([u({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],$.prototype,`infoFor3D`,void 0),n([u({json:{origins:{"web-map":{write:{target:`layerDefinition.type`}}}}})],$.prototype,`isTable`,void 0),n([q(`service`,`isTable`,[`type`,`geometryType`]),q(`isTable`,[`layerDefinition.type`,`layerDefinition.geometryType`])],$.prototype,`readIsTable`,null),n([J(`web-map`,`isTable`)],$.prototype,`writeIsTable`,null),n([u(I)],$.prototype,`labelsVisible`,void 0),n([u({type:[qe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:U,write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:U,write:{layerContainerTypes:d}}})],$.prototype,`labelingInfo`,void 0),n([u({type:W,json:{name:`layerDefinition.drawingInfo.symbolLayerDrawing`,write:!0,origins:{"web-scene":{write:!1}}}})],$.prototype,`symbolLayerDrawing`,void 0),n([q([`portal-item`,`web-map`],`symbolLayerDrawing`,[`layerDefinition.drawingInfo.renderer`,`layerDefinition.drawingInfo.symbolLayerDrawing`])],$.prototype,`readSymbolLayerDrawing`,null),n([u((()=>{let e=c(L);return e.json.origins[`portal-item`]={write:{target:`layerDefinition.drawingInfo.transparency`,writer(e,t,n){l(n,ot(e),t)}}},e})())],$.prototype,`opacity`,void 0),n([u(R)],$.prototype,`legendEnabled`,void 0),n([u({type:[`show`,`hide`],json:(()=>{let e=c(ge.json);return e.origins[`portal-item`]={read:!1,write:!1},e})()})],$.prototype,`listMode`,void 0),n([q(`globalIdField`,[`layerDefinition.globalIdField`,`layerDefinition.fields`])],$.prototype,`readGlobalIdField`,null),n([u({json:{origins:{"web-map":{write:{target:`layerDefinition.objectIdField`,overridePolicy:Q}}}}})],$.prototype,`objectIdField`,void 0),n([q(`objectIdField`,[`layerDefinition.objectIdField`,`layerDefinition.fields`])],$.prototype,`readObjectIdField`,null),n([u({type:[`ArcGISFeatureLayer`],json:{write:{target:`layerType`,ignoreOrigin:!0,layerContainerTypes:d}}})],$.prototype,`operationalLayerType`,void 0),n([u(Z.outFields)],$.prototype,`outFields`,void 0),n([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],$.prototype,`path`,void 0),n([u(_e)],$.prototype,`popupEnabled`,void 0),n([u({type:r,json:{name:`popupInfo`,write:!0}})],$.prototype,`popupTemplate`,void 0),n([J(`popupTemplate`)],$.prototype,`writePopupTemplate`,null),n([u({readOnly:!0})],$.prototype,`defaultPopupTemplate`,null),n([u({types:et,json:{origins:{service:{write:{target:`drawingInfo.renderer`,enabled:!1}},"web-scene":{types:$e,name:`layerDefinition.drawingInfo.renderer`,write:{layerContainerTypes:d,overridePolicy(e,t,n){return{ignoreOrigin:n?.writeLayerSchema,layerContainerTypes:d}}}}},write:{target:`layerDefinition.drawingInfo.renderer`,overridePolicy(e,t,n){return{ignoreOrigin:n?.writeLayerSchema,layerContainerTypes:d}}}}})],$.prototype,`renderer`,null),n([q(`service`,`renderer`,[`drawingInfo.renderer`,`defaultSymbol`]),q(`renderer`,[`layerDefinition.drawingInfo.renderer`,`layerDefinition.defaultSymbol`])],$.prototype,`readRenderer`,null),n([u()],$.prototype,`resourceInfo`,void 0),n([u((()=>{let e=c(ve);return e.json.origins[`portal-item`]={read:!1,write:!1},e})())],$.prototype,`screenSizePerspectiveEnabled`,void 0),n([u({clonable:!1})],$.prototype,`source`,null),n([q(`portal-item`,`source`,[`featureSet`]),q(`web-map`,`source`,[`featureSet`])],$.prototype,`readSource`,null),n([u({json:{read:{source:`layerDefinition.extent.spatialReference`}}})],$.prototype,`spatialReference`,void 0),n([u({type:Number})],$.prototype,`subtypeCode`,void 0),n([u({readOnly:!1})],$.prototype,`subtypeField`,void 0),n([u({readOnly:!1})],$.prototype,`subtypes`,void 0),n([u({type:[B]})],$.prototype,`templates`,void 0),n([q(`templates`,[`editFieldsInfo`,`creatorField`,`editorField`,`templates`])],$.prototype,`readTemplates`,null),n([u()],$.prototype,`title`,void 0),n([q(`service`,`title`,[`name`]),q(`portal-item`,`title`,[`layerDefinition.title`,`layerDefinition.name`,`title`])],$.prototype,`readTitle`,null),n([q(`web-map`,`title`,[`layerDefinition.name`,`title`])],$.prototype,`readTitleFromWebMap`,null),n([u({type:String})],$.prototype,`sublayerTitleMode`,void 0),n([u({json:{read:!1}})],$.prototype,`type`,void 0),n([u({type:String})],$.prototype,`typeIdField`,void 0),n([q(`service`,`typeIdField`),q(`typeIdField`,[`layerDefinition.typeIdField`])],$.prototype,`readTypeIdField`,null),n([u({type:[V]})],$.prototype,`types`,void 0),n([q(`service`,`types`,[`types`]),q(`types`,[`layerDefinition.types`])],$.prototype,`readTypes`,null),n([u({type:Boolean,json:{origins:{"portal-item":{write:{target:`layerDefinition.defaultVisibility`,layerContainerTypes:d}}}}})],$.prototype,`visible`,void 0),n([q(`portal-item`,`visible`,[`visibility`,`layerDefinition.defaultVisibility`])],$.prototype,`readVisible`,null),$=n([ue(`esri.layers.FeatureLayer`)],$);export{$ as default};
2
+ import{__addDisposableResource as e,__disposeResources as t,__decorate as n}from"tslib";import r from"../PopupTemplate.js";import i from"../request.js";import{ClonableMixin as a}from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{disposable as ee,makeHandle as te}from"../core/handleUtils.js";import{clone as c}from"../core/lang.js";import ne from"../core/Logger.js";import{destroyMaybe as re}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as ie}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as l}from"../core/object.js";import{debounce as ae,throwIfAbortError as oe,whenOrAbort as se,onAbort as ce}from"../core/promiseUtils.js";import{sqlAnd as le}from"../core/sql.js";import{property as u,subclass as ue}from"../core/accessorSupport/decorators.js";import{excludeTables as d}from"../core/accessorSupport/layerContainerType.js";import de from"../form/FormTemplate.js";import fe from"../geometry/SpatialReference.js";import pe from"../graphic/FeatureGraphicOrigin.js";import me from"./Layer.js";import{MemorySource as f}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as he}from"./mixins/APIKeyMixin.js";import{ArcGISService as p}from"./mixins/ArcGISService.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{CustomParametersMixin as h}from"./mixins/CustomParametersMixin.js";import{DataSeriesLayer as g}from"./mixins/DataSeriesLayer.js";import{DisplayFilteredLayer as _}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as v}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as y}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as b}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as x}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{OrderedLayer as C}from"./mixins/OrderedLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{PublishableLayer as T}from"./mixins/PublishableLayer.js";import{RefreshableLayer as E}from"./mixins/RefreshableLayer.js";import{ReloadableLayer as D}from"./mixins/ReloadableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as k}from"./mixins/TemporalLayer.js";import{TrackableLayer as A}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as j,parse as M,cleanTitle as N}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as P,id as F,labelsVisible as I,opacityDrawingInfo as L,legendEnabled as R,listMode as ge,popupEnabled as _e,screenSizePerspectiveEnabled as ve}from"./support/commonProperties.js";import{ensureLayerCredential as ye,computeEffectiveEditingEnabled as be,readGlobalIdField as xe,readObjectIdField as Se,createDefaultRenderer as Ce,addAttachment as we,updateAttachment as Te,applyEdits as Ee,uploadAssets as De,createQuery as Oe,deleteAttachments as ke,fetchRecomputedExtents as Ae,getFeatureType as je,getFieldDomain as Me,queryAttachments as Ne,queryObjectIds as Pe,queryFeatureCount as Fe,queryExtent as Ie,queryRelatedFeatures as Le,queryRelatedFeaturesCount as Re,validateBinsQuery as ze,hasDataChanged as Be,geometryTypeKebabDict as z}from"./support/featureLayerUtils.js";import B from"./support/FeatureTemplate.js";import V from"./support/FeatureType.js";import Ve from"./support/FieldConfiguration.js";import{popupTemplateWithFieldConfigurations as He,fieldConfigurationsFromPopupTemplate as Ue,fieldConfigurationsFromFields as We}from"./support/fieldConfigUtils.js";import{defineFieldProperties as Ge}from"./support/fieldProperties.js";import{fixRendererFields as H,fixTimeInfoFields as Ke}from"./support/fieldUtils.js";import qe from"./support/LabelClass.js";import{reader as U}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Je}from"./support/serviceCapabilitiesUtils.js";import W from"./support/SymbolLayerDrawing.js";import Ye from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Xe}from"./support/versionUtils.js";import{read as Ze}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Qe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as $e,rendererTypes as et}from"../renderers/support/typeUtils.js";import{dynamicDataSourceTypes as tt}from"../rest/layerSources/typeUtils.js";import nt from"../rest/support/FeatureSet.js";import G from"../rest/support/Query.js";import{isNumber as rt}from"../support/guards.js";import{createPopupTemplate as it}from"../support/popupUtils.js";import{symbolTypes as at}from"../symbols/support/typeUtils.js";import{opacityToTransparency as ot}from"../webdoc/support/opacityUtils.js";import{addLayerUnsupportedError as K}from"../webdoc/support/unsupportedErrors.js";import{reader as q}from"../core/accessorSupport/decorators/reader.js";import{writer as J}from"../core/accessorSupport/decorators/writer.js";const Y=`FeatureLayer`;function X(e){return e&&e instanceof o}const Z=Ge();function Q(e,t,n){let r=!!n?.writeLayerSchema;return{enabled:r,ignoreOrigin:r}}let $=class extends D(b(x(y(T(v(_(m(C(k(g(A(O(E(p(S(w(ie(h(he(a(me))))))))))))))))))))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new pe(this),this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.symbolLayerDrawing=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType=`ArcGISFeatureLayer`,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=fe.WGS84,this.subtypeCode=null,this.subtypeField=null,this.subtypes=null,this.supportedPortalItemTypes=[`Feature Service`,`Feature Collection`,`Scene Service`],this.supportedSourceTypes=new Set([`Feature Layer`,`Oriented Imagery Layer`,`Table`,`Catalog Layer`]),this.templates=null,this.title=null,this.sublayerTitleMode=`item-title`,this.type=`feature`,this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=ae(async(e,t,n)=>{let{save:r,saveAs:i}=await import(`./save/featureLayerUtils.js`);switch(e){case 0:return r(this,t);case 1:return i(this,n,t)}})}destroy(){this.source?.destroy()}load(e){let t=e==null?null:e.signal;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then(e=>this.initLayerProperties(e))),Promise.resolve(this);let n=this.loadFromPortal({supportedTypes:this.supportedPortalItemTypes},e).catch(oe).then(async()=>{if(this.url&&this.layerId==null&&/FeatureServer|MapServer\/*$/i.test(this.url)){let e=await this._fetchFirstValidLayerId(t);e!=null&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s(`feature-layer:missing-url-or-source`,`Feature layer must be created with either a url or a source`);return this.initLayerProperties(await this.createGraphicsSource(t))}).then(()=>ye(this,`load`,e));return this.addResolvingPromise(n),Promise.resolve(this)}get _titleCreator(){let e=this._get(`_titleCreator`);return re(e),new Ye({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Je(t,this.url)}get createQueryVersion(){return this.commitProperty(`definitionExpression`),this.commitProperty(`dynamicDataSource`),this.commitProperty(`timeExtent`),this.commitProperty(`timeOffset`),this.commitProperty(`geometryType`),this.commitProperty(`gdbVersion`),this.commitProperty(`historicMoment`),this.commitProperty(`returnZ`),this.commitProperty(`capabilities`),this.commitProperty(`returnM`),(this._get(`createQueryVersion`)??0)+1}get editingEnabled(){return this.loaded&&!this.capabilities?.operations.supportsEditing?!1:this._isOverridden(`editingEnabled`)?this._get(`editingEnabled`):this._hasMemorySource()||this.userHasEditingPrivileges}set editingEnabled(e){this._overrideIfSome(`editingEnabled`,e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,n){return this._readEditingEnabled(t,!0,n)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,n,r){this._writeEditingEnabled(e,t,!0,r)}get effectiveEditingEnabled(){return be(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}set fieldConfigurations(e){if(this._hasMemorySource()||(this._override(`fieldConfigurations`,e),!this.loaded))return;let t=He(this,e);t&&this._set(`popupTemplate`,t)}get fieldConfigurations(){if(!this._hasMemorySource())return this._isOverridden(`fieldConfigurations`)?this._get(`fieldConfigurations`):Ue(this)||null}readIsTable(e,t){return t=t?.layerDefinition??t,t.type===`Table`||!t.geometryType}writeIsTable(e,t,n,r){r?.writeLayerSchema&&l(n,e?`Table`:`Feature Layer`,t)}readSymbolLayerDrawing(e,t){let n=t.layerDefinition?.drawingInfo,r=n?.renderer,i=n?.symbolLayerDrawing;return r&&i?new W(i):null}readGlobalIdField(e,t){return xe(t.layerDefinition||t)}readObjectIdField(e,t){return Se(t.layerDefinition||t)}writePopupTemplate(e,t,n,r){e&&(t[n]=e.toJSON({...r,writeFieldFormat:!r?.writeLayerSchema}))}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){H(e,this.fieldsIndex),this._set(`renderer`,e)}readRenderer(e,t,n){t=t.layerDefinition||t;let r=t.drawingInfo?.renderer;if(r){let e=Ze(r,t,n)??void 0;return e||ne.getLogger(this).error(`Failed to create renderer`,{rendererDefinition:t.drawingInfo.renderer,layer:this,context:n}),e}return Ce(t,n)}get source(){return this._get(`source`)}set source(e){e||=null;let t=this._get(`source`);t!==e&&((Array.isArray(e)||e instanceof o)&&(e=new f({layer:this,items:e})),X(t)&&this._resetMemorySource(t),X(e)&&this._initMemorySource(e),this._set(`source`,e))}readSource(e,t){let n=nt.fromJSON(t.featureSet);return new f({layer:this,items:n?.features??[]})}readTemplates(e,t){let n=t.editFieldsInfo,r=n?.creatorField,i=n?.editorField;return e=e?.map(e=>B.fromJSON(e)),this._fixTemplates(e,r),this._fixTemplates(e,i),e}readTitle(e,t){let n=t.layerDefinition?.name??t.name,r=t.title||t.layerDefinition?.title;if(n){if(this.sublayerTitleMode===`item-title`)return this.url?j(this.url,n):n;let e=n;if(!e&&this.url){let t=M(this.url);t!=null&&(e=t.title)}if(!e)return;let t=this.portalItem?.title;return this.sublayerTitleMode===`item-title-and-service-name`&&t&&t!==e&&(e=t+` - `+e),N(e)}if(this.sublayerTitleMode===`item-title`&&r)return r}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){t=t.layerDefinition||t;let n=t.typeIdField;if(n&&t.fields){n=n.toLowerCase();let e=t.fields.find(e=>e.name.toLowerCase()===n);e&&(n=e.name)}return n}readTypes(e,t){t=t.layerDefinition||t,e=t.types;let n=t.editFieldsInfo,r=n?.creatorField,i=n?.editorField;return e?.map(e=>(e=V.fromJSON(e),this._fixTemplates(e.templates,r),this._fixTemplates(e.templates,i),e))}readVisible(e,t){if(t.layerDefinition?.defaultVisibility!=null)return!!t.layerDefinition.defaultVisibility;if(t.visibility!=null)return!!t.visibility}async addAttachment(e,t,n){let r=await we(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,n,r){let i=await Te(this,e,t,n,Y,r);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return Ee(this,e,t)}async uploadAssets(e,t){return De(this,e,t)}createFieldConfigurations(){return We(this)}createPopupTemplate(e){return it(this,e)}async createGraphicsSource(n){let r={stack:[],error:void 0,hasError:!1};try{if(this._hasMemorySource()&&this.source)return this.source.load({signal:n});let{default:t}=await se(import(`./graphics/sources/FeatureLayerSource.js`),n),i=new t({layer:this,supportedSourceTypes:this.supportedSourceTypes});return e(r,ee(ce(n,()=>i.cancelLoad())??te()),!1),await i.load({signal:n}),i}catch(e){r.error=e,r.hasError=!0}finally{t(r)}}createQuery(){let e=Oe(this);e.dynamicDataSource=this.dynamicDataSource;let t=this.subtypeCode==null?null:`${this.subtypeField} = ${this.subtypeCode}`;return e.where=le(this.definitionExpression,t)||`1=1`,e}async deleteAttachments(e,t,n){let r=await ke(this,e,t,Y,n);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return Ae(this,e,Y)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return je(this.types,this.typeIdField,e)}getFieldAlias(e){let t=this.getField(e);if(t)return this.getFieldConfiguration(t.name)?.alias||t.alias}getFieldConfiguration(e){return e=e.toLowerCase(),this.fieldConfigurations?.find(t=>t.name.toLowerCase()===e)}getFieldDomain(e,t){return Me(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return Ne(this,e,t,Y)}async queryFeatures(e,t){let n=await this.load(),r=await n.source.queryFeatures(G.from(e)??n.createQuery(),t),i=this.graphicOrigin;if(r?.features)for(let e of r.features)e.layer=e.sourceLayer=n,e.origin=i;return r}async queryObjectIds(e,t){return await Pe(this,e,t,Y)}async queryFeatureCount(e,t){return Fe(this,e,t,Y)}async queryExtent(e,t){return Ie(this,e,t,Y)}async queryRelatedFeatures(e,t){return Le(this,e,t,Y)}async queryRelatedFeaturesCount(e,t){return Re(this,e,t,Y)}async queryPivot(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryPivot||!r?.operations?.supportsQueryPivot)throw new s(Y,`Layer source does not support queryPivot capability`);let i=await import(`../rest/support/PivotQuery.js`),a=await n.queryPivot(i.default.from(e),t),o=this.graphicOrigin;if(a?.features)for(let e of a.features)e.layer=e.sourceLayer=this,e.origin=o;return a}async queryTopFeatures(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopFeatures||!r?.query?.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryTopFeatures capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`),a=await n.queryTopFeatures(i.default.from(e),t),o=this.graphicOrigin;if(a?.features)for(let e of a.features)e.layer=e.sourceLayer=this,e.origin=o;return a}async queryAttributeBins(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryAttributeBins)throw new s(Y,`Layer source does not support queryAttributeBins capability`);ze(e,r,Y);let i=await import(`../rest/support/AttributeBinsQuery.js`),a=await n.queryAttributeBins(i.default.from(e),t),o=this.graphicOrigin;if(a.features)for(let e of a.features)e.layer=e.sourceLayer=this,e.origin=o;return a}async queryTopObjectIds(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopObjectIds||!r?.query.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryTopObjectIds capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`);return(await n.queryTopObjectIds(i.default.from(e),t)).filter(rt)}async queryTopFeaturesExtent(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopExtents||!r?.query?.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryTopExtents capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`);return n.queryTopExtents(i.default.from(e),t)}async queryTopFeatureCount(e,t){let{source:n,capabilities:r}=await this.load();if(!n.queryTopCount||!r?.query?.supportsTopFeaturesQuery)throw new s(Y,`Layer source does not support queryFeatureCount capability`);let i=await import(`../rest/support/TopFeaturesQuery.js`);return n.queryTopCount(i.default.from(e),t)}read(e,t){let n=e.featureCollection;if((n||e.type===`Feature Collection`)&&(this.resourceInfo=e),n){let{layers:e,showLegend:r}=n;e?.length===1&&(super.read(e[0],t),r!=null&&super.read({showLegend:r},t))}super.read(e,t),X(this.source)&&t?.origin===`service`&&([`objectIdField`,`fields`,`timeInfo`,`dateFieldsTimeZone`,`uniqueIdFields`].forEach(e=>{this.revertToOrigin(e,`service`)}),this.spatialReference||this.revertToOrigin(`spatialReference`,`service`))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};let{origin:n,layerContainerType:r}=t;if(this.dynamicDataSource)return K(t,this,`a dynamic data source cannot be written to web scenes, web maps and feature service items`),null;if(this.isTable){if((n===`web-map`||n===`web-scene`)&&r!==`tables`)return K(t,this,`a table source can only be written to tables`),null;if(this._hasMemorySource())return K(t,this,`an in-memory table source cannot be written to web scenes and web maps`),null}else if(this.loaded&&(n===`web-map`||n===`web-scene`)&&r===`tables`)return K(t,this,`a non-table source cannot be written to tables in web maps or web scenes`),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(Y,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return this.loaded?this.source?.type===`memory`||Xe(this,e):!1}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}_readEditingEnabled(e,t,n){let r=e.layerDefinition?.capabilities;if(r||(r=e.capabilities,t&&n?.origin===`web-map`&&!this._hasMemorySource()&&r))return this._hasEditingCapability(r)}_hasEditingCapability(e){return e.toLowerCase().split(`,`).map(e=>e.trim()).includes(`editing`)}_writeEditingEnabled(e,t,n,r){if(!e){let e=this.capabilities?.operations?.supportsSync?`Query,Sync`:`Query`;l(`layerDefinition.capabilities`,e,t),n&&!r?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return i(this.url??``,{query:{f:`json`,...this.customParameters,token:this.apiKey},responseType:`json`,signal:e}).then(e=>{let t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)})}async initLayerProperties(e){return this._set(`source`,e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:`service`,portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),H(this.renderer,this.fieldsIndex),Ke(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&this.geometryType===`mesh`&&(this.capabilities.query.supportsReturnMesh=!0),Qe(this,{origin:`service`})}canReload(){return super.canReload()&&!this._hasMemorySource()}async reloadFromService(e){let t=this.source;await t.reload({signal:e}),await this.initLayerProperties(t)}async hasDataChanged(){return Be(this)}async fetchPublishingStatus(){let e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():`unavailable`}_verifyFields(){let e=this.parsedUrl?.path??`undefined`;this.objectIdField||console.log(`FeatureLayer: 'objectIdField' property is not defined (url: `+e+`)`),this.isTable||this._hasMemorySource()||/\/FeatureServer\//i.test(e)||this.fields?.some(e=>e.type===`geometry`)||console.log(`FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: `+e+`)`)}_fixTemplates(e,t){e&&e.forEach(e=>{let n=e.prototype?.attributes;n&&t&&delete n[t]})}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s(`feature-layer:mixed-source-and-url`,`FeatureLayer cannot be created with both an in-memory source and a url`)}else if(!this.url)throw new s(`feature-layer:source-or-url-required`,`FeatureLayer requires either a url, a valid portal item or a source`)}_initMemorySource(e){e.forEach(e=>{e.layer=this,e.sourceLayer=this}),this.addHandles([e.on(`after-add`,e=>{e.item.layer=this,e.item.sourceLayer=this}),e.on(`after-remove`,e=>{e.item.layer=null,e.item.sourceLayer=null})],`fl-source`)}_resetMemorySource(e){e.forEach(e=>{e.layer=null,e.sourceLayer=null}),this.removeHandles(`fl-source`)}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return[...e.layers||[],...e.tables||[]].find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id}};n([u({clonable:!1,readOnly:!0})],$.prototype,`_titleCreator`,null),n([u(P)],$.prototype,`attributeTableTemplate`,void 0),n([q(`service`,`capabilities`)],$.prototype,`readCapabilities`,null),n([u({json:{origins:{"web-scene":{write:!1}},write:!0}})],$.prototype,`charts`,void 0),n([u({readOnly:!0})],$.prototype,`createQueryVersion`,null),n([u({json:{read:{source:`layerDefinition.copyrightText`}}})],$.prototype,`copyright`,void 0),n([u({json:{read:{source:`layerDefinition.displayField`}}})],$.prototype,`displayField`,void 0),n([u({types:at,readOnly:!0})],$.prototype,`defaultSymbol`,void 0),n([u({types:tt})],$.prototype,`dynamicDataSource`,void 0),n([u({type:Boolean})],$.prototype,`editingEnabled`,null),n([q([`portal-item`,`web-scene`],`editingEnabled`,[`layerDefinition.capabilities`])],$.prototype,`readEditingEnabled`,null),n([q(`web-map`,`editingEnabled`,[`capabilities`,`layerDefinition.capabilities`])],$.prototype,`readEditingEnabledFromWebMap`,null),n([J([`portal-item`,`web-scene`],`editingEnabled`,{"layerDefinition.capabilities":{type:String}})],$.prototype,`writeEditingEnabled`,null),n([J(`web-map`,`editingEnabled`,{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],$.prototype,`writeEditingEnabledToWebMap`,null),n([u({readOnly:!0})],$.prototype,`effectiveEditingEnabled`,null),n([u({clonable:!1,readOnly:!0})],$.prototype,`featureTitleFields`,null),n([u({type:[Ve],json:{name:`layerDefinition.fieldConfigurations`,write:{overridePolicy(e,t,n){return{enabled:!n?.writeLayerSchema,ignoreOrigin:this.originIdOf(t)===1}}}}})],$.prototype,`fieldConfigurations`,null),n([u({...Z.fields,json:{read:{source:`layerDefinition.fields`},origins:{service:{name:`fields`},"web-map":{write:{target:`layerDefinition.fields`,overridePolicy:Q}}}}})],$.prototype,`fields`,void 0),n([u(Z.fieldsIndex)],$.prototype,`fieldsIndex`,void 0),n([u({type:de,json:{name:`formInfo`,write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],$.prototype,`formTemplate`,void 0),n([u({json:{read:{source:`layerDefinition.extent`}}})],$.prototype,`fullExtent`,void 0),n([u({json:{origins:{"web-map":{write:{target:`layerDefinition.geometryType`,overridePolicy:Q,writer(e,t,n){let r=e?z.toJSON(e):null;r&&l(n,r,t)}}}},read:{source:`layerDefinition.geometryType`,reader:z.read}}})],$.prototype,`geometryType`,void 0),n([u({readOnly:!0,clonable:!1})],$.prototype,`graphicOrigin`,void 0),n([u({json:{read:{source:`layerDefinition.hasM`}}})],$.prototype,`hasM`,void 0),n([u({json:{read:{source:`layerDefinition.hasZ`}}})],$.prototype,`hasZ`,void 0),n([u(F)],$.prototype,`id`,void 0),n([u({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],$.prototype,`infoFor3D`,void 0),n([u({json:{origins:{"web-map":{write:{target:`layerDefinition.type`}}}}})],$.prototype,`isTable`,void 0),n([q(`service`,`isTable`,[`type`,`geometryType`]),q(`isTable`,[`layerDefinition.type`,`layerDefinition.geometryType`])],$.prototype,`readIsTable`,null),n([J(`web-map`,`isTable`)],$.prototype,`writeIsTable`,null),n([u(I)],$.prototype,`labelsVisible`,void 0),n([u({type:[qe],json:{origins:{service:{name:`drawingInfo.labelingInfo`,read:U,write:!1}},name:`layerDefinition.drawingInfo.labelingInfo`,read:U,write:{layerContainerTypes:d}}})],$.prototype,`labelingInfo`,void 0),n([u({type:W,json:{name:`layerDefinition.drawingInfo.symbolLayerDrawing`,write:!0,origins:{"web-scene":{write:!1}}}})],$.prototype,`symbolLayerDrawing`,void 0),n([q([`portal-item`,`web-map`],`symbolLayerDrawing`,[`layerDefinition.drawingInfo.renderer`,`layerDefinition.drawingInfo.symbolLayerDrawing`])],$.prototype,`readSymbolLayerDrawing`,null),n([u((()=>{let e=c(L);return e.json.origins[`portal-item`]={write:{target:`layerDefinition.drawingInfo.transparency`,writer(e,t,n){l(n,ot(e),t)}}},e})())],$.prototype,`opacity`,void 0),n([u(R)],$.prototype,`legendEnabled`,void 0),n([u({type:[`show`,`hide`],json:(()=>{let e=c(ge.json);return e.origins[`portal-item`]={read:!1,write:!1},e})()})],$.prototype,`listMode`,void 0),n([q(`globalIdField`,[`layerDefinition.globalIdField`,`layerDefinition.fields`])],$.prototype,`readGlobalIdField`,null),n([u({json:{origins:{"web-map":{write:{target:`layerDefinition.objectIdField`,overridePolicy:Q}}}}})],$.prototype,`objectIdField`,void 0),n([q(`objectIdField`,[`layerDefinition.objectIdField`,`layerDefinition.fields`])],$.prototype,`readObjectIdField`,null),n([u({type:[`ArcGISFeatureLayer`],json:{write:{target:`layerType`,ignoreOrigin:!0,layerContainerTypes:d}}})],$.prototype,`operationalLayerType`,void 0),n([u(Z.outFields)],$.prototype,`outFields`,void 0),n([u({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],$.prototype,`path`,void 0),n([u(_e)],$.prototype,`popupEnabled`,void 0),n([u({type:r,json:{name:`popupInfo`,write:!0}})],$.prototype,`popupTemplate`,void 0),n([J(`popupTemplate`)],$.prototype,`writePopupTemplate`,null),n([u({readOnly:!0})],$.prototype,`defaultPopupTemplate`,null),n([u({types:et,json:{origins:{service:{write:{target:`drawingInfo.renderer`,enabled:!1}},"web-scene":{types:$e,name:`layerDefinition.drawingInfo.renderer`,write:{layerContainerTypes:d,overridePolicy(e,t,n){return{ignoreOrigin:n?.writeLayerSchema,layerContainerTypes:d}}}}},write:{target:`layerDefinition.drawingInfo.renderer`,overridePolicy(e,t,n){return{ignoreOrigin:n?.writeLayerSchema,layerContainerTypes:d}}}}})],$.prototype,`renderer`,null),n([q(`service`,`renderer`,[`drawingInfo.renderer`,`defaultSymbol`]),q(`renderer`,[`layerDefinition.drawingInfo.renderer`,`layerDefinition.defaultSymbol`])],$.prototype,`readRenderer`,null),n([u()],$.prototype,`resourceInfo`,void 0),n([u((()=>{let e=c(ve);return e.json.origins[`portal-item`]={read:!1,write:!1},e})())],$.prototype,`screenSizePerspectiveEnabled`,void 0),n([u({clonable:!1})],$.prototype,`source`,null),n([q(`portal-item`,`source`,[`featureSet`]),q(`web-map`,`source`,[`featureSet`])],$.prototype,`readSource`,null),n([u({json:{read:{source:`layerDefinition.extent.spatialReference`}}})],$.prototype,`spatialReference`,void 0),n([u({type:Number})],$.prototype,`subtypeCode`,void 0),n([u({readOnly:!1})],$.prototype,`subtypeField`,void 0),n([u({readOnly:!1})],$.prototype,`subtypes`,void 0),n([u({type:[B]})],$.prototype,`templates`,void 0),n([q(`templates`,[`editFieldsInfo`,`creatorField`,`editorField`,`templates`])],$.prototype,`readTemplates`,null),n([u()],$.prototype,`title`,void 0),n([q(`service`,`title`,[`name`]),q(`portal-item`,`title`,[`layerDefinition.title`,`layerDefinition.name`,`title`])],$.prototype,`readTitle`,null),n([q(`web-map`,`title`,[`layerDefinition.name`,`title`])],$.prototype,`readTitleFromWebMap`,null),n([u({type:String})],$.prototype,`sublayerTitleMode`,void 0),n([u({json:{read:!1}})],$.prototype,`type`,void 0),n([u({type:String})],$.prototype,`typeIdField`,void 0),n([q(`service`,`typeIdField`),q(`typeIdField`,[`layerDefinition.typeIdField`])],$.prototype,`readTypeIdField`,null),n([u({type:[V]})],$.prototype,`types`,void 0),n([q(`service`,`types`,[`types`]),q(`types`,[`layerDefinition.types`])],$.prototype,`readTypes`,null),n([u({type:Boolean,json:{origins:{"portal-item":{write:{target:`layerDefinition.defaultVisibility`,layerContainerTypes:d}}}}})],$.prototype,`visible`,void 0),n([q(`portal-item`,`visible`,[`visibility`,`layerDefinition.defaultVisibility`])],$.prototype,`readVisible`,null),$=n([ue(`esri.layers.FeatureLayer`)],$);export{$ as default};
@@ -587,7 +587,11 @@ export interface GeoJSONLayerEvents extends EditBusLayerEvents, RefreshableLayer
587
587
  * > Each GeoJSONLayer will only accept one schema of the properties. The [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) property
588
588
  * > can be used to specify the desired fields for the layer. If [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) is not defined, the schema used by
589
589
  * > the first feature will be used to deduce the fields schema for the layer.
590
- * > [GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8) is not supported.
590
+ * > [GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8) members, including nested collections,
591
+ * > are loaded as separate features of the layer's geometry type with generated unique object IDs.
592
+ * > The original parent ID is retained as a string in `__PARENTID` (with a numeric suffix if that name is already used).
593
+ * > Empty collections are ignored. Collections must be present when the layer is loaded to establish the parent ID field;
594
+ * > if they are introduced later, recreate the layer instead of refreshing it.
591
595
  * > Using an object as an attribute value for GeoJSON features is not supported.
592
596
  * > Geometries that cross the Antimeridian line are not currently supported.
593
597
  * > Date [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) will be created implicitly when GeoJSONLayer is loaded, if the GeoJSON [feature](https://datatracker.ietf.org/doc/html/rfc7946#section-3.2) objects
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Error.js";import{MultiOriginJSONSupportMixin as n}from"../core/MultiOriginJSONSupport.js";import{property as r,subclass as i}from"../core/accessorSupport/decorators.js";import{ensureClass as a}from"../core/accessorSupport/ensureType.js";import o from"../geometry/SpatialReference.js";import{getInfo as s}from"../geometry/support/spatialReferenceUtils.js";import c from"./Layer.js";import{BlendLayer as l}from"./mixins/BlendLayer.js";import{RasterJobHandlerMixin as u}from"./mixins/RasterJobHandlerMixin.js";import{ScaleRangeLayer as d}from"./mixins/ScaleRangeLayer.js";import f from"./raster/datasets/GeospatialPDFRaster.js";import{clip as p}from"./raster/functions/clipUtils.js";import m from"./support/PortalItemData.js";import h from"./support/TileInfo.js";let g=class extends l(d(u(n(c)))){constructor(e){super(e),this._frame=null,this._objectURL=null,this.clippedToNeatline=!1,this.data=null,this.raster=null,this.serviceRasterInfo=null,this.spatialReference=null,this.type=`geospatial-pdf`}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}destroy(){this._shutdownJobHandler(),this.raster?.destroy(),this._objectURL&&=(URL.revokeObjectURL(this._objectURL),null)}get fullExtent(){return this.serviceRasterInfo?.extent}createNeatline(e){if(!this._frame)throw new t(`geospatial-pdf-layer: render`,`Layer does not have valid mapframe`);return e?this._frame.createNeatline(e):this._frame.createNeatline()}async fetchImageBitmapTile(){throw new t(`geospatial-pdf-layer:fetch-image-bitmap-tile`,`GeospatialPDFLayer does not expose pre-rendered image tile URLs.`)}async fetchPixels(e,t,n,r={}){return _(this),await this._initJobHandler(),this.raster.fetchPixels(e,Math.round(t),Math.round(n),r)}async fetchTile(e,n,r,i={}){if(_(this),i.requestAsImageElement)throw new t(`geospatial-pdf-layer:fetch-tile`,`GeospatialPDFLayer does not support requestAsImageElement.`);await this._initJobHandler();let a=await this.raster.fetchTile(e,n,r,i),o=this.clippedToNeatline?this._frame?.sourceNeatlinePolygon:this._frame?.sourceMediaBoxPolygon;return o&&a.pixelBlock&&this._frame&&a.srcExtent&&(a.pixelBlock=await p(a.pixelBlock,a.srcExtent,o)),a}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}getCompatibleTileInfo(e,t,n=!1){if(!this.loaded||t==null)return null;if(n&&e.equals(this.spatialReference))return this.tileInfo;let r=s(e);return h.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.origin[1]}:{x:t.xmin,y:t.ymax}})}getRawDisplayBandIds(){return _(this),[0,1,2]}async _initJobHandler(){if(!this._rasterJobHandler)return super._initJobHandler().then(()=>{this._rasterJobHandler&&(_(this),this.raster.rasterJobHandler=this._rasterJobHandler)}).catch(()=>{})}_shutdownJobHandler(){super._shutdownJobHandler(),this.raster&&(this.raster.rasterJobHandler=null)}async _getDataUrl(e){let{data:n}=this;if(typeof n==`string`)return n;if(n instanceof File)return this._objectURL=URL.createObjectURL(n),this._objectURL;if(n instanceof m){await n.portalItem.load({signal:e?.signal});let r=n.portalItem.url;if(!r)throw new t(`geospatial-pdf-layer:load`,`Portal item does not have a valid data URL.`);return r}throw new t(`geospatialpdf-layer:missing-data`,`A data source must be specified.`)}async _load(e){let t=await this._getDataUrl(e);await this._openRaster(t,e?.signal)}async _openRaster(e,n){let r=new f({url:e});if(await r.open({signal:n}),!r.rasterInfo)throw r.destroy(),new t(`geospatialpdf-layer:load`,`cannot load resources on `+e);let{rasterInfo:i}=r;this._set(`serviceRasterInfo`,i),this.setAtOrigin(`spatialReference`,i.spatialReference,`service`),this.setAtOrigin(`tileInfo`,i.storageInfo.tileInfo,`service`),this._frame=r.frame,this.raster=r}};e([r({clonable:!1})],g.prototype,`_compatibleFullExtent`,void 0),e([r({type:Boolean})],g.prototype,`clippedToNeatline`,void 0),e([r({cast:e=>e?typeof e==`string`||e instanceof File?e:a(m,e):null})],g.prototype,`data`,void 0),e([r({json:{read:!1}})],g.prototype,`fullExtent`,null),e([r()],g.prototype,`raster`,void 0),e([r()],g.prototype,`serviceRasterInfo`,void 0),e([r({readOnly:!0,type:o,json:{read:!1}})],g.prototype,`spatialReference`,void 0),e([r({type:h,readOnly:!0})],g.prototype,`tileInfo`,void 0),e([r({readOnly:!0,value:`geospatial-pdf`})],g.prototype,`type`,void 0),g=e([i(`esri.layers.GeospatialPDFLayer`)],g);function _(e){if(!e.raster||!e.serviceRasterInfo)throw new t(`imagery-tile`,`no raster`)}const v=g;export{v as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Error.js";import{MultiOriginJSONSupportMixin as n}from"../core/MultiOriginJSONSupport.js";import{property as r,subclass as i}from"../core/accessorSupport/decorators.js";import{ensureClass as a}from"../core/accessorSupport/ensureType.js";import o from"../geometry/SpatialReference.js";import{getInfo as s}from"../geometry/support/spatialReferenceUtils.js";import c from"./Layer.js";import{BlendLayer as l}from"./mixins/BlendLayer.js";import{RasterJobHandlerMixin as u}from"./mixins/RasterJobHandlerMixin.js";import{ScaleRangeLayer as d}from"./mixins/ScaleRangeLayer.js";import f from"./raster/datasets/GeospatialPDFRaster.js";import{clip as p}from"./raster/functions/clipUtils.js";import m from"./support/PortalItemData.js";import h from"./support/TileInfo.js";let g=class extends l(d(u(n(c)))){constructor(e){super(e),this._frame=null,this._objectURL=null,this.clippedToNeatline=!1,this.data=null,this.raster=null,this.serviceRasterInfo=null,this.spatialReference=null,this.type=`geospatial-pdf`}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}destroy(){this._shutdownJobHandler(),this.raster?.destroy(),this._objectURL&&=(URL.revokeObjectURL(this._objectURL),null)}get fullExtent(){return this.serviceRasterInfo?.extent}createNeatline(e){if(!this._frame)throw new t(`geospatial-pdf-layer: render`,`Layer does not have valid mapframe`);return e?this._frame.createNeatline(e):this._frame.createNeatline()}async fetchImageBitmapTile(){throw new t(`geospatial-pdf-layer:fetch-image-bitmap-tile`,`GeospatialPDFLayer does not expose pre-rendered image tile URLs.`)}async fetchPixels(e,t,n,r={}){return _(this),await this._initJobHandler(),this.raster.fetchPixels(e,Math.round(t),Math.round(n),r)}async fetchTile(e,n,r,i={}){if(_(this),i.requestAsImageElement)throw new t(`geospatial-pdf-layer:fetch-tile`,`GeospatialPDFLayer does not support requestAsImageElement.`);await this._initJobHandler();let a=await this.raster.fetchTile(e,n,r,i),o=this.clippedToNeatline?this._frame?.sourceNeatlinePolygon:this._frame?.sourceMediaBoxPolygon;return o&&a.pixelBlock&&this._frame&&a.srcExtent&&(a.pixelBlock=await p(a.pixelBlock,a.srcExtent,o)),a}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}getCompatibleTileInfo(e,t,n=!1){if(!this.loaded||t==null)return null;if(n&&e.equals(this.spatialReference))return this.tileInfo;let r=s(e);return h.create({size:256,spatialReference:e,origin:r?{x:r.origin[0],y:r.origin[1]}:{x:t.xmin,y:t.ymax}})}getRawDisplayBandIds(){return _(this),[0,1,2]}async _initJobHandler(){if(!this._rasterJobHandler)return super._initJobHandler().then(()=>{this._rasterJobHandler&&(_(this),this.raster.rasterJobHandler=this._rasterJobHandler)}).catch(()=>{})}_shutdownJobHandler(){super._shutdownJobHandler(),this.raster&&(this.raster.rasterJobHandler=null)}async _getResolvedGeospatialPDFData(e){let{data:n}=this;if(typeof n==`string`)return{url:n};if(n instanceof File)return this._objectURL=URL.createObjectURL(n),{url:this._objectURL};if(n instanceof m){await n.portalItem.load({signal:e?.signal});let{url:r,id:i,created:a,modified:o,access:s}=n.portalItem;if(!r)throw new t(`geospatial-pdf-layer:load`,`Portal item does not have a valid data URL.`);return!i||!a||!o||s!==`public`?{url:r}:{url:r,cacheIdentity:{portalItemId:i,modified:o.getTime()}}}throw new t(`geospatial-pdf-layer:missing-data`,`A data source must be specified.`)}async _load(e){let t=await this._getResolvedGeospatialPDFData(e);await this._openRaster(t,e?.signal)}async _openRaster(e,n){let r=new f({url:e.url,sourceCacheIdentity:e.cacheIdentity??null});if(await r.open({signal:n}),!r.rasterInfo)throw r.destroy(),new t(`geospatial-pdf-layer:load`,`cannot load resources on `+e.url);let{rasterInfo:i}=r;this._set(`serviceRasterInfo`,i),this.setAtOrigin(`spatialReference`,i.spatialReference,`service`),this.setAtOrigin(`tileInfo`,i.storageInfo.tileInfo,`service`),this._frame=r.frame,this.raster=r}};e([r({clonable:!1})],g.prototype,`_compatibleFullExtent`,void 0),e([r({type:Boolean})],g.prototype,`clippedToNeatline`,void 0),e([r({cast:e=>e?typeof e==`string`||e instanceof File?e:a(m,e):null})],g.prototype,`data`,void 0),e([r({json:{read:!1}})],g.prototype,`fullExtent`,null),e([r()],g.prototype,`raster`,void 0),e([r()],g.prototype,`serviceRasterInfo`,void 0),e([r({readOnly:!0,type:o,json:{read:!1}})],g.prototype,`spatialReference`,void 0),e([r({type:h,readOnly:!0})],g.prototype,`tileInfo`,void 0),e([r({readOnly:!0,value:`geospatial-pdf`})],g.prototype,`type`,void 0),g=e([i(`esri.layers.GeospatialPDFLayer`)],g);function _(e){if(!e.raster||!e.serviceRasterInfo)throw new t(`imagery-tile`,`no raster`)}const v=g;export{v as default};