shadow-claw 1.59.4 → 1.59.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.well-known/mcp/server-card.json +4 -12
- package/.well-known/mcp.json +4 -12
- package/dist/cli/build/build.js +1 -1
- package/dist/cli/{chunk-s1uNIOTZ.js → chunk-CBpOntTm.js} +2 -2
- package/dist/cli/chunk-DguSnPkq.js +139 -0
- package/dist/cli/cli.js +1 -1
- package/dist/public/.well-known/mcp/server-card.json +4 -12
- package/dist/public/.well-known/mcp.json +4 -12
- package/dist/public/docs/example/article/index.html +1 -1
- package/dist/public/docs/example/article.html +1 -1
- package/dist/public/docs/publishing/index.html +1 -1
- package/dist/public/docs/publishing.html +1 -1
- package/dist/public/docs/skill-creator/index.html +1 -1
- package/dist/public/docs/skill-creator.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/main/index.html +1 -1
- package/dist/public/main/memory/index.html +1 -1
- package/dist/public/main/memory.html +1 -1
- package/dist/public/main.html +1 -1
- package/dist/public/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/cli/chunk-B8gZZ5Hh.js +0 -139
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./chunk-uAI_Zi6n.js";import{C as t,E as n,S as r,T as i,_ as a,a as o,b as s,d as c,f as l,g as u,h as d,i as f,l as p,m,o as h,p as g,r as _,t as v,w as y,x as ee,y as te}from"./chunk-C-P_JXh4.js";import{c as ne,d as b,l as x,o as re,s as S,t as C,u as ie}from"./chunk-Dk4W6ER0.js";import{n as ae}from"./chunk-kF1oe5Yi.js";import*as w from"node:fs";import T,{basename as oe,join as E,posix as se,relative as ce,resolve as le,win32 as ue}from"node:path";import{fileURLToPath as de}from"node:url";import D,{chdir as fe,env as O,exit as pe}from"node:process";import{execSync as me}from"node:child_process";import{copyFile as k,cp as A,lstat as he,mkdir as j,readFile as M,readdir as ge,readlink as _e,realpath as ve,rm as ye,stat as be,writeFile as N}from"node:fs/promises";import{chmodSync as xe,lstatSync as Se,lstatSync as Ce,readdir as we,readdirSync as Te,readlinkSync as Ee,realpathSync as De,renameSync as Oe,rmSync as ke,rmdirSync as Ae,statSync as je,unlinkSync as Me}from"fs";import{EventEmitter as Ne}from"node:events";import Pe from"node:stream";import{StringDecoder as Fe}from"node:string_decoder";import{basename as Ie,parse as P,resolve as F}from"path";import{inspect as Le}from"util";import Re from"fs/promises";import{setTimeout as ze}from"timers/promises";import{tmpdir as Be}from"os";import Ve from"gray-matter";var I=(e,t,n)=>{let r=e instanceof RegExp?He(e,n):e,i=t instanceof RegExp?He(t,n):t,a=r!==null&&i!=null&&Ue(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},He=(e,t)=>{let n=t.match(e);return n?n[0]:null},Ue=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},We=`\0SLASH`+Math.random()+`\0`,Ge=`\0OPEN`+Math.random()+`\0`,Ke=`\0CLOSE`+Math.random()+`\0`,qe=`\0COMMA`+Math.random()+`\0`,Je=`\0PERIOD`+Math.random()+`\0`,Ye=new RegExp(We,`g`),Xe=new RegExp(Ge,`g`),Ze=new RegExp(Ke,`g`),Qe=new RegExp(qe,`g`),$e=new RegExp(Je,`g`),et=/\\\\/g,tt=/\\{/g,nt=/\\}/g,rt=/\\,/g,it=/\\./g,at=1e5;function ot(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function st(e){return e.replace(et,We).replace(tt,Ge).replace(nt,Ke).replace(rt,qe).replace(it,Je)}function ct(e){return e.replace(Ye,`\\`).replace(Xe,`{`).replace(Ze,`}`).replace(Qe,`,`).replace($e,`.`)}function lt(e){if(!e)return[``];let t=[],n=I(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=lt(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function ut(e,t={}){if(!e)return[];let{max:n=at}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),ht(st(e),n,!0).map(ct)}function dt(e){return`{`+e+`}`}function ft(e){return/^-?0\d/.test(e)}function pt(e,t){return e<=t}function mt(e,t){return e>=t}function ht(e,t,n){let r=[],i=I(`{`,`}`,e);if(!i)return[e];let a=i.pre,o=i.post.length?ht(i.post,t,!1):[``];if(/\$$/.test(i.pre))for(let e=0;e<o.length&&e<t;e++){let t=a+`{`+i.body+`}`+o[e];r.push(t)}else{let s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=s||c,u=i.body.indexOf(`,`)>=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+Ke+i.post,ht(e,t,!0)):[e];let d;if(l)d=i.body.split(/\.\./);else if(d=lt(i.body),d.length===1&&d[0]!==void 0&&(d=ht(d[0],t,!1).map(dt),d.length===1))return o.map(e=>i.pre+d[0]+e);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let e=ot(d[0]),t=ot(d[1]),n=Math.max(d[0].length,d[1].length),r=d.length===3&&d[2]!==void 0?Math.abs(ot(d[2])):1,i=pt;t<e&&(r*=-1,i=mt);let a=d.some(ft);f=[];for(let o=e;i(o,t);o+=r){let e;if(c)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,ht(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<o.length&&r.length<t;i++){let t=a+f[e]+o[i];(!n||l||t)&&r.push(t)}}return r}var gt=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},_t={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},vt=e=>e.replace(/[[\]\\-]/g,`\\$&`),yt=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),bt=e=>e.join(``),xt=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;t:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1)l=!0,a++;else{if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c)c=!0,a++;else{if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(_t))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue t}}c=!1,d?(t>d?r.push(vt(d)+`-`+vt(t)):t===d&&r.push(vt(t)),d=``,a++):e.startsWith(`-]`,a+1)?(r.push(vt(t+`-`)),a+=2):e.startsWith(`-`,a+1)?(d=t,a+=2):(r.push(vt(t)),a++)}}}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[yt(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+bt(r)+`]`,p=`[`+(l?``:`^`)+bt(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},St=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),Ct=/* @__PURE__ */ new Set([`!`,`?`,`+`,`*`,`@`]),wt=e=>Ct.has(e),Tt=`(?!(?:^|/)\\.\\.?(?:$|/))`,Et=`(?!\\.)`,Dt=/* @__PURE__ */ new Set([`[`,`.`]),Ot=/* @__PURE__ */ new Set([`..`,`.`]),kt=/* @__PURE__ */ new Set(`().*{}+?[]^$\\!`),At=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),jt=`[^/]`,Mt=jt+`*?`,Nt=jt+`+?`,Pt=class e{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...t){for(let n of t)if(n!==``){if(typeof n!=`string`&&!(n instanceof e&&n.#i===this))throw Error(`invalid part: `+n);this.#r.push(n)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let t=this.#i;for(let n=0;n<this.#a;n++){let r=t.#r[n];if(!(r instanceof e&&r.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(t){let n=new e(this.type,t);for(let e of this.#r)n.copyIn(e);return n}static#f(t,n,r,i){let a=!1,o=!1,s=-1,c=!1;if(n.type===null){let l=r,u=``;for(;l<t.length;){let r=t.charAt(l++);if(a||r===`\\`)a=!a,u+=r;else if(o)l===s+1?(r===`^`||r===`!`)&&(c=!0):r===`]`&&!(l===s+2&&c)&&(o=!1),u+=r;else if(r===`[`)o=!0,s=l,c=!1,u+=r;else if(!i.noext&&wt(r)&&t.charAt(l)===`(`){n.push(u),u=``;let a=new e(r,n);l=e.#f(t,a,l,i),n.push(a)}else u+=r}return n.push(u),l}let l=r+1,u=new e(null,n),d=[],f=``;for(;l<t.length;){let r=t.charAt(l++);if(a||r===`\\`)a=!a,f+=r;else if(o)l===s+1?(r===`^`||r===`!`)&&(c=!0):r===`]`&&!(l===s+2&&c)&&(o=!1),f+=r;else if(r===`[`)o=!0,s=l,c=!1,f+=r;else if(wt(r)&&t.charAt(l)===`(`){u.push(f),f=``;let n=new e(r,u);u.push(n),l=e.#f(t,n,l,i)}else if(r===`|`)u.push(f),f=``,d.push(u),u=new e(null,n);else{if(r===`)`)return f===``&&n.#r.length===0&&(n.#u=!0),u.push(f),f=``,n.push(...d,u),l;f+=r}}return n.type=null,n.#t=void 0,n.#r=[t.substring(r-1)],l}static fromGlob(t,n={}){let r=new e(null,void 0,n);return e.#f(t,r,0,n),r}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(t){let n=t??!!this.#c.dot;if(this.#e===this&&this.#d(),!this.type){let r=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),i=this.#r.map(n=>{let[i,a,o,s]=typeof n==`string`?e.#m(n,this.#t,r):n.toRegExpSource(t);return this.#t=this.#t||o,this.#n=this.#n||s,i}).join(``),a=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ot.has(this.#r[0]))){let e=Dt,r=n&&e.has(i.charAt(0))||i.startsWith(`\\.`)&&e.has(i.charAt(2))||i.startsWith(`\\.\\.`)&&e.has(i.charAt(4)),o=!n&&!t&&e.has(i.charAt(0));a=r?Tt:o?Et:``}let o=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(o=`(?:$|\\/)`),[a+i+o,St(i),this.#t=!!this.#t,this.#n]}let r=this.type===`*`||this.type===`+`,i=this.type===`!`?`(?:(?!(?:`:`(?:`,a=this.#p(n);if(this.isStart()&&this.isEnd()&&!a&&this.type!==`!`){let e=this.toString();return this.#r=[e],this.type=null,this.#t=void 0,[e,St(this.toString()),!1,!1]}let o=!r||t||n||!Et?``:this.#p(!0);o===a&&(o=``),o&&(a=`(?:${a})(?:${o})*?`);let s=``;if(this.type===`!`&&this.#u)s=(this.isStart()&&!n?Et:``)+Nt;else{let e=this.type===`!`?`))`+(this.isStart()&&!n&&!t?Et:``)+Mt+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&o?`)`:this.type===`*`&&o?`)?`:`)${this.type}`;s=i+a+e}return[s,St(a),this.#t=!!this.#t,this.#n]}#p(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#m(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r)r=!1,i+=(kt.has(c)?`\\`:``)+c;else if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Nt:Mt,t=!0}else if(o=!1,c===`\\`)s===e.length-1?i+=`\\\\`:r=!0;else{if(c===`[`){let[n,r,o,c]=xt(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}c===`?`?(i+=jt,t=!0):i+=At(c)}}return[i,St(e),!!t,a]}},Ft=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),L=(e,t,n={})=>(gt(t),!n.nocomment&&t.charAt(0)===`#`?!1:new dn(t,n).match(e)),It=/^\*+([^+@!?\*\[\(]*)$/,Lt=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Rt=e=>t=>t.endsWith(e),zt=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Bt=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Vt=/^\*+\.\*+$/,Ht=e=>!e.startsWith(`.`)&&e.includes(`.`),Ut=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Wt=/^\.\*+$/,Gt=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Kt=/^\*+$/,qt=e=>e.length!==0&&!e.startsWith(`.`),Jt=e=>e.length!==0&&e!==`.`&&e!==`..`,Yt=/^\?+([^+@!?\*\[\(]*)?$/,Xt=([e,t=``])=>{let n=en([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Zt=([e,t=``])=>{let n=tn([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Qt=([e,t=``])=>{let n=tn([e]);return t?e=>n(e)&&e.endsWith(t):n},$t=([e,t=``])=>{let n=en([e]);return t?e=>n(e)&&e.endsWith(t):n},en=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},tn=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},nn=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,rn={win32:{sep:`\\`},posix:{sep:`/`}};L.sep=nn===`win32`?rn.win32.sep:rn.posix.sep;var R=Symbol(`globstar **`);L.GLOBSTAR=R;var an=`[^/]*?`,on=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,sn=`(?:(?!(?:\\/|^)\\.).)*?`;L.filter=(e,t={})=>n=>L(n,e,t);var z=(e,t={})=>Object.assign({},e,t);L.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return L;let t=L;return Object.assign((n,r,i={})=>t(n,r,z(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,z(e,n))}static defaults(n){return t.defaults(z(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,z(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,z(e,r))}},unescape:(n,r={})=>t.unescape(n,z(e,r)),escape:(n,r={})=>t.escape(n,z(e,r)),filter:(n,r={})=>t.filter(n,z(e,r)),defaults:n=>t.defaults(z(e,n)),makeRe:(n,r={})=>t.makeRe(n,z(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,z(e,r)),match:(n,r,i={})=>t.match(n,r,z(e,i)),sep:t.sep,GLOBSTAR:R})};var cn=(e,t={})=>(gt(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ut(e,{max:t.braceExpandMax}));L.braceExpand=cn,L.makeRe=(e,t={})=>new dn(e,t).makeRe(),L.match=(e,t,n={})=>{let r=new dn(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var ln=/[?*]|[+@!]\(.*?\)|\[|\]/,un=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),dn=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){gt(e),t||={},this.options=t,this.pattern=e,this.platform=t.platform||nn,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!ln.test(e[2]))&&!ln.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=this.options;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),r=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),i=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),a=!i&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),o=r?3:n?0:void 0,s=a?3:i?0:void 0;if(typeof o==`number`&&typeof s==`number`){let[n,r]=[e[o],t[s]];n.toLowerCase()===r.toLowerCase()&&(t[s]=n,s>o?t=t.slice(s):o>s&&(e=e.slice(o)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug(`matchOne`,this,{file:e,pattern:t}),this.debug(`matchOne`,e.length,t.length);for(var a=0,o=0,s=e.length,c=t.length;a<s&&o<c;a++,o++){this.debug(`matchOne loop`);var l=t[o],u=e[a];if(this.debug(t,l,u),l===!1)return!1;if(l===R){this.debug(`GLOBSTAR`,[t,l,u]);var d=a,f=o+1;if(f===c){for(this.debug(`** at the end`);a<s;a++)if(e[a]===`.`||e[a]===`..`||!r.dot&&e[a].charAt(0)===`.`)return!1;return!0}for(;d<s;){var p=e[d];if(this.debug(`
|
|
2
|
-
globstar while`,e,d,t,f,p),this.matchOne(e.slice(d),t.slice(f),n))return this.debug(`globstar found match!`,d,s,p),!0;if(p===`.`||p===`..`||!r.dot&&p.charAt(0)===`.`){this.debug(`dot detected!`,e,d,t,f);break}this.debug(`globstar swallow a segment, and continue`),d++}return!!(n&&(this.debug(`
|
|
3
|
-
>>> no match, partial?`,e,d,t,f),d===s))}let i;if(typeof l==`string`?(i=u===l,this.debug(`string match`,l,u,i)):(i=l.test(u),this.debug(`pattern match`,l,u,i)),!i)return!1}if(a===s&&o===c)return!0;if(a===s)return n;if(o===c)return a===s-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return cn(this.pattern,this.options)}parse(e){gt(e);let t=this.options;if(e===`**`)return R;if(e===``)return``;let n,r=null;(n=e.match(Kt))?r=t.dot?Jt:qt:(n=e.match(It))?r=(t.nocase?t.dot?Bt:zt:t.dot?Rt:Lt)(n[1]):(n=e.match(Yt))?r=(t.nocase?t.dot?Zt:Xt:t.dot?Qt:$t)(n):(n=e.match(Vt))?r=t.dot?Ut:Ht:(n=e.match(Wt))&&(r=Gt);let i=Pt.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?an:t.dot?on:sn,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?un(e):e===R?R:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==R||a===R||(a===void 0?i!==void 0&&i!==R?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==R&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=R))});let i=t.filter(e=>e!==R);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return L.defaults(e).Minimatch}};L.AST=Pt,L.Minimatch=dn,L.escape=Ft,L.unescape=St;var fn=typeof performance==`object`&&performance&&typeof performance.now==`function`?performance:Date,pn=/* @__PURE__ */ new Set,mn=typeof process==`object`&&process?process:{},hn=(e,t,n,r)=>{typeof mn.emitWarning==`function`?mn.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},gn=globalThis.AbortController,_n=globalThis.AbortSignal;if(typeof gn>`u`){_n=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},gn=class{constructor(){t()}signal=new _n;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(let t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e=mn.env?.LRU_CACHE_IGNORE_AC_WARNING!==`1`,t=()=>{e&&(e=!1,hn("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.",`NO_ABORT_CONTROLLER`,`ENOTSUP`,t))}}var vn=e=>!pn.has(e),yn=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),bn=e=>yn(e)?e<=256?Uint8Array:e<=2**16?Uint16Array:e<=2**32?Uint32Array:e<=2**53-1?xn:null:null,xn=class extends Array{constructor(e){super(e),this.fill(0)}},Sn=class e{heap;length;static#e=!1;static create(t){let n=bn(t);if(!n)return[];e.#e=!0;let r=new e(t,n);return e.#e=!1,r}constructor(t,n){if(!e.#e)throw TypeError(`instantiate Stack using Stack.create(n)`);this.heap=new n(t),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Cn=class e{#e;#t;#n;#r;#i;#a;#o;#s;get perf(){return this.#s}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#x,autopurgeTimers:e.#S,sizes:e.#y,keyMap:e.#u,keyList:e.#d,valList:e.#f,next:e.#p,prev:e.#m,get head(){return e.#h},get tail(){return e.#g},free:e.#_,isBackgroundFetch:t=>e.#V(t),backgroundFetch:(t,n,r,i)=>e.#B(t,n,r,i),moveToTail:t=>e.#U(t),indexes:t=>e.#I(t),rindexes:t=>e.#L(t),isStale:t=>e.#j(t)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#l}get size(){return this.#c}get fetchMethod(){return this.#a}get memoMethod(){return this.#o}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#i}constructor(t){let{max:n=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:c,dispose:l,onInsert:u,disposeAfter:d,noDisposeOnSet:f,noUpdateTTL:p,maxSize:m=0,maxEntrySize:h=0,sizeCalculation:g,fetchMethod:_,memoMethod:v,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:ee,allowStaleOnFetchRejection:te,allowStaleOnFetchAbort:ne,ignoreFetchAbort:b,perf:x}=t;if(x!==void 0&&typeof x?.now!=`function`)throw TypeError(`perf option must have a now() method if specified`);if(this.#s=x??fn,n!==0&&!yn(n))throw TypeError(`max option must be a nonnegative integer`);let re=n?bn(n):Array;if(!re)throw Error(`invalid max value: `+n);if(this.#e=n,this.#t=m,this.maxEntrySize=h||this.#t,this.sizeCalculation=g,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw TypeError(`cannot set sizeCalculation without setting maxSize or maxEntrySize`);if(typeof this.sizeCalculation!=`function`)throw TypeError(`sizeCalculation set to non-function`)}if(v!==void 0&&typeof v!=`function`)throw TypeError(`memoMethod must be a function if defined`);if(this.#o=v,_!==void 0&&typeof _!=`function`)throw TypeError(`fetchMethod must be a function if specified`);if(this.#a=_,this.#w=!!_,this.#u=/* @__PURE__ */ new Map,this.#d=Array(n).fill(void 0),this.#f=Array(n).fill(void 0),this.#p=new re(n),this.#m=new re(n),this.#h=0,this.#g=0,this.#_=Sn.create(n),this.#c=0,this.#l=0,typeof l==`function`&&(this.#n=l),typeof u==`function`&&(this.#r=u),typeof d==`function`?(this.#i=d,this.#v=[]):(this.#i=void 0,this.#v=void 0),this.#C=!!this.#n,this.#E=!!this.#r,this.#T=!!this.#i,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!te,this.allowStaleOnFetchAbort=!!ne,this.ignoreFetchAbort=!!b,this.maxEntrySize!==0){if(this.#t!==0&&!yn(this.#t))throw TypeError(`maxSize must be a positive integer if specified`);if(!yn(this.maxEntrySize))throw TypeError(`maxEntrySize must be a positive integer if specified`);this.#M()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!ee,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=yn(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!yn(this.ttl))throw TypeError(`ttl must be a positive integer if specified`);this.#D()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw TypeError(`At least one of max, maxSize, or ttl is required`);if(!this.ttlAutopurge&&!this.#e&&!this.#t){let t=`LRU_CACHE_UNBOUNDED`;vn(t)&&(pn.add(t),hn(`TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.`,`UnboundedCacheWarning`,t,e))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#D(){let e=new xn(this.#e),t=new xn(this.#e);this.#x=e,this.#b=t;let n=this.ttlAutopurge?Array(this.#e):void 0;this.#S=n,this.#A=(r,i,a=this.#s.now())=>{if(t[r]=i===0?0:a,e[r]=i,n?.[r]&&(clearTimeout(n[r]),n[r]=void 0),i!==0&&n){let e=setTimeout(()=>{this.#j(r)&&this.#W(this.#d[r],`expire`)},i+1);e.unref&&e.unref(),n[r]=e}},this.#O=n=>{t[n]=e[n]===0?0:this.#s.now()},this.#k=(n,a)=>{if(e[a]){let o=e[a],s=t[a];if(!o||!s)return;n.ttl=o,n.start=s,n.now=r||i(),n.remainingTTL=o-(n.now-s)}};let r=0,i=()=>{let e=this.#s.now();if(this.ttlResolution>0){r=e;let t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{let a=this.#u.get(n);if(a===void 0)return 0;let o=e[a],s=t[a];return!o||!s?1/0:o-((r||i())-s)},this.#j=n=>{let a=t[n],o=e[n];return!!o&&!!a&&(r||i())-a>o}}#O=()=>{};#k=()=>{};#A=()=>{};#j=()=>!1;#M(){let e=new xn(this.#e);this.#l=0,this.#y=e,this.#N=t=>{this.#l-=e[t],e[t]=0},this.#F=(e,t,n,r)=>{if(this.#V(t))return 0;if(!yn(n)){if(r){if(typeof r!=`function`)throw TypeError(`sizeCalculation must be a function`);if(n=r(t,e),!yn(n))throw TypeError(`sizeCalculation return invalid (expect positive integer)`)}else throw TypeError(`invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.`)}return n},this.#P=(t,n,r)=>{if(e[t]=n,this.#t){let n=this.#t-e[t];for(;this.#l>n;)this.#z(!0)}this.#l+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#l)}}#N=e=>{};#P=(e,t,n)=>{};#F=(e,t,n,r)=>{if(n||r)throw TypeError(`cannot set size without setting maxSize or maxEntrySize on cache`);return 0};*#I({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#g;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#h));)t=this.#m[t]}*#L({allowStale:e=this.allowStale}={}){if(this.#c)for(let t=this.#h;!(!this.#R(t)||((e||!this.#j(t))&&(yield t),t===this.#g));)t=this.#p[t]}#R(e){return e!==void 0&&this.#u.get(this.#d[e])===e}*entries(){for(let e of this.#I())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*rentries(){for(let e of this.#L())this.#f[e]!==void 0&&this.#d[e]!==void 0&&!this.#V(this.#f[e])&&(yield[this.#d[e],this.#f[e]])}*keys(){for(let e of this.#I()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*rkeys(){for(let e of this.#L()){let t=this.#d[e];t!==void 0&&!this.#V(this.#f[e])&&(yield t)}}*values(){for(let e of this.#I())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}*rvalues(){for(let e of this.#L())this.#f[e]!==void 0&&!this.#V(this.#f[e])&&(yield this.#f[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]=`LRUCache`;find(e,t={}){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;if(i!==void 0&&e(i,this.#d[n],this))return this.get(this.#d[n],t)}}forEach(e,t=this){for(let n of this.#I()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}rforEach(e,t=this){for(let n of this.#L()){let r=this.#f[n],i=this.#V(r)?r.__staleWhileFetching:r;i!==void 0&&e.call(t,i,this.#d[n],this)}}purgeStale(){let e=!1;for(let t of this.#L({allowStale:!0}))this.#j(t)&&(this.#W(this.#d[t],`expire`),e=!0);return e}info(e){let t=this.#u.get(e);if(t===void 0)return;let n=this.#f[t],r=this.#V(n)?n.__staleWhileFetching:n;if(r===void 0)return;let i={value:r};if(this.#x&&this.#b){let e=this.#x[t],n=this.#b[t];e&&n&&(i.ttl=e-(this.#s.now()-n),i.start=Date.now())}return this.#y&&(i.size=this.#y[t]),i}dump(){let e=[];for(let t of this.#I({allowStale:!0})){let n=this.#d[t],r=this.#f[t],i=this.#V(r)?r.__staleWhileFetching:r;if(i===void 0||n===void 0)continue;let a={value:i};if(this.#x&&this.#b){a.ttl=this.#x[t];let e=this.#s.now()-this.#b[t];a.start=Math.floor(Date.now()-e)}this.#y&&(a.size=this.#y[t]),e.unshift([n,a])}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let e=Date.now()-n.start;n.start=this.#s.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(t===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=n,{noUpdateTTL:c=this.noUpdateTTL}=n,l=this.#F(e,t,n.size||0,o);if(this.maxEntrySize&&l>this.maxEntrySize)return s&&(s.set=`miss`,s.maxEntrySizeExceeded=!0),this.#W(e,`set`),this;let u=this.#c===0?void 0:this.#u.get(e);if(u===void 0)u=this.#c===0?this.#g:this.#_.length===0?this.#c===this.#e?this.#z(!1):this.#c:this.#_.pop(),this.#d[u]=e,this.#f[u]=t,this.#u.set(e,u),this.#p[this.#g]=u,this.#m[u]=this.#g,this.#g=u,this.#c++,this.#P(u,l,s),s&&(s.set=`add`),c=!1,this.#E&&this.#r?.(t,e,`add`);else{this.#U(u);let n=this.#f[u];if(t!==n){if(this.#w&&this.#V(n)){n.__abortController.abort(/* @__PURE__ */ Error(`replaced`));let{__staleWhileFetching:t}=n;t!==void 0&&!a&&(this.#C&&this.#n?.(t,e,`set`),this.#T&&this.#v?.push([t,e,`set`]))}else a||(this.#C&&this.#n?.(n,e,`set`),this.#T&&this.#v?.push([n,e,`set`]));if(this.#N(u),this.#P(u,l,s),this.#f[u]=t,s){s.set=`replace`;let e=n&&this.#V(n)?n.__staleWhileFetching:n;e!==void 0&&(s.oldValue=e)}}else s&&(s.set=`update`);this.#E&&this.onInsert?.(t,e,t===n?`update`:`replace`)}if(r!==0&&!this.#x&&this.#D(),this.#x&&(c||this.#A(u,r,i),s&&this.#k(s,u)),!a&&this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#c;){let e=this.#f[this.#h];if(this.#z(!0),this.#V(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}}#z(e){let t=this.#h,n=this.#d[t],r=this.#f[t];return this.#w&&this.#V(r)?r.__abortController.abort(/* @__PURE__ */ Error(`evicted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(r,n,`evict`),this.#T&&this.#v?.push([r,n,`evict`])),this.#N(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#d[t]=void 0,this.#f[t]=void 0,this.#_.push(t)),this.#c===1?(this.#h=this.#g=0,this.#_.length=0):this.#h=this.#p[t],this.#u.delete(n),this.#c--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#u.get(e);if(i!==void 0){let e=this.#f[i];if(this.#V(e)&&e.__staleWhileFetching===void 0)return!1;if(this.#j(i))r&&(r.has=`stale`,this.#k(r,i));else return n&&this.#O(i),r&&(r.has=`hit`,this.#k(r,i)),!0}else r&&(r.has=`miss`);return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#u.get(e);if(r===void 0||!n&&this.#j(r))return;let i=this.#f[r];return this.#V(i)?i.__staleWhileFetching:i}#B(e,t,n,r){let i=t===void 0?void 0:this.#f[t];if(this.#V(i))return i;let a=new gn,{signal:o}=n;o?.addEventListener(`abort`,()=>a.abort(o.reason),{signal:a.signal});let s={signal:a.signal,options:n,context:r},c=(r,i=!1)=>{let{aborted:o}=a.signal,c=n.ignoreFetchAbort&&r!==void 0,l=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&r!==void 0);if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,c&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!c&&!i)return u(a.signal.reason,l);let d=f,p=this.#f[t];return(p===f||c&&i&&p===void 0)&&(r===void 0?d.__staleWhileFetching===void 0?this.#W(e,`fetch`):this.#f[t]=d.__staleWhileFetching:(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,s.options))),r},l=e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e,!1)),u=(r,i)=>{let{aborted:o}=a.signal,s=o&&n.allowStaleOnFetchAbort,c=s||n.allowStaleOnFetchRejection,l=c||n.noDeleteOnFetchRejection,u=f;if(this.#f[t]===f&&(!l||!i&&u.__staleWhileFetching===void 0?this.#W(e,`fetch`):s||(this.#f[t]=u.__staleWhileFetching)),c)return n.status&&u.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw r},d=(t,r)=>{let o=this.#a?.(e,i,s);o&&o instanceof Promise&&o.then(e=>t(e===void 0?void 0:e),r),a.signal.addEventListener(`abort`,()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))})};n.status&&(n.status.fetchDispatched=!0);let f=new Promise(d).then(c,l),p=Object.assign(f,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return t===void 0?(this.set(e,p,{...s.options,status:void 0}),t=this.#u.get(e)):this.#f[t]=p,p}#V(e){if(!this.#w)return!1;let t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty(`__staleWhileFetching`)&&t.__abortController instanceof gn}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:_}=t;if(!this.#w)return g&&(g.fetch=`get`),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});let v={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:f,status:g,signal:_},y=this.#u.get(e);if(y===void 0){g&&(g.fetch=`miss`);let t=this.#B(e,y,v,m);return t.__returned=t}{let t=this.#f[y];if(this.#V(t)){let e=n&&t.__staleWhileFetching!==void 0;return g&&(g.fetch=`inflight`,e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#j(y);if(!h&&!i)return g&&(g.fetch=`hit`),this.#U(y),r&&this.#O(y),g&&this.#k(g,y),t;let a=this.#B(e,y,v,m),o=a.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=i?`stale`:`refresh`,o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw Error(`fetch() returned undefined`);return n}memo(e,t={}){let n=this.#o;if(!n)throw Error(`no memoMethod provided to constructor`);let{context:r,forceRefresh:i,...a}=t,o=this.get(e,a);if(!i&&o!==void 0)return o;let s=n(e,o,{options:a,context:r});return this.set(e,s,a),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(o!==void 0){let t=this.#f[o],s=this.#V(t);return a&&this.#k(a,o),this.#j(o)?(a&&(a.get=`stale`),s?(a&&n&&t.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#W(e,`expire`),a&&n&&(a.returnedStale=!0),n?t:void 0)):(a&&(a.get=`hit`),s?t.__staleWhileFetching:(this.#U(o),r&&this.#O(o),t))}a&&(a.get=`miss`)}#H(e,t){this.#m[t]=e,this.#p[e]=t}#U(e){e!==this.#g&&(e===this.#h?this.#h=this.#p[e]:this.#H(this.#m[e],this.#p[e]),this.#H(this.#g,e),this.#g=e)}delete(e){return this.#W(e,`delete`)}#W(e,t){let n=!1;if(this.#c!==0){let r=this.#u.get(e);if(r!==void 0){if(this.#S?.[r]&&(clearTimeout(this.#S?.[r]),this.#S[r]=void 0),n=!0,this.#c===1)this.#G(t);else{this.#N(r);let n=this.#f[r];if(this.#V(n)?n.__abortController.abort(/* @__PURE__ */ Error(`deleted`)):(this.#C||this.#T)&&(this.#C&&this.#n?.(n,e,t),this.#T&&this.#v?.push([n,e,t])),this.#u.delete(e),this.#d[r]=void 0,this.#f[r]=void 0,r===this.#g)this.#g=this.#m[r];else if(r===this.#h)this.#h=this.#p[r];else{let e=this.#m[r];this.#p[e]=this.#p[r];let t=this.#p[r];this.#m[t]=this.#m[r]}this.#c--,this.#_.push(r)}}}if(this.#T&&this.#v?.length){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}return n}clear(){return this.#G(`delete`)}#G(e){for(let t of this.#L({allowStale:!0})){let n=this.#f[t];if(this.#V(n))n.__abortController.abort(/* @__PURE__ */ Error(`deleted`));else{let r=this.#d[t];this.#C&&this.#n?.(n,r,e),this.#T&&this.#v?.push([n,r,e])}}if(this.#u.clear(),this.#f.fill(void 0),this.#d.fill(void 0),this.#x&&this.#b){this.#x.fill(0),this.#b.fill(0);for(let e of this.#S??[])e!==void 0&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#h=0,this.#g=0,this.#_.length=0,this.#l=0,this.#c=0,this.#T&&this.#v){let e=this.#v,t;for(;t=e?.shift();)this.#i?.(...t)}}},wn=typeof process==`object`&&process?process:{stdout:null,stderr:null},Tn=e=>!!e&&typeof e==`object`&&(e instanceof sr||e instanceof Pe||En(e)||Dn(e)),En=e=>!!e&&typeof e==`object`&&e instanceof Ne&&typeof e.pipe==`function`&&e.pipe!==Pe.Writable.prototype.pipe,Dn=e=>!!e&&typeof e==`object`&&e instanceof Ne&&typeof e.write==`function`&&typeof e.end==`function`,On=Symbol(`EOF`),kn=Symbol(`maybeEmitEnd`),An=Symbol(`emittedEnd`),jn=Symbol(`emittingEnd`),Mn=Symbol(`emittedError`),Nn=Symbol(`closed`),Pn=Symbol(`read`),Fn=Symbol(`flush`),In=Symbol(`flushChunk`),Ln=Symbol(`encoding`),Rn=Symbol(`decoder`),B=Symbol(`flowing`),zn=Symbol(`paused`),Bn=Symbol(`resume`),V=Symbol(`buffer`),H=Symbol(`pipes`),U=Symbol(`bufferLength`),Vn=Symbol(`bufferPush`),Hn=Symbol(`bufferShift`),W=Symbol(`objectMode`),G=Symbol(`destroyed`),Un=Symbol(`error`),Wn=Symbol(`emitData`),Gn=Symbol(`emitEnd`),Kn=Symbol(`emitEnd2`),qn=Symbol(`async`),Jn=Symbol(`abort`),Yn=Symbol(`aborted`),Xn=Symbol(`signal`),Zn=Symbol(`dataListeners`),K=Symbol(`discarded`),Qn=e=>Promise.resolve().then(e),$n=e=>e(),er=e=>e===`end`||e===`finish`||e===`prefinish`,tr=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,nr=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),rr=class{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[Bn](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ir=class extends rr{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>this.dest.emit(`error`,e),e.on(`error`,this.proxyErrors)}},ar=e=>!!e.objectMode,or=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`,sr=class extends Ne{[B]=!1;[zn]=!1;[H]=[];[V]=[];[W];[Ln];[qn];[Rn];[On]=!1;[An]=!1;[jn]=!1;[Nn]=!1;[Mn]=null;[U]=0;[G]=!1;[Xn];[Yn]=!1;[Zn]=0;[K]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);ar(t)?(this[W]=!0,this[Ln]=null):or(t)?(this[Ln]=t.encoding,this[W]=!1):(this[W]=!1,this[Ln]=null),this[qn]=!!t.async,this[Rn]=this[Ln]?new Fe(this[Ln]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[V]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[H]});let{signal:n}=t;n&&(this[Xn]=n,n.aborted?this[Jn]():n.addEventListener(`abort`,()=>this[Jn]()))}get bufferLength(){return this[U]}get encoding(){return this[Ln]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[W]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[qn]}set async(e){this[qn]=this[qn]||!!e}[Jn](){this[Yn]=!0,this.emit(`abort`,this[Xn]?.reason),this.destroy(this[Xn]?.reason)}get aborted(){return this[Yn]}set aborted(e){}write(e,t,n){if(this[Yn])return!1;if(this[On])throw Error(`write after end`);if(this[G])return this.emit(`error`,Object.assign(/* @__PURE__ */ Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[qn]?Qn:$n;if(!this[W]&&!Buffer.isBuffer(e)){if(nr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(tr(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[W]?(this[B]&&this[U]!==0&&this[Fn](!0),this[B]?this.emit(`data`,e):this[Vn](e),this[U]!==0&&this.emit(`readable`),n&&r(n),this[B]):e.length?(typeof e==`string`&&(t!==this[Ln]||this[Rn]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Ln]&&(e=this[Rn].write(e)),this[B]&&this[U]!==0&&this[Fn](!0),this[B]?this.emit(`data`,e):this[Vn](e),this[U]!==0&&this.emit(`readable`),n&&r(n),this[B]):(this[U]!==0&&this.emit(`readable`),n&&r(n),this[B])}read(e){if(this[G])return null;if(this[K]=!1,this[U]===0||e===0||e&&e>this[U])return this[kn](),null;this[W]&&(e=null),this[V].length>1&&!this[W]&&(this[V]=[this[Ln]?this[V].join(``):Buffer.concat(this[V],this[U])]);let t=this[Pn](e||null,this[V][0]);return this[kn](),t}[Pn](e,t){if(this[W])this[Hn]();else{let n=t;e===n.length||e===null?this[Hn]():typeof n==`string`?(this[V][0]=n.slice(e),t=n.slice(0,e),this[U]-=e):(this[V][0]=n.subarray(e),t=n.subarray(0,e),this[U]-=e)}return this.emit(`data`,t),!this[V].length&&!this[On]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[On]=!0,this.writable=!1,(this[B]||!this[zn])&&this[kn](),this}[Bn](){this[G]||(!this[Zn]&&!this[H].length&&(this[K]=!0),this[zn]=!1,this[B]=!0,this.emit(`resume`),this[V].length?this[Fn]():this[On]?this[kn]():this.emit(`drain`))}resume(){return this[Bn]()}pause(){this[B]=!1,this[zn]=!0,this[K]=!1}get destroyed(){return this[G]}get flowing(){return this[B]}get paused(){return this[zn]}[Vn](e){this[W]?this[U]+=1:this[U]+=e.length,this[V].push(e)}[Hn](){return this[W]?--this[U]:this[U]-=this[V][0].length,this[V].shift()}[Fn](e=!1){do;while(this[In](this[Hn]())&&this[V].length);!e&&!this[V].length&&!this[On]&&this.emit(`drain`)}[In](e){return this.emit(`data`,e),this[B]}pipe(e,t){if(this[G])return e;this[K]=!1;let n=this[An];return t||={},e===wn.stdout||e===wn.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[H].push(t.proxyErrors?new ir(this,e,t):new rr(this,e,t)),this[qn]?Qn(()=>this[Bn]()):this[Bn]()),e}unpipe(e){let t=this[H].find(t=>t.dest===e);t&&(this[H].length===1?(this[B]&&this[Zn]===0&&(this[B]=!1),this[H]=[]):this[H].splice(this[H].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[K]=!1,this[Zn]++,!this[H].length&&!this[B]&&this[Bn]();else if(e===`readable`&&this[U]!==0)super.emit(`readable`);else if(er(e)&&this[An])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[Mn]){let e=t;this[qn]?Qn(()=>e.call(this,this[Mn])):e.call(this,this[Mn])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[Zn]=this.listeners(`data`).length,this[Zn]===0&&!this[K]&&!this[H].length&&(this[B]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[Zn]=0,!this[K]&&!this[H].length&&(this[B]=!1)),t}get emittedEnd(){return this[An]}[kn](){!this[jn]&&!this[An]&&!this[G]&&this[V].length===0&&this[On]&&(this[jn]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[Nn]&&this.emit(`close`),this[jn]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==G&&this[G])return!1;if(e===`data`)return!this[W]&&!n?!1:this[qn]?(Qn(()=>this[Wn](n)),!0):this[Wn](n);if(e===`end`)return this[Gn]();if(e===`close`){if(this[Nn]=!0,!this[An]&&!this[G])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}if(e===`error`){this[Mn]=n,super.emit(Un,n);let e=!this[Xn]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[kn](),e}if(e===`resume`){let e=super.emit(`resume`);return this[kn](),e}if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[kn](),r}[Wn](e){for(let t of this[H])t.dest.write(e)===!1&&this.pause();let t=!this[K]&&super.emit(`data`,e);return this[kn](),t}[Gn](){return!this[An]&&(this[An]=!0,this.readable=!1,this[qn]?(Qn(()=>this[Kn]()),!0):this[Kn]())}[Kn](){if(this[Rn]){let e=this[Rn].end();if(e){for(let t of this[H])t.dest.write(e);this[K]||super.emit(`data`,e)}}for(let e of this[H])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[W]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[W]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[W])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[Ln]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(G,()=>t(/* @__PURE__ */ Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[K]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[On])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(G,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(G,c),this.pause(),r({value:e,done:!!this[On]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(G,c),t(),r({done:!0,value:void 0})},c=()=>a(/* @__PURE__ */ Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(G,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[K]=!1;let e=!1,t=()=>(this.pause(),this.off(Un,t),this.off(G,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(Un,t),this.once(G,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[G])return e?this.emit(`error`,e):this.emit(G),this;this[G]=!0,this[K]=!0,this[V].length=0,this[U]=0;let t=this;return typeof t.close==`function`&&!this[Nn]&&t.close(),e?this.emit(`error`,e):this.emit(G),this}static get isStream(){return Tn}},cr=De.native,lr={lstatSync:Se,readdir:we,readdirSync:Te,readlinkSync:Ee,realpathSync:cr,promises:{lstat:he,readdir:ge,readlink:_e,realpath:ve}},ur=e=>!e||e===lr||e===w?lr:{...lr,...e,promises:{...lr.promises,...e.promises||{}}},dr=/^\\\\\?\\([a-z]:)\\?$/i,fr=e=>e.replace(/\//g,`\\`).replace(dr,`$1\\`),pr=/[\\\/]/,mr=0,hr=1,gr=2,_r=4,vr=6,yr=8,br=10,xr=12,Sr=15,Cr=~Sr,wr=16,Tr=32,Er=64,Dr=128,Or=256,kr=512,Ar=Er|Dr|kr,jr=1023,Mr=e=>e.isFile()?yr:e.isDirectory()?_r:e.isSymbolicLink()?br:e.isCharacterDevice()?gr:e.isBlockDevice()?vr:e.isSocket()?xr:e.isFIFO()?hr:mr,Nr=new Cn({max:4096}),Pr=e=>{let t=Nr.get(e);if(t)return t;let n=e.normalize(`NFKD`);return Nr.set(e,n),n},Fr=new Cn({max:4096}),Ir=e=>{let t=Fr.get(e);if(t)return t;let n=Pr(e.toLowerCase());return Fr.set(e,n),n},Lr=class extends Cn{constructor(){super({max:256})}},Rr=class extends Cn{constructor(e=16384){super({maxSize:e,sizeCalculation:e=>e.length+1})}},zr=Symbol(`PathScurry setAsCwd`),q=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#i;get uid(){return this.#i}#a;get gid(){return this.#a}#o;get rdev(){return this.#o}#s;get blksize(){return this.#s}#c;get ino(){return this.#c}#l;get size(){return this.#l}#u;get blocks(){return this.#u}#d;get atimeMs(){return this.#d}#f;get mtimeMs(){return this.#f}#p;get ctimeMs(){return this.#p}#m;get birthtimeMs(){return this.#m}#h;get atime(){return this.#h}#g;get mtime(){return this.#g}#_;get ctime(){return this.#_}#v;get birthtime(){return this.#v}#y;#b;#x;#S;#C;#w;#T;#E;#D;#O;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=mr,n,r,i,a,o){this.name=e,this.#y=i?Ir(e):Pr(e),this.#T=t&jr,this.nocase=i,this.roots=r,this.root=n||this,this.#E=a,this.#x=o.fullpath,this.#C=o.relative,this.#w=o.relativePosix,this.parent=o.parent,this.#e=this.parent?this.parent.#e:ur(o.fs)}depth(){return this.#b===void 0?this.#b=this.parent?this.parent.depth()+1:0:this.#b}childrenCache(){return this.#E}resolve(e){if(!e)return this;let t=this.getRootString(e),n=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#k(n):this.#k(n)}#k(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#E.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#E.set(this,t),this.#T&=~wr,t}child(e,t){if(e===``||e===`.`)return this;if(e===`..`)return this.parent||this;let n=this.children(),r=this.nocase?Ir(e):Pr(e);for(let e of n)if(e.#y===r)return e;let i=this.parent?this.sep:``,a=this.#x?this.#x+i+e:void 0,o=this.newChild(e,mr,{...t,parent:this,fullpath:a});return this.canReaddir()||(o.#T|=Dr),n.push(o),o}relative(){if(this.isCWD)return``;if(this.#C!==void 0)return this.#C;let e=this.name,t=this.parent;if(!t)return this.#C=this.name;let n=t.relative();return n+(!n||!t.parent?``:this.sep)+e}relativePosix(){if(this.sep===`/`)return this.relative();if(this.isCWD)return``;if(this.#w!==void 0)return this.#w;let e=this.name,t=this.parent;if(!t)return this.#w=this.fullpathPosix();let n=t.relativePosix();return n+(!n||!t.parent?``:`/`)+e}fullpath(){if(this.#x!==void 0)return this.#x;let e=this.name,t=this.parent;if(!t)return this.#x=this.name;let n=t.fullpath()+(t.parent?this.sep:``)+e;return this.#x=n}fullpathPosix(){if(this.#S!==void 0)return this.#S;if(this.sep===`/`)return this.#S=this.fullpath();if(!this.parent){let e=this.fullpath().replace(/\\/g,`/`);return this.#S=/^[a-z]:\//i.test(e)?`//?/${e}`:e}let e=this.parent,t=e.fullpathPosix(),n=t+(!t||!e.parent?``:`/`)+this.name;return this.#S=n}isUnknown(){return(this.#T&Sr)===mr}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?`Unknown`:this.isDirectory()?`Directory`:this.isFile()?`File`:this.isSymbolicLink()?`SymbolicLink`:this.isFIFO()?`FIFO`:this.isCharacterDevice()?`CharacterDevice`:this.isBlockDevice()?`BlockDevice`:this.isSocket()?`Socket`:`Unknown`}isFile(){return(this.#T&Sr)===yr}isDirectory(){return(this.#T&Sr)===_r}isCharacterDevice(){return(this.#T&Sr)===gr}isBlockDevice(){return(this.#T&Sr)===vr}isFIFO(){return(this.#T&Sr)===hr}isSocket(){return(this.#T&Sr)===xr}isSymbolicLink(){return(this.#T&br)===br}lstatCached(){return this.#T&Tr?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#O}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let e=this.#T&Sr;return!(e!==mr&&e!==br||this.#T&Or||this.#T&Dr)}calledReaddir(){return!!(this.#T&wr)}isENOENT(){return!!(this.#T&Dr)}isNamed(e){return this.nocase?this.#y===Ir(e):this.#y===Pr(e)}async readlink(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=await this.#e.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}readlinkSync(){let e=this.#D;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=this.#e.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#D=t}catch(e){this.#L(e.code);return}}#A(e){this.#T|=wr;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#j()}}#j(){this.#T&Dr||(this.#T=(this.#T|Dr)&Cr,this.#M())}#M(){let e=this.children();e.provisional=0;for(let t of e)t.#j()}#N(){this.#T|=kr,this.#P()}#P(){if(this.#T&Er)return;let e=this.#T;(e&Sr)===_r&&(e&=Cr),this.#T=e|Er,this.#M()}#F(e=``){e===`ENOTDIR`||e===`EPERM`?this.#P():e===`ENOENT`?this.#j():this.children().provisional=0}#I(e=``){e===`ENOTDIR`?this.parent.#P():e===`ENOENT`&&this.#j()}#L(e=``){let t=this.#T;t|=Or,e===`ENOENT`&&(t|=Dr),(e===`EINVAL`||e===`UNKNOWN`)&&(t&=Cr),this.#T=t,e===`ENOTDIR`&&this.parent&&this.parent.#P()}#R(e,t){return this.#B(e,t)||this.#z(e,t)}#z(e,t){let n=Mr(e),r=this.newChild(e.name,n,{parent:this}),i=r.#T&Sr;return i!==_r&&i!==br&&i!==mr&&(r.#T|=Er),t.unshift(r),t.provisional++,r}#B(e,t){for(let n=t.provisional;n<t.length;n++){let r=t[n];if((this.nocase?Ir(e.name):Pr(e.name))===r.#y)return this.#V(e,r,n,t)}}#V(e,t,n,r){let i=t.name;return t.#T=t.#T&Cr|Mr(e),i!==e.name&&(t.name=e.name),n!==r.provisional&&(n===r.length-1?r.pop():r.splice(n,1),r.unshift(t)),r.provisional++,t}async lstat(){if((this.#T&Dr)===0)try{return this.#H(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#I(e.code)}}lstatSync(){if((this.#T&Dr)===0)try{return this.#H(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#I(e.code)}}#H(e){let{atime:t,atimeMs:n,birthtime:r,birthtimeMs:i,blksize:a,blocks:o,ctime:s,ctimeMs:c,dev:l,gid:u,ino:d,mode:f,mtime:p,mtimeMs:m,nlink:h,rdev:g,size:_,uid:v}=e;this.#h=t,this.#d=n,this.#v=r,this.#m=i,this.#s=a,this.#u=o,this.#_=s,this.#p=c,this.#t=l,this.#a=u,this.#c=d,this.#n=f,this.#g=p,this.#f=m,this.#r=h,this.#o=g,this.#l=_,this.#i=v;let y=Mr(e);this.#T=this.#T&Cr|y|Tr,y!==mr&&y!==_r&&y!==br&&(this.#T|=Er)}#U=[];#W=!1;#G(e){this.#W=!1;let t=this.#U.slice();this.#U.length=0,t.forEach(t=>t(null,e))}readdirCB(e,t=!1){if(!this.canReaddir()){t?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#U.push(e),this.#W)return;this.#W=!0;let r=this.fullpath();this.#e.readdir(r,{withFileTypes:!0},(e,t)=>{if(e)this.#F(e.code),n.provisional=0;else{for(let e of t)this.#R(e,n);this.#A(n)}this.#G(n.slice(0,n.provisional))})}#K;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#K)await this.#K;else{let n=()=>{};this.#K=new Promise(e=>n=e);try{for(let n of await this.#e.promises.readdir(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}this.#K=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#e.readdirSync(t,{withFileTypes:!0}))this.#R(n,e);this.#A(e)}catch(t){this.#F(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#T&Ar)return!1;let e=Sr&this.#T;return e===mr||e===_r||e===br}shouldWalk(e,t){return(this.#T&_r)===_r&&!(this.#T&Ar)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#O)return this.#O;if(!((kr|Or|Dr)&this.#T))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#O)return this.#O;if(!((kr|Or|Dr)&this.#T))try{let e=this.#e.realpathSync(this.fullpath());return this.#O=this.resolve(e)}catch{this.#N()}}[zr](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=/* @__PURE__ */ new Set([]),n=[],r=this;for(;r&&r.parent;)t.add(r),r.#C=n.join(this.sep),r.#w=n.join(`/`),r=r.parent,n.push(`..`);for(r=e;r&&r.parent&&!t.has(r);)r.#C=void 0,r.#w=void 0,r=r.parent}},Br=class e extends q{sep=`\\`;splitSep=pr;constructor(e,t=mr,n,r,i,a,o){super(e,t,n,r,i,a,o)}newChild(t,n=mr,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}getRootString(e){return ue.parse(e).root}getRoot(e){if(e=fr(e.toUpperCase()),e===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new Ur(e,this).root}sameRoot(e,t=this.root.name){return e=e.toUpperCase().replace(/\//g,`\\`).replace(dr,`$1\\`),e===t}},Vr=class e extends q{splitSep=`/`;sep=`/`;constructor(e,t=mr,n,r,i,a,o){super(e,t,n,r,i,a,o)}getRootString(e){return e.startsWith(`/`)?`/`:``}getRoot(e){return this.root}newChild(t,n=mr,r={}){return new e(t,n,this.root,this.roots,this.nocase,this.childrenCache(),r)}},Hr=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),t,n,{nocase:r,childrenCacheSize:i=16384,fs:a=lr}={}){this.#r=ur(a),(e instanceof URL||e.startsWith(`file://`))&&(e=de(e));let o=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new Lr,this.#t=new Lr,this.#n=new Rr(i);let s=o.substring(this.rootPath.length).split(n);if(s.length===1&&!s[0]&&s.pop(),r===void 0)throw TypeError(`must provide nocase setting to PathScurryBase ctor`);this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=s.length-1,u=t.sep,d=this.rootPath,f=!1;for(let e of s){let t=l--;c=c.child(e,{relative:Array(t).fill(`..`).join(u),relativePosix:Array(t).fill(`..`).join(`/`),fullpath:d+=(f?``:u)+e}),f=!0}this.cwd=c}depth(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r&&r!==`.`&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#e.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpath();return this.#e.set(t,r),r}resolvePosix(...e){let t=``;for(let n=e.length-1;n>=0;n--){let r=e[n];if(r&&r!==`.`&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#t.get(t);if(n!==void 0)return n;let r=this.cwd.resolve(t).fullpathPosix();return this.#t.set(t,r),r}relative(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(e.canReaddir()){let t=await e.readdir();return n?t:t.map(e=>e.name)}return[]}readdirSync(e=this.cwd,t={withFileTypes:!0}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e==`string`&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=/* @__PURE__ */ new Set,c=(e,t)=>{s.add(e),e.readdirCB((e,l)=>{if(e)return t(e);let u=l.length;if(!u)return t();let d=()=>{--u===0&&t()};for(let e of l)(!i||i(e))&&o.push(n?e:e.fullpath()),r&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(s,a)?c(e,d):d()):e.shouldWalk(s,a)?c(e,d):d()},!0)},l=e;return new Promise((e,t)=>{c(l,n=>{if(n)return t(n);e(o)})})}walkSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=[];(!i||i(e))&&o.push(n?e:e.fullpath());let s=/* @__PURE__ */ new Set([e]);for(let e of s){let t=e.readdirSync();for(let e of t){(!i||i(e))&&o.push(n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&s.add(t)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t;(!i||i(e))&&(yield n?e:e.fullpath());let o=/* @__PURE__ */ new Set([e]);for(let e of o){let t=e.readdirSync();for(let e of t){(!i||i(e))&&(yield n?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,a)&&o.add(t)}}}stream(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new sr({objectMode:!0});(!i||i(e))&&o.write(n?e:e.fullpath());let s=/* @__PURE__ */ new Set,c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let d=(t,p,m=!1)=>{if(t)return o.emit(`error`,t);if(r&&!m){let e=[];for(let t of p)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length){Promise.all(e).then(()=>d(null,p,!0));return}}for(let t of p)t&&(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of p){let t=e.realpathCached()||e;t.shouldWalk(s,a)&&c.push(t)}e&&!o.flowing?o.once(`drain`,u):f||u()},f=!0;t.readdirCB(d,!0),f=!1}};return u(),o}streamSync(e=this.cwd,t={}){typeof e==`string`?e=this.cwd.resolve(e):e instanceof q||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:a}=t,o=new sr({objectMode:!0}),s=/* @__PURE__ */ new Set;(!i||i(e))&&o.write(n?e:e.fullpath());let c=[e],l=0,u=()=>{let e=!1;for(;!e;){let t=c.shift();if(!t){l===0&&o.end();return}l++,s.add(t);let u=t.readdirSync();for(let t of u)(!i||i(t))&&(o.write(n?t:t.fullpath())||(e=!0));l--;for(let e of u){let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,a)&&c.push(t)}}e&&!o.flowing&&o.once(`drain`,u)};return u(),o}chdir(e=this.cwd){let t=this.cwd;this.cwd=typeof e==`string`?this.cwd.resolve(e):e,this.cwd[zr](t)}},Ur=class extends Hr{sep=`\\`;constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,ue,`\\`,{...t,nocase:n}),this.nocase=n;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return ue.parse(e).root.toUpperCase()}newRoot(e){return new Br(this.rootPath,_r,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)||e.startsWith(`\\`)||/^[a-z]:(\/|\\)/i.test(e)}},Wr=class extends Hr{sep=`/`;constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,se,`/`,{...t,nocase:n}),this.nocase=n}parseRootPath(e){return`/`}newRoot(e){return new Vr(this.rootPath,_r,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith(`/`)}},Gr=class extends Wr{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}};process.platform;var Kr=process.platform===`win32`?Ur:process.platform===`darwin`?Gr:Wr,qr=e=>e.length>=1,Jr=e=>e.length>=1,Yr=Symbol.for(`nodejs.util.inspect.custom`),Xr=class e{#e;#t;#n;length;#r;#i;#a;#o;#s;#c;#l=!0;constructor(e,t,n,r){if(!qr(e))throw TypeError(`empty pattern list`);if(!Jr(t))throw TypeError(`empty glob list`);if(t.length!==e.length)throw TypeError(`mismatched pattern list and glob list lengths`);if(this.length=e.length,n<0||n>=this.length)throw TypeError(`index out of range`);if(this.#e=e,this.#t=t,this.#n=n,this.#r=r,this.#n===0){if(this.isUNC()){let[e,t,n,r,...i]=this.#e,[a,o,s,c,...l]=this.#t;i[0]===``&&(i.shift(),l.shift());let u=[e,t,n,r,``].join(`/`),d=[a,o,s,c,``].join(`/`);this.#e=[u,...i],this.#t=[d,...l],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[e,...t]=this.#e,[n,...r]=this.#t;t[0]===``&&(t.shift(),r.shift());let i=e+`/`,a=n+`/`;this.#e=[i,...t],this.#t=[a,...r],this.length=this.#e.length}}}[Yr](){return`Pattern <`+this.#t.slice(this.#n).join(`/`)+`>`}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]==`string`}isGlobstar(){return this.#e[this.#n]===R}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#a=this.#a||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join(`/`):this.#t.join(`/`):this.#t.slice(this.#n).join(`/`))}hasMore(){return this.length>this.#n+1}rest(){return this.#i===void 0?this.hasMore()?(this.#i=new e(this.#e,this.#t,this.#n+1,this.#r),this.#i.#c=this.#c,this.#i.#s=this.#s,this.#i.#o=this.#o,this.#i):this.#i=null:this.#i}isUNC(){let e=this.#e;return this.#s===void 0?this.#s=this.#r===`win32`&&this.#n===0&&e[0]===``&&e[1]===``&&typeof e[2]==`string`&&!!e[2]&&typeof e[3]==`string`&&!!e[3]:this.#s}isDrive(){let e=this.#e;return this.#o===void 0?this.#o=this.#r===`win32`&&this.#n===0&&this.length>1&&typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]):this.#o}isAbsolute(){let e=this.#e;return this.#c===void 0?this.#c=e[0]===``&&e.length>1||this.isDrive()||this.isUNC():this.#c}root(){let e=this.#e[0];return typeof e==`string`&&this.isAbsolute()&&this.#n===0?e:``}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}},Zr=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,Qr=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:r,noglobstar:i,platform:a=Zr}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=a,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:r,noglobstar:i,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let t of e)this.add(t)}add(e){let t=new dn(e,this.mmopts);for(let e=0;e<t.set.length;e++){let n=t.set[e],r=t.globParts[e];if(!n||!r)throw Error(`invalid pattern object`);for(;n[0]===`.`&&r[0]===`.`;)n.shift(),r.shift();let i=new Xr(n,r,0,this.platform),a=new dn(i.globString(),this.mmopts),o=r[r.length-1]===`**`,s=i.isAbsolute();s?this.absolute.push(a):this.relative.push(a),o&&(s?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let t=e.fullpath(),n=`${t}/`,r=e.relative()||`.`,i=`${r}/`;for(let e of this.relative)if(e.match(r)||e.match(i))return!0;for(let e of this.absolute)if(e.match(t)||e.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+`/`,n=(e.relative()||`.`)+`/`;for(let e of this.relativeChildren)if(e.match(n))return!0;for(let e of this.absoluteChildren)if(e.match(t))return!0;return!1}},$r=class e{store;constructor(e=/* @__PURE__ */ new Map){this.store=e}copy(){return new e(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),r=this.store.get(n);r?r.add(t.globString()):this.store.set(n,/* @__PURE__ */ new Set([t.globString()]))}},ei=class{store=/* @__PURE__ */ new Map;add(e,t,n){let r=(t?2:0)|!!n,i=this.store.get(e);this.store.set(e,i===void 0?r:r&i)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(t&2),!!(t&1)])}},ti=class{store=/* @__PURE__ */ new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(e=>e.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw Error(`attempting to walk unknown path`);return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},ni=class e{hasWalkedCache;matches=new ei;subwalks=new ti;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new $r}processPatterns(e,t){this.patterns=t;let n=t.map(t=>[e,t]);for(let[e,t]of n){this.hasWalkedCache.storeWalked(e,t);let n=t.root(),r=t.isAbsolute()&&this.opts.absolute!==!1;if(n){e=e.resolve(n===`/`&&this.opts.root!==void 0?this.opts.root:n);let r=t.rest();if(r)t=r;else{this.matches.add(e,!0,!1);continue}}if(e.isENOENT())continue;let i,a,o=!1;for(;typeof(i=t.pattern())==`string`&&(a=t.rest());)e=e.resolve(i),t=a,o=!0;if(i=t.pattern(),a=t.rest(),o){if(this.hasWalkedCache.hasWalked(e,t))continue;this.hasWalkedCache.storeWalked(e,t)}if(typeof i==`string`){let t=i===`..`||i===``||i===`.`;this.matches.add(e.resolve(i),r,t)}else if(i===R){(!e.isSymbolicLink()||this.follow||t.checkFollowGlobstar())&&this.subwalks.add(e,t);let n=a?.pattern(),i=a?.rest();if(!a||(n===``||n===`.`)&&!i)this.matches.add(e,r,n===``||n===`.`);else if(n===`..`){let t=e.parent||e;i?this.hasWalkedCache.hasWalked(t,i)||this.subwalks.add(t,i):this.matches.add(t,r,!0)}}else i instanceof RegExp&&this.subwalks.add(e,t)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new e(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),r=this.child();for(let e of t)for(let t of n){let n=t.isAbsolute(),i=t.pattern(),a=t.rest();i===R?r.testGlobstar(e,t,a,n):i instanceof RegExp?r.testRegExp(e,i,a,n):r.testString(e,i,a,n)}return r}testGlobstar(e,t,n,r){if((this.dot||!e.name.startsWith(`.`))&&(t.hasMore()||this.matches.add(e,r,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let t=n.pattern();if(typeof t==`string`&&t!==`..`&&t!==``&&t!==`.`)this.testString(e,t,n.rest(),r);else if(t===`..`){let t=e.parent||e;this.subwalks.add(t,n)}else t instanceof RegExp&&this.testRegExp(e,t,n.rest(),r)}}testRegExp(e,t,n,r){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}testString(e,t,n,r){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}},ri=(e,t)=>typeof e==`string`?new Qr([e],t):Array.isArray(e)?new Qr(e,t):e,ii=class{path;patterns;opts;seen=/* @__PURE__ */ new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#n=!n.posix&&n.platform===`win32`?`\\`:`/`,this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=ri(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener(`abort`,()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#i(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let t=`${e.relativePosix()}/**`;this.#t.add(t)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#n:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(`..`+this.#n)?`.`+this.#n:``;this.matchEmit(t?n+t+r:`.`+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new ni(this.opts),n)}walkCB2(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,a):e.readdirCB((t,r)=>this.walkCB3(e,r,n,a),!0)}a()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||(i++,this.match(e,t,r).then(()=>a()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),a);a()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new ni(this.opts),n)}walkCB2Sync(e,t,n,r){if(this.#i(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,a)}a()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#r(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),a);a()}},ai=class extends ii{matches=/* @__PURE__ */ new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},oi=class extends ii{results;constructor(e,t,n){super(e,t,n),this.results=new sr({signal:this.signal,objectMode:!0}),this.results.on(`drain`,()=>this.resume()),this.results.on(`resume`,()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},si=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`,ci=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw TypeError(`glob options required`);if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith(`file://`))&&(t.cwd=de(t.cwd)):this.cwd=``,this.cwd=t.cwd||``,this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=t.includeChildMatches!==!1,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof e==`string`&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(t.noglobstar)throw TypeError(`base matching requires globstar`);e=e.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||si,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,t.nocase!==void 0&&t.nocase!==t.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else{let e=t.platform===`win32`?Ur:t.platform===`darwin`?Gr:t.platform?Wr:Kr;this.scurry=new e(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n=this.platform===`darwin`||this.platform===`win32`,r={braceExpandMax:1e4,...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[i,a]=this.pattern.map(e=>new dn(e,r)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=i.map((e,t)=>{let n=a[t];if(!n)throw Error(`invalid pattern object`);return new Xr(e,n,0,this.platform)})}async walk(){return[...await new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new ai(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new oi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},li=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let n of e)if(new dn(n,t).hasMagic())return!0;return!1};function ui(e,t={}){return new ci(e,t).streamSync()}function di(e,t={}){return new ci(e,t).stream()}function fi(e,t={}){return new ci(e,t).walkSync()}async function pi(e,t={}){return new ci(e,t).walk()}function mi(e,t={}){return new ci(e,t).iterateSync()}function hi(e,t={}){return new ci(e,t).iterate()}var gi=ui,_i=Object.assign(di,{sync:ui}),vi=mi,yi=Object.assign(hi,{sync:mi}),bi=Object.assign(fi,{stream:ui,iterate:mi}),xi=Object.assign(pi,{glob:pi,globSync:fi,sync:bi,globStream:di,stream:_i,globStreamSync:ui,streamSync:gi,globIterate:hi,iterate:yi,globIterateSync:mi,iterateSync:vi,Glob:ci,hasMagic:li,escape:Ft,unescape:St});xi.glob=xi;const Si=(e,t)=>e===void 0||typeof e===t,Ci=e=>!!e&&typeof e==`object`&&Si(e.preserveRoot,`boolean`)&&Si(e.tmp,`string`)&&Si(e.maxRetries,`number`)&&Si(e.retryDelay,`number`)&&Si(e.backoff,`number`)&&Si(e.maxBackoff,`number`)&&(Si(e.glob,`boolean`)||e.glob&&typeof e.glob==`object`)&&Si(e.filter,`function`),wi=e=>{if(!Ci(e))throw Error(`invalid rimraf options`)},Ti=e=>{wi(e);let{glob:t,...n}=e;if(!t)return n;let r=t===!0?e.signal?{signal:e.signal}:{}:e.signal?{signal:e.signal,...t}:t;return{...n,glob:{...r,absolute:!0,withFileTypes:!1}}},Ei=(e={})=>Ti(e),Di=(e={})=>Ti(e),Oi=(e,t={})=>{let n=typeof e;if(n!==`string`){let t=e&&n===`object`&&e.constructor,r=`The "path" argument must be of type string. Received ${t&&t.name?`an instance of ${t.name}`:n===`object`?Le(e):`type ${n} ${e}`}`;throw Object.assign(TypeError(r),{path:e,code:`ERR_INVALID_ARG_TYPE`})}if(/\0/.test(e))throw Object.assign(/* @__PURE__ */ TypeError(`path must be a string without null bytes`),{path:e,code:`ERR_INVALID_ARG_VALUE`});e=F(e);let{root:r}=P(e);if(e===r&&t.preserveRoot!==!1)throw Object.assign(/* @__PURE__ */ Error(`refusing to remove root directory without preserveRoot:false`),{path:e,code:`ERR_PRESERVE_ROOT`});if(process.platform===`win32`){let t=/[*|"<>?:]/,{root:n}=P(e);if(t.test(e.substring(n.length)))throw Object.assign(/* @__PURE__ */ Error(`Illegal characters in path.`),{path:e,code:`EINVAL`})}return e},ki=e=>Te(e,{withFileTypes:!0}),Ai={chmod:Re.chmod,mkdir:Re.mkdir,readdir:e=>Re.readdir(e,{withFileTypes:!0}),rename:Re.rename,rm:Re.rm,rmdir:Re.rmdir,stat:Re.stat,lstat:Re.lstat,unlink:Re.unlink},{readdir:ji}=Ai,Mi=e=>ji(e).catch(e=>e),Ni=e=>{try{return ki(e)}catch(e){return e}},Pi=e=>!!e&&typeof e==`object`,Fi=(e,t)=>t in e&&typeof e[t]==`string`,Ii=e=>Pi(e)&&Fi(e,`code`)&&Fi(e,`path`),J=e=>Pi(e)&&Fi(e,`code`)?e.code:null,Li=async(e,t)=>e.catch(e=>{if(J(e)!==`ENOENT`)throw t??e}),Ri=(e,t)=>{try{return e()}catch(e){if(J(e)===`ENOENT`)return;throw t??e}},{lstat:zi,rmdir:Bi,unlink:Vi}=Ai,Hi=async(e,t)=>(t?.signal?.throwIfAborted(),await Li(zi(e).then(n=>Wi(e,t,n)))??!0),Ui=(e,t)=>(t?.signal?.throwIfAborted(),Ri(()=>Gi(e,t,Ce(e)))??!0),Wi=async(e,t,n)=>{t?.signal?.throwIfAborted();let r=n.isDirectory()?await Mi(e):null;if(!Array.isArray(r)){
|
|
4
|
-
/* c8 ignore start */
|
|
5
|
-
if(r){if(J(r)===`ENOENT`)return!0;if(J(r)!==`ENOTDIR`)throw r}return t.filter&&!await t.filter(e,n)?!1:(await Li(Vi(e)),!0)}return!(await Promise.all(r.map(n=>Wi(F(e,n.name),t,n)))).every(e=>e===!0)||t.preserveRoot===!1&&e===P(e).root||t.filter&&!await t.filter(e,n)?!1:(await Li(Bi(e)),!0)},Gi=(e,t,n)=>{t?.signal?.throwIfAborted();let r=n.isDirectory()?Ni(e):null;if(!Array.isArray(r)){
|
|
6
|
-
/* c8 ignore start */
|
|
7
|
-
if(r){if(J(r)===`ENOENT`)return!0;if(J(r)!==`ENOTDIR`)throw r}return t.filter&&!t.filter(e,n)?!1:(Ri(()=>Me(e)),!0)}let i=!0;for(let n of r){let r=F(e,n.name);i=Gi(r,t,n)&&i}return t.preserveRoot===!1&&e===P(e).root||!i||t.filter&&!t.filter(e,n)?!1:(Ri(()=>Ae(e)),!0)},{chmod:Ki}=Ai,qi=e=>async t=>{try{await Li(e(t));return}catch(n){if(J(n)===`EPERM`){if(!await Li(Ki(t,438).then(()=>!0),n))return;await e(t);return}throw n}},Ji=e=>t=>{try{Ri(()=>e(t));return}catch(n){if(J(n)===`EPERM`){if(!Ri(()=>(xe(t,438),!0),n))return;e(t);return}throw n}},Yi=/* @__PURE__ */ new Set([`EMFILE`,`ENFILE`,`EBUSY`]),Xi=e=>{let t=async(n,r,i=1,a=0)=>{let o=r.maxBackoff||200,s=r.backoff||1.2,c=r.maxRetries||10,l=0;for(;;)try{return await e(n)}catch(e){if(Ii(e)&&e.path===n&&Yi.has(e.code)){if(i=Math.ceil(i*s),a=i+a,a<o)return await ze(i),t(n,r,i,a);if(l<c){l++;continue}}throw e}};return t},Zi=e=>(t,n)=>{let r=n.maxRetries||10,i=0;for(;;)try{return e(t)}catch(e){if(Ii(e)&&e.path===t&&Yi.has(e.code)&&i<r){i++;continue}throw e}},{stat:Qi}=Ai,$i=e=>{try{return je(e).isDirectory()}catch{return!1}},ea=e=>Qi(e).then(e=>e.isDirectory(),()=>!1),ta=async e=>{let{root:t}=P(e),n=Be(),{root:r}=P(n);if(t.toLowerCase()===r.toLowerCase())return n;let i=F(t,`/temp`);return await ea(i)?i:t},na=e=>{let{root:t}=P(e),n=Be(),{root:r}=P(n);if(t.toLowerCase()===r.toLowerCase())return n;let i=F(t,`/temp`);return $i(i)?i:t},ra=async()=>Be(),ia=()=>Be(),aa=process.platform===`win32`?ta:ra,oa=process.platform===`win32`?na:ia,{lstat:sa,rename:ca,unlink:la,rmdir:ua}=Ai,da=e=>`.${Ie(e)}.${Math.random()}`,fa=qi(la),pa=Ji(Me),ma=async(e,t)=>(t?.signal?.throwIfAborted(),await Li(sa(e).then(n=>ha(e,t,n)))??!0),ha=async(e,t,n)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return ha(e,{...t,tmp:await aa(e)},n);if(e===t.tmp&&P(e).root!==e)throw Error(`cannot delete temp directory used for deletion`);let r=n.isDirectory()?await Mi(e):null;if(!Array.isArray(r)){
|
|
8
|
-
/* c8 ignore start */
|
|
9
|
-
if(r){if(J(r)===`ENOENT`)return!0;if(J(r)!==`ENOTDIR`)throw r}return t.filter&&!await t.filter(e,n)?!1:(await Li(ga(e,t.tmp,fa)),!0)}return!(await Promise.all(r.map(n=>ha(F(e,n.name),t,n)))).every(e=>e===!0)||t.preserveRoot===!1&&e===P(e).root||t.filter&&!await t.filter(e,n)?!1:(await Li(ga(e,t.tmp,ua)),!0)},ga=async(e,t,n)=>{let r=F(t,da(e));return await ca(e,r),await n(r)},_a=(e,t)=>(t?.signal?.throwIfAborted(),Ri(()=>va(e,t,Ce(e)))??!0),va=(e,t,n)=>{if(t?.signal?.throwIfAborted(),!t.tmp)return va(e,{...t,tmp:oa(e)},n);let r=t.tmp;if(e===t.tmp&&P(e).root!==e)throw Error(`cannot delete temp directory used for deletion`);let i=n.isDirectory()?Ni(e):null;if(!Array.isArray(i)){
|
|
10
|
-
/* c8 ignore start */
|
|
11
|
-
if(i){if(J(i)===`ENOENT`)return!0;if(J(i)!==`ENOTDIR`)throw i}return t.filter&&!t.filter(e,n)?!1:(Ri(()=>ya(e,r,pa)),!0)}let a=!0;for(let n of i){let r=F(e,n.name);a=va(r,t,n)&&a}return!a||t.preserveRoot===!1&&e===P(e).root||t.filter&&!t.filter(e,n)?!1:(Ri(()=>ya(e,r,Ae)),!0)},ya=(e,t,n)=>{let r=F(t,da(e));return Oe(e,r),n(r)},{unlink:ba,rmdir:xa,lstat:Sa}=Ai,Ca=Xi(qi(ba)),wa=Zi(Ji(Me)),Ta=Xi(qi(xa)),Ea=Zi(Ji(Ae)),Da=async(e,{filter:t,...n})=>{
|
|
12
|
-
/* c8 ignore next */
|
|
13
|
-
n?.signal?.throwIfAborted();try{return await Ta(e,n),!0}catch(t){if(J(t)===`ENOTEMPTY`)return ma(e,n);throw t}},Oa=(e,{filter:t,...n})=>{n?.signal?.throwIfAborted();try{return Ea(e,n),!0}catch(t){if(J(t)===`ENOTEMPTY`)return _a(e,n);throw t}},ka=Symbol(`start`),Aa=Symbol(`child`),ja=Symbol(`finish`),Ma=async(e,t)=>(t?.signal?.throwIfAborted(),await Li(Sa(e).then(n=>Pa(e,t,n,ka)))??!0),Na=(e,t)=>(t?.signal?.throwIfAborted(),Ri(()=>Fa(e,t,Ce(e),ka))??!0),Pa=async(e,t,n,r=ka)=>{t?.signal?.throwIfAborted();let i=n.isDirectory()?await Mi(e):null;if(!Array.isArray(i)){
|
|
14
|
-
/* c8 ignore start */
|
|
15
|
-
if(i){if(J(i)===`ENOENT`)return!0;if(J(i)!==`ENOTDIR`)throw i}return t.filter&&!await t.filter(e,n)?!1:(await Li(Ca(e,t)),!0)}let a=r===ka?Aa:r,o=(await Promise.all(i.map(n=>Pa(F(e,n.name),t,n,a)))).every(e=>e===!0);if(r===ka)return Pa(e,t,n,ja);if(r===ja){if(t.preserveRoot===!1&&e===P(e).root||!o||t.filter&&!await t.filter(e,n))return!1;await Li(Da(e,t))}return!0},Fa=(e,t,n,r=ka)=>{let i=n.isDirectory()?Ni(e):null;if(!Array.isArray(i)){
|
|
16
|
-
/* c8 ignore start */
|
|
17
|
-
if(i){if(J(i)===`ENOENT`)return!0;if(J(i)!==`ENOTDIR`)throw i}return t.filter&&!t.filter(e,n)?!1:(Ri(()=>wa(e,t)),!0)}let a=!0;for(let n of i){let i=r===ka?Aa:r,o=F(e,n.name);a=Fa(o,t,n,i)&&a}if(r===ka)return Fa(e,t,n,ja);if(r===ja){if(t.preserveRoot===!1&&e===P(e).root||!a||t.filter&&!t.filter(e,n))return!1;Ri(()=>Oa(e,t))}return!0},Ia=process.platform===`win32`?Ma:Hi,La=process.platform===`win32`?Na:Ui,{rm:Ra}=Ai,za=async(e,t)=>(await Ra(e,{...t,force:!0,recursive:!0}),!0),Ba=(e,t)=>(ke(e,{...t,force:!0,recursive:!0}),!0),[Va=0,Ha=0]=process.version.replace(/^v/,``).split(`.`).map(e=>parseInt(e,10)),Ua=Va>14||Va===14&&Ha>=14,Wa=!Ua||process.platform===`win32`?()=>!1:e=>!e?.signal&&!e?.filter,Ga=!Ua||process.platform===`win32`?()=>!1:e=>!e?.signal&&!e?.filter,Ka=e=>async(t,n)=>{let r=Ei(n);return r.glob&&(t=await xi(t,r.glob)),Array.isArray(t)?!!(await Promise.all(t.map(t=>e(Oi(t,r),r)))).reduce((e,t)=>e&&t,!0):!!await e(Oi(t,r),r)},qa=e=>(t,n)=>{let r=Di(n);return r.glob&&(t=fi(t,r.glob)),Array.isArray(t)?!!t.map(t=>e(Oi(t,r),r)).reduce((e,t)=>e&&t,!0):!!e(Oi(t,r),r)},Ja=qa(Ba),Ya=Object.assign(Ka(za),{sync:Ja}),Xa=qa(La),Za=Object.assign(Ka(Ia),{sync:Xa}),Qa=qa(Na),$a=Object.assign(Ka(Ma),{sync:Qa}),eo=qa(Ui),to=Object.assign(Ka(Hi),{sync:eo}),no=qa(_a),ro=Object.assign(Ka(ma),{sync:no}),io=qa((e,t)=>Ga(t)?Ba(e,t):La(e,t)),ao=Ka((e,t)=>Wa(t)?za(e,t):Ia(e,t)),oo=Object.assign(ao,{rimraf:ao,sync:io,rimrafSync:io,manual:Za,manualSync:Xa,native:Ya,nativeSync:Ja,posix:to,posixSync:eo,windows:$a,windowsSync:Qa,moveRemove:ro,moveRemoveSync:no});oo.rimraf=oo;async function so(e,t,{baseDir:n=``,readdirImpl:r=ge,cpImpl:i=A,joinImpl:a=E}={}){for(let o of e){let e=n?a(n,o):o;try{let n=await r(e,{withFileTypes:!0});for(let r of n){let n=a(e,r.name),o=a(t,r.name);r.isDirectory()?await i(n,o,{recursive:!0,force:!0}):r.isFile()&&await i(n,o,{force:!0})}}catch{}}}async function co(e,t,n={},{statImpl:r=be,cpImpl:i=A}={}){let a=Array.isArray(e)?e:[e];for(let e of a)try{return await r(e),await i(e,t,n),!0}catch{}return!1}async function lo(e,{statImpl:t=be}={}){for(let n of e)try{return await t(n),n}catch{}return null}function uo({contentRoot:e=``,toolchainRoot:t=``,distPublicDir:n=`dist/public`}={}){let r=[{sources:[`pages/resources/README.md`,`pages/deps/README.md`,`resources/README.md`,`deps/README.md`,`pages/README.md`,`README.md`],dest:`dist/public/README.md`},{sources:[`pages/resources/docs`,`pages/deps/docs`,`resources/docs`,`deps/docs`,`pages/docs`,`docs`],dest:`dist/public/docs`,opts:{recursive:!0}},{sources:[`pages/resources/AGENTS.md`,`pages/deps/AGENTS.md`,`resources/AGENTS.md`,`deps/AGENTS.md`,`pages/AGENTS.md`,`AGENTS.md`],dest:`dist/public/AGENTS.md`},{sources:[`pages/resources/llms.txt`,`pages/deps/llms.txt`,`resources/llms.txt`,`deps/llms.txt`,`pages/llms.txt`,`llms.txt`],dest:`dist/public/llms.txt`},{sources:[`pages/resources/robots.txt`,`pages/deps/robots.txt`,`resources/robots.txt`,`deps/robots.txt`,`pages/robots.txt`,`robots.txt`],dest:`dist/public/robots.txt`},{sources:[`pages/resources/sitemap.xml`,`pages/deps/sitemap.xml`,`resources/sitemap.xml`,`deps/sitemap.xml`,`pages/sitemap.xml`,`pages/main/sitemap.xml`,`sitemap.xml`],dest:`dist/public/sitemap.xml`},{sources:[`pages/resources/sitemap.txt`,`pages/deps/sitemap.txt`,`resources/sitemap.txt`,`deps/sitemap.txt`,`pages/sitemap.txt`,`pages/main/sitemap.txt`,`sitemap.txt`],dest:`dist/public/sitemap.txt`},{sources:[`pages/resources/404.html`,`pages/deps/404.html`,`resources/404.html`,`deps/404.html`,`pages/404.html`,`pages/main/404.html`,`404.html`],dest:`dist/public/404.html`},{sources:[`pages/resources/manifest.json`,`pages/deps/manifest.json`,`resources/manifest.json`,`deps/manifest.json`,`pages/manifest.json`,`pages/main/manifest.json`,`manifest.json`],dest:`dist/public/manifest.json`},{sources:[`pages/resources/assets/icons/favicon.svg`,`pages/deps/assets/icons/favicon.svg`,`resources/assets/icons/favicon.svg`,`deps/assets/icons/favicon.svg`,`pages/resources/assets/favicon.svg`,`pages/resources/favicon.svg`,`pages/deps/favicon.svg`,`resources/favicon.svg`,`deps/favicon.svg`,`pages/favicon.svg`,`pages/main/favicon.svg`,`assets/icons/favicon.svg`],dest:`dist/public/favicon.svg`},{sources:[`pages/resources/assets/icons/favicon.ico`,`pages/deps/assets/icons/favicon.ico`,`resources/assets/icons/favicon.ico`,`deps/assets/icons/favicon.ico`,`pages/resources/assets/favicon.ico`,`pages/resources/favicon.ico`,`pages/deps/favicon.ico`,`resources/favicon.ico`,`deps/favicon.ico`,`pages/favicon.ico`,`pages/main/favicon.ico`,`assets/icons/favicon.ico`],dest:`dist/public/favicon.ico`}];if(!e&&!t&&n===`dist/public`)return r;let i=/* @__PURE__ */ new Set([`dist/public/404.html`,`dist/public/manifest.json`,`dist/public/robots.txt`,`dist/public/favicon.svg`,`dist/public/favicon.ico`]);return r.map(r=>{let a=n?r.dest.replace(/^dist\/public/,n):r.dest,o=[];if(e)for(let t of r.sources)o.push(T.join(e,t));if(t&&t!==e&&i.has(r.dest))for(let e of r.sources)o.push(T.join(t,e));return!e&&!t&&o.push(...r.sources),{sources:o,dest:a,...r.opts?{opts:r.opts}:{}}})}function fo(e){let t=[`pages/resources/routes.json`,`pages/deps/routes.json`,`resources/routes.json`,`deps/routes.json`,`pages/routes.json`,`routes.json`];return e?t.map(t=>T.join(e,t)):t}function po(e){return e?[T.join(e,`shadow-claw-config.json`),T.join(e,`shadow-claw.config.json`),T.join(e,`shadowclaw.config.json`),T.join(e,`pages/shadow-claw-config.json`),T.join(e,`pages/shadow-claw.config.json`),T.join(e,`site-config.json`),T.join(e,`pages/site-config.json`)]:[`shadow-claw-config.json`,`shadow-claw.config.json`,`shadowclaw.config.json`,`site-config.json`]}function mo(e={}){let t=e.PRERENDER_PAGES||`all`;return{isProduction:e.NODE_ENV===`production`,copyAllAssets:e.COPY_ALL_ASSETS===`true`,prerenderPages:t,prerenderMainMemory:e.PRERENDER_MAIN_MEMORY!==`false`&&t!==`none`&&t!==`0`}}function ho(e){let t=re(e);if(t.startsWith(`pages/main/`))return t.slice(11);if(t.startsWith(`pages/br:main/`)||t.startsWith(`pages/br-main/`))return t.slice(14);if(t.startsWith(`main/`))return t.slice(5);if(t.startsWith(`pages/`)){let e=t.split(`/`);if(e.length>=3)return e.slice(2).join(`/`)}return t}function go(e,t){let n=`<script id="shadow-claw-static-routing" type="application/json">${ne(t)}<\/script>`;return/id="shadow-claw-static-routing"/iu.test(e)?e.replace(/<script\s+id="shadow-claw-static-routing"[\s\S]*?<\/script>/iu,()=>n):i(e,` ${n}`)}function _o(e){let t=(e.siteTitle||``).trim(),n=e.pageTitle?x(e.pageTitle).trim():``;if(e.isHome||!n)return t;if(!t)return n;if(n.toLowerCase()===t.toLowerCase())return t;let r=e.separator==null?` - `:e.separator;r&&!r.startsWith(` `)&&!r.endsWith(` `)&&(r=` ${r} `);let i=r.trim();return RegExp(`(?:\\s*[-|—•·]\\s*|\\s+${bo(i)}\\s+)${bo(t)}$`,`i`).test(n)?n:e.titleTemplate?e.titleTemplate.replace(/%%title%%|%title%/g,n).replace(/%%sitename%%|%%site%%|%sitename%|%site%/g,t).replace(/%%sep%%|%sep%/g,i).replace(/%%sitedesc%%|%%description%%|%sitedesc%|%description%/g,(e.siteDescription||``).trim()).replace(/\s+/g,` `).trim():`${n}${r}${t}`}function vo(e,t){if(!e)return t?.fallback||``;let n=t?.maxLength??160,r=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``);r=r.replace(/```[\s\S]*?```/gu,``),r=r.replace(/~~~[\s\S]*?~~~/gu,``),r=r.replace(/^#{1,6}\s+.*$/gmu,``),r=r.replace(/!\[.*?\]\(.*?\)/gu,``),r=r.replace(/\[([^\]]+)\]\([^)]+\)/gu,`$1`),r=r.replace(/^>\s*/gmu,``),r=r.replace(/\*\*([^*]+)\*\*/gu,`$1`),r=r.replace(/\*([^*]+)\*/gu,`$1`),r=r.replace(/__([^_]+)__/gu,`$1`),r=r.replace(/_([^_]+)_/gu,`$1`),r=r.replace(/`([^`]+)`/gu,`$1`);let i=r.split(/\r?\n\s*\r?\n/).map(e=>x(e).replace(/\s+/g,` `).trim()).filter(e=>e.length>0);if(i.length===0)return t?.fallback||``;let a=i[0];if(a.length<=n)return a;let o=a.slice(0,n),s=o.lastIndexOf(` `);return s>n*.7&&(o=o.slice(0,s)),o=o.replace(/[,;.:\-—]+$/u,``).trim(),`${o}...`}function yo(e){let t=(e.origin||``).trim().replace(/\/+$/,``),n=(e.basePath||``).trim(),r=e.prettyPath.trim();if(r.startsWith(`/`)||(r=`/${r}`),n&&n!==`/`){let e=`/${n.replace(/^\/+|\/+$/g,``)}`;r.startsWith(e)||t.endsWith(e)||(r=`${e}${r}`)}return t?`${t}${r}`:r}function bo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xo(e){let t=/<!--[\s\S]*?-->|<script\b[\s\S]*?<\/script>|<style\b[\s\S]*?<\/style>|<template\b[\s\S]*?<\/template>|<\/head>/gi,n;for(;(n=t.exec(e))!==null;)if(n[0].toLowerCase().startsWith(`</head`))return n.index;return-1}function So(e,t){let n=xo(e);return n===-1?`${t}\n${e}`:`${e.slice(0,n)} ${t}\n${e.slice(n)}`}function Co(e,t){let n=e;if(t.title){let e=S(t.title);n=/<title>[^<]*<\/title>/iu.test(n)?n.replace(/<title>[^<]*<\/title>/iu,`<title>${e}</title>`):So(n,`<title>${e}</title>`)}if(t.description){let e=`<meta name="description" content="${S(t.description)}" />`;n=/<meta\s+name="description"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="description"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.canonicalUrl){let e=`<link rel="canonical" href="${S(t.canonicalUrl)}" />`;n=/<link\s+rel="canonical"\s+href="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<link\s+rel="canonical"\s+href="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.title){let e=`<meta property="og:title" content="${S(t.title)}" />`;n=/<meta\s+property="og:title"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:title"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.description){let e=`<meta property="og:description" content="${S(t.description)}" />`;n=/<meta\s+property="og:description"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:description"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.canonicalUrl){let e=`<meta property="og:url" content="${S(t.canonicalUrl)}" />`;n=/<meta\s+property="og:url"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:url"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.siteTitle){let e=`<meta property="og:site_name" content="${S(t.siteTitle)}" />`;n=/<meta\s+property="og:site_name"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:site_name"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.type){let e=`<meta property="og:type" content="${S(t.type)}" />`;n=/<meta\s+property="og:type"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:type"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.title){let e=`<meta name="twitter:title" content="${S(t.title)}" />`;n=/<meta\s+name="twitter:title"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="twitter:title"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.description){let e=`<meta name="twitter:description" content="${S(t.description)}" />`;n=/<meta\s+name="twitter:description"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="twitter:description"\s+content="[^"]*"\s*\/?>/iu,e):So(n,e)}if(t.image){let e=S(t.image),r=`<meta property="og:image" content="${e}" />`;n=/<meta\s+property="og:image"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+property="og:image"\s+content="[^"]*"\s*\/?>/iu,r):So(n,r);let i=`<meta name="twitter:image" content="${e}" />`;n=/<meta\s+name="twitter:image"\s+content="[^"]*"\s*\/?>/iu.test(n)?n.replace(/<meta\s+name="twitter:image"\s+content="[^"]*"\s*\/?>/iu,i):So(n,i)}return n}const wo=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`);function To(e){let t=e?.routes;if(!t||typeof t!=`object`)return[];let n=/* @__PURE__ */ new Set;for(let e of Object.values(t)){let t=e?.prettyPath;typeof t==`string`&&t&&n.add(t)}return[...n]}function Eo(e,t){let n=t.endsWith(`/`)?t:`${t}/`,r=/* @__PURE__ */ new Set([n]);for(let t of To(e))r.add(n+t.replace(/^\/+/,``));return`<?xml version="1.0" encoding="UTF-8"?>
|
|
18
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
19
|
-
${[...r].map(e=>` <url>\n <loc>${wo(e)}</loc>\n </url>`).join(`
|
|
20
|
-
`)}
|
|
21
|
-
</urlset>
|
|
22
|
-
`}const Y=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`);function Do(e){return`<![CDATA[${e.replace(/]]>/g,`]]]]><![CDATA[>`)}]]>`}function Oo(e){if(!e)return(/* @__PURE__ */ new Date()).toUTCString();let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?(/* @__PURE__ */ new Date()).toUTCString():t.toUTCString()}function ko(e){if(!e)return(/* @__PURE__ */ new Date()).toISOString();let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?(/* @__PURE__ */ new Date()).toISOString():t.toISOString()}function Ao(e){let t=e.match(/\b(19\d\d|20\d\d)[-_/](0[1-9]|1[0-2])[-_/](0[1-9]|[12]\d|3[01])\b/);if(t)return`${t[1]}-${t[2]}-${t[3]}T00:00:00Z`}function jo(e){let t=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``).match(/^#+\s+(.+)$/m);return t?t[1].trim():``}function Mo(e){let t=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``).replace(/^#+.*$/gm,``).replace(/<[^>]+>/g,``).trim().split(/\n\s*\n/);return t[0]?t[0].trim().slice(0,300):``}function No(e,t){let n=/* @__PURE__ */ new Set;if(t){n.add(t);let e=t.replace(/^\/+|\/+$/g,``);e&&n.add(e)}if(e){n.add(e);let t=e.replace(/^\/+|\/+$/g,``);t&&n.add(t);let r=t.replace(/^pages\/main\//,``).replace(/^pages\//,``).replace(/^main\//,``);r&&n.add(r);let i=T.basename(e);i&&n.add(i)}return Array.from(n)}function Po(e,t){let n=e.trim();if(!n)return!1;if(n.includes(`*`)){let e=n.replace(/^\/+/,``).replace(/\/+$/,``).replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*\*/g,`.*`).replace(/\*/g,`[^/]*`),r=RegExp(`^${e}$`,`i`);return t.some(e=>r.test(e))}if(n.endsWith(`/`)){let e=n.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();return t.some(t=>{let n=t.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();return n===e||n.startsWith(`${e}/`)})}let r=n.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();for(let e of t){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).toLowerCase();if(t===r||t.replace(/\.(md|markdown|html|xhtml|txt)$/i,``)===r.replace(/\.(md|markdown|html|xhtml|txt)$/i,``))return!0}return!1}async function Fo(e,t){let n=e?.routes;if(!n||typeof n!=`object`)return[];let r=t.origin.endsWith(`/`)?t.origin:`${t.origin}/`,i=[];for(let[e,a]of Object.entries(n)){let n=a?.prettyPath;if(!n||typeof n!=`string`)continue;let o=n.replace(/^\/+|\/+$/g,``);if(o===``||o===`index.html`||o===`main`||o===`feed`||o.startsWith(`feed/`)||e.endsWith(`.xml`))continue;let s=No(e,n);if(t.denyList&&t.denyList.length>0&&t.denyList.some(e=>Po(e,s))||t.allowList&&t.allowList.length>0&&!t.allowList.some(e=>Po(e,s)))continue;let c=``;if(t.pagesDir){let n=[T.join(t.pagesDir,e.replace(/^\/pages\/main\//,``).replace(/^\/main\//,``).replace(/^\//,``)),T.join(t.pagesDir,T.basename(e))];for(let e of n)try{c=await M(e,`utf8`);break}catch{}}let l={},u=c;if(c)try{let e=Ve(c);l=e.data||{},u=e.content||``}catch{}if(l.slug===`shadow-claw--purge-pages`||l.draft===!0||l.published===!1||l.feed===!1||l.feed?.enabled===!1||l.feed?.exclude===!0||l.syndication===!1||l.syndicate===!1||l.rss===!1)continue;let d=a.title||l.title||jo(c)||T.basename(e,T.extname(e)).replace(/[-_]/g,` `),f=l.date||l.pubDate||l.created||l.updated||a.date||Ao(e),p=f?new Date(f):void 0,m=l.updated||l.created||f,h=m?new Date(m):p,g=a.description||l.description||l.excerpt||l.summary||Mo(u),_=`${r}${n.replace(/^\/+/,``)}`,v=l.author||a.author||t.author,y=Array.isArray(l.categories)?l.categories:Array.isArray(l.tags)?l.tags:typeof l.section==`string`?[l.section]:[];i.push({title:d,link:_,guid:_,pubDate:p,updated:h,description:g,content:u?u.trim():void 0,author:v,categories:y})}let a=t.sortOrder!==`asc`;return i.sort((e,t)=>{let n=e.pubDate?new Date(e.pubDate).getTime():0,r=t.pubDate?new Date(t.pubDate).getTime():0;return n===r?e.title.localeCompare(t.title):a?r-n:n-r}),i}function Io(e){let t=e.lang||`en-US`,n=Oo(e.lastBuildDate),r=e.link.endsWith(`/`)?e.link:`${e.link}/`,i=e.feedUrl||`${r}feed/`,a=e.items.map(t=>{let n=Oo(t.pubDate),r=t.guid||t.link,i=t.author||e.author||e.title,a=(t.categories||[]).map(e=>` <category>${Do(e)}</category>`).join(`
|
|
23
|
-
`),o=t.content?` <content:encoded>${Do(t.content)}</content:encoded>\n`:``;return` <item>
|
|
24
|
-
<title>${Y(t.title)}</title>
|
|
25
|
-
<link>${Y(t.link)}</link>
|
|
26
|
-
<pubDate>${n}</pubDate>
|
|
27
|
-
<dc:creator>${Do(i)}</dc:creator>
|
|
28
|
-
<guid isPermaLink="true">${Y(r)}</guid>
|
|
29
|
-
<description>${Do(t.description||``)}</description>
|
|
30
|
-
${o}${a?a+`
|
|
31
|
-
`:``} </item>`}).join(`
|
|
32
|
-
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
33
|
-
<rss version="2.0"
|
|
34
|
-
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
|
35
|
-
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
|
36
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
37
|
-
xmlns:atom="http://www.w3.org/2005/Atom"
|
|
38
|
-
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
|
39
|
-
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
|
40
|
-
>
|
|
41
|
-
<channel>
|
|
42
|
-
<title>${Y(e.title)}</title>
|
|
43
|
-
<atom:link href="${Y(i)}" rel="self" type="application/rss+xml" />
|
|
44
|
-
<link>${Y(e.link)}</link>
|
|
45
|
-
<description>${Y(e.description||``)}</description>
|
|
46
|
-
<lastBuildDate>${n}</lastBuildDate>
|
|
47
|
-
<language>${Y(t)}</language>
|
|
48
|
-
<sy:updatePeriod>hourly</sy:updatePeriod>
|
|
49
|
-
<sy:updateFrequency>1</sy:updateFrequency>
|
|
50
|
-
<generator>ShadowClaw</generator>
|
|
51
|
-
${a?a+`
|
|
52
|
-
`:``} </channel>
|
|
53
|
-
</rss>
|
|
54
|
-
`}function Lo(e){let t=e.lang||`en-US`,n=ko(e.lastBuildDate),r=e.link.endsWith(`/`)?e.link:`${e.link}/`,i=e.feedUrl||`${r}feed/atom/`,a=e.items.map(t=>{let n=ko(t.pubDate),r=ko(t.updated||t.pubDate),i=t.guid||t.link,a=t.author||e.author||e.title,o=t.description?` <summary type="html">${Do(t.description)}</summary>\n`:``,s=t.content?` <content type="html" xml:base="${Y(t.link)}">${Do(t.content)}</content>\n`:``,c=(t.categories||[]).map(e=>` <category term="${Y(e)}" />`).join(`
|
|
55
|
-
`);return` <entry>
|
|
56
|
-
<author><name>${Y(a)}</name></author>
|
|
57
|
-
<title type="html">${Do(t.title)}</title>
|
|
58
|
-
<link rel="alternate" type="text/html" href="${Y(t.link)}" />
|
|
59
|
-
<id>${Y(i)}</id>
|
|
60
|
-
<updated>${r}</updated>
|
|
61
|
-
<published>${n}</published>
|
|
62
|
-
${o}${s}${c?c+`
|
|
63
|
-
`:``} </entry>`}).join(`
|
|
64
|
-
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
65
|
-
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="${Y(t)}">
|
|
66
|
-
<title type="text">${Y(e.title)}</title>
|
|
67
|
-
<subtitle type="text">${Y(e.description||``)}</subtitle>
|
|
68
|
-
<updated>${n}</updated>
|
|
69
|
-
<link rel="alternate" type="text/html" href="${Y(e.link)}" />
|
|
70
|
-
<id>${Y(i)}</id>
|
|
71
|
-
<link rel="self" type="application/atom+xml" href="${Y(i)}" />
|
|
72
|
-
<generator uri="https://github.com/xt-ml/shadow-claw">ShadowClaw</generator>
|
|
73
|
-
${a?a+`
|
|
74
|
-
`:``}
|
|
75
|
-
</feed>
|
|
76
|
-
`}function Ro(e){let t=e.lang||`en-US`,n=ko(e.lastBuildDate),r=e.link.endsWith(`/`)?e.link:`${e.link}/`,i=e.feedUrl||`${r}feed/rdf/`,a=e.items.map(e=>` <rdf:li rdf:resource="${Y(e.link)}" />`).join(`
|
|
77
|
-
`),o=e.items.map(t=>{let n=ko(t.pubDate),r=t.author||e.author||e.title,i=t.content?` <content:encoded>${Do(t.content)}</content:encoded>\n`:``;return`<item rdf:about="${Y(t.link)}">
|
|
78
|
-
<title>${Y(t.title)}</title>
|
|
79
|
-
<link>${Y(t.link)}</link>
|
|
80
|
-
<dc:date>${n}</dc:date>
|
|
81
|
-
<dc:creator>${Y(r)}</dc:creator>
|
|
82
|
-
<description>${Do(t.description||``)}</description>
|
|
83
|
-
${i}</item>`}).join(`
|
|
84
|
-
|
|
85
|
-
`);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
86
|
-
<rdf:RDF
|
|
87
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
88
|
-
xmlns="http://purl.org/rss/1.0/"
|
|
89
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
90
|
-
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
|
91
|
-
xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
|
|
92
|
-
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
|
|
93
|
-
xmlns:admin="http://webns.net/mvcb/"
|
|
94
|
-
>
|
|
95
|
-
<channel rdf:about="${Y(i)}">
|
|
96
|
-
<title>${Y(e.title)}</title>
|
|
97
|
-
<link>${Y(e.link)}</link>
|
|
98
|
-
<description>${Y(e.description||``)}</description>
|
|
99
|
-
<dc:date>${n}</dc:date>
|
|
100
|
-
<dc:language>${Y(t)}</dc:language>
|
|
101
|
-
<syn:updatePeriod>hourly</syn:updatePeriod>
|
|
102
|
-
<syn:updateFrequency>1</syn:updateFrequency>
|
|
103
|
-
<syn:updateBase>1970-01-01T00:00+00:00</syn:updateBase>
|
|
104
|
-
<items>
|
|
105
|
-
<rdf:Seq>
|
|
106
|
-
${a?a+`
|
|
107
|
-
`:``} </rdf:Seq>
|
|
108
|
-
</items>
|
|
109
|
-
</channel>
|
|
110
|
-
|
|
111
|
-
${o}
|
|
112
|
-
</rdf:RDF>
|
|
113
|
-
`}function zo(e,t,n){return`<!DOCTYPE html>
|
|
114
|
-
<html lang="en">
|
|
115
|
-
<head>
|
|
116
|
-
<meta charset="utf-8" />
|
|
117
|
-
<meta http-equiv="refresh" content="0; url=${Y(e)}" />
|
|
118
|
-
<link rel="alternate" type="${Y(n)}" title="${Y(t)}" href="${Y(e)}" />
|
|
119
|
-
<title>${Y(t)}</title>
|
|
120
|
-
</head>
|
|
121
|
-
<body>
|
|
122
|
-
<p><a href="${Y(e)}">Click here to view ${Y(t)}</a></p>
|
|
123
|
-
</body>
|
|
124
|
-
</html>
|
|
125
|
-
`}function Bo(e,t){if(!t)return e;let n=t.endsWith(`/`)?t:`${t}/`,r=new URL(n),i=r.pathname.replace(/\/$/,``);return e.replace(/(<(?:link|guid|id)[^>]*>|rdf:about="|rdf:resource="|href="|xml:base=")(https?:\/\/[^"<>\s]+)/giu,(e,t,n)=>{try{let e=new URL(n),a=e.pathname;i&&a.startsWith(i+`/`)?a=a.slice(i.length):i&&a===i&&(a=`/`);let o=a.startsWith(`/`)?a:`/${a}`,s=`${r.origin}${i}${o}${e.search}${e.hash}`;return`${t}${Y(s)}`}catch{return e}})}async function Vo(e){let t=e.origin||``,n=t.endsWith(`/`)?t:`${t}/`,r=e.siteConfig?.site||{},i=e.siteConfig?.branding||{},a=i.titleText||r.title||`ShadowClaw`,o=r.description||``,s=r.lang||`en-US`,c=i.repoLabel||r.author||a,l=e.lastBuildDate||/* @__PURE__ */ new Date,u=typeof e.siteConfig?.feed==`object`?e.siteConfig.feed:{},d=[...u?.allowList||u?.allowlist||[],...e.siteConfig?.pages?.allowList||e.siteConfig?.allowList||[]],f=[...u?.denyList||u?.denylist||[],...e.siteConfig?.pages?.denyList||e.siteConfig?.denyList||[]],p=await Fo(e.routesJson,{origin:n,pagesDir:e.pagesDir,allowList:d.length>0?d:void 0,denyList:f.length>0?f:void 0,sortOrder:e.siteConfig?.pages?.sortOrder,author:c}),m={title:a,link:n,feedUrl:`${n}feed/`,description:o,lang:s,author:c,lastBuildDate:l,items:p},h={...m,feedUrl:`${n}feed/atom/`},g={...m,feedUrl:`${n}feed/rdf/`},_=Io(m),v=Lo(h),y=Ro(g);return{rss2:_,atom:v,rdf:y,files:{"feed/rss.xml":_,"feed/index.xml":_,"feed/index.html":zo(`rss.xml`,`${a} Feed`,`application/rss+xml`),"feed/atom/atom.xml":v,"feed/atom/index.xml":v,"feed/atom/index.html":zo(`atom.xml`,`${a} Atom Feed`,`application/atom+xml`),"feed/rdf/index.xml":y,"feed/rdf/index.html":zo(`index.xml`,`${a} RDF Feed`,`application/rdf+xml`)}}}function Ho(e={},t={}){let n=e.customElements;return{rawScripts:(typeof n==`object`&&!Array.isArray(n)?n.scripts:n)||e.scripts||t.scripts||[],allowedDomains:(typeof n==`object`&&!Array.isArray(n)?n.allowedDomains:void 0)||e.allowedCustomElementDomains||[]}}function Uo(e,t){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`//`)||!t||Array.isArray(t)&&t.length===0)return!0;try{let n=new URL(e,`https://localhost`).hostname.toLowerCase();return(Array.isArray(t)?t:String(t).split(/[\n,]+/)).some(e=>{let t=e.trim().toLowerCase();return n===t||n.endsWith(`.`+t)||t===`*`})}catch{return!1}}function Wo(e,t){let n=JSON.parse(JSON.stringify(e));return n.customElements&&typeof n.customElements==`object`&&Array.isArray(n.customElements.scripts)&&(n.customElements.scripts=n.customElements.scripts.filter(e=>{let n=typeof e==`string`?e:e?.src;return n?Uo(n,t):!1})),n}function X(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}const Go=[`pages/resources/`,`pages/deps/`,`resources/`,`deps/`,`pages/assets/`,`pages/main/assets/`];function Ko(e){for(let t of Go)if(e.startsWith(t))return e.slice(t.length).replace(/^\/+/,``);return e.replace(/^\/+/,``)}async function qo(e){try{return JSON.parse(await M(e,`utf8`))}catch{return null}}async function Jo(e){try{return await M(e,`utf8`)}catch{return null}}async function Yo(e,t){await N(e,t,`utf8`)}function Xo(e){return!Array.isArray(e)||e.length===0?``:`<nav slot="sidebar" class="sidebar-custom-sections" aria-label="Site Navigation">\n${e.map((e,t)=>{if(e.html)return e.html;let n=e.title?`sidebar-${e.title.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`:`sidebar-section-${t+1}`,r=e.headerHref?`<a href="${X(e.headerHref)}" class="sidebar-link">${X(e.title||``)}</a>`:`<span>${X(e.title||``)}</span>`,i=e.title?` <div class="sidebar-section-header">${r}</div>`:``,a=(e.items||[]).map(e=>{let t=e.title||e.label||``,n=e.href||`#`,r=e.target?` target="${X(e.target)}"`:``,i=e.rel?` rel="${X(e.rel)}"`:e.target===`_blank`?` rel="noopener noreferrer"`:``,a=e.active?` active`:``,o=e.active?` aria-current="page"`:``;return` <div class="sidebar-item"><a href="${X(n)}"${r}${i} class="sidebar-link${a}"${o}>${X(t)}</a></div>`}).join(`
|
|
126
|
-
`);return[` <section class="sidebar-section" id="${n}">`,i,a,` </section>`].filter(Boolean).join(`
|
|
127
|
-
`)}).join(`
|
|
128
|
-
`)}\n</nav>`}function Zo(e){let t=e.trim();if(!t||t===`/`)return`/`;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n:`${n}/`}function Qo(e){if(!e||typeof e!=`string`||!e.trim())return null;let t=e.trim();try{return Zo(new URL(t).pathname||`/`)}catch{return t.startsWith(`/`)?Zo(t):null}}function $o(e={}){return e.basePath&&e.basePath.trim()?Zo(e.basePath):Qo(e.pagesOrigin)||Qo(e.siteUrl)||(e.defaultBasePath&&e.defaultBasePath.trim()?Zo(e.defaultBasePath):`/`)}function es(e,t){let n=Zo(t);return e.replace(/<base\s+href="[^"]*"\s*\/?>/iu,`<base href="${X(n)}" />`)}function ts(e,t,n,r){let a=e,o=t.site||{};o.title&&(a=a.replace(/<title>[^<]*<\/title>/iu,`<title>${X(o.title)}</title>`)),o.description&&(a=a.replace(/<meta\s+name="description"\s+content="[^"]*"\s*\/?>/iu,`<meta name="description" content="${X(o.description)}" />`)),o.themeColor&&(a=a.replace(/<meta\s+name="theme-color"\s+content="[^"]*"\s*\/?>/iu,`<meta name="theme-color" content="${X(o.themeColor)}" />`)),o.lang&&(a=a.replace(/<html\s+lang="[^"]*"/iu,`<html lang="${o.lang}"`));let s=t.branding||{},c=r?.isProduction??D.env.NODE_ENV===`production`;if(r?.basePath&&r.basePath.trim())a=es(a,r.basePath);else if(c&&(r?.pagesOrigin||s.siteUrl)){let e=$o({pagesOrigin:r?.pagesOrigin,siteUrl:s.siteUrl});a=es(a,e)}if(s.faviconPath){let e=s.faviconPath.replace(/^pages\/main\//,``),t=e.endsWith(`.svg`)?`image/svg+xml`:e.endsWith(`.png`)?`image/png`:`image/x-icon`,n=`<link href="${X(e)}" rel="icon" type="${t}" />`,r=!1;a=a.replace(/<link\b[^>]*\brel=["']?(?:shortcut\s+)?icon["']?[^>]*\/?>/giu,()=>r?``:(r=!0,n)),r||(a=i(a,` ${n}`))}if(s.appleTouchIconPath){let e=`<link href="${X(s.appleTouchIconPath.replace(/^pages\/main\//,``))}" rel="apple-touch-icon" />`,t=!1;a=a.replace(/<link\b[^>]*\brel=["']?apple-touch-icon["']?[^>]*\/?>/giu,()=>t?``:(t=!0,e)),t||(a=i(a,` ${e}`))}if(s.titleText||s.siteUrl||s.logoSlotHtml!==void 0){let e=s.siteUrl||``;a=a.replace(/<a\b([^>]*\bslot="header-title-link"[^>]*)>([\s\S]*?)<\/a>/iu,(n,r,i)=>{let a=``;if(s.logoSlotHtml!==void 0){let e=typeof s.logoSlotHtml==`string`?s.logoSlotHtml.trim():``;e!==``&&e.toLowerCase()!==`none`&&(a=s.logoSlotHtml)}else{let e=i.match(/<svg\b[\s\S]*?<\/svg>/iu)||i.match(/<img\b[^>]*\bclass="[^"]*header-title-logo[^"]*"[^>]*\/?>/iu);e&&(a=e[0])}let o=i.match(/<(h1|span)\b[^>]*\bclass="[^"]*header-title[^"]*"[^>]*>([\s\S]*?)<\/\1>/iu),c=o?o[1]:/<h1\b/i.test(i)?`h1`:`span`,l=o?o[2].trim():`ShadowClaw`,u=s.titleText||t.site?.title||l;return[`<a`,` aria-label="${X(u)}"`,` class="header-title-link"`,e?` href="${X(e)}"`:``,` slot="header-title-link"`,` >`,a?` ${a.trim()}`:``,` <${c} class="header-title">${X(u)}</${c}>`,` </a>`].filter(Boolean).join(`
|
|
129
|
-
`)})}if(s.repoUrl){let e=s.repoLabel||`Project on GitHub`;a=a.replace(/<a\b[^>]*\bslot="header-actions-logo"[^>]*>[\s\S]*?<\/a>/iu,[`<a`,` aria-label="${X(e)}"`,` class="header-actions-logo-link"`,` href="${X(s.repoUrl)}"`,` slot="header-actions-logo"`,` >`,` <svg aria-hidden="true" focusable="false" viewBox="0 0 496 512" xmlns="http://www.w3.org/2000/svg">`,` <path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8z" fill="var(--shadow-claw-bg-primary-reverse, currentColor)"></path>`,` </svg>`,` </a>`].join(`
|
|
130
|
-
`))}s.siteUrl&&!s.siteUrl.includes(`xt-ml.github.io`)&&(a=a.replace(/\s*<meta\s+http-equiv="origin-trial"\s+content="[^"]*"\s*\/?>\s*/iu,`
|
|
131
|
-
`));let l=t.theme||{};if(l.stylesheet){let e=Ko(l.stylesheet),t=`<link rel="stylesheet" href="${X(e)}" />`,n=X(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=RegExp(`<link\\s+[^>]*href=["'](?:${r}|${n})["'][^>]*>`,`iu`),s=y(a),c=(s===-1?a:a.slice(0,s)).replace(/<script\b[\s\S]*?<\/script>/gi,``);o.test(c)||(a=/<link\s+rel="stylesheet"\s+href="index\.css"\s*\/?>/iu.test(a)?a.replace(/(<link\s+rel="stylesheet"\s+href="index\.css"\s*\/?>)/iu,`$1\n ${t}`):i(a,` ${t}`))}let{allowedDomains:u}=Ho(t,l),d=Wo(t,u),f=`<script id="shadow-claw-site-config" type="application/json">${JSON.stringify(d).replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/\//g,`\\u002f`)}<\/script>`;a=a.includes(`<script id="shadow-claw-site-config"`)?a.replace(/<script\s+id="shadow-claw-site-config"[\s\S]*?<\/script>/iu,()=>f):a.includes(`<script src="theme-init.js">`)?a.replace(`<script src="theme-init.js">`,`${f}\n <script src="theme-init.js">`):/<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b/iu.test(a)?a.replace(/(<script\b[^>]*>\s*var\s+ShadowClawThemeInit\b)/iu,`${f}\n $1`):i(a,` ${f}`),a=a.replace(/\s*<meta\s+name="shadow-claw-override-prerender-skeleton"[^>]*>/giu,``),typeof t.settings?.overridePrerenderSkeleton==`boolean`&&(a=a.replace(`<script id="shadow-claw-site-config"`,`<meta name="shadow-claw-override-prerender-skeleton" content="${t.settings.overridePrerenderSkeleton}" />\n <script id="shadow-claw-site-config"`));let p=n||t.sidebar?.slotHtml||(t.sidebar?.sections?Xo(t.sidebar.sections):``);if(p){let e=p.trim();/\bslot="sidebar(?:-nav|-content|-footer)?"/iu.test(e)||(e=`<div slot="sidebar" class="sidebar-custom-sections">\n${e}\n</div>`);let t=a.match(/<[^>]+?\bslot="sidebar(?:-nav|-content|-footer)?"[^>]*>[\s\S]*?<\/[^>]+>/iu);t&&(a=a.replace(t[0],``)),a.includes(`</shadow-claw>`)?a=a.replace(`</shadow-claw>`,` ${e}\n</shadow-claw>`):a.includes(`<shadow-claw></shadow-claw>`)&&(a=a.replace(`<shadow-claw></shadow-claw>`,`<shadow-claw>\n ${e}\n</shadow-claw>`))}if(t.sidebar&&(a=v(a,t.sidebar)),t.feed===!0||typeof t.feed==`object`&&t.feed?.enabled===!0){let e=s.titleText||o.title||`ShadowClaw`,t=s.siteUrl?s.siteUrl.endsWith(`/`)?s.siteUrl:`${s.siteUrl}/`:``,n=`<link rel="alternate" type="application/rss+xml" title="${X(e)} » Feed" href="${X(t)}feed/" />`,r=`<link rel="alternate" type="application/atom+xml" title="${X(e)} » Atom Feed" href="${X(t)}feed/atom/" />`,c=`<link rel="alternate" type="application/rdf+xml" title="${X(e)} » RDF Feed" href="${X(t)}feed/rdf/" />`;a.includes(`type="application/rss+xml"`)||(a=i(a,` ${n}`)),a.includes(`type="application/atom+xml"`)||(a=i(a,` ${r}`)),a.includes(`type="application/rdf+xml"`)||(a=i(a,` ${c}`))}return a}function ns(e){let t=(e.src||``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),n=e.type||(t.endsWith(`.svg`)?`image/svg+xml`:t.endsWith(`.png`)?`image/png`:`image/x-icon`),r=(e.purpose||`any`).trim();return n===`image/svg+xml`||t.endsWith(`.svg`)?[{...e,src:t,type:n,purpose:`any`}]:r.includes(`any`)&&r.includes(`maskable`)?[{...e,src:t,type:n,purpose:`any`},{...e,src:t,type:n,purpose:`maskable`}]:[{...e,src:t,type:n,purpose:r}]}function rs(e,t){let n=typeof e==`string`?JSON.parse(e):e,r=t.pwa||{},i=t.site||{},a=D.env.PAGES_ORIGIN;if((r.name||i.title)&&(n.name=r.name||i.title),(r.shortName||i.title)&&(n.short_name=r.shortName||i.title),i.description&&(n.description=i.description),r.backgroundColor&&(n.background_color=r.backgroundColor),(r.themeColor||i.themeColor)&&(n.theme_color=r.themeColor||i.themeColor),r.startUrl?n.start_url=r.startUrl:a?n.start_url=a:n.start_url||=`./`,r.icons&&Array.isArray(r.icons)){let e=r.icons.flatMap(ns),t=Array.isArray(n.icons)?n.icons.flatMap(ns):[],i=new Set(e.map(e=>e.src));n.icons=[...e,...t.filter(e=>!i.has(e.src))]}else Array.isArray(n.icons)&&(n.icons=n.icons.flatMap(ns));return r.screenshots&&Array.isArray(r.screenshots)&&(n.screenshots=r.screenshots.map(e=>{let t=(e.src||``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``);return{...e,src:t}})),JSON.stringify(n,null,2)}function is(e,t){if(!t)return e;let n=t.endsWith(`/`)?t:t+`/`;return/<loc>/i.test(e)?e.replace(/<loc>([^<]*)<\/loc>/giu,(e,t)=>{try{let e=new URL(t.trim()),r=new URL(n),i=r.pathname.replace(/\/$/,``);return`<loc>${X(r.origin+i+e.pathname+e.search)}</loc>`}catch{return`<loc>${X(n)}</loc>`}}):e.split(`
|
|
132
|
-
`).map(e=>{let t=e.trim();if(!t)return e;if(t.startsWith(`http://`)||t.startsWith(`https://`))try{let e=new URL(t),r=new URL(n);return e.protocol=r.protocol,e.host=r.host,e.pathname=(r.pathname.endsWith(`/`)?r.pathname.slice(0,-1):r.pathname)+e.pathname,e.toString()}catch{return n}if(t.startsWith(`/`))try{return new URL(t,n).toString()}catch{return e}return e}).join(`
|
|
133
|
-
`)}function as(e,t,n){let r=e,i=t.site||{};if(i.title&&(r=r.replace(/<title>[^<]*<\/title>/iu,`<title>${X(i.title)} - Not Found</title>`)),n){let e=n.endsWith(`/`)?n:n+`/`;r=r.replace(/l\.replace\(["']\/shadow-claw\/["']\)/gu,`l.replace("${X(e)}")`)}return r}function os(e){let t=T.resolve(e),n=t.split(T.sep),r=n[n.length-1],i=n[n.length-2];return(r===`resources`||r===`deps`)&&i===`pages`?T.resolve(t,`../..`):r===`resources`||r===`deps`||r===`pages`?T.resolve(t,`..`):t}function ss(e){let t=T.resolve(e),n=T.basename(t);return n===`resources`||n===`deps`||n===`pages`?T.resolve(t,`..`):t}function Z(e,t,n){if(!e||typeof e!=`string`)return[];if(T.isAbsolute(e))return[e];let r=e.replace(/^\/+/,``).replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=os(t);return[T.resolve(t,`resources`,r),T.resolve(t,`deps`,r),T.resolve(t,`main`,r),T.resolve(i,`pages`,`resources`,r),T.resolve(i,`pages`,`resources`,e),T.resolve(i,`pages`,`deps`,r),T.resolve(i,`pages`,`deps`,e),T.resolve(i,`resources`,r),T.resolve(i,`resources`,e),T.resolve(i,`deps`,r),T.resolve(i,`deps`,e),T.resolve(n,`pages`,`resources`,r),T.resolve(n,`pages`,`deps`,r),T.resolve(n,`resources`,r),T.resolve(n,`deps`,r),T.resolve(n,`pages`,e),T.resolve(n,`pages`,r),T.resolve(n,`pages`,`main`,r),T.resolve(i,`pages`,e),T.resolve(i,`pages`,r),T.resolve(i,`pages`,`main`,r),T.resolve(i,`pages`,`main`,e),T.resolve(t,e),T.resolve(t,r),T.resolve(n,e),T.resolve(n,r),T.resolve(i,e),T.resolve(i,r)]}async function cs(e,t,n){if(!n)return null;let r=await Q([...fo(e),...fo(t),...fo(os(e))]);if(!r)return null;let i=await qo(r);return i?Eo(i,n):null}async function Q(e){for(let t of e)if(t)try{return await be(t),t}catch{}return null}async function ls(e,t,n){let r=n?T.dirname(T.resolve(n)):D.cwd(),i=ss(r),a=os(r),o=[T.resolve(r,`resources`),T.resolve(r,`deps`),T.resolve(i,`resources`),T.resolve(i,`deps`),T.resolve(i,`pages`,`resources`),T.resolve(i,`pages`,`deps`),T.resolve(a,`resources`),T.resolve(a,`deps`),T.resolve(a,`pages`,`resources`),T.resolve(a,`pages`,`deps`)];for(let e of o)try{let n=await ge(e,{withFileTypes:!0});for(let r of n){let n=T.join(e,r.name),i=T.join(t,r.name);r.isDirectory()?await A(n,i,{recursive:!0,force:!0}):r.isFile()&&(await j(T.dirname(i),{recursive:!0}),await k(n,i))}}catch{}let s=await Q([...e.pages?.notFoundPath?Z(e.pages.notFoundPath,r,i):[],...e.branding?.notFoundPath?Z(e.branding.notFoundPath,r,i):[],...e.notFoundPath?Z(e.notFoundPath,r,i):[],...Z(`404.html`,r,i)]);if(s)try{await k(s,T.join(t,`404.html`)),console.log(` Copied custom 404.html: ${s}`)}catch(e){console.warn(` Warning: Could not copy custom 404.html: ${e.message}`)}let c=await Q([...e.pwa?.manifestPath?Z(e.pwa.manifestPath,r,i):[],...e.manifestPath?Z(e.manifestPath,r,i):[],...Z(`manifest.json`,r,i)]);if(c)try{await k(c,T.join(t,`manifest.json`)),console.log(` Copied custom manifest.json: ${c}`)}catch(e){console.warn(` Warning: Could not copy custom manifest.json: ${e.message}`)}if(e.feedPath){let n=await Q(Z(e.feedPath,r,i));if(n)try{let e=T.basename(n);await k(n,T.join(t,e)),console.log(` Copied custom feed: ${n} → ${e}`)}catch(e){console.warn(` Warning: Could not copy custom feed: ${e.message}`)}}let l=!1;if(e.sitemapPath){let n=await Q(Z(e.sitemapPath,r,i));if(n)try{let e=T.basename(n);await k(n,T.join(t,e)),console.log(` Copied custom sitemap: ${n} → ${e}`),l=!0}catch(e){console.warn(` Warning: Could not copy custom sitemap: ${e.message}`)}}if(!l){let e=await Q(Z(`sitemap.xml`,r,i));if(e)try{await k(e,T.join(t,`sitemap.xml`)),console.log(` Copied custom sitemap.xml: ${e}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.xml: ${e.message}`)}let n=await Q(Z(`sitemap.txt`,r,i));if(n)try{await k(n,T.join(t,`sitemap.txt`)),console.log(` Copied custom sitemap.txt: ${n}`)}catch(e){console.warn(` Warning: Could not copy custom sitemap.txt: ${e.message}`)}}let u=e.overwriteAssets===!0||e.branding?.overwriteAssets===!0,d=Array.isArray(e.assets)?e.assets:[e.assetsDir,e.assets].filter(Boolean),f=Array.from(new Set([...d.flatMap(e=>Z(e,r,i)),...Z(`assets`,r,i)].filter(e=>e&&typeof e==`string`))),p=T.join(t,`assets`);if(u)try{await ye(p,{recursive:!0,force:!0}),await j(p,{recursive:!0}),console.log(` Cleared dist public assets for complete template asset overwrite.`)}catch{}let m=/* @__PURE__ */ new Set,h=[...f].reverse();for(let e of h)if(!m.has(e))try{let t=await be(e);if(m.add(e),t.isDirectory())await A(e,p,{recursive:!0,force:!0}),console.log(` Copied custom assets: ${e} → ${p}`);else if(t.isFile()){let t=T.basename(e);await j(p,{recursive:!0}),await k(e,T.join(p,t)),console.log(` Copied custom asset file: ${e} → ${p}`)}}catch{}}async function us(e,t,n){let r=e.theme||{};if(!r.stylesheet)return;let i=n?T.dirname(T.resolve(n)):D.cwd(),a=ss(i),o=await Q(Z(r.stylesheet,i,a));if(!o)return;let s=r.stylesheet.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),c=T.join(t,s);try{await j(T.dirname(c),{recursive:!0}),await k(o,c),console.log(` Copied theme stylesheet: ${o} → ${c}`)}catch(e){console.warn(` Warning: Could not copy theme stylesheet ${o}: ${e.message}`)}}async function ds(e,t,n){let r=(e.customElements&&typeof e.customElements==`object`&&!Array.isArray(e.customElements)?e.customElements?.scripts:void 0)||e.scripts||[];if(!Array.isArray(r)||r.length===0)return;let i=n?T.dirname(T.resolve(n)):D.cwd(),a=ss(i);for(let e of r){let n=typeof e==`string`?e:e?.src;if(!n||n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))continue;let r=await Q(Z(n,i,a));if(r){let e=n.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=T.join(t,e);try{await j(T.dirname(i),{recursive:!0}),await k(r,i),console.log(` Copied custom script: ${r} → ${i}`)}catch(e){console.warn(` Warning: Could not copy custom script ${r}: ${e.message}`)}}}}async function fs(e,t,n){let r=e.branding||{},i=e.pwa||{},a=n?T.dirname(T.resolve(n)):D.cwd(),o=ss(a),s=[],c=await Q(Z(i.manifestPath||e.manifestPath||`manifest.json`,a,o));if(c){let e=await qo(c);e&&Array.isArray(e.icons)&&(s=e.icons.map(e=>e?.src).filter(Boolean))}let l=[r.faviconPath,r.appleTouchIconPath,`assets/icons/favicon.svg`,`assets/icons/favicon.ico`,`favicon.svg`,`favicon.ico`,`pages/resources/assets/icons/favicon.svg`,`pages/resources/assets/icons/favicon.ico`,`pages/resources/favicon.svg`,`pages/deps/favicon.svg`,`pages/main/favicon.svg`,...Array.isArray(i.icons)?i.icons.map(e=>e.src):[],...s].filter(e=>!!e&&typeof e==`string`&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&!e.startsWith(`//`));if(l.length===0)return;let u=/* @__PURE__ */ new Set,d=/* @__PURE__ */ new Set;for(let e of l){if(u.has(e))continue;u.add(e);let n=await Q(Z(e,a,o));if(n){let r=e.replace(/^(pages\/)?(resources\/|deps\/|main\/)?/,``),i=T.join(t,r);if(d.has(i))continue;d.add(i);try{await j(T.dirname(i),{recursive:!0}),await k(n,i),console.log(` Copied branding asset: ${n} → ${i}`)}catch(e){console.warn(` Warning: Could not copy branding asset ${n}: ${e.message}`)}}}}async function ps(e,t,n){let r=await qo(t);if(!r)return console.log(`No site-config.json found — skipping site configuration.`),{applied:!1};console.log(`Applying site-config.json...`);let i=n?.pagesOrigin||D.env.PAGES_ORIGIN||``,a=n?.basePath||D.env.PAGES_BASE_PATH||``,o=n?.isProduction??D.env.NODE_ENV===`production`;await ls(r,e,t);let s=t?T.dirname(T.resolve(t)):D.cwd(),c=ss(s),l;if(r.sidebar?.slotHtml)l=r.sidebar.slotHtml;else if(r.sidebar?.sections)l=Xo(r.sidebar.sections);else{let e=await Q([r.sidebar?.slotPath,`pages/main/sidebar.html`,`pages/sidebar.html`,`sidebar.html`,`resources/sidebar.html`].filter(Boolean).flatMap(e=>Z(e,s,c)));e&&(l=await Jo(e)??void 0,console.log(` Found slotted sidebar: ${e}`))}let u=T.join(e,`index.html`),d=await Jo(u);d&&(await Yo(u,ts(d,r,l,{basePath:a,pagesOrigin:i,isProduction:o})),console.log(` Patched index.html`));let f=T.join(e,`share/share-target.html`),p=await Jo(f);if(p){let e=`/`;a&&a.trim()?e=a:o&&(i||r.branding?.siteUrl)&&(e=$o({pagesOrigin:i,siteUrl:r.branding?.siteUrl})),await Yo(f,es(p,e)),console.log(` Patched share/share-target.html`)}let m=T.join(e,`manifest.json`),h=await Jo(m);h&&(await Yo(m,rs(h,r)),console.log(` Patched manifest.json`));let g=T.join(e,`sitemap.xml`),_=!!await Jo(T.join(e,`sitemap.txt`)),v=!1;if(!await Jo(g)&&!_){let e=await cs(s,c,i||r.branding?.siteUrl||``);e&&(await Yo(g,e),v=!0,console.log(` Generated sitemap.xml from routes.json`))}let y=v?``:await Jo(g);y&&(await Yo(g,is(y,i)),console.log(` Patched sitemap.xml`));let ee=T.join(e,`sitemap.txt`),te=await Jo(ee);if(te&&(await Yo(ee,is(te,i)),console.log(` Patched sitemap.txt`)),r.feed===!0||typeof r.feed==`object`&&r.feed?.enabled===!0){let t=await Q([...fo(s),...fo(c),...fo(os(s))]);if(t){let n=await qo(t);if(n){let t=await Q([T.join(e,`pages/main`),T.join(e,`files/main`),T.join(e,`static-main`),T.join(s,`pages/main`),T.join(s,`main`),T.join(c,`pages/main`),T.resolve(`pages/main`)]),a=await Vo({routesJson:n,siteConfig:r,origin:i||r.branding?.siteUrl||``,pagesDir:t||void 0});for(let[t,n]of Object.entries(a.files)){let r=T.join(e,t);await j(T.dirname(r),{recursive:!0}),await Yo(r,t.endsWith(`.xml`)?Bo(n,i):n)}console.log(` Generated RSS 2.0, Atom, and RDF feeds`)}}}let ne=T.join(e,`404.html`),b=await Jo(ne);return b&&(await Yo(ne,as(b,r,a)),console.log(` Patched 404.html`)),await us(r,e,t),await ds(r,e,t),await fs(r,e,t),console.log(`Site configuration applied successfully.`),{applied:!0}}async function ms(){let[e,t]=D.argv.slice(2);(!e||!t)&&(console.error(`Usage: node bin/site-config/apply.mjs <distPublicDir> <siteConfigPath>`),D.exit(1)),await ps(e,t)}D.argv[1]&&T.resolve(D.argv[1])===T.resolve(de(import.meta.url))&&ms().catch(e=>{console.error(`site-config/apply.ts failed:`,e),D.exit(1)});function hs(e){let t=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/mu,``).match(/^#+\s+(.+)$/m);return t?t[1].trim():``}async function gs(e={}){let u=T.resolve(e.publicDir||`dist/public`),v=T.resolve(e.routesPath||`pages/routes.json`),y=T.resolve(e.sourcePath||`pages/main`),ne=T.resolve(e.indexPath||T.join(u,`index.html`)),b=e.siteConfig||{},x=!!e.siteConfig;if(!e.siteConfig){let t=[e.siteConfigPath,T.resolve(T.dirname(y),`shadow-claw.config.json`),T.resolve(T.dirname(y),`site-config.json`),T.resolve(`shadow-claw.config.json`),T.resolve(`site-config.json`),T.join(u,`shadow-claw.config.json`),T.join(u,`site-config.json`)].filter(Boolean);for(let n of t)try{let t=await M(n,`utf8`);b=JSON.parse(t),(e.siteConfigPath||n.startsWith(T.dirname(y))||n.startsWith(u)||u.startsWith(D.cwd()))&&(x=!0);break}catch{}}let S=e.prerenderPages===void 0?D.env.PRERENDER_PAGES??1:e.prerenderPages,ie=n(S),ae;try{ae=await M(v,`utf8`)}catch(e){if(e?.code===`ENOENT`)return{count:0,skipped:!0,reason:`No routes.json found`};throw e}let w;try{w=JSON.parse(ae)}catch(e){return console.warn(`Failed to parse ${v}:`,e),{count:0,skipped:!0,reason:`Invalid JSON in routes.json`}}if(!w||typeof w!=`object`)return{count:0,skipped:!0,reason:`Invalid routes.json`};w.routes||(w.routes={});let oe={...w.routes||{}},E=/* @__PURE__ */ new Set;async function se(e,t){if(!e.subRoutes)return;let n=Array.isArray(e.subRoutes)?e.subRoutes:Object.values(e.subRoutes);for(let e of n){let n=T.resolve(T.dirname(t),e);if(typeof e==`string`&&e.startsWith(`pages/`)&&(n=T.resolve(e)),!E.has(n)){E.add(n);try{let e=await M(n,`utf8`),t=JSON.parse(e);t.routes&&Object.assign(oe,t.routes),await se(t,n)}catch(e){console.warn(`Failed to read subRoute: ${n}`,e?.message)}}}}await se(w,v),Object.assign(w.routes,oe),Array.isArray(w.subRoutes)&&delete w.subRoutes;let ce={allowList:b?.pages?.allowList??b?.pages?.allowlist??b?.allowList??b?.allowlist,denyList:b?.pages?.denyList??b?.pages?.denylist??b?.denyList??b?.denylist};for(let[e,t]of Object.entries(oe)){let n=ho(e);(!C(n,{...ce,basePathPrefix:y})||!C(e,ce)||t?.prettyPath&&!C(t.prettyPath,ce))&&(delete oe[e],delete w.routes[e])}let le=Object.entries(oe);if(le.length===0)return{count:0,skipped:!0,reason:`Empty routes table`};let ue=JSON.stringify(w,null,2),de=T.join(u,`static-routing.json`);await j(u,{recursive:!0}),await N(de,ue,`utf8`);let fe=JSON.stringify(w),O=T.join(u,`components/shadow-claw/shadow-claw.html`),pe=T.join(u,`components/shadow-claw-pages/shadow-claw-pages.html`),me=T.join(u,`components/shadow-claw-page-header/shadow-claw-page-header.html`),k=T.join(u,`components/shadow-claw/shadow-claw.css`),he=T.join(u,`components/shadow-claw-pages/shadow-claw-pages.css`),_e=T.join(u,`components/shadow-claw-page-header/shadow-claw-page-header.css`),[ve,ye,xe,Se,Ce,we,Te,Ee]=await Promise.all([M(ne,`utf8`),M(O,`utf8`),M(pe,`utf8`).catch(()=>``),M(me,`utf8`).catch(()=>``),h(y,`desc`,{allowList:b?.pages?.allowList??b?.pages?.allowlist??b?.allowList??b?.allowlist,denyList:b?.pages?.denyList??b?.pages?.denylist??b?.denyList??b?.denylist}),M(k,`utf8`).catch(()=>``),M(he,`utf8`).catch(()=>``),M(_e,`utf8`).catch(()=>``)]),De=e.isProduction??D.env.NODE_ENV===`production`,Oe=e.singleFile??!1,ke=e.basePath===void 0?D.env.PAGES_BASE_PATH||``:e.basePath,Ae=e.pagesOrigin||D.env.PAGES_ORIGIN||``,je=x&&(De||e.basePath===void 0)?b?.branding?.siteUrl:void 0,Me=ve.match(/<base\s+href="([^"]*)"/i),Ne=Me?Me[1]:`/`,Pe=ke||Ae||je?$o({basePath:ke,pagesOrigin:Ae,siteUrl:je,defaultBasePath:Ne}):Ne,Fe=Me?es(ve,ke===``?Pe===`/`?Ne:Pe:ke):ve,Ie=(await Promise.all(Ce.map(async e=>{let t=typeof e.inlineContent==`string`?e.inlineContent:await M(e.absolutePath,`utf8`);return{...e,content:t}}))).filter(e=>!(e.displayPath.endsWith(`.md`)&&/^---\r?\n[\s\S]*?slug:\s*"shadow-claw--purge-pages"[\s\S]*?---/mu.test(e.content||``))),P=d(go(Fe,fe)),F=await l(P,u,{isProduction:De,singleFile:Oe});await N(ne,F,`utf8`);let Le=p(ye),Re=p(xe),ze=p(Se),Be=Ie.map(e=>({displayPath:e.displayPath,content:e.content})),Ve=T.join(u,`static-main-manifest.json`),I={};try{I=JSON.parse(await M(Ve,`utf8`))}catch{}let He={pages:Be,...Array.isArray(I.skills)?{skills:I.skills}:{},...Array.isArray(I.tools)?{tools:I.tools}:{},...I.skillsPurgeId?{skillsPurgeId:I.skillsPurgeId}:{},...I.preRenderedStaticPages?{preRenderedStaticPages:I.preRenderedStaticPages}:{},...I.purgeId?{purgeId:I.purgeId}:{}};await N(Ve,JSON.stringify(He,null,2),`utf8`);try{if((await be(y)).isDirectory()){let e=T.join(u,`static-main`);await j(e,{recursive:!0}),await A(y,e,{recursive:!0});let t=T.join(u,`files/main`);await j(t,{recursive:!0}),await A(y,t,{recursive:!0})}}catch{}let Ue=[],We=0;for(let[e,n]of le){if(!n||!n.prettyPath)continue;let p=re(n.prettyPath);if(p===`feed`||p.startsWith(`feed/`)||e.endsWith(`.xml`))continue;let h=ho(e),v=Ie.find(e=>e.displayPath===h);if(!v)try{let e=T.join(y,h);v={absolutePath:e,displayPath:h,content:await M(e,`utf8`)}}catch{console.warn(`Could not find page file for route: ${e} (${h})`);continue}let ne=Ie.filter(e=>e.displayPath!==v.displayPath),x=[],S=[];ie===`all`?(x=[v,...ne],S=x.map(e=>({displayPath:e.displayPath,content:e.content}))):typeof ie==`number`&&(ie===0?(x=[],S=[]):(x=[v,...ne.slice(0,ie-1)],S=x.map(e=>({displayPath:e.displayPath,content:e.content}))));let C=te(v.content||``),ae=C.data&&C.data.title?C.data.title:``,w=(b?.customElements?.scripts||[]).map(e=>typeof e==`string`?e:e?.src).filter(Boolean),oe=await a(v.content||``,v.displayPath,{approvedScripts:w}),E=b?.theme?.stylesheet,se=``;if(typeof E==`string`&&E.trim()){let e=s(E.trim());se=e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`)?e:e.replace(/^\/+/,``)}let ce;if(ie===0)ce=o(Le,we,b.sidebar);else{let e=_(Re,x,oe,ze,ae,Te,Ee,se);ce=f(Le,e,we,b.sidebar)}let le=c(Fe,ce),ue=m(le),de=JSON.stringify({pages:S,...Array.isArray(I.skills)?{skills:I.skills}:{},...Array.isArray(I.tools)?{tools:I.tools}:{},...I.skillsPurgeId?{skillsPurgeId:I.skillsPurgeId}:{},...I.preRenderedStaticPages?{preRenderedStaticPages:I.preRenderedStaticPages}:{},...I.purgeId?{purgeId:I.purgeId}:{}}),D=t(ue,de),O=re(n.prettyPath),pe=O===``||O===`index.html`||n.prettyPath===`/`,me=Fe.match(/<base\s+href="([^"]*)"/i),k=me?me[1]:void 0,he=b?.branding?.siteUrl||void 0,_e=Co(D,{title:_o({pageTitle:n.title||C.data?.seo_title||C.data?.seoTitle||C.data?.title||hs(v.content||``),siteTitle:b?.site?.title||`ShadowClaw`,siteDescription:b?.site?.description,separator:b?.site?.titleSeparator??b?.site?.sep,titleTemplate:b?.site?.titleTemplate,isHome:pe}),description:n.description||C.data?.seo_description||C.data?.seoDescription||C.data?.description||C.data?.excerpt||C.data?.summary||vo(v.content||``,{fallback:b?.site?.description})||b?.site?.description,canonicalUrl:yo({origin:he,basePath:k,prettyPath:n.prettyPath}),siteTitle:b?.site?.title||`ShadowClaw`,type:pe?`website`:`article`}),ve=b?.customElements?.scripts||[],ye=r(ve,C.data,v.content),be=_e;if(ye.length>0){let e=be.match(/<head[^>]*>([\s\S]*?)<\/head>/i),t=e?e[1]:``,n=ye.filter(e=>!t.includes(`src="${e.src}"`)&&!t.includes(`src='${e.src}'`));if(n.length>0){let e=ee(n);be=i(be,` ${e.trim()}`)}}let xe=d(go(be,fe)),Se=await l(xe,u,{isProduction:De,singleFile:Oe}),Ce;Ce=O.endsWith(`.html`)?O:T.join(O,`index.html`);let ke=T.join(u,Ce),Ae=T.dirname(ke);if(await j(Ae,{recursive:!0}),await N(ke,Se,`utf8`),v&&v.absolutePath)try{let e=T.dirname(v.absolutePath),t=await ge(e,{withFileTypes:!0});for(let n of t)n.isFile()&&!g(n.name)&&n.name!==`routes.json`&&await A(T.join(e,n.name),T.join(Ae,n.name))}catch(t){console.warn(`Failed to copy co-located assets for ${e}:`,t)}if(Ue.push(Ce.replace(/\\/g,`/`)),!O.endsWith(`.html`)&&O.length>0){let e=`${O}.html`,t=T.join(u,e);await j(T.dirname(t),{recursive:!0}),await N(t,Se,`utf8`),Ue.push(e.replace(/\\/g,`/`))}We++}return(e.silent??D.env.NODE_ENV===`test`)||console.log(`Prerendered ${We} pretty path page${We===1?``:`s`} from ${v} (prerender-pages: ${ie}).`),{count:We,generatedPaths:Ue,skipped:!1}}async function _s(){let e=D.argv.slice(2).filter(e=>!e.startsWith(`--`)),t=D.argv.slice(2).filter(e=>e.startsWith(`--`)),n;for(let e of t)e.startsWith(`--prerender-pages=`)?n=e.slice(18):e.startsWith(`--pages=`)&&(n=e.slice(8));let r=e[0]||`dist/public`;await gs({publicDir:r,routesPath:e[1]||`pages/routes.json`,sourcePath:e[2]||`pages/main`,indexPath:e[3]||T.join(r,`index.html`),prerenderPages:n})}D.argv[1]&&T.resolve(D.argv[1])===T.resolve(de(import.meta.url))&&_s().catch(e=>{console.error(e),D.exit(1)});async function vs(t,{writeFileImpl:n=N}={}){let r=t||E(e(import.meta.url),`dist`,`public`);await n(E(r,`.nojekyll`),``,`utf-8`)}D.argv[1]&&T.resolve(D.argv[1])===T.resolve(de(import.meta.url))&&await vs();const ys=e(import.meta.url);async function $(e){try{return await be(e),!0}catch{return!1}}async function bs(e,t){let n=[t?E(t,`package.json`):``,E(ys,`package.json`),E(e,`package.json`)].filter(Boolean);for(let e of n)if(await $(e))try{let t=JSON.parse(await M(e,`utf8`));if(t.name===`shadow-claw`&&t.version)return t.version}catch{}let r=E(e,`package.json`);if(await $(r))try{let e=JSON.parse(await M(r,`utf8`)),t=e.dependencies?.[`shadow-claw`]||e.devDependencies?.[`shadow-claw`];if(typeof t==`string`&&t.trim()){let e=t.replace(/^[~^>=<v\s]+/,``);if(e)return e}}catch{}return`latest`}async function xs(e){let{indexPath:t,mainSourcePath:n,contentRoot:r,toolchainRoot:a,cdnBase:o,isQuiet:s,log:c}=e;if(s||c(`Embedding pages, theme, and CDN runtime for single-file distribution...`),await $(t)){let e=await M(t,`utf8`),s=await lo([E(n,`theme.css`),E(r,`pages/main/theme.css`),E(r,`pages/theme.css`),E(r,`theme.css`)]);if(s)try{let t=await M(s,`utf8`);if(t.trim()&&!e.includes(`id="shadow-claw-theme"`)){let n=`<style id="shadow-claw-theme">\n${t.trim()}\n</style>`;e=i(e,` ${n}`)}}catch{}if(await $(n))try{let t=await h(n),r=[];for(let e of t)if(e.absolutePath&&await $(e.absolutePath)){let t=await M(e.absolutePath,`utf8`),n=/^memory\.(md|markdown)$/iu.test(e.displayPath)&&t.trim()===ie.trim(),i=e.displayPath===`index.html`&&t.trim()===b.trim();n||i?r.push(`<!-- prettier-ignore -->\n <script type="text/markdown" data-shadow-claw-page="${e.displayPath}"><\/script>`):r.push(`<!-- prettier-ignore -->\n <script type="text/markdown" data-shadow-claw-page="${e.displayPath}">${t}<\/script>`)}r.length>0&&(e=i(e,` ${r.join(`
|
|
134
|
-
`)}`))}catch{}let c=o||O.SHADOWCLAW_CDN;c||=`https://cdn.jsdelivr.net/npm/shadow-claw@${await bs(r,a)}`,c=c.replace(/\/+$/,``);let l=`${c}/dist/public/`;if(e=e.includes(`name="shadow-claw-asset-base"`)?e.replace(/<meta\s+name="shadow-claw-asset-base"[^>]*>/i,`<meta name="shadow-claw-asset-base" content="${l}" />`):/<base\s+href="[^"]*"\s*\/?>/i.test(e)?e.replace(/(<base\s+href="[^"]*"\s*\/?>)/i,`$1\n <meta name="shadow-claw-asset-base" content="${l}" />`):i(e,` <meta name="shadow-claw-asset-base" content="${l}" />`),e=e.replace(/<script\s+src="[^"]*?theme-init\.js"><\/script>/gi,`<script src="${l}theme-init.js"><\/script>`),e=e.replace(/<link\b([^>]*?)href="[^"]*?index\.css"([^>]*?)\/?>/gi,`<link$1href="${l}index.css"$2 />`),e=e.replace(/<link\b([^>]*?)href="[^"]*?manifest\.json"([^>]*?)\/?>/gi,`<link$1href="${l}manifest.json"$2 />`),e=e.replace(/<link\b([^>]*?)href="(?:\.\/|\/)?assets\/icons\/favicon\.ico"([^>]*?)\/?>/gi,`<link$1href="${l}assets/icons/favicon.ico"$2 />`),e=e.replace(/<link\b([^>]*?)href="(?:\.\/|\/)?assets\/icons\/180\.png"([^>]*?)\/?>/gi,`<link$1href="${l}assets/icons/180.png"$2 />`),e=e.replace(/\s*<script\s+type="module"\s+src="(?:\.\/|\/)?index\.js"><\/script>/gi,``),e=e.replace(/\s*<script\s+type="module"\s+src="(?:\.\/|\/)?service-worker\/init\.js"><\/script>/gi,``),e.includes(`<script type="importmap">`))e=e.replace(/"shadow-claw":\s*"[^"]*?\/dist\/lib\/index\.js"/g,`"shadow-claw": "${c}/dist/lib/index.js"`),e=e.replace(/"shadow-claw\/":\s*"[^"]*?"/g,`"shadow-claw/": "${c}/"`);else{let t=[` <!-- Import Map -->`,` <script type="importmap">`,` {`,` "imports": {`,` "shadow-claw": "${c}/dist/lib/index.js",`,` "shadow-claw/": "${c}/"`,` }`,` }`,` <\/script>`,` <!-- ShadowClaw Library Module -->`,` <script type="module">`,` import "shadow-claw";`,` <\/script>`].join(`
|
|
135
|
-
`);e=i(e,t)}if(!e.includes(`data-shadow-claw-dedent="true"`)){let t=[` <!-- Dedent embedded markdown scripts if indented by formatters (e.g. Prettier) -->`,` <script data-shadow-claw-dedent="true">`,` for (const el of document.querySelectorAll('script[type="text/markdown"][data-shadow-claw-page]')) {`,` const text = el.textContent || '';`,` const m = text.match(/^\\r?\\n([ \\t]+)/);`,` if (m) {`,` const indent = m[1].length;`," const regex = new RegExp(`^[ \\\\t]{1,${indent}}`, 'gm');",` el.textContent = text.replace(/^\\r?\\n/, '').replace(regex, '').replace(/\\r?\\n[ \\t]*$/, '\\n');`,` }`,` }`,` <\/script>`].join(`
|
|
136
|
-
`);e=i(e,t)}if(!e.includes(`data-shadow-claw-opfs-cleanup="true"`)){let t=[` <!-- Self-heal stale pre-seeded OPFS files with leading whitespace before frontmatter -->`,` <script data-shadow-claw-opfs-cleanup="true">`,` (async () => {`,` try {`,` if (!navigator.storage?.getDirectory) return;`,` const root = await navigator.storage.getDirectory();`,` const scDir = await root.getDirectoryHandle("shadowclaw", { create: false }).catch(() => null);`,` if (!scDir) return;`,` const groupsDir = await scDir.getDirectoryHandle("groups", { create: false }).catch(() => null);`,` if (!groupsDir) return;`,` for await (const [, grp] of groupsDir.entries()) {`,` if (grp.kind !== "directory") continue;`,` async function cleanDir(dir) {`,` for await (const [name, handle] of dir.entries()) {`,` if (handle.kind === "directory") {`,` await cleanDir(handle);`,` } else if (handle.kind === "file") {`,` try {`,` const file = await handle.getFile();`,` const text = await file.text();`,` if (/^(?:\\r?\\n)+[ \\t]*---/.test(text) || /^[ \\t]+---/.test(text)) {`,` await dir.removeEntry(name);`,` }`,` } catch {}`,` }`,` }`,` }`,` await cleanDir(grp);`,` }`,` } catch {}`,` })();`,` <\/script>`].join(`
|
|
137
|
-
`);e=i(e,t)}await N(t,e,`utf8`)}}async function Ss(e={}){let t=process.env.NODE_ENV;try{let t=e.quiet??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE),n=e.stdio??(process.env.NODE_ENV===`test`&&!process.env.VERBOSE?`pipe`:`inherit`),r=(...e)=>{t||console.log(...e)},i=le(e.contentRoot||O.SHADOWCLAW_CONTENT_ROOT||process.cwd()),a=le(e.toolchainRoot||ys),o=i===a,{isProduction:s,copyAllAssets:c,prerenderPages:l,prerenderMainMemory:d}=mo({...O,...e.isProduction===void 0?{}:{NODE_ENV:e.isProduction?`production`:`development`},...e.copyAllAssets===void 0?{}:{COPY_ALL_ASSETS:String(e.copyAllAssets)},...e.prerenderPages===void 0?{}:{PRERENDER_PAGES:String(e.prerenderPages)},...e.prerenderMainMemory===void 0?{}:{PRERENDER_MAIN_MEMORY:String(e.prerenderMainMemory)}});s?process.env.NODE_ENV=`production`:e.isProduction===!1&&(process.env.NODE_ENV=`development`);async function f(e,r={}){!t&&!r.quiet&&console.log(`> ${e}`);let i=r.stdio??n,a={...process.env,...s?{NODE_ENV:`production`}:{},...r.env||{}};me(e,{stdio:i,...r,env:a})}if(o){if(fe(ys),await oo(`dist/public`),await j(`dist/public/assets`,{recursive:!0}),c)await A(`assets`,`dist/public`,{recursive:!0});else{await A(`assets/icons`,`dist/public/assets/icons`,{recursive:!0}),await A(`assets/screenshots`,`dist/public/assets/screenshots`,{recursive:!0});try{await A(`assets/fonts`,`dist/public/assets/fonts`,{recursive:!0})}catch{}}await so([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],`dist/public`);for(let e of uo())await co(e.sources,e.dest,e.opts||{});try{await A(`e2e/README.md`,`dist/public/e2e/README.md`)}catch{}try{await A(`pages`,`dist/public/pages`,{recursive:!0})}catch{}try{await A(`pages/main`,`dist/public/files/main`,{recursive:!0})}catch{}let n;try{let{isTestFileOrDir:e}=await import(`./chunk-CGoE4llV.js`);n=t=>!e(oe(t),t)}catch{}try{await A(`pages/main`,`dist/public/static-main`,{recursive:!0})}catch{}try{let{migrateLegacyWorkspaceLayout:e}=await import(`./chunk-CeuR-KKG.js`);await e(process.cwd())}catch{}try{await A(`.agents/skills`,`dist/public/.agents/skills`,{recursive:!0,...n?{filter:n}:{}})}catch{}try{await A(`.agents/tools`,`dist/public/.agents/tools`,{recursive:!0,...n?{filter:n}:{}})}catch{}try{await A(`.agents/scripts`,`dist/public/.agents/scripts`,{recursive:!0,...n?{filter:n}:{}})}catch{}if(await $(`.agents/skills`))try{let{generateSkillsIndex:e}=await import(`./chunk-CGoE4llV.js`);await e(ys)}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}if(await $(`.well-known`))try{await A(`.well-known`,`dist/public/.well-known`,{recursive:!0,force:!0})}catch{}await f(`npm run -s rolldown`);let o=await lo(po()),p=o||`pages/site-config.json`,m;if(o)try{m=JSON.parse(await M(o,`utf8`))}catch{}let h=e.pagesOrigin||O.PAGES_ORIGIN,g=s?$o({basePath:e.basePath||O.PAGES_BASE_PATH,pagesOrigin:h,siteUrl:m?.branding?.siteUrl,defaultBasePath:`/shadow-claw/`}):e.basePath||O.PAGES_BASE_PATH||`/`;d?await u({indexPath:`dist/public/index.html`,sourcePath:`pages/main`,prerenderPages:l,siteConfigPath:p,isProduction:s,singleFile:e.singleFile}):await u({indexPath:`dist/public/index.html`,noSeed:!0,siteConfigPath:p,isProduction:s,singleFile:e.singleFile});try{await ps(`dist/public`,p,{basePath:g,pagesOrigin:h,isProduction:s})}catch{}try{let e=JSON.parse(await M(`package.json`,`utf8`));if(e.version){let t=`dist/public/index.html`,n=await M(t,`utf8`);await N(t,n.replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${e.version}" />`),`utf8`);for(let t of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=E(`dist/public`,t);if(await $(n))try{let t=JSON.parse(await M(n,`utf8`));t.version!==e.version&&(t.version=e.version,await N(n,JSON.stringify(t,null,2)+`
|
|
138
|
-
`,`utf8`))}catch{}}}}catch{}try{let e=`dist/public/index.html`,t=await M(e,`utf8`);await N(e,es(t,g),`utf8`);let n=`dist/public/share/share-target.html`;if(await $(n)){let e=await M(n,`utf8`);await N(n,es(e,g),`utf8`)}}catch{}if(s){if(r(`Running production post-build steps...`),r(` PAGES_ORIGIN : ${h||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${g}`),h)try{let e=`dist/public/manifest.json`,t=await M(e,`utf8`),n=JSON.parse(t);n.start_url&&(n.start_url=h,await N(e,JSON.stringify(n,null,2),`utf8`))}catch{}await vs(`dist/public`);let e=``;try{e=me(`npm run -s build:pkg:get:meta`,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}e&&await f(`npm run -s build:pkg:meta "${e}"`)}await gs({publicDir:`dist/public`,routesPath:await lo(fo())||`pages/routes.json`,sourcePath:`pages/main`,prerenderPages:l,siteConfigPath:p,basePath:g,pagesOrigin:h,isProduction:s,singleFile:e.singleFile}),await f(`npm run -s build:service-worker`);let _=`dist/public/service-worker.js`;if(await $(_)&&await ae(_,{logImpl:()=>{}}),s)try{let{precompressAssets:e}=await import(`./chunk-Cwpkwpa9.js`),n=await e(`dist/public`,{silent:t});!t&&n.count>0&&r(`Pre-compressed ${n.count} assets (.br and .gz).`)}catch(e){t||console.warn(`Notice: Asset pre-compression encountered an issue:`,e)}e.singleFile&&await xs({indexPath:`dist/public/index.html`,mainSourcePath:`pages/main`,contentRoot:i,toolchainRoot:a,cdnBase:e.cdn,isQuiet:t,log:r}),r(`Build completed successfully.`);return}let p=e.outDir||`dist/public`,m=le(i,p);await oo(m),await j(m,{recursive:!0}),await j(E(m,`assets`),{recursive:!0});let h=E(a,`dist/public`);await $(E(h,`index.js`))||(r(`Building ShadowClaw core toolchain...`),await oo(E(a,`dist/public`)),await oo(E(a,`dist-electron`)),await f(`npm run -s rolldown`,{cwd:a})),await A(h,m,{recursive:!0,filter:e=>{if(e.includes(`/assets/cache/`)||e.includes(`\\assets\\cache\\`)||e.includes(`/.cache/`)||e.includes(`\\.cache\\`)||e.includes(`/cache/`)||e.includes(`\\cache\\`)||e.endsWith(`/cache`)||e.endsWith(`\\cache`))return!1;if(i!==a){let t=ce(h,e).replace(/\\/g,`/`);if(t===`docs`||t.startsWith(`docs/`)||t===`main`||t.startsWith(`main/`)||t===`main.html`||t.startsWith(`main.html.`)||t===`static-main`||t.startsWith(`static-main/`)||t===`static-main-manifest.json`||t.startsWith(`static-main-manifest.json.`)||t===`static-routing.json`||t.startsWith(`static-routing.json.`)||t===`files`||t.startsWith(`files/`)||t===`pages`||t.startsWith(`pages/`)||t===`sitemap.xml`||t.startsWith(`sitemap.xml.`)||t===`sitemap.txt`||t.startsWith(`sitemap.txt.`)||t===`llms.txt`||t.startsWith(`llms.txt.`)||t===`README.md`||t.startsWith(`README.md.`)||t===`AGENTS.md`||t.startsWith(`AGENTS.md.`))return!1}return!0}}),i!==a&&(await oo(E(m,`sitemap.xml`)),await oo(E(m,`sitemap.txt`)));let g=E(i,`assets`);await $(g)&&(c?await A(g,m,{recursive:!0,force:!0}):(await $(E(g,`icons`))&&await A(E(g,`icons`),E(m,`assets/icons`),{recursive:!0,force:!0}),await $(E(g,`screenshots`))&&await A(E(g,`screenshots`),E(m,`assets/screenshots`),{recursive:!0,force:!0}),await $(E(g,`fonts`))&&await A(E(g,`fonts`),E(m,`assets/fonts`),{recursive:!0,force:!0}))),await so([`pages/resources`,`pages/deps`,`resources`,`deps`,`pages/assets`,`pages/main/assets`],m,{baseDir:i});let _=uo({contentRoot:i,toolchainRoot:a,distPublicDir:m});for(let e of _)await co(e.sources,e.dest,e.opts||{});let v=E(i,`pages`);await $(v)&&await A(v,E(m,`pages`),{recursive:!0,force:!0});let y=E(i,`pages/main`);await $(y)&&(await A(y,E(m,`files/main`),{recursive:!0,force:!0}),await A(y,E(m,`static-main`),{recursive:!0,force:!0}));try{let{migrateLegacyWorkspaceLayout:e}=await import(`./chunk-CeuR-KKG.js`);await $(E(i,`.agents`))&&await e(i),i!==a&&await $(E(a,`.agents`))&&await e(a)}catch{}let ee=E(i,`.agents/skills`);await $(ee)&&await A(ee,E(m,`.agents/skills`),{recursive:!0,force:!0});let te=E(a,`.agents/skills`);i!==a&&await $(te)&&await A(te,E(m,`.agents/skills`),{recursive:!0,force:!1,errorOnExist:!1});let ne=E(i,`.agents/tools`);if(await $(ne))await A(ne,E(m,`.agents/tools`),{recursive:!0,force:!0});else{let e=E(a,`.agents/tools`);await $(e)&&await A(e,E(m,`.agents/tools`),{recursive:!0,force:!0})}let b=E(i,`.agents/scripts`);if(await $(b))await A(b,E(m,`.agents/scripts`),{recursive:!0,force:!0});else{let e=E(a,`.agents/scripts`);await $(e)&&await A(e,E(m,`.agents/scripts`),{recursive:!0,force:!0})}let x=E(a,`.well-known`);await $(x)&&await A(x,E(m,`.well-known`),{recursive:!0,force:!0});let re=E(i,`.well-known`);if(i!==a&&await $(re)&&await A(re,E(m,`.well-known`),{recursive:!0,force:!0}),await $(E(m,`.agents/skills`)))try{let{generateSkillsIndex:e}=await import(`./chunk-CGoE4llV.js`);if(await e(m,{metadataRoot:i,outDir:`.well-known/agent-skills`,toolchainRoot:a,includeBundled:!0}),await $(ee))try{await e(i,{toolchainRoot:a,includeBundled:!0})}catch{}}catch(e){console.warn(`Notice: Failed to auto-generate agent-skills index:`,e)}let S=await lo(po(i)),C=S||E(i,`pages/site-config.json`),ie=d,w;if(S)try{w=JSON.parse(await M(S,`utf8`))}catch{}e.prerenderMainMemory===void 0&&w&&(w?.settings?.prerenderMainMemory===!1?(ie=!1,r(` site-config: prerenderMainMemory=false — pages DSD pre-rendering disabled.`)):w?.settings?.overridePrerenderSkeleton===!1&&r(` site-config: overridePrerenderSkeleton=false — skeleton overlay disabled.`));let T=E(m,`index.html`);ie&&await $(y)?await u({indexPath:T,sourcePath:y,prerenderPages:l,siteConfigPath:C,isProduction:s,singleFile:e.singleFile}):await u({indexPath:T,noSeed:!0,siteConfigPath:C,isProduction:s,singleFile:e.singleFile});let se=e.pagesOrigin||O.PAGES_ORIGIN,ue=s?$o({basePath:e.basePath||O.PAGES_BASE_PATH,pagesOrigin:se,siteUrl:w?.branding?.siteUrl,defaultBasePath:`/`}):e.basePath||O.PAGES_BASE_PATH||`/`;try{await ps(m,C,{basePath:ue,pagesOrigin:se,isProduction:s})}catch{}try{let e=await M(T,`utf8`);e=es(e,ue);let t=``;try{let e=await lo([E(i,`package.json`),E(a,`package.json`)]);e&&(t=JSON.parse(await M(e,`utf8`)).version||``)}catch{}if(t){e=e.replace(/<meta\s+name="version"[^>]*>/,`<meta name="version" content="${t}" />`);for(let e of[`.well-known/mcp.json`,`.well-known/mcp/server-card.json`]){let n=E(m,e);if(await $(n))try{let e=JSON.parse(await M(n,`utf8`));e.version!==t&&(e.version=t,await N(n,JSON.stringify(e,null,2)+`
|
|
139
|
-
`,`utf8`))}catch{}}}await N(T,e,`utf8`);let n=E(m,`share/share-target.html`);if(await $(n)){let e=await M(n,`utf8`);await N(n,es(e,ue),`utf8`)}}catch{}if(s){if(r(`Running production post-build steps...`),r(` PAGES_ORIGIN : ${se||`(relative ./)`}`),r(` PAGES_BASE_PATH: ${ue}`),se)try{let e=E(m,`manifest.json`),t=await M(e,`utf8`),n=JSON.parse(t);n.start_url&&(n.start_url=se,await N(e,JSON.stringify(n,null,2),`utf8`))}catch{}await N(E(m,`.nojekyll`),``,`utf8`);let e=``;try{e=me(`git rev-parse HEAD`,{cwd:i,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{try{e=me(`git rev-parse HEAD`,{cwd:a,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{}}if(e){let t=await M(T,`utf8`);await N(T,t.replace(/<meta\s+name="revision"[^>]*>/,`<meta name="revision" content="${e}" />`),`utf8`)}}let de=await lo(fo(i))||E(i,`pages/routes.json`),D=await $(y)?y:E(a,`pages/main`);await gs({publicDir:m,routesPath:de,sourcePath:D,prerenderPages:l,siteConfigPath:C,basePath:ue,pagesOrigin:se,isProduction:s,singleFile:e.singleFile});let pe=E(m,`service-worker.js`);if(await $(pe)&&await ae(pe,{logImpl:()=>{}}),s)try{let{precompressAssets:e}=await import(`./chunk-Cwpkwpa9.js`),n=await e(m,{silent:t});!t&&n.count>0&&r(`Pre-compressed ${n.count} assets (.br and .gz).`)}catch(e){t||console.warn(`Notice: Asset pre-compression encountered an issue:`,e)}e.singleFile&&await xs({indexPath:E(m,`index.html`),mainSourcePath:D,contentRoot:i,toolchainRoot:a,cdnBase:e.cdn,isQuiet:t,log:r}),r(`Build completed successfully.`)}finally{t===void 0?delete process.env.NODE_ENV:process.env.NODE_ENV=t}}process.argv[1]&&le(process.argv[1])===le(de(import.meta.url))&&Ss().catch(e=>{console.error(e),pe(1)});export{Ss as t};
|