buddy-agent-harness 0.9.0 → 0.9.1
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/dist/cli.mjs +1 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -11
- package/dist/index.mjs.map +1 -1
- package/dist/skill-scripts/doctor.mjs +300 -0
- package/dist/skill-scripts/init.mjs +300 -0
- package/package.json +3 -2
- package/plugin.json +1 -1
- package/skills/doctor/SKILL.md +1 -1
- package/skills/doctor/scripts/doctor.mjs +299 -13
- package/skills/init/SKILL.md +1 -1
- package/skills/init/scripts/doctor.mjs +299 -13
- package/skills/init/scripts/init.mjs +299 -13
- package/skills/repair/SKILL.md +1 -1
- package/skills/repair/scripts/doctor.mjs +299 -13
- package/src/cli.ts +10 -2
- package/src/diagnose-bridges/doctor-guidance.ts +45 -26
- package/src/skill-scripts/doctor.ts +11 -0
- package/src/skill-scripts/init.ts +10 -0
- package/src/skill-scripts/launchers.ts +15 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Generated from packages/buddy-agent-harness/src/skill-scripts/init.ts by `pnpm build` — do not edit.
|
|
3
|
+
// Runs `buddy-agent-harness init` from this bundle against the current working directory. Nothing outside this file is read.
|
|
4
|
+
|
|
5
|
+
import{createRequire as e}from"node:module";import t,{cpSync as n,existsSync as r,lstatSync as i,mkdirSync as a,readFileSync as o,readdirSync as s,readlinkSync as c,realpathSync as l,rmSync as u,statSync as d,symlinkSync as f,writeFileSync as p}from"node:fs";import m,{dirname as h,extname as g,join as _,parse as v,posix as y,relative as b,resolve as x,sep as S}from"node:path";import{pathToFileURL as C}from"node:url";import{homedir as w,platform as T}from"node:os";import{execFileSync as E}from"node:child_process";var ee=Object.create,te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,re=Object.getOwnPropertyNames,ie=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,oe=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},D=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),se=(e,t)=>{let n={};for(var r in e)te(n,r,{get:e[r],enumerable:!0});return t||te(n,Symbol.toStringTag,{value:`Module`}),n},ce=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=re(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ae.call(e,s)&&s!==n&&te(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ne(t,s))||r.enumerable});return e},le=(e,t,n)=>(n=e==null?{}:ee(ie(e)),ce(t||!e||!e.__esModule||!ae.call(e,`default`)?te(n,`default`,{value:e,enumerable:!0}):n,e)),O=e(import.meta.url);function ue(e){let t=e.slice(2).reduce((e,t)=>(e.args.__?e.args.__.push(t):fe(t)?(de(e)&&(e=_e(e)),e=pe(e,t)):de(e)?e.values.push(t):t===`--`?e.args.__=[]:e.args._.push(t),e),{args:{_:[]},key:``,values:[]});return(de(t)?_e(t):t).args}function de(e){return!!e.key}function fe(e){return e.startsWith(`-`)&&/\w+/.test(e)}function pe(e,t){return/^-\w+/.test(t)?me(e,t):ge(e,t)}function me(e,t){let n=t.indexOf(`=`),[r,i]=n>0?[t.slice(1,n),[t.slice(n+1)]]:[t.slice(1),[]],a=r.split(``),o=a.pop();return e=he(e,a),e.key=o,e.values=i,e}function he(e,t){return t.length<=0?e:(e.key=t.pop(),e.values=[`true`],he(_e(e),t))}function ge(e,t){let n=t.indexOf(`=`);return n>0?(e.key=t.slice(2,n),e.values=[t.slice(n+1)]):(e.key=t.slice(2),e.values=[]),e}function _e(e){let{key:t,values:n}=e,r={...e.args};return r[t]||(r[t]=[]),n.length===0?r[t].push(`true`):r[t].push(...n),{args:r,key:``,values:[]}}var ve=D(((e,t)=>{
|
|
6
|
+
/*!
|
|
7
|
+
* Determine if an object is a Buffer
|
|
8
|
+
*
|
|
9
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
10
|
+
* @license MIT
|
|
11
|
+
*/
|
|
12
|
+
t.exports=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}}));function ye(e,t,n){return be([e,t,n],(e,t)=>({...e,...t}))}function be(e,t){return e[0]===void 0||e[0]===null?e[0]:e.filter(e=>!!e).reduce(t,{})}function xe(e,t,n){return e==null?e:[e,t,n].filter(Ce).reduce((e,t)=>({...e,...Se(t)}),{})}function Se(e){return Object.keys(e).reduce((t,n)=>(Ce(e[n])&&(t[n]=e[n]),t),{})}function Ce(e){return e!=null}var we=oe((()=>{}));const Te={maxLength:120,references:[]};function Ee(e){return typeof e.tersify==`function`}var De=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],Oe=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],ke=`·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・`,Ae=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,je={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},Me=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,Ne={5:Me,"5module":Me+` export import`,6:Me+` const class extends export import super`},Pe=/^in(stanceof)?$/,Fe=RegExp(`[`+Ae+`]`),Ie=RegExp(`[`+Ae+ke+`]`);function Le(e,t){for(var n=65536,r=0;r<t.length;r+=2){if(n+=t[r],n>e)return!1;if(n+=t[r+1],n>=e)return!0}return!1}function Re(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Fe.test(String.fromCharCode(e)):t!==!1&&Le(e,Oe)}function ze(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&Ie.test(String.fromCharCode(e)):t===!1?!1:Le(e,Oe)||Le(e,De)}var k=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function Be(e,t){return new k(e,{beforeExpr:!0,binop:t})}var Ve={beforeExpr:!0},He={startsExpr:!0},Ue={};function A(e,t){return t===void 0&&(t={}),t.keyword=e,Ue[e]=new k(e,t)}var j={num:new k(`num`,He),regexp:new k(`regexp`,He),string:new k(`string`,He),name:new k(`name`,He),privateId:new k(`privateId`,He),eof:new k(`eof`),bracketL:new k(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new k(`]`),braceL:new k(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new k(`}`),parenL:new k(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new k(`)`),comma:new k(`,`,Ve),semi:new k(`;`,Ve),colon:new k(`:`,Ve),dot:new k(`.`),question:new k(`?`,Ve),questionDot:new k(`?.`),arrow:new k(`=>`,Ve),template:new k(`template`),invalidTemplate:new k(`invalidTemplate`),ellipsis:new k(`...`,Ve),backQuote:new k("`",He),dollarBraceL:new k("${",{beforeExpr:!0,startsExpr:!0}),eq:new k(`=`,{beforeExpr:!0,isAssign:!0}),assign:new k(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new k(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new k(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Be(`||`,1),logicalAND:Be(`&&`,2),bitwiseOR:Be(`|`,3),bitwiseXOR:Be(`^`,4),bitwiseAND:Be(`&`,5),equality:Be(`==/!=/===/!==`,6),relational:Be(`</>/<=/>=`,7),bitShift:Be(`<</>>/>>>`,8),plusMin:new k(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Be(`%`,10),star:Be(`*`,10),slash:Be(`/`,10),starstar:new k(`**`,{beforeExpr:!0}),coalesce:Be(`??`,1),_break:A(`break`),_case:A(`case`,Ve),_catch:A(`catch`),_continue:A(`continue`),_debugger:A(`debugger`),_default:A(`default`,Ve),_do:A(`do`,{isLoop:!0,beforeExpr:!0}),_else:A(`else`,Ve),_finally:A(`finally`),_for:A(`for`,{isLoop:!0}),_function:A(`function`,He),_if:A(`if`),_return:A(`return`,Ve),_switch:A(`switch`),_throw:A(`throw`,Ve),_try:A(`try`),_var:A(`var`),_const:A(`const`),_while:A(`while`,{isLoop:!0}),_with:A(`with`),_new:A(`new`,{beforeExpr:!0,startsExpr:!0}),_this:A(`this`,He),_super:A(`super`,He),_class:A(`class`,He),_extends:A(`extends`,Ve),_export:A(`export`),_import:A(`import`,He),_null:A(`null`,He),_true:A(`true`,He),_false:A(`false`,He),_in:A(`in`,{beforeExpr:!0,binop:7}),_instanceof:A(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:A(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:A(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:A(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},We=/\r\n?|\n|\u2028|\u2029/,Ge=new RegExp(We.source,`g`);function Ke(e){return e===10||e===13||e===8232||e===8233}function qe(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(Ke(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var Je=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ye=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Xe=Object.prototype,Ze=Xe.hasOwnProperty,Qe=Xe.toString,$e=Object.hasOwn||(function(e,t){return Ze.call(e,t)}),et=Array.isArray||(function(e){return Qe.call(e)===`[object Array]`}),tt=Object.create(null);function nt(e){return tt[e]||(tt[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function rt(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var it=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,at=function(e,t){this.line=e,this.column=t};at.prototype.offset=function(e){return new at(this.line,this.column+e)};var ot=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function st(e,t){for(var n=1,r=0;;){var i=qe(e,r,t);if(i<0)return new at(n,t-r);++n,r=i}}var ct={ecmaVersion:null,sourceType:`script`,strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},lt=!1;function ut(e){var t={};for(var n in ct)t[n]=e&&$e(e,n)?e[n]:ct[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!lt&&typeof console==`object`&&console.warn&&(lt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
13
|
+
Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),et(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}if(et(t.onComment)&&(t.onComment=dt(t,t.onComment)),t.sourceType===`commonjs`&&t.allowAwaitOutsideFunction)throw Error(`Cannot use allowAwaitOutsideFunction with sourceType: commonjs`);return t}function dt(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new ot(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}var ft=1,pt=2,mt=4,ht=8,gt=16,_t=32,vt=64,yt=128,bt=256,xt=512,St=1024,Ct=ft|pt|bt;function wt(e,t){return pt|(e?mt:0)|(t?ht:0)}var Tt=0,Et=1,Dt=2,Ot=3,kt=4,At=5,M=function(e,t,n){this.options=e=ut(e),this.sourceFile=e.sourceFile,this.keywords=nt(Ne[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;e.allowReserved!==!0&&(r=je[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=nt(r);var i=(r?r+` `:``)+je.strict;this.reservedWordsStrict=nt(i),this.reservedWordsStrictBind=nt(i+` `+je.strictBind),this.input=String(t),this.containsEsc=!1,this.pos=n||0,this.curLine=1,e.startLocation?(this.lineStart=this.pos-e.startLocation.column,this.curLine=e.startLocation.line):n?(this.lineStart=this.input.lastIndexOf(`
|
|
14
|
+
`,n-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(We).length)):this.lineStart=0,this.type=j.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||e.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType===`commonjs`?pt:ft),this.regexpState=null,this.privateNameStack=[]},jt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};M.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},jt.inFunction.get=function(){return(this.currentVarScope().flags&pt)>0},jt.inGenerator.get=function(){return(this.currentVarScope().flags&ht)>0},jt.inAsync.get=function(){return(this.currentVarScope().flags&mt)>0},jt.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(bt|xt))return!1;if(t&pt)return(t&mt)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},jt.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ft)},jt.allowSuper.get=function(){return(this.currentThisScope().flags&vt)>0||this.options.allowSuperOutsideMethod},jt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&yt)>0},jt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},jt.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(bt|xt)||t&pt&&!(t>))return!0}return!1},jt.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&St||!this.inModule&&e&ft)},jt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&bt)>0},M.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},M.parse=function(e,t){return new this(t,e).parse()},M.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},M.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(M.prototype,jt);var Mt=M.prototype,Nt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Mt.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){Ye.lastIndex=e,e+=Ye.exec(this.input)[0].length;var t=Nt.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){Ye.lastIndex=e+t[0].length;var n=Ye.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||We.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,Ye.lastIndex=e,e+=Ye.exec(this.input)[0].length,this.input[e]===`;`&&e++}},Mt.eat=function(e){return this.type===e&&(this.next(),!0)},Mt.isContextual=function(e){return this.type===j.name&&this.value===e&&!this.containsEsc},Mt.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1},Mt.catchStackOverflow=function(e){try{return e()}catch(e){if(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message)))this.raise(this.start,`Not enough stack space to parse input`);else throw e}},Mt.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},Mt.canInsertSemicolon=function(){return this.type===j.eof||this.type===j.braceR||We.test(this.input.slice(this.lastTokEnd,this.start))},Mt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Mt.semicolon=function(){!this.eat(j.semi)&&!this.insertSemicolon()&&this.unexpected()},Mt.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},Mt.expect=function(e){this.eat(e)||this.unexpected()},Mt.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var Pt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Mt.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},Mt.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},Mt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},Mt.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var N=M.prototype;N.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==j.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType===`commonjs`?`script`:this.options.sourceType,this.finishNode(e,`Program`)};var Ft={kind:`loop`},It={kind:`switch`};N.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;Ye.lastIndex=this.pos;var t=Ye.exec(this.input),n=this.pos+t[0].length,r=this.fullCharCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(Re(r)){var i=n;do n+=r<=65535?1:2;while(ze(r=this.fullCharCodeAt(n)));if(r===92)return!0;var a=this.input.slice(i,n);if(!Pe.test(a))return!0}return!1},N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;Ye.lastIndex=this.pos;var e=Ye.exec(this.input),t=this.pos+e[0].length,n;return!We.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)===`function`&&(t+8===this.input.length||!(ze(n=this.fullCharCodeAt(t+8))||n===92))},N.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;Ye.lastIndex=this.pos;var n=Ye.exec(this.input),r=this.pos+n[0].length;if(We.test(this.input.slice(this.pos,r)))return!1;if(e){var i=r+5,a;if(this.input.slice(r,i)!==`using`||i===this.input.length||ze(a=this.fullCharCodeAt(i))||a===92)return!1;Ye.lastIndex=i;var o=Ye.exec(this.input);if(r=i+o[0].length,o&&We.test(this.input.slice(i,r)))return!1}var s=this.fullCharCodeAt(r);if(!Re(s)&&s!==92)return!1;var c=r;do r+=s<=65535?1:2;while(ze(s=this.fullCharCodeAt(r)));if(s===92)return!0;var l=this.input.slice(c,r);if(Pe.test(l))return!1;if(t&&!e&&l===`of`){Ye.lastIndex=r;var u=Ye.exec(this.input);if(r+=u[0].length,this.input.charCodeAt(r)!==61||(s=this.input.charCodeAt(r+1))===61||s===62)return!1}return!0},N.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},N.isUsing=function(e){return this.isUsingKeyword(!1,e)},N.parseStatement=function(e,t,n){var r=this.type,i=this.startNode(),a;switch(this.isLet(e)&&(r=j._var,a=`let`),r){case j._break:case j._continue:return this.parseBreakContinueStatement(i,r.keyword);case j._debugger:return this.parseDebuggerStatement(i);case j._do:return this.parseDoStatement(i);case j._for:return this.parseForStatement(i);case j._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(i,!1,!e);case j._class:return e&&this.unexpected(),this.parseClass(i,!0);case j._if:return this.parseIfStatement(i);case j._return:return this.parseReturnStatement(i);case j._switch:return this.parseSwitchStatement(i);case j._throw:return this.parseThrowStatement(i);case j._try:return this.parseTryStatement(i);case j._const:case j._var:return a||=this.value,e&&a!==`var`&&this.unexpected(),this.parseVarStatement(i,a);case j._while:return this.parseWhileStatement(i);case j._with:return this.parseWithStatement(i);case j.braceL:return this.parseBlock(!0,i);case j.semi:return this.parseEmptyStatement(i);case j._export:case j._import:if(this.options.ecmaVersion>10&&r===j._import){Ye.lastIndex=this.pos;var o=Ye.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(i,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),r===j._import?this.parseImport(i):this.parseExport(i,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(i,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,`Using declaration is not allowed in single-statement positions`),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(i,!1,l),this.semicolon(),this.finishNode(i,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return r===j.name&&d.type===`Identifier`&&this.eat(j.colon)?this.parseLabeledStatement(i,u,d,e):this.parseExpressionStatement(i,d)}},N.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(j.semi)||this.insertSemicolon()?e.label=null:this.type===j.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},N.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},N.parseDoStatement=function(e){return this.next(),this.labels.push(Ft),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(j._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(j.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},N.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(Ft),this.enterScope(0),this.expect(j.parenL),this.type===j.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===j._var||this.type===j._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new Pt,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===j._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===j._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start===d&&!l&&f.type===`Identifier`&&f.name===`async`?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},N.parseForAfterInit=function(e,t,n){return(this.type===j._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.type===j._in?((t.kind===`using`||t.kind===`await using`)&&!t.declarations[0].init&&this.raise(this.start,`Using declaration is not allowed in for-in loops`),this.options.ecmaVersion>=9&&n>-1&&this.unexpected(n)):this.options.ecmaVersion>=9&&(e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},N.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Rt|(n?0:zt),!1,t)},N.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(j._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},N.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(j.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},N.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(j.braceL),this.labels.push(It),this.enterScope(St);for(var t,n=!1;this.type!==j.braceR;)if(this.type===j._case||this.type===j._default){var r=this.type===j._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(j.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},N.parseThrowStatement=function(e){return this.next(),We.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var Lt=[];N.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?_t:0),this.checkLValPattern(e,t?kt:Dt),this.expect(j.parenR),e},N.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===j._catch){var t=this.startNode();this.next(),this.eat(j.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(j._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},N.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},N.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Ft),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},N.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},N.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},N.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===j._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=o;else break}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},N.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},N.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(j.braceL),e&&this.enterScope(0);this.type!==j.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},N.parseFor=function(e,t){return e.init=t,this.expect(j.semi),e.test=this.type===j.semi?null:this.parseExpression(),this.expect(j.semi),e.update=this.type===j.parenR?null:this.parseExpression(),this.expect(j.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},N.parseForIn=function(e,t){var n=this.type===j._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(j.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},N.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(j.eq)?i.init=this.parseMaybeAssign(t):!r&&n===`const`&&!(this.type===j._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))?this.unexpected():!r&&(n===`using`||n===`await using`)&&this.options.ecmaVersion>=17&&this.type!==j._in&&!this.isContextual(`of`)?this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):!r&&i.id.type!==`Identifier`&&(!t||this.type!==j._in&&!this.isContextual(`of`))?this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):i.init=null,e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(j.comma))break}return e},N.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?Et:Dt,!1)};var Rt=1,zt=2,Bt=4;N.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===j.star&&t&zt&&this.unexpected(),e.generator=this.eat(j.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Rt&&(e.id=t&Bt&&this.type!==j.name?null:this.parseIdent(),e.id&&!(t&zt)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Et:Dt:Ot));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(wt(e.async,e.generator)),t&Rt||(e.id=this.type===j.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Rt?`FunctionDeclaration`:`FunctionExpression`)},N.parseFunctionParams=function(e){this.expect(j.parenL),e.params=this.parseBindingList(j.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},N.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(j.braceL);this.type!==j.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Vt(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},N.parseClassElement=function(e){if(this.eat(j.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(j.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===j.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&((this.isClassElementNameStart()||this.type===j.star)&&!this.canInsertSemicolon()?a=!0:r=`async`),!r&&(t>=9||!a)&&this.eat(j.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===j.parenL||o!==`method`||i||a){var l=!n.static&&Ht(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},N.isClassElementNameStart=function(){return this.type===j.name||this.type===j.privateId||this.type===j.num||this.type===j.string||this.type===j.bracketL||this.type.keyword},N.parseClassElementName=function(e){this.type===j.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},N.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&Ht(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},N.parseClassField=function(e){return Ht(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&Ht(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(j.eq)?(this.enterScope(xt|vt),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},N.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(bt|vt);this.type!==j.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},N.parseClassId=function(e,t){this.type===j.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Dt,!1)):(t===!0&&this.unexpected(),e.id=null)},N.parseClassSuper=function(e){e.superClass=this.eat(j._extends)?this.parseExprSubscripts(null,!1):null},N.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},N.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];$e(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}};function Vt(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type===`MethodDefinition`&&(t.kind===`get`||t.kind===`set`)&&(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):r?!0:(e[n]=i,!1)}function Ht(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}N.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==j.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},N.parseExport=function(e,t){if(this.next(),this.eat(j.star))return this.parseExportAllDeclaration(e,t);if(this.eat(j._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==j.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},N.parseExportDeclaration=function(e){return this.parseStatement(null)},N.parseExportDefaultDeclaration=function(){var e;if(this.type===j._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Rt|Bt,!1,e)}if(this.type===j._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},N.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),$e(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},N.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},N.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},N.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},N.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},N.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(j.braceL);!this.eat(j.braceR);){if(n)n=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;t.push(this.parseExportSpecifier(e))}return t},N.parseImport=function(e){return this.next(),this.type===j.string?(e.specifiers=Lt,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===j.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},N.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Dt),this.finishNode(e,`ImportSpecifier`)},N.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Dt),this.finishNode(e,`ImportDefaultSpecifier`)},N.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,Dt),this.finishNode(e,`ImportNamespaceSpecifier`)},N.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===j.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(j.comma)))return e;if(this.type===j.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(j.braceL);!this.eat(j.braceR);){if(t)t=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;e.push(this.parseImportSpecifier())}return e},N.parseWithClause=function(){var e=[];if(!this.eat(j._with))return e;this.expect(j.braceL);for(var t={},n=!0;!this.eat(j.braceR);){if(n)n=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;$e(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},N.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===j.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(j.colon),this.type!==j.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===j.string){var e=this.parseLiteral(this.value);return it.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},N.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},N.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var Ut=M.prototype;Ut.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type===`RestElement`&&(a.argument.type===`ArrayPattern`||a.argument.type===`ObjectPattern`)&&this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Ut.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Ut.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Ut.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==j.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Ut.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case j.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(j.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case j.braceL:return this.parseObj(!0)}return this.parseIdent()},Ut.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(j.comma),t&&this.type===j.comma)i.push(null);else if(n&&this.afterTrailingComma(e))break;else if(this.type===j.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===j.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}else i.push(this.parseAssignableListItem(r));return i},Ut.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Ut.parseBindingListItem=function(e){return e},Ut.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(j.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Ut.checkLValSimple=function(e,t,n){t===void 0&&(t=Tt);var r=t!==Tt;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===Dt&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&($e(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==At&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Ut.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=Tt),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Ut.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=Tt),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Wt=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},P={b_stat:new Wt(`{`,!1),b_expr:new Wt(`{`,!0),b_tmpl:new Wt("${",!1),p_stat:new Wt(`(`,!1),p_expr:new Wt(`(`,!0),q_tmpl:new Wt("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Wt(`function`,!1),f_expr:new Wt(`function`,!0),f_expr_gen:new Wt(`function`,!0,!1,null,!0),f_gen:new Wt(`function`,!1,!1,null,!0)},Gt=M.prototype;Gt.initialContext=function(){return[P.b_stat]},Gt.curContext=function(){return this.context[this.context.length-1]},Gt.braceIsBlock=function(e){var t=this.curContext();return t===P.f_expr||t===P.f_stat?!0:e===j.colon&&(t===P.b_stat||t===P.b_expr)?!t.isExpr:e===j._return||e===j.name&&this.exprAllowed?We.test(this.input.slice(this.lastTokEnd,this.start)):e===j._else||e===j.semi||e===j.eof||e===j.parenR||e===j.arrow?!0:e===j.braceL?t===P.b_stat:e===j._var||e===j._const||e===j.name?!1:!this.exprAllowed},Gt.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Gt.updateContext=function(e){var t,n=this.type;n.keyword&&e===j.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Gt.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},j.parenR.updateContext=j.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===P.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr},j.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?P.b_stat:P.b_expr),this.exprAllowed=!0},j.dollarBraceL.updateContext=function(){this.context.push(P.b_tmpl),this.exprAllowed=!0},j.parenL.updateContext=function(e){var t=e===j._if||e===j._for||e===j._with||e===j._while;this.context.push(t?P.p_stat:P.p_expr),this.exprAllowed=!0},j.incDec.updateContext=function(){},j._function.updateContext=j._class.updateContext=function(e){e.beforeExpr&&e!==j._else&&(e!==j.semi||this.curContext()===P.p_stat)&&!(e===j._return&&We.test(this.input.slice(this.lastTokEnd,this.start)))&&(e!==j.colon&&e!==j.braceL||this.curContext()!==P.b_stat)?this.context.push(P.f_expr):this.context.push(P.f_stat),this.exprAllowed=!1},j.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},j.backQuote.updateContext=function(){this.curContext()===P.q_tmpl?this.context.pop():this.context.push(P.q_tmpl),this.exprAllowed=!1},j.star.updateContext=function(e){if(e===j._function){var t=this.context.length-1;this.context[t]===P.f_expr?this.context[t]=P.f_expr_gen:this.context[t]=P.f_gen}this.exprAllowed=!0},j.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==j.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var F=M.prototype;F.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`)&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,i;switch(r.type){case`Identifier`:i=r.name;break;case`Literal`:i=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){i===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=r.start):this.raiseRecoverable(r.start,`Redefinition of __proto__ property`)),t.proto=!0);return}i=`$`+i;var o=t[i];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(r.start,`Redefinition of property`):o=t[i]={init:!1,get:!1,set:!1},o[a]=!0}},F.parseExpression=function(e,t){var n=this;return this.catchStackOverflow(function(){var r=n.start,i=n.startLoc,a=n.parseMaybeAssign(e,t);if(n.type===j.comma){var o=n.startNodeAt(r,i);for(o.expressions=[a];n.eat(j.comma);)o.expressions.push(n.parseMaybeAssign(e,t));return n.finishNode(o,`SequenceExpression`)}return a})},F.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Pt,r=!0);var s=this.start,c=this.startLoc;(this.type===j.parenL||this.type===j.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===j.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===j.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},F.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if((i.type!==`ArrowFunctionExpression`||i.start!==n)&&this.eat(j.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(j.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},F.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},F.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==j._in)&&a>r){var o=this.type===j.logicalOR||this.type===j.logicalAND,s=this.type===j.coalesce;s&&(a=j.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===j.coalesce||s&&(this.type===j.logicalOR||this.type===j.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},F.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},F.parseMaybeUnary=function(e,t,n,r){var i=this.start,a=this.startLoc,o;if(this.isContextual(`await`)&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===j.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&Kt(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&qt(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,o=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(!t&&this.type===j.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==j._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(i,a);l.operator=this.value,l.prefix=!1,l.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(l,`UpdateExpression`)}}if(!n&&(o.type!==`ArrowFunctionExpression`||o.start!==i)&&this.eat(j.starstar)){if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(i,a,o,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)}else return o};function Kt(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&Kt(e.expression)}function qt(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&qt(e.expression)||e.type===`ParenthesizedExpression`&&qt(e.expression)}F.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},F.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},F.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(j.arrow)},F.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},F.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(j.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(j.bracketL);if(l||c&&this.type!==j.parenL&&this.type!==j.backQuote||this.eat(j.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(j.bracketR)):u.property=this.type===j.privateId&&e.type!==`Super`?this.parsePrivateIdent():this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(j.parenL)){var d=new Pt,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(j.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===j.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},F.parseExprAtom=function(e,t,n){this.type===j.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case j._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type===j.parenL&&!this.allowDirectSuper&&this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==j.dot&&this.type!==j.bracketL&&this.type!==j.parenL&&this.unexpected(),this.finishNode(r,`Super`);case j._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case j.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(j._function))return this.overrideContext(P.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(j.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===j.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(j.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case j.regexp:var l=this.value;return r=this.parseLiteral(l.value),r.regex={pattern:l.pattern,flags:l.flags},r;case j.num:case j.string:return this.parseLiteral(this.value);case j._null:case j._true:case j._false:return r=this.startNode(),r.value=this.type===j._null?null:this.type===j._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case j.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case j.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(j.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case j.braceL:return this.overrideContext(P.b_expr),this.parseObj(!1,e);case j._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case j._class:return this.parseClass(this.startNode(),!1);case j._new:return this.parseNew();case j.backQuote:return this.parseTemplate();case j._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},F.parseExprAtomDefault=function(){this.unexpected()},F.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===j.parenL&&!e)return this.parseDynamicImport(t);if(this.type===j.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},F.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(j.parenR)?e.options=null:(this.expect(j.comma),this.afterTrailingComma(j.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(j.parenR)||(this.expect(j.comma),this.afterTrailingComma(j.parenR)||this.unexpected())));else if(!this.eat(j.parenR)){var t=this.start;this.eat(j.comma)&&this.eat(j.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},F.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType!==`module`&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},F.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},F.parseParenExpression=function(){this.expect(j.parenL);var e=this.parseExpression();return this.expect(j.parenR),e},F.shouldParseArrow=function(e){return!this.canInsertSemicolon()},F.parseParenAndDistinguishExpression=function(e,t){var n=this.start,r=this.startLoc,i,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,s=this.startLoc,c=[],l=!0,u=!1,d=new Pt,f=this.yieldPos,p=this.awaitPos,m;for(this.yieldPos=0,this.awaitPos=0;this.type!==j.parenR;){if(l?l=!1:this.expect(j.comma),a&&this.afterTrailingComma(j.parenR,!0)){u=!0;break}if(this.type===j.ellipsis){m=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===j.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}c.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(j.parenR),e&&this.shouldParseArrow(c)&&this.eat(j.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=f,this.awaitPos=p,this.parseParenArrowList(n,r,c,t);(!c.length||u)&&this.unexpected(this.lastTokStart),m&&this.unexpected(m),this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,c.length>1?(i=this.startNodeAt(o,s),i.expressions=c,this.finishNodeAt(i,`SequenceExpression`,h,g)):i=c[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,r);return _.expression=i,this.finishNode(_,`ParenthesizedExpression`)}return i},F.parseParenItem=function(e){return e},F.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var Jt=[];F.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===j.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),e.callee.type===`Super`&&this.raiseRecoverable(r,`Invalid use of 'super'`),e.arguments=this.eat(j.parenL)?this.parseExprList(j.parenR,this.options.ecmaVersion>=8,!1):Jt,this.finishNode(e,`NewExpression`)},F.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===j.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
|
|
15
|
+
`),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
16
|
+
`),cooked:this.value},this.next(),n.tail=this.type===j.backQuote,this.finishNode(n,`TemplateElement`)},F.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===j.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(j.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(j.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},F.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===j.name||this.type===j.num||this.type===j.string||this.type===j.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===j.star)&&!We.test(this.input.slice(this.lastTokEnd,this.start))},F.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(j.braceR);){if(r)r=!1;else if(this.expect(j.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(j.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},F.parseProperty=function(e,t){var n=this.startNode(),r,i,a,o;if(this.options.ecmaVersion>=9&&this.eat(j.ellipsis))return e?(n.argument=this.parseIdent(!1),this.type===j.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(n,`RestElement`)):(n.argument=this.parseMaybeAssign(!1,t),this.type===j.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(n,`SpreadElement`));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(j.star)));var s=this.containsEsc;return this.parsePropertyName(n),!e&&!s&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(n)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(j.star),this.parsePropertyName(n)):i=!1,this.parsePropertyValue(n,e,r,i,a,o,t,s),this.finishNode(n,`Property`)},F.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},F.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===j.colon&&this.unexpected(),this.eat(j.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===j.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):!t&&!s&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type===`Identifier`&&(e.key.name===`get`||e.key.name===`set`)&&this.type!==j.comma&&this.type!==j.braceR&&this.type!==j.eq?((n||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===j.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected()},F.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(j.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(j.bracketR),e.key;e.computed=!1}return e.key=this.type===j.num||this.type===j.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},F.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},F.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(wt(t,r.generator)|vt|(n?yt:0)),this.expect(j.parenL),r.params=this.parseBindingList(j.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},F.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(wt(n,!1)|gt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},F.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==j.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||s)&&(o=this.strictDirective(this.end),o&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`));var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,At),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},F.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},F.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,Et,t?null:n)}},F.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(j.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===j.comma?o=null:this.type===j.ellipsis?(o=this.parseSpread(r),r&&this.type===j.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},F.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),!(this.currentThisScope().flags&Ct)&&r===`arguments`&&this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),this.inClassStaticBlock&&(r===`arguments`||r===`await`)&&this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),!(this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(!this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},F.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name===`await`&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},F.parseIdentNode=function(){var e=this.startNode();return this.type===j.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name===`class`||e.name===`function`)&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=j.name):this.unexpected(),e},F.parsePrivateIdent=function(){var e=this.startNode();return this.type===j.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},F.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===j.semi||this.canInsertSemicolon()||this.type!==j.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(j.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},F.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var Yt=M.prototype;Yt.raise=function(e,t){var n=st(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},Yt.raiseRecoverable=Yt.raise,Yt.curPosition=function(){if(this.options.locations)return new at(this.curLine,this.pos-this.lineStart)};var Xt=M.prototype,Zt=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};Xt.enterScope=function(e){this.scopeStack.push(new Zt(e))},Xt.exitScope=function(){this.scopeStack.pop()},Xt.treatFunctionsAsVarInScope=function(e){return e.flags&pt||!this.inModule&&e.flags&ft},Xt.declareName=function(e,t,n){var r=!1;if(t===Dt){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&ft&&delete this.undefinedExports[e]}else if(t===kt)this.currentScope().lexical.push(e);else if(t===Ot){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(s.flags&_t&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&s.flags&ft&&delete this.undefinedExports[e],s.flags&Ct)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},Xt.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Xt.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Xt.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ct|xt|bt))return t}},Xt.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Ct|xt|bt)&&!(t.flags>))return t}};var Qt=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new ot(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},$t=M.prototype;$t.startNode=function(){return new Qt(this,this.start,this.startLoc)},$t.startNodeAt=function(e,t){return new Qt(this,e,t)};function en(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}$t.finishNode=function(e,t){return en.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},$t.finishNodeAt=function(e,t,n,r){return en.call(this,e,t,n,r)},$t.copyNode=function(e){var t=new Qt(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var tn=`Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz`,nn=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,rn=nn+` Extended_Pictographic`,an=rn,on=an+` EBase EComp EMod EPres ExtPict`,sn=on,cn={9:nn,10:rn,11:an,12:on,13:sn,14:sn},ln={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},un=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,dn=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,fn=dn+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,pn=fn+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,mn=pn+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,hn=mn+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,gn={9:dn,10:fn,11:pn,12:mn,13:hn,14:hn+` `+tn},_n={};function vn(e){var t=_n[e]={binary:nt(cn[e]+` `+un),binaryOfStrings:nt(ln[e]),nonBinary:{General_Category:nt(un),Script:nt(gn[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var yn=0,bn=[9,10,11,12,13,14];yn<bn.length;yn+=1){var xn=bn[yn];vn(xn)}var I=M.prototype,Sn=function(e,t){this.parent=e,this.base=t||this};Sn.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Sn.prototype.sibling=function(){return new Sn(this.parent,this.base)};var Cn=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=_n[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Cn.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=e|0,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Cn.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Cn.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!(t||this.switchU)||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Cn.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i=n.charCodeAt(e),a;return!(t||this.switchU)||i<=55295||i>=57344||e+1>=r||(a=n.charCodeAt(e+1))<56320||a>57343?e+1:e+2},Cn.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Cn.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Cn.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Cn.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Cn.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},I.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)};function wn(e){for(var t in e)return!0;return!1}I.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&wn(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},I.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},I.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Sn(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},I.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},I.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1},I.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},I.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1},I.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},I.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},I.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},I.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},I.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);!n&&!o&&e.current()===58&&e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},I.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},I.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&Tn(n);)t+=rt(n),e.advance();return t};function Tn(e){return e===105||e===109||e===115}I.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},I.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},I.regexp_eatSyntaxCharacter=function(e){var t=e.current();return En(t)?(e.lastIntValue=t,e.advance(),!0):!1};function En(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}I.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!En(n);)e.advance();return e.pos!==t},I.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124&&(e.advance(),!0)},I.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n){if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`)}t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},I.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},I.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=rt(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=rt(e.lastIntValue);return!0}return!1},I.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),Dn(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Dn(e){return Re(e,!0)||e===36||e===95}I.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),On(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function On(e){return ze(e,!0)||e===36||e===95||e===8204||e===8205}I.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},I.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},I.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},I.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},I.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},I.regexp_eatZero=function(e){return e.current()===48&&!Bn(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},I.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},I.regexp_eatControlLetter=function(e){var t=e.current();return kn(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function kn(e){return e>=65&&e<=90||e>=97&&e<=122}I.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(r&&i>=55296&&i<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(i-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=i}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&An(e.lastIntValue))return!0;r&&e.raise(`Invalid unicode escape`),e.pos=n}return!1};function An(e){return e>=0&&e<=1114111}I.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)&&(e.lastIntValue=t,e.advance(),!0)},I.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};var jn=0,Mn=1,Nn=2;I.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Pn(t))return e.lastIntValue=-1,e.advance(),Mn;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===Nn&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return jn};function Pn(e){return e===100||e===68||e===115||e===83||e===119||e===87}I.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),Mn}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return jn},I.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){$e(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},I.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Mn;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return Nn;e.raise(`Invalid property name`)},I.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;Fn(t=e.current());)e.lastStringValue+=rt(t),e.advance();return e.lastStringValue!==``};function Fn(e){return kn(e)||e===95}I.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;In(t=e.current());)e.lastStringValue+=rt(t),e.advance();return e.lastStringValue!==``};function In(e){return Fn(e)||Bn(e)}I.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},I.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===Nn&&e.raise(`Negated character class may contain strings`),!0}return!1},I.regexp_classContents=function(e){return e.current()===93?Mn:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Mn)},I.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;e.switchU&&(t===-1||n===-1)&&e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},I.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||Un(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},I.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},I.regexp_classSetExpression=function(e){var t=Mn,n;if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e)){n===Nn&&(t=Nn);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(n=this.regexp_eatClassSetOperand(e))){n!==Nn&&(t=Mn);continue}e.raise(`Invalid character in character class`)}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return t}else e.raise(`Invalid character in character class`)}for(;;)if(!this.regexp_eatClassSetRange(e)){if(n=this.regexp_eatClassSetOperand(e),!n)return t;n===Nn&&(t=Nn)}},I.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},I.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Mn:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},I.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===Nn&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},I.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},I.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Nn&&(t=Nn);return t},I.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Mn:Nn},I.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var n=e.current();return n<0||n===e.lookahead()&&Ln(n)||Rn(n)?!1:(e.advance(),e.lastIntValue=n,!0)};function Ln(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function Rn(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}I.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return zn(t)?(e.lastIntValue=t,e.advance(),!0):!1};function zn(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}I.regexp_eatClassControlLetter=function(e){var t=e.current();return Bn(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1},I.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},I.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Bn(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t};function Bn(e){return e>=48&&e<=57}I.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;Vn(n=e.current());)e.lastIntValue=16*e.lastIntValue+Hn(n),e.advance();return e.pos!==t};function Vn(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Hn(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}I.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;e.lastIntValue=t<=3&&this.regexp_eatOctalDigit(e)?t*64+n*8+e.lastIntValue:t*8+n}else e.lastIntValue=t;return!0}return!1},I.regexp_eatOctalDigit=function(e){var t=e.current();return Un(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Un(e){return e>=48&&e<=55}I.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!Vn(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+Hn(i),e.advance()}return!0};var Wn=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new ot(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},L=M.prototype;L.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new Wn(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},L.getToken=function(){return this.next(),new Wn(this)},typeof Symbol<`u`&&(L[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===j.eof,value:t}}}}),L.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(j.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())},L.readToken=function(e){return Re(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},L.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var n=this.input.charCodeAt(e+1);return n<=56319||n>=57344?t:(t<<10)+n-56613888},L.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},L.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=qe(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},L.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Ke(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},L.skipSpace=function(){loop:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(e>8&&e<14||e>=5760&&Je.test(String.fromCharCode(e)))++this.pos;else break loop}}},L.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},L.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(j.ellipsis)):(++this.pos,this.finishToken(j.dot))},L.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(j.assign,2):this.finishOp(j.slash,1)},L.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?j.star:j.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=j.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(j.assign,n+1):this.finishOp(r,n)},L.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(j.assign,3):this.finishOp(e===124?j.logicalOR:j.logicalAND,2):t===61?this.finishOp(j.assign,2):this.finishOp(e===124?j.bitwiseOR:j.bitwiseAND,1)},L.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(j.assign,2):this.finishOp(j.bitwiseXOR,1)},L.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||We.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(j.incDec,2):t===61?this.finishOp(j.assign,2):this.finishOp(j.plusMin,1)},L.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(j.assign,n+1):this.finishOp(j.bitShift,n)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(n=2),this.finishOp(j.relational,n))},L.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(j.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(j.arrow)):this.finishOp(e===61?j.eq:j.prefix,1)},L.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(j.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(j.assign,3):this.finishOp(j.coalesce,2)}return this.finishOp(j.question,1)},L.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),Re(t,!0)||t===92))return this.finishToken(j.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+rt(t)+`'`)},L.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(j.parenL);case 41:return++this.pos,this.finishToken(j.parenR);case 59:return++this.pos,this.finishToken(j.semi);case 44:return++this.pos,this.finishToken(j.comma);case 91:return++this.pos,this.finishToken(j.bracketL);case 93:return++this.pos,this.finishToken(j.bracketR);case 123:return++this.pos,this.finishToken(j.braceL);case 125:return++this.pos,this.finishToken(j.braceR);case 58:return++this.pos,this.finishToken(j.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(j.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(j.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+rt(e)+`'`)},L.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},L.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(We.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Cn(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(j.regexp,{pattern:i,flags:o,value:c})},L.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95){i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;continue}if(d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0,d>=e)break;s=u,o=o*e+d}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o};function Gn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,``))}function Kn(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}L.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=Kn(this.input.slice(t,this.pos)),++this.pos):Re(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(j.num,n)},L.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=Kn(this.input.slice(t,this.pos));return++this.pos,Re(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(j.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r===46&&!n&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!n&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),Re(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a=Gn(this.input.slice(t,this.pos),n);return this.finishToken(j.num,a)},L.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var n=++this.pos;t=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(n,`Code point out of bounds`)}else t=this.readHexChar(4);return t},L.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Ke(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(j.string,t)};var qn={};L.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===qn)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1},L.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw qn;this.raise(e,t)},L.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===j.template||this.type===j.invalidTemplate)?n===36?(this.pos+=2,this.finishToken(j.dollarBraceL)):(++this.pos,this.finishToken(j.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(j.template,e));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Ke(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
|
|
17
|
+
`;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},L.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(j.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
|
|
18
|
+
`&&++this.pos;case`
|
|
19
|
+
`:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},L.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
|
|
20
|
+
`;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return rt(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return Ke(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},L.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},L.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(ze(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?Re:ze)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=rt(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},L.readWord=function(){var e=this.readWord1(),t=j.name;return this.keywords.test(e)&&(t=Ue[e]),this.finishToken(t,e)},M.acorn={Parser:M,version:`8.18.0`,defaultOptions:ct,Position:at,SourceLocation:ot,getLineInfo:st,Node:Qt,TokenType:k,tokTypes:j,keywordTypes:Ue,TokContext:Wt,tokContexts:P,isIdentifierChar:ze,isIdentifierStart:Re,Token:Wn,isNewLine:Ke,lineBreak:We,lineBreakG:Ge,nonASCIIwhitespace:Je};function Jn(e,t,n){return M.parseExpressionAt(e,t,n)}function R({raw:e,noTrim:t},n,r){if(t||e||n.length<=r)return n;let i=n.slice(0,Math.max(r,0)),a=i.length===0?``:i.length<=3?`.`:i.length===4?`..`:`...`;return i.slice(0,i.length-a.length)+a}const z=new Map;z.set(`!`,16),z.set(`~`,16),z.set(`+`,16),z.set(`-`,16),z.set(`++`,16),z.set(`--`,16),z.set(`**`,15),z.set(`*`,14),z.set(`/`,14),z.set(`%`,14),z.set(`+`,13),z.set(`-`,13),z.set(`<<`,12),z.set(`>>`,12),z.set(`>>>`,12),z.set(`<`,11),z.set(`<=`,11),z.set(`>`,11),z.set(`>=`,11),z.set(`&`,9),z.set(`^`,8),z.set(`|`,7),z.set(`&&`,6),z.set(`||`,5);function Yn(e,t){return z.get(e)>z.get(t)}function Xn(e,t,n){let r=Zn(t),i=Jn(`(${r})`,0,{ecmaVersion:2020});return B({...e,rawString:r},i,n)}function Zn(e){let t=e.toString(),n=t.startsWith(`async `),r=n?t.slice(6):t,i=/^([^\s\\)]+)\s?\(/.exec(r);return i&&i[1]!==`function`&&i[1]!==`function*`?`${n?`async `:``}function ${t}`:t}function B(e,t,n){if(!t)return``;switch(t.type){case`Identifier`:return Or(e,t,n);case`Literal`:return kr(e,t,n);case`AssignmentPattern`:return jr(e,t,n);case`RestElement`:case`SpreadElement`:return Ar(e,t,n);case`ArrowFunctionExpression`:return Mr(e,t,n);case`ExpressionStatement`:return Fr(e,t,n);case`CallExpression`:return Lr(e,t,n);case`MemberExpression`:return Ir(e,t,n);case`FunctionDeclaration`:case`FunctionExpression`:return Vr(e,t,n);case`BlockStatement`:case`ClassBody`:return Wr(e,t,n);case`ReturnStatement`:return Gr(e,t,n);case`VariableDeclaration`:return Dr(e,t,n);case`VariableDeclarator`:return Er(e,t,n);case`NewExpression`:return wr(e,t,n);case`BinaryExpression`:case`LogicalExpression`:return Cr(e,t,n);case`ConditionalExpression`:return xr(e,t,n);case`UnaryExpression`:return yr(e,t,n);case`UpdateExpression`:return br(e,t,n);case`IfStatement`:return Sr(e,t,n);case`WhileStatement`:return _r(e,t,n);case`AssignmentExpression`:return gr(e,t,n);case`DoWhileStatement`:return vr(e,t,n);case`ForStatement`:return hr(e,t,n);case`BreakStatement`:return mr(e,t,n);case`LabeledStatement`:return pr(e,t,n);case`ContinueStatement`:return fr(e,t,n);case`SwitchStatement`:return dr(e,t,n);case`SwitchCase`:return ur(e,t,n);case`ForInStatement`:return lr(e,t,n);case`ForOfStatement`:return cr(e,t,n);case`ObjectExpression`:return sr(e,t,n);case`Property`:return or(e,t,n);case`YieldExpression`:return ir(e,t,n);case`AwaitExpression`:return rr(e,t,n);case`ArrayExpression`:return nr(e,t,n);case`ThrowStatement`:return tr(e,t,n);case`TryStatement`:return er(e,t,n);case`CatchClause`:return $n(e,t,n);case`ThisExpression`:return Kr(e,t,n);case`ClassExpression`:return qr(e,t,n);case`MethodDefinition`:return Jr(e,t,n);case`ObjectPattern`:return Yr(e,t,n);case`SequenceExpression`:return Xr(e,t,n);case`TemplateLiteral`:return Zr(e,t,n);case`TaggedTemplateExpression`:return Qr(e,t,n);case`ChainExpression`:return $r(e,t,n);case`MetaProperty`:return ar(e,t,n);case`Super`:return ei(e,t,n);default:return Qn(t,e.rawString)}}function Qn(e,t){let n=e.type;return console.warn(`tersify received unsupported type: ${n}. Please open an issue at https://github.com/unional/tersify/issues
|
|
21
|
+
node detail:
|
|
22
|
+
${JSON.stringify(e,void 0,2)}
|
|
23
|
+
|
|
24
|
+
subject:
|
|
25
|
+
${t}`),`<unsupported: ${n}>`}function $n(e,t,n){let r=B(e,t.param,n),i=B(e,t.body,n);return`catch${r?` (${r})`:``}${i?` ${i}`:``}`}function er(e,t,n){let r=B(e,t.block,n),i=B(e,t.handler,n),a=B(e,t.finalizer,n);return`try ${r}${i?` ${i}`:``}${a?` finally ${a}`:``}`}function tr(e,t,n){return`throw ${B(e,t.argument,n)}`}function nr(e,t,n){return R(e,`[${t.elements.map(t=>B(e,t,n)).join(`, `)}]`,n)}function rr(e,t,n){return`await ${B(e,t.argument,n)}`}function ir(e,t,n){return`yield ${B(e,t.argument,n)}`}function ar(e,t,n){return`${B(e,t.meta,n)}.${B(e,t.property,n)}`}function or(e,t,n){let r=B(e,t.key,n),i=t.value;if(i.type===`FunctionExpression`)return`${i.async?`async `:``}${i.generator?`*`:``}${r}${Hr(e,i.params)} ${Ur(e,i.body)}`;if(i.type===`AssignmentPattern`)return B(e,i,n);let a=B(e,i,n);return t.computed?`[${r}]: ${a}`:r===a?r:`${r}: ${a}`}function sr(e,t,n){return`{ ${t.properties.map(t=>B(e,t,n)).join(`, `)} }`}function cr(e,t,n){return`for (${B(e,t.left,n)} of ${B(e,t.right,n)}) ${B(e,t.body,n)}`}function lr(e,t,n){return`for (${B(e,t.left,n)} in ${B(e,t.right,n)}) ${B(e,t.body,n)}`}function ur(e,t,n){let r=B(e,t.test,n),i=t.consequent.map(t=>B(e,t,n));return t.test?`case ${r}: ${i.join(` `)}`:`default: ${i.join(` `)}`}function dr(e,t,n){return`switch (${B(e,t.discriminant,n)}) { ${t.cases.map(t=>B(e,t,n)).join(`; `)} }`}function fr(e,t,n){let r=B(e,t.label,n);return r?`continue ${r}`:`continue`}function pr(e,t,n){return`${B(e,t.label,n)}: ${B(e,t.body,n)}`}function mr(e,t,n){let r=B(e,t.label,n);return r?`break ${r}`:`break`}function hr(e,t,n){let r=B(e,t.test,n),i=B(e,t.init,n),a=B(e,t.update,n),o=B(e,t.body,n);return`for (${i};${r?` ${r}`:``};${a?` ${a}`:``}) ${o}`}function gr(e,t,n){let r=B(e,t.left,n),i=B(e,t.right,n);return`${r} ${t.operator} ${i}`}function _r(e,t,n){return`while (${B(e,t.test,n)}) ${B(e,t.body,n)}`}function vr(e,t,n){let r=B(e,t.test,n),i=B(e,t.body,n);return t.body.type===`BlockStatement`?`do ${i} while (${r})`:`do ${i}; while (${r})`}function yr(e,t,n){return[`void`,`typeof`].indexOf(t.operator)===-1?t.prefix?`${t.operator}${B(e,t.argument,n)}`:`${B(e,t.argument,n)}${t.operator}`:`${t.operator} ${B(e,t.argument,n)}`}function br(e,t,n){return t.prefix?`${t.operator}${B(e,t.argument,n)}`:`${B(e,t.argument,n)}${t.operator}`}function xr(e,t,n){return`${B(e,t.test,n)} ? ${B(e,t.consequent,n)} : ${B(e,t.alternate,n)}`}function Sr(e,t,n){let r=B(e,t.test,n),i=B(e,t.consequent,n),a=B(e,t.alternate,n);return a?t.consequent.type===`BlockStatement`?`if (${r}) ${i} else ${a}`:`if (${r}) ${i}; else ${a}`:`if (${r}) ${i}`}function Cr(e,t,n){(t.left.type===`BinaryExpression`||t.left.type===`LogicalExpression`)&&Yn(t.operator,t.left.operator)&&(t.left.needParen=!0);let r=B(e,t.left,n);(t.right.type===`BinaryExpression`||t.right.type===`LogicalExpression`)&&Yn(t.operator,t.right.operator)&&(t.right.needParen=!0);let i=B(e,t.right,n);return t.needParen?`(${r} ${t.operator} ${i})`:`${r} ${t.operator} ${i}`}function wr(e,t,n){return Tr(t)||`new ${B(e,t.callee,n)}(${t.arguments.map(t=>B(e,t,n)).join(`, `)})`}function Tr(e){if(e.callee.type===`Identifier`&&e.callee.name===`Date`){let t=e.arguments;if(t.length>0&&!t.some(e=>e.type!==`Literal`)){let e=t;if(e.length===1){let t=e[0];if(typeof t.value==`string`)return new Date(t.value).toISOString()}let n=e.map(e=>e.value);return new Date(...n).toISOString()}}}function Er(e,t,n){return`${t.id.name}${t.init?` = ${B(e,t.init,n)}`:``}`}function Dr(e,t,n){return`${t.kind} ${t.declarations.map(t=>B(e,t,n)).join(`, `)}`}function Or(e,t,n){return t.name===`Symbol`?`Sym`:t.name}function kr(e,t,n){return t.raw}function Ar(e,t,n){return`...${t.argument.name}`}function jr(e,t,n){return`${t.left.name} = ${B(e,t.right,n-t.left.name.length-3)}`}function Mr(e,t,n){let r=t.async?`async `:``,i=t.generator?`*`:``,a=` => `,o=t.params.length===1&&t.params[0].type!==`ObjectPattern`,s=Br(e,t.params),c=o?s:`(${s})`,l=Nr(e,t.body),u=l?Pr(e,l):Ur(e,t.body),d=l&&l.type===`ObjectExpression`;if(d&&(u=`(${u})`),r.length+i.length+c.length+4+u.length<=n)return`${r}${i}${c}${a}${u}`;{let t=Math.max(o?1:3,n-(r.length+i.length+4+u.length)),c=o?R(e,s,t):`(${R(e,s,t-2)})`;if(r.length+i.length+t+4+u.length<=n)return`${r}${i}${c}${a}${u}`;{let t=d?6:l?0:4,o=Math.max(3,n-(r.length+i.length+c.length+4+t));return R(e,`${r}${i}${c}${a}${d?`({ ${R(e,u.slice(2,u.length-2),o-4)} })`:l?R(e,u,o):`{ ${R(e,u.slice(2,u.length-1),o)} }`}`,n)}}}function Nr(e,t){if(t.type!==`BlockStatement`)return t;if(t.body.length===1&&t.body[0].type===`ReturnStatement`)return t.body[0]}function Pr(e,t){return t.type===`ReturnStatement`?t.argument?t.argument.type===`ObjectExpression`?`(${B(e,t.argument,1/0)})`:B(e,t.argument,1/0):`{}`:B(e,t,1/0)}function Fr(e,t,n){return B(e,t.expression,n)}function Ir(e,t,n){let r=t.property.type===`Identifier`?B(e,t.property,n):`[${B(e,t.property,n)}]`;return`${B(e,t.object,n)}${t.optional?`?`:``}.${r}`}function Lr(e,t,n){if(Rr(t))return`Sym(${t.arguments[0].value})`;if(zr(t)){let r=t.arguments[1].value;return`this.${r} = ${B(e,t.arguments[2],n-5-r.length-3)}`}let r=B(e,t.callee,n),i=Hr(e,t.arguments);return`${r}${t.optional?`?.`:``}${i}`}function Rr(e){return e.callee.type===`MemberExpression`&&e.callee.object.type===`Identifier`&&e.callee.object.name===`Symbol`&&e.callee.property.type===`Identifier`&&e.callee.property.name===`for`}function zr(e){return e.callee.type===`Identifier`&&e.callee.name===`_defineProperty`&&e.arguments.length===3&&e.arguments[0].type===`ThisExpression`}function Br(e,t){return t.reduce((t,n)=>(t.push(B(e,n,1/0)),t),[]).join(`, `)}function Vr(e,t,n){let r=e.raw?`function`:`fn`,i=t.async?`async `:``,a=t.generator?`*`:``,o=t.id?` ${t.id.name}`:``,s=t.params.length>0?Hr(e,t.params):`()`,c=i.length+r.length+a.length+o.length+1,l=s.slice(1,s.length-1),u=l.length>3?`(${R(e,l,3)})`:s,d=c+u.length,f=c+s.length,p=Ur(e,t.body);if(d+p.length>n){if(d+5>n)return R(e,`${i}${r}${a}${o}${u} ${p}`,n);{let t=p.slice(2,p.length-2),s=`${i}${r}${a}${o}${u} ${t.length===0?`{}`:`{ ${R(e,t,n-d-4)} }`}`;return s.length>n?R(e,s,n):s}}return f+p.length>n?d+p.length<n?`${i}${r}${a}${o}(${R(e,l,n-p.length-c-2)}) ${p}`:R(e,`${i}${r}${a}${o}${u} ${p}`,n):R(e,`${i}${r}${a}${o}${s} ${p}`,n)}function Hr(e,t){return`(${Br(e,t)})`}function Ur(e,t){return B(e,t,1/0)}function Wr(e,t,n){if(n<=3&&t.body.length>0)return R(e,`...`,n);if(n<=4&&t.body.length>0)return R(e,`{...`,n);let r=n-4,i=[];t.body.forEach(t=>{if(r){let n=B(e,t,r);r-=n.length,n&&n!==`return`&&i.push(n)}});let a=i.join(`; `);return`{${a?` ${a} `:``}}`}function Gr(e,t,n){return t.argument?`return ${B(e,t.argument,n)}`:`return`}function Kr(e,t,n){return`this`}function qr(e,t,n){let r=R(e,`class${t.id?` ${t.id.name}`:` `}{}`,n),i=r.slice(0,Math.max(3,r.length-2)),a=B(e,t.body,n-i.length);return`${i}${n>=i.length+a.length||a.length>3?a:R(e,`...`,n-i.length)}`}function Jr(e,t,n){let r=t.static?`static `:``,i=t.value,a=i.async?`async `:``,o=i.generator?`*`:``,s=t.key.name??`[${B(e,t.key,n)}]`,c=i.params.length>0?Hr(e,i.params):`()`,l=r.length+a.length+o.length+s.length+1,u=c.slice(1,c.length-1),d=u.length>3?`(${R(e,u,3)})`:c,f=l+d.length,p=l+c.length,m=Ur(e,i.body);if(f+m.length>n){if(f+5>n)return R(e,`${r}${a}${o}${s}${d} ${m}`,n);{let t=m.slice(2,m.length-2),i=`${r}${a}${o}${s}${d} ${t.length===0?`{}`:`{ ${R(e,t,n-f-4)} }`}`;return i.length>n?R(e,i,n):i}}return p+m.length>n?f+m.length<n?`${r}${a}${o}${s}(${R(e,u,n-m.length-l-2)}) ${m}`:R(e,`${r}${a}${o}${s}${d} ${m}`,n):R(e,`${r}${a}${o}${s}${c} ${m}`,n)}function Yr(e,t,n){return`${R(e,`{ ${t.properties.map(t=>B(e,t,n)).join(`, `)} }`,n-2)}`}function Xr(e,t,n){return`(${t.expressions.map(t=>B(e,t,n)).join(`, `)})`}function Zr(e,t,n){return"`"+t.expressions.concat(t.quasis).sort((e,t)=>e.start-t.start).reduce((t,r)=>{if(n<=0)return t;if(r.type===`TemplateElement`)n-=r.value.raw.length,t+=r.value.raw;else{let i=B(e,r,n);n-=i.length,t+="${"+i+`}`}return t},``)+"`"}function Qr(e,t,n){let r=t.tag.name;return r+B(e,t.quasi,n-r.length)}function $r(e,t,n){switch(t.expression.type){case`MemberExpression`:return Ir(e,t.expression,n);case`CallExpression`:return Lr(e,t.expression,n);default:return Qn(t,e.rawString)}}function ei(e,t,n){return`Super`}function ti(e,t){let n=e.toString();if(t.raw)return n;let r=ai(n);switch(r.type){case`function`:return oi(r,t.maxLength);case`arrow`:return si(r,t.maxLength);default:return ci(r,t.maxLength)}}const ni=/^(async\s+)?function\s*(\*?)\s*(\w*)\s*\(([^)]*)\)\s*(\{.*\})$/ms,ri=/^(async\s*)?\(([^)]*)\)\s*=>(.*)$/ms,ii=/^(async\s+)?(\w+)\s*=>(.*)$/ms;function ai(e){let t=ni.exec(e);if(t){let e=di((t[5]??``).trim()).trim();return{type:`function`,async:!!t[1],generator:!!t[2],name:(t[3]??``).trim(),params:(t[4]??``).trim(),body:e}}if(t=ri.exec(e),t){let e=(t[2]??``).trim(),n=(t[3]??``).trim(),r=li(n);return n=fi(r?ui(n,1/0):di(n)).trim(),!r&&n.startsWith(`return `)&&n.endsWith(`;`)&&(r=!0,n=n.slice(7,-1),n.startsWith(`{`)&&(n=`(${n})`)),{type:`arrow`,async:!!t[1],params:e,body:n,singleParam:e.length>0&&e.indexOf(`,`)===-1,singleLineBody:r}}if(t=ii.exec(e),t){let e=(t[3]??``).trim(),n=li(e);return e=fi(n?ui(e,1/0):di(e)).trim(),!n&&e.startsWith(`return `)&&e.endsWith(`;`)&&(n=!0,e=e.slice(7,-1),e.startsWith(`{`)&&(e=`(${e})`)),{type:`arrow`,async:!!t[1],params:`${t[2]}`,body:e,singleParam:!0,singleLineBody:n}}return{type:`unknown`,value:e}}function oi(e,t){let n=`${e.async?`async `:``}fn${e.generator?`*`:``}${e.name?` `+e.name:``}(${e.params?`%1`:``}) {${e.body?` %2 `:``}}`,r=e.params&&e.body?n.length-4:e.params||e.body?n.length-2:n.length;return e.params=R({raw:!1,noTrim:!1},e.params,Math.max(3,t-r-e.body.length)),e.body=R({raw:!1,noTrim:!1},e.body,Math.max(3,t-r-e.params.length)),R({raw:!1,noTrim:!1},pi(n,e),t)}function si(e,t){let n=`${e.async?`async `:``}${e.singleParam?`%1`:`(${e.params?`%1`:``})`} => ${e.singleLineBody?`%2`:`{${e.body?` %2 `:``}}`}`,r=e.params&&e.body?n.length-4:e.params||e.body?n.length-2:n.length;return e.params=R({raw:!1,noTrim:!1},e.params,Math.max(3,t-r-e.body.length)),e.body=R({raw:!1,noTrim:!1},e.body,Math.max(3,t-r-e.params.length)),R({raw:!1,noTrim:!1},pi(n,e),t)}function ci(e,t){return R({noTrim:!1},e.value,t)}function li(e){return!e.startsWith(`{`)}function ui(e,t){let n=ai(e);switch(n.type){case`function`:return oi(n,t);case`arrow`:return si(n,t);default:return e.replace(/return;/g,``).replace(/([\s([{])Symbol\(\)/g,`$1Sym()`).replace(/([\s([{])Symbol\.for\('([\w_]*)'\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\("([\w_]*)"\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\(`([\w_]*)`\)/g,`$1Sym($2)`).replace(/{\s+}/g,`{}`)}}function di(e){let t=1;e=e.slice(1);for(let n=0;n<=e.length;n++)if(e[n]===`}`&&t--,e[n]===`{`&&t++,t===0){e=fi(e.slice(0,n)).replace(/return;/g,``).replace(/([\s([{])Symbol\(\)/g,`$1Sym()`).replace(/([\s([{])Symbol\.for\('([\w_]*)'\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\("([\w_]*)"\)/g,`$1Sym($2)`).replace(/([\s([{])Symbol\.for\(`([\w_]*)`\)/g,`$1Sym($2)`).replace(/{\s+}/g,`{}`);break}return e}function fi(e){return e.split(`
|
|
26
|
+
`).map(e=>e.trim()).filter(e=>!!e).map((e,t,n)=>t<n.length-1&&/[^({}):;(do|else)]$/.test(e)&&/[^)}]/.test(n[t+1])?e+`;`:e).join(` `)}function pi(e,t){return t.params&&(e=e.replace(`%1`,t.params)),t.body&&(e=e.replace(`%2`,t.body)),e}function mi(e,t,n){if(!e.raw&&Ee(t)&&t.tersify!==gi)return t.tersify({maxLength:e.maxLength,raw:e.raw});try{return Xn(e,t,e.maxLength)}catch(n){if(n.name!==`SyntaxError`)throw n;return ti(t,e)}}var hi=le(ve(),1);we();function gi(e){return _i(this,e)}function _i(e,t){let n=ye(Te,t,{path:[],references:[]});return vi(n,e,n.maxLength)}function vi(e,t,n){let r=yi(t),i=bi[r];if(!i)throw Error(`Can't find fn for ${JSON.stringify(t)}`);return i(e,t,n)}function yi(e){if(e==null)return String(e);if(e instanceof RegExp)return`RegExp`;if(e instanceof Date)return`Date`;if(Array.isArray(e))return`Array`;if(e instanceof Error)return`Error`;if((0,hi.default)(e))return`Buffer`;let t=typeof e;return t===`object`&&Object.getPrototypeOf(e)!==Object.prototype?`instance`:t}const bi={undefined:xi,null:xi,boolean:xi,number:xi,bigint:Ei,instance:ji,string:wi,symbol:Ti,function:mi,object:Ai,Buffer:Oi,Date:Si,RegExp:Ci,Array:ki,Error:Di};function xi(e,t,n){return R(e,String(t),n)}function Si(e,t,n){return R(e,t.toISOString(),n)}function Ci(e,t,n){return R(e,String(t),n)}function wi(e,t,n){return R(e,`'${t}'`,n)}function Ti(e,t,n){return e.raw?t.toString():R(e,t.toString().replace(`Symbol(`,`Sym(`),n)}function Ei(e,t,n){return R(e,String(t)+`n`,n)}function Di(e,t,n){let r=t.constructor.name,i=R(e,`'${t.message}'`,n-7);return t.message?i.length===0?R(e,`${r}( )`,n):R(e,`${r}(${i})`,n):R(e,`${r}()`,n)}function Oi(e,t,n){return R(e,t.inspect(),n)}function ki(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&Ee(t)&&t.tersify!==gi)return t.tersify({maxLength:n});if(t.length===0)return`[]`;let i=0,a=R(e,t.reduce((r,a,o)=>{let s=[...e.path,o],c=vi({...e,path:s},a,n-i);return i+=c.length,o!==t.length-1&&(i+=2),r.push(c),r},[]).join(`, `),n-2);return a.length===0?R(e,`[ ]`,n):`[${a}]`}function Ai(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&Ee(t)&&t.tersify!==gi)return t.tersify({maxLength:n});let i=n-4,a=Object.keys(t),o=a.reduce((n,r,o)=>{if(i>0){let s=o===a.length-1,c=Mi(e,t,r,i,s);i-=c.length,n.push(c)}return n},[]),s=R(e,a.length>o.length?o.join(`, `)+` `:o.join(`, `),n-4);return a.length===0?`{}`:s.length===0?R(e,`{ }`,n):`{ ${s} }`}function ji(e,t,n){let r=e.references.find(e=>e.value===t);if(r)return`ref(${r.path.join(`, `)})`;if(e.references.push({value:t,path:e.path}),!e.raw&&Ee(t)&&t.tersify!==gi)return t.tersify({maxLength:n});if(n<=4)switch(n){case 4:return`. {}`;case 3:return`...`;case 2:return`..`;case 1:return`.`;case 0:return``}let i=Object.getPrototypeOf(t)?.constructor?.name??``,[a,o]=n<i.length+1+2?[n-1-2,2]:[i.length,n-i.length-1],s=a?`${R(e,i,a)} `:``,c=o,l=Object.keys(t),u=l.reduce((n,r,i)=>{if(c>0){let a=i===l.length-1,o=Mi(e,t,r,c,a);c-=o.length,n.push(o)}return n},[]),d=R(e,l.length>u.length?u.join(`, `)+` `:u.join(`, `),o-2-2);return l.length===0?`${s}{}`:d.length===0?R(e,`${s}{ }`,n):`${s}{ ${d} }`}function Mi(e,t,n,r,i){let a=i?0:2,o=[...e.path,n],s=Object.getOwnPropertyDescriptor(t,n),c=[];if(s.get&&c.push(`Get`),s.set&&c.push(`Set`),c.length>0)return`${Ni(n)}: [${c.join(`/`)}]`;let l=t[n];if(typeof l==`function`){if(/^(.*)\s?=>\s?/.test(l.toString())){let t=vi({...e,path:o},l,r-n.length-a-2);return`${Ni(n)}: ${t}`}{let t=vi({...e,path:o},l,r-n.length-a+2);return`${/^async fn/.test(t)?`async `:``}${/^(async )?fn\*/.test(t)?`*`:``}${Ni(n)}${t.slice(t.indexOf(`(`))}`}}{let t=vi({...e,path:o,noTrim:!0},l,r-n.length-2-a);return`${Ni(n)}: ${t}`}}function Ni(e){return e.indexOf(`-`)>=0?`'${e}'`:e}function Pi(e,t,n){return Object.keys(e).find(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function Fi(e,t,n){return Object.keys(e).forEach(t,n)}function Ii(e,t,n){return Object.keys(e).map(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function Li(e,t,n){return Object.keys(e).reduce((n,r,i,a)=>t(n,r,i,a,e),n)}const Ri=Li;function zi(e){let t=Object.create(null);return e?Object.assign(t,e):t}function Bi(e,t,n){return Object.keys(e).some(function(n,r,i){return t.apply(this,[n,r,i,e])},n)}function Vi(e){return e}var V;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(V||={});var Hi;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Hi||={});const H=V.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Ui=e=>{switch(typeof e){case`undefined`:return H.undefined;case`string`:return H.string;case`number`:return Number.isNaN(e)?H.nan:H.number;case`boolean`:return H.boolean;case`function`:return H.function;case`bigint`:return H.bigint;case`symbol`:return H.symbol;case`object`:return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?H.promise:typeof Map<`u`&&e instanceof Map?H.map:typeof Set<`u`&&e instanceof Set?H.set:typeof Date<`u`&&e instanceof Date?H.date:H.object;default:return H.unknown}},U=V.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]);var Wi=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Wi.create=e=>new Wi(e);const Gi=(e,t)=>{let n;switch(e.code){case U.invalid_type:n=e.received===H.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,V.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:n=`Unrecognized key(s) in object: ${V.joinValues(e.keys,`, `)}`;break;case U.invalid_union:n=`Invalid input`;break;case U.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${V.joinValues(e.options)}`;break;case U.invalid_enum_value:n=`Invalid enum value. Expected ${V.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:n=`Invalid function arguments`;break;case U.invalid_return_type:n=`Invalid function return type`;break;case U.invalid_date:n=`Invalid date`;break;case U.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:V.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case U.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case U.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case U.custom:n=`Invalid input`;break;case U.invalid_intersection_types:n=`Intersection results could not be merged`;break;case U.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,V.assertNever(e)}return{message:n}};let Ki=Gi;function qi(){return Ki}const Ji=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function W(e,t){let n=qi(),r=Ji({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Gi?void 0:Gi].filter(e=>!!e)});e.common.issues.push(r)}var Yi=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return G;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return G;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const G=Object.freeze({status:`aborted`}),Xi=e=>({status:`dirty`,value:e}),Zi=e=>({status:`valid`,value:e}),Qi=e=>e.status===`aborted`,$i=e=>e.status===`dirty`,ea=e=>e.status===`valid`,ta=e=>typeof Promise<`u`&&e instanceof Promise;var K;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(K||={});var na=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ra=(e,t)=>{if(ea(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new Wi(e.common.issues);return this._error=t,this._error}}};function q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var J=class{get description(){return this._def.description}_getType(e){return Ui(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ui(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yi,ctx:{common:e.parent.common,data:e.data,parsedType:Ui(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ta(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ui(e)},r=this._parseSync({data:e,path:n.path,parent:n});return ra(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ui(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ea(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>ea(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ui(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(ta(r)?r:Promise.resolve(r));return ra(n,i)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:U.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ao({schema:this,typeName:Y.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return oo.create(this,this._def)}nullable(){return so.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ba.create(this)}promise(){return io.create(this,this._def)}or(e){return Ua.create([this,e],this._def)}and(e){return qa.create(this,e,this._def)}transform(e){return new ao({...q(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new co({...q(this._def),innerType:this,defaultValue:t,typeName:Y.ZodDefault})}brand(){return new fo({typeName:Y.ZodBranded,type:this,...q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new lo({...q(this._def),innerType:this,catchValue:t,typeName:Y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return po.create(this,e)}readonly(){return mo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const ia=/^c[^\s-]{8,}$/i,aa=/^[0-9a-z]+$/,oa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sa=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ca=/^[a-z0-9_-]{21}$/i,la=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ua=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,da=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let fa;const pa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ma=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ha=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ga=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_a=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,va=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ya=`((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`,ba=RegExp(`^${ya}$`);function xa(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Sa(e){return RegExp(`^${xa(e)}$`)}function Ca(e){let t=`${ya}T${xa(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function wa(e,t){return!((t!==`v4`&&t||!pa.test(e))&&(t!==`v6`&&t||!ha.test(e)))}function Ta(e,t){if(!la.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ea(e,t){return!((t!==`v4`&&t||!ma.test(e))&&(t!==`v6`&&t||!ga.test(e)))}var Da=class e extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.string,received:t.parsedType}),G}let t=new Yi,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)da.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`email`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)fa||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),fa.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`emoji`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)sa.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`uuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ca.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`nanoid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ia.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)aa.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid2`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)oa.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ulid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:`url`,code:U.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`regex`,code:U.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Ca(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?ba.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Sa(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?ua.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`duration`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?wa(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ip`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Ta(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`jwt`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Ea(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cidr`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?_a.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?va.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64url`,code:U.invalid_string,message:r.message}),t.dirty()):V.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:U.invalid_string,...K.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...K.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...K.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...K.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...K.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...K.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...K.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...K.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...K.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...K.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...K.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...K.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...K.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...K.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...K.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...K.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...K.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...K.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...K.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...K.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...K.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...K.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...K.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...K.errToObj(t)})}nonempty(e){return this.min(1,K.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Da.create=e=>new Da({checks:[],typeName:Y.ZodString,coerce:e?.coerce??!1,...q(e)});function Oa(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var ka=class e extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.number,received:t.parsedType}),G}let t,n=new Yi;for(let r of this._def.checks)r.kind===`int`?V.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Oa(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_finite,message:r.message}),n.dirty()):V.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,K.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,K.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,K.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,K.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:K.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:K.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:K.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:K.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:K.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&V.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};ka.create=e=>new ka({checks:[],typeName:Y.ZodNumber,coerce:e?.coerce||!1,...q(e)});var Aa=class e extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==H.bigint)return this._getInvalidInput(e);let t,n=new Yi;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):V.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.bigint,received:t.parsedType}),G}gte(e,t){return this.setLimit(`min`,e,!0,K.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,K.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,K.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,K.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:K.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Aa.create=e=>new Aa({checks:[],typeName:Y.ZodBigInt,coerce:e?.coerce??!1,...q(e)});var ja=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.boolean,received:t.parsedType}),G}return Zi(e.data)}};ja.create=e=>new ja({typeName:Y.ZodBoolean,coerce:e?.coerce||!1,...q(e)});var Ma=class e extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.date,received:t.parsedType}),G}if(Number.isNaN(e.data.getTime()))return W(this._getOrReturnCtx(e),{code:U.invalid_date}),G;let t=new Yi,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):V.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:K.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:K.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Ma.create=e=>new Ma({checks:[],coerce:e?.coerce||!1,typeName:Y.ZodDate,...q(e)});var Na=class extends J{_parse(e){if(this._getType(e)!==H.symbol){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.symbol,received:t.parsedType}),G}return Zi(e.data)}};Na.create=e=>new Na({typeName:Y.ZodSymbol,...q(e)});var Pa=class extends J{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.undefined,received:t.parsedType}),G}return Zi(e.data)}};Pa.create=e=>new Pa({typeName:Y.ZodUndefined,...q(e)});var Fa=class extends J{_parse(e){if(this._getType(e)!==H.null){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.null,received:t.parsedType}),G}return Zi(e.data)}};Fa.create=e=>new Fa({typeName:Y.ZodNull,...q(e)});var Ia=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Zi(e.data)}};Ia.create=e=>new Ia({typeName:Y.ZodAny,...q(e)});var La=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Zi(e.data)}};La.create=e=>new La({typeName:Y.ZodUnknown,...q(e)});var Ra=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.never,received:t.parsedType}),G}};Ra.create=e=>new Ra({typeName:Y.ZodNever,...q(e)});var za=class extends J{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.void,received:t.parsedType}),G}return Zi(e.data)}};za.create=e=>new za({typeName:Y.ZodVoid,...q(e)});var Ba=class e extends J{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==H.array)return W(t,{code:U.invalid_type,expected:H.array,received:t.parsedType}),G;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(W(t,{code:e?U.too_big:U.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(W(t,{code:U.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(W(t,{code:U.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new na(t,e,t.path,n)))).then(e=>Yi.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new na(t,e,t.path,n)));return Yi.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:K.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:K.toString(n)}})}nonempty(e){return this.min(1,e)}};Ba.create=(e,t)=>new Ba({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...q(t)});function Va(e){if(e instanceof Ha){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=oo.create(Va(r))}return new Ha({...e._def,shape:()=>t})}return e instanceof Ba?new Ba({...e._def,type:Va(e.element)}):e instanceof oo?oo.create(Va(e.unwrap())):e instanceof so?so.create(Va(e.unwrap())):e instanceof Ja?Ja.create(e.items.map(e=>Va(e))):e}var Ha=class e extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=V.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==H.object){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),G}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ra&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new na(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ra){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(W(n,{code:U.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new na(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Yi.mergeObjectSync(t,e)):Yi.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return K.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:K.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of V.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of V.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Va(this)}partial(t){let n={};for(let e of V.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of V.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof oo;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return to(V.objectKeys(this.shape))}};Ha.create=(e,t)=>new Ha({shape:()=>e,unknownKeys:`strip`,catchall:Ra.create(),typeName:Y.ZodObject,...q(t)}),Ha.strictCreate=(e,t)=>new Ha({shape:()=>e,unknownKeys:`strict`,catchall:Ra.create(),typeName:Y.ZodObject,...q(t)}),Ha.lazycreate=(e,t)=>new Ha({shape:e,unknownKeys:`strip`,catchall:Ra.create(),typeName:Y.ZodObject,...q(t)});var Ua=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Wi(e.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:n}),G}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Wi(e));return W(t,{code:U.invalid_union,unionErrors:i}),G}}get options(){return this._def.options}};Ua.create=(e,t)=>new Ua({options:e,typeName:Y.ZodUnion,...q(t)});const Wa=e=>e instanceof $a?Wa(e.schema):e instanceof ao?Wa(e.innerType()):e instanceof eo?[e.value]:e instanceof no?e.options:e instanceof ro?V.objectValues(e.enum):e instanceof co?Wa(e._def.innerType):e instanceof Pa?[void 0]:e instanceof Fa?[null]:e instanceof oo?[void 0,...Wa(e.unwrap())]:e instanceof so?[null,...Wa(e.unwrap())]:e instanceof fo||e instanceof mo?Wa(e.unwrap()):e instanceof lo?Wa(e._def.innerType):[];var Ga=class e extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.object)return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),G;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Wa(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:Y.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...q(r)})}};function Ka(e,t){let n=Ui(e),r=Ui(t);if(e===t)return{valid:!0,data:e};if(n===H.object&&r===H.object){let n=V.objectKeys(t),r=V.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ka(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===H.array&&r===H.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ka(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===H.date&&r===H.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qa=class extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Qi(e)||Qi(r))return G;let i=Ka(e.value,r.value);return i.valid?(($i(e)||$i(r))&&t.dirty(),{status:t.value,value:i.data}):(W(n,{code:U.invalid_intersection_types}),G)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};qa.create=(e,t,n)=>new qa({left:e,right:t,typeName:Y.ZodIntersection,...q(n)});var Ja=class e extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.array)return W(n,{code:U.invalid_type,expected:H.array,received:n.parsedType}),G;if(n.data.length<this._def.items.length)return W(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),G;!this._def.rest&&n.data.length>this._def.items.length&&(W(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new na(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Yi.mergeArray(t,e)):Yi.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ja.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Ja({items:e,typeName:Y.ZodTuple,rest:null,...q(t)})};var Ya=class e extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.object)return W(n,{code:U.invalid_type,expected:H.object,received:n.parsedType}),G;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new na(n,e,n.path,e)),value:a._parse(new na(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Yi.mergeObjectAsync(t,r):Yi.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof J?new e({keyType:t,valueType:n,typeName:Y.ZodRecord,...q(r)}):new e({keyType:Da.create(),valueType:t,typeName:Y.ZodRecord,...q(n)})}},Xa=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.map)return W(n,{code:U.invalid_type,expected:H.map,received:n.parsedType}),G;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new na(n,e,n.path,[a,`key`])),value:i._parse(new na(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return G;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return G;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Xa.create=(e,t,n)=>new Xa({valueType:t,keyType:e,typeName:Y.ZodMap,...q(n)});var Za=class e extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.set)return W(n,{code:U.invalid_type,expected:H.set,received:n.parsedType}),G;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(W(n,{code:U.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(W(n,{code:U.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return G;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new na(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:K.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Za.create=(e,t)=>new Za({valueType:e,minSize:null,maxSize:null,typeName:Y.ZodSet,...q(t)});var Qa=class e extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.function)return W(t,{code:U.invalid_type,expected:H.function,received:t.parsedType}),G;function n(e,n){return Ji({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qi(),Gi].filter(e=>!!e),issueData:{code:U.invalid_arguments,argumentsError:n}})}function r(e,n){return Ji({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,qi(),Gi].filter(e=>!!e),issueData:{code:U.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof io){let e=this;return Zi(async function(...t){let o=new Wi([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}{let e=this;return Zi(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Wi([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Wi([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ja.create(t).rest(La.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Ja.create([]).rest(La.create()),returns:n||La.create(),typeName:Y.ZodFunction,...q(r)})}},$a=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};$a.create=(e,t)=>new $a({getter:e,typeName:Y.ZodLazy,...q(t)});var eo=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),G}return{status:`valid`,value:e.data}}get value(){return this._def.value}};eo.create=(e,t)=>new eo({value:e,typeName:Y.ZodLiteral,...q(t)});function to(e,t){return new no({values:e,typeName:Y.ZodEnum,...q(t)})}var no=class e extends J{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{expected:V.joinValues(n),received:t.parsedType,code:U.invalid_type}),G}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:n}),G}return Zi(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};no.create=to;var ro=class extends J{_parse(e){let t=V.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==H.string&&n.parsedType!==H.number){let e=V.objectValues(t);return W(n,{expected:V.joinValues(e),received:n.parsedType,code:U.invalid_type}),G}if(this._cache||=new Set(V.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=V.objectValues(t);return W(n,{received:n.data,code:U.invalid_enum_value,options:e}),G}return Zi(e.data)}get enum(){return this._def.values}};ro.create=(e,t)=>new ro({values:e,typeName:Y.ZodNativeEnum,...q(t)});var io=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.promise&&t.common.async===!1)return W(t,{code:U.invalid_type,expected:H.promise,received:t.parsedType}),G;let n=t.parsedType===H.promise?t.data:Promise.resolve(t.data);return Zi(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};io.create=(e,t)=>new io({type:e,typeName:Y.ZodPromise,...q(t)});var ao=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{W(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return G;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?G:r.status===`dirty`||t.value===`dirty`?Xi(r.value):r});{if(t.value===`aborted`)return G;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?G:r.status===`dirty`||t.value===`dirty`?Xi(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?G:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?G:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ea(e))return G;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>ea(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):G)}V.assertNever(r)}};ao.create=(e,t,n)=>new ao({schema:e,typeName:Y.ZodEffects,effect:t,...q(n)}),ao.createWithPreprocess=(e,t,n)=>new ao({schema:t,effect:{type:`preprocess`,transform:e},typeName:Y.ZodEffects,...q(n)});var oo=class extends J{_parse(e){return this._getType(e)===H.undefined?Zi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};oo.create=(e,t)=>new oo({innerType:e,typeName:Y.ZodOptional,...q(t)});var so=class extends J{_parse(e){return this._getType(e)===H.null?Zi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};so.create=(e,t)=>new so({innerType:e,typeName:Y.ZodNullable,...q(t)});var co=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};co.create=(e,t)=>new co({innerType:e,typeName:Y.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...q(t)});var lo=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ta(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Wi(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Wi(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};lo.create=(e,t)=>new lo({innerType:e,typeName:Y.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...q(t)});var uo=class extends J{_parse(e){if(this._getType(e)!==H.nan){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.nan,received:t.parsedType}),G}return{status:`valid`,value:e.data}}};uo.create=e=>new uo({typeName:Y.ZodNaN,...q(e)});var fo=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},po=class e extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?G:e.status===`dirty`?(t.dirty(),Xi(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?G:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Y.ZodPipeline})}},mo=class extends J{_parse(e){let t=this._def.innerType._parse(e),n=e=>(ea(e)&&(e.value=Object.freeze(e.value)),e);return ta(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};mo.create=(e,t)=>new mo({innerType:e,typeName:Y.ZodReadonly,...q(t)}),Ha.lazycreate;var Y;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(Y||={});const ho=Da.create;ka.create,uo.create,Aa.create;const go=ja.create;Ma.create,Na.create,Pa.create,Fa.create,Ia.create,La.create,Ra.create,za.create,Ba.create,Ha.create,Ha.strictCreate,Ua.create,Ga.create,qa.create,Ja.create,Ya.create,Xa.create,Za.create,Qa.create,$a.create,eo.create;const _o=no.create;ro.create,io.create,ao.create;const X=oo.create;so.create,ao.createWithPreprocess,po.create;function vo(e){return e.shape}function yo(e){return e&&e.element}function bo(e){return!!e&&e.isOptional()}function xo(e){return To(e,`ZodBoolean`)}function So(e){return To(e,`ZodNumber`)}function Co(e){return To(e,`ZodString`)}function wo(e){return To(e,`ZodEnum`)}function To(e,t){return Object.getPrototypeOf(e).constructor.name===t}const Eo={type:X(_o([`toon`,`text`,`json`])),description:`Output format: 'toon' for agents, 'text' for humans, 'json' to pipe`,default:`toon`};function Do(e){return/["\\,]|^\s|\s$/.test(e)?JSON.stringify(e):e}function Oo(e,t){return`${e}[${t.length}]: ${t.map(Do).join(`,`)}`}function ko(e,t,n){return[`${e}[${n.length}]{${t.join(`,`)}}:`,...n.map(e=>` ${e.map(Do).join(`,`)}`)]}function Ao(e){return`help[1]: ${e}`}function jo(e,{noun:t,plural:n},r,i,a){if(r.length===0){e.info(`no ${t} with keywords: ${a.join(`, `)}`);return}if(r.length===1){e.info(`found one ${t}: ${i(r[0])}`);return}e.info(`found the following ${n}:`),e.info(``),r.forEach(t=>{e.info(` ${i(t)}`)})}var Mo=D((e=>{var t=O(`path`),n=process.platform===`win32`,r=O(`fs`),i=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function a(){var e;if(i){var t=Error();e=n}else e=r;return e;function n(e){e&&(t.message=e.message,e=t,r(e))}function r(e){if(e){if(process.throwDeprecation)throw e;if(!process.noDeprecation){var t=`fs: missing callback `+(e.stack||e.message);process.traceDeprecation?console.trace(t):console.error(t)}}}}function o(e){return typeof e==`function`?e:a()}if(t.normalize,n)var s=/(.*?)(?:[\/\\]+|$)/g;else var s=/(.*?)(?:[\/]+|$)/g;if(n)var c=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else var c=/^[\/]*/;e.realpathSync=function(e,i){if(e=t.resolve(e),i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];var a=e,o={},l={},u,d,f,p;m();function m(){var t=c.exec(e);u=t[0].length,d=t[0],f=t[0],p=``,n&&!l[f]&&(r.lstatSync(f),l[f]=!0)}for(;u<e.length;){s.lastIndex=u;var h=s.exec(e);if(p=d,d+=h[0],f=p+h[1],u=s.lastIndex,!(l[f]||i&&i[f]===f)){var g;if(i&&Object.prototype.hasOwnProperty.call(i,f))g=i[f];else{var _=r.lstatSync(f);if(!_.isSymbolicLink()){l[f]=!0,i&&(i[f]=f);continue}var v=null;if(!n){var y=_.dev.toString(32)+`:`+_.ino.toString(32);o.hasOwnProperty(y)&&(v=o[y])}v===null&&(r.statSync(f),v=r.readlinkSync(f)),g=t.resolve(p,v),i&&(i[f]=g),n||(o[y]=v)}e=t.resolve(g,e.slice(u)),m()}}return i&&(i[a]=e),e},e.realpath=function(e,i,a){if(typeof a!=`function`&&(a=o(i),i=null),e=t.resolve(e),i&&Object.prototype.hasOwnProperty.call(i,e))return process.nextTick(a.bind(null,null,i[e]));var l=e,u={},d={},f,p,m,h;g();function g(){var t=c.exec(e);f=t[0].length,p=t[0],m=t[0],h=``,n&&!d[m]?r.lstat(m,function(e){if(e)return a(e);d[m]=!0,_()}):process.nextTick(_)}function _(){if(f>=e.length)return i&&(i[l]=e),a(null,e);s.lastIndex=f;var t=s.exec(e);return h=p,p+=t[0],m=h+t[1],f=s.lastIndex,d[m]||i&&i[m]===m?process.nextTick(_):i&&Object.prototype.hasOwnProperty.call(i,m)?b(i[m]):r.lstat(m,v)}function v(e,t){if(e)return a(e);if(!t.isSymbolicLink())return d[m]=!0,i&&(i[m]=m),process.nextTick(_);if(!n){var o=t.dev.toString(32)+`:`+t.ino.toString(32);if(u.hasOwnProperty(o))return y(null,u[o],m)}r.stat(m,function(e){if(e)return a(e);r.readlink(m,function(e,t){n||(u[o]=t),y(e,t)})})}function y(e,n,r){if(e)return a(e);var o=t.resolve(h,n);i&&(i[r]=o),b(o)}function b(n){e=t.resolve(n,e.slice(f)),g()}}})),No=D(((e,t)=>{t.exports=l,l.realpath=l,l.sync=u,l.realpathSync=u,l.monkeypatch=d,l.unmonkeypatch=f;var n=O(`fs`),r=n.realpath,i=n.realpathSync,a=process.version,o=/^v[0-5]\./.test(a),s=Mo();function c(e){return e&&e.syscall===`realpath`&&(e.code===`ELOOP`||e.code===`ENOMEM`||e.code===`ENAMETOOLONG`)}function l(e,t,n){if(o)return r(e,t,n);typeof t==`function`&&(n=t,t=null),r(e,t,function(r,i){c(r)?s.realpath(e,t,n):n(r,i)})}function u(e,t){if(o)return i(e,t);try{return i(e,t)}catch(n){if(c(n))return s.realpathSync(e,t);throw n}}function d(){n.realpath=l,n.realpathSync=u}function f(){n.realpath=r,n.realpathSync=i}})),Po=D(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var a=t(e[i],i);n(a)?r.push.apply(r,a):r.push(a)}return r};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`}})),Fo=D(((e,t)=>{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i<a&&(a=i,o=l),l=n.indexOf(t,u+1)),u=c<l&&c>=0?c:l;r.length&&(s=[a,o])}return s}})),Io=D(((e,t)=>{Po();var n=Fo();t.exports=m;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`,c=1e5,l=4e6;function u(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function d(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function f(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function p(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=p(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function m(e,t){if(!e)return[];t||={};var n=t.max==null?c:t.max,r=t.maxLength==null?l:t.maxLength;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),x(d(e),n,r,!0).map(f)}function h(e){return`{`+e+`}`}function g(e){return/^-?0\d/.test(e)}function _(e,t){return e<=t}function v(e,t){return e>=t}function y(e,t,n,r,i,a,o,s){for(var c=[],l=0,u=0;u<e.length;u++)for(var d=0;d<r.length;d++){if(c.length>=i)return c;var f=e[u]+n+r[d];if(!(o&&f.length===t[u])){if(l+f.length>a)return c;c.push(f),s.push(t[u]),l+=f.length}}return c}function b(e,t,n,r){var i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;var o=u(i[0]),s=u(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(u(i[2])),1):1,d=_;s<o&&(l*=-1,d=v);for(var f=i.some(g),p=0,m=o;d(m,s)&&a.length<n;m+=l){var h;if(t)h=String.fromCharCode(m),h===`\\`&&(h=``);else if(h=String(m),f){var y=c-h.length;if(y>0){var b=Array(y+1).join(`0`);h=m<0?`-`+b+h.slice(1):b+h}}if(p+h.length>r)break;a.push(h),p+=h.length}return a}function x(e,t,r,i){for(var o=[``],s=[0],c=!1,l=!0,u;;){var d=n(`{`,`}`,e);if(!d)return y(o,s,e,[``],t,r,c,[]);var f=d.pre;if(/\$$/.test(f))return y(o,s,e,[``],t,r,c,[]);var m=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),_=m||g,v=d.body.indexOf(`,`)>=0;if(!_&&!v){if(d.post.match(/,(?!,).*\}/)){e=d.pre+`{`+d.body+a+d.post,i=!0,l=!0,c=!1,s=[];for(var S=0;S<o.length;S++)s.push(o[S].length);continue}return y(o,s,f+`{`+d.body+`}`+d.post,[``],t,r,c,[])}l&&=(c=i&&!_,!1);var C;if(_)C=b(d.body,g,t,r);else{var w=p(d.body);if(w.length===1&&w[0]!==void 0&&(w=x(w[0],t,r,!1).map(h),w.length===1)){if(u=[],o=y(o,s,f+w[0],[``],t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post;continue}for(var T=c&&!d.post.length&&!f,E=0;T&&E<o.length;E++)o[E].length!==s[E]&&(T=!1);C=[];var ee=0;outer:for(var te=0;te<w.length;te++)for(var ne=x(w[te],t,r,!1),re=0;re<ne.length;re++){var ie=ne[re];if(!T||ie){if(C.length>=t||ee+ie.length>r)break outer;C.push(ie),ee+=ie.length}}}if(u=[],o=y(o,s,f,C,t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post}return o}})),Lo=D(((e,t)=>{t.exports=h,h.Minimatch=g;var n=function(){try{return O(`path`)}catch{}}()||{sep:`/`};h.sep=n.sep;var r=h.GLOBSTAR=g.GLOBSTAR={},i=Io(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=d(`().*{}+?[]^$\\!`);function d(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var f=/\/+/;h.filter=p;function p(e,t){return t||={},function(n,r,i){return h(n,e,t)}}function m(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}h.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return h;var t=h,n=function(n,r,i){return t(n,r,m(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,m(e,r))},n.Minimatch.defaults=function(n){return t.defaults(m(e,n)).Minimatch},n.filter=function(n,r){return t.filter(n,m(e,r))},n.defaults=function(n){return t.defaults(m(e,n))},n.makeRe=function(n,r){return t.makeRe(n,m(e,r))},n.braceExpand=function(n,r){return t.braceExpand(n,m(e,r))},n.match=function(n,r,i){return t.match(n,r,m(e,i))},n},g.defaults=function(e){return h.defaults(e).Minimatch};function h(e,t,n){return x(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new g(t,n).match(e)}function g(e,t){if(!(this instanceof g))return new g(e,t);x(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}g.prototype.debug=function(){},g.prototype.make=_;function _(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(f)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}g.prototype.parseNegate=v;function v(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;i<a&&e.charAt(i)===`!`;i++)t=!t,r++;r&&(this.pattern=e.substr(r)),this.negate=t}}h.braceExpand=function(e,t){return y(e,t)},g.prototype.braceExpand=y;function y(e,t){return t||=this instanceof g?this.options:{},e=e===void 0?this.pattern:e,x(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:i(e)}var b=65536,x=function(e){if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>b)throw TypeError(`pattern is too long`)};g.prototype.parse=C;var S={};function C(e,t){x(e);var n=this.options;if(e===`**`){if(n.noglobstar)e=`*`;else return r}if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],f=[],p,m=!1,h=-1,g=-1,_=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,v=this;function y(){if(p){switch(p){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+p}v.debug(`clearStateChar %j %j`,p,i),p=!1}}for(var b=0,C=e.length,w;b<C&&(w=e.charAt(b));b++){if(this.debug(`%s %s %s %j`,e,b,i,w),l&&u[w]){i+=`\\`+w,l=!1;continue}switch(w){case`/`:return!1;case`\\`:y(),l=!0;continue;case`?`:case`*`:case`+`:case`@`:case`!`:if(this.debug(`%s %s %s %j <-- stateChar`,e,b,i,w),m){this.debug(` in class`),w===`!`&&b===g+1&&(w=`^`),i+=w;continue}if(w===`*`&&p===`*`)continue;v.debug(`call clearStateChar %j`,p),y(),p=w,n.noext&&y();continue;case`(`:if(m){i+=`(`;continue}if(!p){i+=`\\(`;continue}d.push({type:p,start:b-1,reStart:i.length,open:a[p].open,close:a[p].close}),i+=p===`!`?`(?:(?!(?:`:`(?:`,this.debug(`plType %j %j`,p,i),p=!1;continue;case`)`:if(m||!d.length){i+=`\\)`;continue}y(),c=!0;var E=d.pop();i+=E.close,E.type===`!`&&f.push(E),E.reEnd=i.length;continue;case`|`:if(m||!d.length||l){i+=`\\|`,l=!1;continue}y(),i+=`|`;continue;case`[`:if(y(),m){i+=`\\`+w;continue}m=!0,g=b,h=i.length,i+=w;continue;case`]`:if(b===g+1||!m){i+=`\\`+w,l=!1;continue}var ee=e.substring(g+1,b);try{RegExp(`[`+ee+`]`)}catch{var te=this.parse(ee,S);i=i.substr(0,h)+`\\[`+te[0]+`\\]`,c||=te[1],m=!1;continue}c=!0,m=!1,i+=w;continue;default:y(),l?l=!1:u[w]&&!(w===`^`&&m)&&(i+=`\\`),i+=w}}for(m&&(ee=e.substr(g+1),te=this.parse(ee,S),i=i.substr(0,h)+`\\[`+te[0],c||=te[1]),E=d.pop();E;E=d.pop()){var ne=i.slice(E.reStart+E.open.length);this.debug(`setting tail`,i,E),ne=ne.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,n){return n||=`\\`,t+t+n+`|`}),this.debug(`tail=%j
|
|
27
|
+
%s`,ne,ne,E,i);var re=E.type===`*`?s:E.type===`?`?o:`\\`+E.type;c=!0,i=i.slice(0,E.reStart)+re+`\\(`+ne}y(),l&&(i+=`\\\\`);var ie=!1;switch(i.charAt(0)){case`[`:case`.`:case`(`:ie=!0}for(var ae=f.length-1;ae>-1;ae--){var oe=f[ae],D=i.slice(0,oe.reStart),se=i.slice(oe.reStart,oe.reEnd-8),ce=i.slice(oe.reEnd-8,oe.reEnd),le=i.slice(oe.reEnd);ce+=le;var O=D.split(`(`).length-1,ue=le;for(b=0;b<O;b++)ue=ue.replace(/\)[+*?]?/,``);le=ue;var de=``;le===``&&t!==S&&(de=`$`),i=D+se+le+de+ce}if(i!==``&&c&&(i=`(?=.)`+i),ie&&(i=_+i),t===S)return[i,c];if(!c)return T(e);var fe=n.nocase?`i`:``;try{var pe=RegExp(`^`+i+`$`,fe)}catch{return RegExp(`$.`)}return pe._glob=e,pe._src=i,pe}h.makeRe=function(e,t){return new g(e,t||{}).makeRe()},g.prototype.makeRe=w;function w(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,n=t.noglobstar?s:t.dot?c:l,i=t.nocase?`i`:``,a=e.map(function(e){return e.map(function(e){return e===r?n:typeof e==`string`?E(e):e._src}).join(`\\/`)}).join(`|`);a=`^(?:`+a+`)$`,this.negate&&(a=`^(?!`+a+`).*$`);try{this.regexp=new RegExp(a,i)}catch{this.regexp=!1}return this.regexp}h.match=function(e,t,n){n||={};var r=new g(t,n);return e=e.filter(function(e){return r.match(e)}),r.options.nonull&&!e.length&&e.push(t),e},g.prototype.match=function(e,t){if(t===void 0&&(t=this.partial),this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;var r=this.options;n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),e=e.split(f),this.debug(this.pattern,`split`,e);var i=this.set;this.debug(this.pattern,`set`,i);for(var a,o=e.length-1;o>=0&&(a=e[o],!a);o--);for(o=0;o<i.length;o++){var s=i[o],c=e;if(r.matchBase&&s.length===1&&(c=[a]),this.matchOne(c,s,t))return r.flipNegate?!0:!this.negate}return!r.flipNegate&&this.negate},g.prototype.matchOne=function(e,t,n){return t.indexOf(r)===-1?this._matchOne(e,t,n,0,0):this._matchGlobstar(e,t,n,0,0)},g.prototype._matchGlobstar=function(e,t,n,i,a){var o,s=-1;for(o=a;o<t.length;o++)if(t[o]===r){s=o;break}var c=-1;for(o=t.length-1;o>=0;o--)if(t[o]===r){c=o;break}var l=t.slice(a,s),u=n?t.slice(s+1):t.slice(s+1,c),d=n?[]:t.slice(c+1);if(l.length){var f=e.slice(i,i+l.length);if(!this._matchOne(f,l,n,0,0))return!1;i+=l.length}var p=0;if(d.length){if(d.length+i>e.length)return!1;var m=e.length-d.length;if(this._matchOne(e,d,n,m,0))p=d.length;else{if(e[e.length-1]!==``||i+d.length===e.length||(m--,!this._matchOne(e,d,n,m,0)))return!1;p=d.length+1}}if(!u.length){var h=!!p;for(o=i;o<e.length-p;o++){var g=String(e[o]);if(h=!0,g===`.`||g===`..`||!this.options.dot&&g.charAt(0)===`.`)return!1}return n||h}for(var _=[[[],0]],v=_[0],y=0,b=[0],x=0;x<u.length;x++){var S=u[x];S===r?(b.push(y),v=[[],0],_.push(v)):(v[0].push(S),y++)}for(var C=_.length-1,w=e.length-p,T=0;T<_.length;T++)_[T][1]=w-(b[C--]+_[T][0].length);return!!this._matchGlobStarBodySections(e,_,i,0,n,0,!!p)},g.prototype._matchGlobStarBodySections=function(e,t,n,r,i,a,o){var s=t[r];if(!s){for(var c=n;c<e.length;c++){o=!0;var l=e[c];if(l===`.`||l===`..`||!this.options.dot&&l.charAt(0)===`.`)return!1}return o}for(var u=s[0],d=s[1];n<=d;){if(this._matchOne(e.slice(0,n+u.length),u,i,n,0)&&a<this.maxGlobstarRecursion){var f=this._matchGlobStarBodySections(e,t,n+u.length,r+1,i,a+1,o);if(f!==!1)return f}var l=e[n];if(l===`.`||l===`..`||!this.options.dot&&l.charAt(0)===`.`)return!1;n++}return i||null},g.prototype._matchOne=function(e,t,n,i,a){for(var o=i,s=a,c=e.length,l=t.length;o<c&&s<l;o++,s++){this.debug(`matchOne loop`);var u=t[s],d=e[o];if(this.debug(t,u,d),u===!1||u===r)return!1;var f;if(typeof u==`string`?(f=d===u,this.debug(`string match`,u,d,f)):(f=d.match(u),this.debug(`pattern match`,u,d,f)),!f)return!1}if(o===c&&s===l)return!0;if(o===c)return n;if(s===l)return o===c-1&&e[o]===``;throw Error(`wtf?`)};function T(e){return e.replace(/\\(.)/g,`$1`)}function E(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`)}})),Ro=D(((e,t)=>{t.exports=typeof Object.create==`function`?function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),zo=D(((e,t)=>{try{var n=O(`util`);if(typeof n.inherits!=`function`)throw``;t.exports=n.inherits}catch{t.exports=Ro()}})),Bo=D(((e,t)=>{function n(e){return e.charAt(0)===`/`}function r(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(e),n=t[1]||``,r=!!(n&&n.charAt(1)!==`:`);return!!(t[2]||r)}t.exports=process.platform===`win32`?r:n,t.exports.posix=n,t.exports.win32=r})),Vo=D((e=>{e.setopts=u,e.ownProp=t,e.makeAbs=p,e.finish=d,e.mark=f,e.isIgnored=m,e.childrenIgnored=h;function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var n=O(`fs`),r=O(`path`),i=Lo(),a=Bo(),o=i.Minimatch;function s(e,t){return e.localeCompare(t,`en`)}function c(e,t){e.ignore=t.ignore||[],Array.isArray(e.ignore)||(e.ignore=[e.ignore]),e.ignore.length&&(e.ignore=e.ignore.map(l))}function l(e){var t=null;return e.slice(-3)===`/**`&&(t=new o(e.replace(/(\/\*\*)+$/,``),{dot:!0})),{matcher:new o(e,{dot:!0}),gmatcher:t}}function u(e,i,s){if(s||={},s.matchBase&&i.indexOf(`/`)===-1){if(s.noglobstar)throw Error(`base matching requires globstar`);i=`**/`+i}e.silent=!!s.silent,e.pattern=i,e.strict=s.strict!==!1,e.realpath=!!s.realpath,e.realpathCache=s.realpathCache||Object.create(null),e.follow=!!s.follow,e.dot=!!s.dot,e.mark=!!s.mark,e.nodir=!!s.nodir,e.nodir&&(e.mark=!0),e.sync=!!s.sync,e.nounique=!!s.nounique,e.nonull=!!s.nonull,e.nosort=!!s.nosort,e.nocase=!!s.nocase,e.stat=!!s.stat,e.noprocess=!!s.noprocess,e.absolute=!!s.absolute,e.fs=s.fs||n,e.maxLength=s.maxLength||1/0,e.cache=s.cache||Object.create(null),e.statCache=s.statCache||Object.create(null),e.symlinks=s.symlinks||Object.create(null),c(e,s),e.changedCwd=!1;var l=process.cwd();t(s,`cwd`)?(e.cwd=r.resolve(s.cwd),e.changedCwd=e.cwd!==l):e.cwd=l,e.root=s.root||r.resolve(e.cwd,`/`),e.root=r.resolve(e.root),process.platform===`win32`&&(e.root=e.root.replace(/\\/g,`/`)),e.cwdAbs=a(e.cwd)?e.cwd:p(e,e.cwd),process.platform===`win32`&&(e.cwdAbs=e.cwdAbs.replace(/\\/g,`/`)),e.nomount=!!s.nomount,s.nonegate=!0,s.nocomment=!0,s.allowWindowsEscape=!1,e.minimatch=new o(i,s),e.options=e.minimatch.options}function d(e){for(var t=e.nounique,n=t?[]:Object.create(null),r=0,i=e.matches.length;r<i;r++){var a=e.matches[r];if(!a||Object.keys(a).length===0){if(e.nonull){var o=e.minimatch.globSet[r];t?n.push(o):n[o]=!0}}else{var c=Object.keys(a);t?n.push.apply(n,c):c.forEach(function(e){n[e]=!0})}}if(t||(n=Object.keys(n)),e.nosort||(n=n.sort(s)),e.mark){for(var r=0;r<n.length;r++)n[r]=e._mark(n[r]);e.nodir&&(n=n.filter(function(t){var n=!/\/$/.test(t),r=e.cache[t]||e.cache[p(e,t)];return n&&r&&(n=r!==`DIR`&&!Array.isArray(r)),n}))}e.ignore.length&&(n=n.filter(function(t){return!m(e,t)})),e.found=n}function f(e,t){var n=p(e,t),r=e.cache[n],i=t;if(r){var a=r===`DIR`||Array.isArray(r),o=t.slice(-1)===`/`;if(a&&!o?i+=`/`:!a&&o&&(i=i.slice(0,-1)),i!==t){var s=p(e,i);e.statCache[s]=e.statCache[n],e.cache[s]=e.cache[n]}}return i}function p(e,t){var n=t;return n=t.charAt(0)===`/`?r.join(e.root,t):a(t)||t===``?t:e.changedCwd?r.resolve(e.cwd,t):r.resolve(t),process.platform===`win32`&&(n=n.replace(/\\/g,`/`)),n}function m(e,t){return e.ignore.length?e.ignore.some(function(e){return e.matcher.match(t)||!!(e.gmatcher&&e.gmatcher.match(t))}):!1}function h(e,t){return e.ignore.length?e.ignore.some(function(e){return!!(e.gmatcher&&e.gmatcher.match(t))}):!1}})),Ho=D(((e,t)=>{t.exports=f,f.GlobSync=p;var n=No(),r=Lo();r.Minimatch,Ko().Glob,O(`util`);var i=O(`path`),a=O(`assert`),o=Bo(),s=Vo(),c=s.setopts,l=s.ownProp,u=s.childrenIgnored,d=s.isIgnored;function f(e,t){if(typeof t==`function`||arguments.length===3)throw TypeError(`callback provided to sync glob
|
|
28
|
+
See: https://github.com/isaacs/node-glob/issues/167`);return new p(e,t).found}function p(e,t){if(!e)throw Error(`must provide pattern`);if(typeof t==`function`||arguments.length===3)throw TypeError(`callback provided to sync glob
|
|
29
|
+
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof p))return new p(e,t);if(c(this,e,t),this.noprocess)return this;var n=this.minimatch.set.length;this.matches=Array(n);for(var r=0;r<n;r++)this._process(this.minimatch.set[r],r,!1);this._finish()}p.prototype._finish=function(){if(a.ok(this instanceof p),this.realpath){var e=this;this.matches.forEach(function(t,r){var i=e.matches[r]=Object.create(null);for(var a in t)try{a=e._makeAbs(a);var o=n.realpathSync(a,e.realpathCache);i[o]=!0}catch(t){if(t.syscall===`stat`)i[e._makeAbs(a)]=!0;else throw t}})}s.finish(this)},p.prototype._process=function(e,t,n){a.ok(this instanceof p);for(var i=0;typeof e[i]==`string`;)i++;var s;switch(i){case e.length:this._processSimple(e.join(`/`),t);return;case 0:s=null;break;default:s=e.slice(0,i).join(`/`)}var c=e.slice(i),l;s===null?l=`.`:((o(s)||o(e.map(function(e){return typeof e==`string`?e:`[*]`}).join(`/`)))&&(!s||!o(s))&&(s=`/`+s),l=s);var d=this._makeAbs(l);u(this,l)||(c[0]===r.GLOBSTAR?this._processGlobStar(s,l,d,c,t,n):this._processReaddir(s,l,d,c,t,n))},p.prototype._processReaddir=function(e,t,n,r,a,o){var s=this._readdir(n,o);if(s){for(var c=r[0],l=!!this.minimatch.negate,u=c._glob,d=this.dot||u.charAt(0)===`.`,f=[],p=0;p<s.length;p++){var m=s[p];(m.charAt(0)!==`.`||d)&&(l&&!e?!m.match(c):m.match(c))&&f.push(m)}var h=f.length;if(h!==0){if(r.length===1&&!this.mark&&!this.stat){this.matches[a]||(this.matches[a]=Object.create(null));for(var p=0;p<h;p++){var m=f[p];e&&(m=e.slice(-1)===`/`?e+m:e+`/`+m),m.charAt(0)===`/`&&!this.nomount&&(m=i.join(this.root,m)),this._emitMatch(a,m)}return}r.shift();for(var p=0;p<h;p++){var m=f[p],g=e?[e,m]:[m];this._process(g.concat(r),a,o)}}}},p.prototype._emitMatch=function(e,t){if(!d(this,t)){var n=this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=n),!this.matches[e][t]){if(this.nodir){var r=this.cache[n];if(r===`DIR`||Array.isArray(r))return}this.matches[e][t]=!0,this.stat&&this._stat(t)}}},p.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,n;try{n=this.fs.lstatSync(e)}catch(e){if(e.code===`ENOENT`)return null}var r=n&&n.isSymbolicLink();return this.symlinks[e]=r,!r&&n&&!n.isDirectory()?this.cache[e]=`FILE`:t=this._readdir(e,!1),t},p.prototype._readdir=function(e,t){if(t&&!l(this.symlinks,e))return this._readdirInGlobStar(e);if(l(this.cache,e)){var n=this.cache[e];if(!n||n===`FILE`)return null;if(Array.isArray(n))return n}try{return this._readdirEntries(e,this.fs.readdirSync(e))}catch(t){return this._readdirError(e,t),null}},p.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var r=t[n];r=e===`/`?e+r:e+`/`+r,this.cache[r]=!0}return this.cache[e]=t,t},p.prototype._readdirError=function(e,t){switch(t.code){case`ENOTSUP`:case`ENOTDIR`:var n=this._makeAbs(e);if(this.cache[n]=`FILE`,n===this.cwdAbs){var r=Error(t.code+` invalid cwd `+this.cwd);throw r.path=this.cwd,r.code=t.code,r}break;case`ENOENT`:case`ELOOP`:case`ENAMETOOLONG`:case`UNKNOWN`:this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;this.silent||console.error(`glob error`,t)}},p.prototype._processGlobStar=function(e,t,n,r,i,a){var o=this._readdir(n,a);if(o){var s=r.slice(1),c=e?[e]:[],l=c.concat(s);this._process(l,i,!1);var u=o.length;if(!(this.symlinks[n]&&a)){for(var d=0;d<u;d++)if(o[d].charAt(0)!==`.`||this.dot){var f=c.concat(o[d],s);this._process(f,i,!0);var p=c.concat(o[d],r);this._process(p,i,!0)}}}},p.prototype._processSimple=function(e,t){var n=this._stat(e);if(this.matches[t]||(this.matches[t]=Object.create(null)),n){if(e&&o(e)&&!this.nomount){var r=/[\/\\]$/.test(e);e.charAt(0)===`/`?e=i.join(this.root,e):(e=i.resolve(this.root,e),r&&(e+=`/`))}process.platform===`win32`&&(e=e.replace(/\\/g,`/`)),this._emitMatch(t,e)}},p.prototype._stat=function(e){var t=this._makeAbs(e),n=e.slice(-1)===`/`;if(e.length>this.maxLength)return!1;if(!this.stat&&l(this.cache,t)){var r=this.cache[t];if(Array.isArray(r)&&(r=`DIR`),!n||r===`DIR`)return r;if(n&&r===`FILE`)return!1}var i=this.statCache[t];if(!i){var a;try{a=this.fs.lstatSync(t)}catch(e){if(e&&(e.code===`ENOENT`||e.code===`ENOTDIR`))return this.statCache[t]=!1,!1}if(a&&a.isSymbolicLink())try{i=this.fs.statSync(t)}catch{i=a}else i=a}this.statCache[t]=i;var r=!0;return i&&(r=i.isDirectory()?`DIR`:`FILE`),this.cache[t]=this.cache[t]||r,n&&r===`FILE`?!1:r},p.prototype._mark=function(e){return s.mark(this,e)},p.prototype._makeAbs=function(e){return s.makeAbs(this,e)}})),Uo=D(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),Wo=D(((e,t)=>{var n=Uo();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),Go=D(((e,t)=>{var n=Uo(),r=Object.create(null),i=Wo();t.exports=n(a);function a(e,t){return r[e]?(r[e].push(t),null):(r[e]=[t],o(e))}function o(e){return i(function t(){var n=r[e],i=n.length,a=s(arguments);try{for(var o=0;o<i;o++)n[o].apply(null,a)}finally{n.length>i?(n.splice(0,i),process.nextTick(function(){t.apply(null,a)})):delete r[e]}})}function s(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r]=e[r];return n}})),Ko=D(((e,t)=>{t.exports=_;var n=No(),r=Lo();r.Minimatch;var i=zo(),a=O(`events`).EventEmitter,o=O(`path`),s=O(`assert`),c=Bo(),l=Ho(),u=Vo(),d=u.setopts,f=u.ownProp,p=Go();O(`util`);var m=u.childrenIgnored,h=u.isIgnored,g=Wo();function _(e,t,n){if(typeof t==`function`&&(n=t,t={}),t||={},t.sync){if(n)throw TypeError(`callback provided to sync glob`);return l(e,t)}return new b(e,t,n)}_.sync=l;var v=_.GlobSync=l.GlobSync;_.glob=_;function y(e,t){if(typeof t!=`object`||!t)return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}_.hasMagic=function(e,t){var n=y({},t);n.noprocess=!0;var r=new b(e,n).minimatch.set;if(!e)return!1;if(r.length>1)return!0;for(var i=0;i<r[0].length;i++)if(typeof r[0][i]!=`string`)return!0;return!1},_.Glob=b,i(b,a);function b(e,t,n){if(typeof t==`function`&&(n=t,t=null),t&&t.sync){if(n)throw TypeError(`callback provided to sync glob`);return new v(e,t)}if(!(this instanceof b))return new b(e,t,n);d(this,e,t),this._didRealPath=!1;var r=this.minimatch.set.length;this.matches=Array(r),typeof n==`function`&&(n=g(n),this.on(`error`,n),this.on(`end`,function(e){n(null,e)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(r===0)return s();for(var a=!0,o=0;o<r;o++)this._process(this.minimatch.set[o],o,!1,s);a=!1;function s(){--i._processing,i._processing<=0&&(a?process.nextTick(function(){i._finish()}):i._finish())}}b.prototype._finish=function(){if(s(this instanceof b),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();u.finish(this),this.emit(`end`,this.found)}},b.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();for(var t=this,n=0;n<this.matches.length;n++)this._realpathSet(n,r);function r(){--e===0&&t._finish()}},b.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var i=Object.keys(r),a=this,o=i.length;if(o===0)return t();var s=this.matches[e]=Object.create(null);i.forEach(function(r,i){r=a._makeAbs(r),n.realpath(r,a.realpathCache,function(n,i){n?n.syscall===`stat`?s[r]=!0:a.emit(`error`,n):s[i]=!0,--o===0&&(a.matches[e]=s,t())})})},b.prototype._mark=function(e){return u.mark(this,e)},b.prototype._makeAbs=function(e){return u.makeAbs(this,e)},b.prototype.abort=function(){this.aborted=!0,this.emit(`abort`)},b.prototype.pause=function(){this.paused||(this.paused=!0,this.emit(`pause`))},b.prototype.resume=function(){if(this.paused){if(this.emit(`resume`),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var n=e[t];this._emitMatch(n[0],n[1])}}if(this._processQueue.length){var r=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<r.length;t++){var i=r[t];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}},b.prototype._process=function(e,t,n,i){if(s(this instanceof b),s(typeof i==`function`),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([e,t,n,i]);return}for(var a=0;typeof e[a]==`string`;)a++;var o;switch(a){case e.length:this._processSimple(e.join(`/`),t,i);return;case 0:o=null;break;default:o=e.slice(0,a).join(`/`)}var l=e.slice(a),u;o===null?u=`.`:((c(o)||c(e.map(function(e){return typeof e==`string`?e:`[*]`}).join(`/`)))&&(!o||!c(o))&&(o=`/`+o),u=o);var d=this._makeAbs(u);if(m(this,u))return i();l[0]===r.GLOBSTAR?this._processGlobStar(o,u,d,l,t,n,i):this._processReaddir(o,u,d,l,t,n,i)}},b.prototype._processReaddir=function(e,t,n,r,i,a,o){var s=this;this._readdir(n,a,function(c,l){return s._processReaddir2(e,t,n,r,i,a,l,o)})},b.prototype._processReaddir2=function(e,t,n,r,i,a,s,c){if(!s)return c();for(var l=r[0],u=!!this.minimatch.negate,d=l._glob,f=this.dot||d.charAt(0)===`.`,p=[],m=0;m<s.length;m++){var h=s[m];(h.charAt(0)!==`.`||f)&&(u&&!e?!h.match(l):h.match(l))&&p.push(h)}var g=p.length;if(g===0)return c();if(r.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var m=0;m<g;m++){var h=p[m];e&&(h=e===`/`?e+h:e+`/`+h),h.charAt(0)===`/`&&!this.nomount&&(h=o.join(this.root,h)),this._emitMatch(i,h)}return c()}r.shift();for(var m=0;m<g;m++){var h=p[m];e&&(h=e===`/`?e+h:e+`/`+h),this._process([h].concat(r),i,a,c)}c()},b.prototype._emitMatch=function(e,t){if(!this.aborted&&!h(this,t)){if(this.paused){this._emitQueue.push([e,t]);return}var n=c(t)?t:this._makeAbs(t);if(this.mark&&(t=this._mark(t)),this.absolute&&(t=n),!this.matches[e][t]){if(this.nodir){var r=this.cache[n];if(r===`DIR`||Array.isArray(r))return}this.matches[e][t]=!0;var i=this.statCache[n];i&&this.emit(`stat`,t,i),this.emit(`match`,t)}}},b.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var n=`lstat\0`+e,r=this,i=p(n,a);i&&r.fs.lstat(e,i);function a(n,i){if(n&&n.code===`ENOENT`)return t();var a=i&&i.isSymbolicLink();r.symlinks[e]=a,!a&&i&&!i.isDirectory()?(r.cache[e]=`FILE`,t()):r._readdir(e,!1,t)}},b.prototype._readdir=function(e,t,n){if(!this.aborted&&(n=p(`readdir\0`+e+`\0`+t,n),n)){if(t&&!f(this.symlinks,e))return this._readdirInGlobStar(e,n);if(f(this.cache,e)){var r=this.cache[e];if(!r||r===`FILE`)return n();if(Array.isArray(r))return n(null,r)}this.fs.readdir(e,x(this,e,n))}};function x(e,t,n){return function(r,i){r?e._readdirError(t,r,n):e._readdirEntries(t,i,n)}}b.prototype._readdirEntries=function(e,t,n){if(!this.aborted){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var i=t[r];i=e===`/`?e+i:e+`/`+i,this.cache[i]=!0}return this.cache[e]=t,n(null,t)}},b.prototype._readdirError=function(e,t,n){if(!this.aborted){switch(t.code){case`ENOTSUP`:case`ENOTDIR`:var r=this._makeAbs(e);if(this.cache[r]=`FILE`,r===this.cwdAbs){var i=Error(t.code+` invalid cwd `+this.cwd);i.path=this.cwd,i.code=t.code,this.emit(`error`,i),this.abort()}break;case`ENOENT`:case`ELOOP`:case`ENAMETOOLONG`:case`UNKNOWN`:this.cache[this._makeAbs(e)]=!1;break;default:this.cache[this._makeAbs(e)]=!1,this.strict&&(this.emit(`error`,t),this.abort()),this.silent||console.error(`glob error`,t)}return n()}},b.prototype._processGlobStar=function(e,t,n,r,i,a,o){var s=this;this._readdir(n,a,function(c,l){s._processGlobStar2(e,t,n,r,i,a,l,o)})},b.prototype._processGlobStar2=function(e,t,n,r,i,a,o,s){if(!o)return s();var c=r.slice(1),l=e?[e]:[],u=l.concat(c);this._process(u,i,!1,s);var d=this.symlinks[n],f=o.length;if(d&&a)return s();for(var p=0;p<f;p++)if(o[p].charAt(0)!==`.`||this.dot){var m=l.concat(o[p],c);this._process(m,i,!0,s);var h=l.concat(o[p],r);this._process(h,i,!0,s)}s()},b.prototype._processSimple=function(e,t,n){var r=this;this._stat(e,function(i,a){r._processSimple2(e,t,i,a,n)})},b.prototype._processSimple2=function(e,t,n,r,i){if(this.matches[t]||(this.matches[t]=Object.create(null)),!r)return i();if(e&&c(e)&&!this.nomount){var a=/[\/\\]$/.test(e);e.charAt(0)===`/`?e=o.join(this.root,e):(e=o.resolve(this.root,e),a&&(e+=`/`))}process.platform===`win32`&&(e=e.replace(/\\/g,`/`)),this._emitMatch(t,e),i()},b.prototype._stat=function(e,t){var n=this._makeAbs(e),r=e.slice(-1)===`/`;if(e.length>this.maxLength)return t();if(!this.stat&&f(this.cache,n)){var i=this.cache[n];if(Array.isArray(i)&&(i=`DIR`),!r||i===`DIR`)return t(null,i);if(r&&i===`FILE`)return t()}var a=this.statCache[n];if(a!==void 0){if(a===!1)return t(null,a);var o=a.isDirectory()?`DIR`:`FILE`;return r&&o===`FILE`?t():t(null,o,a)}var s=this,c=p(`stat\0`+n,l);c&&s.fs.lstat(n,c);function l(r,i){if(i&&i.isSymbolicLink())return s.fs.stat(n,function(r,a){r?s._stat2(e,n,null,i,t):s._stat2(e,n,r,a,t)});s._stat2(e,n,r,i,t)}},b.prototype._stat2=function(e,t,n,r,i){if(n&&(n.code===`ENOENT`||n.code===`ENOTDIR`))return this.statCache[t]=!1,i();var a=e.slice(-1)===`/`;if(this.statCache[t]=r,t.slice(-1)===`/`&&r&&!r.isDirectory())return i(null,!1,r);var o=!0;return r&&(o=r.isDirectory()?`DIR`:`FILE`),this.cache[t]=this.cache[t]||o,a&&o===`FILE`?i():i(null,o,r)}})),qo=D(((e,t)=>{t.exports=d,d.sync=_;var n=O(`assert`),r=O(`path`),i=O(`fs`),a=Ko(),o=438,s={nosort:!0,silent:!0},c=0,l=process.platform===`win32`;function u(e){[`unlink`,`chmod`,`stat`,`lstat`,`rmdir`,`readdir`].forEach(function(t){e[t]=e[t]||i[t],t+=`Sync`,e[t]=e[t]||i[t]}),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1e3,e.glob===!1&&(e.disableGlob=!0),e.disableGlob=e.disableGlob||!1,e.glob=e.glob||s}function d(e,t,r){typeof t==`function`&&(r=t,t={}),n(e,`rimraf: missing path`),n.equal(typeof e,`string`,`rimraf: path should be a string`),n.equal(typeof r,`function`,`rimraf: callback function required`),n(t,`rimraf: invalid options argument provided`),n.equal(typeof t,`object`,`rimraf: options should be object`),u(t);var i=0,o=null,s=0;if(t.disableGlob||!a.hasMagic(e))return d(null,[e]);t.lstat(e,function(n,r){if(!n)return d(null,[e]);a(e,t.glob,d)});function l(e){o||=e,--s===0&&r(o)}function d(e,n){if(e)return r(e);if(s=n.length,s===0)return r();n.forEach(function(e){f(e,t,function n(r){if(r){if((r.code===`EBUSY`||r.code===`ENOTEMPTY`||r.code===`EPERM`)&&i<t.maxBusyTries){i++;var a=i*100;return setTimeout(function(){f(e,t,n)},a)}if(r.code===`EMFILE`&&c<t.emfileWait)return setTimeout(function(){f(e,t,n)},c++);r.code===`ENOENT`&&(r=null)}c=0,l(r)})})}}function f(e,t,r){n(e),n(t),n(typeof r==`function`),t.lstat(e,function(n,i){if(n&&n.code===`ENOENT`)return r(null);if(n&&n.code===`EPERM`&&l&&p(e,t,n,r),i&&i.isDirectory())return h(e,t,n,r);t.unlink(e,function(n){if(n){if(n.code===`ENOENT`)return r(null);if(n.code===`EPERM`)return l?p(e,t,n,r):h(e,t,n,r);if(n.code===`EISDIR`)return h(e,t,n,r)}return r(n)})})}function p(e,t,r,i){n(e),n(t),n(typeof i==`function`),r&&n(r instanceof Error),t.chmod(e,o,function(n){n?i(n.code===`ENOENT`?null:r):t.stat(e,function(n,a){n?i(n.code===`ENOENT`?null:r):a.isDirectory()?h(e,t,r,i):t.unlink(e,i)})})}function m(e,t,r){n(e),n(t),r&&n(r instanceof Error);try{t.chmodSync(e,o)}catch(e){if(e.code===`ENOENT`)return;throw r}try{var i=t.statSync(e)}catch(e){if(e.code===`ENOENT`)return;throw r}i.isDirectory()?v(e,t,r):t.unlinkSync(e)}function h(e,t,r,i){n(e),n(t),r&&n(r instanceof Error),n(typeof i==`function`),t.rmdir(e,function(n){n&&(n.code===`ENOTEMPTY`||n.code===`EEXIST`||n.code===`EPERM`)?g(e,t,i):n&&n.code===`ENOTDIR`?i(r):i(n)})}function g(e,t,i){n(e),n(t),n(typeof i==`function`),t.readdir(e,function(n,a){if(n)return i(n);var o=a.length;if(o===0)return t.rmdir(e,i);var s;a.forEach(function(n){d(r.join(e,n),t,function(n){if(!s){if(n)return i(s=n);--o===0&&t.rmdir(e,i)}})})})}function _(e,t){t||={},u(t),n(e,`rimraf: missing path`),n.equal(typeof e,`string`,`rimraf: path should be a string`),n(t,`rimraf: missing options`),n.equal(typeof t,`object`,`rimraf: options should be object`);var r;if(t.disableGlob||!a.hasMagic(e))r=[e];else try{t.lstatSync(e),r=[e]}catch{r=a.sync(e,t.glob)}if(r.length)for(var i=0;i<r.length;i++){var e=r[i];try{var o=t.lstatSync(e)}catch(n){if(n.code===`ENOENT`)return;n.code===`EPERM`&&l&&m(e,t,n)}try{o&&o.isDirectory()?v(e,t,null):t.unlinkSync(e)}catch(n){if(n.code===`ENOENT`)return;if(n.code===`EPERM`)return l?m(e,t,n):v(e,t,n);if(n.code!==`EISDIR`)throw n;v(e,t,n)}}}function v(e,t,r){n(e),n(t),r&&n(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code===`ENOENT`)return;if(n.code===`ENOTDIR`)throw r;(n.code===`ENOTEMPTY`||n.code===`EEXIST`||n.code===`EPERM`)&&y(e,t)}}function y(e,t){n(e),n(t),t.readdirSync(e).forEach(function(n){_(r.join(e,n),t)});var i=l?100:1,a=0;do{var o=!0;try{var s=t.rmdirSync(e,t);return o=!1,s}finally{if(++a<i&&o)continue}}while(1)}})),Jo=D(((e,t)=>{var n=O(`path`),r=O(`fs`),i=511;t.exports=a.mkdirp=a.mkdirP=a;function a(e,t,o,s){typeof t==`function`?(o=t,t={}):(!t||typeof t!=`object`)&&(t={mode:t});var c=t.mode,l=t.fs||r;c===void 0&&(c=i),s||=null;var u=o||function(){};e=n.resolve(e),l.mkdir(e,c,function(r){if(!r)return s||=e,u(null,s);switch(r.code){case`ENOENT`:if(n.dirname(e)===e)return u(r);a(n.dirname(e),t,function(n,r){n?u(n,r):a(e,t,u,r)});break;default:l.stat(e,function(e,t){e||!t.isDirectory()?u(r,s):u(null,s)})}})}a.sync=function e(t,a,o){(!a||typeof a!=`object`)&&(a={mode:a});var s=a.mode,c=a.fs||r;s===void 0&&(s=i),o||=null,t=n.resolve(t);try{c.mkdirSync(t,s),o||=t}catch(r){switch(r.code){case`ENOENT`:o=e(n.dirname(t),a,o),e(t,a,o);break;default:var l;try{l=c.statSync(t)}catch{throw r}if(!l.isDirectory())throw r}}return o}})),Yo=D(((e,t)=>{let n=O(`fs`),r=O(`path`),i=O(`constants`),a=O(`os`),o=qo(),s=Jo();O(`os`).tmpdir();let c=o.sync,l=r.resolve(a.tmpdir()),u=i.O_CREAT|i.O_TRUNC|i.O_RDWR|i.O_EXCL,d=function(e){if(typeof e==`function`)return[void 0,e];var t;return[new Promise(function(e,n){t=function(){var t=Array.from(arguments),r=t.shift();process.nextTick(function(){r?n(r):t.length===1?e(t[0]):e(t)})}}),t]};var f=function(e,t){var n=p(e,t),i=new Date,a=[n.prefix,i.getFullYear(),i.getMonth(),i.getDate(),`-`,process.pid,`-`,(Math.random()*4294967296+1).toString(36),n.suffix].join(``);return r.join(n.dir||l,a)},p=function(e,t){var n={prefix:null,suffix:null};if(e)switch(typeof e){case`string`:n.prefix=e;break;case`object`:n=e;break;default:throw Error(`Unknown affix declaration: `+n)}else n.prefix=t;return n},m=!1,h=function(e){return m=e!==!1,t.exports},g=!1,_=[],v=[];function y(e){if(!m)return!1;x(),_.push(e)}function b(e){if(!m)return!1;x(),v.push(e)}function x(){if(!m)return!1;g||=(process.addListener(`exit`,function(){try{E()}catch(e){throw console.warn(`Fail to clean temporary files on exit : `,e),e}}),!0)}function S(){if(!m)return!1;for(var e=0,t;(t=_.shift())!==void 0;)c(t,{maxBusyTries:6}),e++;return e}function C(e){var t=d(e),n=t[0];if(e=t[1],!m)return e(Error(`not tracking`)),n;var r=0,i=_.length;if(!i)return e(null,r),n;for(var a,s=function(t){if(i){if(t){e(t),i=0;return}r++,i--,i||e(null,r)}};(a=_.shift())!==void 0;)o(a,{maxBusyTries:6},s);return n}function w(){if(!m)return!1;for(var e=0,t;(t=v.shift())!==void 0;)c(t,{maxBusyTries:6}),e++;return e}function T(e){var t=d(e),n=t[0];if(e=t[1],!m)return e(Error(`not tracking`)),n;var r=0,i=v.length;if(!i)return e(null,r),n;for(var a,s=function(t){if(i){if(t){e(t,r),i=0;return}r++,i--,i||e(null,r)}};(a=v.shift())!==void 0;)o(a,{maxBusyTries:6},s);return n}function E(){return m?{files:S(),dirs:w()}:!1}function ee(e){var t=d(e),n=t[0];return e=t[1],m?(C(function(t,n){t?e(t,{files:n}):T(function(t,r){e(t,{files:n,dirs:r})})}),n):(e(Error(`not tracking`)),n)}e.dir=l,e.track=h,e.mkdir=(e,t)=>{let n=d(t),r=n[0];t=n[1];let i=f(e,`d-`);return s(i,448,e=>{e||b(i),t(e,i)}),r},e.mkdirSync=e=>{let t=f(e,`d-`);return s.sync(t,448),b(t),t},e.open=(e,t)=>{let r=d(t),i=r[0];t=r[1];let a=f(e,`f-`);return n.open(a,u,384,(e,n)=>{e||y(a),t(e,{path:a,fd:n})}),i},e.openSync=e=>{let t=f(e,`f-`),r=n.openSync(t,u,384);return y(t),{path:t,fd:r}},e.path=f,e.cleanup=ee,e.cleanupSync=E,e.createWriteStream=e=>{let t=f(e,`s-`),r=n.createWriteStream(t,{flags:u,mode:384});return y(t),r}})),Xo,Zo=oe((()=>{Xo={"aube-lock.yaml":`aube`,"aube-workspace.yaml":`aube`,"bun.lock":`bun`,"bun.lockb":`bun`,"deno.lock":`deno`,"nub.lock":`nub`,"pnpm-lock.yaml":`pnpm`,"pnpm-workspace.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`,"npm-shrinkwrap.json":`npm`}})),Qo=se({findByKeywords:()=>ys});function $o(){return m.join(Ss.dir,Cs)}function es(e,t){return JSON.stringify({cwd:m.resolve(t),keywords:[...e].sort()})}function ts(e,t){let n=rs(),r=n[e];if(r){if(typeof r.fingerprint!=`number`||r.fingerprint<t){delete n[e],is(n);return}return r.packages}}function ns(e,t,n){let r=rs();r[e]={fingerprint:t,packages:n},is(r)}function rs(){if(ws)return ws;let e=$o();if(!t.existsSync(e))return ws={},ws;try{return ws=JSON.parse(t.readFileSync(e,{encoding:`utf-8`})),ws}catch{return ws={},ws}}function is(e){ws=e;let n=$o();t.writeFileSync(n,JSON.stringify(e))}async function as(e){try{await t.promises.access(e)}catch{return[]}return os(e,{})}async function os(e,n){let r=m.join(e,`node_modules`);if(n[r])return[];n[r]=!0;try{await t.promises.access(r)}catch{return[]}let i=await t.promises.readdir(r),a=[];return await Promise.all(i.map(async e=>{let i=m.join(r,e),o=await ss(i);if(o&&o.isDirectory()){if(n[i]=!0,e.startsWith(`@`)){if(e===`@types`)return;let o=await t.promises.readdir(i);await Promise.all(o.map(async t=>{let i=m.join(r,e,t);if(n[i])return;let o=await ss(i);if(!o||!o.isDirectory())return;n[i]=!0,a.push({name:`${e}/${t}`,ctimeMs:o.ctimeMs,path:i});let s=await os(i,n);a.push(...s)}))}else{a.push({name:e,ctimeMs:o.ctimeMs,path:i});let t=await os(i,n);a.push(...t)}}})),a}async function ss(e){try{return await t.promises.stat(e)}catch{return}}async function cs(e){let t=m.resolve(e),n=0,r=e=>{e&&e.mtimeMs>n&&(n=e.mtimeMs)};r(await ls(m.join(t,`package.json`))),r(await ls(m.join(t,`node_modules`)));let i=t;for(;;){let e=(await Promise.all(Ts.map(e=>ls(m.join(i,e))))).filter(e=>!!e);if(e.length>0){e.forEach(r);break}let t=m.dirname(i);if(t===i)break;i=t}return n}async function ls(e){try{return await t.promises.stat(e)}catch{return}}function us(e,t){let n=new Set(e);return!t.find(e=>!n.has(e))}async function ds(e){try{return await t.promises.readFile(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}async function fs(e){try{let t=await ds(m.resolve(e,`package.json`));if(!t)return;let n=JSON.parse(t);return n&&typeof n==`object`?n:void 0}catch{return}}function ps(e,t){let n=[...ms(e.dependencies),...ms(e.optionalDependencies),...ms(e.peerDependencies),...t?ms(e.devDependencies):[]];return Array.from(new Set(n))}function ms(e){return e&&typeof e==`object`&&!Array.isArray(e)?Object.keys(e):[]}async function hs(e){let t=m.resolve(e),n=await fs(t);if(!n)return;let r=ps(n,!0);if(r.length===0)return;let i=[];return await gs(t,r,new Set([t]),i),i}async function gs(e,t,n,r){await Promise.all(t.map(async t=>{if(t.indexOf(`@types/`)===0)return;let i=_s(t,e);if(!i||n.has(i))return;n.add(i);let a=await fs(i);a&&(a.name&&r.push({name:a.name,path:i,manifest:a}),await gs(i,ps(a,!1),n,r))}))}function _s(n,r){let i=e(m.join(r,`package.json`));try{return m.dirname(i.resolve(`${n}/package.json`))}catch{}try{let e=i.resolve.paths(n);if(e)for(let r of e){let e=m.join(r,n);if(t.existsSync(m.join(e,`package.json`)))return e}}catch{}try{let e=m.dirname(i.resolve(n));for(;;){if(vs(e)===n)return e;let t=m.dirname(e);if(t===e)return;e=t}}catch{}}function vs(e){try{return JSON.parse(t.readFileSync(m.join(e,`package.json`),`utf8`)).name}catch{return}}async function ys(e,t){let{cwd:n}=xe({cwd:`.`},t);return bs(e,n)}async function bs(e,t){let n=es(e,t),r=await cs(t),i=ts(n,r);if(i)return i;let a=(await xs(t)).filter(t=>t.name&&us(t.keywords,e)).map(e=>e.name),o=Array.from(new Set(a));return ns(n,r,o),o}async function xs(e){let t=await hs(e);if(t)return t.map(e=>e.manifest);let n=await as(e);return(await Promise.all(n.map(e=>fs(e.path)))).filter(e=>!!e)}var Ss,Cs,ws,Ts,Es=oe((()=>{we(),Ss=le(Yo(),1),Zo(),Cs=`.find-installed-packages.cache`,Ts=Object.keys(Xo).concat([`.pnp.cjs`,`.pnp.data.json`])}));function Ds(e,t){let n=new Set(e);return!t.find(e=>!n.has(e))}var Os=oe((()=>{}));function ks(e,t,n){let r=e.filter(e=>Ds(e.keywords,t));return n?r.map(e=>n.reduce((t,n)=>(t[n]=e[n],t),{name:e.name})):r.map(e=>e.name)}var As=oe((()=>{Os()}));async function js(e,t={}){let{registry:n=Ns,maxResults:r=Ps,signal:i,fetch:a=globalThis.fetch}=t;if(e.length===0)return{packages:[],truncated:!1};if(typeof a!=`function`)throw new Fs(`global fetch is not available; Node 18 or later is required`);let o=`keywords:${e.join(`,`)}`,s=[],c=1/0;for(;s.length<r&&s.length<c;){let e=Math.min(250,r-s.length),t=await a(`${Ms(n)}/-/v1/search?text=${encodeURIComponent(o)}&size=${e}&from=${s.length}`,{signal:i});if(!t.ok)throw new Fs(`npm registry search failed: ${t.status} ${t.statusText}`,t.status);let l=await t.json(),u=l?.objects??[];if(c=typeof l?.total==`number`?l.total:s.length+u.length,u.length===0)return{packages:s,truncated:!1};for(let e of u)e?.package&&s.push(e.package)}return{packages:s,truncated:c>s.length}}function Ms(e){return e.endsWith(`/`)?e.slice(0,-1):e}var Ns,Ps,Fs,Is=oe((()=>{Ns=`https://registry.npmjs.org`,Ps=1e3,Fs=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`RegistrySearchError`}}}));async function Ls(e,t,n){let{packages:r}=await js(e,n);return ks(r,e,t)}var Rs=oe((()=>{As(),Is()})),zs=se({DEFAULT_MAX_RESULTS:()=>Ps,DEFAULT_REGISTRY:()=>Ns,MAX_PAGE_SIZE:()=>250,RegistrySearchError:()=>Fs,fetchPackagesByKeywords:()=>js,hasAllKeywords:()=>Ds,pickPackagesWithKeywords:()=>ks,searchByKeywords:()=>Ls}),Bs=oe((()=>{Os(),As(),Is(),Rs()}));const Vs=async(...e)=>(await Promise.resolve().then(()=>(Es(),Qo))).findByKeywords(...e),Hs=async(...e)=>(await Promise.resolve().then(()=>(Bs(),zs))).searchByKeywords(...e);function Us(e,t){return Vi({name:``,description:e,options:{help:{type:X(go()),description:`Print help message`,alias:[`h`]},version:{type:X(go()),description:`Print the CLI version`,alias:[`v`]},verbose:{type:X(go()),description:`Turn on verbose logging`,alias:[`V`]},silent:{type:X(go()),description:`Turn off logging`},"debug-cli":{type:X(go()),description:`Display clibuilder debug messages`},...t?.config?{"show-config":{type:X(go()),description:`Print the resolved config and where it was loaded from`}}:{}},commands:[],run(){this.ui.showHelp()}})}const Ws=Vi({name:`list`,alias:[`ls`],description:`List installed plugins`,options:{format:Eo},context:{findByKeywords:Vs},async run(e){let t=await this.context.findByKeywords(this.keywords,this);return Gs(this.ui,e.format,t,this.keywords),t}});function Gs(e,t,n,r){if(t===`json`){e.info(JSON.stringify({plugins:n},void 0,2));return}if(t===`text`){jo(e,{noun:`plugin`,plural:`plugins`},n,e=>e,r);return}if(n.length===0){e.info(`plugins: 0 installed plugins found with keywords: ${r.join(`, `)}`),e.info(Ao("Run `plugins search` to find plugins to install"));return}e.info(Oo(`plugins`,n)),e.info(Ao("Run `plugins search` to find more plugins on npm"))}const Ks=Vi({name:`search`,description:`Search only for available plugins`,options:{format:Eo,fields:{type:X(ho()),description:`Extra fields to report, comma separated. Only 'keywords' is available`}},context:{searchByKeywords:Hs},async run(e){let t=Js(e.fields);if(!t){this.ui.info(`error: unknown value for --fields: ${e.fields}`),this.ui.info(Ao("The only extra field is `keywords`. Run `plugins search --fields keywords`"));return}let n=await Promise.all(this.keywords.map(e=>this.context.searchByKeywords([e]))),r=new Map;n.forEach((e,t)=>{e.forEach(e=>{let n=r.get(e);n?n.push(this.keywords[t]):r.set(e,[this.keywords[t]])})}),Ys(this.ui,e.format,t,[...r].map(qs),this.keywords)}});function qs([e,t]){return{name:e,keywords:t}}function Js(e){if(e===void 0)return{keywords:!1};let t=e.split(`,`).map(e=>e.trim());if(!t.some(e=>e!==`keywords`&&e!==`name`))return{keywords:t.includes(`keywords`)}}function Ys(e,t,n,r,i){if(t===`json`){let t=n.keywords?r:r.map(e=>e.name);e.info(JSON.stringify({packages:t},void 0,2));return}if(t===`text`){jo(e,{noun:`package`,plural:`packages`},r,e=>n.keywords?`${e.name} (${e.keywords.join(`, `)})`:e.name,i);return}if(r.length===0){e.info(`packages: 0 packages found with keywords: ${i.join(`, `)}`);return}n.keywords?ko(`packages`,[`name`,`keywords`],r.map(e=>[e.name,e.keywords.join(` `)])).forEach(t=>{e.info(t)}):e.info(Oo(`packages`,r.map(e=>e.name))),e.info(Ao("Run `plugins list` to see which of them are installed"))}const Xs=Vi({name:`plugins`,description:`Commands related to the plugins of the cli`,commands:[Ws,Ks]});function Zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Qs={},$s={},ec={},tc;function nc(){if(tc)return ec;tc=1;function e(e){return e==null}function t(e){return typeof e==`object`&&!!e}function n(t){return Array.isArray(t)?t:e(t)?[]:[t]}function r(e,t){if(t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r+=1){let i=n[r];e[i]=t[i]}}return e}function i(e,t){let n=``;for(let r=0;r<t;r+=1)n+=e;return n}function a(e){return e===0&&1/e==-1/0}return ec.isNothing=e,ec.isObject=t,ec.toArray=n,ec.repeat=i,ec.isNegativeZero=a,ec.extend=r,ec}var rc,ic;function ac(){if(ic)return rc;ic=1;function e(e,t){let n=``,r=e.reason||`(unknown reason)`;return e.mark?(e.mark.name&&(n+=`in "`+e.mark.name+`" `),n+=`(`+(e.mark.line+1)+`:`+(e.mark.column+1)+`)`,!t&&e.mark.snippet&&(n+=`
|
|
30
|
+
|
|
31
|
+
`+e.mark.snippet),r+` `+n):r}function t(t,n){Error.call(this),this.name=`YAMLException`,this.reason=t,this.mark=n,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||``}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.prototype.toString=function(t){return this.name+`: `+e(this,t)},rc=t,rc}var oc,sc;function cc(){if(sc)return oc;sc=1;let e=nc();function t(e,t,n,r,i){let a=``,o=``,s=Math.floor(i/2)-1;return r-t>s&&(a=` ... `,t=r-s+a.length),n-r>s&&(o=` ...`,n=r+s-o.length),{str:a+e.slice(t,n).replace(/\t/g,`→`)+o,pos:r-t+a.length}}function n(t,n){return e.repeat(` `,n-t.length)+t}function r(r,i){if(i=Object.create(i||null),!r.buffer)return null;i.maxLength||(i.maxLength=79),typeof i.indent!=`number`&&(i.indent=1),typeof i.linesBefore!=`number`&&(i.linesBefore=3),typeof i.linesAfter!=`number`&&(i.linesAfter=2);let a=/\r?\n|\r|\0/g,o=[0],s=[],c,l=-1;for(;c=a.exec(r.buffer);)s.push(c.index),o.push(c.index+c[0].length),r.position<=c.index&&l<0&&(l=o.length-2);l<0&&(l=o.length-1);let u=``,d=Math.min(r.line+i.linesAfter,s.length).toString().length,f=i.maxLength-(i.indent+d+3);for(let a=1;a<=i.linesBefore&&!(l-a<0);a++){let c=t(r.buffer,o[l-a],s[l-a],r.position-(o[l]-o[l-a]),f);u=e.repeat(` `,i.indent)+n((r.line-a+1).toString(),d)+` | `+c.str+`
|
|
32
|
+
`+u}let p=t(r.buffer,o[l],s[l],r.position,f);u+=e.repeat(` `,i.indent)+n((r.line+1).toString(),d)+` | `+p.str+`
|
|
33
|
+
`,u+=e.repeat(`-`,i.indent+d+3+p.pos)+`^
|
|
34
|
+
`;for(let a=1;a<=i.linesAfter&&!(l+a>=s.length);a++){let c=t(r.buffer,o[l+a],s[l+a],r.position-(o[l]-o[l+a]),f);u+=e.repeat(` `,i.indent)+n((r.line+a+1).toString(),d)+` | `+c.str+`
|
|
35
|
+
`}return u.replace(/\n$/,``)}return oc=r,oc}var lc,uc;function dc(){if(uc)return lc;uc=1;let e=ac(),t=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],n=[`scalar`,`sequence`,`mapping`];function r(e){let t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}function i(i,a){if(a||={},Object.keys(a).forEach(function(n){if(t.indexOf(n)===-1)throw new e(`Unknown option "`+n+`" is met in definition of "`+i+`" YAML type.`)}),this.options=a,this.tag=i,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(e){return e},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=r(a.styleAliases||null),n.indexOf(this.kind)===-1)throw new e(`Unknown kind "`+this.kind+`" is specified for "`+i+`" YAML type.`)}return lc=i,lc}var fc,pc;function mc(){if(pc)return fc;pc=1;let e=ac(),t=dc();function n(e,t){let n=[];return e[t].forEach(function(e){let t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function r(){let e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function t(t){t.multi?(e.multi[t.kind].push(t),e.multi.fallback.push(t)):e[t.kind][t.tag]=e.fallback[t.tag]=t}for(let e=0,n=arguments.length;e<n;e+=1)arguments[e].forEach(t);return e}function i(e){return this.extend(e)}return i.prototype.extend=function(a){let o=[],s=[];if(a instanceof t)s.push(a);else if(Array.isArray(a))s=s.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(o=o.concat(a.implicit)),a.explicit&&(s=s.concat(a.explicit));else throw new e(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);o.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(n.loadKind&&n.loadKind!==`scalar`)throw new e(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(n.multi)throw new e(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),s.forEach(function(n){if(!(n instanceof t))throw new e(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});let c=Object.create(i.prototype);return c.implicit=(this.implicit||[]).concat(o),c.explicit=(this.explicit||[]).concat(s),c.compiledImplicit=n(c,`implicit`),c.compiledExplicit=n(c,`explicit`),c.compiledTypeMap=r(c.compiledImplicit,c.compiledExplicit),c},fc=i,fc}var hc,gc;function _c(){return gc?hc:(gc=1,hc=new(dc())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(e){return e===null?``:e}}),hc)}var vc,yc;function bc(){return yc?vc:(yc=1,vc=new(dc())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(e){return e===null?[]:e}}),vc)}var xc,Sc;function Cc(){return Sc?xc:(Sc=1,xc=new(dc())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(e){return e===null?{}:e}}),xc)}var wc,Tc;function Ec(){return Tc?wc:(Tc=1,wc=new(mc())({explicit:[_c(),bc(),Cc()]}),wc)}var Dc,Oc;function kc(){if(Oc)return Dc;Oc=1;let e=dc();function t(e){if(e===null)return!0;let t=e.length;return t===1&&e===`~`||t===4&&(e===`null`||e===`Null`||e===`NULL`)}function n(){return null}function r(e){return e===null}return Dc=new e(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:t,construct:n,predicate:r,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`}),Dc}var Ac,jc;function Mc(){if(jc)return Ac;jc=1;let e=dc();function t(e){if(e===null)return!1;let t=e.length;return t===4&&(e===`true`||e===`True`||e===`TRUE`)||t===5&&(e===`false`||e===`False`||e===`FALSE`)}function n(e){return e===`true`||e===`True`||e===`TRUE`}function r(e){return Object.prototype.toString.call(e)===`[object Boolean]`}return Ac=new e(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:t,construct:n,predicate:r,represent:{lowercase:function(e){return e?`true`:`false`},uppercase:function(e){return e?`TRUE`:`FALSE`},camelcase:function(e){return e?`True`:`False`}},defaultStyle:`lowercase`}),Ac}var Nc,Pc;function Fc(){if(Pc)return Nc;Pc=1;let e=nc(),t=dc();function n(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function r(e){return e>=48&&e<=55}function i(e){return e>=48&&e<=57}function a(e){if(e===null)return!1;let t=e.length,a=0,s=!1;if(!t)return!1;let c=e[a];if((c===`-`||c===`+`)&&(c=e[++a]),c===`0`){if(a+1===t)return!0;if(c=e[++a],c===`b`){for(a++;a<t;a++){if(c=e[a],c!==`0`&&c!==`1`)return!1;s=!0}return s&&isFinite(o(e))}if(c===`x`){for(a++;a<t;a++){if(!n(e.charCodeAt(a)))return!1;s=!0}return s&&isFinite(o(e))}if(c===`o`){for(a++;a<t;a++){if(!r(e.charCodeAt(a)))return!1;s=!0}return s&&isFinite(o(e))}}for(;a<t;a++){if(!i(e.charCodeAt(a)))return!1;s=!0}return s?isFinite(o(e)):!1}function o(e){let t=e,n=1,r=t[0];if((r===`-`||r===`+`)&&(r===`-`&&(n=-1),t=t.slice(1),r=t[0]),t===`0`)return 0;if(r===`0`){if(t[1]===`b`)return n*parseInt(t.slice(2),2);if(t[1]===`x`)return n*parseInt(t.slice(2),16);if(t[1]===`o`)return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function s(e){return o(e)}function c(t){return Object.prototype.toString.call(t)===`[object Number]`&&t%1==0&&!e.isNegativeZero(t)}return Nc=new t(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:a,construct:s,predicate:c,represent:{binary:function(e){return e>=0?`0b`+e.toString(2):`-0b`+e.toString(2).slice(1)},octal:function(e){return e>=0?`0o`+e.toString(8):`-0o`+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?`0x`+e.toString(16).toUpperCase():`-0x`+e.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}}),Nc}var Ic,Lc;function Rc(){if(Lc)return Ic;Lc=1;let e=nc(),t=dc(),n=RegExp(`^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`),r=RegExp(`^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function i(e){return e===null||!n.test(e)?!1:isFinite(parseFloat(e,10))?!0:r.test(e)}function a(e){let t=e.toLowerCase(),n=t[0]===`-`?-1:1;return`+-`.indexOf(t[0])>=0&&(t=t.slice(1)),t===`.inf`?n===1?1/0:-1/0:t===`.nan`?NaN:n*parseFloat(t,10)}let o=/^[-+]?[0-9]+e/;function s(t,n){if(isNaN(t))switch(n){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(t===1/0)switch(n){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(t===-1/0)switch(n){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(e.isNegativeZero(t))return`-0.0`;let r=t.toString(10);return o.test(r)?r.replace(`e`,`.e`):r}function c(t){return Object.prototype.toString.call(t)===`[object Number]`&&(t%1!=0||e.isNegativeZero(t))}return Ic=new t(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:i,construct:a,predicate:c,represent:s,defaultStyle:`lowercase`}),Ic}var zc,Bc;function Vc(){return Bc?zc:(Bc=1,zc=Ec().extend({implicit:[kc(),Mc(),Fc(),Rc()]}),zc)}var Hc,Uc;function Wc(){return Uc?Hc:(Uc=1,Hc=Vc(),Hc)}var Gc,Kc;function qc(){if(Kc)return Gc;Kc=1;let e=dc(),t=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),n=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function r(e){return e===null?!1:t.exec(e)!==null||n.exec(e)!==null}function i(e){let r=0,i=null,a=t.exec(e);if(a===null&&(a=n.exec(e)),a===null)throw Error(`Date resolve error`);let o=+a[1],s=a[2]-1,c=+a[3];if(!a[4])return new Date(Date.UTC(o,s,c));let l=+a[4],u=+a[5],d=+a[6];if(a[7]){for(r=a[7].slice(0,3);r.length<3;)r+=`0`;r=+r}if(a[9]){let e=+a[10],t=+(a[11]||0);i=(e*60+t)*6e4,a[9]===`-`&&(i=-i)}let f=new Date(Date.UTC(o,s,c,l,u,d,r));return i&&f.setTime(f.getTime()-i),f}function a(e){return e.toISOString()}return Gc=new e(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:r,construct:i,instanceOf:Date,represent:a}),Gc}var Jc,Yc;function Xc(){if(Yc)return Jc;Yc=1;let e=dc();function t(e){return e===`<<`||e===null}return Jc=new e(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:t}),Jc}var Zc,Qc;function $c(){if(Qc)return Zc;Qc=1;let e=dc();function t(e){if(e===null)return!1;let t=0,n=e.length;for(let r=0;r<n;r++){let n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
36
|
+
\r`.indexOf(e.charAt(r));if(!(n>64)){if(n<0)return!1;t+=6}}return t%8==0}function n(e){let t=e.replace(/[\r\n=]/g,``),n=t.length,r=0,i=[];for(let e=0;e<n;e++)e%4==0&&e&&(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)),r=r<<6|`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
37
|
+
\r`.indexOf(t.charAt(e));let a=n%4*6;return a===0?(i.push(r>>16&255),i.push(r>>8&255),i.push(r&255)):a===18?(i.push(r>>10&255),i.push(r>>2&255)):a===12&&i.push(r>>4&255),new Uint8Array(i)}function r(e){let t=``,n=0,r=e.length,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
38
|
+
\r`;for(let a=0;a<r;a++)a%3==0&&a&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[a];let a=r%3;return a===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):a===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):a===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function i(e){return Object.prototype.toString.call(e)===`[object Uint8Array]`}return Zc=new e(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:t,construct:n,predicate:i,represent:r}),Zc}var el,tl;function nl(){if(tl)return el;tl=1;let e=dc(),t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;function r(e){if(e===null)return!0;let r={},i=e;for(let e=0,a=i.length;e<a;e+=1){let a=i[e],o=!1;if(n.call(a)!==`[object Object]`)return!1;let s;for(s in a)if(t.call(a,s)){if(!o)o=!0;else return!1}if(!o||t.call(r,s))return!1;Object.defineProperty(r,s,{value:!0})}return!0}function i(e){return e===null?[]:e}return el=new e(`tag:yaml.org,2002:omap`,{kind:`sequence`,resolve:r,construct:i}),el}var rl,il;function al(){if(il)return rl;il=1;let e=dc(),t=Object.prototype.toString;function n(e){if(e===null)return!0;let n=e,r=Array(n.length);for(let e=0,i=n.length;e<i;e+=1){let i=n[e];if(t.call(i)!==`[object Object]`)return!1;let a=Object.keys(i);if(a.length!==1)return!1;r[e]=[a[0],i[a[0]]]}return!0}function r(e){if(e===null)return[];let t=e,n=Array(t.length);for(let e=0,r=t.length;e<r;e+=1){let r=t[e],i=Object.keys(r);n[e]=[i[0],r[i[0]]]}return n}return rl=new e(`tag:yaml.org,2002:pairs`,{kind:`sequence`,resolve:n,construct:r}),rl}var ol,sl;function cl(){if(sl)return ol;sl=1;let e=dc(),t=Object.prototype.hasOwnProperty;function n(e){if(e===null)return!0;let n=e;for(let e in n)if(t.call(n,e)&&n[e]!==null)return!1;return!0}function r(e){return e===null?{}:e}return ol=new e(`tag:yaml.org,2002:set`,{kind:`mapping`,resolve:n,construct:r}),ol}var ll,ul;function dl(){return ul?ll:(ul=1,ll=Wc().extend({implicit:[qc(),Xc()],explicit:[$c(),nl(),al(),cl()]}),ll)}var fl;function pl(){if(fl)return $s;fl=1;let e=nc(),t=ac(),n=cc(),r=dl(),i=Object.prototype.hasOwnProperty,a=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=/[\x85\u2028\u2029]/,s=/[,\[\]{}]/,c=/^(?:!|!!|![0-9A-Za-z-]+!)$/,l=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function u(e){return Object.prototype.toString.call(e)}function d(e){return e===10||e===13}function f(e){return e===9||e===32}function p(e){return e===9||e===32||e===10||e===13}function m(e){return e===44||e===91||e===93||e===123||e===125}function h(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function g(e){return e===120?2:e===117?4:e===85?8:0}function _(e){return e>=48&&e<=57?e-48:-1}function v(e){switch(e){case 48:return`\0`;case 97:return`\x07`;case 98:return`\b`;case 116:return` `;case 9:return` `;case 110:return`
|
|
39
|
+
`;case 118:return`\v`;case 102:return`\f`;case 114:return`\r`;case 101:return`\x1B`;case 32:return` `;case 34:return`"`;case 47:return`/`;case 92:return`\\`;case 78:return`
`;case 95:return`\xA0`;case 76:return`\u2028`;case 80:return`\u2029`;default:return``}}function y(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function b(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}let x=Array(256),S=Array(256);for(let e=0;e<256;e++)x[e]=+!!v(e),S[e]=v(e);function C(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||r,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.maxDepth=typeof t.maxDepth==`number`?t.maxDepth:100,this.maxTotalMergeKeys=typeof t.maxTotalMergeKeys==`number`?t.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function w(e,r){let i={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return i.snippet=n(i),new t(r,i)}function T(e,t){throw w(e,t)}function E(e,t){e.onWarning&&e.onWarning.call(null,w(e,t))}function ee(e,t,n){let r=e.anchorMapTransactions;if(r.length!==0){let n=r[r.length-1];i.call(n,t)||(n[t]={existed:i.call(e.anchorMap,t),value:e.anchorMap[t]})}e.anchorMap[t]=n}function te(e){e.anchorMapTransactions.push(Object.create(null))}function ne(e){let t=e.anchorMapTransactions.pop(),n=e.anchorMapTransactions;if(n.length===0)return;let r=n[n.length-1],a=Object.keys(t);for(let e=0,n=a.length;e<n;e+=1){let n=a[e];i.call(r,n)||(r[n]=t[n])}}function re(e){let t=e.anchorMapTransactions.pop(),n=Object.keys(t);for(let r=n.length-1;r>=0;--r){let i=t[n[r]];i.existed?e.anchorMap[n[r]]=i.value:delete e.anchorMap[n[r]]}}function ie(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function ae(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.tag=t.tag,e.anchor=t.anchor,e.kind=t.kind,e.result=t.result}let oe={YAML:function(e,t,n){e.version!==null&&T(e,`duplication of %YAML directive`),n.length!==1&&T(e,`YAML directive accepts exactly one argument`);let r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);r===null&&T(e,`ill-formed argument of the YAML directive`);let i=parseInt(r[1],10),a=parseInt(r[2],10);i!==1&&T(e,`unacceptable YAML version of the document`),e.version=n[0],e.checkLineBreaks=a<2,a!==1&&a!==2&&E(e,`unsupported YAML version of the document`)},TAG:function(e,t,n){let r;n.length!==2&&T(e,`TAG directive accepts exactly two arguments`);let a=n[0];r=n[1],c.test(a)||T(e,`ill-formed tag handle (first argument) of the TAG directive`),i.call(e.tagMap,a)&&T(e,`there is a previously declared suffix for "`+a+`" tag handle`),l.test(r)||T(e,`ill-formed tag prefix (second argument) of the TAG directive`);try{r=decodeURIComponent(r)}catch{T(e,`tag prefix is malformed: `+r)}e.tagMap[a]=r}};function D(e,t,n,r){if(t<n){let i=e.input.slice(t,n);if(r)for(let t=0,n=i.length;t<n;t+=1){let n=i.charCodeAt(t);n===9||n>=32&&n<=1114111||T(e,`expected valid JSON character`)}else a.test(i)&&T(e,`the stream contains non-printable characters`);e.result+=i}}function se(t,n,r,a){e.isObject(r)||T(t,`cannot merge mappings; the provided source object is unacceptable`);let o=Object.keys(r);for(let e=0,s=o.length;e<s;e+=1){let s=o[e];t.maxTotalMergeKeys!==-1&&++t.totalMergeKeys>t.maxTotalMergeKeys&&T(t,`merge keys exceeded maxTotalMergeKeys (`+t.maxTotalMergeKeys+`)`),i.call(n,s)||(b(n,s,r[s]),a[s]=!0)}}function ce(e,t,n,r,a,o,s,c,l){if(Array.isArray(a)){a=Array.prototype.slice.call(a);for(let t=0,n=a.length;t<n;t+=1)Array.isArray(a[t])&&T(e,`nested arrays are not supported inside keys`),typeof a==`object`&&u(a[t])===`[object Object]`&&(a[t]=`[object Object]`)}if(typeof a==`object`&&u(a)===`[object Object]`&&(a=`[object Object]`),a=String(a),t===null&&(t={}),r===`tag:yaml.org,2002:merge`){if(Array.isArray(o))for(let r=0,i=o.length;r<i;r+=1)se(e,t,o[r],n);else se(e,t,o,n)}else!e.json&&!i.call(n,a)&&i.call(t,a)&&(e.line=s||e.line,e.lineStart=c||e.lineStart,e.position=l||e.position,T(e,`duplicated mapping key`)),b(t,a,o),delete n[a];return t}function le(e){let t=e.input.charCodeAt(e.position);t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):T(e,`a line break is expected`),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function O(e,t,n){let r=0,i=e.input.charCodeAt(e.position);for(;i!==0;){for(;f(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(d(i))for(le(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&E(e,`deficient indentation`),r}function ue(e){let t=e.position,n=e.input.charCodeAt(t);return!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||p(n)))}function de(t,n){n===1?t.result+=` `:n>1&&(t.result+=e.repeat(`
|
|
40
|
+
`,n-1))}function fe(e,t,n){let r,i,a,o,s,c,l=e.kind,u=e.result,h=e.input.charCodeAt(e.position);if(p(h)||m(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96)return!1;if(h===63||h===45){let t=e.input.charCodeAt(e.position+1);if(p(t)||n&&m(t))return!1}for(e.kind=`scalar`,e.result=``,r=i=e.position,a=!1;h!==0;){if(h===58){let t=e.input.charCodeAt(e.position+1);if(p(t)||n&&m(t))break}else if(h===35){if(p(e.input.charCodeAt(e.position-1)))break}else if(e.position===e.lineStart&&ue(e)||n&&m(h))break;else if(d(h)){if(o=e.line,s=e.lineStart,c=e.lineIndent,O(e,!1,-1),e.lineIndent>=t){a=!0,h=e.input.charCodeAt(e.position);continue}e.position=i,e.line=o,e.lineStart=s,e.lineIndent=c;break}a&&=(D(e,r,i,!1),de(e,e.line-o),r=i=e.position,!1),f(h)||(i=e.position+1),h=e.input.charCodeAt(++e.position)}return D(e,r,i,!1),e.result?!0:(e.kind=l,e.result=u,!1)}function pe(e,t){let n,r,i=e.input.charCodeAt(e.position);if(i!==39)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(i=e.input.charCodeAt(e.position))!==0;)if(i===39){if(D(e,n,e.position,!0),i=e.input.charCodeAt(++e.position),i===39)n=e.position,e.position++,r=e.position;else return!0}else d(i)?(D(e,n,r,!0),de(e,O(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ue(e)?T(e,`unexpected end of the document within a single quoted scalar`):(e.position++,f(i)||(r=e.position));T(e,`unexpected end of the stream within a single quoted scalar`)}function me(e,t){let n,r,i,a=e.input.charCodeAt(e.position);if(a!==34)return!1;for(e.kind=`scalar`,e.result=``,e.position++,n=r=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===34)return D(e,n,e.position,!0),e.position++,!0;else if(a===92){if(D(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),d(a))O(e,!1,t);else if(a<256&&x[a])e.result+=S[a],e.position++;else if((i=g(a))>0){let t=i,n=0;for(;t>0;t--)a=e.input.charCodeAt(++e.position),(i=h(a))>=0?n=(n<<4)+i:T(e,`expected hexadecimal character`);e.result+=y(n),e.position++}else T(e,`unknown escape sequence`);n=r=e.position}else d(a)?(D(e,n,r,!0),de(e,O(e,!1,t)),n=r=e.position):e.position===e.lineStart&&ue(e)?T(e,`unexpected end of the document within a double quoted scalar`):(e.position++,f(a)||(r=e.position));T(e,`unexpected end of the stream within a double quoted scalar`)}function he(e,t){let n=!0,r,i,a,o=e.tag,s,c=e.anchor,l,u,d,f,m=Object.create(null),h,g,_,v=e.input.charCodeAt(e.position);if(v===91)l=93,f=!1,s=[];else if(v===123)l=125,f=!0,s={};else return!1;for(e.anchor!==null&&ee(e,e.anchor,s),v=e.input.charCodeAt(++e.position);v!==0;){if(O(e,!0,t),v=e.input.charCodeAt(e.position),v===l)return e.position++,e.tag=o,e.anchor=c,e.kind=f?`mapping`:`sequence`,e.result=s,!0;n?v===44&&T(e,`expected the node content, but found ','`):T(e,`missed comma between flow collection entries`),g=h=_=null,u=d=!1,v===63&&p(e.input.charCodeAt(e.position+1))&&(u=d=!0,e.position++,O(e,!0,t)),r=e.line,i=e.lineStart,a=e.position,Ce(e,t,1,!1,!0),g=e.tag,h=e.result,O(e,!0,t),v=e.input.charCodeAt(e.position),(d||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),O(e,!0,t),Ce(e,t,1,!1,!0),_=e.result),f?ce(e,s,m,g,h,_,r,i,a):u?s.push(ce(e,null,m,g,h,_,r,i,a)):s.push(h),O(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}T(e,`unexpected end of the stream within a flow collection`)}function ge(t,n){let r,i=1,a=!1,o=!1,s=n,c=0,l=!1,u,p=t.input.charCodeAt(t.position);if(p===124)r=!1;else if(p===62)r=!0;else return!1;for(t.kind=`scalar`,t.result=``;p!==0;)if(p=t.input.charCodeAt(++t.position),p===43||p===45)i===1?i=p===43?3:2:T(t,`repeat of a chomping mode identifier`);else if((u=_(p))>=0)u===0?T(t,`bad explicit indentation width of a block scalar; it cannot be less than one`):o?T(t,`repeat of an indentation width identifier`):(s=n+u-1,o=!0);else break;if(f(p)){do p=t.input.charCodeAt(++t.position);while(f(p));if(p===35)do p=t.input.charCodeAt(++t.position);while(!d(p)&&p!==0)}for(;p!==0;){for(le(t),t.lineIndent=0,p=t.input.charCodeAt(t.position);(!o||t.lineIndent<s)&&p===32;)t.lineIndent++,p=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>s&&(s=t.lineIndent),d(p)){c++;continue}if(!o&&s===0&&T(t,`missing indentation for block scalar`),t.lineIndent<s){i===3?t.result+=e.repeat(`
|
|
41
|
+
`,a?1+c:c):i===1&&a&&(t.result+=`
|
|
42
|
+
`);break}r?f(p)?(l=!0,t.result+=e.repeat(`
|
|
43
|
+
`,a?1+c:c)):l?(l=!1,t.result+=e.repeat(`
|
|
44
|
+
`,c+1)):c===0?a&&(t.result+=` `):t.result+=e.repeat(`
|
|
45
|
+
`,c):t.result+=e.repeat(`
|
|
46
|
+
`,a?1+c:c),a=!0,o=!0,c=0;let n=t.position;for(;!d(p)&&p!==0;)p=t.input.charCodeAt(++t.position);D(t,n,t.position,!1)}return!0}function _e(e,t){let n=e.tag,r=e.anchor,i=[],a=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&ee(e,e.anchor,i);let o=e.input.charCodeAt(e.position);for(;o!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,T(e,`tab characters must not be used in indentation`)),o===45&&p(e.input.charCodeAt(e.position+1)));){if(a=!0,e.position++,O(e,!0,-1)&&e.lineIndent<=t){i.push(null),o=e.input.charCodeAt(e.position);continue}let n=e.line;if(Ce(e,t,3,!1,!0),i.push(e.result),O(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&o!==0)T(e,`bad indentation of a sequence entry`);else if(e.lineIndent<t)break}return a?(e.tag=n,e.anchor=r,e.kind=`sequence`,e.result=i,!0):!1}function ve(e,t,n){let r,i,a,o,s=e.tag,c=e.anchor,l={},u=Object.create(null),d=null,m=null,h=null,g=!1,_=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&ee(e,e.anchor,l);let v=e.input.charCodeAt(e.position);for(;v!==0;){!g&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,T(e,`tab characters must not be used in indentation`));let y=e.input.charCodeAt(e.position+1),b=e.line;if((v===63||v===58)&&p(y))v===63?(g&&(ce(e,l,u,d,m,null,i,a,o),d=m=h=null),_=!0,g=!0,r=!0):g?(g=!1,r=!0):T(e,`incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line`),e.position+=1,v=y;else{if(i=e.line,a=e.lineStart,o=e.position,!Ce(e,n,2,!1,!0))break;if(e.line===b){for(v=e.input.charCodeAt(e.position);f(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),p(v)||T(e,`a whitespace character is expected after the key-value separator within a block mapping`),g&&(ce(e,l,u,d,m,null,i,a,o),d=m=h=null),_=!0,g=!1,r=!1,d=e.tag,m=e.result;else if(_)T(e,`can not read an implicit mapping pair; a colon is missed`);else return e.tag=s,e.anchor=c,!0}else if(_)T(e,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return e.tag=s,e.anchor=c,!0}if((e.line===b||e.lineIndent>t)&&(g&&(i=e.line,a=e.lineStart,o=e.position),Ce(e,t,4,!0,r)&&(g?m=e.result:h=e.result),g||(ce(e,l,u,d,m,h,i,a,o),d=m=h=null),O(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===b||e.lineIndent>t)&&v!==0)T(e,`bad indentation of a mapping entry`);else if(e.lineIndent<t)break}return g&&ce(e,l,u,d,m,null,i,a,o),_&&(e.tag=s,e.anchor=c,e.kind=`mapping`,e.result=l),_}function ye(e){let t=!1,n=!1,r,a,o=e.input.charCodeAt(e.position);if(o!==33)return!1;e.tag!==null&&T(e,`duplication of a tag property`),o=e.input.charCodeAt(++e.position),o===60?(t=!0,o=e.input.charCodeAt(++e.position)):o===33?(n=!0,r=`!!`,o=e.input.charCodeAt(++e.position)):r=`!`;let u=e.position;if(t){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(u,e.position),o=e.input.charCodeAt(++e.position)):T(e,`unexpected end of the stream within a verbatim tag`)}else{for(;o!==0&&!p(o);)o===33&&(n?T(e,`tag suffix cannot contain exclamation marks`):(r=e.input.slice(u-1,e.position+1),c.test(r)||T(e,`named tag handle cannot contain such characters`),n=!0,u=e.position+1)),o=e.input.charCodeAt(++e.position);a=e.input.slice(u,e.position),s.test(a)&&T(e,`tag suffix cannot contain flow indicator characters`)}a&&!l.test(a)&&T(e,`tag name cannot contain such characters: `+a);try{a=decodeURIComponent(a)}catch{T(e,`tag name is malformed: `+a)}return t?e.tag=a:i.call(e.tagMap,r)?e.tag=e.tagMap[r]+a:r===`!`?e.tag=`!`+a:r===`!!`?e.tag=`tag:yaml.org,2002:`+a:T(e,`undeclared tag handle "`+r+`"`),!0}function be(e){let t=e.input.charCodeAt(e.position);if(t!==38)return!1;e.anchor!==null&&T(e,`duplication of an anchor property`),t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!p(t)&&!m(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&T(e,`name of an anchor node must contain at least one character`),e.anchor=e.input.slice(n,e.position),!0}function xe(e){let t=e.input.charCodeAt(e.position);if(t!==42)return!1;t=e.input.charCodeAt(++e.position);let n=e.position;for(;t!==0&&!p(t)&&!m(t);)t=e.input.charCodeAt(++e.position);e.position===n&&T(e,`name of an alias node must contain at least one character`);let r=e.input.slice(n,e.position);return i.call(e.anchorMap,r)||T(e,`unidentified alias "`+r+`"`),e.result=e.anchorMap[r],O(e,!0,-1),!0}function Se(e,t,n,r){let i=ie(e);return te(e),ae(e,t),e.tag=null,e.anchor=null,e.kind=null,e.result=null,ve(e,n,r)&&e.kind===`mapping`?(ne(e),!0):(re(e),ae(e,i),!1)}function Ce(e,t,n,r,a){let o,s,c=1,l=!1,u=!1,d=null,f,p,m;e.depth>=e.maxDepth&&T(e,`nesting exceeded maxDepth (`+e.maxDepth+`)`),e.depth+=1,e.listener!==null&&e.listener(`open`,e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let h=o=s=n===4||n===3;if(r&&O(e,!0,-1)&&(l=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;;){let n=e.input.charCodeAt(e.position),r=ie(e);if(l&&(n===33&&e.tag!==null||n===38&&e.anchor!==null)||!ye(e)&&!be(e))break;d===null&&(d=r),O(e,!0,-1)?(l=!0,s=h,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):s=!1}if(s&&=l||a,c===1||n===4){if(p=n===1||n===2?t:t+1,m=e.position-e.lineStart,c===1){if(s&&(_e(e,m)||ve(e,m,p))||he(e,p))u=!0;else{let t=e.input.charCodeAt(e.position);d!==null&&h&&!s&&t!==124&&t!==62&&Se(e,d,d.position-d.lineStart,p)||o&&ge(e,p)||pe(e,p)||me(e,p)?u=!0:xe(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&T(e,`alias node should not have any properties`)):fe(e,p,n===1)&&(u=!0,e.tag===null&&(e.tag=`?`)),e.anchor!==null&&ee(e,e.anchor,e.result)}}else c===0&&(u=s&&_e(e,m))}if(e.tag===null)e.anchor!==null&&ee(e,e.anchor,e.result);else if(e.tag===`?`){e.result!==null&&e.kind!==`scalar`&&T(e,`unacceptable node kind for !<?> tag; it should be "scalar", not "`+e.kind+`"`);for(let t=0,n=e.implicitTypes.length;t<n;t+=1)if(f=e.implicitTypes[t],f.resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,e.anchor!==null&&ee(e,e.anchor,e.result);break}}else if(e.tag!==`!`){if(i.call(e.typeMap[e.kind||`fallback`],e.tag))f=e.typeMap[e.kind||`fallback`][e.tag];else{f=null;let t=e.typeMap.multi[e.kind||`fallback`];for(let n=0,r=t.length;n<r;n+=1)if(e.tag.slice(0,t[n].tag.length)===t[n].tag){f=t[n];break}}f||T(e,`unknown tag !<`+e.tag+`>`),e.result!==null&&f.kind!==e.kind&&T(e,`unacceptable node kind for !<`+e.tag+`> tag; it should be "`+f.kind+`", not "`+e.kind+`"`),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),e.anchor!==null&&ee(e,e.anchor,e.result)):T(e,`cannot resolve a node with !<`+e.tag+`> explicit tag`)}return e.listener!==null&&e.listener(`close`,e),--e.depth,e.tag!==null||e.anchor!==null||u}function we(e){let t=e.position,n=!1,r;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(r=e.input.charCodeAt(e.position))!==0&&(O(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||r!==37));){n=!0,r=e.input.charCodeAt(++e.position);let t=e.position;for(;r!==0&&!p(r);)r=e.input.charCodeAt(++e.position);let a=e.input.slice(t,e.position),o=[];for(a.length<1&&T(e,`directive name must not be less than one character in length`);r!==0;){for(;f(r);)r=e.input.charCodeAt(++e.position);if(r===35){do r=e.input.charCodeAt(++e.position);while(r!==0&&!d(r));break}if(d(r))break;for(t=e.position;r!==0&&!p(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}r!==0&&le(e),i.call(oe,a)?oe[a](e,a,o):E(e,`unknown document directive "`+a+`"`)}if(O(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,O(e,!0,-1)):n&&T(e,`directives end mark is expected`),Ce(e,e.lineIndent-1,4,!1,!0),O(e,!0,-1),e.checkLineBreaks&&o.test(e.input.slice(t,e.position))&&E(e,`non-ASCII line breaks are interpreted as content`),e.documents.push(e.result),e.position===e.lineStart&&ue(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,O(e,!0,-1));return}e.position<e.length-1&&T(e,`end of the stream or a document separator is expected`)}function Te(e,t){e=String(e),t||={},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
47
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));let n=new C(e,t),r=e.indexOf(`\0`);for(r!==-1&&(n.position=r,T(n,`null byte is not allowed in input`)),n.input+=`\0`;n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)we(n);return n.documents}function Ee(e,t,n){typeof t==`object`&&t&&n===void 0&&(n=t,t=null);let r=Te(e,n);if(typeof t!=`function`)return r;for(let e=0,n=r.length;e<n;e+=1)t(r[e])}function De(e,n){let r=Te(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new t(`expected a single document in the stream, but found more`)}}return $s.loadAll=Ee,$s.load=De,$s}var ml={},hl;function gl(){if(hl)return ml;hl=1;let e=nc(),t=ac(),n=dl(),r=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=65279,o={};o[0]=`\\0`,o[7]=`\\a`,o[8]=`\\b`,o[9]=`\\t`,o[10]=`\\n`,o[11]=`\\v`,o[12]=`\\f`,o[13]=`\\r`,o[27]=`\\e`,o[34]=`\\"`,o[92]=`\\\\`,o[133]=`\\N`,o[160]=`\\_`,o[8232]=`\\L`,o[8233]=`\\P`;let s=[`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],c=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function l(e,t){if(t===null)return{};let n={},r=Object.keys(t);for(let a=0,o=r.length;a<o;a+=1){let o=r[a],s=String(t[o]);o.slice(0,2)===`!!`&&(o=`tag:yaml.org,2002:`+o.slice(2));let c=e.compiledTypeMap.fallback[o];c&&i.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[o]=s}return n}function u(n){let r,i,a=n.toString(16).toUpperCase();if(n<=255)r=`x`,i=2;else if(n<=65535)r=`u`,i=4;else if(n<=4294967295)r=`U`,i=8;else throw new t(`code point within a string may not be greater than 0xFFFFFFFF`);return`\\`+r+e.repeat(`0`,i-a.length)+a}function d(t){this.schema=t.schema||n,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=e.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=l(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType=t.quotingType===`"`?2:1,this.forceQuotes=t.forceQuotes||!1,this.replacer=typeof t.replacer==`function`?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result=``,this.duplicates=[],this.usedDuplicates=null}function f(t,n){let r=e.repeat(` `,n),i=0,a=``,o=t.length;for(;i<o;){let e,n=t.indexOf(`
|
|
48
|
+
`,i);n===-1?(e=t.slice(i),i=o):(e=t.slice(i,n+1),i=n+1),e.length&&e!==`
|
|
49
|
+
`&&(a+=r),a+=e}return a}function p(t,n){return`
|
|
50
|
+
`+e.repeat(` `,t.indent*n)}function m(e,t){for(let n=0,r=e.implicitTypes.length;n<r;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}function h(e){return e===32||e===9}function g(e){return e>=32&&e<=126||e>=161&&e<=55295&&e!==8232&&e!==8233||e>=57344&&e<=65533&&e!==a||e>=65536&&e<=1114111}function _(e){return g(e)&&e!==a&&e!==13&&e!==10}function v(e,t,n){let r=_(e),i=r&&!h(e);return(n?r:r&&e!==44&&e!==91&&e!==93&&e!==123&&e!==125)&&e!==35&&!(t===58&&!i)||_(t)&&!h(t)&&e===35||t===58&&i}function y(e){return g(e)&&e!==a&&!h(e)&&e!==45&&e!==63&&e!==58&&e!==44&&e!==91&&e!==93&&e!==123&&e!==125&&e!==35&&e!==38&&e!==42&&e!==33&&e!==124&&e!==61&&e!==62&&e!==39&&e!==34&&e!==37&&e!==64&&e!==96}function b(e){return!h(e)&&e!==58}function x(e,t){let n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function S(e){return/^\n* /.test(e)}function C(e,t,n,r,i,a,o,s){let c,l=0,u=null,d=!1,f=!1,p=r!==-1,m=-1,h=y(x(e,0))&&b(x(e,e.length-1));if(t||o)for(c=0;c<e.length;l>=65536?c+=2:c++){if(l=x(e,c),!g(l))return 5;h&&=v(l,u,s),u=l}else{for(c=0;c<e.length;l>=65536?c+=2:c++){if(l=x(e,c),l===10)d=!0,p&&(f||=c-m-1>r&&e[m+1]!==` `,m=c);else if(!g(l))return 5;h&&=v(l,u,s),u=l}f||=p&&c-m-1>r&&e[m+1]!==` `}return!d&&!f?h&&!o&&!i(e)?1:a===2?5:2:n>9&&S(e)?5:o?a===2?5:2:f?4:3}function w(e,n,r,i,a){e.dump=(function(){if(n.length===0)return e.quotingType===2?`""`:`''`;if(!e.noCompatMode&&(s.indexOf(n)!==-1||c.test(n)))return e.quotingType===2?`"`+n+`"`:`'`+n+`'`;let o=e.indent*Math.max(1,r),l=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),u=i||e.flowLevel>-1&&r>=e.flowLevel;function d(t){return m(e,t)}switch(C(n,u,e.indent,l,d,e.quotingType,e.forceQuotes&&!i,a)){case 1:return n;case 2:return`'`+n.replace(/'/g,`''`)+`'`;case 3:return`|`+T(n,e.indent)+E(f(n,o));case 4:return`>`+T(n,e.indent)+E(f(ee(n,l),o));case 5:return`"`+ne(n)+`"`;default:throw new t(`impossible error: invalid scalar style`)}})()}function T(e,t){let n=S(e)?String(t):``,r=e[e.length-1]===`
|
|
51
|
+
`;return n+(r&&(e[e.length-2]===`
|
|
52
|
+
`||e===`
|
|
53
|
+
`)?`+`:r?``:`-`)+`
|
|
54
|
+
`}function E(e){return e[e.length-1]===`
|
|
55
|
+
`?e.slice(0,-1):e}function ee(e,t){let n=/(\n+)([^\n]*)/g,r=(function(){let r=e.indexOf(`
|
|
56
|
+
`);return r=r===-1?e.length:r,n.lastIndex=r,te(e.slice(0,r),t)})(),i=e[0]===`
|
|
57
|
+
`||e[0]===` `,a,o;for(;o=n.exec(e);){let e=o[1],n=o[2];a=n[0]===` `,r+=e+(!i&&!a&&n!==``?`
|
|
58
|
+
`:``)+te(n,t),i=a}return r}function te(e,t){if(e===``||e[0]===` `)return e;let n=/ [^ ]/g,r,i=0,a,o=0,s=0,c=``;for(;r=n.exec(e);)s=r.index,s-i>t&&(a=o>i?o:s,c+=`
|
|
59
|
+
`+e.slice(i,a),i=a+1),o=s;return c+=`
|
|
60
|
+
`,e.length-i>t&&o>i?c+=e.slice(i,o)+`
|
|
61
|
+
`+e.slice(o+1):c+=e.slice(i),c.slice(1)}function ne(e){let t=``,n=0;for(let r=0;r<e.length;n>=65536?r+=2:r++){n=x(e,r);let i=o[n];!i&&g(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||u(n)}return t}function re(e,t,n){let r=``,i=e.tag;for(let i=0,a=n.length;i<a;i+=1){let a=n[i];e.replacer&&(a=e.replacer.call(n,String(i),a)),(se(e,t,a,!1,!1)||a===void 0&&se(e,t,null,!1,!1))&&(r!==``&&(r+=`,`+(e.condenseFlow?``:` `)),r+=e.dump)}e.tag=i,e.dump=`[`+r+`]`}function ie(e,t,n,r){let i=``,a=e.tag;for(let a=0,o=n.length;a<o;a+=1){let o=n[a];e.replacer&&(o=e.replacer.call(n,String(a),o)),(se(e,t+1,o,!0,!0,!1,!0)||o===void 0&&se(e,t+1,null,!0,!0,!1,!0))&&((!r||i!==``)&&(i+=p(e,t)),e.dump&&e.dump.charCodeAt(0)===10?i+=`-`:i+=`- `,i+=e.dump)}e.tag=a,e.dump=i||`[]`}function ae(e,t,n){let r=``,i=e.tag,a=Object.keys(n);for(let i=0,o=a.length;i<o;i+=1){let o=``;r!==``&&(o+=`, `),e.condenseFlow&&(o+=`"`);let s=a[i],c=n[s];e.replacer&&(c=e.replacer.call(n,s,c)),se(e,t,s,!1,!1)&&(e.dump.length>1024&&(o+=`? `),o+=e.dump+(e.condenseFlow?`"`:``)+`:`+(e.condenseFlow?``:` `),se(e,t,c,!1,!1)&&(o+=e.dump,r+=o))}e.tag=i,e.dump=`{`+r+`}`}function oe(e,n,r,i){let a=``,o=e.tag,s=Object.keys(r);if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys==`function`)s.sort(e.sortKeys);else if(e.sortKeys)throw new t(`sortKeys must be a boolean or a function`);for(let t=0,o=s.length;t<o;t+=1){let o=``;(!i||a!==``)&&(o+=p(e,n));let c=s[t],l=r[c];if(e.replacer&&(l=e.replacer.call(r,c,l)),!se(e,n+1,c,!0,!0,!0))continue;let u=e.tag!==null&&e.tag!==`?`||e.dump&&e.dump.length>1024;u&&(e.dump&&e.dump.charCodeAt(0)===10?o+=`?`:o+=`? `),o+=e.dump,u&&(o+=p(e,n)),se(e,n+1,l,!0,u)&&(e.dump&&e.dump.charCodeAt(0)===10?o+=`:`:o+=`: `,o+=e.dump,a+=o)}e.tag=o,e.dump=a||`{}`}function D(e,n,a){let o=a?e.explicitTypes:e.implicitTypes;for(let s=0,c=o.length;s<c;s+=1){let c=o[s];if((c.instanceOf||c.predicate)&&(!c.instanceOf||typeof n==`object`&&n instanceof c.instanceOf)&&(!c.predicate||c.predicate(n))){if(e.tag=a?c.multi&&c.representName?c.representName(n):c.tag:`?`,c.represent){let a=e.styleMap[c.tag]||c.defaultStyle,o;if(r.call(c.represent)===`[object Function]`)o=c.represent(n,a);else if(i.call(c.represent,a))o=c.represent[a](n,a);else throw new t(`!<`+c.tag+`> tag resolver accepts not "`+a+`" style`);e.dump=o}return!0}}return!1}function se(e,n,i,a,o,s,c){e.tag=null,e.dump=i,D(e,i,!1)||D(e,i,!0);let l=r.call(e.dump),u=a;a&&=e.flowLevel<0||e.flowLevel>n;let d=l===`[object Object]`||l===`[object Array]`,f,p;if(d&&(f=e.duplicates.indexOf(i),p=f!==-1),(e.tag!==null&&e.tag!==`?`||p||e.indent!==2&&n>0)&&(o=!1),p&&e.usedDuplicates[f])e.dump=`*ref_`+f;else{if(d&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l===`[object Object]`)a&&Object.keys(e.dump).length!==0?(oe(e,n,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(ae(e,n,e.dump),p&&(e.dump=`&ref_`+f+` `+e.dump));else if(l===`[object Array]`)a&&e.dump.length!==0?(e.noArrayIndent&&!c&&n>0?ie(e,n-1,e.dump,o):ie(e,n,e.dump,o),p&&(e.dump=`&ref_`+f+e.dump)):(re(e,n,e.dump),p&&(e.dump=`&ref_`+f+` `+e.dump));else if(l===`[object String]`)e.tag!==`?`&&w(e,e.dump,n,s,u);else if(l===`[object Undefined]`)return!1;else{if(e.skipInvalid)return!1;throw new t(`unacceptable kind of an object to dump `+l)}if(e.tag!==null&&e.tag!==`?`){let t=encodeURI(e.tag[0]===`!`?e.tag.slice(1):e.tag).replace(/!/g,`%21`);t=e.tag[0]===`!`?`!`+t:t.slice(0,18)===`tag:yaml.org,2002:`?`!!`+t.slice(18):`!<`+t+`>`,e.dump=t+` `+e.dump}}return!0}function ce(e,t){let n=[],r=[];le(e,n,r);let i=r.length;for(let e=0;e<i;e+=1)t.duplicates.push(n[r[e]]);t.usedDuplicates=Array(i)}function le(e,t,n){if(typeof e==`object`&&e){let r=t.indexOf(e);if(r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(let r=0,i=e.length;r<i;r+=1)le(e[r],t,n);else{let r=Object.keys(e);for(let i=0,a=r.length;i<a;i+=1)le(e[r[i]],t,n)}}}function O(e,t){t||={};let n=new d(t);n.noRefs||ce(e,n);let r=e;return n.replacer&&(r=n.replacer.call({"":r},``,r)),se(n,0,r,!0,!0)?n.dump+`
|
|
62
|
+
`:``}return ml.dump=O,ml}var _l;function vl(){if(_l)return Qs;_l=1;let e=pl(),t=gl();function n(e,t){return function(){throw Error(`Function yaml.`+e+` is removed in js-yaml 4. Use yaml.`+t+` instead, which is now safe by default.`)}}return Qs.Type=dc(),Qs.Schema=mc(),Qs.FAILSAFE_SCHEMA=Ec(),Qs.JSON_SCHEMA=Vc(),Qs.CORE_SCHEMA=Wc(),Qs.DEFAULT_SCHEMA=dl(),Qs.load=e.load,Qs.loadAll=e.loadAll,Qs.dump=t.dump,Qs.YAMLException=ac(),Qs.types={binary:$c(),float:Rc(),map:Cc(),null:kc(),pairs:al(),set:cl(),timestamp:qc(),bool:Mc(),int:Fc(),merge:Xc(),omap:nl(),seq:bc(),str:_c()},Qs.safeLoad=n(`safeLoad`,`load`),Qs.safeLoadAll=n(`safeLoadAll`,`loadAll`),Qs.safeDump=n(`safeDump`,`dump`),Qs}const yl=Zs(vl()),{Type:bl,Schema:xl,FAILSAFE_SCHEMA:Sl,JSON_SCHEMA:Cl,CORE_SCHEMA:wl,DEFAULT_SCHEMA:Tl,load:El,loadAll:Dl,dump:Ol,YAMLException:kl,types:Al,safeLoad:jl,safeLoadAll:Ml,safeDump:Nl}=yl;function Pl(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Ll(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46){if(r++,r<e.length&&Ll(e.charCodeAt(r)))for(r++;r<e.length&&Ll(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r)}let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101)){if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Ll(e.charCodeAt(r))){for(r++;r<e.length&&Ll(e.charCodeAt(r));)r++;n=r}else d=3}return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
63
|
+
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31){if(Il(a)){t+=e.substring(i,r),d=2;break}d=6}r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(Fl(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(Fl(t));return o=15}if(Il(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
|
|
64
|
+
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Il(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,Il(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!Ll(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(Fl(e)||Il(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function Fl(e){return e===32||e===9}function Il(e){return e===10||e===13}function Ll(e){return e>=48&&e<=57}var Rl;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(Rl||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
|
|
65
|
+
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
|
|
66
|
+
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
|
|
67
|
+
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
|
|
68
|
+
`+` `.repeat(t));var zl;(function(e){e.DEFAULT={allowTrailingComma:!1}})(zl||={});function Bl(e,t=[],n=zl.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return Vl(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function Vl(e,t,n=zl.DEFAULT){let r=Pl(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16)}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),ne()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function ee(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function te(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,ne()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function ne(){switch(r.getToken()){case 3:return te();case 1:return ee();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):ne()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}var Hl;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Hl||={});var Ul;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(Ul||={});const Wl=Bl;var Gl;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(Gl||={});function Kl(e){switch(e){case 1:return`InvalidSymbol`;case 2:return`InvalidNumberFormat`;case 3:return`PropertyNameExpected`;case 4:return`ValueExpected`;case 5:return`ColonExpected`;case 6:return`CommaExpected`;case 7:return`CloseBraceExpected`;case 8:return`CloseBracketExpected`;case 9:return`EndOfFileExpected`;case 10:return`InvalidCommentToken`;case 11:return`UnexpectedEndOfComment`;case 12:return`UnexpectedEndOfString`;case 13:return`UnexpectedEndOfNumber`;case 14:return`InvalidUnicode`;case 15:return`InvalidEscapeCharacter`;case 16:return`InvalidCharacter`}return`<unknown ParseErrorCode>`}const ql={platform:process.platform};function Jl(){return ql.platform===`darwin`||ql.platform===`win32`}function Yl(e,t){for(let n of Zl(e)){let e=_(n,t);if(tu(e))return e}}function Xl(e,t){let n=Jl();for(let r of Zl(e)){let e=Ql(r,n);if(e)for(let i of t){let t=$l(e,i,n);if(t&&eu(r,t))return _(r,t.name)}}}function*Zl(e){let t=x(e),{root:n}=v(t);for(;;){if(yield t,t===n)return;t=h(t)}}function Ql(e,t){let n;try{n=s(e,{withFileTypes:!0})}catch{return}let r=new Map;for(let e of n)if(r.set(e.name,e),t){let t=e.name.toLowerCase();r.has(t)||r.set(t,e)}return r}function $l(e,t,n){let r=e.get(t);return r||!n?r:e.get(t.toLowerCase())}function eu(e,t){return t.isFile()?!0:t.isSymbolicLink()?tu(_(e,t.name)):!1}function tu(e){return d(e,{throwIfNoEntry:!1})?.isFile()??!1}process.platform;function nu(e){return Yl(e,`package.json`)}function ru(e){return JSON.parse(o(e,`utf-8`))}const iu={findPackageJson:nu,getPackageJson:ru};function au({cwd:e},t){let n=cu(t),r=Xl(e,n);if(r)return{source:{type:`file`,path:r,format:lu(r)},candidates:n};let i=iu.findPackageJson(e);return i&&iu.getPackageJson(i)[t]?{source:{type:`package.json`,path:i,property:t},candidates:n}:{source:{type:`none`},candidates:n}}async function ou({cwd:e,ui:t},n){let{source:r,candidates:i}=au({cwd:e},n);if(r.type===`file`){t.debug(`load config from: ${r.path}`);let e=await uu(r.path);return t.debug(`config: ${JSON.stringify(e,void 0,2)}`),{config:e,source:r,candidates:i}}if(r.type===`package.json`){t.debug(`load config from package.json: ${r.path}`);let e=iu.getPackageJson(r.path)[r.property];return t.debug(`config: ${JSON.stringify(e,void 0,2)}`),{config:e,source:r,candidates:i}}return t.warn(`no config found under '${e}':\n ${i.join(`
|
|
69
|
+
`)}`),{config:void 0,source:r,candidates:i}}function su(e){switch(e.type){case`file`:return e.path;case`package.json`:return`${e.path} (property "${e.property}")`;default:return`not found`}}function cu(e){let t=[e,`${e}.cjs`,`${e}.mjs`,`${e}.js`,`${e}.json`,`${e}.jsonc`,`${e}.yml`,`${e}.yaml`,`${e}rc.cjs`,`${e}rc.mjs`,`${e}rc.js`,`${e}rc.json`,`${e}rc.jsonc`,`${e}rc.yml`,`${e}rc.yaml`,`${e}rc`];return e.startsWith(`.`)?t:t.flatMap(e=>[e,`.${e}`])}function lu(e){switch(g(e).toLowerCase()){case`.json`:case`.jsonc`:return`jsonc`;case`.yml`:case`.yaml`:return`yaml`;case`.js`:case`.cjs`:case`.mjs`:return`module`;default:return`unknown`}}async function uu(e){let t=lu(e);if(t===`module`)return du(e);let n=o(e,`utf-8`);if(t===`jsonc`)return fu(n,e);if(t===`yaml`)return yl.load(n);try{return fu(n,e)}catch{try{return yl.load(n)}catch{return du(e)}}}async function du(e){let t=await import(C(e).href);return t.activate?t:t.default}function fu(e,t){let n=[],r=Wl(e,n,{allowTrailingComma:!0,disallowComments:!1});if(n.length>0){let[{error:e,offset:r}]=n;throw Error(`Unable to parse ${t} as JSON: ${Kl(e)} at offset ${r}`)}return r}const pu={success:0,error:1,usage:2},mu=Symbol.for(`clibuilder.CliError`);function hu(e){return!!e&&typeof e==`object`&&e[mu]===!0}function gu(e,t){switch(e.type){case`invalid-key`:return`unknown option ${vu(e.key)}`;case`missing-argument`:return`missing required argument <${e.name}>`;case`extra-arguments`:return`unexpected argument${e.values.length>1?`s`:``}: ${e.values.join(`, `)}`;case`invalid-value`:return`invalid value for ${_u(e.key,t)}: ${e.message}, received "${e.value}"`;case`expect-single`:return`${_u(e.key,t)} expects a single value, received: ${yu(e.value).join(`, `)}`}}function _u(e,t){return t.arguments?.some(t=>t.name===e)?`argument <${e}>`:`option ${vu(e)}`}function vu(e){return e.length===1?`-${e}`:`--${e}`}function yu(e){return Array.isArray(e)?e:[e]}function bu(e,t){let n=xu(e,t);return Su(n[0],n[1])}function xu(e,t){if(e.commands){let n=e.commands;for(let e=n.length-1;e>=0;e--){let r=n[e];if(!r.name)return[r,t];if(t._[0]===r.name||r.alias?.includes(t._[0]))return t._.shift(),r.commands&&xu(r,t)||[r,t]}}return[e,t]}function Su(e,t){return Tu(wu(Cu({command:e,rawArgs:t,args:{_:[]},errors:[]})))}function Cu(e){let t=e.command,n=[...e.rawArgs._];return e.args=(t.arguments||[]).reduce((t,r)=>{let i=r.type??ho();if(n.length===0)return bo(i)||e.errors.push({type:`missing-argument`,name:r.name}),t;let a=yo(Du(i))?n.splice(0):[n.shift()],[o,s]=Ou(i,r.name,a);return e.errors.push(...s),t.args[r.name]=o,t},{args:{_:[]}}).args,n.length>0&&e.errors.push({type:`extra-arguments`,name:t.name,values:n}),e}function wu(e){return Li(e.rawArgs,(t,n)=>{if(n===`_`)return t;if(/^-/.test(n))return t.errors.push({type:`invalid-key`,key:n}),t;let[r,i]=Eu(e.command,n);if(!r)return t.errors.push({type:`invalid-key`,key:n}),t;let[a,o]=Ou(i.type||X(go()),n,e.rawArgs[n]);return o&&t.errors.push(...o),t.args[r]=a,t},e)}function Tu(e){let t=e.command.options||{};return Li(t,(e,n)=>{if(e.args[n])return e;let r=t[n];return typeof r==`string`||r.default===void 0||(e.args[n]=yo(r.type)&&!Array.isArray(r.default)?[r.default]:r.default),e},e)}function Eu(e,t){let n=e.options;if(!n)return[];let r=n[t];if(r)return[t,r];let i=Pi(n,e=>{let r=n[e];return r.alias?r.alias.some(e=>e===t||e.alias===t):!1});return i?[i,n[i]]:[]}function Du(e){return bo(e)?e._def.innerType:e}function Ou(e,t,n){let[r,i]=Au(e,t,n);return r.success?[r.data,i]:(i.length===0&&i.push({type:`invalid-value`,key:t,value:n[n.length-1],message:ku(e,r.error)}),[void 0,i])}function ku(e,t){let n=Du(e);return wo(n)?`expected one of: ${n.options.join(`, `)}`:t.issues[0].message}function Au(e,t,n){let[r,i]=ju(e,t,n,[]);return[e.safeParse(r),i]}function ju(e,t,n,r){if(bo(e))return ju(e._def.innerType,t,n,r);if(xo(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),Mu(t,n[n.length-1],r);if(So(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),Nu(t,n[n.length-1],r);if(Co(e))return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),[n[n.length-1],r];if(yo(e)){let i=e.element;if(xo(i))return n.reduce(([e,n],r)=>{let[i,a]=Mu(t,r,n);return e.push(i),[e,a]},[[],r]);if(So(i))return n.reduce(([e,n],r)=>{let[i,a]=Nu(t,r,n);return e.push(i),[e,a]},[[],r]);if(Co(i))return[n,r]}return n.length>1&&r.push({type:`expect-single`,key:t,keyType:e,value:n}),[n[n.length-1],r]}function Mu(e,t,n){return t.toLowerCase()===`true`?[!0,n]:t.toLowerCase()===`false`?[!1,n]:(n.push({type:`invalid-value`,key:e,value:t,message:`expected to be boolean`}),[void 0,n])}function Nu(e,t,n){let r=+t;return typeof r==`number`&&!Number.isNaN(r)?[r,n]:(n.push({type:`invalid-value`,key:e,value:t,message:`expected to be number`}),[void 0,n])}function Pu(){let e=new Map,t=new Map;function n(n){return n.kind===`collection`?t.get(n.id)??[]:e.get(n.id)?.value}return{register(n,r,i){if(r.kind===`collection`){let e=t.get(r.id)??[];return e.push({source:n,value:i}),t.set(r.id,e),{accepted:!0}}let a=e.get(r.id);return a?{accepted:!1,source:a.source}:(e.set(r.id,{source:n,value:i}),{accepted:!0})},get:n,has(n){return n.kind===`collection`?t.has(n.id):e.has(n.id)},describe(n){if(n.kind===`collection`)return(t.get(n.id)??[]).map(({source:e})=>e);let r=e.get(n.id)?.source;return r?[r]:[]}}}function Fu(e){let{name:t,description:n=``,version:r,config:i,keywords:a=[]}=e;i&&a.length===0&&a.push(t);let o=typeof i==`string`?i:i?t:void 0;return{name:t,description:n,version:r,configName:o,keywords:a,displayLevel:`info`,command:Us(n,{config:!!o})}}function Iu(e,t){let n=Fu(t),r=n.description,i=[],a=Pu(),o=n.configName?e.loadConfig(n.configName):void 0,s=n.configName||n.keywords.length>0;return s&&n.command.commands.push(zu(n.command,Xs)),o&&i.push((async()=>{let t=await o;if(n.config=t,t?.plugins){let r=await e.loadPlugins(t.plugins,a,{name:n.name,version:n.version||``});n.command.commands.push(...r.map(e=>zu(n.command,e)))}})()),{name:n.name,version:n.version||``,description:r,parse:s?c:void 0,default(e){return n.command=zu(n.command,{...n.command,...e}),delete this.default,{...this,parse:c}},command(e){return n.command.commands.push(zu(n.command,e)),{...this,parse:c}}};async function c(t){await Promise.all(i),e.ui.debug(`argv:`,t.join(` `));let r=ue(t),o=Us(n.description,{config:!!n.configName}),{args:s}=bu(o,r);if(s.silent&&(delete r.silent,n.displayLevel=`none`),s.verbose&&(delete r.verbose,n.displayLevel=`debug`),s[`debug-cli`]&&(delete r[`debug-cli`],n.displayLevel=`trace`),e.ui.displayLevel=n.displayLevel,e.ui.dump(),n.configName&&s[`show-config`])return l(n.configName);let c=bu(n.command,r),{args:d,command:f}=c;if(s.version||d.version)return Lu(e,n,c.command,a).ui.showVersion();if(s.help||d.help)return Lu(e,n,c.command,a).ui.showHelp();let p=c.errors.filter(e=>!(e.type===`invalid-key`&&Eu(o,e.key)[0]));if(p.length>0){let t=Lu(e,n,c.command,a).ui;for(let e of p)t.error(gu(e,f));return t.showHelp(),e.exit(pu.usage)}if(f.config){let t=typeof n.configName==`string`?n.configName:n.name,{config:r,errors:i}=u(f.config,await e.loadConfig(t));if(n.config=r,i)return e.ui.error(`config fails validation:`),Fi(i,t=>e.ui.error(` ${String(t)}: ${i[t]}`)),Lu(e,n,c.command,a).ui.showHelp(),e.exit(pu.error);n.config=r}let m=Lu(e,n,f,a);if(!m.run)return m.ui.showHelp();try{return await m.run(d)}catch(t){if(!hu(t))throw t;m.ui.error(t.message);for(let e of t.help)m.ui.error(e);return e.exit(t.exitCode)}}async function l(t){let{config:r,source:i}=await e.resolveConfig(t),a=Ru(e,n,n.command);a.info(`config: ${su(i)}`),i.type!==`none`&&a.info(JSON.stringify(r,void 0,2))}function u(e,t){let n=e.safeParse(t);return n.success?{config:t}:{errors:n.error.flatten().fieldErrors}}}function Lu(e,t,n,r){return{...n,run:n.run,ui:Ru(e,t,n),config:t.config,keywords:t.keywords,cwd:e.cwd,registry:r}}function Ru(e,t,n){let r=e.createCommandUI(n.name||t.name);return r.displayLevel=t.displayLevel,{...r,showVersion:()=>r.showVersion(t.version),showHelp:()=>r.showHelp(t.name,n)}}function zu(e,t){return t.name&&(t.parent=e),t.commands&&=t.commands.map(e=>zu(t,e)),t}var Bu=D(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}));const Vu={none:0,emergency:100,alert:200,critical:300,error:400,warn:500,notice:600,info:700,debug:800,trace:900,planck:1/0,all:1/0};function Hu(e){return e<=100?`emergency`:e<=200?`alert`:e<=300?`critical`:e<=400?`error`:e<=500?`warn`:e<=600?`notice`:e<=700?`info`:e<=800?`debug`:e<=900?`trace`:`planck`}function Uu(e){return Vu[e.toLocaleLowerCase()]}const Wu=[`emergency`,`alert`,`critical`,`error`,`warn`,`notice`,`info`,`debug`,`trace`,`planck`];var Gu=le(Bu(),1);function Ku(e){switch(e){case`none`:return e=>void 0;case`iso`:return e=>e.toISOString();case`elapsed`:{let e;return t=>{let n=t.getTime(),r=(0,Gu.default)(e===void 0?0:n-e);return e=n,r}}}}function qu({args:e}){return e}const Ju=zi();function Yu(e){switch(!0){case e<=0:return`debug`;case e<=Vu.error:return`error`;case e<=Vu.warn:return`warn`;case e<=Vu.info:return`info`;default:return`debug`}}function Xu(){return console.log.bind?{debug:(typeof console.info==`function`?console.debug:console.log).bind(console),info:(typeof console.info==`function`?console.info:console.log).bind(console),warn:(typeof console.warn==`function`?console.warn:console.log).bind(console),error:(typeof console.error==`function`?console.error:console.log).bind(console)}:{debug:Zu(typeof console.debug==`function`?`debug`:`log`),info:Zu(typeof console.info==`function`?`info`:`log`),warn:Zu(typeof console.warn==`function`?`warn`:`log`),error:Zu(typeof console.error==`function`?`error`:`log`)}}function Zu(e){return function(...t){console[e](...t)}}function Qu(e){let{id:t,formatter:n,filter:r}=xe({id:`console`,formatter:qu},e);return Ju.console||=Xu(),Object.freeze({id:t,isConsoleReporter:!0,get formatter(){return n},get filter(){return r},console:Ju.console,write(e){if(r&&!r(e))return;let t=n(e),i=Yu(e.level);this.console[i](...t)}})}function $u(e){return{loggers:zi(),nonConsoleLoggers:zi(),reporters:e.reporters||[Qu()],logLevel:e.logLevel,logLevelStore:ed(e)}}function ed(e){let t=e.customLevels||zi(),n={customLevels:t,customLevelsReverse:Li(t,(e,n)=>(e[t[n]]=n,e),{})};return{getName(e){return n.customLevelsReverse[e]??Hu(e)},getLevel(e){return n.customLevels[e]??Uu(e)},getAllLevels(){return Ri(Vu,(e,t)=>(t!==`none`&&t!==`all`&&e.push({name:t,level:Vu[t]}),e),Ii(n.customLevels,e=>({name:e,level:n.customLevels[e]})))}}}function td(e,t,n){t=nd(t);let r=n?.writeTo??(()=>!0),[i,a]=typeof r==`string`?[e=>e===r,e.reporters]:r instanceof RegExp?[e=>r.test(e),e.reporters]:typeof r==`function`?[r,e.reporters]:[()=>!0,[r]];function o(e){rd(a,e,i)}let s={level:n?.level,write:o};return Object.defineProperties(s,{id:{value:t,writable:!1},count:{writable:!1,value:(n=>(...r)=>{id(e,Vu.debug,s.level)&&o({id:t,level:Vu.debug,args:[++n,...r],timestamp:new Date})})(0)},on:{writable:!1,value:(t,n)=>{let r=typeof t==`string`?e.logLevelStore.getLevel(t):t;if(id(e,r,s.level)){let t=e.logLevelStore.getName(r),i=s[t].bind(s),a=n(i,s.level??e.logLevel);a&&i(a)}}}}),e.logLevelStore.getAllLevels().forEach(function({name:n,level:r}){Object.defineProperty(s,n,{writable:!1,value:(...n)=>{id(e,r,s.level)&&o({id:t,level:r,args:n,timestamp:new Date})}})}),s}function nd(e){return e.replace(/[`~!#$%^&*()=+[\]{},|<>?]/g,`-`)}function rd(e,t,n){e.filter(e=>n(e.id)).forEach(e=>e.write(t))}function id(e,t,n){return t<=(n===void 0?e.logLevel:n)}const ad=zi();function od(e){let t=cd(e);return(e?.reporters)?.some(e=>!e.id)&&t.standardLog.getLogger(`standard-log`).critical(`Detected reporter with empty id. This is not allowed as it will create problems with feature like 'getNonConsoleLogger()'. Please add an id to your reporter.`),ad.gsl||=t,t.standardLog}function sd(){}function cd(e){let t=$u(ye({logLevel:Vu.info},e)),n=(e?.reporters)?.filter(e=>!e.isConsoleReporter).map(e=>e.id)??[],r=Wu.concat(Object.keys(e?.customLevels??{})).concat([`on`,`count`,`write`]);return{store:t,standardLog:{get logLevel(){return t.logLevel},toLogLevelName(e){return t.logLevelStore.getName(e)},toLogLevel(e){return t.logLevelStore.getLevel(e)},getLogger(e,n){return t.loggers[e]?t.loggers[e]:t.loggers[e]=td(t,e,{ssf:this.getLogger,...n})},getNonConsoleLogger(e,i){return t.nonConsoleLoggers[e]?t.nonConsoleLoggers[e]:t.loggers[e]?(this.getLogger(`standard-log`).warn(`attempt to create a non-console logger with existing id ('${e}'), ignoring`),t.nonConsoleLoggers[e]=ld(r)):t.nonConsoleLoggers[e]=n.length===0?ld(r):td(t,e,{ssf:this.getNonConsoleLogger,...i,writeTo(e){return n.indexOf(e)>=0}})}}}}function ld(e){return e.reduce((e,t)=>(e[t]=sd,e),zi())}var ud=D(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),dd=le(D(((e,t)=>{let n=O(`os`),r=O(`tty`),i=ud(),{env:a}=process,o;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?o=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(o=1);function s(){if(`FORCE_COLOR`in a)return a.FORCE_COLOR===`true`?1:a.FORCE_COLOR===`false`?0:a.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(a.FORCE_COLOR,10),3)}function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let c=s();c!==void 0&&(o=c);let l=r?o:c;if(l===0)return 0;if(r){if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2}if(e&&!t&&l===void 0)return 0;let u=l||0;if(a.TERM===`dumb`)return u;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in a)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`,`DRONE`].some(e=>e in a)||a.CI_NAME===`codeship`?1:u;if(`TEAMCITY_VERSION`in a)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION);if(a.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in a){let e=Number.parseInt((a.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(a.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||`COLORTERM`in a?1:u}function u(e,t={}){return c(l(e,{streamIsTTY:e&&e.isTTY,...t}))}t.exports={supportsColor:u,stdout:u({isTTY:r.isatty(1)}),stderr:u({isTTY:r.isatty(2)})}}))(),1),fd;(function(e){e[e.DISABLED=0]=`DISABLED`,e[e.BASIC=1]=`BASIC`,e[e.ANSI=2]=`ANSI`,e[e.TRUE=3]=`TRUE`})(fd=fd||={});let pd;function md(){return pd||={stderr:dd.default.stderr?dd.default.stderr.level:fd.DISABLED,stdout:dd.default.stdout?dd.default.stdout.level:fd.DISABLED}}function hd(e,t){return`\u001B[${t.join(`;`)}m${e}\u001B[0m`}function gd(e={timestamp:`none`}){let t=Ku(e.timestamp);return function(e){let n=Yu(e.level);return[vd(n,e.id),..._d(t,n,e)]}}function _d(e,t,n){let r=[...n.args],i=e(n.timestamp);i!==void 0&&r.push(i);let a=t===`error`?[31]:t===`warn`?[33]:void 0;return a?r.map(e=>hd(e,a)):r}function vd(e,t){let n=md();return yd(e===`error`?n.stderr:n.stdout)(t)}function yd(e){switch(e){case fd.DISABLED:return e=>e;case fd.BASIC:return bd;case fd.ANSI:return wd;case fd.TRUE:return Td}}function bd(e){let t=Cd(e);return hd(` ${e} `,t)}const xd={counter:0,list:[[37,41],[30,42],[30,43],[37,44],[37,45],[30,46],[37,40],[37,41,1],[30,42,1],[30,43,1],[37,44,1],[37,45,1],[30,46,1],[37,40,1],[37,41,4],[30,42,4],[30,43,4],[37,44,4],[37,45,4],[30,46,4],[37,40,4],[37,41,1,4],[30,42,1,4],[30,43,1,4],[37,44,1,4],[37,45,1,4],[30,46,1,4],[37,40,1,4]]},Sd=Object.create(null);function Cd(e){return Sd[e]=Sd[e]||xd.list[xd.counter++%xd.list.length]}function wd(e){return bd(e)}function Td(e){return bd(e)}we();function Ed(e){return Qu(ye({formatter:gd()},e))}async function Dd({cwd:e,ui:t,registry:n,host:r},i){return Od(e,t,n,r,i)}async function Od(e,t,n,r,i){let a=await Promise.all(i.map(async n=>(t.debug(`loading plugin`,n),{name:n,pluginModule:await kd(e,t,n)}))),o=[];for(let{name:e,pluginModule:i}of a){if(!Ad(i)){t.warn(`not a valid plugin`,e);continue}t.debug(`activating plugin`,e),(await jd(i,n,r,e,t)).forEach(e=>{t.debug(`adding command`,e.name),o.push(e)}),t.debug(`activated plugin`,e)}return o}async function kd(e,t,n){try{return await import(n)}catch(r){t.warn(`Unable to load plugin from ${n}. Please let the plugin author knows about it.`),t.warn(`cwd: ${e}`),t.warn(`error: `,r.message||r);return}}function Ad(e){return e&&typeof e.activate==`function`}async function jd(e,t,n,r,i){let a=[];return await e.activate({addCommand:e=>a.push(e),register:(e,n)=>{let a=t.register(r,e,n);a.accepted||i.warn(`plugin ${r} could not register ${e.id}; it is already registered by ${a.source}`)},get:t.get,has:t.has,host:n}),a}
|
|
70
|
+
/*!
|
|
71
|
+
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
|
72
|
+
*
|
|
73
|
+
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
74
|
+
* Licensed under the MIT License.
|
|
75
|
+
*/
|
|
76
|
+
var Md=D(((e,t)=>{var n=``,r;t.exports=i;function i(e,t){if(typeof e!=`string`)throw TypeError(`expected a string`);if(t===1)return e;if(t===2)return e+e;var i=e.length*t;if(r!==e||r===void 0)r=e,n=``;else if(n.length>=i)return n.substr(0,i);for(;i>n.length&&t>1;)t&1&&(n+=e),t>>=1,e+=e;return n+=e,n=n.substr(0,i),n}})),Nd=D(((e,t)=>{var n=Md();t.exports=function(e,t,r){var i=``,a=t-e.length;if(a<=5&&!r)i=`00000`;else if(a<=25&&!r)i=`000000000000000000000000000`;else return e+n(r||`0`,a);return e+i.slice(0,a)}})),Pd=D(((e,t)=>{var n=t.exports=function(e,t,n){typeof e==`object`&&(n=e,e=n.start,t=n.stop),typeof t==`object`&&(n=t,e||=n.start,t=void 0),t||(t=e,e=0),n||={};var r=n.mode||`soft`,i=r===`hard`?/\b/:/(\S+\s+)/;return function(n){return n.toString().split(i).reduce(function(n,i){if(r===`hard`)for(var a=0;a<i.length;a+=t-e)n.push(i.slice(a,a+t-e));else n.push(i);return n},[]).reduce(function(n,r){if(r===``)return n;var i=r.replace(/\t/g,` `),a=n.length-1;if(n[a].length+i.length>t)n[a]=n[a].replace(/\s+$/,``),i.split(/\n/).forEach(function(t){n.push(Array(e+1).join(` `)+t.replace(/^\s+/,``))});else if(i.match(/\n/)){var o=i.split(/\n/);n[a]+=o.shift(),o.forEach(function(t){n.push(Array(e+1).join(` `)+t.replace(/^\s+/,``))})}else n[a]+=i;return n},[Array(e+1).join(` `)]).join(`
|
|
77
|
+
`)}};n.soft=n,n.hard=function(e,t){return n(e,t,{mode:`hard`})}})),Fd=le(Nd(),1);const Id=(0,le(Pd(),1).default)(80);function Ld(e){let t=!0,n=[];return{...e,get displayLevel(){return e.displayLevel},set displayLevel(t){e.displayLevel=t},debug:(...r)=>t?n.push([`debug`,r]):e.debug(...r),info:(...r)=>t?n.push([`info`,r]):e.info(...r),warn:(...r)=>t?n.push([`warn`,r]):e.warn(...r),error:(...r)=>t?n.push([`error`,r]):e.error(...r),dump:()=>{t=!1,n.forEach(([t,n])=>{e[t](...n)})}}}function Rd(e){return e.level=Vu.info,{get displayLevel(){return e.level<=Vu.none?`none`:e.level<=Vu.info?`info`:e.level<=Vu.debug?`debug`:`trace`},set displayLevel(t){switch(t){case`none`:e.level=Vu.none;break;case`debug`:e.level=Vu.debug;break;case`trace`:e.level=Vu.trace}},debug:(...t)=>e.debug(...t),info:(...t)=>e.info(...t),warn:(...t)=>e.warn(...t),error:(...t)=>e.error(...t),showHelp:(t,n)=>{let r=zd(t,n);e.info(r)},showVersion(t){e.info(t||`not versioned`)}}}function zd(e,t){return`
|
|
78
|
+
${[Bd(e,t),Hd(t),Wd(t),Kd(t),qd(t),Qd(t),$d(t)].filter(e=>!!e).join(`
|
|
79
|
+
|
|
80
|
+
`)}
|
|
81
|
+
`}function Bd(e,t){let n=Ud(e,t),r=t.commands&&t.commands.length>0,i=`Usage: ${n.join(` `)}${r?` <command>`:``}`;return t.arguments&&(i+=t.arguments.some(e=>Vd(e,!0))?` <arguments>`:` [arguments]`),t.options&&(i+=Bi(t.options,e=>Vd(t.options[e],!1))?` <options>`:` [options]`),i}function Vd({type:e},t){return e?!e.isOptional():t}function Hd(e){return e.description?` ${e.description}`:``}function Ud(e,t){let n=[t];for(;t.parent;)n.unshift(t.parent),t=t.parent;return[e,...n.map(e=>e.name).filter(e=>e)]}function Wd(e){let t=Gd(e.commands);return t.length===0?``:`Commands:
|
|
82
|
+
${Id(t.join(`, `))}
|
|
83
|
+
|
|
84
|
+
${(0,Fd.default)(e.name?`${e.name} <command> -h`:` <command> -h`,25,` `)}Get help for <command>`}function Gd(e){let t=[];return e&&e.forEach(e=>{e.alias?t.push(`${e.name} (${e.alias.join(`|`)})`):t.push(e.name)}),t}function Kd(e){if(!e.arguments)return``;let t=`Arguments:
|
|
85
|
+
`,n=[],r=0;e.arguments.forEach(e=>{let t=Yd(e.name,e.type,{defaultRequired:!0,booleanIsFlag:!1});r=Math.max(r,t.length),n.push([t,e.description||``])});let i=Math.max(23,r+2);return t+=n.map(e=>` ${(0,Fd.default)(e[0],i,` `)}${e[1]}`.trimEnd()).join(`
|
|
86
|
+
`),t}function qd(e){if(!e.options)return``;let t=`Options:
|
|
87
|
+
`,n=[],r=0;for(let t in e.options){let i=e.options[t],a=Jd(t,i),o=Zd(i);n.push([a,o]),r=Math.max(r,a.length)}let i=Math.max(23,r+2);return t+=n.map(e=>` ${(0,Fd.default)(e[0],i,` `)}${e[1]}`).join(`
|
|
88
|
+
`),t}function Jd(e,t){return Yd([...t.alias?t.alias.map(e=>typeof e==`string`?e:e.hidden?void 0:e.alias).filter(e=>e):[],e].sort((e,t)=>e.length-t.length).map(e=>e.length===1?`-${e}`:`--${e}`).join(`|`),t.type,{defaultRequired:!1,booleanIsFlag:!0})}function Yd(e,t,{defaultRequired:n,booleanIsFlag:r}){let i=t?!bo(t):n,a=`${e}${Xd(t,r)}`;return i?`<${a}>`:`[${a}]`}function Xd(e,t){if(!e)return``;let n=bo(e)?e._def.innerType:e,r=yo(n),i=r?n.element:n,a=Co(i)?`string`:So(i)?`number`:xo(i)?`boolean`:``;return r?a?`=${a}...`:`...`:!a||t&&a===`boolean`?``:`=${a}`}function Zd(e){let t=e.type&&Co(e.type)?`'${e.default}'`:e.default;return e.default?`${e.description} (default ${t})`:e.description}function Qd(e){return e.alias?`Alias:
|
|
89
|
+
${Id(e.alias.join(`, `))}`:``}function $d(e){return e.config?`Config:
|
|
90
|
+
${ef(e.config)}`:``}function ef(e){return _i(tf(e),{maxLength:1/0}).replace(/'/g,``)}function tf(e){if(vo(e)){let t=e.shape;return Li(t,(e,n)=>{let r=t[n];return bo(r)?e[`${n}?`]=tf(r._def.innerType):e[n]=tf(r),e},{})}return Co(e)?`string`:xo(e)?`boolean`:So(e)?`number`:yo(e)?vo(e.element)?`Array<${ef(e.element)}>`:`${ef(e.element)}[]`:``}function nf(){let e=process.cwd(),t=od({logLevel:Vu.all,reporters:[Qu()]}),n,r;return{async loadConfig(e){return(await this.resolveConfig(e)).config},async resolveConfig(t){return n||=ou({cwd:e,ui:this.ui},t)},async loadPlugins(t,n,i){return r||=Dd({cwd:e,ui:this.ui,registry:n,host:i},t)},cwd:e,exit(e){process.exitCode=e},createCommandUI(e){return Rd(t.getLogger(e))},ui:Ld(Rd(t.getLogger(`clibuilder`,{writeTo:Ed()})))}}function rf(e){return Iu(nf(),e)}const af={comma:`,`,tab:` `,pipe:`|`},of=af.comma;function sf(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\t/g,`\\t`).replace(/[\u0000-\u001F]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function cf(e){return e===`true`||e===`false`||e===`null`}function lf(e,t,n){if(t===`__proto__`){Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0,configurable:!0});return}e[t]=n}const uf=RegExp(`(?:^?|\\n) *#`);var df=class{constructor(e){if(uf.test(e))throw TypeError(`Raw string must not contain a line starting with "#": ${JSON.stringify(e)}`);this.value=e}};function ff(e){return e instanceof df}const pf=/[\uD800-\uDFFF]/;function mf(e){if(e===null)return null;if(ff(e))return e;if(typeof e==`object`&&e&&`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();if(t!==e)return mf(t)}if(typeof e==`string`)return hf(e,`string value`),e;if(typeof e==`boolean`)return e;if(typeof e==`number`)return Object.is(e,-0)?0:Number.isFinite(e)?e:null;if(typeof e==`bigint`)return e>=-(2**53-1)&&e<=2**53-1?Number(e):e.toString();if(e instanceof Date)return e.toISOString();if(Array.isArray(e))return e.map(mf);if(e instanceof Set)return Array.from(e).map(mf);if(e instanceof Map)return Object.fromEntries(Array.from(e,([e,t])=>[String(e),mf(t)]));if(xf(e)){let t={};for(let n in e)Object.hasOwn(e,n)&&(hf(n,`object key`),lf(t,n,mf(e[n])));return t}return null}function hf(e,t){if(pf.test(e))for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<55296||r>57343)continue;let i=r<=56319,a=e.charCodeAt(n+1);if(i&&a>=56320&&a<=57343){n++;continue}throw TypeError(`Cannot encode ${t} containing an unpaired surrogate U+${r.toString(16).toUpperCase()} at index ${n}`)}}function gf(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function _f(e){return gf(e)||ff(e)}function vf(e){return Array.isArray(e)}function yf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!ff(e)}function bf(e){return Object.keys(e).length===0}function xf(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Sf(e){return e.length===0||e.every(e=>_f(e))}function Cf(e){return e.length===0||e.every(e=>vf(e))}function wf(e){return e.length===0||e.every(e=>yf(e))}const Tf=/^[+-]?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i;function Ef(e){if(!Object.values(af).includes(e))throw TypeError(`Invalid delimiter ${JSON.stringify(e)}. Valid delimiters are: comma (,), tab (\\t), pipe (|)`)}function Df(e){return/^[A-Z_][\w.]*$/i.test(e)}function Of(e,t=of){return!(!e||/^[ \t]|[ \t]$/.test(e)||cf(e)||kf(e)||e.includes(`:`)||e.includes(`"`)||e.includes(`\\`)||/[[\]{}]/.test(e)||/[\u0000-\u001F]/.test(e)||e.includes(t)||e.startsWith(`-`)||e.startsWith(`#`))}function kf(e){return Tf.test(e)}function Af(e,t){return ff(e)?e.value:e===null?`null`:typeof e==`boolean`||typeof e==`number`?String(e):jf(e,t)}function jf(e,t=of){return Of(e,t)?e:`"${sf(e)}"`}function Mf(e){return Df(e)?e:`"${sf(e)}"`}function Nf(e,t=of){return e.map(e=>Af(e,t)).join(t)}function Pf(e,t){let n=t?.key,r=t?.fields,i=t?.delimiter??`,`,a=``;return n!=null&&(a+=Mf(n)),a+=`[${e}${t?.keyed?`:`:``}${i===of?``:i}]`,r&&(a+=`{${Ff(r,i)}}`),a+=`:`,a}function Ff(e,t){return e.map(e=>Mf(e.name)+(e.children?`{${Ff(e.children,t)}}`:``)).join(t)}function If(e){if(e.length===0)return;let t=Object.keys(e[0]);if(t.length===0)return;for(let n of e){if(Object.keys(n).length!==t.length)return;for(let e of t)if(!Object.hasOwn(n,e))return}let n=[];for(let r of t){let t=zf(r,e.map(e=>e[r]));if(!t)return;n.push(t)}return n}function Lf(e){let t=Object.values(e);if(!(t.length<2)&&t.every(e=>yf(e)&&!bf(e)))return If(t)}function Rf(e,t){let n=[];return Bf(e,t,n),n}function zf(e,t){if(t.every(e=>_f(e)))return{name:e};if(!t.every(e=>yf(e)&&!bf(e)))return;let n=If(t);if(n)return{name:e,children:n}}function Bf(e,t,n){for(let r of t){let t=e[r.name];r.children?Bf(t,r.children,n):n.push(t)}}function*Vf(e,t,n){if(_f(e)){let n=Af(e,t.delimiter);n!==``&&(yield n);return}if(vf(e))yield*Kf(void 0,e,n,t);else if(yf(e)){let r=Lf(e);if(r){yield*Wf(void 0,e,r,n,t);return}yield*Hf(e,n,t)}}function*Hf(e,t,n){for(let[r,i]of Object.entries(e))yield*Uf(r,i,t,n)}function*Uf(e,t,n,r){let i=Mf(e);if(_f(t))yield ep(n,`${i}: ${Af(t,r.delimiter)}`,r.indentSize);else if(vf(t))yield*Kf(e,t,n,r);else if(yf(t)){let a=Lf(t);if(a){yield*Wf(e,t,a,n,r);return}yield ep(n,`${i}:`,r.indentSize),bf(t)||(yield*Hf(t,n+1,r))}}function*Wf(e,t,n,r,i){let a=Object.entries(t);yield ep(r,Pf(a.length,{key:e,fields:n,delimiter:i.delimiter,keyed:!0}),i.indentSize),yield*Gf(a,n,r+1,i)}function*Gf(e,t,n,r){for(let[i,a]of e){let e=Rf(a,t);yield ep(n,`${Mf(i)}: ${Nf(e,r.delimiter)}`,r.indentSize)}}function*Kf(e,t,n,r){if(t.length===0){yield ep(n,e==null?`[]`:`${Mf(e)}: []`,r.indentSize);return}if(Sf(t)){yield ep(n,Jf(t,r.delimiter,e),r.indentSize);return}if(Cf(t)&&t.every(e=>Sf(e))){yield*qf(e,t,n,r);return}if(wf(t)){let i=If(t);i?yield*Yf(e,t,i,n,r):yield*Zf(e,t,n,r);return}yield*Zf(e,t,n,r)}function*qf(e,t,n,r){yield ep(n,Pf(t.length,{key:e,delimiter:r.delimiter}),r.indentSize);for(let e of t)if(Sf(e)){let t=Jf(e,r.delimiter);yield tp(n+1,t,r.indentSize)}}function Jf(e,t,n){let r=Pf(e.length,{key:n,delimiter:t}),i=Nf(e,t);return e.length===0?r:`${r} ${i}`}function*Yf(e,t,n,r,i){yield ep(r,Pf(t.length,{key:e,fields:n,delimiter:i.delimiter}),i.indentSize),yield*Xf(t,n,r+1,i)}function*Xf(e,t,n,r){for(let i of e)yield ep(n,Nf(Rf(i,t),r.delimiter),r.indentSize)}function*Zf(e,t,n,r){yield ep(n,Pf(t.length,{key:e,delimiter:r.delimiter}),r.indentSize);for(let e of t)yield*$f(e,n+1,r)}function*Qf(e,t,n){if(bf(e)){yield ep(t,`-`,n.indentSize);return}let r=Object.entries(e),[i,a]=r[0],o=r.slice(1);if(vf(a)&&wf(a)){let e=If(a);if(e){yield tp(t,Pf(a.length,{key:i,fields:e,delimiter:n.delimiter}),n.indentSize),yield*Xf(a,e,t+2,n),o.length>0&&(yield*Hf(Object.fromEntries(o),t+1,n));return}}if(yf(a)){let e=Lf(a);if(e){let r=Object.entries(a);yield tp(t,Pf(r.length,{key:i,fields:e,delimiter:n.delimiter,keyed:!0}),n.indentSize),yield*Gf(r,e,t+2,n),o.length>0&&(yield*Hf(Object.fromEntries(o),t+1,n));return}}let s=Mf(i);if(_f(a))yield tp(t,`${s}: ${Af(a,n.delimiter)}`,n.indentSize);else if(vf(a)){if(a.length===0)yield tp(t,`${s}: []`,n.indentSize);else if(Sf(a))yield tp(t,`${s}${Jf(a,n.delimiter)}`,n.indentSize);else{yield tp(t,`${s}${Pf(a.length,{delimiter:n.delimiter})}`,n.indentSize);for(let e of a)yield*$f(e,t+2,n)}}else yf(a)&&(yield tp(t,`${s}:`,n.indentSize),bf(a)||(yield*Hf(a,t+2,n)));o.length>0&&(yield*Hf(Object.fromEntries(o),t+1,n))}function*$f(e,t,n){if(_f(e))yield tp(t,Af(e,n.delimiter),n.indentSize);else if(vf(e)){if(Sf(e))yield tp(t,Jf(e,n.delimiter),n.indentSize);else{yield tp(t,Pf(e.length,{delimiter:n.delimiter}),n.indentSize);for(let r of e)yield*$f(r,t+1,n)}}else yf(e)&&(yield*Qf(e,t,n))}function ep(e,t,n){return` `.repeat(n*e)+t}function tp(e,t,n){return ep(e,`- `+t,n)}function np(e,t){let n=t(``,e,[]);return n===void 0?ip(e,t,[]):rp(e,n,t,[])}function rp(e,t,n,r){return ff(t)&&!_f(e)?ip(e,n,r):ip(mf(t),n,r)}function ip(e,t,n){return yf(e)?ap(e,t,n):vf(e)?op(e,t,n):e}function ap(e,t,n){let r={};for(let[i,a]of Object.entries(e)){let e=[...n,i],o=t(i,a,e);o!==void 0&&lf(r,i,rp(a,o,t,e))}return r}function op(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=[...n,i],s=t(String(i),a,o);s!==void 0&&r.push(rp(a,s,t,o))}return r}function sp(e,t){return Array.from(cp(e,t)).join(`
|
|
91
|
+
`)}function cp(e,t){let n=mf(e),r=lp(t);return Vf(r.replacer?np(n,r.replacer):n,r,0)}function lp(e){let t=e?.delimiter??of;return Ef(t),{indentSize:e?.indentSize??e?.indent??2,delimiter:t,replacer:e?.replacer}}function up(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const dp=[`toon`,`json`,`text`];function fp(e){if(!dp.includes(e))throw Error(`--format must be toon, json, or text.`);return e}function pp(e,t){process.stdout.write(`${mp(e,t)}\n`)}function mp(e,t){return t===`json`?JSON.stringify(e):t===`text`?_p(e):sp(e)}function hp(e){return e===void 0?``:String(e)}function gp(e){let t=[...new Set(e.flatMap(e=>Object.keys(e)))],n=t.map(t=>Math.max(t.length,...e.map(e=>hp(e[t]).length))),r=e=>` ${e.map((e,t)=>e.padEnd(n[t])).join(` `)}`.trimEnd();return[r(t),...e.map(e=>r(t.map(t=>hp(e[t]))))]}function _p(e){let t=Object.entries(e).map(([e,t])=>{if(!Array.isArray(t))return[`${e}: ${up(t)?JSON.stringify(t):String(t)}`];if(!t.length)return[`${e}: (none)`];let n=t.every(up)?gp(t):t.map(e=>` - ${String(e)}`);return[`${e}:`,...n]});return t.flatMap((e,n)=>{let r=t[n-1];return r&&(r.length>1||e.length>1)?[``,...e]:e}).join(`
|
|
92
|
+
`)}function vp(e,t){return t?e&&t.startsWith(e+S)?`~${t.slice(e.length)}`:t:`buddy-agent-harness`}const yp=new Set([`deps`,`dependencies`,`local`,`plugins`,`marketplace`,`plugin`,`default`]);function bp(e){return yp.has(e.toLowerCase())}function xp(e){return e.replace(/^@/,``).replace(/\//g,`-`).replace(/[^a-zA-Z0-9-_.]/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)||`agent-plugins`}function Sp(e){if(!e||typeof e!=`object`)return[];let t=e,n=new Set;for(let e of[`dependencies`,`devDependencies`]){let r=t[e];if(r&&typeof r==`object`)for(let e of Object.keys(r))n.add(e)}return[...n].sort()}function Cp({name:e,owner:t,plugins:n}){let r=[...n].sort((e,t)=>e.plugin.localeCompare(t.plugin)).map(({plugin:e,package:t,version:n,description:r})=>{let i={source:`npm`,package:t,version:n};return r?{name:e,source:i,description:r}:{name:e,source:i}});return{name:e,owner:{name:t},description:`Plugins provided by this repository’s dependencies. Generated — do not edit.`,plugins:r}}function wp(e){return`${JSON.stringify(e,null,` `)}\n`}function Tp(e){try{return JSON.parse(o(e,`utf8`))}catch{return}}function Ep(e,t){let n=t.split(`/`),r=[],i=e;for(;;){r.push(_(i,`node_modules`,...n));let e=h(i);if(e===i)break;i=e}return r}function Dp(t,n){try{let r=e(n);return h(r.resolve(`${t}/package.json`))}catch{}for(let e of Ep(h(n),t))if(r(_(e,`package.json`)))return e}function Op(e,t){let n=Dp(e,t);if(!n)return{ok:!1,package:e,reason:`unresolved`};let r=Tp(_(n,`plugin.json`));if(!r||typeof r!=`object`)return{ok:!1,package:e,reason:`no-manifest`};let i=r,a=typeof i.name==`string`?i.name:void 0;if(!a)return{ok:!1,package:e,reason:`unnamed`};let o=Tp(_(n,`package.json`)),s=typeof o?.version==`string`?o.version:void 0;if(!s)return{ok:!1,package:e,reason:`no-manifest`};let c=typeof i.description==`string`?i.description:void 0;return{ok:!0,plugin:c?{package:e,plugin:a,version:s,description:c}:{package:e,plugin:a,version:s}}}function kp(){return!!process.versions.pnp}const Ap=_(`.agents`,`buddy-agent-harness`),jp=_(Ap,`.claude-plugin`,`marketplace.json`);function Mp(e){return JSON.parse(o(e,`utf8`))}function Np(e){let t=_(e,`package.json`),n=Mp(t),r=[],i=[];for(let e of Sp(n)){let n=Op(e,t);n.ok?r.push(n.plugin):n.reason===`unresolved`&&i.push({package:e,reason:n.reason})}let a=typeof n.name==`string`?n.name:`unknown`,o=xp(a);return{catalog:Cp({name:o,owner:a,plugins:r}),plugins:r,unresolved:i,genericName:bp(o),pnp:kp()}}function Pp(e,t){let n;try{n=o(_(e,jp),`utf8`)}catch{n=void 0}return n===wp(t)?`unchanged`:n===void 0?`created`:`updated`}function Fp(e,t){let n=Pp(e,t);if(n===`unchanged`)return n;let r=_(e,jp);return a(h(r),{recursive:!0}),p(r,wp(t)),n}function Ip(e){try{return JSON.parse(o(e,`utf8`))}catch{return}}function Lp(e){try{return s(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return[]}}function Rp(e,t=process.env){return t.CLAUDE_CONFIG_DIR||_(e,`.claude`)}function zp(e){let t=Ip(_(e,`plugins`,`installed_plugins.json`)),n=[];for(let[e,r]of Object.entries(t?.plugins??{}))if(Array.isArray(r))for(let t of r){if(!t||typeof t!=`object`)continue;let r=t,i=typeof r.version==`string`?r.version:void 0,a=typeof r.scope==`string`?r.scope:void 0;if(!i||!a)continue;let o=typeof r.projectPath==`string`?r.projectPath:void 0;n.push(o?{id:e,version:i,scope:a,projectPath:o}:{id:e,version:i,scope:a})}let r=Ip(_(e,`plugins`,`known_marketplaces.json`)),i=[];for(let[e,t]of Object.entries(r??{}))i.push({name:e,path:typeof t?.source?.path==`string`?t.source.path:``});return{installed:n,marketplaces:i}}const Bp={name:`claude-code`,scoped:!0,present:(e,t=process.env)=>r(Rp(e,t)),state:(e,t=process.env)=>zp(Rp(e,t)),register:e=>`claude plugin marketplace add ./${e} --scope project`,install:e=>`claude plugin install ${e} --scope project`,update:e=>`claude plugin update ${e} --scope project`,uninstall:e=>`claude plugin uninstall ${e} --scope project`,refreshMarketplace:e=>`claude plugin marketplace update ${e}`};function Vp(e,t=process.env){return t.CODEX_HOME||_(e,`.codex`)}function Hp(e){let t=_(e,`plugins`,`cache`),n=[];for(let e of Lp(t))for(let r of Lp(_(t,e)))for(let i of Lp(_(t,e,r)))n.push({id:`${r}@${e}`,version:i,scope:`user`});let r=[],i=``;try{i=o(_(e,`config.toml`),`utf8`)}catch{i=``}let a;for(let e of i.split(`
|
|
93
|
+
`)){let t=/^\s*\[marketplaces\.(?:"([^"]+)"|([^\]]+))\]\s*$/.exec(e);if(t){a={name:t[1]??t[2],path:``},r.push(a);continue}if(/^\s*\[/.test(e)){a=void 0;continue}let n=a?/^\s*source\s*=\s*"([^"]*)"\s*$/.exec(e):void 0;n?.[1]&&a&&(a.path=n[1])}return{installed:n,marketplaces:r}}const Up=[Bp,{name:`codex`,scoped:!1,present:(e,t=process.env)=>r(Vp(e,t)),state:(e,t=process.env)=>Hp(Vp(e,t)),register:e=>`codex plugin marketplace add ./${e}`,install:e=>`codex plugin add ${e}`,update:e=>`codex plugin add ${e}`,uninstall:e=>`codex plugin remove ${e}`,refreshMarketplace:()=>``}];function Wp(e,t,n,r){let i=`@${t}`;return e.filter(e=>e.id.endsWith(i)&&(!r||e.projectPath===n))}function Gp({catalog:e,catalogDir:t,root:n,installed:r,marketplaces:i,scoped:a=!0}){let o=i.find(t=>t.name===e.name),s=[],c=t.split(/[\\/]/).filter(Boolean),l=o?c.every(e=>o.path.includes(e)):!1,u=o&&!l?o.path:void 0;o||s.push({kind:`register`,subject:e.name,detail:`marketplace is not registered with this harness`});let d=Wp(r,e.name,n,a),f=new Map(d.map(e=>[e.id,e]));for(let t of e.plugins){let n=`${t.name}@${e.name}`,r=f.get(n);if(!r){s.push({kind:`install`,subject:n,detail:`not installed; catalog pins ${t.source.version}`});continue}r.version!==t.source.version&&s.push({kind:`update`,subject:n,detail:`installed ${r.version}, catalog pins ${t.source.version}`})}let p=new Set(e.plugins.map(t=>`${t.name}@${e.name}`));for(let e of d)p.has(e.id)||s.push({kind:`uninstall`,subject:e.id,detail:`installed but no longer in the catalog; it will report a load failure until removed`});return{actions:s,...u?{collision:u}:{},unregistered:!o}}function Kp(e,t,n){switch(t.kind){case`register`:return e.register(Ap);case`install`:return e.install(t.subject);case`update`:{let r=e.refreshMarketplace(n),i=e.update(t.subject);return r?`${r} && ${i}`:i}case`uninstall`:return e.uninstall(t.subject)}}function qp(e){let t=[];e.pnp&&t.push(`Yarn Plug’n’Play is active: dependencies live inside zip archives, so no harness can install from them. Set nodeLinker: node-modules, or unplug the plugin dependencies.`),e.genericName&&t.push(`Marketplace name "${e.catalog.name}" is generic. Registering a second marketplace under a name already in use replaces the first silently, and the install that follows reports "already installed" — the repository then runs the other one's versions.`);for(let{package:n}of e.unresolved)t.push(`Declared dependency "${n}" is not installed; install dependencies before generating.`);return t}const Jp=Vi({name:`dep-plugins`,description:`Derive the marketplace catalog for plugins shipped by this repository’s dependencies, so a harness can install them. Writes the catalog; installing is the harness’s own job.`,options:{root:{description:`Repository directory. Defaults to the current directory.`,type:X(ho())},check:{description:`Report whether the catalog is current without writing it. For CI and postinstall.`,type:X(go())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:X(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=e.root??process.cwd(),r=Np(n),i=e.check?Pp(n,r.catalog)===`unchanged`?`current`:`would-change`:Fp(n,r.catalog),a=w(),o=qp(r),s=Up.filter(e=>e.present(a)),c=[],l=[];for(let e of s){let t=e.state(a),i=Gp({catalog:r.catalog,catalogDir:Ap,root:x(n),installed:t.installed,marketplaces:t.marketplaces,scoped:e.scoped});i.collision&&o.push(`${e.name}: marketplace "${r.catalog.name}" is already registered against ${i.collision}. Registering over it replaces the other repository's silently, and the install that follows reports "already installed" — rename this repository's marketplace instead.`),c.push({runtime:e.name,status:i.actions.length?`${i.actions.length} to apply`:`in sync`});for(let t of i.actions)l.push({runtime:e.name,do:Kp(e,t,r.catalog.name),subject:t.subject,why:t.detail})}return r.plugins.length&&o.push(`Copilot CLI rejects an npm marketplace source, so it cannot install from this catalog. It needs a path-sourced catalog, which cannot reach node_modules from a subdirectory.`),pp({catalog:jp,marketplace:r.catalog.name,outcome:i,plugins:r.plugins.length?r.plugins.map(({plugin:e,package:t,version:n})=>({name:e,package:t,version:n})):`0 dependencies ship a plugin — nothing to install`,harness:c.length?c:`no supported harness detected on this machine`,actions:l.length?l:`0 actions — every detected harness matches the catalog`,...o.length?{notes:o}:{}},t),i===`would-change`?pu.error:pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Catalog generation failed.`}\n`),pu.error}}});function Yp(e){try{return s(e,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()).map(t=>b(e,_(t.parentPath,t.name)).split(S).join(y.sep)).sort()}catch{return[]}}const Xp=[{name:`claude-code`,project:{detect:`.claude`,skillsDirectory:`.claude/skills`,instructionBridge:{kind:`import`,path:`CLAUDE.md`},mcpConfig:{path:`.mcp.json`,key:`mcpServers`,format:`json`},nonstandard:[{path:`.claude/commands`,shape:`directory`,kind:`command`},{path:`.claude/rules`,shape:`directory`,kind:`rule`},{path:`.claude/agents`,shape:`directory`,kind:`subagent`}]},user:{detect:`.claude`,skillsDirectory:`.claude/skills`}},{name:`cursor`,project:{detect:`.cursor`,mcpConfig:{path:`.cursor/mcp.json`,key:`mcpServers`,format:`json`},nonstandard:[{path:`.cursorrules`,shape:`file`,kind:`instructions`},{path:`.cursor/rules`,shape:`directory`,kind:`rule`},{path:`.cursor/commands`,shape:`directory`,kind:`command`},{path:`.cursor/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.cursor`}},{name:`codex`,project:{detect:`.codex`,mcpConfig:{path:`.codex/config.toml`,key:`mcp_servers`,format:`toml`},nonstandard:[{path:`.codex/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.codex`}},{name:`copilot-cli`,project:{detect:`.github/skills`,nonstandard:[{path:`.github/copilot-instructions.md`,shape:`file`,kind:`instructions`},{path:`.github/instructions`,shape:`directory`,kind:`instructions`},{path:`.github/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.copilot`}},{name:`gemini-cli`,project:{detect:`.gemini`,instructionBridge:{kind:`settings-entry`,path:`.gemini/settings.json`,key:`context.fileName`},mcpConfig:{path:`.gemini/settings.json`,key:`mcpServers`,format:`json`,shared:!0},nonstandard:[{path:`GEMINI.md`,shape:`file`,kind:`instructions`},{path:`.gemini/skills`,shape:`directory`,kind:`skill`}]},user:{detect:`.gemini`}},{name:`devin-desktop`,project:{detect:`.devin`}},{name:`windsurf`,project:{detect:`.windsurf`,skillsDirectory:`.windsurf/skills`,nonstandard:[{path:`.windsurfrules`,shape:`file`,kind:`instructions`},{path:`.windsurf/rules`,shape:`directory`,kind:`rule`}]},deprecated:`devin-desktop`}],Zp=new Set(Xp.map(e=>e.name));function Qp(e){return Zp.has(e)}function $p(e){let t=(e??``).split(`,`).map(e=>e.trim()).filter(Boolean),n=t.filter(e=>!Qp(e));if(n.length)throw Error(`Unsupported harness: ${n.join(`, `)}. Supported: ${Xp.map(e=>e.name).join(`, `)}.`);return t.filter(Qp)}const em=[`claude-code`,`cursor`];function tm(e){try{return i(e).isDirectory()}catch{return!1}}function nm(e,t){let n=new Set([...em,...t]);return Xp.filter(t=>n.has(t.name)||tm(_(e,t.project.detect)))}function Z({file:e,server:t,field:n,position:r}){return r?`${e}#L${r.line}:${r.column}`:t===void 0?e:`${e}#servers.${t}${n===void 0?``:`.${n}`}`}function rm(e){return Object.entries(e).map(([e,t])=>({problem:e,...t}))}const im=`buddy-agent-harness`,am=`/buddy-agent-harness:repair`,Q=`/buddy-agent-harness:init`,om=`.agents/buddy-agent-harness/mcp.toml`,sm={"no-canonical":{detail:`the canonical skill directory does not exist, so no bridge can resolve`,repair:(e,t)=>({command:`${t} init`,instruction:`run \`${t} init\` to create .agents/skills and the bridges into it`}),skillRepair:()=>`run \`${Q}\`, which creates \`.agents/skills\` and the bridges`},missing:{detail:`no bridge at this path — the harness sees zero project skills`,repair:({file:e},t)=>({command:`${t} init`,instruction:`run \`${t} init\` to create the bridge at ${e}`}),skillRepair:()=>`run \`${Q}\``},degraded:{detail:`expected a directory but found a regular file — checkout without core.symlinks`,repair:({file:e},t)=>({command:`${t} init --copy --force ${e}`,instruction:`run \`${t} init --copy --force ${e}\` to rebuild ${e} as a real directory`}),skillRepair:({file:e})=>`run \`${Q} --copy --force ${e}\``},stale:{detail:`symlink does not resolve to .agents/skills`,repair:({file:e},t)=>({command:`${t} init --force ${e}`,instruction:`run \`${t} init --force ${e}\` to repoint ${e} at .agents/skills`}),skillRepair:({file:e})=>`run \`${Q} --force ${e}\``},"diverged-bridge":{detail:`only the bridge changed since the two last agreed — an agent wrote through the copy`,repair:({file:e},t)=>({command:``,instruction:`replace .agents/skills with ${e} to keep the newer edit, then run \`${t} init --force ${e}\``}),skillRepair:({file:e})=>`replace .agents/skills with ${e} to keep the newer edit, then run \`${Q} --force ${e}\``},"diverged-canonical":{detail:`only .agents/skills changed since the two last agreed — the copy is stale`,repair:({file:e},t)=>({command:`${t} init --copy --force ${e}`,instruction:`run \`${t} init --copy --force ${e}\` to rebuild ${e} from the newer .agents/skills`}),skillRepair:({file:e})=>`run \`${Q} --copy --force ${e}\``},"diverged-both":{detail:`both sides changed since they last agreed — rebuilding would discard one of them`,repair:({file:e})=>({command:``,instruction:`reconcile .agents/skills with ${e} by hand — rebuilding would discard one of them; \`git diff --no-index .agents/skills ${e}\` shows what differs`}),skillRepair:({file:e})=>`run \`git diff --no-index .agents/skills ${e}\` and reconcile by hand`},"diverged-unknown":{detail:`contents differ and no commit where they agreed was found — which side moved is unknown`,repair:({file:e})=>({command:``,instruction:`reconcile .agents/skills with ${e} by hand — which side moved is unknown; \`git diff --no-index .agents/skills ${e}\` shows what differs`}),skillRepair:({file:e})=>`run \`git diff --no-index .agents/skills ${e}\` and reconcile by hand`},"unpinned-copy":{detail:`tracked copy without the skip-worktree bit — the tree is dirty with content that must not be committed`,repair:({file:e})=>({command:`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree`,instruction:`run \`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree\` to restore the skip-worktree bit`}),skillRepair:({file:e})=>`run \`git ls-files -z ${e} | xargs -0 git update-index --skip-worktree\``}};rm(sm);const cm={"no-instructions":{detail:`no AGENTS.md at the repository root, so every instruction bridge points at nothing`,repair:()=>({command:``,instruction:`hand this to \`${Q}\`, which derives AGENTS.md and the bridges to it`}),skillRepair:()=>`run \`${Q}\`, which derives AGENTS.md and the bridges to it`},"instructions-missing":{detail:`no instruction bridge at this path — the harness reads none of AGENTS.md`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${Q}\`, which writes the bridge into it`}),skillRepair:()=>`run \`${Q}\``},"instructions-unbridged":{detail:`the file is present but names AGENTS.md nowhere — the harness reads none of it`,repair:({file:e})=>({command:``,instruction:`hand ${e} to \`${Q}\`, which adds the bridge without discarding what the file already says`}),skillRepair:()=>`run \`${Q}\`, which adds the bridge without discarding what the file already says`},"instructions-unreadable":{detail:`the settings file does not parse, so the harness reads none of it`,repair:({file:e})=>({command:``,instruction:`fix the JSON in ${e} by hand, then hand it to \`${Q}\``}),skillRepair:()=>`fix the JSON by hand, then run \`${Q}\``}};rm(cm);const lm={"deprecated-harness":{detail:`a projection under a harness name that has been superseded — the replacement reads .agents/skills natively and needs no projection at all`,repair:({file:e})=>({command:``,instruction:`remove ${e} and enable the harness that replaced it — \`${am}\` offers the correction`}),skillRepair:()=>`run \`${am}\``},"ignored-bridge":{detail:`a .gitignore rule matches this bridge — an untracked bridge swallows a real edit silently`,repair:({file:e})=>({command:``,instruction:`narrow or remove the .gitignore rule matching ${e} — \`${am}\` offers the correction`}),skillRepair:()=>`run \`${am}\``},"unread-local-override":{detail:`no harness reads this filename, so everything in it is invisible to every agent`,repair:({file:e})=>({command:``,instruction:`move ${e} to CLAUDE.local.md, or consolidate it into AGENTS.md — \`${am}\` offers the correction`}),skillRepair:()=>`run \`${am}\``},"unloadable-skill":{detail:`frontmatter that does not parse, or no description — either one makes a harness skip the skill outright`,repair:({file:e})=>({command:``,instruction:`quote the description in ${e}, or add one — \`${am}\` offers the correction`}),skillRepair:()=>`run \`${am}\``}};rm(lm);const um={"mcp-golden-unreadable":{detail:`the golden MCP set does not parse — the locator gives the line and column, and nothing else can be said about it`,repair:e=>({command:``,instruction:`fix the TOML at ${Z(e)}`}),skillRepair:e=>`fix the TOML at ${Z(e)} by hand — the reported line and column are all that can be quoted, because the parser's own message repeats the offending line and that line is the one holding the credential`},"mcp-target-unreadable":{detail:`this harness config does not parse, so the harness starts none of its servers and nothing in it can be compared`,repair:e=>({command:``,instruction:`fix the syntax of ${Z(e)}`}),skillRepair:e=>`fix the syntax of ${Z(e)} by hand`},"mcp-unprojected":{detail:`the golden set declares this server and the harness config does not carry it`,repair:({file:e,server:t})=>({command:``,instruction:`add the server ${t} to ${e}, or drop it from the golden set`}),skillRepair:e=>`add the server at ${Z(e)} to that file from its golden entry, or drop it from the golden set`},"mcp-undeclared":{detail:`the harness config carries this server and the golden set does not declare it`,repair:({file:e,server:t})=>({command:``,instruction:`add the server ${t} to ${om}, or drop it from ${e}`}),skillRepair:e=>`copy the server at ${Z(e)} into ${om}, refusing any literal credential it carries, or drop it from ${e.file}`},"mcp-diverged-target":{detail:`only the harness config changed since the two last agreed — the edit was made through the copy`,repair:e=>({command:``,instruction:`reconcile the value at ${Z(e)} back into ${om}`}),skillRepair:e=>`reconcile the value at ${Z(e)} back into ${om}, field by field`},"mcp-diverged-golden":{detail:`only the golden set changed since the two last agreed — the harness copy is stale`,repair:e=>({command:``,instruction:`update ${Z(e)} from the golden entry`}),skillRepair:e=>`update ${Z(e)} from the golden entry`},"mcp-diverged-both":{detail:`both sides changed since they last agreed — merging either way would discard the other`,repair:e=>({command:``,instruction:`reconcile ${Z(e)} against ${om} by hand`}),skillRepair:e=>`reconcile ${Z(e)} against ${om} by hand — never merge a three-way conflict automatically`},"mcp-diverged-unknown":{detail:`the two disagree and no baseline says which side moved — neither history nor a last-projected record covers this server`,repair:e=>({command:``,instruction:`compare ${Z(e)} against ${om} by hand`}),skillRepair:e=>`compare ${Z(e)} against ${om} by hand`},"mcp-literal-secret":{detail:`a credential-bearing field holds a literal rather than a reference to an environment variable`,repair:e=>({command:``,instruction:`move the value at ${Z(e)} into an environment variable and reference it`}),skillRepair:e=>`move the value at ${Z(e)} into an environment variable and reference it — read the value from the file, never from this report, and never repeat it back`},"mcp-committed-secret":{detail:`a credential-bearing field holds a literal in a git-tracked file — the credential is committed, and moving it does not un-commit it`,repair:e=>({command:``,instruction:`rotate the credential behind ${Z(e)}, then reference it from an environment variable`}),skillRepair:e=>`rotate the credential behind ${Z(e)} at its issuer, then reference it from an environment variable — it is in the repository's history, so moving it is not enough`}};rm(um);const dm={"nonstandard-instructions":{detail:`instruction content only one harness reads — AGENTS.md carries the same prose to all of them`,repair:({file:e})=>({command:``,instruction:`consolidate ${e} into AGENTS.md and leave a generated bridge in its place — \`${Q}\` offers the consolidation`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\`, which consolidates it into AGENTS.md`},"nonstandard-rule":{detail:`a path-scoped rule only one harness reads — a skill reaches every harness where the scoping is incidental`,repair:({file:e})=>({command:``,instruction:`convert ${e} into a skill under .agents/skills where its guidance is not tied to the paths it names — \`${Q}\` offers the conversion; keep it where the path scoping is the point`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\` to convert into a skill, unless the path scoping is load-bearing`},"nonstandard-command":{detail:`a harness command file — a skill is the portable form, and this harness reads skills too`,repair:({file:e})=>({command:``,instruction:`move ${e} to .agents/skills/<name>/SKILL.md — \`${Q}\` offers the move`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\`, which moves it to .agents/skills`},"nonstandard-skill":{detail:`a skill under a harness directory rather than the canonical one, where only that harness finds it`,repair:({file:e})=>({command:``,instruction:`move ${e} to .agents/skills and project it back where the harness needs one — \`${Q}\` offers the move`}),skillRepair:({file:e})=>`hand ${e} to \`${Q}\`, which moves it to .agents/skills`},"nonstandard-subagent":{detail:`a subagent definition with no cross-harness form — nothing outside this harness can read it, and no canonical form exists yet`,repair:({file:e})=>({command:``,instruction:`leave ${e} where it is and record that it reaches one harness only — no portable form exists to convert it to`}),skillRepair:({file:e})=>`leave ${e} in place — no portable form exists yet, so this is work for a person rather than a skill`}};rm(dm);const fm={...sm,...cm,...lm,...um,...dm};rm(fm);function pm(e){return{problem:e,...fm[e]}}const mm=`.agents/skills`,hm=`AGENTS.local.md`;function gm(e){let t=/^---\n([\s\S]*?)\n---/.exec(e);if(!t)return`unparseable`;let n=/^description:[ \t]*(.*)$/m.exec(t[1])?.[1]?.trim();if(!n)return`no-description`;if(!/^(['"]).*\1$/.test(n)&&/:\s/.test(n))return`unparseable`}function _m({root:e,git:t,cli:n}){let i=[],a=(e,t)=>{let{detail:r,repair:a}=pm(t);i.push({path:e,problem:t,detail:r,repair:a({file:e},n)})},s=nm(e,[]);for(let t of s){let n=t.project.skillsDirectory;t.deprecated&&n&&r(_(e,n))&&a(n,`deprecated-harness`)}for(let n of s){let i=n.project.skillsDirectory;i&&r(_(e,i))&&t.isIgnored(i)&&a(i,`ignored-bridge`)}r(_(e,hm))&&a(hm,`unread-local-override`);for(let t of Yp(_(e,mm)).filter(e=>e.endsWith(`SKILL.md`)))gm(o(_(e,mm,t),`utf8`))&&a(`${mm}/${t}`,`unloadable-skill`);return i}function vm(e){let t=``,n=0,r=!1,i=!1;for(;n<e.length;){let a=e[n];if(r){t+=a,i?i=!1:a===`\\`?i=!0:a===`"`&&(r=!1),n+=1;continue}if(a===`"`){r=!0,t+=a,n+=1;continue}if(a===`/`&&e[n+1]===`/`){for(;n<e.length&&e[n]!==`
|
|
94
|
+
`;)n+=1;continue}if(a===`/`&&e[n+1]===`*`){for(n+=2;n<e.length&&(e[n]!==`*`||e[n+1]!==`/`);)n+=1;n+=2;continue}t+=a,n+=1}return t}function ym(e){try{return JSON.parse(vm(e))}catch{return}}const bm=[`transport`,`command`,`args`,`env`,`url`,`headers`,`description`,`enabled`,`timeout`,`source`],xm=new Set([`env`,`headers`]);function Sm(e,t,n){if(xm.has(e)&&up(t)&&up(n)){let e=Object.keys(t);return e.length===Object.keys(n).length&&e.every(e=>t[e]===n[e])}return JSON.stringify(t)===JSON.stringify(n)}function Cm(e,t){return bm.filter(n=>{let r=e[n];if(r===void 0)return!1;if(xm.has(n)&&up(r)&&up(t[n])){let e=t[n];return Object.keys(r).some(t=>r[t]!==e[t])}return!Sm(n,r,t[n])})}function wm(e,t,n){return Sm(e,t?.[e],n?.[e])}
|
|
95
|
+
/*!
|
|
96
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
|
+
*
|
|
99
|
+
* Redistribution and use in source and binary forms, with or without
|
|
100
|
+
* modification, are permitted provided that the following conditions are met:
|
|
101
|
+
*
|
|
102
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
103
|
+
* list of conditions and the following disclaimer.
|
|
104
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
105
|
+
* this list of conditions and the following disclaimer in the
|
|
106
|
+
* documentation and/or other materials provided with the distribution.
|
|
107
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
108
|
+
* may be used to endorse or promote products derived from this software without
|
|
109
|
+
* specific prior written permission.
|
|
110
|
+
*
|
|
111
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
112
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
113
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
114
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
115
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
116
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
117
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
118
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
119
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
120
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
121
|
+
*/
|
|
122
|
+
let Tm=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var Em=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(Tm);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
|
|
123
|
+
/*!
|
|
124
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
125
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
126
|
+
*
|
|
127
|
+
* Redistribution and use in source and binary forms, with or without
|
|
128
|
+
* modification, are permitted provided that the following conditions are met:
|
|
129
|
+
*
|
|
130
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
131
|
+
* list of conditions and the following disclaimer.
|
|
132
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
133
|
+
* this list of conditions and the following disclaimer in the
|
|
134
|
+
* documentation and/or other materials provided with the distribution.
|
|
135
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
136
|
+
* may be used to endorse or promote products derived from this software without
|
|
137
|
+
* specific prior written permission.
|
|
138
|
+
*
|
|
139
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
140
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
141
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
142
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
143
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
144
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
145
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
146
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
147
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
148
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
149
|
+
*/
|
|
150
|
+
function Dm(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function Om(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
|
|
151
|
+
`,e===t&&(i+=` `.repeat(a+n+2),i+=`^
|
|
152
|
+
`))}return i}var $=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=Dm(t.toml,t.ptr),i=Om(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
|
|
153
|
+
/*!
|
|
154
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
155
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
156
|
+
*
|
|
157
|
+
* Redistribution and use in source and binary forms, with or without
|
|
158
|
+
* modification, are permitted provided that the following conditions are met:
|
|
159
|
+
*
|
|
160
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
161
|
+
* list of conditions and the following disclaimer.
|
|
162
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
163
|
+
* this list of conditions and the following disclaimer in the
|
|
164
|
+
* documentation and/or other materials provided with the distribution.
|
|
165
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
166
|
+
* may be used to endorse or promote products derived from this software without
|
|
167
|
+
* specific prior written permission.
|
|
168
|
+
*
|
|
169
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
170
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
171
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
172
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
173
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
174
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
175
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
176
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
177
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
178
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
179
|
+
*/
|
|
180
|
+
function km(e,t=0){let n=e.indexOf(`
|
|
181
|
+
`,t);return e.charCodeAt(n-1)===13&&n--,n}function Am(e){for(;e.p<e.s.length;e.p++){let t=e.s.charCodeAt(e.p);if(t===10)break;if(t===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}if(t<32&&t!==9||t===127)throw new $(`control characters are not allowed in comments`,{toml:e.s,ptr:e.p})}}function jm(e,t,n){let r;for(;;){for(;(r=e.s.charCodeAt(e.p))===32||r===9||!t&&(r===10||r===13&&e.s.charCodeAt(e.p+1)===10);)e.p++;if(n||r!==35)break;Am(e)}}function Mm(e,t,n){let r=e.p;if(!n){r=km(e.s,r),e.p=r<0?e.s.length:r;return}for(;e.p<e.s.length;e.p++){let r=e.s.charCodeAt(e.p);if(r===35)Am(e);else if(r===n||r===t)return}throw new $(`cannot find end of structure`,{toml:e.s,ptr:r})}
|
|
182
|
+
/*!
|
|
183
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
184
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
185
|
+
*
|
|
186
|
+
* Redistribution and use in source and binary forms, with or without
|
|
187
|
+
* modification, are permitted provided that the following conditions are met:
|
|
188
|
+
*
|
|
189
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
190
|
+
* list of conditions and the following disclaimer.
|
|
191
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
192
|
+
* this list of conditions and the following disclaimer in the
|
|
193
|
+
* documentation and/or other materials provided with the distribution.
|
|
194
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
195
|
+
* may be used to endorse or promote products derived from this software without
|
|
196
|
+
* specific prior written permission.
|
|
197
|
+
*
|
|
198
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
199
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
200
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
201
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
202
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
203
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
204
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
205
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
206
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
207
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
208
|
+
*/
|
|
209
|
+
let Nm=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Pm=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Fm=/^[+-]?0[0-9_]/;function Im(e){let t=e.p,n=e.s.charCodeAt(e.p++),r=n,i=n===39,a=n===e.s.charCodeAt(e.p)&&n===e.s.charCodeAt(e.p+1);a&&((n=e.s.charCodeAt(e.p+=2))===10?e.p++:n===13&&e.s.charCodeAt(e.p+1)===10&&(e.p+=2));let o=``,s=e.p,c=0;for(;e.p<e.s.length;e.p++)if(n=e.s.charCodeAt(e.p),a&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10))c&&=3;else if(n<32&&n!==9||n===127)throw new $(`control characters are not allowed in strings`,{toml:e.s,ptr:e.p});else if((!c||c===3)&&n===r&&(!a||e.s.charCodeAt(e.p+1)===r&&e.s.charCodeAt(e.p+2)===r))return a&&(e.s.charCodeAt(e.p+3)===r&&e.p++,e.s.charCodeAt(e.p+3)===r&&e.p++),c||(o+=e.s.slice(s,e.p)),e.p+=a?3:1,o;else if(!c)!i&&n===92&&(o+=e.s.slice(s,s=e.p),c=1);else if(c===1){if(n===120||n===117||n===85){let t=0,r=n===120?2:n===117?4:8;for(let n=0;n<r;n++,e.p++){let n=e.s.charCodeAt(e.p+1),r=n>=48&&n<=57?n-48:n>=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:-1;if(r<0)throw new $(`invalid non-hex character in unicode escape`,{toml:e.s,ptr:e.p+1});t=t<<4|r}if(t<0||t>1114111||t>=55296&&t<=57343)throw new $(`invalid unicode escape`,{toml:e.s,ptr:e.p});o+=String.fromCodePoint(t),s=e.p+1,c=0}else if(n===32||n===9)c=2;else{if(n===98)o+=`\b`;else if(n===116)o+=` `;else if(n===110)o+=`
|
|
210
|
+
`;else if(n===102)o+=`\f`;else if(n===114)o+=`\r`;else if(n===101)o+=`\x1B`;else if(n===34)o+=`"`;else if(n===92)o+=`\\`;else throw new $(`unrecognized escape sequence`,{toml:e.s,ptr:e.p});s=e.p+1,c=0}}else if(n!==32&&n!==9){if(c===2)throw new $(`invalid escape: only line-ending whitespace may be escaped`,{toml:e.s,ptr:s});c=+(!i&&n===92),s=e.p}throw new $(`unfinished string`,{toml:e.s,ptr:t})}function Lm(e,t,n){let r=e.s.slice(t,n),i=r.indexOf(`#`);return i>0&&(Am({s:r,p:i,d:0}),r=r.slice(0,i)),r.trimEnd()}function Rm(e,t,n){let r=e.p,i={toml:e.s,ptr:r};Mm(e,44,n);let a=Lm(e,r,e.p);if(!a)throw new $(`incomplete declaration: value expected`,i);if(a===`-inf`)return-1/0;if(a===`inf`||a===`+inf`)return 1/0;if(a===`nan`||a===`+nan`||a===`-nan`)return NaN;if(a===`-0`)return t?0n:0;let o=Nm.test(a);if(o||Pm.test(a)){if(Fm.test(a))throw new $(`leading zeroes are not allowed`,i);a=a.replace(/_/g,``);let e=+a;if(isNaN(e))throw new $(`invalid number`,i);if(o){if((o=!Number.isSafeInteger(e))&&!t)throw new $(`integer value cannot be represented losslessly`,i);(o||t===!0)&&(e=BigInt(a))}return e}let s=new Em(a);if(!s.isValid())throw new $(`invalid value`,i);return s}
|
|
211
|
+
/*!
|
|
212
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
213
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
214
|
+
*
|
|
215
|
+
* Redistribution and use in source and binary forms, with or without
|
|
216
|
+
* modification, are permitted provided that the following conditions are met:
|
|
217
|
+
*
|
|
218
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
219
|
+
* list of conditions and the following disclaimer.
|
|
220
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
221
|
+
* this list of conditions and the following disclaimer in the
|
|
222
|
+
* documentation and/or other materials provided with the distribution.
|
|
223
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
224
|
+
* may be used to endorse or promote products derived from this software without
|
|
225
|
+
* specific prior written permission.
|
|
226
|
+
*
|
|
227
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
228
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
229
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
230
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
231
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
232
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
233
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
234
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
235
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
236
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
237
|
+
*/
|
|
238
|
+
function zm(e,t,n){let r=e.p,i=e.s.charCodeAt(r);if(i===91||i===123){if(!e.d--)throw new $(`document contains excessively nested structures. aborting.`,{toml:e.s,ptr:r});let t=i===91?Um(e,n):Hm(e,n);return e.d++,t}if(i===34||i===39)return Im(e);if(i===116){if(e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)throw new $(`invalid value`,{toml:e.s,ptr:r});return e.p++,!0}if(i===102){if(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)throw new $(`invalid value`,{toml:e.s,ptr:r});return e.p++,!1}return Rm(e,n,t)}
|
|
239
|
+
/*!
|
|
240
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
241
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
242
|
+
*
|
|
243
|
+
* Redistribution and use in source and binary forms, with or without
|
|
244
|
+
* modification, are permitted provided that the following conditions are met:
|
|
245
|
+
*
|
|
246
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
247
|
+
* list of conditions and the following disclaimer.
|
|
248
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
249
|
+
* this list of conditions and the following disclaimer in the
|
|
250
|
+
* documentation and/or other materials provided with the distribution.
|
|
251
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
252
|
+
* may be used to endorse or promote products derived from this software without
|
|
253
|
+
* specific prior written permission.
|
|
254
|
+
*
|
|
255
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
256
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
257
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
258
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
259
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
260
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
261
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
262
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
263
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
264
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
265
|
+
*/
|
|
266
|
+
let Bm=/^[a-zA-Z0-9-_]+[ \t]*$/;function Vm(e,t=`=`){let n=e.p,r=n-1,i=[],a=e.s.indexOf(t,n);if(a<0)throw new $(`incomplete key-value: cannot find end of key`,{toml:e.s,ptr:n});do{let o=e.s.charCodeAt(e.p=++r);if(o!==32&&o!==9){if(o===34||o===39){if(o===e.s.charCodeAt(e.p+1)&&o===e.s.charCodeAt(e.p+2))throw new $(`multiline strings are not allowed in keys`,{toml:e.s,ptr:e.p});let s=Im(e);r=e.s.indexOf(`.`,e.p);let c=e.s.slice(e.p,r<0||r>a?a:r),l=km(c);if(l>-1)throw new $(`newlines are not allowed in keys`,{toml:e.s,ptr:l});if(c.trimStart())throw new $(`found extra tokens after the string part`,{toml:e.s,ptr:e.p});if(a<e.p&&(a=e.s.indexOf(t,e.p),a<0))throw new $(`incomplete key-value: cannot find end of key`,{toml:e.s,ptr:n});i.push(s)}else{r=e.s.indexOf(`.`,e.p);let t=e.s.slice(e.p,r<0||r>a?a:r);if(!Bm.test(t))throw new $(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e.s,ptr:e.p});i.push(t.trimEnd())}}}while(r+1&&r<a);return e.p=a+1,jm(e,!0,!0),i}function Hm(e,t){let n={},r=new Set,i;for(e.p++;e.p<e.s.length;){if(jm(e),(i=e.s.charCodeAt(e.p))===125)return e.p++,n;let a,o=n,s=!1,c=e.p,l=Vm(e);for(let t=0;t<l.length;t++){if(t&&(o=s?o[a]:o[a]={}),a=l[t],(s=Object.hasOwn(o,a))&&(typeof o[a]!=`object`||r.has(o[a])))throw new $(`trying to redefine an already defined value`,{toml:e.s,ptr:c});!s&&a===`__proto__`&&Object.defineProperty(o,a,{enumerable:!0,configurable:!0,writable:!0})}if(s)throw new $(`trying to redefine an already defined value`,{toml:e.s,ptr:e.p});let u=zm(e,125,t);if(r.add(o[a]=u),jm(e),(i=e.s.charCodeAt(e.p++))===125)return n;if(i!==44)throw new $(`expected comma or end of structure`,{toml:e.s,ptr:e.p-1})}throw new $(`unfinished table encountered`,{toml:e.s,ptr:e.p})}function Um(e,t){let n=[],r;for(e.p++;e.p<e.s.length;){if(jm(e),(r=e.s.charCodeAt(e.p))===93)return e.p++,n;if(n.push(zm(e,93,t)),jm(e),(r=e.s.charCodeAt(e.p++))===93)return n;if(r!==44)throw new $(`expected comma or end of structure`,{toml:e.s,ptr:e.p-1})}throw new $(`unfinished array encountered`,{toml:e.s,ptr:e.p})}
|
|
267
|
+
/*!
|
|
268
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
269
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
270
|
+
*
|
|
271
|
+
* Redistribution and use in source and binary forms, with or without
|
|
272
|
+
* modification, are permitted provided that the following conditions are met:
|
|
273
|
+
*
|
|
274
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
275
|
+
* list of conditions and the following disclaimer.
|
|
276
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
277
|
+
* this list of conditions and the following disclaimer in the
|
|
278
|
+
* documentation and/or other materials provided with the distribution.
|
|
279
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
280
|
+
* may be used to endorse or promote products derived from this software without
|
|
281
|
+
* specific prior written permission.
|
|
282
|
+
*
|
|
283
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
284
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
285
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
286
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
287
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
288
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
289
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
290
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
291
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
292
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
293
|
+
*/
|
|
294
|
+
function Wm(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&(r!==1||c.t!==3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function Gm(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={s:e,p:0,d:t},i={},a={},o,s=i,c=a;for(jm(r);r.p<e.length;){if(e.charCodeAt(r.p)===91){let t=e.charCodeAt(++r.p)===91;o=r.p+=+t;let n=Vm(r,`]`);if(t){if(e.charCodeAt(r.p-1)!==93)throw new $(`expected end of table declaration`,{toml:e,ptr:r.p-1});r.p++}let l=Wm(n,i,a,t?2:1);if(!l)throw new $(`trying to redefine an already defined table or value`,{toml:e,ptr:o});c=l[2],s=l[1]}else{o=r.p;let t=Wm(Vm(r),s,c,0);if(!t)throw new $(`trying to redefine an already defined table or value`,{toml:e,ptr:o});t[1][t[0]]=zm(r,void 0,n)}if(jm(r,!0),r.p<e.length&&(o=e.charCodeAt(r.p))!==10&&o!==13)throw new $(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:r.p});jm(r)}return i}const Km=`.agents/buddy-agent-harness/mcp.toml`;function qm(e){if(!up(e))return;let t=Object.entries(e).filter(([,e])=>typeof e==`string`);return t.length?Object.fromEntries(t):void 0}const Jm=new Set([`stdio`,`http`,`sse`]);function Ym(e){let t=e.type??e.transport;if(typeof t==`string`&&Jm.has(t))return t;if(typeof e.url==`string`)return`http`;if(typeof e.command==`string`)return`stdio`}function Xm(e){let t=Array.isArray(e.args)&&e.args.every(e=>typeof e==`string`),n=Ym(e),r=qm(e.env),i=qm(e.headers);return{...n?{transport:n}:{},...typeof e.command==`string`?{command:e.command}:{},...t?{args:e.args}:{},...r?{env:r}:{},...typeof e.url==`string`?{url:e.url}:{},...i?{headers:i}:{},...typeof e.description==`string`?{description:e.description}:{},...typeof e.enabled==`boolean`?{enabled:e.enabled}:{},...typeof e.timeout==`number`?{timeout:e.timeout}:{},...typeof e.source==`string`?{source:e.source}:{}}}function Zm(e,t){let n=up(e)?e[t]:void 0;return up(n)?new Map(Object.entries(n).filter(([,e])=>up(e)).map(([e,t])=>[e,Xm(t)])):new Map}function Qm(e){if(!up(e))return;let{line:t,column:n}=e;return typeof t==`number`&&typeof n==`number`?{line:t,column:n}:void 0}function $m(e){if(e===void 0)return{kind:`absent`};try{return{kind:`servers`,servers:Zm(Gm(e),`servers`)}}catch(e){return{kind:`unreadable`,position:Qm(e)}}}function eh(e,t){if(t===void 0)return{kind:`absent`};if(e.format===`toml`)try{return{kind:`servers`,servers:Zm(Gm(t),e.key)}}catch{return{kind:`unreadable`}}let n=ym(t);return n===void 0?{kind:`unreadable`}:{kind:`servers`,servers:Zm(n,e.key)}}function th(e){let t=e===void 0?void 0:ym(e),n=up(t)?t.targets:void 0;return up(n)?new Map(Object.entries(n).filter(([,e])=>up(e)).map(([e,t])=>[e,new Map(Object.entries(t).filter(([,e])=>up(e)).map(([e,t])=>[e,t]))])):new Map}var nh=class{options;constructor(e){this.options=e}parsed=new Map;walked=new Map;directionOf(e,t,n,r,i){let a=this.baseFor(e,t,n);if(a===void 0)return`unknown`;let o=!wm(n,r,a),s=!wm(n,i,a);return o&&s?`both`:s?`target`:`golden`}baseFor(e,t,n){return this.options.record.get(e.path)?.get(t)||this.lastAgreed(e,t,n)}lastAgreed(e,t,n){for(let r of this.commitsTouching(e)){let i=this.parseAt(r,Km,$m),a=this.parseAt(r,e.path,t=>eh(e,t));if(i.kind!==`servers`||a.kind!==`servers`)continue;let o=i.servers.get(t),s=a.servers.get(t);if(o&&s&&wm(n,o,s))return o}}commitsTouching(e){let t=this.walked.get(e.path);if(t)return t;let n=this.options.git.commitsTouching([Km,e.path]);return this.walked.set(e.path,n),n}parseAt(e,t,n){let r=`${e}\u0000${t}`,i=this.parsed.get(r);if(i)return i;let a=n(this.options.git.contentAt(e,t));return this.parsed.set(r,a),a}};const rh=/token|secret|password|passwd|credential/i,ih=new Set([`key`,`apikey`,`auth`,`authorization`,`bearer`]);function ah(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).split(/[^A-Za-z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}const oh=/\$\{[^}]+\}|\$[A-Za-z_][A-Za-z0-9_]*/;function sh(e){return!oh.test(e)}function ch(e){return rh.test(e)||ah(e).some(e=>ih.has(e))}function lh(e){let t;try{t=new URL(e)}catch{return!1}if(t.password)return!0;for(let[e,n]of t.searchParams)if(ch(e)&&sh(n))return!0;return!1}function uh(e,t){return Object.entries(t??{}).filter(([e,t])=>ch(e)&&sh(t)).map(([t])=>`${e}.${t}`)}function dh(e){return[...uh(`env`,e.env),...uh(`headers`,e.headers),...e.url&&lh(e.url)?[`url`]:[]]}function fh(e,t){let n=_(e,t);return r(n)?o(n,`utf8`):void 0}function ph(e){let t=new Set;return nm(e,[]).map(e=>e.project.mcpConfig).filter(e=>e!==void 0).filter(e=>!t.has(e.path)&&t.add(e.path))}const mh={target:`mcp-diverged-target`,golden:`mcp-diverged-golden`,both:`mcp-diverged-both`,unknown:`mcp-diverged-unknown`};function hh({root:e,git:t,cli:n}){let r=[],i=(e,t)=>{let{detail:i,repair:a}=pm(t);r.push({path:Z(e),problem:t,detail:i,repair:a(e,n)})},a=(e,n)=>{let r=t.trackingOf(e)!==`untracked`;for(let[t,a]of n)for(let n of dh(a))i({file:e,server:t,field:n},r?`mcp-committed-secret`:`mcp-literal-secret`)},o=new Map,s=[];for(let t of ph(e)){let n=eh(t,fh(e,t.path));if(n.kind===`unreadable`){i({file:t.path},`mcp-target-unreadable`);continue}n.kind!==`absent`&&(a(t.path,n.servers),o.set(t.path,n.servers),s.push(t))}let c=$m(fh(e,Km));if(c.kind===`unreadable`)return i({file:Km,position:c.position},`mcp-golden-unreadable`),r;if(c.kind===`absent`)return r;a(Km,c.servers);let l=new nh({git:t,record:th(fh(e,`.agents/buddy-agent-harness/mcp.projected.json`))});for(let e of s){let t=o.get(e.path);for(let[n,r]of c.servers){let a=t.get(n);if(!a){i({file:e.path,server:n},`mcp-unprojected`);continue}for(let t of Cm(r,a))i({file:e.path,server:n,field:t},mh[l.directionOf(e,n,t,r,a)])}for(let n of t.keys())c.servers.has(n)||i({file:e.path,server:n},`mcp-undeclared`)}return r}const gh={instructions:`nonstandard-instructions`,rule:`nonstandard-rule`,command:`nonstandard-command`,skill:`nonstandard-skill`,subagent:`nonstandard-subagent`};function _h(e){let t=/^---\n([\s\S]*?)\n---/.exec(e);if(!t)return!1;let n=/^globs:[ \t]*(.*)$/m.exec(t[1])?.[1]?.trim();return n!==void 0&&n.length>0&&n!==`[]`}function vh(e){return Yp(e).filter(e=>e.endsWith(`SKILL.md`))}function yh(e){try{return!i(e).isSymbolicLink()}catch{return!1}}function bh(e,t){let n=_(e,t.path);return yh(n)?t.shape===`file`?[t.path]:(t.kind===`skill`?vh(n):Yp(n)).map(e=>y.join(t.path,e)):[]}function xh({root:e,cli:t}){let n=[];for(let r of Xp)for(let i of r.project.nonstandard??[])for(let r of bh(e,i)){let a=i.kind===`rule`&&r.endsWith(`.mdc`)&&!_h(o(_(e,r),`utf8`))?`instructions`:i.kind,s=gh[a],{detail:c,repair:l}=pm(s);n.push({path:r,problem:s,detail:c,repair:l({file:r},t)})}return n.sort((e,t)=>e.path.localeCompare(t.path))}function Sh(e){return s(e,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort()}function Ch(e){try{return i(e),!0}catch{return!1}}function wh(e,t){try{return i(e).isSymbolicLink()?l(e)===l(t):!1}catch{return!1}}function Th(e){return a(e,{recursive:!0}),Sh(e).length}function Eh(e,t){return T()===`win32`?x(t):b(h(e),t)}function Dh(e){return e===`true`||e!==`false`&&e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function Oh(e,t,n){return x(e,n)===x(t)}function kh({root:e,canonicalSkills:t,harnesses:r,copy:i,force:o}){let s=r.filter(e=>e.project.skillsDirectory).map(t=>({harness:t,target:_(e,t.project.skillsDirectory)})),c=Array.isArray(o)?o:[],l=c.filter(t=>!s.some(({target:n})=>Oh(e,n,t)));if(l.length)throw Error(`No skill target matches:\n${l.map(e=>`- ${e}`).join(`
|
|
295
|
+
`)}\nTargets for the enabled harnesses:\n${s.map(({target:t})=>`- ${b(e,t)}`).join(`
|
|
296
|
+
`)}`);let d=t=>o===!0||c.some(n=>Oh(e,t,n)),p=s.filter(({target:e})=>Ch(e)&&!wh(e,t)).filter(({target:e})=>!d(e));if(p.length&&c.length===0)throw Error(`Refusing to replace existing skill targets:\n${p.map(({target:t})=>`- ${b(e,t)}`).join(`
|
|
297
|
+
`)}`);let m=new Set(p.map(({harness:e})=>e.name));for(let{harness:e,target:r}of s)if(!m.has(e.name)&&(a(h(r),{recursive:!0}),!wh(r,t))){if(Ch(r)&&u(r,{recursive:!0,force:!0}),i){n(t,r,{recursive:!0});continue}try{f(Eh(r,t),r,T()===`win32`?`junction`:void 0)}catch(e){if(Ch(r))throw e;n(t,r,{recursive:!0})}}return{linked:s.filter(({harness:e})=>!m.has(e.name)).map(({harness:e})=>e.name),skipped:s.filter(({harness:e})=>m.has(e.name)).map(({harness:e})=>e.name)}}const Ah=new Set([`node_modules`]);function jh(e){let t=[],n=i=>{r(_(e,i,`AGENTS.md`))&&t.push(i);let a;try{a=s(_(e,i),{withFileTypes:!0})}catch{return}for(let e of a)!e.isDirectory()||e.name.startsWith(`.`)||Ah.has(e.name)||n(i?y.join(i,e.name):e.name)};return n(``),t.sort()}const Mh=`AGENTS.md`;function Nh(e){let t;try{t=i(e)}catch{return{kind:`none`,status:`missing`,problem:`instructions-missing`}}return t.isSymbolicLink()?c(e)===`AGENTS.md`?{kind:`symlink`,status:`ok`}:{kind:`symlink`,status:`unbridged`,problem:`instructions-unbridged`}:o(e,`utf8`).split(`
|
|
298
|
+
`).some(e=>e.trim()===`@AGENTS.md`)?{kind:`import`,status:`ok`}:{kind:`file`,status:`unbridged`,problem:`instructions-unbridged`}}function Ph(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}function Fh(e,t){let n;try{n=o(e,`utf8`)}catch{return{kind:`none`,status:`missing`,problem:`instructions-missing`}}let r=ym(n);if(r===void 0)return{kind:`file`,status:`unreadable`,problem:`instructions-unreadable`};let i=Ph(r,t);return Array.isArray(i)&&i.includes(`AGENTS.md`)?{kind:`settings-entry`,status:`ok`}:{kind:`file`,status:`unbridged`,problem:`instructions-unbridged`}}function Ih(e,t){return t.kind===`import`?jh(e).map(e=>e?y.join(e,t.path):t.path):[t.path]}function Lh(e,t){return t.kind===`import`?Nh(e):Fh(e,t.key)}function Rh(e,t,n){let r=t.map(e=>({name:e.name,bridge:e.project.instructionBridge})).filter(e=>!!e.bridge),i=[],a=[];if(!r.length)return{instructions:i,findings:a};if(!jh(e).includes(``)){let{detail:e,repair:t}=pm(`no-instructions`);a.push({path:Mh,problem:`no-instructions`,detail:e,repair:t({file:Mh},n)})}for(let{name:t,bridge:o}of r)for(let r of Ih(e,o)){let s=Lh(_(e,r),o);if(i.push({harness:t,path:r,kind:s.kind,status:s.status}),s.problem){let{detail:e,repair:t}=pm(s.problem);a.push({path:r,problem:s.problem,detail:e,repair:t({file:r},n)})}}return{instructions:i,findings:a}}function zh(e,t,n){try{return E(`git`,t,{cwd:e,encoding:`utf8`,...n===void 0?{}:{input:n},stdio:[`pipe`,`pipe`,`pipe`]})}catch{return}}function Bh(e){return(e??``).split(`
|
|
299
|
+
`).filter(Boolean)}var Vh=class{root;prefix;constructor(e){this.root=e,this.prefix=zh(e,[`rev-parse`,`--show-prefix`])?.trim()}trackingOf(e){if(this.prefix===void 0)return`untracked`;let t=Bh(zh(this.root,[`ls-files`,`-v`,`--`,e]));return t.length?t.every(e=>e.startsWith(`S`))?`skip-worktree`:`tracked`:`untracked`}isIgnored(e){return this.prefix!==void 0&&zh(this.root,[`check-ignore`,`-q`,`--`,e])!==void 0}commitsTouching(e){return this.prefix===void 0?[]:Bh(zh(this.root,[`rev-list`,`-n`,`200`,`HEAD`,`--`,...e]))}contentAt(e,t){if(this.prefix!==void 0)return zh(this.root,[`show`,`${e}:${this.prefix}${t}`])}directionOf(e,t){if(this.prefix===void 0)return`unknown`;let n=this.lastAgreedTree(e,t);if(n===void 0)return`unknown`;let r=!this.matchesTree(e,n),i=!this.matchesTree(t,n);return r&&i?`both`:r?`bridge`:`canonical`}lastAgreedTree(e,t){for(let n of Bh(zh(this.root,[`rev-list`,`-n`,`200`,`HEAD`,`--`,e,t]))){let r=zh(this.root,[`rev-parse`,`-q`,`--verify`,`${n}:${this.prefix}${e}`])?.trim();if(r&&r===zh(this.root,[`rev-parse`,`-q`,`--verify`,`${n}:${this.prefix}${t}`])?.trim())return r}}matchesTree(e,t){let n=new Map(Bh(zh(this.root,[`ls-tree`,`-r`,t])).map(e=>{let[t,n]=e.split(` `);return[n,t.split(` `)[2]]})),r=Yp(_(this.root,e));if(r.length!==n.size||r.some(e=>!n.has(e)))return!1;let i=Bh(zh(this.root,[`hash-object`,`--stdin-paths`],r.map(t=>_(e,t)).join(`
|
|
300
|
+
`)));return i.length===r.length&&r.every((e,t)=>n.get(e)===i[t])}};const Hh=`.agents/skills`;function Uh(e){try{let t=i(e);return t.isSymbolicLink()?`symlink`:t.isDirectory()?`directory`:`file`}catch{return`missing`}}function Wh(e){try{return d(e).isDirectory()}catch{return!1}}function Gh(e,t){let n=Yp(e),r=Yp(t);return n.length===r.length&&n.every((n,i)=>r[i]===n&&o(_(e,n)).equals(o(_(t,n))))}function Kh(e,t,n,r){switch(Uh(e)){case`missing`:return{kind:`none`,status:`missing`,problem:`missing`};case`file`:return{kind:`file`,status:`degraded`,problem:`degraded`};case`symlink`:return wh(e,n)?{kind:`symlink`,status:`ok`}:{kind:`symlink`,status:`stale`,problem:`stale`};default:if(!Gh(e,n)){let e=r.directionOf(t,Hh);return{kind:`copy`,status:`diverged`,problem:`diverged-${e}`,direction:e}}return r.trackingOf(t)===`tracked`?{kind:`copy`,status:`ok`,problem:`unpinned-copy`}:{kind:`copy`,status:`ok`}}}function qh({root:e,harnesses:t=[],cli:n}){let r=_(e,`.agents`,`skills`),i=new Vh(e),a=nm(e,t),o=a.map(e=>({name:e.name,skillsDirectory:e.project.skillsDirectory})).filter(e=>!!e.skillsDirectory),s=[],c=[],l=[];if(!Wh(r)){let{detail:e,repair:t}=pm(`no-canonical`);l.push({path:Hh,problem:`no-canonical`,detail:e,repair:t({file:Hh},n)})}for(let t of o){let a=t.skillsDirectory,o=Kh(_(e,a),a,r,i);if(s.push({harness:t.name,path:a,kind:o.kind,status:o.status}),o.direction&&c.push({path:a,direction:o.direction}),o.problem){let{detail:e,repair:t}=pm(o.problem);l.push({path:a,problem:o.problem,detail:e,repair:t({file:a},n)})}}let u=Rh(e,a,n);return l.push(...u.findings),{bridges:s,instructions:u.instructions,divergence:c,findings:l}}function Jh(e,t,n=[]){let r=[...t.findings,...n];if(!r.length){let n=t.bridges.length+t.instructions.length,r=n===1?`the 1 bridge resolves`:`all ${n} bridges resolve`;return{bin:e,bridges:t.bridges,instructions:t.instructions,findings:`0 problems found — ${r} and the configuration around them is current`}}return{bin:e,bridges:t.bridges,instructions:t.instructions,...t.divergence.length?{divergence:t.divergence}:{},findings:r.map(({path:e,problem:t,detail:n})=>({path:e,problem:t,detail:n})),help:[...new Map(r.map(e=>[`${e.repair.command}\u0000${e.repair.instruction}`,e.repair])).values()]}}const Yh=Vi({name:`doctor`,description:`Report whether this repository's harness bridges still resolve — skills into .agents/skills, instructions into AGENTS.md. Read-only.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:X(ho())},harness:{description:`Comma-separated harnesses to check in addition to Claude Code and Cursor, e.g. codex,gemini-cli.`,type:X(ho())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:X(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=$p(e.harness),r=e.root??process.cwd(),i=qh({root:r,...n.length?{harnesses:n}:{},cli:im}),a=new Vh(r),o=[..._m({root:r,git:a,cli:im}),...hh({root:r,git:a,cli:im}),...xh({root:r,cli:im})];return pp(Jh(vp(w(),process.argv[1]),i,o),t),pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Harness diagnosis failed.`}\n`),pu.error}}});function Xh({root:e,harnesses:t=[],copy:n=!1,force:r=!1}){let i=_(e,`.agents`,`skills`),a=Th(i),o=nm(e,t),{linked:s,skipped:c}=kh({root:e,canonicalSkills:i,harnesses:o,copy:n,force:r});return{root:e,harnesses:o.map(e=>e.name),native:o.filter(e=>!e.project.skillsDirectory).map(e=>e.name),linked:s,skipped:c,deprecated:o.filter(e=>e.deprecated).map(e=>({name:e.name,replacedBy:e.deprecated})),skills:a,copied:n}}const Zh=Vi({name:`init`,description:`Set up canonical agent skills for the harnesses already enabled in a repository.`,options:{root:{description:`Repository or package directory. Defaults to the current directory.`,type:X(ho())},harness:{description:`Comma-separated harnesses to enable in addition to Claude Code and Cursor, e.g. codex,gemini-cli.`,type:X(ho())},copy:{description:`Copy skills instead of linking them.`,type:X(go())},force:{description:`Replace conflicting target skill directories. Names the targets to replace, comma-separated (e.g. .claude/skills); given alone it replaces every conflicting target.`,type:X(ho())},format:{description:`Output format: toon (default), json, or text for a human-readable report.`,type:X(ho()),default:`toon`}},run(e){try{let t=fp(e.format),n=$p(e.harness);return pp(Xh({root:e.root??process.cwd(),...n.length?{harnesses:n}:{},...e.copy===void 0?{}:{copy:e.copy},...e.force===void 0?{}:{force:Dh(e.force)}}),t),pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Harness initialization failed.`}\n`),pu.error}}});function Qh(){return rf({name:`buddy-agent-harness`,version:`0.9.1`,description:`Initialize agent harness skill compatibility in consumer repositories.`}).command(Zh).command(Yh).command(Jp)}async function $h(e){try{let t=await Qh().parse(e);return typeof t==`number`?t:pu.success}catch(e){return process.stderr.write(`error: ${e instanceof Error?e.message:`Invalid command.`}\n`),pu.usage}}const eg=await $h([...process.argv.slice(0,2),`init`,...process.argv.slice(2)]);eg!==0&&(process.exitCode=eg);export{};
|