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