/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import i from"../../../core/Collection.js";import r from"../../../core/Logger.js";import s from"../../../core/ReactiveMap.js";import{property as o,subclass as n}from"../../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as a}from"../../../editing/templateUtils.js";import{hasCircularArc as l,isCurvedGeometry as p}from"../../../geometry/support/curves/curveUtils.js";import u from"../Edits.js";const d=()=>r.getLogger("esri.widgets.Editor.CreateFeaturesWorkflowData");let g=class extends t{constructor(e){super(e),this.creationInfo=null,this.editorItem=null,this.fullTemplate=null,this.parent=null,this.temporaryHighlightFeature=null,this.sketchOptions=null,this.snappingManager=null,this.templateExecutorInfo=null,this.viewModel=null,this.upload=null,this._pendingEdits=new s}get attachmentsModified(){return[...this._pendingEdits.values()].some(e=>e.attachmentsModified)}get curveResizeDisabled(){return this.hasCurves&&l(this.selectedPendingFeature?.geometry)&&!this.editorItem?.supportedCurveTypes.includes("elliptic-arc")}get curveUpdatesDisabled(){return this.hasCurves&&!1===this.editorItem?.capabilities.supportsTrueCurveUpdate}get hasCurves(){const e=this.selectedPendingFeature;return!(!e?.geometry||!p(e.geometry))}get isSharedTemplateWorkflow(){return!!this.fullTemplate&&a(this.fullTemplate)}get pendingFeatures(){return new i([...this._pendingEdits.keys()])}set selectedPendingFeature(e){this._set("selectedPendingFeature",e),this.temporaryHighlightFeature=null}set timeZone(e){this._set("timeZone",e),this._pendingEdits.forEach(t=>{t.timeZone=e})}isSubmittable(e){const t=this._pendingEdits.get(e);return!!t?.submittable||!!t?.isAssociation}isDisplayable(e){return!this._pendingEdits.get(e)?.isAssociation}addPendingFeature(e,t=e,i={isAssociation:!1}){this.temporaryHighlightFeature=null;const{_pendingEdits:r}=this;if(r.has(e))return r.get(e);e.sourceLayer||d().warn("source-layer-not-set","A feature added to `pendingFeatures` did not have `sourceLayer` set. This may cause problems throughout `CreateFeaturesWorkflow`.");const s=new u({feature:e,isAssociation:i.isAssociation});return s.trackChanges(t),r.set(e,s),s}getEditsForPendingFeature(e){return this._pendingEdits.get(e)}removePendingFeature(e){this.temporaryHighlightFeature=null;const{_pendingEdits:t}=this,i=t.get(e);i&&(i.destroy(),t.delete(e)),this.selectedPendingFeature===e&&(this.selectedPendingFeature=null)}getFeatureTitle(e){return this._pendingEdits.get(e)?.displayTitle}};e([o()],g.prototype,"attachmentsModified",null),e([o()],g.prototype,"creationInfo",void 0),e([o()],g.prototype,"curveResizeDisabled",null),e([o()],g.prototype,"curveUpdatesDisabled",null),e([o()],g.prototype,"editorItem",void 0),e([o()],g.prototype,"fullTemplate",void 0),e([o()],g.prototype,"hasCurves",null),e([o()],g.prototype,"isSharedTemplateWorkflow",null),e([o()],g.prototype,"parent",void 0),e([o()],g.prototype,"pendingFeatures",null),e([o()],g.prototype,"selectedPendingFeature",null),e([o()],g.prototype,"temporaryHighlightFeature",void 0),e([o({constructOnly:!0})],g.prototype,"sketchOptions",void 0),e([o()],g.prototype,"snappingManager",void 0),e([o()],g.prototype,"templateExecutorInfo",void 0),e([o()],g.prototype,"viewModel",void 0),e([o()],g.prototype,"upload",void 0),e([o()],g.prototype,"timeZone",null),g=e([n("esri.widgets.Editor.legacy.CreateFeaturesWorkflowData")],g);const h=g;export{h as default};
