/*!
 * KoliBri - The accessible HTML-Standard
 */
import{L as r,k as t,b as e}from"./common-DEEjER7G.js";import{c as o}from"./contrast-C0oqtcfU.js";const n=/^#((\d|[a-f]){8}|(\d|[a-f]){6}|(\d|[a-f]){3,4})$/i;function a(r){return n.test(r)}function l(r){if(r.startsWith("{")){try{const t=JSON.parse(r);if(s(t))return{type:"ColorPair",value:t}}catch(r){return{type:null,value:null}}}return{type:null,value:null}}function i(r){if(r){if(typeof r==="string"){if(a(r))return{type:"string",valid:true,value:r};else{const t=l(r);if(t.value)return{type:t.type,valid:true,value:t.value}}}else{const t=r;if(s(t))return{type:"ColorPair",valid:true,value:t}}}return{type:null,valid:false,value:""}}function s(r){return!!(typeof r==="object"&&r&&typeof r.backgroundColor==="string"&&typeof r.foregroundColor==="string")}function u(r){const t=i(r);switch(t.type){case null:return false;case"string":case"ColorPair":return t.valid}}const c=(r,t,o)=>{e(r,"_color",u,new Set(["rgb in hex","ColorPair"]),t,o)};const f=e=>{let n;const a=i(e);switch(a.type){case"string":n=o(a.value);break;case"ColorPair":{const r=a.value;let t="";if(typeof r.foregroundColor==="string")t=r.foregroundColor;if(!t||typeof t!=="string")t="#fff";n=o({background:r.backgroundColor,foreground:t});break}case null:r.warn(`_color was empty or invalid (${JSON.stringify(e)})`);n=o({background:"#000",foreground:"#000"})}if(n.contrast<7){t(`[KolBadge] The contrast of ${n.contrast} (≥7, AAA) is to low, between the color pair ${n.background} and ${n.foreground}.`)}return{backgroundColor:n.background,foregroundColor:n.foreground}};export{f as h,c as v};
//# sourceMappingURL=color-Df2awjVY.js.map