/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import e from"../../Color.js";import{isSome as o}from"../../core/arrayUtils.js";import{createUniqueColors as r}from"../../core/colorUtils.js";import{cloneScheme as t,getSchemes as a}from"./size.js";import n from"./support/colors.js";import{createThemes as i,filterSchemesByName as s,getRawSchemes as m,filterSchemesByTag as c,getThemesforBasemap as l}from"./support/symbologyUtils.js";const p="#aaaaaa",d="25px",h={light:{color:[153,153,153,.25],width:"1px"},dark:{color:[153,153,153,.25],width:"1px"},darker:{color:[26,26,26,.25],width:"1px"}},u=["vibrant-rainbow","cat-dark","predominant-v2","predominant-v5","predominance-race","desert-blooms","tropical-bliss","under-the-sea","ocean-bay","cat-light","predominant-v4","predominance-money","predominant-v3","predominance-race-ethnic","pastel-chalk","predominance-rainbow","predominance-sequence","cat-popup-olympic-sunset"],y=i({themeDictionary:{default:{name:"default",label:"Default",description:"Default theme for visualizing features using a pie chart of categories.",schemes:{point:{light:{primary:"predominant-v1",secondary:u,common:{outline:h.light,colorForOthersCategory:p,size:d}},dark:{primary:"predominant-v2",secondary:u.map(e=>"predominant-v2"===e?"predominant-v1":e),common:{outline:h.darker,colorForOthersCategory:p,size:d}}},polygon:{light:{primary:"predominant-v1",secondary:u,common:{colorForOthersCategory:p,outline:h.light,size:d}},dark:{primary:"predominant-v2",secondary:u.map(e=>"predominant-v2"===e?"predominant-v1":e),common:{colorForOthersCategory:p,outline:h.dark,size:d}}}}}}});function g(e){return l(y,e)}function f(e){const r="default",t=m({basemap:e.basemap,basemapTheme:e.basemapTheme,geometryType:e.geometryType,theme:y.get(r)});if(!t)return;const{schemesInfo:n,basemapId:i,basemapTheme:s}=t,c=n.common,l=e.numColors,p=a({basemap:e.basemap,geometryType:e.geometryType}),d=p?.primaryScheme;return{primaryScheme:v(n.primary,c,l,d),secondarySchemes:n.secondary.map(e=>v(e,c,l,d)).filter(o),basemapId:i,basemapTheme:s}}function b(e){return s(e.name,f(e))}function z(e){return c(e.includedTags,e.excludedTags,f(e))}function w(o){if(!o)return;const r={...o};return r.tags=[...r.tags],r.colors&&(r.colors=r.colors.map(o=>new e(o))),r.colorForOthersCategory&&(r.colorForOthersCategory=new e(r.colorForOthersCategory)),r.outline&&(r.outline={color:r.outline.color&&new e(r.outline.color),width:r.outline.width}),"sizeScheme"in r&&r.sizeScheme&&(r.sizeScheme=t(r.sizeScheme)),r}function v(e,o,t,a){const i=n[e];if(!i)return;return C({name:i.name,tags:i.tags,colors:i[t]||r(i.stops,t),colorForOthersCategory:o.colorForOthersCategory,outline:o.outline,size:o.size,sizeScheme:a})}function C(o){return{name:o.name,tags:[...o.tags],colors:o.colors.map(o=>new e(o)),colorForOthersCategory:new e(o.colorForOthersCategory),outline:{color:new e(o.outline.color),width:o.outline.width},size:o.size,sizeScheme:o.sizeScheme}}export{w as cloneScheme,b as getSchemeByName,f as getSchemes,z as getSchemesByTag,g as getThemes};
