import r from"@arcgis/core/symbols/CIMSymbol";import e from"@arcgis/core/symbols/LabelSymbol3D";import o from"@arcgis/core/symbols/LineSymbol3D";import s from"@arcgis/core/symbols/MeshSymbol3D";import i from"@arcgis/core/symbols/PictureFillSymbol";import l from"@arcgis/core/symbols/PictureMarkerSymbol";import m from"@arcgis/core/symbols/PointSymbol3D";import t from"@arcgis/core/symbols/PolygonSymbol3D";import n from"@arcgis/core/symbols/SimpleFillSymbol";import c from"@arcgis/core/symbols/SimpleLineSymbol";import y from"@arcgis/core/symbols/SimpleMarkerSymbol";import S from"@arcgis/core/symbols/TextSymbol";import{assertNever as a}from"../utilities/checkArg.js";import{isIconSymbol3DLayer as b,isLineSymbol3D as u,isMeshSymbol3D as f,isObjectSymbol3DLayer as p,isPictureFillSymbol as g,isPictureMarkerSymbol as D,isPointSymbol3D as d,isPolygonSymbol3D as h,isSymbol as M}from"../utilities/symbol.js";export function toEsriApiSymbol(a){if(a){if(M(a))return a;switch(a.type){case"esriSMS":return y.fromJSON(a);case"esriSLS":return c.fromJSON(a);case"esriSFS":return n.fromJSON(a);case"esriPMS":return l.fromJSON(a);case"esriPFS":return i.fromJSON(a);case"esriTS":return S.fromJSON(a);case"MeshSymbol3D":return s.fromJSON(a);case"PointSymbol3D":return m.fromJSON(a);case"LineSymbol3D":return o.fromJSON(a);case"PolygonSymbol3D":return t.fromJSON(a);case"LabelSymbol3D":return e.fromJSON(a);case"CIMSymbolReference":return r.fromJSON(a);default:throw new Error("Unrecognized symbol type.")}}}export function fromEsriApiSymbol(r){const e=r.toJSON();return!D(r)&&!g(r)||e.imageData?(d(r)||u(r)||h(r)||f(r))&&r.styleOrigin?.styleUrl?e.styleOrigin.styleUrl=r.styleOrigin.styleUrl:r.symbolLayers&&r.symbolLayers.forEach(((r,o)=>{(b(r)||p(r))&&r.resource?.href&&(e.symbolLayers[o].resource.href=r.resource.href)})):e.url=r.url??void 0,e}export var SymbolType;function O(r,e){const o=r;switch(o){case"simple-marker":return"esriSMS";case"simple-line":return"esriSLS";case"simple-fill":return"esriSFS";case"picture-marker":return"esriPMS";case"picture-fill":return"esriPFS";case"text":return"esriTS";case"label-3d":return"LabelSymbol3D";case"line-3d":return"LineSymbol3D";case"mesh-3d":return"MeshSymbol3D";case"point-3d":return"PointSymbol3D";case"polygon-3d":return"PolygonSymbol3D";case"web-style":return"styleSymbolReference";case"cim":return"CIMSymbolReference";default:return a(o,e)}}function P(r,e){const o=r;switch(o){case"esriSMS":return"simple-marker";case"esriSLS":return"simple-line";case"esriSFS":return"simple-fill";case"esriPMS":return"picture-marker";case"esriPFS":return"picture-fill";case"esriTS":return"text";case"LabelSymbol3D":return"label-3d";case"LineSymbol3D":return"line-3d";case"MeshSymbol3D":return"mesh-3d";case"PointSymbol3D":return"point-3d";case"PolygonSymbol3D":return"polygon-3d";case"styleSymbolReference":return"web-style";case"CIMSymbolReference":return"cim";default:return a(o,e)}}!function(r){r.fromEsriApiSymbolType=function(r){return!!P(r)?r:O(r,new Error("Unrecognized symbol type."))},r.toEsriApiSymbolType=function(r){return!!O(r)||"cim"===r||"shield-label-symbol"===r?r:P(r,new Error("Symbol.toEsriApiSymbolType: Unrecognized symbol type."))}}(SymbolType||(SymbolType={}));