import{__decorate as e}from"tslib";import{DefaultArcGISRequestHelper as r}from"../support/ArcGISRequestHelper.js";import{serializable as t}from"../support/Serializable.js";import{isElevationLayer as a}from"../utilities/_layers.js";import{checkArg as i}from"../utilities/checkArg.js";import{LayerExtension as s,LayerExtensionSchema as l}from"./_LayerExtension.js";let o=class extends s{get layer(){return super.layer}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,layer:{...this._toPropertyDef(e.layer),default:{layerType:"ArcGISTiledElevationServiceLayer"}}}}get canChangeScale(){return!1}_isSupportedLayer(e){return a(e)}_createSchema(){return new n(this)}_applyLayerProperties(e,r){return i("layerJson",e).isNotMissing(),i("layerJson.layerType",e.layerType).satisfies((e=>!e||"ArcGISTiledElevationServiceLayer"===e)),i("layer",r).isNotMissing().satisfies(a),super._applyLayerProperties(e,r)}async _applyPortalItemProperties(e){if("Image Service"!==e.type)throw new Error(`Cannot create Elevation Layer from Portal item that has type: ${e.type}`);if("Elevation"!==(await s._getLayerData(e.url,new r)).cacheType)throw new Error("Cannot create Elevation Layer from Portal item that does not reference an Elevation layer");this.layer.url=e.url||this.layer.url}};o=e([t],o);export{o as ElevationLayerExtension};let n=class extends l{_getPropertyBindings(){return{spatialReference:{property:"spatialReference",readonly:!0}}}};n=e([t],n);