/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../engine/webgl/enums","../../engine/webgl/materialKey/MaterialKey"],(function(e,t,a){"use strict";function r(e){if("line-marker"===e.type){var t;return{type:"line-marker",color:null==(t=e.color)?void 0:t.toJSON(),placement:e.placement,style:e.style}}return e.constructor.fromJSON(e.toJSON()).toJSON()}function l(e){return a.hydrateMaterialKey(e)}function n(e,t,a){if(!e)return null;switch(e.type){case"simple-fill":case"picture-fill":return i(e,t,a);case"simple-marker":case"picture-marker":return y(e,t,a);case"simple-line":return s(e,t,a);case"text":return c(e,t,a);case"label":return o(e,t,a);case"cim":return{type:"cim",rendererKey:t.vvFlags,data:e.data,maxVVSize:t.maxVVSize};case"CIMSymbolReference":return{type:"cim",rendererKey:t.vvFlags,data:e,maxVVSize:t.maxVVSize};case"web-style":return{...r(e),type:"web-style",hash:e.hash(),rendererKey:t.vvFlags,maxVVSize:t.maxVVSize};default:throw new Error(`symbol not supported ${e.type}`)}}function o(e,r,n){const o=e.toJSON(),i=a.createMaterialKey(t.WGLGeometryType.LABEL,{...r,placement:o.labelPlacement});return{materialKey:n?l(i):i,hash:e.hash(),...o,labelPlacement:o.labelPlacement}}function i(e,n,o){const i=a.createMaterialKey(t.WGLGeometryType.FILL,n),s=o?l(i):i,y=e.clone(),c=y.outline,m=a.isOutlineFillSymbology(n.symbologyType);m||(y.outline=null);const u={materialKey:s,hash:y.hash(),...r(y)};if(m)return u;const h=[];if(h.push(u),c){const e=a.createMaterialKey(t.WGLGeometryType.LINE,{...n,isOutline:!0}),i={materialKey:o?l(e):e,hash:c.hash(),...r(c)};h.push(i)}return{type:"composite-symbol",layers:h,hash:h.reduce(((e,t)=>t.hash+e),"")}}function s(e,n,o){const i=a.isOutlineFillSymbology(n.symbologyType)?t.WGLSymbologyType.DEFAULT:n.symbologyType,s=a.createMaterialKey(t.WGLGeometryType.LINE,{...n,symbologyType:i}),y=o?l(s):s,c=e.clone(),m=c.marker;c.marker=null;const u=[];if(u.push({materialKey:y,hash:c.hash(),...r(c)}),m){var h;const e=a.createMaterialKey(t.WGLGeometryType.MARKER,n),i=o?l(e):e;m.color=null!=(h=m.color)?h:c.color,u.push({materialKey:i,hash:m.hash(),lineWidth:c.width,...r(m)})}return{type:"composite-symbol",layers:u,hash:u.reduce(((e,t)=>t.hash+e),"")}}function y(e,n,o){const i=a.createMaterialKey(t.WGLGeometryType.MARKER,n),s=o?l(i):i,y=r(e);return{materialKey:s,hash:e.hash(),...y,angle:e.angle,maxVVSize:n.maxVVSize}}function c(e,n,o){const i=a.createMaterialKey(t.WGLGeometryType.TEXT,n),s=o?l(i):i,y=r(e);return{materialKey:s,hash:e.hash(),...y,angle:e.angle,maxVVSize:n.maxVVSize}}e.createSymbolSchema=n,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
