@dahawa/hawa-code 2.7.12 → 2.7.13
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/cli.js +2 -2
- package/hands.js +2 -2
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -653,7 +653,7 @@ globstar while`,e,d,t,f,p),this.matchOne(e.slice(d),t.slice(f),r))return this.de
|
|
|
653
653
|
`)),FYr(e,o,{encoding:r,flush:!0})}var Jot=new Lj.default({fetchMethod:e=>YYr(e),ttl:300*1e3,ttlAutopurge:!1,max:1e3});async function iit(e){let t=EU(e);return Jot.get(t)||Jot.fetchMethod?.(t)}async function YYr(e){let t=new AbortController;setTimeout(()=>{t.abort()},1e3);let r=await Aet(e,t.signal,15),n=0;for(let o of r)M1(o)==="CRLF"&&n++;return n>3?"CRLF":"LF"}function sit(e,t,r){if(e.has(t))return e.get(t);let n=r();return e.set(t,n),n}var zYr=new Lj.default({fetchMethod:e=>ait(e),ttl:300*1e3,ttlAutopurge:!1,max:1e3});function Zd(e){let t=EU(e);return sit(zYr,t,()=>ait(t))}function ait(e){let r=Buffer.alloc(4096),n;try{n=Zot(e,"r");let o=Xot(n,r,0,4096,0);return o===0?"utf8":o>=2&&r[0]===255&&r[1]===254?"utf16le":o>=3&&r[0]===239&&r[1]===187&&r[2]===191||r.slice(0,o).toString("utf8").length>0?"utf8":"ascii"}catch(o){return be(`Error detecting encoding for file ${e}: ${o}`),"utf8"}finally{n&&eit(n)}}var VYr=new Lj.default({fetchMethod:e=>lit(e),ttl:300*1e3,ttlAutopurge:!1,max:1e3});function M1(e){let t=EU(e);return sit(VYr,t,()=>lit(t))}function lit(e,t="utf8"){try{if(!tit(e).isFile())return"LF";let n=Buffer.alloc(4096),o=Zot(e,"r"),i=Xot(o,n,0,4096,0);eit(o);let s=n.toString(t,0,i),a=0,l=0;for(let c=0;c<s.length;c++)s[c]===`
|
|
654
654
|
`&&(c>0&&s[c-1]==="\r"?a++:l++);return a>l?"CRLF":"LF"}catch(r){return be(`Error detecting line endings for file ${e}: ${r}`),"LF"}}function gB(e){let t=rit(e)?e:EU(Oe(),e);return t.endsWith(" AM.png")?t.replace(" AM.png","\u202FAM.png"):t.endsWith(" PM.png")?t.replace(" PM.png","\u202FPM.png"):t}function I_e(e){return e?rit(e)?e:EU(Oe(),e):void 0}function cit(e){try{let t=I_e(e),r=t?HYr(Oe(),t):void 0;return{absolutePath:t,relativePath:r}}catch(t){return te("getAbsoluteAndRelativePaths error ",t),{absolutePath:null,relativePath:null}}}function Fj(e){try{let t=$Yr(e),r=Wot(e,jot(e));if(!QYr(t))return;let i=UYr(t).filter(s=>Wot(s,jot(s))===r&&qYr(t,s)!==e)[0];return i||void 0}catch(t){be(`Error finding similar file for ${e}: ${t}`);return}}function v_e(){let e=process.env.HAWA_CODE_COMPACT_LINE_PREFIX;return!(e==="0"||e==="false")}function lC({content:e,startLine:t}){if(!e)return"";let r=e.split(/\r?\n/);return v_e()?r.map((n,o)=>`${o+t} ${n}`).join(`
|
|
655
655
|
`):r.map((n,o)=>{let i=String(o+t);return i.length>=6?`${i}\u2192${n}`:`${i.padStart(6," ")}\u2192${n}`}).join(`
|
|
656
|
-
`)}function uit(e){try{let t=GYr(e),r=t.readSync();return t.closeSync(),r===null}catch(t){return be(`Error checking directory: ${t}`),!1}}Pe();function oC(){let e=Nn();e.hasCompletedProjectOnboarding||ti({...e,hasCompletedProjectOnboarding:!0})}function x_e({workspaceDir:e}){let r=!Nn().hasCompletedProjectOnboarding;if(!r)return null;let n=WYr(jYr(e,Qo)),o=uit(e),i=!n&&!o,s=lB.isEnabled&&!Qr().shiftEnterKeyBindingInstalled,a=re();return(0,h.jsxs)(x,{flexDirection:"column",gap:1,padding:1,paddingBottom:0,children:[r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(I,{color:a.secondaryText,children:"Tips for getting started:"}),(0,h.jsx)(Dc,{children:(()=>{let l=[];return o&&l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Ask ",it," to create a new app or clone a repository."]})},"workspace")),i&&l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Run ",(0,h.jsx)(I,{color:a.text,children:"/init"})," to create a",Qo," file with instructions for Hawa code."]})},"claudemd")),s&&l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Run ",(0,h.jsx)(I,{color:a.text,children:"/terminal-setup"}),(0,h.jsx)(I,{bold:!1,children:" to set up terminal integration"})]})},"terminal")),l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Ask ",it," questions about your codebase."]})},"questions")),l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Ask ",it," to implement changes to your codebase."]})},"changes")),l})()})]}),e===KYr()&&(0,h.jsxs)(I,{color:re().warning,children:["Note: You have launched ",(0,h.jsx)(I,{bold:!0,children:it})," in your home directory. For the best experience, launch it in a project directory instead."]})]})}function w_e({isFocused:e,isSelected:t,smallPointer:r,children:n}){let{styles:o}=Ai("Select");return(0,h.jsxs)(x,{...o.option({isFocused:e}),children:[e&&(0,h.jsx)(I,{...o.focusIndicator(),children:r?nr.triangleDownSmall:nr.pointer}),(0,h.jsx)(I,{...o.label({isFocused:e,isSelected:t}),children:n}),t&&(0,h.jsx)(I,{...o.selectedIndicator(),children:nr.tick})]})}var Xd=Ie(Ve(),1);import{isDeepStrictEqual as JYr}from"node:util";var bU=class extends Map{first;constructor(t){let r=[],n,o,i=0;for(let s of t){let a={...s,previous:o,next:void 0,index:i};o&&(o.next=a),n||=a;let l="value"in s?s.value:R_e(s);r.push([l,a]),i++,o=a}super(r),this.first=n}};var ZYr=(e,t)=>{switch(t.type){case"focus-next-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.next;for(;n&&!("value"in n);)n=n.next;if(!n)return e;if(!(n.index>=e.visibleToIndex))return{...e,focusedValue:n.value};let i=Math.min(e.optionMap.size,e.visibleToIndex+1),s=i-e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:s,visibleToIndex:i}}case"focus-previous-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.previous;for(;n&&!("value"in n);)n=n.previous;if(!n)return e;if(!(n.index<=e.visibleFromIndex))return{...e,focusedValue:n.value};let i=Math.max(0,e.visibleFromIndex-1),s=i+e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:i,visibleToIndex:s}}case"select-focused-option":return{...e,previousValue:e.value,value:e.focusedValue};case"reset":return t.state;case"set-focus":return{...e,focusedValue:t.value}}},N_e=e=>e.flatMap(t=>{if("options"in t){let r=N_e(t.options),n=r.flatMap(i=>"value"in i?i.value:[]);return[...t.header!==void 0?[{header:t.header,optionValues:n}]:[],...r]}return t}),dit=({visibleOptionCount:e,defaultValue:t,options:r})=>{let n=N_e(r),o=typeof e=="number"?Math.min(e,n.length):n.length,i=new bU(n),s=i.first,a=s&&"value"in s?s.value:void 0;return{optionMap:i,visibleOptionCount:o,focusedValue:a,visibleFromIndex:0,visibleToIndex:o,previousValue:t,value:t}},D_e=({visibleOptionCount:e=5,options:t,defaultValue:r,onChange:n,onFocus:o,focusValue:i})=>{let s=N_e(t),[a,l]=(0,Xd.useReducer)(ZYr,{visibleOptionCount:e,defaultValue:r,options:t},dit),[c,u]=(0,Xd.useState)(s);s!==c&&!JYr(s,c)&&(l({type:"reset",state:dit({visibleOptionCount:e,defaultValue:r,options:t})}),u(s));let d=(0,Xd.useCallback)(()=>{l({type:"focus-next-option"})},[]),f=(0,Xd.useCallback)(()=>{l({type:"focus-previous-option"})},[]),p=(0,Xd.useCallback)(()=>{l({type:"select-focused-option"})},[]),A=(0,Xd.useMemo)(()=>s.map((_,E)=>({..._,index:E})).slice(a.visibleFromIndex,a.visibleToIndex),[s,a.visibleFromIndex,a.visibleToIndex]);return(0,Xd.useEffect)(()=>{a.value&&a.previousValue!==a.value&&n?.(a.value)},[a.previousValue,a.value,t,n]),(0,Xd.useEffect)(()=>{a.focusedValue&&o?.(a.focusedValue)},[a.focusedValue,o]),(0,Xd.useEffect)(()=>{i&&l({type:"set-focus",value:i})},[i]),{focusedValue:a.focusedValue,visibleFromIndex:a.visibleFromIndex,visibleToIndex:a.visibleToIndex,value:a.value,visibleOptions:A,focusNextOption:d,focusPreviousOption:f,selectFocusedOption:p}};var O_e=({isDisabled:e=!1,state:t})=>{ft((r,n)=>{n.downArrow&&t.focusNextOption(),n.upArrow&&t.focusPreviousOption(),n.return&&t.selectFocusedOption()},{isActive:!e})};var R_e=e=>`HEADER-${e.optionValues.join(",")}`;function Fb({isDisabled:e=!1,visibleOptionCount:t=5,highlightText:r,options:n,defaultValue:o,onChange:i,onFocus:s,focusValue:a}){let l=D_e({visibleOptionCount:t,options:n,defaultValue:o,onChange:i,onFocus:s,focusValue:a});O_e({isDisabled:e,state:l});let{styles:c}=Ai("Select");return(0,h.jsx)(x,{...c.container(),children:l.visibleOptions.map(u=>{let d="value"in u?u.value:R_e(u),f=!e&&l.focusedValue!==void 0&&("value"in u?l.focusedValue===u.value:u.optionValues.includes(l.focusedValue)),p=!!l.value&&("value"in u?l.value===u.value:u.optionValues.includes(l.value)),A="header"in u,_="label"in u?u.label:u.header,E=_;if(r&&_.includes(r)){let S=_.indexOf(r);E=(0,h.jsxs)(h.Fragment,{children:[_.slice(0,S),(0,h.jsx)(I,{...c.highlightedText(),children:r}),_.slice(S+r.length)]})}return(0,h.jsx)(w_e,{isFocused:f,isSelected:p,smallPointer:A,children:E},d)})})}function pit({onDone:e}){return ft((t,r)=>{(r.ctrl&&(t==="c"||t==="d")||r.escape)&&e()}),(0,h.jsxs)(x,{flexDirection:"column",borderStyle:"round",padding:1,borderColor:re().secondaryBorder,children:[(0,h.jsx)(x,{marginBottom:1,flexDirection:"column",children:(0,h.jsx)(I,{bold:!0,children:"You've spent $5 this session."})}),(0,h.jsx)(x,{children:(0,h.jsx)(Fb,{options:[{value:"ok",label:"Got it, thanks!"}],onChange:e})})]})}var Jt=Ie(Ve(),1);Pe();lr();r_();var tzr="2.7.12",n_={VERSION:tzr,PACKAGE_URL:"@dahawa/hawa-code",README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};var k_e=46,git=["(\u2740\u2579\u25E1\u2579)","(\u25D5\u072B\u25D5)","\u239D(\u25D5u\u25D5)\u23A0","\u10DA(\u25C9\u25DE\u0C6A\u25DF\u25C9 )\u10DA","(\xB4\u25C9\u203F\u25C9\uFF40)","\u0E01\u0E47\u0295\u2022\u0361\u1D25\u2022\u0294 \u0E01\u0E49","\uFF0F/( \u25D5\u203F\u203F\u25D5 )\uFF3C"];function Qj({isDefaultModel:e=!1}){let t=Math.max(k_e,Oe().length+12),r=re(),n=git[Math.floor(Math.random()*git.length)];return(0,h.jsx)(x,{flexDirection:"column",children:(0,h.jsxs)(x,{flexDirection:"column",gap:1,paddingLeft:1,width:"100%",children:[(0,h.jsxs)(I,{children:[(0,h.jsx)(I,{children:n})," Welcome to"," ",(0,h.jsx)(I,{bold:!0,children:it}),(0,h.jsxs)(I,{color:r.secondaryText,children:[" v",n_.VERSION]})]}),(0,h.jsx)(h.Fragment,{children:(0,h.jsxs)(x,{paddingLeft:2,flexDirection:"column",gap:1,children:[(0,h.jsx)(I,{color:r.secondaryText,italic:!0,children:"/help for help"}),(0,h.jsxs)(I,{color:r.secondaryText,children:["cwd: ",Oe()]}),(0,h.jsxs)(I,{color:r.secondaryText,children:["model: ",Jn.getConfig().routing.MODEL?.map(o=>`${o.source}__${o.model}`).join(", ")??"N/A"]}),(0,h.jsxs)(I,{color:r.secondaryText,children:["small fast model: ",Jn.getConfig().routing.SMALL_FAST_MODEL?.map(o=>`${o.source}__${o.model}`).join(", ")??"N/A"]})]})})]})})}we();import{randomUUID as $g}from"crypto";ji();we();er();lr();we();Pe();import{existsSync as Gb,readdirSync as Njr,statSync as Djr}from"fs";import{join as mC,relative as Ojr}from"path";import{homedir as llt}from"os";import{platform as Bjr}from"process";import{readFile as fC}from"fs/promises";lr();um();Kt();import{join as azr,sep as lzr}from"path";function ld(){if(!Oc())return!1;try{let e=Je();if(e.autoMemory?.teamMemoryEnabled!==void 0)return e.autoMemory.teamMemoryEnabled}catch{}return!1}function ep(){return(azr(Oe(),".hcode","team-memory")+lzr).normalize("NFC")}function zf(e){let t=e.normalize("NFC"),r=ep();return t.startsWith(r)}um();var clt=Ie(RU(),1);po();var X_e=(e,t,r)=>{let n=e instanceof RegExp?Lat(e,r):e,o=t instanceof RegExp?Lat(t,r):t,i=n!==null&&o!=null&&b7r(n,o,r);return i&&{start:i[0],end:i[1],pre:r.slice(0,i[0]),body:r.slice(i[0]+n.length,i[1]),post:r.slice(i[1]+o.length)}},Lat=(e,t)=>{let r=t.match(e);return r?r[0]:null},b7r=(e,t,r)=>{let n,o,i,s,a,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(e===t)return[l,c];for(n=[],i=r.length;u>=0&&!a;){if(u===l)n.push(u),l=r.indexOf(e,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,c])}else o=n.pop(),o!==void 0&&o<i&&(i=o,s=c),c=r.indexOf(t,u+1);u=l<c&&l>=0?l:c}n.length&&s!==void 0&&(a=[i,s])}return a};var Pat="\0SLASH"+Math.random()+"\0",Fat="\0OPEN"+Math.random()+"\0",rEe="\0CLOSE"+Math.random()+"\0",Qat="\0COMMA"+Math.random()+"\0",Uat="\0PERIOD"+Math.random()+"\0",S7r=new RegExp(Pat,"g"),y7r=new RegExp(Fat,"g"),C7r=new RegExp(rEe,"g"),T7r=new RegExp(Qat,"g"),I7r=new RegExp(Uat,"g"),v7r=/\\\\/g,x7r=/\\{/g,w7r=/\\}/g,R7r=/\\,/g,N7r=/\\\./g,D7r=1e5,O7r=4e6;function eEe(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function B7r(e){return e.replace(v7r,Pat).replace(x7r,Fat).replace(w7r,rEe).replace(R7r,Qat).replace(N7r,Uat)}function M7r(e){return e.replace(S7r,"\\").replace(y7r,"{").replace(C7r,"}").replace(T7r,",").replace(I7r,".")}function Gat(e){if(!e)return[""];let t=[],r=X_e("{","}",e);if(!r)return e.split(",");let{pre:n,body:o,post:i}=r,s=n.split(",");s[s.length-1]+="{"+o+"}";let a=Gat(i);return i.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),t.push.apply(t,s),t}function Hat(e,t={}){if(!e)return[];let{max:r=D7r,maxLength:n=O7r}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),tEe(B7r(e),r,n,!0).map(M7r)}function k7r(e){return"{"+e+"}"}function L7r(e){return/^-?0\d/.test(e)}function P7r(e,t){return e<=t}function F7r(e,t){return e>=t}function NU(e,t,r,n,o,i){let s=[],a=0;for(let l=0;l<e.length;l++)for(let c=0;c<r.length;c++){if(s.length>=n)return s;let u=e[l]+t+r[c];if(!(i&&!u)){if(a+u.length>o)return s;s.push(u),a+=u.length}}return s}function Q7r(e,t,r,n){let o=e.split(/\.\./),i=[];if(o[0]===void 0||o[1]===void 0)return i;let s=eEe(o[0]),a=eEe(o[1]),l=Math.max(o[0].length,o[1].length),c=o.length===3&&o[2]!==void 0?Math.max(Math.abs(eEe(o[2])),1):1,u=P7r;a<s&&(c*=-1,u=F7r);let f=o.some(L7r),p=0;for(let A=s;u(A,a)&&i.length<r;A+=c){let _;if(t)_=String.fromCharCode(A),_==="\\"&&(_="");else if(_=String(A),f){let E=l-_.length;if(E>0){let S=new Array(E+1).join("0");A<0?_="-"+S+_.slice(1):_=S+_}}if(p+_.length>n)break;i.push(_),p+=_.length}return i}function tEe(e,t,r,n){let o=[""],i=!1,s=!0;for(;;){let a=X_e("{","}",e);if(!a)return NU(o,e,[""],t,r,i);let l=a.pre;if(/\$$/.test(l)){if(o=NU(o,l+"{"+a.body+"}",[""],t,r,i&&!a.post.length),s=!1,!a.post.length)break;e=a.post;continue}let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),d=c||u,f=a.body.indexOf(",")>=0;if(!d&&!f){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+rEe+a.post,n=!0;continue}return NU(o,l+"{"+a.body+"}"+a.post,[""],t,r,i)}s&&(i=n&&!d,s=!1);let p;if(d)p=Q7r(a.body,u,t,r);else{let A=Gat(a.body);if(A.length===1&&A[0]!==void 0&&(A=tEe(A[0],t,r,!1).map(k7r),A.length===1)){if(o=NU(o,l+A[0],[""],t,r,i&&!a.post.length),!a.post.length)break;e=a.post;continue}let _=i&&!a.post.length&&!l;for(let S=0;_&&S<o.length;S++)o[S]&&(_=!1);p=[];let E=0;e:for(let S=0;S<A.length;S++){let C=tEe(A[S],t,r,!1);for(let v=0;v<C.length;v++){let R=C[v];if(!(_&&!R)){if(p.length>=t||E+R.length>r)break e;p.push(R),E+=R.length}}}}if(o=NU(o,l,p,t,r,i&&!a.post.length),!a.post.length)break;e=a.post}return o}var DU=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var U7r={"[: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]},OU=e=>e.replace(/[[\]\\-]/g,"\\$&"),G7r=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$at=e=>e.join(""),qat=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],o=[],i=r+1,s=!1,a=!1,l=!1,c=!1,u=r,d="";e:for(;i<e.length;){let _=e.charAt(i);if((_==="!"||_==="^")&&i===r+1){c=!0,i++;continue}if(_==="]"&&s&&!l){u=i+1;break}if(s=!0,_==="\\"&&!l){l=!0,i++;continue}if(_==="["&&!l){for(let[E,[S,C,v]]of Object.entries(U7r))if(e.startsWith(E,i)){if(d)return["$.",!1,e.length-r,!0];i+=E.length,v?o.push(S):n.push(S),a=a||C;continue e}}if(l=!1,d){_>d?n.push(OU(d)+"-"+OU(_)):_===d&&n.push(OU(_)),d="",i++;continue}if(e.startsWith("-]",i+1)){n.push(OU(_+"-")),i+=2;continue}if(e.startsWith("-",i+1)){d=_,i+=2;continue}n.push(OU(_)),i++}if(u<i)return["",!1,0,!1];if(!n.length&&!o.length)return["$.",!1,e.length-r,!0];if(o.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let _=n[0].length===2?n[0].slice(-1):n[0];return[G7r(_),!1,u-r,!1]}let f="["+(c?"^":"")+$at(n)+"]",p="["+(c?"":"^")+$at(o)+"]";return[n.length&&o.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var pC=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?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");var rp,H7r=new Set(["!","?","+","*","@"]),nEe=e=>H7r.has(e),Yat=e=>nEe(e.type),$7r=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),q7r=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Y7r=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),zat=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),z7r="(?!(?:^|/)\\.\\.?(?:$|/))",Jj="(?!\\.)",V7r=new Set(["[","."]),W7r=new Set(["..","."]),j7r=new Set("().*{}+?[]^$\\!"),K7r=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),oEe="[^/]",Vat=oEe+"*?",Wat=oEe+"+?",J7r=0,H1=class{type;#e;#t;#n=!1;#r=[];#i;#o;#l;#s=!1;#a;#d;#m=!1;id=++J7r;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(t,r,n={}){this.type=t,t&&(this.#t=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#l=this.#e===this?[]:this.#e.#l,t==="!"&&!this.#e.#s&&this.#l.push(this),this.#o=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#d!==void 0?this.#d:this.type?this.#d=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#d=this.#r.map(t=>String(t)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let o=r.#o+1;!n.type&&o<n.#r.length;o++)for(let i of t.#r){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(n.#r[o])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof rp&&r.#i===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let t=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#o===0)return!0;let t=this.#i;for(let r=0;r<this.#o;r++){let n=t.#r[r];if(!(n instanceof rp&&n.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 t=this.#i?this.#i.#r.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new rp(this.type,t);for(let n of this.#r)r.copyIn(n);return r}static#c(t,r,n,o,i){let s=o.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(r.type===null){let _=n,E="";for(;_<t.length;){let S=t.charAt(_++);if(a||S==="\\"){a=!a,E+=S;continue}if(l){_===c+1?(S==="^"||S==="!")&&(u=!0):S==="]"&&!(_===c+2&&u)&&(l=!1),E+=S;continue}else if(S==="["){l=!0,c=_,u=!1,E+=S;continue}if(!o.noext&&nEe(S)&&t.charAt(_)==="("&&i<=s){r.push(E),E="";let v=new rp(S,r);_=rp.#c(t,v,_,o,i+1),r.push(v);continue}E+=S}return r.push(E),_}let d=n+1,f=new rp(null,r),p=[],A="";for(;d<t.length;){let _=t.charAt(d++);if(a||_==="\\"){a=!a,A+=_;continue}if(l){d===c+1?(_==="^"||_==="!")&&(u=!0):_==="]"&&!(d===c+2&&u)&&(l=!1),A+=_;continue}else if(_==="["){l=!0,c=d,u=!1,A+=_;continue}if(!o.noext&&nEe(_)&&t.charAt(d)==="("&&(i<=s||r&&r.#_(_))){let S=r&&r.#_(_)?0:1;f.push(A),A="";let C=new rp(_,f);f.push(C),d=rp.#c(t,C,d,o,i+S);continue}if(_==="|"){f.push(A),A="",p.push(f),f=new rp(null,r);continue}if(_===")")return A===""&&r.#r.length===0&&(r.#m=!0),f.push(A),A="",r.push(...p,f),d;A+=_}return r.type=null,r.#t=void 0,r.#r=[t.substring(n-1)],d}#g(t){return this.#A(t,q7r)}#A(t,r=$7r){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null)return!1;let n=t.#r[0];return!n||typeof n!="object"||n.type===null?!1:this.#_(n.type,r)}#_(t,r=Y7r){return!!r.get(this.type)?.includes(t)}#h(t,r){let n=t.#r[0],o=new rp(null,n,this.options);o.#r.push(""),n.push(o),this.#v(t,r)}#v(t,r){let n=t.#r[0];this.#r.splice(r,1,...n.#r);for(let o of n.#r)typeof o=="object"&&(o.#i=this);this.#d=void 0}#b(t){return!!zat.get(this.type)?.has(t)}#C(t){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let r=t.#r[0];return!r||typeof r!="object"||r.type===null?!1:this.#b(r.type)}#T(t){let r=zat.get(this.type),n=t.#r[0],o=r?.get(n.type);if(!o)return!1;this.#r=n.#r;for(let i of this.#r)typeof i=="object"&&(i.#i=this);this.type=o,this.#d=void 0,this.#m=!1}static fromGlob(t,r={}){let n=new rp(null,void 0,r);return rp.#c(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,o,i]=this.toRegExpSource();if(!(o||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#e===this&&(this.#E(),this.#p()),!Yat(this)){let l=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),c=this.#r.map(p=>{let[A,_,E,S]=typeof p=="string"?rp.#y(p,this.#t,l):p.toRegExpSource(t);return this.#t=this.#t||E,this.#n=this.#n||S,A}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&W7r.has(this.#r[0]))){let A=V7r,_=r&&A.has(c.charAt(0))||c.startsWith("\\.")&&A.has(c.charAt(2))||c.startsWith("\\.\\.")&&A.has(c.charAt(4)),E=!r&&!t&&A.has(c.charAt(0));u=_?z7r:E?Jj:""}let d="";return this.isEnd()&&this.#e.#s&&this.#i?.type==="!"&&(d="(?:$|\\/)"),[u+c+d,pC(c),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#S(r);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let l=this.toString(),c=this;return c.#r=[l],c.type=null,c.#t=void 0,[l,pC(this.toString()),!1,!1]}let s=!n||t||r||!Jj?"":this.#S(!0);s===i&&(s=""),s&&(i=`(?:${i})(?:${s})*?`);let a="";if(this.type==="!"&&this.#m)a=(this.isStart()&&!r?Jj:"")+Wat;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Jj:"")+Vat+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=o+i+l}return[a,pC(i),this.#t=!!this.#t,this.#n]}#E(){if(Yat(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#r.length;n++){let o=this.#r[n];typeof o=="object"&&(o.#E(),this.#A(o)?(r=!1,this.#v(o,n)):this.#g(o)?(r=!1,this.#h(o,n)):this.#C(o)&&(r=!1,this.#T(o)))}}while(!r&&++t<10)}else for(let t of this.#r)typeof t=="object"&&t.#E();this.#d=void 0}#S(t){return this.#r.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,o,i,s]=r.toRegExpSource(t);return this.#n=this.#n||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#y(t,r,n=!1){let o=!1,i="",s=!1,a=!1;for(let l=0;l<t.length;l++){let c=t.charAt(l);if(o){o=!1,i+=(j7r.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,i+=n&&/^[*]+$/.test(t)?Wat:Vat,r=!0;continue}else a=!1;if(c==="\\"){l===t.length-1?i+="\\\\":o=!0;continue}if(c==="["){let[u,d,f,p]=qat(t,l);if(f){i+=u,s=s||d,l+=f-1,r=r||p;continue}}if(c==="?"){i+=oEe,r=!0;continue}i+=K7r(c)}return[i,pC(t),!!r,s]}};rp=H1;var iEe=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Bc=(e,t,r={})=>(DU(t),!r.nocomment&&t.charAt(0)==="#"?!1:new vB(t,r).match(e)),Z7r=/^\*+([^+@!?*[(]*)$/,X7r=e=>t=>!t.startsWith(".")&&t.endsWith(e),ejr=e=>t=>t.endsWith(e),tjr=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),rjr=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),njr=/^\*+\.\*+$/,ojr=e=>!e.startsWith(".")&&e.includes("."),ijr=e=>e!=="."&&e!==".."&&e.includes("."),sjr=/^\.\*+$/,ajr=e=>e!=="."&&e!==".."&&e.startsWith("."),ljr=/^\*+$/,cjr=e=>e.length!==0&&!e.startsWith("."),ujr=e=>e.length!==0&&e!=="."&&e!=="..",djr=/^\?+([^+@!?*[(]*)?$/,pjr=([e,t=""])=>{let r=Jat([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},mjr=([e,t=""])=>{let r=Zat([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},fjr=([e,t=""])=>{let r=Zat([e]);return t?n=>r(n)&&n.endsWith(t):r},gjr=([e,t=""])=>{let r=Jat([e]);return t?n=>r(n)&&n.endsWith(t):r},Jat=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},Zat=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},Xat=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jat={win32:{sep:"\\"},posix:{sep:"/"}},hjr=Xat==="win32"?jat.win32.sep:jat.posix.sep;Bc.sep=hjr;var wu=Symbol("globstar **");Bc.GLOBSTAR=wu;var Ajr="[^/]",_jr=Ajr+"*?",Ejr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",bjr="(?:(?!(?:\\/|^)\\.).)*?",Sjr=(e,t={})=>r=>Bc(r,e,t);Bc.filter=Sjr;var Vf=(e,t={})=>Object.assign({},e,t),yjr=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Bc;let t=Bc;return Object.assign((n,o,i={})=>t(n,o,Vf(e,i)),{Minimatch:class extends t.Minimatch{constructor(o,i={}){super(o,Vf(e,i))}static defaults(o){return t.defaults(Vf(e,o)).Minimatch}},AST:class extends t.AST{constructor(o,i,s={}){super(o,i,Vf(e,s))}static fromGlob(o,i={}){return t.AST.fromGlob(o,Vf(e,i))}},unescape:(n,o={})=>t.unescape(n,Vf(e,o)),escape:(n,o={})=>t.escape(n,Vf(e,o)),filter:(n,o={})=>t.filter(n,Vf(e,o)),defaults:n=>t.defaults(Vf(e,n)),makeRe:(n,o={})=>t.makeRe(n,Vf(e,o)),braceExpand:(n,o={})=>t.braceExpand(n,Vf(e,o)),match:(n,o,i={})=>t.match(n,o,Vf(e,i)),sep:t.sep,GLOBSTAR:wu})};Bc.defaults=yjr;var elt=(e,t={})=>(DU(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Hat(e,{max:t.braceExpandMax}));Bc.braceExpand=elt;var Cjr=(e,t={})=>new vB(e,t).makeRe();Bc.makeRe=Cjr;var Tjr=(e,t,r={})=>{let n=new vB(t,r);return e=e.filter(o=>n.match(o)),n.options.nonull&&!e.length&&e.push(t),e};Bc.match=Tjr;var Kat=/[?*]|[+@!]\(.*?\)|\[|\]/,Ijr=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vB=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){DU(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||Xat,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let o=this.globParts.map((i,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=i[0]===""&&i[1]===""&&(i[2]==="?"||!Kat.test(i[2]))&&!Kat.test(i[3]),c=/^[a-z]:/i.test(i[0]);if(l)return[...i.slice(0,4),...i.slice(4).map(u=>this.parse(u))];if(c)return[i[0],...i.slice(1).map(u=>this.parse(u))]}return i.map(l=>this.parse(l))});if(this.debug(this.pattern,o),this.set=o.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let s=this.set[i];s[0]===""&&s[1]===""&&this.globParts[i][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let o=0;o<n.length;o++)n[o]==="**"&&(n[o]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let o=n;for(;r[o+1]==="**";)o++;o!==n&&r.splice(n,o-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,o)=>{let i=n[n.length-1];return o==="**"&&i==="**"?n:o===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(n.pop(),n):(n.push(o),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let o=1;o<t.length-1;o++){let i=t[o];o===1&&i===""&&t[0]===""||(i==="."||i==="")&&(r=!0,t.splice(o,1),o--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let o=t[n-1];o&&o!=="."&&o!==".."&&o!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(o))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let o=-1;for(;(o=n.indexOf("**",o+1))!==-1;){let s=o;for(;n[s+1]==="**";)s++;s>o&&n.splice(o+1,s-o);let a=n[o+1],l=n[o+2],c=n[o+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(o,1);let u=n.slice(0);u[o]="**",t.push(u),o--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let i=0;for(;(i=n.indexOf("..",i+1))!==-1;){let s=n[i-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let l=i===1&&n[i+1]==="**"?["."]:[];n.splice(i-1,2,...l),n.length===0&&n.push(""),i-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let o=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(o){t[r]=[],t[n]=o;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let o=0,i=0,s=[],a="";for(;o<t.length&&i<r.length;)if(t[o]===r[i])s.push(a==="b"?r[i]:t[o]),o++,i++;else if(n&&t[o]==="**"&&r[i]===t[o+1])s.push(t[o]),o++;else if(n&&r[i]==="**"&&t[o]===r[i+1])s.push(r[i]),i++;else if(t[o]==="*"&&r[i]&&(this.options.dot||!r[i].startsWith("."))&&r[i]!=="**"){if(a==="b")return!1;a="a",s.push(t[o]),o++,i++}else if(r[i]==="*"&&t[o]&&(this.options.dot||!t[o].startsWith("."))&&t[o]!=="**"){if(a==="a")return!1;a="b",s.push(r[i]),o++,i++}else return!1;return t.length===r.length&&s}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let o=0;o<t.length&&t.charAt(o)==="!";o++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let o=0,i=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),d=l?3:a?0:void 0,f=u?3:c?0:void 0;if(typeof d=="number"&&typeof f=="number"){let[p,A]=[t[d],r[f]];p.toLowerCase()===A.toLowerCase()&&(r[f]=p,i=f,o=d)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(wu)?this.#e(t,r,n,o,i):this.#n(t,r,n,o,i)}#e(t,r,n,o,i){let s=r.indexOf(wu,i),a=r.lastIndexOf(wu),[l,c,u]=n?[r.slice(i,s),r.slice(s+1),[]]:[r.slice(i,s),r.slice(s+1,a),r.slice(a+1)];if(l.length){let C=t.slice(o,o+l.length);if(!this.#n(C,l,n,0,0))return!1;o+=l.length,i+=l.length}let d=0;if(u.length){if(u.length+o>t.length)return!1;let C=t.length-u.length;if(this.#n(t,u,n,C,0))d=u.length;else{if(t[t.length-1]!==""||o+u.length===t.length||(C--,!this.#n(t,u,n,C,0)))return!1;d=u.length+1}}if(!c.length){let C=!!d;for(let v=o;v<t.length-d;v++){let R=String(t[v]);if(C=!0,R==="."||R===".."||!this.options.dot&&R.startsWith("."))return!1}return n||C}let f=[[[],0]],p=f[0],A=0,_=[0];for(let C of c)C===wu?(_.push(A),p=[[],0],f.push(p)):(p[0].push(C),A++);let E=f.length-1,S=t.length-d;for(let C of f)C[1]=S-(_[E--]+C[0].length);return!!this.#t(t,f,o,0,n,0,!!d)}#t(t,r,n,o,i,s,a){let l=r[o];if(!l){for(let d=n;d<t.length;d++){a=!0;let f=t[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[c,u]=l;for(;n<=u;){if(this.#n(t.slice(0,n+c.length),c,i,n,0)&&s<this.maxGlobstarRecursion){let p=this.#t(t,r,n+c.length,o+1,i,s+1,a);if(p!==!1)return p}let f=t[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return i||null}#n(t,r,n,o,i){let s,a,l,c;for(s=o,a=i,c=t.length,l=r.length;s<c&&a<l;s++,a++){this.debug("matchOne loop");let u=r[a],d=t[s];if(this.debug(r,u,d),u===!1||u===wu)return!1;let f;if(typeof u=="string"?(f=d===u,this.debug("string match",u,d,f)):(f=u.test(d),this.debug("pattern match",u,d,f)),!f)return!1}if(s===c&&a===l)return!0;if(s===c)return n;if(a===l)return s===c-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return elt(this.pattern,this.options)}parse(t){DU(t);let r=this.options;if(t==="**")return wu;if(t==="")return"";let n,o=null;(n=t.match(ljr))?o=r.dot?ujr:cjr:(n=t.match(Z7r))?o=(r.nocase?r.dot?rjr:tjr:r.dot?ejr:X7r)(n[1]):(n=t.match(djr))?o=(r.nocase?r.dot?mjr:pjr:r.dot?fjr:gjr)(n):(n=t.match(njr))?o=r.dot?ijr:ojr:(n=t.match(sjr))&&(o=ajr);let i=H1.fromGlob(t,this.options).toMMPattern();return o&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:o}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?_jr:r.dot?Ejr:bjr,o=new Set(r.nocase?["i"]:[]),i=t.map(l=>{let c=l.map(d=>{if(d instanceof RegExp)for(let f of d.flags.split(""))o.add(f);return typeof d=="string"?Ijr(d):d===wu?wu:d._src});c.forEach((d,f)=>{let p=c[f+1],A=c[f-1];d!==wu||A===wu||(A===void 0?p!==void 0&&p!==wu?c[f+1]="(?:\\/|"+n+"\\/)?"+p:c[f]=n:p===void 0?c[f-1]=A+"(?:\\/|\\/"+n+")?":p!==wu&&(c[f-1]=A+"(?:\\/|\\/"+n+"\\/)"+p,c[f+1]=wu))});let u=c.filter(d=>d!==wu);if(this.partial&&u.length>=1){let d=[];for(let f=1;f<=u.length;f++)d.push(u.slice(0,f).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[s,a]=t.length>1?["(?:",")"]:["",""];i="^"+s+i+a+"$",this.partial&&(i="^(?:\\/|"+s+i.slice(1,-1)+a+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let o=this.slashSplit(t);this.debug(this.pattern,"split",o);let i=this.set;this.debug(this.pattern,"set",i);let s=o[o.length-1];if(!s)for(let a=o.length-2;!s&&a>=0;a--)s=o[a];for(let a of i){let l=o;if(n.matchBase&&a.length===1&&(l=[s]),this.matchOne(l,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Bc.defaults(t).Minimatch}};Bc.AST=H1;Bc.Minimatch=vB;Bc.escape=iEe;Bc.unescape=pC;var nlt=Ie(RU(),1);lr();Pe();we();nd();import{readFile as tlt}from"fs/promises";import{existsSync as sEe,readdirSync as vjr,statSync as xjr}from"fs";import{join as aEe,relative as olt}from"path";import{homedir as wjr}from"os";function rlt(e){try{let t=(0,nlt.default)(e),r=t.data.paths,n=[];return typeof r=="string"?n=r.split(",").map(o=>o.trim()).filter(Boolean):Array.isArray(r)&&(n=r.filter(o=>typeof o=="string")),{paths:n,content:t.content.trim()}}catch(t){return be(t),{paths:[],content:e.trim()}}}function Rjr(e,t){return t.length===0?!0:t.some(r=>{try{return Bc(e,r,{matchBase:!0,dot:!0})}catch(n){return be(n),!1}})}function lEe(e){let t=[];try{if(!sEe(e))return t;let r=vjr(e);for(let n of r){let o=aEe(e,n),i=xjr(o);i.isDirectory()?t.push(...lEe(o)):i.isFile()&&n.endsWith(".md")&&t.push(o)}}catch(r){be(r)}return t}async function Zj(){let e=[];try{let t=aEe(wjr(),Tn,"rules");if(sEe(t)){let r=lEe(t);for(let n of r)try{let o=await tlt(n,"utf-8"),{paths:i,content:s}=rlt(o);i.length>0&&e.push({filePath:n,content:s,paths:i,isProjectRule:!1})}catch(o){be(o)}}}catch(t){be(t)}try{let t=aEe(Oe(),Tn,"rules");if(sEe(t)){let r=lEe(t);for(let n of r)try{let o=await tlt(n,"utf-8"),{paths:i,content:s}=rlt(o);i.length>0&&e.push({filePath:olt(Oe(),n),content:s,paths:i,isProjectRule:!0})}catch(o){be(o)}}}catch(t){be(t)}return e}function ilt(e,t){e=B7(e);let r=B7(Oe()),n=e.startsWith(r)?olt(r,e):e;return t.filter(o=>Rjr(n,o.paths))}function slt(e){return e.length===0?"":e.map(r=>{let n=r.isProjectRule?"project instructions, checked into the codebase":"user's private global instructions for all projects";return`Contents of ${r.filePath} (${n}):
|
|
656
|
+
`)}function uit(e){try{let t=GYr(e),r=t.readSync();return t.closeSync(),r===null}catch(t){return be(`Error checking directory: ${t}`),!1}}Pe();function oC(){let e=Nn();e.hasCompletedProjectOnboarding||ti({...e,hasCompletedProjectOnboarding:!0})}function x_e({workspaceDir:e}){let r=!Nn().hasCompletedProjectOnboarding;if(!r)return null;let n=WYr(jYr(e,Qo)),o=uit(e),i=!n&&!o,s=lB.isEnabled&&!Qr().shiftEnterKeyBindingInstalled,a=re();return(0,h.jsxs)(x,{flexDirection:"column",gap:1,padding:1,paddingBottom:0,children:[r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(I,{color:a.secondaryText,children:"Tips for getting started:"}),(0,h.jsx)(Dc,{children:(()=>{let l=[];return o&&l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Ask ",it," to create a new app or clone a repository."]})},"workspace")),i&&l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Run ",(0,h.jsx)(I,{color:a.text,children:"/init"})," to create a",Qo," file with instructions for Hawa code."]})},"claudemd")),s&&l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Run ",(0,h.jsx)(I,{color:a.text,children:"/terminal-setup"}),(0,h.jsx)(I,{bold:!1,children:" to set up terminal integration"})]})},"terminal")),l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Ask ",it," questions about your codebase."]})},"questions")),l.push((0,h.jsx)(Dc.Item,{children:(0,h.jsxs)(I,{color:a.secondaryText,children:["Ask ",it," to implement changes to your codebase."]})},"changes")),l})()})]}),e===KYr()&&(0,h.jsxs)(I,{color:re().warning,children:["Note: You have launched ",(0,h.jsx)(I,{bold:!0,children:it})," in your home directory. For the best experience, launch it in a project directory instead."]})]})}function w_e({isFocused:e,isSelected:t,smallPointer:r,children:n}){let{styles:o}=Ai("Select");return(0,h.jsxs)(x,{...o.option({isFocused:e}),children:[e&&(0,h.jsx)(I,{...o.focusIndicator(),children:r?nr.triangleDownSmall:nr.pointer}),(0,h.jsx)(I,{...o.label({isFocused:e,isSelected:t}),children:n}),t&&(0,h.jsx)(I,{...o.selectedIndicator(),children:nr.tick})]})}var Xd=Ie(Ve(),1);import{isDeepStrictEqual as JYr}from"node:util";var bU=class extends Map{first;constructor(t){let r=[],n,o,i=0;for(let s of t){let a={...s,previous:o,next:void 0,index:i};o&&(o.next=a),n||=a;let l="value"in s?s.value:R_e(s);r.push([l,a]),i++,o=a}super(r),this.first=n}};var ZYr=(e,t)=>{switch(t.type){case"focus-next-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.next;for(;n&&!("value"in n);)n=n.next;if(!n)return e;if(!(n.index>=e.visibleToIndex))return{...e,focusedValue:n.value};let i=Math.min(e.optionMap.size,e.visibleToIndex+1),s=i-e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:s,visibleToIndex:i}}case"focus-previous-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.previous;for(;n&&!("value"in n);)n=n.previous;if(!n)return e;if(!(n.index<=e.visibleFromIndex))return{...e,focusedValue:n.value};let i=Math.max(0,e.visibleFromIndex-1),s=i+e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:i,visibleToIndex:s}}case"select-focused-option":return{...e,previousValue:e.value,value:e.focusedValue};case"reset":return t.state;case"set-focus":return{...e,focusedValue:t.value}}},N_e=e=>e.flatMap(t=>{if("options"in t){let r=N_e(t.options),n=r.flatMap(i=>"value"in i?i.value:[]);return[...t.header!==void 0?[{header:t.header,optionValues:n}]:[],...r]}return t}),dit=({visibleOptionCount:e,defaultValue:t,options:r})=>{let n=N_e(r),o=typeof e=="number"?Math.min(e,n.length):n.length,i=new bU(n),s=i.first,a=s&&"value"in s?s.value:void 0;return{optionMap:i,visibleOptionCount:o,focusedValue:a,visibleFromIndex:0,visibleToIndex:o,previousValue:t,value:t}},D_e=({visibleOptionCount:e=5,options:t,defaultValue:r,onChange:n,onFocus:o,focusValue:i})=>{let s=N_e(t),[a,l]=(0,Xd.useReducer)(ZYr,{visibleOptionCount:e,defaultValue:r,options:t},dit),[c,u]=(0,Xd.useState)(s);s!==c&&!JYr(s,c)&&(l({type:"reset",state:dit({visibleOptionCount:e,defaultValue:r,options:t})}),u(s));let d=(0,Xd.useCallback)(()=>{l({type:"focus-next-option"})},[]),f=(0,Xd.useCallback)(()=>{l({type:"focus-previous-option"})},[]),p=(0,Xd.useCallback)(()=>{l({type:"select-focused-option"})},[]),A=(0,Xd.useMemo)(()=>s.map((_,E)=>({..._,index:E})).slice(a.visibleFromIndex,a.visibleToIndex),[s,a.visibleFromIndex,a.visibleToIndex]);return(0,Xd.useEffect)(()=>{a.value&&a.previousValue!==a.value&&n?.(a.value)},[a.previousValue,a.value,t,n]),(0,Xd.useEffect)(()=>{a.focusedValue&&o?.(a.focusedValue)},[a.focusedValue,o]),(0,Xd.useEffect)(()=>{i&&l({type:"set-focus",value:i})},[i]),{focusedValue:a.focusedValue,visibleFromIndex:a.visibleFromIndex,visibleToIndex:a.visibleToIndex,value:a.value,visibleOptions:A,focusNextOption:d,focusPreviousOption:f,selectFocusedOption:p}};var O_e=({isDisabled:e=!1,state:t})=>{ft((r,n)=>{n.downArrow&&t.focusNextOption(),n.upArrow&&t.focusPreviousOption(),n.return&&t.selectFocusedOption()},{isActive:!e})};var R_e=e=>`HEADER-${e.optionValues.join(",")}`;function Fb({isDisabled:e=!1,visibleOptionCount:t=5,highlightText:r,options:n,defaultValue:o,onChange:i,onFocus:s,focusValue:a}){let l=D_e({visibleOptionCount:t,options:n,defaultValue:o,onChange:i,onFocus:s,focusValue:a});O_e({isDisabled:e,state:l});let{styles:c}=Ai("Select");return(0,h.jsx)(x,{...c.container(),children:l.visibleOptions.map(u=>{let d="value"in u?u.value:R_e(u),f=!e&&l.focusedValue!==void 0&&("value"in u?l.focusedValue===u.value:u.optionValues.includes(l.focusedValue)),p=!!l.value&&("value"in u?l.value===u.value:u.optionValues.includes(l.value)),A="header"in u,_="label"in u?u.label:u.header,E=_;if(r&&_.includes(r)){let S=_.indexOf(r);E=(0,h.jsxs)(h.Fragment,{children:[_.slice(0,S),(0,h.jsx)(I,{...c.highlightedText(),children:r}),_.slice(S+r.length)]})}return(0,h.jsx)(w_e,{isFocused:f,isSelected:p,smallPointer:A,children:E},d)})})}function pit({onDone:e}){return ft((t,r)=>{(r.ctrl&&(t==="c"||t==="d")||r.escape)&&e()}),(0,h.jsxs)(x,{flexDirection:"column",borderStyle:"round",padding:1,borderColor:re().secondaryBorder,children:[(0,h.jsx)(x,{marginBottom:1,flexDirection:"column",children:(0,h.jsx)(I,{bold:!0,children:"You've spent $5 this session."})}),(0,h.jsx)(x,{children:(0,h.jsx)(Fb,{options:[{value:"ok",label:"Got it, thanks!"}],onChange:e})})]})}var Jt=Ie(Ve(),1);Pe();lr();r_();var tzr="2.7.13",n_={VERSION:tzr,PACKAGE_URL:"@dahawa/hawa-code",README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};var k_e=46,git=["(\u2740\u2579\u25E1\u2579)","(\u25D5\u072B\u25D5)","\u239D(\u25D5u\u25D5)\u23A0","\u10DA(\u25C9\u25DE\u0C6A\u25DF\u25C9 )\u10DA","(\xB4\u25C9\u203F\u25C9\uFF40)","\u0E01\u0E47\u0295\u2022\u0361\u1D25\u2022\u0294 \u0E01\u0E49","\uFF0F/( \u25D5\u203F\u203F\u25D5 )\uFF3C"];function Qj({isDefaultModel:e=!1}){let t=Math.max(k_e,Oe().length+12),r=re(),n=git[Math.floor(Math.random()*git.length)];return(0,h.jsx)(x,{flexDirection:"column",children:(0,h.jsxs)(x,{flexDirection:"column",gap:1,paddingLeft:1,width:"100%",children:[(0,h.jsxs)(I,{children:[(0,h.jsx)(I,{children:n})," Welcome to"," ",(0,h.jsx)(I,{bold:!0,children:it}),(0,h.jsxs)(I,{color:r.secondaryText,children:[" v",n_.VERSION]})]}),(0,h.jsx)(h.Fragment,{children:(0,h.jsxs)(x,{paddingLeft:2,flexDirection:"column",gap:1,children:[(0,h.jsx)(I,{color:r.secondaryText,italic:!0,children:"/help for help"}),(0,h.jsxs)(I,{color:r.secondaryText,children:["cwd: ",Oe()]}),(0,h.jsxs)(I,{color:r.secondaryText,children:["model: ",Jn.getConfig().routing.MODEL?.map(o=>`${o.source}__${o.model}`).join(", ")??"N/A"]}),(0,h.jsxs)(I,{color:r.secondaryText,children:["small fast model: ",Jn.getConfig().routing.SMALL_FAST_MODEL?.map(o=>`${o.source}__${o.model}`).join(", ")??"N/A"]})]})})]})})}we();import{randomUUID as $g}from"crypto";ji();we();er();lr();we();Pe();import{existsSync as Gb,readdirSync as Njr,statSync as Djr}from"fs";import{join as mC,relative as Ojr}from"path";import{homedir as llt}from"os";import{platform as Bjr}from"process";import{readFile as fC}from"fs/promises";lr();um();Kt();import{join as azr,sep as lzr}from"path";function ld(){if(!Oc())return!1;try{let e=Je();if(e.autoMemory?.teamMemoryEnabled!==void 0)return e.autoMemory.teamMemoryEnabled}catch{}return!1}function ep(){return(azr(Oe(),".hcode","team-memory")+lzr).normalize("NFC")}function zf(e){let t=e.normalize("NFC"),r=ep();return t.startsWith(r)}um();var clt=Ie(RU(),1);po();var X_e=(e,t,r)=>{let n=e instanceof RegExp?Lat(e,r):e,o=t instanceof RegExp?Lat(t,r):t,i=n!==null&&o!=null&&b7r(n,o,r);return i&&{start:i[0],end:i[1],pre:r.slice(0,i[0]),body:r.slice(i[0]+n.length,i[1]),post:r.slice(i[1]+o.length)}},Lat=(e,t)=>{let r=t.match(e);return r?r[0]:null},b7r=(e,t,r)=>{let n,o,i,s,a,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(e===t)return[l,c];for(n=[],i=r.length;u>=0&&!a;){if(u===l)n.push(u),l=r.indexOf(e,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,c])}else o=n.pop(),o!==void 0&&o<i&&(i=o,s=c),c=r.indexOf(t,u+1);u=l<c&&l>=0?l:c}n.length&&s!==void 0&&(a=[i,s])}return a};var Pat="\0SLASH"+Math.random()+"\0",Fat="\0OPEN"+Math.random()+"\0",rEe="\0CLOSE"+Math.random()+"\0",Qat="\0COMMA"+Math.random()+"\0",Uat="\0PERIOD"+Math.random()+"\0",S7r=new RegExp(Pat,"g"),y7r=new RegExp(Fat,"g"),C7r=new RegExp(rEe,"g"),T7r=new RegExp(Qat,"g"),I7r=new RegExp(Uat,"g"),v7r=/\\\\/g,x7r=/\\{/g,w7r=/\\}/g,R7r=/\\,/g,N7r=/\\\./g,D7r=1e5,O7r=4e6;function eEe(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function B7r(e){return e.replace(v7r,Pat).replace(x7r,Fat).replace(w7r,rEe).replace(R7r,Qat).replace(N7r,Uat)}function M7r(e){return e.replace(S7r,"\\").replace(y7r,"{").replace(C7r,"}").replace(T7r,",").replace(I7r,".")}function Gat(e){if(!e)return[""];let t=[],r=X_e("{","}",e);if(!r)return e.split(",");let{pre:n,body:o,post:i}=r,s=n.split(",");s[s.length-1]+="{"+o+"}";let a=Gat(i);return i.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),t.push.apply(t,s),t}function Hat(e,t={}){if(!e)return[];let{max:r=D7r,maxLength:n=O7r}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),tEe(B7r(e),r,n,!0).map(M7r)}function k7r(e){return"{"+e+"}"}function L7r(e){return/^-?0\d/.test(e)}function P7r(e,t){return e<=t}function F7r(e,t){return e>=t}function NU(e,t,r,n,o,i){let s=[],a=0;for(let l=0;l<e.length;l++)for(let c=0;c<r.length;c++){if(s.length>=n)return s;let u=e[l]+t+r[c];if(!(i&&!u)){if(a+u.length>o)return s;s.push(u),a+=u.length}}return s}function Q7r(e,t,r,n){let o=e.split(/\.\./),i=[];if(o[0]===void 0||o[1]===void 0)return i;let s=eEe(o[0]),a=eEe(o[1]),l=Math.max(o[0].length,o[1].length),c=o.length===3&&o[2]!==void 0?Math.max(Math.abs(eEe(o[2])),1):1,u=P7r;a<s&&(c*=-1,u=F7r);let f=o.some(L7r),p=0;for(let A=s;u(A,a)&&i.length<r;A+=c){let _;if(t)_=String.fromCharCode(A),_==="\\"&&(_="");else if(_=String(A),f){let E=l-_.length;if(E>0){let S=new Array(E+1).join("0");A<0?_="-"+S+_.slice(1):_=S+_}}if(p+_.length>n)break;i.push(_),p+=_.length}return i}function tEe(e,t,r,n){let o=[""],i=!1,s=!0;for(;;){let a=X_e("{","}",e);if(!a)return NU(o,e,[""],t,r,i);let l=a.pre;if(/\$$/.test(l)){if(o=NU(o,l+"{"+a.body+"}",[""],t,r,i&&!a.post.length),s=!1,!a.post.length)break;e=a.post;continue}let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),d=c||u,f=a.body.indexOf(",")>=0;if(!d&&!f){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+rEe+a.post,n=!0;continue}return NU(o,l+"{"+a.body+"}"+a.post,[""],t,r,i)}s&&(i=n&&!d,s=!1);let p;if(d)p=Q7r(a.body,u,t,r);else{let A=Gat(a.body);if(A.length===1&&A[0]!==void 0&&(A=tEe(A[0],t,r,!1).map(k7r),A.length===1)){if(o=NU(o,l+A[0],[""],t,r,i&&!a.post.length),!a.post.length)break;e=a.post;continue}let _=i&&!a.post.length&&!l;for(let S=0;_&&S<o.length;S++)o[S]&&(_=!1);p=[];let E=0;e:for(let S=0;S<A.length;S++){let C=tEe(A[S],t,r,!1);for(let v=0;v<C.length;v++){let R=C[v];if(!(_&&!R)){if(p.length>=t||E+R.length>r)break e;p.push(R),E+=R.length}}}}if(o=NU(o,l,p,t,r,i&&!a.post.length),!a.post.length)break;e=a.post}return o}var DU=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var U7r={"[: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]},OU=e=>e.replace(/[[\]\\-]/g,"\\$&"),G7r=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),$at=e=>e.join(""),qat=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],o=[],i=r+1,s=!1,a=!1,l=!1,c=!1,u=r,d="";e:for(;i<e.length;){let _=e.charAt(i);if((_==="!"||_==="^")&&i===r+1){c=!0,i++;continue}if(_==="]"&&s&&!l){u=i+1;break}if(s=!0,_==="\\"&&!l){l=!0,i++;continue}if(_==="["&&!l){for(let[E,[S,C,v]]of Object.entries(U7r))if(e.startsWith(E,i)){if(d)return["$.",!1,e.length-r,!0];i+=E.length,v?o.push(S):n.push(S),a=a||C;continue e}}if(l=!1,d){_>d?n.push(OU(d)+"-"+OU(_)):_===d&&n.push(OU(_)),d="",i++;continue}if(e.startsWith("-]",i+1)){n.push(OU(_+"-")),i+=2;continue}if(e.startsWith("-",i+1)){d=_,i+=2;continue}n.push(OU(_)),i++}if(u<i)return["",!1,0,!1];if(!n.length&&!o.length)return["$.",!1,e.length-r,!0];if(o.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let _=n[0].length===2?n[0].slice(-1):n[0];return[G7r(_),!1,u-r,!1]}let f="["+(c?"^":"")+$at(n)+"]",p="["+(c?"":"^")+$at(o)+"]";return[n.length&&o.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var pC=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?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");var rp,H7r=new Set(["!","?","+","*","@"]),nEe=e=>H7r.has(e),Yat=e=>nEe(e.type),$7r=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),q7r=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Y7r=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),zat=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),z7r="(?!(?:^|/)\\.\\.?(?:$|/))",Jj="(?!\\.)",V7r=new Set(["[","."]),W7r=new Set(["..","."]),j7r=new Set("().*{}+?[]^$\\!"),K7r=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),oEe="[^/]",Vat=oEe+"*?",Wat=oEe+"+?",J7r=0,H1=class{type;#e;#t;#n=!1;#r=[];#i;#o;#l;#s=!1;#a;#d;#m=!1;id=++J7r;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(t,r,n={}){this.type=t,t&&(this.#t=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#l=this.#e===this?[]:this.#e.#l,t==="!"&&!this.#e.#s&&this.#l.push(this),this.#o=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#d!==void 0?this.#d:this.type?this.#d=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#d=this.#r.map(t=>String(t)).join("")}#p(){if(this!==this.#e)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let o=r.#o+1;!n.type&&o<n.#r.length;o++)for(let i of t.#r){if(typeof i=="string")throw new Error("string part in extglob AST??");i.copyIn(n.#r[o])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof rp&&r.#i===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let t=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#o===0)return!0;let t=this.#i;for(let r=0;r<this.#o;r++){let n=t.#r[r];if(!(n instanceof rp&&n.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 t=this.#i?this.#i.#r.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new rp(this.type,t);for(let n of this.#r)r.copyIn(n);return r}static#c(t,r,n,o,i){let s=o.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(r.type===null){let _=n,E="";for(;_<t.length;){let S=t.charAt(_++);if(a||S==="\\"){a=!a,E+=S;continue}if(l){_===c+1?(S==="^"||S==="!")&&(u=!0):S==="]"&&!(_===c+2&&u)&&(l=!1),E+=S;continue}else if(S==="["){l=!0,c=_,u=!1,E+=S;continue}if(!o.noext&&nEe(S)&&t.charAt(_)==="("&&i<=s){r.push(E),E="";let v=new rp(S,r);_=rp.#c(t,v,_,o,i+1),r.push(v);continue}E+=S}return r.push(E),_}let d=n+1,f=new rp(null,r),p=[],A="";for(;d<t.length;){let _=t.charAt(d++);if(a||_==="\\"){a=!a,A+=_;continue}if(l){d===c+1?(_==="^"||_==="!")&&(u=!0):_==="]"&&!(d===c+2&&u)&&(l=!1),A+=_;continue}else if(_==="["){l=!0,c=d,u=!1,A+=_;continue}if(!o.noext&&nEe(_)&&t.charAt(d)==="("&&(i<=s||r&&r.#_(_))){let S=r&&r.#_(_)?0:1;f.push(A),A="";let C=new rp(_,f);f.push(C),d=rp.#c(t,C,d,o,i+S);continue}if(_==="|"){f.push(A),A="",p.push(f),f=new rp(null,r);continue}if(_===")")return A===""&&r.#r.length===0&&(r.#m=!0),f.push(A),A="",r.push(...p,f),d;A+=_}return r.type=null,r.#t=void 0,r.#r=[t.substring(n-1)],d}#g(t){return this.#A(t,q7r)}#A(t,r=$7r){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null)return!1;let n=t.#r[0];return!n||typeof n!="object"||n.type===null?!1:this.#_(n.type,r)}#_(t,r=Y7r){return!!r.get(this.type)?.includes(t)}#h(t,r){let n=t.#r[0],o=new rp(null,n,this.options);o.#r.push(""),n.push(o),this.#v(t,r)}#v(t,r){let n=t.#r[0];this.#r.splice(r,1,...n.#r);for(let o of n.#r)typeof o=="object"&&(o.#i=this);this.#d=void 0}#b(t){return!!zat.get(this.type)?.has(t)}#C(t){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let r=t.#r[0];return!r||typeof r!="object"||r.type===null?!1:this.#b(r.type)}#T(t){let r=zat.get(this.type),n=t.#r[0],o=r?.get(n.type);if(!o)return!1;this.#r=n.#r;for(let i of this.#r)typeof i=="object"&&(i.#i=this);this.type=o,this.#d=void 0,this.#m=!1}static fromGlob(t,r={}){let n=new rp(null,void 0,r);return rp.#c(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,o,i]=this.toRegExpSource();if(!(o||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(i?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#e===this&&(this.#E(),this.#p()),!Yat(this)){let l=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),c=this.#r.map(p=>{let[A,_,E,S]=typeof p=="string"?rp.#y(p,this.#t,l):p.toRegExpSource(t);return this.#t=this.#t||E,this.#n=this.#n||S,A}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&W7r.has(this.#r[0]))){let A=V7r,_=r&&A.has(c.charAt(0))||c.startsWith("\\.")&&A.has(c.charAt(2))||c.startsWith("\\.\\.")&&A.has(c.charAt(4)),E=!r&&!t&&A.has(c.charAt(0));u=_?z7r:E?Jj:""}let d="";return this.isEnd()&&this.#e.#s&&this.#i?.type==="!"&&(d="(?:$|\\/)"),[u+c+d,pC(c),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",o=this.type==="!"?"(?:(?!(?:":"(?:",i=this.#S(r);if(this.isStart()&&this.isEnd()&&!i&&this.type!=="!"){let l=this.toString(),c=this;return c.#r=[l],c.type=null,c.#t=void 0,[l,pC(this.toString()),!1,!1]}let s=!n||t||r||!Jj?"":this.#S(!0);s===i&&(s=""),s&&(i=`(?:${i})(?:${s})*?`);let a="";if(this.type==="!"&&this.#m)a=(this.isStart()&&!r?Jj:"")+Wat;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Jj:"")+Vat+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=o+i+l}return[a,pC(i),this.#t=!!this.#t,this.#n]}#E(){if(Yat(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#r.length;n++){let o=this.#r[n];typeof o=="object"&&(o.#E(),this.#A(o)?(r=!1,this.#v(o,n)):this.#g(o)?(r=!1,this.#h(o,n)):this.#C(o)&&(r=!1,this.#T(o)))}}while(!r&&++t<10)}else for(let t of this.#r)typeof t=="object"&&t.#E();this.#d=void 0}#S(t){return this.#r.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,o,i,s]=r.toRegExpSource(t);return this.#n=this.#n||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#y(t,r,n=!1){let o=!1,i="",s=!1,a=!1;for(let l=0;l<t.length;l++){let c=t.charAt(l);if(o){o=!1,i+=(j7r.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,i+=n&&/^[*]+$/.test(t)?Wat:Vat,r=!0;continue}else a=!1;if(c==="\\"){l===t.length-1?i+="\\\\":o=!0;continue}if(c==="["){let[u,d,f,p]=qat(t,l);if(f){i+=u,s=s||d,l+=f-1,r=r||p;continue}}if(c==="?"){i+=oEe,r=!0;continue}i+=K7r(c)}return[i,pC(t),!!r,s]}};rp=H1;var iEe=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var Bc=(e,t,r={})=>(DU(t),!r.nocomment&&t.charAt(0)==="#"?!1:new vB(t,r).match(e)),Z7r=/^\*+([^+@!?*[(]*)$/,X7r=e=>t=>!t.startsWith(".")&&t.endsWith(e),ejr=e=>t=>t.endsWith(e),tjr=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),rjr=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),njr=/^\*+\.\*+$/,ojr=e=>!e.startsWith(".")&&e.includes("."),ijr=e=>e!=="."&&e!==".."&&e.includes("."),sjr=/^\.\*+$/,ajr=e=>e!=="."&&e!==".."&&e.startsWith("."),ljr=/^\*+$/,cjr=e=>e.length!==0&&!e.startsWith("."),ujr=e=>e.length!==0&&e!=="."&&e!=="..",djr=/^\?+([^+@!?*[(]*)?$/,pjr=([e,t=""])=>{let r=Jat([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},mjr=([e,t=""])=>{let r=Zat([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},fjr=([e,t=""])=>{let r=Zat([e]);return t?n=>r(n)&&n.endsWith(t):r},gjr=([e,t=""])=>{let r=Jat([e]);return t?n=>r(n)&&n.endsWith(t):r},Jat=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},Zat=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},Xat=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jat={win32:{sep:"\\"},posix:{sep:"/"}},hjr=Xat==="win32"?jat.win32.sep:jat.posix.sep;Bc.sep=hjr;var wu=Symbol("globstar **");Bc.GLOBSTAR=wu;var Ajr="[^/]",_jr=Ajr+"*?",Ejr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",bjr="(?:(?!(?:\\/|^)\\.).)*?",Sjr=(e,t={})=>r=>Bc(r,e,t);Bc.filter=Sjr;var Vf=(e,t={})=>Object.assign({},e,t),yjr=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Bc;let t=Bc;return Object.assign((n,o,i={})=>t(n,o,Vf(e,i)),{Minimatch:class extends t.Minimatch{constructor(o,i={}){super(o,Vf(e,i))}static defaults(o){return t.defaults(Vf(e,o)).Minimatch}},AST:class extends t.AST{constructor(o,i,s={}){super(o,i,Vf(e,s))}static fromGlob(o,i={}){return t.AST.fromGlob(o,Vf(e,i))}},unescape:(n,o={})=>t.unescape(n,Vf(e,o)),escape:(n,o={})=>t.escape(n,Vf(e,o)),filter:(n,o={})=>t.filter(n,Vf(e,o)),defaults:n=>t.defaults(Vf(e,n)),makeRe:(n,o={})=>t.makeRe(n,Vf(e,o)),braceExpand:(n,o={})=>t.braceExpand(n,Vf(e,o)),match:(n,o,i={})=>t.match(n,o,Vf(e,i)),sep:t.sep,GLOBSTAR:wu})};Bc.defaults=yjr;var elt=(e,t={})=>(DU(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Hat(e,{max:t.braceExpandMax}));Bc.braceExpand=elt;var Cjr=(e,t={})=>new vB(e,t).makeRe();Bc.makeRe=Cjr;var Tjr=(e,t,r={})=>{let n=new vB(t,r);return e=e.filter(o=>n.match(o)),n.options.nonull&&!e.length&&e.push(t),e};Bc.match=Tjr;var Kat=/[?*]|[+@!]\(.*?\)|\[|\]/,Ijr=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vB=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){DU(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||Xat,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...i)=>console.error(...i)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(i=>this.slashSplit(i));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let o=this.globParts.map((i,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=i[0]===""&&i[1]===""&&(i[2]==="?"||!Kat.test(i[2]))&&!Kat.test(i[3]),c=/^[a-z]:/i.test(i[0]);if(l)return[...i.slice(0,4),...i.slice(4).map(u=>this.parse(u))];if(c)return[i[0],...i.slice(1).map(u=>this.parse(u))]}return i.map(l=>this.parse(l))});if(this.debug(this.pattern,o),this.set=o.filter(i=>i.indexOf(!1)===-1),this.isWindows)for(let i=0;i<this.set.length;i++){let s=this.set[i];s[0]===""&&s[1]===""&&this.globParts[i][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let o=0;o<n.length;o++)n[o]==="**"&&(n[o]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let o=n;for(;r[o+1]==="**";)o++;o!==n&&r.splice(n,o-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,o)=>{let i=n[n.length-1];return o==="**"&&i==="**"?n:o===".."&&i&&i!==".."&&i!=="."&&i!=="**"?(n.pop(),n):(n.push(o),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let o=1;o<t.length-1;o++){let i=t[o];o===1&&i===""&&t[0]===""||(i==="."||i==="")&&(r=!0,t.splice(o,1),o--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let o=t[n-1];o&&o!=="."&&o!==".."&&o!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(o))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let o=-1;for(;(o=n.indexOf("**",o+1))!==-1;){let s=o;for(;n[s+1]==="**";)s++;s>o&&n.splice(o+1,s-o);let a=n[o+1],l=n[o+2],c=n[o+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(o,1);let u=n.slice(0);u[o]="**",t.push(u),o--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let i=0;for(;(i=n.indexOf("..",i+1))!==-1;){let s=n[i-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let l=i===1&&n[i+1]==="**"?["."]:[];n.splice(i-1,2,...l),n.length===0&&n.push(""),i-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let o=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(o){t[r]=[],t[n]=o;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let o=0,i=0,s=[],a="";for(;o<t.length&&i<r.length;)if(t[o]===r[i])s.push(a==="b"?r[i]:t[o]),o++,i++;else if(n&&t[o]==="**"&&r[i]===t[o+1])s.push(t[o]),o++;else if(n&&r[i]==="**"&&t[o]===r[i+1])s.push(r[i]),i++;else if(t[o]==="*"&&r[i]&&(this.options.dot||!r[i].startsWith("."))&&r[i]!=="**"){if(a==="b")return!1;a="a",s.push(t[o]),o++,i++}else if(r[i]==="*"&&t[o]&&(this.options.dot||!t[o].startsWith("."))&&t[o]!=="**"){if(a==="a")return!1;a="b",s.push(r[i]),o++,i++}else return!1;return t.length===r.length&&s}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let o=0;o<t.length&&t.charAt(o)==="!";o++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let o=0,i=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),d=l?3:a?0:void 0,f=u?3:c?0:void 0;if(typeof d=="number"&&typeof f=="number"){let[p,A]=[t[d],r[f]];p.toLowerCase()===A.toLowerCase()&&(r[f]=p,i=f,o=d)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(wu)?this.#e(t,r,n,o,i):this.#n(t,r,n,o,i)}#e(t,r,n,o,i){let s=r.indexOf(wu,i),a=r.lastIndexOf(wu),[l,c,u]=n?[r.slice(i,s),r.slice(s+1),[]]:[r.slice(i,s),r.slice(s+1,a),r.slice(a+1)];if(l.length){let C=t.slice(o,o+l.length);if(!this.#n(C,l,n,0,0))return!1;o+=l.length,i+=l.length}let d=0;if(u.length){if(u.length+o>t.length)return!1;let C=t.length-u.length;if(this.#n(t,u,n,C,0))d=u.length;else{if(t[t.length-1]!==""||o+u.length===t.length||(C--,!this.#n(t,u,n,C,0)))return!1;d=u.length+1}}if(!c.length){let C=!!d;for(let v=o;v<t.length-d;v++){let R=String(t[v]);if(C=!0,R==="."||R===".."||!this.options.dot&&R.startsWith("."))return!1}return n||C}let f=[[[],0]],p=f[0],A=0,_=[0];for(let C of c)C===wu?(_.push(A),p=[[],0],f.push(p)):(p[0].push(C),A++);let E=f.length-1,S=t.length-d;for(let C of f)C[1]=S-(_[E--]+C[0].length);return!!this.#t(t,f,o,0,n,0,!!d)}#t(t,r,n,o,i,s,a){let l=r[o];if(!l){for(let d=n;d<t.length;d++){a=!0;let f=t[d];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1}return a}let[c,u]=l;for(;n<=u;){if(this.#n(t.slice(0,n+c.length),c,i,n,0)&&s<this.maxGlobstarRecursion){let p=this.#t(t,r,n+c.length,o+1,i,s+1,a);if(p!==!1)return p}let f=t[n];if(f==="."||f===".."||!this.options.dot&&f.startsWith("."))return!1;n++}return i||null}#n(t,r,n,o,i){let s,a,l,c;for(s=o,a=i,c=t.length,l=r.length;s<c&&a<l;s++,a++){this.debug("matchOne loop");let u=r[a],d=t[s];if(this.debug(r,u,d),u===!1||u===wu)return!1;let f;if(typeof u=="string"?(f=d===u,this.debug("string match",u,d,f)):(f=u.test(d),this.debug("pattern match",u,d,f)),!f)return!1}if(s===c&&a===l)return!0;if(s===c)return n;if(a===l)return s===c-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return elt(this.pattern,this.options)}parse(t){DU(t);let r=this.options;if(t==="**")return wu;if(t==="")return"";let n,o=null;(n=t.match(ljr))?o=r.dot?ujr:cjr:(n=t.match(Z7r))?o=(r.nocase?r.dot?rjr:tjr:r.dot?ejr:X7r)(n[1]):(n=t.match(djr))?o=(r.nocase?r.dot?mjr:pjr:r.dot?fjr:gjr)(n):(n=t.match(njr))?o=r.dot?ijr:ojr:(n=t.match(sjr))&&(o=ajr);let i=H1.fromGlob(t,this.options).toMMPattern();return o&&typeof i=="object"&&Reflect.defineProperty(i,"test",{value:o}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?_jr:r.dot?Ejr:bjr,o=new Set(r.nocase?["i"]:[]),i=t.map(l=>{let c=l.map(d=>{if(d instanceof RegExp)for(let f of d.flags.split(""))o.add(f);return typeof d=="string"?Ijr(d):d===wu?wu:d._src});c.forEach((d,f)=>{let p=c[f+1],A=c[f-1];d!==wu||A===wu||(A===void 0?p!==void 0&&p!==wu?c[f+1]="(?:\\/|"+n+"\\/)?"+p:c[f]=n:p===void 0?c[f-1]=A+"(?:\\/|\\/"+n+")?":p!==wu&&(c[f-1]=A+"(?:\\/|\\/"+n+"\\/)"+p,c[f+1]=wu))});let u=c.filter(d=>d!==wu);if(this.partial&&u.length>=1){let d=[];for(let f=1;f<=u.length;f++)d.push(u.slice(0,f).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[s,a]=t.length>1?["(?:",")"]:["",""];i="^"+s+i+a+"$",this.partial&&(i="^(?:\\/|"+s+i.slice(1,-1)+a+")$"),this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...o].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let o=this.slashSplit(t);this.debug(this.pattern,"split",o);let i=this.set;this.debug(this.pattern,"set",i);let s=o[o.length-1];if(!s)for(let a=o.length-2;!s&&a>=0;a--)s=o[a];for(let a of i){let l=o;if(n.matchBase&&a.length===1&&(l=[s]),this.matchOne(l,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Bc.defaults(t).Minimatch}};Bc.AST=H1;Bc.Minimatch=vB;Bc.escape=iEe;Bc.unescape=pC;var nlt=Ie(RU(),1);lr();Pe();we();nd();import{readFile as tlt}from"fs/promises";import{existsSync as sEe,readdirSync as vjr,statSync as xjr}from"fs";import{join as aEe,relative as olt}from"path";import{homedir as wjr}from"os";function rlt(e){try{let t=(0,nlt.default)(e),r=t.data.paths,n=[];return typeof r=="string"?n=r.split(",").map(o=>o.trim()).filter(Boolean):Array.isArray(r)&&(n=r.filter(o=>typeof o=="string")),{paths:n,content:t.content.trim()}}catch(t){return be(t),{paths:[],content:e.trim()}}}function Rjr(e,t){return t.length===0?!0:t.some(r=>{try{return Bc(e,r,{matchBase:!0,dot:!0})}catch(n){return be(n),!1}})}function lEe(e){let t=[];try{if(!sEe(e))return t;let r=vjr(e);for(let n of r){let o=aEe(e,n),i=xjr(o);i.isDirectory()?t.push(...lEe(o)):i.isFile()&&n.endsWith(".md")&&t.push(o)}}catch(r){be(r)}return t}async function Zj(){let e=[];try{let t=aEe(wjr(),Tn,"rules");if(sEe(t)){let r=lEe(t);for(let n of r)try{let o=await tlt(n,"utf-8"),{paths:i,content:s}=rlt(o);i.length>0&&e.push({filePath:n,content:s,paths:i,isProjectRule:!1})}catch(o){be(o)}}}catch(t){be(t)}try{let t=aEe(Oe(),Tn,"rules");if(sEe(t)){let r=lEe(t);for(let n of r)try{let o=await tlt(n,"utf-8"),{paths:i,content:s}=rlt(o);i.length>0&&e.push({filePath:olt(Oe(),n),content:s,paths:i,isProjectRule:!0})}catch(o){be(o)}}}catch(t){be(t)}return e}function ilt(e,t){e=B7(e);let r=B7(Oe()),n=e.startsWith(r)?olt(r,e):e;return t.filter(o=>Rjr(n,o.paths))}function slt(e){return e.length===0?"":e.map(r=>{let n=r.isProjectRule?"project instructions, checked into the codebase":"user's private global instructions for all projects";return`Contents of ${r.filePath} (${n}):
|
|
657
657
|
|
|
658
658
|
${r.content}`}).join(`
|
|
659
659
|
|
|
@@ -754,7 +754,7 @@ data: ${JSON.stringify(F)}
|
|
|
754
754
|
`);a=O.pop()||"";for(let F of O){let G=F.trim();if(!(!G||G==="data: [DONE]"))if(G.startsWith("data: ")){let P=G.slice(6);try{let $=JSON.parse(P);R($)}catch($){this.logger&&this.logger.error({err:$,line:G},"Failed to parse Gemini SSE chunk")}}else try{let P=JSON.parse(G);R(P)}catch{}}};(async()=>{try{for(;;){let{value:O,done:F}=await s.read();if(F)break;a+=n.decode(O,{stream:!0}),D()}v()}catch(O){i.error(O)}})()}})}convertGeminiResponseToAnthropic(t){this.logger&&this.logger.debug({response:t},"Original Gemini response");try{if(!t.candidates||!t.candidates[0])throw new Error("No candidates found in Gemini response");let r=t.candidates[0],n=[];r.content&&r.content.parts&&r.content.parts.forEach(i=>{if(i.text&&n.push({type:"text",text:i.text}),i.functionCall){let s=`toolu_${jB()}`,a=i.functionCall.thoughtSignature||i.functionCall.thought_signature||null;n.push({type:"tool_use",id:s,name:i.functionCall.name,input:i.functionCall.args||{},thought_signature:a})}}),r.groundingMetadata&&(this.logger&&this.logger.debug({groundingMetadata:r.groundingMetadata},"Processing grounding metadata"),r.groundingMetadata.webSearchQueries&&n.push({type:"text",text:`
|
|
755
755
|
|
|
756
756
|
[Search queries used: ${r.groundingMetadata.webSearchQueries.join(", ")}]`}));let o={id:`msg_${Math.random().toString(36).slice(2)}`,type:"message",role:"assistant",model:t.modelVersion||"gemini",content:n,stop_reason:r.finishReason?r.finishReason==="STOP"&&n.some(i=>i.type==="tool_use")?"tool_use":this.mapGeminiFinishReason(r.finishReason):"end_turn",stop_sequence:null,usage:{input_tokens:t.usageMetadata?.promptTokenCount||0,output_tokens:t.usageMetadata?.candidatesTokenCount||0}};return this.logger&&this.logger.debug({result:o},"Conversion complete, final Anthropic response"),o}catch{throw Jen(`Provider error: ${JSON.stringify(t)}`,500,"provider_error")}}mapGeminiFinishReason(t){switch(t){case"STOP":return"end_turn";case"MAX_TOKENS":return"max_tokens";case"SAFETY":case"RECITATION":return"stop_sequence";default:return"end_turn"}}},ESe=new _Se;var CEt=Ie(bEt(),1);Kt();ji();function Oh(e){return e?typeof e.entries=="function"?Object.fromEntries(e.entries()):{...e}:{}}function SEt(e){let t=String(e?.["x-thinking-level"]??"medium").toLowerCase();return["off","low","medium","high"].includes(t)?t:"medium"}function dAn(e,t){if(t==="off"){delete e.reasoning;return}e.reasoning={effort:t}}function pAn(e,t){if(t==="off"){delete e.reasoning;return}e.reasoning={effort:t,summary:"auto"}}function mAn(e,t="chat"){let r={request:{},response:{},openai:{request:{},response:{}}};return r.request.model=e.request.body.model,r.request.messages=e.request.body.messages,r.request.system=e.request.body.system,r.response.content=e.response.body.content,r.response.usage=e.response.body?.usage,t==="responses"?(r.openai.request.model=e.openai.request.body.model,r.openai.request.input=e.openai.request.body.input,r.openai.response.output=e.openai.response.body?.output,r.openai.response.usage=e.openai.response.body?.usage):(r.openai.request.model=e.openai.request.body.model,r.openai.request.messages=e.openai.request.body.messages,r.openai.response.choices=e.openai.response.body.choices,r.openai.response.usage=e.openai.response.body?.usage),r}function w5(e,t,r){RY(t,e),NY(t,mAn(e,r),r)}function PM(e){let t=[],r=e.getReader(),n,o=new Promise(l=>n=l),i=!1,s=()=>{i||(i=!0,n(Buffer.concat(t).toString("utf8")))};return{stream:new ReadableStream({async pull(l){try{let{done:c,value:u}=await r.read();if(c){l.close(),s();return}t.push(u),l.enqueue(u)}catch(c){l.error(c),s()}},cancel(l){r.cancel(l).catch(()=>{}),s()}}),done:o}}function R5(e){let t=new Headers(e);return t.delete("content-encoding"),t.delete("content-length"),t.delete("transfer-encoding"),t}function VTe(e,t,r,n,o){let i;try{i={type:"error",error:{type:"api_error",message:JSON.parse(o).error?.message??`${e}: ${n}`,code:`${t}_${r}_ERROR`}}}catch{i={type:"error",error:{type:"api_error",message:`${e}: ${n}`,code:`${t}_${r}_ERROR`}}}return new Response(JSON.stringify(i),{status:r,statusText:n,headers:{"Content-Type":"application/json"}})}var yEt=["/v1/messages"];function WTe(e){let t;try{typeof e=="string"?t=new Dx(e):e instanceof Dx?t=e:t=new Dx(e.url)}catch{return""}let r=t.pathname;for(let n of yEt){let o=r.indexOf(n);if(o!==-1)return t.origin+r.slice(0,o)}return t.origin}function BX(e,t){let r=typeof e=="string"?e:e instanceof Dx?e.toString():e.url,n;try{n=new Dx(r).pathname}catch{return!1}return yEt.some(o=>n.includes(o))&&(t.method==="POST"||t.method==="post")}function fAn(e){return async(t,r)=>{if(!BX(t,r))return e(t,r);let n=JSON.parse(r.body),o=await MJ.transformRequestOut(n),i=WTe(t)+"/chat/completions",s=Oh(r.headers),a=s.authorization??s.Authorization??"";dAn(o,SEt(s));let l=await e(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:a},body:JSON.stringify(o),signal:r.signal});if(!l.ok){let E=await l.text();return te(`OpenAI Chat Completions API error: ${l.status}`,{url:i,errorResponse:E}),VTe("OpenAI Chat Completions API error","OPENROUTER",l.status,l.statusText,E)}let c=n.stream===!0,u=s["x-agent-id"],d={request:{url:i,method:r.method,headers:s,body:n},response:{status:l.status,statusText:l.statusText,headers:Oh(l.headers)},openai:{request:{body:o},response:{}}};if(!c){let E=await l.text(),S=new Response(E,{status:l.status,statusText:l.statusText,headers:R5(l.headers)}),C=await MJ.transformResponseIn(S,n),v=await C.text();try{w5({...d,openai:{...d.openai,response:{body:JSON.parse(E)}},response:{...d.response,body:JSON.parse(v)}},u)}catch(R){te("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Chat \u975E\u6D41\u5F0F):",R)}return new Response(v,{status:C.status,statusText:C.statusText,headers:C.headers})}let f=PM(l.body),p=new Response(f.stream,{status:l.status,statusText:l.statusText,headers:R5(l.headers)}),A=await MJ.transformResponseIn(p,n),_=PM(A.body);return Promise.all([f.done,_.done]).then(async([E,S])=>{try{w5({...d,openai:{...d.openai,response:{body:await Kct(E)}},response:{...d.response,body:await b9(S)}},u)}catch(C){te("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Chat \u6D41\u5F0F):"+C?.stack)}}).catch(E=>te("\u65E5\u5FD7\u805A\u5408\u9519\u8BEF(Chat):"+E)),new Response(_.stream,{status:A.status,statusText:A.statusText,headers:A.headers})}}function gAn(e){return async(t,r)=>{if(!BX(t,r))return e(t,r);let n=JSON.parse(r.body),o=await kJ.transformRequestOut(n),i=Oh(r.headers);pAn(o,SEt(i));let s=JSON.stringify(o),l=WTe(t)+"/responses",c=i.authorization??i.Authorization??"";if(!c)return new Response(JSON.stringify({type:"error",error:{type:"api_error",message:"Missing Authorization header",code:"RESPONSES_AUTH_MISSING"}}),{status:401,headers:{"Content-Type":"application/json"}});let u=await e(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:c,"x-api-key":c.replace(/^Bearer\s+/i,"").trim()},body:s,signal:r.signal});if(!u.ok){let C=await u.text();return te(`OpenAI Responses API error: ${u.status} ${u.statusText}`,{url:l,status:u.status,errorResponse:C}),VTe("OpenAI Responses API error","RESPONSES",u.status,u.statusText,C)}let d=n.stream===!0,f=i["x-agent-id"],p={request:{url:l,method:r.method,headers:i,body:n},response:{status:u.status,statusText:u.statusText,headers:Oh(u.headers)},openai:{request:{body:o},response:{}}};if(!d){let C=await u.text(),v=new Response(C,{status:u.status,statusText:u.statusText,headers:R5(u.headers)}),R=await kJ.transformResponseIn(v,n),D=await R.text();try{w5({...p,openai:{...p.openai,response:{body:JSON.parse(C)}},response:{...p.response,body:JSON.parse(D)}},f,"responses")}catch(O){te("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Responses \u975E\u6D41\u5F0F):",O)}return new Response(D,{status:R.status,statusText:R.statusText,headers:R.headers})}let A=PM(u.body),_=new Response(A.stream,{status:u.status,statusText:u.statusText,headers:R5(u.headers)}),E=await kJ.transformResponseIn(_,n),S=PM(E.body);return Promise.all([A.done,S.done]).then(async([C,v])=>{try{w5({...p,openai:{...p.openai,response:{body:await jct(C)}},response:{...p.response,body:await b9(v)}},f,"responses")}catch(R){te("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Responses \u6D41\u5F0F):"+R?.stack)}}).catch(C=>te("\u65E5\u5FD7\u805A\u5408\u9519\u8BEF(Responses):"+C)),new Response(S.stream,{status:E.status,statusText:E.statusText,headers:E.headers})}}function hAn(e){return async(t,r)=>{if(!BX(t,r))return e(t,r);let n=JSON.parse(r.body),o=Oh(r.headers),i=await ESe.transformRequestOut(n),s=JSON.stringify(i),a=WTe(t)+`/models/${n.model}:streamGenerateContent?alt=sse`,l=o.authorization??o.Authorization??"",c;try{c=await e(a,{method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":String(l).replace(/^Bearer\s+/i,"").trim()},body:s,signal:r.signal})}catch(S){throw te("gemini request error:",S),S}if(!c.ok){let S=await c.text();return te(`Gemini API error response: ${c.status} ${c.statusText}`,{url:a,status:c.status,errorResponse:S}),VTe("Gemini API error","Gemini",c.status,c.statusText,S)}let u=n.stream===!0,d=o["x-agent-id"],f={request:{url:a,method:r.method,headers:Oh(r.headers),body:n},response:{status:c.status,statusText:c.statusText,headers:Oh(c.headers)},openai:{request:{body:i},response:{}}},p=PM(c.body),A=new Response(p.stream,{status:c.status,statusText:c.statusText,headers:R5(c.headers)}),_=await ESe.transformResponseIn(A),E=PM(_.body);return Promise.all([p.done,E.done]).then(async([S,C])=>{try{let v=u?Jct(S):JSON.parse(S),R=u?await b9(C):JSON.parse(C);w5({...f,openai:{...f.openai,response:{body:v}},response:{...f.response,body:R}},d)}catch(v){te("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Gemini):"+v?.stack)}}).catch(S=>te("\u65E5\u5FD7\u805A\u5408\u9519\u8BEF(Gemini):"+S)),new Response(E.stream,{status:_.status,statusText:_.statusText,headers:_.headers})}}function AAn(e){return async(t,r)=>{if(!BX(t,r))return e(t,r);let n=r.body;if(r.body)try{let d=JSON.parse(r.body);n=JSON.stringify(d)}catch{}let o=Oh(r.headers);["1","true"].includes(String(process.env.HAWA_CODE_X_API_KEY_DISABLED??"").toLowerCase())&&(delete o["x-api-key"],delete o["X-API-Key"]),["1","true"].includes(String(process.env.HAWA_CODE_AUTH_DISABLED??"").toLowerCase())&&(delete o.authorization,delete o.Authorization),delete o["content-length"];let a=await e(t,{method:r.method,headers:o,body:n,signal:r.signal});if(!a.ok){let d=await a.text();te(`API error response: ${a.status} ${a.statusText}`,{url:typeof t=="string"?t:t instanceof Dx?t.toString():t.url,status:a.status,errorResponse:d});let f;try{let p=JSON.parse(d);f={type:"error",error:{type:"api_error",message:p.error?.message||p.message||`API error: ${a.statusText}`,code:p.error?.code||p.code||`API_${a.status}_ERROR`}},p.error?.details&&(f.error.details=p.error.details)}catch{f={type:"error",error:{type:"api_error",message:`API error: ${a.statusText}`,code:`API_${a.status}_ERROR`}}}return new Response(JSON.stringify(f),{status:a.status,statusText:a.statusText,headers:{"Content-Type":"application/json"}})}let l=a.clone(),c=!(Object.hasOwn(JSON.parse(n),"stream")&&!JSON.parse(n).stream),u={request:{url:typeof t=="string"?t:t instanceof Dx?t.toString():t.url,method:r.method,headers:Oh(r.headers),body:JSON.parse(n)},response:{status:a.status,statusText:a.statusText,headers:Oh(a.headers)}};return(async()=>{if(c){let p=await a.text();u.response.body=await b9(p)}else u.response.body=await a.json();let f=Oh(r.headers)["x-agent-id"];RY(f,u),NY(f,{request:u.request.body.messages,response:u.response.body.content,usage:u.response.body?.usage})})().catch(d=>te(`\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF:
|
|
757
|
-
Stack trace: `+d.stack)),new Response(l.body,{status:a.status,statusText:a.statusText,headers:a.headers})}}var OX=null,zTe=!1;function _An(){OX=null,zTe=!1}Qt.on("proxy:changed",_An);function EAn(){if(zTe)return OX;if(zTe=!0,Je().proxy!==!0)return null;let e=process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.https_proxy||process.env.http_proxy;return e&&(OX=new CEt.ProxyAgent({uri:e}),Dt(`[proxy] using proxy: ${e}`)),OX}function bAn(){let e=EAn();return e?((t,r={})=>global.fetch(t,{...r,dispatcher:e})):global.fetch}function MX(e){let t=e||process.env.API_TYPE,r=bAn();switch(t){case"openai":return fAn(r);case"openai-responses":return gAn(r);case"gemini":return hAn(r);default:return AAn(r)}}r_();we();Pe();Pe();var jTe="2.7.
|
|
757
|
+
Stack trace: `+d.stack)),new Response(l.body,{status:a.status,statusText:a.statusText,headers:a.headers})}}var OX=null,zTe=!1;function _An(){OX=null,zTe=!1}Qt.on("proxy:changed",_An);function EAn(){if(zTe)return OX;if(zTe=!0,Je().proxy!==!0)return null;let e=process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.https_proxy||process.env.http_proxy;return e&&(OX=new CEt.ProxyAgent({uri:e}),Dt(`[proxy] using proxy: ${e}`)),OX}function bAn(){let e=EAn();return e?((t,r={})=>global.fetch(t,{...r,dispatcher:e})):global.fetch}function MX(e){let t=e||process.env.API_TYPE,r=bAn();switch(t){case"openai":return fAn(r);case"openai-responses":return gAn(r);case"gemini":return hAn(r);default:return AAn(r)}}r_();we();Pe();Pe();var jTe="2.7.13";globalThis.MACRO={VERSION:jTe,PACKAGE_URL:`@dahawa/${Uo}`,README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};var kX=process.env.HAWA_CODE_USER_AGENT||`${Uo}/${jTe} (${process.env.USER_TYPE})`;we();we();er();function Du(e,t){let r=[],n=new Set;return e.filter(o=>o.type!=="progress"&&o.type!=="reminder").forEach(o=>{switch(o.type){case"user":{let i=yc(r);if(i?.type==="user"){r[r.length-1]=TEt(i,o);return}r.push(o);return}case"assistant":r.push(o);return;case"insert":{let i=yc(r);i?.type==="user"&&(r[r.length-1]=SAn(i,o));return}case"path_rules":{let i=t?.pathRules;if(!i)return;let s=o.content.paths.filter(u=>!n.has(u));if(s.length===0)return;let a=s.map(u=>i.get(u)).filter(u=>u!==void 0);if(s.forEach(u=>n.add(u)),a.length===0)return;let l=At([{type:"text",text:`<system-rules>
|
|
758
758
|
${slt(a)}
|
|
759
759
|
</system-rules>`}]),c=yc(r);c?.type==="user"?r[r.length-1]=TEt(c,l,{skipTrailingSystemReminders:!0}):r.push(l);return}}}),r}function SAn(e,t){return{...e,message:{...e.message,content:CAn(e.message.content,yAn(t.content.content))}}}function yAn(e){return`
|
|
760
760
|
<system-reminder>
|
package/hands.js
CHANGED
|
@@ -623,7 +623,7 @@ data: ${JSON.stringify(z)}
|
|
|
623
623
|
`);a=M.pop()||"";for(let z of M){let j=z.trim();if(!(!j||j==="data: [DONE]"))if(j.startsWith("data: ")){let L=j.slice(6);try{let V=JSON.parse(L);D(V)}catch(V){this.logger&&this.logger.error({err:V,line:j},"Failed to parse Gemini SSE chunk")}}else try{let L=JSON.parse(j);D(L)}catch{}}};(async()=>{try{for(;;){let{value:M,done:z}=await s.read();if(z)break;a+=n.decode(M,{stream:!0}),N()}T()}catch(M){o.error(M)}})()}})}convertGeminiResponseToAnthropic(t){this.logger&&this.logger.debug({response:t},"Original Gemini response");try{if(!t.candidates||!t.candidates[0])throw new Error("No candidates found in Gemini response");let r=t.candidates[0],n=[];r.content&&r.content.parts&&r.content.parts.forEach(o=>{if(o.text&&n.push({type:"text",text:o.text}),o.functionCall){let s=`toolu_${YN()}`,a=o.functionCall.thoughtSignature||o.functionCall.thought_signature||null;n.push({type:"tool_use",id:s,name:o.functionCall.name,input:o.functionCall.args||{},thought_signature:a})}}),r.groundingMetadata&&(this.logger&&this.logger.debug({groundingMetadata:r.groundingMetadata},"Processing grounding metadata"),r.groundingMetadata.webSearchQueries&&n.push({type:"text",text:`
|
|
624
624
|
|
|
625
625
|
[Search queries used: ${r.groundingMetadata.webSearchQueries.join(", ")}]`}));let i={id:`msg_${Math.random().toString(36).slice(2)}`,type:"message",role:"assistant",model:t.modelVersion||"gemini",content:n,stop_reason:r.finishReason?r.finishReason==="STOP"&&n.some(o=>o.type==="tool_use")?"tool_use":this.mapGeminiFinishReason(r.finishReason):"end_turn",stop_sequence:null,usage:{input_tokens:t.usageMetadata?.promptTokenCount||0,output_tokens:t.usageMetadata?.candidatesTokenCount||0}};return this.logger&&this.logger.debug({result:i},"Conversion complete, final Anthropic response"),i}catch{throw U3r(`Provider error: ${JSON.stringify(t)}`,500,"provider_error")}}mapGeminiFinishReason(t){switch(t){case"STOP":return"end_turn";case"MAX_TOKENS":return"max_tokens";case"SAFETY":case"RECITATION":return"stop_sequence";default:return"end_turn"}}},z_e=new G_e;var Dpt=Re(vpt(),1);Wt();ps();function cg(e){return e?typeof e.entries=="function"?Object.fromEntries(e.entries()):{...e}:{}}function xpt(e){let t=String(e?.["x-thinking-level"]??"medium").toLowerCase();return["off","low","medium","high"].includes(t)?t:"medium"}function een(e,t){if(t==="off"){delete e.reasoning;return}e.reasoning={effort:t}}function ten(e,t){if(t==="off"){delete e.reasoning;return}e.reasoning={effort:t,summary:"auto"}}function ren(e,t="chat"){let r={request:{},response:{},openai:{request:{},response:{}}};return r.request.model=e.request.body.model,r.request.messages=e.request.body.messages,r.request.system=e.request.body.system,r.response.content=e.response.body.content,r.response.usage=e.response.body?.usage,t==="responses"?(r.openai.request.model=e.openai.request.body.model,r.openai.request.input=e.openai.request.body.input,r.openai.response.output=e.openai.response.body?.output,r.openai.response.usage=e.openai.response.body?.usage):(r.openai.request.model=e.openai.request.body.model,r.openai.request.messages=e.openai.request.body.messages,r.openai.response.choices=e.openai.response.body.choices,r.openai.response.usage=e.openai.response.body?.usage),r}function NU(e,t,r){TG(t,e),vG(t,ren(e,r),r)}function MB(e){let t=[],r=e.getReader(),n,i=new Promise(l=>n=l),o=!1,s=()=>{o||(o=!0,n(Buffer.concat(t).toString("utf8")))};return{stream:new ReadableStream({async pull(l){try{let{done:c,value:u}=await r.read();if(c){l.close(),s();return}t.push(u),l.enqueue(u)}catch(c){l.error(c),s()}},cancel(l){r.cancel(l).catch(()=>{}),s()}}),done:i}}function BU(e){let t=new Headers(e);return t.delete("content-encoding"),t.delete("content-length"),t.delete("transfer-encoding"),t}function _1e(e,t,r,n,i){let o;try{o={type:"error",error:{type:"api_error",message:JSON.parse(i).error?.message??`${e}: ${n}`,code:`${t}_${r}_ERROR`}}}catch{o={type:"error",error:{type:"api_error",message:`${e}: ${n}`,code:`${t}_${r}_ERROR`}}}return new Response(JSON.stringify(o),{status:r,statusText:n,headers:{"Content-Type":"application/json"}})}var wpt=["/v1/messages"];function y1e(e){let t;try{typeof e=="string"?t=new QT(e):e instanceof QT?t=e:t=new QT(e.url)}catch{return""}let r=t.pathname;for(let n of wpt){let i=r.indexOf(n);if(i!==-1)return t.origin+r.slice(0,i)}return t.origin}function MJ(e,t){let r=typeof e=="string"?e:e instanceof QT?e.toString():e.url,n;try{n=new QT(r).pathname}catch{return!1}return wpt.some(i=>n.includes(i))&&(t.method==="POST"||t.method==="post")}function nen(e){return async(t,r)=>{if(!MJ(t,r))return e(t,r);let n=JSON.parse(r.body),i=await QW.transformRequestOut(n),o=y1e(t)+"/chat/completions",s=cg(r.headers),a=s.authorization??s.Authorization??"";een(i,xpt(s));let l=await e(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:a},body:JSON.stringify(i),signal:r.signal});if(!l.ok){let y=await l.text();return K(`OpenAI Chat Completions API error: ${l.status}`,{url:o,errorResponse:y}),_1e("OpenAI Chat Completions API error","OPENROUTER",l.status,l.statusText,y)}let c=n.stream===!0,u=s["x-agent-id"],d={request:{url:o,method:r.method,headers:s,body:n},response:{status:l.status,statusText:l.statusText,headers:cg(l.headers)},openai:{request:{body:i},response:{}}};if(!c){let y=await l.text(),C=new Response(y,{status:l.status,statusText:l.statusText,headers:BU(l.headers)}),I=await QW.transformResponseIn(C,n),T=await I.text();try{NU({...d,openai:{...d.openai,response:{body:JSON.parse(y)}},response:{...d.response,body:JSON.parse(T)}},u)}catch(D){K("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Chat \u975E\u6D41\u5F0F):",D)}return new Response(T,{status:I.status,statusText:I.statusText,headers:I.headers})}let g=MB(l.body),m=new Response(g.stream,{status:l.status,statusText:l.statusText,headers:BU(l.headers)}),A=await QW.transformResponseIn(m,n),h=MB(A.body);return Promise.all([g.done,h.done]).then(async([y,C])=>{try{NU({...d,openai:{...d.openai,response:{body:await rit(y)}},response:{...d.response,body:await SF(C)}},u)}catch(I){K("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Chat \u6D41\u5F0F):"+I?.stack)}}).catch(y=>K("\u65E5\u5FD7\u805A\u5408\u9519\u8BEF(Chat):"+y)),new Response(h.stream,{status:A.status,statusText:A.statusText,headers:A.headers})}}function ien(e){return async(t,r)=>{if(!MJ(t,r))return e(t,r);let n=JSON.parse(r.body),i=await PW.transformRequestOut(n),o=cg(r.headers);ten(i,xpt(o));let s=JSON.stringify(i),l=y1e(t)+"/responses",c=o.authorization??o.Authorization??"";if(!c)return new Response(JSON.stringify({type:"error",error:{type:"api_error",message:"Missing Authorization header",code:"RESPONSES_AUTH_MISSING"}}),{status:401,headers:{"Content-Type":"application/json"}});let u=await e(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:c,"x-api-key":c.replace(/^Bearer\s+/i,"").trim()},body:s,signal:r.signal});if(!u.ok){let I=await u.text();return K(`OpenAI Responses API error: ${u.status} ${u.statusText}`,{url:l,status:u.status,errorResponse:I}),_1e("OpenAI Responses API error","RESPONSES",u.status,u.statusText,I)}let d=n.stream===!0,g=o["x-agent-id"],m={request:{url:l,method:r.method,headers:o,body:n},response:{status:u.status,statusText:u.statusText,headers:cg(u.headers)},openai:{request:{body:i},response:{}}};if(!d){let I=await u.text(),T=new Response(I,{status:u.status,statusText:u.statusText,headers:BU(u.headers)}),D=await PW.transformResponseIn(T,n),N=await D.text();try{NU({...m,openai:{...m.openai,response:{body:JSON.parse(I)}},response:{...m.response,body:JSON.parse(N)}},g,"responses")}catch(M){K("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Responses \u975E\u6D41\u5F0F):",M)}return new Response(N,{status:D.status,statusText:D.statusText,headers:D.headers})}let A=MB(u.body),h=new Response(A.stream,{status:u.status,statusText:u.statusText,headers:BU(u.headers)}),y=await PW.transformResponseIn(h,n),C=MB(y.body);return Promise.all([A.done,C.done]).then(async([I,T])=>{try{NU({...m,openai:{...m.openai,response:{body:await tit(I)}},response:{...m.response,body:await SF(T)}},g,"responses")}catch(D){K("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Responses \u6D41\u5F0F):"+D?.stack)}}).catch(I=>K("\u65E5\u5FD7\u805A\u5408\u9519\u8BEF(Responses):"+I)),new Response(C.stream,{status:y.status,statusText:y.statusText,headers:y.headers})}}function oen(e){return async(t,r)=>{if(!MJ(t,r))return e(t,r);let n=JSON.parse(r.body),i=cg(r.headers),o=await z_e.transformRequestOut(n),s=JSON.stringify(o),a=y1e(t)+`/models/${n.model}:streamGenerateContent?alt=sse`,l=i.authorization??i.Authorization??"",c;try{c=await e(a,{method:"POST",headers:{"Content-Type":"application/json","x-goog-api-key":String(l).replace(/^Bearer\s+/i,"").trim()},body:s,signal:r.signal})}catch(C){throw K("gemini request error:",C),C}if(!c.ok){let C=await c.text();return K(`Gemini API error response: ${c.status} ${c.statusText}`,{url:a,status:c.status,errorResponse:C}),_1e("Gemini API error","Gemini",c.status,c.statusText,C)}let u=n.stream===!0,d=i["x-agent-id"],g={request:{url:a,method:r.method,headers:cg(r.headers),body:n},response:{status:c.status,statusText:c.statusText,headers:cg(c.headers)},openai:{request:{body:o},response:{}}},m=MB(c.body),A=new Response(m.stream,{status:c.status,statusText:c.statusText,headers:BU(c.headers)}),h=await z_e.transformResponseIn(A),y=MB(h.body);return Promise.all([m.done,y.done]).then(async([C,I])=>{try{let T=u?nit(C):JSON.parse(C),D=u?await SF(I):JSON.parse(I);NU({...g,openai:{...g.openai,response:{body:T}},response:{...g.response,body:D}},d)}catch(T){K("\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF(Gemini):"+T?.stack)}}).catch(C=>K("\u65E5\u5FD7\u805A\u5408\u9519\u8BEF(Gemini):"+C)),new Response(y.stream,{status:h.status,statusText:h.statusText,headers:h.headers})}}function sen(e){return async(t,r)=>{if(!MJ(t,r))return e(t,r);let n=r.body;if(r.body)try{let d=JSON.parse(r.body);n=JSON.stringify(d)}catch{}let i=cg(r.headers);["1","true"].includes(String(process.env.HAWA_CODE_X_API_KEY_DISABLED??"").toLowerCase())&&(delete i["x-api-key"],delete i["X-API-Key"]),["1","true"].includes(String(process.env.HAWA_CODE_AUTH_DISABLED??"").toLowerCase())&&(delete i.authorization,delete i.Authorization),delete i["content-length"];let a=await e(t,{method:r.method,headers:i,body:n,signal:r.signal});if(!a.ok){let d=await a.text();K(`API error response: ${a.status} ${a.statusText}`,{url:typeof t=="string"?t:t instanceof QT?t.toString():t.url,status:a.status,errorResponse:d});let g;try{let m=JSON.parse(d);g={type:"error",error:{type:"api_error",message:m.error?.message||m.message||`API error: ${a.statusText}`,code:m.error?.code||m.code||`API_${a.status}_ERROR`}},m.error?.details&&(g.error.details=m.error.details)}catch{g={type:"error",error:{type:"api_error",message:`API error: ${a.statusText}`,code:`API_${a.status}_ERROR`}}}return new Response(JSON.stringify(g),{status:a.status,statusText:a.statusText,headers:{"Content-Type":"application/json"}})}let l=a.clone(),c=!(Object.hasOwn(JSON.parse(n),"stream")&&!JSON.parse(n).stream),u={request:{url:typeof t=="string"?t:t instanceof QT?t.toString():t.url,method:r.method,headers:cg(r.headers),body:JSON.parse(n)},response:{status:a.status,statusText:a.statusText,headers:cg(a.headers)}};return(async()=>{if(c){let m=await a.text();u.response.body=await SF(m)}else u.response.body=await a.json();let g=cg(r.headers)["x-agent-id"];TG(g,u),vG(g,{request:u.request.body.messages,response:u.response.body.content,usage:u.response.body?.usage})})().catch(d=>K(`\u65E5\u5FD7\u89E3\u6790\u9519\u8BEF:
|
|
626
|
-
Stack trace: `+d.stack)),new Response(l.body,{status:a.status,statusText:a.statusText,headers:a.headers})}}var kJ=null,E1e=!1;function aen(){kJ=null,E1e=!1}_r.on("proxy:changed",aen);function len(){if(E1e)return kJ;if(E1e=!0,tt().proxy!==!0)return null;let e=process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.https_proxy||process.env.http_proxy;return e&&(kJ=new Dpt.ProxyAgent({uri:e}),Ct(`[proxy] using proxy: ${e}`)),kJ}function cen(){let e=len();return e?((t,r={})=>global.fetch(t,{...r,dispatcher:e})):global.fetch}function QJ(e){let t=e||process.env.API_TYPE,r=cen();switch(t){case"openai":return nen(r);case"openai-responses":return ien(r);case"gemini":return oen(r);default:return sen(r)}}kA();var pen=Re(it(),1);function Rpt(e,t){let r=[],n=Math.max(1,Math.floor(t)),i="",o=0;for(let s of e){let a=uen(s);i&&o+a>n?(r.push(i),i=s,o=a):(i+=s,o+=a)}return i&&r.push(i),r}function uen(e){if(e===" ")return 4;let t=e.codePointAt(0);return t===void 0||t===0||t<32||t>=127&&t<160||den(t)?0:fen(t)?2:1}function den(e){return e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071}function fen(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=127744&&e<=128591||e>=129280&&e<=129535||e>=131072&&e<=262141)}function O0(e){if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),n=(e%6e4/1e3).toFixed(1);return t>0?`${t}h ${r}m ${n}s`:r>0?`${r}m ${n}s`:`${n}s`}function AC(e){return new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e).toLowerCase()}Oe();ps();var Gl={totalCost:0,totalAPIDuration:0,startTime:Date.now(),inputTokens:0,outputTokens:0,cacheCreationTokens:0,cacheReadTokens:0,currentContextTokens:0};function PJ(e,t){Gl.totalCost+=e,Gl.totalAPIDuration+=t}function LJ(e,t){Gl.inputTokens+=e,Gl.outputTokens+=t,_r.emit("token:change",{inputTokens:Gl.inputTokens,outputTokens:Gl.outputTokens})}function FJ(e,t){Gl.cacheCreationTokens+=e,Gl.cacheReadTokens+=t}function b1e(){return{inputTokens:Gl.inputTokens,outputTokens:Gl.outputTokens,cacheCreationTokens:Gl.cacheCreationTokens,cacheReadTokens:Gl.cacheReadTokens}}function Npt(){return Gl.totalCost}function Bpt(){return Date.now()-Gl.startTime}function Opt(){return Gl.totalAPIDuration}function kpt(e){Gl.currentContextTokens=e}function Mpt(){return Gl.currentContextTokens}Oe();$e();$e();var C1e="2.7.12";globalThis.MACRO={VERSION:C1e,PACKAGE_URL:`@dahawa/${Fi}`,README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};var UJ=process.env.HAWA_CODE_USER_AGENT||`${Fi}/${C1e} (${process.env.USER_TYPE})`;import{randomUUID as jh}from"crypto";ps();Oe();er();Ar();Oe();$e();import{existsSync as L0,readdirSync as $in,statSync as Hin}from"fs";import{join as yC,relative as qin}from"path";import{homedir as vAt}from"os";import{platform as Gin}from"process";import{readFile as bC}from"fs/promises";Ar();qp();Wt();import{join as Een,sep as _en}from"path";function Gp(){if(!au())return!1;try{let e=tt();if(e.autoMemory?.teamMemoryEnabled!==void 0)return e.autoMemory.teamMemoryEnabled}catch{}return!1}function Cf(){return(Een(Be(),".hcode","team-memory")+_en).normalize("NFC")}function M0(e){let t=e.normalize("NFC"),r=Cf();return t.startsWith(r)}qp();var xAt=Re($U(),1);Ci();var F1e=(e,t,r)=>{let n=e instanceof RegExp?eAt(e,r):e,i=t instanceof RegExp?eAt(t,r):t,o=n!==null&&i!=null&&Nnn(n,i,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+i.length)}},eAt=(e,t)=>{let r=t.match(e);return r?r[0]:null},Nnn=(e,t,r)=>{let n,i,o,s,a,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(e===t)return[l,c];for(n=[],o=r.length;u>=0&&!a;){if(u===l)n.push(u),l=r.indexOf(e,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,c])}else i=n.pop(),i!==void 0&&i<o&&(o=i,s=c),c=r.indexOf(t,u+1);u=l<c&&l>=0?l:c}n.length&&s!==void 0&&(a=[o,s])}return a};var tAt="\0SLASH"+Math.random()+"\0",rAt="\0OPEN"+Math.random()+"\0",H1e="\0CLOSE"+Math.random()+"\0",nAt="\0COMMA"+Math.random()+"\0",iAt="\0PERIOD"+Math.random()+"\0",Bnn=new RegExp(tAt,"g"),Onn=new RegExp(rAt,"g"),knn=new RegExp(H1e,"g"),Mnn=new RegExp(nAt,"g"),Qnn=new RegExp(iAt,"g"),Pnn=/\\\\/g,Lnn=/\\{/g,Fnn=/\\}/g,Unn=/\\,/g,$nn=/\\\./g,Hnn=1e5,qnn=4e6;function U1e(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Gnn(e){return e.replace(Pnn,tAt).replace(Lnn,rAt).replace(Fnn,H1e).replace(Unn,nAt).replace($nn,iAt)}function znn(e){return e.replace(Bnn,"\\").replace(Onn,"{").replace(knn,"}").replace(Mnn,",").replace(Qnn,".")}function oAt(e){if(!e)return[""];let t=[],r=F1e("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:o}=r,s=n.split(",");s[s.length-1]+="{"+i+"}";let a=oAt(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),t.push.apply(t,s),t}function sAt(e,t={}){if(!e)return[];let{max:r=Hnn,maxLength:n=qnn}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),$1e(Gnn(e),r,n,!0).map(znn)}function jnn(e){return"{"+e+"}"}function Ynn(e){return/^-?0\d/.test(e)}function Vnn(e,t){return e<=t}function Wnn(e,t){return e>=t}function HU(e,t,r,n,i,o){let s=[],a=0;for(let l=0;l<e.length;l++)for(let c=0;c<r.length;c++){if(s.length>=n)return s;let u=e[l]+t+r[c];if(!(o&&!u)){if(a+u.length>i)return s;s.push(u),a+=u.length}}return s}function Knn(e,t,r,n){let i=e.split(/\.\./),o=[];if(i[0]===void 0||i[1]===void 0)return o;let s=U1e(i[0]),a=U1e(i[1]),l=Math.max(i[0].length,i[1].length),c=i.length===3&&i[2]!==void 0?Math.max(Math.abs(U1e(i[2])),1):1,u=Vnn;a<s&&(c*=-1,u=Wnn);let g=i.some(Ynn),m=0;for(let A=s;u(A,a)&&o.length<r;A+=c){let h;if(t)h=String.fromCharCode(A),h==="\\"&&(h="");else if(h=String(A),g){let y=l-h.length;if(y>0){let C=new Array(y+1).join("0");A<0?h="-"+C+h.slice(1):h=C+h}}if(m+h.length>n)break;o.push(h),m+=h.length}return o}function $1e(e,t,r,n){let i=[""],o=!1,s=!0;for(;;){let a=F1e("{","}",e);if(!a)return HU(i,e,[""],t,r,o);let l=a.pre;if(/\$$/.test(l)){if(i=HU(i,l+"{"+a.body+"}",[""],t,r,o&&!a.post.length),s=!1,!a.post.length)break;e=a.post;continue}let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),d=c||u,g=a.body.indexOf(",")>=0;if(!d&&!g){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+H1e+a.post,n=!0;continue}return HU(i,l+"{"+a.body+"}"+a.post,[""],t,r,o)}s&&(o=n&&!d,s=!1);let m;if(d)m=Knn(a.body,u,t,r);else{let A=oAt(a.body);if(A.length===1&&A[0]!==void 0&&(A=$1e(A[0],t,r,!1).map(jnn),A.length===1)){if(i=HU(i,l+A[0],[""],t,r,o&&!a.post.length),!a.post.length)break;e=a.post;continue}let h=o&&!a.post.length&&!l;for(let C=0;h&&C<i.length;C++)i[C]&&(h=!1);m=[];let y=0;e:for(let C=0;C<A.length;C++){let I=$1e(A[C],t,r,!1);for(let T=0;T<I.length;T++){let D=I[T];if(!(h&&!D)){if(m.length>=t||y+D.length>r)break e;m.push(D),y+=D.length}}}}if(i=HU(i,l,m,t,r,o&&!a.post.length),!a.post.length)break;e=a.post}return i}var qU=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Jnn={"[: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]},GU=e=>e.replace(/[[\]\\-]/g,"\\$&"),Znn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),aAt=e=>e.join(""),lAt=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],o=r+1,s=!1,a=!1,l=!1,c=!1,u=r,d="";e:for(;o<e.length;){let h=e.charAt(o);if((h==="!"||h==="^")&&o===r+1){c=!0,o++;continue}if(h==="]"&&s&&!l){u=o+1;break}if(s=!0,h==="\\"&&!l){l=!0,o++;continue}if(h==="["&&!l){for(let[y,[C,I,T]]of Object.entries(Jnn))if(e.startsWith(y,o)){if(d)return["$.",!1,e.length-r,!0];o+=y.length,T?i.push(C):n.push(C),a=a||I;continue e}}if(l=!1,d){h>d?n.push(GU(d)+"-"+GU(h)):h===d&&n.push(GU(h)),d="",o++;continue}if(e.startsWith("-]",o+1)){n.push(GU(h+"-")),o+=2;continue}if(e.startsWith("-",o+1)){d=h,o+=2;continue}n.push(GU(h)),o++}if(u<o)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let h=n[0].length===2?n[0].slice(-1):n[0];return[Znn(h),!1,u-r,!1]}let g="["+(c?"^":"")+aAt(n)+"]",m="["+(c?"":"^")+aAt(i)+"]";return[n.length&&i.length?"("+g+"|"+m+")":n.length?g:m,a,u-r,!0]};var _C=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?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");var fd,Xnn=new Set(["!","?","+","*","@"]),q1e=e=>Xnn.has(e),cAt=e=>q1e(e.type),ein=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),tin=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),rin=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),uAt=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),nin="(?!(?:^|/)\\.\\.?(?:$|/))",XJ="(?!\\.)",iin=new Set(["[","."]),oin=new Set(["..","."]),sin=new Set("().*{}+?[]^$\\!"),ain=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),G1e="[^/]",dAt=G1e+"*?",fAt=G1e+"+?",lin=0,GT=class{type;#e;#t;#n=!1;#r=[];#o;#i;#l;#s=!1;#a;#d;#p=!1;id=++lin;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(t,r,n={}){this.type=t,t&&(this.#t=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#l=this.#e===this?[]:this.#e.#l,t==="!"&&!this.#e.#s&&this.#l.push(this),this.#i=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#d!==void 0?this.#d:this.type?this.#d=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#d=this.#r.map(t=>String(t)).join("")}#f(){if(this!==this.#e)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#o;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#r.length;i++)for(let o of t.#r){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#r[i])}r=n,n=r.#o}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof fd&&r.#o===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let t=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#i===0)return!0;let t=this.#o;for(let r=0;r<this.#i;r++){let n=t.#r[r];if(!(n instanceof fd&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#i===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new fd(this.type,t);for(let n of this.#r)r.copyIn(n);return r}static#c(t,r,n,i,o){let s=i.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(r.type===null){let h=n,y="";for(;h<t.length;){let C=t.charAt(h++);if(a||C==="\\"){a=!a,y+=C;continue}if(l){h===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(h===c+2&&u)&&(l=!1),y+=C;continue}else if(C==="["){l=!0,c=h,u=!1,y+=C;continue}if(!i.noext&&q1e(C)&&t.charAt(h)==="("&&o<=s){r.push(y),y="";let T=new fd(C,r);h=fd.#c(t,T,h,i,o+1),r.push(T);continue}y+=C}return r.push(y),h}let d=n+1,g=new fd(null,r),m=[],A="";for(;d<t.length;){let h=t.charAt(d++);if(a||h==="\\"){a=!a,A+=h;continue}if(l){d===c+1?(h==="^"||h==="!")&&(u=!0):h==="]"&&!(d===c+2&&u)&&(l=!1),A+=h;continue}else if(h==="["){l=!0,c=d,u=!1,A+=h;continue}if(!i.noext&&q1e(h)&&t.charAt(d)==="("&&(o<=s||r&&r.#E(h))){let C=r&&r.#E(h)?0:1;g.push(A),A="";let I=new fd(h,g);g.push(I),d=fd.#c(t,I,d,i,o+C);continue}if(h==="|"){g.push(A),A="",m.push(g),g=new fd(null,r);continue}if(h===")")return A===""&&r.#r.length===0&&(r.#p=!0),g.push(A),A="",r.push(...m,g),d;A+=h}return r.type=null,r.#t=void 0,r.#r=[t.substring(n-1)],d}#g(t){return this.#h(t,tin)}#h(t,r=ein){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null)return!1;let n=t.#r[0];return!n||typeof n!="object"||n.type===null?!1:this.#E(n.type,r)}#E(t,r=rin){return!!r.get(this.type)?.includes(t)}#A(t,r){let n=t.#r[0],i=new fd(null,n,this.options);i.#r.push(""),n.push(i),this.#v(t,r)}#v(t,r){let n=t.#r[0];this.#r.splice(r,1,...n.#r);for(let i of n.#r)typeof i=="object"&&(i.#o=this);this.#d=void 0}#y(t){return!!uAt.get(this.type)?.has(t)}#S(t){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let r=t.#r[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type)}#I(t){let r=uAt.get(this.type),n=t.#r[0],i=r?.get(n.type);if(!i)return!1;this.#r=n.#r;for(let o of this.#r)typeof o=="object"&&(o.#o=this);this.type=i,this.#d=void 0,this.#p=!1}static fromGlob(t,r={}){let n=new fd(null,void 0,r);return fd.#c(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,o]=this.toRegExpSource();if(!(i||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#e===this&&(this.#_(),this.#f()),!cAt(this)){let l=this.isStart()&&this.isEnd()&&!this.#r.some(m=>typeof m!="string"),c=this.#r.map(m=>{let[A,h,y,C]=typeof m=="string"?fd.#C(m,this.#t,l):m.toRegExpSource(t);return this.#t=this.#t||y,this.#n=this.#n||C,A}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&oin.has(this.#r[0]))){let A=iin,h=r&&A.has(c.charAt(0))||c.startsWith("\\.")&&A.has(c.charAt(2))||c.startsWith("\\.\\.")&&A.has(c.charAt(4)),y=!r&&!t&&A.has(c.charAt(0));u=h?nin:y?XJ:""}let d="";return this.isEnd()&&this.#e.#s&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+c+d,_C(c),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#b(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString(),c=this;return c.#r=[l],c.type=null,c.#t=void 0,[l,_C(this.toString()),!1,!1]}let s=!n||t||r||!XJ?"":this.#b(!0);s===o&&(s=""),s&&(o=`(?:${o})(?:${s})*?`);let a="";if(this.type==="!"&&this.#p)a=(this.isStart()&&!r?XJ:"")+fAt;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?XJ:"")+dAt+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=i+o+l}return[a,_C(o),this.#t=!!this.#t,this.#n]}#_(){if(cAt(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#r.length;n++){let i=this.#r[n];typeof i=="object"&&(i.#_(),this.#h(i)?(r=!1,this.#v(i,n)):this.#g(i)?(r=!1,this.#A(i,n)):this.#S(i)&&(r=!1,this.#I(i)))}}while(!r&&++t<10)}else for(let t of this.#r)typeof t=="object"&&t.#_();this.#d=void 0}#b(t){return this.#r.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,o,s]=r.toRegExpSource(t);return this.#n=this.#n||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#C(t,r,n=!1){let i=!1,o="",s=!1,a=!1;for(let l=0;l<t.length;l++){let c=t.charAt(l);if(i){i=!1,o+=(sin.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,o+=n&&/^[*]+$/.test(t)?fAt:dAt,r=!0;continue}else a=!1;if(c==="\\"){l===t.length-1?o+="\\\\":i=!0;continue}if(c==="["){let[u,d,g,m]=lAt(t,l);if(g){o+=u,s=s||d,l+=g-1,r=r||m;continue}}if(c==="?"){o+=G1e,r=!0;continue}o+=ain(c)}return[o,_C(t),!!r,s]}};fd=GT;var z1e=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var jl=(e,t,r={})=>(qU(t),!r.nocomment&&t.charAt(0)==="#"?!1:new zB(t,r).match(e)),cin=/^\*+([^+@!?*[(]*)$/,uin=e=>t=>!t.startsWith(".")&&t.endsWith(e),din=e=>t=>t.endsWith(e),fin=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),pin=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),min=/^\*+\.\*+$/,gin=e=>!e.startsWith(".")&&e.includes("."),Ain=e=>e!=="."&&e!==".."&&e.includes("."),hin=/^\.\*+$/,Ein=e=>e!=="."&&e!==".."&&e.startsWith("."),_in=/^\*+$/,yin=e=>e.length!==0&&!e.startsWith("."),bin=e=>e.length!==0&&e!=="."&&e!=="..",Cin=/^\?+([^+@!?*[(]*)?$/,Sin=([e,t=""])=>{let r=gAt([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},Iin=([e,t=""])=>{let r=AAt([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},Tin=([e,t=""])=>{let r=AAt([e]);return t?n=>r(n)&&n.endsWith(t):r},vin=([e,t=""])=>{let r=gAt([e]);return t?n=>r(n)&&n.endsWith(t):r},gAt=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},AAt=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},hAt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",pAt={win32:{sep:"\\"},posix:{sep:"/"}},xin=hAt==="win32"?pAt.win32.sep:pAt.posix.sep;jl.sep=xin;var vc=Symbol("globstar **");jl.GLOBSTAR=vc;var win="[^/]",Din=win+"*?",Rin="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Nin="(?:(?!(?:\\/|^)\\.).)*?",Bin=(e,t={})=>r=>jl(r,e,t);jl.filter=Bin;var zp=(e,t={})=>Object.assign({},e,t),Oin=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return jl;let t=jl;return Object.assign((n,i,o={})=>t(n,i,zp(e,o)),{Minimatch:class extends t.Minimatch{constructor(i,o={}){super(i,zp(e,o))}static defaults(i){return t.defaults(zp(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,o,s={}){super(i,o,zp(e,s))}static fromGlob(i,o={}){return t.AST.fromGlob(i,zp(e,o))}},unescape:(n,i={})=>t.unescape(n,zp(e,i)),escape:(n,i={})=>t.escape(n,zp(e,i)),filter:(n,i={})=>t.filter(n,zp(e,i)),defaults:n=>t.defaults(zp(e,n)),makeRe:(n,i={})=>t.makeRe(n,zp(e,i)),braceExpand:(n,i={})=>t.braceExpand(n,zp(e,i)),match:(n,i,o={})=>t.match(n,i,zp(e,o)),sep:t.sep,GLOBSTAR:vc})};jl.defaults=Oin;var EAt=(e,t={})=>(qU(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:sAt(e,{max:t.braceExpandMax}));jl.braceExpand=EAt;var kin=(e,t={})=>new zB(e,t).makeRe();jl.makeRe=kin;var Min=(e,t,r={})=>{let n=new zB(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e};jl.match=Min;var mAt=/[?*]|[+@!]\(.*?\)|\[|\]/,Qin=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),zB=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){qU(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||hAt,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!mAt.test(o[2]))&&!mAt.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let s=this.set[o];s[0]===""&&s[1]===""&&this.globParts[o][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let o=n[n.length-1];return i==="**"&&o==="**"?n:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let o=t[i];i===1&&o===""&&t[0]===""||(o==="."||o==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-i);let a=n[i+1],l=n[i+2],c=n[i+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let s=n[o-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let l=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...l),n.length===0&&n.push(""),o-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,o=0,s=[],a="";for(;i<t.length&&o<r.length;)if(t[i]===r[o])s.push(a==="b"?r[o]:t[i]),i++,o++;else if(n&&t[i]==="**"&&r[o]===t[i+1])s.push(t[i]),i++;else if(n&&r[o]==="**"&&t[i]===r[o+1])s.push(r[o]),o++;else if(t[i]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",s.push(t[i]),i++,o++}else if(r[o]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",s.push(r[o]),i++,o++}else return!1;return t.length===r.length&&s}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=0,o=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),d=l?3:a?0:void 0,g=u?3:c?0:void 0;if(typeof d=="number"&&typeof g=="number"){let[m,A]=[t[d],r[g]];m.toLowerCase()===A.toLowerCase()&&(r[g]=m,o=g,i=d)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(vc)?this.#e(t,r,n,i,o):this.#n(t,r,n,i,o)}#e(t,r,n,i,o){let s=r.indexOf(vc,o),a=r.lastIndexOf(vc),[l,c,u]=n?[r.slice(o,s),r.slice(s+1),[]]:[r.slice(o,s),r.slice(s+1,a),r.slice(a+1)];if(l.length){let I=t.slice(i,i+l.length);if(!this.#n(I,l,n,0,0))return!1;i+=l.length,o+=l.length}let d=0;if(u.length){if(u.length+i>t.length)return!1;let I=t.length-u.length;if(this.#n(t,u,n,I,0))d=u.length;else{if(t[t.length-1]!==""||i+u.length===t.length||(I--,!this.#n(t,u,n,I,0)))return!1;d=u.length+1}}if(!c.length){let I=!!d;for(let T=i;T<t.length-d;T++){let D=String(t[T]);if(I=!0,D==="."||D===".."||!this.options.dot&&D.startsWith("."))return!1}return n||I}let g=[[[],0]],m=g[0],A=0,h=[0];for(let I of c)I===vc?(h.push(A),m=[[],0],g.push(m)):(m[0].push(I),A++);let y=g.length-1,C=t.length-d;for(let I of g)I[1]=C-(h[y--]+I[0].length);return!!this.#t(t,g,i,0,n,0,!!d)}#t(t,r,n,i,o,s,a){let l=r[i];if(!l){for(let d=n;d<t.length;d++){a=!0;let g=t[d];if(g==="."||g===".."||!this.options.dot&&g.startsWith("."))return!1}return a}let[c,u]=l;for(;n<=u;){if(this.#n(t.slice(0,n+c.length),c,o,n,0)&&s<this.maxGlobstarRecursion){let m=this.#t(t,r,n+c.length,i+1,o,s+1,a);if(m!==!1)return m}let g=t[n];if(g==="."||g===".."||!this.options.dot&&g.startsWith("."))return!1;n++}return o||null}#n(t,r,n,i,o){let s,a,l,c;for(s=i,a=o,c=t.length,l=r.length;s<c&&a<l;s++,a++){this.debug("matchOne loop");let u=r[a],d=t[s];if(this.debug(r,u,d),u===!1||u===vc)return!1;let g;if(typeof u=="string"?(g=d===u,this.debug("string match",u,d,g)):(g=u.test(d),this.debug("pattern match",u,d,g)),!g)return!1}if(s===c&&a===l)return!0;if(s===c)return n;if(a===l)return s===c-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return EAt(this.pattern,this.options)}parse(t){qU(t);let r=this.options;if(t==="**")return vc;if(t==="")return"";let n,i=null;(n=t.match(_in))?i=r.dot?bin:yin:(n=t.match(cin))?i=(r.nocase?r.dot?pin:fin:r.dot?din:uin)(n[1]):(n=t.match(Cin))?i=(r.nocase?r.dot?Iin:Sin:r.dot?Tin:vin)(n):(n=t.match(min))?i=r.dot?Ain:gin:(n=t.match(hin))&&(i=Ein);let o=GT.fromGlob(t,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?Din:r.dot?Rin:Nin,i=new Set(r.nocase?["i"]:[]),o=t.map(l=>{let c=l.map(d=>{if(d instanceof RegExp)for(let g of d.flags.split(""))i.add(g);return typeof d=="string"?Qin(d):d===vc?vc:d._src});c.forEach((d,g)=>{let m=c[g+1],A=c[g-1];d!==vc||A===vc||(A===void 0?m!==void 0&&m!==vc?c[g+1]="(?:\\/|"+n+"\\/)?"+m:c[g]=n:m===void 0?c[g-1]=A+"(?:\\/|\\/"+n+")?":m!==vc&&(c[g-1]=A+"(?:\\/|\\/"+n+"\\/)"+m,c[g+1]=vc))});let u=c.filter(d=>d!==vc);if(this.partial&&u.length>=1){let d=[];for(let g=1;g<=u.length;g++)d.push(u.slice(0,g).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[s,a]=t.length>1?["(?:",")"]:["",""];o="^"+s+o+a+"$",this.partial&&(o="^(?:\\/|"+s+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let o=this.set;this.debug(this.pattern,"set",o);let s=i[i.length-1];if(!s)for(let a=i.length-2;!s&&a>=0;a--)s=i[a];for(let a of o){let l=i;if(n.matchBase&&a.length===1&&(l=[s]),this.matchOne(l,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return jl.defaults(t).Minimatch}};jl.AST=GT;jl.Minimatch=zB;jl.escape=z1e;jl.unescape=_C;var bAt=Re($U(),1);Ar();$e();Oe();Xc();import{readFile as _At}from"fs/promises";import{existsSync as j1e,readdirSync as Pin,statSync as Lin}from"fs";import{join as Y1e,relative as CAt}from"path";import{homedir as Fin}from"os";function yAt(e){try{let t=(0,bAt.default)(e),r=t.data.paths,n=[];return typeof r=="string"?n=r.split(",").map(i=>i.trim()).filter(Boolean):Array.isArray(r)&&(n=r.filter(i=>typeof i=="string")),{paths:n,content:t.content.trim()}}catch(t){return ve(t),{paths:[],content:e.trim()}}}function Uin(e,t){return t.length===0?!0:t.some(r=>{try{return jl(e,r,{matchBase:!0,dot:!0})}catch(n){return ve(n),!1}})}function V1e(e){let t=[];try{if(!j1e(e))return t;let r=Pin(e);for(let n of r){let i=Y1e(e,n),o=Lin(i);o.isDirectory()?t.push(...V1e(i)):o.isFile()&&n.endsWith(".md")&&t.push(i)}}catch(r){ve(r)}return t}async function eZ(){let e=[];try{let t=Y1e(Fin(),Jr,"rules");if(j1e(t)){let r=V1e(t);for(let n of r)try{let i=await _At(n,"utf-8"),{paths:o,content:s}=yAt(i);o.length>0&&e.push({filePath:n,content:s,paths:o,isProjectRule:!1})}catch(i){ve(i)}}}catch(t){ve(t)}try{let t=Y1e(Be(),Jr,"rules");if(j1e(t)){let r=V1e(t);for(let n of r)try{let i=await _At(n,"utf-8"),{paths:o,content:s}=yAt(i);o.length>0&&e.push({filePath:CAt(Be(),n),content:s,paths:o,isProjectRule:!0})}catch(i){ve(i)}}}catch(t){ve(t)}return e}function SAt(e,t){e=yY(e);let r=yY(Be()),n=e.startsWith(r)?CAt(r,e):e;return t.filter(i=>Uin(n,i.paths))}function IAt(e){return e.length===0?"":e.map(r=>{let n=r.isProjectRule?"project instructions, checked into the codebase":"user's private global instructions for all projects";return`Contents of ${r.filePath} (${n}):
|
|
626
|
+
Stack trace: `+d.stack)),new Response(l.body,{status:a.status,statusText:a.statusText,headers:a.headers})}}var kJ=null,E1e=!1;function aen(){kJ=null,E1e=!1}_r.on("proxy:changed",aen);function len(){if(E1e)return kJ;if(E1e=!0,tt().proxy!==!0)return null;let e=process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.https_proxy||process.env.http_proxy;return e&&(kJ=new Dpt.ProxyAgent({uri:e}),Ct(`[proxy] using proxy: ${e}`)),kJ}function cen(){let e=len();return e?((t,r={})=>global.fetch(t,{...r,dispatcher:e})):global.fetch}function QJ(e){let t=e||process.env.API_TYPE,r=cen();switch(t){case"openai":return nen(r);case"openai-responses":return ien(r);case"gemini":return oen(r);default:return sen(r)}}kA();var pen=Re(it(),1);function Rpt(e,t){let r=[],n=Math.max(1,Math.floor(t)),i="",o=0;for(let s of e){let a=uen(s);i&&o+a>n?(r.push(i),i=s,o=a):(i+=s,o+=a)}return i&&r.push(i),r}function uen(e){if(e===" ")return 4;let t=e.codePointAt(0);return t===void 0||t===0||t<32||t>=127&&t<160||den(t)?0:fen(t)?2:1}function den(e){return e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071}function fen(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=127744&&e<=128591||e>=129280&&e<=129535||e>=131072&&e<=262141)}function O0(e){if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/36e5),r=Math.floor(e%36e5/6e4),n=(e%6e4/1e3).toFixed(1);return t>0?`${t}h ${r}m ${n}s`:r>0?`${r}m ${n}s`:`${n}s`}function AC(e){return new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e).toLowerCase()}Oe();ps();var Gl={totalCost:0,totalAPIDuration:0,startTime:Date.now(),inputTokens:0,outputTokens:0,cacheCreationTokens:0,cacheReadTokens:0,currentContextTokens:0};function PJ(e,t){Gl.totalCost+=e,Gl.totalAPIDuration+=t}function LJ(e,t){Gl.inputTokens+=e,Gl.outputTokens+=t,_r.emit("token:change",{inputTokens:Gl.inputTokens,outputTokens:Gl.outputTokens})}function FJ(e,t){Gl.cacheCreationTokens+=e,Gl.cacheReadTokens+=t}function b1e(){return{inputTokens:Gl.inputTokens,outputTokens:Gl.outputTokens,cacheCreationTokens:Gl.cacheCreationTokens,cacheReadTokens:Gl.cacheReadTokens}}function Npt(){return Gl.totalCost}function Bpt(){return Date.now()-Gl.startTime}function Opt(){return Gl.totalAPIDuration}function kpt(e){Gl.currentContextTokens=e}function Mpt(){return Gl.currentContextTokens}Oe();$e();$e();var C1e="2.7.13";globalThis.MACRO={VERSION:C1e,PACKAGE_URL:`@dahawa/${Fi}`,README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};var UJ=process.env.HAWA_CODE_USER_AGENT||`${Fi}/${C1e} (${process.env.USER_TYPE})`;import{randomUUID as jh}from"crypto";ps();Oe();er();Ar();Oe();$e();import{existsSync as L0,readdirSync as $in,statSync as Hin}from"fs";import{join as yC,relative as qin}from"path";import{homedir as vAt}from"os";import{platform as Gin}from"process";import{readFile as bC}from"fs/promises";Ar();qp();Wt();import{join as Een,sep as _en}from"path";function Gp(){if(!au())return!1;try{let e=tt();if(e.autoMemory?.teamMemoryEnabled!==void 0)return e.autoMemory.teamMemoryEnabled}catch{}return!1}function Cf(){return(Een(Be(),".hcode","team-memory")+_en).normalize("NFC")}function M0(e){let t=e.normalize("NFC"),r=Cf();return t.startsWith(r)}qp();var xAt=Re($U(),1);Ci();var F1e=(e,t,r)=>{let n=e instanceof RegExp?eAt(e,r):e,i=t instanceof RegExp?eAt(t,r):t,o=n!==null&&i!=null&&Nnn(n,i,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+i.length)}},eAt=(e,t)=>{let r=t.match(e);return r?r[0]:null},Nnn=(e,t,r)=>{let n,i,o,s,a,l=r.indexOf(e),c=r.indexOf(t,l+1),u=l;if(l>=0&&c>0){if(e===t)return[l,c];for(n=[],o=r.length;u>=0&&!a;){if(u===l)n.push(u),l=r.indexOf(e,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,c])}else i=n.pop(),i!==void 0&&i<o&&(o=i,s=c),c=r.indexOf(t,u+1);u=l<c&&l>=0?l:c}n.length&&s!==void 0&&(a=[o,s])}return a};var tAt="\0SLASH"+Math.random()+"\0",rAt="\0OPEN"+Math.random()+"\0",H1e="\0CLOSE"+Math.random()+"\0",nAt="\0COMMA"+Math.random()+"\0",iAt="\0PERIOD"+Math.random()+"\0",Bnn=new RegExp(tAt,"g"),Onn=new RegExp(rAt,"g"),knn=new RegExp(H1e,"g"),Mnn=new RegExp(nAt,"g"),Qnn=new RegExp(iAt,"g"),Pnn=/\\\\/g,Lnn=/\\{/g,Fnn=/\\}/g,Unn=/\\,/g,$nn=/\\\./g,Hnn=1e5,qnn=4e6;function U1e(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Gnn(e){return e.replace(Pnn,tAt).replace(Lnn,rAt).replace(Fnn,H1e).replace(Unn,nAt).replace($nn,iAt)}function znn(e){return e.replace(Bnn,"\\").replace(Onn,"{").replace(knn,"}").replace(Mnn,",").replace(Qnn,".")}function oAt(e){if(!e)return[""];let t=[],r=F1e("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:o}=r,s=n.split(",");s[s.length-1]+="{"+i+"}";let a=oAt(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),t.push.apply(t,s),t}function sAt(e,t={}){if(!e)return[];let{max:r=Hnn,maxLength:n=qnn}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),$1e(Gnn(e),r,n,!0).map(znn)}function jnn(e){return"{"+e+"}"}function Ynn(e){return/^-?0\d/.test(e)}function Vnn(e,t){return e<=t}function Wnn(e,t){return e>=t}function HU(e,t,r,n,i,o){let s=[],a=0;for(let l=0;l<e.length;l++)for(let c=0;c<r.length;c++){if(s.length>=n)return s;let u=e[l]+t+r[c];if(!(o&&!u)){if(a+u.length>i)return s;s.push(u),a+=u.length}}return s}function Knn(e,t,r,n){let i=e.split(/\.\./),o=[];if(i[0]===void 0||i[1]===void 0)return o;let s=U1e(i[0]),a=U1e(i[1]),l=Math.max(i[0].length,i[1].length),c=i.length===3&&i[2]!==void 0?Math.max(Math.abs(U1e(i[2])),1):1,u=Vnn;a<s&&(c*=-1,u=Wnn);let g=i.some(Ynn),m=0;for(let A=s;u(A,a)&&o.length<r;A+=c){let h;if(t)h=String.fromCharCode(A),h==="\\"&&(h="");else if(h=String(A),g){let y=l-h.length;if(y>0){let C=new Array(y+1).join("0");A<0?h="-"+C+h.slice(1):h=C+h}}if(m+h.length>n)break;o.push(h),m+=h.length}return o}function $1e(e,t,r,n){let i=[""],o=!1,s=!0;for(;;){let a=F1e("{","}",e);if(!a)return HU(i,e,[""],t,r,o);let l=a.pre;if(/\$$/.test(l)){if(i=HU(i,l+"{"+a.body+"}",[""],t,r,o&&!a.post.length),s=!1,!a.post.length)break;e=a.post;continue}let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),d=c||u,g=a.body.indexOf(",")>=0;if(!d&&!g){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+H1e+a.post,n=!0;continue}return HU(i,l+"{"+a.body+"}"+a.post,[""],t,r,o)}s&&(o=n&&!d,s=!1);let m;if(d)m=Knn(a.body,u,t,r);else{let A=oAt(a.body);if(A.length===1&&A[0]!==void 0&&(A=$1e(A[0],t,r,!1).map(jnn),A.length===1)){if(i=HU(i,l+A[0],[""],t,r,o&&!a.post.length),!a.post.length)break;e=a.post;continue}let h=o&&!a.post.length&&!l;for(let C=0;h&&C<i.length;C++)i[C]&&(h=!1);m=[];let y=0;e:for(let C=0;C<A.length;C++){let I=$1e(A[C],t,r,!1);for(let T=0;T<I.length;T++){let D=I[T];if(!(h&&!D)){if(m.length>=t||y+D.length>r)break e;m.push(D),y+=D.length}}}}if(i=HU(i,l,m,t,r,o&&!a.post.length),!a.post.length)break;e=a.post}return i}var qU=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Jnn={"[: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]},GU=e=>e.replace(/[[\]\\-]/g,"\\$&"),Znn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),aAt=e=>e.join(""),lAt=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],o=r+1,s=!1,a=!1,l=!1,c=!1,u=r,d="";e:for(;o<e.length;){let h=e.charAt(o);if((h==="!"||h==="^")&&o===r+1){c=!0,o++;continue}if(h==="]"&&s&&!l){u=o+1;break}if(s=!0,h==="\\"&&!l){l=!0,o++;continue}if(h==="["&&!l){for(let[y,[C,I,T]]of Object.entries(Jnn))if(e.startsWith(y,o)){if(d)return["$.",!1,e.length-r,!0];o+=y.length,T?i.push(C):n.push(C),a=a||I;continue e}}if(l=!1,d){h>d?n.push(GU(d)+"-"+GU(h)):h===d&&n.push(GU(h)),d="",o++;continue}if(e.startsWith("-]",o+1)){n.push(GU(h+"-")),o+=2;continue}if(e.startsWith("-",o+1)){d=h,o+=2;continue}n.push(GU(h)),o++}if(u<o)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let h=n[0].length===2?n[0].slice(-1):n[0];return[Znn(h),!1,u-r,!1]}let g="["+(c?"^":"")+aAt(n)+"]",m="["+(c?"":"^")+aAt(i)+"]";return[n.length&&i.length?"("+g+"|"+m+")":n.length?g:m,a,u-r,!0]};var _C=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?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");var fd,Xnn=new Set(["!","?","+","*","@"]),q1e=e=>Xnn.has(e),cAt=e=>q1e(e.type),ein=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),tin=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),rin=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),uAt=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),nin="(?!(?:^|/)\\.\\.?(?:$|/))",XJ="(?!\\.)",iin=new Set(["[","."]),oin=new Set(["..","."]),sin=new Set("().*{}+?[]^$\\!"),ain=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),G1e="[^/]",dAt=G1e+"*?",fAt=G1e+"+?",lin=0,GT=class{type;#e;#t;#n=!1;#r=[];#o;#i;#l;#s=!1;#a;#d;#p=!1;id=++lin;get depth(){return(this.#o?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#o?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(t,r,n={}){this.type=t,t&&(this.#t=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#a=this.#e===this?n:this.#e.#a,this.#l=this.#e===this?[]:this.#e.#l,t==="!"&&!this.#e.#s&&this.#l.push(this),this.#i=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#d!==void 0?this.#d:this.type?this.#d=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#d=this.#r.map(t=>String(t)).join("")}#f(){if(this!==this.#e)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#o;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#r.length;i++)for(let o of t.#r){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#r[i])}r=n,n=r.#o}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof fd&&r.#o===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let t=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#i===0)return!0;let t=this.#o;for(let r=0;r<this.#i;r++){let n=t.#r[r];if(!(n instanceof fd&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#i===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new fd(this.type,t);for(let n of this.#r)r.copyIn(n);return r}static#c(t,r,n,i,o){let s=i.maxExtglobRecursion??2,a=!1,l=!1,c=-1,u=!1;if(r.type===null){let h=n,y="";for(;h<t.length;){let C=t.charAt(h++);if(a||C==="\\"){a=!a,y+=C;continue}if(l){h===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(h===c+2&&u)&&(l=!1),y+=C;continue}else if(C==="["){l=!0,c=h,u=!1,y+=C;continue}if(!i.noext&&q1e(C)&&t.charAt(h)==="("&&o<=s){r.push(y),y="";let T=new fd(C,r);h=fd.#c(t,T,h,i,o+1),r.push(T);continue}y+=C}return r.push(y),h}let d=n+1,g=new fd(null,r),m=[],A="";for(;d<t.length;){let h=t.charAt(d++);if(a||h==="\\"){a=!a,A+=h;continue}if(l){d===c+1?(h==="^"||h==="!")&&(u=!0):h==="]"&&!(d===c+2&&u)&&(l=!1),A+=h;continue}else if(h==="["){l=!0,c=d,u=!1,A+=h;continue}if(!i.noext&&q1e(h)&&t.charAt(d)==="("&&(o<=s||r&&r.#E(h))){let C=r&&r.#E(h)?0:1;g.push(A),A="";let I=new fd(h,g);g.push(I),d=fd.#c(t,I,d,i,o+C);continue}if(h==="|"){g.push(A),A="",m.push(g),g=new fd(null,r);continue}if(h===")")return A===""&&r.#r.length===0&&(r.#p=!0),g.push(A),A="",r.push(...m,g),d;A+=h}return r.type=null,r.#t=void 0,r.#r=[t.substring(n-1)],d}#g(t){return this.#h(t,tin)}#h(t,r=ein){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null)return!1;let n=t.#r[0];return!n||typeof n!="object"||n.type===null?!1:this.#E(n.type,r)}#E(t,r=rin){return!!r.get(this.type)?.includes(t)}#A(t,r){let n=t.#r[0],i=new fd(null,n,this.options);i.#r.push(""),n.push(i),this.#v(t,r)}#v(t,r){let n=t.#r[0];this.#r.splice(r,1,...n.#r);for(let i of n.#r)typeof i=="object"&&(i.#o=this);this.#d=void 0}#y(t){return!!uAt.get(this.type)?.has(t)}#S(t){if(!t||typeof t!="object"||t.type!==null||t.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let r=t.#r[0];return!r||typeof r!="object"||r.type===null?!1:this.#y(r.type)}#I(t){let r=uAt.get(this.type),n=t.#r[0],i=r?.get(n.type);if(!i)return!1;this.#r=n.#r;for(let o of this.#r)typeof o=="object"&&(o.#o=this);this.type=i,this.#d=void 0,this.#p=!1}static fromGlob(t,r={}){let n=new fd(null,void 0,r);return fd.#c(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,o]=this.toRegExpSource();if(!(i||this.#t||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#a.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#a}toRegExpSource(t){let r=t??!!this.#a.dot;if(this.#e===this&&(this.#_(),this.#f()),!cAt(this)){let l=this.isStart()&&this.isEnd()&&!this.#r.some(m=>typeof m!="string"),c=this.#r.map(m=>{let[A,h,y,C]=typeof m=="string"?fd.#C(m,this.#t,l):m.toRegExpSource(t);return this.#t=this.#t||y,this.#n=this.#n||C,A}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&oin.has(this.#r[0]))){let A=iin,h=r&&A.has(c.charAt(0))||c.startsWith("\\.")&&A.has(c.charAt(2))||c.startsWith("\\.\\.")&&A.has(c.charAt(4)),y=!r&&!t&&A.has(c.charAt(0));u=h?nin:y?XJ:""}let d="";return this.isEnd()&&this.#e.#s&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+c+d,_C(c),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#b(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString(),c=this;return c.#r=[l],c.type=null,c.#t=void 0,[l,_C(this.toString()),!1,!1]}let s=!n||t||r||!XJ?"":this.#b(!0);s===o&&(s=""),s&&(o=`(?:${o})(?:${s})*?`);let a="";if(this.type==="!"&&this.#p)a=(this.isStart()&&!r?XJ:"")+fAt;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?XJ:"")+dAt+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=i+o+l}return[a,_C(o),this.#t=!!this.#t,this.#n]}#_(){if(cAt(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#r.length;n++){let i=this.#r[n];typeof i=="object"&&(i.#_(),this.#h(i)?(r=!1,this.#v(i,n)):this.#g(i)?(r=!1,this.#A(i,n)):this.#S(i)&&(r=!1,this.#I(i)))}}while(!r&&++t<10)}else for(let t of this.#r)typeof t=="object"&&t.#_();this.#d=void 0}#b(t){return this.#r.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,o,s]=r.toRegExpSource(t);return this.#n=this.#n||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#C(t,r,n=!1){let i=!1,o="",s=!1,a=!1;for(let l=0;l<t.length;l++){let c=t.charAt(l);if(i){i=!1,o+=(sin.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,o+=n&&/^[*]+$/.test(t)?fAt:dAt,r=!0;continue}else a=!1;if(c==="\\"){l===t.length-1?o+="\\\\":i=!0;continue}if(c==="["){let[u,d,g,m]=lAt(t,l);if(g){o+=u,s=s||d,l+=g-1,r=r||m;continue}}if(c==="?"){o+=G1e,r=!0;continue}o+=ain(c)}return[o,_C(t),!!r,s]}};fd=GT;var z1e=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var jl=(e,t,r={})=>(qU(t),!r.nocomment&&t.charAt(0)==="#"?!1:new zB(t,r).match(e)),cin=/^\*+([^+@!?*[(]*)$/,uin=e=>t=>!t.startsWith(".")&&t.endsWith(e),din=e=>t=>t.endsWith(e),fin=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),pin=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),min=/^\*+\.\*+$/,gin=e=>!e.startsWith(".")&&e.includes("."),Ain=e=>e!=="."&&e!==".."&&e.includes("."),hin=/^\.\*+$/,Ein=e=>e!=="."&&e!==".."&&e.startsWith("."),_in=/^\*+$/,yin=e=>e.length!==0&&!e.startsWith("."),bin=e=>e.length!==0&&e!=="."&&e!=="..",Cin=/^\?+([^+@!?*[(]*)?$/,Sin=([e,t=""])=>{let r=gAt([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},Iin=([e,t=""])=>{let r=AAt([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},Tin=([e,t=""])=>{let r=AAt([e]);return t?n=>r(n)&&n.endsWith(t):r},vin=([e,t=""])=>{let r=gAt([e]);return t?n=>r(n)&&n.endsWith(t):r},gAt=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},AAt=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},hAt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",pAt={win32:{sep:"\\"},posix:{sep:"/"}},xin=hAt==="win32"?pAt.win32.sep:pAt.posix.sep;jl.sep=xin;var vc=Symbol("globstar **");jl.GLOBSTAR=vc;var win="[^/]",Din=win+"*?",Rin="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Nin="(?:(?!(?:\\/|^)\\.).)*?",Bin=(e,t={})=>r=>jl(r,e,t);jl.filter=Bin;var zp=(e,t={})=>Object.assign({},e,t),Oin=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return jl;let t=jl;return Object.assign((n,i,o={})=>t(n,i,zp(e,o)),{Minimatch:class extends t.Minimatch{constructor(i,o={}){super(i,zp(e,o))}static defaults(i){return t.defaults(zp(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,o,s={}){super(i,o,zp(e,s))}static fromGlob(i,o={}){return t.AST.fromGlob(i,zp(e,o))}},unescape:(n,i={})=>t.unescape(n,zp(e,i)),escape:(n,i={})=>t.escape(n,zp(e,i)),filter:(n,i={})=>t.filter(n,zp(e,i)),defaults:n=>t.defaults(zp(e,n)),makeRe:(n,i={})=>t.makeRe(n,zp(e,i)),braceExpand:(n,i={})=>t.braceExpand(n,zp(e,i)),match:(n,i,o={})=>t.match(n,i,zp(e,o)),sep:t.sep,GLOBSTAR:vc})};jl.defaults=Oin;var EAt=(e,t={})=>(qU(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:sAt(e,{max:t.braceExpandMax}));jl.braceExpand=EAt;var kin=(e,t={})=>new zB(e,t).makeRe();jl.makeRe=kin;var Min=(e,t,r={})=>{let n=new zB(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e};jl.match=Min;var mAt=/[?*]|[+@!]\(.*?\)|\[|\]/,Qin=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),zB=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){qU(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||hAt,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!mAt.test(o[2]))&&!mAt.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let s=this.set[o];s[0]===""&&s[1]===""&&this.globParts[o][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let o=n[n.length-1];return i==="**"&&o==="**"?n:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let o=t[i];i===1&&o===""&&t[0]===""||(o==="."||o==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-i);let a=n[i+1],l=n[i+2],c=n[i+3];if(a!==".."||!l||l==="."||l===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let s=n[o-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let l=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...l),n.length===0&&n.push(""),o-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,o=0,s=[],a="";for(;i<t.length&&o<r.length;)if(t[i]===r[o])s.push(a==="b"?r[o]:t[i]),i++,o++;else if(n&&t[i]==="**"&&r[o]===t[i+1])s.push(t[i]),i++;else if(n&&r[o]==="**"&&t[i]===r[o+1])s.push(r[o]),o++;else if(t[i]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",s.push(t[i]),i++,o++}else if(r[o]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",s.push(r[o]),i++,o++}else return!1;return t.length===r.length&&s}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=0,o=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),l=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),d=l?3:a?0:void 0,g=u?3:c?0:void 0;if(typeof d=="number"&&typeof g=="number"){let[m,A]=[t[d],r[g]];m.toLowerCase()===A.toLowerCase()&&(r[g]=m,o=g,i=d)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(vc)?this.#e(t,r,n,i,o):this.#n(t,r,n,i,o)}#e(t,r,n,i,o){let s=r.indexOf(vc,o),a=r.lastIndexOf(vc),[l,c,u]=n?[r.slice(o,s),r.slice(s+1),[]]:[r.slice(o,s),r.slice(s+1,a),r.slice(a+1)];if(l.length){let I=t.slice(i,i+l.length);if(!this.#n(I,l,n,0,0))return!1;i+=l.length,o+=l.length}let d=0;if(u.length){if(u.length+i>t.length)return!1;let I=t.length-u.length;if(this.#n(t,u,n,I,0))d=u.length;else{if(t[t.length-1]!==""||i+u.length===t.length||(I--,!this.#n(t,u,n,I,0)))return!1;d=u.length+1}}if(!c.length){let I=!!d;for(let T=i;T<t.length-d;T++){let D=String(t[T]);if(I=!0,D==="."||D===".."||!this.options.dot&&D.startsWith("."))return!1}return n||I}let g=[[[],0]],m=g[0],A=0,h=[0];for(let I of c)I===vc?(h.push(A),m=[[],0],g.push(m)):(m[0].push(I),A++);let y=g.length-1,C=t.length-d;for(let I of g)I[1]=C-(h[y--]+I[0].length);return!!this.#t(t,g,i,0,n,0,!!d)}#t(t,r,n,i,o,s,a){let l=r[i];if(!l){for(let d=n;d<t.length;d++){a=!0;let g=t[d];if(g==="."||g===".."||!this.options.dot&&g.startsWith("."))return!1}return a}let[c,u]=l;for(;n<=u;){if(this.#n(t.slice(0,n+c.length),c,o,n,0)&&s<this.maxGlobstarRecursion){let m=this.#t(t,r,n+c.length,i+1,o,s+1,a);if(m!==!1)return m}let g=t[n];if(g==="."||g===".."||!this.options.dot&&g.startsWith("."))return!1;n++}return o||null}#n(t,r,n,i,o){let s,a,l,c;for(s=i,a=o,c=t.length,l=r.length;s<c&&a<l;s++,a++){this.debug("matchOne loop");let u=r[a],d=t[s];if(this.debug(r,u,d),u===!1||u===vc)return!1;let g;if(typeof u=="string"?(g=d===u,this.debug("string match",u,d,g)):(g=u.test(d),this.debug("pattern match",u,d,g)),!g)return!1}if(s===c&&a===l)return!0;if(s===c)return n;if(a===l)return s===c-1&&t[s]==="";throw new Error("wtf?")}braceExpand(){return EAt(this.pattern,this.options)}parse(t){qU(t);let r=this.options;if(t==="**")return vc;if(t==="")return"";let n,i=null;(n=t.match(_in))?i=r.dot?bin:yin:(n=t.match(cin))?i=(r.nocase?r.dot?pin:fin:r.dot?din:uin)(n[1]):(n=t.match(Cin))?i=(r.nocase?r.dot?Iin:Sin:r.dot?Tin:vin)(n):(n=t.match(min))?i=r.dot?Ain:gin:(n=t.match(hin))&&(i=Ein);let o=GT.fromGlob(t,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?Din:r.dot?Rin:Nin,i=new Set(r.nocase?["i"]:[]),o=t.map(l=>{let c=l.map(d=>{if(d instanceof RegExp)for(let g of d.flags.split(""))i.add(g);return typeof d=="string"?Qin(d):d===vc?vc:d._src});c.forEach((d,g)=>{let m=c[g+1],A=c[g-1];d!==vc||A===vc||(A===void 0?m!==void 0&&m!==vc?c[g+1]="(?:\\/|"+n+"\\/)?"+m:c[g]=n:m===void 0?c[g-1]=A+"(?:\\/|\\/"+n+")?":m!==vc&&(c[g-1]=A+"(?:\\/|\\/"+n+"\\/)"+m,c[g+1]=vc))});let u=c.filter(d=>d!==vc);if(this.partial&&u.length>=1){let d=[];for(let g=1;g<=u.length;g++)d.push(u.slice(0,g).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[s,a]=t.length>1?["(?:",")"]:["",""];o="^"+s+o+a+"$",this.partial&&(o="^(?:\\/|"+s+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let o=this.set;this.debug(this.pattern,"set",o);let s=i[i.length-1];if(!s)for(let a=i.length-2;!s&&a>=0;a--)s=i[a];for(let a of o){let l=i;if(n.matchBase&&a.length===1&&(l=[s]),this.matchOne(l,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return jl.defaults(t).Minimatch}};jl.AST=GT;jl.Minimatch=zB;jl.escape=z1e;jl.unescape=_C;var bAt=Re($U(),1);Ar();$e();Oe();Xc();import{readFile as _At}from"fs/promises";import{existsSync as j1e,readdirSync as Pin,statSync as Lin}from"fs";import{join as Y1e,relative as CAt}from"path";import{homedir as Fin}from"os";function yAt(e){try{let t=(0,bAt.default)(e),r=t.data.paths,n=[];return typeof r=="string"?n=r.split(",").map(i=>i.trim()).filter(Boolean):Array.isArray(r)&&(n=r.filter(i=>typeof i=="string")),{paths:n,content:t.content.trim()}}catch(t){return ve(t),{paths:[],content:e.trim()}}}function Uin(e,t){return t.length===0?!0:t.some(r=>{try{return jl(e,r,{matchBase:!0,dot:!0})}catch(n){return ve(n),!1}})}function V1e(e){let t=[];try{if(!j1e(e))return t;let r=Pin(e);for(let n of r){let i=Y1e(e,n),o=Lin(i);o.isDirectory()?t.push(...V1e(i)):o.isFile()&&n.endsWith(".md")&&t.push(i)}}catch(r){ve(r)}return t}async function eZ(){let e=[];try{let t=Y1e(Fin(),Jr,"rules");if(j1e(t)){let r=V1e(t);for(let n of r)try{let i=await _At(n,"utf-8"),{paths:o,content:s}=yAt(i);o.length>0&&e.push({filePath:n,content:s,paths:o,isProjectRule:!1})}catch(i){ve(i)}}}catch(t){ve(t)}try{let t=Y1e(Be(),Jr,"rules");if(j1e(t)){let r=V1e(t);for(let n of r)try{let i=await _At(n,"utf-8"),{paths:o,content:s}=yAt(i);o.length>0&&e.push({filePath:CAt(Be(),n),content:s,paths:o,isProjectRule:!0})}catch(i){ve(i)}}}catch(t){ve(t)}return e}function SAt(e,t){e=yY(e);let r=yY(Be()),n=e.startsWith(r)?CAt(r,e):e;return t.filter(i=>Uin(n,i.paths))}function IAt(e){return e.length===0?"":e.map(r=>{let n=r.isProjectRule?"project instructions, checked into the codebase":"user's private global instructions for all projects";return`Contents of ${r.filePath} (${n}):
|
|
627
627
|
|
|
628
628
|
${r.content}`}).join(`
|
|
629
629
|
|
|
@@ -1016,7 +1016,7 @@ You are powered by the model ${e}.`}async function hv(){return!["1","true"].incl
|
|
|
1016
1016
|
<context name="${c}">${u}</context>`;let s=i.map(c=>{let u=c.prompt({},t),d=JSON.stringify("inputJSONSchema"in c&&c.inputJSONSchema?c.inputJSONSchema:TE(c.inputSchema));return{name:c.name,description:`${u}
|
|
1017
1017
|
|
|
1018
1018
|
Schema:
|
|
1019
|
-
${d}`}}),{messages:a}=t,l=Pcn(o);return Lcn(o,l,s,a)}},N_t=Fcn;fg();var y2=Re(it(),1);Oe();Oe();import{existsSync as Ucn,readdirSync as $cn,statSync as Hcn}from"fs";import{join as qcn}from"path";function Gcn(){let e=$i.plan();if(!Ucn(e))return[];try{return $cn(e).filter(r=>r.endsWith(".md")).map(r=>{let n=qcn(e,r),i=Hcn(n);return{name:r,path:n,modified:i.mtime}}).sort((r,n)=>n.modified.getTime()-r.modified.getTime())}catch{return[]}}var B_t=({onSelect:e})=>{let[t,r]=(0,y2.useState)([]),[n,i]=(0,y2.useState)(0),[o,s]=(0,y2.useState)(!1);(0,y2.useEffect)(()=>{let c=Gcn();r(c),s(!0)},[]);let a=[{label:"New plan",value:"__NEW_PLAN__",isNew:!0},...t.map(c=>({label:c.name,value:c.path,isNew:!1,modified:c.modified}))];or((c,u)=>{if(u.upArrow)i(d=>d>0?d-1:a.length-1);else if(u.downArrow)i(d=>d<a.length-1?d+1:0);else if(u.return){let d=a[n];d&&e(d.value)}else u.escape&&e("__CANCELLED__")});let l=Me();return o?(0,_.jsxs)(B,{flexDirection:"column",marginY:1,children:[(0,_.jsx)(B,{marginBottom:1,children:(0,_.jsx)(x,{bold:!0,color:l.claude,children:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"})}),(0,_.jsx)(B,{marginBottom:1,children:(0,_.jsx)(x,{bold:!0,color:l.claude,children:" Select a plan to continue, or create a new one"})}),a.map((c,u)=>{let d=u===n;return(0,_.jsxs)(B,{flexDirection:"row",marginLeft:2,children:[(0,_.jsx)(x,{color:d?l.claude:l.text,children:d?"\u276F":" "}),(0,_.jsx)(x,{color:d?l.claude:l.text,children:" "}),(0,_.jsx)(x,{color:d?l.claude:l.text,bold:c.isNew,children:c.isNew?c.label:c.label.replace(".md","")}),!c.isNew&&c.modified&&(0,_.jsxs)(x,{dimColor:!0,children:[" ","(",$me(c.modified),")"]})]},c.isNew?"new":c.value)}),(0,_.jsx)(B,{marginTop:1,marginLeft:2,children:(0,_.jsx)(x,{dimColor:!0,children:"\u2191/\u2193 to select \xB7 Enter to confirm \xB7 Esc to cancel"})})]}):(0,_.jsx)(B,{flexDirection:"column",marginY:1,children:(0,_.jsx)(x,{children:"Loading plan history..."})})};var zcn={type:"local-jsx",name:"plan",description:()=>"Enable plan mode",isEnabled:!0,isHidden:!1,disableCancel:!0,async call(e){return Ai.isPlanMode()?(e("Already in plan mode."),null):(0,_.jsx)(B_t,{onSelect:t=>{if(t==="__CANCELLED__"){e("Cancelled.");return}t&&t!=="__NEW_PLAN__"?Ai.setCurrentPlanFilePath(t):Ai.generatePlanFilePath(),Ai.setMode("plan",!0,!1),e("Enabled plan mode")}})},userFacingName(){return"plan"}},O_t=zcn;fg();var jcn={type:"local",name:"auto",description:()=>"Enable auto mode",isEnabled:!0,isHidden:!1,async call(){return Ai.isAutoMode()?"Already in auto mode.":(Ai.setMode("auto",!0),"Enabled auto mode")},userFacingName(){return"auto"}},k_t=jcn;Ar();import{resolve as Ycn}from"path";var Vcn={type:"local",name:"cd",description:()=>"Move this session to a new working directory",isEnabled:!0,isHidden:!1,argNames:["path"],async call(e){let t=e.trim();if(t==="")throw new Error("Missing directory path. Usage: /cd <path>");let r=Be(),n=Ycn(r,t);zs(n);let i=Be();return i===r?`Already in ${i}.`:`Changed directory to ${i}/`},userFacingName(){return"cd"}},M_t=Vcn;var fCt=Re(it(),1);var ch=Re(it(),1);var vun=Re(it(),1);var N5=Re(it(),1),Sun=Re(F_t(),1);var U_t={info:"blue",success:"green",error:"red",warning:"yellow"},lun={styles:{container:({variant:e})=>({flexGrow:1,borderStyle:"round",borderColor:U_t[e],gap:1,paddingX:1}),iconContainer:()=>({flexShrink:0}),icon:({variant:e})=>({color:U_t[e]}),content:()=>({flexShrink:1,flexGrow:1,minWidth:0,flexDirection:"column",gap:1}),title:()=>({bold:!0}),message:()=>({})},config({variant:e}){let t;return e==="info"&&(t=Zt.info),e==="success"&&(t=Zt.tick),e==="error"&&(t=Zt.cross),e==="warning"&&(t=Zt.warning),{icon:t}}},$_t=lun;var cun={styles:{container:({color:e})=>({backgroundColor:e}),label:()=>({color:"black"})}},H_t=cun;var uun={styles:{input:({isFocused:e})=>({dimColor:!e})}},q_t=uun;var dun={styles:{container:()=>({flexDirection:"column"}),option:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"}),focusIndicator:()=>({color:"blue"}),label({isFocused:e,isSelected:t}){let r;return t&&(r="green"),e&&(r="blue"),{color:r}},highlightedText:()=>({bold:!0})}},G_t=dun;var fun={styles:{list:()=>({flexDirection:"column"}),listItem:()=>({gap:1}),marker:()=>({dimColor:!0}),content:()=>({flexDirection:"column"})}},z_t=fun;var pun={styles:{container:()=>({flexGrow:1,minWidth:0}),completed:()=>({color:"magenta"}),remaining:()=>({dimColor:!0})},config:()=>({completedCharacter:Zt.square,remainingCharacter:Zt.squareLightShade})},j_t=pun;var mun={styles:{container:()=>({flexDirection:"column"}),option:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"}),focusIndicator:()=>({color:"blue"}),label({isFocused:e,isSelected:t}){let r;return t&&(r="green"),e&&(r="blue"),{color:r}},highlightedText:()=>({bold:!0})}},Y_t=mun;var gun={styles:{container:()=>({gap:1}),frame:()=>({color:"blue"}),label:()=>({})}},V_t=gun;var Aun={success:"green",error:"red",warning:"yellow",info:"blue"},hun={success:Zt.tick,error:Zt.cross,warning:Zt.warning,info:Zt.info},Eun={styles:{container:()=>({gap:1}),iconContainer:()=>({flexShrink:0}),icon:({variant:e})=>({color:Aun[e]}),message:()=>({})},config:({variant:e})=>({icon:hun[e]})},W_t=Eun;var _un={styles:{list:()=>({flexDirection:"column"}),listItem:()=>({gap:1}),marker:()=>({dimColor:!0}),content:()=>({flexDirection:"column"})},config:()=>({marker:Zt.line})},K_t=_un;var yun={styles:{value:()=>({})}},J_t=yun;var bun={styles:{value:()=>({})}},Z_t=bun;var Cun={styles:{value:()=>({})}},X_t=Cun;var Iun={components:{Alert:$_t,Badge:H_t,ConfirmInput:q_t,MultiSelect:G_t,OrderedList:z_t,ProgressBar:j_t,Select:Y_t,Spinner:V_t,StatusMessage:W_t,UnorderedList:K_t,TextInput:J_t,EmailInput:Z_t,PasswordInput:X_t}},Tun=(0,N5.createContext)(Iun);var oo=e=>(0,N5.useContext)(Tun).components[e];var xun=Re(it(),1);var V0=Re(it(),1);var C2=Re(it(),1);var eyt=Re(it(),1);var B5=Zt.line;var sX=(0,eyt.createContext)({marker:B5});function tyt({children:e}){let{marker:t}=(0,C2.useContext)(sX),{styles:r}=oo("UnorderedList");return C2.default.createElement(B,{...r.listItem()},C2.default.createElement(x,{...r.marker()},t),C2.default.createElement(B,{...r.content()},e))}var ryt=Re(it(),1),HTe=(0,ryt.createContext)({depth:0});function wun({children:e}){let{depth:t}=(0,V0.useContext)(HTe),{styles:r,config:n}=oo("UnorderedList"),i=(0,V0.useMemo)(()=>({depth:t+1}),[t]),o=(0,V0.useMemo)(()=>{let{marker:s}=n();return typeof s=="string"?{marker:s}:Array.isArray(s)?{marker:s[t]??s.at(-1)??B5}:{marker:B5}},[n,t]);return V0.default.createElement(HTe.Provider,{value:i},V0.default.createElement(sX.Provider,{value:o},V0.default.createElement(B,{...r.list()},e)))}wun.Item=tyt;var Run=Re(it(),1);var Dun=Re(it(),1);var O5=Re(it(),1);var S2=class extends Map{first;constructor(t){let r=[],n,i,o=0;for(let s of t){let a={...s,previous:i,next:void 0,index:o};i&&(i.next=a),n||=a,r.push([s.value,a]),o++,i=a}super(r),this.first=n}};var nyt=Re(it(),1);var I2=Re(it(),1);var k5=Re(it(),1);function iyt({isFocused:e,isSelected:t,children:r}){let{styles:n}=oo("Select");return k5.default.createElement(B,{...n.option({isFocused:e})},e&&k5.default.createElement(x,{...n.focusIndicator()},Zt.pointer),k5.default.createElement(x,{...n.label({isFocused:e,isSelected:t})},r),t&&k5.default.createElement(x,{...n.selectedIndicator()},Zt.tick))}var Zp=Re(it(),1);import{isDeepStrictEqual as Nun}from"node:util";var Bun=(e,t)=>{switch(t.type){case"focus-next-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.next;if(!n)return e;if(!(n.index>=e.visibleToIndex))return{...e,focusedValue:n.value};let o=Math.min(e.optionMap.size,e.visibleToIndex+1),s=o-e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:s,visibleToIndex:o}}case"focus-previous-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.previous;if(!n)return e;if(!(n.index<=e.visibleFromIndex))return{...e,focusedValue:n.value};let o=Math.max(0,e.visibleFromIndex-1),s=o+e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:o,visibleToIndex:s}}case"select-focused-option":return{...e,previousValue:e.value,value:e.focusedValue};case"reset":return t.state}},oyt=({visibleOptionCount:e,defaultValue:t,options:r})=>{let n=typeof e=="number"?Math.min(e,r.length):r.length,i=new S2(r);return{optionMap:i,visibleOptionCount:n,focusedValue:i.first?.value,visibleFromIndex:0,visibleToIndex:n,previousValue:t,value:t}},syt=({visibleOptionCount:e=5,options:t,defaultValue:r,onChange:n})=>{let[i,o]=(0,Zp.useReducer)(Bun,{visibleOptionCount:e,defaultValue:r,options:t},oyt),[s,a]=(0,Zp.useState)(t);t!==s&&!Nun(t,s)&&(o({type:"reset",state:oyt({visibleOptionCount:e,defaultValue:r,options:t})}),a(t));let l=(0,Zp.useCallback)(()=>{o({type:"focus-next-option"})},[]),c=(0,Zp.useCallback)(()=>{o({type:"focus-previous-option"})},[]),u=(0,Zp.useCallback)(()=>{o({type:"select-focused-option"})},[]),d=(0,Zp.useMemo)(()=>t.map((g,m)=>({...g,index:m})).slice(i.visibleFromIndex,i.visibleToIndex),[t,i.visibleFromIndex,i.visibleToIndex]);return(0,Zp.useEffect)(()=>{i.value&&i.previousValue!==i.value&&n?.(i.value)},[i.previousValue,i.value,t,n]),{focusedValue:i.focusedValue,visibleFromIndex:i.visibleFromIndex,visibleToIndex:i.visibleToIndex,value:i.value,visibleOptions:d,focusNextOption:l,focusPreviousOption:c,selectFocusedOption:u}};var ayt=({isDisabled:e=!1,state:t})=>{or((r,n)=>{n.downArrow&&t.focusNextOption(),n.upArrow&&t.focusPreviousOption(),n.return&&t.selectFocusedOption()},{isActive:!e})};function T2({isDisabled:e=!1,visibleOptionCount:t=5,highlightText:r,options:n,defaultValue:i,onChange:o}){let s=syt({visibleOptionCount:t,options:n,defaultValue:i,onChange:o});ayt({isDisabled:e,state:s});let{styles:a}=oo("Select");return I2.default.createElement(B,{...a.container()},s.visibleOptions.map(l=>{let c=l.label;if(r&&l.label.includes(r)){let u=l.label.indexOf(r);c=I2.default.createElement(I2.default.Fragment,null,l.label.slice(0,u),I2.default.createElement(x,{...a.highlightedText()},r),l.label.slice(u+r.length))}return I2.default.createElement(iyt,{key:l.value,isFocused:!e&&s.focusedValue===l.value,isSelected:s.value===l.value},c)}))}var Oun=Re(it(),1);var lyt=Re(it(),1);var Mun=Re(it(),1);var aX=Re(it(),1);var kun=Re(it(),1);var tki=Jt.inverse(" ");var Eg=Re(it(),1);var v2=Re(it(),1);var cyt=Re(it(),1);var lX=(0,cyt.createContext)({marker:Zt.line});function cX({children:e}){let{marker:t}=(0,v2.useContext)(lX),{styles:r}=oo("OrderedList");return v2.default.createElement(B,{...r.listItem()},v2.default.createElement(x,{...r.marker()},t),v2.default.createElement(B,{...r.content()},e))}var uyt=Re(it(),1),qTe=(0,uyt.createContext)({marker:""});function _g({children:e}){let{marker:t}=(0,Eg.useContext)(qTe),{styles:r}=oo("OrderedList"),n=0;for(let o of Eg.default.Children.toArray(e))!(0,Eg.isValidElement)(o)||o.type!==cX||n++;let i=String(n).length;return Eg.default.createElement(B,{...r.list()},Eg.default.Children.map(e,(o,s)=>{if(!(0,Eg.isValidElement)(o)||o.type!==cX)return o;let a=`${String(s+1).padStart(i)}.`,l=`${t}${a}`;return Eg.default.createElement(qTe.Provider,{value:{marker:l}},Eg.default.createElement(lX.Provider,{value:{marker:l}},o))}))}_g.Item=cX;var Pun=Re(it(),1);var GTe=Re(it(),1);var Qun=Re(it(),1);var Rki=Jt.inverse(" ");var Lun=Re(it(),1);var Fun=Re(it(),1);var $un=Re(it(),1);var uX=Re(it(),1);var Uun=Re(it(),1);var eMi=Jt.inverse(" ");var R2=Re(it(),1);var zTe=Re(it(),1);YU();ps();Ci();iv();Wt();var Hun=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function DC(){let e=Hun,{frame:t}=OD({interval:120});return(0,_.jsx)(B,{flexWrap:"nowrap",height:1,width:2,children:(0,_.jsx)(x,{color:Me().claude,children:e[t%e.length]})})}var pX=Re(it(),1);var Ev=null,W0=null,fX=new Set,dX=null;function YTe(e){let{columns:t,rows:r}=e;return t&&r?{columns:t,rows:r}:(dX||(dX=xfe()),{columns:t||dX.columns||80,rows:r||dX.rows||24})}function jTe(){if(!W0)return;let e=YTe(W0);Ev&&e.columns===Ev.columns&&e.rows===Ev.rows||(Ev=e,fX.forEach(t=>t(Ev)))}function qun(e,t){return W0!==e&&(W0&&W0.off("resize",jTe),W0=e,Ev=YTe(e),e.on("resize",jTe)),fX.add(t),()=>{fX.delete(t),fX.size===0&&W0&&(W0.off("resize",jTe),W0=null,Ev=null)}}function VTe(){let{stdout:e}=Uy(),[t,r]=(0,pX.useState)(()=>YTe(e));return(0,pX.useEffect)(()=>qun(e,r),[e]),t}function mX(){return VTe()}$e();Xd();Oe();RA();Oe();var GQi=Re(Zbt(),1);import{homedir as q5}from"os";import{join as D2}from"path";import{existsSync as G5,mkdirSync as eCt,appendFileSync as Xbt,readFileSync as tCt,constants as Upn,writeFileSync as $pn,unlinkSync as rCt,statSync as Hpn}from"fs";import{platform as nCt}from"process";import{accessSync as qpn}from"fs";var Fpn="2.7.12",H5={VERSION:Fpn,PACKAGE_URL:"@dahawa/hawa-code",README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};$e();var yv=D2(s0,".update.lock"),Gpn=300*1e3;function iCt(){try{if(G5(s0)||eCt(s0,{recursive:!0}),G5(yv)){let e=Hpn(yv);if(Date.now()-e.mtimeMs<Gpn)return!1;try{rCt(yv)}catch(r){return ve(`Failed to remove stale lock file: ${r}`),!1}}return $pn(yv,`${process.pid}`,"utf8"),!0}catch(e){return ve(`Failed to acquire lock: ${e}`),!1}}function oCt(){try{G5(yv)&&tCt(yv,"utf8")===`${process.pid}`&&rCt(yv)}catch(e){ve(`Failed to release lock: ${e}`)}}async function gve(){try{let e=await Wn("npm -g config get prefix");if(e.code!==0)return ve("Failed to check npm permissions"),{hasPermissions:!1,npmPrefix:null};let t=e.stdout.trim(),r=!1;try{qpn(t,Upn.W_OK),r=!0}catch{r=!1}return r?{hasPermissions:!0,npmPrefix:t}:(ve("Insufficient permissions for global npm install."),{hasPermissions:!1,npmPrefix:t})}catch(e){return ve(`Failed to verify npm global install permissions: ${e}`),{hasPermissions:!1,npmPrefix:null}}}async function sCt(e){if(!iCt())throw Nt("tengu_auto_updater_prefix_lock_contention",{pid:String(process.pid),currentVersion:H5.VERSION,prefix:e}),new Error("Another process is currently setting up npm prefix");try{G5(e)||eCt(e,{recursive:!0});let t=await Wn(`npm -g config set prefix ${e}`);if(t.code!==0)throw new Error(`Failed to set npm prefix: ${t.stderr}`);let r=`
|
|
1019
|
+
${d}`}}),{messages:a}=t,l=Pcn(o);return Lcn(o,l,s,a)}},N_t=Fcn;fg();var y2=Re(it(),1);Oe();Oe();import{existsSync as Ucn,readdirSync as $cn,statSync as Hcn}from"fs";import{join as qcn}from"path";function Gcn(){let e=$i.plan();if(!Ucn(e))return[];try{return $cn(e).filter(r=>r.endsWith(".md")).map(r=>{let n=qcn(e,r),i=Hcn(n);return{name:r,path:n,modified:i.mtime}}).sort((r,n)=>n.modified.getTime()-r.modified.getTime())}catch{return[]}}var B_t=({onSelect:e})=>{let[t,r]=(0,y2.useState)([]),[n,i]=(0,y2.useState)(0),[o,s]=(0,y2.useState)(!1);(0,y2.useEffect)(()=>{let c=Gcn();r(c),s(!0)},[]);let a=[{label:"New plan",value:"__NEW_PLAN__",isNew:!0},...t.map(c=>({label:c.name,value:c.path,isNew:!1,modified:c.modified}))];or((c,u)=>{if(u.upArrow)i(d=>d>0?d-1:a.length-1);else if(u.downArrow)i(d=>d<a.length-1?d+1:0);else if(u.return){let d=a[n];d&&e(d.value)}else u.escape&&e("__CANCELLED__")});let l=Me();return o?(0,_.jsxs)(B,{flexDirection:"column",marginY:1,children:[(0,_.jsx)(B,{marginBottom:1,children:(0,_.jsx)(x,{bold:!0,color:l.claude,children:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"})}),(0,_.jsx)(B,{marginBottom:1,children:(0,_.jsx)(x,{bold:!0,color:l.claude,children:" Select a plan to continue, or create a new one"})}),a.map((c,u)=>{let d=u===n;return(0,_.jsxs)(B,{flexDirection:"row",marginLeft:2,children:[(0,_.jsx)(x,{color:d?l.claude:l.text,children:d?"\u276F":" "}),(0,_.jsx)(x,{color:d?l.claude:l.text,children:" "}),(0,_.jsx)(x,{color:d?l.claude:l.text,bold:c.isNew,children:c.isNew?c.label:c.label.replace(".md","")}),!c.isNew&&c.modified&&(0,_.jsxs)(x,{dimColor:!0,children:[" ","(",$me(c.modified),")"]})]},c.isNew?"new":c.value)}),(0,_.jsx)(B,{marginTop:1,marginLeft:2,children:(0,_.jsx)(x,{dimColor:!0,children:"\u2191/\u2193 to select \xB7 Enter to confirm \xB7 Esc to cancel"})})]}):(0,_.jsx)(B,{flexDirection:"column",marginY:1,children:(0,_.jsx)(x,{children:"Loading plan history..."})})};var zcn={type:"local-jsx",name:"plan",description:()=>"Enable plan mode",isEnabled:!0,isHidden:!1,disableCancel:!0,async call(e){return Ai.isPlanMode()?(e("Already in plan mode."),null):(0,_.jsx)(B_t,{onSelect:t=>{if(t==="__CANCELLED__"){e("Cancelled.");return}t&&t!=="__NEW_PLAN__"?Ai.setCurrentPlanFilePath(t):Ai.generatePlanFilePath(),Ai.setMode("plan",!0,!1),e("Enabled plan mode")}})},userFacingName(){return"plan"}},O_t=zcn;fg();var jcn={type:"local",name:"auto",description:()=>"Enable auto mode",isEnabled:!0,isHidden:!1,async call(){return Ai.isAutoMode()?"Already in auto mode.":(Ai.setMode("auto",!0),"Enabled auto mode")},userFacingName(){return"auto"}},k_t=jcn;Ar();import{resolve as Ycn}from"path";var Vcn={type:"local",name:"cd",description:()=>"Move this session to a new working directory",isEnabled:!0,isHidden:!1,argNames:["path"],async call(e){let t=e.trim();if(t==="")throw new Error("Missing directory path. Usage: /cd <path>");let r=Be(),n=Ycn(r,t);zs(n);let i=Be();return i===r?`Already in ${i}.`:`Changed directory to ${i}/`},userFacingName(){return"cd"}},M_t=Vcn;var fCt=Re(it(),1);var ch=Re(it(),1);var vun=Re(it(),1);var N5=Re(it(),1),Sun=Re(F_t(),1);var U_t={info:"blue",success:"green",error:"red",warning:"yellow"},lun={styles:{container:({variant:e})=>({flexGrow:1,borderStyle:"round",borderColor:U_t[e],gap:1,paddingX:1}),iconContainer:()=>({flexShrink:0}),icon:({variant:e})=>({color:U_t[e]}),content:()=>({flexShrink:1,flexGrow:1,minWidth:0,flexDirection:"column",gap:1}),title:()=>({bold:!0}),message:()=>({})},config({variant:e}){let t;return e==="info"&&(t=Zt.info),e==="success"&&(t=Zt.tick),e==="error"&&(t=Zt.cross),e==="warning"&&(t=Zt.warning),{icon:t}}},$_t=lun;var cun={styles:{container:({color:e})=>({backgroundColor:e}),label:()=>({color:"black"})}},H_t=cun;var uun={styles:{input:({isFocused:e})=>({dimColor:!e})}},q_t=uun;var dun={styles:{container:()=>({flexDirection:"column"}),option:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"}),focusIndicator:()=>({color:"blue"}),label({isFocused:e,isSelected:t}){let r;return t&&(r="green"),e&&(r="blue"),{color:r}},highlightedText:()=>({bold:!0})}},G_t=dun;var fun={styles:{list:()=>({flexDirection:"column"}),listItem:()=>({gap:1}),marker:()=>({dimColor:!0}),content:()=>({flexDirection:"column"})}},z_t=fun;var pun={styles:{container:()=>({flexGrow:1,minWidth:0}),completed:()=>({color:"magenta"}),remaining:()=>({dimColor:!0})},config:()=>({completedCharacter:Zt.square,remainingCharacter:Zt.squareLightShade})},j_t=pun;var mun={styles:{container:()=>({flexDirection:"column"}),option:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"}),focusIndicator:()=>({color:"blue"}),label({isFocused:e,isSelected:t}){let r;return t&&(r="green"),e&&(r="blue"),{color:r}},highlightedText:()=>({bold:!0})}},Y_t=mun;var gun={styles:{container:()=>({gap:1}),frame:()=>({color:"blue"}),label:()=>({})}},V_t=gun;var Aun={success:"green",error:"red",warning:"yellow",info:"blue"},hun={success:Zt.tick,error:Zt.cross,warning:Zt.warning,info:Zt.info},Eun={styles:{container:()=>({gap:1}),iconContainer:()=>({flexShrink:0}),icon:({variant:e})=>({color:Aun[e]}),message:()=>({})},config:({variant:e})=>({icon:hun[e]})},W_t=Eun;var _un={styles:{list:()=>({flexDirection:"column"}),listItem:()=>({gap:1}),marker:()=>({dimColor:!0}),content:()=>({flexDirection:"column"})},config:()=>({marker:Zt.line})},K_t=_un;var yun={styles:{value:()=>({})}},J_t=yun;var bun={styles:{value:()=>({})}},Z_t=bun;var Cun={styles:{value:()=>({})}},X_t=Cun;var Iun={components:{Alert:$_t,Badge:H_t,ConfirmInput:q_t,MultiSelect:G_t,OrderedList:z_t,ProgressBar:j_t,Select:Y_t,Spinner:V_t,StatusMessage:W_t,UnorderedList:K_t,TextInput:J_t,EmailInput:Z_t,PasswordInput:X_t}},Tun=(0,N5.createContext)(Iun);var oo=e=>(0,N5.useContext)(Tun).components[e];var xun=Re(it(),1);var V0=Re(it(),1);var C2=Re(it(),1);var eyt=Re(it(),1);var B5=Zt.line;var sX=(0,eyt.createContext)({marker:B5});function tyt({children:e}){let{marker:t}=(0,C2.useContext)(sX),{styles:r}=oo("UnorderedList");return C2.default.createElement(B,{...r.listItem()},C2.default.createElement(x,{...r.marker()},t),C2.default.createElement(B,{...r.content()},e))}var ryt=Re(it(),1),HTe=(0,ryt.createContext)({depth:0});function wun({children:e}){let{depth:t}=(0,V0.useContext)(HTe),{styles:r,config:n}=oo("UnorderedList"),i=(0,V0.useMemo)(()=>({depth:t+1}),[t]),o=(0,V0.useMemo)(()=>{let{marker:s}=n();return typeof s=="string"?{marker:s}:Array.isArray(s)?{marker:s[t]??s.at(-1)??B5}:{marker:B5}},[n,t]);return V0.default.createElement(HTe.Provider,{value:i},V0.default.createElement(sX.Provider,{value:o},V0.default.createElement(B,{...r.list()},e)))}wun.Item=tyt;var Run=Re(it(),1);var Dun=Re(it(),1);var O5=Re(it(),1);var S2=class extends Map{first;constructor(t){let r=[],n,i,o=0;for(let s of t){let a={...s,previous:i,next:void 0,index:o};i&&(i.next=a),n||=a,r.push([s.value,a]),o++,i=a}super(r),this.first=n}};var nyt=Re(it(),1);var I2=Re(it(),1);var k5=Re(it(),1);function iyt({isFocused:e,isSelected:t,children:r}){let{styles:n}=oo("Select");return k5.default.createElement(B,{...n.option({isFocused:e})},e&&k5.default.createElement(x,{...n.focusIndicator()},Zt.pointer),k5.default.createElement(x,{...n.label({isFocused:e,isSelected:t})},r),t&&k5.default.createElement(x,{...n.selectedIndicator()},Zt.tick))}var Zp=Re(it(),1);import{isDeepStrictEqual as Nun}from"node:util";var Bun=(e,t)=>{switch(t.type){case"focus-next-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.next;if(!n)return e;if(!(n.index>=e.visibleToIndex))return{...e,focusedValue:n.value};let o=Math.min(e.optionMap.size,e.visibleToIndex+1),s=o-e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:s,visibleToIndex:o}}case"focus-previous-option":{if(!e.focusedValue)return e;let r=e.optionMap.get(e.focusedValue);if(!r)return e;let n=r.previous;if(!n)return e;if(!(n.index<=e.visibleFromIndex))return{...e,focusedValue:n.value};let o=Math.max(0,e.visibleFromIndex-1),s=o+e.visibleOptionCount;return{...e,focusedValue:n.value,visibleFromIndex:o,visibleToIndex:s}}case"select-focused-option":return{...e,previousValue:e.value,value:e.focusedValue};case"reset":return t.state}},oyt=({visibleOptionCount:e,defaultValue:t,options:r})=>{let n=typeof e=="number"?Math.min(e,r.length):r.length,i=new S2(r);return{optionMap:i,visibleOptionCount:n,focusedValue:i.first?.value,visibleFromIndex:0,visibleToIndex:n,previousValue:t,value:t}},syt=({visibleOptionCount:e=5,options:t,defaultValue:r,onChange:n})=>{let[i,o]=(0,Zp.useReducer)(Bun,{visibleOptionCount:e,defaultValue:r,options:t},oyt),[s,a]=(0,Zp.useState)(t);t!==s&&!Nun(t,s)&&(o({type:"reset",state:oyt({visibleOptionCount:e,defaultValue:r,options:t})}),a(t));let l=(0,Zp.useCallback)(()=>{o({type:"focus-next-option"})},[]),c=(0,Zp.useCallback)(()=>{o({type:"focus-previous-option"})},[]),u=(0,Zp.useCallback)(()=>{o({type:"select-focused-option"})},[]),d=(0,Zp.useMemo)(()=>t.map((g,m)=>({...g,index:m})).slice(i.visibleFromIndex,i.visibleToIndex),[t,i.visibleFromIndex,i.visibleToIndex]);return(0,Zp.useEffect)(()=>{i.value&&i.previousValue!==i.value&&n?.(i.value)},[i.previousValue,i.value,t,n]),{focusedValue:i.focusedValue,visibleFromIndex:i.visibleFromIndex,visibleToIndex:i.visibleToIndex,value:i.value,visibleOptions:d,focusNextOption:l,focusPreviousOption:c,selectFocusedOption:u}};var ayt=({isDisabled:e=!1,state:t})=>{or((r,n)=>{n.downArrow&&t.focusNextOption(),n.upArrow&&t.focusPreviousOption(),n.return&&t.selectFocusedOption()},{isActive:!e})};function T2({isDisabled:e=!1,visibleOptionCount:t=5,highlightText:r,options:n,defaultValue:i,onChange:o}){let s=syt({visibleOptionCount:t,options:n,defaultValue:i,onChange:o});ayt({isDisabled:e,state:s});let{styles:a}=oo("Select");return I2.default.createElement(B,{...a.container()},s.visibleOptions.map(l=>{let c=l.label;if(r&&l.label.includes(r)){let u=l.label.indexOf(r);c=I2.default.createElement(I2.default.Fragment,null,l.label.slice(0,u),I2.default.createElement(x,{...a.highlightedText()},r),l.label.slice(u+r.length))}return I2.default.createElement(iyt,{key:l.value,isFocused:!e&&s.focusedValue===l.value,isSelected:s.value===l.value},c)}))}var Oun=Re(it(),1);var lyt=Re(it(),1);var Mun=Re(it(),1);var aX=Re(it(),1);var kun=Re(it(),1);var tki=Jt.inverse(" ");var Eg=Re(it(),1);var v2=Re(it(),1);var cyt=Re(it(),1);var lX=(0,cyt.createContext)({marker:Zt.line});function cX({children:e}){let{marker:t}=(0,v2.useContext)(lX),{styles:r}=oo("OrderedList");return v2.default.createElement(B,{...r.listItem()},v2.default.createElement(x,{...r.marker()},t),v2.default.createElement(B,{...r.content()},e))}var uyt=Re(it(),1),qTe=(0,uyt.createContext)({marker:""});function _g({children:e}){let{marker:t}=(0,Eg.useContext)(qTe),{styles:r}=oo("OrderedList"),n=0;for(let o of Eg.default.Children.toArray(e))!(0,Eg.isValidElement)(o)||o.type!==cX||n++;let i=String(n).length;return Eg.default.createElement(B,{...r.list()},Eg.default.Children.map(e,(o,s)=>{if(!(0,Eg.isValidElement)(o)||o.type!==cX)return o;let a=`${String(s+1).padStart(i)}.`,l=`${t}${a}`;return Eg.default.createElement(qTe.Provider,{value:{marker:l}},Eg.default.createElement(lX.Provider,{value:{marker:l}},o))}))}_g.Item=cX;var Pun=Re(it(),1);var GTe=Re(it(),1);var Qun=Re(it(),1);var Rki=Jt.inverse(" ");var Lun=Re(it(),1);var Fun=Re(it(),1);var $un=Re(it(),1);var uX=Re(it(),1);var Uun=Re(it(),1);var eMi=Jt.inverse(" ");var R2=Re(it(),1);var zTe=Re(it(),1);YU();ps();Ci();iv();Wt();var Hun=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function DC(){let e=Hun,{frame:t}=OD({interval:120});return(0,_.jsx)(B,{flexWrap:"nowrap",height:1,width:2,children:(0,_.jsx)(x,{color:Me().claude,children:e[t%e.length]})})}var pX=Re(it(),1);var Ev=null,W0=null,fX=new Set,dX=null;function YTe(e){let{columns:t,rows:r}=e;return t&&r?{columns:t,rows:r}:(dX||(dX=xfe()),{columns:t||dX.columns||80,rows:r||dX.rows||24})}function jTe(){if(!W0)return;let e=YTe(W0);Ev&&e.columns===Ev.columns&&e.rows===Ev.rows||(Ev=e,fX.forEach(t=>t(Ev)))}function qun(e,t){return W0!==e&&(W0&&W0.off("resize",jTe),W0=e,Ev=YTe(e),e.on("resize",jTe)),fX.add(t),()=>{fX.delete(t),fX.size===0&&W0&&(W0.off("resize",jTe),W0=null,Ev=null)}}function VTe(){let{stdout:e}=Uy(),[t,r]=(0,pX.useState)(()=>YTe(e));return(0,pX.useEffect)(()=>qun(e,r),[e]),t}function mX(){return VTe()}$e();Xd();Oe();RA();Oe();var GQi=Re(Zbt(),1);import{homedir as q5}from"os";import{join as D2}from"path";import{existsSync as G5,mkdirSync as eCt,appendFileSync as Xbt,readFileSync as tCt,constants as Upn,writeFileSync as $pn,unlinkSync as rCt,statSync as Hpn}from"fs";import{platform as nCt}from"process";import{accessSync as qpn}from"fs";var Fpn="2.7.13",H5={VERSION:Fpn,PACKAGE_URL:"@dahawa/hawa-code",README_URL:"https://github.com/italking/hawa-code",ISSUES_EXPLAINER:"report the issue at https://github.com/italking/hawa-code/issues"};$e();var yv=D2(s0,".update.lock"),Gpn=300*1e3;function iCt(){try{if(G5(s0)||eCt(s0,{recursive:!0}),G5(yv)){let e=Hpn(yv);if(Date.now()-e.mtimeMs<Gpn)return!1;try{rCt(yv)}catch(r){return ve(`Failed to remove stale lock file: ${r}`),!1}}return $pn(yv,`${process.pid}`,"utf8"),!0}catch(e){return ve(`Failed to acquire lock: ${e}`),!1}}function oCt(){try{G5(yv)&&tCt(yv,"utf8")===`${process.pid}`&&rCt(yv)}catch(e){ve(`Failed to release lock: ${e}`)}}async function gve(){try{let e=await Wn("npm -g config get prefix");if(e.code!==0)return ve("Failed to check npm permissions"),{hasPermissions:!1,npmPrefix:null};let t=e.stdout.trim(),r=!1;try{qpn(t,Upn.W_OK),r=!0}catch{r=!1}return r?{hasPermissions:!0,npmPrefix:t}:(ve("Insufficient permissions for global npm install."),{hasPermissions:!1,npmPrefix:t})}catch(e){return ve(`Failed to verify npm global install permissions: ${e}`),{hasPermissions:!1,npmPrefix:null}}}async function sCt(e){if(!iCt())throw Nt("tengu_auto_updater_prefix_lock_contention",{pid:String(process.pid),currentVersion:H5.VERSION,prefix:e}),new Error("Another process is currently setting up npm prefix");try{G5(e)||eCt(e,{recursive:!0});let t=await Wn(`npm -g config set prefix ${e}`);if(t.code!==0)throw new Error(`Failed to set npm prefix: ${t.stderr}`);let r=`
|
|
1020
1020
|
# npm global path
|
|
1021
1021
|
export PATH="${e}/bin:$PATH"
|
|
1022
1022
|
`;if(nCt==="win32"){let n=await Wn(`setx PATH "${process.env.PATH};${e}"`);if(n.code!==0)throw new Error(`Failed to update PATH on Windows: ${n.stderr}`)}else{let n=[D2(q5(),".bashrc"),D2(q5(),".bash_profile"),D2(q5(),".zshrc"),D2(q5(),".config","fish","config.fish")];for(let i of n)if(G5(i))try{if(!tCt(i,"utf8").includes(e)){if(i.includes("fish")){let s=`
|