UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

4 lines 34.9 kB
/*! * KoliBri - The accessible HTML-Standard */ function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,t={exports:{}},n=t.exports;function o(){return r||(r=1,function(e){!function(t,o){e.exports?e.exports=o():t.log=o()}(n,function(){var e=function(){},t="undefined",o=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],n={},a=null;function i(e,t){var o=e[t];if("function"==typeof o.bind)return o.bind(e);try{return Function.prototype.bind.call(o,e)}catch(t){return function(){return Function.prototype.apply.apply(o,[e,arguments])}}}function s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function l(r){return"debug"===r&&(r="log"),typeof console!==t&&("trace"===r&&o?s:void 0!==console[r]?i(console,r):void 0!==console.log?i(console,"log"):e)}function c(){for(var o=this.getLevel(),n=0;n<r.length;n++){var a=r[n];this[a]=n<o?e:this.methodFactory(a,o,this.name)}if(this.log=this.debug,typeof console===t&&o<this.levels.SILENT)return"No console available for logging"}function u(e){return function(){typeof console!==t&&(c.call(this),this[e].apply(this,arguments))}}function d(e,t,o){return l(e)||u.apply(this,arguments)}function f(e,o){var i,s,l,u=this,f="loglevel";function h(e){var o=(r[e]||"silent").toUpperCase();if(typeof window!==t&&f){try{return void(window.localStorage[f]=o)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"="+o+";"}catch(e){}}}function g(){var e;if(typeof window!==t&&f){try{e=window.localStorage[f]}catch(e){}if(typeof e===t)try{var o=window.document.cookie,r=encodeURIComponent(f),n=o.indexOf(r+"=");-1!==n&&(e=/^([^;]+)/.exec(o.slice(n+r.length+1))[1])}catch(e){}return void 0===u.levels[e]&&(e=void 0),e}}function p(e){var t=e;if("string"==typeof t&&void 0!==u.levels[t.toUpperCase()]&&(t=u.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=u.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?f+=":"+e:"symbol"==typeof e&&(f=void 0),u.name=e,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=o||d,u.getLevel=function(){return null!=l?l:null!=s?s:i},u.setLevel=function(e,t){return l=p(e),!1!==t&&h(l),c.call(u)},u.setDefaultLevel=function(e){s=p(e),g()||u.setLevel(e,!1)},u.resetLevel=function(){l=null,function(){if(typeof window!==t&&f){try{window.localStorage.removeItem(f)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),c.call(u)},u.enableAll=function(e){u.setLevel(u.levels.TRACE,e)},u.disableAll=function(e){u.setLevel(u.levels.SILENT,e)},u.rebuild=function(){if(a!==u&&(i=p(a.getLevel())),c.call(u),a===u)for(var e in n)n[e].rebuild()},i=p(a?a.getLevel():"WARN");var m=g();null!=m&&(l=p(m)),c.call(u)}(a=new f).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=n[e];return t||(t=n[e]=new f(e,a.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=h),a},a.getLoggers=function(){return n},a.default=a,a})}(t)),t.exports}var i=o(),a=e(i);const s=(e,t)=>o=>o(e,t),l=(e,t)=>o=>o(e,t,{append:!1}),u=()=>{const e=typeof process<"u"&&process.env?process.env:{},t="test"===e.NODE_ENV,o="VITEST"in e,r="JEST_WORKER_ID"in e,n="PLAYWRIGHT_TEST_BASE_URL"in e,a="true"===e.CI,i="true"===e.TEST||"true"===e.IS_TEST,s=typeof navigator<"u"&&!0===navigator.webdriver,l=typeof navigator<"u"&&/playwright|puppeteer|webdriver|selenium|testcafe/i.test(navigator.userAgent);return t||o||r||n||a||i||s||l},f={A11yUi:{CSS_STYLE_CACHE:new Map,IS_TEST_ENVIRONMENT:u(),PERFORMANCE_MEASURES:new Map,STYLING_TASK_QUEUE:new Map,THEMES:new Map,showAverageTimes:()=>{const e={};for(const[t,o]of f.A11yUi.PERFORMANCE_MEASURES.entries())e[t]=[o.totalTime/o.count,o.count];const t=Object.entries(e).sort((e,t)=>t[1][0]-e[1][0]);return console.table(Object.fromEntries(t.map(([e,[t,o]])=>[e,{"avg (ms)":parseFloat(t.toFixed(2)),count:o}]))),e}}};let c=!0,d=!1;const p=/^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/,v=e=>"string"==typeof e&&p.test(e),g=e=>{if(!v(e))throw new Error(`[Theming] The theme identifier "${"string"==typeof e?e:""}" (Type: ${typeof e}) is not valid. Please use only follow this pattern: /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/`)},h=e=>e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s*([{},;])\s*/g,"$1").replace(/:\s+/g,":").replace(/\s+/g," ").replace(/;\}/g,"}").trim(),y=(e,t,o,r)=>b(e,t,o,r),b=(e,t,o,r)=>{(r=r??{}).append=r.append??!1,g(e),c&&!d&&(d=!0,a.warn(`[Theming] The theme process is locked. This means that the theme "${e}" should not be patched.\n\n import { register } from 'adopted-style-sheets';\n import { defineCustomElements } from '...';\n import { THEME } from '...';\n\n register(THEME, defineCustomElements)\n .then(() => {\n // run your app or website\n })\n .catch(console.warn);`));let n=f.A11yUi.THEMES.get(e);if(n||(n=new Map,f.A11yUi.THEMES.set(e,n)),r.append&&n.has(t)){const e=n.get(t);n.set(t,h(`${e}${o}`))}else n.set(t,h(o))},m=(e,t,o,r)=>w(e,t,o,r),w=(e,t,o,r)=>(g(e),"object"==typeof t&&null!==t&&Object.getOwnPropertyNames(t).forEach(n=>{const a=t[n],i=n.toLowerCase(),s="function"!=typeof r?.transformTagName||["GLOBAL","PROPERTIES"].includes(n)?n:r.transformTagName(i);"string"==typeof a&&a.length>0&&b(e,s.toUpperCase(),a,o)}),e),k=e=>{if(e instanceof HTMLElement){if("string"==typeof e.dataset.theme)return e;{let t=e.parentNode;for(;t instanceof ShadowRoot;)t=t.host;return k(t)}}return null},S=(e={})=>"false"!==e.themeEncroachCss&&"true"!==e.themeReset&&{mode:"after"===e.themeEncroachCssMode||"before"===e.themeEncroachCssMode?e.themeEncroachCssMode:"before"},T=()=>"object"==typeof f.A11yUi.Theme&&null!==f.A11yUi.Theme&&"boolean"==typeof f.A11yUi.Theme.cache&&"object"==typeof f.A11yUi.Theme.encroachCss&&null!==f.A11yUi.Theme.encroachCss&&"string"==typeof f.A11yUi.Theme.encroachCss.mode&&"string"==typeof f.A11yUi.Theme.name,E=()=>!("object"==typeof f.A11yUi.Theme&&null!==f.A11yUi.Theme)||"default"!==f.A11yUi.Theme.name,M=e=>{if(T())return f.A11yUi.Theme;{const t={cache:!0,encroachCss:S(),loglevel:"silent",mode:"csr",name:null},o=k(e);return o instanceof HTMLElement&&(t.cache="false"!==o.dataset.themeCache,t.encroachCss=S(o.dataset),t.loglevel="debug"===o.dataset.themeLoglevel?o.dataset.themeLoglevel:"silent",t.mode="ssr"===o.dataset.themeMode?o.dataset.themeMode:"csr",t.name=o.dataset.theme||null),t}},A=(e,t)=>({cache:!1!==t.cache,detect:"auto"===t.detect?"auto":"fixed",encroachCss:!1!==t.encroachCss&&("object"!=typeof t.encroachCss||null==t.encroachCss||"after"!==t.encroachCss.mode&&"before"!==t.encroachCss.mode?{mode:"before"}:t.encroachCss),loglevel:"debug"===t.loglevel?t.loglevel:"silent",mode:"ssr"===t.mode?t.mode:"csr",name:"string"==typeof t.name?t.name:e}),N=(e,t)=>{!1===T()&&E()&&"object"==typeof t&&null!==t&&("fixed"===(t=A(e,t)).detect?(null===t.name&&"string"==typeof e&&(t.name=e),e===t.name&&(f.A11yUi.Theme=t,a.info(`[Theming] Theme "${e}" was set as default theme.`))):d||(d=!0,a.warn("[Theming] The presetting of theme options is only relevant by using 'fixed' detection mode.")))};let O=!1;const L=(e,t,o={})=>{O||(O=!0,c=!1,typeof window<"u"&&(window.A11yUi=f.A11yUi)),"function"==typeof e?e=new Set([e]):Array.isArray(e)&&(e=new Set(e)),e instanceof Set&&e.forEach(e=>{"function"==typeof e&&1===e.length?N(e((e,t,r)=>w(e,t,r,o)),{cache:o.theme?.cache,detect:o.theme?.detect,encroachCss:o.theme?.encroachCss,mode:o.theme?.mode,name:o.theme?.name}):a.error("[Theming] An attempt was made to load an incompatible theme.")}),c=!0,"function"==typeof t?t=new Set([t]):Array.isArray(t)&&(t=new Set(t));const r=[];return t.forEach(e=>{const t=e();t instanceof Promise&&r.push(t)}),Promise.all(r)},R=new Set,j=/--[^;]+/g,I=/:/,C=typeof MutationObserver<"u";let $=25,_=()=>{$=Math.min(25+20*Math.log2(f.A11yUi.STYLING_TASK_QUEUE.size+1),250)};const x=(e,t)=>{let o=t.match(j);if(Array.isArray(o)){o=o.filter(e=>I.test(e));const t=document.createElement("style");t.innerHTML=`.${e} {${o.join(";")}}`,document.querySelector("head")?.appendChild(t)}R.add(e)},F=(e,t)=>{const o=f.A11yUi.THEMES.get(e);return o instanceof Map&&o.has(t)?o.get(t):""},H=e=>{for(const t of Array.from(e.childNodes)){if(!(t instanceof HTMLStyleElement&&"STYLE"===t.tagName&&void 0===t.dataset.themingFallback))break;e.removeChild(t)}},P=(e,t)=>{try{if("ssr"===f.A11yUi.Theme?.mode)throw new Error("SSR");const o=[];t.forEach(e=>{const t=new CSSStyleSheet;t.replaceSync(e),o.push(t)}),e.adoptedStyleSheets=o}catch{[...t].reverse().forEach((t,o)=>{if("string"!=typeof t||0===t.length)return;const r=document.createElement("style");switch(r.dataset.themingFallback="",o){case 4:r.dataset.themingBaseA11y="";break;case 3:r.dataset.themingBaseGlobal="";break;case 2:r.dataset.themingBaseComponent="";break;case 1:r.dataset.themingCustomGlobal="";break;case 0:r.dataset.themingCustomComponent="";break;default:r.dataset.themingUnknown=""}r.innerHTML=t,e.insertBefore(r,e.firstChild)})}},q=(e,t,o)=>{if(!1!==o){const r=[...Array.from(e.childNodes).filter(e=>e instanceof HTMLStyleElement&&"STYLE"===e.tagName)];let n;try{n=[...Array.from(e.adoptedStyleSheets)]}catch{n=[]}"before"===o?.mode?(r.reverse().forEach(e=>t.unshift(e.innerHTML)),n.reverse().forEach(e=>t.unshift(Array.from(e.cssRules).map(e=>e.cssText).join("")))):"after"===o?.mode&&(r.forEach(e=>t.push(e.innerHTML)),n.forEach(e=>t.push(Array.from(e.cssRules).map(e=>e.cssText).join(""))))}},U=(e,t,o)=>{const r=t.name||"default";let n;try{if(null===e.shadowRoot)throw new Error("ShadowRoot is null");n=e.shadowRoot}catch{n=e}if(f.A11yUi.CSS_STYLE_CACHE.get(r)?.has(e.tagName))z(e,n,f.A11yUi.CSS_STYLE_CACHE.get(r)?.get(e.tagName),o);else{const a=F(r,"PROPERTIES"),i=F(r,"GLOBAL"),s=F(r,e.tagName);!1===R.has(r)&&x(r,i);const l=[a,i,s];q(n,l,t.encroachCss),!0===t.cache&&(!1===f.A11yUi.CSS_STYLE_CACHE.has(r)&&f.A11yUi.CSS_STYLE_CACHE.set(r,new Map),f.A11yUi.CSS_STYLE_CACHE.get(r)?.set(e.tagName,l)),z(e,n,l,o)}},z=(e,t,o,r)=>{const n=performance.now();if(H(t),P(t,o),Q(e),r(),f.A11yUi.PERFORMANCE_MEASURES.has(e.tagName)){const t=f.A11yUi.PERFORMANCE_MEASURES.get(e.tagName);t.count+=1,t.totalTime+=performance.now()-n}else f.A11yUi.PERFORMANCE_MEASURES.set(e.tagName,{count:1,totalTime:performance.now()-n})},D=e=>{const t=f.A11yUi.STYLING_TASK_QUEUE.get(e);if(t){const{resetCss:o,themeDetails:r}=t;U(e,r,o),Q(e)}};let B=e=>{const t=setTimeout(()=>{clearTimeout(t),e.classList.contains("hydrated")?D(e):B(e)},$)};const J={attributes:!0,attributeFilter:["class"],childList:!1,subtree:!1},K={attributes:!0,attributeFilter:[],childList:!1,subtree:!1},W=C?new MutationObserver((e,t)=>{for(const o of e){const e=o.target;e.classList.contains("hydrated")&&(D(e),t.observe(e,K))}}):null;W&&(B=e=>W.observe(e,J),_=()=>{});let Y=e=>{const t=getComputedStyle(e).getPropertyValue("--theme-visibility-delay").trim();if(t.endsWith("ms"))return parseFloat(t);if(t.endsWith("s"))return 1e3*parseFloat(t);{const e=parseFloat(t);return isNaN(e)?0:e}};f.A11yUi.IS_TEST_ENVIRONMENT&&(Y=()=>0);const G=(e,t)=>{e.style.setProperty("visibility",t),e.dataset.themed=""},V=(e,t)=>{const o=e.style.visibility||null;f.A11yUi.STYLING_TASK_QUEUE.set(e,{resetCss:()=>{const t=Y(e);t>0?setTimeout(()=>{G(e,o)},t):G(e,o)},themeDetails:t}),e.style.setProperty("visibility","hidden","important"),B(e)},Q=e=>{f.A11yUi.STYLING_TASK_QUEUE.delete(e),_()},X=(e,t)=>{V(e,{...f.A11yUi.Theme,...t})};class Z{Prefix;Key;Tag;createTheme=(e,t)=>l(e,t);createTranslation=(e,t)=>s(e,t);constructor(e,t,o){this.Prefix=e,this.Key=Object.getOwnPropertyNames(t),this.Tag=Object.getOwnPropertyNames(o)}}var ee,te;!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.success=3]="success",e[e.message=4]="message",e[e.close=5]="close",e[e["form-description"]=6]="form-description",e[e.of=7]="of",e[e.characters=8]="characters",e[e.new=9]="new",e[e["no-entries"]=10]="no-entries",e[e["change-order"]=11]="change-order",e[e["action-running"]=12]="action-running",e[e["action-done"]=13]="action-done",e[e["page-first"]=14]="page-first",e[e["page-back"]=15]="page-back",e[e["page-next"]=16]="page-next",e[e["page-last"]=17]="page-last",e[e["entries-per-site"]=18]="entries-per-site",e[e["page-current"]=19]="page-current",e[e["page-selected"]=20]="page-selected",e[e["page-per-site"]=21]="page-per-site",e[e["logo-description"]=22]="logo-description",e[e["open-link-in-tab"]=23]="open-link-in-tab",e[e["kolibri-logo"]=24]="kolibri-logo"}(ee||(ee={})),function(e){e[e.abbr=0]="abbr",e[e.accordion=1]="accordion",e[e.alert=2]="alert",e[e.avatar=3]="avatar",e[e.badge=4]="badge",e[e.breadcrumb=5]="breadcrumb",e[e.button=6]="button",e[e["button-link"]=7]="button-link",e[e.card=8]="card",e[e.combobox=9]="combobox",e[e.details=10]="details",e[e.dialog=11]="dialog",e[e.drawer=12]="drawer",e[e.form=13]="form",e[e.heading=14]="heading",e[e.icon=15]="icon",e[e.image=16]="image",e[e["input-checkbox"]=17]="input-checkbox",e[e["input-color"]=18]="input-color",e[e["input-date"]=19]="input-date",e[e["input-email"]=20]="input-email",e[e["input-file"]=21]="input-file",e[e["input-number"]=22]="input-number",e[e["input-password"]=23]="input-password",e[e["input-radio"]=24]="input-radio",e[e["input-range"]=25]="input-range",e[e["input-text"]=26]="input-text",e[e.kolibri=27]="kolibri",e[e.link=28]="link",e[e["link-button"]=29]="link-button",e[e.logo=30]="logo",e[e.modal=31]="modal",e[e.nav=32]="nav",e[e.pagination=33]="pagination",e[e["popover-button"]=34]="popover-button",e[e.progress=35]="progress",e[e.quote=36]="quote",e[e.select=37]="select",e[e["single-select"]=38]="single-select",e[e["skip-nav"]=39]="skip-nav",e[e.spin=40]="spin",e[e["split-button"]=41]="split-button",e[e.symbol=42]="symbol",e[e.table=43]="table",e[e["table-stateful"]=44]="table-stateful",e[e["table-stateless"]=45]="table-stateless",e[e.tabs=46]="tabs",e[e.textarea=47]="textarea",e[e["toast-container"]=48]="toast-container",e[e.toolbar=49]="toolbar",e[e.tooltip=50]="tooltip",e[e.tree=51]="tree",e[e["tree-item"]=52]="tree-item"}(te||(te={}));const ne=()=>"undefined"!=typeof window?window:{},re=()=>{const e=ne();return e&&void 0!==e.document?e.document:{}},oe=["development","production","test"];let ie="production";const ae=e=>{try{if(!oe.includes(e))throw new Error(`Invalid NODE_ENV value: ${e}. Expected one of ${oe.join(", ")}.`);ie=e}catch(e){ie="production"}},se=()=>{try{const e="undefined"!=typeof process&&process.env?process.env.NODE_ENV:void 0;if(e&&oe.includes(e))return e}catch(e){}return"production"};ae(se());let le=!1,ue=!1;const fe=()=>"development"===ie,ce=()=>"test"===ie,de=()=>!0===le,pe=e=>{le=!0===e},ve=()=>!0===ue,ge=e=>{ue=!0===e},he="color: white; background: #666; font-weight: bold; padding: .25em .5em; border-radius: 3px; border: 1px solid #000",ye=e=>Array.isArray(e)?e:[e],be=e=>`%c${e}`,me=(e,t)=>"string"==typeof t&&t.length>0?`${be(e)} | ${t}`:be(e),we=(e,t)=>[me(e,null==t?void 0:t.classifier),`${he};${(null==t?void 0:t.overwriteStyle)||""}`],ke=e=>fe()||!0===e;class Se{constructor(e){this.label=e}debug(e,t){ke(null==t?void 0:t.forceLog)&&console.debug(...we(this.label,t),...ye(e))}info(e,t){ke(null==t?void 0:t.forceLog)&&console.info(...we(this.label,t),...ye(e))}trace(e,t){ke(null==t?void 0:t.forceLog)&&console.trace(...we(this.label,t),...ye(e))}warn(e,t){ke(null==t?void 0:t.forceLog)&&console.warn(...we(this.label,t),...ye(e))}error(e,t){console.error(...we(this.label,t),...ye(e))}throw(e,t){if(ke(null==t?void 0:t.forceLog))throw new Error(...we(this.label,t),...ye(e))}}const Te=new Se("KoliBri"),Ee=new Set,Me=(e,t)=>{!1===Ee.has(e)&&(Ee.add(e),Te.debug([e].concat([]),{classifier:"✋ a11y",forceLog:!1,overwriteStyle:"; background-color: #09f"}))},Ae=new Set,Ne=(e,t)=>{!1===Ae.has(e)&&(Ae.add(e),Te.warn([e].concat([]),{classifier:"🔥 deprecated",forceLog:!1,overwriteStyle:"; background-color: #f00"}))},Oe=new Set,Le=(e,t)=>{(!1===Oe.has(e)||(null==t?void 0:t.force))&&(Oe.add(e),Te.debug([e].concat((null==t?void 0:t.details)||[]),{classifier:"💻 dev",forceLog:!!(null==t?void 0:t.force),overwriteStyle:"; background-color: #f09"}))},Re=(e,t)=>{!1===Oe.has(e)&&(Oe.add(e),Te.warn([e].concat([]),{classifier:"⚠️ dev",forceLog:!1,overwriteStyle:"; background-color: #f09"}))},je=new Set,Ie=(e,t=!1,o)=>{!1===je.has(e)&&(je.add(e),e+=!0===t?" ✅":"",Te.debug([e].concat([]),{classifier:"🌟 feature",forceLog:!1,overwriteStyle:"; background-color: #309"}))};Le("We appreciate any feedback, comments, screenshots, or demo links of an application based on KoliBri (kolibri@itzbund.de). Thank you!");const Ce=new Set,$e=(e,t)=>{!1===Ce.has(e)&&(Ce.add(e),Te.debug([e].concat([]),{classifier:"📑 ui/ux",forceLog:!1,overwriteStyle:"; background-color: #060;"}))},_e=()=>{Me('"Disabled" limits accessibility and visibility. From an accessibility perspective, we recommend using the readonly attribute instead of disabled.\n- https://uxdesign.cc/is-it-ok-to-grey-out-disabled-buttons-8afa74a0fae')},xe=e=>{"string"==typeof e&&""!==e||Me("Some structural elements, such as the nav tag, can be used multiple times on a webpage. To distinguish between similarly named structural elements, it is necessary to set an ARIA label.\n- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Navigation_Role#accessibility_concerns")},Fe=(e,t=8)=>{t>7&&$e(`[${e}] Within navigation structures, it is recommended to use no more than 7 menu items.\n\nLink:\n- https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two`)};var Ge,Ve,Xe,Ze,He=.2126,Pe=.7152,qe=.0722,Ue=1/12.92;function ze(e){return Math.pow((e+.055)/1.055,2.4)}function De(e){var t=e[0]/255,o=e[1]/255,r=e[2]/255,n=t<=.03928?t*Ue:ze(t),a=o<=.03928?o*Ue:ze(o),i=r<=.03928?r*Ue:ze(r);return n*He+a*Pe+i*qe}function Be(e){var t=255;8===(e=e.replace(/^#/,"")).length&&(t=parseInt(e.slice(6,8),16),e=e.substring(0,6)),4===e.length&&(t=parseInt(e.slice(3,4).repeat(2),16),e=e.substring(0,3)),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);var o=parseInt(e,16);return[o>>16,o>>8&255,255&o,t]}function Je(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function Ke(e,t){return Je(De(e),De(t))}function We(e,t){return Ke(Be(e),Be(t))}function Ye(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"AA Large":"Fail"}function Qe(){return Ve?Ge:(Ve=1,Ge={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]})}function et(){if(Ze)return Xe;Ze=1;var e=Qe();Xe=function(o){var r,n,a=[],i=1;if("string"==typeof o)if(o=o.toLowerCase(),e[o])a=e[o].slice(),n="rgb";else if("transparent"===o)i=0,n="rgb",a=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(o)){var s=o.slice(1);i=1,(u=s.length)<=4?(a=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===u&&(i=parseInt(s[3]+s[3],16)/255)):(a=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===u&&(i=parseInt(s[6]+s[7],16)/255)),a[0]||(a[0]=0),a[1]||(a[1]=0),a[2]||(a[2]=0),n="rgb"}else if(r=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(o)){var l=r[1],c="rgb"===l;n=s=l.replace(/a$/,"");var u="cmyk"===s?4:"gray"===s?1:3;a=r[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(e,o){if(/%$/.test(e))return o===u?parseFloat(e)/100:"rgb"===s?255*parseFloat(e)/100:parseFloat(e);if("h"===s[o]){if(/deg$/.test(e))return parseFloat(e);if(void 0!==t[e])return t[e]}return parseFloat(e)}),l===s&&a.push(1),i=c||void 0===a[u]?1:a[u],a=a.slice(0,u)}else o.length>10&&/[0-9](?:\s|\/)/.test(o)&&(a=o.match(/([0-9]+)/g).map(function(e){return parseFloat(e)}),n=o.match(/([a-z])/gi).join("").toLowerCase());else isNaN(o)?Array.isArray(o)||o.length?(a=[o[0],o[1],o[2]],n="rgb",i=4===o.length?o[3]:1):o instanceof Object&&(null!=o.r||null!=o.red||null!=o.R?(n="rgb",a=[o.r||o.red||o.R||0,o.g||o.green||o.G||0,o.b||o.blue||o.B||0]):(n="hsl",a=[o.h||o.hue||o.H||0,o.s||o.saturation||o.S||0,o.l||o.lightness||o.L||o.b||o.brightness]),i=o.a||o.alpha||o.opacity||1,null!=o.opacity&&(i/=100)):(n="rgb",a=[o>>>16,(65280&o)>>>8,255&o]);return{space:n,values:a,alpha:i}};var t={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};return Xe}var tt=et(),nt=e(tt);const rt={min:[0,0,0],max:[255,255,255]};var ot={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(e){var t,o,r,n,a,i=e[0]/360,s=e[1]/100,l=e[2]/100,c=0;if(0===s)return[a=255*l,a,a];for(t=2*l-(o=l<.5?l*(1+s):l+s-l*s),n=[0,0,0];c<3;)(r=i+1/3*-(c-1))<0?r++:r>1&&r--,a=6*r<1?t+6*(o-t)*r:2*r<1?o:3*r<2?t+(o-t)*(2/3-r)*6:t,n[c++]=255*a;return n}};rt.hsl=function(e){var t,o,r=e[0]/255,n=e[1]/255,a=e[2]/255,i=Math.min(r,n,a),s=Math.max(r,n,a),l=s-i;return s===i?t=0:r===s?t=(n-a)/l:n===s?t=2+(a-r)/l:a===s&&(t=4+(r-n)/l),(t=Math.min(60*t,360))<0&&(t+=360),o=(i+s)/2,[t,100*(s===i?0:o<=.5?l/(s+i):l/(2-s-i)),100*o]};var at,it={exports:{}};function st(){if(at)return it.exports;function e(e){var o=t(e);return 3==o.length?o.concat(255):(o[3]=Math.round(o[3]),o)}function t(e){return"string"==typeof e?function(e){if("red"==e)return[255,0,0];if("green"==e)return[0,255,0];if("blue"==e)return[0,0,255];if("black"==e)return[0,0,0];if("white"==e)return[255,255,255];if("cyan"==e)return[0,255,255];if("gray"==e)return[128,128,128];if("grey"==e)return[128,128,128];if("magenta"==e)return[255,0,255];if("pink"==e)return[255,0,255];if("yellow"==e)return[255,255,0]}(e=e.toLowerCase())||function(e){var t=e.replace(/^#/,""),o=t.length;if(3==o||4==o){var n=r(t[0]),a=r(t[1]),i=r(t[2]),s=3==o?255:r(t[3]);if(isNaN(n)||isNaN(a)||isNaN(i)||isNaN(s))return;return[n,a,i,s]}}(e)||function(e){var t=e.replace(/^#/,""),o=t.length;if(6==o||8==o){var n=r(t.slice(0,2)),a=r(t.slice(2,4)),i=r(t.slice(4,6)),s=6==o?255:r(t.slice(6,8));if(isNaN(n)||isNaN(a)||isNaN(i)||isNaN(s))return;return[n,a,i,s]}}(e)||function(e){if("rgb("==e.substr(0,4)){var t=(e=e.match(/^rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number),o=n(t[0],!0),r=n(t[1],!0),a=n(t[2],!0);if(-1!=o&&-1!=r&&-1!=a)return[o,r,a,255]}}(e)||function(e){if("rgba("==e.substr(0,5)){var t=(e=e.match(/^rgba\(([^)]+)\)/)[1]).split(/ *, */).map(Number),o=n(t[0],!0),r=n(t[1],!0),a=n(t[2],!0),i=n(255*t[3]);if(-1!=o&&-1!=r&&-1!=a&&-1!=i)return[o,r,a,i]}}(e)||[0,0,0,255]:function(e){if("[object Object]"===Object.prototype.toString.call(e)&&Object.getPrototypeOf(e)===Object.getPrototypeOf({})){var t=n(null!=e.r?e.r:null!=e.red?e.red:0,!0),o=n(null!=e.g?e.g:null!=e.green?e.green:0,!0),r=n(null!=e.b?e.b:null!=e.blue?e.blue:0,!0),a=n(null!=e.a?e.a:null!=e.alpha?e.alpha:255,!0);if(-1!=t&&-1!=o&&-1!=r&&-1!=a)return[t,o,r,a]}}(e)||function(e){if(Array.isArray(e)&&(3==e.length||4==e.length)){var t=n(e[0],!0),o=n(e[1],!0),r=n(e[2],!0),a=n(null!=e[3]?e[3]:255,!0);if(-1!=t&&-1!=o&&-1!=r&&-1!=a)return[t,o,r,a]}}(e)||function(e){if("number"==typeof e&&Math.floor(e)==e&&e<=4294967295&&e>=0){return[e>>16&255,e>>8&255,255&e,e>>24&255]}}(e)||[0,0,0,255]}function o(e){var t=e.toString(16);return 1==t.length?"0"+t:t}function r(e){return 1==e.length?parseInt(e+e,16):parseInt(e,16)}function n(e,t){return"number"!=typeof e||!0===t&&Math.floor(e)!==e?-1:e>=0&&e<=255?e:-1}return at=1,it.exports=e,it.exports.arr=e,it.exports.obj=function(e){var o=t(e);return{r:o[0],g:o[1],b:o[2],a:3==o.length?255:Math.round(o[3])}},it.exports.css=function(e){var o=t(e);3==o.length&&o.push(255);return 255==o[3]?"rgb("+o[0]+", "+o[1]+", "+o[2]+")":0==o[3]?"rgba("+o[0]+", "+o[1]+", "+o[2]+", 0)":"rgba("+o[0]+", "+o[1]+", "+o[2]+", "+String(o[3]/255).substr(1)+")"},it.exports.hex=function(e){var r=t(e);3==r.length&&r.push(255);var n=255==r[3],a=o(r[0]),i=o(r[1]),s=o(r[2]),l=(r=o(Math.round(r[3])),function(e,t,o,r){var n=["ff","00","11","22","33","44","55","66","77","88","99","aa","bb","cc","dd","ee"];return-1!=n.indexOf(e)&&-1!=n.indexOf(t)&&-1!=n.indexOf(o)&&-1!=n.indexOf(r)}(a,i,s,r));if(n)return l?"#"+a.charAt(0)+i.charAt(0)+s.charAt(0):"#"+a+i+s;return l?"#"+a.charAt(0)+i.charAt(0)+s.charAt(0)+r.charAt(0):"#"+a+i+s+r},it.exports.num=function(e){var o=t(e);3==o.length?o.push(255):o[3]=Math.round(o[3]);return(o[3]<<24>>>0|o[0]<<16|o[1]<<8|o[2])>>>0},it.exports}var ct,lt=st(),ut=e(lt),ft={};function dt(){return ct||(ct=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.querySelectorAll=void 0;const t=(e,t)=>{t.forEach(t=>{!1===e.has(t)&&e.add(t)})};e.querySelectorAll=(o,r=document)=>{if(r instanceof Document||r instanceof HTMLElement||r instanceof ShadowRoot){const n=new Set;t(n,r.querySelectorAll(o));const a=r.querySelectorAll('[class*="hydrated"]');for(let r=0;r<a.length;r++){const i=a[r].shadowRoot;t(n,"object"==typeof i&&null!==i?(0,e.querySelectorAll)(o,i):(0,e.querySelectorAll)(o,a[r]))}return Array.from(n)}throw new Error("The parameter document for the method querySelectorAll is not type of Document, HTMLElement or ShadowRoot.")}}(ft)),ft}var gt,pt=dt(),vt={};function ht(){return gt||(gt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.querySelector=void 0;e.querySelector=(t,o=document)=>{if(o instanceof Document||o instanceof HTMLElement||o instanceof ShadowRoot){let r=o.querySelector(t);if(null===r){const n=o.querySelectorAll('[class*="hydrated"]');for(let o=0;o<n.length;o++){const a=n[o].shadowRoot;if(r="object"==typeof a&&null!==a?(0,e.querySelector)(t,a):(0,e.querySelector)(t,n[o]),null!==r)break}}return r}throw new Error("The parameter document for the method querySelector is not type of Document, HTMLElement or ShadowRoot.")}}(vt)),vt}var yt=ht();const bt=/\[object Object\]/,mt=(e,t)=>{"string"==typeof e&&bt.test(e)||t()},wt=(e,t)=>{"string"==typeof e&&""===e||t()},kt=(e,t)=>{de()&&(Te.debug([e,t]),Te.debug("↑ We propagate the (submit) event to this target.")),Object.defineProperty(e,"target",{value:t,writable:!1})},St=e=>{var t,o,r;null===(t=e.nextHooks)||void 0===t||t.forEach((t,o)=>{var r;const n=t.get("beforePatch");"function"==typeof n&&n(null===(r=e.nextState)||void 0===r?void 0:r.get(o),e.nextState,e,o)}),(null===(o=e.nextState)||void 0===o?void 0:o.size)>0&&(e.state=Object.assign(Object.assign({},e.state),Object.fromEntries(e.nextState)),delete e.nextState,null===(r=e.nextHooks)||void 0===r||r.forEach((t,o)=>{const r=t.get("afterPatch");"function"==typeof r&&r(e.state[o],e.state,e,o)})),delete e.nextHooks},Tt=(e,t,o,r={})=>{var n,a;void 0===e.nextHooks&&(e.nextHooks=new Map),void 0===e.nextState&&(e.nextState=new Map);e.nextHooks.get(t)instanceof Map==!1&&e.nextHooks.set(t,new Map),"function"==typeof r.afterPatch&&(null===(n=e.nextHooks.get(t))||void 0===n||n.set("afterPatch",r.afterPatch)),"function"==typeof r.beforePatch&&(null===(a=e.nextHooks.get(t))||void 0===a||a.set("beforePatch",r.beforePatch)),e.nextState.set(t,o),St(e)},Et=(e,t,o,r)=>{Le(`[${e.constructor.name}] The property value: (${o}) for '${t}' is not valid. Allowed values are: ${Array.from(r).join(", ")}`)};function Mt(e,t,o,r,n,a={}){o(n)?Tt(e,t,n,a.hooks):void 0===n&&!0!==a.required&&o(a.defaultValue)?Tt(e,t,a.defaultValue,a.hooks):(a.required||r.add(null),Et(e,t,n,r))}const At=(e,t,o,r)=>{Mt(e,t,e=>"boolean"==typeof e,new Set(["Boolean {true, false}"]),o,r)},Nt=(e,t,o,r={})=>{const n="number"==typeof r.minLength?null==r?void 0:r.minLength:0;Mt(e,t,e=>"string"==typeof e&&e.length>=n&&(void 0===(null==r?void 0:r.maxLength)||e.length<=r.maxLength),new Set(["String"]),o,r)},Ot=(e,t,o,r)=>{Mt(e,t,e=>"number"==typeof e&&(void 0===(null==r?void 0:r.min)||"number"==typeof(null==r?void 0:r.min)&&e>=r.min)&&(void 0===(null==r?void 0:r.max)||"number"==typeof(null==r?void 0:r.max)&&e<=r.max),new Set(["Number"]),o,r)},Lt=(e,t,o,r,n=e=>e==e,a={})=>{wt(r,()=>{mt(r,()=>{void 0===r&&(r=[]);try{try{r=It(r)}catch(e){}if(Array.isArray(r)){const i=r.find(e=>!o(e));void 0===i&&n(r)?Tt(e,t,r,a.hooks):mt(i,()=>{throw Te.debug(i),new Error("↑ The schema for the property (_options) is not valid. The value will not be changed.")})}else mt(r,()=>{throw Te.debug(r),new Error("↑ The schema for the property (_options) is not valid. The value will not be changed.")})}catch(e){Te.debug(e)}})})},Rt=e=>{try{return JSON.stringify(e).replace(/"/g,"'")}catch(t){throw Te.warn(["stringifyJson",e]),Te.error("↑ The JSON could not be converted to a string. A stringifiable JSON is expected."),new Error}},jt=/^[{[]/,It=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){if(jt.test(e))try{return JSON.parse(e.replace(/'/g,'"'))}catch(t){Te.warn(["parseJson",e]),Te.error("↑ The JSON string could not be parsed. Make sure that single quotes in the text are escaped (&#8216;).")}}throw new Error},Ct=e=>"boolean"==typeof e?!0===e?"true":"false":void 0,$t=e=>"string"==typeof e?e:Ct(e),_t=(e,t)=>yt.querySelector(e,t||re()),xt=(e,t)=>pt.querySelectorAll(e,t||re());let Ft=null;const Ht=()=>(Ft=Ft||{backgroundColor:"#00000000",color:"#00000000",domNode:re().body,level:"Fail",score:1},Ft),Pt=/(\d+, ){3}0\)/,qt=(e,t=Ht())=>{const o=getComputedStyle(e),r=Pt.test(o.backgroundColor)?t.backgroundColor:ut.hex(o.backgroundColor),n=Pt.test(o.color)?t.color:ut.hex(o.color),a=We(r,n),i={backgroundColor:r,color:n,domNode:e,level:Ye(a),score:a};return a<4.5&&Te.error(["Color-Contrast-Error",{backgroundColor:i.backgroundColor,color:i.color,level:i.level,score:i.score},i.domNode]),i},Ut=(e,t=Ht())=>{t.domNode instanceof HTMLElement&&(t=qt(t.domNode,t));const o=t.domNode.querySelector(e);if(null===o){const o=t.domNode.querySelectorAll('[class="hydrated"]');for(let r=0;r<o.length&&(t.domNode=o[r],null===(t=Ut(e,t)).domNode);r++);return t}return qt(o,t)};class zt{static queryHtmlElementColors(e,t,o=!1,r=!0){let n=null;if(!0===o||!1===zt.executionLock)if(!1===o&&(zt.cache.clear(),zt.cache.set(t.domNode,t),zt.executionLock=!0,!0===r&&Te.debug("[KoliBriUtils] Color contrast analysis started...")),e===t.domNode)n=t;else{const o=new Set;if(t.domNode.shadowRoot){const e=t.domNode.shadowRoot.children;for(let t=0;t<e.length;t++)o.add(e[t])}const r=t.domNode;if("function"==typeof r.assignedNodes){const e=r.assignedNodes();for(let t=0;t<e.length;t++)e[t]instanceof HTMLElement&&o.add(e[t])}const a=t.domNode.children;for(let e=0;e<a.length;e++)o.add(a[e]);const i=Array.from(o);for(let o=0;o<i.length;o++){let r=zt.cache.get(i[o]);void 0===r&&(r=qt(i[o],t)),zt.cache.set(i[o],r);const a=zt.queryHtmlElementColors(e,r,!0,!1);if(null!==a){n=a;break}}}else Te.debug("[KoliBriUtils] Call aborted because a color contrast analysis is currently being executed.");return!1===o&&(!0===r&&Te.debug(`[KoliBriUtils] Color contrast analysis finished (${zt.cache.size} DOM elements are analysed).`),zt.executionLock=!1,zt.cache.clear()),n}}zt.executionLock=!1,zt.cache=new Map;class Dt{}Dt.getCssStyle=F,Dt.patchTheme=m,Dt.patchThemeTag=y,Dt.querySelector=_t,Dt.querySelectorAll=xt,Dt.stringifyJson=Rt;const Bt=e=>"object"==typeof e&&null!==e,Jt=(e,t=0)=>"string"==typeof e&&e.length>=t,Kt=e=>{if("object"!=typeof e||null===e)return Jt(e,1);for(const t in e)if(!1===Jt(t,1))return!1;return!0},Wt=new Event("StateChange");export{ve as $,ot as A,rt as B,ut as C,We as D,Kt as E,Bt as F,Lt as G,Fe as H,de as I,kt as J,ee as K,Te as L,Ot as M,Re as N,wt as O,_t as P,$t as Q,Ct as R,Wt as S,te as T,fe as U,L as V,qt as W,xt as X,Ut as Y,zt as Z,Rt as _,Dt as a,M as b,xe as c,At as d,Nt as e,Ie as f,Jt as g,Ne as h,Z as i,Le as j,ae as k,e as l,Me as m,X as n,mt as o,It as p,_e as q,re as r,Tt as s,pe as t,$e as u,ge as v,Mt as w,ne as x,ce as y,nt as z};