/*
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","../../analysis/SliceAnalysis","../../core/maybe","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../support/AnalysisViewModel"],(function(e,t,s,o,r,n,i,a,l,c){"use strict";const u=new Set;let y=function(t){function r(s){var o;return(o=t.call(this,s)||this).analysis=null,o.supportedViewType="3d",o.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",u.add(e._assertThisInitialized(o)),o}e._inheritsLoose(r,t);var n=r.prototype;return n.destroy=function(){u.delete(this)},n.start=function(){var s=e._asyncToGenerator((function*(){yield t.prototype.start.call(this),u.forEach((e=>{e.view===this.view&&e!==this&&e.clear()})),o.isSome(this.analysisView)&&(this.analysisView.active=!0)}));function r(){return s.apply(this,arguments)}return r}(),n.enterExcludeLayerMode=function(){o.isSome(this.tool)&&this.tool.enterExcludeLayerMode()},n.exitExcludeLayerMode=function(){o.isSome(this.tool)&&this.tool.exitExcludeLayerMode()},n.onConnectToAnalysisView=function(e){e.active=!0},n.constructAnalysis=function(){return new s},e._createClass(r,[{key:"state",get:function(){return this.disabled||!this.ready?"disabled":o.isNone(this.tool)?"ready":this.tool.state}},{key:"shape",get:function(){return this.analysis.shape},set:function(e){this.analysis.shape=e}},{key:"tiltEnabled",get:function(){return this.analysis.tiltEnabled},set:function(e){this.analysis.tiltEnabled=e}},{key:"layersMode",get:function(){const e=o.applySome(this.tool,(e=>e.layersMode));return o.unwrapOr(e,"none")}},{key:"excludedLayers",get:function(){return this.analysis.excludedLayers},set:function(e){this.analysis.excludedLayers=e}},{key:"excludeGroundSurface",get:function(){return this.analysis.excludeGroundSurface},set:function(e){this.analysis.excludeGroundSurface=e}}]),r}(c.AnalysisViewModel);t.__decorate([r.property({type:s})],y.prototype,"analysis",void 0),t.__decorate([r.property({readOnly:!0})],y.prototype,"state",null),t.__decorate([r.property()],y.prototype,"shape",null),t.__decorate([r.property()],y.prototype,"tiltEnabled",null),t.__decorate([r.property()],y.prototype,"layersMode",null),t.__decorate([r.property()],y.prototype,"excludedLayers",null),t.__decorate([r.property({nonNullable:!0})],y.prototype,"excludeGroundSurface",null),y=t.__decorate([l.subclass("esri.widgets.Slice.SliceViewModel")],y);return y}));
