thematic-earth
Version:
HTML-based, whole-Earth thematic maps using locally hosted data layers
2 lines • 24.9 kB
JavaScript
/* Copyright (c) 2023 Read Write Tools. Legal use subject to the Thematic Earth Software License Agreement. */
import FT from'../enum/feature-type.enum.js';import SS from'../enum/symbol-specifier-type.enum.js';import*as TessGrammar from'../tess/tess-grammar.js';import*as MapScale from'../projection/map-scale.js';import TessDefaults from'../tess/tess-defaults.js';import expect from'../dev/expect.js';import vartype from'../dev/vartype.js';import terminal from'../dev/terminal.js';export function isSpelledCorrectly(e){return!!TessGrammar.readOnlyProperties.includes(e)||TessGrammar.allProperties.includes(e)}export function checkPropertyName(e,s,a){var o=isValidPropertyName(s,a);return o||validationMessage(`${e} { ${a} } unsupported ${s} property`),o}export function isValidPropertyName(e,s){if(TessGrammar.readOnlyProperties.includes(s))return!0;switch(e){case FT.POINT:return TessGrammar.validPointProperties.includes(s);case FT.LINE:return TessGrammar.validLineProperties.includes(s);case FT.POLYGON:return TessGrammar.validPolygonProperties.includes(s);case FT.LABEL:return TessGrammar.validLabelProperties.includes(s);case FT.SPHERE:return TessGrammar.validSphereProperties.includes(s);case FT.SPACE:return TessGrammar.validSpaceProperties.includes(s);default:return terminal.abnormal(`Unexpected featureType ${e}`),!1}}export const lookupTable={visibility:['hidden','visible'],'deep-space':['hidden','visible'],'earth-glow':['hidden','visible'],sunrise:['hidden','visible'],'symbol-type':['circle','triangle','rhombus','pentagon','hexagon','polygon','diamond','trigram','shuriken','pentagram','hexagram','star','crosshair','x-mark','unicode'],'sb-symbol-type':['circle','triangle','rhombus','pentagon','hexagon','polygon','diamond','trigram','shuriken','pentagram','hexagram','star','crosshair','x-mark','unicode'],'fp-symbol-type':['circle','triangle','rhombus','pentagon','hexagon','polygon','diamond','trigram','shuriken','pentagram','hexagram','star','crosshair','x-mark','unicode'],'stroke-type':['solid','dots','short-dash','dash','long-dash','dot-dash','dot-dot-dash','dot-dot-dot-dash','dot-dash-dot','spaced-ticks'],'over-stroke-type':['solid','dots','short-dash','dash','long-dash','dot-dash','dot-dot-dash','dot-dot-dot-dash','dot-dash-dot','spaced-ticks'],'sb-hatch-stroke-type':['solid','dots','short-dash','dash','long-dash','dot-dash','dot-dot-dash','dot-dot-dot-dash','dot-dash-dot'],'fp-hatch-stroke-type':['solid','dots','short-dash','dash','long-dash','dot-dash','dot-dot-dash','dot-dot-dot-dash','dot-dash-dot'],'sb-crosshatch-stroke-type':['solid','dots','short-dash','dash','long-dash','dot-dash','dot-dot-dash','dot-dot-dot-dash','dot-dash-dot'],'fp-crosshatch-stroke-type':['solid','dots','short-dash','dash','long-dash','dot-dash','dot-dot-dash','dot-dot-dot-dash','dot-dash-dot'],'fill-composition':['source-over','source-in','source-out','source-atop','destination-over','destination-in','destination-out','destination-atop','lighter','copy','xor','multiply','screen','overlay','darken','lighten','color-dodge','color-burn','hard-light','soft-light','difference','exclusion','hue','saturation','color','luminosity'],'fill-gradient':['none','horizontal','vertical','diagonal','radial'],'sb-symbol-repeat':['grid','offset','random'],'fp-symbol-repeat':['grid','offset','random'],'sb-hatch-stroke-direction':['horizontal','diagonal','vertical','reverse-diagonal','0','45','90','135'],'fp-hatch-stroke-direction':['horizontal','diagonal','vertical','reverse-diagonal','0','45','90','135'],'sb-crosshatch-stroke-direction':['horizontal','diagonal','vertical','reverse-diagonal','0','45','90','135'],'fp-crosshatch-stroke-direction':['horizontal','diagonal','vertical','reverse-diagonal','0','45','90','135'],'sb-symbol-stroke-alignment':['inside','overline','outside'],'sb-hatch-stroke-alignment':['inside','overline','outside'],'sb-crosshatch-stroke-alignment':['inside','overline','outside'],'label-position':['NW','N','NE','W','C','E','SW','S','SE'],'label-orientation':['horizontal','diagonal','curved'],'label-font-style':['normal','italic','oblique'],'label-font-variant':['normal','small-caps','all-small-caps','petite-caps','all-petite-caps','unicase','titling-caps'],'label-font-weight':['100','200','300','400','normal','500','600','700','bold','800','900'],'label-font-stretch':['ultra-condensed','extra-condensed','condensed','semi-condensed','normal','semi-expanded','expanded','extra-expanded','ultra-expanded','50%','62.5%','75%','87.5%','100%','112.5%','125%','150%','200%'],'label-debug-alt-positions':['show','hide'],'label-debug-alt-curves':['show','hide'],'label-debug-alt-slots':['show','hide']};export const multiTable={'stroke-brush':['none','symbol','hatch','crosshatch'],'fill-pattern':['none','symbol','hatch','crosshatch']};export const colorTable=['symbol-stroke-color','symbol-fill-color','stroke-color','over-stroke-color','sb-symbol-stroke-color','sb-symbol-fill-color','sb-symbol-background-color','sb-hatch-stroke-color','sb-hatch-background-color','sb-crosshatch-stroke-color','sb-crosshatch-background-color','fill-color','fp-symbol-stroke-color','fp-symbol-fill-color','fp-symbol-background-color','fp-hatch-stroke-color','fp-hatch-background-color','fp-crosshatch-stroke-color','fp-crosshatch-background-color','label-fill-color','label-stroke-color','label-shadow-color','deep-space-color','deep-space-star-color','earth-glow-inner-color','earth-glow-outer-color','sunrise-inner-color','sunrise-outer-color'];export const numberTable={'symbol-size':{min:1,step:1},'symbol-inner-size':{min:1,step:1},'sb-symbol-size':{min:1,step:1},'sb-symbol-inner-size':{min:1,step:1},'fp-symbol-size':{min:1,step:1},'label-shadow-blur':{min:0,step:1},'label-letter-spacing':{min:0,step:1},'label-word-spacing':{min:0,step:1},'sb-symbol-thickness':{min:4,step:4},'sb-hatch-thickness':{min:4,step:4},'sb-crosshatch-thickness':{min:4,step:4},'earth-glow-size':{min:0,step:5},'earth-glow-offset':{min:0,step:5},'sunrise-inner-radius':{min:0,step:4},'sunrise-outer-radius':{min:0,step:4},'symbol-stroke-width':{min:0,step:.5},'stroke-width':{min:0,step:.5},'over-stroke-width':{min:0,step:.5},'sb-symbol-stroke-width':{min:0,step:.5},'fp-symbol-stroke-width':{min:0,step:.5},'sb-hatch-stroke-width':{min:0,step:.5},'fp-hatch-stroke-width':{min:0,step:.5},'sb-crosshatch-stroke-width':{min:0,step:.5},'fp-crosshatch-stroke-width':{min:0,step:.5},'label-stroke-width':{min:0,step:.5}};export const rangeTable={transparency:{min:0,max:1,step:.1},'sb-symbol-spacing':{min:1,max:100,step:1,special:'or the keyword "auto"'},'fp-symbol-spacing':{min:1,max:100,step:1,special:'or the keyword "auto"'},'sb-hatch-stroke-spacing':{min:1,max:100,step:1,special:'or the keyword "auto"'},'sb-crosshatch-stroke-spacing':{min:1,max:100,step:1,special:'or the keyword "auto"'},'fp-hatch-stroke-spacing':{min:1,max:100,step:1,special:'or the keyword "auto"'},'fp-crosshatch-stroke-spacing':{min:1,max:100,step:1,special:'or the keyword "auto"'},'fg-saturation':{min:0,max:200,step:10,special:'or the keywords "none" or "auto"'},'fg-brightness':{min:0,max:200,step:10,special:'or the keywords "none" or "auto"'},'fg-transparency':{min:0,max:200,step:10,special:'or the keywords "none" or "auto"'},'symbol-node-count':{min:2,max:12,step:1},'sb-symbol-node-count':{min:2,max:12,step:1},'fp-symbol-node-count':{min:2,max:12,step:1},'label-offset':{min:0,max:24,step:1,special:'or the keywords "none" or "auto"'},'label-shadow-offset-x':{min:-10,max:10,step:.5},'label-shadow-offset-y':{min:-10,max:10,step:.5},'label-font-size':{min:6,max:72,step:2},'deep-space-star-count':{min:0,max:5e3,step:50},'earth-glow-axis':{min:0,max:360,step:5}};export const mapScaleTable={'map-basis':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-labels-low':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-labels-high':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-strokes-low':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-strokes-high':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-symbols-low':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-symbols-high':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-labels-begin':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-labels-end':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-strokes-begin':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-strokes-end':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-symbols-begin':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE},'map-symbols-end':{min:MapScale.MIN_MAP_SCALE,max:MapScale.MAX_MAP_SCALE}};export const fallbackTable={'map-labels-low':'map-basis','map-labels-high':'map-labels-low','map-strokes-low':'map-basis','map-strokes-high':'map-strokes-low','map-symbols-low':'map-basis','map-symbols-high':'map-symbols-low','map-labels-begin':'map-labels-low','map-labels-end':'map-labels-high','map-strokes-begin':'map-strokes-low','map-strokes-end':'map-strokes-high','map-symbols-begin':'map-symbols-low','map-symbols-end':'map-symbols-high'};export function getDefaultValue(e){return expect(TessDefaults[e],'String'),TessDefaults[e]??''}export function getSymbolSpecifierType(e){return e in lookupTable||'label-feature-key'==e?SS.SELECT:e in multiTable?SS.MULTI:colorTable.includes(e)?SS.COLOR:e in numberTable?SS.NUMBER:e in rangeTable?SS.RANGE:e in mapScaleTable?SS.MAPSCALE:SS.TEXT}export function getPrerequisite(e,s){switch(s){case'symbol-inner-size':return['symbol-type',['star'],null];case'symbol-node-count':return['symbol-type',['star','polygon'],null];case'symbol-code-point':return['symbol-type',['unicode'],null];case'sb-symbol-type':case'sb-symbol-spacing':case'sb-symbol-repeat':case'sb-symbol-stroke-width':case'sb-symbol-size':case'sb-symbol-fill-color':case'sb-symbol-stroke-color':case'sb-symbol-background-color':case'sb-symbol-thickness':return['stroke-brush',['symbol'],null];case'sb-symbol-inner-size':return['sb-symbol-type',['star'],null];case'sb-symbol-node-count':return['sb-symbol-type',['star','polygon'],null];case'sb-symbol-code-point':return['sb-symbol-type',['unicode'],null];case'sb-hatch-stroke-type':return['sb-hatch-stroke-direction',null,['diagonal','reverse-diagonal','45','135']];case'sb-hatch-stroke-spacing':case'sb-hatch-stroke-direction':case'sb-hatch-stroke-width':case'sb-hatch-stroke-color':case'sb-hatch-background-color':case'sb-hatch-thickness':return['stroke-brush',['hatch'],null];case'sb-crosshatch-stroke-type':return['sb-crosshatch-stroke-direction',null,['diagonal','reverse-diagonal','45','135']];case'sb-crosshatch-stroke-spacing':case'sb-crosshatch-stroke-direction':case'sb-crosshatch-stroke-width':case'sb-crosshatch-stroke-color':case'sb-crosshatch-background-color':case'sb-crosshatch-thickness':return['stroke-brush',['crosshatch'],null];case'fp-symbol-type':case'fp-symbol-spacing':case'fp-symbol-repeat':case'fp-symbol-stroke-width':case'fp-symbol-size':case'fp-symbol-fill-color':case'fp-symbol-stroke-color':case'fp-symbol-background-color':return['fill-pattern',['symbol'],null];case'fp-symbol-inner-size':return['fp-symbol-type',['star'],null];case'fp-symbol-node-count':return['fp-symbol-type',['star','polygon'],null];case'fp-symbol-code-point':return['fp-symbol-type',['unicode'],null];case'fp-hatch-stroke-type':return['fp-hatch-stroke-direction',null,['diagonal','reverse-diagonal','45','135']];case'fp-hatch-stroke-spacing':case'fp-hatch-stroke-direction':case'fp-hatch-stroke-width':case'fp-hatch-stroke-color':case'fp-hatch-background-color':return['fill-pattern',['hatch'],null];case'fp-crosshatch-stroke-type':return['fp-crosshatch-stroke-direction',null,['diagonal','reverse-diagonal','45','135']];case'fp-crosshatch-stroke-spacing':case'fp-crosshatch-stroke-direction':case'fp-crosshatch-stroke-width':case'fp-crosshatch-stroke-color':case'fp-crosshatch-background-color':return['fill-pattern',['crosshatch'],null];case'fg-saturation':case'fg-brightness':case'fg-transparency':return['fill-gradient',null,['none']];case'label-fill-color':case'label-stroke-color':case'label-stroke-width':case'label-letter-spacing':case'label-word-spacing':case'label-shadow-color':case'label-font-family':case'label-font-size':case'label-font-weight':case'label-font-style':case'label-font-variant':case'label-font-stretch':return['label-feature-key',null,['none']];case'label-position':case'label-offset':return e==FT.POINT?'':['feature-type',['point'],null];case'label-orientation':return e==FT.LINE?'':['feature-type',['line'],null];case'label-shadow-blur':case'label-shadow-offset-x':case'label-shadow-offset-y':return['label-shadow-color',null,['none']];case'deep-space':case'earth-glow':case'sunrise':return e==FT.SPACE?'':['feature-type',['space'],null];case'deep-space-color':case'deep-space-star-count':case'deep-space-star-color':return['deep-space',['visible'],null];case'earth-glow-size':case'earth-glow-offset':case'earth-glow-axis':case'earth-glow-inner-color':case'earth-glow-outer-color':return['earth-glow',['visible'],null];case'sunrise-inner-radius':case'sunrise-outer-radius':case'sunrise-inner-color':case'sunrise-outer-color':return['sunrise',['visible'],null];default:return[null,null,null]}}export function checkForPrerequisite(e,s,a){expect(e,'String'),expect(s,'String'),expect(a,'CanvasParams');var[o,t,r]=getPrerequisite(e,s);if(null==o)return'';if('feature-type'==o)return`${s} is only allowed on ${t[0]} features`;var l=a[o];if(null==l)return`${s} has a prerequisite of ${o}, which is not defined`;if('Array'==l.constructor.name)for(let e=0;e<l.length;e++){if(null!=t&&t.includes(l[e]))return'';if(null!=r&&!r.includes(l[e]))return''}else{if(null!=t&&t.includes(l))return'';if(null!=r&&!r.includes(l))return''}return null!=t?1==t.length?`'${s}' is predicated on '${o}' having a value of '${t[0]}'`:`'${s}' is predicated on '${o}' having one of these values: ${t.join(', ')}`:null!=r?1==r.length?`'${s}' is predicated on '${o}' having a value other than '${r[0]}'`:`'${s}' is predicated on '${o}' having any value other than: ${r.join(', ')}`:void 0}export function checkScaleRequirements(e,s,a){switch(expect(e,'Layer'),expect(a,'CanvasParams'),s){case'map-labels-low':if(a['map-labels-low']>a['map-labels-high'])return'\'map-labels-low\' must be less than or equal to \'map-labels-high\'';if(a['map-labels-low']>a['map-basis'])return'\'map-labels-low\' must be less than or equal to \'map-basis\'';break;case'map-labels-high':if(a['map-labels-high']<a['map-labels-low'])return'\'map-labels-high\' must be greater than or equal to \'map-labels-low\'';if(a['map-labels-high']<a['map-basis'])return'\'map-labels-high\' must be greater than or equal to \'map-basis\'';break;case'map-labels-begin':if(a['map-labels-begin']>a['map-labels-low'])return'\'map-labels-begin\' should be less than or equal to \'map-labels-low\'';break;case'map-labels-end':if(a['map-labels-end']<a['map-labels-high'])return'\'map-labels-end\' should be greater than or equal to \'map-labels-high\'';break;case'map-strokes-low':if(a['map-strokes-low']>a['map-strokes-high'])return'\'map-strokes-low\' must be less than or equal to \'map-strokes-high\'';if(a['map-strokes-low']>a['map-basis'])return'\'map-strokes-low\' must be less than or equal to \'map-basis\'';break;case'map-strokes-high':if(a['map-strokes-high']<a['map-strokes-low'])return'\'map-strokes-high\' must be greater than or equal to \'map-strokes-low\'';if(a['map-strokes-high']<a['map-basis'])return'\'map-strokes-high\' must be greater than or equal to \'map-basis\'';break;case'map-strokes-begin':if(a['map-strokes-begin']>a['map-strokes-low'])return'\'map-strokes-begin\' should be less than or equal to \'map-strokes-low\'';break;case'map-strokes-end':if(a['map-strokes-end']<a['map-strokes-high'])return'\'map-strokes-end\' should be greater than or equal to \'map-strokes-high\'';break;case'map-symbols-low':if(a['map-symbols-low']>a['map-symbols-high'])return'\'map-symbols-low\' must be less than or equal to \'map-symbols-high\'';if(a['map-symbols-low']>a['map-basis'])return'\'map-symbols-low\' must be less than or equal to \'map-basis\'';break;case'map-symbols-high':if(a['map-symbols-high']<a['map-symbols-low'])return'\'map-symbols-high\' must be greater than or equal to \'map-symbols-low\'';if(a['map-symbols-high']<a['map-basis'])return'\'map-symbols-high\' must be greater than or equal to \'map-basis\'';break;case'map-symbols-begin':if(a['map-symbols-begin']>a['map-symbols-low'])return'\'map-symbols-begin\' should be less than or equal to \'map-symbols-low\'';break;case'map-symbols-end':if(a['map-symbols-end']<a['map-symbols-high'])return'\'map-symbols-end\' should be greater than or equal to \'map-symbols-high\''}return''}export function checkLabelRequirements(e,s,a){return expect(e,'Layer'),expect(a,'CanvasParams'),0==TessGrammar.labelProperties.includes(s)?'':0==e.isLabelable()?`'${s}' ignored because '${e.layerName}' layer has disabled labels.`:0==a.wantsLabel()?`'${s}' will be ineffective until 'label-fill-color' or 'label-stroke-width' + 'label-stroke-color' are defined`:''}export function isValidPropertyValue(e,s){if(expect(s,['Array','String','Number']),null==s)return`{ ${e} } unable to parse value`;switch(e){case'visibility':case'deep-space':case'earth-glow':case'sunrise':case'symbol-type':case'sb-symbol-type':case'fp-symbol-type':case'stroke-type':case'over-stroke-type':case'sb-hatch-stroke-type':case'fp-hatch-stroke-type':case'sb-crosshatch-stroke-type':case'fp-crosshatch-stroke-type':case'fill-composition':case'fill-gradient':case'sb-symbol-repeat':case'fp-symbol-repeat':case'sb-hatch-stroke-direction':case'fp-hatch-stroke-direction':case'sb-crosshatch-stroke-direction':case'fp-crosshatch-stroke-direction':case'sb-symbol-stroke-alignment':case'sb-hatch-stroke-alignment':case'sb-crosshatch-stroke-alignment':case'label-position':case'label-orientation':case'label-font-style':case'label-font-variant':case'label-font-weight':case'label-debug-alt-positions':case'label-debug-alt-curves':case'label-debug-alt-slots':return validateLookup(e,s);case'map-basis':case'map-labels-begin':case'map-labels-low':case'map-labels-high':case'map-labels-end':case'map-strokes-begin':case'map-strokes-low':case'map-strokes-high':case'map-strokes-end':case'map-symbols-begin':case'map-symbols-low':case'map-symbols-high':case'map-symbols-end':return validateMapScale(e,s);case'transparency':case'earth-glow-axis':case'symbol-node-count':case'sb-symbol-node-count':case'fp-symbol-node-count':case'label-shadow-offset-x':case'label-shadow-offset-y':case'deep-space-star-count':case'label-font-size':return validateRange(e,s);case'symbol-size':case'symbol-inner-size':case'sb-symbol-size':case'sb-symbol-inner-size':case'fp-symbol-size':case'fp-symbol-inner-size':case'earth-glow-size':case'earth-glow-offset':case'sunrise-inner-radius':case'sunrise-outer-radius':return validateNumber(e,s);case'label-letter-spacing':case'label-word-spacing':return validateInteger(e,s);case'label-shadow-blur':case'symbol-stroke-width':case'stroke-width':case'over-stroke-width':case'sb-symbol-stroke-width':case'fp-symbol-stroke-width':case'sb-hatch-stroke-width':case'fp-hatch-stroke-width':case'sb-crosshatch-stroke-width':case'fp-crosshatch-stroke-width':case'label-stroke-width':return validatePositiveNumberOrNone(e,s);case'fill-color':if(Array.isArray(s)){for(let o=0;o<s.length;o++){var a=validateColor(e,s[o]);if(''!=a)return a}return''}return validateColor(e,s);case'symbol-fill-color':case'sb-symbol-fill-color':case'fp-symbol-fill-color':case'symbol-stroke-color':case'sb-symbol-stroke-color':case'fp-symbol-stroke-color':case'sb-hatch-stroke-color':case'fp-hatch-stroke-color':case'sb-crosshatch-stroke-color':case'fp-crosshatch-stroke-color':case'sb-symbol-background-color':case'sb-hatch-background-color':case'sb-crosshatch-background-color':case'fp-symbol-background-color':case'fp-hatch-background-color':case'fp-crosshatch-background-color':case'stroke-color':case'over-stroke-color':case'label-stroke-color':case'label-fill-color':case'label-shadow-color':case'deep-space-color':case'deep-space-star-color':case'earth-glow-inner-color':case'earth-glow-outer-color':case'sunrise-inner-color':case'sunrise-outer-color':return validateColor(e,s);case'fg-saturation':case'fg-brightness':case'fg-transparency':return validateGradientSaturationBrightness(e,s);case'symbol-code-point':case'sb-symbol-code-point':case'fp-symbol-code-point':return validateSymbolCodePoint(e,s);case'stroke-brush':case'fill-pattern':return validateSymbolHatchCrosshatch(e,s);case'sb-symbol-spacing':case'fp-symbol-spacing':case'sb-hatch-stroke-spacing':case'fp-hatch-stroke-spacing':case'sb-crosshatch-stroke-spacing':case'fp-crosshatch-stroke-spacing':return validatePositiveNumberOrAuto(e,s);case'sb-symbol-thickness':case'sb-hatch-thickness':case'sb-crosshatch-thickness':return validatePositiveNumber(e,s);case'label-feature-key':return validateLabelFeatureKey(e,s);case'label-offset':return validatePositiveNumberOrAutoOrNone(e,s);case'label-font-stretch':return validateFontStretch(e,s);case'label-font-family':return validateFontFamily(e,s);case'scale-symbols-coefficient':case'scale-strokes-coefficient':case'scale-labels-coefficient':case'display-symbols-threshold':case'display-strokes-threshold':case'display-labels-threshold':case'unknown':return'';default:return`{ ${e}: ${s} } not handled by TESS Validator`}}export function checkPropertyValue(e,s,a){expect(a,['Array','String','Number']);var o=isValidPropertyValue(s,a);return''==o||(validationMessage(`${e} ${o}`),!1)}function validateLookup(e,s){var a=lookupTable[e];return a.includes(s.toString())?'':`{ ${e}: ${s} } expected to be one of [${a.join(', ')}]`}function validateRange(e,s){var a=Number.parseFloat(s),o=rangeTable[e];return'Number'!=vartype(a)?`{ ${e}: ${s} } expected a number`:a<o.min||a>o.max?`{ ${e}: ${s} } should be between ${o.min} and ${o.max}`:''}function validateMapScale(e,s){var a=Number.parseFloat(s),o=mapScaleTable[e];return'Number'!=vartype(a)?`{ ${e}: ${s} } expected a number`:a<o.min||a>o.max?`{ ${e}: ${s} } should be between ${o.min} and ${o.max}`:''}function validateNumber(e,s){return'Number'!=vartype(s)&&(s=Number.parseFloat(s),Number.isNaN(s))?`{ ${e}: ${s} } expected a number`:''}function validatePositiveNumber(e,s){return'Number'!=vartype(s)&&(s=Number.parseFloat(s),Number.isNaN(s))?`{ ${e}: ${s} } expected a number`:s<0?`{ ${e}: ${s} } expected a positive number`:''}function validatePositiveNumberOrNone(e,s){return'none'==s?'':validatePositiveNumber(e,s)}function validatePositiveNumberOrAuto(e,s){return'auto'==s?'':validatePositiveNumber(e,s)}function validatePositiveNumberOrAutoOrNone(e,s){return'auto'==s||'none'==s?'':validatePositiveNumber(e,s)}function validateInteger(e,s){return Number.isNaN(Number.parseInt(s))?`{ ${e}: ${s} } expected an integer`:''}function validateColor(e,s){if('String'!=s.constructor.name||-1==s.indexOf('#'))return'none'==s?'':`{ ${e}: ${s} } expected a color value in the form #rgb or #rrggbb or #rrggbbaa or the keyword 'none'`;let a=s.substr(1),o=a.length;return(3==o||6==o||8==o)&&parseInt(a,16).toString(16).padStart(o,'0')==a.toLowerCase()?'':`{ ${e}: ${s} } invalid color value`}function validateGradientSaturationBrightness(e,s){var a=rangeTable[e];if('String'==s.constructor.name){if('none'==s||'auto'==s)return'';if(s.indexOf('%')!=s.length-1)return`{ ${e}: ${s} } expected 'none', 'auto' or a percentage from ${a.min}% to ${a.max}%`;s=s.substr(0,s.length-1)}return s<0||s>200?`{ ${e}: ${s} } expected a number from ${a.min}% to ${a.max}%`:''}function validateSymbolCodePoint(e,s){return'String'!=s.constructor.name?`{ ${e}: ${s} } expects a single Unicode character`:1!=[...s].length?`{ ${e}: ${s} } use caution when specifying more than one Unicode character`:''}function validateSymbolHatchCrosshatch(e,s){expect(s,'Array');var a=multiTable[e];for(let o=0;o<s.length;o++){let t=s[o];if(s.length>1&&'none'==t)return`{ ${e}:${t} } 'none' should not be specified together with ['symbol','hatch','crosshatch']`;if(!a.includes(t))return`{ ${e}:${t} } expected to be 'none' or one or more of ['symbol','hatch','crosshatch'] (Hint: use parentheses when specifying more than one)`}return''}function validateLabelFeatureKey(e,s){return''}function validateFontStretch(e,s){var a=lookupTable[e];if(!a.includes(s)){var o=s.indexOf('%');if(-1==o)return`{ ${e}: ${s} } expected to be a percentage or one of [${a.join(', ')}]`;var t=Number(s.substr(0,o));if(t<50||t>200)return`{ ${e}: ${s} } expected to be a percentage from 50% to 200%`}return''}function validateFontFamily(e,s){return''}function validateShowHide(e,s){var a=lookupTable[e];return a.includes(s)?'':`{ ${e}: ${s} } expected to be one of [${a.join(', ')}]`}var numMsgs=0;function validationMessage(e){numMsgs<100?console.warn(e):100==numMsgs&&console.error('Additional validation messages suppressed'),numMsgs++}