/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../geometry","../../core/Accessor","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../layers/support/LOD","./constraints/GeometryConstraint","./constraints/RotationConstraint","./constraints/ZoomConstraint","../../geometry/Extent","../../geometry/Polygon"],(function(o,e,t,r,n,i,a,s,c,p,l,y,m,_,u){"use strict";const d={base:null,key:"type",typeMap:{extent:_,polygon:u}};let f=function(e){function t(o){var t;return(t=e.call(this,o)||this).lods=null,t.minScale=0,t.maxScale=0,t.minZoom=-1,t.maxZoom=-1,t.rotationEnabled=!0,t.snapToZoom=!0,t}o._inheritsLoose(t,e);var r=t.prototype;return r.destroy=function(){this.view=null,this._set("_zoom",null),this._set("_rotation",null),this._set("_geometry",null)},r.canZoomInTo=function(o){const e=this.effectiveMaxScale;return 0===e||o>=e},r.canZoomOutTo=function(o){const e=this.effectiveMinScale;return 0===e||o<=e},r.constrain=function(o,e){return this._zoom.constrain(o,e),this._rotation.constrain(o,e),this._geometry.constrain(o,e),o},r.constrainByGeometry=function(o){return this._geometry.constrain(o)},r.fit=function(o){return this._zoom.fit(o)},r.zoomToScale=function(o){return this._zoom.zoomToScale(o)},r.scaleToZoom=function(o){return this._zoom.scaleToZoom(o)},r.snapScale=function(o){return this._zoom.snapToClosestScale(o)},r.snapToNextScale=function(o){return this._zoom.snapToNextScale(o)},r.snapToPreviousScale=function(o){return this._zoom.snapToPreviousScale(o)},o._createClass(t,[{key:"geometry",set:function(o){o?this._set("geometry",o):this._set("geometry",null)}},{key:"version",get:function(){var o;return this.commitProperty("_zoom"),this.commitProperty("_rotation"),this.commitProperty("_geometry"),(null!=(o=this._get("version"))?o:0)+1}},{key:"_defaultLODs",get:function(){var o,e,t;const r=null==(o=this.view)||null==(e=o.defaultsFromMap)?void 0:e.tileInfo,n=null==(t=this.view)?void 0:t.spatialReference;return r&&n&&r.spatialReference.equals(n)?r.lods:null}},{key:"_geometry",get:function(){var o;return new l.GeometryConstraint({geometry:this.geometry,spatialReference:null==(o=this.view)?void 0:o.spatialReference})}},{key:"_rotation",get:function(){return new y({rotationEnabled:this.rotationEnabled})}},{key:"_zoom",get:function(){const o=this._get("_zoom"),e=this.lods||this._defaultLODs,t=this.minZoom,r=this.maxZoom,n=this.minScale,i=this.maxScale,a=this.snapToZoom;return o&&o.lods===e&&o.minZoom===t&&o.maxZoom===r&&o.minScale===n&&o.maxScale===i&&o.snapToZoom===a?o:new m({lods:e,minZoom:t,maxZoom:r,minScale:n,maxScale:i,snapToZoom:a})}}]),t}(r);e.__decorate([n.property({readOnly:!0,aliasOf:"_zoom.effectiveLODs"})],f.prototype,"effectiveLODs",void 0),e.__decorate([n.property({readOnly:!0,aliasOf:"_zoom.effectiveMinScale"})],f.prototype,"effectiveMinScale",void 0),e.__decorate([n.property({readOnly:!0,aliasOf:"_zoom.effectiveMaxScale"})],f.prototype,"effectiveMaxScale",void 0),e.__decorate([n.property({readOnly:!0,aliasOf:"_zoom.effectiveMinZoom"})],f.prototype,"effectiveMinZoom",void 0),e.__decorate([n.property({readOnly:!0,aliasOf:"_zoom.effectiveMaxZoom"})],f.prototype,"effectiveMaxZoom",void 0),e.__decorate([n.property({types:d,value:null})],f.prototype,"geometry",null),e.__decorate([n.property({type:[p]})],f.prototype,"lods",void 0),e.__decorate([n.property()],f.prototype,"minScale",void 0),e.__decorate([n.property()],f.prototype,"maxScale",void 0),e.__decorate([n.property()],f.prototype,"minZoom",void 0),e.__decorate([n.property()],f.prototype,"maxZoom",void 0),e.__decorate([n.property()],f.prototype,"rotationEnabled",void 0),e.__decorate([n.property()],f.prototype,"snapToZoom",void 0),e.__decorate([n.property()],f.prototype,"view",void 0),e.__decorate([n.property({readOnly:!0})],f.prototype,"version",null),e.__decorate([n.property()],f.prototype,"_defaultLODs",null),e.__decorate([n.property({type:l.GeometryConstraint})],f.prototype,"_geometry",null),e.__decorate([n.property({type:y})],f.prototype,"_rotation",null),e.__decorate([n.property({readOnly:!0,type:m})],f.prototype,"_zoom",null),f=e.__decorate([c.subclass("esri.views.2d.MapViewConstraints")],f);return f}));
