/*
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","../../../core/lang","../../../core/accessorSupport/decorators/property","../../../core/accessorSupport/decorators/cast","../../../core/accessorSupport/decorators/subclass","../../../core/accessorSupport/ensureType","./lightingUtils","./SceneViewAtmosphere","./SunLighting","./VirtualLighting","../../../webscene/Environment","../../../webscene/SunLighting","../../../webscene/VirtualLighting"],(function(e,t,n,i,r,s,g,o,h,c,l,a,p,u){"use strict";var b;let d=b=function(t){function i(e){var n;return(n=t.call(this,e)||this).atmosphere=new h.SceneViewAtmosphere,n.lighting=new c,n}e._inheritsLoose(i,t),i.fromWebsceneEnvironment=function(e){const t=e.cloneConstructProperties();return new b({...t,lighting:"virtual"===t.lighting.type?l.fromWebsceneLighting(t.lighting):c.fromWebsceneLighting(t.lighting)})};var r=i.prototype;return r.castLighting=function(e){return this._convertLighting(e)},r.applyLighting=function(e){this.lighting=this._convertLighting(e)},r._convertLighting=function(e){return e?e instanceof c||e instanceof l?e:e instanceof p?this.lighting&&"sun"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(e):new c(e.cloneConstructProperties()):e instanceof u?this.lighting&&"virtual"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(e):new l(e.cloneConstructProperties()):g.ensureOneOfType(o.lightingTypes,e):new c},r.clone=function(){return new b({lighting:this.lighting.clone(),atmosphere:this.atmosphere.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n.clone(this.background)})},r.cloneWithWebsceneEnvironment=function(e){return new b({atmosphere:this.atmosphere.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n.clone(this.background),...e.cloneConstructProperties(),lighting:this._getLighting(e)})},r._getLighting=function(e){return"sun"===e.lighting.type?this.lighting&&"sun"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(e.lighting):c.fromWebsceneLighting(e.lighting):"virtual"===e.lighting.type?this.lighting&&"virtual"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(e.lighting):l.fromWebsceneLighting(e.lighting):c.fromWebsceneLighting(e.lighting)},i}(a);t.__decorate([i.property({type:h.SceneViewAtmosphere,json:{read:!1},nonNullable:!0})],d.prototype,"atmosphere",void 0),t.__decorate([i.property({nonNullable:!0})],d.prototype,"lighting",void 0),t.__decorate([r.cast("lighting")],d.prototype,"castLighting",null),d=b=t.__decorate([s.subclass("esri.views.3d.environment.SceneViewEnvironment")],d);return d}));
