zen-code 4.10.0 → 4.10.2

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.
Files changed (93) hide show
  1. package/dist/app.js +3 -3
  2. package/dist/chunk-0ddrb30y.js +1 -0
  3. package/dist/{chunk-gz7fz9fg.js → chunk-215an3fz.js} +1 -1
  4. package/dist/{chunk-5m4yb9av.js → chunk-40ht9pe1.js} +2 -2
  5. package/dist/{chunk-dx9k6sdd.js → chunk-4wnmk2tj.js} +1 -1
  6. package/dist/{chunk-e6ggkg36.js → chunk-4z0w0ng1.js} +1 -1
  7. package/dist/chunk-57bj89e2.js +1 -0
  8. package/dist/{chunk-54cdhhqm.js → chunk-5a5mepqj.js} +1 -1
  9. package/dist/{chunk-t0f66x64.js → chunk-5c3bpcpm.js} +1 -1
  10. package/dist/{chunk-8bs8r50r.js → chunk-7kw7ss8d.js} +1 -1
  11. package/dist/chunk-86m0rmtc.js +1 -0
  12. package/dist/{chunk-cef4vbtb.js → chunk-8f19qk9r.js} +1 -1
  13. package/dist/{chunk-yerf10k7.js → chunk-8tbtavry.js} +1 -1
  14. package/dist/{chunk-5yd4ntp6.js → chunk-9rayxazs.js} +2 -2
  15. package/dist/{chunk-1w19w1bm.js → chunk-a9gpb2tx.js} +1 -1
  16. package/dist/{chunk-d2770b2z.js → chunk-a9tw6d68.js} +1 -1
  17. package/dist/{chunk-r0cfe5c1.js → chunk-anbtppz1.js} +3 -3
  18. package/dist/chunk-bca8tkkr.js +1 -0
  19. package/dist/{chunk-bm7578sn.js → chunk-bdqds8vh.js} +1 -1
  20. package/dist/{chunk-gwf8b14k.js → chunk-bzgznka5.js} +1 -1
  21. package/dist/{chunk-1v863afn.js → chunk-c7kd2qrp.js} +3 -3
  22. package/dist/{chunk-vhn13anh.js → chunk-dvbb3dd1.js} +2 -2
  23. package/dist/{chunk-t01t72t2.js → chunk-e8kxa5vj.js} +2 -2
  24. package/dist/{chunk-7yzv6385.js → chunk-ehmmd8qc.js} +1 -1
  25. package/dist/{chunk-whdf0vbb.js → chunk-ejfa95sm.js} +1 -1
  26. package/dist/{chunk-hrcxdj3c.js → chunk-f0m4532p.js} +2 -2
  27. package/dist/{chunk-rtjytfhh.js → chunk-f7cps5x1.js} +1 -1
  28. package/dist/{chunk-7jatn15w.js → chunk-fbemqjck.js} +1 -1
  29. package/dist/{chunk-075hks9v.js → chunk-feeqtzv5.js} +1 -1
  30. package/dist/{chunk-8waww0j9.js → chunk-fzh0v6r0.js} +2 -2
  31. package/dist/{chunk-nm253hhf.js → chunk-g2zskge5.js} +2 -2
  32. package/dist/{chunk-875hayaj.js → chunk-g974hxbz.js} +1 -1
  33. package/dist/{chunk-4scrkcqv.js → chunk-g9911ymn.js} +1 -1
  34. package/dist/{chunk-bytq4kd1.js → chunk-gfhmzpy7.js} +2 -2
  35. package/dist/{chunk-wd3gkd45.js → chunk-gt8c6dne.js} +1 -1
  36. package/dist/{chunk-d72063sm.js → chunk-h8fdexm4.js} +1 -1
  37. package/dist/{chunk-k12y05c3.js → chunk-hnnwbfqk.js} +2 -2
  38. package/dist/{chunk-hz9yw7cs.js → chunk-hp2jzn9x.js} +2 -2
  39. package/dist/{chunk-arv4h3h1.js → chunk-hve2a279.js} +2 -2
  40. package/dist/{chunk-ws232ksq.js → chunk-js4qp900.js} +1 -1
  41. package/dist/{chunk-mv0xzmq8.js → chunk-k4q8j7pg.js} +1 -1
  42. package/dist/{chunk-kmxdq21k.js → chunk-m21hvv91.js} +1 -1
  43. package/dist/{chunk-prg6489q.js → chunk-mmx0k2yq.js} +1 -1
  44. package/dist/{chunk-3dnayvgx.js → chunk-mnnyjmgw.js} +2 -2
  45. package/dist/chunk-mw7x6xqp.js +1 -0
  46. package/dist/{chunk-0fj768k4.js → chunk-n7s6my89.js} +2 -2
  47. package/dist/{chunk-cnzhxgn5.js → chunk-n9rpnke9.js} +1 -1
  48. package/dist/{chunk-tn356gwf.js → chunk-nk62q95g.js} +2 -2
  49. package/dist/{chunk-n849zsd3.js → chunk-nmzx5nmt.js} +1 -1
  50. package/dist/{chunk-7w9y11hj.js → chunk-nqh1pptf.js} +1 -1
  51. package/dist/{chunk-qhzm2qw9.js → chunk-nsw5168d.js} +2 -2
  52. package/dist/{chunk-9tgp14v7.js → chunk-pe8mzxwn.js} +2 -2
  53. package/dist/{chunk-4hg13vwj.js → chunk-pg1ppq4y.js} +1 -1
  54. package/dist/{chunk-yzv3n8mw.js → chunk-pzb224c5.js} +1 -1
  55. package/dist/chunk-q1cxrg0x.js +2 -0
  56. package/dist/{chunk-k6fxqssr.js → chunk-qxebn3jw.js} +3 -3
  57. package/dist/{chunk-mm9w91rj.js → chunk-s1tbdcs8.js} +1 -1
  58. package/dist/{chunk-j4y5rjne.js → chunk-s5cqejr6.js} +1 -1
  59. package/dist/{chunk-qmxtys9q.js → chunk-spa69h7p.js} +1 -1
  60. package/dist/{chunk-znw7fpep.js → chunk-spx7nn8t.js} +2 -2
  61. package/dist/{chunk-wbm7rn9w.js → chunk-swc7se71.js} +1 -1
  62. package/dist/chunk-swyc15ym.js +1 -0
  63. package/dist/chunk-t2s3s6af.js +1 -0
  64. package/dist/{chunk-h0q3dvnv.js → chunk-t6440ajd.js} +2 -2
  65. package/dist/{chunk-vd8kwzra.js → chunk-tjg2e8v3.js} +2 -2
  66. package/dist/{chunk-d988tv30.js → chunk-tjvhqr94.js} +1 -1
  67. package/dist/{chunk-fjqtrakn.js → chunk-vbb3m0vz.js} +1 -1
  68. package/dist/{chunk-9czhw5k6.js → chunk-vdmq9d9x.js} +2 -2
  69. package/dist/{chunk-pxdgy0vr.js → chunk-vfxjbdz4.js} +1 -1
  70. package/dist/{chunk-mcb8rewr.js → chunk-vrnj0659.js} +2 -2
  71. package/dist/{chunk-6scjjkn3.js → chunk-wmyc17aa.js} +1 -1
  72. package/dist/{chunk-vnewbtjy.js → chunk-wt3p1w1g.js} +1 -1
  73. package/dist/{chunk-19mf2aa7.js → chunk-y5ry5c7v.js} +1 -1
  74. package/dist/{chunk-z3e4c424.js → chunk-y8qhrx11.js} +1 -1
  75. package/dist/{chunk-1mq2jmfy.js → chunk-yy8p9zph.js} +2 -2
  76. package/dist/chunk-z61m3anh.js +1 -0
  77. package/dist/{chunk-a239dn0b.js → chunk-zg54h6gy.js} +1 -1
  78. package/dist/chunk-zr90qp47.js +1 -0
  79. package/dist/{chunk-s7ttf0pm.js → chunk-zsa62xr0.js} +2 -2
  80. package/dist/cli.js +1 -1
  81. package/dist/nonInteractive.js +1 -1
  82. package/dist/zen-keyboard.js +1 -1
  83. package/package.json +1 -1
  84. package/dist/chunk-1vn8d8b8.js +0 -1
  85. package/dist/chunk-8ysg0rga.js +0 -1
  86. package/dist/chunk-b2551zfb.js +0 -2
  87. package/dist/chunk-b9emn03n.js +0 -1
  88. package/dist/chunk-c2wfgbj6.js +0 -1
  89. package/dist/chunk-gbfpab0j.js +0 -1
  90. package/dist/chunk-gkvx829z.js +0 -1
  91. package/dist/chunk-h0qb9jk1.js +0 -1
  92. package/dist/chunk-h9y136h8.js +0 -1
  93. package/dist/chunk-zq2g4rfd.js +0 -1
@@ -1,4 +1,4 @@
1
- import{vl as h}from"./chunk-vd8kwzra.js";import{Fl as yw,Hl as d,Kl as t}from"./chunk-z3e4c424.js";var G0=d((n1)=>{n1.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};n1.find=($,w)=>$.nodes.find((q)=>q.type===w);n1.exceedsLimit=($,w,q=1,J)=>{if(J===!1)return!1;if(!n1.isInteger($)||!n1.isInteger(w))return!1;return(Number(w)-Number($))/Number(q)>=J};n1.escapeNode=($,w=0,q)=>{let J=$.nodes[w];if(!J)return;if(q&&J.type===q||J.type==="open"||J.type==="close"){if(J.escaped!==!0)J.value="\\"+J.value,J.escaped=!0}};n1.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};n1.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};n1.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};n1.reduce=($)=>$.reduce((w,q)=>{if(q.type==="text")w.push(q.value);if(q.type==="range")q.type="text";return w},[]);n1.flatten=(...$)=>{let w=[],q=(J)=>{for(let f=0;f<J.length;f++){let Z=J[f];if(Array.isArray(Z)){q(Z);continue}if(Z!==void 0)w.push(Z)}return w};return q($),w}});var M0=d((jw,v0)=>{var d0=G0();v0.exports=($,w={})=>{let q=(J,f={})=>{let Z=w.escapeInvalid&&d0.isInvalidBrace(f),V=J.invalid===!0&&w.escapeInvalid===!0,F="";if(J.value){if((Z||V)&&d0.isOpenOrClose(J))return"\\"+J.value;return J.value}if(J.value)return J.value;if(J.nodes)for(let N of J.nodes)F+=q(N);return F};return q($)}});var l0=d((zw,m0)=>{/*!
1
+ import{tl as h}from"./chunk-tjg2e8v3.js";import{Dl as yw,Fl as d,Il as t}from"./chunk-y8qhrx11.js";var G0=d((n1)=>{n1.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};n1.find=($,w)=>$.nodes.find((q)=>q.type===w);n1.exceedsLimit=($,w,q=1,J)=>{if(J===!1)return!1;if(!n1.isInteger($)||!n1.isInteger(w))return!1;return(Number(w)-Number($))/Number(q)>=J};n1.escapeNode=($,w=0,q)=>{let J=$.nodes[w];if(!J)return;if(q&&J.type===q||J.type==="open"||J.type==="close"){if(J.escaped!==!0)J.value="\\"+J.value,J.escaped=!0}};n1.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};n1.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};n1.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};n1.reduce=($)=>$.reduce((w,q)=>{if(q.type==="text")w.push(q.value);if(q.type==="range")q.type="text";return w},[]);n1.flatten=(...$)=>{let w=[],q=(J)=>{for(let f=0;f<J.length;f++){let Z=J[f];if(Array.isArray(Z)){q(Z);continue}if(Z!==void 0)w.push(Z)}return w};return q($),w}});var M0=d((jw,v0)=>{var d0=G0();v0.exports=($,w={})=>{let q=(J,f={})=>{let Z=w.escapeInvalid&&d0.isInvalidBrace(f),V=J.invalid===!0&&w.escapeInvalid===!0,F="";if(J.value){if((Z||V)&&d0.isOpenOrClose(J))return"\\"+J.value;return J.value}if(J.value)return J.value;if(J.nodes)for(let N of J.nodes)F+=q(N);return F};return q($)}});var l0=d((zw,m0)=>{/*!
2
2
  * is-number <https://github.com/jonschlinkert/is-number>
3
3
  *
4
4
  * Copyright (c) 2014-present, Jon Schlinkert.
@@ -14,5 +14,5 @@ import{vl as h}from"./chunk-vd8kwzra.js";import{Fl as yw,Hl as d,Kl as t}from"./
14
14
  * Copyright (c) 2014-present, Jon Schlinkert.
15
15
  * Licensed under the MIT License.
16
16
  */var F$=t("util"),t0=e0(),o0=($)=>$!==null&&typeof $==="object"&&!Array.isArray($),U$=($)=>{return(w)=>$===!0?Number(w):String(w)},L0=($)=>{return typeof $==="number"||typeof $==="string"&&$!==""},Y0=($)=>Number.isInteger(+$),O0=($)=>{let w=`${$}`,q=-1;if(w[0]==="-")w=w.slice(1);if(w==="0")return!1;while(w[++q]==="0");return q>0},X$=($,w,q)=>{if(typeof $==="string"||typeof w==="string")return!0;return q.stringify===!0},Q$=($,w,q)=>{if(w>0){let J=$[0]==="-"?"-":"";if(J)$=$.slice(1);$=J+$.padStart(J?w-1:w,"0")}if(q===!1)return String($);return $},K0=($,w)=>{let q=$[0]==="-"?"-":"";if(q)$=$.slice(1),w--;while($.length<w)$="0"+$;return q?"-"+$:$},B$=($,w,q)=>{$.negatives.sort((F,N)=>F<N?-1:F>N?1:0),$.positives.sort((F,N)=>F<N?-1:F>N?1:0);let J=w.capture?"":"?:",f="",Z="",V;if($.positives.length)f=$.positives.map((F)=>K0(String(F),q)).join("|");if($.negatives.length)Z=`-(${J}${$.negatives.map((F)=>K0(String(F),q)).join("|")})`;if(f&&Z)V=`${f}|${Z}`;else V=f||Z;if(w.wrap)return`(${J}${V})`;return V},$1=($,w,q,J)=>{if(q)return t0($,w,{wrap:!1,...J});let f=String.fromCharCode($);if($===w)return f;let Z=String.fromCharCode(w);return`[${f}-${Z}]`},w1=($,w,q)=>{if(Array.isArray($)){let J=q.wrap===!0,f=q.capture?"":"?:";return J?`(${f}${$.join("|")})`:$.join("|")}return t0($,w,q)},q1=(...$)=>{return RangeError("Invalid range arguments: "+F$.inspect(...$))},J1=($,w,q)=>{if(q.strictRanges===!0)throw q1([$,w]);return[]},N$=($,w)=>{if(w.strictRanges===!0)throw TypeError(`Expected step "${$}" to be a number`);return[]},G$=($,w,q=1,J={})=>{let f=Number($),Z=Number(w);if(!Number.isInteger(f)||!Number.isInteger(Z)){if(J.strictRanges===!0)throw q1([$,w]);return[]}if(f===0)f=0;if(Z===0)Z=0;let V=f>Z,F=String($),N=String(w),K=String(q);q=Math.max(Math.abs(q),1);let B=O0(F)||O0(N)||O0(K),j=B?Math.max(F.length,N.length,K.length):0,X=B===!1&&X$($,w,J)===!1,H=J.transform||U$(X);if(J.toRegex&&q===1)return $1(K0($,j),K0(w,j),!0,J);let y={negatives:[],positives:[]},M=(u)=>y[u<0?"negatives":"positives"].push(Math.abs(u)),L=[],A=0;while(V?f>=Z:f<=Z){if(J.toRegex===!0&&q>1)M(f);else L.push(Q$(H(f,A),j,X));f=V?f-q:f+q,A++}if(J.toRegex===!0)return q>1?B$(y,J,j):w1(L,null,{wrap:!1,...J});return L},M$=($,w,q=1,J={})=>{if(!Y0($)&&$.length>1||!Y0(w)&&w.length>1)return J1($,w,J);let f=J.transform||((X)=>String.fromCharCode(X)),Z=`${$}`.charCodeAt(0),V=`${w}`.charCodeAt(0),F=Z>V,N=Math.min(Z,V),K=Math.max(Z,V);if(J.toRegex&&q===1)return $1(N,K,!1,J);let B=[],j=0;while(F?Z>=V:Z<=V)B.push(f(Z,j)),Z=F?Z-q:Z+q,j++;if(J.toRegex===!0)return w1(B,null,{wrap:!1,options:J});return B},y0=($,w,q,J={})=>{if(w==null&&L0($))return[$];if(!L0($)||!L0(w))return J1($,w,J);if(typeof q==="function")return y0($,w,1,{transform:q});if(o0(q))return y0($,w,0,q);let f={...J};if(f.capture===!0)f.wrap=!0;if(q=q||f.step||1,!Y0(q)){if(q!=null&&!o0(q))return N$(q,f);return y0($,w,1,q)}if(Y0($)&&Y0(w))return G$($,w,q,f);return M$($,w,Math.max(Math.abs(q),1),f)};f1.exports=y0});var Y1=d((Dw,Z1)=>{var y$=E0(),V1=G0(),K$=($,w={})=>{let q=(J,f={})=>{let Z=V1.isInvalidBrace(f),V=J.invalid===!0&&w.escapeInvalid===!0,F=Z===!0||V===!0,N=w.escapeInvalid===!0?"\\":"",K="";if(J.isOpen===!0)return N+J.value;if(J.isClose===!0)return console.log("node.isClose",N,J.value),N+J.value;if(J.type==="open")return F?N+J.value:"(";if(J.type==="close")return F?N+J.value:")";if(J.type==="comma")return J.prev.type==="comma"?"":F?J.value:"|";if(J.value)return J.value;if(J.nodes&&J.ranges>0){let B=V1.reduce(J.nodes),j=y$(...B,{...w,wrap:!1,toRegex:!0,strictZeros:!0});if(j.length!==0)return B.length>1&&j.length>1?`(${j})`:j}if(J.nodes)for(let B of J.nodes)K+=q(B,J);return K};return q($)};Z1.exports=K$});var U1=d((Hw,F1)=>{var j$=E0(),W1=M0(),V0=G0(),J0=($="",w="",q=!1)=>{let J=[];if($=[].concat($),w=[].concat(w),!w.length)return $;if(!$.length)return q?V0.flatten(w).map((f)=>`{${f}}`):w;for(let f of $)if(Array.isArray(f))for(let Z of f)J.push(J0(Z,w,q));else for(let Z of w){if(q===!0&&typeof Z==="string")Z=`{${Z}}`;J.push(Array.isArray(Z)?J0(f,Z,q):f+Z)}return V0.flatten(J)},z$=($,w={})=>{let q=w.rangeLimit===void 0?1000:w.rangeLimit,J=(f,Z={})=>{f.queue=[];let V=Z,F=Z.queue;while(V.type!=="brace"&&V.type!=="root"&&V.parent)V=V.parent,F=V.queue;if(f.invalid||f.dollar){F.push(J0(F.pop(),W1(f,w)));return}if(f.type==="brace"&&f.invalid!==!0&&f.nodes.length===2){F.push(J0(F.pop(),["{}"]));return}if(f.nodes&&f.ranges>0){let j=V0.reduce(f.nodes);if(V0.exceedsLimit(...j,w.step,q))throw RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let X=j$(...j,w);if(X.length===0)X=W1(f,w);F.push(J0(F.pop(),X)),f.nodes=[];return}let N=V0.encloseBrace(f),K=f.queue,B=f;while(B.type!=="brace"&&B.type!=="root"&&B.parent)B=B.parent,K=B.queue;for(let j=0;j<f.nodes.length;j++){let X=f.nodes[j];if(X.type==="comma"&&f.type==="brace"){if(j===1)K.push("");K.push("");continue}if(X.type==="close"){F.push(J0(F.pop(),K,N));continue}if(X.value&&X.type!=="open"){K.push(J0(K.pop(),X.value));continue}if(X.nodes)J(X,f)}return K};return V0.flatten(J($))};F1.exports=z$});var Q1=d((Pw,X1)=>{X1.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
17
- `,CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var y1=d((Lw,M1)=>{var I$=M0(),{MAX_LENGTH:B1,CHAR_BACKSLASH:R0,CHAR_BACKTICK:C$,CHAR_COMMA:D$,CHAR_DOT:H$,CHAR_LEFT_PARENTHESES:P$,CHAR_RIGHT_PARENTHESES:L$,CHAR_LEFT_CURLY_BRACE:O$,CHAR_RIGHT_CURLY_BRACE:E$,CHAR_LEFT_SQUARE_BRACKET:N1,CHAR_RIGHT_SQUARE_BRACKET:G1,CHAR_DOUBLE_QUOTE:R$,CHAR_SINGLE_QUOTE:_$,CHAR_NO_BREAK_SPACE:T$,CHAR_ZERO_WIDTH_NOBREAK_SPACE:A$}=Q1(),S$=($,w={})=>{if(typeof $!=="string")throw TypeError("Expected a string");let q=w||{},J=typeof q.maxLength==="number"?Math.min(B1,q.maxLength):B1;if($.length>J)throw SyntaxError(`Input length (${$.length}), exceeds max characters (${J})`);let f={type:"root",input:$,nodes:[]},Z=[f],V=f,F=f,N=0,K=$.length,B=0,j=0,X,H=()=>$[B++],y=(M)=>{if(M.type==="text"&&F.type==="dot")F.type="text";if(F&&F.type==="text"&&M.type==="text"){F.value+=M.value;return}return V.nodes.push(M),M.parent=V,M.prev=F,F=M,M};y({type:"bos"});while(B<K){if(V=Z[Z.length-1],X=H(),X===A$||X===T$)continue;if(X===R0){y({type:"text",value:(w.keepEscaping?X:"")+H()});continue}if(X===G1){y({type:"text",value:"\\"+X});continue}if(X===N1){N++;let M;while(B<K&&(M=H())){if(X+=M,M===N1){N++;continue}if(M===R0){X+=H();continue}if(M===G1){if(N--,N===0)break}}y({type:"text",value:X});continue}if(X===P$){V=y({type:"paren",nodes:[]}),Z.push(V),y({type:"text",value:X});continue}if(X===L$){if(V.type!=="paren"){y({type:"text",value:X});continue}V=Z.pop(),y({type:"text",value:X}),V=Z[Z.length-1];continue}if(X===R$||X===_$||X===C$){let M=X,L;if(w.keepQuotes!==!0)X="";while(B<K&&(L=H())){if(L===R0){X+=L+H();continue}if(L===M){if(w.keepQuotes===!0)X+=L;break}X+=L}y({type:"text",value:X});continue}if(X===O$){j++;let L={type:"brace",open:!0,close:!1,dollar:F.value&&F.value.slice(-1)==="$"||V.dollar===!0,depth:j,commas:0,ranges:0,nodes:[]};V=y(L),Z.push(V),y({type:"open",value:X});continue}if(X===E$){if(V.type!=="brace"){y({type:"text",value:X});continue}let M="close";V=Z.pop(),V.close=!0,y({type:M,value:X}),j--,V=Z[Z.length-1];continue}if(X===D$&&j>0){if(V.ranges>0){V.ranges=0;let M=V.nodes.shift();V.nodes=[M,{type:"text",value:I$(V)}]}y({type:"comma",value:X}),V.commas++;continue}if(X===H$&&j>0&&V.commas===0){let M=V.nodes;if(j===0||M.length===0){y({type:"text",value:X});continue}if(F.type==="dot"){if(V.range=[],F.value+=X,F.type="range",V.nodes.length!==3&&V.nodes.length!==5){V.invalid=!0,V.ranges=0,F.type="text";continue}V.ranges++,V.args=[];continue}if(F.type==="range"){M.pop();let L=M[M.length-1];L.value+=F.value+X,F=L,V.ranges--;continue}y({type:"dot",value:X});continue}y({type:"text",value:X})}do if(V=Z.pop(),V.type!=="root"){V.nodes.forEach((A)=>{if(!A.nodes){if(A.type==="open")A.isOpen=!0;if(A.type==="close")A.isClose=!0;if(!A.nodes)A.type="text";A.invalid=!0}});let M=Z[Z.length-1],L=M.nodes.indexOf(V);M.nodes.splice(L,1,...V.nodes)}while(Z.length>0);return y({type:"eos"}),f};M1.exports=S$});var z1=d((Ow,j1)=>{var K1=M0(),x$=Y1(),g$=U1(),h$=y1(),r=($,w={})=>{let q=[];if(Array.isArray($))for(let J of $){let f=r.create(J,w);if(Array.isArray(f))q.push(...f);else q.push(f)}else q=[].concat(r.create($,w));if(w&&w.expand===!0&&w.nodupes===!0)q=[...new Set(q)];return q};r.parse=($,w={})=>h$($,w);r.stringify=($,w={})=>{if(typeof $==="string")return K1(r.parse($,w),w);return K1($,w)};r.compile=($,w={})=>{if(typeof $==="string")$=r.parse($,w);return x$($,w)};r.expand=($,w={})=>{if(typeof $==="string")$=r.parse($,w);let q=g$($,w);if(w.noempty===!0)q=q.filter(Boolean);if(w.nodupes===!0)q=[...new Set(q)];return q};r.create=($,w={})=>{if($===""||$.length<3)return[$];return w.expand!==!0?r.compile($,w):r.expand($,w)};j1.exports=r});var W0=d((Ew,C1)=>{var k$=t("path"),I1={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},b$={...I1,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},d$={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};C1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:d$,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:k$.sep,extglobChars($){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${$.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars($){return $===!0?b$:I1}}});var F0=d((i$)=>{var v$=t("path"),m$=process.platform==="win32",{REGEX_BACKSLASH:l$,REGEX_REMOVE_BACKSLASH:u$,REGEX_SPECIAL_CHARS:c$,REGEX_SPECIAL_CHARS_GLOBAL:r$}=W0();i$.isObject=($)=>$!==null&&typeof $==="object"&&!Array.isArray($);i$.hasRegexChars=($)=>c$.test($);i$.isRegexChar=($)=>$.length===1&&i$.hasRegexChars($);i$.escapeRegex=($)=>$.replace(r$,"\\$1");i$.toPosixSlashes=($)=>$.replace(l$,"/");i$.removeBackslashes=($)=>{return $.replace(u$,(w)=>{return w==="\\"?"":w})};i$.supportsLookbehinds=()=>{let $=process.version.slice(1).split(".").map(Number);if($.length===3&&$[0]>=9||$[0]===8&&$[1]>=10)return!0;return!1};i$.isWindows=($)=>{if($&&typeof $.windows==="boolean")return $.windows;return m$===!0||v$.sep==="\\"};i$.escapeLast=($,w,q)=>{let J=$.lastIndexOf(w,q);if(J===-1)return $;if($[J-1]==="\\")return i$.escapeLast($,w,J-1);return`${$.slice(0,J)}\\${$.slice(J)}`};i$.removePrefix=($,w={})=>{let q=$;if(q.startsWith("./"))q=q.slice(2),w.prefix="./";return q};i$.wrapOutput=($,w={},q={})=>{let J=q.contains?"":"^",f=q.contains?"":"$",Z=`${J}(?:${$})${f}`;if(w.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z}});var A1=d((_w,T1)=>{var P1=F0(),{CHAR_ASTERISK:_0,CHAR_AT:qw,CHAR_BACKWARD_SLASH:U0,CHAR_COMMA:Jw,CHAR_DOT:T0,CHAR_EXCLAMATION_MARK:A0,CHAR_FORWARD_SLASH:_1,CHAR_LEFT_CURLY_BRACE:S0,CHAR_LEFT_PARENTHESES:x0,CHAR_LEFT_SQUARE_BRACKET:fw,CHAR_PLUS:Vw,CHAR_QUESTION_MARK:L1,CHAR_RIGHT_CURLY_BRACE:Zw,CHAR_RIGHT_PARENTHESES:O1,CHAR_RIGHT_SQUARE_BRACKET:Yw}=W0(),E1=($)=>{return $===_1||$===U0},R1=($)=>{if($.isPrefix!==!0)$.depth=$.isGlobstar?1/0:1},Ww=($,w)=>{let q=w||{},J=$.length-1,f=q.parts===!0||q.scanToEnd===!0,Z=[],V=[],F=[],N=$,K=-1,B=0,j=0,X=!1,H=!1,y=!1,M=!1,L=!1,A=!1,u=!1,S=!1,n=!1,b=!1,e=0,v,z,P={value:"",depth:0,isGlob:!1},k=()=>K>=J,U=()=>N.charCodeAt(K+1),_=()=>{return v=z,N.charCodeAt(++K)};while(K<J){z=_();let m;if(z===U0){if(u=P.backslashes=!0,z=_(),z===S0)A=!0;continue}if(A===!0||z===S0){e++;while(k()!==!0&&(z=_())){if(z===U0){u=P.backslashes=!0,_();continue}if(z===S0){e++;continue}if(A!==!0&&z===T0&&(z=_())===T0){if(X=P.isBrace=!0,y=P.isGlob=!0,b=!0,f===!0)continue;break}if(A!==!0&&z===Jw){if(X=P.isBrace=!0,y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===Zw){if(e--,e===0){A=!1,X=P.isBrace=!0,b=!0;break}}}if(f===!0)continue;break}if(z===_1){if(Z.push(K),V.push(P),P={value:"",depth:0,isGlob:!1},b===!0)continue;if(v===T0&&K===B+1){B+=2;continue}j=K+1;continue}if(q.noext!==!0){if((z===Vw||z===qw||z===_0||z===L1||z===A0)===!0&&U()===x0){if(y=P.isGlob=!0,M=P.isExtglob=!0,b=!0,z===A0&&K===B)n=!0;if(f===!0){while(k()!==!0&&(z=_())){if(z===U0){u=P.backslashes=!0,z=_();continue}if(z===O1){y=P.isGlob=!0,b=!0;break}}continue}break}}if(z===_0){if(v===_0)L=P.isGlobstar=!0;if(y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===L1){if(y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===fw){while(k()!==!0&&(m=_())){if(m===U0){u=P.backslashes=!0,_();continue}if(m===Yw){H=P.isBracket=!0,y=P.isGlob=!0,b=!0;break}}if(f===!0)continue;break}if(q.nonegate!==!0&&z===A0&&K===B){S=P.negated=!0,B++;continue}if(q.noparen!==!0&&z===x0){if(y=P.isGlob=!0,f===!0){while(k()!==!0&&(z=_())){if(z===x0){u=P.backslashes=!0,z=_();continue}if(z===O1){b=!0;break}}continue}break}if(y===!0){if(b=!0,f===!0)continue;break}}if(q.noext===!0)M=!1,y=!1;let O=N,o="",Y="";if(B>0)o=N.slice(0,B),N=N.slice(B),j-=B;if(O&&y===!0&&j>0)O=N.slice(0,j),Y=N.slice(j);else if(y===!0)O="",Y=N;else O=N;if(O&&O!==""&&O!=="/"&&O!==N){if(E1(O.charCodeAt(O.length-1)))O=O.slice(0,-1)}if(q.unescape===!0){if(Y)Y=P1.removeBackslashes(Y);if(O&&u===!0)O=P1.removeBackslashes(O)}let W={prefix:o,input:$,start:B,base:O,glob:Y,isBrace:X,isBracket:H,isGlob:y,isExtglob:M,isGlobstar:L,negated:S,negatedExtglob:n};if(q.tokens===!0){if(W.maxDepth=0,!E1(z))V.push(P);W.tokens=V}if(q.parts===!0||q.tokens===!0){let m;for(let D=0;D<Z.length;D++){let p=m?m+1:B,a=Z[D],c=$.slice(p,a);if(q.tokens){if(D===0&&B!==0)V[D].isPrefix=!0,V[D].value=o;else V[D].value=c;R1(V[D]),W.maxDepth+=V[D].depth}if(D!==0||c!=="")F.push(c);m=a}if(m&&m+1<$.length){let D=$.slice(m+1);if(F.push(D),q.tokens)V[V.length-1].value=D,R1(V[V.length-1]),W.maxDepth+=V[V.length-1].depth}W.slashes=Z,W.parts=F}return W};T1.exports=Ww});var g1=d((Tw,x1)=>{var j0=W0(),i=F0(),{MAX_LENGTH:z0,POSIX_REGEX_SOURCE:Fw,REGEX_NON_SPECIAL_CHARS:Uw,REGEX_SPECIAL_CHARS_BACKREF:Xw,REPLACEMENTS:S1}=j0,Qw=($,w)=>{if(typeof w.expandRange==="function")return w.expandRange(...$,w);$.sort();let q=`[${$.join("-")}]`;try{new RegExp(q)}catch(J){return $.map((f)=>i.escapeRegex(f)).join("..")}return q},Z0=($,w)=>{return`Missing ${$}: "${w}" - use "\\\\${w}" to match literal characters`},g0=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");$=S1[$]||$;let q={...w},J=typeof q.maxLength==="number"?Math.min(z0,q.maxLength):z0,f=$.length;if(f>J)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${J}`);let Z={type:"bos",value:"",output:q.prepend||""},V=[Z],F=q.capture?"":"?:",N=i.isWindows(w),K=j0.globChars(N),B=j0.extglobChars(K),{DOT_LITERAL:j,PLUS_LITERAL:X,SLASH_LITERAL:H,ONE_CHAR:y,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:u,QMARK:S,QMARK_NO_DOT:n,STAR:b,START_ANCHOR:e}=K,v=(G)=>{return`(${F}(?:(?!${e}${G.dot?M:j}).)*?)`},z=q.dot?"":L,P=q.dot?S:n,k=q.bash===!0?v(q):b;if(q.capture)k=`(${k})`;if(typeof q.noext==="boolean")q.noextglob=q.noext;let U={input:$,index:-1,start:0,dot:q.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};$=i.removePrefix($,U),f=$.length;let _=[],O=[],o=[],Y=Z,W,m=()=>U.index===f-1,D=U.peek=(G=1)=>$[U.index+G],p=U.advance=()=>$[++U.index]||"",a=()=>$.slice(U.index+1),c=(G="",E=0)=>{U.consumed+=G,U.index+=E},X0=(G)=>{U.output+=G.output!=null?G.output:G.value,c(G.value)},r1=()=>{let G=1;while(D()==="!"&&(D(2)!=="("||D(3)==="?"))p(),U.start++,G++;if(G%2===0)return!1;return U.negated=!0,U.start++,!0},Q0=(G)=>{U[G]++,o.push(G)},w0=(G)=>{U[G]--,o.pop()},C=(G)=>{if(Y.type==="globstar"){let E=U.braces>0&&(G.type==="comma"||G.type==="brace"),Q=G.extglob===!0||_.length&&(G.type==="pipe"||G.type==="paren");if(G.type!=="slash"&&G.type!=="paren"&&!E&&!Q)U.output=U.output.slice(0,-Y.output.length),Y.type="star",Y.value="*",Y.output=k,U.output+=Y.output}if(_.length&&G.type!=="paren")_[_.length-1].inner+=G.value;if(G.value||G.output)X0(G);if(Y&&Y.type==="text"&&G.type==="text"){Y.value+=G.value,Y.output=(Y.output||"")+G.value;return}G.prev=Y,V.push(G),Y=G},B0=(G,E)=>{let Q={...B[E],conditions:1,inner:""};Q.prev=Y,Q.parens=U.parens,Q.output=U.output;let I=(q.capture?"(":"")+Q.open;Q0("parens"),C({type:G,value:E,output:U.output?"":y}),C({type:"paren",extglob:!0,value:p(),output:I}),_.push(Q)},i1=(G)=>{let E=G.close+(q.capture?")":""),Q;if(G.type==="negate"){let I=k;if(G.inner&&G.inner.length>1&&G.inner.includes("/"))I=v(q);if(I!==k||m()||/^\)+$/.test(a()))E=G.close=`)$))${I}`;if(G.inner.includes("*")&&(Q=a())&&/^\.[^\\/.]+$/.test(Q)){let T=g0(Q,{...w,fastpaths:!1}).output;E=G.close=`)${T})${I})`}if(G.prev.type==="bos")U.negatedExtglob=!0}C({type:"paren",extglob:!0,value:W,output:E}),w0("parens")};if(q.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test($)){let G=!1,E=$.replace(Xw,(Q,I,T,l,g,D0)=>{if(l==="\\")return G=!0,Q;if(l==="?"){if(I)return I+l+(g?S.repeat(g.length):"");if(D0===0)return P+(g?S.repeat(g.length):"");return S.repeat(T.length)}if(l===".")return j.repeat(T.length);if(l==="*"){if(I)return I+l+(g?k:"");return k}return I?Q:`\\${Q}`});if(G===!0)if(q.unescape===!0)E=E.replace(/\\/g,"");else E=E.replace(/\\+/g,(Q)=>{return Q.length%2===0?"\\\\":Q?"\\":""});if(E===$&&q.contains===!0)return U.output=$,U;return U.output=i.wrapOutput(E,U,w),U}while(!m()){if(W=p(),W==="\x00")continue;if(W==="\\"){let Q=D();if(Q==="/"&&q.bash!==!0)continue;if(Q==="."||Q===";")continue;if(!Q){W+="\\",C({type:"text",value:W});continue}let I=/^\\+/.exec(a()),T=0;if(I&&I[0].length>2){if(T=I[0].length,U.index+=T,T%2!==0)W+="\\"}if(q.unescape===!0)W=p();else W+=p();if(U.brackets===0){C({type:"text",value:W});continue}}if(U.brackets>0&&(W!=="]"||Y.value==="["||Y.value==="[^")){if(q.posix!==!1&&W===":"){let Q=Y.value.slice(1);if(Q.includes("[")){if(Y.posix=!0,Q.includes(":")){let I=Y.value.lastIndexOf("["),T=Y.value.slice(0,I),l=Y.value.slice(I+2),g=Fw[l];if(g){if(Y.value=T+g,U.backtrack=!0,p(),!Z.output&&V.indexOf(Y)===1)Z.output=y;continue}}}}if(W==="["&&D()!==":"||W==="-"&&D()==="]")W=`\\${W}`;if(W==="]"&&(Y.value==="["||Y.value==="[^"))W=`\\${W}`;if(q.posix===!0&&W==="!"&&Y.value==="[")W="^";Y.value+=W,X0({value:W});continue}if(U.quotes===1&&W!=='"'){W=i.escapeRegex(W),Y.value+=W,X0({value:W});continue}if(W==='"'){if(U.quotes=U.quotes===1?0:1,q.keepQuotes===!0)C({type:"text",value:W});continue}if(W==="("){Q0("parens"),C({type:"paren",value:W});continue}if(W===")"){if(U.parens===0&&q.strictBrackets===!0)throw SyntaxError(Z0("opening","("));let Q=_[_.length-1];if(Q&&U.parens===Q.parens+1){i1(_.pop());continue}C({type:"paren",value:W,output:U.parens?")":"\\)"}),w0("parens");continue}if(W==="["){if(q.nobracket===!0||!a().includes("]")){if(q.nobracket!==!0&&q.strictBrackets===!0)throw SyntaxError(Z0("closing","]"));W=`\\${W}`}else Q0("brackets");C({type:"bracket",value:W});continue}if(W==="]"){if(q.nobracket===!0||Y&&Y.type==="bracket"&&Y.value.length===1){C({type:"text",value:W,output:`\\${W}`});continue}if(U.brackets===0){if(q.strictBrackets===!0)throw SyntaxError(Z0("opening","["));C({type:"text",value:W,output:`\\${W}`});continue}w0("brackets");let Q=Y.value.slice(1);if(Y.posix!==!0&&Q[0]==="^"&&!Q.includes("/"))W=`/${W}`;if(Y.value+=W,X0({value:W}),q.literalBrackets===!1||i.hasRegexChars(Q))continue;let I=i.escapeRegex(Y.value);if(U.output=U.output.slice(0,-Y.value.length),q.literalBrackets===!0){U.output+=I,Y.value=I;continue}Y.value=`(${F}${I}|${Y.value})`,U.output+=Y.value;continue}if(W==="{"&&q.nobrace!==!0){Q0("braces");let Q={type:"brace",value:W,output:"(",outputIndex:U.output.length,tokensIndex:U.tokens.length};O.push(Q),C(Q);continue}if(W==="}"){let Q=O[O.length-1];if(q.nobrace===!0||!Q){C({type:"text",value:W,output:W});continue}let I=")";if(Q.dots===!0){let T=V.slice(),l=[];for(let g=T.length-1;g>=0;g--){if(V.pop(),T[g].type==="brace")break;if(T[g].type!=="dots")l.unshift(T[g].value)}I=Qw(l,q),U.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){let T=U.output.slice(0,Q.outputIndex),l=U.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",W=I="\\}",U.output=T;for(let g of l)U.output+=g.output||g.value}C({type:"brace",value:W,output:I}),w0("braces"),O.pop();continue}if(W==="|"){if(_.length>0)_[_.length-1].conditions++;C({type:"text",value:W});continue}if(W===","){let Q=W,I=O[O.length-1];if(I&&o[o.length-1]==="braces")I.comma=!0,Q="|";C({type:"comma",value:W,output:Q});continue}if(W==="/"){if(Y.type==="dot"&&U.index===U.start+1){U.start=U.index+1,U.consumed="",U.output="",V.pop(),Y=Z;continue}C({type:"slash",value:W,output:H});continue}if(W==="."){if(U.braces>0&&Y.type==="dot"){if(Y.value===".")Y.output=j;let Q=O[O.length-1];Y.type="dots",Y.output+=W,Y.value+=W,Q.dots=!0;continue}if(U.braces+U.parens===0&&Y.type!=="bos"&&Y.type!=="slash"){C({type:"text",value:W,output:j});continue}C({type:"dot",value:W,output:j});continue}if(W==="?"){if(!(Y&&Y.value==="(")&&q.noextglob!==!0&&D()==="("&&D(2)!=="?"){B0("qmark",W);continue}if(Y&&Y.type==="paren"){let I=D(),T=W;if(I==="<"&&!i.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");if(Y.value==="("&&!/[!=<:]/.test(I)||I==="<"&&!/<([!=]|\w+>)/.test(a()))T=`\\${W}`;C({type:"text",value:W,output:T});continue}if(q.dot!==!0&&(Y.type==="slash"||Y.type==="bos")){C({type:"qmark",value:W,output:n});continue}C({type:"qmark",value:W,output:S});continue}if(W==="!"){if(q.noextglob!==!0&&D()==="("){if(D(2)!=="?"||!/[!=<:]/.test(D(3))){B0("negate",W);continue}}if(q.nonegate!==!0&&U.index===0){r1();continue}}if(W==="+"){if(q.noextglob!==!0&&D()==="("&&D(2)!=="?"){B0("plus",W);continue}if(Y&&Y.value==="("||q.regex===!1){C({type:"plus",value:W,output:X});continue}if(Y&&(Y.type==="bracket"||Y.type==="paren"||Y.type==="brace")||U.parens>0){C({type:"plus",value:W});continue}C({type:"plus",value:X});continue}if(W==="@"){if(q.noextglob!==!0&&D()==="("&&D(2)!=="?"){C({type:"at",extglob:!0,value:W,output:""});continue}C({type:"text",value:W});continue}if(W!=="*"){if(W==="$"||W==="^")W=`\\${W}`;let Q=Uw.exec(a());if(Q)W+=Q[0],U.index+=Q[0].length;C({type:"text",value:W});continue}if(Y&&(Y.type==="globstar"||Y.star===!0)){Y.type="star",Y.star=!0,Y.value+=W,Y.output=k,U.backtrack=!0,U.globstar=!0,c(W);continue}let G=a();if(q.noextglob!==!0&&/^\([^?]/.test(G)){B0("star",W);continue}if(Y.type==="star"){if(q.noglobstar===!0){c(W);continue}let Q=Y.prev,I=Q.prev,T=Q.type==="slash"||Q.type==="bos",l=I&&(I.type==="star"||I.type==="globstar");if(q.bash===!0&&(!T||G[0]&&G[0]!=="/")){C({type:"star",value:W,output:""});continue}let g=U.braces>0&&(Q.type==="comma"||Q.type==="brace"),D0=_.length&&(Q.type==="pipe"||Q.type==="paren");if(!T&&Q.type!=="paren"&&!g&&!D0){C({type:"star",value:W,output:""});continue}while(G.slice(0,3)==="/**"){let N0=$[U.index+4];if(N0&&N0!=="/")break;G=G.slice(3),c("/**",3)}if(Q.type==="bos"&&m()){Y.type="globstar",Y.value+=W,Y.output=v(q),U.output=Y.output,U.globstar=!0,c(W);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!l&&m()){U.output=U.output.slice(0,-(Q.output+Y.output).length),Q.output=`(?:${Q.output}`,Y.type="globstar",Y.output=v(q)+(q.strictSlashes?")":"|$)"),Y.value+=W,U.globstar=!0,U.output+=Q.output+Y.output,c(W);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&G[0]==="/"){let N0=G[1]!==void 0?"|$":"";U.output=U.output.slice(0,-(Q.output+Y.output).length),Q.output=`(?:${Q.output}`,Y.type="globstar",Y.output=`${v(q)}${H}|${H}${N0})`,Y.value+=W,U.output+=Q.output+Y.output,U.globstar=!0,c(W+p()),C({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&G[0]==="/"){Y.type="globstar",Y.value+=W,Y.output=`(?:^|${H}|${v(q)}${H})`,U.output=Y.output,U.globstar=!0,c(W+p()),C({type:"slash",value:"/",output:""});continue}U.output=U.output.slice(0,-Y.output.length),Y.type="globstar",Y.output=v(q),Y.value+=W,U.output+=Y.output,U.globstar=!0,c(W);continue}let E={type:"star",value:W,output:k};if(q.bash===!0){if(E.output=".*?",Y.type==="bos"||Y.type==="slash")E.output=z+E.output;C(E);continue}if(Y&&(Y.type==="bracket"||Y.type==="paren")&&q.regex===!0){E.output=W,C(E);continue}if(U.index===U.start||Y.type==="slash"||Y.type==="dot"){if(Y.type==="dot")U.output+=A,Y.output+=A;else if(q.dot===!0)U.output+=u,Y.output+=u;else U.output+=z,Y.output+=z;if(D()!=="*")U.output+=y,Y.output+=y}C(E)}while(U.brackets>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing","]"));U.output=i.escapeLast(U.output,"["),w0("brackets")}while(U.parens>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing",")"));U.output=i.escapeLast(U.output,"("),w0("parens")}while(U.braces>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing","}"));U.output=i.escapeLast(U.output,"{"),w0("braces")}if(q.strictSlashes!==!0&&(Y.type==="star"||Y.type==="bracket"))C({type:"maybe_slash",value:"",output:`${H}?`});if(U.backtrack===!0){U.output="";for(let G of U.tokens)if(U.output+=G.output!=null?G.output:G.value,G.suffix)U.output+=G.suffix}return U};g0.fastpaths=($,w)=>{let q={...w},J=typeof q.maxLength==="number"?Math.min(z0,q.maxLength):z0,f=$.length;if(f>J)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${J}`);$=S1[$]||$;let Z=i.isWindows(w),{DOT_LITERAL:V,SLASH_LITERAL:F,ONE_CHAR:N,DOTS_SLASH:K,NO_DOT:B,NO_DOTS:j,NO_DOTS_SLASH:X,STAR:H,START_ANCHOR:y}=j0.globChars(Z),M=q.dot?j:B,L=q.dot?X:B,A=q.capture?"":"?:",u={negated:!1,prefix:""},S=q.bash===!0?".*?":H;if(q.capture)S=`(${S})`;let n=(z)=>{if(z.noglobstar===!0)return S;return`(${A}(?:(?!${y}${z.dot?K:V}).)*?)`},b=(z)=>{switch(z){case"*":return`${M}${N}${S}`;case".*":return`${V}${N}${S}`;case"*.*":return`${M}${S}${V}${N}${S}`;case"*/*":return`${M}${S}${F}${N}${L}${S}`;case"**":return M+n(q);case"**/*":return`(?:${M}${n(q)}${F})?${L}${N}${S}`;case"**/*.*":return`(?:${M}${n(q)}${F})?${L}${S}${V}${N}${S}`;case"**/.*":return`(?:${M}${n(q)}${F})?${V}${N}${S}`;default:{let P=/^(.*?)\.(\w+)$/.exec(z);if(!P)return;let k=b(P[1]);if(!k)return;return k+V+P[2]}}},e=i.removePrefix($,u),v=b(e);if(v&&q.strictSlashes!==!0)v+=`${F}?`;return v};x1.exports=g0});var k1=d((Aw,h1)=>{var Bw=t("path"),Nw=A1(),h0=g1(),k0=F0(),Gw=W0(),Mw=($)=>$&&typeof $==="object"&&!Array.isArray($),x=($,w,q=!1)=>{if(Array.isArray($)){let B=$.map((X)=>x(X,w,q));return(X)=>{for(let H of B){let y=H(X);if(y)return y}return!1}}let J=Mw($)&&$.tokens&&$.input;if($===""||typeof $!=="string"&&!J)throw TypeError("Expected pattern to be a non-empty string");let f=w||{},Z=k0.isWindows(w),V=J?x.compileRe($,w):x.makeRe($,w,!1,!0),F=V.state;delete V.state;let N=()=>!1;if(f.ignore){let B={...w,ignore:null,onMatch:null,onResult:null};N=x(f.ignore,B,q)}let K=(B,j=!1)=>{let{isMatch:X,match:H,output:y}=x.test(B,V,w,{glob:$,posix:Z}),M={glob:$,state:F,regex:V,posix:Z,input:B,output:y,match:H,isMatch:X};if(typeof f.onResult==="function")f.onResult(M);if(X===!1)return M.isMatch=!1,j?M:!1;if(N(B)){if(typeof f.onIgnore==="function")f.onIgnore(M);return M.isMatch=!1,j?M:!1}if(typeof f.onMatch==="function")f.onMatch(M);return j?M:!0};if(q)K.state=F;return K};x.test=($,w,q,{glob:J,posix:f}={})=>{if(typeof $!=="string")throw TypeError("Expected input to be a string");if($==="")return{isMatch:!1,output:""};let Z=q||{},V=Z.format||(f?k0.toPosixSlashes:null),F=$===J,N=F&&V?V($):$;if(F===!1)N=V?V($):$,F=N===J;if(F===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)F=x.matchBase($,w,q,f);else F=w.exec(N);return{isMatch:Boolean(F),match:F,output:N}};x.matchBase=($,w,q,J=k0.isWindows(q))=>{return(w instanceof RegExp?w:x.makeRe(w,q)).test(Bw.basename($))};x.isMatch=($,w,q)=>x(w,q)($);x.parse=($,w)=>{if(Array.isArray($))return $.map((q)=>x.parse(q,w));return h0($,{...w,fastpaths:!1})};x.scan=($,w)=>Nw($,w);x.compileRe=($,w,q=!1,J=!1)=>{if(q===!0)return $.output;let f=w||{},Z=f.contains?"":"^",V=f.contains?"":"$",F=`${Z}(?:${$.output})${V}`;if($&&$.negated===!0)F=`^(?!${F}).*$`;let N=x.toRegex(F,w);if(J===!0)N.state=$;return N};x.makeRe=($,w={},q=!1,J=!1)=>{if(!$||typeof $!=="string")throw TypeError("Expected a non-empty string");let f={negated:!1,fastpaths:!0};if(w.fastpaths!==!1&&($[0]==="."||$[0]==="*"))f.output=h0.fastpaths($,w);if(!f.output)f=h0($,w);return x.compileRe(f,w,q,J)};x.toRegex=($,w)=>{try{let q=w||{};return new RegExp($,q.flags||(q.nocase?"i":""))}catch(q){if(w&&w.debug===!0)throw q;return/$^/}};x.constants=Gw;h1.exports=x});var u1=d((Sw,l1)=>{var d1=t("util"),v1=z1(),s=k1(),b0=F0(),b1=($)=>$===""||$==="./",m1=($)=>{let w=$.indexOf("{");return w>-1&&$.indexOf("}",w)>-1},R=($,w,q)=>{w=[].concat(w),$=[].concat($);let J=new Set,f=new Set,Z=new Set,V=0,F=(B)=>{if(Z.add(B.output),q&&q.onResult)q.onResult(B)};for(let B=0;B<w.length;B++){let j=s(String(w[B]),{...q,onResult:F},!0),X=j.state.negated||j.state.negatedExtglob;if(X)V++;for(let H of $){let y=j(H,!0);if(!(X?!y.isMatch:y.isMatch))continue;if(X)J.add(y.output);else J.delete(y.output),f.add(y.output)}}let K=(V===w.length?[...Z]:[...f]).filter((B)=>!J.has(B));if(q&&K.length===0){if(q.failglob===!0)throw Error(`No matches found for "${w.join(", ")}"`);if(q.nonull===!0||q.nullglob===!0)return q.unescape?w.map((B)=>B.replace(/\\/g,"")):w}return K};R.match=R;R.matcher=($,w)=>s($,w);R.isMatch=($,w,q)=>s(w,q)($);R.any=R.isMatch;R.not=($,w,q={})=>{w=[].concat(w).map(String);let J=new Set,f=[],V=new Set(R($,w,{...q,onResult:(F)=>{if(q.onResult)q.onResult(F);f.push(F.output)}}));for(let F of f)if(!V.has(F))J.add(F);return[...J]};R.contains=($,w,q)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${d1.inspect($)}"`);if(Array.isArray(w))return w.some((J)=>R.contains($,J,q));if(typeof w==="string"){if(b1($)||b1(w))return!1;if($.includes(w)||$.startsWith("./")&&$.slice(2).includes(w))return!0}return R.isMatch($,w,{...q,contains:!0})};R.matchKeys=($,w,q)=>{if(!b0.isObject($))throw TypeError("Expected the first argument to be an object");let J=R(Object.keys($),w,q),f={};for(let Z of J)f[Z]=$[Z];return f};R.some=($,w,q)=>{let J=[].concat($);for(let f of[].concat(w)){let Z=s(String(f),q);if(J.some((V)=>Z(V)))return!0}return!1};R.every=($,w,q)=>{let J=[].concat($);for(let f of[].concat(w)){let Z=s(String(f),q);if(!J.every((V)=>Z(V)))return!1}return!0};R.all=($,w,q)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${d1.inspect($)}"`);return[].concat(w).every((J)=>s(J,q)($))};R.capture=($,w,q)=>{let J=b0.isWindows(q),Z=s.makeRe(String($),{...q,capture:!0}).exec(J?b0.toPosixSlashes(w):w);if(Z)return Z.slice(1).map((V)=>V===void 0?"":V)};R.makeRe=(...$)=>s.makeRe(...$);R.scan=(...$)=>s.scan(...$);R.parse=($,w)=>{let q=[];for(let J of[].concat($||[]))for(let f of v1(String(J),w))q.push(s.parse(f,w));return q};R.braces=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");if(w&&w.nobrace===!0||!m1($))return[$];return v1($,w)};R.braceExpand=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");return R.braces($,{...w,expand:!0})};R.hasBraces=m1;l1.exports=R});var c1=yw(u1(),1);var I0;((J)=>{J.ALLOW="allow";J.ASK="ask";J.DENY="deny"})(I0||={});var gw=h.object({tool:h.string(),specifier:h.string().optional(),action:h.nativeEnum(I0)}),hw=h.object({allow:h.array(h.string()).optional(),ask:h.array(h.string()).optional(),deny:h.array(h.string()).optional(),defaultMode:h.nativeEnum(I0).optional()}),kw=h.object({name:h.string(),args:h.record(h.string(),h.any())});class f0{rules;defaultMode;patternCache=new Map;constructor($){this.rules=$.rules,this.defaultMode=$.defaultMode||"ask",this.rules.sort((w,q)=>{let J={deny:0,ask:1,allow:2},f=J[w.action]-J[q.action];if(f!==0)return f;let Z=w.specifier==null?1:0,V=q.specifier==null?1:0;return Z-V})}checkPermission($){for(let w of this.rules)if(this.matchRule(w,$))return{allowed:w.action==="allow"||w.action==="ask",requiresApproval:w.action==="ask",matchedRule:w,reason:this.getReason(w)};return{allowed:this.defaultMode==="allow"||this.defaultMode==="ask",requiresApproval:this.defaultMode==="ask",reason:`No matching rule, using default mode: ${this.defaultMode}`}}matchRule($,w){if($.tool!==w.name)return!1;if(!$.specifier)return!0;let q=this.argsToString(w.args);if(w.name==="Bash")return this.matchBashCommand($.specifier,q);if($.specifier.endsWith(" ")&&!/[*?[\\]/.test($.specifier))return q.startsWith($.specifier);return this.matchGlob($.specifier,q)}matchBashCommand($,w){if(/[;&|]/.test(w))return!1;let J=/[<>()]/;if(J.test(w)){let f=w.split(J)[0].trim();return this.matchBashPattern($,f)}return this.matchBashPattern($,w)}matchBashPattern($,w){if($.endsWith(" "))return w.startsWith($);return this.matchGlob($,w)}matchGlob($,w){try{let q=$.replace(/^\.\//,""),J=w.replace(/^\.\//,""),f=`${$}::${w}`,Z=this.patternCache.get(f);if(Z!==void 0)return Z;let V=c1.default.isMatch(J,q,{nocase:!1,dot:!0});return this.cacheResult(f,V),V}catch(q){return w===$}}cacheResult($,w){if(this.patternCache.size>1000){let q=this.patternCache.keys().next().value;if(q)this.patternCache.delete(q)}this.patternCache.set($,w)}argsToString($){if(typeof $==="object"&&$!==null){if("command"in $&&$.command)return String($.command);if("file_path"in $&&$.file_path)return String($.file_path);return Object.values($).flat().join(" ")}return String($)}getReason($){let w=$.action.toUpperCase(),q=$.tool,J=$.specifier?`(${$.specifier})`:"";return`${w} rule matched: ${q}${J}`}static parseRule($,w){let q=$.match(/^(\w+)(?:\((.*)\))?$/);if(!q)throw Error(`Invalid permission rule format: ${$}`);let[,J,f]=q;return{tool:J,specifier:f,action:w}}static fromConfig($){let w=[];for(let q of $.allow||[])w.push(f0.parseRule(q,"allow"));for(let q of $.ask||[])w.push(f0.parseRule(q,"ask"));for(let q of $.deny||[])w.push(f0.parseRule(q,"deny"));return new f0({rules:w,defaultMode:$.defaultMode||"ask"})}clearCache(){this.patternCache.clear()}getCacheSize(){return this.patternCache.size}}class $0{configStore;toolNameMapper={};constructor($){this.configStore=$}static instance=null;static getInstance($){if(!$0.instance){if(!$)throw Error("PermissionStore not initialized. Provide configStore on first call.");$0.instance=new $0($)}return $0.instance}static resetInstance(){$0.instance=null}async getPermissions(){let $=await this.configStore.getConfig();if($.permissions)return f0.fromConfig($.permissions);return}async checkBashPermission($,w){return(await this.getPermissions())?.checkPermission({name:"Bash",args:{command:$,cwd:w}})}async checkReadPermission($){return(await this.getPermissions())?.checkPermission({name:"Read",args:{file_path:$}})}async checkWritePermission($){return(await this.getPermissions())?.checkPermission({name:"Write",args:{file_path:$}})}}class C0{configStore;skillStore;pluginStore;remoteStore;permissionStore;_initialized=!1;constructor($,w,q,J){this.configStore=$,this.skillStore=w,this.pluginStore=q,this.remoteStore=J,this.permissionStore=$0.getInstance($)}async initialize(){if(this._initialized)return;if("initialize"in this.configStore&&typeof this.configStore.initialize==="function")await this.configStore.initialize();if("initialize"in this.skillStore&&typeof this.skillStore.initialize==="function")await this.skillStore.initialize();if("initialize"in this.pluginStore&&typeof this.pluginStore.initialize==="function")await this.pluginStore.initialize();this._initialized=!0}async ensureInitialized(){if(!this._initialized)throw Error("ConfigManager not initialized. Call await manager.initialize() first.")}async getConfig(){return await this.ensureInitialized(),await this.configStore.getConfig()}async updateConfig($){return await this.ensureInitialized(),await this.configStore.updateConfig($)}async listSkills(){return await this.ensureInitialized(),await this.skillStore.listSkills()}async getSkill($){return await this.ensureInitialized(),await this.skillStore.getSkill($)}async saveSkill($,w){return await this.ensureInitialized(),await this.skillStore.saveSkill($,w)}async deleteSkill($){return await this.ensureInitialized(),await this.skillStore.deleteSkill($)}async syncSkillsFromRemote(){if(await this.ensureInitialized(),!this.remoteStore)throw Error("Remote store not configured");return await this.skillStore.syncFromRemote(this.remoteStore)}async listPlugins(){return await this.ensureInitialized(),await this.pluginStore.listPlugins()}async getPluginConfig($){return await this.ensureInitialized(),await this.pluginStore.getPluginConfig($)}async updatePluginConfig($,w){return await this.ensureInitialized(),await this.pluginStore.updatePluginConfig($,w)}async installPlugin($,w){return await this.ensureInitialized(),await this.pluginStore.installPlugin($,w)}async uninstallPlugin($){return await this.ensureInitialized(),await this.pluginStore.uninstallPlugin($)}async checkBashPermission($,w){return await this.ensureInitialized(),await this.permissionStore.checkBashPermission($,w)}async checkReadPermission($){return await this.ensureInitialized(),await this.permissionStore.checkReadPermission($)}async checkWritePermission($){return await this.ensureInitialized(),await this.permissionStore.checkWritePermission($)}async getPermissionMatcher(){return await this.ensureInitialized(),await this.permissionStore.getPermissions()}getConfigPath(){return this.configStore?.dbPath}}async function ow(){let{FileSystemConfigStore:$}=await import("./chunk-b9emn03n.js"),{FileSystemSkillStore:w}=await import("./chunk-gkvx829z.js"),{FileSystemPluginStore:q}=await import("./chunk-h0qb9jk1.js"),J=new $,f=new w,Z=new q,V=new C0(J,f,Z);return await V.initialize(),V}async function tw($){let{configStore:w,skillStore:q,pluginStore:J,remoteStore:f}=$,Z=new C0(w,q,J,f);return await Z.initialize(),Z}
18
- export{ow as kf,tw as lf};
17
+ `,CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var y1=d((Lw,M1)=>{var I$=M0(),{MAX_LENGTH:B1,CHAR_BACKSLASH:R0,CHAR_BACKTICK:C$,CHAR_COMMA:D$,CHAR_DOT:H$,CHAR_LEFT_PARENTHESES:P$,CHAR_RIGHT_PARENTHESES:L$,CHAR_LEFT_CURLY_BRACE:O$,CHAR_RIGHT_CURLY_BRACE:E$,CHAR_LEFT_SQUARE_BRACKET:N1,CHAR_RIGHT_SQUARE_BRACKET:G1,CHAR_DOUBLE_QUOTE:R$,CHAR_SINGLE_QUOTE:_$,CHAR_NO_BREAK_SPACE:T$,CHAR_ZERO_WIDTH_NOBREAK_SPACE:A$}=Q1(),S$=($,w={})=>{if(typeof $!=="string")throw TypeError("Expected a string");let q=w||{},J=typeof q.maxLength==="number"?Math.min(B1,q.maxLength):B1;if($.length>J)throw SyntaxError(`Input length (${$.length}), exceeds max characters (${J})`);let f={type:"root",input:$,nodes:[]},Z=[f],V=f,F=f,N=0,K=$.length,B=0,j=0,X,H=()=>$[B++],y=(M)=>{if(M.type==="text"&&F.type==="dot")F.type="text";if(F&&F.type==="text"&&M.type==="text"){F.value+=M.value;return}return V.nodes.push(M),M.parent=V,M.prev=F,F=M,M};y({type:"bos"});while(B<K){if(V=Z[Z.length-1],X=H(),X===A$||X===T$)continue;if(X===R0){y({type:"text",value:(w.keepEscaping?X:"")+H()});continue}if(X===G1){y({type:"text",value:"\\"+X});continue}if(X===N1){N++;let M;while(B<K&&(M=H())){if(X+=M,M===N1){N++;continue}if(M===R0){X+=H();continue}if(M===G1){if(N--,N===0)break}}y({type:"text",value:X});continue}if(X===P$){V=y({type:"paren",nodes:[]}),Z.push(V),y({type:"text",value:X});continue}if(X===L$){if(V.type!=="paren"){y({type:"text",value:X});continue}V=Z.pop(),y({type:"text",value:X}),V=Z[Z.length-1];continue}if(X===R$||X===_$||X===C$){let M=X,L;if(w.keepQuotes!==!0)X="";while(B<K&&(L=H())){if(L===R0){X+=L+H();continue}if(L===M){if(w.keepQuotes===!0)X+=L;break}X+=L}y({type:"text",value:X});continue}if(X===O$){j++;let L={type:"brace",open:!0,close:!1,dollar:F.value&&F.value.slice(-1)==="$"||V.dollar===!0,depth:j,commas:0,ranges:0,nodes:[]};V=y(L),Z.push(V),y({type:"open",value:X});continue}if(X===E$){if(V.type!=="brace"){y({type:"text",value:X});continue}let M="close";V=Z.pop(),V.close=!0,y({type:M,value:X}),j--,V=Z[Z.length-1];continue}if(X===D$&&j>0){if(V.ranges>0){V.ranges=0;let M=V.nodes.shift();V.nodes=[M,{type:"text",value:I$(V)}]}y({type:"comma",value:X}),V.commas++;continue}if(X===H$&&j>0&&V.commas===0){let M=V.nodes;if(j===0||M.length===0){y({type:"text",value:X});continue}if(F.type==="dot"){if(V.range=[],F.value+=X,F.type="range",V.nodes.length!==3&&V.nodes.length!==5){V.invalid=!0,V.ranges=0,F.type="text";continue}V.ranges++,V.args=[];continue}if(F.type==="range"){M.pop();let L=M[M.length-1];L.value+=F.value+X,F=L,V.ranges--;continue}y({type:"dot",value:X});continue}y({type:"text",value:X})}do if(V=Z.pop(),V.type!=="root"){V.nodes.forEach((A)=>{if(!A.nodes){if(A.type==="open")A.isOpen=!0;if(A.type==="close")A.isClose=!0;if(!A.nodes)A.type="text";A.invalid=!0}});let M=Z[Z.length-1],L=M.nodes.indexOf(V);M.nodes.splice(L,1,...V.nodes)}while(Z.length>0);return y({type:"eos"}),f};M1.exports=S$});var z1=d((Ow,j1)=>{var K1=M0(),x$=Y1(),g$=U1(),h$=y1(),r=($,w={})=>{let q=[];if(Array.isArray($))for(let J of $){let f=r.create(J,w);if(Array.isArray(f))q.push(...f);else q.push(f)}else q=[].concat(r.create($,w));if(w&&w.expand===!0&&w.nodupes===!0)q=[...new Set(q)];return q};r.parse=($,w={})=>h$($,w);r.stringify=($,w={})=>{if(typeof $==="string")return K1(r.parse($,w),w);return K1($,w)};r.compile=($,w={})=>{if(typeof $==="string")$=r.parse($,w);return x$($,w)};r.expand=($,w={})=>{if(typeof $==="string")$=r.parse($,w);let q=g$($,w);if(w.noempty===!0)q=q.filter(Boolean);if(w.nodupes===!0)q=[...new Set(q)];return q};r.create=($,w={})=>{if($===""||$.length<3)return[$];return w.expand!==!0?r.compile($,w):r.expand($,w)};j1.exports=r});var W0=d((Ew,C1)=>{var k$=t("path"),I1={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},b$={...I1,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},d$={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};C1.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:d$,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:k$.sep,extglobChars($){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${$.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars($){return $===!0?b$:I1}}});var F0=d((i$)=>{var v$=t("path"),m$=process.platform==="win32",{REGEX_BACKSLASH:l$,REGEX_REMOVE_BACKSLASH:u$,REGEX_SPECIAL_CHARS:c$,REGEX_SPECIAL_CHARS_GLOBAL:r$}=W0();i$.isObject=($)=>$!==null&&typeof $==="object"&&!Array.isArray($);i$.hasRegexChars=($)=>c$.test($);i$.isRegexChar=($)=>$.length===1&&i$.hasRegexChars($);i$.escapeRegex=($)=>$.replace(r$,"\\$1");i$.toPosixSlashes=($)=>$.replace(l$,"/");i$.removeBackslashes=($)=>{return $.replace(u$,(w)=>{return w==="\\"?"":w})};i$.supportsLookbehinds=()=>{let $=process.version.slice(1).split(".").map(Number);if($.length===3&&$[0]>=9||$[0]===8&&$[1]>=10)return!0;return!1};i$.isWindows=($)=>{if($&&typeof $.windows==="boolean")return $.windows;return m$===!0||v$.sep==="\\"};i$.escapeLast=($,w,q)=>{let J=$.lastIndexOf(w,q);if(J===-1)return $;if($[J-1]==="\\")return i$.escapeLast($,w,J-1);return`${$.slice(0,J)}\\${$.slice(J)}`};i$.removePrefix=($,w={})=>{let q=$;if(q.startsWith("./"))q=q.slice(2),w.prefix="./";return q};i$.wrapOutput=($,w={},q={})=>{let J=q.contains?"":"^",f=q.contains?"":"$",Z=`${J}(?:${$})${f}`;if(w.negated===!0)Z=`(?:^(?!${Z}).*$)`;return Z}});var A1=d((_w,T1)=>{var P1=F0(),{CHAR_ASTERISK:_0,CHAR_AT:qw,CHAR_BACKWARD_SLASH:U0,CHAR_COMMA:Jw,CHAR_DOT:T0,CHAR_EXCLAMATION_MARK:A0,CHAR_FORWARD_SLASH:_1,CHAR_LEFT_CURLY_BRACE:S0,CHAR_LEFT_PARENTHESES:x0,CHAR_LEFT_SQUARE_BRACKET:fw,CHAR_PLUS:Vw,CHAR_QUESTION_MARK:L1,CHAR_RIGHT_CURLY_BRACE:Zw,CHAR_RIGHT_PARENTHESES:O1,CHAR_RIGHT_SQUARE_BRACKET:Yw}=W0(),E1=($)=>{return $===_1||$===U0},R1=($)=>{if($.isPrefix!==!0)$.depth=$.isGlobstar?1/0:1},Ww=($,w)=>{let q=w||{},J=$.length-1,f=q.parts===!0||q.scanToEnd===!0,Z=[],V=[],F=[],N=$,K=-1,B=0,j=0,X=!1,H=!1,y=!1,M=!1,L=!1,A=!1,u=!1,S=!1,n=!1,b=!1,e=0,v,z,P={value:"",depth:0,isGlob:!1},k=()=>K>=J,U=()=>N.charCodeAt(K+1),_=()=>{return v=z,N.charCodeAt(++K)};while(K<J){z=_();let m;if(z===U0){if(u=P.backslashes=!0,z=_(),z===S0)A=!0;continue}if(A===!0||z===S0){e++;while(k()!==!0&&(z=_())){if(z===U0){u=P.backslashes=!0,_();continue}if(z===S0){e++;continue}if(A!==!0&&z===T0&&(z=_())===T0){if(X=P.isBrace=!0,y=P.isGlob=!0,b=!0,f===!0)continue;break}if(A!==!0&&z===Jw){if(X=P.isBrace=!0,y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===Zw){if(e--,e===0){A=!1,X=P.isBrace=!0,b=!0;break}}}if(f===!0)continue;break}if(z===_1){if(Z.push(K),V.push(P),P={value:"",depth:0,isGlob:!1},b===!0)continue;if(v===T0&&K===B+1){B+=2;continue}j=K+1;continue}if(q.noext!==!0){if((z===Vw||z===qw||z===_0||z===L1||z===A0)===!0&&U()===x0){if(y=P.isGlob=!0,M=P.isExtglob=!0,b=!0,z===A0&&K===B)n=!0;if(f===!0){while(k()!==!0&&(z=_())){if(z===U0){u=P.backslashes=!0,z=_();continue}if(z===O1){y=P.isGlob=!0,b=!0;break}}continue}break}}if(z===_0){if(v===_0)L=P.isGlobstar=!0;if(y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===L1){if(y=P.isGlob=!0,b=!0,f===!0)continue;break}if(z===fw){while(k()!==!0&&(m=_())){if(m===U0){u=P.backslashes=!0,_();continue}if(m===Yw){H=P.isBracket=!0,y=P.isGlob=!0,b=!0;break}}if(f===!0)continue;break}if(q.nonegate!==!0&&z===A0&&K===B){S=P.negated=!0,B++;continue}if(q.noparen!==!0&&z===x0){if(y=P.isGlob=!0,f===!0){while(k()!==!0&&(z=_())){if(z===x0){u=P.backslashes=!0,z=_();continue}if(z===O1){b=!0;break}}continue}break}if(y===!0){if(b=!0,f===!0)continue;break}}if(q.noext===!0)M=!1,y=!1;let O=N,o="",Y="";if(B>0)o=N.slice(0,B),N=N.slice(B),j-=B;if(O&&y===!0&&j>0)O=N.slice(0,j),Y=N.slice(j);else if(y===!0)O="",Y=N;else O=N;if(O&&O!==""&&O!=="/"&&O!==N){if(E1(O.charCodeAt(O.length-1)))O=O.slice(0,-1)}if(q.unescape===!0){if(Y)Y=P1.removeBackslashes(Y);if(O&&u===!0)O=P1.removeBackslashes(O)}let W={prefix:o,input:$,start:B,base:O,glob:Y,isBrace:X,isBracket:H,isGlob:y,isExtglob:M,isGlobstar:L,negated:S,negatedExtglob:n};if(q.tokens===!0){if(W.maxDepth=0,!E1(z))V.push(P);W.tokens=V}if(q.parts===!0||q.tokens===!0){let m;for(let D=0;D<Z.length;D++){let p=m?m+1:B,a=Z[D],c=$.slice(p,a);if(q.tokens){if(D===0&&B!==0)V[D].isPrefix=!0,V[D].value=o;else V[D].value=c;R1(V[D]),W.maxDepth+=V[D].depth}if(D!==0||c!=="")F.push(c);m=a}if(m&&m+1<$.length){let D=$.slice(m+1);if(F.push(D),q.tokens)V[V.length-1].value=D,R1(V[V.length-1]),W.maxDepth+=V[V.length-1].depth}W.slashes=Z,W.parts=F}return W};T1.exports=Ww});var g1=d((Tw,x1)=>{var j0=W0(),i=F0(),{MAX_LENGTH:z0,POSIX_REGEX_SOURCE:Fw,REGEX_NON_SPECIAL_CHARS:Uw,REGEX_SPECIAL_CHARS_BACKREF:Xw,REPLACEMENTS:S1}=j0,Qw=($,w)=>{if(typeof w.expandRange==="function")return w.expandRange(...$,w);$.sort();let q=`[${$.join("-")}]`;try{new RegExp(q)}catch(J){return $.map((f)=>i.escapeRegex(f)).join("..")}return q},Z0=($,w)=>{return`Missing ${$}: "${w}" - use "\\\\${w}" to match literal characters`},g0=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");$=S1[$]||$;let q={...w},J=typeof q.maxLength==="number"?Math.min(z0,q.maxLength):z0,f=$.length;if(f>J)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${J}`);let Z={type:"bos",value:"",output:q.prepend||""},V=[Z],F=q.capture?"":"?:",N=i.isWindows(w),K=j0.globChars(N),B=j0.extglobChars(K),{DOT_LITERAL:j,PLUS_LITERAL:X,SLASH_LITERAL:H,ONE_CHAR:y,DOTS_SLASH:M,NO_DOT:L,NO_DOT_SLASH:A,NO_DOTS_SLASH:u,QMARK:S,QMARK_NO_DOT:n,STAR:b,START_ANCHOR:e}=K,v=(G)=>{return`(${F}(?:(?!${e}${G.dot?M:j}).)*?)`},z=q.dot?"":L,P=q.dot?S:n,k=q.bash===!0?v(q):b;if(q.capture)k=`(${k})`;if(typeof q.noext==="boolean")q.noextglob=q.noext;let U={input:$,index:-1,start:0,dot:q.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:V};$=i.removePrefix($,U),f=$.length;let _=[],O=[],o=[],Y=Z,W,m=()=>U.index===f-1,D=U.peek=(G=1)=>$[U.index+G],p=U.advance=()=>$[++U.index]||"",a=()=>$.slice(U.index+1),c=(G="",E=0)=>{U.consumed+=G,U.index+=E},X0=(G)=>{U.output+=G.output!=null?G.output:G.value,c(G.value)},r1=()=>{let G=1;while(D()==="!"&&(D(2)!=="("||D(3)==="?"))p(),U.start++,G++;if(G%2===0)return!1;return U.negated=!0,U.start++,!0},Q0=(G)=>{U[G]++,o.push(G)},w0=(G)=>{U[G]--,o.pop()},C=(G)=>{if(Y.type==="globstar"){let E=U.braces>0&&(G.type==="comma"||G.type==="brace"),Q=G.extglob===!0||_.length&&(G.type==="pipe"||G.type==="paren");if(G.type!=="slash"&&G.type!=="paren"&&!E&&!Q)U.output=U.output.slice(0,-Y.output.length),Y.type="star",Y.value="*",Y.output=k,U.output+=Y.output}if(_.length&&G.type!=="paren")_[_.length-1].inner+=G.value;if(G.value||G.output)X0(G);if(Y&&Y.type==="text"&&G.type==="text"){Y.value+=G.value,Y.output=(Y.output||"")+G.value;return}G.prev=Y,V.push(G),Y=G},B0=(G,E)=>{let Q={...B[E],conditions:1,inner:""};Q.prev=Y,Q.parens=U.parens,Q.output=U.output;let I=(q.capture?"(":"")+Q.open;Q0("parens"),C({type:G,value:E,output:U.output?"":y}),C({type:"paren",extglob:!0,value:p(),output:I}),_.push(Q)},i1=(G)=>{let E=G.close+(q.capture?")":""),Q;if(G.type==="negate"){let I=k;if(G.inner&&G.inner.length>1&&G.inner.includes("/"))I=v(q);if(I!==k||m()||/^\)+$/.test(a()))E=G.close=`)$))${I}`;if(G.inner.includes("*")&&(Q=a())&&/^\.[^\\/.]+$/.test(Q)){let T=g0(Q,{...w,fastpaths:!1}).output;E=G.close=`)${T})${I})`}if(G.prev.type==="bos")U.negatedExtglob=!0}C({type:"paren",extglob:!0,value:W,output:E}),w0("parens")};if(q.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test($)){let G=!1,E=$.replace(Xw,(Q,I,T,l,g,D0)=>{if(l==="\\")return G=!0,Q;if(l==="?"){if(I)return I+l+(g?S.repeat(g.length):"");if(D0===0)return P+(g?S.repeat(g.length):"");return S.repeat(T.length)}if(l===".")return j.repeat(T.length);if(l==="*"){if(I)return I+l+(g?k:"");return k}return I?Q:`\\${Q}`});if(G===!0)if(q.unescape===!0)E=E.replace(/\\/g,"");else E=E.replace(/\\+/g,(Q)=>{return Q.length%2===0?"\\\\":Q?"\\":""});if(E===$&&q.contains===!0)return U.output=$,U;return U.output=i.wrapOutput(E,U,w),U}while(!m()){if(W=p(),W==="\x00")continue;if(W==="\\"){let Q=D();if(Q==="/"&&q.bash!==!0)continue;if(Q==="."||Q===";")continue;if(!Q){W+="\\",C({type:"text",value:W});continue}let I=/^\\+/.exec(a()),T=0;if(I&&I[0].length>2){if(T=I[0].length,U.index+=T,T%2!==0)W+="\\"}if(q.unescape===!0)W=p();else W+=p();if(U.brackets===0){C({type:"text",value:W});continue}}if(U.brackets>0&&(W!=="]"||Y.value==="["||Y.value==="[^")){if(q.posix!==!1&&W===":"){let Q=Y.value.slice(1);if(Q.includes("[")){if(Y.posix=!0,Q.includes(":")){let I=Y.value.lastIndexOf("["),T=Y.value.slice(0,I),l=Y.value.slice(I+2),g=Fw[l];if(g){if(Y.value=T+g,U.backtrack=!0,p(),!Z.output&&V.indexOf(Y)===1)Z.output=y;continue}}}}if(W==="["&&D()!==":"||W==="-"&&D()==="]")W=`\\${W}`;if(W==="]"&&(Y.value==="["||Y.value==="[^"))W=`\\${W}`;if(q.posix===!0&&W==="!"&&Y.value==="[")W="^";Y.value+=W,X0({value:W});continue}if(U.quotes===1&&W!=='"'){W=i.escapeRegex(W),Y.value+=W,X0({value:W});continue}if(W==='"'){if(U.quotes=U.quotes===1?0:1,q.keepQuotes===!0)C({type:"text",value:W});continue}if(W==="("){Q0("parens"),C({type:"paren",value:W});continue}if(W===")"){if(U.parens===0&&q.strictBrackets===!0)throw SyntaxError(Z0("opening","("));let Q=_[_.length-1];if(Q&&U.parens===Q.parens+1){i1(_.pop());continue}C({type:"paren",value:W,output:U.parens?")":"\\)"}),w0("parens");continue}if(W==="["){if(q.nobracket===!0||!a().includes("]")){if(q.nobracket!==!0&&q.strictBrackets===!0)throw SyntaxError(Z0("closing","]"));W=`\\${W}`}else Q0("brackets");C({type:"bracket",value:W});continue}if(W==="]"){if(q.nobracket===!0||Y&&Y.type==="bracket"&&Y.value.length===1){C({type:"text",value:W,output:`\\${W}`});continue}if(U.brackets===0){if(q.strictBrackets===!0)throw SyntaxError(Z0("opening","["));C({type:"text",value:W,output:`\\${W}`});continue}w0("brackets");let Q=Y.value.slice(1);if(Y.posix!==!0&&Q[0]==="^"&&!Q.includes("/"))W=`/${W}`;if(Y.value+=W,X0({value:W}),q.literalBrackets===!1||i.hasRegexChars(Q))continue;let I=i.escapeRegex(Y.value);if(U.output=U.output.slice(0,-Y.value.length),q.literalBrackets===!0){U.output+=I,Y.value=I;continue}Y.value=`(${F}${I}|${Y.value})`,U.output+=Y.value;continue}if(W==="{"&&q.nobrace!==!0){Q0("braces");let Q={type:"brace",value:W,output:"(",outputIndex:U.output.length,tokensIndex:U.tokens.length};O.push(Q),C(Q);continue}if(W==="}"){let Q=O[O.length-1];if(q.nobrace===!0||!Q){C({type:"text",value:W,output:W});continue}let I=")";if(Q.dots===!0){let T=V.slice(),l=[];for(let g=T.length-1;g>=0;g--){if(V.pop(),T[g].type==="brace")break;if(T[g].type!=="dots")l.unshift(T[g].value)}I=Qw(l,q),U.backtrack=!0}if(Q.comma!==!0&&Q.dots!==!0){let T=U.output.slice(0,Q.outputIndex),l=U.tokens.slice(Q.tokensIndex);Q.value=Q.output="\\{",W=I="\\}",U.output=T;for(let g of l)U.output+=g.output||g.value}C({type:"brace",value:W,output:I}),w0("braces"),O.pop();continue}if(W==="|"){if(_.length>0)_[_.length-1].conditions++;C({type:"text",value:W});continue}if(W===","){let Q=W,I=O[O.length-1];if(I&&o[o.length-1]==="braces")I.comma=!0,Q="|";C({type:"comma",value:W,output:Q});continue}if(W==="/"){if(Y.type==="dot"&&U.index===U.start+1){U.start=U.index+1,U.consumed="",U.output="",V.pop(),Y=Z;continue}C({type:"slash",value:W,output:H});continue}if(W==="."){if(U.braces>0&&Y.type==="dot"){if(Y.value===".")Y.output=j;let Q=O[O.length-1];Y.type="dots",Y.output+=W,Y.value+=W,Q.dots=!0;continue}if(U.braces+U.parens===0&&Y.type!=="bos"&&Y.type!=="slash"){C({type:"text",value:W,output:j});continue}C({type:"dot",value:W,output:j});continue}if(W==="?"){if(!(Y&&Y.value==="(")&&q.noextglob!==!0&&D()==="("&&D(2)!=="?"){B0("qmark",W);continue}if(Y&&Y.type==="paren"){let I=D(),T=W;if(I==="<"&&!i.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");if(Y.value==="("&&!/[!=<:]/.test(I)||I==="<"&&!/<([!=]|\w+>)/.test(a()))T=`\\${W}`;C({type:"text",value:W,output:T});continue}if(q.dot!==!0&&(Y.type==="slash"||Y.type==="bos")){C({type:"qmark",value:W,output:n});continue}C({type:"qmark",value:W,output:S});continue}if(W==="!"){if(q.noextglob!==!0&&D()==="("){if(D(2)!=="?"||!/[!=<:]/.test(D(3))){B0("negate",W);continue}}if(q.nonegate!==!0&&U.index===0){r1();continue}}if(W==="+"){if(q.noextglob!==!0&&D()==="("&&D(2)!=="?"){B0("plus",W);continue}if(Y&&Y.value==="("||q.regex===!1){C({type:"plus",value:W,output:X});continue}if(Y&&(Y.type==="bracket"||Y.type==="paren"||Y.type==="brace")||U.parens>0){C({type:"plus",value:W});continue}C({type:"plus",value:X});continue}if(W==="@"){if(q.noextglob!==!0&&D()==="("&&D(2)!=="?"){C({type:"at",extglob:!0,value:W,output:""});continue}C({type:"text",value:W});continue}if(W!=="*"){if(W==="$"||W==="^")W=`\\${W}`;let Q=Uw.exec(a());if(Q)W+=Q[0],U.index+=Q[0].length;C({type:"text",value:W});continue}if(Y&&(Y.type==="globstar"||Y.star===!0)){Y.type="star",Y.star=!0,Y.value+=W,Y.output=k,U.backtrack=!0,U.globstar=!0,c(W);continue}let G=a();if(q.noextglob!==!0&&/^\([^?]/.test(G)){B0("star",W);continue}if(Y.type==="star"){if(q.noglobstar===!0){c(W);continue}let Q=Y.prev,I=Q.prev,T=Q.type==="slash"||Q.type==="bos",l=I&&(I.type==="star"||I.type==="globstar");if(q.bash===!0&&(!T||G[0]&&G[0]!=="/")){C({type:"star",value:W,output:""});continue}let g=U.braces>0&&(Q.type==="comma"||Q.type==="brace"),D0=_.length&&(Q.type==="pipe"||Q.type==="paren");if(!T&&Q.type!=="paren"&&!g&&!D0){C({type:"star",value:W,output:""});continue}while(G.slice(0,3)==="/**"){let N0=$[U.index+4];if(N0&&N0!=="/")break;G=G.slice(3),c("/**",3)}if(Q.type==="bos"&&m()){Y.type="globstar",Y.value+=W,Y.output=v(q),U.output=Y.output,U.globstar=!0,c(W);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&!l&&m()){U.output=U.output.slice(0,-(Q.output+Y.output).length),Q.output=`(?:${Q.output}`,Y.type="globstar",Y.output=v(q)+(q.strictSlashes?")":"|$)"),Y.value+=W,U.globstar=!0,U.output+=Q.output+Y.output,c(W);continue}if(Q.type==="slash"&&Q.prev.type!=="bos"&&G[0]==="/"){let N0=G[1]!==void 0?"|$":"";U.output=U.output.slice(0,-(Q.output+Y.output).length),Q.output=`(?:${Q.output}`,Y.type="globstar",Y.output=`${v(q)}${H}|${H}${N0})`,Y.value+=W,U.output+=Q.output+Y.output,U.globstar=!0,c(W+p()),C({type:"slash",value:"/",output:""});continue}if(Q.type==="bos"&&G[0]==="/"){Y.type="globstar",Y.value+=W,Y.output=`(?:^|${H}|${v(q)}${H})`,U.output=Y.output,U.globstar=!0,c(W+p()),C({type:"slash",value:"/",output:""});continue}U.output=U.output.slice(0,-Y.output.length),Y.type="globstar",Y.output=v(q),Y.value+=W,U.output+=Y.output,U.globstar=!0,c(W);continue}let E={type:"star",value:W,output:k};if(q.bash===!0){if(E.output=".*?",Y.type==="bos"||Y.type==="slash")E.output=z+E.output;C(E);continue}if(Y&&(Y.type==="bracket"||Y.type==="paren")&&q.regex===!0){E.output=W,C(E);continue}if(U.index===U.start||Y.type==="slash"||Y.type==="dot"){if(Y.type==="dot")U.output+=A,Y.output+=A;else if(q.dot===!0)U.output+=u,Y.output+=u;else U.output+=z,Y.output+=z;if(D()!=="*")U.output+=y,Y.output+=y}C(E)}while(U.brackets>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing","]"));U.output=i.escapeLast(U.output,"["),w0("brackets")}while(U.parens>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing",")"));U.output=i.escapeLast(U.output,"("),w0("parens")}while(U.braces>0){if(q.strictBrackets===!0)throw SyntaxError(Z0("closing","}"));U.output=i.escapeLast(U.output,"{"),w0("braces")}if(q.strictSlashes!==!0&&(Y.type==="star"||Y.type==="bracket"))C({type:"maybe_slash",value:"",output:`${H}?`});if(U.backtrack===!0){U.output="";for(let G of U.tokens)if(U.output+=G.output!=null?G.output:G.value,G.suffix)U.output+=G.suffix}return U};g0.fastpaths=($,w)=>{let q={...w},J=typeof q.maxLength==="number"?Math.min(z0,q.maxLength):z0,f=$.length;if(f>J)throw SyntaxError(`Input length: ${f}, exceeds maximum allowed length: ${J}`);$=S1[$]||$;let Z=i.isWindows(w),{DOT_LITERAL:V,SLASH_LITERAL:F,ONE_CHAR:N,DOTS_SLASH:K,NO_DOT:B,NO_DOTS:j,NO_DOTS_SLASH:X,STAR:H,START_ANCHOR:y}=j0.globChars(Z),M=q.dot?j:B,L=q.dot?X:B,A=q.capture?"":"?:",u={negated:!1,prefix:""},S=q.bash===!0?".*?":H;if(q.capture)S=`(${S})`;let n=(z)=>{if(z.noglobstar===!0)return S;return`(${A}(?:(?!${y}${z.dot?K:V}).)*?)`},b=(z)=>{switch(z){case"*":return`${M}${N}${S}`;case".*":return`${V}${N}${S}`;case"*.*":return`${M}${S}${V}${N}${S}`;case"*/*":return`${M}${S}${F}${N}${L}${S}`;case"**":return M+n(q);case"**/*":return`(?:${M}${n(q)}${F})?${L}${N}${S}`;case"**/*.*":return`(?:${M}${n(q)}${F})?${L}${S}${V}${N}${S}`;case"**/.*":return`(?:${M}${n(q)}${F})?${V}${N}${S}`;default:{let P=/^(.*?)\.(\w+)$/.exec(z);if(!P)return;let k=b(P[1]);if(!k)return;return k+V+P[2]}}},e=i.removePrefix($,u),v=b(e);if(v&&q.strictSlashes!==!0)v+=`${F}?`;return v};x1.exports=g0});var k1=d((Aw,h1)=>{var Bw=t("path"),Nw=A1(),h0=g1(),k0=F0(),Gw=W0(),Mw=($)=>$&&typeof $==="object"&&!Array.isArray($),x=($,w,q=!1)=>{if(Array.isArray($)){let B=$.map((X)=>x(X,w,q));return(X)=>{for(let H of B){let y=H(X);if(y)return y}return!1}}let J=Mw($)&&$.tokens&&$.input;if($===""||typeof $!=="string"&&!J)throw TypeError("Expected pattern to be a non-empty string");let f=w||{},Z=k0.isWindows(w),V=J?x.compileRe($,w):x.makeRe($,w,!1,!0),F=V.state;delete V.state;let N=()=>!1;if(f.ignore){let B={...w,ignore:null,onMatch:null,onResult:null};N=x(f.ignore,B,q)}let K=(B,j=!1)=>{let{isMatch:X,match:H,output:y}=x.test(B,V,w,{glob:$,posix:Z}),M={glob:$,state:F,regex:V,posix:Z,input:B,output:y,match:H,isMatch:X};if(typeof f.onResult==="function")f.onResult(M);if(X===!1)return M.isMatch=!1,j?M:!1;if(N(B)){if(typeof f.onIgnore==="function")f.onIgnore(M);return M.isMatch=!1,j?M:!1}if(typeof f.onMatch==="function")f.onMatch(M);return j?M:!0};if(q)K.state=F;return K};x.test=($,w,q,{glob:J,posix:f}={})=>{if(typeof $!=="string")throw TypeError("Expected input to be a string");if($==="")return{isMatch:!1,output:""};let Z=q||{},V=Z.format||(f?k0.toPosixSlashes:null),F=$===J,N=F&&V?V($):$;if(F===!1)N=V?V($):$,F=N===J;if(F===!1||Z.capture===!0)if(Z.matchBase===!0||Z.basename===!0)F=x.matchBase($,w,q,f);else F=w.exec(N);return{isMatch:Boolean(F),match:F,output:N}};x.matchBase=($,w,q,J=k0.isWindows(q))=>{return(w instanceof RegExp?w:x.makeRe(w,q)).test(Bw.basename($))};x.isMatch=($,w,q)=>x(w,q)($);x.parse=($,w)=>{if(Array.isArray($))return $.map((q)=>x.parse(q,w));return h0($,{...w,fastpaths:!1})};x.scan=($,w)=>Nw($,w);x.compileRe=($,w,q=!1,J=!1)=>{if(q===!0)return $.output;let f=w||{},Z=f.contains?"":"^",V=f.contains?"":"$",F=`${Z}(?:${$.output})${V}`;if($&&$.negated===!0)F=`^(?!${F}).*$`;let N=x.toRegex(F,w);if(J===!0)N.state=$;return N};x.makeRe=($,w={},q=!1,J=!1)=>{if(!$||typeof $!=="string")throw TypeError("Expected a non-empty string");let f={negated:!1,fastpaths:!0};if(w.fastpaths!==!1&&($[0]==="."||$[0]==="*"))f.output=h0.fastpaths($,w);if(!f.output)f=h0($,w);return x.compileRe(f,w,q,J)};x.toRegex=($,w)=>{try{let q=w||{};return new RegExp($,q.flags||(q.nocase?"i":""))}catch(q){if(w&&w.debug===!0)throw q;return/$^/}};x.constants=Gw;h1.exports=x});var u1=d((Sw,l1)=>{var d1=t("util"),v1=z1(),s=k1(),b0=F0(),b1=($)=>$===""||$==="./",m1=($)=>{let w=$.indexOf("{");return w>-1&&$.indexOf("}",w)>-1},R=($,w,q)=>{w=[].concat(w),$=[].concat($);let J=new Set,f=new Set,Z=new Set,V=0,F=(B)=>{if(Z.add(B.output),q&&q.onResult)q.onResult(B)};for(let B=0;B<w.length;B++){let j=s(String(w[B]),{...q,onResult:F},!0),X=j.state.negated||j.state.negatedExtglob;if(X)V++;for(let H of $){let y=j(H,!0);if(!(X?!y.isMatch:y.isMatch))continue;if(X)J.add(y.output);else J.delete(y.output),f.add(y.output)}}let K=(V===w.length?[...Z]:[...f]).filter((B)=>!J.has(B));if(q&&K.length===0){if(q.failglob===!0)throw Error(`No matches found for "${w.join(", ")}"`);if(q.nonull===!0||q.nullglob===!0)return q.unescape?w.map((B)=>B.replace(/\\/g,"")):w}return K};R.match=R;R.matcher=($,w)=>s($,w);R.isMatch=($,w,q)=>s(w,q)($);R.any=R.isMatch;R.not=($,w,q={})=>{w=[].concat(w).map(String);let J=new Set,f=[],V=new Set(R($,w,{...q,onResult:(F)=>{if(q.onResult)q.onResult(F);f.push(F.output)}}));for(let F of f)if(!V.has(F))J.add(F);return[...J]};R.contains=($,w,q)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${d1.inspect($)}"`);if(Array.isArray(w))return w.some((J)=>R.contains($,J,q));if(typeof w==="string"){if(b1($)||b1(w))return!1;if($.includes(w)||$.startsWith("./")&&$.slice(2).includes(w))return!0}return R.isMatch($,w,{...q,contains:!0})};R.matchKeys=($,w,q)=>{if(!b0.isObject($))throw TypeError("Expected the first argument to be an object");let J=R(Object.keys($),w,q),f={};for(let Z of J)f[Z]=$[Z];return f};R.some=($,w,q)=>{let J=[].concat($);for(let f of[].concat(w)){let Z=s(String(f),q);if(J.some((V)=>Z(V)))return!0}return!1};R.every=($,w,q)=>{let J=[].concat($);for(let f of[].concat(w)){let Z=s(String(f),q);if(!J.every((V)=>Z(V)))return!1}return!0};R.all=($,w,q)=>{if(typeof $!=="string")throw TypeError(`Expected a string: "${d1.inspect($)}"`);return[].concat(w).every((J)=>s(J,q)($))};R.capture=($,w,q)=>{let J=b0.isWindows(q),Z=s.makeRe(String($),{...q,capture:!0}).exec(J?b0.toPosixSlashes(w):w);if(Z)return Z.slice(1).map((V)=>V===void 0?"":V)};R.makeRe=(...$)=>s.makeRe(...$);R.scan=(...$)=>s.scan(...$);R.parse=($,w)=>{let q=[];for(let J of[].concat($||[]))for(let f of v1(String(J),w))q.push(s.parse(f,w));return q};R.braces=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");if(w&&w.nobrace===!0||!m1($))return[$];return v1($,w)};R.braceExpand=($,w)=>{if(typeof $!=="string")throw TypeError("Expected a string");return R.braces($,{...w,expand:!0})};R.hasBraces=m1;l1.exports=R});var c1=yw(u1(),1);var I0;((J)=>{J.ALLOW="allow";J.ASK="ask";J.DENY="deny"})(I0||={});var gw=h.object({tool:h.string(),specifier:h.string().optional(),action:h.nativeEnum(I0)}),hw=h.object({allow:h.array(h.string()).optional(),ask:h.array(h.string()).optional(),deny:h.array(h.string()).optional(),defaultMode:h.nativeEnum(I0).optional()}),kw=h.object({name:h.string(),args:h.record(h.string(),h.any())});class f0{rules;defaultMode;patternCache=new Map;constructor($){this.rules=$.rules,this.defaultMode=$.defaultMode||"ask",this.rules.sort((w,q)=>{let J={deny:0,ask:1,allow:2},f=J[w.action]-J[q.action];if(f!==0)return f;let Z=w.specifier==null?1:0,V=q.specifier==null?1:0;return Z-V})}checkPermission($){for(let w of this.rules)if(this.matchRule(w,$))return{allowed:w.action==="allow"||w.action==="ask",requiresApproval:w.action==="ask",matchedRule:w,reason:this.getReason(w)};return{allowed:this.defaultMode==="allow"||this.defaultMode==="ask",requiresApproval:this.defaultMode==="ask",reason:`No matching rule, using default mode: ${this.defaultMode}`}}matchRule($,w){if($.tool!==w.name)return!1;if(!$.specifier)return!0;let q=this.argsToString(w.args);if(w.name==="Bash")return this.matchBashCommand($.specifier,q);if($.specifier.endsWith(" ")&&!/[*?[\\]/.test($.specifier))return q.startsWith($.specifier);return this.matchGlob($.specifier,q)}matchBashCommand($,w){if(/[;&|]/.test(w))return!1;let J=/[<>()]/;if(J.test(w)){let f=w.split(J)[0].trim();return this.matchBashPattern($,f)}return this.matchBashPattern($,w)}matchBashPattern($,w){if($.endsWith(" "))return w.startsWith($);return this.matchGlob($,w)}matchGlob($,w){try{let q=$.replace(/^\.\//,""),J=w.replace(/^\.\//,""),f=`${$}::${w}`,Z=this.patternCache.get(f);if(Z!==void 0)return Z;let V=c1.default.isMatch(J,q,{nocase:!1,dot:!0});return this.cacheResult(f,V),V}catch(q){return w===$}}cacheResult($,w){if(this.patternCache.size>1000){let q=this.patternCache.keys().next().value;if(q)this.patternCache.delete(q)}this.patternCache.set($,w)}argsToString($){if(typeof $==="object"&&$!==null){if("command"in $&&$.command)return String($.command);if("file_path"in $&&$.file_path)return String($.file_path);return Object.values($).flat().join(" ")}return String($)}getReason($){let w=$.action.toUpperCase(),q=$.tool,J=$.specifier?`(${$.specifier})`:"";return`${w} rule matched: ${q}${J}`}static parseRule($,w){let q=$.match(/^(\w+)(?:\((.*)\))?$/);if(!q)throw Error(`Invalid permission rule format: ${$}`);let[,J,f]=q;return{tool:J,specifier:f,action:w}}static fromConfig($){let w=[];for(let q of $.allow||[])w.push(f0.parseRule(q,"allow"));for(let q of $.ask||[])w.push(f0.parseRule(q,"ask"));for(let q of $.deny||[])w.push(f0.parseRule(q,"deny"));return new f0({rules:w,defaultMode:$.defaultMode||"ask"})}clearCache(){this.patternCache.clear()}getCacheSize(){return this.patternCache.size}}class $0{configStore;toolNameMapper={};constructor($){this.configStore=$}static instance=null;static getInstance($){if(!$0.instance){if(!$)throw Error("PermissionStore not initialized. Provide configStore on first call.");$0.instance=new $0($)}return $0.instance}static resetInstance(){$0.instance=null}async getPermissions(){let $=await this.configStore.getConfig();if($.permissions)return f0.fromConfig($.permissions);return}async checkBashPermission($,w){return(await this.getPermissions())?.checkPermission({name:"Bash",args:{command:$,cwd:w}})}async checkReadPermission($){return(await this.getPermissions())?.checkPermission({name:"Read",args:{file_path:$}})}async checkWritePermission($){return(await this.getPermissions())?.checkPermission({name:"Write",args:{file_path:$}})}}class C0{configStore;skillStore;pluginStore;remoteStore;permissionStore;_initialized=!1;constructor($,w,q,J){this.configStore=$,this.skillStore=w,this.pluginStore=q,this.remoteStore=J,this.permissionStore=$0.getInstance($)}async initialize(){if(this._initialized)return;if("initialize"in this.configStore&&typeof this.configStore.initialize==="function")await this.configStore.initialize();if("initialize"in this.skillStore&&typeof this.skillStore.initialize==="function")await this.skillStore.initialize();if("initialize"in this.pluginStore&&typeof this.pluginStore.initialize==="function")await this.pluginStore.initialize();this._initialized=!0}async ensureInitialized(){if(!this._initialized)throw Error("ConfigManager not initialized. Call await manager.initialize() first.")}async getConfig(){return await this.ensureInitialized(),await this.configStore.getConfig()}async updateConfig($){return await this.ensureInitialized(),await this.configStore.updateConfig($)}async listSkills(){return await this.ensureInitialized(),await this.skillStore.listSkills()}async getSkill($){return await this.ensureInitialized(),await this.skillStore.getSkill($)}async saveSkill($,w){return await this.ensureInitialized(),await this.skillStore.saveSkill($,w)}async deleteSkill($){return await this.ensureInitialized(),await this.skillStore.deleteSkill($)}async syncSkillsFromRemote(){if(await this.ensureInitialized(),!this.remoteStore)throw Error("Remote store not configured");return await this.skillStore.syncFromRemote(this.remoteStore)}async listPlugins(){return await this.ensureInitialized(),await this.pluginStore.listPlugins()}async getPluginConfig($){return await this.ensureInitialized(),await this.pluginStore.getPluginConfig($)}async updatePluginConfig($,w){return await this.ensureInitialized(),await this.pluginStore.updatePluginConfig($,w)}async installPlugin($,w){return await this.ensureInitialized(),await this.pluginStore.installPlugin($,w)}async uninstallPlugin($){return await this.ensureInitialized(),await this.pluginStore.uninstallPlugin($)}async checkBashPermission($,w){return await this.ensureInitialized(),await this.permissionStore.checkBashPermission($,w)}async checkReadPermission($){return await this.ensureInitialized(),await this.permissionStore.checkReadPermission($)}async checkWritePermission($){return await this.ensureInitialized(),await this.permissionStore.checkWritePermission($)}async getPermissionMatcher(){return await this.ensureInitialized(),await this.permissionStore.getPermissions()}getConfigPath(){return this.configStore?.dbPath}}async function ow(){let{FileSystemConfigStore:$}=await import("./chunk-86m0rmtc.js"),{FileSystemSkillStore:w}=await import("./chunk-bca8tkkr.js"),{FileSystemPluginStore:q}=await import("./chunk-57bj89e2.js"),J=new $,f=new w,Z=new q,V=new C0(J,f,Z);return await V.initialize(),V}async function tw($){let{configStore:w,skillStore:q,pluginStore:J,remoteStore:f}=$,Z=new C0(w,q,J,f);return await Z.initialize(),Z}
18
+ export{ow as if,tw as jf};
@@ -1,4 +1,4 @@
1
- import{j as o}from"./chunk-d72063sm.js";import{R as n}from"./chunk-kmxdq21k.js";import{U as m,X as d,Y as x}from"./chunk-dx9k6sdd.js";import{Be as X,Ce as G,Fe as a,Ke as g,Le as D,Me as E,ye as u}from"./chunk-1v863afn.js";import"./chunk-d2770b2z.js";import"./chunk-mv0xzmq8.js";import"./chunk-znw7fpep.js";import"./chunk-pxdgy0vr.js";import"./chunk-k6fxqssr.js";import"./chunk-t01t72t2.js";import"./chunk-b2551zfb.js";import"./chunk-vd8kwzra.js";import{Fl as S}from"./chunk-z3e4c424.js";var H=S(u(),1);var b=S(u(),1);var _=S(D(),1);function Xz(Y){try{let $=JSON.parse(Y);if(typeof $!=="object"||$===null)return{isValid:!1,error:{message:"配置必须是 JSON 对象"}};if(!$.command&&!$.url)return{isValid:!1,error:{message:'配置必须包含 "command" (stdio) 或 "url" (SSE)'}};return{isValid:!0,config:$}}catch($){let L=$ instanceof Error?$.message:String($),B=L.match(/position (\d+)/),Q=B?parseInt(B[1],10):void 0;return{isValid:!1,error:{message:`JSON 格式错误: ${L}`,line:Q}}}}function Yz(Y,$,L){if(!Y||Y.length<2||Y.length>32)return"名称必须为 2-32 个字符";if(!/^[a-zA-Z0-9_-]+$/.test(Y))return"名称只能包含字母、数字、下划线和连字符";if($.includes(Y)&&Y!==L)return"名称已存在";return null}function Zz(Y,$=2){return JSON.stringify(Y,null,$)}var _z=[{key:"serverName",label:"Server ID"},{key:"config",label:"Config (JSON)"}],$z=({mode:Y,serverName:$,serverConfig:L,onCancel:B,onSave:Q})=>{let[O,y]=b.useState({serverName:$||"",configJSON:L?Zz(L):""}),[F,I]=b.useState(0),[j,V]=b.useState(null),M=b.useMemo(()=>{return[]},[]),U=b.useMemo(()=>{return Xz(O.configJSON)},[O.configJSON]),k=b.useCallback(()=>{let A=Yz(O.serverName,M,Y==="edit"?$:void 0);return V(A),A===null},[O.serverName,M,$,Y]),N=b.useCallback(()=>{if(Y==="add"&&!k())return;if(!U.isValid||!U.config)return;Q(O.serverName,U.config)},[Y,O.serverName,U,Q,k]),w=b.useCallback((A)=>{let h=Y==="add"?_z.length-1:1,q=A==="next"?(F+1)%h:(F-1+h)%h;I(q)},[F,Y]),f=()=>{if(Y!=="add")return null;let A=F===0,h=j!==null;return _.jsxDEV(X,{marginBottom:1,children:[_.jsxDEV(G,{color:A?"cyan":h?"red":"gray",children:"Server ID: "},void 0,!1,void 0,this),A?_.jsxDEV(X,{width:40,children:_.jsxDEV(E,{value:O.serverName,onChange:(q)=>{y((K)=>({...K,serverName:q})),V(null)},onSubmit:N,placeholder:"my-server",maxVisibleLines:1,showCursor:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this):_.jsxDEV(G,{children:O.serverName||"my-server"},void 0,!1,void 0,this),h&&_.jsxDEV(G,{color:"red",children:[" ",j]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},p=()=>{let A=Y==="add"?F===1:F===0,h=U.isValid;return _.jsxDEV(X,{flexDirection:"column",marginBottom:1,children:[_.jsxDEV(G,{color:A?"cyan":"gray",children:"Config (JSON):"},void 0,!1,void 0,this),_.jsxDEV(X,{marginTop:1,children:_.jsxDEV(E,{value:O.configJSON,onChange:(q)=>y((K)=>({...K,configJSON:q})),onSubmit:N,placeholder:`{
1
+ import{j as o}from"./chunk-h8fdexm4.js";import{R as n}from"./chunk-m21hvv91.js";import{U as m,X as d,Y as x}from"./chunk-4wnmk2tj.js";import{Ae as G,De as a,Ie as g,Je as D,Ke as E,we as u,ze as X}from"./chunk-c7kd2qrp.js";import"./chunk-a9tw6d68.js";import"./chunk-k4q8j7pg.js";import"./chunk-spx7nn8t.js";import"./chunk-vfxjbdz4.js";import"./chunk-qxebn3jw.js";import"./chunk-e8kxa5vj.js";import"./chunk-q1cxrg0x.js";import"./chunk-tjg2e8v3.js";import{Dl as S}from"./chunk-y8qhrx11.js";var H=S(u(),1);var b=S(u(),1);var _=S(D(),1);function Xz(Y){try{let $=JSON.parse(Y);if(typeof $!=="object"||$===null)return{isValid:!1,error:{message:"配置必须是 JSON 对象"}};if(!$.command&&!$.url)return{isValid:!1,error:{message:'配置必须包含 "command" (stdio) 或 "url" (SSE)'}};return{isValid:!0,config:$}}catch($){let L=$ instanceof Error?$.message:String($),B=L.match(/position (\d+)/),Q=B?parseInt(B[1],10):void 0;return{isValid:!1,error:{message:`JSON 格式错误: ${L}`,line:Q}}}}function Yz(Y,$,L){if(!Y||Y.length<2||Y.length>32)return"名称必须为 2-32 个字符";if(!/^[a-zA-Z0-9_-]+$/.test(Y))return"名称只能包含字母、数字、下划线和连字符";if($.includes(Y)&&Y!==L)return"名称已存在";return null}function Zz(Y,$=2){return JSON.stringify(Y,null,$)}var _z=[{key:"serverName",label:"Server ID"},{key:"config",label:"Config (JSON)"}],$z=({mode:Y,serverName:$,serverConfig:L,onCancel:B,onSave:Q})=>{let[O,y]=b.useState({serverName:$||"",configJSON:L?Zz(L):""}),[F,I]=b.useState(0),[j,V]=b.useState(null),M=b.useMemo(()=>{return[]},[]),U=b.useMemo(()=>{return Xz(O.configJSON)},[O.configJSON]),k=b.useCallback(()=>{let A=Yz(O.serverName,M,Y==="edit"?$:void 0);return V(A),A===null},[O.serverName,M,$,Y]),N=b.useCallback(()=>{if(Y==="add"&&!k())return;if(!U.isValid||!U.config)return;Q(O.serverName,U.config)},[Y,O.serverName,U,Q,k]),w=b.useCallback((A)=>{let h=Y==="add"?_z.length-1:1,q=A==="next"?(F+1)%h:(F-1+h)%h;I(q)},[F,Y]),f=()=>{if(Y!=="add")return null;let A=F===0,h=j!==null;return _.jsxDEV(X,{marginBottom:1,children:[_.jsxDEV(G,{color:A?"cyan":h?"red":"gray",children:"Server ID: "},void 0,!1,void 0,this),A?_.jsxDEV(X,{width:40,children:_.jsxDEV(E,{value:O.serverName,onChange:(q)=>{y((K)=>({...K,serverName:q})),V(null)},onSubmit:N,placeholder:"my-server",maxVisibleLines:1,showCursor:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this):_.jsxDEV(G,{children:O.serverName||"my-server"},void 0,!1,void 0,this),h&&_.jsxDEV(G,{color:"red",children:[" ",j]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},p=()=>{let A=Y==="add"?F===1:F===0,h=U.isValid;return _.jsxDEV(X,{flexDirection:"column",marginBottom:1,children:[_.jsxDEV(G,{color:A?"cyan":"gray",children:"Config (JSON):"},void 0,!1,void 0,this),_.jsxDEV(X,{marginTop:1,children:_.jsxDEV(E,{value:O.configJSON,onChange:(q)=>y((K)=>({...K,configJSON:q})),onSubmit:N,placeholder:`{
2
2
  "command": "npx",
3
3
  "args": ["-y", "..."]
4
4
  }`,showCursor:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),O.configJSON&&_.jsxDEV(X,{marginTop:1,children:h?_.jsxDEV(G,{color:"green",children:"✓ JSON 格式有效"},void 0,!1,void 0,this):_.jsxDEV(G,{color:"red",children:["✗ ",U.error?.message||"JSON 格式错误"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},P=()=>_.jsxDEV(X,{marginTop:1,children:_.jsxDEV(G,{color:"gray",dimColor:!0,children:[_.jsxDEV(G,{color:"cyan",children:"Enter"},void 0,!1,void 0,this)," 保存 ",_.jsxDEV(G,{color:"cyan",children:"Tab"},void 0,!1,void 0,this)," 切换字段"," ",_.jsxDEV(G,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 取消"]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return _.jsxDEV(X,{flexDirection:"column",paddingX:2,children:[_.jsxDEV(X,{marginBottom:1,children:_.jsxDEV(G,{bold:!0,color:"cyan",children:Y==="add"?"Add MCP Server":`Edit MCP Server: ${$}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.jsxDEV(X,{flexDirection:"column",gap:1,children:[f(),p()]},void 0,!0,void 0,this),P()]},void 0,!0,void 0,this)},l=$z;function i({mcpConfig:Y,updateConfig:$}){let L=m(),B=d({mutationFn:async(Q)=>{return await $({mcp_config:Q}),Q},onSuccess:(Q)=>{L.setQueryData(x.mcp.config(),Q)}});return{mcpConfig:Y,updateMcpConfig:B.mutateAsync,isUpdating:B.isPending}}var z=S(D(),1),Hz=({onClose:Y})=>{let{config:$,updateConfig:L}=o(),B=$?.mcp_config||{},{mcpConfig:Q,updateMcpConfig:O}=i({mcpConfig:B,updateConfig:L}),[y,F]=H.useState("list"),[I,j]=H.useState("add"),[V,M]=H.useState(null),[U,k]=H.useState(0),[N,w]=H.useState(null),[f,p]=H.useState(null),[P,A]=H.useState(null),h=H.useCallback(()=>w(null),[]);n(h,N?3000:null);let q=Object.keys(Q),K=q[U],R=K?Q[K]:null,v=H.useCallback((W)=>{if(W.command)return"stdio";if(W.url)return"SSE";return"unknown"},[]),r=H.useCallback(()=>{j("add"),M(null),F("json"),w(null)},[]),t=H.useCallback(()=>{if(!K||!R)return;j("edit"),M(K),F("json"),w(null)},[K,R]),s=H.useCallback(async()=>{if(!K||!R)return;p(K),A(null),F("test");try{let W=!!(R.command&&R.args),Z=!!R.url;if(!W&&!Z){A({success:!1,message:"配置无效:必须包含 command (stdio) 或 url (SSE)"});return}if(W&&(!R.command||!Array.isArray(R.args))){A({success:!1,message:"配置无效:stdio 模式需要 command 和 args 字段"});return}A({success:!0,message:`配置格式验证通过 (${Z?"SSE":"stdio"} 模式)`,tools:[]})}catch(W){A({success:!1,message:`验证失败: ${W instanceof Error?W.message:String(W)}`})}},[K,R]),C=H.useCallback(()=>{F("list"),M(null),A(null),w(null)},[]),e=H.useCallback(async(W,Z)=>{let J={...Q};if(J[W]=Z,await O(J),w(I==="add"?`已添加服务器: ${W}`:`已更新服务器: ${W}`),I==="add"){let T=Object.keys(J).findIndex((c)=>c===W);k(T>=0?T:0)}C()},[I,Q,O,C]),zz=H.useCallback(async()=>{if(!K)return;let W={...Q};delete W[K],await O(W);let Z=Math.min(U,Object.keys(W).length-1);k(Z>=0?Z:0),w(`已删除服务器: ${K}`)},[K,U,Q,O]);g((W,Z)=>{if(y==="json"||y==="test"){if(Z.escape)C();return}if(Z.upArrow)k((J)=>J>0?J-1:q.length-1);else if(Z.downArrow)k((J)=>J<q.length-1?J+1:0);else if(W==="n"||W==="N")r();else if((W==="e"||W==="E"||Z.return)&&K)t();else if((W==="d"||W==="D")&&K)zz();else if((W==="t"||W==="T")&&K)s();else if(Z.escape)Y()},{isActive:!0});let Gz=H.useMemo(()=>{if(q.length===0)return z.jsxDEV(X,{paddingX:2,paddingY:1,children:[z.jsxDEV(G,{color:"yellow",children:"未配置任何 MCP 服务器"},void 0,!1,void 0,this),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:["按 ",z.jsxDEV(G,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 添加新服务器"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return z.jsxDEV(X,{flexDirection:"column",paddingX:2,gap:1,children:[q.map((W,Z)=>{let J=Q[W],T=v(J);return z.jsxDEV(X,{marginBottom:0,gap:1,children:[z.jsxDEV(G,{color:Z===U?"cyan":"gray",bold:Z===U,children:Z===U?">":" "},void 0,!1,void 0,this),z.jsxDEV(G,{bold:Z===U,color:Z===U?"cyan":void 0,children:W},void 0,!1,void 0,this),z.jsxDEV(a,{},void 0,!1,void 0,this),z.jsxDEV(G,{color:T==="stdio"?"green":T==="SSE"?"blue":"yellow",dimColor:Z!==U,children:["[",T.toUpperCase(),"]"]},void 0,!0,void 0,this)]},`server-${Z}-${W}`,!0,void 0,this)}),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:[z.jsxDEV(G,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",z.jsxDEV(G,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增 ",z.jsxDEV(G,{color:"cyan",children:"e"},void 0,!1,void 0,this)," ","编辑 ",z.jsxDEV(G,{color:"cyan",children:"d"},void 0,!1,void 0,this)," 删除 ",z.jsxDEV(G,{color:"cyan",children:"t"},void 0,!1,void 0,this)," 测试"," ",z.jsxDEV(G,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[q,Q,U,v]),Wz=H.useMemo(()=>{if(!f||!P)return z.jsxDEV(X,{paddingX:2,paddingY:1,children:z.jsxDEV(G,{color:"yellow",children:"正在验证配置..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(P.success)return z.jsxDEV(X,{flexDirection:"column",paddingX:2,gap:1,children:[z.jsxDEV(X,{children:z.jsxDEV(G,{color:"green",children:["✓ ",P.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this),P.tools&&P.tools.length>0&&z.jsxDEV(X,{flexDirection:"column",marginTop:1,children:[z.jsxDEV(G,{color:"gray",children:["发现 ",P.tools.length," 个工具:"]},void 0,!0,void 0,this),P.tools.slice(0,10).map((W)=>z.jsxDEV(X,{paddingLeft:2,children:z.jsxDEV(G,{color:"gray",children:["- ",W]},void 0,!0,void 0,this)},W,!1,void 0,this)),P.tools.length>10&&z.jsxDEV(X,{paddingLeft:2,children:z.jsxDEV(G,{color:"gray",children:["... 还有 ",P.tools.length-10," 个工具"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:["按 ",z.jsxDEV(G,{color:"cyan",children:"Enter"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);else return z.jsxDEV(X,{flexDirection:"column",paddingX:2,gap:1,children:[z.jsxDEV(X,{children:z.jsxDEV(G,{color:"red",children:"✗ 验证失败"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(X,{children:z.jsxDEV(G,{color:"yellow",children:P.message},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV(X,{marginTop:1,children:[z.jsxDEV(G,{color:"gray",children:"建议检查:"},void 0,!1,void 0,this),z.jsxDEV(G,{color:"gray",children:"- 配置格式是否正确"},void 0,!1,void 0,this),z.jsxDEV(G,{color:"gray",children:"- 命令是否已安装(stdio 模式)"},void 0,!1,void 0,this),z.jsxDEV(G,{color:"gray",children:"- URL 是否可访问(SSE 模式)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(X,{marginTop:1,children:z.jsxDEV(G,{color:"gray",dimColor:!0,children:["按 ",z.jsxDEV(G,{color:"cyan",children:"Enter"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[f,P]);return g((W,Z)=>{if(y==="test"&&Z.return)C()},{isActive:y==="test"}),z.jsxDEV(X,{flexDirection:"column",children:[z.jsxDEV(X,{paddingX:2,paddingY:1,children:z.jsxDEV(G,{bold:!0,color:"cyan",children:"MCP Servers"},void 0,!1,void 0,this)},void 0,!1,void 0,this),y==="list"?Gz:y==="json"?z.jsxDEV(l,{mode:I,serverName:V||void 0,serverConfig:R||void 0,onCancel:C,onSave:e},void 0,!1,void 0,this):Wz,N&&z.jsxDEV(X,{paddingX:2,paddingY:0,children:z.jsxDEV(G,{color:"green",children:N},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},kz=Hz;export{kz as default};
@@ -1,4 +1,4 @@
1
- import{Fl as W8,Hl as E1,Kl as o5}from"./chunk-z3e4c424.js";var Y4=E1((sY,X6)=>{var J6=["nodebuffer","arraybuffer","fragments"],K6=typeof Blob<"u";if(K6)J6.push("blob");X6.exports={BINARY_TYPES:J6,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:K6,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var _3=E1((oY,$7)=>{var{EMPTY_BUFFER:qI}=Y4(),gJ=Buffer[Symbol.species];function UI(G,H){if(G.length===0)return qI;if(G.length===1)return G[0];let R=Buffer.allocUnsafe(H),P=0;for(let D=0;D<G.length;D++){let M=G[D];R.set(M,P),P+=M.length}if(P<H)return new gJ(R.buffer,R.byteOffset,P);return R}function Z6(G,H,R,P,D){for(let M=0;M<D;M++)R[P+M]=G[M]^H[M&3]}function $6(G,H){for(let R=0;R<G.length;R++)G[R]^=H[R&3]}function LI(G){if(G.length===G.buffer.byteLength)return G.buffer;return G.buffer.slice(G.byteOffset,G.byteOffset+G.length)}function hJ(G){if(hJ.readOnly=!0,Buffer.isBuffer(G))return G;let H;if(G instanceof ArrayBuffer)H=new gJ(G);else if(ArrayBuffer.isView(G))H=new gJ(G.buffer,G.byteOffset,G.byteLength);else H=Buffer.from(G),hJ.readOnly=!1;return H}$7.exports={concat:UI,mask:Z6,toArrayBuffer:LI,toBuffer:hJ,unmask:$6};if(!process.env.WS_NO_BUFFER_UTIL)try{let G=(()=>{throw new Error("Cannot require module "+"bufferutil");})();$7.exports.mask=function(H,R,P,D,M){if(M<48)Z6(H,R,P,D,M);else G.mask(H,R,P,D,M)},$7.exports.unmask=function(H,R){if(H.length<32)$6(H,R);else G.unmask(H,R)}}catch(G){}});var z6=E1((tY,I6)=>{var Q6=Symbol("kDone"),mJ=Symbol("kRun");class G6{constructor(G){this[Q6]=()=>{this.pending--,this[mJ]()},this.concurrency=G||1/0,this.jobs=[],this.pending=0}add(G){this.jobs.push(G),this[mJ]()}[mJ](){if(this.pending===this.concurrency)return;if(this.jobs.length){let G=this.jobs.shift();this.pending++,G(this[Q6])}}}I6.exports=G6});var N3=E1((eY,H6)=>{var H3=o5("zlib"),j6=_3(),WI=z6(),{kStatusCode:Y6}=Y4(),EI=Buffer[Symbol.species],yI=Buffer.from([0,0,255,255]),G7=Symbol("permessage-deflate"),V4=Symbol("total-length"),T8=Symbol("callback"),U4=Symbol("buffers"),x8=Symbol("error"),Q7;class V6{constructor(G,H,R){if(this._maxPayload=R|0,this._options=G||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!H,this._deflate=null,this._inflate=null,this.params=null,!Q7){let P=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Q7=new WI(P)}}static get extensionName(){return"permessage-deflate"}offer(){let G={};if(this._options.serverNoContextTakeover)G.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)G.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)G.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)G.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)G.client_max_window_bits=!0;return G}accept(G){return G=this.normalizeParams(G),this.params=this._isServer?this.acceptAsServer(G):this.acceptAsClient(G),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let G=this._deflate[T8];if(this._deflate.close(),this._deflate=null,G)G(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(G){let H=this._options,R=G.find((P)=>{if(H.serverNoContextTakeover===!1&&P.server_no_context_takeover||P.server_max_window_bits&&(H.serverMaxWindowBits===!1||typeof H.serverMaxWindowBits==="number"&&H.serverMaxWindowBits>P.server_max_window_bits)||typeof H.clientMaxWindowBits==="number"&&!P.client_max_window_bits)return!1;return!0});if(!R)throw Error("None of the extension offers can be accepted");if(H.serverNoContextTakeover)R.server_no_context_takeover=!0;if(H.clientNoContextTakeover)R.client_no_context_takeover=!0;if(typeof H.serverMaxWindowBits==="number")R.server_max_window_bits=H.serverMaxWindowBits;if(typeof H.clientMaxWindowBits==="number")R.client_max_window_bits=H.clientMaxWindowBits;else if(R.client_max_window_bits===!0||H.clientMaxWindowBits===!1)delete R.client_max_window_bits;return R}acceptAsClient(G){let H=G[0];if(this._options.clientNoContextTakeover===!1&&H.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!H.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")H.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&H.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return H}normalizeParams(G){return G.forEach((H)=>{Object.keys(H).forEach((R)=>{let P=H[R];if(P.length>1)throw Error(`Parameter "${R}" must have only a single value`);if(P=P[0],R==="client_max_window_bits"){if(P!==!0){let D=+P;if(!Number.isInteger(D)||D<8||D>15)throw TypeError(`Invalid value for parameter "${R}": ${P}`);P=D}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${R}": ${P}`)}else if(R==="server_max_window_bits"){let D=+P;if(!Number.isInteger(D)||D<8||D>15)throw TypeError(`Invalid value for parameter "${R}": ${P}`);P=D}else if(R==="client_no_context_takeover"||R==="server_no_context_takeover"){if(P!==!0)throw TypeError(`Invalid value for parameter "${R}": ${P}`)}else throw Error(`Unknown parameter "${R}"`);H[R]=P})}),G}decompress(G,H,R){Q7.add((P)=>{this._decompress(G,H,(D,M)=>{P(),R(D,M)})})}compress(G,H,R){Q7.add((P)=>{this._compress(G,H,(D,M)=>{P(),R(D,M)})})}_decompress(G,H,R){let P=this._isServer?"client":"server";if(!this._inflate){let D=`${P}_max_window_bits`,M=typeof this.params[D]!=="number"?H3.Z_DEFAULT_WINDOWBITS:this.params[D];this._inflate=H3.createInflateRaw({...this._options.zlibInflateOptions,windowBits:M}),this._inflate[G7]=this,this._inflate[V4]=0,this._inflate[U4]=[],this._inflate.on("error",vI),this._inflate.on("data",_6)}if(this._inflate[T8]=R,this._inflate.write(G),H)this._inflate.write(yI);this._inflate.flush(()=>{let D=this._inflate[x8];if(D){this._inflate.close(),this._inflate=null,R(D);return}let M=j6.concat(this._inflate[U4],this._inflate[V4]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[V4]=0,this._inflate[U4]=[],H&&this.params[`${P}_no_context_takeover`])this._inflate.reset();R(null,M)})}_compress(G,H,R){let P=this._isServer?"server":"client";if(!this._deflate){let D=`${P}_max_window_bits`,M=typeof this.params[D]!=="number"?H3.Z_DEFAULT_WINDOWBITS:this.params[D];this._deflate=H3.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:M}),this._deflate[V4]=0,this._deflate[U4]=[],this._deflate.on("data",SI)}this._deflate[T8]=R,this._deflate.write(G),this._deflate.flush(H3.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let D=j6.concat(this._deflate[U4],this._deflate[V4]);if(H)D=new EI(D.buffer,D.byteOffset,D.length-4);if(this._deflate[T8]=null,this._deflate[V4]=0,this._deflate[U4]=[],H&&this.params[`${P}_no_context_takeover`])this._deflate.reset();R(null,D)})}}H6.exports=V6;function SI(G){this[U4].push(G),this[V4]+=G.length}function _6(G){if(this[V4]+=G.length,this[G7]._maxPayload<1||this[V4]<=this[G7]._maxPayload){this[U4].push(G);return}this[x8]=RangeError("Max payload size exceeded"),this[x8].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[x8][Y6]=1009,this.removeListener("data",_6),this.reset()}function vI(G){if(this[G7]._inflate=null,this[x8]){this[T8](this[x8]);return}G[Y6]=1007,this[T8](G)}});var B8=E1((JV,I7)=>{var{isUtf8:N6}=o5("buffer"),{hasBlob:wI}=Y4(),gI=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function hI(G){return G>=1000&&G<=1014&&G!==1004&&G!==1005&&G!==1006||G>=3000&&G<=4999}function fJ(G){let H=G.length,R=0;while(R<H)if((G[R]&128)===0)R++;else if((G[R]&224)===192){if(R+1===H||(G[R+1]&192)!==128||(G[R]&254)===192)return!1;R+=2}else if((G[R]&240)===224){if(R+2>=H||(G[R+1]&192)!==128||(G[R+2]&192)!==128||G[R]===224&&(G[R+1]&224)===128||G[R]===237&&(G[R+1]&224)===160)return!1;R+=3}else if((G[R]&248)===240){if(R+3>=H||(G[R+1]&192)!==128||(G[R+2]&192)!==128||(G[R+3]&192)!==128||G[R]===240&&(G[R+1]&240)===128||G[R]===244&&G[R+1]>143||G[R]>244)return!1;R+=4}else return!1;return!0}function mI(G){return wI&&typeof G==="object"&&typeof G.arrayBuffer==="function"&&typeof G.type==="string"&&typeof G.stream==="function"&&(G[Symbol.toStringTag]==="Blob"||G[Symbol.toStringTag]==="File")}I7.exports={isBlob:mI,isValidStatusCode:hI,isValidUTF8:fJ,tokenChars:gI};if(N6)I7.exports.isValidUTF8=function(G){return G.length<24?fJ(G):N6(G)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let G=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();I7.exports.isValidUTF8=function(H){return H.length<32?fJ(H):G(H)}}catch(G){}});var lJ=E1((KV,O6)=>{var{Writable:fI}=o5("stream"),R6=N3(),{BINARY_TYPES:uI,EMPTY_BUFFER:A6,kStatusCode:lI,kWebSocket:pI}=Y4(),{concat:uJ,toArrayBuffer:kI,unmask:bI}=_3(),{isValidStatusCode:iI,isValidUTF8:F6}=B8(),z7=Buffer[Symbol.species];class D6 extends fI{constructor(G={}){super();this._allowSynchronousEvents=G.allowSynchronousEvents!==void 0?G.allowSynchronousEvents:!0,this._binaryType=G.binaryType||uI[0],this._extensions=G.extensions||{},this._isServer=!!G.isServer,this._maxPayload=G.maxPayload|0,this._skipUTF8Validation=!!G.skipUTF8Validation,this[pI]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(G,H,R){if(this._opcode===8&&this._state==0)return R();this._bufferedBytes+=G.length,this._buffers.push(G),this.startLoop(R)}consume(G){if(this._bufferedBytes-=G,G===this._buffers[0].length)return this._buffers.shift();if(G<this._buffers[0].length){let R=this._buffers[0];return this._buffers[0]=new z7(R.buffer,R.byteOffset+G,R.length-G),new z7(R.buffer,R.byteOffset,G)}let H=Buffer.allocUnsafe(G);do{let R=this._buffers[0],P=H.length-G;if(G>=R.length)H.set(this._buffers.shift(),P);else H.set(new Uint8Array(R.buffer,R.byteOffset,G),P),this._buffers[0]=new z7(R.buffer,R.byteOffset+G,R.length-G);G-=R.length}while(G>0);return H}startLoop(G){this._loop=!0;do switch(this._state){case 0:this.getInfo(G);break;case 1:this.getPayloadLength16(G);break;case 2:this.getPayloadLength64(G);break;case 3:this.getMask();break;case 4:this.getData(G);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)G()}getInfo(G){if(this._bufferedBytes<2){this._loop=!1;return}let H=this.consume(2);if((H[0]&48)!==0){let P=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");G(P);return}let R=(H[0]&64)===64;if(R&&!this._extensions[R6.extensionName]){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");G(P);return}if(this._fin=(H[0]&128)===128,this._opcode=H[0]&15,this._payloadLength=H[1]&127,this._opcode===0){if(R){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");G(P);return}if(!this._fragmented){let P=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");G(P);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");G(P);return}this._compressed=R}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let P=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");G(P);return}if(R){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");G(P);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let P=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");G(P);return}}else{let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");G(P);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(H[1]&128)===128,this._isServer){if(!this._masked){let P=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");G(P);return}}else if(this._masked){let P=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");G(P);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(G)}getPayloadLength16(G){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(G)}getPayloadLength64(G){if(this._bufferedBytes<8){this._loop=!1;return}let H=this.consume(8),R=H.readUInt32BE(0);if(R>Math.pow(2,21)-1){let P=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");G(P);return}this._payloadLength=R*Math.pow(2,32)+H.readUInt32BE(4),this.haveLength(G)}haveLength(G){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let H=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");G(H);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(G){let H=A6;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(H=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)bI(H,this._mask)}if(this._opcode>7){this.controlMessage(H,G);return}if(this._compressed){this._state=5,this.decompress(H,G);return}if(H.length)this._messageLength=this._totalPayloadLength,this._fragments.push(H);this.dataMessage(G)}decompress(G,H){this._extensions[R6.extensionName].decompress(G,this._fin,(P,D)=>{if(P)return H(P);if(D.length){if(this._messageLength+=D.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let M=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");H(M);return}this._fragments.push(D)}if(this.dataMessage(H),this._state===0)this.startLoop(H)})}dataMessage(G){if(!this._fin){this._state=0;return}let H=this._messageLength,R=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let P;if(this._binaryType==="nodebuffer")P=uJ(R,H);else if(this._binaryType==="arraybuffer")P=kI(uJ(R,H));else if(this._binaryType==="blob")P=new Blob(R);else P=R;if(this._allowSynchronousEvents)this.emit("message",P,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",P,!0),this._state=0,this.startLoop(G)})}else{let P=uJ(R,H);if(!this._skipUTF8Validation&&!F6(P)){let D=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");G(D);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",P,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",P,!1),this._state=0,this.startLoop(G)})}}controlMessage(G,H){if(this._opcode===8){if(G.length===0)this._loop=!1,this.emit("conclude",1005,A6),this.end();else{let R=G.readUInt16BE(0);if(!iI(R)){let D=this.createError(RangeError,`invalid status code ${R}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");H(D);return}let P=new z7(G.buffer,G.byteOffset+2,G.length-2);if(!this._skipUTF8Validation&&!F6(P)){let D=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");H(D);return}this._loop=!1,this.emit("conclude",R,P),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",G),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",G),this._state=0,this.startLoop(H)})}createError(G,H,R,P,D){this._loop=!1,this._errored=!0;let M=new G(R?`Invalid WebSocket frame: ${H}`:H);return Error.captureStackTrace(M,this.createError),M.code=D,M[lI]=P,M}}O6.exports=D6});var kJ=E1((ZV,T6)=>{var{Duplex:XV}=o5("stream"),{randomFillSync:dI}=o5("crypto"),M6=N3(),{EMPTY_BUFFER:cI,kWebSocket:nI,NOOP:rI}=Y4(),{isBlob:C8,isValidStatusCode:aI}=B8(),{mask:P6,toBuffer:n4}=_3(),k1=Symbol("kByteLength"),sI=Buffer.alloc(4),r4,q8=8192,c1=0,oI=1,tI=2;class L4{constructor(G,H,R){if(this._extensions=H||{},R)this._generateMask=R,this._maskBuffer=Buffer.alloc(4);this._socket=G,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=c1,this.onerror=rI,this[nI]=void 0}static frame(G,H){let R,P=!1,D=2,M=!1;if(H.mask){if(R=H.maskBuffer||sI,H.generateMask)H.generateMask(R);else{if(q8===8192){if(r4===void 0)r4=Buffer.alloc(8192);dI(r4,0,8192),q8=0}R[0]=r4[q8++],R[1]=r4[q8++],R[2]=r4[q8++],R[3]=r4[q8++]}M=(R[0]|R[1]|R[2]|R[3])===0,D=6}let p;if(typeof G==="string")if((!H.mask||M)&&H[k1]!==void 0)p=H[k1];else G=Buffer.from(G),p=G.length;else p=G.length,P=H.mask&&H.readOnly&&!M;let f=p;if(p>=65536)D+=8,f=127;else if(p>125)D+=2,f=126;let u=Buffer.allocUnsafe(P?p+D:D);if(u[0]=H.fin?H.opcode|128:H.opcode,H.rsv1)u[0]|=64;if(u[1]=f,f===126)u.writeUInt16BE(p,2);else if(f===127)u[2]=u[3]=0,u.writeUIntBE(p,4,6);if(!H.mask)return[u,G];if(u[1]|=128,u[D-4]=R[0],u[D-3]=R[1],u[D-2]=R[2],u[D-1]=R[3],M)return[u,G];if(P)return P6(G,R,u,D,p),[u];return P6(G,R,G,0,p),[u,G]}close(G,H,R,P){let D;if(G===void 0)D=cI;else if(typeof G!=="number"||!aI(G))throw TypeError("First argument must be a valid error code number");else if(H===void 0||!H.length)D=Buffer.allocUnsafe(2),D.writeUInt16BE(G,0);else{let p=Buffer.byteLength(H);if(p>123)throw RangeError("The message must not be greater than 123 bytes");if(D=Buffer.allocUnsafe(2+p),D.writeUInt16BE(G,0),typeof H==="string")D.write(H,2);else D.set(H,2)}let M={[k1]:D.length,fin:!0,generateMask:this._generateMask,mask:R,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==c1)this.enqueue([this.dispatch,D,!1,M,P]);else this.sendFrame(L4.frame(D,M),P)}ping(G,H,R){let P,D;if(typeof G==="string")P=Buffer.byteLength(G),D=!1;else if(C8(G))P=G.size,D=!1;else G=n4(G),P=G.length,D=n4.readOnly;if(P>125)throw RangeError("The data size must not be greater than 125 bytes");let M={[k1]:P,fin:!0,generateMask:this._generateMask,mask:H,maskBuffer:this._maskBuffer,opcode:9,readOnly:D,rsv1:!1};if(C8(G))if(this._state!==c1)this.enqueue([this.getBlobData,G,!1,M,R]);else this.getBlobData(G,!1,M,R);else if(this._state!==c1)this.enqueue([this.dispatch,G,!1,M,R]);else this.sendFrame(L4.frame(G,M),R)}pong(G,H,R){let P,D;if(typeof G==="string")P=Buffer.byteLength(G),D=!1;else if(C8(G))P=G.size,D=!1;else G=n4(G),P=G.length,D=n4.readOnly;if(P>125)throw RangeError("The data size must not be greater than 125 bytes");let M={[k1]:P,fin:!0,generateMask:this._generateMask,mask:H,maskBuffer:this._maskBuffer,opcode:10,readOnly:D,rsv1:!1};if(C8(G))if(this._state!==c1)this.enqueue([this.getBlobData,G,!1,M,R]);else this.getBlobData(G,!1,M,R);else if(this._state!==c1)this.enqueue([this.dispatch,G,!1,M,R]);else this.sendFrame(L4.frame(G,M),R)}send(G,H,R){let P=this._extensions[M6.extensionName],D=H.binary?2:1,M=H.compress,p,f;if(typeof G==="string")p=Buffer.byteLength(G),f=!1;else if(C8(G))p=G.size,f=!1;else G=n4(G),p=G.length,f=n4.readOnly;if(this._firstFragment){if(this._firstFragment=!1,M&&P&&P.params[P._isServer?"server_no_context_takeover":"client_no_context_takeover"])M=p>=P._threshold;this._compress=M}else M=!1,D=0;if(H.fin)this._firstFragment=!0;let u={[k1]:p,fin:H.fin,generateMask:this._generateMask,mask:H.mask,maskBuffer:this._maskBuffer,opcode:D,readOnly:f,rsv1:M};if(C8(G))if(this._state!==c1)this.enqueue([this.getBlobData,G,this._compress,u,R]);else this.getBlobData(G,this._compress,u,R);else if(this._state!==c1)this.enqueue([this.dispatch,G,this._compress,u,R]);else this.dispatch(G,this._compress,u,R)}getBlobData(G,H,R,P){this._bufferedBytes+=R[k1],this._state=tI,G.arrayBuffer().then((D)=>{if(this._socket.destroyed){let p=Error("The socket was closed while the blob was being read");process.nextTick(pJ,this,p,P);return}this._bufferedBytes-=R[k1];let M=n4(D);if(!H)this._state=c1,this.sendFrame(L4.frame(M,R),P),this.dequeue();else this.dispatch(M,H,R,P)}).catch((D)=>{process.nextTick(eI,this,D,P)})}dispatch(G,H,R,P){if(!H){this.sendFrame(L4.frame(G,R),P);return}let D=this._extensions[M6.extensionName];this._bufferedBytes+=R[k1],this._state=oI,D.compress(G,R.fin,(M,p)=>{if(this._socket.destroyed){let f=Error("The socket was closed while data was being compressed");pJ(this,f,P);return}this._bufferedBytes-=R[k1],this._state=c1,R.readOnly=!1,this.sendFrame(L4.frame(p,R),P),this.dequeue()})}dequeue(){while(this._state===c1&&this._queue.length){let G=this._queue.shift();this._bufferedBytes-=G[3][k1],Reflect.apply(G[0],this,G.slice(1))}}enqueue(G){this._bufferedBytes+=G[3][k1],this._queue.push(G)}sendFrame(G,H){if(G.length===2)this._socket.cork(),this._socket.write(G[0]),this._socket.write(G[1],H),this._socket.uncork();else this._socket.write(G[0],H)}}T6.exports=L4;function pJ(G,H,R){if(typeof R==="function")R(H);for(let P=0;P<G._queue.length;P++){let D=G._queue[P],M=D[D.length-1];if(typeof M==="function")M(H)}}function eI(G,H,R){pJ(G,H,R),G.onerror(H)}});var y6=E1(($V,E6)=>{var{kForOnEventAttribute:R3,kListener:bJ}=Y4(),x6=Symbol("kCode"),B6=Symbol("kData"),C6=Symbol("kError"),q6=Symbol("kMessage"),U6=Symbol("kReason"),U8=Symbol("kTarget"),L6=Symbol("kType"),W6=Symbol("kWasClean");class W4{constructor(G){this[U8]=null,this[L6]=G}get target(){return this[U8]}get type(){return this[L6]}}Object.defineProperty(W4.prototype,"target",{enumerable:!0});Object.defineProperty(W4.prototype,"type",{enumerable:!0});class L8 extends W4{constructor(G,H={}){super(G);this[x6]=H.code===void 0?0:H.code,this[U6]=H.reason===void 0?"":H.reason,this[W6]=H.wasClean===void 0?!1:H.wasClean}get code(){return this[x6]}get reason(){return this[U6]}get wasClean(){return this[W6]}}Object.defineProperty(L8.prototype,"code",{enumerable:!0});Object.defineProperty(L8.prototype,"reason",{enumerable:!0});Object.defineProperty(L8.prototype,"wasClean",{enumerable:!0});class A3 extends W4{constructor(G,H={}){super(G);this[C6]=H.error===void 0?null:H.error,this[q6]=H.message===void 0?"":H.message}get error(){return this[C6]}get message(){return this[q6]}}Object.defineProperty(A3.prototype,"error",{enumerable:!0});Object.defineProperty(A3.prototype,"message",{enumerable:!0});class Y7 extends W4{constructor(G,H={}){super(G);this[B6]=H.data===void 0?null:H.data}get data(){return this[B6]}}Object.defineProperty(Y7.prototype,"data",{enumerable:!0});var Jz={addEventListener(G,H,R={}){for(let D of this.listeners(G))if(!R[R3]&&D[bJ]===H&&!D[R3])return;let P;if(G==="message")P=function(M,p){let f=new Y7("message",{data:p?M:M.toString()});f[U8]=this,j7(H,this,f)};else if(G==="close")P=function(M,p){let f=new L8("close",{code:M,reason:p.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});f[U8]=this,j7(H,this,f)};else if(G==="error")P=function(M){let p=new A3("error",{error:M,message:M.message});p[U8]=this,j7(H,this,p)};else if(G==="open")P=function(){let M=new W4("open");M[U8]=this,j7(H,this,M)};else return;if(P[R3]=!!R[R3],P[bJ]=H,R.once)this.once(G,P);else this.on(G,P)},removeEventListener(G,H){for(let R of this.listeners(G))if(R[bJ]===H&&!R[R3]){this.removeListener(G,R);break}}};E6.exports={CloseEvent:L8,ErrorEvent:A3,Event:W4,EventTarget:Jz,MessageEvent:Y7};function j7(G,H,R){if(typeof G==="object"&&G.handleEvent)G.handleEvent.call(G,R);else G.call(H,R)}});var iJ=E1((QV,S6)=>{var{tokenChars:F3}=B8();function X4(G,H,R){if(G[H]===void 0)G[H]=[R];else G[H].push(R)}function Kz(G){let H=Object.create(null),R=Object.create(null),P=!1,D=!1,M=!1,p,f,u=-1,V0=-1,R0=-1,Z0=0;for(;Z0<G.length;Z0++)if(V0=G.charCodeAt(Z0),p===void 0)if(R0===-1&&F3[V0]===1){if(u===-1)u=Z0}else if(Z0!==0&&(V0===32||V0===9)){if(R0===-1&&u!==-1)R0=Z0}else if(V0===59||V0===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(R0===-1)R0=Z0;let h=G.slice(u,R0);if(V0===44)X4(H,h,R),R=Object.create(null);else p=h;u=R0=-1}else throw SyntaxError(`Unexpected character at index ${Z0}`);else if(f===void 0)if(R0===-1&&F3[V0]===1){if(u===-1)u=Z0}else if(V0===32||V0===9){if(R0===-1&&u!==-1)R0=Z0}else if(V0===59||V0===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(R0===-1)R0=Z0;if(X4(R,G.slice(u,R0),!0),V0===44)X4(H,p,R),R=Object.create(null),p=void 0;u=R0=-1}else if(V0===61&&u!==-1&&R0===-1)f=G.slice(u,Z0),u=R0=-1;else throw SyntaxError(`Unexpected character at index ${Z0}`);else if(D){if(F3[V0]!==1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(u===-1)u=Z0;else if(!P)P=!0;D=!1}else if(M)if(F3[V0]===1){if(u===-1)u=Z0}else if(V0===34&&u!==-1)M=!1,R0=Z0;else if(V0===92)D=!0;else throw SyntaxError(`Unexpected character at index ${Z0}`);else if(V0===34&&G.charCodeAt(Z0-1)===61)M=!0;else if(R0===-1&&F3[V0]===1){if(u===-1)u=Z0}else if(u!==-1&&(V0===32||V0===9)){if(R0===-1)R0=Z0}else if(V0===59||V0===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(R0===-1)R0=Z0;let h=G.slice(u,R0);if(P)h=h.replace(/\\/g,""),P=!1;if(X4(R,f,h),V0===44)X4(H,p,R),R=Object.create(null),p=void 0;f=void 0,u=R0=-1}else throw SyntaxError(`Unexpected character at index ${Z0}`);if(u===-1||M||V0===32||V0===9)throw SyntaxError("Unexpected end of input");if(R0===-1)R0=Z0;let U=G.slice(u,R0);if(p===void 0)X4(H,U,R);else{if(f===void 0)X4(R,U,!0);else if(P)X4(R,f,U.replace(/\\/g,""));else X4(R,f,U);X4(H,p,R)}return H}function Xz(G){return Object.keys(G).map((H)=>{let R=G[H];if(!Array.isArray(R))R=[R];return R.map((P)=>{return[H].concat(Object.keys(P).map((D)=>{let M=P[D];if(!Array.isArray(M))M=[M];return M.map((p)=>p===!0?D:`${D}=${p}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}S6.exports={format:Xz,parse:Kz}});var N7=E1((zV,i6)=>{var Zz=o5("events"),$z=o5("https"),Qz=o5("http"),g6=o5("net"),Gz=o5("tls"),{randomBytes:Iz,createHash:zz}=o5("crypto"),{Duplex:GV,Readable:IV}=o5("stream"),{URL:dJ}=o5("url"),E4=N3(),jz=lJ(),Yz=kJ(),{isBlob:Vz}=B8(),{BINARY_TYPES:v6,CLOSE_TIMEOUT:_z,EMPTY_BUFFER:V7,GUID:Hz,kForOnEventAttribute:cJ,kListener:Nz,kStatusCode:Rz,kWebSocket:Y1,NOOP:h6}=Y4(),{EventTarget:{addEventListener:Az,removeEventListener:Fz}}=y6(),{format:Dz,parse:Oz}=iJ(),{toBuffer:Mz}=_3(),m6=Symbol("kAborted"),nJ=[8,13],_4=["CONNECTING","OPEN","CLOSING","CLOSED"],Pz=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class a0 extends Zz{constructor(G,H,R){super();if(this._binaryType=v6[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=V7,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=a0.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,G!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,H===void 0)H=[];else if(!Array.isArray(H))if(typeof H==="object"&&H!==null)R=H,H=[];else H=[H];f6(this,G,H,R)}else this._autoPong=R.autoPong,this._closeTimeout=R.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(G){if(!v6.includes(G))return;if(this._binaryType=G,this._receiver)this._receiver._binaryType=G}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(G,H,R){let P=new jz({allowSynchronousEvents:R.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:R.maxPayload,skipUTF8Validation:R.skipUTF8Validation}),D=new Yz(G,this._extensions,R.generateMask);if(this._receiver=P,this._sender=D,this._socket=G,P[Y1]=this,D[Y1]=this,G[Y1]=this,P.on("conclude",Bz),P.on("drain",Cz),P.on("error",qz),P.on("message",Uz),P.on("ping",Lz),P.on("pong",Wz),D.onerror=Ez,G.setTimeout)G.setTimeout(0);if(G.setNoDelay)G.setNoDelay();if(H.length>0)G.unshift(H);G.on("close",p6),G.on("data",H7),G.on("end",k6),G.on("error",b6),this._readyState=a0.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=a0.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[E4.extensionName])this._extensions[E4.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=a0.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(G,H){if(this.readyState===a0.CLOSED)return;if(this.readyState===a0.CONNECTING){v1(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===a0.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=a0.CLOSING,this._sender.close(G,H,!this._isServer,(R)=>{if(R)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),l6(this)}pause(){if(this.readyState===a0.CONNECTING||this.readyState===a0.CLOSED)return;this._paused=!0,this._socket.pause()}ping(G,H,R){if(this.readyState===a0.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof G==="function")R=G,G=H=void 0;else if(typeof H==="function")R=H,H=void 0;if(typeof G==="number")G=G.toString();if(this.readyState!==a0.OPEN){rJ(this,G,R);return}if(H===void 0)H=!this._isServer;this._sender.ping(G||V7,H,R)}pong(G,H,R){if(this.readyState===a0.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof G==="function")R=G,G=H=void 0;else if(typeof H==="function")R=H,H=void 0;if(typeof G==="number")G=G.toString();if(this.readyState!==a0.OPEN){rJ(this,G,R);return}if(H===void 0)H=!this._isServer;this._sender.pong(G||V7,H,R)}resume(){if(this.readyState===a0.CONNECTING||this.readyState===a0.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(G,H,R){if(this.readyState===a0.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof H==="function")R=H,H={};if(typeof G==="number")G=G.toString();if(this.readyState!==a0.OPEN){rJ(this,G,R);return}let P={binary:typeof G!=="string",mask:!this._isServer,compress:!0,fin:!0,...H};if(!this._extensions[E4.extensionName])P.compress=!1;this._sender.send(G||V7,P,R)}terminate(){if(this.readyState===a0.CLOSED)return;if(this.readyState===a0.CONNECTING){v1(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=a0.CLOSING,this._socket.destroy()}}Object.defineProperty(a0,"CONNECTING",{enumerable:!0,value:_4.indexOf("CONNECTING")});Object.defineProperty(a0.prototype,"CONNECTING",{enumerable:!0,value:_4.indexOf("CONNECTING")});Object.defineProperty(a0,"OPEN",{enumerable:!0,value:_4.indexOf("OPEN")});Object.defineProperty(a0.prototype,"OPEN",{enumerable:!0,value:_4.indexOf("OPEN")});Object.defineProperty(a0,"CLOSING",{enumerable:!0,value:_4.indexOf("CLOSING")});Object.defineProperty(a0.prototype,"CLOSING",{enumerable:!0,value:_4.indexOf("CLOSING")});Object.defineProperty(a0,"CLOSED",{enumerable:!0,value:_4.indexOf("CLOSED")});Object.defineProperty(a0.prototype,"CLOSED",{enumerable:!0,value:_4.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((G)=>{Object.defineProperty(a0.prototype,G,{enumerable:!0})});["open","error","close","message"].forEach((G)=>{Object.defineProperty(a0.prototype,`on${G}`,{enumerable:!0,get(){for(let H of this.listeners(G))if(H[cJ])return H[Nz];return null},set(H){for(let R of this.listeners(G))if(R[cJ]){this.removeListener(G,R);break}if(typeof H!=="function")return;this.addEventListener(G,H,{[cJ]:!0})}})});a0.prototype.addEventListener=Az;a0.prototype.removeEventListener=Fz;i6.exports=a0;function f6(G,H,R,P){let D={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_z,protocolVersion:nJ[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...P,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(G._autoPong=D.autoPong,G._closeTimeout=D.closeTimeout,!nJ.includes(D.protocolVersion))throw RangeError(`Unsupported protocol version: ${D.protocolVersion} (supported versions: ${nJ.join(", ")})`);let M;if(H instanceof dJ)M=H;else try{M=new dJ(H)}catch(y){throw SyntaxError(`Invalid URL: ${H}`)}if(M.protocol==="http:")M.protocol="ws:";else if(M.protocol==="https:")M.protocol="wss:";G._url=M.href;let p=M.protocol==="wss:",f=M.protocol==="ws+unix:",u;if(M.protocol!=="ws:"&&!p&&!f)u=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(f&&!M.pathname)u="The URL's pathname is empty";else if(M.hash)u="The URL contains a fragment identifier";if(u){let y=SyntaxError(u);if(G._redirects===0)throw y;else{_7(G,y);return}}let V0=p?443:80,R0=Iz(16).toString("base64"),Z0=p?$z.request:Qz.request,U=new Set,h;if(D.createConnection=D.createConnection||(p?xz:Tz),D.defaultPort=D.defaultPort||V0,D.port=M.port||V0,D.host=M.hostname.startsWith("[")?M.hostname.slice(1,-1):M.hostname,D.headers={...D.headers,"Sec-WebSocket-Version":D.protocolVersion,"Sec-WebSocket-Key":R0,Connection:"Upgrade",Upgrade:"websocket"},D.path=M.pathname+M.search,D.timeout=D.handshakeTimeout,D.perMessageDeflate)h=new E4(D.perMessageDeflate!==!0?D.perMessageDeflate:{},!1,D.maxPayload),D.headers["Sec-WebSocket-Extensions"]=Dz({[E4.extensionName]:h.offer()});if(R.length){for(let y of R){if(typeof y!=="string"||!Pz.test(y)||U.has(y))throw SyntaxError("An invalid or duplicated subprotocol was specified");U.add(y)}D.headers["Sec-WebSocket-Protocol"]=R.join(",")}if(D.origin)if(D.protocolVersion<13)D.headers["Sec-WebSocket-Origin"]=D.origin;else D.headers.Origin=D.origin;if(M.username||M.password)D.auth=`${M.username}:${M.password}`;if(f){let y=D.path.split(":");D.socketPath=y[0],D.path=y[1]}let g;if(D.followRedirects){if(G._redirects===0){G._originalIpc=f,G._originalSecure=p,G._originalHostOrSocketPath=f?D.socketPath:M.host;let y=P&&P.headers;if(P={...P,headers:{}},y)for(let[r,F0]of Object.entries(y))P.headers[r.toLowerCase()]=F0}else if(G.listenerCount("redirect")===0){let y=f?G._originalIpc?D.socketPath===G._originalHostOrSocketPath:!1:G._originalIpc?!1:M.host===G._originalHostOrSocketPath;if(!y||G._originalSecure&&!p){if(delete D.headers.authorization,delete D.headers.cookie,!y)delete D.headers.host;D.auth=void 0}}if(D.auth&&!P.headers.authorization)P.headers.authorization="Basic "+Buffer.from(D.auth).toString("base64");if(g=G._req=Z0(D),G._redirects)G.emit("redirect",G.url,g)}else g=G._req=Z0(D);if(D.timeout)g.on("timeout",()=>{v1(G,g,"Opening handshake has timed out")});if(g.on("error",(y)=>{if(g===null||g[m6])return;g=G._req=null,_7(G,y)}),g.on("response",(y)=>{let r=y.headers.location,F0=y.statusCode;if(r&&D.followRedirects&&F0>=300&&F0<400){if(++G._redirects>D.maxRedirects){v1(G,g,"Maximum redirects exceeded");return}g.abort();let v0;try{v0=new dJ(r,H)}catch($0){let A0=SyntaxError(`Invalid URL: ${r}`);_7(G,A0);return}f6(G,v0,R,P)}else if(!G.emit("unexpected-response",g,y))v1(G,g,`Unexpected server response: ${y.statusCode}`)}),g.on("upgrade",(y,r,F0)=>{if(G.emit("upgrade",y),G.readyState!==a0.CONNECTING)return;g=G._req=null;let v0=y.headers.upgrade;if(v0===void 0||v0.toLowerCase()!=="websocket"){v1(G,r,"Invalid Upgrade header");return}let $0=zz("sha1").update(R0+Hz).digest("base64");if(y.headers["sec-websocket-accept"]!==$0){v1(G,r,"Invalid Sec-WebSocket-Accept header");return}let A0=y.headers["sec-websocket-protocol"],Q0;if(A0!==void 0){if(!U.size)Q0="Server sent a subprotocol but none was requested";else if(!U.has(A0))Q0="Server sent an invalid subprotocol"}else if(U.size)Q0="Server sent no subprotocol";if(Q0){v1(G,r,Q0);return}if(A0)G._protocol=A0;let H0=y.headers["sec-websocket-extensions"];if(H0!==void 0){if(!h){v1(G,r,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let I0;try{I0=Oz(H0)}catch(F5){v1(G,r,"Invalid Sec-WebSocket-Extensions header");return}let L0=Object.keys(I0);if(L0.length!==1||L0[0]!==E4.extensionName){v1(G,r,"Server indicated an extension that was not requested");return}try{h.accept(I0[E4.extensionName])}catch(F5){v1(G,r,"Invalid Sec-WebSocket-Extensions header");return}G._extensions[E4.extensionName]=h}G.setSocket(r,F0,{allowSynchronousEvents:D.allowSynchronousEvents,generateMask:D.generateMask,maxPayload:D.maxPayload,skipUTF8Validation:D.skipUTF8Validation})}),D.finishRequest)D.finishRequest(g,G);else g.end()}function _7(G,H){G._readyState=a0.CLOSING,G._errorEmitted=!0,G.emit("error",H),G.emitClose()}function Tz(G){return G.path=G.socketPath,g6.connect(G)}function xz(G){if(G.path=void 0,!G.servername&&G.servername!=="")G.servername=g6.isIP(G.host)?"":G.host;return Gz.connect(G)}function v1(G,H,R){G._readyState=a0.CLOSING;let P=Error(R);if(Error.captureStackTrace(P,v1),H.setHeader){if(H[m6]=!0,H.abort(),H.socket&&!H.socket.destroyed)H.socket.destroy();process.nextTick(_7,G,P)}else H.destroy(P),H.once("error",G.emit.bind(G,"error")),H.once("close",G.emitClose.bind(G))}function rJ(G,H,R){if(H){let P=Vz(H)?H.size:Mz(H).length;if(G._socket)G._sender._bufferedBytes+=P;else G._bufferedAmount+=P}if(R){let P=Error(`WebSocket is not open: readyState ${G.readyState} (${_4[G.readyState]})`);process.nextTick(R,P)}}function Bz(G,H){let R=this[Y1];if(R._closeFrameReceived=!0,R._closeMessage=H,R._closeCode=G,R._socket[Y1]===void 0)return;if(R._socket.removeListener("data",H7),process.nextTick(u6,R._socket),G===1005)R.close();else R.close(G,H)}function Cz(){let G=this[Y1];if(!G.isPaused)G._socket.resume()}function qz(G){let H=this[Y1];if(H._socket[Y1]!==void 0)H._socket.removeListener("data",H7),process.nextTick(u6,H._socket),H.close(G[Rz]);if(!H._errorEmitted)H._errorEmitted=!0,H.emit("error",G)}function w6(){this[Y1].emitClose()}function Uz(G,H){this[Y1].emit("message",G,H)}function Lz(G){let H=this[Y1];if(H._autoPong)H.pong(G,!this._isServer,h6);H.emit("ping",G)}function Wz(G){this[Y1].emit("pong",G)}function u6(G){G.resume()}function Ez(G){let H=this[Y1];if(H.readyState===a0.CLOSED)return;if(H.readyState===a0.OPEN)H._readyState=a0.CLOSING,l6(H);if(this._socket.end(),!H._errorEmitted)H._errorEmitted=!0,H.emit("error",G)}function l6(G){G._closeTimer=setTimeout(G._socket.destroy.bind(G._socket),G._closeTimeout)}function p6(){let G=this[Y1];if(this.removeListener("close",p6),this.removeListener("data",H7),this.removeListener("end",k6),G._readyState=a0.CLOSING,!this._readableState.endEmitted&&!G._closeFrameReceived&&!G._receiver._writableState.errorEmitted&&this._readableState.length!==0){let H=this.read(this._readableState.length);G._receiver.write(H)}if(G._receiver.end(),this[Y1]=void 0,clearTimeout(G._closeTimer),G._receiver._writableState.finished||G._receiver._writableState.errorEmitted)G.emitClose();else G._receiver.on("error",w6),G._receiver.on("finish",w6)}function H7(G){if(!this[Y1]._receiver.write(G))this.pause()}function k6(){let G=this[Y1];G._readyState=a0.CLOSING,G._receiver.end(),this.end()}function b6(){let G=this[Y1];if(this.removeListener("error",b6),this.on("error",h6),G)G._readyState=a0.CLOSING,this.destroy()}});var r6=E1((YV,n6)=>{var jV=N7(),{Duplex:yz}=o5("stream");function d6(G){G.emit("close")}function Sz(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function c6(G){if(this.removeListener("error",c6),this.destroy(),this.listenerCount("error")===0)this.emit("error",G)}function vz(G,H){let R=!0,P=new yz({...H,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return G.on("message",function(M,p){let f=!p&&P._readableState.objectMode?M.toString():M;if(!P.push(f))G.pause()}),G.once("error",function(M){if(P.destroyed)return;R=!1,P.destroy(M)}),G.once("close",function(){if(P.destroyed)return;P.push(null)}),P._destroy=function(D,M){if(G.readyState===G.CLOSED){M(D),process.nextTick(d6,P);return}let p=!1;if(G.once("error",function(u){p=!0,M(u)}),G.once("close",function(){if(!p)M(D);process.nextTick(d6,P)}),R)G.terminate()},P._final=function(D){if(G.readyState===G.CONNECTING){G.once("open",function(){P._final(D)});return}if(G._socket===null)return;if(G._socket._writableState.finished){if(D(),P._readableState.endEmitted)P.destroy()}else G._socket.once("finish",function(){D()}),G.close()},P._read=function(){if(G.isPaused)G.resume()},P._write=function(D,M,p){if(G.readyState===G.CONNECTING){G.once("open",function(){P._write(D,M,p)});return}G.send(D,p)},P.on("end",Sz),P.on("error",c6),P}n6.exports=vz});var s6=E1((VV,a6)=>{var{tokenChars:wz}=B8();function gz(G){let H=new Set,R=-1,P=-1,D=0;for(D;D<G.length;D++){let p=G.charCodeAt(D);if(P===-1&&wz[p]===1){if(R===-1)R=D}else if(D!==0&&(p===32||p===9)){if(P===-1&&R!==-1)P=D}else if(p===44){if(R===-1)throw SyntaxError(`Unexpected character at index ${D}`);if(P===-1)P=D;let f=G.slice(R,P);if(H.has(f))throw SyntaxError(`The "${f}" subprotocol is duplicated`);H.add(f),R=P=-1}else throw SyntaxError(`Unexpected character at index ${D}`)}if(R===-1||P!==-1)throw SyntaxError("Unexpected end of input");let M=G.slice(R,D);if(H.has(M))throw SyntaxError(`The "${M}" subprotocol is duplicated`);return H.add(M),H}a6.exports={parse:gz}});var K$=E1((HV,J$)=>{var hz=o5("events"),R7=o5("http"),{Duplex:_V}=o5("stream"),{createHash:mz}=o5("crypto"),o6=iJ(),a4=N3(),fz=s6(),uz=N7(),{CLOSE_TIMEOUT:lz,GUID:pz,kWebSocket:kz}=Y4(),bz=/^[+/0-9A-Za-z]{22}==$/;class e6 extends hz{constructor(G,H){super();if(G={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:lz,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:uz,...G},G.port==null&&!G.server&&!G.noServer||G.port!=null&&(G.server||G.noServer)||G.server&&G.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(G.port!=null)this._server=R7.createServer((R,P)=>{let D=R7.STATUS_CODES[426];P.writeHead(426,{"Content-Length":D.length,"Content-Type":"text/plain"}),P.end(D)}),this._server.listen(G.port,G.host,G.backlog,H);else if(G.server)this._server=G.server;if(this._server){let R=this.emit.bind(this,"connection");this._removeListeners=iz(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(P,D,M)=>{this.handleUpgrade(P,D,M,R)}})}if(G.perMessageDeflate===!0)G.perMessageDeflate={};if(G.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=G,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(G){if(this._state===2){if(G)this.once("close",()=>{G(Error("The server is not running"))});process.nextTick(D3,this);return}if(G)this.once("close",G);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(D3,this);else this._shouldEmitClose=!0;else process.nextTick(D3,this)}else{let H=this._server;this._removeListeners(),this._removeListeners=this._server=null,H.close(()=>{D3(this)})}}shouldHandle(G){if(this.options.path){let H=G.url.indexOf("?");if((H!==-1?G.url.slice(0,H):G.url)!==this.options.path)return!1}return!0}handleUpgrade(G,H,R,P){H.on("error",t6);let D=G.headers["sec-websocket-key"],M=G.headers.upgrade,p=+G.headers["sec-websocket-version"];if(G.method!=="GET"){s4(this,G,H,405,"Invalid HTTP method");return}if(M===void 0||M.toLowerCase()!=="websocket"){s4(this,G,H,400,"Invalid Upgrade header");return}if(D===void 0||!bz.test(D)){s4(this,G,H,400,"Missing or invalid Sec-WebSocket-Key header");return}if(p!==13&&p!==8){s4(this,G,H,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(G)){O3(H,400);return}let f=G.headers["sec-websocket-protocol"],u=new Set;if(f!==void 0)try{u=fz.parse(f)}catch(Z0){s4(this,G,H,400,"Invalid Sec-WebSocket-Protocol header");return}let V0=G.headers["sec-websocket-extensions"],R0={};if(this.options.perMessageDeflate&&V0!==void 0){let Z0=new a4(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let U=o6.parse(V0);if(U[a4.extensionName])Z0.accept(U[a4.extensionName]),R0[a4.extensionName]=Z0}catch(U){s4(this,G,H,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let Z0={origin:G.headers[`${p===8?"sec-websocket-origin":"origin"}`],secure:!!(G.socket.authorized||G.socket.encrypted),req:G};if(this.options.verifyClient.length===2){this.options.verifyClient(Z0,(U,h,g,y)=>{if(!U)return O3(H,h||401,g,y);this.completeUpgrade(R0,D,u,G,H,R,P)});return}if(!this.options.verifyClient(Z0))return O3(H,401)}this.completeUpgrade(R0,D,u,G,H,R,P)}completeUpgrade(G,H,R,P,D,M,p){if(!D.readable||!D.writable)return D.destroy();if(D[kz])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return O3(D,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${mz("sha1").update(H+pz).digest("base64")}`],V0=new this.options.WebSocket(null,void 0,this.options);if(R.size){let R0=this.options.handleProtocols?this.options.handleProtocols(R,P):R.values().next().value;if(R0)u.push(`Sec-WebSocket-Protocol: ${R0}`),V0._protocol=R0}if(G[a4.extensionName]){let R0=G[a4.extensionName].params,Z0=o6.format({[a4.extensionName]:[R0]});u.push(`Sec-WebSocket-Extensions: ${Z0}`),V0._extensions=G}if(this.emit("headers",u,P),D.write(u.concat(`\r
1
+ import{Dl as W8,Fl as E1,Il as o5}from"./chunk-y8qhrx11.js";var Y4=E1((sY,X6)=>{var J6=["nodebuffer","arraybuffer","fragments"],K6=typeof Blob<"u";if(K6)J6.push("blob");X6.exports={BINARY_TYPES:J6,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:K6,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var _3=E1((oY,$7)=>{var{EMPTY_BUFFER:qI}=Y4(),gJ=Buffer[Symbol.species];function UI(G,H){if(G.length===0)return qI;if(G.length===1)return G[0];let R=Buffer.allocUnsafe(H),P=0;for(let D=0;D<G.length;D++){let M=G[D];R.set(M,P),P+=M.length}if(P<H)return new gJ(R.buffer,R.byteOffset,P);return R}function Z6(G,H,R,P,D){for(let M=0;M<D;M++)R[P+M]=G[M]^H[M&3]}function $6(G,H){for(let R=0;R<G.length;R++)G[R]^=H[R&3]}function LI(G){if(G.length===G.buffer.byteLength)return G.buffer;return G.buffer.slice(G.byteOffset,G.byteOffset+G.length)}function hJ(G){if(hJ.readOnly=!0,Buffer.isBuffer(G))return G;let H;if(G instanceof ArrayBuffer)H=new gJ(G);else if(ArrayBuffer.isView(G))H=new gJ(G.buffer,G.byteOffset,G.byteLength);else H=Buffer.from(G),hJ.readOnly=!1;return H}$7.exports={concat:UI,mask:Z6,toArrayBuffer:LI,toBuffer:hJ,unmask:$6};if(!process.env.WS_NO_BUFFER_UTIL)try{let G=(()=>{throw new Error("Cannot require module "+"bufferutil");})();$7.exports.mask=function(H,R,P,D,M){if(M<48)Z6(H,R,P,D,M);else G.mask(H,R,P,D,M)},$7.exports.unmask=function(H,R){if(H.length<32)$6(H,R);else G.unmask(H,R)}}catch(G){}});var z6=E1((tY,I6)=>{var Q6=Symbol("kDone"),mJ=Symbol("kRun");class G6{constructor(G){this[Q6]=()=>{this.pending--,this[mJ]()},this.concurrency=G||1/0,this.jobs=[],this.pending=0}add(G){this.jobs.push(G),this[mJ]()}[mJ](){if(this.pending===this.concurrency)return;if(this.jobs.length){let G=this.jobs.shift();this.pending++,G(this[Q6])}}}I6.exports=G6});var N3=E1((eY,H6)=>{var H3=o5("zlib"),j6=_3(),WI=z6(),{kStatusCode:Y6}=Y4(),EI=Buffer[Symbol.species],yI=Buffer.from([0,0,255,255]),G7=Symbol("permessage-deflate"),V4=Symbol("total-length"),T8=Symbol("callback"),U4=Symbol("buffers"),x8=Symbol("error"),Q7;class V6{constructor(G,H,R){if(this._maxPayload=R|0,this._options=G||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!H,this._deflate=null,this._inflate=null,this.params=null,!Q7){let P=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Q7=new WI(P)}}static get extensionName(){return"permessage-deflate"}offer(){let G={};if(this._options.serverNoContextTakeover)G.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)G.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)G.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)G.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)G.client_max_window_bits=!0;return G}accept(G){return G=this.normalizeParams(G),this.params=this._isServer?this.acceptAsServer(G):this.acceptAsClient(G),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let G=this._deflate[T8];if(this._deflate.close(),this._deflate=null,G)G(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(G){let H=this._options,R=G.find((P)=>{if(H.serverNoContextTakeover===!1&&P.server_no_context_takeover||P.server_max_window_bits&&(H.serverMaxWindowBits===!1||typeof H.serverMaxWindowBits==="number"&&H.serverMaxWindowBits>P.server_max_window_bits)||typeof H.clientMaxWindowBits==="number"&&!P.client_max_window_bits)return!1;return!0});if(!R)throw Error("None of the extension offers can be accepted");if(H.serverNoContextTakeover)R.server_no_context_takeover=!0;if(H.clientNoContextTakeover)R.client_no_context_takeover=!0;if(typeof H.serverMaxWindowBits==="number")R.server_max_window_bits=H.serverMaxWindowBits;if(typeof H.clientMaxWindowBits==="number")R.client_max_window_bits=H.clientMaxWindowBits;else if(R.client_max_window_bits===!0||H.clientMaxWindowBits===!1)delete R.client_max_window_bits;return R}acceptAsClient(G){let H=G[0];if(this._options.clientNoContextTakeover===!1&&H.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!H.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")H.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&H.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return H}normalizeParams(G){return G.forEach((H)=>{Object.keys(H).forEach((R)=>{let P=H[R];if(P.length>1)throw Error(`Parameter "${R}" must have only a single value`);if(P=P[0],R==="client_max_window_bits"){if(P!==!0){let D=+P;if(!Number.isInteger(D)||D<8||D>15)throw TypeError(`Invalid value for parameter "${R}": ${P}`);P=D}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${R}": ${P}`)}else if(R==="server_max_window_bits"){let D=+P;if(!Number.isInteger(D)||D<8||D>15)throw TypeError(`Invalid value for parameter "${R}": ${P}`);P=D}else if(R==="client_no_context_takeover"||R==="server_no_context_takeover"){if(P!==!0)throw TypeError(`Invalid value for parameter "${R}": ${P}`)}else throw Error(`Unknown parameter "${R}"`);H[R]=P})}),G}decompress(G,H,R){Q7.add((P)=>{this._decompress(G,H,(D,M)=>{P(),R(D,M)})})}compress(G,H,R){Q7.add((P)=>{this._compress(G,H,(D,M)=>{P(),R(D,M)})})}_decompress(G,H,R){let P=this._isServer?"client":"server";if(!this._inflate){let D=`${P}_max_window_bits`,M=typeof this.params[D]!=="number"?H3.Z_DEFAULT_WINDOWBITS:this.params[D];this._inflate=H3.createInflateRaw({...this._options.zlibInflateOptions,windowBits:M}),this._inflate[G7]=this,this._inflate[V4]=0,this._inflate[U4]=[],this._inflate.on("error",vI),this._inflate.on("data",_6)}if(this._inflate[T8]=R,this._inflate.write(G),H)this._inflate.write(yI);this._inflate.flush(()=>{let D=this._inflate[x8];if(D){this._inflate.close(),this._inflate=null,R(D);return}let M=j6.concat(this._inflate[U4],this._inflate[V4]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[V4]=0,this._inflate[U4]=[],H&&this.params[`${P}_no_context_takeover`])this._inflate.reset();R(null,M)})}_compress(G,H,R){let P=this._isServer?"server":"client";if(!this._deflate){let D=`${P}_max_window_bits`,M=typeof this.params[D]!=="number"?H3.Z_DEFAULT_WINDOWBITS:this.params[D];this._deflate=H3.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:M}),this._deflate[V4]=0,this._deflate[U4]=[],this._deflate.on("data",SI)}this._deflate[T8]=R,this._deflate.write(G),this._deflate.flush(H3.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let D=j6.concat(this._deflate[U4],this._deflate[V4]);if(H)D=new EI(D.buffer,D.byteOffset,D.length-4);if(this._deflate[T8]=null,this._deflate[V4]=0,this._deflate[U4]=[],H&&this.params[`${P}_no_context_takeover`])this._deflate.reset();R(null,D)})}}H6.exports=V6;function SI(G){this[U4].push(G),this[V4]+=G.length}function _6(G){if(this[V4]+=G.length,this[G7]._maxPayload<1||this[V4]<=this[G7]._maxPayload){this[U4].push(G);return}this[x8]=RangeError("Max payload size exceeded"),this[x8].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[x8][Y6]=1009,this.removeListener("data",_6),this.reset()}function vI(G){if(this[G7]._inflate=null,this[x8]){this[T8](this[x8]);return}G[Y6]=1007,this[T8](G)}});var B8=E1((JV,I7)=>{var{isUtf8:N6}=o5("buffer"),{hasBlob:wI}=Y4(),gI=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function hI(G){return G>=1000&&G<=1014&&G!==1004&&G!==1005&&G!==1006||G>=3000&&G<=4999}function fJ(G){let H=G.length,R=0;while(R<H)if((G[R]&128)===0)R++;else if((G[R]&224)===192){if(R+1===H||(G[R+1]&192)!==128||(G[R]&254)===192)return!1;R+=2}else if((G[R]&240)===224){if(R+2>=H||(G[R+1]&192)!==128||(G[R+2]&192)!==128||G[R]===224&&(G[R+1]&224)===128||G[R]===237&&(G[R+1]&224)===160)return!1;R+=3}else if((G[R]&248)===240){if(R+3>=H||(G[R+1]&192)!==128||(G[R+2]&192)!==128||(G[R+3]&192)!==128||G[R]===240&&(G[R+1]&240)===128||G[R]===244&&G[R+1]>143||G[R]>244)return!1;R+=4}else return!1;return!0}function mI(G){return wI&&typeof G==="object"&&typeof G.arrayBuffer==="function"&&typeof G.type==="string"&&typeof G.stream==="function"&&(G[Symbol.toStringTag]==="Blob"||G[Symbol.toStringTag]==="File")}I7.exports={isBlob:mI,isValidStatusCode:hI,isValidUTF8:fJ,tokenChars:gI};if(N6)I7.exports.isValidUTF8=function(G){return G.length<24?fJ(G):N6(G)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let G=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();I7.exports.isValidUTF8=function(H){return H.length<32?fJ(H):G(H)}}catch(G){}});var lJ=E1((KV,O6)=>{var{Writable:fI}=o5("stream"),R6=N3(),{BINARY_TYPES:uI,EMPTY_BUFFER:A6,kStatusCode:lI,kWebSocket:pI}=Y4(),{concat:uJ,toArrayBuffer:kI,unmask:bI}=_3(),{isValidStatusCode:iI,isValidUTF8:F6}=B8(),z7=Buffer[Symbol.species];class D6 extends fI{constructor(G={}){super();this._allowSynchronousEvents=G.allowSynchronousEvents!==void 0?G.allowSynchronousEvents:!0,this._binaryType=G.binaryType||uI[0],this._extensions=G.extensions||{},this._isServer=!!G.isServer,this._maxPayload=G.maxPayload|0,this._skipUTF8Validation=!!G.skipUTF8Validation,this[pI]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(G,H,R){if(this._opcode===8&&this._state==0)return R();this._bufferedBytes+=G.length,this._buffers.push(G),this.startLoop(R)}consume(G){if(this._bufferedBytes-=G,G===this._buffers[0].length)return this._buffers.shift();if(G<this._buffers[0].length){let R=this._buffers[0];return this._buffers[0]=new z7(R.buffer,R.byteOffset+G,R.length-G),new z7(R.buffer,R.byteOffset,G)}let H=Buffer.allocUnsafe(G);do{let R=this._buffers[0],P=H.length-G;if(G>=R.length)H.set(this._buffers.shift(),P);else H.set(new Uint8Array(R.buffer,R.byteOffset,G),P),this._buffers[0]=new z7(R.buffer,R.byteOffset+G,R.length-G);G-=R.length}while(G>0);return H}startLoop(G){this._loop=!0;do switch(this._state){case 0:this.getInfo(G);break;case 1:this.getPayloadLength16(G);break;case 2:this.getPayloadLength64(G);break;case 3:this.getMask();break;case 4:this.getData(G);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)G()}getInfo(G){if(this._bufferedBytes<2){this._loop=!1;return}let H=this.consume(2);if((H[0]&48)!==0){let P=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");G(P);return}let R=(H[0]&64)===64;if(R&&!this._extensions[R6.extensionName]){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");G(P);return}if(this._fin=(H[0]&128)===128,this._opcode=H[0]&15,this._payloadLength=H[1]&127,this._opcode===0){if(R){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");G(P);return}if(!this._fragmented){let P=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");G(P);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");G(P);return}this._compressed=R}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let P=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");G(P);return}if(R){let P=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");G(P);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let P=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");G(P);return}}else{let P=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");G(P);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(H[1]&128)===128,this._isServer){if(!this._masked){let P=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");G(P);return}}else if(this._masked){let P=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");G(P);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(G)}getPayloadLength16(G){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(G)}getPayloadLength64(G){if(this._bufferedBytes<8){this._loop=!1;return}let H=this.consume(8),R=H.readUInt32BE(0);if(R>Math.pow(2,21)-1){let P=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");G(P);return}this._payloadLength=R*Math.pow(2,32)+H.readUInt32BE(4),this.haveLength(G)}haveLength(G){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let H=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");G(H);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(G){let H=A6;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(H=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)bI(H,this._mask)}if(this._opcode>7){this.controlMessage(H,G);return}if(this._compressed){this._state=5,this.decompress(H,G);return}if(H.length)this._messageLength=this._totalPayloadLength,this._fragments.push(H);this.dataMessage(G)}decompress(G,H){this._extensions[R6.extensionName].decompress(G,this._fin,(P,D)=>{if(P)return H(P);if(D.length){if(this._messageLength+=D.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let M=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");H(M);return}this._fragments.push(D)}if(this.dataMessage(H),this._state===0)this.startLoop(H)})}dataMessage(G){if(!this._fin){this._state=0;return}let H=this._messageLength,R=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let P;if(this._binaryType==="nodebuffer")P=uJ(R,H);else if(this._binaryType==="arraybuffer")P=kI(uJ(R,H));else if(this._binaryType==="blob")P=new Blob(R);else P=R;if(this._allowSynchronousEvents)this.emit("message",P,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",P,!0),this._state=0,this.startLoop(G)})}else{let P=uJ(R,H);if(!this._skipUTF8Validation&&!F6(P)){let D=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");G(D);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",P,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",P,!1),this._state=0,this.startLoop(G)})}}controlMessage(G,H){if(this._opcode===8){if(G.length===0)this._loop=!1,this.emit("conclude",1005,A6),this.end();else{let R=G.readUInt16BE(0);if(!iI(R)){let D=this.createError(RangeError,`invalid status code ${R}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");H(D);return}let P=new z7(G.buffer,G.byteOffset+2,G.length-2);if(!this._skipUTF8Validation&&!F6(P)){let D=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");H(D);return}this._loop=!1,this.emit("conclude",R,P),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",G),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",G),this._state=0,this.startLoop(H)})}createError(G,H,R,P,D){this._loop=!1,this._errored=!0;let M=new G(R?`Invalid WebSocket frame: ${H}`:H);return Error.captureStackTrace(M,this.createError),M.code=D,M[lI]=P,M}}O6.exports=D6});var kJ=E1((ZV,T6)=>{var{Duplex:XV}=o5("stream"),{randomFillSync:dI}=o5("crypto"),M6=N3(),{EMPTY_BUFFER:cI,kWebSocket:nI,NOOP:rI}=Y4(),{isBlob:C8,isValidStatusCode:aI}=B8(),{mask:P6,toBuffer:n4}=_3(),k1=Symbol("kByteLength"),sI=Buffer.alloc(4),r4,q8=8192,c1=0,oI=1,tI=2;class L4{constructor(G,H,R){if(this._extensions=H||{},R)this._generateMask=R,this._maskBuffer=Buffer.alloc(4);this._socket=G,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=c1,this.onerror=rI,this[nI]=void 0}static frame(G,H){let R,P=!1,D=2,M=!1;if(H.mask){if(R=H.maskBuffer||sI,H.generateMask)H.generateMask(R);else{if(q8===8192){if(r4===void 0)r4=Buffer.alloc(8192);dI(r4,0,8192),q8=0}R[0]=r4[q8++],R[1]=r4[q8++],R[2]=r4[q8++],R[3]=r4[q8++]}M=(R[0]|R[1]|R[2]|R[3])===0,D=6}let p;if(typeof G==="string")if((!H.mask||M)&&H[k1]!==void 0)p=H[k1];else G=Buffer.from(G),p=G.length;else p=G.length,P=H.mask&&H.readOnly&&!M;let f=p;if(p>=65536)D+=8,f=127;else if(p>125)D+=2,f=126;let u=Buffer.allocUnsafe(P?p+D:D);if(u[0]=H.fin?H.opcode|128:H.opcode,H.rsv1)u[0]|=64;if(u[1]=f,f===126)u.writeUInt16BE(p,2);else if(f===127)u[2]=u[3]=0,u.writeUIntBE(p,4,6);if(!H.mask)return[u,G];if(u[1]|=128,u[D-4]=R[0],u[D-3]=R[1],u[D-2]=R[2],u[D-1]=R[3],M)return[u,G];if(P)return P6(G,R,u,D,p),[u];return P6(G,R,G,0,p),[u,G]}close(G,H,R,P){let D;if(G===void 0)D=cI;else if(typeof G!=="number"||!aI(G))throw TypeError("First argument must be a valid error code number");else if(H===void 0||!H.length)D=Buffer.allocUnsafe(2),D.writeUInt16BE(G,0);else{let p=Buffer.byteLength(H);if(p>123)throw RangeError("The message must not be greater than 123 bytes");if(D=Buffer.allocUnsafe(2+p),D.writeUInt16BE(G,0),typeof H==="string")D.write(H,2);else D.set(H,2)}let M={[k1]:D.length,fin:!0,generateMask:this._generateMask,mask:R,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==c1)this.enqueue([this.dispatch,D,!1,M,P]);else this.sendFrame(L4.frame(D,M),P)}ping(G,H,R){let P,D;if(typeof G==="string")P=Buffer.byteLength(G),D=!1;else if(C8(G))P=G.size,D=!1;else G=n4(G),P=G.length,D=n4.readOnly;if(P>125)throw RangeError("The data size must not be greater than 125 bytes");let M={[k1]:P,fin:!0,generateMask:this._generateMask,mask:H,maskBuffer:this._maskBuffer,opcode:9,readOnly:D,rsv1:!1};if(C8(G))if(this._state!==c1)this.enqueue([this.getBlobData,G,!1,M,R]);else this.getBlobData(G,!1,M,R);else if(this._state!==c1)this.enqueue([this.dispatch,G,!1,M,R]);else this.sendFrame(L4.frame(G,M),R)}pong(G,H,R){let P,D;if(typeof G==="string")P=Buffer.byteLength(G),D=!1;else if(C8(G))P=G.size,D=!1;else G=n4(G),P=G.length,D=n4.readOnly;if(P>125)throw RangeError("The data size must not be greater than 125 bytes");let M={[k1]:P,fin:!0,generateMask:this._generateMask,mask:H,maskBuffer:this._maskBuffer,opcode:10,readOnly:D,rsv1:!1};if(C8(G))if(this._state!==c1)this.enqueue([this.getBlobData,G,!1,M,R]);else this.getBlobData(G,!1,M,R);else if(this._state!==c1)this.enqueue([this.dispatch,G,!1,M,R]);else this.sendFrame(L4.frame(G,M),R)}send(G,H,R){let P=this._extensions[M6.extensionName],D=H.binary?2:1,M=H.compress,p,f;if(typeof G==="string")p=Buffer.byteLength(G),f=!1;else if(C8(G))p=G.size,f=!1;else G=n4(G),p=G.length,f=n4.readOnly;if(this._firstFragment){if(this._firstFragment=!1,M&&P&&P.params[P._isServer?"server_no_context_takeover":"client_no_context_takeover"])M=p>=P._threshold;this._compress=M}else M=!1,D=0;if(H.fin)this._firstFragment=!0;let u={[k1]:p,fin:H.fin,generateMask:this._generateMask,mask:H.mask,maskBuffer:this._maskBuffer,opcode:D,readOnly:f,rsv1:M};if(C8(G))if(this._state!==c1)this.enqueue([this.getBlobData,G,this._compress,u,R]);else this.getBlobData(G,this._compress,u,R);else if(this._state!==c1)this.enqueue([this.dispatch,G,this._compress,u,R]);else this.dispatch(G,this._compress,u,R)}getBlobData(G,H,R,P){this._bufferedBytes+=R[k1],this._state=tI,G.arrayBuffer().then((D)=>{if(this._socket.destroyed){let p=Error("The socket was closed while the blob was being read");process.nextTick(pJ,this,p,P);return}this._bufferedBytes-=R[k1];let M=n4(D);if(!H)this._state=c1,this.sendFrame(L4.frame(M,R),P),this.dequeue();else this.dispatch(M,H,R,P)}).catch((D)=>{process.nextTick(eI,this,D,P)})}dispatch(G,H,R,P){if(!H){this.sendFrame(L4.frame(G,R),P);return}let D=this._extensions[M6.extensionName];this._bufferedBytes+=R[k1],this._state=oI,D.compress(G,R.fin,(M,p)=>{if(this._socket.destroyed){let f=Error("The socket was closed while data was being compressed");pJ(this,f,P);return}this._bufferedBytes-=R[k1],this._state=c1,R.readOnly=!1,this.sendFrame(L4.frame(p,R),P),this.dequeue()})}dequeue(){while(this._state===c1&&this._queue.length){let G=this._queue.shift();this._bufferedBytes-=G[3][k1],Reflect.apply(G[0],this,G.slice(1))}}enqueue(G){this._bufferedBytes+=G[3][k1],this._queue.push(G)}sendFrame(G,H){if(G.length===2)this._socket.cork(),this._socket.write(G[0]),this._socket.write(G[1],H),this._socket.uncork();else this._socket.write(G[0],H)}}T6.exports=L4;function pJ(G,H,R){if(typeof R==="function")R(H);for(let P=0;P<G._queue.length;P++){let D=G._queue[P],M=D[D.length-1];if(typeof M==="function")M(H)}}function eI(G,H,R){pJ(G,H,R),G.onerror(H)}});var y6=E1(($V,E6)=>{var{kForOnEventAttribute:R3,kListener:bJ}=Y4(),x6=Symbol("kCode"),B6=Symbol("kData"),C6=Symbol("kError"),q6=Symbol("kMessage"),U6=Symbol("kReason"),U8=Symbol("kTarget"),L6=Symbol("kType"),W6=Symbol("kWasClean");class W4{constructor(G){this[U8]=null,this[L6]=G}get target(){return this[U8]}get type(){return this[L6]}}Object.defineProperty(W4.prototype,"target",{enumerable:!0});Object.defineProperty(W4.prototype,"type",{enumerable:!0});class L8 extends W4{constructor(G,H={}){super(G);this[x6]=H.code===void 0?0:H.code,this[U6]=H.reason===void 0?"":H.reason,this[W6]=H.wasClean===void 0?!1:H.wasClean}get code(){return this[x6]}get reason(){return this[U6]}get wasClean(){return this[W6]}}Object.defineProperty(L8.prototype,"code",{enumerable:!0});Object.defineProperty(L8.prototype,"reason",{enumerable:!0});Object.defineProperty(L8.prototype,"wasClean",{enumerable:!0});class A3 extends W4{constructor(G,H={}){super(G);this[C6]=H.error===void 0?null:H.error,this[q6]=H.message===void 0?"":H.message}get error(){return this[C6]}get message(){return this[q6]}}Object.defineProperty(A3.prototype,"error",{enumerable:!0});Object.defineProperty(A3.prototype,"message",{enumerable:!0});class Y7 extends W4{constructor(G,H={}){super(G);this[B6]=H.data===void 0?null:H.data}get data(){return this[B6]}}Object.defineProperty(Y7.prototype,"data",{enumerable:!0});var Jz={addEventListener(G,H,R={}){for(let D of this.listeners(G))if(!R[R3]&&D[bJ]===H&&!D[R3])return;let P;if(G==="message")P=function(M,p){let f=new Y7("message",{data:p?M:M.toString()});f[U8]=this,j7(H,this,f)};else if(G==="close")P=function(M,p){let f=new L8("close",{code:M,reason:p.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});f[U8]=this,j7(H,this,f)};else if(G==="error")P=function(M){let p=new A3("error",{error:M,message:M.message});p[U8]=this,j7(H,this,p)};else if(G==="open")P=function(){let M=new W4("open");M[U8]=this,j7(H,this,M)};else return;if(P[R3]=!!R[R3],P[bJ]=H,R.once)this.once(G,P);else this.on(G,P)},removeEventListener(G,H){for(let R of this.listeners(G))if(R[bJ]===H&&!R[R3]){this.removeListener(G,R);break}}};E6.exports={CloseEvent:L8,ErrorEvent:A3,Event:W4,EventTarget:Jz,MessageEvent:Y7};function j7(G,H,R){if(typeof G==="object"&&G.handleEvent)G.handleEvent.call(G,R);else G.call(H,R)}});var iJ=E1((QV,S6)=>{var{tokenChars:F3}=B8();function X4(G,H,R){if(G[H]===void 0)G[H]=[R];else G[H].push(R)}function Kz(G){let H=Object.create(null),R=Object.create(null),P=!1,D=!1,M=!1,p,f,u=-1,V0=-1,R0=-1,Z0=0;for(;Z0<G.length;Z0++)if(V0=G.charCodeAt(Z0),p===void 0)if(R0===-1&&F3[V0]===1){if(u===-1)u=Z0}else if(Z0!==0&&(V0===32||V0===9)){if(R0===-1&&u!==-1)R0=Z0}else if(V0===59||V0===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(R0===-1)R0=Z0;let h=G.slice(u,R0);if(V0===44)X4(H,h,R),R=Object.create(null);else p=h;u=R0=-1}else throw SyntaxError(`Unexpected character at index ${Z0}`);else if(f===void 0)if(R0===-1&&F3[V0]===1){if(u===-1)u=Z0}else if(V0===32||V0===9){if(R0===-1&&u!==-1)R0=Z0}else if(V0===59||V0===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(R0===-1)R0=Z0;if(X4(R,G.slice(u,R0),!0),V0===44)X4(H,p,R),R=Object.create(null),p=void 0;u=R0=-1}else if(V0===61&&u!==-1&&R0===-1)f=G.slice(u,Z0),u=R0=-1;else throw SyntaxError(`Unexpected character at index ${Z0}`);else if(D){if(F3[V0]!==1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(u===-1)u=Z0;else if(!P)P=!0;D=!1}else if(M)if(F3[V0]===1){if(u===-1)u=Z0}else if(V0===34&&u!==-1)M=!1,R0=Z0;else if(V0===92)D=!0;else throw SyntaxError(`Unexpected character at index ${Z0}`);else if(V0===34&&G.charCodeAt(Z0-1)===61)M=!0;else if(R0===-1&&F3[V0]===1){if(u===-1)u=Z0}else if(u!==-1&&(V0===32||V0===9)){if(R0===-1)R0=Z0}else if(V0===59||V0===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${Z0}`);if(R0===-1)R0=Z0;let h=G.slice(u,R0);if(P)h=h.replace(/\\/g,""),P=!1;if(X4(R,f,h),V0===44)X4(H,p,R),R=Object.create(null),p=void 0;f=void 0,u=R0=-1}else throw SyntaxError(`Unexpected character at index ${Z0}`);if(u===-1||M||V0===32||V0===9)throw SyntaxError("Unexpected end of input");if(R0===-1)R0=Z0;let U=G.slice(u,R0);if(p===void 0)X4(H,U,R);else{if(f===void 0)X4(R,U,!0);else if(P)X4(R,f,U.replace(/\\/g,""));else X4(R,f,U);X4(H,p,R)}return H}function Xz(G){return Object.keys(G).map((H)=>{let R=G[H];if(!Array.isArray(R))R=[R];return R.map((P)=>{return[H].concat(Object.keys(P).map((D)=>{let M=P[D];if(!Array.isArray(M))M=[M];return M.map((p)=>p===!0?D:`${D}=${p}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}S6.exports={format:Xz,parse:Kz}});var N7=E1((zV,i6)=>{var Zz=o5("events"),$z=o5("https"),Qz=o5("http"),g6=o5("net"),Gz=o5("tls"),{randomBytes:Iz,createHash:zz}=o5("crypto"),{Duplex:GV,Readable:IV}=o5("stream"),{URL:dJ}=o5("url"),E4=N3(),jz=lJ(),Yz=kJ(),{isBlob:Vz}=B8(),{BINARY_TYPES:v6,CLOSE_TIMEOUT:_z,EMPTY_BUFFER:V7,GUID:Hz,kForOnEventAttribute:cJ,kListener:Nz,kStatusCode:Rz,kWebSocket:Y1,NOOP:h6}=Y4(),{EventTarget:{addEventListener:Az,removeEventListener:Fz}}=y6(),{format:Dz,parse:Oz}=iJ(),{toBuffer:Mz}=_3(),m6=Symbol("kAborted"),nJ=[8,13],_4=["CONNECTING","OPEN","CLOSING","CLOSED"],Pz=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class a0 extends Zz{constructor(G,H,R){super();if(this._binaryType=v6[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=V7,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=a0.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,G!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,H===void 0)H=[];else if(!Array.isArray(H))if(typeof H==="object"&&H!==null)R=H,H=[];else H=[H];f6(this,G,H,R)}else this._autoPong=R.autoPong,this._closeTimeout=R.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(G){if(!v6.includes(G))return;if(this._binaryType=G,this._receiver)this._receiver._binaryType=G}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(G,H,R){let P=new jz({allowSynchronousEvents:R.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:R.maxPayload,skipUTF8Validation:R.skipUTF8Validation}),D=new Yz(G,this._extensions,R.generateMask);if(this._receiver=P,this._sender=D,this._socket=G,P[Y1]=this,D[Y1]=this,G[Y1]=this,P.on("conclude",Bz),P.on("drain",Cz),P.on("error",qz),P.on("message",Uz),P.on("ping",Lz),P.on("pong",Wz),D.onerror=Ez,G.setTimeout)G.setTimeout(0);if(G.setNoDelay)G.setNoDelay();if(H.length>0)G.unshift(H);G.on("close",p6),G.on("data",H7),G.on("end",k6),G.on("error",b6),this._readyState=a0.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=a0.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[E4.extensionName])this._extensions[E4.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=a0.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(G,H){if(this.readyState===a0.CLOSED)return;if(this.readyState===a0.CONNECTING){v1(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===a0.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=a0.CLOSING,this._sender.close(G,H,!this._isServer,(R)=>{if(R)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),l6(this)}pause(){if(this.readyState===a0.CONNECTING||this.readyState===a0.CLOSED)return;this._paused=!0,this._socket.pause()}ping(G,H,R){if(this.readyState===a0.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof G==="function")R=G,G=H=void 0;else if(typeof H==="function")R=H,H=void 0;if(typeof G==="number")G=G.toString();if(this.readyState!==a0.OPEN){rJ(this,G,R);return}if(H===void 0)H=!this._isServer;this._sender.ping(G||V7,H,R)}pong(G,H,R){if(this.readyState===a0.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof G==="function")R=G,G=H=void 0;else if(typeof H==="function")R=H,H=void 0;if(typeof G==="number")G=G.toString();if(this.readyState!==a0.OPEN){rJ(this,G,R);return}if(H===void 0)H=!this._isServer;this._sender.pong(G||V7,H,R)}resume(){if(this.readyState===a0.CONNECTING||this.readyState===a0.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(G,H,R){if(this.readyState===a0.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof H==="function")R=H,H={};if(typeof G==="number")G=G.toString();if(this.readyState!==a0.OPEN){rJ(this,G,R);return}let P={binary:typeof G!=="string",mask:!this._isServer,compress:!0,fin:!0,...H};if(!this._extensions[E4.extensionName])P.compress=!1;this._sender.send(G||V7,P,R)}terminate(){if(this.readyState===a0.CLOSED)return;if(this.readyState===a0.CONNECTING){v1(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=a0.CLOSING,this._socket.destroy()}}Object.defineProperty(a0,"CONNECTING",{enumerable:!0,value:_4.indexOf("CONNECTING")});Object.defineProperty(a0.prototype,"CONNECTING",{enumerable:!0,value:_4.indexOf("CONNECTING")});Object.defineProperty(a0,"OPEN",{enumerable:!0,value:_4.indexOf("OPEN")});Object.defineProperty(a0.prototype,"OPEN",{enumerable:!0,value:_4.indexOf("OPEN")});Object.defineProperty(a0,"CLOSING",{enumerable:!0,value:_4.indexOf("CLOSING")});Object.defineProperty(a0.prototype,"CLOSING",{enumerable:!0,value:_4.indexOf("CLOSING")});Object.defineProperty(a0,"CLOSED",{enumerable:!0,value:_4.indexOf("CLOSED")});Object.defineProperty(a0.prototype,"CLOSED",{enumerable:!0,value:_4.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((G)=>{Object.defineProperty(a0.prototype,G,{enumerable:!0})});["open","error","close","message"].forEach((G)=>{Object.defineProperty(a0.prototype,`on${G}`,{enumerable:!0,get(){for(let H of this.listeners(G))if(H[cJ])return H[Nz];return null},set(H){for(let R of this.listeners(G))if(R[cJ]){this.removeListener(G,R);break}if(typeof H!=="function")return;this.addEventListener(G,H,{[cJ]:!0})}})});a0.prototype.addEventListener=Az;a0.prototype.removeEventListener=Fz;i6.exports=a0;function f6(G,H,R,P){let D={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_z,protocolVersion:nJ[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...P,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(G._autoPong=D.autoPong,G._closeTimeout=D.closeTimeout,!nJ.includes(D.protocolVersion))throw RangeError(`Unsupported protocol version: ${D.protocolVersion} (supported versions: ${nJ.join(", ")})`);let M;if(H instanceof dJ)M=H;else try{M=new dJ(H)}catch(y){throw SyntaxError(`Invalid URL: ${H}`)}if(M.protocol==="http:")M.protocol="ws:";else if(M.protocol==="https:")M.protocol="wss:";G._url=M.href;let p=M.protocol==="wss:",f=M.protocol==="ws+unix:",u;if(M.protocol!=="ws:"&&!p&&!f)u=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(f&&!M.pathname)u="The URL's pathname is empty";else if(M.hash)u="The URL contains a fragment identifier";if(u){let y=SyntaxError(u);if(G._redirects===0)throw y;else{_7(G,y);return}}let V0=p?443:80,R0=Iz(16).toString("base64"),Z0=p?$z.request:Qz.request,U=new Set,h;if(D.createConnection=D.createConnection||(p?xz:Tz),D.defaultPort=D.defaultPort||V0,D.port=M.port||V0,D.host=M.hostname.startsWith("[")?M.hostname.slice(1,-1):M.hostname,D.headers={...D.headers,"Sec-WebSocket-Version":D.protocolVersion,"Sec-WebSocket-Key":R0,Connection:"Upgrade",Upgrade:"websocket"},D.path=M.pathname+M.search,D.timeout=D.handshakeTimeout,D.perMessageDeflate)h=new E4(D.perMessageDeflate!==!0?D.perMessageDeflate:{},!1,D.maxPayload),D.headers["Sec-WebSocket-Extensions"]=Dz({[E4.extensionName]:h.offer()});if(R.length){for(let y of R){if(typeof y!=="string"||!Pz.test(y)||U.has(y))throw SyntaxError("An invalid or duplicated subprotocol was specified");U.add(y)}D.headers["Sec-WebSocket-Protocol"]=R.join(",")}if(D.origin)if(D.protocolVersion<13)D.headers["Sec-WebSocket-Origin"]=D.origin;else D.headers.Origin=D.origin;if(M.username||M.password)D.auth=`${M.username}:${M.password}`;if(f){let y=D.path.split(":");D.socketPath=y[0],D.path=y[1]}let g;if(D.followRedirects){if(G._redirects===0){G._originalIpc=f,G._originalSecure=p,G._originalHostOrSocketPath=f?D.socketPath:M.host;let y=P&&P.headers;if(P={...P,headers:{}},y)for(let[r,F0]of Object.entries(y))P.headers[r.toLowerCase()]=F0}else if(G.listenerCount("redirect")===0){let y=f?G._originalIpc?D.socketPath===G._originalHostOrSocketPath:!1:G._originalIpc?!1:M.host===G._originalHostOrSocketPath;if(!y||G._originalSecure&&!p){if(delete D.headers.authorization,delete D.headers.cookie,!y)delete D.headers.host;D.auth=void 0}}if(D.auth&&!P.headers.authorization)P.headers.authorization="Basic "+Buffer.from(D.auth).toString("base64");if(g=G._req=Z0(D),G._redirects)G.emit("redirect",G.url,g)}else g=G._req=Z0(D);if(D.timeout)g.on("timeout",()=>{v1(G,g,"Opening handshake has timed out")});if(g.on("error",(y)=>{if(g===null||g[m6])return;g=G._req=null,_7(G,y)}),g.on("response",(y)=>{let r=y.headers.location,F0=y.statusCode;if(r&&D.followRedirects&&F0>=300&&F0<400){if(++G._redirects>D.maxRedirects){v1(G,g,"Maximum redirects exceeded");return}g.abort();let v0;try{v0=new dJ(r,H)}catch($0){let A0=SyntaxError(`Invalid URL: ${r}`);_7(G,A0);return}f6(G,v0,R,P)}else if(!G.emit("unexpected-response",g,y))v1(G,g,`Unexpected server response: ${y.statusCode}`)}),g.on("upgrade",(y,r,F0)=>{if(G.emit("upgrade",y),G.readyState!==a0.CONNECTING)return;g=G._req=null;let v0=y.headers.upgrade;if(v0===void 0||v0.toLowerCase()!=="websocket"){v1(G,r,"Invalid Upgrade header");return}let $0=zz("sha1").update(R0+Hz).digest("base64");if(y.headers["sec-websocket-accept"]!==$0){v1(G,r,"Invalid Sec-WebSocket-Accept header");return}let A0=y.headers["sec-websocket-protocol"],Q0;if(A0!==void 0){if(!U.size)Q0="Server sent a subprotocol but none was requested";else if(!U.has(A0))Q0="Server sent an invalid subprotocol"}else if(U.size)Q0="Server sent no subprotocol";if(Q0){v1(G,r,Q0);return}if(A0)G._protocol=A0;let H0=y.headers["sec-websocket-extensions"];if(H0!==void 0){if(!h){v1(G,r,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let I0;try{I0=Oz(H0)}catch(F5){v1(G,r,"Invalid Sec-WebSocket-Extensions header");return}let L0=Object.keys(I0);if(L0.length!==1||L0[0]!==E4.extensionName){v1(G,r,"Server indicated an extension that was not requested");return}try{h.accept(I0[E4.extensionName])}catch(F5){v1(G,r,"Invalid Sec-WebSocket-Extensions header");return}G._extensions[E4.extensionName]=h}G.setSocket(r,F0,{allowSynchronousEvents:D.allowSynchronousEvents,generateMask:D.generateMask,maxPayload:D.maxPayload,skipUTF8Validation:D.skipUTF8Validation})}),D.finishRequest)D.finishRequest(g,G);else g.end()}function _7(G,H){G._readyState=a0.CLOSING,G._errorEmitted=!0,G.emit("error",H),G.emitClose()}function Tz(G){return G.path=G.socketPath,g6.connect(G)}function xz(G){if(G.path=void 0,!G.servername&&G.servername!=="")G.servername=g6.isIP(G.host)?"":G.host;return Gz.connect(G)}function v1(G,H,R){G._readyState=a0.CLOSING;let P=Error(R);if(Error.captureStackTrace(P,v1),H.setHeader){if(H[m6]=!0,H.abort(),H.socket&&!H.socket.destroyed)H.socket.destroy();process.nextTick(_7,G,P)}else H.destroy(P),H.once("error",G.emit.bind(G,"error")),H.once("close",G.emitClose.bind(G))}function rJ(G,H,R){if(H){let P=Vz(H)?H.size:Mz(H).length;if(G._socket)G._sender._bufferedBytes+=P;else G._bufferedAmount+=P}if(R){let P=Error(`WebSocket is not open: readyState ${G.readyState} (${_4[G.readyState]})`);process.nextTick(R,P)}}function Bz(G,H){let R=this[Y1];if(R._closeFrameReceived=!0,R._closeMessage=H,R._closeCode=G,R._socket[Y1]===void 0)return;if(R._socket.removeListener("data",H7),process.nextTick(u6,R._socket),G===1005)R.close();else R.close(G,H)}function Cz(){let G=this[Y1];if(!G.isPaused)G._socket.resume()}function qz(G){let H=this[Y1];if(H._socket[Y1]!==void 0)H._socket.removeListener("data",H7),process.nextTick(u6,H._socket),H.close(G[Rz]);if(!H._errorEmitted)H._errorEmitted=!0,H.emit("error",G)}function w6(){this[Y1].emitClose()}function Uz(G,H){this[Y1].emit("message",G,H)}function Lz(G){let H=this[Y1];if(H._autoPong)H.pong(G,!this._isServer,h6);H.emit("ping",G)}function Wz(G){this[Y1].emit("pong",G)}function u6(G){G.resume()}function Ez(G){let H=this[Y1];if(H.readyState===a0.CLOSED)return;if(H.readyState===a0.OPEN)H._readyState=a0.CLOSING,l6(H);if(this._socket.end(),!H._errorEmitted)H._errorEmitted=!0,H.emit("error",G)}function l6(G){G._closeTimer=setTimeout(G._socket.destroy.bind(G._socket),G._closeTimeout)}function p6(){let G=this[Y1];if(this.removeListener("close",p6),this.removeListener("data",H7),this.removeListener("end",k6),G._readyState=a0.CLOSING,!this._readableState.endEmitted&&!G._closeFrameReceived&&!G._receiver._writableState.errorEmitted&&this._readableState.length!==0){let H=this.read(this._readableState.length);G._receiver.write(H)}if(G._receiver.end(),this[Y1]=void 0,clearTimeout(G._closeTimer),G._receiver._writableState.finished||G._receiver._writableState.errorEmitted)G.emitClose();else G._receiver.on("error",w6),G._receiver.on("finish",w6)}function H7(G){if(!this[Y1]._receiver.write(G))this.pause()}function k6(){let G=this[Y1];G._readyState=a0.CLOSING,G._receiver.end(),this.end()}function b6(){let G=this[Y1];if(this.removeListener("error",b6),this.on("error",h6),G)G._readyState=a0.CLOSING,this.destroy()}});var r6=E1((YV,n6)=>{var jV=N7(),{Duplex:yz}=o5("stream");function d6(G){G.emit("close")}function Sz(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function c6(G){if(this.removeListener("error",c6),this.destroy(),this.listenerCount("error")===0)this.emit("error",G)}function vz(G,H){let R=!0,P=new yz({...H,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return G.on("message",function(M,p){let f=!p&&P._readableState.objectMode?M.toString():M;if(!P.push(f))G.pause()}),G.once("error",function(M){if(P.destroyed)return;R=!1,P.destroy(M)}),G.once("close",function(){if(P.destroyed)return;P.push(null)}),P._destroy=function(D,M){if(G.readyState===G.CLOSED){M(D),process.nextTick(d6,P);return}let p=!1;if(G.once("error",function(u){p=!0,M(u)}),G.once("close",function(){if(!p)M(D);process.nextTick(d6,P)}),R)G.terminate()},P._final=function(D){if(G.readyState===G.CONNECTING){G.once("open",function(){P._final(D)});return}if(G._socket===null)return;if(G._socket._writableState.finished){if(D(),P._readableState.endEmitted)P.destroy()}else G._socket.once("finish",function(){D()}),G.close()},P._read=function(){if(G.isPaused)G.resume()},P._write=function(D,M,p){if(G.readyState===G.CONNECTING){G.once("open",function(){P._write(D,M,p)});return}G.send(D,p)},P.on("end",Sz),P.on("error",c6),P}n6.exports=vz});var s6=E1((VV,a6)=>{var{tokenChars:wz}=B8();function gz(G){let H=new Set,R=-1,P=-1,D=0;for(D;D<G.length;D++){let p=G.charCodeAt(D);if(P===-1&&wz[p]===1){if(R===-1)R=D}else if(D!==0&&(p===32||p===9)){if(P===-1&&R!==-1)P=D}else if(p===44){if(R===-1)throw SyntaxError(`Unexpected character at index ${D}`);if(P===-1)P=D;let f=G.slice(R,P);if(H.has(f))throw SyntaxError(`The "${f}" subprotocol is duplicated`);H.add(f),R=P=-1}else throw SyntaxError(`Unexpected character at index ${D}`)}if(R===-1||P!==-1)throw SyntaxError("Unexpected end of input");let M=G.slice(R,D);if(H.has(M))throw SyntaxError(`The "${M}" subprotocol is duplicated`);return H.add(M),H}a6.exports={parse:gz}});var K$=E1((HV,J$)=>{var hz=o5("events"),R7=o5("http"),{Duplex:_V}=o5("stream"),{createHash:mz}=o5("crypto"),o6=iJ(),a4=N3(),fz=s6(),uz=N7(),{CLOSE_TIMEOUT:lz,GUID:pz,kWebSocket:kz}=Y4(),bz=/^[+/0-9A-Za-z]{22}==$/;class e6 extends hz{constructor(G,H){super();if(G={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:lz,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:uz,...G},G.port==null&&!G.server&&!G.noServer||G.port!=null&&(G.server||G.noServer)||G.server&&G.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(G.port!=null)this._server=R7.createServer((R,P)=>{let D=R7.STATUS_CODES[426];P.writeHead(426,{"Content-Length":D.length,"Content-Type":"text/plain"}),P.end(D)}),this._server.listen(G.port,G.host,G.backlog,H);else if(G.server)this._server=G.server;if(this._server){let R=this.emit.bind(this,"connection");this._removeListeners=iz(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(P,D,M)=>{this.handleUpgrade(P,D,M,R)}})}if(G.perMessageDeflate===!0)G.perMessageDeflate={};if(G.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=G,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(G){if(this._state===2){if(G)this.once("close",()=>{G(Error("The server is not running"))});process.nextTick(D3,this);return}if(G)this.once("close",G);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(D3,this);else this._shouldEmitClose=!0;else process.nextTick(D3,this)}else{let H=this._server;this._removeListeners(),this._removeListeners=this._server=null,H.close(()=>{D3(this)})}}shouldHandle(G){if(this.options.path){let H=G.url.indexOf("?");if((H!==-1?G.url.slice(0,H):G.url)!==this.options.path)return!1}return!0}handleUpgrade(G,H,R,P){H.on("error",t6);let D=G.headers["sec-websocket-key"],M=G.headers.upgrade,p=+G.headers["sec-websocket-version"];if(G.method!=="GET"){s4(this,G,H,405,"Invalid HTTP method");return}if(M===void 0||M.toLowerCase()!=="websocket"){s4(this,G,H,400,"Invalid Upgrade header");return}if(D===void 0||!bz.test(D)){s4(this,G,H,400,"Missing or invalid Sec-WebSocket-Key header");return}if(p!==13&&p!==8){s4(this,G,H,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(G)){O3(H,400);return}let f=G.headers["sec-websocket-protocol"],u=new Set;if(f!==void 0)try{u=fz.parse(f)}catch(Z0){s4(this,G,H,400,"Invalid Sec-WebSocket-Protocol header");return}let V0=G.headers["sec-websocket-extensions"],R0={};if(this.options.perMessageDeflate&&V0!==void 0){let Z0=new a4(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let U=o6.parse(V0);if(U[a4.extensionName])Z0.accept(U[a4.extensionName]),R0[a4.extensionName]=Z0}catch(U){s4(this,G,H,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let Z0={origin:G.headers[`${p===8?"sec-websocket-origin":"origin"}`],secure:!!(G.socket.authorized||G.socket.encrypted),req:G};if(this.options.verifyClient.length===2){this.options.verifyClient(Z0,(U,h,g,y)=>{if(!U)return O3(H,h||401,g,y);this.completeUpgrade(R0,D,u,G,H,R,P)});return}if(!this.options.verifyClient(Z0))return O3(H,401)}this.completeUpgrade(R0,D,u,G,H,R,P)}completeUpgrade(G,H,R,P,D,M,p){if(!D.readable||!D.writable)return D.destroy();if(D[kz])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return O3(D,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${mz("sha1").update(H+pz).digest("base64")}`],V0=new this.options.WebSocket(null,void 0,this.options);if(R.size){let R0=this.options.handleProtocols?this.options.handleProtocols(R,P):R.values().next().value;if(R0)u.push(`Sec-WebSocket-Protocol: ${R0}`),V0._protocol=R0}if(G[a4.extensionName]){let R0=G[a4.extensionName].params,Z0=o6.format({[a4.extensionName]:[R0]});u.push(`Sec-WebSocket-Extensions: ${Z0}`),V0._extensions=G}if(this.emit("headers",u,P),D.write(u.concat(`\r
2
2
  `).join(`\r
3
3
  `)),D.removeListener("error",t6),V0.setSocket(D,M,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(V0),V0.on("close",()=>{if(this.clients.delete(V0),this._shouldEmitClose&&!this.clients.size)process.nextTick(D3,this)});p(V0,P)}}J$.exports=e6;function iz(G,H){for(let R of Object.keys(H))G.on(R,H[R]);return function(){for(let P of Object.keys(H))G.removeListener(P,H[P])}}function D3(G){G._state=2,G.emit("close")}function t6(){this.destroy()}function O3(G,H,R,P){R=R||R7.STATUS_CODES[H],P={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(R),...P},G.once("finish",G.destroy),G.end(`HTTP/1.1 ${H} ${R7.STATUS_CODES[H]}\r
4
4
  `+Object.keys(P).map((D)=>`${D}: ${P[D]}`).join(`\r
@@ -1,2 +1,2 @@
1
- import{Hl as L}from"./chunk-z3e4c424.js";var N=L((O,D)=>{var I=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],M=function(x){var j,z=0,q=0,w=[],B=x.length;for(;z<B;z++)if(j=x.charCodeAt(z),j<128)w[q++]=j;else if(j<2048)w[q++]=j>>6|192,w[q++]=j&63|128;else if((j&64512)===55296&&z+1<x.length&&(x.charCodeAt(z+1)&64512)===56320)j=65536+((j&1023)<<10)+(x.charCodeAt(++z)&1023),w[q++]=j>>18|240,w[q++]=j>>12&63|128,w[q++]=j>>6&63|128,w[q++]=j&63|128;else w[q++]=j>>12|224,w[q++]=j>>6&63|128,w[q++]=j&63|128;return w},J=D.exports=function(x){var j,z=0,q=-1,w=0,B=0,G=typeof x==="string"?M(x):x,K=G.length;while(z<K){if(j=G[z++],q===-1){if(j===123)q=z}else if(j!==125)B=I[(j^B>>8)&255]^B<<8;else if(z-1!==q)return B&16383;w=I[(j^w>>8)&255]^w<<8}return w&16383};D.exports.generateMulti=function(x){var j=1,z=x.length,q=J(x[0]);while(j<z)if(J(x[j++])!==q)return-1;return q}});
1
+ import{Fl as L}from"./chunk-y8qhrx11.js";var N=L((O,D)=>{var I=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],M=function(x){var j,z=0,q=0,w=[],B=x.length;for(;z<B;z++)if(j=x.charCodeAt(z),j<128)w[q++]=j;else if(j<2048)w[q++]=j>>6|192,w[q++]=j&63|128;else if((j&64512)===55296&&z+1<x.length&&(x.charCodeAt(z+1)&64512)===56320)j=65536+((j&1023)<<10)+(x.charCodeAt(++z)&1023),w[q++]=j>>18|240,w[q++]=j>>12&63|128,w[q++]=j>>6&63|128,w[q++]=j&63|128;else w[q++]=j>>12|224,w[q++]=j>>6&63|128,w[q++]=j&63|128;return w},J=D.exports=function(x){var j,z=0,q=-1,w=0,B=0,G=typeof x==="string"?M(x):x,K=G.length;while(z<K){if(j=G[z++],q===-1){if(j===123)q=z}else if(j!==125)B=I[(j^B>>8)&255]^B<<8;else if(z-1!==q)return B&16383;w=I[(j^w>>8)&255]^w<<8}return w&16383};D.exports.generateMulti=function(x){var j=1,z=x.length,q=J(x[0]);while(j<z)if(J(x[j++])!==q)return-1;return q}});
2
2
  export{N as c};
@@ -1,6 +1,6 @@
1
- import{Kk as T}from"./chunk-t01t72t2.js";import{Fl as R}from"./chunk-z3e4c424.js";var I=R(T(),1);import A from"fs/promises";import z from"path";import O from"os";class U{skillsDir;projectSkillsDir;constructor(){let b=O.homedir();this.skillsDir=z.join(b,".claude","skills"),this.projectSkillsDir=z.join(process.cwd(),".claude","skills")}async listSkills(){let b=new Map,g=await this.listSkillsInDir(this.skillsDir);for(let q of g)b.set(q.name,q);let x=await this.listSkillsInDir(this.projectSkillsDir);for(let q of x)b.set(q.name,q);return Array.from(b.values())}async listSkillsInDir(b){try{let g=await A.readdir(b,{withFileTypes:!0}),x=[];for(let q of g){let F=z.join(b,q.name),J=await A.lstat(F).catch(()=>null);if(!J)continue;let K=await A.stat(F).catch(()=>null);if(!K||!K.isDirectory())continue;if(J.isSymbolicLink()){let C=z.resolve(F),G=z.resolve(b),N=C.substring(G.length);if(!(C===G||N.startsWith("/")||N==="")){let Q=O.homedir();if(!C.startsWith(Q))continue}}let L=z.join(F,"SKILL.md");try{let C=await A.readFile(L,"utf-8"),G=this.parseFrontmatter(C);x.push({name:q.name,description:G.description||"",path:L})}catch{}}return x}catch{return[]}}async getSkill(b){let g=z.join(this.projectSkillsDir,b,"SKILL.md");try{let q=await A.readFile(g,"utf-8");return this.parseSkillContent(q)}catch{}let x=z.join(this.skillsDir,b,"SKILL.md");try{let q=await A.readFile(x,"utf-8");return this.parseSkillContent(q)}catch{return null}}async saveSkill(b,g){let x=z.join(this.skillsDir,b);await A.mkdir(x,{recursive:!0});let q=this.formatSkillContent(g);await A.writeFile(z.join(x,"SKILL.md"),q,"utf-8")}async deleteSkill(b){let g=z.join(this.skillsDir,b);await A.rm(g,{recursive:!0,force:!0})}async syncFromRemote(b){let g=await b.listRemoteSkills();for(let x of g){let q=await b.fetchSkill(x.name);if(q)await this.saveSkill(x.name,q)}}parseFrontmatter(b){let g=b.match(/^---\n(.+?)\n---/s);if(!g)return{};try{return I.default.parse(g[1])}catch{return{}}}parseSkillContent(b){let g=this.parseFrontmatter(b),x=b.replace(/^---\n.+?\n---\n*/s,"");return{frontmatter:g,markdown:x}}formatSkillContent(b){return`---
1
+ import{Ik as T}from"./chunk-e8kxa5vj.js";import{Dl as R}from"./chunk-y8qhrx11.js";var I=R(T(),1);import A from"fs/promises";import z from"path";import O from"os";class U{skillsDir;projectSkillsDir;constructor(){let b=O.homedir();this.skillsDir=z.join(b,".claude","skills"),this.projectSkillsDir=z.join(process.cwd(),".claude","skills")}async listSkills(){let b=new Map,g=await this.listSkillsInDir(this.skillsDir);for(let q of g)b.set(q.name,q);let x=await this.listSkillsInDir(this.projectSkillsDir);for(let q of x)b.set(q.name,q);return Array.from(b.values())}async listSkillsInDir(b){try{let g=await A.readdir(b,{withFileTypes:!0}),x=[];for(let q of g){let F=z.join(b,q.name),J=await A.lstat(F).catch(()=>null);if(!J)continue;let K=await A.stat(F).catch(()=>null);if(!K||!K.isDirectory())continue;if(J.isSymbolicLink()){let C=z.resolve(F),G=z.resolve(b),N=C.substring(G.length);if(!(C===G||N.startsWith("/")||N==="")){let Q=O.homedir();if(!C.startsWith(Q))continue}}let L=z.join(F,"SKILL.md");try{let C=await A.readFile(L,"utf-8"),G=this.parseFrontmatter(C);x.push({name:q.name,description:G.description||"",path:L})}catch{}}return x}catch{return[]}}async getSkill(b){let g=z.join(this.projectSkillsDir,b,"SKILL.md");try{let q=await A.readFile(g,"utf-8");return this.parseSkillContent(q)}catch{}let x=z.join(this.skillsDir,b,"SKILL.md");try{let q=await A.readFile(x,"utf-8");return this.parseSkillContent(q)}catch{return null}}async saveSkill(b,g){let x=z.join(this.skillsDir,b);await A.mkdir(x,{recursive:!0});let q=this.formatSkillContent(g);await A.writeFile(z.join(x,"SKILL.md"),q,"utf-8")}async deleteSkill(b){let g=z.join(this.skillsDir,b);await A.rm(g,{recursive:!0,force:!0})}async syncFromRemote(b){let g=await b.listRemoteSkills();for(let x of g){let q=await b.fetchSkill(x.name);if(q)await this.saveSkill(x.name,q)}}parseFrontmatter(b){let g=b.match(/^---\n(.+?)\n---/s);if(!g)return{};try{return I.default.parse(g[1])}catch{return{}}}parseSkillContent(b){let g=this.parseFrontmatter(b),x=b.replace(/^---\n.+?\n---\n*/s,"");return{frontmatter:g,markdown:x}}formatSkillContent(b){return`---
2
2
  ${I.default.stringify(b.frontmatter).trim()}
3
3
  ---
4
4
 
5
5
  ${b.markdown}`}}
6
- export{U as if};
6
+ export{U as gf};
@@ -1,2 +1,2 @@
1
- import{Jd as P,La as X,Nd as U,Ud as j,Vd as A,_ as T,lb as $}from"./chunk-cnzhxgn5.js";import{Kl as E}from"./chunk-z3e4c424.js";var Z=class{constructor(z){this.createDriver=z}createDriver;createQueryCompiler(){return new U}createAdapter(){return new A}createIntrospector(z){return new j(z)}},F=class{promise;resolve;async lock(){while(this.promise)await this.promise;this.promise=new Promise((z)=>{this.resolve=z})}unlock(){let z=this.resolve;this.promise=void 0,this.resolve=void 0,z?.()}};async function V(z,H,J,O,K){await J.executeQuery(K(X.createWithChildren([X.createWithSql(`${z} `),T.create(O)]),H()))}var _=class{mutex=new F;conn;savepoint;releaseSavepoint;rollbackToSavepoint;init;constructor(z){this.init=()=>import("./chunk-gbfpab0j.js").then(({createQueryId:H})=>{if(H)this.savepoint=V.bind(null,"savepoint",H),this.releaseSavepoint=V.bind(null,"release",H),this.rollbackToSavepoint=V.bind(null,"rollback to",H)}).then(z)}async acquireConnection(){return await this.mutex.lock(),this.conn}async beginTransaction(z){await z.executeQuery(P.raw("begin"))}async commitTransaction(z){await z.executeQuery(P.raw("commit"))}async rollbackTransaction(z){await z.executeQuery(P.raw("rollback"))}async releaseConnection(){this.mutex.unlock()}};function L(z){return async(H,J,O)=>{let K=await z.all(J,O);return H||K.length?{rows:K}:{rows:[],...await z.run("select 1")}}}function M(z){return z===void 0||z===null?void 0:BigInt(z)}var R=class extends _{db;constructor(z,H){super(async()=>{this.db=await z(),this.conn=new W(this.db),await H?.(this.conn)})}async destroy(){await this.db?.close()}},W=class{constructor(z){this.db=z}async*streamQuery({parameters:z,query:H,sql:J}){if(!this.db.iterator)throw Error("streamQuery() is not supported.");let O=this.db.iterator($.is(H),J,z);for await(let K of O)yield{rows:[K]}}async executeQuery({parameters:z,query:H,sql:J}){return await this.db.query($.is(H),J,z)}},b=class extends Z{constructor(z,H){super(()=>new R(z,H))}};
1
+ import{Jd as P,La as X,Nd as U,Ud as j,Vd as A,_ as T,lb as $}from"./chunk-n9rpnke9.js";import{Il as E}from"./chunk-y8qhrx11.js";var Z=class{constructor(z){this.createDriver=z}createDriver;createQueryCompiler(){return new U}createAdapter(){return new A}createIntrospector(z){return new j(z)}},F=class{promise;resolve;async lock(){while(this.promise)await this.promise;this.promise=new Promise((z)=>{this.resolve=z})}unlock(){let z=this.resolve;this.promise=void 0,this.resolve=void 0,z?.()}};async function V(z,H,J,O,K){await J.executeQuery(K(X.createWithChildren([X.createWithSql(`${z} `),T.create(O)]),H()))}var _=class{mutex=new F;conn;savepoint;releaseSavepoint;rollbackToSavepoint;init;constructor(z){this.init=()=>import("./chunk-mw7x6xqp.js").then(({createQueryId:H})=>{if(H)this.savepoint=V.bind(null,"savepoint",H),this.releaseSavepoint=V.bind(null,"release",H),this.rollbackToSavepoint=V.bind(null,"rollback to",H)}).then(z)}async acquireConnection(){return await this.mutex.lock(),this.conn}async beginTransaction(z){await z.executeQuery(P.raw("begin"))}async commitTransaction(z){await z.executeQuery(P.raw("commit"))}async rollbackTransaction(z){await z.executeQuery(P.raw("rollback"))}async releaseConnection(){this.mutex.unlock()}};function L(z){return async(H,J,O)=>{let K=await z.all(J,O);return H||K.length?{rows:K}:{rows:[],...await z.run("select 1")}}}function M(z){return z===void 0||z===null?void 0:BigInt(z)}var R=class extends _{db;constructor(z,H){super(async()=>{this.db=await z(),this.conn=new W(this.db),await H?.(this.conn)})}async destroy(){await this.db?.close()}},W=class{constructor(z){this.db=z}async*streamQuery({parameters:z,query:H,sql:J}){if(!this.db.iterator)throw Error("streamQuery() is not supported.");let O=this.db.iterator($.is(H),J,z);for await(let K of O)yield{rows:[K]}}async executeQuery({parameters:z,query:H,sql:J}){return await this.db.query($.is(H),J,z)}},b=class extends Z{constructor(z,H){super(()=>new R(z,H))}};
2
2
  export{Z as d,L as e,M as f,b as g};
@@ -0,0 +1 @@
1
+ import{lf as c}from"./chunk-zsa62xr0.js";import"./chunk-n7s6my89.js";import"./chunk-yy8p9zph.js";import{bg as a,cg as b}from"./chunk-mnnyjmgw.js";import"./chunk-fzh0v6r0.js";import"./chunk-t6440ajd.js";import"./chunk-f0m4532p.js";import"./chunk-pe8mzxwn.js";import"./chunk-hp2jzn9x.js";import"./chunk-nk62q95g.js";import"./chunk-nmzx5nmt.js";import"./chunk-e8kxa5vj.js";import"./chunk-q1cxrg0x.js";import"./chunk-tjg2e8v3.js";import"./chunk-nsw5168d.js";import"./chunk-hve2a279.js";import"./chunk-y8qhrx11.js";export{a as getAgentListFromPackage,c as createSubAgentsMiddleware,b as SubAgentsMiddleware};
@@ -0,0 +1 @@
1
+ import{Re as a}from"./chunk-anbtppz1.js";import"./chunk-f0m4532p.js";import"./chunk-pe8mzxwn.js";import"./chunk-hp2jzn9x.js";import"./chunk-nk62q95g.js";import"./chunk-nmzx5nmt.js";import"./chunk-q1cxrg0x.js";import"./chunk-tjg2e8v3.js";import"./chunk-hve2a279.js";import"./chunk-y8qhrx11.js";export{a as WebMiddleware};