wilddragon-site/node_modules/@tailwindcss/postcss/dist/index.mjs

11 lines
44 KiB
JavaScript
Raw Normal View History

2026-04-17 15:51:01 -04:00
var de=(e,r)=>(r=Symbol[e])?r:Symbol.for("Symbol."+e),me=e=>{throw TypeError(e)};var ge=(e,r,t)=>{if(r!=null){typeof r!="object"&&typeof r!="function"&&me("Object expected");var o,a;t&&(o=r[de("asyncDispose")]),o===void 0&&(o=r[de("dispose")],t&&(a=o)),typeof o!="function"&&me("Object not disposable"),a&&(o=function(){try{a.call(this)}catch(n){return Promise.reject(n)}}),e.push([t,o,r])}else t&&e.push([t]);return r},he=(e,r,t)=>{var o=typeof SuppressedError=="function"?SuppressedError:function(i,l,u,s){return s=Error(u),s.name="SuppressedError",s.error=i,s.suppressed=l,s},a=i=>r=t?new o(i,r,"An error was suppressed during disposal"):(t=!0,i),n=i=>{for(;i=e.pop();)try{var l=i[1]&&i[1].call(i[2]);if(i[0])return Promise.resolve(l).then(n,u=>(a(u),n()))}catch(u){a(u)}if(t)throw r};return n()};import zt from"@alloc/quick-lru";import{compileAst as Kt,env as Mt,Features as ue,Instrumentation as Ft,optimize as jt,Polyfills as ce}from"@tailwindcss/node";import{clearRequireCache as Wt}from"@tailwindcss/node/require-cache";import{Scanner as Bt}from"@tailwindcss/oxide";import Yt from"fs";import I,{relative as Be}from"path";function K(e){return{kind:"word",value:e}}function qe(e,r){return{kind:"function",value:e,nodes:r}}function Ze(e){return{kind:"separator",value:e}}function S(e){let r="";for(let t of e)switch(t.kind){case"word":case"separator":{r+=t.value;break}case"function":r+=t.value+"("+S(t.nodes)+")"}return r}var ve=92,Qe=41,ke=58,we=44,Je=34,be=61,ye=62,xe=60,Ae=10,Xe=40,et=39,tt=47,Ce=32,Se=9;function A(e){e=e.replaceAll(`\r
`,`
`);let r=[],t=[],o=null,a="",n;for(let i=0;i<e.length;i++){let l=e.charCodeAt(i);switch(l){case ve:{a+=e[i]+e[i+1],i++;break}case tt:{if(a.length>0){let s=K(a);o?o.nodes.push(s):r.push(s),a=""}let u=K(e[i]);o?o.nodes.push(u):r.push(u);break}case ke:case we:case be:case ye:case xe:case Ae:case Ce:case Se:{if(a.length>0){let f=K(a);o?o.nodes.push(f):r.push(f),a=""}let u=i,s=i+1;for(;s<e.length&&(n=e.charCodeAt(s),!(n!==ke&&n!==we&&n!==be&&n!==ye&&n!==xe&&n!==Ae&&n!==Ce&&n!==Se));s++);i=s-1;let c=Ze(e.slice(u,s));o?o.nodes.push(c):r.push(c);break}case et:case Je:{let u=i;for(let s=i+1;s<e.length;s++)if(n=e.charCodeAt(s),n===ve)s+=1;else if(n===l){i=s;break}a+=e.slice(u,i+1);break}case Xe:{let u=qe(a,[]);a="",o?o.nodes.push(u):r.push(u),t.push(u),o=u;break}case Qe:{let u=t.pop();if(a.length>0){let s=K(a);u?.nodes.push(s),a=""}t.length>0?o=t[t.length-1]:o=null;break}default:a+=String.fromCharCode(l)}}return a.length>0&&r.push(K(a)),r}var d=class extends Map{constructor(t){super();this.factory=t}get(t){let o=super.get(t);return o===void 0&&(o=this.factory(t,this),this.set(t,o)),o}};var rr=new Uint8Array(256);var Y=new Uint8Array(256);function v(e,r){let t=0,o=[],a=0,n=e.length,i=r.charCodeAt(0);for(let l=0;l<n;l++){let u=e.charCodeAt(l);if(t===0&&u===i){o.push(e.slice(a,l)),a=l+1;continue}switch(u){case 92:l+=1;break;case 39:case 34:for(;++l<n;){let s=e.charCodeAt(l);if(s===92){l+=1;continue}if(s===u)break}break;case 40:Y[t]=41,t++;break;case 91:Y[t]=93,t++;break;case 123:Y[t]=125,t++;break;case 93:case 125:case 41:t>0&&u===Y[t-1]&&t--;break}}return o.push(e.slice(a)),o}var X=(i=>(i[i.Continue=0]="Continue",i[i.Skip=1]="Skip",i[i.Stop=2]="Stop",i[i.Replace=3]="Replace",i[i.ReplaceSkip=4]="ReplaceSkip",i[i.ReplaceStop=5]="ReplaceStop",i))(X||{}),g={Continue:{kind:0},Skip:{kind:1},Stop:{kind:2},Replace:e=>({kind:3,nodes:Array.isArray(e)?e:[e]}),ReplaceSkip:e=>({kind:4,nodes:Array.isArray(e)?e:[e]}),ReplaceStop:e=>({kind:5,nodes:Array.isArray(e)?e:[e]})};function h(e,r){typeof r=="function"?$e(e,r):$e(e,r.enter,r.exit)}function $e(e,r=()=>g.Continue,t=()=>g.Continue){let o={value:[e,0,null],prev:null},a={parent:null,depth:0,path(){let n=[],i=o;for(;i;){let l=i.value[2];l&&n.push(l),i=i.prev}return n.reverse(),n}};for(;o!==null;){let n=o.value,i=n[0],l=n[1],u=n[2];if(l>=i.length){o=o.prev,a.depth-=1;continue}if(a.parent=u,l>=0){let k=i[l],$=r(k,a)??g.Continue;switch($.kind){case 0:{k.nodes&&k.nodes.length>0&&(a.depth+=1,o={value:[k.nodes,0,k],prev:o}),n[1]=~l;continue}case 2:return;case 1:{n[1]=~l;continue}case 3:{i.splice(l,1,...$.nodes);continue}case 5:{i.splice(l,1,...$.nodes);return}case 4:{i.splice(l,1,...$.nodes),n[1]+=$.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${X[$.kind]??`Unknown(${$.kind})`}\` in enter.`)}}let s=~l,c=i[s],f=t(c,a)??g.Continue;switch(f.kind){case 0:n[1]=s+1;continue;case 2:return;case 3:{i.splice(s,1,...f.nodes),n[1]=s+f.nodes.length;continue}case 5:{i.splice(s,1,...f.nodes);return}case 4:{i.splice(s,1,...f.nodes),n[1]=s+f.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${X[f.kind]??`Unknown(${f.kind})`}\` in exit.`)}}}var dr=new d(e=>{let r=A(e),t=new Set;return h(r,(o,a)=>{let n=a.parent===null?r:a.parent.nodes??[];if(o.kind==="word"&&(o.value==="+"||o.value==="-"||o.value==="*"||o.value==="/")){let i=n.indexOf(o)??-1;if(i===-1)return;let l=n[i-1];if(l?.kind!=="separator"||l.value!==" ")return;let u=n[i+1];if(u?.kind!=="separator"||u.value!==" ")return;t.add(l),t.add(u)}else o.kind==="separator"&&o.value.length>0&&o.value.trim()===""?(n[0]===o||n[n.length-1]===o)&&t.add(o):o.kind==="separator"&&o.value.trim()===","&&(o.value=",")}),t.size>0&&h(r,o=>{if(t.has(o))return t.delete(o),g.ReplaceSkip([])}),ee(r),S(r)});var mr=new d(e=>{let r=A(e);return r.length===3&&r[0].kind==="word"&&r[0].value==="&"&&r[1].kind==="separator"&&r[1].value===":"&&r[2].kind==="function"&&r[2].value==="is"?S(r[2].nodes):e});function ee(e){for(let r of e)switch(r.kind){case"function":{if(r.value==="url"||r.value.endsWith("_url")){r.value=M(r.value);break}if(r.value==="var"||r.value.
`,r){t+=s.length;let c=t;t+=i.property.length,t+=2,t+=i.value?.length??0,i.important&&(t+=11);let f=t;t+=2,i.dst=[o,c,f]}}else if(i.kind==="rule"){if(u+=`${s}${i.selector} {
`,r){t+=s.length;let c=t;t+=i.selector.length,t+=1;let f=t;i.dst=[o,c,f],t+=2}for(let c of i.nodes)u+=a(c,l+1);u+=`${s}}
`,r&&(t+=s.length,t+=2)}else if(i.kind==="at-rule"){if(i.nodes.length===0){let c=`${s}${i.name} ${i.params};
`;if(r){t+=s.length;let f=t;t+=i.name.length,t+=1,t+=i.params.length;let k=t;t+=2,i.dst=[o,f,k]}return c}if(u+=`${s}${i.name}${i.params?` ${i.params} `:" "}{
`,r){t+=s.length;let c=t;t+=i.name.length,i.params&&(t+=1,t+=i.params.length),t+=1;let f=t;i.dst=[o,c,f],t+=2}for(let c of i.nodes)u+=a(c,l+1);u+=`${s}}
`,r&&(t+=s.length,t+=2)}else if(i.kind==="comment"){if(u+=`${s}/*${i.value}*/
`,r){t+=s.length;let c=t;t+=2+i.value.length+2;let f=t;i.dst=[o,c,f],t+=1}}else if(i.kind==="context"||i.kind==="at-root")return"";return u}let n="";for(let i of e)n+=a(i,0);return o.code=n,n}var Lt=33;function Fe(e,r,t){let o=new d(s=>new e.Input(s.code,{map:t?.input.map,from:s.file??void 0})),a=new d(s=>H(s.code)),n=e.root();n.source=t;function i(s){if(!s||!s[0])return;let c=a.get(s[0]),f=c.find(s[1]),k=c.find(s[2]);return{input:o.get(s[0]),start:{line:f.line,column:f.column+1,offset:s[1]},end:{line:k.line,column:k.column+1,offset:s[2]}}}function l(s,c){let f=i(c);f?s.source=f:delete s.source}function u(s,c){if(s.kind==="declaration"){let f=e.decl({prop:s.property,value:s.value??"",important:s.important});l(f,s.src),c.append(f)}else if(s.kind==="rule"){let f=e.rule({selector:s.selector});l(f,s.src),f.raws.semicolon=!0,c.append(f);for(let k of s.nodes)u(k,f)}else if(s.kind==="at-rule"){let f=e.atRule({name:s.name.slice(1),params:s.params});l(f,s.src),f.raws.semicolon=!0,c.append(f);for(let k of s.nodes)u(k,f)}else if(s.kind==="comment"){let f=e.comment({text:s.value});f.raws.left="",f.raws.right="",l(f,s.src),c.append(f)}else s.kind==="at-root"||s.kind}for(let s of r)u(s,n);return n}function je(e){let r=new d(n=>({file:n.file??n.id??null,code:n.css}));function t(n){let i=n.source;if(!i)return;let l=i.input;if(l&&i.start!==void 0&&i.end!==void 0)return[r.get(l),i.start.offset,i.end.offset]}function o(n,i){if(n.type==="decl"){let l=T(n.prop,n.value,n.important);l.src=t(n),i.push(l)}else if(n.type==="rule"){let l=O(n.selector);l.src=t(n),n.each(u=>o(u,l.nodes)),i.push(l)}else if(n.type==="atrule"){let l=x(`@${n.name}`,n.params);l.src=t(n),n.each(u=>o(u,l.nodes)),i.push(l)}else if(n.type==="comment"){if(n.text.charCodeAt(0)!==Lt)return;let l=q(n.text);l.src=t(n),i.push(l)}}let a=[];return e.each(n=>o(n,a)),a}import{normalizePath as We}from"@tailwindcss/node";import Q from"path";var le="'",ae='"';function se(){let e=new WeakSet;function r(t){let o=t.root().source?.input.file;if(!o)return;let a=t.source?.input.file;if(!a||e.has(t))return;let n=t.params[0],i=n[0]===ae&&n[n.length-1]===ae?ae:n[0]===le&&n[n.length-1]===le?le:null;if(!i)return;let l=t.params.slice(1,-1),u="";if(l.startsWith("!")&&(l=l.slice(1),u="!"),!l.startsWith("./")&&!l.startsWith("../"))return;let s=Q.posix.join(We(Q.dirname(a)),l),c=Q.posix.dirname(We(o)),f=Q.posix.relative(c,s);f.startsWith(".")||(f="./"+f),t.params=i+u+f+i,e.add(t)}return{postcssPlugin:"tailwindcss-postcss-fix-relative-paths",Once(t){t.walkAtRules(/source|plugin|config/,r)}}}var p=Mt.DEBUG,fe=new zt({maxSize:50});function Gt(e,r,t){let o=`${r}:${t.base??""}:${JSON.stringify(t.optimize)}`;if(fe.has(o))return fe.get(o);let a={mtimes:new Map,compiler:null,scanner:null,tailwindCssAst:[],cachedPostCssAst:e.root(),optimizedPostCssAst:e.root(),fullRebuildPaths:[]};return fe.set(o,a),a}function Ht(e={}){let r=e.base??process.cwd(),t=e.optimize??process.env.NODE_ENV==="production",o=e.transformAssetUrls??!0;return{postcssPlugin:"@tailwindcss/postcss",plugins:[se(),{postcssPlugin:"tailwindcss",async Once(a,{result:n,postcss:i}){var pe=[];try{let l=ge(pe,new Ft);let u=n.opts.from??"";let s=u.endsWith(".module.css");p&&l.start(`[@tailwindcss/postcss] ${Be(r,u)}`);{p&&l.start("Quick bail check");let b=!0;if(a.walkAtRules(m=>{if(m.name==="import"||m.name==="reference"||m.name==="theme"||m.name==="variant"||m.name==="config"||m.name==="plugin"||m.name==="apply"||m.name==="tailwind")return b=!1,!1}),b)return;p&&l.end("Quick bail check")}let c=Gt(i,u,e);let f=I.dirname(I.resolve(u));let k=c.compiler===null;async function $(){p&&l.start("Setup compiler"),c.fullRebuildPaths.length>0&&!k&&Wt(c.fullRebuildPaths),c.fullRebuildPaths=[],p&&l.start("PostCSS AST -> Tailwind CSS AST");let b=je(a);p&&l.end("PostCSS AST -> Tailwind CSS AST"),p&&l.start("Create compiler");let m=await Kt(b,{from:n.opts.from,base:f,shouldRewriteUrls:o,onDependency:J=>c.fullRebuildPaths.push(J),polyfills:s?ce.All^ce.AtProperty:ce.All});return p&&l.end("Create compiler"),p&&l.end("Setup compiler"),m}try{if(c.compiler??=$(),(await c.compi