Files
glastree/node_modules/@tailwindcss/node/dist/index.mjs
T

19 lines
53 KiB
JavaScript
Raw Normal View History

var Et=Object.defineProperty;var Tt=(e,r)=>{for(var t in r)Et(e,t,{get:r[t],enumerable:!0})};import*as M from"module";import{pathToFileURL as on}from"url";var me={};Tt(me,{DEBUG:()=>de});var de=Nt(process.env.DEBUG);function Nt(e){if(typeof e=="boolean")return e;if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let r=e.split(",").map(t=>t.split(":")[0]);return r.includes("-tailwindcss")?!1:!!r.includes("tailwindcss")}import{isBuiltin as Rt}from"module";var De=(e,r,t)=>{let n=t(e,r);return Pt(r,n)};function Pt(e,r){if(r.url===import.meta.url||Rt(r.url)||!e.parentURL)return r;let n=new URL(e.parentURL).searchParams.get("id");if(n===null)return r;let i=new URL(r.url);return i.searchParams.set("id",n),{...r,url:`${i}`}}import B from"enhanced-resolve";import{createJiti as Wr}from"jiti";import Oe from"fs";import yt from"fs/promises";import re from"path";import{pathToFileURL as vt}from"url";import{__unstable__loadDesignSystem as Br,compile as Yr,compileAst as Gr,Features as tu,Polyfills as ru}from"tailwindcss";import ge from"fs/promises";import Y from"path";var Ot=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],_t=[".js",".cjs",".mjs"],Dt=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],It=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function Ut(e,r){for(let t of r){let n=`${e}${t}`;if((await ge.stat(n).catch(()=>null))?.isFile())return n}for(let t of r){let n=`${e}/index${t}`;if(await ge.access(n).then(()=>!0,()=>!1))return n}return null}async function Ie(e,r,t,n){let i=_t.includes(n)?Dt:It,l=await Ut(Y.resolve(t,r),i);if(l===null||e.has(l))return;e.add(l),t=Y.dirname(l),n=Y.extname(l);let o=await ge.readFile(l,"utf-8"),s=[];for(let a of Ot)for(let u of o.matchAll(a))u[1].startsWith(".")&&s.push(Ie(e,u[1],t,n));await Promise.all(s)}async function Ue(e){let r=new Set;return await Ie(r,e,Y.dirname(e),Y.extname(e)),Array.from(r)}import*as Ne from"path";function j(e){return{kind:"word",value:e}}function Lt(e,r){return{kind:"function",value:e,nodes:r}}function zt(e){return{kind:"separator",value:e}}function A(e){let r="";for(let t of e)switch(t.kind){case"word":case"separator":{r+=t.value;break}case"function":r+=t.value+"("+A(t.nodes)+")"}return r}var Le=92,Kt=41,ze=58,Ke=44,Mt=34,Me=61,Fe=62,je=60,We=10,Ft=40,jt=39,Wt=47,Be=32,Ye=9;function y(e){e=e.replaceAll(`\r
`,`
`);let r=[],t=[],n=null,i="",l;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);switch(s){case Le:{i+=e[o]+e[o+1],o++;break}case Wt:{if(i.length>0){let u=j(i);n?n.nodes.push(u):r.push(u),i=""}let a=j(e[o]);n?n.nodes.push(a):r.push(a);break}case ze:case Ke:case Me:case Fe:case je:case We:case Be:case Ye:{if(i.length>0){let c=j(i);n?n.nodes.push(c):r.push(c),i=""}let a=o,u=o+1;for(;u<e.length&&(l=e.charCodeAt(u),!(l!==ze&&l!==Ke&&l!==Me&&l!==Fe&&l!==je&&l!==We&&l!==Be&&l!==Ye));u++);o=u-1;let p=zt(e.slice(a,u));n?n.nodes.push(p):r.push(p);break}case jt:case Mt:{let a=o;for(let u=o+1;u<e.length;u++)if(l=e.charCodeAt(u),l===Le)u+=1;else if(l===s){o=u;break}i+=e.slice(a,o+1);break}case Ft:{let a=Lt(i,[]);i="",n?n.nodes.push(a):r.push(a),t.push(a),n=a;break}case Kt:{let a=t.pop();if(i.length>0){let u=j(i);a?.nodes.push(u),i=""}t.length>0?n=t[t.length-1]:n=null;break}default:i+=String.fromCharCode(s)}}return i.length>0&&r.push(j(i)),r}var h=class extends Map{constructor(t){super();this.factory=t}factory;get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t,this),this.set(t,n)),n}};var hn=new Uint8Array(256);var oe=new Uint8Array(256);function w(e,r){let t=0,n=[],i=0,l=e.length,o=r.charCodeAt(0);for(let s=0;s<l;s++){let a=e.charCodeAt(s);if(t===0&&a===o){n.push(e.slice(i,s)),i=s+1;continue}switch(a){case 92:s+=1;break;case 39:case 34:for(;++s<l;){let u=e.charCodeAt(s);if(u===92){s+=1;continue}if(u===a)break}break;case 40:oe[t]=41,t++;break;case 91:oe[t]=93,t++;break;case 123:oe[t]=125,t++;break;case 93:case 125:case 41:t>0&&a===oe[t-1]&&t--;break}}return n.push(e.slice(i)),n}var he=(o=>(o[o.Continue=0]="Continue",o[o.Skip=1]="Skip",o[o.Stop=2]="Stop",o[o.Replace=3]="Replace",o[o.ReplaceSkip=4]="ReplaceSkip",o[o.ReplaceStop=5]="ReplaceStop",o))(he||{}),v={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 g(e,r){typeof r=="function"?Ge(e,r):Ge(e,r.enter,r.exit)}function Ge(e,r=()=>v.Continue,t=()=>v.Continue){let n={value:[e,0,null],prev:null},i={parent:null,depth:0,index:0,siblings:e,path(){let l=[],o=n;for(;o;){let s=o.value[2];s&&l.push(s),o=o.prev}return l.reverse(),l}};for(;n!==null;){let l=n.value,o=l[0],s=l[1],a=l[2];if(s>=o.length){n=n.prev,i.depth-=1;continue}if(i.parent=a,i.siblings=o,s>=0){i.index=s;let f=o[s],d=r(f,i)??v.Continue;switch(d.kind){case 0:{f.nodes&&f.nodes.length>0&&(i.depth+=1,n={value:[f.nodes,0,f],prev:n}),l[1]=~s;continue}case 2:return;case 1:{l[1]=~s;continue}case 3:{o.splice(s,1,...d.nodes);continue}case 5:{o.splice(s,1,...d.nodes);return}case 4:{o.splice(s,1,...d.nodes),l[1]+=d.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${he[d.kind]??`Unknown(${d.kind})`}\` in enter.`)}}let u=~s;i.index=u;let p=o[u],c=t(p,i)??v.Continue;switch(c.kind){case 0:l[1]=u+1;continue;case 2:return;case 3:{o.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}case 5:{o.splice(u,1,...c.nodes);return}case 4:{o.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${he[c.kind]??`Unknown(${c.kind})`}\` in exit.`)}}}var Vn=new h(e=>{let r=y(e),t=new Set,n=new Set(["~",">","+","-","*","/"]);return g(r,(i,l)=>{if(i.kind==="word"&&n.has(i.value)){let o=l.index;if(o===-1)return;let s=l.siblings[o-1];if(s?.kind!=="separator"||s.value!==" ")return;let a=l.siblings[o+1];if(a?.kind!=="separator"||a.value!==" ")return;let u=l.siblings[o-2];if(u&&n.has(u.value))return;let p=l.siblings[o+2];if(p&&n.has(p.value))return;t.add(s),t.add(a)}else if(i.kind==="separator"&&i.value.length>0&&i.value.trim()==="")(l.siblings[0]===i||l.siblings[l.siblings.length-1]===i)&&t.add(i);else if(i.kind==="separator"&&i.value.trim()===",")i.value=",";else if(i.kind==="function"&&i.value.startsWith("--")){let o=l.index;if(o<=0)return;let s=l.siblings[o-1];if(s?.kind==="separator"&&s.value===",")return;let a=l.siblings[o-2];return a&&!n.has(a.value)?void 0:v.ReplaceSkip({kind:"function",value:"",nodes:[i]})}}),t.size
`,r){t+=u.length;let p=t;t+=o.property.length,t+=2,t+=o.value?.length??0,o.important&&(t+=11);let c=t;t+=2,o.dst=[n,p,c]}}else if(o.kind==="rule"){if(a+=`${u}${o.selector} {
`,r){t+=u.length;let p=t;t+=o.selector.length,t+=1;let c=t;o.dst=[n,p,c],t+=2}for(let p of o.nodes)a+=i(p,s+1);a+=`${u}}
`,r&&(t+=u.length,t+=2)}else if(o.kind==="at-rule"){if(o.nodes.length===0){let p=`${u}${o.name} ${o.params};
`;if(r){t+=u.length;let c=t;t+=o.name.length,t+=1,t+=o.params.length;let f=t;t+=2,o.dst=[n,c,f]}return p}if(a+=`${u}${o.name}${o.params?` ${o.params} `:" "}{
`,r){t+=u.length;let p=t;t+=o.name.length,o.params&&(t+=1,t+=o.params.length),t+=1;let c=t;o.dst=[n,p,c],t+=2}for(let p of o.nodes)a+=i(p,s+1);a+=`${u}}
`,r&&(t+=u.length,t+=2)}else if(o.kind==="comment"){if(a+=`${u}/*${o.value}*/
`,r){t+=u.length;let p=t;t+=2+o.value.length+2;let c=t;o.dst=[n,p,c],t+=1}}else if(o.kind==="context"||o.kind==="at-root")return"";return a}let l="";for(let o of e)l+=i(o,0);return n.code=l,l}function Tr(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var n="";if(t>4&&e[3]==="\\"){var i=e[2];(i==="?"||i===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),n="//")}var l=e.split(/[/\\]+/);return r!==!1&&l[l.length-1]===""&&l.pop(),n+l.join("/")}function Te(e){let r=Tr(e);return e.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var Re=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,pt=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,Nr=/(?:gradient|element|cross-fade|image)\(/,Rr=/^\s*data:/i,Pr=/^([a-z]+:)?\/\//,Or=/^[A-Z_][.\w-]*\(/i,_r=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,Dr=/(?<!\\)"/g,Ir=/(?: |\\t|\\n|\\f|\\r)+/g,Ur=e=>Rr.test(e),Lr=e=>Pr.test(e);async function dt({css:e,base:r,root:t}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let n=te(e),i=[];function l(o){if(o[0]==="/")return o;let s=Ne.posix.join(Te(r),o),a=Ne.posix.relative(Te(t),s);return a.startsWith(".")||(a="./"+a),a}return g(n,o=>{if(o.kind!=="declaration"||!o.value)return;let s=Re.test(o.value),a=pt.test(o.value);if(s||a){let u=a?zr:mt;i.push(u(o.value,l).then(p=>{o.value=p}))}}),i.length&&await Promise.all(i),z(n)}function mt(e,r){return ht(e,Re,async t=>{let[n,i]=t;return await gt(i.trim(),n,r)})}async function zr(e,r){return await ht(e,pt,async t=>{let[,n]=t;return await Mr(n,async({url:l})=>Re.test(l)?await mt(l,r):Nr.test(l)?l:await gt(l,l,r))})}async function gt(e,r,t,n="url"){let i="",l=e[0];if((l==='"'||l==="'")&&(i=l,e=e.slice(1,-1)),Kr(e))return r;let o=await t(e);return i===""&&o!==encodeURI(o)&&(i='"'),i==="'"&&o.includes("'")&&(i='"'),i==='"'&&o.includes('"')&&(o=o.replace(Dr,'\\"')),`${n}(${i}${o}${i})`}function Kr(e,r){return Lr(e)||Ur(e)||!e[0].match(/[.a-zA-Z0-9_]/)||Or.test(e)}function Mr(e,r){return Promise.all(Fr(e).map(async({url:t,descriptor:n})=>({url:await r({url:t,descriptor:n}),descriptor:n}))).then(jr)}function Fr(e){let r=e.trim().replace(Ir," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(_r);return Array.from(r,({groups:t})=>({url:t?.url?.trim()??"",descriptor:t?.descriptor?.trim()??""})).filter(({url:t})=>!!t)}function jr(e){return e.map(({url:r,descriptor:t})=>r+(t?` ${t}`:"")).join(", ")}async function ht(e,r,t){let n,i=e,l="";for(;n=r.exec(i);)l+=i.slice(0,n.index),l+=await t(n),i=i.slice(n.index+n[0].length);return l+=i,l}function xt({base:e,from:r,polyfills:t,onDependency:n,shouldRewriteUrls:i,customCssResolver:l,customJsResolver:o}){return{base:e,polyfills:t,from:r,async loadModule(s,a){return Ct(s,a,n,o)},async loadStylesheet(s,a){let u=await St(s,a,n,l);return i&&(u.content=await dt({css:u.content,root:e,base:u.base})),u}}}async function At(e){if(e.root&&e.root!=="none"){let r=/[*{]/,t=[];for(let i of e.root.pattern.split("/")){if(r.test(i))break;t.push(i)}if(!await yt.stat(re.resolve(e.root.base,t.join("/"))).then(i=>i.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${e.root.pattern})\` does not exist or is not a directory.`)}}async function ou(e,r){let t=await Gr(e,xt(r));return await At(t),t}async function lu(e,r){let t=await Yr(e,xt(r));return await At(t),t}async function au(e,{base:r}){return Br(e,{base:r,async loadModule(t,n){return Ct(t,n,()=>{})},async loadStylesheet(t,n){return St(t,n,()=>{})}})}async function Ct(e,r,t,n){if(e[0]!=="."){let s=await bt(e,r,n);if(!s)throw new Error(`Could not resolve '${e}' from '${r}'`);let a=await wt(vt(s).href);return{path:s,base:re.dirname(s),module:a.default??a}}let i=await bt(e,r,n);if(!i)throw new Error(`Could not resolve '${e}' from '${r}'`);let[l,o]=await Promise.all([wt(vt(i).href+"?id="+Date.now()),Ue(i)]);for(let s of o)t(s);return{path:i,base:re.dirname(i),module:l.default??l}}async function St(e
`)}){this.shouldReport=r;this.defaultFlush=t}shouldReport;defaultFlush;#r=new h(()=>({value:0}));#t=new h(()=>({value:0n}));#e=[];hit(r){this.#r.get(r).value++}start(r){let t=this.#e.map(i=>i.label).join("//"),n=`${t}${t.length===0?"":"//"}${r}`;this.#r.get(n).value++,this.#t.get(n),this.#e.push({id:n,label:r,namespace:t,value:process.hrtime.bigint()})}end(r){let t=process.hrtime.bigint();if(this.#e[this.#e.length-1].label!==r)throw new Error(`Mismatched timer label: \`${r}\`, expected \`${this.#e[this.#e.length-1].label}\``);let n=this.#e.pop(),i=t-n.value;this.#t.get(n.id).value+=i}track(r){this.start(r);let t=!1;return{[Symbol.dispose]:()=>{t||(this.end(r),t=!0)},[Symbol.asyncDispose]:()=>{t||(this.end(r),t=!0)}}}span(r,t){this.start(r);let n=!1;try{let i=t();return n=i&&typeof i.then=="function",n?i.finally(()=>this.end(r)):i}finally{n||this.end(r)}}reset(){this.#r.clear(),this.#t.clear(),this.#e.splice(0)}report(r=this.defaultFlush){let t=[],n=!1;for(let o=this.#e.length-1;o>=0;o--)this.end(this.#e[o].label);for(let[o,{value:s}]of this.#r.entries()){if(this.#t.has(o))continue;t.length===0&&(n=!0,t.push("Hits:"));let a=o.split("//").length;t.push(`${" ".repeat(a)}${o} ${pe(Vt(`\xD7 ${s}`))}`)}this.#t.size>0&&n&&t.push(`
Timers:`);let i=-1/0,l=new Map;for(let[o,{value:s}]of this.#t){let a=`${(Number(s)/1e6).toFixed(2)}ms`;l.set(o,a),i=Math.max(i,a.length)}for(let o of this.#t.keys()){let s=o.split("//").length;t.push(`${pe(`[${l.get(o).padStart(i," ")}]`)}${" ".repeat(s-1)}${s===1?" ":pe(" \u21B3 ")}${o.split("//").pop()} ${this.#r.get(o).value===1?"":pe(Vt(`\xD7 ${this.#r.get(o).value}`))}`.trimEnd())}r(`
${t.join(`
`)}
`),this.reset()}[Symbol.dispose](){this.shouldReport&&this.report()}};function pe(e){return`\x1B[2m${e}\x1B[22m`}function Vt(e){return`\x1B[34m${e}\x1B[39m`}import Jr from"@jridgewell/remapping";import{Features as ne,transform as Xr}from"lightningcss";import en from"magic-string";function mu(e,{file:r="input.css",minify:t=!1,map:n}={}){function i(a,u){return Xr({filename:r,code:a,minify:t,sourceMap:typeof u<"u",inputSourceMap:u,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:ne.Nesting|ne.MediaQueries,exclude:ne.LogicalProperties|ne.DirSelector|ne.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0})}let l=i(Buffer.from(e),n);if(n=l.map?.toString(),l.warnings=l.warnings.filter(a=>!/'(deep|slotted|global)' is not recognized as a valid pseudo-/.test(a.message)),l.warnings.length>0){let a=e.split(`
`),u=[`Found ${l.warnings.length} ${l.warnings.length===1?"warning":"warnings"} while optimizing generated CSS:`];for(let[p,c]of l.warnings.entries()){u.push(""),l.warnings.length>1&&u.push(`Issue #${p+1}:`);let f=2,d=Math.max(0,c.loc.line-f-1),m=Math.min(a.length,c.loc.line+f),C=a.slice(d,m).map((k,I)=>d+I+1===c.loc.line?`${ie("\u2502")} ${k}`:ie(`\u2502 ${k}`));C.splice(c.loc.line-d,0,`${ie("\u2506")}${" ".repeat(c.loc.column-1)} ${tn(`${ie("^--")} ${c.message}`)}`,`${ie("\u2506")}`),u.push(...C)}u.push(""),console.warn(u.join(`
`))}l=i(l.code,n),n=l.map?.toString();let o=l.code.toString(),s=new en(o);if(s.replaceAll("@media not (","@media not all and ("),n!==void 0&&s.hasChanged()){let a=s.generateMap({source:"original",hires:"boundary"}).toString();n=Jr([a,n],()=>null).toString()}return o=s.toString(),{code:o,map:n}}function ie(e){return`\x1B[2m${e}\x1B[22m`}function tn(e){return`\x1B[33m${e}\x1B[39m`}import{SourceMapGenerator as rn}from"source-map-js";function nn(e){let r=new rn,t=1,n=new h(i=>({url:i?.url??`<unknown ${t++}>`,content:i?.content??"<none>"}));for(let i of e.mappings){let l=n.get(i.originalPosition?.source??null);r.addMapping({generated:i.generatedPosition,original:i.originalPosition,source:l.url,name:i.name}),r.setSourceContent(l.url,l.content)}return r.toString()}function ku(e){let r=typeof e=="string"?e:nn(e);function t(n){return`/*# sourceMappingURL=${n} */
`}return{raw:r,get inline(){let n=Buffer.from(r,"utf-8").toString("base64");return t(`data:application/json;base64,${n}`)},comment:t}}if(!process.versions.bun)if(M.registerHooks)M.registerHooks({resolve:De});else{let e=M.createRequire(import.meta.url);M.register?.(on(e.resolve("@tailwindcss/node/esm-cache-loader")))}export{tu as Features,$t as Instrumentation,ru as Polyfills,au as __unstable__loadDesignSystem,lu as compile,ou as compileAst,me as env,Ct as loadModule,Te as normalizePath,mu as optimize,ku as toSourceMap};