@arcgis/core 4.32.0-next.20250205 → 4.32.0-next.20250206

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 (120) hide show
  1. package/assets/components/assets/icon/dualImageArea16.json +1 -0
  2. package/assets/components/assets/icon/dualImageArea24.json +1 -0
  3. package/assets/components/assets/icon/dualImageArea32.json +1 -0
  4. package/assets/components/assets/icon/dualImageDistance16.json +1 -0
  5. package/assets/components/assets/icon/dualImageDistance24.json +1 -0
  6. package/assets/components/assets/icon/dualImageDistance32.json +1 -0
  7. package/assets/components/assets/icon/dualImageLocation16.json +1 -0
  8. package/assets/components/assets/icon/dualImageLocation24.json +1 -0
  9. package/assets/components/assets/icon/dualImageLocation32.json +1 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{24a86c52c8bdd0b5eb4d.js → 09a99c556089c166d1f8.js} +1 -1
  12. package/assets/esri/core/workers/chunks/0a8e388e96af44deeabb.js +1 -0
  13. package/assets/esri/core/workers/chunks/15f850c9a1154fc57e5a.js +1 -0
  14. package/assets/esri/core/workers/chunks/{9b4f471fcd8a3b5e089f.js → 192569dfa7c0ea8dd864.js} +1 -1
  15. package/assets/esri/core/workers/chunks/24e47f748f0e4f815c6e.js +1 -0
  16. package/assets/esri/core/workers/chunks/28374a64790342e1b5ae.js +1 -0
  17. package/assets/esri/core/workers/chunks/{ad215219e5eef8598745.js → 28dbbfc44cc2bdcd221d.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{6d5bfcc7856cafe7b043.js → 2d62b44385b2b7882b72.js} +2 -2
  19. package/assets/esri/core/workers/chunks/{6d5bfcc7856cafe7b043.js.LICENSE.txt → 2d62b44385b2b7882b72.js.LICENSE.txt} +1 -1
  20. package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
  21. package/assets/esri/core/workers/chunks/{72cf9192292e5c85c6df.js → 32d3657dcae89b740f8b.js} +2 -2
  22. package/assets/esri/core/workers/chunks/{72cf9192292e5c85c6df.js.LICENSE.txt → 32d3657dcae89b740f8b.js.LICENSE.txt} +1 -1
  23. package/assets/esri/core/workers/chunks/333091ab2e267652ed56.js +1 -0
  24. package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js.LICENSE.txt +1 -1
  25. package/assets/esri/core/workers/chunks/35e4af82a08b4eadbfab.js +1 -0
  26. package/assets/esri/core/workers/chunks/38cd7745b8ef1b8b6196.js +1 -0
  27. package/assets/esri/core/workers/chunks/{8a1e4f65fc81aba7a704.js → 4122d10bc910e888eee1.js} +1 -1
  28. package/assets/esri/core/workers/chunks/433576983754f690bcc7.js +1 -0
  29. package/assets/esri/core/workers/chunks/459af0c3d62c3ed11c19.js +1 -0
  30. package/assets/esri/core/workers/chunks/53810519ff5922b42cd2.js +1 -0
  31. package/assets/esri/core/workers/chunks/594d923400fd74881833.js +1 -0
  32. package/assets/esri/core/workers/chunks/{7a0415db78c68d31733f.js → 6039da57a2adedd3b83f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/6fa4e80da3a7499a952c.js +1 -0
  34. package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js.LICENSE.txt +1 -1
  35. package/assets/esri/core/workers/chunks/{723a9fba144e2fa6d017.js → 7cb09e58bcc537ec1f7a.js} +1 -1
  36. package/assets/esri/core/workers/chunks/842db06ce62758fab1e7.js +1 -0
  37. package/assets/esri/core/workers/chunks/8c32cee395da0a7b9a8e.js +1 -0
  38. package/assets/esri/core/workers/chunks/94490937dca566fe2640.js +1 -0
  39. package/assets/esri/core/workers/chunks/{610b33b7291cffcc4e5d.js → a42ae5d5e5f66d120b4d.js} +1 -1
  40. package/assets/esri/core/workers/chunks/a5e9ea13e844a62b2a7f.js +1 -0
  41. package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
  42. package/assets/esri/core/workers/chunks/b43d88b6e7dc4ab13599.js +1 -0
  43. package/assets/esri/core/workers/chunks/d29c3bf29fcd7fa31f1a.js +1 -0
  44. package/assets/esri/core/workers/chunks/d339dee99c4820b63f39.js +1 -0
  45. package/assets/esri/core/workers/chunks/{9c5c6ecaf5be24279fa5.js → ddc30044f61a2c2df3fe.js} +1 -1
  46. package/assets/esri/core/workers/chunks/de1f3c4b8000c2d73013.js +1 -0
  47. package/assets/esri/core/workers/chunks/e4b3f2d5c43518b0cde7.js +1 -0
  48. package/assets/esri/core/workers/chunks/e5e3b6d00d27b5bb354f.js +1 -0
  49. package/assets/esri/core/workers/chunks/ef6279f5c63ab1e88c71.js +1 -0
  50. package/assets/esri/core/workers/chunks/{0711d3ad4d403bcfdcad.js → f117a89d1f4001a1f9f0.js} +1 -1
  51. package/assets/esri/core/workers/chunks/f60e301de6517553672f.js +2 -0
  52. package/assets/esri/core/workers/chunks/{1a2e1a414e651e988435.js.LICENSE.txt → f60e301de6517553672f.js.LICENSE.txt} +1 -1
  53. package/assets/esri/core/workers/chunks/f9e48205178a5a804d38.js +1 -0
  54. package/chunks/WaterSurface.glsl.js +2 -2
  55. package/geometry/support/meshUtils/elevation.js +1 -1
  56. package/interfaces.d.ts +84 -49
  57. package/layers/Layer.js +1 -1
  58. package/layers/graphics/data/FeatureStore.js +1 -1
  59. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  60. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  61. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  62. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  63. package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
  64. package/layers/graphics/sources/support/sourceUtils.js +1 -1
  65. package/layers/support/rasterFunctionUtils.d.ts +2 -1
  66. package/layers/support/rasterFunctionUtils.js +1 -1
  67. package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
  68. package/package.json +2 -2
  69. package/rest/support/ImageSampleParameters.js +1 -1
  70. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  71. package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
  72. package/support/revision.js +1 -1
  73. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  74. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  75. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  76. package/views/3d/layers/MediaLayerView3D.js +1 -1
  77. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  78. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  79. package/views/3d/terrain/OverlayManager.js +1 -1
  80. package/views/3d/terrain/OverlayRenderer.js +1 -1
  81. package/views/3d/terrain/TerrainSurface.js +1 -1
  82. package/views/3d/webgl-engine/Stage.js +1 -1
  83. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  84. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  85. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  86. package/views/LayerViewManager.js +1 -1
  87. package/views/SceneView.js +1 -1
  88. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  89. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
  90. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  91. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  92. package/widgets/Editor.js +1 -1
  93. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  94. package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
  95. package/widgets/Sketch.js +1 -1
  96. package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js +0 -2
  97. package/assets/esri/core/workers/chunks/287362f9af132fafe4de.js +0 -1
  98. package/assets/esri/core/workers/chunks/2ea5e5e6c4660a06b516.js +0 -1
  99. package/assets/esri/core/workers/chunks/380d37ceb8cf52bad190.js +0 -1
  100. package/assets/esri/core/workers/chunks/3984bf01f055fc42bfbf.js +0 -1
  101. package/assets/esri/core/workers/chunks/39e38aab86dcee3f79be.js +0 -1
  102. package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +0 -1
  103. package/assets/esri/core/workers/chunks/5e7f16b312077ca8c18d.js +0 -1
  104. package/assets/esri/core/workers/chunks/6ef2514a6b7bbfb8e37d.js +0 -1
  105. package/assets/esri/core/workers/chunks/7e4d72279cc599b7029c.js +0 -1
  106. package/assets/esri/core/workers/chunks/82d26884127ed772cc4b.js +0 -1
  107. package/assets/esri/core/workers/chunks/8438fba57e82e4cc7c11.js +0 -1
  108. package/assets/esri/core/workers/chunks/858b191c078d04232342.js +0 -1
  109. package/assets/esri/core/workers/chunks/91d2bdfa6e34c10b7f50.js +0 -1
  110. package/assets/esri/core/workers/chunks/92155d112ebb6a4c6c6e.js +0 -1
  111. package/assets/esri/core/workers/chunks/991e0f619f1f81f94d56.js +0 -1
  112. package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +0 -1
  113. package/assets/esri/core/workers/chunks/b33122adfd1fb68f7c0f.js +0 -1
  114. package/assets/esri/core/workers/chunks/bbbe5d6cb8b737811c84.js +0 -1
  115. package/assets/esri/core/workers/chunks/bf26f58210755875748c.js +0 -1
  116. package/assets/esri/core/workers/chunks/d175953337fa655dc6b0.js +0 -1
  117. package/assets/esri/core/workers/chunks/d8c762ca94e3a11b125d.js +0 -1
  118. package/assets/esri/core/workers/chunks/dbc447413ab40a79ba87.js +0 -1
  119. package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +0 -1
  120. package/assets/esri/core/workers/chunks/e410a09650530d7aad10.js +0 -1
@@ -25,7 +25,7 @@ import{ForwardLinearDepth as e}from"../views/3d/webgl-engine/core/shaderLibrary/
25
25
  forwardViewPosDepth((view * vec4(vpos, 1.0)).xyz);
26
26
 
27
27
  gl_Position = transformPosition(proj, view, vpos);
28
- forwardLinearDepth();`)),S.include(c,O),O.output){case i.Color:case i.ColorEmission:S.include(t,{pbrMode:m.Disabled,lightingSphericalHarmonicsOrder:2}),S.include(w),S.include(v,O),S.include(p,O),S.fragment.include(o,O),S.include(C,O),N.uniforms.add(z,new y("timeElapsed",(e=>e.timeElapsed)),D.uniforms.get("view"),D.uniforms.get("localOrigin")),h(N,O),N.include(u),l(N),d(N),N.main.add(j`
28
+ forwardLinearDepth();`)),S.include(c,O),O.output){case i.Color:case i.ColorEmission:S.include(t,{pbrMode:m.Disabled,lightingSphericalHarmonicsOrder:2}),S.include(w),S.include(v,O),S.include(p,O),S.fragment.include(o,O),S.include(C,O),N.include(u),h(N,O),l(N),d(N),N.uniforms.add(z,new y("timeElapsed",(({timeElapsed:e})=>e)),D.uniforms.get("view"),D.uniforms.get("localOrigin")).main.add(j`
29
29
  discardBySlice(vpos);
30
30
  discardByTerrainDepth();
31
31
  vec3 localUp = vnormal;
@@ -51,7 +51,7 @@ import{ForwardLinearDepth as e}from"../views/3d/webgl-engine/core/shaderLibrary/
51
51
  vuv = uv0;
52
52
  vpos = position;
53
53
 
54
- gl_Position = transformPosition(proj, view, vpos);`),N.uniforms.add(new y("timeElapsed",(e=>e.timeElapsed))),N.main.add(j`discardBySlice(vpos);
54
+ gl_Position = transformPosition(proj, view, vpos);`),N.uniforms.add(new y("timeElapsed",(({timeElapsed:e})=>e))).main.add(j`discardBySlice(vpos);
55
55
  vec4 tangentNormalFoam = getSurfaceNormalAndFoam(vuv, timeElapsed);
56
56
  tangentNormalFoam.xyz = normalize(tangentNormalFoam.xyz);
57
57
  fragColor = vec4((tangentNormalFoam.xyz + vec3(1.0)) * 0.5, tangentNormalFoam.w);`);break;case i.Highlight:S.include(n,O),S.varyings.add("vpos","vec3"),D.uniforms.add(z),D.main.add(j`
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import o from"../../Mesh.js";import n from"../../Point.js";import{project as r}from"../../projection.js";import{compactIndices as i}from"../Indices.js";import a from"../MeshComponent.js";import{MeshVertexAttributes as s}from"../MeshVertexAttributes.js";import{isGround as l}from"../../../support/groundInstanceUtils.js";async function m(t,o,n){let r;if(p(t)||l(t)){const e=await u(t);return r=await e.createElevationSampler(o,{demResolution:n?.demResolution??"finest-contiguous"}),c(r,o,{material:n?.material})}return"string"==typeof n?.demResolution?(e.getLogger("esri.geometry.support.meshUtils.elevation").error("create()","demResolution must be a number when used directly with a sampler"),null):c(t,o,{material:n?.material,demResolution:n?.demResolution})}function c(e,n,l){const m=t(n.spatialReference),c=(l?.demResolution??e.demResolution.min)/m,u=Math.round(n.width/c),p=Math.round(n.height/c),d=u+1,h=p+1,R=new Float64Array(d*h*3),w=new Float32Array(d*h*2);let y=0,g=0;const j=new Uint32Array(u*p*2*3);let v=0,A=0;const x=!e.spatialReference.equals(n.spatialReference);f.spatialReference=n.spatialReference;const{xmin:b,ymin:M,height:U,width:F}=n;for(let t=0;t<h;t++){const o=M+U*(t/p);for(let n=0;n<d;n++){const i=b+F*(n/u);if(R[y++]=i,R[y++]=o,x){f.x=i,f.y=o;const t=r(f,e.spatialReference);R[y++]=e.elevationAt(t.x,t.y)??0}else R[y++]=e.elevationAt(i,o)??0;const a=n/u,s=t/p;w[g++]=a,w[g++]=s,t!==p&&n!==u&&(j[A++]=v+1,j[A++]=v+d+1,j[A++]=v+d,j[A++]=v,j[A++]=v+1,j[A++]=v+d),v++}}return new o({vertexAttributes:new s({position:R,uv:w}),components:[new a({faces:i(j),shading:"smooth",material:l?.material??null})],spatialReference:n.spatialReference})}async function u(e){return p(e)?e.load():(await e.load(),await Promise.allSettled(e.layers.items.map((e=>e.load()))),e)}function p(e){return"type"in e&&("elevation"===e.type||"base-elevation"===e.type)}const f=new n;export{m as create};
5
+ import e from"../../../core/Logger.js";import{getMetersPerUnitForSR as t}from"../../../core/unitUtils.js";import o from"../../Mesh.js";import n from"../../Point.js";import{project as r}from"../../projection.js";import i from"../MeshComponent.js";import{MeshVertexAttributes as a}from"../MeshVertexAttributes.js";import{isGround as s}from"../../../support/groundInstanceUtils.js";async function l(t,o,n){let r;if(u(t)||s(t)){const e=await c(t);return r=await e.createElevationSampler(o,{demResolution:n?.demResolution??"finest-contiguous"}),m(r,o,{material:n?.material})}return"string"==typeof n?.demResolution?(e.getLogger("esri.geometry.support.meshUtils.elevation").error("create()","demResolution must be a number when used directly with a sampler"),null):m(t,o,{material:n?.material,demResolution:n?.demResolution})}function m(e,n,s){const l=t(n.spatialReference),m=(s?.demResolution??e.demResolution.min)/l,c=Math.round(n.width/m),u=Math.round(n.height/m),f=c+1,d=u+1,h=new Float64Array(f*d*3),R=new Float32Array(f*d*2);let w=0,y=0;const g=new Uint32Array(c*u*2*3);let j=0,v=0;const A=!e.spatialReference.equals(n.spatialReference);p.spatialReference=n.spatialReference;const{xmin:x,ymin:b,height:M,width:U}=n;for(let t=0;t<d;t++){const o=b+M*(t/u);for(let n=0;n<f;n++){const i=x+U*(n/c);if(h[w++]=i,h[w++]=o,A){p.x=i,p.y=o;const t=r(p,e.spatialReference);h[w++]=e.elevationAt(t.x,t.y)??0}else h[w++]=e.elevationAt(i,o)??0;const a=n/c,s=t/u;R[y++]=a,R[y++]=s,t!==u&&n!==c&&(g[v++]=j+1,g[v++]=j+f+1,g[v++]=j+f,g[v++]=j,g[v++]=j+1,g[v++]=j+f),j++}}return new o({vertexAttributes:new a({position:h,uv:R}),components:[new i({faces:g,shading:"smooth",material:s?.material??null})],spatialReference:n.spatialReference})}async function c(e){return u(e)?e.load():(await e.load(),await Promise.allSettled(e.layers.items.map((e=>e.load()))),e)}function u(e){return"type"in e&&("elevation"===e.type||"base-elevation"===e.type)}const p=new n;export{l as create};
package/interfaces.d.ts CHANGED
@@ -23918,15 +23918,6 @@ declare namespace __esri {
23918
23918
  }
23919
23919
 
23920
23920
  export class Layer {
23921
- /**
23922
- * Called by the views, such as {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html MapView} and
23923
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html SceneView}, when the layer is added to the
23924
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers Map.layers} collection and a layer view must
23925
- * be created for it.
23926
- *
23927
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#createLayerView Read more...}
23928
- */
23929
- createLayerView: CreateLayerView | nullish;
23930
23921
  /**
23931
23922
  * The unique ID assigned to the layer.
23932
23923
  *
@@ -24090,6 +24081,19 @@ declare namespace __esri {
24090
24081
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#cancelLoad Read more...}
24091
24082
  */
24092
24083
  cancelLoad(): void;
24084
+ /**
24085
+ * Called by the views, such as {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html MapView} and
24086
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html SceneView}, when the layer is added to the
24087
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers Map.layers} collection and a layer view must
24088
+ * be created for it.
24089
+ *
24090
+ * @param view The parent view.
24091
+ * @param options An object specifying additional options. See the object specification table below for the required properties of this object.
24092
+ * @param options.signal A signal to abort the creation of the layerview.
24093
+ *
24094
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#createLayerView Read more...}
24095
+ */
24096
+ createLayerView(view: any, options?: LayerCreateLayerViewOptions): Promise<LayerView>;
24093
24097
  /**
24094
24098
  * Destroys the layer and any associated resources (including its {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#portalItem portalItem}, if it is a property on the layer).
24095
24099
  *
@@ -24183,15 +24187,6 @@ declare namespace __esri {
24183
24187
  }
24184
24188
 
24185
24189
  interface LayerProperties extends LoadableProperties {
24186
- /**
24187
- * Called by the views, such as {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html MapView} and
24188
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html SceneView}, when the layer is added to the
24189
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers Map.layers} collection and a layer view must
24190
- * be created for it.
24191
- *
24192
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#createLayerView Read more...}
24193
- */
24194
- createLayerView?: CreateLayerView | nullish;
24195
24190
  /**
24196
24191
  * The full extent of the layer.
24197
24192
  *
@@ -24242,7 +24237,9 @@ declare namespace __esri {
24242
24237
  visible?: boolean;
24243
24238
  }
24244
24239
 
24245
- export type CreateLayerView = (view: any, options?: any) => Promise<LayerView>;
24240
+ export interface LayerCreateLayerViewOptions {
24241
+ signal?: AbortSignal | nullish;
24242
+ }
24246
24243
 
24247
24244
  export interface LayerFromArcGISServerUrlParams {
24248
24245
  url: string;
@@ -36672,6 +36669,7 @@ declare namespace __esri {
36672
36669
  * @param parameters The clip parameters object has the following properties.
36673
36670
  * @param parameters.geometry An extent or a polygon geometry to define the clip shape.
36674
36671
  * @param parameters.keepOutside When `false`, the imagery within the clip geometry will be kept in the output. When `true`, imagery outside of the clip geometry will be kept and the imagery inside the clip geometry will be discarded.
36672
+ * @param parameters.raster The input raster. Default is the image service.
36675
36673
  * @param parameters.outputPixelType The output pixel type.
36676
36674
  *
36677
36675
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#clip Read more...}
@@ -36690,6 +36688,7 @@ declare namespace __esri {
36690
36688
  *
36691
36689
  * @param parameters The parameters object has the following properties.
36692
36690
  * @param parameters.raster The input raster. Default is the image service.
36691
+ * @param parameters.outputPixelType The output pixel type, default is u8.
36693
36692
  *
36694
36693
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#colormapToRGB Read more...}
36695
36694
  */
@@ -36701,9 +36700,9 @@ declare namespace __esri {
36701
36700
  * @param parameters.rasters The input raster. Default is the image service.
36702
36701
  * @param parameters.outputPixelType The output pixel type, default is unknown.
36703
36702
  *
36704
- * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#compositeBands Read more...}
36703
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#compositeBand Read more...}
36705
36704
  */
36706
- compositeBands(parameters: rasterFunctionUtilsCompositeBandsParameters): RasterFunction;
36705
+ compositeBand(parameters: rasterFunctionUtilsCompositeBandParameters): RasterFunction;
36707
36706
  /**
36708
36707
  * Creates a raster function that sets the truthy pixels (value is not 0) to the pixel value from a true raster, and falsy pixels (value is 0) to the pixel value of the false raster.
36709
36708
  *
@@ -36821,6 +36820,7 @@ declare namespace __esri {
36821
36820
  *
36822
36821
  * @param parameters The grayscale parameters object has the following properties.
36823
36822
  * @param parameters.weights The weights applied to each input band. Weights are often applied because some bands have variable importance depending on the application.
36823
+ * @param parameters.raster The input raster. Default is the image service.
36824
36824
  * @param parameters.outputPixelType The output pixel type, default is unknown.
36825
36825
  *
36826
36826
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#grayscale Read more...}
@@ -36922,7 +36922,7 @@ declare namespace __esri {
36922
36922
  * @param parameters The parameters object has the following properties.
36923
36923
  * @param parameters.includedRanges The included values for each band. Each band is specified using a range [from, to].
36924
36924
  * @param parameters.noDataValues The nodata values for each band.
36925
- * @param parameters.noDataInterpretation Result is no data if all bands are nodata when match-all is specified, any if any band is nodata when match-any is specified.
36925
+ * @param parameters.noDataInterpretation Result is no data if all bands are nodata when match-all is specified, any if any band is nodata when match-any is specified. Default is match-any.
36926
36926
  * @param parameters.raster The input raster. Default is the image service.
36927
36927
  * @param parameters.outputPixelType The output pixel type, default is unknown.
36928
36928
  *
@@ -37045,6 +37045,7 @@ declare namespace __esri {
37045
37045
  * @param parameters The parameters object has the following properties.
37046
37046
  * @param parameters.slopeType The slope type
37047
37047
  * @param parameters.zFactor A ratio of z unit / xy unit, with optional exaggeration factored in.
37048
+ * @param parameters.scalingType The slope result is scaled dynamically by adjusting the zFactor. Default is none.
37048
37049
  * @param parameters.pixelSizePower Pixel size factor accounts for changes in scale as the viewer zooms in and out on the map display. It controls the rate at which the zFactor changes. This parameter is only valid when the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#scalingType scalingType} is `adjusted`.
37049
37050
  * @param parameters.pixelSizeZFactor Pixel Size Power accounts for the altitude changes (or scale) as the viewer zooms in and out on the map display. It is the exponent applied to the pixel size term in the equation that controls the rate at which the zFactor changes to avoid significant loss of relief. This parameter is only valid when the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#scalingType scalingType} is `adjusted`.
37050
37051
  * @param parameters.removeEdgeEffect Remove edge effect when true
@@ -37112,6 +37113,20 @@ declare namespace __esri {
37112
37113
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#stretchMinMax Read more...}
37113
37114
  */
37114
37115
  stretchMinMax(parameters: rasterFunctionUtilsStretchMinMaxParameters): RasterFunction;
37116
+ /**
37117
+ * Creates a Stretch function without a specific stretch method.
37118
+ *
37119
+ * @param parameters The parameters object has the following properties.
37120
+ * @param parameters.outputMin The minimum output value. Default is 0.
37121
+ * @param parameters.outputMax The maximum output value. Default is 255.
37122
+ * @param parameters.useGamma When true, gamma stretch is applied.
37123
+ * @param parameters.gamma The gamma values used for each band, needed when useGamma is true.
37124
+ * @param parameters.raster The input raster. Default is the image service.
37125
+ * @param parameters.outputPixelType The output pixel type, default is unknown.
37126
+ *
37127
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-rasterFunctionUtils.html#stretchNone Read more...}
37128
+ */
37129
+ stretchNone(parameters: rasterFunctionUtilsStretchNoneParameters): RasterFunction;
37115
37130
  /**
37116
37131
  * Creates a Stretch function using percent-clip stretch type.
37117
37132
  *
@@ -37388,7 +37403,14 @@ declare namespace __esri {
37388
37403
  | "yellow-to-green-to-dark-blue"
37389
37404
  | "yellow-to-red"
37390
37405
  | "yellow-green-bright"
37391
- | "yellow-green-light-to-dark";
37406
+ | "yellow-green-light-to-dark"
37407
+ | "hillshade"
37408
+ | "gray"
37409
+ | "elevation"
37410
+ | "ndvi"
37411
+ | "ndvi2"
37412
+ | "ndvi3"
37413
+ | "random";
37392
37414
  raster?: RasterPrimaryArgument;
37393
37415
  outputPixelType?: OutputPixelType;
37394
37416
  }
@@ -37597,7 +37619,7 @@ declare namespace __esri {
37597
37619
  }
37598
37620
 
37599
37621
  export interface rasterFunctionUtilsBandArithmeticSultanParameters {
37600
- bandIds: [number, number, number, number, number, number];
37622
+ bandIds: [number, number, number, number, number];
37601
37623
  raster?: RasterPrimaryArgument;
37602
37624
  outputPixelType?: OutputPixelType;
37603
37625
  }
@@ -37639,14 +37661,16 @@ declare namespace __esri {
37639
37661
  export interface rasterFunctionUtilsClipParameters {
37640
37662
  geometry: Polygon | Extent;
37641
37663
  keepOutside?: boolean;
37664
+ raster?: RasterPrimaryArgument;
37642
37665
  outputPixelType?: OutputPixelType;
37643
37666
  }
37644
37667
 
37645
37668
  export interface rasterFunctionUtilsColormapToRGBParameters {
37646
37669
  raster?: RasterPrimaryArgument;
37670
+ outputPixelType?: OutputPixelType;
37647
37671
  }
37648
37672
 
37649
- export interface rasterFunctionUtilsCompositeBandsParameters {
37673
+ export interface rasterFunctionUtilsCompositeBandParameters {
37650
37674
  rasters: RasterArgument[];
37651
37675
  outputPixelType?: OutputPixelType;
37652
37676
  }
@@ -37667,6 +37691,7 @@ declare namespace __esri {
37667
37691
 
37668
37692
  export interface rasterFunctionUtilsGrayscaleParameters {
37669
37693
  weights: number[];
37694
+ raster?: RasterPrimaryArgument;
37670
37695
  outputPixelType?: OutputPixelType;
37671
37696
  }
37672
37697
 
@@ -37684,9 +37709,9 @@ declare namespace __esri {
37684
37709
  }
37685
37710
 
37686
37711
  export interface rasterFunctionUtilsMaskParameters {
37687
- includedRanges: [number, number][];
37688
- noDataValues: number[][];
37689
- noDataInterpretation: "match-any" | "match-all";
37712
+ includedRanges?: [number, number][];
37713
+ noDataValues?: number[][];
37714
+ noDataInterpretation?: "match-any" | "match-all";
37690
37715
  raster?: RasterPrimaryArgument;
37691
37716
  outputPixelType?: OutputPixelType;
37692
37717
  }
@@ -37701,6 +37726,7 @@ declare namespace __esri {
37701
37726
  export interface rasterFunctionUtilsSlopeParameters {
37702
37727
  slopeType: "degree" | "percent-rise";
37703
37728
  zFactor: number;
37729
+ scalingType?: "none" | "adjusted";
37704
37730
  pixelSizePower?: number;
37705
37731
  pixelSizeZFactor?: number;
37706
37732
  removeEdgeEffect?: boolean;
@@ -37735,6 +37761,15 @@ declare namespace __esri {
37735
37761
  outputPixelType?: OutputPixelType;
37736
37762
  }
37737
37763
 
37764
+ export interface rasterFunctionUtilsStretchNoneParameters {
37765
+ outputMin?: number;
37766
+ outputMax?: number;
37767
+ useGamma?: boolean;
37768
+ gamma?: number[];
37769
+ raster?: RasterPrimaryArgument;
37770
+ outputPixelType?: OutputPixelType;
37771
+ }
37772
+
37738
37773
  export interface rasterFunctionUtilsStretchPercentClipParameters {
37739
37774
  minPercent: number;
37740
37775
  maxPercent: number;
@@ -70372,8 +70407,8 @@ declare namespace __esri {
70372
70407
  *
70373
70408
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageIdentifyParameters.html#mosaicRule Read more...}
70374
70409
  */
70375
- get mosaicRule(): MosaicRule;
70376
- set mosaicRule(value: MosaicRuleProperties);
70410
+ get mosaicRule(): MosaicRule | nullish;
70411
+ set mosaicRule(value: MosaicRuleProperties | nullish);
70377
70412
  /**
70378
70413
  * Specifies the pixel level being identified on the x and y axis.
70379
70414
  *
@@ -70441,7 +70476,7 @@ declare namespace __esri {
70441
70476
  *
70442
70477
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageIdentifyParameters.html#mosaicRule Read more...}
70443
70478
  */
70444
- mosaicRule?: MosaicRuleProperties;
70479
+ mosaicRule?: MosaicRuleProperties | nullish;
70445
70480
  /**
70446
70481
  * Specifies the pixel level being identified on the x and y axis.
70447
70482
  *
@@ -70560,8 +70595,8 @@ declare namespace __esri {
70560
70595
  *
70561
70596
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageIdentifyResult.html#location Read more...}
70562
70597
  */
70563
- get location(): Point | nullish;
70564
- set location(value: PointProperties | nullish);
70598
+ get location(): Point;
70599
+ set location(value: PointProperties);
70565
70600
  /**
70566
70601
  * Converts an instance of this class to its [ArcGIS portal JSON](https://developers.arcgis.com/documentation/common-data-types/geometry-objects.htm) representation.
70567
70602
  *
@@ -70598,7 +70633,7 @@ declare namespace __esri {
70598
70633
  *
70599
70634
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageIdentifyResult.html#location Read more...}
70600
70635
  */
70601
- location?: PointProperties | nullish;
70636
+ location?: PointProperties;
70602
70637
  /**
70603
70638
  * The identify property name.
70604
70639
  *
@@ -70988,8 +71023,8 @@ declare namespace __esri {
70988
71023
  *
70989
71024
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImagePixelLocationParameters.html#geometries Read more...}
70990
71025
  */
70991
- get geometries(): Point[] | nullish;
70992
- set geometries(value: PointProperties[] | nullish);
71026
+ get geometries(): Point[];
71027
+ set geometries(value: PointProperties[]);
70993
71028
  /**
70994
71029
  * Converts an instance of this class to its [ArcGIS portal JSON](https://developers.arcgis.com/documentation/common-data-types/geometry-objects.htm) representation.
70995
71030
  *
@@ -71014,7 +71049,7 @@ declare namespace __esri {
71014
71049
  *
71015
71050
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImagePixelLocationParameters.html#geometries Read more...}
71016
71051
  */
71017
- geometries?: PointProperties[] | nullish;
71052
+ geometries?: PointProperties[];
71018
71053
  /**
71019
71054
  * The rasterId of a raster catalog in the image service.
71020
71055
  *
@@ -71161,7 +71196,7 @@ declare namespace __esri {
71161
71196
  *
71162
71197
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSample.html#locationId Read more...}
71163
71198
  */
71164
- locationId: number | nullish;
71199
+ locationId: number;
71165
71200
  /**
71166
71201
  * The pixel value associated with the sampled location.
71167
71202
  *
@@ -71179,7 +71214,7 @@ declare namespace __esri {
71179
71214
  *
71180
71215
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSample.html#resolution Read more...}
71181
71216
  */
71182
- resolution: number | nullish;
71217
+ resolution: number;
71183
71218
  /**
71184
71219
  * The {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#getSamples getSamples}
71185
71220
  * method on {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html ImageryLayer} returns
@@ -71193,8 +71228,8 @@ declare namespace __esri {
71193
71228
  *
71194
71229
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSample.html#location Read more...}
71195
71230
  */
71196
- get location(): Point | nullish;
71197
- set location(value: PointProperties | nullish);
71231
+ get location(): Point;
71232
+ set location(value: PointProperties);
71198
71233
  /**
71199
71234
  * Converts an instance of this class to its [ArcGIS portal JSON](https://developers.arcgis.com/documentation/common-data-types/geometry-objects.htm) representation.
71200
71235
  *
@@ -71225,13 +71260,13 @@ declare namespace __esri {
71225
71260
  *
71226
71261
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSample.html#location Read more...}
71227
71262
  */
71228
- location?: PointProperties | nullish;
71263
+ location?: PointProperties;
71229
71264
  /**
71230
71265
  * The location id.
71231
71266
  *
71232
71267
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSample.html#locationId Read more...}
71233
71268
  */
71234
- locationId?: number | nullish;
71269
+ locationId?: number;
71235
71270
  /**
71236
71271
  * The pixel value associated with the sampled location.
71237
71272
  *
@@ -71249,7 +71284,7 @@ declare namespace __esri {
71249
71284
  *
71250
71285
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSample.html#resolution Read more...}
71251
71286
  */
71252
- resolution?: number | nullish;
71287
+ resolution?: number;
71253
71288
  }
71254
71289
 
71255
71290
  export interface ImageSampleParameters extends Accessor, JSONSupport {
@@ -71323,8 +71358,8 @@ declare namespace __esri {
71323
71358
  *
71324
71359
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSampleParameters.html#locations Read more...}
71325
71360
  */
71326
- get locations(): Point[];
71327
- set locations(value: PointProperties[]);
71361
+ get locations(): Point[] | nullish;
71362
+ set locations(value: PointProperties[] | nullish);
71328
71363
  /**
71329
71364
  * Specifies the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-MosaicRule.html mosaic rule} defining the image sort order and selection.
71330
71365
  *
@@ -71387,7 +71422,7 @@ declare namespace __esri {
71387
71422
  *
71388
71423
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageSampleParameters.html#locations Read more...}
71389
71424
  */
71390
- locations?: PointProperties[];
71425
+ locations?: PointProperties[] | nullish;
71391
71426
  /**
71392
71427
  * Specifies the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-MosaicRule.html mosaic rule} defining the image sort order and selection.
71393
71428
  *
@@ -71491,7 +71526,7 @@ declare namespace __esri {
71491
71526
  *
71492
71527
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageToMapMultirayParameters.html#rasterIds Read more...}
71493
71528
  */
71494
- rasterIds: number[] | nullish;
71529
+ rasterIds: number[];
71495
71530
  /**
71496
71531
  * Input parameters for the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#imageToMapMultiray ImageryLayer.imageToMapMultiray()}
71497
71532
  * or {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-imageService.html#imageToMapMultiray imageService.imageToMapMultiray()} methods.
@@ -71563,7 +71598,7 @@ declare namespace __esri {
71563
71598
  *
71564
71599
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-ImageToMapMultirayParameters.html#rasterIds Read more...}
71565
71600
  */
71566
- rasterIds?: number[] | nullish;
71601
+ rasterIds?: number[];
71567
71602
  }
71568
71603
 
71569
71604
  export class ImageToMapParameters extends JSONSupport {
package/layers/Layer.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.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../request.js";import r from"../core/Error.js";import o from"../core/Evented.js";import i from"../core/Identifiable.js";import s from"../core/Loadable.js";import a from"../core/Logger.js";import{isAbortError as l}from"../core/promiseUtils.js";import{urlToObject as n}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/Extent.js";import c from"../geometry/SpatialReference.js";import{fromPortalItem as u}from"./support/fromPortalItem.js";import m from"../time/TimeExtent.js";let b=0,h=class extends(o.EventedMixin(i.IdentifiableMixin(s))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new d(-180,-90,180,90,c.WGS84),this.id=Date.now().toString(16)+"-layer-"+b++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=c.WGS84,this.title=null,this.type=null,this.url=null,this.visibilityTimeExtent=null,this.visible=!0,this.createLayerView=void 0}static async fromArcGISServerUrl(t){const e="string"==typeof t?{url:t}:t;return(await import("./support/arcgisLayers.js")).fromUrl(e)}static fromPortalItem(t){return u(t)}initialize(){this.when().catch((t=>{l(t)||a.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:t})}))}destroy(){const t=this.parent;if(t){const e=this;"layers"in t&&t.layers.includes(e)?t.layers.remove(e):"tables"in t&&t.tables.includes(e)?t.tables.remove(e):"baseLayers"in t&&t.baseLayers.includes(e)?t.baseLayers.remove(e):"referenceLayers"in t&&t.referenceLayers.includes(e)&&t.referenceLayers.remove(e),this._set("parent",null)}}get effectiveVisible(){let t=this.visible;const e=this.parent;return t&&e&&"effectiveVisible"in e&&(t&&=e.effectiveVisible),t}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return n(this.url)}async fetchAttributionData(){const t=this.attributionDataUrl;if(this.hasAttributionData&&t){return(await e(t,{query:{f:"json"},responseType:"json"})).data}throw new r("layer:no-attribution-data","Layer does not have attribution data")}};t([p({type:String})],h.prototype,"attributionDataUrl",void 0),t([p({readOnly:!0})],h.prototype,"effectiveVisible",null),t([p({type:d})],h.prototype,"fullExtent",void 0),t([p({readOnly:!0})],h.prototype,"hasAttributionData",null),t([p({type:String,clonable:!1})],h.prototype,"id",void 0),t([p({type:Boolean,nonNullable:!0})],h.prototype,"legendEnabled",void 0),t([p({type:["show","hide","hide-children"]})],h.prototype,"listMode",void 0),t([p({type:Number,range:{min:0,max:1},nonNullable:!0})],h.prototype,"opacity",void 0),t([p({clonable:!1})],h.prototype,"parent",void 0),t([p({readOnly:!0})],h.prototype,"parsedUrl",null),t([p({type:Boolean,readOnly:!0})],h.prototype,"persistenceEnabled",void 0),t([p({type:Boolean})],h.prototype,"popupEnabled",void 0),t([p({type:Boolean})],h.prototype,"attributionVisible",void 0),t([p({type:c})],h.prototype,"spatialReference",void 0),t([p({type:String})],h.prototype,"title",void 0),t([p({readOnly:!0,json:{read:!1}})],h.prototype,"type",void 0),t([p()],h.prototype,"url",void 0),t([p({type:m})],h.prototype,"visibilityTimeExtent",void 0),t([p({type:Boolean,nonNullable:!0})],h.prototype,"visible",void 0),h=t([y("esri.layers.Layer")],h);const f=h;export{f as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import o from"../core/Evented.js";import i from"../core/Identifiable.js";import s from"../core/Loadable.js";import a from"../core/Logger.js";import{isAbortError as l}from"../core/promiseUtils.js";import{urlToObject as n}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import d from"../geometry/Extent.js";import c from"../geometry/SpatialReference.js";import{fromPortalItem as u}from"./support/fromPortalItem.js";import m from"../time/TimeExtent.js";let b=0,h=class extends(o.EventedMixin(i.IdentifiableMixin(s))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new d(-180,-90,180,90,c.WGS84),this.id=Date.now().toString(16)+"-layer-"+b++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=c.WGS84,this.title=null,this.type=null,this.url=null,this.visibilityTimeExtent=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await import("./support/arcgisLayers.js")).fromUrl(t)}static fromPortalItem(e){return u(e)}initialize(){this.when().catch((e=>{l(e)||a.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){const e=this.parent;if(e){const t=this;"layers"in e&&e.layers.includes(t)?e.layers.remove(t):"tables"in e&&e.tables.includes(t)?e.tables.remove(t):"baseLayers"in e&&e.baseLayers.includes(t)?e.baseLayers.remove(t):"referenceLayers"in e&&e.referenceLayers.includes(t)&&e.referenceLayers.remove(t),this._set("parent",null)}}get effectiveVisible(){let e=this.visible;const t=this.parent;return e&&t&&"effectiveVisible"in t&&(e&&=t.effectiveVisible),e}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return n(this.url)}createLayerView(e,t){return Promise.reject(new r("layer:create-layer-view","Layer does not support creating a layer view"))}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e){return(await t(e,{query:{f:"json"},responseType:"json"})).data}throw new r("layer:no-attribution-data","Layer does not have attribution data")}};e([p({type:String})],h.prototype,"attributionDataUrl",void 0),e([p({readOnly:!0})],h.prototype,"effectiveVisible",null),e([p({type:d})],h.prototype,"fullExtent",void 0),e([p({readOnly:!0})],h.prototype,"hasAttributionData",null),e([p({type:String,clonable:!1})],h.prototype,"id",void 0),e([p({type:Boolean,nonNullable:!0})],h.prototype,"legendEnabled",void 0),e([p({type:["show","hide","hide-children"]})],h.prototype,"listMode",void 0),e([p({type:Number,range:{min:0,max:1},nonNullable:!0})],h.prototype,"opacity",void 0),e([p({clonable:!1})],h.prototype,"parent",void 0),e([p({readOnly:!0})],h.prototype,"parsedUrl",null),e([p({type:Boolean,readOnly:!0})],h.prototype,"persistenceEnabled",void 0),e([p({type:Boolean})],h.prototype,"popupEnabled",void 0),e([p({type:Boolean})],h.prototype,"attributionVisible",void 0),e([p({type:c})],h.prototype,"spatialReference",void 0),e([p({type:String})],h.prototype,"title",void 0),e([p({readOnly:!0,json:{read:!1}})],h.prototype,"type",void 0),e([p()],h.prototype,"url",void 0),e([p({type:m})],h.prototype,"visibilityTimeExtent",void 0),e([p({type:Boolean,nonNullable:!0})],h.prototype,"visible",void 0),h=e([y("esri.layers.Layer")],h);const f=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.32/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{create as o,fromRect as i}from"../../../geometry/support/aaBoundingBox.js";import{create as n}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as a}from"../featureConversionUtils.js";import{BoundsStore as u}from"./BoundsStore.js";import{cleanFromGeometryEngine as d}from"./geometryUtils.js";import{optimizedFeatureQueryEngineAdapter as h}from"./optimizedFeatureQueryEngineAdapter.js";const f=o();class m{constructor(e){this.geometryInfo=e,this._boundsStore=new u,this._featuresById=new Map,this.events=new r,this.featureAdapter=h}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach((t=>{null!=t.geometry&&t.geometry.coords&&(e+=t.geometry.coords.length)})),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,r,s,o]=this.fullBounds;return{xmin:t,ymin:r,xmax:s,ymax:o,spatialReference:d(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(t){const r=t.map((e=>this._upsert(e)));return this._emitChanged(),r.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const r of e){const e=this._boundsStore.get(r.objectId);e&&t(i(f,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach((t=>e(t)))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,(e=>{t(this._featuresById.get(e))}))}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const r=e.objectId;if(null==r)return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e}));const o=this._featuresById.get(r);let i;if(o?(e.displayId=o.displayId,i=this._boundsStore.get(r),this._boundsStore.delete(r)):null!=this.onFeatureAdd&&this.onFeatureAdd(e),!e.geometry?.coords?.length)return this._boundsStore.set(r,null),void this._featuresById.set(r,e);i=a(null!=i?i:n(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),null!=i&&this._boundsStore.set(r,i),this._featuresById.set(r,e)}_upsert(e){const r=e?.objectId;if(null==r)return s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const o=this._featuresById.get(r);if(!o)return this._add(e),e;const{geometry:i,attributes:u}=e;for(const t in u)o.attributes[t]=u[t];return i&&(o.geometry=i,this._boundsStore.set(r,a(n(),i,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),o}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),e}}export{m as default};
5
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import r from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{create as o,fromRect as i}from"../../../geometry/support/aaBoundingBox.js";import{create as n}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as u}from"../featureConversionUtils.js";import{BoundsStore as a}from"./BoundsStore.js";import{cleanFromGeometryEngine as d}from"./geometryUtils.js";import{optimizedFeatureQueryEngineAdapter as h}from"./optimizedFeatureQueryEngineAdapter.js";const m=o();class f{constructor(e){this.geometryInfo=e,this._boundsStore=new a,this._featuresById=new Map,this._usedMemory=0,this.events=new r,this.featureAdapter=h}get usedMemory(){return this._usedMemory}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach((t=>{null!=t.geometry&&t.geometry.coords&&(e+=t.geometry.coords.length)})),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,r,s,o]=this.fullBounds;return{xmin:t,ymin:r,xmax:s,ymax:o,spatialReference:d(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(t){const r=t.map((e=>this._upsert(e)));return this._emitChanged(),r.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const r of e){const e=this._boundsStore.get(r.objectId);e&&t(i(m,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach((t=>e(t)))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,(e=>{t(this._featuresById.get(e))}))}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const r=e.objectId;if(null==r)return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e}));const o=this._featuresById.get(r);let i;if(o?(e.displayId=o.displayId,i=this._boundsStore.get(r),this._boundsStore.delete(r),this._usedMemory-=this.estimateFeatureUsedMemory?.(o)??0):null!=this.onFeatureAdd&&this.onFeatureAdd(e),!e.geometry?.coords?.length)return this._boundsStore.set(r,null),void this._featuresById.set(r,e);i=u(null!=i?i:n(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),null!=i&&this._boundsStore.set(r,i),this._featuresById.set(r,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0}_upsert(e){const r=e?.objectId;if(null==r)return s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const o=this._featuresById.get(r);if(!o)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(o)??0;const{geometry:i,attributes:a}=e;for(const t in a)o.attributes[t]=a[t];return i&&(o.geometry=i,this._boundsStore.set(r,u(n(),i,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(o)??0,o}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}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.32/esri/copyright.txt for details.
4
4
  */
5
- const t={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1};export{t as queryCapabilities};
5
+ const t={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCacheHint:!0,supportsCurrentUser:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!0,supportsReturnMesh:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},s={supportsDate:!0,supportsFixedInterval:!0,supportsAutoInterval:!0,supportsFixedBoundaries:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!0,supportedStatistics:{count:!0,sum:!0,avg:!0,var:!0,stddev:!0,min:!0,max:!0,percentileContinuous:!0,percentileDiscrete:!0,envelope:!0,centroid:!0,convexHull:!0},supportedNormalizationTypes:{field:!0,log:!0,naturalLog:!0,percentOfTotal:!0,squareRoot:!0}};export{s as queryBinsCapabilities,t as queryCapabilities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../config.js";import r from"../../../request.js";import{isSome as s,remove as a}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import o from"../../../core/Loadable.js";import u from"../../../core/Logger.js";import{setDeepValue as l}from"../../../core/object.js";import{debounce as c,after as d,throwIfAbortError as p}from"../../../core/promiseUtils.js";import{watch as y}from"../../../core/reactiveUtils.js";import{join as h}from"../../../core/urlUtils.js";import{generateBracedUUID as m}from"../../../core/uuid.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import w from"../../../geometry/Extent.js";import q from"../../../geometry/SpatialReference.js";import S from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import{isRelativeVertexSpace as E}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as O}from"../../../geometry/support/meshUtils/External.js";import{createFeatureEditResult as _,getFeatureJSON as b,getFeatureIds as R,getAttachmentEditsJSON as A,isProtectedOrPrivateVersionError as F,unpackEditResultData as I,createEditedFeatures as x}from"../applyEditsUtils.js";import{createDrawingInfo as j}from"./support/clientSideDefaults.js";import v from"./support/QueryTask.js";import{isHostedAgolService as T}from"../../support/arcgisLayerUrl.js";import{ensureLayerCredential as M}from"../../support/featureLayerUtils.js";import{getAssetMapTable as N}from"../../support/infoFor3D.js";import{executeQueryJSON as U}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as J}from"../../../rest/query/operations/editsZScale.js";import D from"../../../rest/support/Query.js";import k from"../../../time/TimeExtent.js";import{isSafeToEditVersion as C,isVersionInEditSession as L,isHistoricVersion as Q,currentSessionId as P}from"../../../versionManagement/support/versionManagementUtils.js";const V=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),$=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let G=class extends o{constructor(e){super(e),this.type="feature-layer",this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=this.layer.sourceJSON,r=this._fetchService(t,{...e}).then((()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,e))).then((()=>this._ensureLatestMetadata(e)));return this.addResolvingPromise(r),Promise.resolve(this)}initialize(){this.addHandles([y((()=>{const e=this.layer;return e&&"lastEditsEventDate"in e?e.lastEditsEventDate:null}),(e=>this._handleLastEditsEventChange(e)))])}destroy(){this._removeEditInterceptor()}get queryTask(){const{capabilities:e,parsedUrl:t,gdbVersion:r,spatialReference:s,fieldsIndex:a}=this.layer,i="infoFor3D"in this.layer?this.layer.infoFor3D:null,n="dynamicDataSource"in this.layer?this.layer.dynamicDataSource:null,o=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==i,u=e?.operations?.supportsQueryAttachments??!1;return new v({url:t.path,pbfSupported:o,fieldsIndex:a,infoFor3D:i,dynamicDataSource:n,gdbVersion:r,sourceSpatialReference:s,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const{layer:s}=this;await M(s,"editing");const a=e.attributes[s.objectIdField],i=s.parsedUrl.path+"/"+a+"/addAttachment",n=this._getLayerRequestOptions(),o=this._getFormDataForAttachment(t,n.query);try{const e=await r(i,{body:o});return _(e.data.addAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async updateAttachment(e,t,s){await this.load();const{layer:a}=this;await M(a,"editing");const i=e.attributes[a.objectIdField],n=a.parsedUrl.path+"/"+i+"/updateAttachment",o=this._getLayerRequestOptions({query:{attachmentId:t}}),u=this._getFormDataForAttachment(s,o.query);try{const e=await r(n,{body:u});return _(e.data.updateAttachmentResult)}catch(l){throw this._createAttachmentErrorResult(i,l)}}async applyEdits(e,t){await this.load();const{layer:a}=this;await M(a,"editing");const n="infoFor3D"in a?a.infoFor3D:null,o=null!=n,u=o||(t?.globalIdUsed??!1),l=o?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,c=e.addFeatures?.map((e=>b(this.layer,e,n)))??[],d=(await Promise.all(c)).filter(s),p=e.updateFeatures?.map((e=>b(this.layer,e,n)))??[],y=(await Promise.all(p)).filter(s),h=R(this.layer,e.deleteFeatures,u);J(d,y,a.spatialReference);const m=await A(this.layer,e),f=a.capabilities.editing.supportsAsyncApplyEdits&&o,g=t?.gdbVersion||a.gdbVersion,w={gdbVersion:g,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,async:f};await C(this.layer.url,g,!0);const q=L(this.layer.url,g||null);if(await Q(a.url,g,a.historicMoment))throw new i("feature-layer-source:historic-version","Editing a historic version is not allowed");t?.returnServiceEditsOption?(w.edits=JSON.stringify([{id:a.layerId,adds:d.length?d:null,updates:y.length?y:null,deletes:h.length?h:null,attachments:m,assetMaps:l}]),w.returnServiceEditsOption=V.toJSON(t?.returnServiceEditsOption),w.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(w.adds=d.length?JSON.stringify(d):null,w.updates=y.length?JSON.stringify(y):null,w.deletes=h.length?u?JSON.stringify(h):h.join(","):null,w.attachments=m&&JSON.stringify(m),w.assetMaps=null!=l?JSON.stringify(l):void 0);const S=this._getLayerRequestOptions({method:"post",query:w});q&&(S.authMode="immediate",S.query.returnEditMoment=!0,S.query.sessionId=P);const E=t?.returnServiceEditsOption?a.url:a.parsedUrl.path;let O;try{O=f?await this._asyncApplyEdits(E+"/applyEdits",S):await r(E+"/applyEdits",S)}catch(_){if(!F(_))throw _;S.authMode="immediate",O=f?await this._asyncApplyEdits(E+"/applyEdits",S):await r(E+"/applyEdits",S)}return this._createEditsResult(O)}async deleteAttachments(e,t){await this.load();const{layer:s}=this;await M(s,"editing");const a=e.attributes[s.objectIdField],i=s.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await r(i,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(_)}catch(n){throw this._createAttachmentErrorResult(a,n)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:a}=this.layer,{data:i}=await r(`${a}/${s}`,t),{id:n,extent:o,fullExtent:u,timeExtent:l}=i,c=o||u;return{id:n,fullExtent:c&&w.fromJSON(c),timeExtent:l&&k.fromJSON({start:l[0],end:l[1]})}}))}async queryAttachments(e,t={}){await this.load();const r=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,r)}async queryFeatures(e,t){await this.load();const r=await this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)});return e.outStatistics?.length&&r.features.length&&r.features.forEach((t=>{const r=t.attributes;e.outStatistics?.forEach((({outStatisticFieldName:e})=>{if(e){const t=e.toLowerCase();t&&t in r&&e!==t&&(r[e]=r[t],delete r[t])}}))})),r}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryAttributeBins(e,t){return await this.load(),this.queryTask.executeAttributeBinsQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!T(this.layer.url))return"unavailable";const e=h(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return $.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:r}=await import("./support/uploadAssets.js");return r(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}_handleLastEditsEventChange(e){const t=this.layer;if(null==e||!("capabilities"in t)||!("effectiveCapabilities"in t))return;if(!(!t.capabilities?.operations?.supportsEditing&&t.effectiveCapabilities?.operations?.supportsEditing))return;const r=t.url;if(null==r)return;"layerId"in t&&h(r,t.layerId.toString());this._getOrCreateEditInterceptor(r).before=t=>{const r=t.requestOptions.method??"auto";if("auto"===r||"head"===r){const r=t.requestOptions.query??{};r._ts=e.getTime(),t.requestOptions.query=r}}}_getOrCreateEditInterceptor(e){return null==this._editInterceptor&&(this._editInterceptor={urls:e},t.request.internalInterceptors.push(this._editInterceptor)),this._editInterceptor}_removeEditInterceptor(){null!=this._editInterceptor&&(a(t.request.internalInterceptors,this._editInterceptor),this._editInterceptor=null)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new i("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new i("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await d(H)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const s={};has("featurelayer-advanced-symbols")&&(s.returnAdvancedSymbols=!0),t?.cacheBust&&(s._ts=Date.now());const{data:a}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:s,signal:t?.signal}));e=a}this.sourceJSON=await this._patchServiceJSON(e,t?.signal);const s=e.type;if(!this.supportedSourceTypes.has(s))throw new i("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=j(e.geometryType).renderer;l("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:s}=await r(this.layer.url,this._getLayerRequestOptions({signal:t}));s.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){p(s)}return e}async _ensureLatestMetadata(e){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...e,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;if(await this._areAllAssetsAlreadyMapped(t))return null;const r=e.addFeatures.filter((e=>e.geometry));if(t.length!==r.length+e.updateFeatures.length)throw new i("feature-layer-source:unsupported-mesh-edits","Mixing attribute only edits with mesh geometry edits is not currently supported");const s=new Array,a=new Map;for(const i of t){const{geometry:e}=i,{vertexSpace:t}=e;if(E(t))s.push(e);else{const t=e.origin,{convertMeshVertexSpace:r}=await import("../../../geometry/support/meshUtils/convertMeshVertexSpace.js"),n=await r(e,new S({origin:[t.x,t.y,t.z??0]}));a.set(n,e),i.geometry=n,s.push(n)}}await this.uploadAssets(s);for(const[i,n]of a)n.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(t),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,r=this.layer.globalIdField,s=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,n=i.getExternalSourcesOnService(s),o=a.getAttribute(r);if(0===n.length){u.getLogger(this).error(`Skipping feature ${o}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=n.find(O)??n[0];for(const r of l)1===r.parts.length?t.push({globalId:m(),parentGlobalId:o,assetName:r.assetName,assetHash:r.parts[0].partHash,flags:[]}):u.getLogger(this).error(`Skipping asset ${r.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_createEditsResult(e){const t=e.data,{layerId:r}=this.layer,s=[];let a=null;if(Array.isArray(t))for(const n of t)s.push({id:n.id,editedFeatures:n.editedFeatures}),n.id===r&&(a={addResults:n.addResults??[],updateResults:n.updateResults??[],deleteResults:n.deleteResults??[],attachments:n.attachments,editMoment:n.editMoment});else a=t;const i=I(a);if(s.length>0){i.editedFeatureResults=[];for(const e of s){const{editedFeatures:t}=e,r=t?.spatialReference?new q(t.spatialReference):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:x(t,r)})}}return i}_createAttachmentErrorResult(e,t){const r=t.details.messages?.[0]||t.message,s=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new i("feature-layer-source:attachment-failure",r,{code:s})}}_getFormDataForAttachment(e,t){const r=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(r)for(const s in t){const e=t[s];null!=e&&(r.set?r.set(s,e):r.append(s,e))}return r}_getLayerRequestOptions(e={}){const{layer:t,layer:{parsedUrl:r,gdbVersion:s}}=this;return{...e,query:{gdbVersion:s,layer:"dynamicDataSource"in t&&t.dynamicDataSource?JSON.stringify({source:t.dynamicDataSource}):void 0,...r.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _areAllAssetsAlreadyMapped(e){const{layer:t}=this,{globalIdField:r,parsedUrl:a}=t,i="infoFor3D"in t?t.infoFor3D:null;if(null==i||null==r)return!1;const n=N(i);if(null==n)return!1;const o=h(a.path,`../${n.id}`),u=new Array;for(const s of e){if(!(s.geometry.metadata.getExternalSourcesOnService(a).length>0))return!1;u.push(s)}const l=u.map((e=>e.getAttribute(r))).filter(s);if(0===l.length)return!1;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:d}}=i,p=new D({where:`${c} IN (${l.map((e=>`'${e}'`))})`,outFields:[d,c],returnGeometry:!1}),y=await U(o,p),{features:m}=y;return 0!==m.length&&!u.some((e=>{const t=e.getAttribute(r);if(!t)return!0;const{metadata:s}=e.geometry,i=m.filter((e=>e.getAttribute(c)===t));if(0===i.length)return!0;const n=i.map((e=>e.getAttribute(d)));return s.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>n.every((t=>e!==t))))}))}};e([f()],G.prototype,"type",void 0),e([f({constructOnly:!0})],G.prototype,"layer",void 0),e([f({constructOnly:!0})],G.prototype,"supportedSourceTypes",void 0),e([f({readOnly:!0})],G.prototype,"queryTask",null),G=e([g("esri.layers.graphics.sources.FeatureLayerSource")],G);const H=1e3,B=G;export{B as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../config.js";import r from"../../../request.js";import{isSome as s,remove as a}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as n}from"../../../core/jsonMap.js";import o from"../../../core/Loadable.js";import u from"../../../core/Logger.js";import{setDeepValue as l}from"../../../core/object.js";import{debounce as c,after as d,throwIfAbortError as p}from"../../../core/promiseUtils.js";import{watch as y}from"../../../core/reactiveUtils.js";import{join as h}from"../../../core/urlUtils.js";import{generateBracedUUID as m}from"../../../core/uuid.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import{subclass as g}from"../../../core/accessorSupport/decorators/subclass.js";import w from"../../../geometry/Extent.js";import q from"../../../geometry/SpatialReference.js";import S from"../../../geometry/support/MeshGeoreferencedVertexSpace.js";import{isRelativeVertexSpace as E}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as O}from"../../../geometry/support/meshUtils/External.js";import{createFeatureEditResult as _,getFeatureJSON as b,getFeatureIds as R,getAttachmentEditsJSON as A,isProtectedOrPrivateVersionError as F,unpackEditResultData as I,createEditedFeatures as x}from"../applyEditsUtils.js";import{createDrawingInfo as j}from"./support/clientSideDefaults.js";import v from"./support/QueryTask.js";import{isHostedAgolService as T}from"../../support/arcgisLayerUrl.js";import{ensureLayerCredential as M}from"../../support/featureLayerUtils.js";import{getAssetMapTable as N}from"../../support/infoFor3D.js";import{executeQueryJSON as U}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as J}from"../../../rest/query/operations/editsZScale.js";import D from"../../../rest/support/Query.js";import k from"../../../time/TimeExtent.js";import{isSafeToEditVersion as C,isVersionInEditSession as L,isHistoricVersion as Q,currentSessionId as P}from"../../../versionManagement/support/versionManagementUtils.js";const V=new n({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),$=new n({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let G=class extends o{constructor(e){super(e),this.type="feature-layer",this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}})),this._ongoingAssetUploads=new Map}load(e){const t=this.layer.sourceJSON,r=this._fetchService(t,{...e}).then((()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,e))).then((()=>this._ensureLatestMetadata(e)));return this.addResolvingPromise(r),Promise.resolve(this)}initialize(){this.addHandles([y((()=>{const e=this.layer;return e&&"lastEditsEventDate"in e?e.lastEditsEventDate:null}),(e=>this._handleLastEditsEventChange(e)))])}destroy(){this._removeEditInterceptor()}get queryTask(){const{capabilities:e,parsedUrl:t,gdbVersion:r,spatialReference:s,fieldsIndex:a}=this.layer,i="infoFor3D"in this.layer?this.layer.infoFor3D:null,n="dynamicDataSource"in this.layer?this.layer.dynamicDataSource:null,o=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==i,u=e?.operations?.supportsQueryAttachments??!1;return new v({url:t.path,pbfSupported:o,fieldsIndex:a,infoFor3D:i,dynamicDataSource:n,gdbVersion:r,sourceSpatialReference:s,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const{layer:s}=this;await M(s,"editing");const a=e.attributes[s.objectIdField],i=s.parsedUrl.path+"/"+a+"/addAttachment",n=this._getLayerRequestOptions(),o=this._getFormDataForAttachment(t,n.query);try{const e=await r(i,{body:o});return _(e.data.addAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async updateAttachment(e,t,s){await this.load();const{layer:a}=this;await M(a,"editing");const i=e.attributes[a.objectIdField],n=a.parsedUrl.path+"/"+i+"/updateAttachment",o=this._getLayerRequestOptions({query:{attachmentId:t}}),u=this._getFormDataForAttachment(s,o.query);try{const e=await r(n,{body:u});return _(e.data.updateAttachmentResult)}catch(l){throw this._createAttachmentErrorResult(i,l)}}async applyEdits(e,t){await this.load();const{layer:a}=this;await M(a,"editing");const n="infoFor3D"in a?a.infoFor3D:null,o=null!=n,u=o||(t?.globalIdUsed??!1),l=o?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,c=e.addFeatures?.map((e=>b(this.layer,e,n)))??[],d=(await Promise.all(c)).filter(s),p=e.updateFeatures?.map((e=>b(this.layer,e,n)))??[],y=(await Promise.all(p)).filter(s),h=R(this.layer,e.deleteFeatures,u);J(d,y,a.spatialReference);const m=await A(this.layer,e),f=a.capabilities.editing.supportsAsyncApplyEdits&&o,g=t?.gdbVersion||a.gdbVersion,w={gdbVersion:g,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,async:f};await C(this.layer.url,g,!0);const q=L(this.layer.url,g||null);if(await Q(a.url,g,a.historicMoment))throw new i("feature-layer-source:historic-version","Editing a historic version is not allowed");t?.returnServiceEditsOption?(w.edits=JSON.stringify([{id:a.layerId,adds:d.length?d:null,updates:y.length?y:null,deletes:h.length?h:null,attachments:m,assetMaps:l}]),w.returnServiceEditsOption=V.toJSON(t?.returnServiceEditsOption),w.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(w.adds=d.length?JSON.stringify(d):null,w.updates=y.length?JSON.stringify(y):null,w.deletes=h.length?u?JSON.stringify(h):h.join(","):null,w.attachments=m&&JSON.stringify(m),w.assetMaps=null!=l?JSON.stringify(l):void 0);const S=this._getLayerRequestOptions({method:"post",query:w});q&&(S.authMode="immediate",S.query.returnEditMoment=!0,S.query.sessionId=P);const E=t?.returnServiceEditsOption?a.url:a.parsedUrl.path;let O;try{O=f?await this._asyncApplyEdits(E+"/applyEdits",S):await r(E+"/applyEdits",S)}catch(_){if(!F(_))throw _;S.authMode="immediate",O=f?await this._asyncApplyEdits(E+"/applyEdits",S):await r(E+"/applyEdits",S)}return this._createEditsResult(O)}async deleteAttachments(e,t){await this.load();const{layer:s}=this;await M(s,"editing");const a=e.attributes[s.objectIdField],i=s.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await r(i,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(_)}catch(n){throw this._createAttachmentErrorResult(a,n)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:a}=this.layer,{data:i}=await r(`${a}/${s}`,t),{id:n,extent:o,fullExtent:u,timeExtent:l}=i,c=o||u;return{id:n,fullExtent:c&&w.fromJSON(c),timeExtent:l&&k.fromJSON({start:l[0],end:l[1]})}}))}async queryAttachments(e,t={}){await this.load();const r=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,r)}async queryFeatures(e,t){await this.load();const r=await this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)});if(e.outStatistics?.length&&r.features.length){const t=new Map;if(r.features.forEach((r=>{const s=r.attributes;e.outStatistics?.forEach((({outStatisticFieldName:e})=>{if(e){const r=e.toLowerCase();r&&r in s&&e!==r&&(s[e]=s[r],delete s[r],t.set(r,e))}}))})),null!=r.fields)for(const e of r.fields){const r=t.get(e.name.toLowerCase());null!=r&&(e.name=r)}}return r}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryAttributeBins(e,t){return await this.load(),this.queryTask.executeAttributeBinsQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!T(this.layer.url))return"unavailable";const e=h(this.layer.url,"status"),t=await r(e,{query:{f:"json"}});return $.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:r}=await import("./support/uploadAssets.js");return r(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}_handleLastEditsEventChange(e){const t=this.layer;if(null==e||!("capabilities"in t)||!("effectiveCapabilities"in t))return;if(!(!t.capabilities?.operations?.supportsEditing&&t.effectiveCapabilities?.operations?.supportsEditing))return;const r=t.url;if(null==r)return;"layerId"in t&&h(r,t.layerId.toString());this._getOrCreateEditInterceptor(r).before=t=>{const r=t.requestOptions.method??"auto";if("auto"===r||"head"===r){const r=t.requestOptions.query??{};r._ts=e.getTime(),t.requestOptions.query=r}}}_getOrCreateEditInterceptor(e){return null==this._editInterceptor&&(this._editInterceptor={urls:e},t.request.internalInterceptors.push(this._editInterceptor)),this._editInterceptor}_removeEditInterceptor(){null!=this._editInterceptor&&(a(t.request.internalInterceptors,this._editInterceptor),this._editInterceptor=null)}async _asyncApplyEdits(e,t){const s=(await r(e,t)).data.statusUrl;for(;;){const e=(await r(s,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return r(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new i("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new i("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await d(H)}}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const s={};has("featurelayer-advanced-symbols")&&(s.returnAdvancedSymbols=!0),t?.cacheBust&&(s._ts=Date.now());const{data:a}=await r(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:s,signal:t?.signal}));e=a}this.sourceJSON=await this._patchServiceJSON(e,t?.signal);const s=e.type;if(!this.supportedSourceTypes.has(s))throw new i("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=j(e.geometryType).renderer;l("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:s}=await r(this.layer.url,this._getLayerRequestOptions({signal:t}));s.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){p(s)}return e}async _ensureLatestMetadata(e){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...e,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;if(await this._areAllAssetsAlreadyMapped(t))return null;const r=e.addFeatures.filter((e=>e.geometry));if(t.length!==r.length+e.updateFeatures.length)throw new i("feature-layer-source:unsupported-mesh-edits","Mixing attribute only edits with mesh geometry edits is not currently supported");const s=new Array,a=new Map;for(const i of t){const{geometry:e}=i,{vertexSpace:t}=e;if(E(t))s.push(e);else{const t=e.origin,{convertMeshVertexSpace:r}=await import("../../../geometry/support/meshUtils/convertMeshVertexSpace.js"),n=await r(e,new S({origin:[t.x,t.y,t.z??0]}));a.set(n,e),i.geometry=n,s.push(n)}}await this.uploadAssets(s);for(const[i,n]of a)n.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(t),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,r=this.layer.globalIdField,s=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,n=i.getExternalSourcesOnService(s),o=a.getAttribute(r);if(0===n.length){u.getLogger(this).error(`Skipping feature ${o}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=n.find(O)??n[0];for(const r of l)1===r.parts.length?t.push({globalId:m(),parentGlobalId:o,assetName:r.assetName,assetHash:r.parts[0].partHash,flags:[]}):u.getLogger(this).error(`Skipping asset ${r.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_createEditsResult(e){const t=e.data,{layerId:r}=this.layer,s=[];let a=null;if(Array.isArray(t))for(const n of t)s.push({id:n.id,editedFeatures:n.editedFeatures}),n.id===r&&(a={addResults:n.addResults??[],updateResults:n.updateResults??[],deleteResults:n.deleteResults??[],attachments:n.attachments,editMoment:n.editMoment});else a=t;const i=I(a);if(s.length>0){i.editedFeatureResults=[];for(const e of s){const{editedFeatures:t}=e,r=t?.spatialReference?new q(t.spatialReference):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:x(t,r)})}}return i}_createAttachmentErrorResult(e,t){const r=t.details.messages?.[0]||t.message,s=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new i("feature-layer-source:attachment-failure",r,{code:s})}}_getFormDataForAttachment(e,t){const r=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(r)for(const s in t){const e=t[s];null!=e&&(r.set?r.set(s,e):r.append(s,e))}return r}_getLayerRequestOptions(e={}){const{layer:t,layer:{parsedUrl:r,gdbVersion:s}}=this;return{...e,query:{gdbVersion:s,layer:"dynamicDataSource"in t&&t.dynamicDataSource?JSON.stringify({source:t.dynamicDataSource}):void 0,...r.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _areAllAssetsAlreadyMapped(e){const{layer:t}=this,{globalIdField:r,parsedUrl:a}=t,i="infoFor3D"in t?t.infoFor3D:null;if(null==i||null==r)return!1;const n=N(i);if(null==n)return!1;const o=h(a.path,`../${n.id}`),u=new Array;for(const s of e){if(!(s.geometry.metadata.getExternalSourcesOnService(a).length>0))return!1;u.push(s)}const l=u.map((e=>e.getAttribute(r))).filter(s);if(0===l.length)return!1;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:d}}=i,p=new D({where:`${c} IN (${l.map((e=>`'${e}'`))})`,outFields:[d,c],returnGeometry:!1}),y=await U(o,p),{features:m}=y;return 0!==m.length&&!u.some((e=>{const t=e.getAttribute(r);if(!t)return!0;const{metadata:s}=e.geometry,i=m.filter((e=>e.getAttribute(c)===t));if(0===i.length)return!0;const n=i.map((e=>e.getAttribute(d)));return s.getExternalSourcesOnService(a).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>n.every((t=>e!==t))))}))}};e([f()],G.prototype,"type",void 0),e([f({constructOnly:!0})],G.prototype,"layer",void 0),e([f({constructOnly:!0})],G.prototype,"supportedSourceTypes",void 0),e([f({readOnly:!0})],G.prototype,"queryTask",null),G=e([g("esri.layers.graphics.sources.FeatureLayerSource")],G);const H=1e3,B=G;export{B 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.32/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 u,convertToGeometry as l,convertFromFeatures as d,convertToFeature as p,convertFromFeature as c}from"../../featureConversionUtils.js";import{executeQueryForSnapping as m}from"../../data/executeQueryForSnapping.js";import y from"../../data/FeatureStore.js";import{checkProjectionSupport as h,project as f}from"../../data/projectionSupport.js";import{QueryEngine as g}from"../../data/QueryEngine.js";import{inferLayerProperties as _,createOptimizedFeatures as F,validateGeoJSON as I}from"./geojson.js";import{createDrawingInfo as j,createDefaultTemplate as E,createDefaultAttributesFunction as b}from"../support/clientSideDefaults.js";import{loadGeometryEngineForSimplify as T,mixAttributes as w,createFeatureEditSuccessResult as q,createFeatureEditErrorResult as x,simplify as S}from"../support/sourceUtils.js";import R from"../../../support/FieldsIndex.js";import{kebabDict as O}from"../../../support/fieldType.js";import{getFieldDefaultValue as C,getFieldDefaultLength as k}from"../../../support/fieldUtils.js";import{utc as D}from"../../../../time/timeZoneUtils.js";const Q={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryWithCacheHint:!0,supportsQueryWithDistance:!0,supportsQueryWithResultType:!0,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class A{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=_(r,{geometryType:e.geometryType}),o=e.fields||n.fields||[],u=null!=e.hasZ?e.hasZ:n.hasZ,l=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 m=new R(o);let h=m.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 f={};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(!O.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=C(a);void 0!==e&&(f[a.name]=e)}null==a.length&&(a.length=k(a))}if(c){if(c.startTimeField){const e=m.get(c.startTimeField);e?(c.startTimeField=e.name,e.type="esriFieldTypeDate"):c.startTimeField=null}if(c.endTimeField){const e=m.get(c.endTimeField);e?(c.endTimeField=e.name,e.type="esriFieldTypeDate"):c.endTimeField=null}if(c.trackIdField){const e=m.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=l?j(l):void 0,I=m.dateFields.length?{timeZoneIANA:D}:null,T={warnings:i,featureErrors:[],layerDefinition:{...Q,drawingInfo:F??void 0,templates:E(f),extent:void 0,geometryType:l,objectIdField:d,fields:o,hasZ:!!u,timeInfo:c,dateFieldsTimeReference:I}};this._queryEngine=new g({fieldsIndex:R.fromLayerJSON({fields:o,timeInfo:c,dateFieldsTimeReference:I}),geometryType:l,hasM:!1,hasZ:u,objectIdField:d,spatialReference:p,timeInfo:c,featureStore:new y({geometryType:l,hasM:!1,hasZ:u})});const w=this._queryEngine.fieldsIndex.requiredFields.indexOf(h);w>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(w,1),this._createDefaultAttributes=b(f,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:S,timeExtent:A}=await this._queryEngine.fetchRecomputedExtents();if(T.layerDefinition.extent=S,A){const{start:e,end:t}=A;T.layerDefinition.timeInfo.timeExtent=[e,t]}return T}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([T(t,s),h(e.adds,t),h(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(),m(this._queryEngine,e,t.signal)}async queryAttributeBins(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeAttributeBinsQuery(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=u(f(l(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 I(r),r}_normalizeFeatures(e,t){const{objectIdField:s,fieldsIndex:i}=this._queryEngine,r=[];for(const n of e){const e=this._createDefaultAttributes(),a=w(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(q(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:u,featureStore:l,fieldsIndex:p}=this._queryEngine,c=[];for(const d of t){if(d.geometry&&i!==n(d.geometry)){s.push(x("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=w(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??u;d.geometry=f(S(d.geometry,e),e,u)}c.push(d),s.push(q(d.attributes[o]))}}l.addMany(d([],c,i,a,r,o))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:i,hasZ:r,objectIdField:a,spatialReference:o,featureStore:u,fieldsIndex:l}=this._queryEngine;for(const d of t){const{attributes:t,geometry:m}=d,y=t?.[a];if(null==y){e.push(x(`Identifier field ${a} missing`));continue}if(!u.has(y)){e.push(x(`Feature with object id ${y} missing`));continue}const h=p(u.getFeature(y),s,r,i);if(null!=m){if(s!==n(m)){e.push(x("Incorrect geometry type."));continue}const t=m.spatialReference??o;h.geometry=f(S(m,t),t,o)}if(t){const s=w(l,h.attributes,t);if(s){e.push(s);continue}}u.add(c(h,s,r,i,a)),e.push(q(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 h(a,e)}catch{throw new s("geojson-layer","Projection not supported")}}}export{A 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 u,convertToGeometry as l,convertFromFeatures as d,convertToFeature as p,convertFromFeature as c}from"../../featureConversionUtils.js";import{executeQueryForSnapping as y}from"../../data/executeQueryForSnapping.js";import m from"../../data/FeatureStore.js";import{checkProjectionSupport as h,project as f}from"../../data/projectionSupport.js";import{QueryEngine as g}from"../../data/QueryEngine.js";import{inferLayerProperties as _,createOptimizedFeatures as F,validateGeoJSON as I}from"./geojson.js";import{createDrawingInfo as j,createDefaultTemplate as E,createDefaultAttributesFunction as b}from"../support/clientSideDefaults.js";import{loadGeometryEngineForSimplify as T,mixAttributes as w,createFeatureEditSuccessResult as q,createFeatureEditErrorResult as x,simplify as S,queryBinsCapabilities as R}from"../support/sourceUtils.js";import C from"../../../support/FieldsIndex.js";import{kebabDict as O}from"../../../support/fieldType.js";import{getFieldDefaultValue as k,getFieldDefaultLength as Q}from"../../../support/fieldUtils.js";import{utc as D}from"../../../../time/timeZoneUtils.js";const A={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsQueryAttachmentOrderByFields:!1,supportsQueryBins:!0,supportsQueryWithCacheHint:!0,supportsQueryWithDistance:!0,supportsQueryWithResultType:!0,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0},queryBinsCapabilities:R};class v{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=_(r,{geometryType:e.geometryType}),o=e.fields||n.fields||[],u=null!=e.hasZ?e.hasZ:n.hasZ,l=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 C(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 f={};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(!O.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=k(a);void 0!==e&&(f[a.name]=e)}null==a.length&&(a.length=Q(a))}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=l?j(l):void 0,I=y.dateFields.length?{timeZoneIANA:D}:null,T={warnings:i,featureErrors:[],layerDefinition:{...A,drawingInfo:F??void 0,templates:E(f),extent:void 0,geometryType:l,objectIdField:d,fields:o,hasZ:!!u,timeInfo:c,dateFieldsTimeReference:I}};this._queryEngine=new g({fieldsIndex:C.fromLayerJSON({fields:o,timeInfo:c,dateFieldsTimeReference:I}),geometryType:l,hasM:!1,hasZ:u,objectIdField:d,spatialReference:p,timeInfo:c,featureStore:new m({geometryType:l,hasM:!1,hasZ:u})});const w=this._queryEngine.fieldsIndex.requiredFields.indexOf(h);w>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(w,1),this._createDefaultAttributes=b(f,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:S,timeExtent:R}=await this._queryEngine.fetchRecomputedExtents();if(T.layerDefinition.extent=S,R){const{start:e,end:t}=R;T.layerDefinition.timeInfo.timeExtent=[e,t]}return T}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([T(t,s),h(e.adds,t),h(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(),y(this._queryEngine,e,t.signal)}async queryAttributeBins(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeAttributeBinsQuery(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=u(f(l(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 I(r),r}_normalizeFeatures(e,t){const{objectIdField:s,fieldsIndex:i}=this._queryEngine,r=[];for(const n of e){const e=this._createDefaultAttributes(),a=w(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(q(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:u,featureStore:l,fieldsIndex:p}=this._queryEngine,c=[];for(const d of t){if(d.geometry&&i!==n(d.geometry)){s.push(x("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=w(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??u;d.geometry=f(S(d.geometry,e),e,u)}c.push(d),s.push(q(d.attributes[o]))}}l.addMany(d([],c,i,a,r,o))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:i,hasZ:r,objectIdField:a,spatialReference:o,featureStore:u,fieldsIndex:l}=this._queryEngine;for(const d of t){const{attributes:t,geometry:y}=d,m=t?.[a];if(null==m){e.push(x(`Identifier field ${a} missing`));continue}if(!u.has(m)){e.push(x(`Feature with object id ${m} missing`));continue}const h=p(u.getFeature(m),s,r,i);if(null!=y){if(s!==n(y)){e.push(x("Incorrect geometry type."));continue}const t=y.spatialReference??o;h.geometry=f(S(y,t),t,o)}if(t){const s=w(l,h.attributes,t);if(s){e.push(s);continue}}u.add(c(h,s,r,i,a)),e.push(q(m))}}_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 h(a,e)}catch{throw new s("geojson-layer","Projection not supported")}}}export{v as default};