/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../core/Collection.js";import{referenceSetter as t,castForReferenceSetter as o}from"../core/collectionUtils.js";import s from"../core/Logger.js";import{isAbsolute as l,normalize as i,hasSamePortal as a}from"../core/urlUtils.js";import m from"../core/Warning.js";import{property as y,cast as n,subclass as p}from"../core/accessorSupport/decorators.js";import c from"../portal/Portal.js";import{f as b,t as f}from"../chunks/persistableUrlUtils.js";import g from"./ExtrudeSymbol3DLayer.js";import u from"./FillSymbol3DLayer.js";import d from"./IconSymbol3DLayer.js";import j from"./LineSymbol3DLayer.js";import h from"./ObjectSymbol3DLayer.js";import S from"./PathSymbol3DLayer.js";import L from"./Symbol.js";import O from"./Symbol3DLayer.js";import U from"./TextSymbol3DLayer.js";import _ from"./WaterSymbol3DLayer.js";import D from"./support/StyleOrigin.js";import{Thumbnail as w}from"./support/Thumbnail.js";import{reader as N}from"../core/accessorSupport/decorators/reader.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";const v={icon:d,object:h,line:j,path:S,fill:u,extrude:g,text:U,water:_},C=r.ofType({base:O,key:"type",typeMap:v,errorContext:"symbol-layer"});let T=class extends L{constructor(e){super(e),this.styleOrigin=null,this.thumbnail=null,this.type=null;const t=this.__accessor__&&this.__accessor__.metadata&&this.__accessor__.metadata.symbolLayers,o=t?.type,s=o||r;this._set("symbolLayers",new s)}get color(){return null}set color(e){this.constructed&&s.getLogger(this).error("Symbol3D does not support colors on the symbol level. Colors may be set on individual symbol layer materials instead.")}set symbolLayers(e){t(e,this._get("symbolLayers"))}readStyleOrigin(e,r,t){if(e.styleUrl&&e.name){const r=b(e.styleUrl,t);return new D({styleUrl:r,name:e.name})}if(e.styleName&&e.name)return new D({portal:t?.portal||c.getDefault(),styleName:e.styleName,name:e.name});t?.messages&&t.messages.push(new m("symbol3d:incomplete-style-origin","Style origin requires either a 'styleUrl' or 'styleName' and a 'name' property",{context:t,definition:e}))}writeStyleOrigin(e,r,t,o){if(e.styleUrl&&e.name){let t=f(e.styleUrl,o);l(t)&&(t=i(t)),r.styleOrigin={styleUrl:t,name:e.name}}else e.styleName&&e.name&&(e.portal&&o?.portal&&!a(e.portal.restUrl,o.portal.restUrl)?o?.messages&&o.messages.push(new m("symbol:cross-portal","The symbol style origin cannot be persisted because it refers to an item on a different portal than the one being saved to.",{symbol:this})):r.styleOrigin={styleName:e.styleName,name:e.name})}normalizeCtorArgs(e){return e instanceof O||e&&v[e.type]?{symbolLayers:[e]}:Array.isArray(e)?{symbolLayers:e}:e}};e([y({json:{read:!1,write:!1}})],T.prototype,"color",null),e([y({type:C,nonNullable:!0,json:{write:!0}}),n(o)],T.prototype,"symbolLayers",null),e([y({type:D})],T.prototype,"styleOrigin",void 0),e([N("styleOrigin")],T.prototype,"readStyleOrigin",null),e([x("styleOrigin",{"styleOrigin.styleUrl":{type:String},"styleOrigin.styleName":{type:String},"styleOrigin.name":{type:String}})],T.prototype,"writeStyleOrigin",null),e([y({type:w,json:{read:!1}})],T.prototype,"thumbnail",void 0),e([y({type:["point-3d","line-3d","polygon-3d","mesh-3d","label-3d"],readOnly:!0})],T.prototype,"type",void 0),T=e([p("esri.symbols.Symbol3D")],T);export{T as default};
