@arcgis/core 4.28.0-next.20231003 → 4.28.0-rc.0

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 (211) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/02120d192eafd7612475.js +1 -0
  3. package/assets/esri/core/workers/chunks/0beebbb0c6dad0e742d7.js +1 -0
  4. package/assets/esri/core/workers/chunks/112e89da628bdea5355c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{5e9edd06e624f385fa4b.js → 121a9e148509f2fe2210.js} +1 -1
  6. package/assets/esri/core/workers/chunks/1856d16d738f44f58084.js +1 -0
  7. package/assets/esri/core/workers/chunks/{0526d623d0b4c12929bd.js → 18ab9cc85a1a7988fdfd.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{7c960a2694c4c3123acf.js → 1a36703ebe934749646e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/24a0cf405195421c0d06.js +1 -0
  10. package/assets/esri/core/workers/chunks/24ff267cf253feac22de.js +1 -0
  11. package/assets/esri/core/workers/chunks/{3c8613596659801fd6ab.js → 29cab345819ec02ed60a.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{169a61c6e128b8a16021.js → 2c560a075d9ef2069ed1.js} +1 -1
  13. package/assets/esri/core/workers/chunks/2f8e71dac98135bbc3e6.js +1 -0
  14. package/assets/esri/core/workers/chunks/341fb51b2165522963b3.js +1 -0
  15. package/assets/esri/core/workers/chunks/{ad8e0f82cb1feafa9e2f.js → 36ab90fb34b9716a9983.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{2688213bbff536da7917.js → 3ea0b872436fce84b927.js} +1 -1
  17. package/assets/esri/core/workers/chunks/40633064c290dc2af9ea.js +1 -0
  18. package/assets/esri/core/workers/chunks/42ec4c80b0c2944cd65c.js +1 -0
  19. package/assets/esri/core/workers/chunks/44b870cb53ba68b17c32.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8a7fa4e8b0d14da7c9eb.js → 4cc680fe4c9c39d2f853.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{6730c9f0890191a95fdb.js → 4d81aa50d90f5701a343.js} +1 -1
  22. package/assets/esri/core/workers/chunks/4e0bf30da4281070e453.js +1 -0
  23. package/assets/esri/core/workers/chunks/4e6bf1efe3b0b474cbb4.js +1 -0
  24. package/assets/esri/core/workers/chunks/52cef7cd3aaaa4f45c94.js +1 -0
  25. package/assets/esri/core/workers/chunks/5e907ec0ee1565b5fbbc.js +1 -0
  26. package/assets/esri/core/workers/chunks/66ba749ab0a631bbfdec.js +1 -0
  27. package/assets/esri/core/workers/chunks/6b14d89d689a21014aec.js +1 -0
  28. package/assets/esri/core/workers/chunks/6b1856303d1562f05100.js +1 -0
  29. package/assets/esri/core/workers/chunks/{576269fd1f9049876aa1.js → 6b7b5544ed1f9a84623f.js} +1 -1
  30. package/assets/esri/core/workers/chunks/710a6268de62003af825.js +1 -0
  31. package/assets/esri/core/workers/chunks/77923afde29ae1ff10ca.js +1 -0
  32. package/assets/esri/core/workers/chunks/784ffd52315a4d55d683.js +1 -0
  33. package/assets/esri/core/workers/chunks/7cf7f2b991a7cbdad2ce.js +1 -0
  34. package/assets/esri/core/workers/chunks/{70dffbf49b0633b1a5f1.js → 8f3680fee85a05839489.js} +1 -1
  35. package/assets/esri/core/workers/chunks/97aecf210938015cc7a3.js +1 -0
  36. package/assets/esri/core/workers/chunks/{c7ebd5d431fb996bfcee.js → 9f8207c82a17508a87a8.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{557305b91f77569ce664.js → a01ffe03b1465c21b9e6.js} +1 -1
  38. package/assets/esri/core/workers/chunks/a298c9031962951e55a9.js +1 -0
  39. package/assets/esri/core/workers/chunks/{329669a9beda89b028dd.js → a5a7bbdd8298016535bc.js} +1 -1
  40. package/assets/esri/core/workers/chunks/a877a4826cd6a46ec99b.js +1 -0
  41. package/assets/esri/core/workers/chunks/ad38e456a7cee940a165.js +1 -0
  42. package/assets/esri/core/workers/chunks/adfbc168be8c49b51e1b.js +1 -0
  43. package/assets/esri/core/workers/chunks/b0526633a93ef69ec47b.js +1 -0
  44. package/assets/esri/core/workers/chunks/b99bc08a01e9250b0a31.js +1 -0
  45. package/assets/esri/core/workers/chunks/{36c4b4c3eca57417da2c.js → c260ad3434bb00ba64a7.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{39922ce232338de076ae.js → c459c8d8630eb4b955b1.js} +1 -1
  47. package/assets/esri/core/workers/chunks/c92e75b79aff7b505b31.js +1 -0
  48. package/assets/esri/core/workers/chunks/ca85e88dad30b5f2956b.js +1 -0
  49. package/assets/esri/core/workers/chunks/{8e56d40691b6bf75d7cc.js → ce409944221a784ddb61.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d13f75f233cf313e5a1d.js +1 -0
  51. package/assets/esri/core/workers/chunks/d60d5f006375f7fcc88c.js +1 -0
  52. package/assets/esri/core/workers/chunks/{77958089748dc31757cf.js → d6ded127949160103f69.js} +1 -1
  53. package/assets/esri/core/workers/chunks/d8c696da42f8f8919b83.js +1 -0
  54. package/assets/esri/core/workers/chunks/{304c81f6297ecba3a324.js → d95eed98316e59f8f35d.js} +1 -1
  55. package/assets/esri/core/workers/chunks/df7267892b6e0493e1d7.js +1 -0
  56. package/assets/esri/core/workers/chunks/{52dca349e1a45555954d.js → e52d5a48e83d8df36f92.js} +1 -1
  57. package/assets/esri/core/workers/chunks/e8688b6cc3b3c1010b43.js +1 -0
  58. package/assets/esri/core/workers/chunks/e8c7cc974420c0b92d0e.js +1 -0
  59. package/assets/esri/core/workers/chunks/{b6847d68c35e7dbf6004.js → e93442c6d92229f3a4b0.js} +1 -1
  60. package/assets/esri/core/workers/chunks/f2718e260f594537f7fd.js +1 -0
  61. package/assets/esri/core/workers/chunks/f6b7036114b1d754fdd9.js +1 -0
  62. package/assets/esri/core/workers/chunks/{c4631241dc777ca77aaa.js → f6c0680c535c5a3c73ee.js} +1 -1
  63. package/assets/esri/core/workers/chunks/fac3e57784d7f37053af.js +1 -0
  64. package/assets/esri/t9n/common.json +1 -1
  65. package/assets/esri/t9n/common_ar.json +1 -1
  66. package/assets/esri/t9n/common_bg.json +1 -1
  67. package/assets/esri/t9n/common_bs.json +1 -1
  68. package/assets/esri/t9n/common_ca.json +1 -1
  69. package/assets/esri/t9n/common_cs.json +1 -1
  70. package/assets/esri/t9n/common_da.json +1 -1
  71. package/assets/esri/t9n/common_de.json +1 -1
  72. package/assets/esri/t9n/common_el.json +1 -1
  73. package/assets/esri/t9n/common_en.json +1 -1
  74. package/assets/esri/t9n/common_es.json +1 -1
  75. package/assets/esri/t9n/common_et.json +1 -1
  76. package/assets/esri/t9n/common_fi.json +1 -1
  77. package/assets/esri/t9n/common_fr.json +1 -1
  78. package/assets/esri/t9n/common_he.json +1 -1
  79. package/assets/esri/t9n/common_hr.json +1 -1
  80. package/assets/esri/t9n/common_hu.json +1 -1
  81. package/assets/esri/t9n/common_id.json +1 -1
  82. package/assets/esri/t9n/common_it.json +1 -1
  83. package/assets/esri/t9n/common_ja.json +1 -1
  84. package/assets/esri/t9n/common_ko.json +1 -1
  85. package/assets/esri/t9n/common_lt.json +1 -1
  86. package/assets/esri/t9n/common_lv.json +1 -1
  87. package/assets/esri/t9n/common_nb.json +1 -1
  88. package/assets/esri/t9n/common_nl.json +1 -1
  89. package/assets/esri/t9n/common_pl.json +1 -1
  90. package/assets/esri/t9n/common_pt-BR.json +1 -1
  91. package/assets/esri/t9n/common_pt-PT.json +1 -1
  92. package/assets/esri/t9n/common_ro.json +1 -1
  93. package/assets/esri/t9n/common_ru.json +1 -1
  94. package/assets/esri/t9n/common_sk.json +1 -1
  95. package/assets/esri/t9n/common_sl.json +1 -1
  96. package/assets/esri/t9n/common_sr.json +1 -1
  97. package/assets/esri/t9n/common_sv.json +1 -1
  98. package/assets/esri/t9n/common_th.json +1 -1
  99. package/assets/esri/t9n/common_tr.json +1 -1
  100. package/assets/esri/t9n/common_uk.json +1 -1
  101. package/assets/esri/t9n/common_vi.json +1 -1
  102. package/assets/esri/t9n/common_zh-CN.json +1 -1
  103. package/assets/esri/t9n/common_zh-HK.json +1 -1
  104. package/assets/esri/t9n/common_zh-TW.json +1 -1
  105. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +2 -1
  106. package/assets/esri/themes/base/widgets/_FeatureForm.scss +0 -1
  107. package/assets/esri/themes/dark/main.css +1 -1
  108. package/assets/esri/themes/light/main.css +1 -1
  109. package/assets/esri/themes/light/view.css +1 -1
  110. package/config.js +1 -1
  111. package/core/pbf.js +1 -1
  112. package/interfaces.d.ts +0 -32
  113. package/kernel.js +1 -1
  114. package/layers/GroupLayer.js +1 -1
  115. package/layers/SceneLayer.js +1 -1
  116. package/layers/graphics/editingSupport.js +1 -1
  117. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  118. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  119. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  120. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  121. package/layers/mixins/OperationalLayer.js +1 -1
  122. package/layers/save/featureLayerUtils.js +1 -1
  123. package/layers/save/groupLayerUtils.js +5 -0
  124. package/layers/save/utils.js +1 -1
  125. package/layers/support/LayerLoadContext.js +5 -0
  126. package/layers/support/featureLayerUtils.js +1 -1
  127. package/layers/support/labelFormatUtils.js +1 -1
  128. package/layers/support/layersCreator.js +1 -1
  129. package/package.json +1 -1
  130. package/portal/schemas/definitions.js +1 -1
  131. package/portal/support/jsonContext.js +1 -1
  132. package/portal/support/layersLoader.js +1 -1
  133. package/portal/support/loadUtils.js +5 -0
  134. package/portal/support/portalItemUtils.js +1 -1
  135. package/portal/support/portalLayers.js +1 -1
  136. package/renderers/support/RasterSymbolizer.js +1 -1
  137. package/support/basemapUtils.js +1 -1
  138. package/support/revision.js +1 -1
  139. package/symbols/PolygonSymbol3D.js +1 -1
  140. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  141. package/views/2d/engine/imagery/colorizer/shadedrelief.js +1 -1
  142. package/views/2d/engine/imagery/colorizer/stretch.js +1 -1
  143. package/views/2d/input/handlers/KeyPan.js +1 -1
  144. package/views/2d/input/handlers/KeyRotate.js +1 -1
  145. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  146. package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
  147. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  148. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  149. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  150. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  151. package/views/3d/layers/i3s/featureEditing.js +1 -1
  152. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  153. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  154. package/views/DOMContainer.js +1 -1
  155. package/views/input/VisibilityChange.js +5 -0
  156. package/webdoc/support/saveUtils.js +1 -1
  157. package/webdoc/webdocSaveUtils.js +1 -1
  158. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  159. package/widgets/DirectionalPad/constants.js +1 -1
  160. package/widgets/DirectionalPad.js +1 -1
  161. package/widgets/FeatureForm/FieldInput.js +1 -1
  162. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  163. package/widgets/FeatureForm.js +1 -1
  164. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  165. package/widgets/FeatureTable/FieldColumn.js +1 -1
  166. package/widgets/support/dateUtils.js +1 -1
  167. package/assets/esri/core/workers/chunks/027f8b57565c65fbccda.js +0 -1
  168. package/assets/esri/core/workers/chunks/048265fb5953350e3e33.js +0 -1
  169. package/assets/esri/core/workers/chunks/0b9cf14f8aafb76c578b.js +0 -1
  170. package/assets/esri/core/workers/chunks/10fd951bd296b2beeeba.js +0 -1
  171. package/assets/esri/core/workers/chunks/1224475f3eefdfd59c76.js +0 -1
  172. package/assets/esri/core/workers/chunks/162b0220e24e9ba72655.js +0 -1
  173. package/assets/esri/core/workers/chunks/1e611cad53b745ee146f.js +0 -1
  174. package/assets/esri/core/workers/chunks/29ed31fd4f9d5cf53686.js +0 -1
  175. package/assets/esri/core/workers/chunks/2b6d1c8e4ed759767827.js +0 -1
  176. package/assets/esri/core/workers/chunks/34b44b0fab88f838885c.js +0 -1
  177. package/assets/esri/core/workers/chunks/364f55294a1d7bf163d7.js +0 -1
  178. package/assets/esri/core/workers/chunks/3714ab435dd5ccf9e694.js +0 -1
  179. package/assets/esri/core/workers/chunks/3788009a5ece453011f3.js +0 -1
  180. package/assets/esri/core/workers/chunks/3aafe8160b3bfbaa6935.js +0 -1
  181. package/assets/esri/core/workers/chunks/3e6255ab48b561af131e.js +0 -1
  182. package/assets/esri/core/workers/chunks/41c002e4c42c581cda8d.js +0 -1
  183. package/assets/esri/core/workers/chunks/47be4c75dd6372b96fe4.js +0 -1
  184. package/assets/esri/core/workers/chunks/4e8d1e6051f6654a5e83.js +0 -1
  185. package/assets/esri/core/workers/chunks/53746e9976758630159b.js +0 -1
  186. package/assets/esri/core/workers/chunks/5449fdd69e12e5cbd12a.js +0 -1
  187. package/assets/esri/core/workers/chunks/57ce4ece0147afb0d43c.js +0 -1
  188. package/assets/esri/core/workers/chunks/5e83d21400a5dec05c81.js +0 -1
  189. package/assets/esri/core/workers/chunks/6047f4487dcd37cca98e.js +0 -1
  190. package/assets/esri/core/workers/chunks/6967d2b3721678b38774.js +0 -1
  191. package/assets/esri/core/workers/chunks/6ac5ca7de651e3d672a1.js +0 -1
  192. package/assets/esri/core/workers/chunks/6b7ee9164149428edb9e.js +0 -1
  193. package/assets/esri/core/workers/chunks/6c495077cc79e1898927.js +0 -1
  194. package/assets/esri/core/workers/chunks/6d43648d5326e01b4474.js +0 -1
  195. package/assets/esri/core/workers/chunks/74fb07de0f990d45af89.js +0 -1
  196. package/assets/esri/core/workers/chunks/8e9a52062ce059153a89.js +0 -1
  197. package/assets/esri/core/workers/chunks/919a57d372419785cd5e.js +0 -1
  198. package/assets/esri/core/workers/chunks/939f0a1a7d605e389e45.js +0 -1
  199. package/assets/esri/core/workers/chunks/9932f23ba6589df14a3d.js +0 -1
  200. package/assets/esri/core/workers/chunks/a25a38c9f338e0beffef.js +0 -1
  201. package/assets/esri/core/workers/chunks/a97581e584336b46ede7.js +0 -1
  202. package/assets/esri/core/workers/chunks/b04eb35e06b1c5759ad0.js +0 -1
  203. package/assets/esri/core/workers/chunks/b1cb932cfadc4dc3f1e4.js +0 -1
  204. package/assets/esri/core/workers/chunks/be3fb6113b0b27b94537.js +0 -1
  205. package/assets/esri/core/workers/chunks/c37119f5692e19aa1ce2.js +0 -1
  206. package/assets/esri/core/workers/chunks/c685f16435d9861bbbd0.js +0 -1
  207. package/assets/esri/core/workers/chunks/e6416a2684866d677b3e.js +0 -1
  208. package/assets/esri/core/workers/chunks/eb01f4cdb9b918cc61e7.js +0 -1
  209. package/assets/esri/core/workers/chunks/eb4aed4fdb44495a4fe6.js +0 -1
  210. package/assets/esri/core/workers/chunks/ec8258c9dc1491e97fc8.js +0 -1
  211. package/assets/esri/core/workers/chunks/eeac53da496de4cd4182.js +0 -1
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";import{buildDate as s}from"./support/revision.js";const r={apiKey:void 0,applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(r,globalThis.esriConfig,!0),delete r.has),!r.assetsPath){{const e="4.28.0";r.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}-next.${s}/assets`}r.defaultAssetsPath=r.assetsPath}export{r as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.28";s.assetsPath=`https://js.arcgis.com/${e}/@arcgis/core/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/core/pbf.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"./has.js";import t from"./ObjectPool.js";var e;!function(t){t[t.varint=0]="varint",t[t.fixed64=1]="fixed64",t[t.delimited=2]="delimited",t[t.fixed32=5]="fixed32",t[t.unknown=99]="unknown"}(e||(e={}));const i=4294967296,s=new TextDecoder("utf-8"),r=has("safari")||has("ios")?6:has("ff")?12:32;class n{constructor(t,i,s=0,r=(t?t.byteLength:0)){this._tag=0,this._dataType=e.unknown,this._init(t,i,s,r)}_init(t,e,i,s){this._data=t,this._dataView=e,this._pos=i,this._end=s}asUnsafe(){return this}clone(){return new n(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(t){this._pos=t}nextTag(t){for(;;){if(this._pos===this._end)return!1;const e=this._decodeVarint();if(this._tag=e>>3,this._dataType=7&e,!t||t===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const t=this._decodeVarint();return this._tag=t>>3,this._dataType=7&t,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let t=4294967295;return t=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128?t:(t=(t|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128?t:void 0))))}getUInt64(){return this._decodeVarint()}getSInt32(){const t=this.getUInt32();if(void 0!==t)return t>>>1^-(1&t)|0}getSInt64(){return this._decodeSVarint()}getBool(){const t=0!==this._data[this._pos];return this._skip(1),t}getEnum(){return this._decodeVarint()}getFixed64(){const t=this._dataView,e=this._pos,s=t.getUint32(e,!0)+t.getUint32(e+4,!0)*i;return this._skip(8),s}getSFixed64(){const t=this._dataView,e=this._pos,s=t.getUint32(e,!0)+t.getInt32(e+4,!0)*i;return this._skip(8),s}getDouble(){const t=this._dataView.getFloat64(this._pos,!0);return this._skip(8),t}getFixed32(){const t=this._dataView.getUint32(this._pos,!0);return this._skip(4),t}getSFixed32(){const t=this._dataView.getInt32(this._pos,!0);return this._skip(4),t}getFloat(){const t=this._dataView.getFloat32(this._pos,!0);return this._skip(4),t}getString(){const t=this._getLength(),e=this._pos,i=this._toString(this._data,e,e+t);return this._skip(t),i}getBytes(){const t=this._getLength(),e=this._pos,i=this._toBytes(this._data,e,e+t);return this._skip(t),i}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(t,e,i,s){const r=this.getMessage(),n=t(r,e,i,s);return r.release(),n}processMessage(t){const e=this.getMessage(),i=t(e);return e.release(),i}getMessage(){const t=this._getLength(),e=n.pool.acquire();return e._init(this._data,this._dataView,this._pos,this._pos+t),this._skip(t),e}release(){n.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case e.varint:this._decodeVarint();break;case e.fixed64:this._skip(8);break;case e.delimited:this._skip(this._getLength());break;case e.fixed32:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(t){this._skip(t)}_skip(t){if(this._pos+t>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=t}_decodeVarint(){const t=this._data;let e=this._pos,i=0,s=0;if(this._end-e>=10)do{if(s=t[e++],i|=127&s,0==(128&s))break;if(s=t[e++],i|=(127&s)<<7,0==(128&s))break;if(s=t[e++],i|=(127&s)<<14,0==(128&s))break;if(s=t[e++],i|=(127&s)<<21,0==(128&s))break;if(s=t[e++],i+=268435456*(127&s),0==(128&s))break;if(s=t[e++],i+=34359738368*(127&s),0==(128&s))break;if(s=t[e++],i+=4398046511104*(127&s),0==(128&s))break;if(s=t[e++],i+=562949953421312*(127&s),0==(128&s))break;if(s=t[e++],i+=72057594037927940*(127&s),0==(128&s))break;if(s=t[e++],i+=0x8000000000000000*(127&s),0==(128&s))break;throw new Error("Varint too long!")}while(0);else{let r=1;for(;e!==this._end&&(s=t[e],0!=(128&s));)++e,i+=(127&s)*r,r*=128;if(e===this._end)throw new Error("Varint overrun!");++e,i+=s*r}return this._pos=e,i}_decodeSVarint(){const t=this._data;let e=this._pos,i=0,s=0;const r=1&t[e];if(this._end-e>=10)do{if(s=t[e++],i|=127&s,0==(128&s))break;if(s=t[e++],i|=(127&s)<<7,0==(128&s))break;if(s=t[e++],i|=(127&s)<<14,0==(128&s))break;if(s=t[e++],i|=(127&s)<<21,0==(128&s))break;if(s=t[e++],i+=268435456*(127&s),0==(128&s))break;if(s=t[e++],i+=34359738368*(127&s),0==(128&s))break;if(s=t[e++],i+=4398046511104*(127&s),0==(128&s))break;if(s=t[e++],i+=562949953421312*(127&s),0==(128&s))break;if(s=t[e++],i+=72057594037927940*(127&s),0==(128&s))break;if(s=t[e++],i+=0x8000000000000000*(127&s),0==(128&s))break;throw new Error("Varint too long!")}while(0);else{let r=1;for(;e!==this._end&&(s=t[e],0!=(128&s));)++e,i+=(127&s)*r,r*=128;if(e===this._end)throw new Error("Varint overrun!");++e,i+=s*r}return this._pos=e,r?-(i+1)/2:i/2}_getLength(){if(this._dataType!==e.delimited)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(t,e,i){if((i=Math.min(this._end,i))-e>r){const r=t.subarray(e,i);return s.decode(r)}let n="",a="";for(let s=e;s<i;++s){const e=t[s];128&e?a+="%"+e.toString(16):(n+=decodeURIComponent(a)+String.fromCharCode(e),a="")}return a.length&&(n+=decodeURIComponent(a)),n}_toBytes(t,e,i){return i=Math.min(this._end,i),new Uint8Array(t.buffer,e,i-e)}}n.pool=new t(n,void 0,(t=>{t._data=null,t._dataView=null}));export{n as default};
5
+ import has from"./has.js";import t from"./ObjectPool.js";var e;!function(t){t[t.varint=0]="varint",t[t.fixed64=1]="fixed64",t[t.delimited=2]="delimited",t[t.fixed32=5]="fixed32",t[t.unknown=99]="unknown"}(e||(e={}));const i=4294967296,s=new TextDecoder("utf-8"),n=has("safari")||has("ios")?6:has("ff")?12:32;class r{constructor(t,i,s=0,n=(t?t.byteLength:0)){this._tag=0,this._dataType=e.unknown,this._init(t,i,s,n)}_init(t,e,i,s){this._data=t,this._dataView=e,this._pos=i,this._end=s}asUnsafe(){return this}clone(){return new r(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(t){this._pos=t}nextTag(t){for(;;){if(this._pos===this._end)return!1;const e=this._decodeVarint();if(this._tag=e>>3,this._dataType=7&e,!t||t===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const t=this._decodeVarint();return this._tag=t>>3,this._dataType=7&t,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let t=4294967295;return t=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128?t:(t=(t|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128?t:void 0))))}getUInt64(){return this._decodeVarint()}getSInt32(){const t=this.getUInt32();if(void 0!==t)return t>>>1^-(1&t)|0}getSInt64(){return this._decodeSVarint()}getBool(){const t=0!==this._data[this._pos];return this._skip(1),t}getEnum(){return this._decodeVarint()}getFixed64(){const t=this._dataView,e=this._pos,s=t.getUint32(e,!0)+t.getUint32(e+4,!0)*i;return this._skip(8),s}getSFixed64(){const t=this._dataView,e=this._pos,s=t.getUint32(e,!0)+t.getInt32(e+4,!0)*i;return this._skip(8),s}getDouble(){const t=this._dataView.getFloat64(this._pos,!0);return this._skip(8),t}getFixed32(){const t=this._dataView.getUint32(this._pos,!0);return this._skip(4),t}getSFixed32(){const t=this._dataView.getInt32(this._pos,!0);return this._skip(4),t}getFloat(){const t=this._dataView.getFloat32(this._pos,!0);return this._skip(4),t}getString(){const t=this._getLength(),e=this._pos,i=this._toString(this._data,e,e+t);return this._skip(t),i}getBytes(){const t=this._getLength(),e=this._pos,i=this._toBytes(this._data,e,e+t);return this._skip(t),i}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(t,e,i,s){const n=this.getMessage(),r=t(n,e,i,s);return n.release(),r}processMessage(t){const e=this.getMessage(),i=t(e);return e.release(),i}getMessage(){const t=this._getLength(),e=r.pool.acquire();return e._init(this._data,this._dataView,this._pos,this._pos+t),this._skip(t),e}release(){r.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case e.varint:this._decodeVarint();break;case e.fixed64:this._skip(8);break;case e.delimited:this._skip(this._getLength());break;case e.fixed32:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(t){this._skip(t)}_skip(t){if(this._pos+t>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=t}_decodeVarint(){const t=this._data;let e=this._pos,i=0,s=0;if(this._end-e>=10)do{if(s=t[e++],i|=127&s,0==(128&s))break;if(s=t[e++],i|=(127&s)<<7,0==(128&s))break;if(s=t[e++],i|=(127&s)<<14,0==(128&s))break;if(s=t[e++],i|=(127&s)<<21,0==(128&s))break;if(s=t[e++],i+=268435456*(127&s),0==(128&s))break;if(s=t[e++],i+=34359738368*(127&s),0==(128&s))break;if(s=t[e++],i+=4398046511104*(127&s),0==(128&s))break;if(s=t[e++],i+=562949953421312*(127&s),0==(128&s))break;if(s=t[e++],i+=72057594037927940*(127&s),0==(128&s))break;if(s=t[e++],i+=0x8000000000000000*(127&s),0==(128&s))break;throw new Error("Varint too long!")}while(0);else{let n=1;for(;e!==this._end&&(s=t[e],0!=(128&s));)++e,i+=(127&s)*n,n*=128;if(e===this._end)throw new Error("Varint overrun!");++e,i+=s*n}return this._pos=e,i}_decodeSVarint(){const t=this._data;let e,i=0,s=0;const n=1&t[this._pos];if(s=t[this._pos++],i|=127&s,0==(128&s))return n?-(i+1)/2:i/2;if(s=t[this._pos++],i|=(127&s)<<7,0==(128&s))return n?-(i+1)/2:i/2;if(s=t[this._pos++],i|=(127&s)<<14,0==(128&s))return n?-(i+1)/2:i/2;if(s=t[this._pos++],i|=(127&s)<<21,0==(128&s))return n?-(i+1)/2:i/2;if(s=t[this._pos++],i+=268435456*(127&s),0==(128&s))return n?-(i+1)/2:i/2;if(s=t[this._pos++],i+=34359738368*(127&s),0==(128&s))return n?-(i+1)/2:i/2;if(s=t[this._pos++],i+=4398046511104*(127&s),0==(128&s))return n?-(i+1)/2:i/2;if(e=BigInt(i),s=t[this._pos++],e+=0x2000000000000n*BigInt(127&s),0==(128&s))return Number(n?-(e+1n)/2n:e/2n);if(s=t[this._pos++],e+=0x100000000000000n*BigInt(127&s),0==(128&s))return Number(n?-(e+1n)/2n:e/2n);if(s=t[this._pos++],e+=0x8000000000000000n*BigInt(127&s),0==(128&s))return Number(n?-(e+1n)/2n:e/2n);throw new Error("Varint too long!")}_getLength(){if(this._dataType!==e.delimited)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(t,e,i){if((i=Math.min(this._end,i))-e>n){const n=t.subarray(e,i);return s.decode(n)}let r="",h="";for(let s=e;s<i;++s){const e=t[s];128&e?h+="%"+e.toString(16):(r+=decodeURIComponent(h)+String.fromCharCode(e),h="")}return h.length&&(r+=decodeURIComponent(h)),r}_toBytes(t,e,i){return i=Math.min(this._end,i),new Uint8Array(t.buffer,e,i-e)}}r.pool=new t(r,void 0,(t=>{t._data=null,t._dataView=null}));export{r as default};
package/interfaces.d.ts CHANGED
@@ -87661,14 +87661,6 @@ declare namespace __esri {
87661
87661
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html#iconClass)
87662
87662
  */
87663
87663
  iconClass: string;
87664
- /**
87665
- * When `true`, adds the map's current basemap (at the time of the widget's instantiation) to the gallery if it's not found in the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html#source).
87666
- *
87667
- * @default false
87668
- *
87669
- * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html#includeCurrentBasemap)
87670
- */
87671
- includeCurrentBasemap: boolean;
87672
87664
  /**
87673
87665
  * The source for basemaps that the widget will display.
87674
87666
  *
@@ -87726,14 +87718,6 @@ declare namespace __esri {
87726
87718
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html#iconClass)
87727
87719
  */
87728
87720
  iconClass?: string;
87729
- /**
87730
- * When `true`, adds the map's current basemap (at the time of the widget's instantiation) to the gallery if it's not found in the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html#source).
87731
- *
87732
- * @default false
87733
- *
87734
- * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery.html#includeCurrentBasemap)
87735
- */
87736
- includeCurrentBasemap?: boolean;
87737
87721
  /**
87738
87722
  * The source for basemaps that the widget will display.
87739
87723
  *
@@ -87765,14 +87749,6 @@ declare namespace __esri {
87765
87749
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-BasemapGalleryViewModel.html#activeBasemap)
87766
87750
  */
87767
87751
  activeBasemap: Basemap;
87768
- /**
87769
- * When `true`, adds the map's current basemap (at the time of the widget's instantiation) to the gallery if it's not found in the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-BasemapGalleryViewModel.html#source).
87770
- *
87771
- * @default false
87772
- *
87773
- * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-BasemapGalleryViewModel.html#includeCurrentBasemap)
87774
- */
87775
- includeCurrentBasemap: boolean;
87776
87752
  /**
87777
87753
  * A collection of [BasemapGalleryItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-BasemapGalleryItem.html)s representing basemaps.
87778
87754
  *
@@ -87820,14 +87796,6 @@ declare namespace __esri {
87820
87796
  * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-BasemapGalleryViewModel.html#activeBasemap)
87821
87797
  */
87822
87798
  activeBasemap?: BasemapProperties;
87823
- /**
87824
- * When `true`, adds the map's current basemap (at the time of the widget's instantiation) to the gallery if it's not found in the [source](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-BasemapGalleryViewModel.html#source).
87825
- *
87826
- * @default false
87827
- *
87828
- * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-BasemapGalleryViewModel.html#includeCurrentBasemap)
87829
- */
87830
- includeCurrentBasemap?: boolean;
87831
87799
  /**
87832
87800
  * A collection of [BasemapGalleryItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapGallery-support-BasemapGalleryItem.html)s representing basemaps.
87833
87801
  *
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.28";let t,n=r;n=`${"4.28.0"}-next.${s}`;function i(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,n as fullVersion,t as id,e as revision,i as setId,r as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as r}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.28";let t,i=e;i="4.28.0-rc.0";function n(o){t=o}function m(s){const r=t?.findCredential(s);return r?.token?o(s,"token",r.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,r as revision,n as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import i from"../core/CollectionFlattener.js";import{loadAll as t}from"../core/loadAll.js";import r from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{watch as o,syncAndInitial as l,on as a,sync as n}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as d}from"../core/accessorSupport/utils.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import c from"./Layer.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{OperationalLayer as u}from"./mixins/OperationalLayer.js";import{PortalLayer as b}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{layerLookupMap as f}from"./support/lazyLayerLoader.js";import{createFlattenedTablesCollection as j}from"../support/collectionUtils.js";import{LayersMixin as L}from"../support/LayersMixin.js";import{TablesMixin as g}from"../support/TablesMixin.js";import{WebSceneTag as w}from"../support/tagSymbols.js";import{getLayerJSON as _}from"../webdoc/support/writeUtils.js";let O=class extends(m(v(u(b(g(L(s(c)))))))){constructor(e){super(e),this.allLayers=new i({getCollections:()=>[this.layers],getChildrenFunction:e=>"layers"in e?e.layers:null}),this.allTables=j(this),this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group"}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.addHandles([o((()=>{let e=this.parent;for(;e&&"parent"in e&&e.parent;)e=e.parent;return e&&w in e}),(e=>{const i="prevent-adding-tables";this.removeHandles(i),e&&(this.tables.removeAll(),this.addHandles(a((()=>this.tables),"before-add",(e=>{e.preventDefault(),r.getLogger(this).errorOnce("tables","tables in group layers in a webscene are not supported. Please move the tables from the group layer to the webscene if you want to persist them.")})),i))}),l),o((()=>this.visible),this._onVisibilityChange.bind(this),n)])}destroy(){this.allLayers.destroy(),this.allTables.destroy()}_writeLayers(e,i,t,r){const s=[];if(!e)return s;e.forEach((e=>{const i=_(e,r.webmap?r.webmap.getLayerJSONFromResourceInfo(e):null,r);i?.layerType&&s.push(i)})),i.layers=s}set portalItem(e){this._set("portalItem",e)}set visibilityMode(e){const i=this._get("visibilityMode")!==e;this._set("visibilityMode",e),i&&this._enforceVisibility(e,this.visible)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"],layerModuleTypeMap:f},e)),Promise.resolve(this)}async loadAll(){return t(this,(e=>{e(this.layers,this.tables)}))}layerAdded(e){e.visible&&"exclusive"===this.visibilityMode?this._turnOffOtherLayers(e):"inherited"===this.visibilityMode&&(e.visible=this.visible),this.hasHandles(e.uid)?console.error(`Layer readded to Grouplayer: uid=${e.uid}`):this.addHandles(o((()=>e.visible),(i=>this._onChildVisibilityChange(e,i)),n),e.uid)}layerRemoved(e){this.removeHandles(e.uid),this._enforceVisibility(this.visibilityMode,this.visible)}_turnOffOtherLayers(e){this.layers.forEach((i=>{i!==e&&(i.visible=!1)}))}_enforceVisibility(e,i){if(!d(this).initialized)return;const t=this.layers;let r=t.find((e=>e.visible));switch(e){case"exclusive":t.length&&!r&&(r=t.at(0),r.visible=!0),this._turnOffOtherLayers(r);break;case"inherited":t.forEach((e=>{e.visible=i}))}}_onVisibilityChange(e){"inherited"===this.visibilityMode&&this.layers.forEach((i=>{i.visible=e}))}_onChildVisibilityChange(e,i){switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(e):this._isAnyLayerVisible()||(e.visible=!0);break;case"inherited":e.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some((e=>e.visible))}};e([p({readOnly:!0,dependsOn:[]})],O.prototype,"allLayers",void 0),e([p({readOnly:!0})],O.prototype,"allTables",void 0),e([p()],O.prototype,"fullExtent",void 0),e([p({json:{read:!0,write:!0}})],O.prototype,"blendMode",void 0),e([p({json:{read:!1,write:{ignoreOrigin:!0}}})],O.prototype,"layers",void 0),e([h("layers")],O.prototype,"_writeLayers",null),e([p({type:["GroupLayer"]})],O.prototype,"operationalLayerType",void 0),e([p({json:{origins:{"web-document":{read:!1,write:!1}}}})],O.prototype,"portalItem",null),e([p()],O.prototype,"spatialReference",void 0),e([p({json:{read:!1},readOnly:!0,value:"group"})],O.prototype,"type",void 0),e([p({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{type:["independent","exclusive"],write:(e,i,t)=>{"inherited"!==e&&(i[t]=e)}}}}})],O.prototype,"visibilityMode",null),O=e([y("esri.layers.GroupLayer")],O);const M=O;export{M as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import i from"../core/CollectionFlattener.js";import{loadAll as r}from"../core/loadAll.js";import t from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as o,throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as l,syncAndInitial as p,on as n,sync as d}from"../core/reactiveUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as c}from"../core/accessorSupport/utils.js";import{reader as h}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{OriginId as b}from"../core/accessorSupport/PropertyOrigin.js";import v from"./Layer.js";import{BlendLayer as f}from"./mixins/BlendLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{layerLookupMap as g}from"./support/lazyLayerLoader.js";import S from"../portal/PortalItem.js";import{createFlattenedTablesCollection as _}from"../support/collectionUtils.js";import{LayersMixin as O}from"../support/LayersMixin.js";import{TablesMixin as I}from"../support/TablesMixin.js";import{WebSceneTag as M}from"../support/tagSymbols.js";import{SaveOperationType as x}from"../webdoc/interfaces.js";import{beforeSave as A}from"../webdoc/support/saveUtils.js";import{getLayerJSON as V}from"../webdoc/support/writeUtils.js";let P=class extends(f(L(j(w(I(O(s(v)))))))){constructor(e){super(e),this.allLayers=new i({getCollections:()=>[this.layers],getChildrenFunction:e=>"layers"in e?e.layers:null}),this.allTables=_(this),this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group",this._debouncedSaveOperations=o((async(e,i,r)=>{const{save:t,saveAs:s}=await import("./save/groupLayerUtils.js");switch(e){case x.SAVE:return t(this,i);case x.SAVE_AS:return s(this,r,i)}}))}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.addHandles([l((()=>{let e=this.parent;for(;e&&"parent"in e&&e.parent;)e=e.parent;return e&&M in e}),(e=>{const i="prevent-adding-tables";this.removeHandles(i),e&&(this.tables.removeAll(),this.addHandles(n((()=>this.tables),"before-add",(e=>{e.preventDefault(),t.getLogger(this).errorOnce("tables","tables in group layers in a webscene are not supported. Please move the tables from the group layer to the webscene if you want to persist them.")})),i))}),p),l((()=>this.visible),this._onVisibilityChange.bind(this),d)])}destroy(){this.allLayers.destroy(),this.allTables.destroy()}_writeLayers(e,i,r,t){const s=[];if(!e)return s;e.forEach((e=>{const i=V(e,t.webmap?t.webmap.getLayerJSONFromResourceInfo(e):null,t);i?.layerType&&s.push(i)})),i.layers=s}set portalItem(e){this._set("portalItem",e)}readPortalItem(e,i,r){const{itemId:t,layerType:s}=i;if("GroupLayer"===s&&t)return new S({id:t,portal:r?.portal})}writePortalItem(e,i){e?.id&&(i.itemId=e.id)}set visibilityMode(e){const i=this._get("visibilityMode")!==e;this._set("visibilityMode",e),i&&this._enforceVisibility(e,this.visible)}async beforeSave(){return A(this)}load(e){const i=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Group Layer","Scene Service"],layerModuleTypeMap:g},e).catch((e=>{if(a(e),this.originIdOf("portalItem")===b.USER)throw e}));return this.addResolvingPromise(i),Promise.resolve(this)}async loadAll(){return r(this,(e=>{e(this.layers,this.tables)}))}layerAdded(e){e.visible&&"exclusive"===this.visibilityMode?this._turnOffOtherLayers(e):"inherited"===this.visibilityMode&&(e.visible=this.visible),this.hasHandles(e.uid)?console.error(`Layer readded to Grouplayer: uid=${e.uid}`):this.addHandles(l((()=>e.visible),(i=>this._onChildVisibilityChange(e,i)),d),e.uid)}layerRemoved(e){this.removeHandles(e.uid),this._enforceVisibility(this.visibilityMode,this.visible)}async save(e){return this._debouncedSaveOperations(x.SAVE,e)}async saveAs(e,i){return this._debouncedSaveOperations(x.SAVE_AS,i,e)}_turnOffOtherLayers(e){this.layers.forEach((i=>{i!==e&&(i.visible=!1)}))}_enforceVisibility(e,i){if(!c(this).initialized)return;const r=this.layers;let t=r.find((e=>e.visible));switch(e){case"exclusive":r.length&&!t&&(t=r.at(0),t.visible=!0),this._turnOffOtherLayers(t);break;case"inherited":r.forEach((e=>{e.visible=i}))}}_onVisibilityChange(e){"inherited"===this.visibilityMode&&this.layers.forEach((i=>{i.visible=e}))}_onChildVisibilityChange(e,i){switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(e):this._isAnyLayerVisible()||(e.visible=!0);break;case"inherited":e.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some((e=>e.visible))}};e([y({readOnly:!0,dependsOn:[]})],P.prototype,"allLayers",void 0),e([y({readOnly:!0})],P.prototype,"allTables",void 0),e([y()],P.prototype,"fullExtent",void 0),e([y({json:{read:!0,write:!0}})],P.prototype,"blendMode",void 0),e([y({json:{read:!1,write:{ignoreOrigin:!0}}})],P.prototype,"layers",void 0),e([u("layers")],P.prototype,"_writeLayers",null),e([y({type:["GroupLayer"]})],P.prototype,"operationalLayerType",void 0),e([y({json:{origins:{"web-map":{read:!1,write:{overridePolicy:e=>({enabled:"Group Layer"===e?.type})}},"web-scene":{read:!1,write:!1}}}})],P.prototype,"portalItem",null),e([h("web-map","portalItem",["itemId"])],P.prototype,"readPortalItem",null),e([u("web-map","portalItem",{itemId:{type:String}})],P.prototype,"writePortalItem",null),e([y()],P.prototype,"spatialReference",void 0),e([y({json:{read:!1},readOnly:!0,value:"group"})],P.prototype,"type",void 0),e([y({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{type:["independent","exclusive"],write:(e,i,r)=>{"inherited"!==e&&(i[r]=e)}}}}})],P.prototype,"visibilityMode",null),P=e([m("esri.layers.GroupLayer")],P);const E=P;export{E as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{webSceneRendererTypes as i}from"../renderers/support/types.js";import s from"../request.js";import{ClonableMixin as o}from"../core/Clonable.js";import a from"../core/Collection.js";import n from"../core/Error.js";import l from"../core/Logger.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as y}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as f}from"../core/accessorSupport/utils.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as v}from"../core/accessorSupport/PropertyOrigin.js";import b from"./Layer.js";import{APIKeyMixin as w}from"./mixins/APIKeyMixin.js";import{ArcGISService as I}from"./mixins/ArcGISService.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as F}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{SceneService as _,SaveOperationType as E}from"./mixins/SceneService.js";import{isHostedAgolService as O}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as A}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as P}from"./support/capabilities.js";import{elevationInfo as T,labelsVisible as D,legendEnabled as U,popupEnabled as x,screenSizePerspectiveEnabled as R}from"./support/commonProperties.js";import{computeEffectiveEditingEnabled as q}from"./support/featureLayerUtils.js";import{FeatureReduction as C}from"./support/FeatureReduction.js";import G from"./support/FeatureReductionSelection.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import N from"./support/FieldsIndex.js";import{fixRendererFields as k,unpackFieldNames as V}from"./support/fieldUtils.js";import{I3SNodePageDefinition as K,I3SMaterialDefinition as H,I3STextureSetDefinition as M,I3SGeometryDefinition as $}from"./support/I3SLayerDefinitions.js";import z from"./support/LabelClass.js";import{reader as W}from"./support/labelingInfo.js";import B from"./support/LayerFloorInfo.js";import{layerLookupMap as Z}from"./support/lazyLayerLoader.js";import{RangeInfo as J}from"./support/RangeInfo.js";import X from"./support/SceneFilter.js";import{loadStyleRenderer as Y}from"../renderers/support/styleUtils.js";import ee from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as te,elevationModeUnsupportedMessage as re,featureExpressionUnsupportedMessage as ie}from"../support/elevationInfoUtils.js";import{sceneLayerEditingEnabled as se}from"../support/featureFlags.js";import{createPopupTemplate as oe}from"../support/popupUtils.js";import{queryAttributesFromCachedAttributesId as ae}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as ne,getFetchPopupTemplate as le}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as pe}from"../webdoc/support/opacityUtils.js";const de=new Set(["3DObject","Point"]),ye=Q();let ue=class extends(L(_(I(j(F(S(p(w(o(b)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new a,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new N(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:K.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&q(this.associatedLayer)}get geometryType(){return he[this.profile]||"mesh"}set renderer(e){k(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:P;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:y},operations:{supportsEditing:u,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,w=!!this.associatedLayer?.infoFor3D&&se();return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:w&&a,supportsUploadWithItemId:o},data:{supportsAttachment:y,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:u&&b,supportsAdd:w&&c&&b,supportsDelete:w&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&ce[r]?ce[r]:(l.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(d),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await Y(this,{origin:"service"},t),k(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){l.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new ee;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new n("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new n("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=V(this.fieldsIndex,await ne(this,le(this)));return ae(this.parsedUrl.path,this.attributeStorageInfo??[],e,t,r)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new n("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(l.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return oe(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new n("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new n("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){if(await this.load(t),!this.statisticsInfo)throw new n("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new n("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const i of this.statisticsInfo)if(i.name===r.name){const e=c(this.parsedUrl.path,i.href);return s(e,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new n("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(E.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(E.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");if(await this.load(),!this.associatedLayer)throw new n(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),r(this,this.associatedLayer.source,e,t)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new n(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}validateLayer(e){if(e.layerType&&!de.has(e.layerType))throw new n("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new n("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new n("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new n("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new n("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new n("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some((t=>t.name===e.name))),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=f(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===v.SERVICE||o===v.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.editingInfo?.lastEditDate,t=this.associatedLayer?.serverGens,r=this.associatedLayer?.getAtOrigin("fullExtent","service");if(!se()||null==this.associatedLayer?.infoFor3D||!r||!O(this.associatedLayer?.url)||!e||this.serviceUpdateTimeStamp?.lastUpdate===e.getTime()||!this.serviceUpdateTimeStamp&&t?.minServerGen===t?.serverGen)return;f(this).setAtOrigin("fullExtent",r.clone(),v.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await A(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,apiKey:this.apiKey,signal:e}),s=await Z.FeatureLayer();this.associatedLayer=new s({url:t,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){y(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?l.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):l.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&te(l.getLogger(this),re("Mesh scene layers","relative-to-scene",e)),te(l.getLogger(this),ie("Scene layers",e))}};e([h({types:{key:"type",base:C,typeMap:{selection:G}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],ue.prototype,"featureReduction",void 0),e([h({type:[J],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],ue.prototype,"rangeInfos",void 0),e([h({json:{read:!1}})],ue.prototype,"associatedLayer",void 0),e([h({type:["show","hide"]})],ue.prototype,"listMode",void 0),e([h({type:["ArcGISSceneServiceLayer"]})],ue.prototype,"operationalLayerType",void 0),e([h({json:{read:!1},readOnly:!0})],ue.prototype,"type",void 0),e([h({...ye.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ue.prototype,"fields",void 0),e([h()],ue.prototype,"types",null),e([h()],ue.prototype,"typeIdField",null),e([h()],ue.prototype,"templates",null),e([h()],ue.prototype,"formTemplate",null),e([h({readOnly:!0})],ue.prototype,"fieldsIndex",null),e([h({type:B,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],ue.prototype,"floorInfo",void 0),e([h(ye.outFields)],ue.prototype,"outFields",void 0),e([h({type:K,readOnly:!0,json:{read:!1}})],ue.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],ue.prototype,"readNodePages",null),e([h({type:[H],readOnly:!0})],ue.prototype,"materialDefinitions",void 0),e([h({type:[M],readOnly:!0})],ue.prototype,"textureSetDefinitions",void 0),e([h({type:[$],readOnly:!0})],ue.prototype,"geometryDefinitions",void 0),e([h({readOnly:!0})],ue.prototype,"serviceUpdateTimeStamp",void 0),e([h({readOnly:!0})],ue.prototype,"attributeStorageInfo",void 0),e([h({readOnly:!0})],ue.prototype,"statisticsInfo",void 0),e([h({type:a.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],ue.prototype,"excludeObjectIds",void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],ue.prototype,"definitionExpression",void 0),e([h({type:X,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],ue.prototype,"filter",void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ue.prototype,"path",void 0),e([h(T)],ue.prototype,"elevationInfo",null),e([h({readOnly:!0,json:{read:!1}})],ue.prototype,"effectiveCapabilities",null),e([h({readOnly:!0})],ue.prototype,"effectiveEditingEnabled",null),e([h({type:String})],ue.prototype,"geometryType",null),e([h(D)],ue.prototype,"labelsVisible",void 0),e([h({type:[z],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:W},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:W},write:!0}})],ue.prototype,"labelingInfo",void 0),e([h(U)],ue.prototype,"legendEnabled",void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?pe(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],ue.prototype,"opacity",void 0),e([h({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ue.prototype,"priority",void 0),e([h({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ue.prototype,"semantic",void 0),e([h({types:i,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],ue.prototype,"renderer",null),e([h({json:{read:!1}})],ue.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],ue.prototype,"readCachedDrawingInfo",null),e([h({readOnly:!0,json:{read:!1}})],ue.prototype,"capabilities",null),e([h({type:Boolean,json:{read:!1}})],ue.prototype,"editingEnabled",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],ue.prototype,"infoFor3D",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],ue.prototype,"relationships",null),e([h(x)],ue.prototype,"popupEnabled",void 0),e([h({type:r,json:{name:"popupInfo",write:!0}})],ue.prototype,"popupTemplate",void 0),e([h({readOnly:!0,json:{read:!1}})],ue.prototype,"defaultPopupTemplate",null),e([h({type:String,json:{read:!1}})],ue.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],ue.prototype,"readObjectIdField",null),e([h({type:String,json:{read:!1}})],ue.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],ue.prototype,"readGlobalIdField",null),e([h({readOnly:!0,type:String,json:{read:!1}})],ue.prototype,"displayField",null),e([h({type:String,json:{read:!1}})],ue.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],ue.prototype,"readProfile",null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],ue.prototype,"normalReferenceFrame",void 0),e([h(R)],ue.prototype,"screenSizePerspectiveEnabled",void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],ue.prototype,"serviceItemId",void 0),ue=e([g("esri.layers.SceneLayer")],ue);const ce={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},he={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},fe=ue;export{fe as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Graphic.js";import r from"../PopupTemplate.js";import"../renderers/ClassBreaksRenderer.js";import"../renderers/DictionaryRenderer.js";import"../renderers/DotDensityRenderer.js";import"../renderers/HeatmapRenderer.js";import"../renderers/PieChartRenderer.js";import"../renderers/Renderer.js";import"../renderers/SimpleRenderer.js";import"../renderers/UniqueValueRenderer.js";import"../renderers/support/jsonUtils.js";import{webSceneRendererTypes as i}from"../renderers/support/types.js";import s from"../request.js";import{ClonableMixin as o}from"../core/Clonable.js";import a from"../core/Collection.js";import n from"../core/Error.js";import l from"../core/Logger.js";import{MultiOriginJSONMixin as p}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as d,isAbortError as y}from"../core/promiseUtils.js";import{whenOnce as u}from"../core/reactiveUtils.js";import{join as c}from"../core/urlUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{getProperties as f}from"../core/accessorSupport/utils.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as v}from"../core/accessorSupport/PropertyOrigin.js";import b from"./Layer.js";import{APIKeyMixin as I}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{EditBusLayer as L}from"./mixins/EditBusLayer.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as F}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{SceneService as _,SaveOperationType as O}from"./mixins/SceneService.js";import{isHostedAgolService as E}from"./support/arcgisLayerUrl.js";import{findAssociatedFeatureService as A}from"./support/associatedFeatureServiceUtils.js";import{zeroCapabilities as P}from"./support/capabilities.js";import{elevationInfo as T,labelsVisible as D,legendEnabled as U,popupEnabled as x,screenSizePerspectiveEnabled as R}from"./support/commonProperties.js";import{computeEffectiveEditingEnabled as q,getGlobalIdToObjectIdMap as C}from"./support/featureLayerUtils.js";import{FeatureReduction as G}from"./support/FeatureReduction.js";import Q from"./support/FeatureReductionSelection.js";import{defineFieldProperties as N}from"./support/fieldProperties.js";import k from"./support/FieldsIndex.js";import{fixRendererFields as V,unpackFieldNames as K}from"./support/fieldUtils.js";import{I3SNodePageDefinition as H,I3SMaterialDefinition as M,I3STextureSetDefinition as $,I3SGeometryDefinition as z}from"./support/I3SLayerDefinitions.js";import W from"./support/LabelClass.js";import{reader as B}from"./support/labelingInfo.js";import Z from"./support/LayerFloorInfo.js";import{layerLookupMap as J}from"./support/lazyLayerLoader.js";import{RangeInfo as X}from"./support/RangeInfo.js";import Y from"./support/SceneFilter.js";import{loadStyleRenderer as ee}from"../renderers/support/styleUtils.js";import te from"../rest/support/Query.js";import{logInvalidElevationInfoWarning as re,elevationModeUnsupportedMessage as ie,featureExpressionUnsupportedMessage as se}from"../support/elevationInfoUtils.js";import{sceneLayerEditingEnabled as oe}from"../support/featureFlags.js";import{createPopupTemplate as ae}from"../support/popupUtils.js";import{queryAttributesFromCachedAttributesId as ne}from"../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as le,getFetchPopupTemplate as pe}from"../views/layers/support/popupUtils.js";import{transparencyToOpacity as de}from"../webdoc/support/opacityUtils.js";const ye=new Set(["3DObject","Point"]),ue=N();let ce=class extends(L(_(w(j(F(S(p(I(o(b)))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new a,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getFeatureType(t?.feature)?.domains?.[e];return r&&"inherited"!==r.type?r:this.getField(e)?.domain??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new k(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:H.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&q(this.associatedLayer)}get geometryType(){return fe[this.profile]||"mesh"}set renderer(e){V(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:P;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:n},data:{supportsZ:l,supportsM:p,isVersioned:d,supportsAttachment:y},operations:{supportsEditing:u,supportsAdd:c,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,b=e.operations.supportsChangeTracking,I=!!this.associatedLayer?.infoFor3D&&oe();return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:n,supportsRollbackOnFailure:s,supportsGeometryUpdate:I&&a,supportsUploadWithItemId:o},data:{supportsAttachment:y,supportsZ:l,supportsM:p,isVersioned:d},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:u&&b,supportsAdd:I&&c&&b,supportsDelete:I&&f&&b,supportsUpdate:h&&b,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&he[r]?he[r]:(l.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(d),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await ee(this,{origin:"service"},t),V(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){l.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new te;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new n("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new n("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=K(this.fieldsIndex,await le(this,pe(this)));return ne(this.parsedUrl.path,this.attributeStorageInfo??[],e,t,r)}async queryCachedFeature(e,r){const i=await this.queryCachedAttributes(e,[r]);if(!i||0===i.length)throw new n("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const s=new t;return s.attributes=i[0],s.layer=this,s.sourceLayer=this,s}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(l.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return ae(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new n("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new n("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){if(await this.load(t),!this.statisticsInfo)throw new n("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new n("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const i of this.statisticsInfo)if(i.name===r.name){const e=c(this.parsedUrl.path,i.href);return s(e,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then((e=>e.data))}throw new n("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(O.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(O.SAVE,e)}async applyEdits(e,t){const{applyEdits:r}=await import("./graphics/editingSupport.js");let i=t;await this.load();const s=this.associatedLayer;if(!s)throw new n(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:o}=s;return E(s.url)&&s.infoFor3D&&null!=e.deleteFeatures&&null!=o&&(i={...i,globalIdToObjectId:await C(s,e.deleteFeatures,o)}),r(this,s.source,e,i)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new n(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}validateLayer(e){if(e.layerType&&!ye.has(e.layerType))throw new n("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new n("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new n("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function t(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new n("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new n("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}t(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new n("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some((t=>t.name===e.name))),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],t=f(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===v.SERVICE||o===v.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.editingInfo?.lastEditDate,t=this.associatedLayer?.serverGens,r=this.associatedLayer?.getAtOrigin("fullExtent","service");if(!oe()||null==this.associatedLayer?.infoFor3D||!r||!E(this.associatedLayer?.url)||!e||this.serviceUpdateTimeStamp?.lastUpdate===e.getTime()||!this.serviceUpdateTimeStamp&&t?.minServerGen===t?.serverGen)return;f(this).setAtOrigin("fullExtent",r.clone(),v.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await A(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,apiKey:this.apiKey,signal:e}),s=await J.FeatureLayer();this.associatedLayer=new s({url:t,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(t){y(t)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){await u((()=>this.popupEnabled&&null!=this.popupTemplate));const e=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?l.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):l.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&re(l.getLogger(this),ie("Mesh scene layers","relative-to-scene",e)),re(l.getLogger(this),se("Scene layers",e))}};e([h({types:{key:"type",base:G,typeMap:{selection:Q}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],ce.prototype,"featureReduction",void 0),e([h({type:[X],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],ce.prototype,"rangeInfos",void 0),e([h({json:{read:!1}})],ce.prototype,"associatedLayer",void 0),e([h({type:["show","hide"]})],ce.prototype,"listMode",void 0),e([h({type:["ArcGISSceneServiceLayer"]})],ce.prototype,"operationalLayerType",void 0),e([h({json:{read:!1},readOnly:!0})],ce.prototype,"type",void 0),e([h({...ue.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ce.prototype,"fields",void 0),e([h()],ce.prototype,"types",null),e([h()],ce.prototype,"typeIdField",null),e([h()],ce.prototype,"templates",null),e([h()],ce.prototype,"formTemplate",null),e([h({readOnly:!0})],ce.prototype,"fieldsIndex",null),e([h({type:Z,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],ce.prototype,"floorInfo",void 0),e([h(ue.outFields)],ce.prototype,"outFields",void 0),e([h({type:H,readOnly:!0,json:{read:!1}})],ce.prototype,"nodePages",void 0),e([m("service","nodePages",["nodePages","pointNodePages"])],ce.prototype,"readNodePages",null),e([h({type:[M],readOnly:!0})],ce.prototype,"materialDefinitions",void 0),e([h({type:[$],readOnly:!0})],ce.prototype,"textureSetDefinitions",void 0),e([h({type:[z],readOnly:!0})],ce.prototype,"geometryDefinitions",void 0),e([h({readOnly:!0})],ce.prototype,"serviceUpdateTimeStamp",void 0),e([h({readOnly:!0})],ce.prototype,"attributeStorageInfo",void 0),e([h({readOnly:!0})],ce.prototype,"statisticsInfo",void 0),e([h({type:a.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],ce.prototype,"excludeObjectIds",void 0),e([h({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],ce.prototype,"definitionExpression",void 0),e([h({type:Y,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],ce.prototype,"filter",void 0),e([h({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ce.prototype,"path",void 0),e([h(T)],ce.prototype,"elevationInfo",null),e([h({readOnly:!0,json:{read:!1}})],ce.prototype,"effectiveCapabilities",null),e([h({readOnly:!0})],ce.prototype,"effectiveEditingEnabled",null),e([h({type:String})],ce.prototype,"geometryType",null),e([h(D)],ce.prototype,"labelsVisible",void 0),e([h({type:[W],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:B},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:B},write:!0}})],ce.prototype,"labelingInfo",void 0),e([h(U)],ce.prototype,"legendEnabled",void 0),e([h({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?de(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],ce.prototype,"opacity",void 0),e([h({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ce.prototype,"priority",void 0),e([h({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],ce.prototype,"semantic",void 0),e([h({types:i,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],ce.prototype,"renderer",null),e([h({json:{read:!1}})],ce.prototype,"cachedDrawingInfo",void 0),e([m("service","cachedDrawingInfo")],ce.prototype,"readCachedDrawingInfo",null),e([h({readOnly:!0,json:{read:!1}})],ce.prototype,"capabilities",null),e([h({type:Boolean,json:{read:!1}})],ce.prototype,"editingEnabled",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],ce.prototype,"infoFor3D",null),e([h({readOnly:!0,json:{write:!1,read:!1}})],ce.prototype,"relationships",null),e([h(x)],ce.prototype,"popupEnabled",void 0),e([h({type:r,json:{name:"popupInfo",write:!0}})],ce.prototype,"popupTemplate",void 0),e([h({readOnly:!0,json:{read:!1}})],ce.prototype,"defaultPopupTemplate",null),e([h({type:String,json:{read:!1}})],ce.prototype,"objectIdField",void 0),e([m("service","objectIdField",["objectIdField","fields"])],ce.prototype,"readObjectIdField",null),e([h({type:String,json:{read:!1}})],ce.prototype,"globalIdField",void 0),e([m("service","globalIdField",["globalIdField","fields"])],ce.prototype,"readGlobalIdField",null),e([h({readOnly:!0,type:String,json:{read:!1}})],ce.prototype,"displayField",null),e([h({type:String,json:{read:!1}})],ce.prototype,"profile",void 0),e([m("service","profile",["store.profile"])],ce.prototype,"readProfile",null),e([h({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],ce.prototype,"normalReferenceFrame",void 0),e([h(R)],ce.prototype,"screenSizePerspectiveEnabled",void 0),e([h({json:{read:!1,origins:{service:{read:!0}}}})],ce.prototype,"serviceItemId",void 0),ce=e([g("esri.layers.SceneLayer")],ce);const he={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},fe={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},me=ce;export{me as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{createResolver as i}from"../../core/promiseUtils.js";import{dataComponents as n}from"../../core/urlUtils.js";import{generateBracedUUID as o}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isEditBusLayer as l,emitApplyEditsEvent as u}from"../mixins/EditBusLayer.js";import{isValidFieldValue as p}from"../support/fieldUtils.js";import{getMimeTypeFormatId as c,getFilenameFormatId as h}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as m,getEffectiveLayerCapabilities as f}from"../support/layerUtils.js";function y(e){return null!=e?.applyEdits}function g(e){return"object"==typeof e&&null!=e&&"objectId"in e&&!!e.objectId}function b(e){return e.every(g)}function w(e){return"object"==typeof e&&null!=e&&"globalId"in e&&!!e.globalId}function F(e){return e.every(w)}async function A(e,t,a,s={}){let n;if(l(e)&&e.url)n=u(e.url,e.layerId,s.gdbVersion,"original-and-current-features"===s.returnServiceEditsOption);else{n=i(),n.promise.then((t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)}));const t={result:n.promise};e.emit("apply-edits",t)}try{const{results:i,edits:o}=await v(e,t,a,s),d=e=>e.filter((e=>!e.error)).map(r),l={edits:o,addedFeatures:d(i.addFeatureResults),updatedFeatures:d(i.updateFeatureResults),deletedFeatures:d(i.deleteFeatureResults),addedAttachments:d(i.addAttachmentResults),updatedAttachments:d(i.updateAttachmentResults),deletedAttachments:d(i.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:i.editMoment?new Date(i.editMoment):null};return i.editedFeatureResults?.length&&(l.editedFeatures=i.editedFeatureResults),n.resolve(l),i}catch(o){throw n.reject(o),o}}async function v(e,t,r,s){if(await e.load(),!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!m(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:i,options:n}=await I(e,r,s);return i.addFeatures?.length||i.updateFeatures?.length||i.deleteFeatures?.length||i.addAttachments?.length||i.updateAttachments?.length||i.deleteAttachments?.length?{edits:i,results:await t.applyEdits(i,n)}:{edits:i,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function I(e,t,r){const i=f(e),n=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),o=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),d=null!=e.infoFor3D;if(D(t,i,r,!!n,!!o,`${e.type}-layer`),!i.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!i.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const l={...r};if(null!=l.rollbackOnFailureEnabled||i.editing.supportsRollbackOnFailure||(l.rollbackOnFailureEnabled=!0),l.rollbackOnFailureEnabled||"original-and-current-features"!==l.returnServiceEditsOption||(!1===l.rollbackOnFailureEnabled&&s.getLogger("esri.layers.graphics.editingSupport").warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwrritten and set to true."),l.rollbackOnFailureEnabled=!0),!i.editing.supportsReturnServiceEditsInSourceSpatialReference&&l.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(l.returnServiceEditsInSourceSR&&"original-and-current-features"!==l.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=B(t,i,`${e.type}-layer`),p=r?.globalIdUsed||d,c=e.fields.filter((e=>"big-integer"===e.type||"oid"===e.type&&e.length>=8));if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach((e=>U(e,t)))}u.addFeatures.forEach((t=>S(t,e,p,c))),u.updateFeatures.forEach((t=>j(t,e,p,c))),u.deleteFeatures.forEach((t=>R(t,e,p,c))),u.addAttachments.forEach((t=>O(t,e))),u.updateAttachments.forEach((t=>O(t,e))),d&&await T(u,e);return{edits:await L(u),options:l}}function $(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const i of s){const r=e.attributes[i.name];if(void 0!==r&&!p(i,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${i.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function E(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D){const{geometry:r}=e;if(r.vertexSpace.isGeoreferenced)throw new a(`${t.type}-layer:georeferenced-mesh-unsupported`,"Uploading georeferenced meshes to a layer is not supported.")}}function S(e,t,a,r){$(e,t,a,r),E(e,t)}function R(e,t,a,r){$(e,t,a,r)}function j(e,t,r,s){$(e,t,r,s),E(e,t);const i=f(t);if("geometry"in e&&null!=e.geometry&&!i?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function O(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=n(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function U(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=o())}async function L(e){const t=e.addFeatures??[],a=e.updateFeatures??[],r=t.concat(a).map((e=>e.geometry)),s=await d(r),i=t.length,n=a.length;return s.slice(0,i).forEach(((e,a)=>t[a].geometry=e)),s.slice(i,i+n).forEach(((e,t)=>a[t].geometry=e)),e}function k(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function B(e,t,r){const s=k(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(G),s.updateFeatures=s.updateFeatures.map(G),s.addAssetFeatures=[],s}function D(e,t,r,s,i,n){if(!e||!s&&!i)throw new a(`${n}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&r?.globalIdUsed)throw new a(`${n}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&i)throw new a(`${n}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&i)throw new a(`${n}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function G(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function T(e,t){if(null==t.infoFor3D)return;const{infoFor3D:r}=t,s=c("model/gltf-binary",r.supportedFormats)??h("glb",r.supportedFormats);if(!(!!s&&r.editFormats.includes(s)))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:i}=e;for(const a of e.addFeatures??[])M(a)&&i.push(a);for(const a of e.updateFeatures??[])M(a)&&i.push(a)}function M(e){return"mesh"===e?.geometry?.type}function V(e,t,r,s){if(!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{A as applyEdits,D as checkEditingCapabilities,F as isFeatureIdentifierArrayWithGlobalId,b as isFeatureIdentifierArrayWithObjectId,w as isFeatureIdentifierWithGlobalId,g as isFeatureIdentifierWithObjectId,k as normalizeCollections,B as normalizeEdits,L as normalizeGeometries,G as shallowCloneFeature,V as uploadAssets};
5
+ import e from"../../Graphic.js";import t from"../../core/Collection.js";import a from"../../core/Error.js";import{clone as r}from"../../core/lang.js";import s from"../../core/Logger.js";import{createResolver as o}from"../../core/promiseUtils.js";import{dataComponents as i}from"../../core/urlUtils.js";import{generateBracedUUID as n}from"../../core/uuid.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{isEditBusLayer as l,emitApplyEditsEvent as u}from"../mixins/EditBusLayer.js";import{isValidFieldValue as p}from"../support/fieldUtils.js";import{getMimeTypeFormatId as c,getFilenameFormatId as h}from"../support/infoFor3D.js";import{getEffectiveEditingEnabled as m,getEffectiveLayerCapabilities as f}from"../support/layerUtils.js";function y(e){return null!=e?.applyEdits}function g(e){return"object"==typeof e&&null!=e&&"objectId"in e&&!!e.objectId}function b(e){return e.every(g)}function w(e){return"object"==typeof e&&null!=e&&"globalId"in e&&!!e.globalId}function F(e){return e.every(w)}async function A(e,t,a,s={}){let i;if(l(e)&&e.url)i=u(e.url,e.layerId,s.gdbVersion,"original-and-current-features"===s.returnServiceEditsOption);else{i=o(),i.promise.then((t=>{(t.addedFeatures.length||t.updatedFeatures.length||t.deletedFeatures.length||t.addedAttachments.length||t.updatedAttachments.length||t.deletedAttachments.length)&&e.emit("edits",t)}));const t={result:i.promise};e.emit("apply-edits",t)}try{const{results:o,edits:n}=await v(e,t,a,s),d=e=>e.filter((e=>!e.error)).map(r),l={edits:n,addedFeatures:d(o.addFeatureResults),updatedFeatures:d(o.updateFeatureResults),deletedFeatures:d(o.deleteFeatureResults),addedAttachments:d(o.addAttachmentResults),updatedAttachments:d(o.updateAttachmentResults),deletedAttachments:d(o.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:o.editMoment?new Date(o.editMoment):null,globalIdToObjectId:s.globalIdToObjectId};return o.editedFeatureResults?.length&&(l.editedFeatures=o.editedFeatureResults),i.resolve(l),o}catch(n){throw i.reject(n),n}}async function v(e,t,r,s){if(await e.load(),!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!m(e))throw new a(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:o,options:i}=await I(e,r,s);return o.addFeatures?.length||o.updateFeatures?.length||o.deleteFeatures?.length||o.addAttachments?.length||o.updateAttachments?.length||o.deleteAttachments?.length?{edits:o,results:await t.applyEdits(o,i)}:{edits:o,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function I(e,t,r){const o=f(e),i=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),n=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),d=null!=e.infoFor3D;if(T(t,o,r,!!i,!!n,`${e.type}-layer`),!o.data.isVersioned&&r?.gdbVersion)throw new a(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!o.editing.supportsRollbackOnFailure&&r?.rollbackOnFailureEnabled)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const l={...r};if(null!=l.rollbackOnFailureEnabled||o.editing.supportsRollbackOnFailure||(l.rollbackOnFailureEnabled=!0),l.rollbackOnFailureEnabled||"original-and-current-features"!==l.returnServiceEditsOption||(!1===l.rollbackOnFailureEnabled&&s.getLogger("esri.layers.graphics.editingSupport").warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwrritten and set to true."),l.rollbackOnFailureEnabled=!0),!o.editing.supportsReturnServiceEditsInSourceSpatialReference&&l.returnServiceEditsInSourceSR)throw new a(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(l.returnServiceEditsInSourceSR&&"original-and-current-features"!==l.returnServiceEditsOption)throw new a(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const u=B(t,o,`${e.type}-layer`),p=r?.globalIdUsed||d,c=e.fields.filter((e=>"big-integer"===e.type||"oid"===e.type&&e.length>=8));if(p){const{globalIdField:t}=e;if(null==t)throw new a(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");u.addFeatures.forEach((e=>U(e,t)))}u.addFeatures.forEach((t=>S(t,e,p,c))),u.updateFeatures.forEach((t=>j(t,e,p,c))),u.deleteFeatures.forEach((t=>R(t,e,p,c))),u.addAttachments.forEach((t=>O(t,e))),u.updateAttachments.forEach((t=>O(t,e))),d&&await G(u,e);return{edits:await L(u),options:l}}function $(e,t,r,s){if(r){if("attributes"in e&&!e.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(s.length&&"attributes"in e)for(const o of s){const r=e.attributes[o.name];if(void 0!==r&&!p(o,r))throw new a(`${t.type}-layer:invalid-parameter`,`Big-integer field '${o.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&null!=e.geometry){if(e.geometry.hasZ&&!1===t.capabilities?.data.supportsZ)throw new a(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities?.data.supportsM)throw new a(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function E(e,t){if("geometry"in e&&"mesh"===e.geometry?.type&&null!=t.infoFor3D){const{geometry:r}=e;if(r.vertexSpace.isGeoreferenced)throw new a(`${t.type}-layer:georeferenced-mesh-unsupported`,"Uploading georeferenced meshes to a layer is not supported.")}}function S(e,t,a,r){$(e,t,a,r),E(e,t)}function R(e,t,a,r){$(e,t,a,r)}function j(e,t,r,s){$(e,t,r,s),E(e,t);const o=f(t);if("geometry"in e&&null!=e.geometry&&!o?.editing.supportsGeometryUpdate)throw new a(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function O(e,t){const{feature:r,attachment:s}=e;if(!r||"attributes"in r&&!r.attributes[t.globalIdField])throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in r)&&!r.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!s.globalId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!s.data&&!s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(s.data instanceof File&&!!s.data.name)&&!s.name)throw new a(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities?.editing.supportsUploadWithItemId&&s.uploadId)throw new a(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof s.data){const e=i(s.data);if(e&&!e.isBase64)throw new a(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function U(e,t){const{attributes:a}=e;null==a[t]&&(a[t]=n())}async function L(e){const t=e.addFeatures??[],a=e.updateFeatures??[],r=t.concat(a).map((e=>e.geometry)),s=await d(r),o=t.length,i=a.length;return s.slice(0,o).forEach(((e,a)=>t[a].geometry=e)),s.slice(o,o+i).forEach(((e,t)=>a[t].geometry=e)),e}function k(e){return{addFeatures:Array.from(e?.addFeatures??[]),updateFeatures:Array.from(e?.updateFeatures??[]),deleteFeatures:e&&t.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function B(e,t,r){const s=k(e);if(s.addFeatures?.length&&!t.operations.supportsAdd)throw new a(`${r}:unsupported-operation`,"Layer does not support adding features.");if(s.updateFeatures?.length&&!t.operations.supportsUpdate)throw new a(`${r}:unsupported-operation`,"Layer does not support updating features.");if(s.deleteFeatures?.length&&!t.operations.supportsDelete)throw new a(`${r}:unsupported-operation`,"Layer does not support deleting features.");return s.addFeatures=s.addFeatures.map(D),s.updateFeatures=s.updateFeatures.map(D),s.addAssetFeatures=[],s}function T(e,t,r,s,o,i){if(!e||!s&&!o)throw new a(`${i}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&r?.globalIdUsed)throw new a(`${i}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&o)throw new a(`${i}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!r?.globalIdUsed&&o)throw new a(`${i}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function D(t){const a=new e;return t.attributes||(t.attributes={}),a.geometry=t.geometry,a.attributes=t.attributes,a}async function G(e,t){if(null==t.infoFor3D)return;const{infoFor3D:r}=t,s=c("model/gltf-binary",r.supportedFormats)??h("glb",r.supportedFormats);if(!(!!s&&r.editFormats.includes(s)))throw new a(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??=[];const{addAssetFeatures:o}=e;for(const a of e.addFeatures??[])M(a)&&o.push(a);for(const a of e.updateFeatures??[])M(a)&&o.push(a)}function M(e){return"mesh"===e?.geometry?.type}function V(e,t,r,s){if(!y(t))throw new a(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new a(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(r,s)}export{A as applyEdits,T as checkEditingCapabilities,F as isFeatureIdentifierArrayWithGlobalId,b as isFeatureIdentifierArrayWithObjectId,w as isFeatureIdentifierWithGlobalId,g as isFeatureIdentifierWithObjectId,k as normalizeCollections,B as normalizeEdits,L as normalizeGeometries,D as shallowCloneFeature,V as uploadAssets};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as e}from"../../../core/asyncUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Logger.js";import{throwIfAborted as s,isAbortError as a}from"../../../core/promiseUtils.js";import{equals as i}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as o,convertToGeometry as n}from"../featureConversionUtils.js";import{checkProjectionSupport as u,project as p}from"../data/projectionSupport.js";import{validateGeoJSON as l,createOptimizedFeatures as h}from"./geojson/geojson.js";import{mixAttributes as c}from"./support/sourceUtils.js";import{getGetFeatureSpatialReference as y,getFeature as m}from"../../ogc/wfsUtils.js";import f from"../../support/FieldsIndex.js";import{utc as g}from"../../../time/timeZoneUtils.js";class d{constructor(){this._queryEngine=null,this._customParameters=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=null}async load(e,r){const{getFeatureUrl:a,getFeatureOutputFormat:i,fields:o,geometryType:n,featureType:p,objectIdField:l,customParameters:h}=e,{spatialReference:c,getFeatureSpatialReference:m}=y(a,p,e.spatialReference);this._featureType=p,this._customParameters=h,this._getFeatureUrl=a,this._getFeatureOutputFormat=i,this._getFeatureSpatialReference=m;try{await u(m,c)}catch{throw new t("unsupported-projection","Projection not supported",{inSpatialReference:m,outSpatialReference:c})}s(r);const d=f.fromLayerJSON({fields:o,dateFieldsTimeReference:o.some((e=>"esriFieldTypeDate"===e.type))?{timeZoneIANA:g}:null}),[_,{QueryEngine:F,FeatureStore:w}]=await Promise.all([this._snapshotFeatures({fieldsIndex:d,geometryType:n,objectIdField:l,spatialReference:c},r.signal),import("./support/QueryEngineBuildLayer.js")]);return this._queryEngine=new F({fieldsIndex:d,geometryType:n,hasM:!1,hasZ:!1,objectIdField:l,spatialReference:c,timeInfo:null,featureStore:new w({geometryType:n,hasM:!1,hasZ:!1})}),this._queryEngine.featureStore.addMany(_),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async applyEdits(){throw new t("wfs-source:editing-not-supported","applyEdits() is not supported on WFSLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(s){return this._customParameters=s,this._snapshotTask?.abort(),this._snapshotTask=e((e=>this._snapshotFeatures(this._queryEngine,e))),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),e&&this._queryEngine.featureStore.addMany(e)}),(e=>{this._queryEngine.featureStore.clear(),a(e)||r.getLogger("esri.layers.WFSLayer").error(new t("wfs-layer:getfeature-error","An error occurred during the GetFeature request",{error:e}))})),await this._waitSnapshotComplete(),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _snapshotFeatures({objectIdField:e,geometryType:t,spatialReference:r,fieldsIndex:a},u){const y=await m(this._getFeatureUrl??"",this._featureType.typeName,this._getFeatureSpatialReference,this._getFeatureOutputFormat,{customParameters:this._customParameters,signal:u});l(y,this._getFeatureSpatialReference.wkid),s(u);const f=h(y,{geometryType:t,hasZ:!1,objectIdField:e});if(!i(r,this._getFeatureSpatialReference))for(const s of f)null!=s.geometry&&(s.geometry=o(p(n(s.geometry,t,!1,!1),this._getFeatureSpatialReference,r)));let g=1;for(const s of f){const t={};c(a,t,s.attributes,!0),s.attributes=t,null==t[e]&&(s.objectId=t[e]=g++)}return f}}export{d as default};
5
+ import{createTask as e}from"../../../core/asyncUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Logger.js";import{throwIfAborted as s,isAbortError as a}from"../../../core/promiseUtils.js";import{equals as i}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as o,convertToGeometry as n}from"../featureConversionUtils.js";import u from"../data/FeatureStore.js";import{checkProjectionSupport as p,project as l}from"../data/projectionSupport.js";import{QueryEngine as h}from"../data/QueryEngine.js";import{validateGeoJSON as c,createOptimizedFeatures as m}from"./geojson/geojson.js";import{mixAttributes as y}from"./support/sourceUtils.js";import{getGetFeatureSpatialReference as f,getFeature as g}from"../../ogc/wfsUtils.js";import d from"../../support/FieldsIndex.js";import{utc as _}from"../../../time/timeZoneUtils.js";class F{constructor(){this._queryEngine=null,this._customParameters=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=null}async load(e,r){const{getFeatureUrl:a,getFeatureOutputFormat:i,fields:o,geometryType:n,featureType:l,objectIdField:c,customParameters:m}=e,{spatialReference:y,getFeatureSpatialReference:g}=f(a,l,e.spatialReference);this._featureType=l,this._customParameters=m,this._getFeatureUrl=a,this._getFeatureOutputFormat=i,this._getFeatureSpatialReference=g;try{await p(g,y)}catch{throw new t("unsupported-projection","Projection not supported",{inSpatialReference:g,outSpatialReference:y})}s(r);const F=d.fromLayerJSON({fields:o,dateFieldsTimeReference:o.some((e=>"esriFieldTypeDate"===e.type))?{timeZoneIANA:_}:null}),w=await this._snapshotFeatures({fieldsIndex:F,geometryType:n,objectIdField:c,spatialReference:y},r.signal);return this._queryEngine=new h({fieldsIndex:F,geometryType:n,hasM:!1,hasZ:!1,objectIdField:c,spatialReference:y,timeInfo:null,featureStore:new u({geometryType:n,hasM:!1,hasZ:!1})}),this._queryEngine.featureStore.addMany(w),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async applyEdits(){throw new t("wfs-source:editing-not-supported","applyEdits() is not supported on WFSLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(s){return this._customParameters=s,this._snapshotTask?.abort(),this._snapshotTask=e((e=>this._snapshotFeatures(this._queryEngine,e))),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),e&&this._queryEngine.featureStore.addMany(e)}),(e=>{this._queryEngine.featureStore.clear(),a(e)||r.getLogger("esri.layers.WFSLayer").error(new t("wfs-layer:getfeature-error","An error occurred during the GetFeature request",{error:e}))})),await this._waitSnapshotComplete(),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _snapshotFeatures({objectIdField:e,geometryType:t,spatialReference:r,fieldsIndex:a},u){const p=await g(this._getFeatureUrl??"",this._featureType.typeName,this._getFeatureSpatialReference,this._getFeatureOutputFormat,{customParameters:this._customParameters,signal:u});c(p,this._getFeatureSpatialReference.wkid),s(u);const h=m(p,{geometryType:t,hasZ:!1,objectIdField:e});if(!i(r,this._getFeatureSpatialReference))for(const s of h)null!=s.geometry&&(s.geometry=o(l(n(s.geometry,t,!1,!1),this._getFeatureSpatialReference,r)));let f=1;for(const s of h){const t={};y(a,t,s.attributes,!0),s.attributes=t,null==t[e]&&(s.objectId=t[e]=f++)}return h}}export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import{createTask as t}from"../../../../core/asyncUtils.js";import s from"../../../../core/Error.js";import i from"../../../../core/Logger.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{getJsonType as n}from"../../../../geometry/support/jsonUtils.js";import{WGS84 as a,equals as o}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as l,convertToGeometry as u,convertFromFeatures as d,convertToFeature as p,convertFromFeature as c}from"../../featureConversionUtils.js";import{checkProjectionSupport as y,project as m}from"../../data/projectionSupport.js";import{inferLayerProperties as h,createOptimizedFeatures as f,validateGeoJSON as g}from"./geojson.js";import{createDrawingInfo as _,createDefaultTemplate as F,createDefaultAttributesFunction as I}from"../support/clientSideDefaults.js";import{loadGeometryEngineForSimplify as E,mixAttributes as j,createFeatureEditSuccessResult as b,createFeatureEditErrorResult as T,simplify as w}from"../support/sourceUtils.js";import q from"../../../support/FieldsIndex.js";import{kebabDict as x}from"../../../support/fieldType.js";import{getFieldDefaultValue as S}from"../../../support/fieldUtils.js";import{utc as R}from"../../../../time/timeZoneUtils.js";const O={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class k{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};const i=[],[r,{QueryEngine:n,FeatureStore:o}]=await Promise.all([e.url?this._fetch(t?.signal):null,import("../support/QueryEngineBuildLayer.js"),this._checkProjection(e.spatialReference)]),l=h(r,{geometryType:e.geometryType}),u=e.fields||l.fields||[],d=null!=e.hasZ?e.hasZ:l.hasZ,p=l.geometryType;let c=e.objectIdField||l.objectIdFieldName||"__OBJECTID";const y=e.spatialReference||a;let m=e.timeInfo;u===l.fields&&l.unknownFields.length>0&&i.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:l.unknownFields}});const f=new q(u);let g=f.get(c);g?("esriFieldTypeString"!==g.type&&(g.type="esriFieldTypeOID"),g.editable=!1,g.nullable=!1,c=g.name):(g={alias:c,name:c,type:"string"===l.objectIdFieldType?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},u.unshift(g));const E={};for(const a of u){if(null==a.name&&(a.name=a.alias),null==a.alias&&(a.alias=a.name),!a.name)throw new s("geojson-layer:invalid-field-name","field name is missing",{field:a});if(!x.jsonValues.includes(a.type))throw new s("geojson-layer:invalid-field-type",`invalid type for field "${a.name}"`,{field:a});if(a.name!==g.name){const e=S(a);void 0!==e&&(E[a.name]=e)}}if(m){if(m.startTimeField){const e=f.get(m.startTimeField);e?(m.startTimeField=e.name,e.type="esriFieldTypeDate"):m.startTimeField=null}if(m.endTimeField){const e=f.get(m.endTimeField);e?(m.endTimeField=e.name,e.type="esriFieldTypeDate"):m.endTimeField=null}if(m.trackIdField){const e=f.get(m.trackIdField);e?m.trackIdField=e.name:(m.trackIdField=null,i.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:m}}))}m.startTimeField||m.endTimeField||(i.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:m}}),m=null)}const j=p?_(p):void 0,b=f.dateFields.length?{timeZoneIANA:R}:null,T={warnings:i,featureErrors:[],layerDefinition:{...O,drawingInfo:j??void 0,templates:F(E),extent:void 0,geometryType:p,objectIdField:c,fields:u,hasZ:!!d,timeInfo:m,dateFieldsTimeReference:b}};this._queryEngine=new n({fieldsIndex:q.fromLayerJSON({fields:u,timeInfo:m,dateFieldsTimeReference:b}),geometryType:p,hasM:!1,hasZ:d,objectIdField:c,spatialReference:y,timeInfo:m,featureStore:new o({geometryType:p,hasM:!1,hasZ:d}),cacheSpatialQueries:!0});const w=this._queryEngine.fieldsIndex.requiredFields.indexOf(g);w>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(w,1),this._createDefaultAttributes=I(E,c);const k=await this._createFeatures(r);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,k);const C=this._normalizeFeatures(k,T.featureErrors);this._queryEngine.featureStore.addMany(C);const{fullExtent:D,timeExtent:Q}=await this._queryEngine.fetchRecomputedExtents();if(T.layerDefinition.extent=D,Q){const{start:e,end:t}=Q;T.layerDefinition.timeInfo.timeExtent=[e,t]}return T}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([E(t,s),y(e.adds,t),y(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=t(this._snapshotFeatures),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,e);const t=this._normalizeFeatures(e);t&&this._queryEngine.featureStore.addMany(t)}),(e=>{this._queryEngine.featureStore.clear(),r(e)||i.getLogger("esri.layers.GeoJSONLayer").error(new s("geojson-layer:refresh","An error occurred during refresh",{error:e}))})),await this._waitSnapshotComplete();const{fullExtent:n,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:n,timeExtent:a}}async _createFeatures(e){if(null==e)return[];const{geometryType:t,hasZ:s,objectIdField:i}=this._queryEngine,r=f(e,{geometryType:t,hasZ:s,objectIdField:i});if(!o(this._queryEngine.spatialReference,a))for(const n of r)null!=n.geometry&&(n.geometry=l(m(u(n.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),a,this._queryEngine.spatialReference)));return r}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){const{url:s,customParameters:i}=this._loadOptions,r=(await e(s,{responseType:"json",query:{...i},signal:t})).data;return g(r),r}_normalizeFeatures(e,t){const{objectIdField:s,fieldsIndex:i}=this._queryEngine,r=[];for(const n of e){const e=this._createDefaultAttributes(),a=j(i,e,n.attributes,!0);a?t?.push(a):(this._assignObjectId(e,n.attributes,!0),n.attributes=e,n.objectId=e[s],r.push(n))}return r}async _applyEdits(e){const{adds:t,updates:s,deletes:i}=e,r={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(r,t),s?.length&&this._applyUpdateEdits(r,s),i?.length){for(const e of i)r.deleteResults.push(b(e));this._queryEngine.featureStore.removeManyById(i)}const{fullExtent:n,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:n,timeExtent:a,featureEditResults:r}}_applyAddEdits(e,t){const{addResults:s}=e,{geometryType:i,hasM:r,hasZ:a,objectIdField:o,spatialReference:l,featureStore:u,fieldsIndex:p}=this._queryEngine,c=[];for(const d of t){if(d.geometry&&i!==n(d.geometry)){s.push(T("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=j(p,t,d.attributes);if(r)s.push(r);else{if(this._assignObjectId(t,d.attributes),d.attributes=t,null!=d.uid){const t=d.attributes[o];e.uidToObjectId[d.uid]=t}if(null!=d.geometry){const e=d.geometry.spatialReference??l;d.geometry=m(w(d.geometry,e),e,l)}c.push(d),s.push(b(d.attributes[o]))}}u.addMany(d([],c,i,a,r,o))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:i,hasZ:r,objectIdField:a,spatialReference:o,featureStore:l,fieldsIndex:u}=this._queryEngine;for(const d of t){const{attributes:t,geometry:y}=d,h=t?.[a];if(null==h){e.push(T(`Identifier field ${a} missing`));continue}if(!l.has(h)){e.push(T(`Feature with object id ${h} missing`));continue}const f=p(l.getFeature(h),s,r,i);if(null!=y){if(s!==n(y)){e.push(T("Incorrect geometry type."));continue}const t=y.spatialReference??o;f.geometry=m(w(y,t),t,o)}if(t){const s=j(u,f.attributes,t);if(s){e.push(s);continue}}l.add(c(f,s,r,i,a)),e.push(b(h))}}_createObjectIdGenerator(e,t){const s=e.fieldsIndex.get(e.objectIdField);if("esriFieldTypeString"===s.type)return()=>s.name+"-"+Date.now().toString(16);let i=Number.NEGATIVE_INFINITY;for(const r of t)r.objectId&&(i=Math.max(i,r.objectId));return i=Math.max(0,i)+1,()=>i++}_assignObjectId(e,t,s=!1){const i=this._queryEngine.objectIdField;e[i]=s&&i in t?t[i]:this._objectIdGenerator()}async _checkProjection(e){try{await y(a,e)}catch{throw new s("geojson-layer","Projection not supported")}}}export{k as default};
5
+ import e from"../../../../request.js";import{createTask as t}from"../../../../core/asyncUtils.js";import s from"../../../../core/Error.js";import i from"../../../../core/Logger.js";import{isAbortError as r}from"../../../../core/promiseUtils.js";import{getJsonType as n}from"../../../../geometry/support/jsonUtils.js";import{WGS84 as a,equals as o}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as l,convertToGeometry as u,convertFromFeatures as d,convertToFeature as p,convertFromFeature as c}from"../../featureConversionUtils.js";import m from"../../data/FeatureStore.js";import{checkProjectionSupport as y,project as h}from"../../data/projectionSupport.js";import{QueryEngine as f}from"../../data/QueryEngine.js";import{inferLayerProperties as g,createOptimizedFeatures as _,validateGeoJSON as F}from"./geojson.js";import{createDrawingInfo as I,createDefaultTemplate as j,createDefaultAttributesFunction as E}from"../support/clientSideDefaults.js";import{loadGeometryEngineForSimplify as b,mixAttributes as T,createFeatureEditSuccessResult as w,createFeatureEditErrorResult as q,simplify as x}from"../support/sourceUtils.js";import S from"../../../support/FieldsIndex.js";import{kebabDict as R}from"../../../support/fieldType.js";import{getFieldDefaultValue as O}from"../../../support/fieldUtils.js";import{utc as k}from"../../../../time/timeZoneUtils.js";const C={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class D{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};const i=[],[r]=await Promise.all([e.url?this._fetch(t?.signal):null,this._checkProjection(e.spatialReference)]),n=g(r,{geometryType:e.geometryType}),o=e.fields||n.fields||[],l=null!=e.hasZ?e.hasZ:n.hasZ,u=n.geometryType;let d=e.objectIdField||n.objectIdFieldName||"__OBJECTID";const p=e.spatialReference||a;let c=e.timeInfo;o===n.fields&&n.unknownFields.length>0&&i.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:n.unknownFields}});const y=new S(o);let h=y.get(d);h?("esriFieldTypeString"!==h.type&&(h.type="esriFieldTypeOID"),h.editable=!1,h.nullable=!1,d=h.name):(h={alias:d,name:d,type:"string"===n.objectIdFieldType?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},o.unshift(h));const _={};for(const a of o){if(null==a.name&&(a.name=a.alias),null==a.alias&&(a.alias=a.name),!a.name)throw new s("geojson-layer:invalid-field-name","field name is missing",{field:a});if(!R.jsonValues.includes(a.type))throw new s("geojson-layer:invalid-field-type",`invalid type for field "${a.name}"`,{field:a});if(a.name!==h.name){const e=O(a);void 0!==e&&(_[a.name]=e)}}if(c){if(c.startTimeField){const e=y.get(c.startTimeField);e?(c.startTimeField=e.name,e.type="esriFieldTypeDate"):c.startTimeField=null}if(c.endTimeField){const e=y.get(c.endTimeField);e?(c.endTimeField=e.name,e.type="esriFieldTypeDate"):c.endTimeField=null}if(c.trackIdField){const e=y.get(c.trackIdField);e?c.trackIdField=e.name:(c.trackIdField=null,i.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:c}}))}c.startTimeField||c.endTimeField||(i.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:c}}),c=null)}const F=u?I(u):void 0,b=y.dateFields.length?{timeZoneIANA:k}:null,T={warnings:i,featureErrors:[],layerDefinition:{...C,drawingInfo:F??void 0,templates:j(_),extent:void 0,geometryType:u,objectIdField:d,fields:o,hasZ:!!l,timeInfo:c,dateFieldsTimeReference:b}};this._queryEngine=new f({fieldsIndex:S.fromLayerJSON({fields:o,timeInfo:c,dateFieldsTimeReference:b}),geometryType:u,hasM:!1,hasZ:l,objectIdField:d,spatialReference:p,timeInfo:c,featureStore:new m({geometryType:u,hasM:!1,hasZ:l}),cacheSpatialQueries:!0});const w=this._queryEngine.fieldsIndex.requiredFields.indexOf(h);w>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(w,1),this._createDefaultAttributes=E(_,d);const q=await this._createFeatures(r);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,q);const x=this._normalizeFeatures(q,T.featureErrors);this._queryEngine.featureStore.addMany(x);const{fullExtent:D,timeExtent:Q}=await this._queryEngine.fetchRecomputedExtents();if(T.layerDefinition.extent=D,Q){const{start:e,end:t}=Q;T.layerDefinition.timeInfo.timeExtent=[e,t]}return T}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([b(t,s),y(e.adds,t),y(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=t(this._snapshotFeatures),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,e);const t=this._normalizeFeatures(e);t&&this._queryEngine.featureStore.addMany(t)}),(e=>{this._queryEngine.featureStore.clear(),r(e)||i.getLogger("esri.layers.GeoJSONLayer").error(new s("geojson-layer:refresh","An error occurred during refresh",{error:e}))})),await this._waitSnapshotComplete();const{fullExtent:n,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:n,timeExtent:a}}async _createFeatures(e){if(null==e)return[];const{geometryType:t,hasZ:s,objectIdField:i}=this._queryEngine,r=_(e,{geometryType:t,hasZ:s,objectIdField:i});if(!o(this._queryEngine.spatialReference,a))for(const n of r)null!=n.geometry&&(n.geometry=l(h(u(n.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),a,this._queryEngine.spatialReference)));return r}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){const{url:s,customParameters:i}=this._loadOptions,r=(await e(s,{responseType:"json",query:{...i},signal:t})).data;return F(r),r}_normalizeFeatures(e,t){const{objectIdField:s,fieldsIndex:i}=this._queryEngine,r=[];for(const n of e){const e=this._createDefaultAttributes(),a=T(i,e,n.attributes,!0);a?t?.push(a):(this._assignObjectId(e,n.attributes,!0),n.attributes=e,n.objectId=e[s],r.push(n))}return r}async _applyEdits(e){const{adds:t,updates:s,deletes:i}=e,r={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(r,t),s?.length&&this._applyUpdateEdits(r,s),i?.length){for(const e of i)r.deleteResults.push(w(e));this._queryEngine.featureStore.removeManyById(i)}const{fullExtent:n,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:n,timeExtent:a,featureEditResults:r}}_applyAddEdits(e,t){const{addResults:s}=e,{geometryType:i,hasM:r,hasZ:a,objectIdField:o,spatialReference:l,featureStore:u,fieldsIndex:p}=this._queryEngine,c=[];for(const d of t){if(d.geometry&&i!==n(d.geometry)){s.push(q("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=T(p,t,d.attributes);if(r)s.push(r);else{if(this._assignObjectId(t,d.attributes),d.attributes=t,null!=d.uid){const t=d.attributes[o];e.uidToObjectId[d.uid]=t}if(null!=d.geometry){const e=d.geometry.spatialReference??l;d.geometry=h(x(d.geometry,e),e,l)}c.push(d),s.push(w(d.attributes[o]))}}u.addMany(d([],c,i,a,r,o))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:i,hasZ:r,objectIdField:a,spatialReference:o,featureStore:l,fieldsIndex:u}=this._queryEngine;for(const d of t){const{attributes:t,geometry:m}=d,y=t?.[a];if(null==y){e.push(q(`Identifier field ${a} missing`));continue}if(!l.has(y)){e.push(q(`Feature with object id ${y} missing`));continue}const f=p(l.getFeature(y),s,r,i);if(null!=m){if(s!==n(m)){e.push(q("Incorrect geometry type."));continue}const t=m.spatialReference??o;f.geometry=h(x(m,t),t,o)}if(t){const s=T(u,f.attributes,t);if(s){e.push(s);continue}}l.add(c(f,s,r,i,a)),e.push(w(y))}}_createObjectIdGenerator(e,t){const s=e.fieldsIndex.get(e.objectIdField);if("esriFieldTypeString"===s.type)return()=>s.name+"-"+Date.now().toString(16);let i=Number.NEGATIVE_INFINITY;for(const r of t)r.objectId&&(i=Math.max(i,r.objectId));return i=Math.max(0,i)+1,()=>i++}_assignObjectId(e,t,s=!1){const i=this._queryEngine.objectIdField;e[i]=s&&i in t?t[i]:this._objectIdGenerator()}async _checkProjection(e){try{await y(a,e)}catch{throw new s("geojson-layer","Projection not supported")}}}export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../geometry.js";import e from"../../../../request.js";import{createTask as t}from"../../../../core/asyncUtils.js";import{parseDate as i}from"../../../../core/date.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{urlToObject as o,getFilename as a}from"../../../../core/urlUtils.js";import{projectMany as l}from"../../../../geometry/projection.js";import{jsonAdapter as c}from"../../../../geometry/geometryAdapters/json.js";import{equals as m,isWebMercator as d,WGS84 as u}from"../../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as p}from"../../../../geometry/support/webMercatorUtils.js";import{OptimizedFeature as f}from"../../OptimizedFeature.js";import y from"../../OptimizedGeometry.js";import{checkProjectionSupport as h}from"../../data/projectionSupport.js";import{parseRows as g,parseNumber as I,readRows as _,inferDelimiterAndLocationInfo as F,extractFieldNamesAndAliasesFromRow as w,inferFields as E}from"../csv/csv.js";import{createDefaultAttributesFunction as T,createDrawingInfo as j}from"./clientSideDefaults.js";import x from"../../../support/FieldsIndex.js";import{getFieldDefaultValue as N}from"../../../support/fieldUtils.js";import{utc as S}from"../../../../time/timeZoneUtils.js";import q from"../../../../geometry/SpatialReference.js";const b=j("esriGeometryPoint"),C=["csv"],O=[0,0];class v{constructor(e,t){this.x=e,this.y=t}}class D{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=null}async load(e,t={}){this._loadOptions=e;const[i,{QueryEngine:n,FeatureStore:r}]=await Promise.all([this._fetch(t.signal),import("./QueryEngineBuildLayer.js"),this._checkProjection(e?.parsingOptions?.spatialReference)]),s=k(i,e);this._locationInfo=s.locationInfo,this._delimiter=s.delimiter,this._queryEngine=this._createQueryEngine(n,r,s);const o=await this._createFeatures(i);this._queryEngine.featureStore.addMany(o);const{fullExtent:a,timeExtent:l}=await this._queryEngine.fetchRecomputedExtents();if(s.layerDefinition.extent=a,l){const{start:e,end:t}=l;s.layerDefinition.timeInfo.timeExtent=[e,t]}return s}async applyEdits(){throw new n("csv-layer:editing-not-supported","applyEdits() is not supported on CSVLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=t(this._snapshotFeatures),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),e&&this._queryEngine.featureStore.addMany(e)}),(e=>{this._queryEngine.featureStore.clear(),s(e)||r.getLogger("esri.layers.CSVLayer").error(new n("csv-layer:refresh","An error occurred during refresh",{error:e}))})),await this._waitSnapshotComplete();const{fullExtent:i,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:i,timeExtent:o}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){const{url:i,customParameters:r}=this._loadOptions;if(!i)throw new n("csv-layer:invalid-source","url not defined");const s=o(i);return(await e(s.path,{query:{...s.query,...r},responseType:"text",signal:t})).data}_createQueryEngine(e,t,i){const{objectIdField:n,fields:r,extent:s,timeInfo:o}=i.layerDefinition,a=new t({geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1});return new e({fieldsIndex:x.fromLayerJSON({fields:r,dateFieldsTimeReference:{timeZoneIANA:S}}),geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1,timeInfo:o,objectIdField:n,spatialReference:s.spatialReference||{wkid:4326},cacheSpatialQueries:!0,featureStore:a})}async _createFeatures(e){const{latitudeFieldName:t,longitudeFieldName:n}=this._locationInfo,{objectIdField:r,fieldsIndex:s,spatialReference:o}=this._queryEngine;let a=[];const u=[],h=s.fields.filter((e=>e.name!==r)).map((e=>e.name));let _=0;const F={};for(const i of s.fields)if("esriFieldTypeOID"!==i.type&&"esriFieldTypeGlobalID"!==i.type){const e=N(i);void 0!==e&&(F[i.name]=e)}const w=g(e,h,this._delimiter,T(F,r));for(const l of w){const e=this._parseCoordinateValue(l[t]),o=this._parseCoordinateValue(l[n]);if(null!=o&&null!=e&&!isNaN(e)&&!isNaN(o)){l[t]=e,l[n]=o;for(const e in l)if(e!==t&&e!==n)if(s.isDateField(e))l[e]=i(l[e]);else if(s.isNumericField(e)){const t=I(l[e]);isNaN(t)?l[e]=null:l[e]=t}l[r]=_,_++,a.push(new v(o,e)),u.push(l)}}if(!m({wkid:4326},o))if(d(o))for(const i of a)[i.x,i.y]=p(i.x,i.y,O);else a=l(c,a,q.WGS84,o,null,null);const E=[];for(let i=0;i<a.length;i++){const{x:e,y:t}=a[i],n=u[i];n[r]=i+1,E.push(new f(new y([],[e,t]),n,null,n[r]))}return E}_parseCoordinateValue(e){if(null==e||""===e)return null;let t=I(e);return(isNaN(t)||Math.abs(t)>181)&&(t=parseFloat(e)),t}async _checkProjection(e){try{await h(u,e)}catch{throw new n("csv-layer:projection-not-supported","Projection not supported")}}}function k(e,t){const i=t.parsingOptions||{},r={delimiter:i.delimiter,layerDefinition:null,locationInfo:{latitudeFieldName:i.latitudeField,longitudeFieldName:i.longitudeField}},s=r.layerDefinition={name:a(t.url,C)||"csv",dateFieldsTimeReference:{timeZoneIANA:S},drawingInfo:b,geometryType:"esriGeometryPoint",objectIdField:null,fields:[],timeInfo:i.timeInfo,extent:{xmin:Number.POSITIVE_INFINITY,ymin:Number.POSITIVE_INFINITY,xmax:Number.NEGATIVE_INFINITY,ymax:Number.NEGATIVE_INFINITY,spatialReference:i.spatialReference||{wkid:4326}}},o=_(e),l=o.next().value?.trim(),c=o.next().value?.trim();if(!l)throw new n("csv-layer:empty-csv","CSV is empty",{csv:e});const{delimiter:m,locationInfo:d}=F(l,c,i);if(!m)throw new n("csv-layer:invalid-delimiter","Unable to detect the delimiter from CSV",{firstLine:l,secondLine:c,parsingOptions:i});if(!d)throw new n("csv-layer:location-fields-not-found","Unable to identify latitude and longitude fields from the CSV file",{firstLine:l,secondLine:c,parsingOptions:i});r.locationInfo=d,r.delimiter=m;const{names:u,aliases:p}=w(l,m),f=E(e,r.delimiter,u,p,r.locationInfo);if(i.fields?.length){const e=new x(i.fields);for(const t of f){const i=e.get(t.name);i&&Object.assign(t,i)}}if(!f.some((e=>"esriFieldTypeOID"===e.type&&(s.objectIdField=e.name,!0)))){const e={name:"__OBJECTID",alias:"__OBJECTID",type:"esriFieldTypeOID",editable:!1,nullable:!1};s.objectIdField=e.name,f.unshift(e)}s.fields=f;const y=new x(s.fields);if(r.locationInfo&&(r.locationInfo.latitudeFieldName=y.get(r.locationInfo.latitudeFieldName).name,r.locationInfo.longitudeFieldName=y.get(r.locationInfo.longitudeFieldName).name),s.timeInfo){const e=s.timeInfo;if(e.startTimeField){const t=y.get(e.startTimeField);t?(e.startTimeField=t.name,t.type="esriFieldTypeDate"):e.startTimeField=null}if(e.endTimeField){const t=y.get(e.endTimeField);t?(e.endTimeField=t.name,t.type="esriFieldTypeDate"):e.endTimeField=null}if(e.trackIdField){const t=y.get(e.trackIdField);e.trackIdField=t?t.name:null}e.startTimeField||e.endTimeField||(s.timeInfo=null)}return r}export{D as default};
5
+ import"../../../../geometry.js";import e from"../../../../request.js";import{createTask as t}from"../../../../core/asyncUtils.js";import{parseDate as i}from"../../../../core/date.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{isAbortError as s}from"../../../../core/promiseUtils.js";import{urlToObject as o,getFilename as a}from"../../../../core/urlUtils.js";import{projectMany as l}from"../../../../geometry/projection.js";import{jsonAdapter as m}from"../../../../geometry/geometryAdapters/json.js";import{equals as c,isWebMercator as d,WGS84 as u}from"../../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as p}from"../../../../geometry/support/webMercatorUtils.js";import{OptimizedFeature as f}from"../../OptimizedFeature.js";import y from"../../OptimizedGeometry.js";import h from"../../data/FeatureStore.js";import{checkProjectionSupport as g}from"../../data/projectionSupport.js";import{QueryEngine as I}from"../../data/QueryEngine.js";import{parseRows as _,parseNumber as F,readRows as w,inferDelimiterAndLocationInfo as E,extractFieldNamesAndAliasesFromRow as j,inferFields as T}from"../csv/csv.js";import{createDefaultAttributesFunction as x,createDrawingInfo as N}from"./clientSideDefaults.js";import S from"../../../support/FieldsIndex.js";import{getFieldDefaultValue as q}from"../../../support/fieldUtils.js";import{utc as b}from"../../../../time/timeZoneUtils.js";import C from"../../../../geometry/SpatialReference.js";const O=N("esriGeometryPoint"),v=["csv"],D=[0,0];class k{constructor(e,t){this.x=e,this.y=t}}class P{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=null}async load(e,t={}){this._loadOptions=e;const[i]=await Promise.all([this._fetch(t.signal),this._checkProjection(e?.parsingOptions?.spatialReference)]),n=R(i,e);this._locationInfo=n.locationInfo,this._delimiter=n.delimiter,this._queryEngine=this._createQueryEngine(n);const r=await this._createFeatures(i);this._queryEngine.featureStore.addMany(r);const{fullExtent:s,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();if(n.layerDefinition.extent=s,o){const{start:e,end:t}=o;n.layerDefinition.timeInfo.timeExtent=[e,t]}return n}async applyEdits(){throw new n("csv-layer:editing-not-supported","applyEdits() is not supported on CSVLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=t(this._snapshotFeatures),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),e&&this._queryEngine.featureStore.addMany(e)}),(e=>{this._queryEngine.featureStore.clear(),s(e)||r.getLogger("esri.layers.CSVLayer").error(new n("csv-layer:refresh","An error occurred during refresh",{error:e}))})),await this._waitSnapshotComplete();const{fullExtent:i,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:i,timeExtent:o}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){const{url:i,customParameters:r}=this._loadOptions;if(!i)throw new n("csv-layer:invalid-source","url not defined");const s=o(i);return(await e(s.path,{query:{...s.query,...r},responseType:"text",signal:t})).data}_createQueryEngine(e){const{objectIdField:t,fields:i,extent:n,timeInfo:r}=e.layerDefinition,s=new h({geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1});return new I({fieldsIndex:S.fromLayerJSON({fields:i,dateFieldsTimeReference:{timeZoneIANA:b}}),geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1,timeInfo:r,objectIdField:t,spatialReference:n.spatialReference||{wkid:4326},cacheSpatialQueries:!0,featureStore:s})}async _createFeatures(e){const{latitudeFieldName:t,longitudeFieldName:n}=this._locationInfo,{objectIdField:r,fieldsIndex:s,spatialReference:o}=this._queryEngine;let a=[];const u=[],h=s.fields.filter((e=>e.name!==r)).map((e=>e.name));let g=0;const I={};for(const i of s.fields)if("esriFieldTypeOID"!==i.type&&"esriFieldTypeGlobalID"!==i.type){const e=q(i);void 0!==e&&(I[i.name]=e)}const w=_(e,h,this._delimiter,x(I,r));for(const l of w){const e=this._parseCoordinateValue(l[t]),o=this._parseCoordinateValue(l[n]);if(null!=o&&null!=e&&!isNaN(e)&&!isNaN(o)){l[t]=e,l[n]=o;for(const e in l)if(e!==t&&e!==n)if(s.isDateField(e))l[e]=i(l[e]);else if(s.isNumericField(e)){const t=F(l[e]);isNaN(t)?l[e]=null:l[e]=t}l[r]=g,g++,a.push(new k(o,e)),u.push(l)}}if(!c({wkid:4326},o))if(d(o))for(const i of a)[i.x,i.y]=p(i.x,i.y,D);else a=l(m,a,C.WGS84,o,null,null);const E=[];for(let i=0;i<a.length;i++){const{x:e,y:t}=a[i],n=u[i];n[r]=i+1,E.push(new f(new y([],[e,t]),n,null,n[r]))}return E}_parseCoordinateValue(e){if(null==e||""===e)return null;let t=F(e);return(isNaN(t)||Math.abs(t)>181)&&(t=parseFloat(e)),t}async _checkProjection(e){try{await g(u,e)}catch{throw new n("csv-layer:projection-not-supported","Projection not supported")}}}function R(e,t){const i=t.parsingOptions||{},r={delimiter:i.delimiter,layerDefinition:null,locationInfo:{latitudeFieldName:i.latitudeField,longitudeFieldName:i.longitudeField}},s=r.layerDefinition={name:a(t.url,v)||"csv",dateFieldsTimeReference:{timeZoneIANA:b},drawingInfo:O,geometryType:"esriGeometryPoint",objectIdField:null,fields:[],timeInfo:i.timeInfo,extent:{xmin:Number.POSITIVE_INFINITY,ymin:Number.POSITIVE_INFINITY,xmax:Number.NEGATIVE_INFINITY,ymax:Number.NEGATIVE_INFINITY,spatialReference:i.spatialReference||{wkid:4326}}},o=w(e),l=o.next().value?.trim(),m=o.next().value?.trim();if(!l)throw new n("csv-layer:empty-csv","CSV is empty",{csv:e});const{delimiter:c,locationInfo:d}=E(l,m,i);if(!c)throw new n("csv-layer:invalid-delimiter","Unable to detect the delimiter from CSV",{firstLine:l,secondLine:m,parsingOptions:i});if(!d)throw new n("csv-layer:location-fields-not-found","Unable to identify latitude and longitude fields from the CSV file",{firstLine:l,secondLine:m,parsingOptions:i});r.locationInfo=d,r.delimiter=c;const{names:u,aliases:p}=j(l,c),f=T(e,r.delimiter,u,p,r.locationInfo);if(i.fields?.length){const e=new S(i.fields);for(const t of f){const i=e.get(t.name);i&&Object.assign(t,i)}}if(!f.some((e=>"esriFieldTypeOID"===e.type&&(s.objectIdField=e.name,!0)))){const e={name:"__OBJECTID",alias:"__OBJECTID",type:"esriFieldTypeOID",editable:!1,nullable:!1};s.objectIdField=e.name,f.unshift(e)}s.fields=f;const y=new S(s.fields);if(r.locationInfo&&(r.locationInfo.latitudeFieldName=y.get(r.locationInfo.latitudeFieldName).name,r.locationInfo.longitudeFieldName=y.get(r.locationInfo.longitudeFieldName).name),s.timeInfo){const e=s.timeInfo;if(e.startTimeField){const t=y.get(e.startTimeField);t?(e.startTimeField=t.name,t.type="esriFieldTypeDate"):e.startTimeField=null}if(e.endTimeField){const t=y.get(e.endTimeField);t?(e.endTimeField=t.name,t.type="esriFieldTypeDate"):e.endTimeField=null}if(e.trackIdField){const t=y.get(e.trackIdField);e.trackIdField=t?t.name:null}e.startTimeField||e.endTimeField||(s.timeInfo=null)}return r}export{P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import{getJsonType as t,isPoint as i}from"../../../../geometry/support/jsonUtils.js";import{WGS84 as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatures as n,convertToFeature as r,convertFromFeature as a}from"../../featureConversionUtils.js";import{initialObjectId as o,findLastObjectIdFromFeatures as l}from"../../objectIdUtils.js";import{checkProjectionSupport as u,project as d}from"../../data/projectionSupport.js";import{createDefaultAttributesFunction as p,createDrawingInfo as f,createDefaultTemplate as c}from"./clientSideDefaults.js";import{loadGeometryEngineForSimplify as y,createFeatureEditErrorResult as m,mixAttributes as h,createFeatureEditSuccessResult as g,simplify as I}from"./sourceUtils.js";import F from"../../../support/FieldsIndex.js";import{kebabDict as b}from"../../../support/fieldType.js";import{getFieldDefaultValue as j}from"../../../support/fieldUtils.js";import{utc as E}from"../../../../time/timeZoneUtils.js";const T=s,_={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:s},x={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};function R(e){return i(e)?null!=e.z:!!e.hasZ}function q(e){return i(e)?null!=e.m:!!e.hasM}class w{constructor(){this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(t){const i=[],{features:s}=t,n=this._inferLayerProperties(s,t.fields),r=t.fields||[],a=null!=t.hasM?t.hasM:!!n.hasM,d=null!=t.hasZ?t.hasZ:!!n.hasZ,y=!t.spatialReference&&!n.spatialReference,m=y?T:t.spatialReference||n.spatialReference,h=y?_:null,g=t.geometryType||n.geometryType,I=!g;let R=t.objectIdField||n.objectIdField,q=t.timeInfo;const w=new F(r);if(!I&&(y&&i.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!g))throw new e("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(!R)throw new e("feature-layer:missing-property","objectIdField not set and couldn't be found in the provided fields");if(n.objectIdField&&R!==n.objectIdField&&(i.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${R}" doesn't match the field name "${n.objectIdField}", found in the provided fields`}),R=n.objectIdField),R&&!n.objectIdField){const e=w.get(R);e?(R=e.name,e.type="esriFieldTypeOID",e.editable=!1,e.nullable=!1):r.unshift({alias:R,name:R,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const o of r){if(null==o.name&&(o.name=o.alias),null==o.alias&&(o.alias=o.name),!o.name)throw new e("feature-layer:invalid-field-name","field name is missing",{field:o});if(o.name===R&&(o.type="esriFieldTypeOID"),!b.jsonValues.includes(o.type))throw new e("feature-layer:invalid-field-type",`invalid type for field "${o.name}"`,{field:o})}const D={};for(const e of r)if("esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type){const t=j(e);void 0!==t&&(D[e.name]=t)}if(q){if(q.startTimeField){const e=w.get(q.startTimeField);e?(q.startTimeField=e.name,e.type="esriFieldTypeDate"):q.startTimeField=null}if(q.endTimeField){const e=w.get(q.endTimeField);e?(q.endTimeField=e.name,e.type="esriFieldTypeDate"):q.endTimeField=null}if(q.trackIdField){const e=w.get(q.trackIdField);e?q.trackIdField=e.name:(q.trackIdField=null,i.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:q}}))}q.startTimeField||q.endTimeField||(i.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:q}}),q=null)}const O=w.dateFields.length?{timeZoneIANA:t.dateFieldsTimeZone??E}:null;this._createDefaultAttributes=p(D,R);const S={warnings:i,featureErrors:[],layerDefinition:{...x,drawingInfo:f(g),templates:c(D),extent:h,geometryType:g,objectIdField:R,fields:r,hasZ:d,hasM:a,timeInfo:q,dateFieldsTimeReference:O},assignedObjectIds:{}},{QueryEngine:v,FeatureStore:Q}=await import("./QueryEngineBuildLayer.js");if(this._queryEngine=new v({fieldsIndex:F.fromLayerJSON({fields:r,timeInfo:q,dateFieldsTimeReference:O}),geometryType:g,hasM:a,hasZ:d,objectIdField:R,spatialReference:m,featureStore:new Q({geometryType:g,hasM:a,hasZ:d}),timeInfo:q,cacheSpatialQueries:!0}),!s?.length)return this._nextObjectId=o,S;const M=l(R,s);return this._nextObjectId=M+1,await u(s,m),this._loadInitialFeatures(S,s)}async applyEdits(e){const{spatialReference:t,geometryType:i}=this._queryEngine;return await Promise.all([y(t,i),u(e.adds,t),u(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return this._queryEngine.executeQueryForSnapping(e,t.signal)}_inferLayerProperties(e,i){let s,n,r=null,a=null,o=null;for(const l of e){const e=l.geometry;if(null!=e&&(r||(r=t(e)),a||(a=e.spatialReference),null==s&&(s=R(e)),null==n&&(n=q(e)),r&&a&&null!=s&&null!=n))break}if(i&&i.length){let e=null;i.some((t=>{const i="esriFieldTypeOID"===t.type,s=!t.type&&t.name&&"objectid"===t.name.toLowerCase();return e=t,i||s}))&&(o=e.name)}return{geometryType:r,spatialReference:a,objectIdField:o,hasM:n,hasZ:s}}async _loadInitialFeatures(e,i){const{geometryType:s,hasM:r,hasZ:a,objectIdField:o,spatialReference:l,featureStore:u,fieldsIndex:p}=this._queryEngine,f=[];for(const n of i){if(null!=n.uid&&(e.assignedObjectIds[n.uid]=-1),n.geometry&&s!==t(n.geometry)){e.featureErrors.push(m("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),r=h(p,i,n.attributes,!0);r?e.featureErrors.push(r):(this._assignObjectId(i,n.attributes,!0),n.attributes=i,null!=n.uid&&(e.assignedObjectIds[n.uid]=n.attributes[o]),null!=n.geometry&&(n.geometry=d(n.geometry,n.geometry.spatialReference,l)),f.push(n))}u.addMany(n([],f,s,a,r,o));const{fullExtent:c,timeExtent:y}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=c,y){const{start:t,end:i}=y;e.layerDefinition.timeInfo.timeExtent=[t,i]}return e}async _applyEdits(e){const{adds:t,updates:i,deletes:s}=e,n={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(n,t),i?.length&&this._applyUpdateEdits(n,i),s?.length){for(const e of s)n.deleteResults.push(g(e));this._queryEngine.featureStore.removeManyById(s)}const{fullExtent:r,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:r,timeExtent:a,featureEditResults:n}}_applyAddEdits(e,i){const{addResults:s}=e,{geometryType:r,hasM:a,hasZ:o,objectIdField:l,spatialReference:u,featureStore:p,fieldsIndex:f}=this._queryEngine,c=[];for(const n of i){if(n.geometry&&r!==t(n.geometry)){s.push(m("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),a=h(f,i,n.attributes);if(a)s.push(a);else{if(this._assignObjectId(i,n.attributes),n.attributes=i,null!=n.uid){const t=n.attributes[l];e.uidToObjectId[n.uid]=t}if(null!=n.geometry){const e=n.geometry.spatialReference??u;n.geometry=d(I(n.geometry,e),e,u)}c.push(n),s.push(g(n.attributes[l]))}}p.addMany(n([],c,r,o,a,l))}_applyUpdateEdits({updateResults:e},i){const{geometryType:s,hasM:n,hasZ:o,objectIdField:l,spatialReference:u,featureStore:p,fieldsIndex:f}=this._queryEngine;for(const c of i){const{attributes:i,geometry:y}=c,F=i?.[l];if(null==F){e.push(m(`Identifier field ${l} missing`));continue}if(!p.has(F)){e.push(m(`Feature with object id ${F} missing`));continue}const b=r(p.getFeature(F),s,o,n);if(null!=y){if(s!==t(y)){e.push(m("Incorrect geometry type."));continue}const i=y.spatialReference??u;b.geometry=d(I(y,i),i,u)}if(i){const t=h(f,b.attributes,i);if(t){e.push(t);continue}}p.add(a(b,s,o,n,l)),e.push(g(F))}}_assignObjectId(e,t,i=!1){const s=this._queryEngine.objectIdField;i&&t&&isFinite(t[s])?e[s]=t[s]:e[s]=this._nextObjectId++}}export{w as default};
5
+ import e from"../../../../core/Error.js";import{getJsonType as t,isPoint as i}from"../../../../geometry/support/jsonUtils.js";import{WGS84 as s}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertFromFeatures as r,convertToFeature as n,convertFromFeature as a}from"../../featureConversionUtils.js";import{initialObjectId as o,findLastObjectIdFromFeatures as l}from"../../objectIdUtils.js";import u from"../../data/FeatureStore.js";import{checkProjectionSupport as d,project as p}from"../../data/projectionSupport.js";import{QueryEngine as f}from"../../data/QueryEngine.js";import{createDefaultAttributesFunction as c,createDrawingInfo as m,createDefaultTemplate as y}from"./clientSideDefaults.js";import{loadGeometryEngineForSimplify as h,createFeatureEditErrorResult as g,mixAttributes as I,createFeatureEditSuccessResult as F,simplify as b}from"./sourceUtils.js";import j from"../../../support/FieldsIndex.js";import{kebabDict as E}from"../../../support/fieldType.js";import{getFieldDefaultValue as T}from"../../../support/fieldUtils.js";import{utc as _}from"../../../../time/timeZoneUtils.js";const x=s,R={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:s},q={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};function D(e){return i(e)?null!=e.z:!!e.hasZ}function O(e){return i(e)?null!=e.m:!!e.hasM}class w{constructor(){this._queryEngine=null,this._nextObjectId=null}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(t){const i=[],{features:s}=t,r=this._inferLayerProperties(s,t.fields),n=t.fields||[],a=null!=t.hasM?t.hasM:!!r.hasM,p=null!=t.hasZ?t.hasZ:!!r.hasZ,h=!t.spatialReference&&!r.spatialReference,g=h?x:t.spatialReference||r.spatialReference,I=h?R:null,F=t.geometryType||r.geometryType,b=!F;let D=t.objectIdField||r.objectIdField,O=t.timeInfo;const w=new j(n);if(!b&&(h&&i.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!F))throw new e("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(!D)throw new e("feature-layer:missing-property","objectIdField not set and couldn't be found in the provided fields");if(r.objectIdField&&D!==r.objectIdField&&(i.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${D}" doesn't match the field name "${r.objectIdField}", found in the provided fields`}),D=r.objectIdField),D&&!r.objectIdField){const e=w.get(D);e?(D=e.name,e.type="esriFieldTypeOID",e.editable=!1,e.nullable=!1):n.unshift({alias:D,name:D,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const o of n){if(null==o.name&&(o.name=o.alias),null==o.alias&&(o.alias=o.name),!o.name)throw new e("feature-layer:invalid-field-name","field name is missing",{field:o});if(o.name===D&&(o.type="esriFieldTypeOID"),!E.jsonValues.includes(o.type))throw new e("feature-layer:invalid-field-type",`invalid type for field "${o.name}"`,{field:o})}const S={};for(const e of n)if("esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type){const t=T(e);void 0!==t&&(S[e.name]=t)}if(O){if(O.startTimeField){const e=w.get(O.startTimeField);e?(O.startTimeField=e.name,e.type="esriFieldTypeDate"):O.startTimeField=null}if(O.endTimeField){const e=w.get(O.endTimeField);e?(O.endTimeField=e.name,e.type="esriFieldTypeDate"):O.endTimeField=null}if(O.trackIdField){const e=w.get(O.trackIdField);e?O.trackIdField=e.name:(O.trackIdField=null,i.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:O}}))}O.startTimeField||O.endTimeField||(i.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:O}}),O=null)}const v=w.dateFields.length?{timeZoneIANA:t.dateFieldsTimeZone??_}:null;this._createDefaultAttributes=c(S,D);const Q={warnings:i,featureErrors:[],layerDefinition:{...q,drawingInfo:m(F),templates:y(S),extent:I,geometryType:F,objectIdField:D,fields:n,hasZ:p,hasM:a,timeInfo:O,dateFieldsTimeReference:v},assignedObjectIds:{}};if(this._queryEngine=new f({fieldsIndex:j.fromLayerJSON({fields:n,timeInfo:O,dateFieldsTimeReference:v}),geometryType:F,hasM:a,hasZ:p,objectIdField:D,spatialReference:g,featureStore:new u({geometryType:F,hasM:a,hasZ:p}),timeInfo:O,cacheSpatialQueries:!0}),!s?.length)return this._nextObjectId=o,Q;const M=l(D,s);return this._nextObjectId=M+1,await d(s,g),this._loadInitialFeatures(Q,s)}async applyEdits(e){const{spatialReference:t,geometryType:i}=this._queryEngine;return await Promise.all([h(t,i),d(e.adds,t),d(e.updates,t)]),this._applyEdits(e)}queryFeatures(e,t={}){return this._queryEngine.executeQuery(e,t.signal)}queryFeatureCount(e,t={}){return this._queryEngine.executeQueryForCount(e,t.signal)}queryObjectIds(e,t={}){return this._queryEngine.executeQueryForIds(e,t.signal)}queryExtent(e,t={}){return this._queryEngine.executeQueryForExtent(e,t.signal)}querySnapping(e,t={}){return this._queryEngine.executeQueryForSnapping(e,t.signal)}_inferLayerProperties(e,i){let s,r,n=null,a=null,o=null;for(const l of e){const e=l.geometry;if(null!=e&&(n||(n=t(e)),a||(a=e.spatialReference),null==s&&(s=D(e)),null==r&&(r=O(e)),n&&a&&null!=s&&null!=r))break}if(i&&i.length){let e=null;i.some((t=>{const i="esriFieldTypeOID"===t.type,s=!t.type&&t.name&&"objectid"===t.name.toLowerCase();return e=t,i||s}))&&(o=e.name)}return{geometryType:n,spatialReference:a,objectIdField:o,hasM:r,hasZ:s}}async _loadInitialFeatures(e,i){const{geometryType:s,hasM:n,hasZ:a,objectIdField:o,spatialReference:l,featureStore:u,fieldsIndex:d}=this._queryEngine,f=[];for(const r of i){if(null!=r.uid&&(e.assignedObjectIds[r.uid]=-1),r.geometry&&s!==t(r.geometry)){e.featureErrors.push(g("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),n=I(d,i,r.attributes,!0);n?e.featureErrors.push(n):(this._assignObjectId(i,r.attributes,!0),r.attributes=i,null!=r.uid&&(e.assignedObjectIds[r.uid]=r.attributes[o]),null!=r.geometry&&(r.geometry=p(r.geometry,r.geometry.spatialReference,l)),f.push(r))}u.addMany(r([],f,s,a,n,o));const{fullExtent:c,timeExtent:m}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=c,m){const{start:t,end:i}=m;e.layerDefinition.timeInfo.timeExtent=[t,i]}return e}async _applyEdits(e){const{adds:t,updates:i,deletes:s}=e,r={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(r,t),i?.length&&this._applyUpdateEdits(r,i),s?.length){for(const e of s)r.deleteResults.push(F(e));this._queryEngine.featureStore.removeManyById(s)}const{fullExtent:n,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();return{extent:n,timeExtent:a,featureEditResults:r}}_applyAddEdits(e,i){const{addResults:s}=e,{geometryType:n,hasM:a,hasZ:o,objectIdField:l,spatialReference:u,featureStore:d,fieldsIndex:f}=this._queryEngine,c=[];for(const r of i){if(r.geometry&&n!==t(r.geometry)){s.push(g("Incorrect geometry type."));continue}const i=this._createDefaultAttributes(),a=I(f,i,r.attributes);if(a)s.push(a);else{if(this._assignObjectId(i,r.attributes),r.attributes=i,null!=r.uid){const t=r.attributes[l];e.uidToObjectId[r.uid]=t}if(null!=r.geometry){const e=r.geometry.spatialReference??u;r.geometry=p(b(r.geometry,e),e,u)}c.push(r),s.push(F(r.attributes[l]))}}d.addMany(r([],c,n,o,a,l))}_applyUpdateEdits({updateResults:e},i){const{geometryType:s,hasM:r,hasZ:o,objectIdField:l,spatialReference:u,featureStore:d,fieldsIndex:f}=this._queryEngine;for(const c of i){const{attributes:i,geometry:m}=c,y=i?.[l];if(null==y){e.push(g(`Identifier field ${l} missing`));continue}if(!d.has(y)){e.push(g(`Feature with object id ${y} missing`));continue}const h=n(d.getFeature(y),s,o,r);if(null!=m){if(s!==t(m)){e.push(g("Incorrect geometry type."));continue}const i=m.spatialReference??u;h.geometry=p(b(m,i),i,u)}if(i){const t=I(f,h.attributes,i);if(t){e.push(t);continue}}d.add(a(h,s,o,r,l)),e.push(F(y))}}_assignObjectId(e,t,i=!1){const s=this._queryEngine.objectIdField;i&&t&&isFinite(t[s])?e[s]=t[s]:e[s]=this._nextObjectId++}}export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Error.js";import{isBlobProtocol as t}from"../../core/urlUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as a}from"../../core/accessorSupport/layerContainerType.js";import{readLoadable as n}from"../../core/accessorSupport/read.js";import{willPropertyWrite as p}from"../../core/accessorSupport/write.js";import{supportedTypes as l}from"./operationalLayers.js";import{listMode as y,opacity as c}from"../support/commonProperties.js";const u=u=>{let d=class extends u{constructor(){super(...arguments),this.persistenceEnabled=!0,this.title=null}writeListMode(e,r,t,i){(i&&"ground"===i.layerContainerType||e&&p(this,t,{},i))&&(r[t]=e)}writeOperationalLayerType(e,r,t,i){e&&"tables"!==i?.layerContainerType&&(r.layerType=e)}writeTitle(e,r){r.title=e??"Layer"}read(e,r){r&&(r.layer=this),n(this,e,(r=>super.read(e,r)),r)}write(e,i){if(!this.persistenceEnabled)return null;if(i?.origin){const e=`${i.origin}/${i.layerContainerType||"operational-layers"}`,t=l[e];let o=!!t?.[this.operationalLayerType];if("ArcGISTiledElevationServiceLayer"===this.operationalLayerType&&"web-scene/operational-layers"===e&&(o=!1),"ArcGISDimensionLayer"===this.operationalLayerType&&"web-map/operational-layers"===e&&(o=!1),!o)return i.messages?.push(new r("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this})),null}const o=super.write(e,{...i,layer:this}),s=!!i&&!!i.messages&&!!i.messages.filter((e=>e instanceof r&&"web-document-write:property-required"===e.name)).length;return t(o?.url)?(i?.messages?.push(new r("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:o}beforeSave(){}};return e([i({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],d.prototype,"id",void 0),e([i(y)],d.prototype,"listMode",void 0),e([s("listMode")],d.prototype,"writeListMode",null),e([i({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1},"web-scene":{name:"layerType",read:!1,write:{enabled:!0,ignoreOrigin:!0,layerContainerTypes:a}}}}})],d.prototype,"operationalLayerType",void 0),e([s("operationalLayerType")],d.prototype,"writeOperationalLayerType",null),e([i(c)],d.prototype,"opacity",void 0),e([i({type:Boolean,readOnly:!1})],d.prototype,"persistenceEnabled",void 0),e([i({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],d.prototype,"title",void 0),e([s("title"),s(["web-scene"],"title")],d.prototype,"writeTitle",null),e([i({type:Boolean,json:{origins:{"web-scene":{name:"visibility",write:{enabled:!0,layerContainerTypes:a}}},name:"visibility",write:!0}})],d.prototype,"visible",void 0),d=e([o("esri.layers.mixins.OperationalLayer")],d),d};function d(e){return"operationalLayerType"in e}export{u as OperationalLayer,d as isOperationalLayer};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Error.js";import{isBlobProtocol as t}from"../../core/urlUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{reader as i}from"../../core/accessorSupport/decorators/reader.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as n}from"../../core/accessorSupport/layerContainerType.js";import{readLoadable as p}from"../../core/accessorSupport/read.js";import{willPropertyWrite as l}from"../../core/accessorSupport/write.js";import{supportedTypes as y}from"./operationalLayers.js";import{listMode as c,opacity as d}from"../support/commonProperties.js";const u=u=>{let m=class extends u{constructor(){super(...arguments),this.persistenceEnabled=!0,this.title=null}readId(e,r,t){return"Group Layer"===t?.portalItem?.type?void 0:e}writeListMode(e,r,t,o){(o&&"ground"===o.layerContainerType||e&&l(this,t,{},o))&&(r[t]=e)}writeOperationalLayerType(e,r,t,o){e&&"tables"!==o?.layerContainerType&&(r.layerType=e)}writeTitle(e,r){r.title=e??"Layer"}read(e,r){r&&(r.layer=this),p(this,e,(r=>super.read(e,r)),r)}write(e,o){if(!this.persistenceEnabled)return null;if(o?.origin){const e=`${o.origin}/${o.layerContainerType||"operational-layers"}`,t=y[e];let i=!!t?.[this.operationalLayerType];if("ArcGISTiledElevationServiceLayer"===this.operationalLayerType&&"web-scene/operational-layers"===e&&(i=!1),"ArcGISDimensionLayer"===this.operationalLayerType&&"web-map/operational-layers"===e&&(i=!1),!i)return o.messages?.push(new r("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this})),null}const i=super.write(e,{...o,layer:this}),s=!!o&&!!o.messages&&!!o.messages.filter((e=>e instanceof r&&"web-document-write:property-required"===e.name)).length;return t(i?.url)?(o?.messages?.push(new r("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:i}beforeSave(){}};return e([o({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],m.prototype,"id",void 0),e([i("id",["id"])],m.prototype,"readId",null),e([o(c)],m.prototype,"listMode",void 0),e([a("listMode")],m.prototype,"writeListMode",null),e([o({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1},"web-scene":{name:"layerType",read:!1,write:{enabled:!0,ignoreOrigin:!0,layerContainerTypes:n}}}}})],m.prototype,"operationalLayerType",void 0),e([a("operationalLayerType")],m.prototype,"writeOperationalLayerType",null),e([o(d)],m.prototype,"opacity",void 0),e([o({type:Boolean,readOnly:!1})],m.prototype,"persistenceEnabled",void 0),e([o({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],m.prototype,"title",void 0),e([a("title"),a(["web-scene"],"title")],m.prototype,"writeTitle",null),e([o({type:Boolean,json:{origins:{"web-scene":{name:"visibility",write:{enabled:!0,layerContainerTypes:n}}},name:"visibility",write:!0}})],m.prototype,"visible",void 0),m=e([s("esri.layers.mixins.OperationalLayer")],m),m};function m(e){return"operationalLayerType"in e}export{u as OperationalLayer,m as isOperationalLayer};