@arcgis/core 4.27.0-next.20230420 → 4.27.0-next.20230421

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 (152) hide show
  1. package/WebMap.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{f64f95623d9296a91f95.js → 059ec6fd9b971de4b4c1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{1fe31a412479815e5e2d.js → 10770939900946feb20d.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{5252f3cc244204edc299.js → 1216e939d363f96b6cc6.js} +1 -1
  7. package/assets/esri/core/workers/chunks/156dad2b7fed6749bae7.js +1 -0
  8. package/assets/esri/core/workers/chunks/15a97d3e42b00ac42984.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d72c0c97cc4e30f1e4f2.js → 18704903814b9d73c708.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{852b4a6c0f3feb57cf54.js → 1db5e4c8244dbc21590c.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{f0953e41d1653e66ba57.js → 2a1a5a1969e80a10dcca.js} +1 -1
  12. package/assets/esri/core/workers/chunks/33b735faa582e6f39e9a.js +1 -0
  13. package/assets/esri/core/workers/chunks/34025ac04ca02531923a.js +1 -0
  14. package/assets/esri/core/workers/chunks/3e9f3479fd8558d9e3e3.js +1 -0
  15. package/assets/esri/core/workers/chunks/{d59274ac695dfcff1143.js → 46090b69e9161bc05141.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1b647446a6a27798c5cf.js → 47bf38d910e71ac39bb8.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{3978f4f68ada540ee3a3.js → 4f8a09b61267e5e26712.js} +1 -1
  18. package/assets/esri/core/workers/chunks/5183ecab7eddae7b70e8.js +1 -0
  19. package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js → 51a0d1dabe7415515c77.js} +2 -2
  20. package/assets/esri/core/workers/chunks/541e6efc3b491e507410.js +1 -0
  21. package/assets/esri/core/workers/chunks/5c64fd3bf057a1a5527f.js +1 -0
  22. package/assets/esri/core/workers/chunks/6047bdaf4855506f8fdb.js +1 -0
  23. package/assets/esri/core/workers/chunks/{b2358c2e27be7a5709cf.js → 6adb58f1bffc5d1c03bd.js} +1 -1
  24. package/assets/esri/core/workers/chunks/770940417e6ddbdbb9d6.js +1 -0
  25. package/assets/esri/core/workers/chunks/{1c1d8be85297c483a606.js → 77c98121223a144170e3.js} +1 -1
  26. package/assets/esri/core/workers/chunks/80117007d86be4eb3bc3.js +1 -0
  27. package/assets/esri/core/workers/chunks/838849b751805615833a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{9ca395f7bc8d397b5240.js → 88197520501fcc20b6e8.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{89e8ba4fc325838bf1a9.js → 88f9dededcf60fd011ef.js} +1 -1
  30. package/assets/esri/core/workers/chunks/88fdd288ef799a7ac48a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{f11ec68ceb7c973cde74.js → 8ae7fea9f7fda38dd207.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{0d080dd1ca6a71597409.js → 9265d4e9cfab2c7bbce5.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{8d41305509fedb3603ac.js → 94041a9ced04aa281d40.js} +1 -1
  34. package/assets/esri/core/workers/chunks/98540791fcef86069e44.js +1 -0
  35. package/assets/esri/core/workers/chunks/9c1b2f82877ff79969f5.js +1 -0
  36. package/assets/esri/core/workers/chunks/a7b3cd537c9127b5e65e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{3d1c697182237807ab49.js → abea316f2eac0f3086ab.js} +1 -1
  38. package/assets/esri/core/workers/chunks/ad85ade6a2cfb56cf328.js +1 -0
  39. package/assets/esri/core/workers/chunks/{25862269952c1bda910f.js → b833b4ea2973bb16792e.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{e50d1afdc878258c437e.js → be4aa835a7abfc809126.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{4fed7c08b5f4de23bb75.js → c2ec6e904f96173a7b83.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{c25aa08b869f2777dc26.js → c4488a8d857c765da30e.js} +1 -1
  43. package/assets/esri/core/workers/chunks/c5c56b6d99db96a6755a.js +2 -0
  44. package/assets/esri/core/workers/chunks/{b28883e2a13f360310b3.js → c727d38f71e52bee17e1.js} +1 -1
  45. package/assets/esri/core/workers/chunks/cf315d255f0dc8d50f21.js +1 -0
  46. package/assets/esri/core/workers/chunks/cf7676fdc09ad4835680.js +1 -0
  47. package/assets/esri/core/workers/chunks/cfad34c949cbe8a31ef8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{a2c9cb23f3e35e88da1d.js → d399b1b9cbf0737d1735.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{df7dcd035997881cf2ef.js → d5c8119d6d34628d3126.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d6b6bb8aecc85d2a3f6b.js +1 -0
  51. package/assets/esri/core/workers/chunks/{8dfa32cc8453f85faab0.js → dd1f8bade9c5c3b7929b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/e11e60759821746259c6.js +1 -0
  53. package/assets/esri/core/workers/chunks/{e4b65c5a4575a5c1c49f.js → e356c576f9a7521a49b3.js} +1 -1
  54. package/assets/esri/core/workers/chunks/f02edf71645eb33bf92f.js +1 -0
  55. package/assets/esri/core/workers/chunks/{3dff550c29115dd625fa.js → f1a4165c2710ca90e5ea.js} +1 -1
  56. package/assets/esri/core/workers/chunks/f57a3ee17869ced3dd33.js +1 -0
  57. package/assets/esri/core/workers/chunks/fc07f6e103d7f69a9909.js +1 -0
  58. package/chunks/WaterSurface.glsl.js +35 -20
  59. package/chunks/index.js +1 -1
  60. package/core/Loadable.js +1 -1
  61. package/core/Promise.js +1 -1
  62. package/core/accessorSupport/ensureType.js +1 -1
  63. package/core/accessorSupport/watch.js +1 -1
  64. package/core/accessorSupport/write.js +1 -1
  65. package/core/promiseUtils.js +1 -1
  66. package/core/watchUtils.js +1 -1
  67. package/core/workers/Connection.js +1 -1
  68. package/core/workers/RemoteClient.js +1 -1
  69. package/geometry/support/geodesicUtils.js +1 -1
  70. package/intl/messages.js +1 -1
  71. package/layers/graphics/data/attributeSupport.js +1 -1
  72. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  73. package/layers/mixins/ArcGISMapService.js +1 -1
  74. package/layers/support/PromiseQueue.js +1 -1
  75. package/layers/support/Sublayer.js +1 -1
  76. package/layers/support/TileKey.js +1 -1
  77. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  78. package/networks/Network.js +1 -1
  79. package/package.json +1 -1
  80. package/portal/schemas/definitions.js +1 -1
  81. package/request.js +1 -1
  82. package/support/revision.js +1 -1
  83. package/symbols/support/previewSymbol3D.js +1 -1
  84. package/symbols/support/styleUtils.js +1 -1
  85. package/symbols/support/symbolLayerUtils.js +1 -1
  86. package/symbols/support/utils.js +1 -1
  87. package/symbols/support/webStyleSymbolUtils.js +1 -1
  88. package/views/2d/engine/webgl/TextureManager.js +1 -1
  89. package/views/2d/layers/support/webStyleUtils.js +1 -1
  90. package/views/3d/input/SceneInputManager.js +1 -1
  91. package/views/3d/interactive/manipulatorUtils.js +1 -1
  92. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  93. package/views/3d/layers/graphics/ElevationQuery.js +1 -1
  94. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  95. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  96. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  97. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  98. package/views/3d/layers/graphics/symbolComplexity.js +1 -1
  99. package/views/3d/layers/graphics/webStyleUtils.js +5 -0
  100. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  102. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  103. package/views/LayerViewManager.js +1 -1
  104. package/views/PopupView.js +1 -1
  105. package/views/SceneView.js +1 -1
  106. package/views/ViewAnimation.js +1 -1
  107. package/views/input/BrowserEventSource.js +1 -1
  108. package/views/input/InputManager.js +1 -1
  109. package/views/interactive/coordinateHelper.js +1 -1
  110. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  111. package/views/support/QueueProcessor.js +1 -1
  112. package/views/ui/DefaultUI.js +1 -1
  113. package/views/ui/UI.js +1 -1
  114. package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
  115. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  116. package/widgets/Editor/Upload.js +1 -1
  117. package/widgets/Editor/deprecationUtils.js +1 -1
  118. package/widgets/Editor/modelUploadUtils.js +1 -1
  119. package/widgets/Editor.js +1 -1
  120. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  121. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  122. package/widgets/Feature/FeatureViewModel.js +1 -1
  123. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  124. package/widgets/Popup.js +1 -1
  125. package/assets/esri/core/workers/chunks/0cec1c16b25406858ae6.js +0 -1
  126. package/assets/esri/core/workers/chunks/27353056c3e4e8d8b8d3.js +0 -1
  127. package/assets/esri/core/workers/chunks/337d59d624ef8a89aae5.js +0 -1
  128. package/assets/esri/core/workers/chunks/4b6a903d4aeeb4eeb615.js +0 -1
  129. package/assets/esri/core/workers/chunks/4bf9bc8b52d618f395c5.js +0 -1
  130. package/assets/esri/core/workers/chunks/5ec4fedbbcbb0053cf74.js +0 -2
  131. package/assets/esri/core/workers/chunks/60e29d172a2dcf45e8d0.js +0 -1
  132. package/assets/esri/core/workers/chunks/68a15cc7c51645d31572.js +0 -1
  133. package/assets/esri/core/workers/chunks/778ecf61f07dafc51bbc.js +0 -1
  134. package/assets/esri/core/workers/chunks/7e67e071789c6d264280.js +0 -1
  135. package/assets/esri/core/workers/chunks/80d335bec34d60b7bbdc.js +0 -1
  136. package/assets/esri/core/workers/chunks/810da30f13151b72a293.js +0 -1
  137. package/assets/esri/core/workers/chunks/81485a5056aed94b3d8d.js +0 -1
  138. package/assets/esri/core/workers/chunks/8ebda132068f6b962dd9.js +0 -1
  139. package/assets/esri/core/workers/chunks/914a0c78c80aa897b1a1.js +0 -1
  140. package/assets/esri/core/workers/chunks/979ea2e3b1b164334634.js +0 -1
  141. package/assets/esri/core/workers/chunks/a0e92dd27c8f6b642dbf.js +0 -1
  142. package/assets/esri/core/workers/chunks/a6240bf258b3886a6661.js +0 -1
  143. package/assets/esri/core/workers/chunks/b1a8024bf8cdd0cd3884.js +0 -1
  144. package/assets/esri/core/workers/chunks/b366e0db9b5f27dd53a3.js +0 -1
  145. package/assets/esri/core/workers/chunks/c564055cb906857c8641.js +0 -1
  146. package/assets/esri/core/workers/chunks/c646dc9da08b509e39d6.js +0 -1
  147. package/assets/esri/core/workers/chunks/db5598944b691e43f13e.js +0 -1
  148. package/assets/esri/core/workers/chunks/eb163a2ddeb27c690308.js +0 -1
  149. package/assets/esri/core/workers/chunks/f05634909c9449533193.js +0 -1
  150. package/assets/esri/core/workers/chunks/fcebd70b089dea833c75.js +0 -1
  151. /package/assets/esri/core/workers/chunks/{a5c33b24b7ee042cb473.js.LICENSE.txt → 51a0d1dabe7415515c77.js.LICENSE.txt} +0 -0
  152. /package/assets/esri/core/workers/chunks/{5ec4fedbbcbb0053cf74.js.LICENSE.txt → c5c56b6d99db96a6755a.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import s from"../../../Basemap.js";import e from"../../../core/Collection.js";import a from"../../../core/Error.js";import r from"../../../core/Handles.js";import o from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{EsriPromiseMixin as i}from"../../../core/Promise.js";import{isAbortError as p}from"../../../core/promiseUtils.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../portal/Portal.js";import d from"./LocalBasemapsSource.js";const f=e.ofType(s);let y=class extends(o.LoadableMixin(i(d))){constructor(t){super(t),this._handles=new r,this._lastPortalBasemapFetchController=null,this.basemaps=new f,this.filterFunction=null,this.portal=u.getDefault(),this.query=null,this.updateBasemapsCallback=null}initialize(){this._handles.add([n((()=>[this.filterFunction,this.loadStatus,this.portal?.basemapGalleryGroupQuery,this.portal?.user,this.query,this.updateBasemapsCallback]),(()=>this.refresh()),h)])}destroy(){this._handles.destroy(),this._handles=null,this.filterFunction=null,this.portal=null}get state(){return"not-loaded"===this.loadStatus?"not-loaded":"loading"===this.loadStatus||this._lastPortalBasemapFetchController?"loading":"ready"}load(t){return this.addResolvingPromise(this.portal.load(t)),this.notifyChange("state"),Promise.resolve(this)}async refresh(){if("ready"!==this.state)return;this._lastPortalBasemapFetchController&&(this._lastPortalBasemapFetchController.abort(),this._lastPortalBasemapFetchController=null);const t=this.portal,s=new AbortController;this._lastPortalBasemapFetchController=s,this.notifyChange("state");try{const e=await t.fetchBasemaps(this._toQueryString(this.query),s);await this._updateBasemaps(e)}catch(e){if(p(e))throw e;l.getLogger(this.declaredClass).warn(new a("basemap-source:fetch-basemaps-error","Could not fetch basemaps from portal.",{error:e})),await this._updateBasemaps()}this._lastPortalBasemapFetchController=null,this.notifyChange("state")}_toQueryString(t){return t&&"string"!=typeof t?Object.keys(t).map((s=>`${s}:${t[s]}`)).join(" AND "):t}async _updateBasemaps(t=[]){let s=await this._filterBasemaps(t);s=this.updateBasemapsCallback?this.updateBasemapsCallback(s):s,this.basemaps.removeAll(),this.basemaps.addMany(s)}async _filterBasemaps(t){if(!this.filterFunction)return t;const s=t.map(this.filterFunction),e=await Promise.all(s);return t.filter(((t,s)=>e[s]))}};t([m({readOnly:!0,type:f})],y.prototype,"basemaps",void 0),t([m()],y.prototype,"filterFunction",void 0),t([m({type:u})],y.prototype,"portal",void 0),t([m()],y.prototype,"query",void 0),t([m({readOnly:!0})],y.prototype,"state",null),t([m()],y.prototype,"updateBasemapsCallback",void 0),y=t([c("esri.widgets.BasemapGallery.support.PortalBasemapsSource")],y);const B=y;export{B as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import s from"../../../Basemap.js";import e from"../../../core/Collection.js";import a from"../../../core/Error.js";import r from"../../../core/Handles.js";import o from"../../../core/Loadable.js";import l from"../../../core/Logger.js";import{EsriPromiseMixin as i}from"../../../core/Promise.js";import{isAbortError as p}from"../../../core/promiseUtils.js";import{watch as n,initial as m}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../portal/Portal.js";import d from"./LocalBasemapsSource.js";const f=e.ofType(s);let y=class extends(o.LoadableMixin(i(d))){constructor(t){super(t),this._handles=new r,this._lastPortalBasemapFetchController=null,this.basemaps=new f,this.filterFunction=null,this.portal=u.getDefault(),this.query=null,this.updateBasemapsCallback=null}initialize(){this._handles.add([n((()=>[this.filterFunction,this.loadStatus,this.portal?.basemapGalleryGroupQuery,this.portal?.user,this.query,this.updateBasemapsCallback]),(()=>this.refresh()),m)])}destroy(){this._handles.destroy(),this._handles=null,this.filterFunction=null,this.portal=null}get state(){return"not-loaded"===this.loadStatus?"not-loaded":"loading"===this.loadStatus||this._lastPortalBasemapFetchController?"loading":"ready"}load(t){return this.addResolvingPromise(this.portal.load(t)),Promise.resolve(this)}async refresh(){if("loaded"!==this.loadStatus)return;this._lastPortalBasemapFetchController&&(this._lastPortalBasemapFetchController.abort(),this._lastPortalBasemapFetchController=null);const t=this.portal,s=new AbortController;this._lastPortalBasemapFetchController=s,this.notifyChange("state");try{const e=await t.fetchBasemaps(this._toQueryString(this.query),s);await this._updateBasemaps(e)}catch(e){if(p(e))throw e;l.getLogger(this.declaredClass).warn(new a("basemap-source:fetch-basemaps-error","Could not fetch basemaps from portal.",{error:e})),await this._updateBasemaps()}this._lastPortalBasemapFetchController=null,this.notifyChange("state")}_toQueryString(t){return t&&"string"!=typeof t?Object.keys(t).map((s=>`${s}:${t[s]}`)).join(" AND "):t}async _updateBasemaps(t=[]){let s=await this._filterBasemaps(t);s=this.updateBasemapsCallback?this.updateBasemapsCallback(s):s,this.basemaps.removeAll(),this.basemaps.addMany(s)}async _filterBasemaps(t){if(!this.filterFunction)return t;const s=t.map(this.filterFunction),e=await Promise.all(s);return t.filter(((t,s)=>e[s]))}};t([h({readOnly:!0,type:f})],y.prototype,"basemaps",void 0),t([h()],y.prototype,"filterFunction",void 0),t([h({type:u})],y.prototype,"portal",void 0),t([h()],y.prototype,"query",void 0),t([h({readOnly:!0})],y.prototype,"state",null),t([h()],y.prototype,"updateBasemapsCallback",void 0),y=t([c("esri.widgets.BasemapGallery.support.PortalBasemapsSource")],y);const B=y;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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{remove as t}from"../../core/arrayUtils.js";import{makeHandle as a,handlesGroup as i}from"../../core/handleUtils.js";import{removeMaybe as r,destroyMaybe as o}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import{whenOnce as s,watch as l,syncAndInitial as c}from"../../core/reactiveUtils.js";import{generateBracedUUID as d,generateUUID as u}from"../../core/uuid.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as f,getEffectiveEditingEnabled as m}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as w}from"../../views/draw/support/helpMessageUtils.js";import g from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{CreateFeaturesWorkflowData as v}from"./CreateFeaturesWorkflowData.js";import{waitForModelUpload as y}from"./modelUploadUtils.js";import M from"./Workflow.js";import{shouldShowAttachmentsForCreateWorkflow as _,startCreatingNewFeature as A,findLayerInfo as b,updateGraphicSymbolWhenRequired as F,isTerminalUpdateEventType as I,getVisualVariableAttributes as V,startUpdatingFeature as k,createWorkflowSteps as j,avoidFeatureTemplateSelectionWithOnlyOneItem as S,prepareAttachmentsForCreateWorkflow as U,visualVariableInteractiveUpdate as C}from"./workflowUtils.js";var O;const E=Symbol();let D=O=class extends M{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._attachmentFileInfos=new Map,this._highlightHandles=new Map,this._preventDefaultActionOnCancel=!1,this._lastActiveGraphics=[]}get numPendingFeatures(){return this.data.viewModel.sketchViewModel.layer.graphics.length}get pendingFeatures(){return this.data.viewModel.sketchViewModel.layer.graphics}get reliesOnOwnerAdminPrivileges(){const{creationInfo:e}=this.data;if(!e)return!1;const{layer:t}=e,a=t.capabilities?.operations.supportsAdd,i=f(t)?.operations.supportsAdd;return m(t)&&!t.editingEnabled||!!i&&!a}get shouldShowAttachments(){return!!(this.data&&this.data.creationInfo&&this.data.viewModel)&&_(this.data)}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"===this.stepId&&e)return w(e.layer.geometryType,t.sketchViewModel.createGraphic?.geometry)}async updatePendingFeature(e,a){return this._preventDefaultActionOnCancel=!0,this.data.viewModel.sketchViewModel.cancel(),t(this._lastActiveGraphics,e),this._startUpdating(e,a)}static create(e,t,a,i,r){const o=new O({data:new v({creationInfo:t,viewModel:e}),onCommit:async e=>{const{creationInfo:t,viewModel:a}=e;if(!t)return;e.creationInfo=null;const n=a.sketchViewModel.layer.graphics.toArray(),{layer:s}=t,l=s.capabilities?.editing.supportsGlobalId&&"globalIdField"in s,c=o._attachmentFileInfos;if(0===c.size){const e=l?G(n,s):{addFeatures:n};return void await i(s,e)}if(l){const e=G(n,s,c),t="addAttachments"in e?{globalIdUsed:!0}:void 0;return void await i(s,e,t)}const{addFeatureResults:d}=await i(s,{addFeatures:n}),u=o._getAddAttachmentsData(n,d,s,c);await r(s,u)}});return o._set("steps",this._createWorkflowSteps(o,a)),o}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",a((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,a((()=>e.opacity=t))}_highlight(e){const t=this.data.viewModel.view;"3d"===t?.type&&this._highlightHandles.set(e,t.highlight(e))}_removeHighlight(e){r(this._highlightHandles.get(e)),this._highlightHandles.delete(e)}async _startCreating(e){const{creationInfo:t}=this.data;if(t)return this.createFeatureState="create-new",A(this.data.viewModel.sketchViewModel,t,e)}async _startUpdating(e,t){const{creationInfo:a,viewModel:o}=this.data,{featureFormViewModel:n,layerInfos:s,sketchViewModel:l,view:c}=o;if(!c||!a)return;const d=a.layer,u=b(s,d),h=u?.formTemplate,p=c.spatialReference;return n.set({arcadeEditType:"INSERT",feature:e,formTemplate:h,spatialReference:p,view:c}),r(this._featureFormHandle),this._featureFormHandle=i([n.on("value-change",(async()=>{e.attributes=n.getValues(),await F(e,t)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&I(e.toolEventInfo.type))&&n.notifyFeatureGeometryChanged()}))]),this._removeHighlight(e),this.createFeatureState="update-pending",this._visualVariableAttributes=V(e),k(l,e,d,this._visualVariableAttributes,t)}static _createWorkflowSteps(e,i="awaiting-feature-creation-info"){const{data:d,handles:u}=e;let h=null,p=!0;const f=new Map,m=j(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],i,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(t){const{creationInfo:a}=d;"scene"===a?.layer?.type?(await y({workflow:e,stepId:this.id,handles:u,signal:t}),n(t)):(d.creationInfo=null,u.add(d.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>{e&&(d.creationInfo=e,d.viewModel.activeWorkflow?.next())})),this.id))},async tearDown(){u.remove(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){if(u.has(this.id))return;const i=d.viewModel.view;if(!i)return;const n=d.viewModel.sketchViewModel;p=n.updateOnGraphicClick,n.updateOnGraphicClick=!1,e._lastActiveGraphics=[],e._featureFormHandle=r(e._featureFormHandle),e._visualVariableAttributes={rotation:null,size:null},U(d.viewModel.attachmentsViewModel);const m="2d"===i.type&&d.creationInfo?e._fadeExistingFeatures(d.creationInfo.layer):null,w=n.on("create",(async t=>{if("cancel"===t.state){if(e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(e._lastActiveGraphics.length<1)return e._startCreating(f);const t=e._lastActiveGraphics.pop();return e._startUpdating(t,f)}if("complete"===t.state&&t.graphic)return e._startUpdating(t.graphic,f)})),v=n.on("update",(async t=>{const r=t.graphics[0];if("complete"===t.state){if(r!==h&&(e._lastActiveGraphics.push(r),e._highlight(r)),h=null,"add"!==d.viewModel.attachmentsViewModel.mode&&"edit"!==d.viewModel.attachmentsViewModel.mode||d.viewModel.activeWorkflow?.previous(),t.aborted&&e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);const o=i.cursor;return i.cursor="progress",u.add([a((()=>i.cursor=o)),i.on("click",(e=>e.preventDefault()))],E),s((()=>!d.viewModel.featureFormViewModel.updating)).then((()=>{u.remove(E),e._startCreating(f)}))}if("start"===t.state){e._removeHighlight(r);const t=d.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||d.viewModel.activeWorkflow?.previous(),t.fileInfos.removeAll(),t.graphic=r,t.mode="view";(e._attachmentFileInfos.get(r)||[]).forEach((({file:e,form:a})=>t.addFile(e,a)))}await C(i,r,t,e._visualVariableAttributes,f);const o=r.attributes;if(null!=e._visualVariableAttributes.rotation){const{field:t}=e._visualVariableAttributes.rotation;d.viewModel.featureFormViewModel.setValue(t,o[t])}if(null!=e._visualVariableAttributes.size){const{field:t}=e._visualVariableAttributes.size;d.viewModel.featureFormViewModel.setValue(t,o[t])}})),y=n.on("delete",(async a=>{const i=a.graphics[0];t(e._lastActiveGraphics,i),h=i}));let M=null;const _=l((()=>{const e=n.snappingOptions.featureSources.find((e=>e.layer===d.creationInfo?.layer));return{hasFeatureLayerSource:!!e,enabled:e?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{const a=n.snappingOptions.featureSources;e?(null==M&&(M=new g({layer:n.layer,enabled:t}),a.add(M)),M.enabled=t):(null!=M&&a.remove(M),M=o(M))}),c),A=i.on("immediate-click",(async t=>{const{results:a}=await i.hitTest(t,{include:n.layer}),r=a.find((e=>"graphic"===e.type));if(r){const t=r.graphic;if("transform"===n.activeTool||"reshape"===n.activeTool){if(n.updateGraphics.getItemAt(0)===t)return;await e.updatePendingFeature(t,f)}}})),b=l((()=>d.viewModel.attachmentsViewModel.mode),(e=>{"add"===e&&d.viewModel.activeWorkflow.go("adding-attachment"),"edit"===e&&d.viewModel.activeWorkflow.go("editing-attachment")}));await e._startCreating(f);const F={remove:()=>{r(e._featureFormHandle),w.remove(),v.remove(),y.remove(),_.remove(),null!=M&&n.snappingOptions.featureSources.remove(M),M=o(M),n.cancel(),A.remove(),b.remove(),r(m)}};u.add(F,this.id)},async tearDown(t){t.cancelled&&(d.viewModel.sketchViewModel.layer.removeAll(),u.remove([this.id,E]),d.viewModel.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear(),d.viewModel.sketchViewModel.updateOnGraphicClick=p)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{graphic:t,fileInfos:a}=d.viewModel.attachmentsViewModel;e._attachmentFileInfos.set(t,a.toArray()),d.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{graphic:t,fileInfos:a}=d.viewModel.attachmentsViewModel;e._attachmentFileInfos.set(t,a.toArray()),d.viewModel.attachmentsViewModel.mode="view"}})});return S(d,m)}_getAddAttachmentsData(e,t,a,i){const r=[];return t.forEach(((t,o)=>{if(!t.error){const n=e[o],s=i.get(n)||[];n.attributes[a.objectIdField]=t.objectId,s.forEach((({form:e})=>r.push({feature:n,attachment:e})))}})),r}};function G(e,t,a){const i=[],r=t.globalIdField;return e.forEach(((t,o)=>{var n;(n=e[o].attributes)[r]??(n[r]=d()),(a?.get(t)||[]).forEach((({file:e})=>i.push({feature:t,attachment:{globalId:u(),data:e}})))})),i.length?{addFeatures:e,addAttachments:i}:{addFeatures:e}}e([h()],D.prototype,"reliesOnOwnerAdminPrivileges",null),e([h()],D.prototype,"shouldShowAttachments",null),e([h()],D.prototype,"shouldAllowAttachmentEditing",null),e([h()],D.prototype,"helpMessage",null),D=O=e([p("esri.widgets.Editor.CreateFeaturesWorkflow")],D);const H=D;export{H as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{remove as t}from"../../core/arrayUtils.js";import{makeHandle as a,handlesGroup as i}from"../../core/handleUtils.js";import{removeMaybe as r,destroyMaybe as o}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import{whenOnce as s,watch as l,syncAndInitial as c}from"../../core/reactiveUtils.js";import{generateBracedUUID as d}from"../../core/uuid.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as p,getEffectiveEditingEnabled as f}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as m}from"../../views/draw/support/helpMessageUtils.js";import w from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{CreateFeaturesWorkflowData as g}from"./CreateFeaturesWorkflowData.js";import{waitForModelUpload as v}from"./modelUploadUtils.js";import y from"./Workflow.js";import{shouldShowAttachmentsForCreateWorkflow as M,startCreatingNewFeature as _,findLayerInfo as b,updateGraphicSymbolWhenRequired as A,isTerminalUpdateEventType as F,getVisualVariableAttributes as I,startUpdatingFeature as V,createWorkflowSteps as k,avoidFeatureTemplateSelectionWithOnlyOneItem as j,prepareAttachmentsForCreateWorkflow as S,visualVariableInteractiveUpdate as U}from"./workflowUtils.js";var C;const O=Symbol();let E=C=class extends y{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._attachmentFileInfos=new Map,this._highlightHandles=new Map,this._preventDefaultActionOnCancel=!1,this._lastActiveGraphics=[]}get numPendingFeatures(){return this.data.viewModel.sketchViewModel.layer.graphics.length}get pendingFeatures(){return this.data.viewModel.sketchViewModel.layer.graphics}get reliesOnOwnerAdminPrivileges(){const{creationInfo:e}=this.data;if(!e)return!1;const{layer:t}=e,a=t.capabilities?.operations.supportsAdd,i=p(t)?.operations.supportsAdd;return f(t)&&!t.editingEnabled||!!i&&!a}get shouldShowAttachments(){return!!(this.data&&this.data.creationInfo&&this.data.viewModel)&&M(this.data)}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"===this.stepId&&e)return m(e.layer.geometryType,t.sketchViewModel.createGraphic?.geometry)}get test(){return{addAttachment:(e,t)=>{this._attachmentFileInfos.set(e,t)}}}async updatePendingFeature(e,a){return this._preventDefaultActionOnCancel=!0,this.data.viewModel.sketchViewModel.cancel(),t(this._lastActiveGraphics,e),this._startUpdating(e,a)}static create(e,t,a,i,r){const o=new C({data:new g({creationInfo:t,viewModel:e}),onCommit:async e=>{const{creationInfo:t,viewModel:a}=e;if(!t)return;e.creationInfo=null;const n=a.sketchViewModel.layer.graphics.toArray(),{layer:s}=t,l=s.capabilities?.editing.supportsGlobalId&&"globalIdField"in s,c=o._attachmentFileInfos;if(l){const e=H(n,s,c);return void await i(s,e,{globalIdUsed:!0})}const d=await i(s,{addFeatures:n});if(c.size>0){const e=d?.addFeatureResults??[];await r(s,G(n,e,s,c))}}});return o._set("steps",this._createWorkflowSteps(o,a)),o}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",a((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,a((()=>e.opacity=t))}_highlight(e){const t=this.data.viewModel.view;"3d"===t?.type&&this._highlightHandles.set(e,t.highlight(e))}_removeHighlight(e){r(this._highlightHandles.get(e)),this._highlightHandles.delete(e)}async _startCreating(e){const{creationInfo:t}=this.data;if(t)return this.createFeatureState="create-new",_(this.data.viewModel.sketchViewModel,t,e)}async _startUpdating(e,t){const{creationInfo:a,viewModel:o}=this.data,{featureFormViewModel:n,layerInfos:s,sketchViewModel:l,view:c}=o;if(!c||!a)return;const d=a.layer,u=b(s,d),h=u?.formTemplate,p=c.spatialReference;return n.set({arcadeEditType:"INSERT",feature:e,formTemplate:h,spatialReference:p,view:c}),r(this._featureFormHandle),this._featureFormHandle=i([n.on("value-change",(async()=>{e.attributes=n.getValues(),await A(e,t)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&F(e.toolEventInfo.type))&&n.notifyFeatureGeometryChanged()}))]),this._removeHighlight(e),this.createFeatureState="update-pending",this._visualVariableAttributes=I(e),V(l,e,d,this._visualVariableAttributes,t)}static _createWorkflowSteps(e,i="awaiting-feature-creation-info"){const{data:d,handles:u}=e;let h=null,p=!0;const f=new Map,m=k(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],i,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(t){const{creationInfo:a}=d;"scene"===a?.layer?.type?(await v({workflow:e,stepId:this.id,handles:u,signal:t}),n(t)):(d.creationInfo=null,u.add(d.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>{e&&(d.creationInfo=e,d.viewModel.activeWorkflow?.next())})),this.id))},async tearDown(){u.remove(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){if(u.has(this.id))return;const i=d.viewModel.view;if(!i)return;const n=d.viewModel.sketchViewModel;p=n.updateOnGraphicClick,n.updateOnGraphicClick=!1,e._lastActiveGraphics=[],e._featureFormHandle=r(e._featureFormHandle),e._visualVariableAttributes={rotation:null,size:null},S(d.viewModel.attachmentsViewModel);const m="2d"===i.type&&d.creationInfo?e._fadeExistingFeatures(d.creationInfo.layer):null,g=n.on("create",(async t=>{if("cancel"===t.state){if(e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);if(e._lastActiveGraphics.length<1)return e._startCreating(f);const t=e._lastActiveGraphics.pop();return e._startUpdating(t,f)}if("complete"===t.state&&t.graphic)return e._startUpdating(t.graphic,f)})),v=n.on("update",(async t=>{const r=t.graphics[0];if("complete"===t.state){if(r!==h&&(e._lastActiveGraphics.push(r),e._highlight(r)),h=null,"add"!==d.viewModel.attachmentsViewModel.mode&&"edit"!==d.viewModel.attachmentsViewModel.mode||d.viewModel.activeWorkflow?.previous(),t.aborted&&e._preventDefaultActionOnCancel)return void(e._preventDefaultActionOnCancel=!1);const o=i.cursor;return i.cursor="progress",u.add([a((()=>i.cursor=o)),i.on("click",(e=>e.preventDefault()))],O),s((()=>!d.viewModel.featureFormViewModel.updating)).then((()=>{u.remove(O),e._startCreating(f)}))}if("start"===t.state){e._removeHighlight(r);const t=d.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||d.viewModel.activeWorkflow?.previous(),t.fileInfos.removeAll(),t.graphic=r,t.mode="view";(e._attachmentFileInfos.get(r)||[]).forEach((({file:e,form:a})=>t.addFile(e,a)))}await U(i,r,t,e._visualVariableAttributes,f);const o=r.attributes;if(null!=e._visualVariableAttributes.rotation){const{field:t}=e._visualVariableAttributes.rotation;d.viewModel.featureFormViewModel.setValue(t,o[t])}if(null!=e._visualVariableAttributes.size){const{field:t}=e._visualVariableAttributes.size;d.viewModel.featureFormViewModel.setValue(t,o[t])}})),y=n.on("delete",(async a=>{const i=a.graphics[0];t(e._lastActiveGraphics,i),h=i}));let M=null;const _=l((()=>{const e=n.snappingOptions.featureSources.find((e=>e.layer===d.creationInfo?.layer));return{hasFeatureLayerSource:!!e,enabled:e?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{const a=n.snappingOptions.featureSources;e?(null==M&&(M=new w({layer:n.layer,enabled:t}),a.add(M)),M.enabled=t):(null!=M&&a.remove(M),M=o(M))}),c),b=i.on("immediate-click",(async t=>{const{results:a}=await i.hitTest(t,{include:n.layer}),r=a.find((e=>"graphic"===e.type));if(r){const t=r.graphic;if("transform"===n.activeTool||"reshape"===n.activeTool){if(n.updateGraphics.getItemAt(0)===t)return;await e.updatePendingFeature(t,f)}}})),A=l((()=>d.viewModel.attachmentsViewModel.mode),(e=>{"add"===e&&d.viewModel.activeWorkflow.go("adding-attachment"),"edit"===e&&d.viewModel.activeWorkflow.go("editing-attachment")}));await e._startCreating(f);const F={remove:()=>{r(e._featureFormHandle),g.remove(),v.remove(),y.remove(),_.remove(),null!=M&&n.snappingOptions.featureSources.remove(M),M=o(M),n.cancel(),b.remove(),A.remove(),r(m)}};u.add(F,this.id)},async tearDown(t){t.cancelled&&(d.viewModel.sketchViewModel.layer.removeAll(),u.remove([this.id,O]),d.viewModel.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear(),d.viewModel.sketchViewModel.updateOnGraphicClick=p)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{graphic:t,fileInfos:a}=d.viewModel.attachmentsViewModel;e._attachmentFileInfos.set(t,a.toArray()),d.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{graphic:t,fileInfos:a}=d.viewModel.attachmentsViewModel;e._attachmentFileInfos.set(t,a.toArray()),d.viewModel.attachmentsViewModel.mode="view"}})});return j(d,m)}};function G(e,t,a,i){const r=[];return t.forEach(((t,o)=>{if(!t.error){const n=e[o],s=i.get(n)||[];n.attributes[a.objectIdField]=t.objectId,s.forEach((({form:e})=>r.push({feature:n,attachment:e})))}})),r}function H(e,t,a){const i=[],r=t.globalIdField;return e.forEach(((t,o)=>{var n;(n=e[o].attributes)[r]??(n[r]=d()),(a?.get(t)||[]).forEach((({file:e})=>i.push({feature:t,attachment:{globalId:d(),data:e}})))})),i.length?{addFeatures:e,addAttachments:i}:{addFeatures:e}}e([u()],E.prototype,"reliesOnOwnerAdminPrivileges",null),e([u()],E.prototype,"shouldShowAttachments",null),e([u()],E.prototype,"shouldAllowAttachmentEditing",null),e([u()],E.prototype,"helpMessage",null),E=C=e([h("esri.widgets.Editor.CreateFeaturesWorkflow")],E);const D=E;export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{abortMaybe as s}from"../../core/maybe.js";import{isAbortError as a,throwIfAborted as n,createAbortError as i,createDeferred as c}from"../../core/promiseUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../geometry/Point.js";import m from"../../geometry/SpatialReference.js";import d from"../../geometry/support/MeshTransform.js";let f=class extends e{constructor(){super({}),this._uploadTask=null}destroy(){this.cancel()}get state(){const r=this._uploadTask;return r?r.finished?r.error?a(r.error)?"cancelled":"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(r){this.cancel(),this._uploadTask=o((async e=>{const o=await h();if(n(e),0===o.length)throw i();const s=(await import("../../geometry/Mesh.js")).default;n(e);const a=new u({x:0,y:0,z:0,spatialReference:m.WebMercator}),c=s.createWithExternalSource(a,o,{transform:new d({geographic:!1})}),l=await r.uploadAssets([c],{signal:e});n(e);const p=l.length>0?l[0]:void 0;if(!p)throw new t("editor:upload","could not upload or convert model");return await p.load(),n(e),p}))}cancel(){this._uploadTask=s(this._uploadTask)}};async function h(){const r=c(),e=document.createElement("input");e.type="file",e.multiple=!0;const o=()=>{const{files:r}=e;return r?Array.from(r):[]};function t(){window.removeEventListener("focus",t),setTimeout((()=>{if(0===o().length)return r.resolve([])}),y)}return e.addEventListener("change",(()=>r.resolve(o()))),window.addEventListener("focus",t),e.click(),r.promise}r([l()],f.prototype,"state",null),r([l()],f.prototype,"result",null),r([l()],f.prototype,"error",null),r([l()],f.prototype,"_uploadTask",void 0),f=r([p("esri.widgets.Editor.Upload")],f);const y=1e3,g=f;export{g as default};
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{abortMaybe as s}from"../../core/maybe.js";import{isAbortError as a,throwIfAborted as n,createAbortError as i,createResolver as c}from"../../core/promiseUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../geometry/Point.js";import m from"../../geometry/SpatialReference.js";import d from"../../geometry/support/MeshTransform.js";let f=class extends e{constructor(){super({}),this._uploadTask=null}destroy(){this.cancel()}get state(){const r=this._uploadTask;return r?r.finished?r.error?a(r.error)?"cancelled":"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(r){this.cancel(),this._uploadTask=o((async e=>{const o=await h();if(n(e),0===o.length)throw i();const s=(await import("../../geometry/Mesh.js")).default;n(e);const a=new u({x:0,y:0,z:0,spatialReference:m.WebMercator}),c=s.createWithExternalSource(a,o,{transform:new d({geographic:!1})}),l=await r.uploadAssets([c],{signal:e});n(e);const p=l.length>0?l[0]:void 0;if(!p)throw new t("editor:upload","could not upload or convert model");return await p.load(),n(e),p}))}cancel(){this._uploadTask=s(this._uploadTask)}};async function h(){const r=c(),e=document.createElement("input");e.type="file",e.multiple=!0;const o=()=>{const{files:r}=e;return r?Array.from(r):[]};function t(){window.removeEventListener("focus",t),setTimeout((()=>{if(0===o().length)return r.resolve([])}),y)}return e.addEventListener("change",(()=>r.resolve(o()))),window.addEventListener("focus",t),e.click(),r.promise}r([l()],f.prototype,"state",null),r([l()],f.prototype,"result",null),r([l()],f.prototype,"error",null),r([l()],f.prototype,"_uploadTask",void 0),f=r([p("esri.widgets.Editor.Upload")],f);const y=1e3,g=f;export{g 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{deprecated as e}from"../../core/deprecate.js";function t(t,r,s=undefined){e(t,"`"+r+"` is deprecated, because it instantiates the deprecated class 'esri.widgets.Editor.CreateWorkflow'",{replacement:s,version:"4.23",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-CreateFeaturesWorkflow.html"})}export{t as workflowDeprecation};
5
+ import{deprecated as e}from"../../core/deprecate.js";function t(t,r,s=void 0){e(t,"`"+r+"` is deprecated, because it instantiates the deprecated class 'esri.widgets.Editor.CreateWorkflow'",{replacement:s,version:"4.23",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-CreateFeaturesWorkflow.html"})}export{t as workflowDeprecation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{makeHandle as e}from"../../core/handleUtils.js";import{destroyMaybe as o}from"../../core/maybe.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{watch as t}from"../../core/reactiveUtils.js";async function a({stepId:a,workflow:l,handles:c,signal:s}){const{data:n}=l,{creationInfo:i}=n;if(!i)return;const{layer:d}=i;if("scene"!==d.type)return;const m=(await import("./Upload.js")).default;r(s);const p=null!=i.geometryToPlace;if(i.geometryToPlace=null,p)return n.viewModel.cancelWorkflow();const f=new m;n.upload=f,c.add([t((()=>f.state),(e=>{switch(e){case"success":i.geometryToPlace=f.result,l.next();break;case"error":break;case"cancelled":n.viewModel.cancelWorkflow()}})),e((()=>{n.upload=o(n.upload)}))],a),f.uploadTo(d)}export{a as waitForModelUpload};
5
+ import{makeHandle as e}from"../../core/handleUtils.js";import{destroyMaybe as o}from"../../core/maybe.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{watch as t}from"../../core/reactiveUtils.js";async function c({stepId:c,workflow:a,handles:l,signal:n}){const{data:i}=a,{creationInfo:u,viewModel:p}=i,{view:d}=p;if(!u||!d)return;const{layer:f}=u;if("scene"!==f.type)return;const m=null!=u.geometryToPlace;if(u.geometryToPlace=null,m)return p.cancelWorkflow();const w=(await import("./Upload.js")).default;r(n);const y=new w;i.upload=y,l.add([t((()=>y.state),(e=>{switch(e){case"success":u.geometryToPlace=y.result,a.next();break;case"error":break;case"cancelled":p.cancelWorkflow()}})),e((()=>{i.upload=o(i.upload)})),s(d)],c),y.uploadTo(f)}function s(o){const r=o.cursor;return o.cursor="progress",e((()=>o.cursor=r))}export{c as waitForModelUpload};
package/widgets/Editor.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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{HandleOwnerMixin as s}from"../core/HandleOwner.js";import a from"../core/Logger.js";import{createDeferred as o}from"../core/promiseUtils.js";import{watch as i,on as n,when as r,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import u from"./Attachments.js";import h from"./FeatureForm.js";import g from"./FeatureTemplates.js";import f from"./Spinner.js";import _ from"./Widget.js";import{workflowDeprecation as w}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as y}from"./FeatureTemplates/ItemList.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as b,incrementHeadingLevel as C}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{SketchTooltipControls as E}from"./support/SketchTooltipControls/SketchTooltipControls.js";import{substitute as S}from"../intl/substitute.js";const L="esri-editor",I=`${L}__panel`,j=`${L}__prompt`,P={base:`${L} esri-widget esri-widget--panel`,message:`${L}__message`,actions:`${L}__actions`,helpMessage:`${L}__help-message`,progressBar:`${L}__progress-bar`,panelToolbar:`${I}-toolbar`,panelContent:`${I}-content`,panelContentMessage:`${I}-content__message`,panelContentSection:`${I}-content__section`,panelContentSectionGroup:`${I}-content__section__group`,panelContentScrimContainer:`${I}-content__scrim-container`,settingsContainer:`${L}__settings`,updateFeaturesActionButtons:`${L}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${L}__update-features-action-buttons--button`,featureTemplatesContainer:`${L}__feature-templates-container`,ownerAdminNotice:`${L}__owner-admin-notice`,templateItemContentEnd:`${L}__template-item-content-end`,templateItemContentEndSuccess:`${L}__template-item-content-end--success`,templateItemContentEndError:`${L}__template-item-content-end--error`,templateItemLoader:`${L}__template-item-loader`,promptContainer:j,promptHeader:`${j}__header`,promptHeading:`${j}__header__heading`,promptMessage:`${j}__message`,promptDivider:`${j}__divider`,promptActions:`${j}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},U={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0},sketchTooltipControls:!0};function B(e){requestAnimationFrame((()=>e.setFocus()))}const $="esri.widgets.Editor",D=a.getLogger($);let O=class extends(s(_)){constructor(e,t){super(e,t),this._featureForm=new h,this._attachments=new u({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1,renderItemContentEnd:e=>this._renderTemplateContentEnd(e),renderItemDescription:e=>this._renderTemplateDescription(e),renderItemLabel:e=>this._renderTemplateLabel(e)}),this._filterText="",this._prompt=null,this._spinner=new f,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...U},this.EditorPanel=({handleBack:e,heading:t,headingLevel:s,key:a},...o)=>{const{messagesCommon:i,viewModel:n,visibleElements:r}=this,l=n.sketchViewModel,c=n.syncing||this._attachments.submitting;return W("calcite-flow-item",{closable:!1,heading:t,headingLevel:s,key:a,loading:c,onCalciteFlowItemBack:e??void 0},W("div",{key:"panel-toolbar",class:P.panelToolbar},this._renderSettings(),r.undoRedoButtons&&[W("calcite-button",{key:"undo-button",label:i.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},i.undo),W("calcite-button",{key:"redo-button",label:i.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},i.redo)]),...o)},this._showDiscardWarning=()=>{const{messages:e}=this,t="create"===this.activeWorkflow?.type,s=o();return this._prompt={title:e[t?"cancelAddTitle":"cancelEditTitle"],message:e[t?"cancelAddWarningMessage":"cancelEditWarningMessage"],context:"danger",actions:{primary:{label:e[t?"discardFeature":"discardEdits"],action:()=>{s.resolve(),this._clearPrompt()}},secondary:{label:e[t?"continueAdding":"continueEditing"],action:()=>{s.reject(),this._clearPrompt()}}}},s.promise},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.previous(),this._clearPrompt())},this._onAttachmentsError=e=>{this._prompt={title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}}},this._clearPrompt=()=>{this._prompt=null},this._onBack=this._onBack.bind(this),this._onSave=this._onSave.bind(this),this._onDelete=this._onDelete.bind(this),this._onToggleUpdateWorkflow=this._onToggleUpdateWorkflow.bind(this),this._onAttachmentAdd=this._onAttachmentAdd.bind(this),this._onAttachmentUpdate=this._onAttachmentUpdate.bind(this),this._onAttachmentDelete=this._onAttachmentDelete.bind(this)}initialize(){this.addHandles([i((()=>C(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),n((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const s=this.viewModel;if(s.activeWorkflow)try{await s.cancelWorkflow({force:!s.hasPendingEdits})}catch{return s.featureTemplatesViewModel.select(t,{emit:!1})}if(!e||e.id===t?.id)return;const a={layer:e.layer,template:e.template};if(e.supportsUpload)return this.viewModel.startCreateFeaturesWorkflow(a);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(a):this.startCreateFeaturesWorkflowAtFeatureCreation(a)})),i((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,{emit:!1}))),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),i((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardPrompt=this._showDiscardWarning}),l),i((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:a,cancel:o}]=e;this._prompt={title:t.errorWarningTitle,message:S(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{a(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}}})),i((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),i((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),n((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.viewModel.back()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return k({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion.js"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js")})}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger",type:"primary"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...U,...e,snappingControlsElements:{...U.snappingControlsElements,...e?.snappingControlsElements}}}startCreateWorkflowAtFeatureTypeSelection(){return w(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return w(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return w(D,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this;if(!e)return W("div",{key:"empty",class:P.base});const{state:t}=e;return W("div",{key:"base",class:P.base},W("calcite-flow",{key:"flow"},e.pageStack.map((e=>this._renderPage(e,t))),this._renderPage(e.page,t)),this._renderPrompt())}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:a,_onBack:o}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:o,heading:a.selectTemplate,headingLevel:s},W("div",{key:"feature-templates",class:P.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:a,messagesCommon:o,headingLevel:i,_onBack:n,viewModel:r}=this;if(!t)return null;const l=t.type,c=r.featureFormViewModel,d="update"===l&&!t.data.edits.modified||r.syncing||c.updating,p="update"===l?a.editFeature:a.createFeatures,m="update"===l?o.update:o.create,u="create-features"===l&&"create-new"===t.createFeatureState,h="create-features"===l?t.numPendingFeatures:0,g=h>1?S(a.createFeaturesTemplate,{numFeatures:h}):m,f=t.shouldShowAttachments,_=c.inputs.every((e=>!e.visible))&&!f?this._renderMessage(S(a.clickToFinishTemplate,{button:m})):W("div",{key:"panel-content-section",class:P.panelContentSection},this._renderOwnerAdminNoticeIfApplicable(t),W("div",{class:P.panelContentSectionGroup},this._featureForm.render(),f&&W("div",{key:"attachments"},W(b,{level:C(i)},a.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:p,headingLevel:i,handleBack:n},W("div",{key:"panel-content",class:this.classes(P.panelContent,{[P.panelContentScrimContainer]:u})},_,u&&W("calcite-scrim",null)),this._renderFooterActions([{clickHandler:this._onSave,disabled:d,label:g,type:"primary"},r.shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._onDelete,disabled:r.syncing,label:o.delete}:null]))}_renderOwnerAdminNoticeIfApplicable(e){if(e?.reliesOnOwnerAdminPrivileges)return W("calcite-notice",{open:!0,kind:"info",scale:"s",class:P.ownerAdminNotice},W("div",{slot:"message"},this.messages.ownerAdminNotice))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_onBack:a,headingLevel:o,messages:i,messagesCommon:n}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:i.addAttachment,headingLevel:o,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?n.cancel:n.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentAdd}]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_onBack:a,activeWorkflow:o,headingLevel:i,messages:n,messagesCommon:r}=this;return o?W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:i,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),o.shouldAllowAttachmentEditing?this._renderFooterActions([{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._onAttachmentDelete,disabled:t.submitting,label:r.delete}]):void 0):null}_renderMessage(e){return W("div",{key:"panel-content-message",class:P.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:P.actions},e.filter(t).map((({type:e,disabled:t,class:s,clickHandler:a,label:o,...i},n)=>W("calcite-button",{key:`action-${n}`,slot:"footer-actions",class:s,disabled:t??!1,onclick:a,width:"full",...i},o))))}_renderPrompt(){const e=this._prompt;if(!e)return null;const{title:t,message:s,context:a,actions:o}=e,i=o.secondary;let n;switch(a){case"danger":n="danger";break;case"info":n="brand";break;default:n="neutral"}const r=W("calcite-button",{afterCreate:B,appearance:"solid",key:"prompt-primary-button",kind:n,onclick:o.primary.action,scale:"m",width:i?"half":"full"},o.primary.label),l=i&&W("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:n,onclick:i.action,scale:"m",width:"half"},i.label);return W("calcite-scrim",{key:"prompt"},W("div",{class:`${P.promptContainer}--${a}`},W("div",{class:P.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(b,{class:P.promptHeading,level:this.headingLevel},t)),W("div",{class:P.promptMessage},s),W("div",{class:P.promptDivider}),W("div",{class:P.promptActions},l,r)))}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:a,viewModel:o}=this,{canUpdate:i}=o,n=this._featureTemplates.viewModel.numberOfFeatureTemplates,r=!i&&0===n;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:a.widgetLabel,headingLevel:s},W("div",{key:"landing-content",class:P.panelContent},i&&W("div",{key:"edit-actions",class:P.panelContentSection},this._renderUpdateActions(e)),n>0&&W("div",{key:"create-actions",class:P.panelContentSection},this._renderCreateActions()),r&&W("div",{key:"no-content",class:P.panelContentMessage},a.noEditableLayers)),this._renderFooterHelpMessages())}_renderFooterHelpMessages(){const{activeWorkflow:e,messages:t,view:s}=this,a=e?.helpMessage,o=a?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[a]:null;return o?W("div",{key:"footer-actions",slot:"footer",class:P.helpMessage},o):null}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(b,{level:C(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._onToggleUpdateWorkflow},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(b,{level:C(t)},s.createFeatures),W("div",{key:"templates",class:P.featureTemplatesContainer},e.render()))}_renderTemplateLabel(e){return e.label}_renderTemplateDescription(e){const t=this._getUploadForTemplateItem(e);if(!t)return null;switch(t.state){case"pending":return this.messages?.uploadingModel;case"error":return t.error?.message;default:return null}}_renderTemplateContentEnd(e){const t=this._getUploadForTemplateItem(e),s=W("calcite-icon",{key:"upload-icon",class:P.templateItemContentEnd,icon:"upload-to"});if(!t)return e.supportsUpload?s:null;switch(t.state){case"success":return W("calcite-icon",{key:"success-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndSuccess),icon:"check"});case"error":return W("calcite-icon",{key:"error-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndError),icon:"exclamation-mark-circle-f"});case"pending":return W("calcite-loader",{class:P.templateItemLoader,inline:!0,key:"loader",label:"",scale:"s",type:"indeterminate"});case"cancelled":case"default":return s}}_getUploadForTemplateItem(e){const t=this.activeWorkflow;if("create-features"!==t?.type)return null;const{data:s}=t,{creationInfo:a,upload:o}=s;return a?.template===e.template&&a?.layer===e.layer?o:null}_renderFeatureList(e){const{EditorPanel:s,_onBack:a,headingLevel:o,messages:i,messagesTemplates:n,viewModel:{activeWorkflow:r,editableItems:l}}=this;if("update"!==r?.type)return null;const c=r.data.candidates,d=S(i.multipleFeaturesTemplate,{total:c.length}),p=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,a=this._filterText.toLowerCase(),{title:o}=s.layer,i=l.find((e=>e.layer===s.layer));if(!i)return null;const{attachmentsOnUpdateEnabled:n,supports:r}=i;return(r.includes("update")||r.includes("delete")||n)&&(!a||t?.toLowerCase().includes(a)||o?.toLowerCase().includes(a))})).filter(t).forEach((e=>{m++;const t=e.data.layer;p.has(t)?p.get(t)?.items.push(e):p.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const u=l.toArray().map((({layer:e})=>p.get(e))).filter(t),h=m>10||this._filterText.length>0;return W(s,{active:this._isPanelActive(e),key:"feature-list",heading:d,headingLevel:o,handleBack:a},W("div",{key:"feature-list",class:P.panelContent},W("div",{class:P.panelContentSection},y({enableListScroll:!1,filterEnabled:h,filterText:this._filterText,id:this.id,items:u,messages:{filterPlaceholder:n.filterPlaceholder,noItems:n.noItems,noMatches:n.noMatches},onFilterChange:e=>this._filterText=e,onItemMouseEnter:e=>this.viewModel.selectFeature(e.data),onItemMouseLeave:()=>this.viewModel.selectFeature(null),onItemSelect:e=>this.viewModel.selectFeature(e.data,!0)}))))}_isPanelActive(e){return this.viewModel.state===e}_renderSettings(){const e=this.visibleElements,t=e.snappingControls,s=e.sketchTooltipControls;return t||s?W("calcite-accordion",{key:"settings",class:P.settingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:this.messagesCommon?.settings,iconStart:"gear"},s&&W(E,{tooltipOptions:this.tooltipOptions}),t&&W(A,{snappingOptions:this.snappingOptions,view:this.view,visibleElements:e.snappingControlsElements,afterCreate:e=>e.layerListOpen=!1}))):null}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:a}=e,o=m(t);return o&&a[o]&&`${a[o]}`||S(this.messages.untitledFeatureTemplate,{id:a[s]})}_onSave(){this.viewModel.save()}_onDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}async _onToggleUpdateWorkflow(){const{viewModel:e}=this;e.canUpdate&&(e.activeWorkflow&&"awaiting-feature-to-update"===e.state?await e.cancelWorkflow():await e.startUpdateWorkflowAtFeatureSelection())}async _onBack(e){return e?.stopPropagation(),this.viewModel.back()}_onAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_onAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_onAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}};e([c()],O.prototype,"_featureForm",void 0),e([c()],O.prototype,"_attachments",void 0),e([c()],O.prototype,"_featureTemplates",void 0),e([c()],O.prototype,"_filterText",void 0),e([c()],O.prototype,"_prompt",void 0),e([c()],O.prototype,"_spinner",void 0),e([c()],O.prototype,"_deleteButtonCommonInfo",null),e([c({readOnly:!0})],O.prototype,"activeWorkflow",null),e([c()],O.prototype,"allowedWorkflows",null),e([c()],O.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c()],O.prototype,"label",null),e([c()],O.prototype,"labelOptions",null),e([c()],O.prototype,"layerInfos",null),e([c(),M("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),M("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),M("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([c()],O.prototype,"snappingOptions",null),e([c()],O.prototype,"tooltipOptions",null),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([c()],O.prototype,"view",null),e([c(),T(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([F()],O.prototype,"_onSave",null),e([F()],O.prototype,"_onDelete",null),e([F()],O.prototype,"_onToggleUpdateWorkflow",null),e([F()],O.prototype,"_onBack",null),e([F()],O.prototype,"_onAttachmentAdd",null),e([F()],O.prototype,"_onAttachmentUpdate",null),e([F()],O.prototype,"_onAttachmentDelete",null),O=e([p($)],O);const x=O;export{x as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{HandleOwnerMixin as s}from"../core/HandleOwner.js";import a from"../core/Logger.js";import{createResolver as o}from"../core/promiseUtils.js";import{watch as i,on as n,when as r,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import u from"./Attachments.js";import h from"./FeatureForm.js";import g from"./FeatureTemplates.js";import f from"./Spinner.js";import _ from"./Widget.js";import{workflowDeprecation as w}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as y}from"./FeatureTemplates/ItemList.js";import{loadCalciteComponents as k}from"./support/componentsUtils.js";import{Heading as b,incrementHeadingLevel as C}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as F}from"./support/decorators/accessibleHandler.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as T}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{SketchTooltipControls as E}from"./support/SketchTooltipControls/SketchTooltipControls.js";import{substitute as S}from"../intl/substitute.js";const L="esri-editor",I=`${L}__panel`,j=`${L}__prompt`,P={base:`${L} esri-widget esri-widget--panel`,message:`${L}__message`,actions:`${L}__actions`,helpMessage:`${L}__help-message`,progressBar:`${L}__progress-bar`,panelToolbar:`${I}-toolbar`,panelContent:`${I}-content`,panelContentMessage:`${I}-content__message`,panelContentSection:`${I}-content__section`,panelContentSectionGroup:`${I}-content__section__group`,panelContentScrimContainer:`${I}-content__scrim-container`,settingsContainer:`${L}__settings`,updateFeaturesActionButtons:`${L}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${L}__update-features-action-buttons--button`,featureTemplatesContainer:`${L}__feature-templates-container`,ownerAdminNotice:`${L}__owner-admin-notice`,templateItemContentEnd:`${L}__template-item-content-end`,templateItemContentEndSuccess:`${L}__template-item-content-end--success`,templateItemContentEndError:`${L}__template-item-content-end--error`,templateItemLoader:`${L}__template-item-loader`,promptContainer:j,promptHeader:`${j}__header`,promptHeading:`${j}__header__heading`,promptMessage:`${j}__message`,promptDivider:`${j}__divider`,promptActions:`${j}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},U={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0},sketchTooltipControls:!0};function B(e){requestAnimationFrame((()=>e.setFocus()))}const $="esri.widgets.Editor",D=a.getLogger($);let O=class extends(s(_)){constructor(e,t){super(e,t),this._featureForm=new h,this._attachments=new u({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1,renderItemContentEnd:e=>this._renderTemplateContentEnd(e),renderItemDescription:e=>this._renderTemplateDescription(e),renderItemLabel:e=>this._renderTemplateLabel(e)}),this._filterText="",this._prompt=null,this._spinner=new f,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...U},this.EditorPanel=({handleBack:e,heading:t,headingLevel:s,key:a},...o)=>{const{messagesCommon:i,viewModel:n,visibleElements:r}=this,l=n.sketchViewModel,c=n.syncing||this._attachments.submitting;return W("calcite-flow-item",{closable:!1,heading:t,headingLevel:s,key:a,loading:c,onCalciteFlowItemBack:e??void 0},W("div",{key:"panel-toolbar",class:P.panelToolbar},this._renderSettings(),r.undoRedoButtons&&[W("calcite-button",{key:"undo-button",label:i.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},i.undo),W("calcite-button",{key:"redo-button",label:i.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},i.redo)]),...o)},this._showDiscardWarning=()=>{const{messages:e}=this,t="create"===this.activeWorkflow?.type,s=o();return this._prompt={title:e[t?"cancelAddTitle":"cancelEditTitle"],message:e[t?"cancelAddWarningMessage":"cancelEditWarningMessage"],context:"danger",actions:{primary:{label:e[t?"discardFeature":"discardEdits"],action:()=>{s.resolve(),this._clearPrompt()}},secondary:{label:e[t?"continueAdding":"continueEditing"],action:()=>{s.reject(),this._clearPrompt()}}}},s.promise},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.previous(),this._clearPrompt())},this._onAttachmentsError=e=>{this._prompt={title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}}},this._clearPrompt=()=>{this._prompt=null},this._onBack=this._onBack.bind(this),this._onSave=this._onSave.bind(this),this._onDelete=this._onDelete.bind(this),this._onToggleUpdateWorkflow=this._onToggleUpdateWorkflow.bind(this),this._onAttachmentAdd=this._onAttachmentAdd.bind(this),this._onAttachmentUpdate=this._onAttachmentUpdate.bind(this),this._onAttachmentDelete=this._onAttachmentDelete.bind(this)}initialize(){this.addHandles([i((()=>C(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),n((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const s=this.viewModel;if(s.activeWorkflow)try{await s.cancelWorkflow({force:!s.hasPendingEdits})}catch{return s.featureTemplatesViewModel.select(t,{emit:!1})}if(!e||e.id===t?.id)return;const a={layer:e.layer,template:e.template};if(e.supportsUpload)return this.viewModel.startCreateFeaturesWorkflow(a);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(a):this.startCreateFeaturesWorkflowAtFeatureCreation(a)})),i((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,{emit:!1}))),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),i((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardPrompt=this._showDiscardWarning}),l),i((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:a,cancel:o}]=e;this._prompt={title:t.errorWarningTitle,message:S(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{a(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{o(),this._clearPrompt()}}}}})),i((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),i((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),n((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.viewModel.back()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return k({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion.js"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js")})}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger",type:"primary"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...U,...e,snappingControlsElements:{...U.snappingControlsElements,...e?.snappingControlsElements}}}startCreateWorkflowAtFeatureTypeSelection(){return w(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return w(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return w(D,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this;if(!e)return W("div",{key:"empty",class:P.base});const{state:t}=e;return W("div",{key:"base",class:P.base},W("calcite-flow",{key:"flow"},e.pageStack.map((e=>this._renderPage(e,t))),this._renderPage(e.page,t)),this._renderPrompt())}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:a,_onBack:o}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:o,heading:a.selectTemplate,headingLevel:s},W("div",{key:"feature-templates",class:P.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:a,messagesCommon:o,headingLevel:i,_onBack:n,viewModel:r}=this;if(!t)return null;const l=t.type,c=r.featureFormViewModel,d="update"===l&&!t.data.edits.modified||r.syncing||c.updating,p="update"===l?a.editFeature:a.createFeatures,m="update"===l?o.update:o.create,u="create-features"===l&&"create-new"===t.createFeatureState,h="create-features"===l?t.numPendingFeatures:0,g=h>1?S(a.createFeaturesTemplate,{numFeatures:h}):m,f=t.shouldShowAttachments,_=c.inputs.every((e=>!e.visible))&&!f?this._renderMessage(S(a.clickToFinishTemplate,{button:m})):W("div",{key:"panel-content-section",class:P.panelContentSection},this._renderOwnerAdminNoticeIfApplicable(t),W("div",{class:P.panelContentSectionGroup},this._featureForm.render(),f&&W("div",{key:"attachments"},W(b,{level:C(i)},a.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:p,headingLevel:i,handleBack:n},W("div",{key:"panel-content",class:this.classes(P.panelContent,{[P.panelContentScrimContainer]:u})},_,u&&W("calcite-scrim",null)),this._renderFooterActions([{clickHandler:this._onSave,disabled:d,label:g,type:"primary"},r.shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._onDelete,disabled:r.syncing,label:o.delete}:null]))}_renderOwnerAdminNoticeIfApplicable(e){if(e?.reliesOnOwnerAdminPrivileges)return W("calcite-notice",{open:!0,kind:"info",scale:"s",class:P.ownerAdminNotice},W("div",{slot:"message"},this.messages.ownerAdminNotice))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_onBack:a,headingLevel:o,messages:i,messagesCommon:n}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:i.addAttachment,headingLevel:o,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?n.cancel:n.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentAdd}]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_onBack:a,activeWorkflow:o,headingLevel:i,messages:n,messagesCommon:r}=this;return o?W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:i,handleBack:a},W("div",{key:"attachments",class:P.panelContent},t.render()),o.shouldAllowAttachmentEditing?this._renderFooterActions([{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._onAttachmentDelete,disabled:t.submitting,label:r.delete}]):void 0):null}_renderMessage(e){return W("div",{key:"panel-content-message",class:P.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:P.actions},e.filter(t).map((({type:e,disabled:t,class:s,clickHandler:a,label:o,...i},n)=>W("calcite-button",{key:`action-${n}`,slot:"footer-actions",class:s,disabled:t??!1,onclick:a,width:"full",...i},o))))}_renderPrompt(){const e=this._prompt;if(!e)return null;const{title:t,message:s,context:a,actions:o}=e,i=o.secondary;let n;switch(a){case"danger":n="danger";break;case"info":n="brand";break;default:n="neutral"}const r=W("calcite-button",{afterCreate:B,appearance:"solid",key:"prompt-primary-button",kind:n,onclick:o.primary.action,scale:"m",width:i?"half":"full"},o.primary.label),l=i&&W("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:n,onclick:i.action,scale:"m",width:"half"},i.label);return W("calcite-scrim",{key:"prompt"},W("div",{class:`${P.promptContainer}--${a}`},W("div",{class:P.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(b,{class:P.promptHeading,level:this.headingLevel},t)),W("div",{class:P.promptMessage},s),W("div",{class:P.promptDivider}),W("div",{class:P.promptActions},l,r)))}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:a,viewModel:o}=this,{canUpdate:i}=o,n=this._featureTemplates.viewModel.numberOfFeatureTemplates,r=!i&&0===n;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:a.widgetLabel,headingLevel:s},W("div",{key:"landing-content",class:P.panelContent},i&&W("div",{key:"edit-actions",class:P.panelContentSection},this._renderUpdateActions(e)),n>0&&W("div",{key:"create-actions",class:P.panelContentSection},this._renderCreateActions()),r&&W("div",{key:"no-content",class:P.panelContentMessage},a.noEditableLayers)),this._renderFooterHelpMessages())}_renderFooterHelpMessages(){const{activeWorkflow:e,messages:t,view:s}=this,a=e?.helpMessage,o=a?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[a]:null;return o?W("div",{key:"footer-actions",slot:"footer",class:P.helpMessage},o):null}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(b,{level:C(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._onToggleUpdateWorkflow},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(b,{level:C(t)},s.createFeatures),W("div",{key:"templates",class:P.featureTemplatesContainer},e.render()))}_renderTemplateLabel(e){return e.label}_renderTemplateDescription(e){const t=this._getUploadForTemplateItem(e);if(!t)return null;switch(t.state){case"pending":return this.messages?.uploadingModel;case"error":return t.error?.message;default:return null}}_renderTemplateContentEnd(e){const t=this._getUploadForTemplateItem(e),s=W("calcite-icon",{key:"upload-icon",class:P.templateItemContentEnd,icon:"upload-to"});if(!t)return e.supportsUpload?s:null;switch(t.state){case"success":return W("calcite-icon",{key:"success-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndSuccess),icon:"check"});case"error":return W("calcite-icon",{key:"error-icon",class:this.classes(P.templateItemContentEnd,P.templateItemContentEndError),icon:"exclamation-mark-circle-f"});case"pending":return W("calcite-loader",{class:P.templateItemLoader,inline:!0,key:"loader",label:"",scale:"s",type:"indeterminate"});case"cancelled":case"default":return s}}_getUploadForTemplateItem(e){const t=this.activeWorkflow;if("create-features"!==t?.type)return null;const{data:s}=t,{creationInfo:a,upload:o}=s;return a?.template===e.template&&a?.layer===e.layer?o:null}_renderFeatureList(e){const{EditorPanel:s,_onBack:a,headingLevel:o,messages:i,messagesTemplates:n,viewModel:{activeWorkflow:r,editableItems:l}}=this;if("update"!==r?.type)return null;const c=r.data.candidates,d=S(i.multipleFeaturesTemplate,{total:c.length}),p=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,a=this._filterText.toLowerCase(),{title:o}=s.layer,i=l.find((e=>e.layer===s.layer));if(!i)return null;const{attachmentsOnUpdateEnabled:n,supports:r}=i;return(r.includes("update")||r.includes("delete")||n)&&(!a||t?.toLowerCase().includes(a)||o?.toLowerCase().includes(a))})).filter(t).forEach((e=>{m++;const t=e.data.layer;p.has(t)?p.get(t)?.items.push(e):p.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const u=l.toArray().map((({layer:e})=>p.get(e))).filter(t),h=m>10||this._filterText.length>0;return W(s,{active:this._isPanelActive(e),key:"feature-list",heading:d,headingLevel:o,handleBack:a},W("div",{key:"feature-list",class:P.panelContent},W("div",{class:P.panelContentSection},y({enableListScroll:!1,filterEnabled:h,filterText:this._filterText,id:this.id,items:u,messages:{filterPlaceholder:n.filterPlaceholder,noItems:n.noItems,noMatches:n.noMatches},onFilterChange:e=>this._filterText=e,onItemMouseEnter:e=>this.viewModel.selectFeature(e.data),onItemMouseLeave:()=>this.viewModel.selectFeature(null),onItemSelect:e=>this.viewModel.selectFeature(e.data,!0)}))))}_isPanelActive(e){return this.viewModel.state===e}_renderSettings(){const e=this.visibleElements,t=e.snappingControls,s=e.sketchTooltipControls;return t||s?W("calcite-accordion",{key:"settings",class:P.settingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:this.messagesCommon?.settings,iconStart:"gear"},s&&W(E,{tooltipOptions:this.tooltipOptions}),t&&W(A,{snappingOptions:this.snappingOptions,view:this.view,visibleElements:e.snappingControlsElements,afterCreate:e=>e.layerListOpen=!1}))):null}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:a}=e,o=m(t);return o&&a[o]&&`${a[o]}`||S(this.messages.untitledFeatureTemplate,{id:a[s]})}_onSave(){this.viewModel.save()}_onDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}async _onToggleUpdateWorkflow(){const{viewModel:e}=this;e.canUpdate&&(e.activeWorkflow&&"awaiting-feature-to-update"===e.state?await e.cancelWorkflow():await e.startUpdateWorkflowAtFeatureSelection())}async _onBack(e){return e?.stopPropagation(),this.viewModel.back()}_onAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_onAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_onAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}};e([c()],O.prototype,"_featureForm",void 0),e([c()],O.prototype,"_attachments",void 0),e([c()],O.prototype,"_featureTemplates",void 0),e([c()],O.prototype,"_filterText",void 0),e([c()],O.prototype,"_prompt",void 0),e([c()],O.prototype,"_spinner",void 0),e([c()],O.prototype,"_deleteButtonCommonInfo",null),e([c({readOnly:!0})],O.prototype,"activeWorkflow",null),e([c()],O.prototype,"allowedWorkflows",null),e([c()],O.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c()],O.prototype,"label",null),e([c()],O.prototype,"labelOptions",null),e([c()],O.prototype,"layerInfos",null),e([c(),M("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),M("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),M("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([c()],O.prototype,"snappingOptions",null),e([c()],O.prototype,"tooltipOptions",null),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([c()],O.prototype,"view",null),e([c(),T(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([F()],O.prototype,"_onSave",null),e([F()],O.prototype,"_onDelete",null),e([F()],O.prototype,"_onToggleUpdateWorkflow",null),e([F()],O.prototype,"_onBack",null),e([F()],O.prototype,"_onAttachmentAdd",null),e([F()],O.prototype,"_onAttachmentUpdate",null),e([F()],O.prototype,"_onAttachmentDelete",null),O=e([p($)],O);const x=O;export{x 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Graphic.js";import o from"../../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../../core/HandleOwner.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import{throttle as i}from"../../../core/throttle.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../popup/content/AttachmentsContent.js";import"../../../popup/content/Content.js";import"../../../popup/content/CustomContent.js";import"../../../popup/content/ExpressionContent.js";import a from"../../../popup/content/FieldsContent.js";import c from"../../../popup/content/MediaContent.js";import"../../../popup/content/RelationshipContent.js";import m from"../../../popup/content/TextContent.js";import h from"../../../popup/ElementExpressionInfo.js";import u from"../FeatureContent/FeatureContentViewModel.js";import d from"../FeatureFields/FeatureFieldsViewModel.js";import f from"../FeatureMedia/FeatureMediaViewModel.js";import{loadArcadeUtils as y,createCompiledExpression as _}from"../support/arcadeFeatureUtils.js";const w=1;let j=class extends(r(o)){constructor(t){super(t),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{const t=this.contentElement?.type;this.contentElementViewModel?.destroy();const e="fields"===t?new d:"media"===t?new f:"text"===t?new u:null;this._set("contentElementViewModel",e)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=i(this._compile,w,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:e,interceptor:o,spatialReference:r,map:n,view:s,_abortController:i}=this;if(!(t&&e&&r&&n))return void this._set("contentElement",null);const l=await y();if(i!==this._abortController)return;const p=await _({arcadeUtils:l,expressionInfo:t,graphic:e,interceptor:o,map:n,spatialReference:r,view:s});if(!p||"esri.arcade.Dictionary"!==p.declaredClass)return void this._set("contentElement",null);const h=await p.castAsJsonAsync(i?.signal),u=h?.type,d="media"===u?c.fromJSON(h):"text"===u?m.fromJSON(h):"fields"===u?a.fromJSON(h):null;this._set("contentElement",d)},this.handles.add([n((()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view]),(()=>this._compileThrottled()),s),n((()=>[this.contentElement]),(()=>this._createVM()),s)])}destroy(){this._cancelQuery(),this.contentElementViewModel?.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(t){this._override("spatialReference",t)}get state(){const{_abortController:t,contentElement:e,contentElementViewModel:o}=this;return t?"loading":e||o?"ready":"disabled"}get map(){return this.view?.map??null}set map(t){this._override("map",t)}};t([l()],j.prototype,"_abortController",void 0),t([l({type:h})],j.prototype,"expressionInfo",void 0),t([l({type:e})],j.prototype,"graphic",void 0),t([l({readOnly:!0})],j.prototype,"contentElement",void 0),t([l({readOnly:!0})],j.prototype,"contentElementViewModel",void 0),t([l()],j.prototype,"interceptor",void 0),t([l()],j.prototype,"spatialReference",null),t([l({readOnly:!0})],j.prototype,"state",null),t([l()],j.prototype,"map",null),t([l()],j.prototype,"view",void 0),j=t([p("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],j);const C=j;export{C as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../Graphic.js";import o from"../../../core/Accessor.js";import{HandleOwnerMixin as r}from"../../../core/HandleOwner.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import{throttle as i}from"../../../core/throttle.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import"../../../popup/content/AttachmentsContent.js";import"../../../popup/content/Content.js";import"../../../popup/content/CustomContent.js";import"../../../popup/content/ExpressionContent.js";import a from"../../../popup/content/FieldsContent.js";import c from"../../../popup/content/MediaContent.js";import"../../../popup/content/RelationshipContent.js";import m from"../../../popup/content/TextContent.js";import h from"../../../popup/ElementExpressionInfo.js";import d from"../FeatureContent/FeatureContentViewModel.js";import u from"../FeatureFields/FeatureFieldsViewModel.js";import f from"../FeatureMedia/FeatureMediaViewModel.js";import{loadArcadeUtils as y,createCompiledExpression as _}from"../support/arcadeFeatureUtils.js";const w=1;let j=class extends(r(o)){constructor(t){super(t),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{const t=this.contentElement?.type;this.contentElementViewModel?.destroy();const e="fields"===t?new u:"media"===t?new f:"text"===t?new d:null;this._set("contentElementViewModel",e)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=i(this._compile,w,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:e,interceptor:o,spatialReference:r,map:n,view:s,_abortController:i}=this;if(!(t&&e&&r&&n))return void this._set("contentElement",null);const l=await y();if(i!==this._abortController)return;const p=await _({arcadeUtils:l,expressionInfo:t,graphic:e,interceptor:o,map:n,spatialReference:r,view:s});if(!p||"esri.arcade.Dictionary"!==p.declaredClass)return void this._set("contentElement",null);const h=await p.castAsJsonAsync(i?.signal),d=h?.type,u="media"===d?c.fromJSON(h):"text"===d?m.fromJSON(h):"fields"===d?a.fromJSON(h):null;this._set("contentElement",u)},this.handles.add([n((()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view]),(()=>this._compileThrottled()),s),n((()=>[this.contentElement]),(()=>this._createVM()),s)])}initialize(){this.addHandles(this._compileThrottled)}destroy(){this._cancelQuery(),this.contentElementViewModel?.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(t){this._override("spatialReference",t)}get state(){const{_abortController:t,contentElement:e,contentElementViewModel:o}=this;return t?"loading":e||o?"ready":"disabled"}get map(){return this.view?.map??null}set map(t){this._override("map",t)}};t([l()],j.prototype,"_abortController",void 0),t([l({type:h})],j.prototype,"expressionInfo",void 0),t([l({type:e})],j.prototype,"graphic",void 0),t([l({readOnly:!0})],j.prototype,"contentElement",void 0),t([l({readOnly:!0})],j.prototype,"contentElementViewModel",void 0),t([l()],j.prototype,"interceptor",void 0),t([l()],j.prototype,"spatialReference",null),t([l({readOnly:!0})],j.prototype,"state",null),t([l()],j.prototype,"map",null),t([l()],j.prototype,"view",void 0),j=t([p("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],j);const C=j;export{C 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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import s from"../../../core/Collection.js";import{HandleOwnerMixin as a}from"../../../core/HandleOwner.js";import{IdentifiableMixin as i}from"../../../core/Identifiable.js";import{ignoreAbortErrors as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{throttle as h}from"../../../core/throttle.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as C,findRelatedLayer as _}from"../support/featureUtils.js";const g=100;let b=class extends(l(i(a(r)))){constructor(e){super(e),this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await n(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await n(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await n(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryThrottled=h(this._queryController,g,this),this._queryFeatureCountThrottled=h(this._queryFeatureCountController,g,this),this._queryPageThrottled=h(this._queryPageController,g,this),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal})))},this.handles.add([u((()=>[this.displayCount,this.graphic,this.layer,this.map,this.orderByFieldsFixedCasing,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryThrottled()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageThrottled())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountThrottled()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=C(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new s}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?_(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new s}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o}=this;return t?"loading":e||r?"querying":o?"ready":"disabled"}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:s,supportsCacheHint:a}=this;if(await(e?.load()),await(t?.load()),!s||!e||!t)return void this._set("featureCount",0);const i=t.createQuery(),n=new c({cacheHint:a,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o}=this;!r||t<2||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:s,layer:a,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:h}=this,{canQuery:y,objectId:p}=this;if(!y||!a||!d)return[];const C=r?((n-1)*l+u)%u:0,_=r?l:s,g=d.objectIdField,b=[...t.map((e=>e.field)),g].filter(o),F=t.map((e=>`${e.field} ${e.order}`)),m=d.createQuery(),f=new c({orderByFields:F,start:C,num:_,outFields:b,cacheHint:h,relationshipId:i,returnGeometry:!1,objectIds:[p],where:m.where??void 0}),q=await a.queryRelatedFeatures(f,{signal:e?.signal}),A=q[p]?.features||[];return A.forEach((e=>{e.sourceLayer=d,e.layer=d})),A}};e([y()],b.prototype,"_queryAbortController",void 0),e([y()],b.prototype,"_queryPageAbortController",void 0),e([y()],b.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],b.prototype,"featurePage",null),e([y()],b.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],b.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],b.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],b.prototype,"canQuery",null),e([y()],b.prototype,"description",void 0),e([y({readOnly:!0})],b.prototype,"itemDescriptionFieldName",null),e([y({value:3})],b.prototype,"displayCount",null),e([y({type:t})],b.prototype,"graphic",void 0),e([y()],b.prototype,"layer",void 0),e([y()],b.prototype,"map",void 0),e([y({readOnly:!0})],b.prototype,"objectId",null),e([y({readOnly:!0})],b.prototype,"objectIdField",null),e([y()],b.prototype,"orderByFields",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatures",null),e([y({readOnly:!0})],b.prototype,"relatedLayer",null),e([y({readOnly:!0})],b.prototype,"relationship",null),e([y()],b.prototype,"featureCount",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatureViewModels",null),e([y()],b.prototype,"relationshipId",void 0),e([y()],b.prototype,"showAllEnabled",void 0),e([y()],b.prototype,"state",null),e([y()],b.prototype,"title",void 0),b=e([p("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],b);const F=b;export{F as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import s from"../../../core/Collection.js";import{HandleOwnerMixin as a}from"../../../core/HandleOwner.js";import{IdentifiableMixin as i}from"../../../core/Identifiable.js";import{ignoreAbortErrors as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{throttle as h}from"../../../core/throttle.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as C,findRelatedLayer as _}from"../support/featureUtils.js";const g=100;let b=class extends(l(i(a(r)))){constructor(e){super(e),this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await n(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await n(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await n(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryThrottled=h(this._queryController,g,this),this._queryFeatureCountThrottled=h(this._queryFeatureCountController,g,this),this._queryPageThrottled=h(this._queryPageController,g,this),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal})))},this.handles.add([u((()=>[this.displayCount,this.graphic,this.layer,this.map,this.orderByFieldsFixedCasing,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryThrottled()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageThrottled())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountThrottled()))])}initialize(){this.addHandles(this._queryThrottled)}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=C(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new s}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?_(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new s}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o}=this;return t?"loading":e||r?"querying":o?"ready":"disabled"}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:s,supportsCacheHint:a}=this;if(await(e?.load()),await(t?.load()),!s||!e||!t)return void this._set("featureCount",0);const i=t.createQuery(),n=new c({cacheHint:a,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o}=this;!r||t<2||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:s,layer:a,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:h}=this,{canQuery:y,objectId:p}=this;if(!y||!a||!d)return[];const C=r?((n-1)*l+u)%u:0,_=r?l:s,g=d.objectIdField,b=[...t.map((e=>e.field)),g].filter(o),F=t.map((e=>`${e.field} ${e.order}`)),m=d.createQuery(),f=new c({orderByFields:F,start:C,num:_,outFields:b,cacheHint:h,relationshipId:i,returnGeometry:!1,objectIds:[p],where:m.where??void 0}),q=await a.queryRelatedFeatures(f,{signal:e?.signal}),A=q[p]?.features||[];return A.forEach((e=>{e.sourceLayer=d,e.layer=d})),A}};e([y()],b.prototype,"_queryAbortController",void 0),e([y()],b.prototype,"_queryPageAbortController",void 0),e([y()],b.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],b.prototype,"featurePage",null),e([y()],b.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],b.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],b.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],b.prototype,"canQuery",null),e([y()],b.prototype,"description",void 0),e([y({readOnly:!0})],b.prototype,"itemDescriptionFieldName",null),e([y({value:3})],b.prototype,"displayCount",null),e([y({type:t})],b.prototype,"graphic",void 0),e([y()],b.prototype,"layer",void 0),e([y()],b.prototype,"map",void 0),e([y({readOnly:!0})],b.prototype,"objectId",null),e([y({readOnly:!0})],b.prototype,"objectIdField",null),e([y()],b.prototype,"orderByFields",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatures",null),e([y({readOnly:!0})],b.prototype,"relatedLayer",null),e([y({readOnly:!0})],b.prototype,"relationship",null),e([y()],b.prototype,"featureCount",void 0),e([y({readOnly:!0})],b.prototype,"relatedFeatureViewModels",null),e([y()],b.prototype,"relationshipId",void 0),e([y()],b.prototype,"showAllEnabled",void 0),e([y()],b.prototype,"state",null),e([y()],b.prototype,"title",void 0),b=e([p("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],b);const F=b;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.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import o from"../../core/Handles.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import a from"../../core/Logger.js";import{isAbortError as l,eachAlways as p}from"../../core/promiseUtils.js";import{watch as c,on as d,initial as u}from"../../core/reactiveUtils.js";import{throttle as h}from"../../core/throttle.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../popup/content/TextContent.js";import b from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import g from"./FeatureContent/FeatureContentViewModel.js";import I from"./FeatureExpression/FeatureExpressionViewModel.js";import A from"./FeatureFields/FeatureFieldsViewModel.js";import M from"./FeatureMedia/FeatureMediaViewModel.js";import w from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as x}from"./support/arcadeFeatureUtils.js";import{createfieldInfoMap as F,getAllFieldInfos as v,getSourceLayer as C,querySourceLayer as E,isRelatableFeatureSupportedLayer as T,substituteFieldsInLinksAndAttributes as V,isExpressionField as j,isRelatedField as P,formatEditInfo as R,graphicCallback as L,queryUpdatedFeature as O,formatAttributes as S,preLayerQueryCallback as k,preRequestCallback as U}from"./support/featureUtils.js";import{queryLayerInfos as D,queryRelatedFeatures as N,setRelatedFeatures as q,getRelatedFieldInfo as B,createRelatedInfo as Q,updateRelatedInfo as G}from"./support/relatedFeatureUtils.js";var H;const z=1,J="content-view-models",K="relationship-view-models",W={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let X=H=class extends(n(i)){constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=h(this._graphicChanged,z,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...W},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent},this._handles.add(c((()=>[this.graphic,this._effectivePopupTemplate,this.abilities]),(()=>this._graphicChangedThrottled()),u))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return F(v(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return C(this.graphic)}castAbilities(e){return{...W,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof M&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:r}=this;await(r?.load());const i=r?.objectIdField;if(!i||!e||!r)return;const s=e?.attributes?.[i];if(null==s)return;const o=[s];if(!e.geometry){const i=await E({layer:r,graphic:e,outFields:[],objectIds:o,returnGeometry:!0,spatialReference:t}),s=i?.geometry;s&&(e.geometry=s)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){l(r)||(this._error=r,a.getLogger(this.declaredClass).error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(s):"string"==typeof e?this._compileText(new y({text:e}),0).text:e}_destroyContentViewModels(){this._handles?.remove(K),this._handles?.remove(J),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const r=e?.graphic?.getObjectId(),i=t?.getObjectId();return null!=r&&null!=i&&r===i}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:r}){const{view:i,spatialReference:s}=this;t?.filter(Boolean).forEach((t=>{e.find((e=>this._matchesFeature(e,t)))||e.add(new H({abilities:{relationshipContent:!1},map:r,view:i,spatialReference:s,graphic:t}))})),e.forEach((r=>{const i=t?.find((e=>this._matchesFeature(r,e)));i||e.remove(r)}))}_setExpressionContentVM(e,t){const r=this.formattedAttributes,{contentElement:i,contentElementViewModel:s}=e,o=i?.type;s&&o&&("fields"===o&&(this._createFieldsFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),s.set(this._createFieldsVMParams(i,t))),"media"===o&&(this._createMediaFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),s.set(this._createMediaVMParams(i,t))),"text"===o&&s.set(this._createTextVMParams(i)))}_compileRelationship(e,t){const{displayCount:r,orderByFields:i,relationshipId:s,title:o,description:n}=e,{_sourceLayer:a,graphic:l,map:p}=this;if(!T(a))return;const c=new w({displayCount:r,graphic:l,orderByFields:i,relationshipId:s,layer:a,map:p,...this._compileTitleAndDesc({title:o,description:n})});return this.contentViewModels[t]=c,this._handles.add(d((()=>c.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(c))),K),e}_compileExpression(e,t){const{expressionInfo:r}=e,{graphic:i,map:s,spatialReference:o,view:n}=this,a=new I({expressionInfo:r,graphic:i,interceptor:H.interceptor,map:s,spatialReference:o,view:n});return this.contentViewModels[t]=a,this._handles.add(c((()=>a.contentElementViewModel),(()=>this._setExpressionContentVM(a,t)),u),J),e}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:s}=e;return this.contentViewModels[t]=new b({graphic:r,...this._compileTitleAndDesc({title:s,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:s}=e;return this.contentViewModels[t]=new g({graphic:r,creator:i,destroyer:s}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:s,formattedAttributes:o}=this,n=s?.attributes,a=this._expressionAttributes,l=o.global;return{title:V({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:e}),description:V({attributes:n,fieldInfoMap:r,globalAttributes:l,expressionAttributes:a,layer:i,text:t})}}_createFieldsVMParams(e,t){const r=this._effectivePopupTemplate,i=this.formattedAttributes,s={...i?.global,...i?.content[t]},o=e?.fieldInfos||r?.fieldInfos,n=o?.filter((({fieldName:e})=>j(e)||P(e)||s.hasOwnProperty(e))),a=r?.expressionInfos,{description:l,title:p}=e;return{attributes:s,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const r=e.clone(),i=new A(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=i,r.fieldInfos=i.formattedFieldInfos.slice(0),r}_createMediaVMParams(e,t){const{abilities:r,graphic:i,_fieldInfoMap:s,_effectivePopupTemplate:o,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,p=this.formattedAttributes,c=i?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:r.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:i?.isAggregate,layer:a,fieldInfoMap:s,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:o,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const r=e.clone(),i=new M(this._createMediaVMParams(e,t));return r.mediaInfos=i.formattedMediaInfos.slice(0),this.contentViewModels[t]=i,r}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:r,_sourceLayer:i,_expressionAttributes:s}=this;if(e&&e.text){const o=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=V({attributes:o,fieldInfoMap:r,globalAttributes:n,expressionAttributes:s,layer:i,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const r=e.clone();return this.contentViewModels[t]=new g(this._createTextVMParams(r)),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,s=t?.editFieldsInfo;return i&&s?R(s,r?.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:s}=this,o=i?.attributes??{},n=this.formattedAttributes?.global??{};return V({attributes:o,fieldInfoMap:t,globalAttributes:n,expressionAttributes:s,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const r=e?.title;return L(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const r=e?.content;return L(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:s}=this,o=this.map,n=this.view,a=this.spatialReference;if(t!==this._featureAbortController||!i)return;await O({graphic:i,popupTemplate:s,layer:r,spatialReference:a},e);const{content:{value:l},title:{value:c}}=await p({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:d}}=await p({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:x({expressionInfos:s?.expressionInfos,spatialReference:a,graphic:i,map:o,interceptor:H.interceptor,view:n})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...i.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(l)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(l)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){const{_effectivePopupTemplate:i,graphic:s,relatedInfos:o,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;r.content[t]=S({fieldInfos:i?.fieldInfos,graphic:s,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:o})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){if(e.fieldInfos){const{graphic:i,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;r.content[t]=S({fieldInfos:e.fieldInfos,graphic:i,attributes:{...a,...e.attributes},layer:o,fieldInfoMap:n,relatedInfos:s})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:r,relatedInfos:i,_sourceLayer:s,_fieldInfoMap:o,_graphicExpressionAttributes:n}=this,a=t?.fieldInfos,l={global:S({fieldInfos:a,graphic:r,attributes:n,layer:s,fieldInfoMap:o,relatedInfos:i}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,v(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:s}=this;i.clear();const o=null!=s?.associatedLayer?await(s?.associatedLayer.load(r)):s;if(!o||!e)return;const n=t.filter((e=>e&&P(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,o)));const a=await D({relatedInfos:i,layer:o},r);Object.keys(a).forEach((e=>{const t=i.get(e.toString()),r=a[e]?.value;t&&r&&(t.layerInfo=r.data)}));const l=await N({graphic:e,relatedInfos:i,layer:o},r);Object.keys(l).forEach((e=>{q(l[e]?.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=B(e.fieldName);if(!i)return;const{layerId:s,fieldName:o}=i;if(!s)return;const n=r.get(s.toString())||Q(s,t);n&&(G({relatedInfo:n,fieldName:o,fieldInfo:e}),this.relatedInfos.set(s,n))}};X.interceptor=new r(k,U),e([f()],X.prototype,"_error",void 0),e([f()],X.prototype,"_featureAbortController",void 0),e([f({readOnly:!0})],X.prototype,"_effectivePopupTemplate",null),e([f({readOnly:!0})],X.prototype,"_fieldInfoMap",null),e([f({readOnly:!0})],X.prototype,"_sourceLayer",null),e([f()],X.prototype,"abilities",void 0),e([m("abilities")],X.prototype,"castAbilities",null),e([f({readOnly:!0})],X.prototype,"content",void 0),e([f({readOnly:!0})],X.prototype,"contentViewModels",void 0),e([f()],X.prototype,"description",void 0),e([f({type:Boolean})],X.prototype,"defaultPopupTemplateEnabled",void 0),e([f({readOnly:!0})],X.prototype,"isTable",null),e([f({readOnly:!0})],X.prototype,"state",null),e([f({readOnly:!0})],X.prototype,"formattedAttributes",void 0),e([f({type:t,value:null})],X.prototype,"graphic",null),e([f({readOnly:!0})],X.prototype,"lastEditInfo",void 0),e([f({readOnly:!0})],X.prototype,"relatedInfos",void 0),e([f()],X.prototype,"spatialReference",null),e([f({readOnly:!0})],X.prototype,"title",void 0),e([f()],X.prototype,"map",null),e([f({readOnly:!0})],X.prototype,"waitingForContent",null),e([f()],X.prototype,"view",void 0),X=H=e([_("esri.widgets.FeatureViewModel")],X);const Y=X;export{Y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import o from"../../core/Handles.js";import{IdentifiableMixin as n}from"../../core/Identifiable.js";import a from"../../core/Logger.js";import{isAbortError as l,eachAlways as p}from"../../core/promiseUtils.js";import{watch as c,on as d,initial as u}from"../../core/reactiveUtils.js";import{throttle as h}from"../../core/throttle.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../popup/content/TextContent.js";import g from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import b from"./FeatureContent/FeatureContentViewModel.js";import I from"./FeatureExpression/FeatureExpressionViewModel.js";import A from"./FeatureFields/FeatureFieldsViewModel.js";import M from"./FeatureMedia/FeatureMediaViewModel.js";import w from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as x}from"./support/arcadeFeatureUtils.js";import{createfieldInfoMap as F,getAllFieldInfos as v,getSourceLayer as C,querySourceLayer as T,isRelatableFeatureSupportedLayer as E,substituteFieldsInLinksAndAttributes as V,isExpressionField as j,isRelatedField as P,formatEditInfo as R,graphicCallback as L,queryUpdatedFeature as O,formatAttributes as S,preLayerQueryCallback as k,preRequestCallback as U}from"./support/featureUtils.js";import{queryLayerInfos as D,queryRelatedFeatures as N,setRelatedFeatures as q,getRelatedFieldInfo as B,createRelatedInfo as Q,updateRelatedInfo as G}from"./support/relatedFeatureUtils.js";var H;const z=1,J="content-view-models",K="relationship-view-models",W={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let X=H=class extends(n(r)){constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=h(this._graphicChanged,z,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...W},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent},this._handles.add(c((()=>[this.graphic,this._effectivePopupTemplate,this.abilities]),(()=>this._graphicChangedThrottled()),u))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return F(v(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return C(this.graphic)}castAbilities(e){return{...W,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof M&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof M&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const r=i?.objectIdField;if(!r||!e||!i)return;const s=e?.attributes?.[r];if(null==s)return;const o=[s];if(!e.geometry){const r=await T({layer:i,graphic:e,outFields:[],objectIds:o,returnGeometry:!0,spatialReference:t}),s=r?.geometry;s&&(e.geometry=s)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(i){l(i)||(this._error=i,a.getLogger(this.declaredClass).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(s):"string"==typeof e?this._compileText(new y({text:e}),0).text:e}_destroyContentViewModels(){this._handles?.remove(K),this._handles?.remove(J),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),r=t?.getObjectId();return null!=i&&null!=r&&i===r}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:r,spatialReference:s}=this;t?.filter(Boolean).forEach((t=>{e.find((e=>this._matchesFeature(e,t)))||e.add(new H({abilities:{relationshipContent:!1},map:i,view:r,spatialReference:s,graphic:t}))})),e.forEach((i=>{const r=t?.find((e=>this._matchesFeature(i,e)));r||e.remove(i)}))}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:r,contentElementViewModel:s}=e,o=r?.type;s&&o&&("fields"===o&&(this._createFieldsFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createFieldsVMParams(r,t))),"media"===o&&(this._createMediaFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createMediaVMParams(r,t))),"text"===o&&s.set(this._createTextVMParams(r)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:r,relationshipId:s,title:o,description:n}=e,{_sourceLayer:a,graphic:l,map:p}=this;if(!E(a))return;const c=new w({displayCount:i,graphic:l,orderByFields:r,relationshipId:s,layer:a,map:p,...this._compileTitleAndDesc({title:o,description:n})});return this.contentViewModels[t]=c,this._handles.add(d((()=>c.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(c))),K),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:r,map:s,spatialReference:o,view:n}=this,a=new I({expressionInfo:i,graphic:r,interceptor:H.interceptor,map:s,spatialReference:o,view:n});return this.contentViewModels[t]=a,this._handles.add(c((()=>a.contentElementViewModel),(()=>this._setExpressionContentVM(a,t)),u),J),e}_compileAttachments(e,t){const{graphic:i}=this,{description:r,title:s}=e;return this.contentViewModels[t]=new g({graphic:i,...this._compileTitleAndDesc({title:s,description:r})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:r,destroyer:s}=e;return this.contentViewModels[t]=new b({graphic:i,creator:r,destroyer:s}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:r,graphic:s,formattedAttributes:o}=this,n=s?.attributes,a=this._expressionAttributes,l=o.global;return{title:V({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:e}),description:V({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,r=this.formattedAttributes,s={...r?.global,...r?.content[t]},o=e?.fieldInfos||i?.fieldInfos,n=o?.filter((({fieldName:e})=>j(e)||P(e)||s.hasOwnProperty(e))),a=i?.expressionInfos,{description:l,title:p}=e;return{attributes:s,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),r=new A(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=r,i.fieldInfos=r.formattedFieldInfos.slice(0),i}_createMediaVMParams(e,t){const{abilities:i,graphic:r,_fieldInfoMap:s,_effectivePopupTemplate:o,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,p=this.formattedAttributes,c=r?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:r?.isAggregate,layer:a,fieldInfoMap:s,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:o,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const i=e.clone(),r=new M(this._createMediaVMParams(e,t));return i.mediaInfos=r.formattedMediaInfos.slice(0),this.contentViewModels[t]=r,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:r,_expressionAttributes:s}=this;if(e&&e.text){const o=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=V({attributes:o,fieldInfoMap:i,globalAttributes:n,expressionAttributes:s,layer:r,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new b(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i}=this;if(!e)return;const{lastEditInfoEnabled:r}=e,s=t?.editFieldsInfo;return r&&s?R(s,i?.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:r,_expressionAttributes:s}=this,o=r?.attributes??{},n=this.formattedAttributes?.global??{};return V({attributes:o,fieldInfoMap:t,globalAttributes:n,expressionAttributes:s,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.title;return L(i,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.content;return L(i,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:i,graphic:r,_effectivePopupTemplate:s}=this,o=this.map,n=this.view,a=this.spatialReference;if(t!==this._featureAbortController||!r)return;await O({graphic:r,popupTemplate:s,layer:i,spatialReference:a},e);const{content:{value:l},title:{value:c}}=await p({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:d}}=await p({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:x({expressionInfos:s?.expressionInfos,spatialReference:a,graphic:r,map:o,interceptor:H.interceptor,view:n})});t===this._featureAbortController&&r&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...r.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(l)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(l)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:r,graphic:s,relatedInfos:o,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;i.content[t]=S({fieldInfos:r?.fieldInfos,graphic:s,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:o})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:r,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;i.content[t]=S({fieldInfos:e.fieldInfos,graphic:r,attributes:{...a,...e.attributes},layer:o,fieldInfoMap:n,relatedInfos:s})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:r,_sourceLayer:s,_fieldInfoMap:o,_graphicExpressionAttributes:n}=this,a=t?.fieldInfos,l={global:S({fieldInfos:a,graphic:i,attributes:n,layer:s,fieldInfoMap:o,relatedInfos:r}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,v(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:r,_sourceLayer:s}=this;r.clear();const o=null!=s?.associatedLayer?await(s?.associatedLayer.load(i)):s;if(!o||!e)return;const n=t.filter((e=>e&&P(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,o)));const a=await D({relatedInfos:r,layer:o},i);Object.keys(a).forEach((e=>{const t=r.get(e.toString()),i=a[e]?.value;t&&i&&(t.layerInfo=i.data)}));const l=await N({graphic:e,relatedInfos:r,layer:o},i);Object.keys(l).forEach((e=>{q(l[e]?.value,r.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,r=B(e.fieldName);if(!r)return;const{layerId:s,fieldName:o}=r;if(!s)return;const n=i.get(s.toString())||Q(s,t);n&&(G({relatedInfo:n,fieldName:o,fieldInfo:e}),this.relatedInfos.set(s,n))}};X.interceptor=new i(k,U),e([f()],X.prototype,"_error",void 0),e([f()],X.prototype,"_featureAbortController",void 0),e([f({readOnly:!0})],X.prototype,"_effectivePopupTemplate",null),e([f({readOnly:!0})],X.prototype,"_fieldInfoMap",null),e([f({readOnly:!0})],X.prototype,"_sourceLayer",null),e([f()],X.prototype,"abilities",void 0),e([m("abilities")],X.prototype,"castAbilities",null),e([f({readOnly:!0})],X.prototype,"content",void 0),e([f({readOnly:!0})],X.prototype,"contentViewModels",void 0),e([f()],X.prototype,"description",void 0),e([f({type:Boolean})],X.prototype,"defaultPopupTemplateEnabled",void 0),e([f({readOnly:!0})],X.prototype,"isTable",null),e([f({readOnly:!0})],X.prototype,"state",null),e([f({readOnly:!0})],X.prototype,"formattedAttributes",void 0),e([f({type:t,value:null})],X.prototype,"graphic",null),e([f({readOnly:!0})],X.prototype,"lastEditInfo",void 0),e([f({readOnly:!0})],X.prototype,"relatedInfos",void 0),e([f()],X.prototype,"spatialReference",null),e([f({readOnly:!0})],X.prototype,"title",void 0),e([f()],X.prototype,"map",null),e([f({readOnly:!0})],X.prototype,"waitingForContent",null),e([f()],X.prototype,"view",void 0),X=H=e([_("esri.widgets.FeatureViewModel")],X);const Y=X;export{Y as default};