import{isOpenStreetMapLayer as e}from"../utilities/_layers.js";import{checkArg as r}from"../utilities/checkArg.js";import{ERR_LAYER_TYPE_MISMATCH as t,applyLayerBaseToEsriApiLayer as a,applyBasemapLayerToEsriApiLayer as s,fromEsriApiLayerToLayerBase as i}from"./_layerHelper.js";export var OpenStreetMapLayer;!function(n){async function p(i,n){r("layerJson",i).isNotMissing();const p=i.layerType||i.type;r("layerJson.layerType",p).satisfies((e=>!e||"OpenStreetMap"===e),t),r("layer",n).isNotMissing().satisfies(e,t),a(i,n),s(i,n)}n.esriOpenStreetMapLayerDefaults={legendEnabled:!0,visible:!0,opacity:1,minScale:0,maxScale:0},n.toEsriApiLayer=async function(e){r("layerJson",e).isNotMissing();const a=e.layerType||e.type;r("layerJson.layerType",a).satisfies((e=>!e||"OpenStreetMap"===e),t);const s=new((await import("@arcgis/core/layers/OpenStreetMapLayer")).default);return await p(e,s),s},n.applyToEsriApiLayer=p,n.fromEsriApiOpenStreetMapLayer=function(e){r("layer",e).isNotMissing();const t={...i(e,n.esriOpenStreetMapLayerDefaults),layerType:"OpenStreetMap"};return delete t.showLegend,t}}(OpenStreetMapLayer||(OpenStreetMapLayer={}));