"use strict";var e=require("postcss-selector-parser");const s=[" ",">","~",":","+","@","#","(",")"];function isValidReplacement(e){let t=!0;for(let n=0,o=s.length;n-1&&(t=!1);return t}const t="js-focus-within",n=":focus-within",creator=s=>{const o=Object.assign({preserve:!0,replaceWith:"[focus-within]",disablePolyfillReadyClass:!1},s),r=e().astSync(o.replaceWith);return isValidReplacement(o.replaceWith)?{postcssPlugin:"postcss-focus-within",prepare(){const s=new WeakSet;return{postcssPlugin:"postcss-focus-within",Rule(l,{result:i}){if(s.has(l))return;if(!l.selector.toLowerCase().includes(n))return;const a=l.selectors.flatMap((s=>{if(!s.toLowerCase().includes(n))return[s];let a;try{a=e().astSync(s)}catch(e){return l.warn(i,`Failed to parse selector : "${s}" with message: "${e instanceof Error?e.message:e}"`),s}if(void 0===a)return[s];let c=!1;if(a.walkPseudos((e=>{e.value.toLowerCase()===n&&(e.nodes&&e.nodes.length||(c=!0,e.replaceWith(r.clone({}))))})),!c)return[s];const d=a.clone();if(!o.disablePolyfillReadyClass){if(a.nodes?.[0]?.nodes?.length)for(let s=0;s