import{__require as t}from"../../postcss/lib/stringifier.mjs";var e,r;function s(){if(r)return e;r=1;let s=t().default;return e=class extends s{constructor(t){super(t),this.originalBuilder=t,this.stringifiedInterpolations=[]}document(t){if(0===t.nodes.length)return void this.builder(t.source.input.css);let e=t.nodes.filter(t=>!t.raws.styledSyntaxIsComponent);for(let t of e){let e="";this.builder=t=>{e+=t};let r=this.raw(t,"semicolon");this.stringify(t,r);let s={start:t.raws.styledSyntaxRangeStart,end:t.raws.styledSyntaxRangeEnd,content:e,originalContent:t.raws.styledOriginalContent};this.stringifiedInterpolations.push(s)}this.builder=this.originalBuilder,this.body(t)}root(t){t.raws.codeBefore&&this.builder(t.raws.codeBefore),this.body(t),t.raws.after&&(t.raws.after=this.replaceInterpolations(t.raws.after,t.raws.styledSyntaxRangeEnd),this.builder(t.raws.after)),t.raws.codeAfter&&this.builder(t.raws.codeAfter)}body(t){let e=t.nodes;if(function(t){return"document"===t.type}(t)&&(e=t.nodes.filter(t=>t.raws.styledSyntaxIsComponent)),!e)return;let r=e.length-1;for(;r>0&&"comment"===e[r].type;)r-=1;let s=this.raw(t,"semicolon");for(let t=0;t<e.length;t++){let i=e[t],n=this.raw(i,"before");n&&(void 0!==i?.source?.start?.offset&&(n=this.replaceInterpolations(n,i.source.start.offset)),this.builder(n)),this.stringify(i,r!==t||s)}}block(t,e){let r,s=this.raw(t,"between","beforeOpen");this.builder(e+s+"{",t,"start"),t.nodes&&t.nodes.length?(this.body(t),r=this.raw(t,"after")):r=this.raw(t,"after","emptyBody"),r&&(void 0!==t?.source?.end?.offset&&(r=this.replaceInterpolations(r,t.source.end.offset)),this.builder(r)),this.builder("}",t,"end")}replaceInterpolations(t,e){let r=t;if(r.includes("${")){let t=e-r.length,s=e;for(let e=0;e<this.stringifiedInterpolations.length;e++){let i=this.stringifiedInterpolations[e];t<=i.start&&i.end<=s&&(r=r.replace(i.originalContent,i.content))}}return r}}}export{s as __require};