/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as s}from"tslib";import t from"../../../core/Accessor.js";import e from"../../../core/Collection.js";import{property as o,subclass as i}from"../../../core/accessorSupport/decorators.js";import{LineSnapper as r}from"./LineSnapper.js";import{ParallelLineSnapper as n}from"./ParallelLineSnapper.js";import{RightAngleSnapper as p}from"./RightAngleSnapper.js";import{RightAngleTriangleSnapper as a}from"./RightAngleTriangleSnapper.js";import{sortCandidatesInPlace as m}from"./snappingUtils.js";import{GeometryWorkerHandle as h}from"../../support/GeometryWorkerHandle.js";let f=class extends t{constructor(s){super(s),this.updating=!1,this._measurementWorker=new h,this._snappers=new e,this._domain=2}initialize(){this._snappers.push(new n(this.view,this.options),new r(this.view,this.options,this._measurementWorker),new p(this.view,this.options,this._measurementWorker),new a(this.view,this.options))}destroy(){this._measurementWorker.destroy()}set options(s){this._set("options",s);for(const t of this._snappers)t.options=s}async fetchCandidates(s,t,e){if(!(t&this._domain)||!this.options.effectiveSelfEnabled||e.suppressSelfSnapping)return[];const o=[];for(const i of this._snappers.items)for(const t of await i.snap(s,e))o.push(t);return m(s,o),o}};s([o({readOnly:!0})],f.prototype,"updating",void 0),s([o({constructOnly:!0})],f.prototype,"view",void 0),s([o()],f.prototype,"options",null),f=s([i("esri.views.interactive.snapping.SelfSnappingEngine")],f);export{f as SelfSnappingEngine};
