@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
1 lines • 58.1 kB
JavaScript
var __awaiter=this&&this.__awaiter||function(e,r,t,a){function n(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,o){function i(e){try{s(a.next(e))}catch(r){o(r)}}function l(e){try{s(a["throw"](e))}catch(r){o(r)}}function s(e){e.done?t(e.value):n(e.value).then(i,l)}s((a=a.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a,n,o,i;return i={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(r){return s([e,r])}}function s(i){if(a)throw new TypeError("Generator is already executing.");while(t)try{if(a=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:t.label++;return{value:i[1],done:false};case 5:t.label++;n=i[1];i=[0];continue;case 7:i=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){t=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){t.label=i[1];break}if(i[0]===6&&t.label<o[1]){t.label=o[1];o=i;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(i);break}if(o[2])t.ops.pop();t.trys.pop();continue}i=r.call(e,t)}catch(l){i=[6,l];n=0}finally{a=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r){for(var t=0,a=r.length,n=e.length;t<a;t++,n++)e[n]=r[t];return e};System.register(["./p-1720b7a7.system.js","./p-60d9e7d4.system.js","./p-a6b26bd1.system.js","./p-95dfb659.system.js","./p-53caa311.system.js","./p-2c235db8.system.js"],(function(e){"use strict";var r,t,a,n,o,i,l,s,c,h,u,d,v,f,p,m,g,b,y,w;return{setters:[function(e){r=e.r;t=e.c;a=e.h;n=e.g},function(e){o=e.f;i=e.g;l=e.C;s=e.a},function(e){c=e.n;h=e.C;u=e.p;d=e.c;v=e.i;f=e.a;p=e.r;m=e.h;g=e.b},function(e){b=e.g},function(e){y=e.d;w=e.i},function(){}],execute:function(){var C="Expected a function";function x(e,r,t){var a=true,n=true;if(typeof e!="function"){throw new TypeError(C)}if(w(t)){a="leading"in t?!!t.leading:a;n="trailing"in t?!!t.trailing:n}return y(e,r,{leading:a,maxWait:r,trailing:n})}function k(e,r,t){return t={path:r,exports:{},require:function(e,r){return S()}},e(t,t.exports),t.exports}function S(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};var D=function e(r){if(!r||typeof r==="string"){return false}return r instanceof Array||Array.isArray(r)||r.length>=0&&(r.splice instanceof Function||Object.getOwnPropertyDescriptor(r,r.length-1)&&r.constructor.name!=="String")};var F=k((function(e){var r=Array.prototype.concat;var t=Array.prototype.slice;var a=e.exports=function e(a){var n=[];for(var o=0,i=a.length;o<i;o++){var l=a[o];if(D(l)){n=r.call(n,t.call(l))}else{n.push(l)}}return n};a.wrap=function(e){return function(){return e(a(arguments))}}}));var A=k((function(e){var r={};for(var t in M){if(M.hasOwnProperty(t)){r[M[t]]=t}}var a=e.exports={to:{},get:{}};a.get=function(e){var r=e.substring(0,3).toLowerCase();var t;var n;switch(r){case"hsl":t=a.get.hsl(e);n="hsl";break;case"hwb":t=a.get.hwb(e);n="hwb";break;default:t=a.get.rgb(e);n="rgb";break}if(!t){return null}return{model:n,value:t}};a.get.rgb=function(e){if(!e){return null}var r=/^#([a-f0-9]{3,4})$/i;var t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i;var a=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;var o=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;var i=/(\D+)/;var l=[0,0,0,1];var s;var c;var h;if(s=e.match(t)){h=s[2];s=s[1];for(c=0;c<3;c++){var u=c*2;l[c]=parseInt(s.slice(u,u+2),16)}if(h){l[3]=parseInt(h,16)/255}}else if(s=e.match(r)){s=s[1];h=s[3];for(c=0;c<3;c++){l[c]=parseInt(s[c]+s[c],16)}if(h){l[3]=parseInt(h+h,16)/255}}else if(s=e.match(a)){for(c=0;c<3;c++){l[c]=parseInt(s[c+1],0)}if(s[4]){l[3]=parseFloat(s[4])}}else if(s=e.match(o)){for(c=0;c<3;c++){l[c]=Math.round(parseFloat(s[c+1])*2.55)}if(s[4]){l[3]=parseFloat(s[4])}}else if(s=e.match(i)){if(s[1]==="transparent"){return[0,0,0,0]}l=M[s[1]];if(!l){return null}l[3]=1;return l}else{return null}for(c=0;c<3;c++){l[c]=n(l[c],0,255)}l[3]=n(l[3],0,1);return l};a.get.hsl=function(e){if(!e){return null}var r=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;var t=e.match(r);if(t){var a=parseFloat(t[4]);var o=(parseFloat(t[1])+360)%360;var i=n(parseFloat(t[2]),0,100);var l=n(parseFloat(t[3]),0,100);var s=n(isNaN(a)?1:a,0,1);return[o,i,l,s]}return null};a.get.hwb=function(e){if(!e){return null}var r=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;var t=e.match(r);if(t){var a=parseFloat(t[4]);var o=(parseFloat(t[1])%360+360)%360;var i=n(parseFloat(t[2]),0,100);var l=n(parseFloat(t[3]),0,100);var s=n(isNaN(a)?1:a,0,1);return[o,i,l,s]}return null};a.to.hex=function(){var e=F(arguments);return"#"+o(e[0])+o(e[1])+o(e[2])+(e[3]<1?o(Math.round(e[3]*255)):"")};a.to.rgb=function(){var e=F(arguments);return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};a.to.rgb.percent=function(){var e=F(arguments);var r=Math.round(e[0]/255*100);var t=Math.round(e[1]/255*100);var a=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+r+"%, "+t+"%, "+a+"%)":"rgba("+r+"%, "+t+"%, "+a+"%, "+e[3]+")"};a.to.hsl=function(){var e=F(arguments);return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};a.to.hwb=function(){var e=F(arguments);var r="";if(e.length>=4&&e[3]!==1){r=", "+e[3]}return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+r+")"};a.to.keyword=function(e){return r[e.slice(0,3)]};function n(e,r,t){return Math.min(Math.max(r,e),t)}function o(e){var r=e.toString(16).toUpperCase();return r.length<2?"0"+r:r}}));var T=k((function(e){var r={};for(var t in M){if(M.hasOwnProperty(t)){r[M[t]]=t}}var a=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var n in a){if(a.hasOwnProperty(n)){if(!("channels"in a[n])){throw new Error("missing channels property: "+n)}if(!("labels"in a[n])){throw new Error("missing channel labels property: "+n)}if(a[n].labels.length!==a[n].channels){throw new Error("channel and label counts mismatch: "+n)}var o=a[n].channels;var i=a[n].labels;delete a[n].channels;delete a[n].labels;Object.defineProperty(a[n],"channels",{value:o});Object.defineProperty(a[n],"labels",{value:i})}}a.rgb.hsl=function(e){var r=e[0]/255;var t=e[1]/255;var a=e[2]/255;var n=Math.min(r,t,a);var o=Math.max(r,t,a);var i=o-n;var l;var s;var c;if(o===n){l=0}else if(r===o){l=(t-a)/i}else if(t===o){l=2+(a-r)/i}else if(a===o){l=4+(r-t)/i}l=Math.min(l*60,360);if(l<0){l+=360}c=(n+o)/2;if(o===n){s=0}else if(c<=.5){s=i/(o+n)}else{s=i/(2-o-n)}return[l,s*100,c*100]};a.rgb.hsv=function(e){var r;var t;var a;var n;var o;var i=e[0]/255;var l=e[1]/255;var s=e[2]/255;var c=Math.max(i,l,s);var h=c-Math.min(i,l,s);var u=function(e){return(c-e)/6/h+1/2};if(h===0){n=o=0}else{o=h/c;r=u(i);t=u(l);a=u(s);if(i===c){n=a-t}else if(l===c){n=1/3+r-a}else if(s===c){n=2/3+t-r}if(n<0){n+=1}else if(n>1){n-=1}}return[n*360,o*100,c*100]};a.rgb.hwb=function(e){var r=e[0];var t=e[1];var n=e[2];var o=a.rgb.hsl(e)[0];var i=1/255*Math.min(r,Math.min(t,n));n=1-1/255*Math.max(r,Math.max(t,n));return[o,i*100,n*100]};a.rgb.cmyk=function(e){var r=e[0]/255;var t=e[1]/255;var a=e[2]/255;var n;var o;var i;var l;l=Math.min(1-r,1-t,1-a);n=(1-r-l)/(1-l)||0;o=(1-t-l)/(1-l)||0;i=(1-a-l)/(1-l)||0;return[n*100,o*100,i*100,l*100]};function l(e,r){return Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2)+Math.pow(e[2]-r[2],2)}a.rgb.keyword=function(e){var t=r[e];if(t){return t}var a=Infinity;var n;for(var o in M){if(M.hasOwnProperty(o)){var i=M[o];var s=l(e,i);if(s<a){a=s;n=o}}}return n};a.keyword.rgb=function(e){return M[e]};a.rgb.xyz=function(e){var r=e[0]/255;var t=e[1]/255;var a=e[2]/255;r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92;a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92;var n=r*.4124+t*.3576+a*.1805;var o=r*.2126+t*.7152+a*.0722;var i=r*.0193+t*.1192+a*.9505;return[n*100,o*100,i*100]};a.rgb.lab=function(e){var r=a.rgb.xyz(e);var t=r[0];var n=r[1];var o=r[2];var i;var l;var s;t/=95.047;n/=100;o/=108.883;t=t>.008856?Math.pow(t,1/3):7.787*t+16/116;n=n>.008856?Math.pow(n,1/3):7.787*n+16/116;o=o>.008856?Math.pow(o,1/3):7.787*o+16/116;i=116*n-16;l=500*(t-n);s=200*(n-o);return[i,l,s]};a.hsl.rgb=function(e){var r=e[0]/360;var t=e[1]/100;var a=e[2]/100;var n;var o;var i;var l;var s;if(t===0){s=a*255;return[s,s,s]}if(a<.5){o=a*(1+t)}else{o=a+t-a*t}n=2*a-o;l=[0,0,0];for(var c=0;c<3;c++){i=r+1/3*-(c-1);if(i<0){i++}if(i>1){i--}if(6*i<1){s=n+(o-n)*6*i}else if(2*i<1){s=o}else if(3*i<2){s=n+(o-n)*(2/3-i)*6}else{s=n}l[c]=s*255}return l};a.hsl.hsv=function(e){var r=e[0];var t=e[1]/100;var a=e[2]/100;var n=t;var o=Math.max(a,.01);var i;var l;a*=2;t*=a<=1?a:2-a;n*=o<=1?o:2-o;l=(a+t)/2;i=a===0?2*n/(o+n):2*t/(a+t);return[r,i*100,l*100]};a.hsv.rgb=function(e){var r=e[0]/60;var t=e[1]/100;var a=e[2]/100;var n=Math.floor(r)%6;var o=r-Math.floor(r);var i=255*a*(1-t);var l=255*a*(1-t*o);var s=255*a*(1-t*(1-o));a*=255;switch(n){case 0:return[a,s,i];case 1:return[l,a,i];case 2:return[i,a,s];case 3:return[i,l,a];case 4:return[s,i,a];case 5:return[a,i,l]}};a.hsv.hsl=function(e){var r=e[0];var t=e[1]/100;var a=e[2]/100;var n=Math.max(a,.01);var o;var i;var l;l=(2-t)*a;o=(2-t)*n;i=t*n;i/=o<=1?o:2-o;i=i||0;l/=2;return[r,i*100,l*100]};a.hwb.rgb=function(e){var r=e[0]/360;var t=e[1]/100;var a=e[2]/100;var n=t+a;var o;var i;var l;var s;if(n>1){t/=n;a/=n}o=Math.floor(6*r);i=1-a;l=6*r-o;if((o&1)!==0){l=1-l}s=t+l*(i-t);var c;var h;var u;switch(o){default:case 6:case 0:c=i;h=s;u=t;break;case 1:c=s;h=i;u=t;break;case 2:c=t;h=i;u=s;break;case 3:c=t;h=s;u=i;break;case 4:c=s;h=t;u=i;break;case 5:c=i;h=t;u=s;break}return[c*255,h*255,u*255]};a.cmyk.rgb=function(e){var r=e[0]/100;var t=e[1]/100;var a=e[2]/100;var n=e[3]/100;var o;var i;var l;o=1-Math.min(1,r*(1-n)+n);i=1-Math.min(1,t*(1-n)+n);l=1-Math.min(1,a*(1-n)+n);return[o*255,i*255,l*255]};a.xyz.rgb=function(e){var r=e[0]/100;var t=e[1]/100;var a=e[2]/100;var n;var o;var i;n=r*3.2406+t*-1.5372+a*-.4986;o=r*-.9689+t*1.8758+a*.0415;i=r*.0557+t*-.204+a*1.057;n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*12.92;o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92;i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92;n=Math.min(Math.max(0,n),1);o=Math.min(Math.max(0,o),1);i=Math.min(Math.max(0,i),1);return[n*255,o*255,i*255]};a.xyz.lab=function(e){var r=e[0];var t=e[1];var a=e[2];var n;var o;var i;r/=95.047;t/=100;a/=108.883;r=r>.008856?Math.pow(r,1/3):7.787*r+16/116;t=t>.008856?Math.pow(t,1/3):7.787*t+16/116;a=a>.008856?Math.pow(a,1/3):7.787*a+16/116;n=116*t-16;o=500*(r-t);i=200*(t-a);return[n,o,i]};a.lab.xyz=function(e){var r=e[0];var t=e[1];var a=e[2];var n;var o;var i;o=(r+16)/116;n=t/500+o;i=o-a/200;var l=Math.pow(o,3);var s=Math.pow(n,3);var c=Math.pow(i,3);o=l>.008856?l:(o-16/116)/7.787;n=s>.008856?s:(n-16/116)/7.787;i=c>.008856?c:(i-16/116)/7.787;n*=95.047;o*=100;i*=108.883;return[n,o,i]};a.lab.lch=function(e){var r=e[0];var t=e[1];var a=e[2];var n;var o;var i;n=Math.atan2(a,t);o=n*360/2/Math.PI;if(o<0){o+=360}i=Math.sqrt(t*t+a*a);return[r,i,o]};a.lch.lab=function(e){var r=e[0];var t=e[1];var a=e[2];var n;var o;var i;i=a/360*2*Math.PI;n=t*Math.cos(i);o=t*Math.sin(i);return[r,n,o]};a.rgb.ansi16=function(e){var r=e[0];var t=e[1];var n=e[2];var o=1 in arguments?arguments[1]:a.rgb.hsv(e)[2];o=Math.round(o/50);if(o===0){return 30}var i=30+(Math.round(n/255)<<2|Math.round(t/255)<<1|Math.round(r/255));if(o===2){i+=60}return i};a.hsv.ansi16=function(e){return a.rgb.ansi16(a.hsv.rgb(e),e[2])};a.rgb.ansi256=function(e){var r=e[0];var t=e[1];var a=e[2];if(r===t&&t===a){if(r<8){return 16}if(r>248){return 231}return Math.round((r-8)/247*24)+232}var n=16+36*Math.round(r/255*5)+6*Math.round(t/255*5)+Math.round(a/255*5);return n};a.ansi16.rgb=function(e){var r=e%10;if(r===0||r===7){if(e>50){r+=3.5}r=r/10.5*255;return[r,r,r]}var t=(~~(e>50)+1)*.5;var a=(r&1)*t*255;var n=(r>>1&1)*t*255;var o=(r>>2&1)*t*255;return[a,n,o]};a.ansi256.rgb=function(e){if(e>=232){var r=(e-232)*10+8;return[r,r,r]}e-=16;var t;var a=Math.floor(e/36)/5*255;var n=Math.floor((t=e%36)/6)/5*255;var o=t%6/5*255;return[a,n,o]};a.rgb.hex=function(e){var r=((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255);var t=r.toString(16).toUpperCase();return"000000".substring(t.length)+t};a.hex.rgb=function(e){var r=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!r){return[0,0,0]}var t=r[0];if(r[0].length===3){t=t.split("").map((function(e){return e+e})).join("")}var a=parseInt(t,16);var n=a>>16&255;var o=a>>8&255;var i=a&255;return[n,o,i]};a.rgb.hcg=function(e){var r=e[0]/255;var t=e[1]/255;var a=e[2]/255;var n=Math.max(Math.max(r,t),a);var o=Math.min(Math.min(r,t),a);var i=n-o;var l;var s;if(i<1){l=o/(1-i)}else{l=0}if(i<=0){s=0}else if(n===r){s=(t-a)/i%6}else if(n===t){s=2+(a-r)/i}else{s=4+(r-t)/i+4}s/=6;s%=1;return[s*360,i*100,l*100]};a.hsl.hcg=function(e){var r=e[1]/100;var t=e[2]/100;var a=1;var n=0;if(t<.5){a=2*r*t}else{a=2*r*(1-t)}if(a<1){n=(t-.5*a)/(1-a)}return[e[0],a*100,n*100]};a.hsv.hcg=function(e){var r=e[1]/100;var t=e[2]/100;var a=r*t;var n=0;if(a<1){n=(t-a)/(1-a)}return[e[0],a*100,n*100]};a.hcg.rgb=function(e){var r=e[0]/360;var t=e[1]/100;var a=e[2]/100;if(t===0){return[a*255,a*255,a*255]}var n=[0,0,0];var o=r%1*6;var i=o%1;var l=1-i;var s=0;switch(Math.floor(o)){case 0:n[0]=1;n[1]=i;n[2]=0;break;case 1:n[0]=l;n[1]=1;n[2]=0;break;case 2:n[0]=0;n[1]=1;n[2]=i;break;case 3:n[0]=0;n[1]=l;n[2]=1;break;case 4:n[0]=i;n[1]=0;n[2]=1;break;default:n[0]=1;n[1]=0;n[2]=l}s=(1-t)*a;return[(t*n[0]+s)*255,(t*n[1]+s)*255,(t*n[2]+s)*255]};a.hcg.hsv=function(e){var r=e[1]/100;var t=e[2]/100;var a=r+t*(1-r);var n=0;if(a>0){n=r/a}return[e[0],n*100,a*100]};a.hcg.hsl=function(e){var r=e[1]/100;var t=e[2]/100;var a=t*(1-r)+.5*r;var n=0;if(a>0&&a<.5){n=r/(2*a)}else if(a>=.5&&a<1){n=r/(2*(1-a))}return[e[0],n*100,a*100]};a.hcg.hwb=function(e){var r=e[1]/100;var t=e[2]/100;var a=r+t*(1-r);return[e[0],(a-r)*100,(1-a)*100]};a.hwb.hcg=function(e){var r=e[1]/100;var t=e[2]/100;var a=1-t;var n=a-r;var o=0;if(n<1){o=(a-n)/(1-n)}return[e[0],n*100,o*100]};a.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};a.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};a.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};a.gray.hsl=a.gray.hsv=function(e){return[0,0,e[0]]};a.gray.hwb=function(e){return[0,100,e[0]]};a.gray.cmyk=function(e){return[0,0,0,e[0]]};a.gray.lab=function(e){return[e[0],0,0]};a.gray.hex=function(e){var r=Math.round(e[0]/100*255)&255;var t=(r<<16)+(r<<8)+r;var a=t.toString(16).toUpperCase();return"000000".substring(a.length)+a};a.rgb.gray=function(e){var r=(e[0]+e[1]+e[2])/3;return[r/255*100]}}));function I(){var e={};var r=Object.keys(T);for(var t=r.length,a=0;a<t;a++){e[r[a]]={distance:-1,parent:null}}return e}function j(e){var r=I();var t=[e];r[e].distance=0;while(t.length){var a=t.pop();var n=Object.keys(T[a]);for(var o=n.length,i=0;i<o;i++){var l=n[i];var s=r[l];if(s.distance===-1){s.distance=r[a].distance+1;s.parent=a;t.unshift(l)}}}return r}function O(e,r){return function(t){return r(e(t))}}function E(e,r){var t=[r[e].parent,e];var a=T[r[e].parent][e];var n=r[e].parent;while(r[n].parent){t.unshift(r[n].parent);a=O(T[r[n].parent][n],a);n=r[n].parent}a.conversion=t;return a}var H=function(e){var r=j(e);var t={};var a=Object.keys(r);for(var n=a.length,o=0;o<n;o++){var i=a[o];var l=r[i];if(l.parent===null){continue}t[i]=E(i,r)}return t};var P={};var _=Object.keys(T);function R(e){var r=function(r){if(r===undefined||r===null){return r}if(arguments.length>1){r=Array.prototype.slice.call(arguments)}return e(r)};if("conversion"in e){r.conversion=e.conversion}return r}function L(e){var r=function(r){if(r===undefined||r===null){return r}if(arguments.length>1){r=Array.prototype.slice.call(arguments)}var t=e(r);if(typeof t==="object"){for(var a=t.length,n=0;n<a;n++){t[n]=Math.round(t[n])}}return t};if("conversion"in e){r.conversion=e.conversion}return r}_.forEach((function(e){P[e]={};Object.defineProperty(P[e],"channels",{value:T[e].channels});Object.defineProperty(P[e],"labels",{value:T[e].labels});var r=H(e);var t=Object.keys(r);t.forEach((function(t){var a=r[t];P[e][t]=L(a);P[e][t].raw=R(a)}))}));var N=P;var z=[].slice;var U=["keyword","gray","hex"];var K={};Object.keys(N).forEach((function(e){K[z.call(N[e].labels).sort().join("")]=e}));var V={};function B(e,r){if(!(this instanceof B)){return new B(e,r)}if(r&&r in U){r=null}if(r&&!(r in N)){throw new Error("Unknown model: "+r)}var t;var a;if(e==null){this.model="rgb";this.color=[0,0,0];this.valpha=1}else if(e instanceof B){this.model=e.model;this.color=e.color.slice();this.valpha=e.valpha}else if(typeof e==="string"){var n=A.get(e);if(n===null){throw new Error("Unable to parse color from string: "+e)}this.model=n.model;a=N[this.model].channels;this.color=n.value.slice(0,a);this.valpha=typeof n.value[a]==="number"?n.value[a]:1}else if(e.length){this.model=r||"rgb";a=N[this.model].channels;var o=z.call(e,0,a);this.color=$(o,a);this.valpha=typeof e[a]==="number"?e[a]:1}else if(typeof e==="number"){e&=16777215;this.model="rgb";this.color=[e>>16&255,e>>8&255,e&255];this.valpha=1}else{this.valpha=1;var i=Object.keys(e);if("alpha"in e){i.splice(i.indexOf("alpha"),1);this.valpha=typeof e.alpha==="number"?e.alpha:0}var l=i.sort().join("");if(!(l in K)){throw new Error("Unable to parse color from object: "+JSON.stringify(e))}this.model=K[l];var s=N[this.model].labels;var c=[];for(t=0;t<s.length;t++){c.push(e[s[t]])}this.color=$(c)}if(V[this.model]){a=N[this.model].channels;for(t=0;t<a;t++){var h=V[this.model][t];if(h){this.color[t]=h(this.color[t])}}}this.valpha=Math.max(0,Math.min(1,this.valpha));if(Object.freeze){Object.freeze(this)}}B.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(e){var r=this.model in A.to?this:this.rgb();r=r.round(typeof e==="number"?e:1);var t=r.valpha===1?r.color:r.color.concat(this.valpha);return A.to[r.model](t)},percentString:function(e){var r=this.rgb().round(typeof e==="number"?e:1);var t=r.valpha===1?r.color:r.color.concat(this.valpha);return A.to.rgb.percent(t)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){var e={};var r=N[this.model].channels;var t=N[this.model].labels;for(var a=0;a<r;a++){e[t[a]]=this.color[a]}if(this.valpha!==1){e.alpha=this.valpha}return e},unitArray:function(){var e=this.rgb().color;e[0]/=255;e[1]/=255;e[2]/=255;if(this.valpha!==1){e.push(this.valpha)}return e},unitObject:function(){var e=this.rgb().object();e.r/=255;e.g/=255;e.b/=255;if(this.valpha!==1){e.alpha=this.valpha}return e},round:function(e){e=Math.max(e||0,0);return new B(this.color.map(G(e)).concat(this.valpha),this.model)},alpha:function(e){if(arguments.length){return new B(this.color.concat(Math.max(0,Math.min(1,e))),this.model)}return this.valpha},red:X("rgb",0,Y(255)),green:X("rgb",1,Y(255)),blue:X("rgb",2,Y(255)),hue:X(["hsl","hsv","hsl","hwb","hcg"],0,(function(e){return(e%360+360)%360})),saturationl:X("hsl",1,Y(100)),lightness:X("hsl",2,Y(100)),saturationv:X("hsv",1,Y(100)),value:X("hsv",2,Y(100)),chroma:X("hcg",1,Y(100)),gray:X("hcg",2,Y(100)),white:X("hwb",1,Y(100)),wblack:X("hwb",2,Y(100)),cyan:X("cmyk",0,Y(100)),magenta:X("cmyk",1,Y(100)),yellow:X("cmyk",2,Y(100)),black:X("cmyk",3,Y(100)),x:X("xyz",0,Y(100)),y:X("xyz",1,Y(100)),z:X("xyz",2,Y(100)),l:X("lab",0,Y(100)),a:X("lab",1),b:X("lab",2),keyword:function(e){if(arguments.length){return new B(e)}return N[this.model].keyword(this.color)},hex:function(e){if(arguments.length){return new B(e)}return A.to.hex(this.rgb().round().color)},rgbNumber:function(){var e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity:function(){var e=this.rgb().color;var r=[];for(var t=0;t<e.length;t++){var a=e[t]/255;r[t]=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}return.2126*r[0]+.7152*r[1]+.0722*r[2]},contrast:function(e){var r=this.luminosity();var t=e.luminosity();if(r>t){return(r+.05)/(t+.05)}return(t+.05)/(r+.05)},level:function(e){var r=this.contrast(e);if(r>=7.1){return"AAA"}return r>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;var r=(e[0]*299+e[1]*587+e[2]*114)/1e3;return r<128},isLight:function(){return!this.isDark()},negate:function(){var e=this.rgb();for(var r=0;r<3;r++){e.color[r]=255-e.color[r]}return e},lighten:function(e){var r=this.hsl();r.color[2]+=r.color[2]*e;return r},darken:function(e){var r=this.hsl();r.color[2]-=r.color[2]*e;return r},saturate:function(e){var r=this.hsl();r.color[1]+=r.color[1]*e;return r},desaturate:function(e){var r=this.hsl();r.color[1]-=r.color[1]*e;return r},whiten:function(e){var r=this.hwb();r.color[1]+=r.color[1]*e;return r},blacken:function(e){var r=this.hwb();r.color[2]+=r.color[2]*e;return r},grayscale:function(){var e=this.rgb().color;var r=e[0]*.3+e[1]*.59+e[2]*.11;return B.rgb(r,r,r)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var r=this.hsl();var t=r.color[0];t=(t+e)%360;t=t<0?360+t:t;r.color[0]=t;return r},mix:function(e,r){if(!e||!e.rgb){throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e)}var t=e.rgb();var a=this.rgb();var n=r===undefined?.5:r;var o=2*n-1;var i=t.alpha()-a.alpha();var l=((o*i===-1?o:(o+i)/(1+o*i))+1)/2;var s=1-l;return B.rgb(l*t.red()+s*a.red(),l*t.green()+s*a.green(),l*t.blue()+s*a.blue(),t.alpha()*n+a.alpha()*(1-n))}};Object.keys(N).forEach((function(e){if(U.indexOf(e)!==-1){return}var r=N[e].channels;B.prototype[e]=function(){if(this.model===e){return new B(this)}if(arguments.length){return new B(arguments,e)}var t=typeof arguments[r]==="number"?r:this.valpha;return new B(W(N[this.model][e].raw(this.color)).concat(t),e)};B[e]=function(t){if(typeof t==="number"){t=$(z.call(arguments),r)}return new B(t,e)}}));function q(e,r){return Number(e.toFixed(r))}function G(e){return function(r){return q(r,e)}}function X(e,r,t){e=Array.isArray(e)?e:[e];e.forEach((function(e){(V[e]||(V[e]=[]))[r]=t}));e=e[0];return function(a){var n;if(arguments.length){if(t){a=t(a)}n=this[e]();n.color[r]=a;return n}n=this[e]().color[r];if(t){n=t(n)}return n}}function Y(e){return function(r){return Math.max(0,Math.min(e,r))}}function W(e){return Array.isArray(e)?e:[e]}function $(e,r){for(var t=0;t<r;t++){if(typeof e[t]!=="number"){e[t]=0}}return e}var J=B;var Q={container:"container",controlSection:"control-section",hexOptions:"color-hex-options",section:"section",header:"header",control:"control",splitSection:"section--split",colorModeContainer:"color-mode-container",colorMode:"color-mode",channels:"channels",channel:"channel",savedColors:"saved-colors",savedColorsSection:"saved-colors-section",saveColor:"save-color",deleteColor:"delete-color",savedColorsButtons:"saved-colors-buttons",headerHex:"header--hex",colorFieldAndSlider:"color-field-and-slider",colorFieldAndSliderInteractive:"color-field-and-slider--interactive",colorFieldAndSliderWrap:"color-field-and-slider-wrap",scope:"scope",hueScope:"scope--hue",colorFieldScope:"scope--color-field",savedColor:"saved-color"};var Z=J("#007AC2");var ee="calcite-color-";var re={r:255,g:255,b:255};var te={h:360,s:100,v:100};var ae={b:"B",blue:"Blue",deleteColor:"Delete color",g:"G",green:"Green",h:"H",hsv:"HSV",hex:"Hex",hue:"Hue",noColor:"No color",r:"R",red:"Red",rgb:"RGB",s:"S",saturation:"Saturation",saveColor:"Save color",saved:"Saved",v:"V",value:"Value"};var ne={s:{slider:{height:10,width:156},colorField:{height:80,width:156},thumb:{radius:8}},m:{slider:{height:14,width:272},colorField:{height:150,width:272},thumb:{radius:10}},l:{slider:{height:16,width:420},colorField:{height:200,width:420},thumb:{radius:12}}};var oe=function(e,r,t){return Math.max(r,Math.min(e,t))};var ie="@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{display:inline-block}:host([scale=s]) .container{width:156px}:host([scale=s]) .saved-colors{grid-template-columns:repeat(auto-fill, minmax(20px, 1fr))}:host([scale=s]) .channels{-ms-flex-direction:column;flex-direction:column}:host([scale=s]) .channel{width:100%;margin-bottom:4px}:host([scale=s]) .channel:last-child{margin-bottom:0}:host([scale=m]) .container{width:272px}:host([scale=l]) .control-section.section.calcite--rtl>:nth-child(2){margin-left:0;margin-right:12px}:host([scale=l]) .container{width:420px}:host([scale=l]) .color-field-and-slider{margin-bottom:-20px}:host([scale=l]) .section{padding:0 16px 16px}:host([scale=l]) .section:first-of-type{padding-top:16px}:host([scale=l]) .saved-colors{grid-template-columns:repeat(auto-fill, minmax(28px, 1fr));grid-gap:12px;padding-top:16px}:host([scale=l]) .control-section{-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:baseline;align-items:baseline}:host([scale=l]) .control-section>:nth-child(2){margin-left:12px}:host([scale=l]) .color-hex-options{-ms-flex-negative:1;flex-shrink:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:distribute;justify-content:space-around;min-height:90px}:host([scale=l]) .color-mode-container{-ms-flex-negative:3;flex-shrink:3}:host([appearance=minimal]) .container{border:none}.container{background-color:var(--calcite-ui-foreground-1);display:inline-block;border:1px solid var(--calcite-ui-border-1)}.color-field-and-slider-wrap{position:relative}.scope{font-size:var(--calcite-font-size--1);padding:0;margin-bottom:0;margin-right:0;outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;width:0.5rem;height:0.5rem;position:absolute;pointer-events:none;margin-top:-0.25rem;margin-left:-0.25rem;outline-offset:10px}.scope:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px;outline-offset:12px}.color-field-and-slider{margin-bottom:-16px}.color-field-and-slider--interactive{cursor:pointer}.control-section{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap}.section{padding:0 12px 12px}.section:first-of-type{padding-top:12px}.color-hex-options{margin-bottom:1rem}.color-hex-options,.section--split{-ms-flex-positive:1;flex-grow:1}.header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;color:var(--calcite-ui-text-3);font-weight:500;font-size:0.875rem;line-height:1.5}.header--hex{line-height:1.5;font-size:0.875rem;line-height:1.5;padding-top:12px}.control{margin-top:8px}.channels{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.channel{width:31%}.saved-colors{padding-top:12px;display:-ms-grid;display:grid;grid-template-columns:repeat(auto-fill, minmax(24px, 1fr));grid-gap:8px;width:100%}.saved-colors-buttons{display:-ms-flexbox;display:flex}.saved-color{outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;cursor:pointer}.saved-color:focus{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}.saved-color:hover{-webkit-transition:outline-color 100ms ease-in-out;transition:outline-color 100ms ease-in-out;outline:2px solid var(--calcite-ui-border-2);outline-offset:2px}";var le=16;var se=c(Z.hex());var ce="auto";var he=e("calcite_color_picker",function(){function e(e){var n=this;r(this,e);this.calciteColorPickerChange=t(this,"calciteColorPickerChange",7);this.allowEmpty=false;this.appearance="default";this.color=Z;this.format=ce;this.hideHex=false;this.hideChannels=false;this.hideSaved=false;this.intlB=ae.b;this.intlBlue=ae.blue;this.intlDeleteColor=ae.deleteColor;this.intlG=ae.g;this.intlGreen=ae.green;this.intlH=ae.h;this.intlHsv=ae.hsv;this.intlHex=ae.hex;this.intlHue=ae.hue;this.intlNoColor=ae.noColor;this.intlR=ae.r;this.intlRed=ae.red;this.intlRgb=ae.rgb;this.intlS=ae.s;this.intlSaturation=ae.saturation;this.intlSaveColor=ae.saveColor;this.intlSaved=ae.saved;this.intlV=ae.v;this.intlValue=ae.value;this.scale="m";this.value=se;this.colorUpdateLocked=false;this.hueThumbState="idle";this.mode=h.HEX;this.shiftKeyChannelAdjustment=0;this.sliderThumbState="idle";this.colorFieldAndSliderInteractive=false;this.channelMode="rgb";this.channels=this.toChannels(Z);this.dimensions=ne.m;this.savedColors=[];this.handleTabActivate=function(e){n.channelMode=e.currentTarget.getAttribute("data-color-mode");n.updateChannelsFromColor(n.color)};this.handleColorFieldScopeKeyDown=function(e){var r=b(e.key);var t={ArrowUp:{x:0,y:-10},ArrowRight:{x:10,y:0},ArrowDown:{x:0,y:10},ArrowLeft:{x:-10,y:0}};if(Object.keys(t).includes(r)){e.preventDefault();n.scopeOrientation=r==="ArrowDown"||r==="ArrowUp"?"vertical":"horizontal";n.captureColorFieldColor(n.colorFieldScopeLeft+t[r].x||0,n.colorFieldScopeTop+t[r].y||0,false);return}};this.handleHueScopeKeyDown=function(e){var r;var t=e.shiftKey?10:1;var a=b(e.key);var o={ArrowUp:1,ArrowRight:1,ArrowDown:-1,ArrowLeft:-1};if(Object.keys(o).includes(a)){e.preventDefault();var i=o[a]*t;var l=(r=n.baseColorFieldColor)===null||r===void 0?void 0:r.hue();var s=l?n.baseColorFieldColor.hue(l+i):J({h:0,s:0,v:100});n.internalColorSet(s,false);return}};this.handleHexInputChange=function(e){e.stopPropagation();var r=n,t=r.allowEmpty,a=r.color;var o=e.target;var i=o.value;if(t&&!i){n.internalColorSet(null);return}var l=a&&c(a.hex());if(i!==l){n.internalColorSet(J(i))}};this.handleSavedColorSelect=function(e){var r=e.currentTarget;n.internalColorSet(J(r.color))};this.handleChannelInput=function(e){var r=e.currentTarget;var t=e.detail.nativeEvent.target;var a=Number(r.getAttribute("data-channel-index"));var o=n.channelMode==="rgb"?re[Object.keys(re)[a]]:te[Object.keys(te)[a]];var i;if(n.allowEmpty&&!r.value){i=""}else{var l=Number(r.value)+n.shiftKeyChannelAdjustment;var s=oe(l,0,o);i=s.toString()}r.value=i;t.value=i};this.handleChannelChange=function(e){var r=e.currentTarget;var t=Number(r.getAttribute("data-channel-index"));var a=__spreadArray([],n.channels);var o=n.allowEmpty&&!r.value;if(o){n.channels=[null,null,null];n.internalColorSet(null);return}a[t]=Number(r.value);n.updateColorFromChannels(a)};this.handleSavedColorKeyDown=function(e){if(e.key===" "||e.key==="Enter"){e.preventDefault();e.stopPropagation();n.handleSavedColorSelect(e)}};this.handleColorFieldAndSliderMouseLeave=function(){n.colorFieldAndSliderInteractive=false;if(n.sliderThumbState!=="drag"&&n.hueThumbState!=="drag"){n.hueThumbState="idle";n.sliderThumbState="idle";n.drawColorFieldAndSlider()}};this.handleColorFieldAndSliderMouseDown=function(e){var r=e.offsetX,t=e.offsetY;n.activeThumbX=r;n.activeThumbY=t;n.globalThumbX=r;n.globalThumbY=t;var a=n.getCanvasRegion(t);if(a==="color-field"){n.hueThumbState="drag";n.captureColorFieldColor(r,t)}else if(a==="slider"){n.sliderThumbState="drag";n.captureHueSliderColor(r)}e.preventDefault();document.addEventListener("mousemove",n.globalMouseMoveHandler);document.addEventListener("mouseup",n.globalMouseUpHandler,{once:true})};this.globalMouseUpHandler=function(){n.hueThumbState="idle";n.sliderThumbState="idle";n.drawColorFieldAndSlider()};this.globalMouseMoveHandler=function(e){var r=n,t=r.el,a=r.dimensions;var o=n.sliderThumbState==="drag";var i=n.hueThumbState==="drag";if(!t.isConnected||!o&&!i){return}n.globalThumbX=n.globalThumbX+e.movementX;n.globalThumbY=n.globalThumbY+e.movementY;n.activeThumbX=oe(n.globalThumbX,0,a.colorField.width);n.activeThumbY=oe(n.globalThumbY,0,a.colorField.height+a.slider.height);var l=i?"color-field":o?"slider":n.getCanvasRegion(n.activeThumbY);if(l==="color-field"){n.captureColorFieldColor(n.activeThumbX,n.activeThumbY,false)}else if(l==="slider"){n.captureHueSliderColor(n.activeThumbX)}};this.handleColorFieldAndSliderMouseEnterOrMove=function(e){var r=e.offsetX,t=e.offsetY;var a=n.dimensions,o=a.colorField,i=a.slider,l=a.thumb;n.colorFieldAndSliderInteractive=t<=o.height+i.height;var s=n.getCanvasRegion(t);if(s==="color-field"){var c=n.hueThumbState;var h=n.baseColorFieldColor.hsv();var u=Math.round(h.saturationv()/(te.s/o.width));var d=Math.round(o.height-h.value()/(te.v/o.height));var v=n.containsPoint(r,t,u,d,l.radius);var f=false;if(c==="idle"&&v){n.hueThumbState="hover";f=true}else if(c==="hover"&&!v){n.hueThumbState="idle";f=true}if(n.hueThumbState!=="drag"){if(f){n.drawColorFieldAndSlider()}}}else if(s==="slider"){var p=n.baseColorFieldColor.hsv().saturationv(100).value(100);var m=n.sliderThumbState;var g=Math.round(p.hue()/(360/i.width));var b=Math.round((i.height+n.getSliderCapSpacing())/2)+o.height;var y=n.containsPoint(r,t,g,b,l.radius);var w=false;if(m==="idle"&&y){n.sliderThumbState="hover";w=true}else if(m==="hover"&&!y){n.sliderThumbState="idle";w=true}if(n.sliderThumbState!=="drag"){if(w){n.drawColorFieldAndSlider()}}}};this.storeColorFieldScope=function(e){n.colorFieldScopeNode=e};this.renderChannelsTabTitle=function(e){var r=n,t=r.channelMode,o=r.intlRgb,i=r.intlHsv;var l=e===t;var s=e==="rgb"?o:i;return a("calcite-tab-title",{active:l,class:Q.colorMode,"data-color-mode":e,key:e,onCalciteTabsActivate:n.handleTabActivate},s)};this.renderChannelsTab=function(e){var r=n,t=r.channelMode,o=r.channels,i=r.intlB,l=r.intlBlue,s=r.intlG,c=r.intlGreen,h=r.intlH,u=r.intlHue,d=r.intlR,v=r.intlRed,f=r.intlS,p=r.intlSaturation,m=r.intlV,g=r.intlValue;var b=e===t;var y=e==="rgb";var w=y?[d,s,i]:[h,f,m];var C=y?[v,c,l]:[u,p,g];return a("calcite-tab",{active:b,class:Q.control,key:e},a("div",{class:Q.channels},o.map((function(e,r){return n.renderChannel(e,r,w[r],C[r])}))))};this.renderChannel=function(e,r,t,o){return a("calcite-input",{"aria-label":o,class:Q.channel,"data-channel-index":r,numberButtonType:"none",onCalciteInputChange:n.handleChannelChange,onCalciteInputInput:n.handleChannelInput,prefixText:t,scale:"s",type:"number",value:e===null||e===void 0?void 0:e.toString()})};this.deleteColor=function(){var e=n.color.hex();var r=n.savedColors.indexOf(e)>-1;if(!r){return}var t=n.savedColors.filter((function(r){return r!==e}));n.savedColors=t;var a=""+ee+n.storageId;if(n.storageId){localStorage.setItem(a,JSON.stringify(t))}};this.saveColor=function(){var e=n.color.hex();var r=n.savedColors.indexOf(e)>-1;if(r){return}var t=__spreadArray(__spreadArray([],n.savedColors),[e]);n.savedColors=t;var a=""+ee+n.storageId;if(n.storageId){localStorage.setItem(a,JSON.stringify(t))}};this.drawColorFieldAndSlider=x((function(){if(!n.fieldAndSliderRenderingContext){return}n.drawColorField();n.drawHueSlider()}),le);this.captureColorFieldColor=function(e,r,t){if(t===void 0){t=true}var a=n.dimensions.colorField,o=a.height,i=a.width;var l=Math.round(te.s/i*e);var s=Math.round(te.v/o*(o-r));n.internalColorSet(n.baseColorFieldColor.hsv().saturationv(l).value(s),t)};this.initColorFieldAndSlider=function(e){n.fieldAndSliderRenderingContext=e.getContext("2d");n.setCanvasContextSize(e,{width:n.dimensions.colorField.width,height:n.dimensions.colorField.height+n.dimensions.slider.height+n.getSliderCapSpacing()*2});n.drawColorFieldAndSlider()}}e.prototype.handleColorChange=function(e,r){this.drawColorFieldAndSlider();this.updateChannelsFromColor(e);this.previousColor=r;if(this.colorUpdateLocked){return}this.value=this.toValue(e)};e.prototype.handleFormatChange=function(e){this.mode=e==="auto"?this.mode:e;this.value=this.toValue(this.color)};e.prototype.handleScaleChange=function(e){if(e===void 0){e="m"}this.updateDimensions(e)};e.prototype.handleValueChange=function(e,r){var t=this,a=t.allowEmpty,n=t.format;var o=!a||e;var i=false;if(o){var l=u(e);if(!l||n!=="auto"&&l!==n){console.warn("ignoring invalid color value: "+e);this.value=r;return}i=this.mode!==l;this.mode=l}if(this.colorUpdateLocked){this.calciteColorPickerChange.emit();return}var s=a&&!e?null:J(e);var c=!d(s,this.color);if(i||c){this.color=s;this.calciteColorPickerChange.emit()}};Object.defineProperty(e.prototype,"baseColorFieldColor",{get:function(){return this.color||this.previousColor||Z},enumerable:false,configurable:true});e.prototype.handleChannelKeyUpOrDown=function(e){this.shiftKeyChannelAdjustment=0;var r=b(e.key);if(r!=="ArrowUp"&&r!=="ArrowDown"||!e.composedPath().some((function(e){var r;return(r=e.classList)===null||r===void 0?void 0:r.contains(Q.channel)}))){return}var t=e.shiftKey;e.preventDefault();if(!this.color){this.internalColorSet(this.previousColor);e.stopPropagation();return}var a=9;this.shiftKeyChannelAdjustment=r==="ArrowUp"&&t?a:r==="ArrowDown"&&t?-a:0};e.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,o(this.colorFieldScopeNode)]}))}))};e.prototype.componentWillLoad=function(){var e=""+ee+this.storageId;if(this.storageId&&localStorage.getItem(e)){this.savedColors=JSON.parse(localStorage.getItem(e))}};e.prototype.connectedCallback=function(){var e=this,r=e.color,t=e.format,a=e.value;var n=t!=="auto"?this.toValue(r,t):se;var o=t!=="auto"&&a===se?n:a;this.handleValueChange(o,n);this.updateDimensions(this.scale)};e.prototype.disconnectedCallback=function(){document.removeEventListener("mousemove",this.globalMouseMoveHandler);document.removeEventListener("mouseup",this.globalMouseUpHandler)};e.prototype.render=function(){var e,r,t,n,o,s,c;var h=this;var u=this,d=u.allowEmpty,v=u.color,f=u.intlDeleteColor,p=u.el,m=u.hideHex,g=u.hideChannels,b=u.hideSaved,y=u.intlHex,w=u.intlSaved,C=u.intlSaveColor,x=u.savedColors,k=u.scale;var S=v?v.hex():null;var M=k!=="s"?"m":k;var D=this,F=D.colorFieldAndSliderInteractive,A=D.colorFieldScopeTop,T=D.colorFieldScopeLeft,I=D.hueScopeLeft,j=D.hueScopeTop,O=D.scopeOrientation,E=D.dimensions,H=E.colorField,P=H.height,_=H.width,R=E.slider.height;var L=j!==null&&j!==void 0?j:R/2+P;var N=I!==null&&I!==void 0?I:_*Z.hue()/te.h;var z=i(p);var U=v===null;var K=O==="vertical";return a("div",{class:Q.container},a("div",{class:Q.colorFieldAndSliderWrap},a("canvas",{class:(e={},e[Q.colorFieldAndSlider]=true,e[Q.colorFieldAndSliderInteractive]=F,e),onMouseDown:this.handleColorFieldAndSliderMouseDown,onMouseEnter:this.handleColorFieldAndSliderMouseEnterOrMove,onMouseLeave:this.handleColorFieldAndSliderMouseLeave,onMouseMove:this.handleColorFieldAndSliderMouseEnterOrMove,ref:this.initColorFieldAndSlider}),a("div",{"aria-label":K?this.intlValue:this.intlSaturation,"aria-valuemax":K?te.v:te.s,"aria-valuemin":"0","aria-valuenow":(K?v===null||v===void 0?void 0:v.saturationv():v===null||v===void 0?void 0:v.value())||"0",class:(r={},r[Q.scope]=true,r[Q.colorFieldScope]=true,r),onKeyDown:this.handleColorFieldScopeKeyDown,ref:this.storeColorFieldScope,role:"slider",style:{top:(A||0)+"px",left:(T||0)+"px"},tabindex:"0"}),a("div",{"aria-label":this.intlHue,"aria-valuemax":te.h,"aria-valuemin":"0","aria-valuenow":(v===null||v===void 0?void 0:v.round().hue())||Z.round().hue(),class:(t={},t[Q.scope]=true,t[Q.hueScope]=true,t),onKeyDown:this.handleHueScopeKeyDown,role:"slider",style:{top:L+"px",left:N+"px"},tabindex:"0"})),m&&g?null:a("div",{class:(n={},n[Q.controlSection]=true,n[Q.section]=true,n[l.rtl]=z==="rtl",n)},m?null:a("div",{class:Q.hexOptions},a("span",{class:(o={},o[Q.header]=true,o[Q.headerHex]=true,o)},y),a("calcite-color-picker-hex-input",{allowEmpty:d,class:Q.control,dir:z,onCalciteColorPickerHexInputChange:this.handleHexInputChange,scale:M,value:S})),g?null:a("calcite-tabs",{class:(s={},s[Q.colorModeContainer]=true,s[Q.splitSection]=true,s),dir:z,scale:"s"},a("calcite-tab-nav",{slot:"tab-nav"},this.renderChannelsTabTitle("rgb"),this.renderChannelsTabTitle("hsv")),this.renderChannelsTab("rgb"),this.renderChannelsTab("hsv"))),b?null:a("div",{class:(c={},c[Q.savedColorsSection]=true,c[Q.section]=true,c)},a("div",{class:Q.header},a("label",null,w),a("div",{class:Q.savedColorsButtons},a("calcite-button",{appearance:"transparent",class:Q.deleteColor,color:"neutral",disabled:U,iconStart:"minus",label:f,onClick:this.deleteColor,scale:k}),a("calcite-button",{appearance:"transparent",class:Q.saveColor,color:"neutral",disabled:U,iconStart:"plus",label:C,onClick:this.saveColor,scale:k}))),x.length>0?a("div",{class:Q.savedColors},__spreadArray([],x.map((function(e){return a("calcite-color-picker-swatch",{active:S===e,class:Q.savedColor,color:e,key:e,onClick:h.handleSavedColorSelect,onKeyDown:h.handleSavedColorKeyDown,scale:k,tabIndex:0})})))):null))};e.prototype.captureHueSliderColor=function(e){var r=this.dimensions.slider.width;var t=360/r*e;this.internalColorSet(this.baseColorFieldColor.hue(t),false)};e.prototype.getCanvasRegion=function(e){var r=this.dimensions,t=r.colorField.height,a=r.slider.height;if(e<=t){return"color-field"}if(e<=t+a){return"slider"}return"none"};e.prototype.internalColorSet=function(e,r){if(r===void 0){r=true}if(r&&d(e,this.color)){return}this.colorUpdateLocked=true;this.color=e;this.value=this.toValue(e);this.colorUpdateLocked=false};e.prototype.toValue=function(e,r){if(r===void 0){r=this.mode}if(!e){return null}var t="hex";if(r.includes(t)){return c(e.round()[t]())}if(r.includes("-css")){return e[r.replace("-css","").replace("a","")]().round().string()}var a=e[r]().round().object();if(r.endsWith("a")){a.a=a.alpha;delete a.alpha}return a};e.prototype.getSliderCapSpacing=function(){var e=this.dimensions,r=e.slider.height,t=e.thumb.radius;return t*2-r};e.prototype.updateDimensions=function(e){if(e===void 0){e="m"}this.dimensions=ne[e]};e.prototype.drawColorField=function(){var e=this.fieldAndSliderRenderingContext;var r=this.dimensions.colorField,t=r.height,a=r.width;e.fillStyle=this.baseColorFieldColor.hsv().saturationv(100).value(100).string();e.fillRect(0,0,a,t);var n=e.createLinearGradient(0,0,a,0);n.addColorStop(0,"rgba(255,255,255,1)");n.addColorStop(1,"rgba(255,255,255,0)");e.fillStyle=n;e.fillRect(0,0,a,t);var o=e.createLinearGradient(0,0,0,t);o.addColorStop(0,"rgba(0,0,0,0)");o.addColorStop(1,"rgba(0,0,0,1)");e.fillStyle=o;e.fillRect(0,0,a,t);this.drawActiveColorFieldColor()};e.prototype.setCanvasContextSize=function(e,r){var t=r.height,a=r.width;var n=window.devicePixelRatio||1;e.width=a*n;e.height=t*n;e.style.height=t+"px";e.style.width=a+"px";var o=e.getContext("2d");o.scale(n,n)};e.prototype.containsPoint=function(e,r,t,a,n){return Math.pow(e-t,2)+Math.pow(r-a,2)<=Math.pow(n,2)};e.prototype.drawActiveColorFieldColor=function(){var e=this;var r=this.color;if(!r){return}var t=r.hsv();var a=this.dimensions,n=a.colorField,o=n.height,i=n.width,l=a.thumb.radius;var s=t.saturationv()/(te.s/i);var c=o-t.value()/(te.v/o);requestAnimationFrame((function(){e.colorFieldScopeLeft=s;e.colorFieldScopeTop=c}));this.drawThumb(this.fieldAndSliderRenderingContext,l,s,c,t,this.hueThumbState)};e.prototype.drawThumb=function(e,r,t,a,n,o){var i=0;var l=2*Math.PI;e.beginPath();e.arc(t,a,r,i,l);e.shadowBlur=o==="hover"?32:16;e.shadowColor="rgba(0, 0, 0, "+(o==="drag"?.32:.16)+")";e.fillStyle="#fff";e.fill();e.beginPath();e.arc(t,a,r-3,i,l);e.shadowBlur=0;e.shadowColor="transparent";e.fillStyle=n.rgb().string();e.fill()};e.prototype.drawActiveHueSliderColor=function(){var e=this;var r=this.color;if(!r){return}var t=r.hsv().saturationv(100).value(100);var a=this.dimensions,n=a.colorField.height,o=a.slider,i=o.height,l=o.width,s=a.thumb.radius;var c=t.hue()/(360/l);var h=i/2+n;requestAnimationFrame((function(){e.hueScopeLeft=c;e.hueScopeTop=h}));this.drawThumb(this.fieldAndSliderRenderingContext,s,c,h,t,this.sliderThumbState)};e.prototype.drawHueSlider=function(){var e=this.fieldAndSliderRenderingContext;var r=this.dimensions,t=r.colorField.height,a=r.slider,n=a.height,o=a.width;var i=e.createLinearGradient(0,0,o,0);var l=["red","yellow","lime","cyan","blue","magenta","red"];var s=1/(l.length-1);var c=0;l.forEach((function(e){i.addColorStop(c,J(e).string());c+=s}));e.fillStyle=i;e.clearRect(0,t,o,n+this.getSliderCapSpacing()*2);e.fillRect(0,t,o,n);this.drawActiveHueSliderColor()};e.prototype.updateColorFromChannels=function(e){this.internalColorSet(J(e,this.channelMode))};e.prototype.updateChannelsFromColor=function(e){this.channels=e?this.toChannels(e):[null,null,null]};e.prototype.toChannels=function(e){var r=this.channelMode;return e[r]().array().map((function(e){return Math.floor(e)}))};Object.defineProperty(e.p