/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import o from"../../Color.js";import{createThemes as a,getRawSchemes as i,getThemesforBasemap as t}from"./support/symbologyUtils.js";import{toWorldScale as r}from"./support/utils.js";const e=[128,128,128,1],n=[128,128,128,1],c="4px",l="40px",p={primary:{color:[227,139,79,1],noDataColor:e,outline:{color:[255,255,255,.25],width:"1px"},noDataSize:"4px",size:"12px",minSize:c,maxSize:l,opacity:.8},secondary:[{color:[128,128,128,1],noDataColor:e,outline:{color:[255,255,255,.25],width:"1px"},noDataSize:"4px",size:"12px",minSize:c,maxSize:l,opacity:.8},{color:[255,255,255,1],noDataColor:e,outline:{color:[128,128,128,.25],width:"1px"},noDataSize:"4px",size:"12px",minSize:c,maxSize:l,opacity:.8}]},m={primary:{color:[227,139,79,1],noDataColor:n,outline:{color:[92,92,92,.25],width:"1px"},noDataSize:"4px",size:"12px",minSize:c,maxSize:l,opacity:.8},secondary:[{color:[178,178,178,1],noDataColor:n,outline:{color:[92,92,92,.25],width:"1px"},noDataSize:"4px",size:"12px",minSize:c,maxSize:l,opacity:.8},{color:[26,26,26,1],noDataColor:n,outline:{color:[128,128,128,.25],width:"1px"},noDataSize:"4px",size:"12px",minSize:c,maxSize:l,opacity:.8}]},d=[0,0,0,0],h={color:d,outline:{color:[166,166,166,.25],width:"1px"}},y={color:d,outline:{color:[153,153,153,.25],width:"1px"}},u=a({themeDictionary:{default:{name:"default",label:"Default",description:"Default theme for visualizing features by varying their size to show data.",schemes:{point:{light:p,dark:m},polyline:{light:{primary:{color:[226,119,40,1],noDataColor:e,noDataWidth:"1px",width:"1px",minWidth:"1px",maxWidth:"18px"},secondary:[{color:[77,77,77,1],noDataColor:e,noDataWidth:"1px",width:"1px",minWidth:"1px",maxWidth:"18px"},{color:[153,153,153,1],noDataColor:e,noDataWidth:"1px",width:"1px",minWidth:"1px",maxWidth:"18px"}]},dark:{primary:{color:[226,119,40,1],noDataColor:n,noDataWidth:"1px",width:"1px",minWidth:"1px",maxWidth:"18px"},secondary:[{color:[255,255,255,1],noDataColor:n,noDataWidth:"1px",width:"1px",minWidth:"1px",maxWidth:"18px"},{color:[153,153,153,1],noDataColor:n,noDataWidth:"1px",width:"1px",minWidth:"1px",maxWidth:"18px"}]}},polygon:{light:{primary:{marker:p.primary,background:y,opacity:p.primary.opacity},secondary:[{marker:p.secondary[0],background:y,opacity:p.secondary[0].opacity},{marker:p.secondary[1],background:y,opacity:p.secondary[1].opacity}]},dark:{primary:{marker:m.primary,background:h,opacity:m.primary.opacity},secondary:[{marker:m.secondary[0],background:h,opacity:m.secondary[0].opacity},{marker:m.secondary[1],background:h,opacity:m.secondary[1].opacity}]}}}}}});function s(o){return t(u,o)}function x(o){if("mesh"===o.geometryType)return null;const a="default",t=i({basemap:o.basemap,geometryType:o.geometryType,basemapTheme:o.basemapTheme,theme:u.get(a)});if(!t)return;const{schemesInfo:r,basemapId:e,basemapTheme:n}=t;return{primaryScheme:z(o,r.primary),secondarySchemes:r.secondary.map(a=>z(o,a)).filter(Boolean),basemapId:e,basemapTheme:n}}function D(a){if(!a)return;const i={...a};return"color"in i&&i.color&&(i.color=new o(i.color)),"noDataColor"in i&&i.noDataColor&&(i.noDataColor=new o(i.noDataColor)),"outline"in i&&i.outline&&(i.outline={color:i.outline.color&&new o(i.outline.color),width:i.outline.width}),"marker"in i&&i.marker&&(i.marker=D(i.marker)),"background"in i&&i.background&&(i.background=D(i.background)),i}function z(o,a){const i="mesh"!==o.geometryType&&o.worldScale?o.view:null;switch(o.geometryType){case"point":case"multipoint":{const o=a;return w({color:o.color,noDataColor:o.noDataColor,outline:o.outline,size:o.size,noDataSize:o.noDataSize,minSize:o.minSize,maxSize:o.maxSize,opacity:o.opacity||1},i)}case"polyline":{const o=a;return S({color:o.color,noDataColor:o.noDataColor,width:o.width,noDataWidth:o.noDataWidth,minWidth:o.minWidth,maxWidth:o.maxWidth},i)}case"polygon":{const o=a,t=o.marker;return delete t.opacity,k({marker:t,background:o.background,opacity:o.opacity||1},i)}}}function w(a,i){return{color:new o(a.color),noDataColor:new o(a.noDataColor),outline:{color:new o(a.outline.color),width:a.outline.width},size:i?r(a.size,i):a.size,noDataSize:i?r(a.noDataSize,i):a.noDataSize,minSize:i?r(a.minSize,i):a.minSize,maxSize:i?r(a.maxSize,i):a.maxSize,opacity:a.opacity}}function S(a,i){return{color:new o(a.color),noDataColor:new o(a.noDataColor),width:i?r(a.width,i):a.width,noDataWidth:i?r(a.noDataWidth,i):a.noDataWidth,minWidth:i?r(a.minWidth,i):a.minWidth,maxWidth:i?r(a.maxWidth,i):a.maxWidth,opacity:1}}function k(a,i){const t=w(a.marker,i);delete t.opacity;return{marker:t,background:{color:new o(a.background.color),outline:{color:new o(a.background.outline.color),width:a.background.outline.width}},opacity:a.opacity}}export{D as cloneScheme,x as getSchemes,s as getThemes};
