/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../core/Collection","../core/collectionUtils","../core/Logger","../core/urlUtils","../core/Warning","../core/accessorSupport/decorators/property","../core/arrayUtils","../core/has","../core/accessorSupport/decorators/cast","../core/accessorSupport/decorators/reader","../core/accessorSupport/decorators/subclass","../core/accessorSupport/decorators/writer","../portal/Portal","../chunks/persistableUrlUtils","./ExtrudeSymbol3DLayer","./FillSymbol3DLayer","./IconSymbol3DLayer","./LineSymbol3DLayer","./ObjectSymbol3DLayer","./PathSymbol3DLayer","./Symbol","./Symbol3DLayer","./TextSymbol3DLayer","./WaterSymbol3DLayer","./support/StyleOrigin","./support/Thumbnail"],(function(e,r,t,o,s,l,a,n,y,i,c,p,m,u,b,d,g,_,S,h,f,L,O,U,D,w,N,v){"use strict";const k={icon:S,object:f,line:h,path:L,fill:_,extrude:g,text:D,water:w},x=t.ofType({base:U,key:"type",typeMap:k,errorContext:"symbol-layer"}),j=s.getLogger("esri.symbols.Symbol3D");let C=function(r){function s(e){var o;(o=r.call(this,e)||this).styleOrigin=null,o.thumbnail=null,o.type=null;const s=o.__accessor__&&o.__accessor__.metadatas&&o.__accessor__.metadatas.symbolLayers,l=s&&s.type||t;return o._set("symbolLayers",new l),o}e._inheritsLoose(s,r);var n=s.prototype;return n.readStyleOrigin=function(e,r,t){if(e.styleUrl&&e.name){const r=d.fromJSON(e.styleUrl,t);return new N({styleUrl:r,name:e.name})}if(e.styleName&&e.name)return new N({portal:t&&t.portal||b.getDefault(),styleName:e.styleName,name:e.name});t&&t.messages&&t.messages.push(new a("symbol3d:incomplete-style-origin","Style origin requires either a 'styleUrl' or 'styleName' and a 'name' property",{context:t,definition:e}))},n.writeStyleOrigin=function(e,r,t,o){if(e.styleUrl&&e.name){let t=d.toJSON(e.styleUrl,o);l.isAbsolute(t)&&(t=l.normalize(t)),r.styleOrigin={styleUrl:t,name:e.name}}else e.styleName&&e.name&&(e.portal&&o&&o.portal&&!l.hasSamePortal(e.portal.restUrl,o.portal.restUrl)?o&&o.messages&&o.messages.push(new a("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})},n.normalizeCtorArgs=function(e){return e instanceof U||e&&k[e.type]?{symbolLayers:[e]}:Array.isArray(e)?{symbolLayers:e}:e},e._createClass(s,[{key:"color",get:function(){return null},set:function(e){this.initialized&&j.error("Symbol3D does not support colors on the symbol level. Colors may be set on individual symbol layer materials instead.")}},{key:"symbolLayers",set:function(e){o.referenceSetter(e,this._get("symbolLayers"))}}]),s}(O);r.__decorate([n.property({json:{read:!1,write:!1}})],C.prototype,"color",null),r.__decorate([n.property({type:x,nonNullable:!0,json:{write:!0}}),c.cast(o.castForReferenceSetter)],C.prototype,"symbolLayers",null),r.__decorate([n.property({type:N})],C.prototype,"styleOrigin",void 0),r.__decorate([p.reader("styleOrigin")],C.prototype,"readStyleOrigin",null),r.__decorate([u.writer("styleOrigin",{"styleOrigin.styleUrl":{type:String},"styleOrigin.styleName":{type:String},"styleOrigin.name":{type:String}})],C.prototype,"writeStyleOrigin",null),r.__decorate([n.property({type:v.Thumbnail,json:{read:!1}})],C.prototype,"thumbnail",void 0),r.__decorate([n.property({type:["point-3d","line-3d","polygon-3d","mesh-3d","label-3d"],readOnly:!0})],C.prototype,"type",void 0),C=r.__decorate([m.subclass("esri.symbols.Symbol3D")],C);return C}));
