/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r,subclass as s}from"../../../core/accessorSupport/decorators.js";import{isTable as l}from"../../../layers/support/layerUtils.js";import o from"./EditorEditingCapabilities.js";import{isMergeableGeometryType as i}from"./mergeFeaturesUtils.js";import{isSplittableGeometryType as a}from"./splitFeatureUtils.js";import{formTemplateHasInvalidFields as p}from"../../FeatureForm/featureFormUtils.js";let u=class extends t{constructor(e){super(e),this.disabled=!1,this.layer=null,this.layerInfo=null,this.layerView=null}get _suspended(){return!!this.layerView?.suspended}get capabilities(){return new o({layer:this.layer,layerInfo:this.layerInfo,layerView:this.layerView})}get editable(){const{create:e,relationship:t,update:r,delete:{enabled:s}}=this.capabilities,l=e.attachments.enabled||r.attachments.enabled;return!this.disabled&&(e.enabled||r.enabled||l||s||t.enabled)}get formTemplate(){return this.capabilities.formTemplate}get hasInvalidFormTemplate(){return p(this.layer,this.formTemplate)}get isTable(){return l(this.layer)}get supportedCurveTypes(){return this.capabilities.supportedCurveTypes}get supportsCreateFeaturesWorkflow(){if(this.disabled)return!1;const{enabled:e,geometry:t}=this.capabilities.create;return this.isTable?e:e&&t}get supportsGlobalIds(){return this.capabilities.supportsGlobalIds}get supportsMergeFeaturesWorkflow(){const{capabilities:e,layer:t}=this;return!this.disabled&&e.update.enabled&&e.update.geometry&&e.delete.enabled&&!l(t)&&i(t.geometryType)}get supportsSplitFeatureWorkflow(){const{capabilities:e}=this;return!this.disabled&&e.update.enabled&&e.update.geometry&&e.create.enabled&&a(this.layer.geometryType)}get supportsUpdateWorkflow(){const{capabilities:e}=this;return!this.disabled&&(e.update.enabled||e.update.attachments.enabled||e.delete.enabled)}get visible(){const{layer:e}=this,t=e.parent;return!this._suspended&&e.visible&&(!t||!("visible"in t)||t.visible)}};e([r()],u.prototype,"_suspended",null),e([r()],u.prototype,"capabilities",null),e([r()],u.prototype,"disabled",void 0),e([r()],u.prototype,"editable",null),e([r()],u.prototype,"formTemplate",null),e([r()],u.prototype,"hasInvalidFormTemplate",null),e([r()],u.prototype,"isTable",null),e([r()],u.prototype,"layer",void 0),e([r()],u.prototype,"layerInfo",void 0),e([r()],u.prototype,"layerView",void 0),e([r()],u.prototype,"supportedCurveTypes",null),e([r()],u.prototype,"supportsCreateFeaturesWorkflow",null),e([r()],u.prototype,"supportsGlobalIds",null),e([r()],u.prototype,"supportsMergeFeaturesWorkflow",null),e([r()],u.prototype,"supportsSplitFeatureWorkflow",null),e([r()],u.prototype,"supportsUpdateWorkflow",null),e([r()],u.prototype,"visible",null),u=e([s("esri.widgets.Editor.support.EditorItem")],u);const n=u;export{n as default};
