/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../chunks/tslib.es6","../../core/Error","../../core/urlUtils","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass","../../core/accessorSupport/decorators/writer","../../core/accessorSupport/read","../../core/accessorSupport/write","./operationalLayers","../support/commonProperties"],(function(e,r,t,o,i,a,n,s,l,p,y,c,u,d,w){"use strict";const g=e=>{let n=function(e){function t(){var r;return(r=e.apply(this,arguments)||this).title=null,r}r._inheritsLoose(t,e);var a=t.prototype;return a.writeListMode=function(e,r,t,o){(o&&"ground"===o.layerContainerType||e&&u.willPropertyWrite(this,t,{},o))&&(r[t]=e)},a.writeOperationalLayerType=function(e,r,t,o){!e||o&&"tables"===o.layerContainerType||(r.layerType=e)},a.writeTitle=function(e,r){r.title=e||"Layer"},a.read=function(r,t){t&&(t.layer=this),c.readLoadable(this,r,(t=>e.prototype.read.call(this,r,t)),t)},a.write=function(r,t){if(null!=t&&t.origin){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`,r=d.supportedTypes[e];let i=r&&r[this.operationalLayerType];var a;if("ArcGISTiledElevationServiceLayer"===this.operationalLayerType&&"web-scene/operational-layers"===e&&(i=!1),!i)return null==(a=t.messages)||a.push(new o("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this})),null}const n=e.prototype.write.call(this,r,{...t,layer:this}),s=!!t&&!!t.messages&&!!t.messages.filter((e=>e instanceof o&&"web-document-write:property-required"===e.name)).length;var l;return i.isBlobProtocol(null==n?void 0:n.url)?(null==t||null==(l=t.messages)||l.push(new o("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:n},a.beforeSave=function(){},t}(e);return t.__decorate([a.property({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],n.prototype,"id",void 0),t.__decorate([a.property(w.listMode)],n.prototype,"listMode",void 0),t.__decorate([y.writer("listMode")],n.prototype,"writeListMode",null),t.__decorate([a.property({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1}}}})],n.prototype,"operationalLayerType",void 0),t.__decorate([y.writer("operationalLayerType")],n.prototype,"writeOperationalLayerType",null),t.__decorate([a.property(w.opacity)],n.prototype,"opacity",void 0),t.__decorate([a.property({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],n.prototype,"title",void 0),t.__decorate([y.writer([void 0,"web-scene"],"title")],n.prototype,"writeTitle",null),t.__decorate([a.property({type:Boolean,json:{name:"visibility"}})],n.prototype,"visible",void 0),n=t.__decorate([p.subclass("esri.layers.mixins.OperationalLayer")],n),n};function h(e){return"operationalLayerType"in e}e.OperationalLayer=g,e.isOperationalLayer=h,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
