UNPKG

deep-focus-trap

Version:

A focus trap library that pierces that shadow dom. So you can use it with native web components. Deep Focus Trap is a lightweight library written in vanilla js with only one dependency (that is tree-shakable if not in use).

1 lines 51.8 kB
var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t=e(((e,t)=>{t.exports=function(e,t){for(var r=-1,s=[];-1!==(r=e.indexOf(t,r+1));)s.push(r);return s}})),r=e(((e,t)=>{t.exports=function(e,t,r){return 0===e.length?e:t?(r||e.sort(t),function(e,t){for(var r=1,s=e.length,n=e[0],i=e[0],o=1;o<s;++o)if(i=n,t(n=e[o],i)){if(o===r){r++;continue}e[r++]=n}return e.length=r,e}(e,t)):(r||e.sort(),function(e){for(var t=1,r=e.length,s=e[0],n=e[0],i=1;i<r;++i,n=s)if(n=s,(s=e[i])!==n){if(i===t){t++;continue}e[t++]=s}return e.length=t,e}(e))}})),s=e(((e,t)=>{e.__esModule=!0,e.default=function(e){return e.replace(r,(function(e,t,r){var s="0x"+t-65536;return s!=s||r?t:s<0?String.fromCharCode(s+65536):String.fromCharCode(s>>10|55296,1023&s|56320)}))};var r=new RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)","ig");t.exports=e.default})),n=e(((e,t)=>{e.__esModule=!0,e.default=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];for(;r.length>0;){var n=r.shift();if(!e[n])return;e=e[n]}return e},t.exports=e.default})),i=e(((e,t)=>{e.__esModule=!0,e.default=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];for(;r.length>0;){var n=r.shift();e[n]||(e[n]={}),e=e[n]}},t.exports=e.default})),o=e(((e,t)=>{e.__esModule=!0,e.default=function(e){var t="",r=e.indexOf("/*"),s=0;for(;r>=0;){t+=e.slice(s,r);var n=e.indexOf("*/",r+2);if(n<0)return t;s=n+2,r=e.indexOf("/*",s)}return t+=e.slice(s)},t.exports=e.default})),a=e((e=>{e.__esModule=!0,e.stripComments=e.ensureObject=e.getProp=e.unesc=void 0;var t=c(s());e.unesc=t.default;var r=c(n());e.getProp=r.default;var a=c(i());e.ensureObject=a.default;var u=c(o());function c(e){return e&&e.__esModule?e:{default:e}}e.stripComments=u.default})),u=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r=a();function s(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var n=function e(t,r){if("object"!=typeof t||null===t)return t;var s=new t.constructor;for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];"parent"===n&&"object"===typeof i?r&&(s[n]=r):s[n]=i instanceof Array?i.map((function(t){return e(t,s)})):e(i,s)}return s},i=function(){function e(e){void 0===e&&(e={}),Object.assign(this,e),this.spaces=this.spaces||{},this.spaces.before=this.spaces.before||"",this.spaces.after=this.spaces.after||""}var t,i,o,a=e.prototype;return a.remove=function(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this},a.replaceWith=function(){if(this.parent){for(var e in arguments)this.parent.insertBefore(this,arguments[e]);this.remove()}return this},a.next=function(){return this.parent.at(this.parent.index(this)+1)},a.prev=function(){return this.parent.at(this.parent.index(this)-1)},a.clone=function(e){void 0===e&&(e={});var t=n(this);for(var r in e)t[r]=e[r];return t},a.appendToPropertyAndEscape=function(e,t,r){this.raws||(this.raws={});var s=this[e],n=this.raws[e];this[e]=s+t,n||r!==t?this.raws[e]=(n||s)+r:delete this.raws[e]},a.setPropertyAndEscape=function(e,t,r){this.raws||(this.raws={}),this[e]=t,this.raws[e]=r},a.setPropertyWithoutEscape=function(e,t){this[e]=t,this.raws&&delete this.raws[e]},a.isAtPosition=function(e,t){if(this.source&&this.source.start&&this.source.end)return!(this.source.start.line>e)&&(!(this.source.end.line<e)&&(!(this.source.start.line===e&&this.source.start.column>t)&&!(this.source.end.line===e&&this.source.end.column<t)))},a.stringifyProperty=function(e){return this.raws&&this.raws[e]||this[e]},a.valueToString=function(){return String(this.stringifyProperty("value"))},a.toString=function(){return[this.rawSpaceBefore,this.valueToString(),this.rawSpaceAfter].join("")},t=e,(i=[{key:"rawSpaceBefore",get:function(){var e=this.raws&&this.raws.spaces&&this.raws.spaces.before;return void 0===e&&(e=this.spaces&&this.spaces.before),e||""},set:function(e){(0,r.ensureObject)(this,"raws","spaces"),this.raws.spaces.before=e}},{key:"rawSpaceAfter",get:function(){var e=this.raws&&this.raws.spaces&&this.raws.spaces.after;return void 0===e&&(e=this.spaces.after),e||""},set:function(e){(0,r.ensureObject)(this,"raws","spaces"),this.raws.spaces.after=e}}])&&s(t.prototype,i),o&&s(t,o),e}();e.default=i,t.exports=e.default})),c=e((e=>{e.__esModule=!0,e.UNIVERSAL=e.ATTRIBUTE=e.CLASS=e.COMBINATOR=e.COMMENT=e.ID=e.NESTING=e.PSEUDO=e.ROOT=e.SELECTOR=e.STRING=e.TAG=void 0;e.TAG="tag";e.STRING="string";e.SELECTOR="selector";e.ROOT="root";e.PSEUDO="pseudo";e.NESTING="nesting";e.ID="id";e.COMMENT="comment";e.COMBINATOR="combinator";e.CLASS="class";e.ATTRIBUTE="attribute";e.UNIVERSAL="universal"})),l=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=u())&&r.__esModule?r:{default:r},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};s.get||s.set?Object.defineProperty(t,r,s):t[r]=e[r]}return t.default=e,t}(c());function i(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var o=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).nodes||(r.nodes=[]),r}r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o,a,u,c=s.prototype;return c.append=function(e){return e.parent=this,this.nodes.push(e),this},c.prepend=function(e){return e.parent=this,this.nodes.unshift(e),this},c.at=function(e){return this.nodes[e]},c.index=function(e){return"number"==typeof e?e:this.nodes.indexOf(e)},c.removeChild=function(e){var t;for(var r in e=this.index(e),this.at(e).parent=void 0,this.nodes.splice(e,1),this.indexes)(t=this.indexes[r])>=e&&(this.indexes[r]=t-1);return this},c.removeAll=function(){var e=this.nodes,t=Array.isArray(e),r=0;for(e=t?e:e[Symbol.iterator]();;){var s;if(t){if(r>=e.length)break;s=e[r++]}else{if((r=e.next()).done)break;s=r.value}s.parent=void 0}return this.nodes=[],this},c.empty=function(){return this.removeAll()},c.insertAfter=function(e,t){t.parent=this;var r,s=this.index(e);for(var n in this.nodes.splice(s+1,0,t),t.parent=this,this.indexes)s<=(r=this.indexes[n])&&(this.indexes[n]=r+1);return this},c.insertBefore=function(e,t){t.parent=this;var r,s=this.index(e);for(var n in this.nodes.splice(s,0,t),t.parent=this,this.indexes)(r=this.indexes[n])<=s&&(this.indexes[n]=r+1);return this},c._findChildAtPosition=function(e,t){var r=void 0;return this.each((function(s){if(s.atPosition){var n=s.atPosition(e,t);if(n)return r=n,!1}else if(s.isAtPosition(e,t))return r=s,!1})),r},c.atPosition=function(e,t){return this.isAtPosition(e,t)?this._findChildAtPosition(e,t)||this:void 0},c._inferEndPosition=function(){this.last&&this.last.source&&this.last.source.end&&(this.source=this.source||{},this.source.end=this.source.end||{},Object.assign(this.source.end,this.last.source.end))},c.each=function(e){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach++;var t=this.lastEach;if(this.indexes[t]=0,this.length){for(var r,s;this.indexes[t]<this.length&&(r=this.indexes[t],!1!==(s=e(this.at(r),r)));)this.indexes[t]+=1;return delete this.indexes[t],!1!==s&&void 0}},c.walk=function(e){return this.each((function(t,r){var s=e(t,r);if(!1!==s&&t.length&&(s=t.walk(e)),!1===s)return!1}))},c.walkAttributes=function(e){var t=this;return this.walk((function(r){if(r.type===n.ATTRIBUTE)return e.call(t,r)}))},c.walkClasses=function(e){var t=this;return this.walk((function(r){if(r.type===n.CLASS)return e.call(t,r)}))},c.walkCombinators=function(e){var t=this;return this.walk((function(r){if(r.type===n.COMBINATOR)return e.call(t,r)}))},c.walkComments=function(e){var t=this;return this.walk((function(r){if(r.type===n.COMMENT)return e.call(t,r)}))},c.walkIds=function(e){var t=this;return this.walk((function(r){if(r.type===n.ID)return e.call(t,r)}))},c.walkNesting=function(e){var t=this;return this.walk((function(r){if(r.type===n.NESTING)return e.call(t,r)}))},c.walkPseudos=function(e){var t=this;return this.walk((function(r){if(r.type===n.PSEUDO)return e.call(t,r)}))},c.walkTags=function(e){var t=this;return this.walk((function(r){if(r.type===n.TAG)return e.call(t,r)}))},c.walkUniversals=function(e){var t=this;return this.walk((function(r){if(r.type===n.UNIVERSAL)return e.call(t,r)}))},c.split=function(e){var t=this,r=[];return this.reduce((function(s,n,i){var o=e.call(t,n);return r.push(n),o?(s.push(r),r=[]):i===t.length-1&&s.push(r),s}),[])},c.map=function(e){return this.nodes.map(e)},c.reduce=function(e,t){return this.nodes.reduce(e,t)},c.every=function(e){return this.nodes.every(e)},c.some=function(e){return this.nodes.some(e)},c.filter=function(e){return this.nodes.filter(e)},c.sort=function(e){return this.nodes.sort(e)},c.toString=function(){return this.map(String).join("")},o=s,(a=[{key:"first",get:function(){return this.at(0)}},{key:"last",get:function(){return this.at(this.length-1)}},{key:"length",get:function(){return this.nodes.length}}])&&i(o.prototype,a),u&&i(o,u),s}(s.default);e.default=o,t.exports=e.default})),h=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=l())&&r.__esModule?r:{default:r},n=c();function i(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var o=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.ROOT,r}r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var o,a,u,c=s.prototype;return c.toString=function(){var e=this.reduce((function(e,t){return e.push(String(t)),e}),[]).join(",");return this.trailingComma?e+",":e},c.error=function(e,t){return this._error?this._error(e,t):new Error(e)},o=s,(a=[{key:"errorGenerator",set:function(e){this._error=e}}])&&i(o.prototype,a),u&&i(o,u),s}(s.default);e.default=o,t.exports=e.default})),f=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=l())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.SELECTOR,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),p=e(((e,t)=>{var r={}.hasOwnProperty,s=/[ -,\.\/:-@\[-\^`\{-~]/,n=/[ -,\.\/:-@\[\]\^`\{-~]/,i=/(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g,o=function e(t,o){"single"!=(o=function(e,t){if(!e)return t;var s={};for(var n in t)s[n]=r.call(e,n)?e[n]:t[n];return s}(o,e.options)).quotes&&"double"!=o.quotes&&(o.quotes="single");for(var a="double"==o.quotes?'"':"'",u=o.isIdentifier,c=t.charAt(0),l="",h=0,f=t.length;h<f;){var p=t.charAt(h++),d=p.charCodeAt(),v=void 0;if(d<32||d>126){if(d>=55296&&d<=56319&&h<f){var E=t.charCodeAt(h++);56320==(64512&E)?d=((1023&d)<<10)+(1023&E)+65536:h--}v="\\"+d.toString(16).toUpperCase()+" "}else v=o.escapeEverything?s.test(p)?"\\"+p:"\\"+d.toString(16).toUpperCase()+" ":/[\t\n\f\r\x0B]/.test(p)?"\\"+d.toString(16).toUpperCase()+" ":"\\"==p||!u&&('"'==p&&a==p||"'"==p&&a==p)||u&&n.test(p)?"\\"+p:p;l+=v}return u&&(/^-[-\d]/.test(l)?l="\\-"+l.slice(1):/\d/.test(c)&&(l="\\3"+c+" "+l.slice(1))),l=l.replace(i,(function(e,t,r){return t&&t.length%2?e:(t||"")+r})),!u&&o.wrap?a+l+a:l};o.options={escapeEverything:!1,isIdentifier:!1,quotes:"single",wrap:!1},o.version="3.0.0",t.exports=o})),d=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r=o(p()),s=a(),n=o(u()),i=c();function o(e){return e&&e.__esModule?e:{default:e}}function l(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var h=function(e){var t,n,o,a,u;function c(t){var r;return(r=e.call(this,t)||this).type=i.CLASS,r._constructed=!0,r}return n=e,(t=c).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,c.prototype.valueToString=function(){return"."+e.prototype.valueToString.call(this)},o=c,(a=[{key:"value",set:function(e){if(this._constructed){var t=(0,r.default)(e,{isIdentifier:!0});t!==e?((0,s.ensureObject)(this,"raws"),this.raws.value=t):this.raws&&delete this.raws.value}this._value=e},get:function(){return this._value}}])&&l(o.prototype,a),u&&l(o,u),c}(n.default);e.default=h,t.exports=e.default})),v=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=u())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.COMMENT,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),E=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=u())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.ID,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s.prototype.valueToString=function(){return"#"+e.prototype.valueToString.call(this)},s}(s.default);e.default=i,t.exports=e.default})),_=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r=n(p()),s=a();function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var o=function(e){var t,n;function o(){return e.apply(this,arguments)||this}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n;var a,u,c,l=o.prototype;return l.qualifiedName=function(e){return this.namespace?this.namespaceString+"|"+e:e},l.valueToString=function(){return this.qualifiedName(e.prototype.valueToString.call(this))},a=o,(u=[{key:"namespace",get:function(){return this._namespace},set:function(e){if(!0===e||"*"===e||"&"===e)return this._namespace=e,void(this.raws&&delete this.raws.namespace);var t=(0,r.default)(e,{isIdentifier:!0});this._namespace=e,t!==e?((0,s.ensureObject)(this,"raws"),this.raws.namespace=t):this.raws&&delete this.raws.namespace}},{key:"ns",get:function(){return this._namespace},set:function(e){this.namespace=e}},{key:"namespaceString",get:function(){if(this.namespace){var e=this.stringifyProperty("namespace");return!0===e?"":e}return""}}])&&i(a.prototype,u),c&&i(a,c),o}(n(u()).default);e.default=o,t.exports=e.default})),S=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=_())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.TAG,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),T=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=u())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.STRING,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),b=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=l())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.PSEUDO,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s.prototype.toString=function(){var e=this.length?"("+this.map(String).join(",")+")":"";return[this.rawSpaceBefore,this.stringifyProperty("value"),e,this.rawSpaceAfter].join("")},s}(s.default);e.default=i,t.exports=e.default})),w=e(((e,t)=>{function r(e){try{if(!global.localStorage)return!1}catch(e){return!1}var t=global.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var s=!1;return function(){if(!s){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),s=!0}return e.apply(this,arguments)}}})),g=e((e=>{e.__esModule=!0,e.unescapeValue=E,e.default=void 0;var t,r=a(p()),n=a(s()),i=a(_()),o=c();function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var l=w(),h=/^('|")(.*)\1$/,f=l((function(){}),"Assigning an attribute a value containing characters that might need to be escaped is deprecated. Call attribute.setValue() instead."),d=l((function(){}),"Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead."),v=l((function(){}),"Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");function E(e){var t=!1,r=null,s=e,i=s.match(h);return i&&(r=i[1],s=i[2]),(s=(0,n.default)(s))!==e&&(t=!0),{deprecatedUsage:t,unescaped:s,quoteMark:r}}var S=function(e){var t,s;function n(t){var r;return void 0===t&&(t={}),r=e.call(this,function(e){if(void 0!==e.quoteMark)return e;if(void 0===e.value)return e;v();var t=E(e.value),r=t.quoteMark,s=t.unescaped;return e.raws||(e.raws={}),void 0===e.raws.value&&(e.raws.value=e.value),e.value=s,e.quoteMark=r,e}(t))||this,r.type=o.ATTRIBUTE,r.raws=r.raws||{},Object.defineProperty(r.raws,"unquoted",{get:l((function(){return r.value}),"attr.raws.unquoted is deprecated. Call attr.value instead."),set:l((function(){return r.value}),"Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")}),r._constructed=!0,r}s=e,(t=n).prototype=Object.create(s.prototype),t.prototype.constructor=t,t.__proto__=s;var i,a,c,h=n.prototype;return h.getQuotedValue=function(e){void 0===e&&(e={});var t=this._determineQuoteMark(e),s=T[t];return(0,r.default)(this._value,s)},h._determineQuoteMark=function(e){return e.smart?this.smartQuoteMark(e):this.preferredQuoteMark(e)},h.setValue=function(e,t){void 0===t&&(t={}),this._value=e,this._quoteMark=this._determineQuoteMark(t),this._syncRawValue()},h.smartQuoteMark=function(e){var t=this.value,s=t.replace(/[^']/g,"").length,i=t.replace(/[^"]/g,"").length;if(s+i===0){var o=(0,r.default)(t,{isIdentifier:!0});if(o===t)return n.NO_QUOTE;var a=this.preferredQuoteMark(e);if(a===n.NO_QUOTE){var u=this.quoteMark||e.quoteMark||n.DOUBLE_QUOTE,c=T[u];if((0,r.default)(t,c).length<o.length)return u}return a}return i===s?this.preferredQuoteMark(e):i<s?n.DOUBLE_QUOTE:n.SINGLE_QUOTE},h.preferredQuoteMark=function(e){var t=e.preferCurrentQuoteMark?this.quoteMark:e.quoteMark;return void 0===t&&(t=e.preferCurrentQuoteMark?e.quoteMark:this.quoteMark),void 0===t&&(t=n.DOUBLE_QUOTE),t},h._syncRawValue=function(){var e=(0,r.default)(this._value,T[this.quoteMark]);e===this._value?this.raws&&delete this.raws.value:this.raws.value=e},h._handleEscapes=function(e,t){if(this._constructed){var s=(0,r.default)(t,{isIdentifier:!0});s!==t?this.raws[e]=s:delete this.raws[e]}},h._spacesFor=function(e){var t=this.spaces[e]||{},r=this.raws.spaces&&this.raws.spaces[e]||{};return Object.assign({before:"",after:""},t,r)},h._stringFor=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=b);var s=this._spacesFor(t);return r(this.stringifyProperty(e),s)},h.offsetOf=function(e){var t=1,r=this._spacesFor("attribute");if(t+=r.before.length,"namespace"===e||"ns"===e)return this.namespace?t:-1;if("attributeNS"===e)return t;if(t+=this.namespaceString.length,this.namespace&&(t+=1),"attribute"===e)return t;t+=this.stringifyProperty("attribute").length,t+=r.after.length;var s=this._spacesFor("operator");t+=s.before.length;var n=this.stringifyProperty("operator");if("operator"===e)return n?t:-1;t+=n.length,t+=s.after.length;var i=this._spacesFor("value");t+=i.before.length;var o=this.stringifyProperty("value");return"value"===e?o?t:-1:(t+=o.length,t+=i.after.length,t+=this._spacesFor("insensitive").before.length,"insensitive"===e&&this.insensitive?t:-1)},h.toString=function(){var e=this,t=[this.rawSpaceBefore,"["];return t.push(this._stringFor("qualifiedAttribute","attribute")),this.operator&&(this.value||""===this.value)&&(t.push(this._stringFor("operator")),t.push(this._stringFor("value")),t.push(this._stringFor("insensitiveFlag","insensitive",(function(t,r){return!(t.length>0)||e.quoted||0!==r.before.length||e.spaces.value&&e.spaces.value.after||(r.before=" "),b(t,r)})))),t.push("]"),t.push(this.rawSpaceAfter),t.join("")},i=n,(a=[{key:"quoted",get:function(){var e=this.quoteMark;return"'"===e||'"'===e},set:function(e){d()}},{key:"quoteMark",get:function(){return this._quoteMark},set:function(e){this._constructed?this._quoteMark!==e&&(this._quoteMark=e,this._syncRawValue()):this._quoteMark=e}},{key:"qualifiedAttribute",get:function(){return this.qualifiedName(this.raws.attribute||this.attribute)}},{key:"insensitiveFlag",get:function(){return this.insensitive?"i":""}},{key:"value",get:function(){return this._value},set:function(e){if(this._constructed){var t=E(e),r=t.deprecatedUsage,s=t.unescaped,n=t.quoteMark;if(r&&f(),s===this._value&&n===this._quoteMark)return;this._value=s,this._quoteMark=n,this._syncRawValue()}else this._value=e}},{key:"attribute",get:function(){return this._attribute},set:function(e){this._handleEscapes("attribute",e),this._attribute=e}}])&&u(i.prototype,a),c&&u(i,c),n}(i.default);e.default=S,S.NO_QUOTE=null,S.SINGLE_QUOTE="'",S.DOUBLE_QUOTE='"';var T=((t={"'":{quotes:"single",wrap:!0},'"':{quotes:"double",wrap:!0}}).null={isIdentifier:!0},t);function b(e,t){return""+t.before+e+t.after}})),m=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=_())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.UNIVERSAL,r.value="*",r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),k=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=u())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.COMBINATOR,r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),y=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=u())&&r.__esModule?r:{default:r},n=c();var i=function(e){var t,r;function s(t){var r;return(r=e.call(this,t)||this).type=n.NESTING,r.value="&",r}return r=e,(t=s).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,s}(s.default);e.default=i,t.exports=e.default})),O=e(((e,t)=>{e.__esModule=!0,e.default=function(e){return e.sort((function(e,t){return e-t}))},t.exports=e.default})),I=e((e=>{e.__esModule=!0,e.combinator=e.word=e.comment=e.str=e.tab=e.newline=e.feed=e.cr=e.backslash=e.bang=e.slash=e.doubleQuote=e.singleQuote=e.space=e.greaterThan=e.pipe=e.equals=e.plus=e.caret=e.tilde=e.dollar=e.closeSquare=e.openSquare=e.closeParenthesis=e.openParenthesis=e.semicolon=e.colon=e.comma=e.at=e.asterisk=e.ampersand=void 0;e.ampersand=38;e.asterisk=42;e.at=64;e.comma=44;e.colon=58;e.semicolon=59;e.openParenthesis=40;e.closeParenthesis=41;e.openSquare=91;e.closeSquare=93;e.dollar=36;e.tilde=126;e.caret=94;e.plus=43;e.equals=61;e.pipe=124;e.greaterThan=62;e.space=32;e.singleQuote=39;e.doubleQuote=34;e.slash=47;e.bang=33;e.backslash=92;e.cr=13;e.feed=12;e.newline=10;e.tab=9;e.str=39;e.comment=-1;e.word=-2;e.combinator=-3})),L=e((e=>{e.__esModule=!0,e.default=function(e){var t,r,n,i,o,a,u,l,h,f,p,d,v,E=[],_=e.css.valueOf(),S=_.length,T=-1,b=1,w=0,g=0;function m(t,r){if(!e.safe)throw e.error("Unclosed "+t,b,w-T,w);h=(_+=r).length-1}for(;w<S;){switch((t=_.charCodeAt(w))===s.newline&&(T=w,b+=1),t){case s.space:case s.tab:case s.newline:case s.cr:case s.feed:h=w;do{h+=1,(t=_.charCodeAt(h))===s.newline&&(T=h,b+=1)}while(t===s.space||t===s.newline||t===s.tab||t===s.cr||t===s.feed);v=s.space,i=b,n=h-T-1,g=h;break;case s.plus:case s.greaterThan:case s.tilde:case s.pipe:h=w;do{h+=1,t=_.charCodeAt(h)}while(t===s.plus||t===s.greaterThan||t===s.tilde||t===s.pipe);v=s.combinator,i=b,n=w-T,g=h;break;case s.asterisk:case s.ampersand:case s.bang:case s.comma:case s.equals:case s.dollar:case s.caret:case s.openSquare:case s.closeSquare:case s.colon:case s.semicolon:case s.openParenthesis:case s.closeParenthesis:v=t,i=b,n=w-T,g=(h=w)+1;break;case s.singleQuote:case s.doubleQuote:d=t===s.singleQuote?"'":'"',h=w;do{for(o=!1,-1===(h=_.indexOf(d,h+1))&&m("quote",d),a=h;_.charCodeAt(a-1)===s.backslash;)a-=1,o=!o}while(o);v=s.str,i=b,n=w-T,g=h+1;break;default:t===s.slash&&_.charCodeAt(w+1)===s.asterisk?(0===(h=_.indexOf("*/",w+2)+1)&&m("comment","*/"),r=_.slice(w,h+1),l=r.split("\n"),(u=l.length-1)>0?(f=b+u,p=h-l[u].length):(f=b,p=T),v=s.comment,b=f,i=f,n=h-p):t===s.slash?(v=t,i=b,n=w-T,g=(h=w)+1):(h=c(_,w),v=s.word,i=b,n=h-T),g=h+1}E.push([v,b,w-T,i,n,w,g]),p&&(T=p,p=null),w=g}return E},e.FIELDS=void 0;var t,r,s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};s.get||s.set?Object.defineProperty(t,r,s):t[r]=e[r]}return t.default=e,t}(I());for(var n=((t={})[s.tab]=!0,t[s.newline]=!0,t[s.cr]=!0,t[s.feed]=!0,t),i=((r={})[s.space]=!0,r[s.tab]=!0,r[s.newline]=!0,r[s.cr]=!0,r[s.feed]=!0,r[s.ampersand]=!0,r[s.asterisk]=!0,r[s.bang]=!0,r[s.comma]=!0,r[s.colon]=!0,r[s.semicolon]=!0,r[s.openParenthesis]=!0,r[s.closeParenthesis]=!0,r[s.openSquare]=!0,r[s.closeSquare]=!0,r[s.singleQuote]=!0,r[s.doubleQuote]=!0,r[s.plus]=!0,r[s.pipe]=!0,r[s.tilde]=!0,r[s.greaterThan]=!0,r[s.equals]=!0,r[s.dollar]=!0,r[s.caret]=!0,r[s.slash]=!0,r),o={},a="0123456789abcdefABCDEF",u=0;u<a.length;u++)o[a.charCodeAt(u)]=!0;function c(e,t){var r,n=t;do{if(r=e.charCodeAt(n),i[r])return n-1;r===s.backslash?n=l(e,n)+1:n++}while(n<e.length);return n-1}function l(e,t){var r=t,i=e.charCodeAt(r+1);if(n[i]);else if(o[i]){var a=0;do{r++,a++,i=e.charCodeAt(r+1)}while(o[i]&&a<6);a<6&&i===s.space&&r++}else r++;return r}e.FIELDS={TYPE:0,START_LINE:1,START_COL:2,END_LINE:3,END_COL:4,START_POS:5,END_POS:6}})),P=e(((e,s)=>{e.__esModule=!0,e.default=void 0;var n,i,o=Q(t()),u=Q(r()),l=Q(h()),p=Q(f()),_=Q(d()),w=Q(v()),P=Q(E()),x=Q(S()),F=Q(T()),D=Q(b()),A=B(g()),M=Q(m()),N=Q(k()),C=Q(y()),R=Q(O()),q=B(L()),j=B(I()),U=B(c()),Y=a();function B(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};s.get||s.set?Object.defineProperty(t,r,s):t[r]=e[r]}return t.default=e,t}function Q(e){return e&&e.__esModule?e:{default:e}}function G(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var W=((n={})[j.space]=!0,n[j.cr]=!0,n[j.feed]=!0,n[j.newline]=!0,n[j.tab]=!0,n),V=Object.assign({},W,((i={})[j.comment]=!0,i));function K(e){return{line:e[q.FIELDS.START_LINE],column:e[q.FIELDS.START_COL]}}function $(e){return{line:e[q.FIELDS.END_LINE],column:e[q.FIELDS.END_COL]}}function H(e,t,r,s){return{start:{line:e,column:t},end:{line:r,column:s}}}function z(e){return H(e[q.FIELDS.START_LINE],e[q.FIELDS.START_COL],e[q.FIELDS.END_LINE],e[q.FIELDS.END_COL])}function J(e,t){if(e)return H(e[q.FIELDS.START_LINE],e[q.FIELDS.START_COL],t[q.FIELDS.END_LINE],t[q.FIELDS.END_COL])}function X(e,t){var r=e[t];if("string"==typeof r)return-1!==r.indexOf("\\")&&((0,Y.ensureObject)(e,"raws"),e[t]=(0,Y.unesc)(r),void 0===e.raws[t]&&(e.raws[t]=r)),e}var Z=function(){function e(e,t){void 0===t&&(t={}),this.rule=e,this.options=Object.assign({lossy:!1,safe:!1},t),this.position=0,this.css="string"==typeof this.rule?this.rule:this.rule.selector,this.tokens=(0,q.default)({css:this.css,error:this._errorGenerator(),safe:this.options.safe});var r=J(this.tokens[0],this.tokens[this.tokens.length-1]);this.root=new l.default({source:r}),this.root.errorGenerator=this._errorGenerator();var s=new p.default({source:{start:{line:1,column:1}}});this.root.append(s),this.current=s,this.loop()}var t,r,s,n=e.prototype;return n._errorGenerator=function(){var e=this;return function(t,r){return"string"==typeof e.rule?new Error(t):e.rule.error(t,r)}},n.attribute=function(){var e=[],t=this.currToken;for(this.position++;this.position<this.tokens.length&&this.currToken[q.FIELDS.TYPE]!==j.closeSquare;)e.push(this.currToken),this.position++;if(this.currToken[q.FIELDS.TYPE]!==j.closeSquare)return this.expected("closing square bracket",this.currToken[q.FIELDS.START_POS]);var r=e.length,s={source:H(t[1],t[2],this.currToken[3],this.currToken[4]),sourceIndex:t[q.FIELDS.START_POS]};if(1===r&&!~[j.word].indexOf(e[0][q.FIELDS.TYPE]))return this.expected("attribute",e[0][q.FIELDS.START_POS]);for(var n=0,i="",o="",a=null,u=!1;n<r;){var c=e[n],l=this.content(c),h=e[n+1];switch(c[q.FIELDS.TYPE]){case j.space:if(u=!0,this.options.lossy)break;if(a){(0,Y.ensureObject)(s,"spaces",a);var f=s.spaces[a].after||"";s.spaces[a].after=f+l;var p=(0,Y.getProp)(s,"raws","spaces",a,"after")||null;p&&(s.raws.spaces[a].after=p+l)}else i+=l,o+=l;break;case j.asterisk:if(h[q.FIELDS.TYPE]===j.equals)s.operator=l,a="operator";else if((!s.namespace||"namespace"===a&&!u)&&h){i&&((0,Y.ensureObject)(s,"spaces","attribute"),s.spaces.attribute.before=i,i=""),o&&((0,Y.ensureObject)(s,"raws","spaces","attribute"),s.raws.spaces.attribute.before=i,o=""),s.namespace=(s.namespace||"")+l,((0,Y.getProp)(s,"raws","namespace")||null)&&(s.raws.namespace+=l),a="namespace"}u=!1;break;case j.dollar:if("value"===a){var d=(0,Y.getProp)(s,"raws","value");s.value+="$",d&&(s.raws.value=d+"$");break}case j.caret:h[q.FIELDS.TYPE]===j.equals&&(s.operator=l,a="operator"),u=!1;break;case j.combinator:if("~"===l&&h[q.FIELDS.TYPE]===j.equals&&(s.operator=l,a="operator"),"|"!==l){u=!1;break}h[q.FIELDS.TYPE]===j.equals?(s.operator=l,a="operator"):s.namespace||s.attribute||(s.namespace=!0),u=!1;break;case j.word:if(h&&"|"===this.content(h)&&e[n+2]&&e[n+2][q.FIELDS.TYPE]!==j.equals&&!s.operator&&!s.namespace)s.namespace=l,a="namespace";else if(!s.attribute||"attribute"===a&&!u){i&&((0,Y.ensureObject)(s,"spaces","attribute"),s.spaces.attribute.before=i,i=""),o&&((0,Y.ensureObject)(s,"raws","spaces","attribute"),s.raws.spaces.attribute.before=o,o=""),s.attribute=(s.attribute||"")+l,((0,Y.getProp)(s,"raws","attribute")||null)&&(s.raws.attribute+=l),a="attribute"}else if(!s.value&&""!==s.value||"value"===a&&!u){var v=(0,Y.unesc)(l),E=(0,Y.getProp)(s,"raws","value")||"",_=s.value||"";s.value=_+v,s.quoteMark=null,(v!==l||E)&&((0,Y.ensureObject)(s,"raws"),s.raws.value=(E||_)+l),a="value"}else{var S="i"===l||"I"===l;!s.value&&""!==s.value||!s.quoteMark&&!u?(s.value||""===s.value)&&(a="value",s.value+=l,s.raws.value&&(s.raws.value+=l)):(s.insensitive=S,S&&"I"!==l||((0,Y.ensureObject)(s,"raws"),s.raws.insensitiveFlag=l),a="insensitive",i&&((0,Y.ensureObject)(s,"spaces","insensitive"),s.spaces.insensitive.before=i,i=""),o&&((0,Y.ensureObject)(s,"raws","spaces","insensitive"),s.raws.spaces.insensitive.before=o,o=""))}u=!1;break;case j.str:if(!s.attribute||!s.operator)return this.error("Expected an attribute followed by an operator preceding the string.",{index:c[q.FIELDS.START_POS]});var T=(0,A.unescapeValue)(l),b=T.unescaped,w=T.quoteMark;s.value=b,s.quoteMark=w,a="value",(0,Y.ensureObject)(s,"raws"),s.raws.value=l,u=!1;break;case j.equals:if(!s.attribute)return this.expected("attribute",c[q.FIELDS.START_POS],l);if(s.value)return this.error('Unexpected "=" found; an operator was already defined.',{index:c[q.FIELDS.START_POS]});s.operator=s.operator?s.operator+l:l,a="operator",u=!1;break;case j.comment:if(a)if(u||h&&h[q.FIELDS.TYPE]===j.space||"insensitive"===a){var g=(0,Y.getProp)(s,"spaces",a,"after")||"",m=(0,Y.getProp)(s,"raws","spaces",a,"after")||g;(0,Y.ensureObject)(s,"raws","spaces",a),s.raws.spaces[a].after=m+l}else{var k=s[a]||"",y=(0,Y.getProp)(s,"raws",a)||k;(0,Y.ensureObject)(s,"raws"),s.raws[a]=y+l}else o+=l;break;default:return this.error('Unexpected "'+l+'" found.',{index:c[q.FIELDS.START_POS]})}n++}X(s,"attribute"),X(s,"namespace"),this.newNode(new A.default(s)),this.position++},n.parseWhitespaceEquivalentTokens=function(e){e<0&&(e=this.tokens.length);var t=this.position,r=[],s="",n=void 0;do{if(W[this.currToken[q.FIELDS.TYPE]])this.options.lossy||(s+=this.content());else if(this.currToken[q.FIELDS.TYPE]===j.comment){var i={};s&&(i.before=s,s=""),n=new w.default({value:this.content(),source:z(this.currToken),sourceIndex:this.currToken[q.FIELDS.START_POS],spaces:i}),r.push(n)}}while(++this.position<e);if(s)if(n)n.spaces.after=s;else if(!this.options.lossy){var o=this.tokens[t],a=this.tokens[this.position-1];r.push(new F.default({value:"",source:H(o[q.FIELDS.START_LINE],o[q.FIELDS.START_COL],a[q.FIELDS.END_LINE],a[q.FIELDS.END_COL]),sourceIndex:o[q.FIELDS.START_POS],spaces:{before:s,after:""}}))}return r},n.convertWhitespaceNodesToSpace=function(e,t){var r=this;void 0===t&&(t=!1);var s="",n="";return e.forEach((function(e){var i=r.lossySpace(e.spaces.before,t),o=r.lossySpace(e.rawSpaceBefore,t);s+=i+r.lossySpace(e.spaces.after,t&&0===i.length),n+=i+e.value+r.lossySpace(e.rawSpaceAfter,t&&0===o.length)})),n===s&&(n=void 0),{space:s,rawSpace:n}},n.isNamedCombinator=function(e){return void 0===e&&(e=this.position),this.tokens[e+0]&&this.tokens[e+0][q.FIELDS.TYPE]===j.slash&&this.tokens[e+1]&&this.tokens[e+1][q.FIELDS.TYPE]===j.word&&this.tokens[e+2]&&this.tokens[e+2][q.FIELDS.TYPE]===j.slash},n.namedCombinator=function(){if(this.isNamedCombinator()){var e=this.content(this.tokens[this.position+1]),t=(0,Y.unesc)(e).toLowerCase(),r={};t!==e&&(r.value="/"+e+"/");var s=new N.default({value:"/"+t+"/",source:H(this.currToken[q.FIELDS.START_LINE],this.currToken[q.FIELDS.START_COL],this.tokens[this.position+2][q.FIELDS.END_LINE],this.tokens[this.position+2][q.FIELDS.END_COL]),sourceIndex:this.currToken[q.FIELDS.START_POS],raws:r});return this.position=this.position+3,s}this.unexpected()},n.combinator=function(){var e=this;if("|"===this.content())return this.namespace();var t=this.locateNextMeaningfulToken(this.position);if(!(t<0||this.tokens[t][q.FIELDS.TYPE]===j.comma)){var r,s=this.currToken,n=void 0;if(t>this.position&&(n=this.parseWhitespaceEquivalentTokens(t)),this.isNamedCombinator()?r=this.namedCombinator():this.currToken[q.FIELDS.TYPE]===j.combinator?(r=new N.default({value:this.content(),source:z(this.currToken),sourceIndex:this.currToken[q.FIELDS.START_POS]}),this.position++):W[this.currToken[q.FIELDS.TYPE]]||n||this.unexpected(),r){if(n){var i=this.convertWhitespaceNodesToSpace(n),o=i.space,a=i.rawSpace;r.spaces.before=o,r.rawSpaceBefore=a}}else{var u=this.convertWhitespaceNodesToSpace(n,!0),c=u.space,l=u.rawSpace;l||(l=c);var h={},f={spaces:{}};c.endsWith(" ")&&l.endsWith(" ")?(h.before=c.slice(0,c.length-1),f.spaces.before=l.slice(0,l.length-1)):c.startsWith(" ")&&l.startsWith(" ")?(h.after=c.slice(1),f.spaces.after=l.slice(1)):f.value=l,r=new N.default({value:" ",source:J(s,this.tokens[this.position-1]),sourceIndex:s[q.FIELDS.START_POS],spaces:h,raws:f})}return this.currToken&&this.currToken[q.FIELDS.TYPE]===j.space&&(r.spaces.after=this.optionalSpace(this.content()),this.position++),this.newNode(r)}var p=this.parseWhitespaceEquivalentTokens(t);if(p.length>0){var d=this.current.last;if(d){var v=this.convertWhitespaceNodesToSpace(p),E=v.space,_=v.rawSpace;void 0!==_&&(d.rawSpaceAfter+=_),d.spaces.after+=E}else p.forEach((function(t){return e.newNode(t)}))}},n.comma=function(){if(this.position===this.tokens.length-1)return this.root.trailingComma=!0,void this.position++;this.current._inferEndPosition();var e=new p.default({source:{start:K(this.tokens[this.position+1])}});this.current.parent.append(e),this.current=e,this.position++},n.comment=function(){var e=this.currToken;this.newNode(new w.default({value:this.content(),source:z(e),sourceIndex:e[q.FIELDS.START_POS]})),this.position++},n.error=function(e,t){throw this.root.error(e,t)},n.missingBackslash=function(){return this.error("Expected a backslash preceding the semicolon.",{index:this.currToken[q.FIELDS.START_POS]})},n.missingParenthesis=function(){return this.expected("opening parenthesis",this.currToken[q.FIELDS.START_POS])},n.missingSquareBracket=function(){return this.expected("opening square bracket",this.currToken[q.FIELDS.START_POS])},n.unexpected=function(){return this.error("Unexpected '"+this.content()+"'. Escaping special characters with \\ may help.",this.currToken[q.FIELDS.START_POS])},n.namespace=function(){var e=this.prevToken&&this.content(this.prevToken)||!0;return this.nextToken[q.FIELDS.TYPE]===j.word?(this.position++,this.word(e)):this.nextToken[q.FIELDS.TYPE]===j.asterisk?(this.position++,this.universal(e)):void 0},n.nesting=function(){if(this.nextToken&&"|"===this.content(this.nextToken))return void this.position++;var e=this.currToken;this.newNode(new C.default({value:this.content(),source:z(e),sourceIndex:e[q.FIELDS.START_POS]})),this.position++},n.parentheses=function(){var e=this.current.last,t=1;if(this.position++,e&&e.type===U.PSEUDO){var r=new p.default({source:{start:K(this.tokens[this.position-1])}}),s=this.current;for(e.append(r),this.current=r;this.position<this.tokens.length&&t;)this.currToken[q.FIELDS.TYPE]===j.openParenthesis&&t++,this.currToken[q.FIELDS.TYPE]===j.closeParenthesis&&t--,t?this.parse():(this.current.source.end=$(this.currToken),this.current.parent.source.end=$(this.currToken),this.position++);this.current=s}else{for(var n,i=this.currToken,o="(";this.position<this.tokens.length&&t;)this.currToken[q.FIELDS.TYPE]===j.openParenthesis&&t++,this.currToken[q.FIELDS.TYPE]===j.closeParenthesis&&t--,n=this.currToken,o+=this.parseParenthesisToken(this.currToken),this.position++;e?e.appendToPropertyAndEscape("value",o,o):this.newNode(new F.default({value:o,source:H(i[q.FIELDS.START_LINE],i[q.FIELDS.START_COL],n[q.FIELDS.END_LINE],n[q.FIELDS.END_COL]),sourceIndex:i[q.FIELDS.START_POS]}))}if(t)return this.expected("closing parenthesis",this.currToken[q.FIELDS.START_POS])},n.pseudo=function(){for(var e=this,t="",r=this.currToken;this.currToken&&this.currToken[q.FIELDS.TYPE]===j.colon;)t+=this.content(),this.position++;return this.currToken?this.currToken[q.FIELDS.TYPE]!==j.word?this.expected(["pseudo-class","pseudo-element"],this.currToken[q.FIELDS.START_POS]):void this.splitWord(!1,(function(s,n){t+=s,e.newNode(new D.default({value:t,source:J(r,e.currToken),sourceIndex:r[q.FIELDS.START_POS]})),n>1&&e.nextToken&&e.nextToken[q.FIELDS.TYPE]===j.openParenthesis&&e.error("Misplaced parenthesis.",{index:e.nextToken[q.FIELDS.START_POS]})})):this.expected(["pseudo-class","pseudo-element"],this.position-1)},n.space=function(){var e=this.content();0===this.position||this.prevToken[q.FIELDS.TYPE]===j.comma||this.prevToken[q.FIELDS.TYPE]===j.openParenthesis||this.current.nodes.every((function(e){return"comment"===e.type}))?(this.spaces=this.optionalSpace(e),this.position++):this.position===this.tokens.length-1||this.nextToken[q.FIELDS.TYPE]===j.comma||this.nextToken[q.FIELDS.TYPE]===j.closeParenthesis?(this.current.last.spaces.after=this.optionalSpace(e),this.position++):this.combinator()},n.string=function(){var e=this.currToken;this.newNode(new F.default({value:this.content(),source:z(e),sourceIndex:e[q.FIELDS.START_POS]})),this.position++},n.universal=function(e){var t=this.nextToken;if(t&&"|"===this.content(t))return this.position++,this.namespace();var r=this.currToken;this.newNode(new M.default({value:this.content(),source:z(r),sourceIndex:r[q.FIELDS.START_POS]}),e),this.position++},n.splitWord=function(e,t){for(var r=this,s=this.nextToken,n=this.content();s&&~[j.dollar,j.caret,j.equals,j.word].indexOf(s[q.FIELDS.TYPE]);){this.position++;var i=this.content();if(n+=i,i.lastIndexOf("\\")===i.length-1){var a=this.nextToken;a&&a[q.FIELDS.TYPE]===j.space&&(n+=this.requiredSpace(this.content(a)),this.position++)}s=this.nextToken}var c=(0,o.default)(n,".").filter((function(e){return"\\"!==n[e-1]})),l=(0,o.default)(n,"#").filter((function(e){return"\\"!==n[e-1]})),h=(0,o.default)(n,"#{");h.length&&(l=l.filter((function(e){return!~h.indexOf(e)})));var f=(0,R.default)((0,u.default)([0].concat(c,l)));f.forEach((function(s,i){var o,a=f[i+1]||n.length,u=n.slice(s,a);if(0===i&&t)return t.call(r,u,f.length);var h=r.currToken,p=h[q.FIELDS.START_POS]+f[i],d=H(h[1],h[2]+s,h[3],h[2]+(a-1));if(~c.indexOf(s)){var v={value:u.slice(1),source:d,sourceIndex:p};o=new _.default(X(v,"value"))}else if(~l.indexOf(s)){var E={value:u.slice(1),source:d,sourceIndex:p};o=new P.default(X(E,"value"))}else{var S={value:u,source:d,sourceIndex:p};X(S,"value"),o=new x.default(S)}r.newNode(o,e),e=null})),this.position++},n.word=function(e){var t=this.nextToken;return t&&"|"===this.content(t)?(this.position++,this.namespace()):this.splitWord(e)},n.loop=function(){for(;this.position<this.tokens.length;)this.parse(!0);return this.current._inferEndPosition(),this.root},n.parse=function(e){switch(this.currToken[q.FIELDS.TYPE]){case j.space:this.space();break;case j.comment:this.comment();break;case j.openParenthesis:this.parentheses();break;case j.closeParenthesis:e&&this.missingParenthesis();break;case j.openSquare:this.attribute();break;case j.dollar:case j.caret:case j.equals:case j.word:this.word();break;case j.colon:this.pseudo();break;case j.comma:this.comma();break;case j.asterisk:this.universal();break;case j.ampersand:this.nesting();break;case j.slash:case j.combinator:this.combinator();break;case j.str:this.string();break;case j.closeSquare:this.missingSquareBracket();case j.semicolon:this.missingBackslash();default:this.unexpected()}},n.expected=function(e,t,r){if(Array.isArray(e)){var s=e.pop();e=e.join(", ")+" or "+s}var n=/^[aeiou]/.test(e[0])?"an":"a";return r?this.error("Expected "+n+" "+e+', found "'+r+'" instead.',{index:t}):this.error("Expected "+n+" "+e+".",{index:t})},n.requiredSpace=function(e){return this.options.lossy?" ":e},n.optionalSpace=function(e){return this.options.lossy?"":e},n.lossySpace=function(e,t){return this.options.lossy?t?" ":"":e},n.parseParenthesisToken=function(e){var t=this.content(e);return e[q.FIELDS.TYPE]===j.space?this.requiredSpace(t):t},n.newNode=function(e,t){return t&&(/^ +$/.test(t)&&(this.options.lossy||(this.spaces=(this.spaces||"")+t),t=!0),e.namespace=t,X(e,"namespace")),this.spaces&&(e.spaces.before=this.spaces,this.spaces=""),this.current.append(e)},n.content=function(e){return void 0===e&&(e=this.currToken),this.css.slice(e[q.FIELDS.START_POS],e[q.FIELDS.END_POS])},n.locateNextMeaningfulToken=function(e){void 0===e&&(e=this.position+1);for(var t=e;t<this.tokens.length;){if(!V[this.tokens[t][q.FIELDS.TYPE]])return t;t++}return-1},t=e,(r=[{key:"currToken",get:function(){return this.tokens[this.position]}},{key:"nextToken",get:function(){return this.tokens[this.position+1]}},{key:"prevToken",get:function(){return this.tokens[this.position-1]}}])&&G(t.prototype,r),s&&G(t,s),e}();e.default=Z,s.exports=e.default})),x=e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=P())&&r.__esModule?r:{default:r};var n=function(){function e(e,t){this.func=e||function(){},this.funcRes=null,this.options=t}var t=e.prototype;return t._shouldUpdateSelector=function(e,t){return void 0===t&&(t={}),!1!==Object.assign({},this.options,t).updateSelector&&"string"!=typeof e},t._isLossy=function(e){return void 0===e&&(e={}),!1===Object.assign({},this.options,e).lossless},t._root=function(e,t){return void 0===t&&(t={}),new s.default(e,this._parseOptions(t)).root},t._parseOptions=function(e){return{lossy:this._isLossy(e)}},t._run=function(e,t){var r=this;return void 0===t&&(t={}),new Promise((function(s,n){try{var i=r._root(e,t);Promise.resolve(r.func(i)).then((function(s){var n=void 0;return r._shouldUpdateSelector(e,t)&&(n=i.toString(),e.selector=n),{transform:s,root:i,string:n}})).then(s,n)}catch(e){return void n(e)}}))},t._runSync=function(e,t){void 0===t&&(t={});var r=this._root(e,t),s=this.func(r);if(s&&"function"==typeof s.then)throw new Error("Selector processor returned a promise to a synchronous call.");var n=void 0;return t.updateSelector&&"string"!=typeof e&&(n=r.toString(),e.selector=n),{transform:s,root:r,string:n}},t.ast=function(e,t){return this._run(e,t).then((function(e){return e.root}))},t.astSync=function(e,t){return this._runSync(e,t).root},t.transform=function(e,t){return this._run(e,t).then((function(e){return e.transform}))},t.transformSync=function(e,t){return this._runSync(e,t).transform},t.process=function(e,t){return this._run(e,t).then((function(e){return e.string||e.root.toString()}))},t.processSync=function(e,t){var r=this._runSync(e,t);return r.string||r.root.toString()},e}();e.default=n,t.exports=e.default})),F=e((e=>{e.__esModule=!0,e.universal=e.tag=e.string=e.selector=e.root=e.pseudo=e.nesting=e.id=e.comment=e.combinator=e.className=e.attribute=void 0;var t=w(g()),r=w(d()),s=w(k()),n=w(v()),i=w(E()),o=w(y()),a=w(b()),u=w(h()),c=w(f()),l=w(T()),p=w(S()),_=w(m());function w(e){return e&&e.__esModule?e:{default:e}}e.attribute=function(e){return new t.default(e)};e.className=function(e){return new r.default(e)};e.combinator=function(e){return new s.default(e)};e.comment=function(e){return new n.default(e)};e.id=function(e){return new i.default(e)};e.nesting=function(e){return new o.default(e)};e.pseudo=function(e){return new a.default(e)};e.root=function(e){return new u.default(e)};e.selector=function(e){return new c.default(e)};e.string=function(e){return new l.default(e)};e.tag=function(e){return new p.default(e)};e.universal=function(e){return new _.default(e)}})),D=e((e=>{e.__esModule=!0,e.isNode=n,e.isPseudoElement=T,e.isPseudoClass=function(e){return p(e)&&!T(e)},e.isContainer=function(e){return!(!n(e)||!e.walk)},e.isNamespace=function(e){return o(e)||_(e)},e.isUniversal=e.isTag=e.isString=e.isSelector=e.isRoot=e.isPseudo=e.isNesting=e.isIdentifier=e.isComment=e.isCombinator=e.isClassName=e.isAttribute=void 0;var t,r=c(),s=((t={})[r.ATTRIBUTE]=!0,t[r.CLASS]=!0,t[r.COMBINATOR]=!0,t[r.COMMENT]=!0,t[r.ID]=!0,t[r.NESTING]=!0,t[r.PSEUDO]=!0,t[r.ROOT]=!0,t[r.SELECTOR]=!0,t[r.STRING]=!0,t[r.TAG]=!0,t[r.UNIVERSAL]=!0,t);function n(e){return"object"==typeof e&&s[e.type]}function i(e,t){return n(t)&&t.type===e}var o=i.bind(null,r.ATTRIBUTE);e.isAttribute=o;var a=i.bind(null,r.CLASS);e.isClassName=a;var u=i.bind(null,r.COMBINATOR);e.isCombinator=u;var l=i.bind(null,r.COMMENT);e.isComment=l;var h=i.bind(null,r.ID);e.isIdentifier=h;var f=i.bind(null,r.NESTING);e.isNesting=f;var p=i.bind(null,r.PSEUDO);e.isPseudo=p;var d=i.bind(null,r.ROOT);e.isRoot=d;var v=i.bind(null,r.SELECTOR);e.isSelector=v;var E=i.bind(null,r.STRING);e.isString=E;var _=i.bind(null,r.TAG);e.isTag=_;var S=i.bind(null,r.UNIVERSAL);function T(e){return p(e)&&e.value&&(e.value.startsWith("::")||":before"===e.value.toLowerCase()||":after"===e.value.toLowerCase())}e.isUniversal=S})),A=e((e=>{e.__esModule=!0;var t=c();Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&(e[r]=t[r])}));var r=F();Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&(e[t]=r[t])}));var s=D();Object.keys(s).forEach((function(t){"default"!==t&&"__esModule"!==t&&(e[t]=s[t])}))}));function M(e){return e.nodeType===Node.ELEMENT_NODE}function N(e){return e.nodeType===Node.DOCUMENT_NODE}function C(e,t=document,r){const s=[...t.querySelectorAll(e)];for(const r of function*(e,t){if(!M(e)&&!N(e))return;const r=N(e)?e:e.getRootNode({composed:!0});M(e)&&e.shadowRoot&&(yield e.shadowRoot);const s=[e];let n;for(;n=s.pop();){const e=r.createTreeWalker(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_DOCUMENT_FRAGMENT,{acceptNode:e=>M(e)&&e.shadowRoot?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let i=e.nextNode();for(;i;)M(i)&&i.shadowRoot&&(t&&s.push(i.shadowRoot),yield i.shadowRoot),i=e.nextNode()}}(t))s.push(...r.querySelectorAll(e));return s}e(((e,t)=>{e.__esModule=!0,e.default=void 0;var r,s=(r=x())&&r.__esModule?r:{default:r},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};s.get||s.set?Object.defineProperty(t,r,s):t[r]=e[r]}return t.default=e,t}(A());var i=function(e){return new s.default(e)};Object.assign(i,n),delete i.__esModule;var o=i;e.default=o,t.exports=e.default}))();class R extends class{constructor(e){this.TAB=9,this.ESC=27,this.FOCUSABLE_ELEMENT_SELECTORS='a[href], area[href], input:not([disabled]):not([hidden]):not([hidden="true"]):not([tabindex="-1"]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], button:not([tabindex="-1"]) [contenteditable]',this.el="string"==typeof e.el?document.querySelector(e.el):e.el,this.focusElement=e.focusElement,this.returnFocus=e.returnFocus??!0,this.escCallback=e.escCallback,this.listener=this.listener.bind(this),this.includeActiveElement=e.includeActiveElement??!1,this.unordered=!(!e.unordered&&!this.includeActiveElement),this.active=!1,this.unordered&&(this.index=1,this.lastFocusedIndex=0)}get elements(){return this.focusableElements}setReturnFocusEl(e){let t=document.activeElement;t=t.shadowRoot?t.shadowRoot.activeElement:t,this.previousFocusedEl=e??t}updateElements(e){this.setElements(e)}setElements(e){this.focusableElements=e??this.el.querySelectorAll(this.FOCUSABLE_ELEMENT_SELECTORS),this.firstFocusableEl=this.focusableElements[0],this.lastFocusableEl=this.focusableElements[this.focusableElements.length-1],this.elementToFocus=this.focusElement?this.focusElement:this.firstFocusableEl,this.setReturnFocusEl()}listener(e){let t=document.activeElement;t.shadowRoot&&(t=t.shadowRoot.activeElement),e.keyCode===this.TAB?this.unordered?(e.preventDefault(),this.handleUnorderedFocus(e)):e.shiftKey&&t===this.firstFocusableEl?(e.preventDefault(),this.lastFocusableEl.