text: /**
   * @name is-media-descriptor
   * @fileoverview Is given string a valid media descriptor (including media query)?
   * @version 3.1.1
   * @author Roy Revelt, Codsen Ltd
   * @license MIT
   * {@link https://codsen.com/os/is-media-descriptor/}
   */
  
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).isMediaDescriptor={})}(this,(function(e){"use strict";const t=[],o=[],s=(e,s)=>{if(e===s)return 0;const i=e;e.length>s.length&&(e=s,s=i);let f=e.length,r=s.length;for(;f>0&&e.charCodeAt(~-f)===s.charCodeAt(~-r);)f--,r--;let n,l,a,m,c=0;for(;c<f&&e.charCodeAt(c)===s.charCodeAt(c);)c++;if(f-=c,r-=c,0===f)return r;let d=0,u=0;for(;d<f;)o[d]=e.charCodeAt(c+d),t[d]=++d;for(;u<r;)for(n=s.charCodeAt(c+u),a=u++,l=u,d=0;d<f;d++)m=n===o[d]?a:a+1,a=t[d],l=t[d]=a>l?m>l?l+1:m:m>a?a+1:m;return l};var i=s;i.default=s;const f=["all","aural","braille","embossed","handheld","print","projection","screen","speech","tty","tv"],r=["width","min-width","max-width","height","min-height","max-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","orientation","resolution","min-resolution","max-resolution","scan","grid","update","overflow-block","overflow-inline","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","color-gamut","pointer","hover","any-pointer","any-hover"],n=/^\w+$/g;const l={offset:0};e.defaults=l,e.isMediaD=function(e,t){const o={...l,...t};if(o.offset&&!Number.isInteger(o.offset))throw new Error(`is-media-descriptor: [THROW_ID_01] opts.offset must be an integer, it was given as ${o.offset} (type ${typeof o.offset})`);if(o.offset||(o.offset=0),"string"!=typeof e)return[];if(!e.trim())return[];const s=[];let a=0,m=e.length;const c=e.trim();if(e!==e.trim()){const t=[];if(!e[0].trim())for(let s=0,i=e.length;s<i;s++)if(e[s].trim()){t.push([0+o.offset,s+o.offset]),a=s;break}if(!e[e.length-1].trim())for(let s=e.length;s--;)if(e[s].trim()){t.push([s+1+o.offset,e.length+o.offset]),m=s+1;break}s.push({idxFrom:t[0][0],idxTo:t[t.length-1][1],message:"Remove whitespace.",fix:{ranges:t}})}if(f.includes(c))return s;if(["only","not"].includes(c))s.push({idxFrom:a+o.offset,idxTo:m+o.offset,message:"Missing media type or condition.",fix:null});else if(!c.match(n)||c.includes("(")||c.includes(")")){let e=!1;const[t,i]=Array.from(c).reduce(((t,i,f)=>")"===i?(!e&&t[1]+1>t[0]&&(e=!0),[t[0],t[1]+1]):"("===i?[t[0]+1,t[1]]:(";"===i&&s.push({idxFrom:f+o.offset,idxTo:f+1+o.offset,message:"Semicolon found!",fix:null}),t)),[0,0]);if(e&&t===i&&s.push({idxFrom:a+o.offset,idxTo:m+o.offset,message:"Some closing brackets are before their opening counterparts.",fix:null}),t>i?s.push({idxFrom:a+o.offset,idxTo:m+o.offset,message:"More opening brackets than closing.",fix:null}):i>t&&s.push({idxFrom:a+o.offset,idxTo:m+o.offset,message:"More closing brackets than opening.",fix:null}),!s.length&&c.match(/\(\s*\)/g)){let e,t=null;for(let i=0,f=c.length;i<f;i++)"("===c[i]?(t=i,e=!1):")"===c[i]&&t?e?e=!0:s.push({idxFrom:t+o.offset,idxTo:i+1+o.offset,message:"Empty bracket pair.",fix:null}):c[i].trim()&&(e=!0)}if(s.length)return s;!
  /**
   * @name string-process-comma-separated
   * @fileoverview Extracts chunks from possibly comma or whatever-separated string
   * @version 2.0.16
   * @author Roy Revelt, Codsen Ltd
   * @license MIT
   * {@link https://codsen.com/os/string-process-comma-separated/}
   */
  function(e,t){if("string"!=typeof e)throw new Error(`string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ${typeof e}, equal to:\n${JSON.stringify(e,null,4)}`);if(!e.length||!t||!t.cb&&!t.errCb)return;const o={from:0,to:e.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null,...t};Number.isInteger(t.from)||(o.from=0),Number.isInteger(t.to)||(o.to=e.length),Number.isInteger(t.offset)||(o.offset=0);let s=null,i=null,f=!1,r=[],n=null,l=!0;for(let t=o.from;t<o.to;t++){if(e[t].trim()&&e[t]!==o.separator&&(n=t),null!==s||!e[t].trim()||o.separator&&e[t]===o.separator||(f||(f=!0),r.length&&(r.length>1&&r.forEach(((e,t)=>{t&&o.errCb([[e+o.offset,e+1+o.offset]],"Remove separator.",l)})),r=[]),s=t),Number.isInteger(s)&&(t>s&&o.separator&&e[t]===o.separator||t+1===o.to)&&(e.slice(s,t+1===o.to&&e[t]!==o.separator&&e[t].trim()?t+1:t),"function"==typeof o.cb&&o.cb(s+o.offset,(t+1===o.to&&e[t]!==o.separator&&e[t].trim()?t+1:n+1)+o.offset),s=null),e[t].trim()||null!==i||(i=t),null!==i&&(e[t].trim()||t+1===o.to)){if(i===o.from)o.leadingWhitespaceOK||"function"!=typeof o.errCb||o.errCb([[i+o.offset,(t+1===o.to?t+1:t)+o.offset]],"Remove whitespace.",l);else if(e[t].trim()||t+1!==o.to){if(!(o.oneSpaceAfterCommaOK&&e[t].trim()&&t>o.from+1&&" "===e[t-1]&&","===e[t-2]||o.innerWhitespaceAllowed&&f&&e[i-1]&&e[t].trim()&&e[t]!==o.separator&&e[i-1]!==o.separator)){let s=i,r=t;t+1!==o.to||e[t]===o.separator||e[t].trim()||(r+=1);let n="";o.oneSpaceAfterCommaOK&&(" "===e[i]&&e[i-1]===o.separator?s+=1:" "!==e[i]&&(n=" "));let a="Remove whitespace.";!o.innerWhitespaceAllowed&&f&&e[i-1]&&e[t].trim()&&e[t]!==o.separator&&e[i-1]!==o.separator&&(l=!1,a="Bad whitespace."),o.errCb(n.length?[[s+o.offset,r+o.offset,n]]:[[s+o.offset,r+o.offset]],a,l),l=!0}}else o.trailingWhitespaceOK||"function"!=typeof o.errCb||o.errCb([[i+o.offset,t+1+o.offset]],"Remove whitespace.",l);i=null}e[t]===o.separator&&(f?r.push(t):o.errCb([[t+o.offset,t+1+o.offset]],"Remove separator.",l)),t+1===o.to&&r.forEach((e=>{o.errCb([[e+o.offset,e+1+o.offset]],"Remove separator.",l)}))}}(c,{offset:o.offset,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!0,innerWhitespaceAllowed:!0,separator:",",cb:(e,t)=>{!function(e,t,o){let s=null;const i=[];let l=null,a=!0,m=!0,c=!0,d=!1;const u=[];for(let p=t.idxFrom;p<=t.idxTo;p++){if(")"===e[p]){const s=u.pop(),i=e.slice(s+1,p);i.includes("(")||i.includes(")")||i.match(n)&&(r.includes(i.toLowerCase().trim())||o.push({idxFrom:s+1+t.offset,idxTo:p+t.offset,message:`Unrecognised "${i.trim()}".`,fix:null}));const l=new RegExp(f.join("|"),"gi");(i.match(l)||[]).forEach((s=>{const i=e.indexOf(s);o.push({idxFrom:i+t.offset,idxTo:i+s.length+t.offset,message:`Media type "${s}" inside brackets.`,fix:null})}))}if(e[p]&&e[p].trim().length&&null!==l){if("("===e[l-1]||")"===e[p])o.push({idxFrom:l+t.offset,idxTo:p+t.offset,message:"Bad whitespace.",fix:{ranges:[[l+t.offset,p+t.offset]]}});else if(l<p-1||" "!==e[p-1]){let s=l+t.offset,i=p+t.offset,f=" ";l!==p-1&&(" "===e[l]?(s+=1,f=null):" "===e[p-1]&&(i-=1,f=null)),o.push({idxFrom:l+t.offset,idxTo:p+t.offset,message:"Bad whitespace.",fix:{ranges:[f?[s,i," "]:[s,i]]}})}l=null}if(e[p]&&!e[p].trim().length&&null===l&&(l=p),!(null===s||e[p]&&e[p].trim().length&&"("!==e[p]||u.length)){const n=e.slice(s,p);if(i.push(n.toLowerCase()),!d||(a||m)&&"and"!==n)if(c&&["not","only"].includes(n))c=!1,m=!1;else if(a||m){if(n.startsWith("("))if(m);else{let f=`Media condition "${e.slice(s,p)}" can't be here.`;"not"===i[i.length-2]&&(f='"not" can be only in front of media type.'),o.push({idxFrom:s+t.offset,idxTo:p+t.offset,message:f,fix:null})}else{if(!a){let i=`Expected brackets on "${n}".`,l=null,a=p+t.offset;if(["not","else","or"].includes(n.toLowerCase()))i=`"${n}" can't be here.`;else if(f.includes(n.toLowerCase()))i="Unexpected media type, try using a comma.";else if(r.includes(n.toLowerCase()))i="Missing brackets.",l={ranges:[[s+t.offset,s+t.offset,"("],[p+t.offset,p+t.offset,")"]]};else if(e.slice(p).trim().startsWith(":")){const e=n.slice(0,p).trim();i=`Expected brackets on "${e}" and its value.`,a=s+e.length+t.offset}o.push({idxFrom:s+t.offset,idxTo:a,message:i,fix:l});break}if(f.includes(n.toLowerCase()))a=!1,m=!1;else{let e=`Unrecognised "${n}".`;n.match(/\w/g)?["and","only","or","not"].includes(n.toLowerCase())&&(e=`"${n}" instead of a media type.`):e=`Strange symbol${1===n.trim().length?"":"s"} "${n}".`,o.push({idxFrom:s+t.offset,idxTo:p+t.offset,message:e,fix:null})}}d=!0}else o.push({idxFrom:s+t.offset,idxTo:p+t.offset,message:`Unrecognised media type "${e.slice(s,p)}".`,fix:null});else"and"!==n.toLowerCase()?o.push({idxFrom:s+t.offset,idxTo:p+t.offset,message:`Expected "and", found "${n}".`,fix:null}):e[p]?e[p].trim()&&o.push({idxFrom:s+t.offset,idxTo:p+t.offset,message:'Space after "and" missing.',fix:{ranges:[[p+t.offset,p+t.offset," "]]}}):o.push({idxFrom:s+t.offset,idxTo:p+t.offset,message:`Dangling "${n}".`,fix:{ranges:[[e.slice(0,s).trim().length+t.offset,p+t.offset]]}}),d=!1,m=!0;s=null,c&&(c=!1)}null===s&&e[p]&&e[p].trim().length&&")"!==e[p]&&(s=p),"("===e[p]&&u.push(p)}}(c,{...o,idxFrom:e-o.offset,idxTo:t-o.offset},s)},errCb:(e,t)=>{}})}else for(let e=0,t=f.length;e<t;e++){if(1===i(f[e],c)){s.push({idxFrom:a+o.offset,idxTo:m+o.offset,message:`Did you mean "${f[e]}"?`,fix:{ranges:[[a+o.offset,m+o.offset,f[e]]]}});break}e===t-1&&s.push({idxFrom:a+o.offset,idxTo:m+o.offset,message:`Unrecognised media type "${c}".`,fix:null})}return s},e.version="3.1.1",Object.defineProperty(e,"__esModule",{value:!0})}));
  