/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import{property as t,subclass as r}from"../../../core/accessorSupport/decorators.js";import a from"../../../layers/support/EditingCapabilities.js";import{isGeometryEditableSceneLayer as l}from"../../../views/layers/support/editableLayerViews.js";import{isRelatableFeatureSupportedLayer as n}from"../../Feature/support/featureUtils.js";let s=class extends a{constructor(e){super(e),this.layerInfo=null,this.layerView=null}get attachments(){const e=this.defaults.attachments.enabled,t=this.layerInfo;return{enabled:e&&!1!==t?.enabled}}get create(){const{attachments:e,defaults:t,layerInfo:r,layer:a,layerView:l}=this,n=t.create,s=!1!==r?.enabled&&!1!==r?.addEnabled,o=n.enabled&&s;return{attributes:o&&n.attributes,enabled:o,geometry:o&&n.geometry&&i(a,l),attachments:{enabled:e.enabled&&o&&!1!==r?.attachmentsOnCreateEnabled},reliesOnOwnerAdminPrivileges:n.reliesOnOwnerAdminPrivileges}}get defaults(){return new a({layer:this.layer})}get delete(){const{defaults:e,layerInfo:t}=this,r=e.delete,a=!1!==t?.enabled&&!1!==t?.deleteEnabled;return{enabled:r.enabled&&a,reliesOnOwnerAdminPrivileges:r.reliesOnOwnerAdminPrivileges}}get formTemplate(){const{layer:e,layerInfo:t}=this;return t?.formTemplate?t.formTemplate:e&&"formTemplate"in e?e.formTemplate:null}get relationship(){const{layer:e}=this,t=!(!n(e)||!e.relationships?.length),r=!!this.formTemplate?.elements?.some(e=>"relationship"===e.type);return{enabled:t&&r}}get update(){const{attachments:e,defaults:t,layerInfo:r,layer:a,layerView:l}=this,n=t.update,s=!1!==r?.enabled&&!1!==r?.updateEnabled,o=n.enabled&&s,d=o&&n.attributes&&!1!==r?.attributeUpdatesEnabled,p=o&&n.geometry&&!1!==r?.geometryUpdatesEnabled&&i(a,l),m=e.enabled&&!1!==r?.attachmentsOnUpdateEnabled;return{attributes:d,enabled:o,geometry:p,attachments:{enabled:m,create:m&&n.attachments.create,update:m&&n.attachments.update},reliesOnOwnerAdminPrivileges:n.reliesOnOwnerAdminPrivileges}}};function i(e,t){return"scene"!==e.type||null!=t&&"type"in t&&"scene-layer-3d"===t.type&&l(e,t)}e([t()],s.prototype,"attachments",null),e([t()],s.prototype,"create",null),e([t()],s.prototype,"defaults",null),e([t()],s.prototype,"delete",null),e([t()],s.prototype,"formTemplate",null),e([t()],s.prototype,"layerInfo",void 0),e([t()],s.prototype,"layerView",void 0),e([t()],s.prototype,"relationship",null),e([t()],s.prototype,"update",null),s=e([r("esri.widgets.Editor.support.EditorEditingCapabilities")],s);const o=s;export{o as default};
