@rsbuild/core 2.1.10 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/jiti/dist/babel.cjs +4 -4
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +1 -1
- package/dist/626.js +50 -38
- package/dist/connect-next.js +1 -1
- package/dist/loadConfig.d.ts +1 -4
- package/dist/manifest-plugin.js +1 -1
- package/dist/memfs.js +1 -1
- package/dist/range-parser.js +1 -1
- package/dist/tinyglobby.js +1 -1
- package/dist/ws.js +2 -2
- package/package.json +7 -7
package/dist/range-parser.js
CHANGED
|
@@ -3,7 +3,7 @@ import { __webpack_require__ } from "./rslib-runtime.js";
|
|
|
3
3
|
__webpack_require__.add({
|
|
4
4
|
"../../node_modules/.pnpm/range-parser@1.3.0/node_modules/range-parser/index.js" (module) {
|
|
5
5
|
function parsePos(str) {
|
|
6
|
-
return /^\d+$/.test(str) ? Number(str) :
|
|
6
|
+
return /^\d+$/.test(str) ? Number(str) : 0 / 0;
|
|
7
7
|
}
|
|
8
8
|
function combineRanges(ranges) {
|
|
9
9
|
for(var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart), j = 0, i = 1; i < ordered.length; i++){
|
package/dist/tinyglobby.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"fs";import{readdir as e,readdirSync as o,realpath as n,realpathSync as s,stat as i,statSync as r}from"fs";import{basename as u,dirname as l,isAbsolute as a,normalize as p,posix as c,relative as h,resolve as f,sep as g}from"path";import{fileURLToPath as d}from"url";import{createRequire as m}from"module";import{__webpack_require__ as y}from"./rslib-runtime.js";y.add({"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js"),s=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");function i(t,e,o=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:s.isWindows()}),n(t,e,o)}Object.assign(i,n),t.exports=i},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"(t){let e="[^\\\\/]",o="[^/]",n="(?:\\/|$)",s="(?:^|\\/)",i=`\\.{1,2}${n}`,r=`(?!${s}${i})`,u=`(?!\\.{0,1}${n})`,l=`(?!${i})`,a=`${o}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:o,END_ANCHOR:n,DOTS_SLASH:i,NO_DOT:"(?!\\.)",NO_DOTS:r,NO_DOT_SLASH:u,NO_DOTS_SLASH:l,QMARK_NO_DOT:"[^.\\/]",STAR:a,START_ANCHOR:s,SEP:"/"},c={...p,SLASH_LITERAL:"[\\\\/]",QMARK:e,STAR:`${e}*?`,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:"(?:[\\\\/]|$)",SEP:"\\"};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,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"},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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?c:p}},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"),s=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:a}=n,p=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let o=`[${t.join("-")}]`;try{new RegExp(o)}catch(e){return t.map(t=>s.escapeRegex(t)).join("..")}return o},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,h=t=>{let e=[],o=0,n=0,s=0,i="",r=!1;for(let u of t){if(!0===r){i+=u,r=!1;continue}if("\\"===u){i+=u,r=!0;continue}if('"'===u){s=+(1!==s),i+=u;continue}if(0===s){if("["===u)o++;else if("]"===u&&o>0)o--;else if(0===o){if("("===u)n++;else if(")"===u&&n>0)n--;else if("|"===u&&0===n){e.push(i),i="";continue}}}i+=u}return e.push(i),e},f=t=>{let e=t.trim(),o=!0;for(;!0===o;)o=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),o=!0);if((t=>{let e=!1;for(let o of t){if(!0===e){e=!1;continue}if("\\"===o){e=!0;continue}if(/[?*+@!()[\]{}]/.test(o))return!1}return!0})(e))return e.replace(/\\(.)/g,"$1")},g=(t,e=!0)=>{if("+"!==t[0]&&"*"!==t[0]||"("!==t[1])return;let o=0,n=0,s=0,i=!1;for(let r=1;r<t.length;r++){let u=t[r];if(!0===i){i=!1;continue}if("\\"===u){i=!0;continue}if('"'===u){s=+(1!==s);continue}if(1!==s){if("["===u){o++;continue}if("]"===u&&o>0){o--;continue}if(!(o>0)){if("("===u){n++;continue}if(")"===u&&0==--n){if(!0===e&&r!==t.length-1)return;return{type:t[0],body:t.slice(2,r),end:r}}}}}},d=t=>{let e=0,o=[];for(;e<t.length;){let n=g(t.slice(e),!1);if(!n||"*"!==n.type)return;let s=h(n.body).map(t=>t.trim());if(1!==s.length)return;let i=f(s[0]);if(!i||1!==i.length)return;o.push(i),e+=n.end+1}if(o.length<1)return;let n=1===o.length?s.escapeRegex(o[0]):`[${o.map(t=>s.escapeRegex(t)).join("")}]`;return`${n}*`},m=t=>{let e=0,o=t.trim(),n=g(o);for(;n;)e++,n=g(o=n.body.trim());return e},y=(t,e)=>{let o;if("string"!=typeof t)throw TypeError("Expected a string");t=a[t]||t;let g={...e},b="number"==typeof g.maxLength?Math.min(i,g.maxLength):i,_=t.length;if(_>b)throw SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${b}`);let x={type:"bos",value:"",output:g.prepend||""},A=[x],R=g.capture?"":"?:",$=n.globChars(g.windows),E=n.extglobChars($),{DOT_LITERAL:v,PLUS_LITERAL:k,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:w,NO_DOT:H,NO_DOT_SLASH:L,NO_DOTS_SLASH:O,QMARK:T,QMARK_NO_DOT:P,STAR:D,START_ANCHOR:I}=$,B=t=>`(${R}(?:(?!${I}${t.dot?w:v}).)*?)`,F=g.dot?"":H,N=g.dot?T:P,M=!0===g.bash?B(g):D;g.capture&&(M=`(${M})`),"boolean"==typeof g.noext&&(g.noextglob=g.noext);let j={input:t,index:-1,start:0,dot:!0===g.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};_=(t=s.removePrefix(t,j)).length;let G=[],U=[],q=[],W=x,K=()=>j.index===_-1,Q=j.peek=(e=1)=>t[j.index+e],X=j.advance=()=>t[++j.index]||"",z=()=>t.slice(j.index+1),Z=(t="",e=0)=>{j.consumed+=t,j.index+=e},Y=t=>{j.output+=null!=t.output?t.output:t.value,Z(t.value)},V=()=>{let t=1;for(;"!"===Q()&&("("!==Q(2)||"?"===Q(3));)X(),j.start++,t++;return t%2!=0&&(j.negated=!0,j.start++,!0)},J=t=>{j[t]++,q.push(t)},tt=t=>{j[t]--,q.pop()},te=t=>{if("globstar"===W.type){let e=j.braces>0&&("comma"===t.type||"brace"===t.type),o=!0===t.extglob||G.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||o||(j.output=j.output.slice(0,-W.output.length),W.type="star",W.value="*",W.output=M,j.output+=W.output)}if(G.length&&"paren"!==t.type&&(G[G.length-1].inner+=t.value),(t.value||t.output)&&Y(t),W&&"text"===W.type&&"text"===t.type){W.output=(W.output||W.value)+t.value,W.value+=t.value;return}t.prev=W,A.push(t),W=t},to=(t,e)=>{let o={...E[e],conditions:1,inner:""};o.prev=W,o.parens=j.parens,o.output=j.output,o.startIndex=j.index,o.tokensIndex=A.length;let n=(g.capture?"(":"")+o.open;J("parens"),te({type:t,value:e,output:j.output?"":C}),te({type:"paren",extglob:!0,value:X(),output:n}),G.push(o)},tn=i=>{let r,u=t.slice(i.startIndex,j.index+1),l=((t,e)=>{if(!1===e.maxExtglobRecursion)return{risky:!1};let o="number"==typeof e.maxExtglobRecursion?e.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,s=h(t).map(t=>t.trim());if(s.length>1&&(s.some(t=>""===t)||s.some(t=>/^[*?]+$/.test(t))||(t=>{let e=t.map(f).filter(Boolean);for(let t=0;t<e.length;t++)for(let o=t+1;o<e.length;o++){let n=e[t],s=e[o],i=n[0];if(i&&n===i.repeat(n.length)&&s===i.repeat(s.length)&&(n===s||n.startsWith(s)||s.startsWith(n)))return!0}return!1})(s)))return{risky:!0};for(let t of s){let e=d(t);if(e)return{risky:!0,safeOutput:e};if(m(t)>o)return{risky:!0}}return{risky:!1}})(t.slice(i.startIndex+2,j.index),g);if(("plus"===i.type||"star"===i.type)&&l.risky){let t=l.safeOutput?(i.output?"":C)+(g.capture?`(${l.safeOutput})`:l.safeOutput):void 0,e=A[i.tokensIndex];e.type="text",e.value=u,e.output=t||s.escapeRegex(u);for(let t=i.tokensIndex+1;t<A.length;t++)A[t].value="",A[t].output="",delete A[t].suffix;j.output=i.output+e.output,j.backtrack=!0,te({type:"paren",extglob:!0,value:o,output:""}),tt("parens");return}let a=i.close+(g.capture?")":"");if("negate"===i.type){let t=M;if(i.inner&&i.inner.length>1&&i.inner.includes("/")&&(t=B(g)),(t!==M||K()||/^\)+$/.test(z()))&&(a=i.close=`)$))${t}`),i.inner.includes("*")&&(r=z())&&/^\.[^\\/.]+$/.test(r)){let o=y(r,{...e,fastpaths:!1}).output;a=i.close=`)${o})${t})`}"bos"===i.prev.type&&(j.negatedExtglob=!0)}te({type:"paren",extglob:!0,value:o,output:a}),tt("parens")};if(!1!==g.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let o=!1,n=t.replace(l,(t,e,n,s,i,r)=>"\\"===s?(o=!0,t):"?"===s?e?e+s+(i?T.repeat(i.length):""):0===r?N+(i?T.repeat(i.length):""):T.repeat(n.length):"."===s?v.repeat(n.length):"*"===s?e?e+s+(i?M:""):M:e?t:`\\${t}`);return(!0===o&&(n=!0===g.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),n===t&&!0===g.contains)?j.output=t:j.output=s.wrapOutput(n,j,e),j}for(;!K();){if("\0"===(o=X()))continue;if("\\"===o){let t=Q();if("/"===t&&!0!==g.bash||"."===t||";"===t)continue;if(!t){te({type:"text",value:o+="\\"});continue}let e=/^\\+/.exec(z()),n=0;if(e&&e[0].length>2&&(n=e[0].length,j.index+=n,n%2!=0&&(o+="\\")),!0===g.unescape?o=X():o+=X(),0===j.brackets){te({type:"text",value:o});continue}}if(j.brackets>0&&("]"!==o||"["===W.value||"[^"===W.value)){if(!1!==g.posix&&":"===o){let t=W.value.slice(1);if(t.includes("[")&&(W.posix=!0,t.includes(":"))){let t=W.value.lastIndexOf("["),e=W.value.slice(0,t),o=r[W.value.slice(t+2)];if(o){W.value=e+o,j.backtrack=!0,X(),x.output||1!==A.indexOf(W)||(x.output=C);continue}}}("["===o&&":"!==Q()||"-"===o&&"]"===Q())&&(o=`\\${o}`),"]"===o&&("["===W.value||"[^"===W.value)&&(o=`\\${o}`),!0===g.posix&&"!"===o&&"["===W.value&&(o="^"),W.value+=o,Y({value:o});continue}if(1===j.quotes&&'"'!==o){o=s.escapeRegex(o),W.value+=o,Y({value:o});continue}if('"'===o){j.quotes=+(1!==j.quotes),!0===g.keepQuotes&&te({type:"text",value:o});continue}if("("===o){J("parens"),te({type:"paren",value:o});continue}if(")"===o){if(0===j.parens&&!0===g.strictBrackets)throw SyntaxError(c("opening","("));let t=G[G.length-1];if(t&&j.parens===t.parens+1){tn(G.pop());continue}te({type:"paren",value:o,output:j.parens?")":"\\)"}),tt("parens");continue}if("["===o){if(!0!==g.nobracket&&z().includes("]"))J("brackets");else{if(!0!==g.nobracket&&!0===g.strictBrackets)throw SyntaxError(c("closing","]"));o=`\\${o}`}te({type:"bracket",value:o});continue}if("]"===o){if(!0===g.nobracket||W&&"bracket"===W.type&&1===W.value.length){te({type:"text",value:o,output:`\\${o}`});continue}if(0===j.brackets){if(!0===g.strictBrackets)throw SyntaxError(c("opening","["));te({type:"text",value:o,output:`\\${o}`});continue}tt("brackets");let t=W.value.slice(1);if(!0===W.posix||"^"!==t[0]||t.includes("/")||(o=`/${o}`),W.value+=o,Y({value:o}),!1===g.literalBrackets||s.hasRegexChars(t))continue;let e=s.escapeRegex(W.value);if(j.output=j.output.slice(0,-W.value.length),!0===g.literalBrackets){j.output+=e,W.value=e;continue}W.value=`(${R}${e}|${W.value})`,j.output+=W.value;continue}if("{"===o&&!0!==g.nobrace){J("braces");let t={type:"brace",value:o,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};U.push(t),te(t);continue}if("}"===o){let t=U[U.length-1];if(!0===g.nobrace||!t){te({type:"text",value:o,output:o});continue}let e=")";if(!0===t.dots){let t=A.slice(),o=[];for(let e=t.length-1;e>=0&&(A.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&o.unshift(t[e].value);e=p(o,g),j.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let n=j.output.slice(0,t.outputIndex),s=j.tokens.slice(t.tokensIndex);for(let i of(t.value=t.output="\\{",o=e="\\}",j.output=n,s))j.output+=i.output||i.value}te({type:"brace",value:o,output:e}),tt("braces"),U.pop();continue}if("|"===o){G.length>0&&G[G.length-1].conditions++,te({type:"text",value:o});continue}if(","===o){let t=o,e=U[U.length-1];e&&"braces"===q[q.length-1]&&(e.comma=!0,t="|"),te({type:"comma",value:o,output:t});continue}if("/"===o){if("dot"===W.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),W=x;continue}te({type:"slash",value:o,output:S});continue}if("."===o){if(j.braces>0&&"dot"===W.type){"."===W.value&&(W.output=v);let t=U[U.length-1];W.type="dots",W.output+=o,W.value+=o,t.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==W.type&&"slash"!==W.type){te({type:"text",value:o,output:v});continue}te({type:"dot",value:o,output:v});continue}if("?"===o){if(!(W&&"("===W.value)&&!0!==g.noextglob&&"("===Q()&&"?"!==Q(2)){to("qmark",o);continue}if(W&&"paren"===W.type){let t=Q(),e=o;("("!==W.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(z()))||(e=`\\${o}`),te({type:"text",value:o,output:e});continue}if(!0!==g.dot&&("slash"===W.type||"bos"===W.type)){te({type:"qmark",value:o,output:P});continue}te({type:"qmark",value:o,output:T});continue}if("!"===o){if(!0!==g.noextglob&&"("===Q()&&("?"!==Q(2)||!/[!=<:]/.test(Q(3)))){to("negate",o);continue}if(!0!==g.nonegate&&0===j.index){V();continue}}if("+"===o){if(!0!==g.noextglob&&"("===Q()&&"?"!==Q(2)){to("plus",o);continue}if(W&&"("===W.value||!1===g.regex){te({type:"plus",value:o,output:k});continue}if(W&&("bracket"===W.type||"paren"===W.type||"brace"===W.type)||j.parens>0){te({type:"plus",value:o});continue}te({type:"plus",value:k});continue}if("@"===o){if(!0!==g.noextglob&&"("===Q()&&"?"!==Q(2)){te({type:"at",extglob:!0,value:o,output:""});continue}te({type:"text",value:o});continue}if("*"!==o){("$"===o||"^"===o)&&(o=`\\${o}`);let t=u.exec(z());t&&(o+=t[0],j.index+=t[0].length),te({type:"text",value:o});continue}if(W&&("globstar"===W.type||!0===W.star)){W.type="star",W.star=!0,W.value+=o,W.output=M,j.backtrack=!0,j.globstar=!0,Z(o);continue}let e=z();if(!0!==g.noextglob&&/^\([^?]/.test(e)){to("star",o);continue}if("star"===W.type){if(!0===g.noglobstar){Z(o);continue}let n=W.prev,s=n.prev,i="slash"===n.type||"bos"===n.type,r=s&&("star"===s.type||"globstar"===s.type);if(!0===g.bash&&(!i||e[0]&&"/"!==e[0])){te({type:"star",value:o,output:""});continue}let u=j.braces>0&&("comma"===n.type||"brace"===n.type),l=G.length&&("pipe"===n.type||"paren"===n.type);if(!i&&"paren"!==n.type&&!u&&!l){te({type:"star",value:o,output:""});continue}for(;"/**"===e.slice(0,3);){let o=t[j.index+4];if(o&&"/"!==o)break;e=e.slice(3),Z("/**",3)}if("bos"===n.type&&K()){W.type="globstar",W.value+=o,W.output=B(g),j.output=W.output,j.globstar=!0,Z(o);continue}if("slash"===n.type&&"bos"!==n.prev.type&&!r&&K()){j.output=j.output.slice(0,-(n.output+W.output).length),n.output=`(?:${n.output}`,W.type="globstar",W.output=B(g)+(g.strictSlashes?")":"|$)"),W.value+=o,j.globstar=!0,j.output+=n.output+W.output,Z(o);continue}if("slash"===n.type&&"bos"!==n.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(n.output+W.output).length),n.output=`(?:${n.output}`,W.type="globstar",W.output=`${B(g)}${S}|${S}${t})`,W.value+=o,j.output+=n.output+W.output,j.globstar=!0,Z(o+X()),te({type:"slash",value:"/",output:""});continue}if("bos"===n.type&&"/"===e[0]){W.type="globstar",W.value+=o,W.output=`(?:^|${S}|${B(g)}${S})`,j.output=W.output,j.globstar=!0,Z(o+X()),te({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-W.output.length),W.type="globstar",W.output=B(g),W.value+=o,j.output+=W.output,j.globstar=!0,Z(o);continue}let n={type:"star",value:o,output:M};if(!0===g.bash){n.output=".*?",("bos"===W.type||"slash"===W.type)&&(n.output=F+n.output),te(n);continue}if(W&&("bracket"===W.type||"paren"===W.type)&&!0===g.regex){n.output=o,te(n);continue}(j.index===j.start||"slash"===W.type||"dot"===W.type)&&("dot"===W.type?(j.output+=L,W.output+=L):!0===g.dot?(j.output+=O,W.output+=O):(j.output+=F,W.output+=F),"*"!==Q()&&(j.output+=C,W.output+=C)),te(n)}for(;j.brackets>0;){if(!0===g.strictBrackets)throw SyntaxError(c("closing","]"));j.output=s.escapeLast(j.output,"["),tt("brackets")}for(;j.parens>0;){if(!0===g.strictBrackets)throw SyntaxError(c("closing",")"));j.output=s.escapeLast(j.output,"("),tt("parens")}for(;j.braces>0;){if(!0===g.strictBrackets)throw SyntaxError(c("closing","}"));j.output=s.escapeLast(j.output,"{"),tt("braces")}if(!0!==g.strictSlashes&&("star"===W.type||"bracket"===W.type)&&te({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack)for(let t of(j.output="",j.tokens))j.output+=null!=t.output?t.output:t.value,t.suffix&&(j.output+=t.suffix);return j};y.fastpaths=(t,e)=>{let o={...e},r="number"==typeof o.maxLength?Math.min(i,o.maxLength):i,u=t.length;if(u>r)throw SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${r}`);t=a[t]||t;let{DOT_LITERAL:l,SLASH_LITERAL:p,ONE_CHAR:c,DOTS_SLASH:h,NO_DOT:f,NO_DOTS:g,NO_DOTS_SLASH:d,STAR:m,START_ANCHOR:y}=n.globChars(o.windows),b=o.dot?g:f,_=o.dot?d:f,x=o.capture?"":"?:",A=!0===o.bash?".*?":m;o.capture&&(A=`(${A})`);let R=t=>!0===t.noglobstar?A:`(${x}(?:(?!${y}${t.dot?h:l}).)*?)`,$=t=>{switch(t){case"*":return`${b}${c}${A}`;case".*":return`${l}${c}${A}`;case"*.*":return`${b}${A}${l}${c}${A}`;case"*/*":return`${b}${A}${p}${c}${_}${A}`;case"**":return b+R(o);case"**/*":return`(?:${b}${R(o)}${p})?${_}${c}${A}`;case"**/*.*":return`(?:${b}${R(o)}${p})?${_}${A}${l}${c}${A}`;case"**/.*":return`(?:${b}${R(o)}${p})?${l}${c}${A}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let o=$(e[1]);if(!o)return;return o+l+e[2]}}},E=$(s.removePrefix(t,{negated:!1,prefix:""}));return E&&!0!==o.strictSlashes&&(E+=`${p}?`),E},t.exports=y},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js"),s=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"),i=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"),r=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"),u=(t,e,o=!1)=>{if(Array.isArray(t)){let n=t.map(t=>u(t,e,o));return t=>{for(let e of n){let o=e(t);if(o)return o}return!1}}let n=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!n)throw TypeError("Expected pattern to be a non-empty string");let s=e||{},i=s.windows,r=n?u.compileRe(t,e):u.makeRe(t,e,!1,!0),l=r.state;delete r.state;let a=()=>!1;if(s.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};a=u(s.ignore,t,o)}let p=(o,n=!1)=>{let{isMatch:p,match:c,output:h}=u.test(o,r,e,{glob:t,posix:i}),f={glob:t,state:l,regex:r,posix:i,input:o,output:h,match:c,isMatch:p};return("function"==typeof s.onResult&&s.onResult(f),!1===p)?(f.isMatch=!1,!!n&&f):a(o)?("function"==typeof s.onIgnore&&s.onIgnore(f),f.isMatch=!1,!!n&&f):("function"==typeof s.onMatch&&s.onMatch(f),!n||f)};return o&&(p.state=l),p};u.test=(t,e,o,{glob:n,posix:s}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let r=o||{},l=r.format||(s?i.toPosixSlashes:null),a=t===n,p=a&&l?l(t):t;return!1===a&&(a=(p=l?l(t):t)===n),(!1===a||!0===r.capture)&&(a=!0===r.matchBase||!0===r.basename?u.matchBase(t,e,o,s):e.exec(p)),{isMatch:!!a,match:a,output:p}},u.matchBase=(t,e,o)=>(e instanceof RegExp?e:u.makeRe(e,o)).test(i.basename(t)),u.isMatch=(t,e,o)=>u(e,o)(t),u.parse=(t,e)=>Array.isArray(t)?t.map(t=>u.parse(t,e)):s(t,{...e,fastpaths:!1}),u.scan=(t,e)=>n(t,e),u.compileRe=(t,e,o=!1,n=!1)=>{if(!0===o)return t.output;let s=e||{},i=s.contains?"":"^",r=s.contains?"":"$",l=`${i}(?:${t.output})${r}`;t&&!0===t.negated&&(l=`^(?!${l}).*$`);let a=u.toRegex(l,e);return!0===n&&(a.state=t),a},u.makeRe=(t,e={},o=!1,n=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(i.output=s.fastpaths(t,e)),i.output||(i=s(t,e)),u.compileRe(i,e,o,n)},u.toRegex=(t,e)=>{try{let o=e||{};return new RegExp(t,o.flags||(o.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},u.constants=r,t.exports=u},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"),{CHAR_ASTERISK:s,CHAR_AT:i,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:u,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:p,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:h,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:g,CHAR_QUESTION_MARK:d,CHAR_RIGHT_CURLY_BRACE:m,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:b}=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"),_=t=>t===p||t===r,x=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};t.exports=(t,e)=>{let o,A,R=e||{},$=t.length-1,E=!0===R.parts||!0===R.scanToEnd,v=[],k=[],S=[],C=t,w=-1,H=0,L=0,O=!1,T=!1,P=!1,D=!1,I=!1,B=!1,F=!1,N=!1,M=!1,j=!1,G=0,U={value:"",depth:0,isGlob:!1},q=()=>w>=$,W=()=>C.charCodeAt(w+1),K=()=>(o=A,C.charCodeAt(++w));for(;w<$;){let t;if((A=K())===r){F=U.backslashes=!0,(A=K())===c&&(B=!0);continue}if(!0===B||A===c){for(G++;!0!==q()&&(A=K());){if(A===r){F=U.backslashes=!0,K();continue}if(A===c){G++;continue}if(!0!==B&&A===l&&(A=K())===l||!0!==B&&A===u){if(O=U.isBrace=!0,P=U.isGlob=!0,j=!0,!0===E)continue;break}if(A===m&&0==--G){B=!1,O=U.isBrace=!0,j=!0;break}}if(!0===E)continue;break}if(A===p){if(v.push(w),k.push(U),U={value:"",depth:0,isGlob:!1},!0===j)continue;if(o===l&&w===H+1){H+=2;continue}L=w+1;continue}if(!0!==R.noext&&!0==(A===g||A===i||A===s||A===d||A===a)&&W()===h){if(P=U.isGlob=!0,D=U.isExtglob=!0,j=!0,A===a&&w===H&&(M=!0),!0===E){for(;!0!==q()&&(A=K());){if(A===r){F=U.backslashes=!0,A=K();continue}if(A===y){P=U.isGlob=!0,j=!0;break}}continue}break}if(A===s){if(o===s&&(I=U.isGlobstar=!0),P=U.isGlob=!0,j=!0,!0===E)continue;break}if(A===d){if(P=U.isGlob=!0,j=!0,!0===E)continue;break}if(A===f){for(;!0!==q()&&(t=K());){if(t===r){F=U.backslashes=!0,K();continue}if(t===b){T=U.isBracket=!0,P=U.isGlob=!0,j=!0;break}}if(!0===E)continue;break}if(!0!==R.nonegate&&A===a&&w===H){N=U.negated=!0,H++;continue}if(!0!==R.noparen&&A===h){if(P=U.isGlob=!0,!0===E){for(;!0!==q()&&(A=K());){if(A===h){F=U.backslashes=!0,A=K();continue}if(A===y){j=!0;break}}continue}break}if(!0===P){if(j=!0,!0===E)continue;break}}!0===R.noext&&(D=!1,P=!1);let Q=C,X="",z="";H>0&&(X=C.slice(0,H),C=C.slice(H),L-=H),Q&&!0===P&&L>0?(Q=C.slice(0,L),z=C.slice(L)):!0===P?(Q="",z=C):Q=C,Q&&""!==Q&&"/"!==Q&&Q!==C&&_(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===R.unescape&&(z&&(z=n.removeBackslashes(z)),Q&&!0===F&&(Q=n.removeBackslashes(Q)));let Z={prefix:X,input:t,start:H,base:Q,glob:z,isBrace:O,isBracket:T,isGlob:P,isExtglob:D,isGlobstar:I,negated:N,negatedExtglob:M};if(!0===R.tokens&&(Z.maxDepth=0,_(A)||k.push(U),Z.tokens=k),!0===R.parts||!0===R.tokens){let e;for(let o=0;o<v.length;o++){let n=e?e+1:H,s=v[o],i=t.slice(n,s);R.tokens&&(0===o&&0!==H?(k[o].isPrefix=!0,k[o].value=X):k[o].value=i,x(k[o]),Z.maxDepth+=k[o].depth),(0!==o||""!==i)&&S.push(i),e=s}if(e&&e+1<t.length){let o=t.slice(e+1);S.push(o),R.tokens&&(k[k.length-1].value=o,x(k[k.length-1]),Z.maxDepth+=k[k.length-1].depth)}Z.slashes=v,Z.parts=S}return Z}},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"(t,e,o){let{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:r}=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");e.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),e.hasRegexChars=t=>i.test(t),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=t=>t.replace(r,"\\$1"),e.toPosixSlashes=t=>t.replace(n,"/"),e.isWindows=()=>{if("u">typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return"u">typeof process&&!!process.platform&&"win32"===process.platform},e.removeBackslashes=t=>t.replace(s,t=>"\\"===t?"":t),e.escapeLast=(t,o,n)=>{let s=t.lastIndexOf(o,n);return -1===s?t:"\\"===t[s-1]?e.escapeLast(t,o,s-1):`${t.slice(0,s)}\\${t.slice(s)}`},e.removePrefix=(t,e={})=>{let o=t;return o.startsWith("./")&&(o=o.slice(2),e.prefix="./"),o},e.wrapOutput=(t,e={},o={})=>{let n=o.contains?"":"^",s=o.contains?"":"$",i=`${n}(?:${t})${s}`;return!0===e.negated&&(i=`(?:^(?!${i}).*$)`),i},e.basename=(t,{windows:e}={})=>{let o=t.split(e?/[\\/]/:"/"),n=o[o.length-1];return""===n?o[o.length-2]:n}}});var b=m(import.meta.url);let _=/[\\/]/g;function x(t,e){return t.replace(_,e)}let A=/^[a-z]:[\\/]$/i;function R(t,e){let o,{resolvePaths:n,normalizePath:s,pathSeparator:i}=e,r="win32"===process.platform&&t.includes("/")||t.startsWith(".");return n&&(t=f(t)),((s||r)&&((o=p(t)).length>1&&o[o.length-1]===g&&(o=o.substring(0,o.length-1)),t=o),"."===t)?"":x(t[t.length-1]!==i?t+i:t,i)}function $(t,e){return e+t}function E(t){return t}let v=(t,e)=>{e.push(t||".")},k=(t,e,o)=>{let n=t||".";o.every(t=>t(n,!0))&&e.push(n)},S=()=>{},C=(t,e,o,n)=>{n.every(e=>e(t,!1))&&o.files++},w=(t,e,o,n)=>{n.every(e=>e(t,!1))&&e.push(t)},H=(t,e,o,n)=>{o.files++},L=(t,e)=>{e.push(t)},O=()=>{},T=t=>t,P=()=>[""].slice(0,0),D=(t,e,o)=>{t.push({directory:e,files:o,dir:e})},I=()=>{},B=function(t,e,o){let{queue:n,fs:s,options:{suppressErrors:i}}=e;n.enqueue(),s.realpath(t,(r,u)=>{if(r)return n.dequeue(i?null:r,e);s.stat(u,(s,r)=>s?n.dequeue(i?null:s,e):r.isDirectory()&&N(t,u,e)?n.dequeue(null,e):void(o(r,u),n.dequeue(null,e)))})},F=function(t,e,o){let{queue:n,fs:s,options:{suppressErrors:i}}=e;n.enqueue();try{let n=s.realpathSync(t),i=s.statSync(n);if(i.isDirectory()&&N(t,n,e))return;o(i,n)}catch(t){if(!i)throw t}};function N(t,e,o){if(o.options.useRealPaths){var n,s;return n=e,(s=o).visited.includes(n+s.options.pathSeparator)}let i=l(t),r=1;for(;i!==o.root&&r<2;){let t=o.symlinks.get(i);t&&(t===e||t.startsWith(e)||e.startsWith(t))?r++:i=l(i)}return o.symlinks.set(t,e),r>1}let M=t=>t.counts,j=t=>t.groups,G=t=>t.paths,U=t=>t.paths.slice(0,t.options.maxFiles),q=(t,e,o)=>(X(e,o,t.counts,t.options.suppressErrors),null),W=(t,e,o)=>(X(e,o,t.paths,t.options.suppressErrors),null),K=(t,e,o)=>(X(e,o,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Q=(t,e,o)=>(X(e,o,t.groups,t.options.suppressErrors),null);function X(t,e,o,n){e(t&&!n?t:null,o)}let z={withFileTypes:!0},Z=(t,e,o,n,s)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",z,(e,i=[])=>{s(i,o,n),t.queue.dequeue(t.options.suppressErrors?null:e,t)})},Y=(t,e,o,n,s)=>{let{fs:i}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let r=[];try{r=i.readdirSync(e||".",z)}catch(e){if(!t.options.suppressErrors)throw e}s(r,o,n)};var V=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},J=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},tt=class{aborted=!1;abort(){this.aborted=!0}},te=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,o,n){var s,i;this.isSynchronous=!n,this.callbackInvoker=function(t,e){let{onlyCounts:o,group:n,maxFiles:s}=t;return o?e?M:q:n?e?j:Q:s?e?U:K:e?G:W}(o,this.isSynchronous),this.root=R(e,o),this.state={root:"/"===(s=this.root)||A.test(s)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new J,options:o,queue:new V((t,e)=>this.callbackInvoker(e,t,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new tt,fs:o.fs||t},this.joinPath=function(t,e){let{relativePaths:o,includeBasePath:n}=e;return o&&t?function(o,n){return n.startsWith(t)?n.slice(t.length)+o:x(h(t,n),e.pathSeparator)+e.pathSeparator+o}:n?$:E}(this.root,o),this.pushDirectory=function(t,e){let{includeDirs:o,filters:n,relativePaths:s}=e;if(!o)return S;if(s)return n&&n.length?function(e,o,n){let s=e.substring(t.length)||".";n.every(t=>t(s,!0))&&o.push(s)}:function(e,o){o.push(e.substring(t.length)||".")};return n&&n.length?k:v}(this.root,o),this.pushFile=function(t){let{excludeFiles:e,filters:o,onlyCounts:n}=t;return e?O:o&&o.length?n?C:w:n?H:L}(o),this.getArray=o.group?P:T,this.groupFiles=o.group?D:I,this.resolveSymlink=(i=this.isSynchronous,!o.resolveSymlinks||o.excludeSymlinks?null:i?F:B),this.walkDirectory=this.isSynchronous?Y:Z}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,o)=>{let{paths:n,options:{filters:s,resolveSymlinks:i,excludeSymlinks:r,exclude:a,maxFiles:p,signal:c,useRealPaths:h,pathSeparator:f},controller:g}=this.state;if(g.aborted||c&&c.aborted||p&&n.length>p)return;let d=this.getArray(this.state.paths);for(let p=0;p<t.length;++p){let c=t[p];if(c.isFile()||c.isSymbolicLink()&&!i&&!r){let t=this.joinPath(c.name,e);this.pushFile(t,d,this.state.counts,s)}else if(c.isDirectory()){let t=e+c.name+this.state.options.pathSeparator;if(a&&a(c.name,t))continue;this.pushDirectory(t,n,s),this.walkDirectory(this.state,t,t,o-1,this.walk)}else if(this.resolveSymlink&&c.isSymbolicLink()){let t=e+c.name;this.resolveSymlink(t,this.state,(e,n)=>{if(e.isDirectory())n=R(n,this.state.options),a&&a(c.name,h?n:t+f)||this.walkDirectory(this.state,n,h?n:t+f,o-1,this.walk);else{let e=u(n=h?n:t),o=R(l(n),this.state.options);n=this.joinPath(e,o),this.pushFile(n,d,this.state.counts,s)}})}}this.groupFiles(this.state.groups,e,d)}};function to(t,e,o){new te(t,e,o).start()}var tn=class{constructor(t,e){this.root=t,this.options=e}withPromise(){var t,e;return t=this.root,e=this.options,new Promise((o,n)=>{to(t,e,(t,e)=>{if(t)return n(t);o(e)})})}withCallback(t){to(this.root,this.options,t)}sync(){return new te(this.root,this.options).start()}};let ts=null;try{b.resolve("picomatch"),ts=b("picomatch")}catch{}var ti=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:g,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new tn(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new tn(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let o=this.globFunction||ts;if(!o)throw Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=o(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(t=>n(t)),this}};let tr=y("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js"),tu=Array.isArray,tl=/\\/g,ta=/^[A-Za-z]:$/,tp="win32"===process.platform,tc=/^(\/?\.\.)+$/,th=/^[A-Z]:\/$/i,tf=tp?t=>th.test(t):t=>"/"===t;function tg(t,e,o){if(t===e||e.startsWith(`${t}/`)){if(o){let e=t.length+ +!tf(t);return(t,o)=>t.slice(e,o?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(t,e)=>{if("."===t)return n;let o=`${n}/${t}`;return e?o.slice(0,-1):o}:(t,e)=>e&&"."!==t?t.slice(0,-1):t}return o?e=>c.relative(t,e)||".":o=>c.relative(t,`${e}/${o}`)||"."}function td(t){return t.replace(ta,t=>`${t}/`)}let tm={parts:!0};function ty(t){var e;let o=tr.scan(t,tm);return(null==(e=o.parts)?void 0:e.length)?o.parts:[t]}let tb=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,t_=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,tx=tp?t=>t.replace(t_,"\\$&"):t=>t.replace(tb,"\\$&");function tA(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function tR(t){return"string"==typeof t?[t]:null!=t?t:[]}let t$=/^(\/?\.\.)+/,tE=/\\(?=[()[\]{}!*+?@|])/g;function tv(t,e,o,n){var s;let i=e.cwd,r=t;"/"===t[t.length-1]&&(r=t.slice(0,-1)),"*"!==r[r.length-1]&&e.expandDirectories&&(r+="/**");let u=tx(i);r=a(r.replace(tE,""))?c.relative(u,r):c.normalize(r);let l=null==(s=t$.exec(r))?void 0:s[0],p=ty(r);if(l){let t=(l.length+1)/3,e=0,n=u.split("/");for(;e<t&&p[e+t]===n[n.length+e-t];)r=r.slice(0,(t-e-1)*3)+r.slice((t-e)*3+p[e+t].length+1)||".",e++;let s=c.join(i,l.slice(3*e));"."!==s[0]&&o.root.length>s.length&&(o.root=td(s),o.depthOffset=-t+e)}if(!n&&o.depthOffset>=0){null!=o.commonPath||(o.commonPath=p);let t=[],e=Math.min(o.commonPath.length,p.length);for(let n=0;n<e;n++){let e=p[n];if("**"===e&&!p[n+1]){t.pop();break}if(n===p.length-1||e!==o.commonPath[n]||function(t){let e=tr.scan(t);return e.isGlob||e.negated}(e))break;t.push(e)}o.depthOffset=t.length,o.commonPath=t,o.root=td(t.length>0?c.join(i,...t):i)}return r}function tk(t,e){if(e)for(let o=t.length-1;o>=0;o--)t[o]=e(t[o]);return t}let tS={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function tC(t,u={}){var l;if(t&&(null==u?void 0:u.patterns))throw Error("Cannot pass patterns as both an argument and an option");let a=tu(t)||"string"==typeof t,p=tR(null!=(l=a?t:t.patterns)?l:"**/*"),h=function(t){let u=Object.assign({},t);for(let t in tS)void 0===u[t]&&Object.assign(u,{[t]:tS[t]});return u.cwd=(u.cwd instanceof URL?d(u.cwd):f(u.cwd||process.cwd())).replace(tl,"/"),u.ignore=tR(u.ignore),u.fs&&(u.fs={readdir:u.fs.readdir||e,readdirSync:u.fs.readdirSync||o,realpath:u.fs.realpath||n,realpathSync:u.fs.realpathSync||s,stat:u.fs.stat||i,statSync:u.fs.statSync||r}),u.debug&&tA("globbing with options:",u),u}(a?u:t);return p.length>0?function(t,e){let o,n=t.cwd,s={root:n,depthOffset:0},i=function(t,e,o){let n=[],s=[];for(let e of t.ignore)e&&("!"!==e[0]||"("===e[1])&&s.push(tv(e,t,o,!0));for(let i of e)i&&("!"!==i[0]||"("===i[1]?n.push(tv(i,t,o,!1)):("!"!==i[1]||"("===i[2])&&s.push(tv(i.slice(1),t,o,!0)));return{match:n,ignore:s}}(t,e,s);t.debug&&tA("internal processing patterns:",i);let{absolute:r,caseSensitiveMatch:u,debug:l,dot:a,followSymbolicLinks:p,onlyDirectories:h}=t,f=s.root.replace(tl,""),g={dot:a,nobrace:!1===t.braceExpansion,nocase:!u,noextglob:!1===t.extglob,noglobstar:!1===t.globstar,posix:!0},d=tr(i.match,g),m=tr(i.ignore,g),y=function(t,e={}){let o,n,s=t.length,i=Array(s),r=Array(s);for(o=0;o<s;o++){let s=ty(t[o]);i[o]=s;let u=s.length,l=Array(u);for(n=0;n<u;n++)l[n]=tr(s[n],e);r[o]=l}return t=>{let u=t.split("/");if(".."===u[0]&&tc.test(t))return!0;for(o=0;o<s;o++){let t=i[o],s=r[o],l=u.length,a=Math.min(l,t.length);for(n=0;n<a;){let o=t[n];if(o.includes("/"))return!0;if(!s[n](u[n]))break;if(!e.noglobstar&&"**"===o)return!0;n++}if(n===l)return!0}return!1}}(i.match,g),b=tg(n,f,r),_=r?b:tg(n,f,!0),x=(t,e)=>{let o=_(e,!0);return"."!==o&&!y(o)||m(o)};void 0!==t.deep&&(o=Math.round(t.deep-s.depthOffset));let A=new ti({filters:[l?(t,e)=>{let o=b(t,e),n=d(o)&&!m(o);return n&&tA(`matched ${o}`),n}:(t,e)=>{let o=b(t,e);return d(o)&&!m(o)}],exclude:l?(t,e)=>{let o=x(t,e);return tA(`${o?"skipped":"crawling"} ${e}`),o}:x,fs:t.fs,pathSeparator:"/",relativePaths:!r,resolvePaths:r,includeBasePath:r,resolveSymlinks:p,excludeSymlinks:!p,excludeFiles:h,includeDirs:h||!t.onlyFiles,maxDepth:o,signal:t.signal}).crawl(f);return t.debug&&tA("internal properties:",{...s,root:f}),[A,n!==f&&!r&&function(t,e){if(e.startsWith(`${t}/`)){let o=e.slice(t.length+1);return t=>`${o}/${t}`}return o=>{let n=c.relative(t,`${e}/${o}`);return"/"===o[o.length-1]&&""!==n?`${n}/`:n||"."}}(n,f)]}(h,p):[]}async function tw(t,e){let[o,n]=tC(t,e);return o?tk(await o.withPromise(),n):[]}function tH(t,e){let[o,n]=tC(t,e);return o?tk(o.sync(),n):[]}export{tw as glob,tH as globSync};
|
|
1
|
+
import*as t from"fs";import{readdir as e,readdirSync as o,realpath as n,realpathSync as s,stat as i,statSync as r}from"fs";import{basename as u,dirname as l,isAbsolute as a,normalize as p,posix as c,relative as h,resolve as f,sep as d}from"path";import{fileURLToPath as g}from"url";import{createRequire as m}from"module";import{__webpack_require__ as y}from"./rslib-runtime.js";y.add({"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js"),s=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js");function i(t,e,o=!1){return e&&(null===e.windows||void 0===e.windows)&&(e={...e,windows:s.isWindows()}),n(t,e,o)}Object.assign(i,n),t.exports=i},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"(t){let e="[^\\\\/]",o="[^/]",n="(?:\\/|$)",s="(?:^|\\/)",i=`\\.{1,2}${n}`,r=`(?!${s}${i})`,u=`(?!\\.{0,1}${n})`,l=`(?!${i})`,a=`${o}*?`,p={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:o,END_ANCHOR:n,DOTS_SLASH:i,NO_DOT:"(?!\\.)",NO_DOTS:r,NO_DOT_SLASH:u,NO_DOTS_SLASH:l,QMARK_NO_DOT:"[^.\\/]",STAR:a,START_ANCHOR:s,SEP:"/"},c={...p,SLASH_LITERAL:"[\\\\/]",QMARK:e,STAR:`${e}*?`,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:"(?:[\\\\/]|$)",SEP:"\\"};t.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{__proto__:null,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"},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:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},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,extglobChars:t=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:t=>!0===t?c:p}},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"),s=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_BACKREF:l,REPLACEMENTS:a}=n,p=(t,e)=>{if("function"==typeof e.expandRange)return e.expandRange(...t,e);t.sort();let o=`[${t.join("-")}]`;try{new RegExp(o)}catch(e){return t.map(t=>s.escapeRegex(t)).join("..")}return o},c=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,h=t=>{let e=[],o=0,n=0,s=0,i="",r=!1;for(let u of t){if(!0===r){i+=u,r=!1;continue}if("\\"===u){i+=u,r=!0;continue}if('"'===u){s=+(1!==s),i+=u;continue}if(0===s){if("["===u)o++;else if("]"===u&&o>0)o--;else if(0===o){if("("===u)n++;else if(")"===u&&n>0)n--;else if("|"===u&&0===n){e.push(i),i="";continue}}}i+=u}return e.push(i),e},f=t=>{let e=t.trim(),o=!0;for(;!0===o;)o=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),o=!0);if((t=>{let e=!1;for(let o of t){if(!0===e){e=!1;continue}if("\\"===o){e=!0;continue}if(/[?*+@!()[\]{}]/.test(o))return!1}return!0})(e))return e.replace(/\\(.)/g,"$1")},d=(t,e=!0)=>{if("+"!==t[0]&&"*"!==t[0]||"("!==t[1])return;let o=0,n=0,s=0,i=!1;for(let r=1;r<t.length;r++){let u=t[r];if(!0===i){i=!1;continue}if("\\"===u){i=!0;continue}if('"'===u){s=+(1!==s);continue}if(1!==s){if("["===u){o++;continue}if("]"===u&&o>0){o--;continue}if(!(o>0)){if("("===u){n++;continue}if(")"===u&&0==--n){if(!0===e&&r!==t.length-1)return;return{type:t[0],body:t.slice(2,r),end:r}}}}}},g=t=>{let e=0,o=[];for(;e<t.length;){let n=d(t.slice(e),!1);if(!n||"*"!==n.type)return;let s=h(n.body).map(t=>t.trim());if(1!==s.length)return;let i=f(s[0]);if(!i||1!==i.length)return;o.push(i),e+=n.end+1}if(o.length<1)return;let n=1===o.length?s.escapeRegex(o[0]):`[${o.map(t=>s.escapeRegex(t)).join("")}]`;return`${n}*`},m=t=>{let e=0,o=t.trim(),n=d(o);for(;n;)e++,n=d(o=n.body.trim());return e},y=(t,e)=>{let o;if("string"!=typeof t)throw TypeError("Expected a string");t=a[t]||t;let d={...e},b="number"==typeof d.maxLength?Math.min(i,d.maxLength):i,_=t.length;if(_>b)throw SyntaxError(`Input length: ${_}, exceeds maximum allowed length: ${b}`);let x={type:"bos",value:"",output:d.prepend||""},A=[x],R=d.capture?"":"?:",$=n.globChars(d.windows),E=n.extglobChars($),{DOT_LITERAL:v,PLUS_LITERAL:k,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:w,NO_DOT:H,NO_DOT_SLASH:L,NO_DOTS_SLASH:O,QMARK:T,QMARK_NO_DOT:P,STAR:D,START_ANCHOR:I}=$,B=t=>`(${R}(?:(?!${I}${t.dot?w:v}).)*?)`,F=d.dot?"":H,N=d.dot?T:P,M=!0===d.bash?B(d):D;d.capture&&(M=`(${M})`),"boolean"==typeof d.noext&&(d.noextglob=d.noext);let j={input:t,index:-1,start:0,dot:!0===d.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};_=(t=s.removePrefix(t,j)).length;let G=[],U=[],q=[],W=x,K=()=>j.index===_-1,Q=j.peek=(e=1)=>t[j.index+e],X=j.advance=()=>t[++j.index]||"",z=()=>t.slice(j.index+1),Z=(t="",e=0)=>{j.consumed+=t,j.index+=e},Y=t=>{j.output+=null!=t.output?t.output:t.value,Z(t.value)},V=()=>{let t=1;for(;"!"===Q()&&("("!==Q(2)||"?"===Q(3));)X(),j.start++,t++;return t%2!=0&&(j.negated=!0,j.start++,!0)},J=t=>{j[t]++,q.push(t)},tt=t=>{j[t]--,q.pop()},te=t=>{if("globstar"===W.type){let e=j.braces>0&&("comma"===t.type||"brace"===t.type),o=!0===t.extglob||G.length&&("pipe"===t.type||"paren"===t.type);"slash"===t.type||"paren"===t.type||e||o||(j.output=j.output.slice(0,-W.output.length),W.type="star",W.value="*",W.output=M,j.output+=W.output)}if(G.length&&"paren"!==t.type&&(G[G.length-1].inner+=t.value),(t.value||t.output)&&Y(t),W&&"text"===W.type&&"text"===t.type){W.output=(W.output||W.value)+t.value,W.value+=t.value;return}t.prev=W,A.push(t),W=t},to=(t,e)=>{let o={...E[e],conditions:1,inner:""};o.prev=W,o.parens=j.parens,o.output=j.output,o.startIndex=j.index,o.tokensIndex=A.length;let n=(d.capture?"(":"")+o.open;J("parens"),te({type:t,value:e,output:j.output?"":C}),te({type:"paren",extglob:!0,value:X(),output:n}),G.push(o)},tn=i=>{let r,u=t.slice(i.startIndex,j.index+1),l=((t,e)=>{if(!1===e.maxExtglobRecursion)return{risky:!1};let o="number"==typeof e.maxExtglobRecursion?e.maxExtglobRecursion:n.DEFAULT_MAX_EXTGLOB_RECURSION,s=h(t).map(t=>t.trim());if(s.length>1&&(s.some(t=>""===t)||s.some(t=>/^[*?]+$/.test(t))||(t=>{let e=t.map(f).filter(Boolean);for(let t=0;t<e.length;t++)for(let o=t+1;o<e.length;o++){let n=e[t],s=e[o],i=n[0];if(i&&n===i.repeat(n.length)&&s===i.repeat(s.length)&&(n===s||n.startsWith(s)||s.startsWith(n)))return!0}return!1})(s)))return{risky:!0};for(let t of s){let e=g(t);if(e)return{risky:!0,safeOutput:e};if(m(t)>o)return{risky:!0}}return{risky:!1}})(t.slice(i.startIndex+2,j.index),d);if(("plus"===i.type||"star"===i.type)&&l.risky){let t=l.safeOutput?(i.output?"":C)+(d.capture?`(${l.safeOutput})`:l.safeOutput):void 0,e=A[i.tokensIndex];e.type="text",e.value=u,e.output=t||s.escapeRegex(u);for(let t=i.tokensIndex+1;t<A.length;t++)A[t].value="",A[t].output="",delete A[t].suffix;j.output=i.output+e.output,j.backtrack=!0,te({type:"paren",extglob:!0,value:o,output:""}),tt("parens");return}let a=i.close+(d.capture?")":"");if("negate"===i.type){let t=M;if(i.inner&&i.inner.length>1&&i.inner.includes("/")&&(t=B(d)),(t!==M||K()||/^\)+$/.test(z()))&&(a=i.close=`)$))${t}`),i.inner.includes("*")&&(r=z())&&/^\.[^\\/.]+$/.test(r)){let o=y(r,{...e,fastpaths:!1}).output;a=i.close=`)${o})${t})`}"bos"===i.prev.type&&(j.negatedExtglob=!0)}te({type:"paren",extglob:!0,value:o,output:a}),tt("parens")};if(!1!==d.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(t)){let o=!1,n=t.replace(l,(t,e,n,s,i,r)=>"\\"===s?(o=!0,t):"?"===s?e?e+s+(i?T.repeat(i.length):""):0===r?N+(i?T.repeat(i.length):""):T.repeat(n.length):"."===s?v.repeat(n.length):"*"===s?e?e+s+(i?M:""):M:e?t:`\\${t}`);return(!0===o&&(n=!0===d.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,t=>t.length%2==0?"\\\\":t?"\\":"")),n===t&&!0===d.contains)?j.output=t:j.output=s.wrapOutput(n,j,e),j}for(;!K();){if("\0"===(o=X()))continue;if("\\"===o){let t=Q();if("/"===t&&!0!==d.bash||"."===t||";"===t)continue;if(!t){te({type:"text",value:o+="\\"});continue}let e=/^\\+/.exec(z()),n=0;if(e&&e[0].length>2&&(n=e[0].length,j.index+=n,n%2!=0&&(o+="\\")),!0===d.unescape?o=X():o+=X(),0===j.brackets){te({type:"text",value:o});continue}}if(j.brackets>0&&("]"!==o||"["===W.value||"[^"===W.value)){if(!1!==d.posix&&":"===o){let t=W.value.slice(1);if(t.includes("[")&&(W.posix=!0,t.includes(":"))){let t=W.value.lastIndexOf("["),e=W.value.slice(0,t),o=r[W.value.slice(t+2)];if(o){W.value=e+o,j.backtrack=!0,X(),x.output||1!==A.indexOf(W)||(x.output=C);continue}}}("["===o&&":"!==Q()||"-"===o&&"]"===Q())&&(o=`\\${o}`),"]"===o&&("["===W.value||"[^"===W.value)&&(o=`\\${o}`),!0===d.posix&&"!"===o&&"["===W.value&&(o="^"),W.value+=o,Y({value:o});continue}if(1===j.quotes&&'"'!==o){o=s.escapeRegex(o),W.value+=o,Y({value:o});continue}if('"'===o){j.quotes=+(1!==j.quotes),!0===d.keepQuotes&&te({type:"text",value:o});continue}if("("===o){J("parens"),te({type:"paren",value:o});continue}if(")"===o){if(0===j.parens&&!0===d.strictBrackets)throw SyntaxError(c("opening","("));let t=G[G.length-1];if(t&&j.parens===t.parens+1){tn(G.pop());continue}te({type:"paren",value:o,output:j.parens?")":"\\)"}),tt("parens");continue}if("["===o){if(!0!==d.nobracket&&z().includes("]"))J("brackets");else{if(!0!==d.nobracket&&!0===d.strictBrackets)throw SyntaxError(c("closing","]"));o=`\\${o}`}te({type:"bracket",value:o});continue}if("]"===o){if(!0===d.nobracket||W&&"bracket"===W.type&&1===W.value.length){te({type:"text",value:o,output:`\\${o}`});continue}if(0===j.brackets){if(!0===d.strictBrackets)throw SyntaxError(c("opening","["));te({type:"text",value:o,output:`\\${o}`});continue}tt("brackets");let t=W.value.slice(1);if(!0===W.posix||"^"!==t[0]||t.includes("/")||(o=`/${o}`),W.value+=o,Y({value:o}),!1===d.literalBrackets||s.hasRegexChars(t))continue;let e=s.escapeRegex(W.value);if(j.output=j.output.slice(0,-W.value.length),!0===d.literalBrackets){j.output+=e,W.value=e;continue}W.value=`(${R}${e}|${W.value})`,j.output+=W.value;continue}if("{"===o&&!0!==d.nobrace){J("braces");let t={type:"brace",value:o,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};U.push(t),te(t);continue}if("}"===o){let t=U[U.length-1];if(!0===d.nobrace||!t){te({type:"text",value:o,output:o});continue}let e=")";if(!0===t.dots){let t=A.slice(),o=[];for(let e=t.length-1;e>=0&&(A.pop(),"brace"!==t[e].type);e--)"dots"!==t[e].type&&o.unshift(t[e].value);e=p(o,d),j.backtrack=!0}if(!0!==t.comma&&!0!==t.dots){let n=j.output.slice(0,t.outputIndex),s=j.tokens.slice(t.tokensIndex);for(let i of(t.value=t.output="\\{",o=e="\\}",j.output=n,s))j.output+=i.output||i.value}te({type:"brace",value:o,output:e}),tt("braces"),U.pop();continue}if("|"===o){G.length>0&&G[G.length-1].conditions++,te({type:"text",value:o});continue}if(","===o){let t=o,e=U[U.length-1];e&&"braces"===q[q.length-1]&&(e.comma=!0,t="|"),te({type:"comma",value:o,output:t});continue}if("/"===o){if("dot"===W.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),W=x;continue}te({type:"slash",value:o,output:S});continue}if("."===o){if(j.braces>0&&"dot"===W.type){"."===W.value&&(W.output=v);let t=U[U.length-1];W.type="dots",W.output+=o,W.value+=o,t.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==W.type&&"slash"!==W.type){te({type:"text",value:o,output:v});continue}te({type:"dot",value:o,output:v});continue}if("?"===o){if(!(W&&"("===W.value)&&!0!==d.noextglob&&"("===Q()&&"?"!==Q(2)){to("qmark",o);continue}if(W&&"paren"===W.type){let t=Q(),e=o;("("!==W.value||/[!=<:]/.test(t))&&("<"!==t||/<([!=]|\w+>)/.test(z()))||(e=`\\${o}`),te({type:"text",value:o,output:e});continue}if(!0!==d.dot&&("slash"===W.type||"bos"===W.type)){te({type:"qmark",value:o,output:P});continue}te({type:"qmark",value:o,output:T});continue}if("!"===o){if(!0!==d.noextglob&&"("===Q()&&("?"!==Q(2)||!/[!=<:]/.test(Q(3)))){to("negate",o);continue}if(!0!==d.nonegate&&0===j.index){V();continue}}if("+"===o){if(!0!==d.noextglob&&"("===Q()&&"?"!==Q(2)){to("plus",o);continue}if(W&&"("===W.value||!1===d.regex){te({type:"plus",value:o,output:k});continue}if(W&&("bracket"===W.type||"paren"===W.type||"brace"===W.type)||j.parens>0){te({type:"plus",value:o});continue}te({type:"plus",value:k});continue}if("@"===o){if(!0!==d.noextglob&&"("===Q()&&"?"!==Q(2)){te({type:"at",extglob:!0,value:o,output:""});continue}te({type:"text",value:o});continue}if("*"!==o){("$"===o||"^"===o)&&(o=`\\${o}`);let t=u.exec(z());t&&(o+=t[0],j.index+=t[0].length),te({type:"text",value:o});continue}if(W&&("globstar"===W.type||!0===W.star)){W.type="star",W.star=!0,W.value+=o,W.output=M,j.backtrack=!0,j.globstar=!0,Z(o);continue}let e=z();if(!0!==d.noextglob&&/^\([^?]/.test(e)){to("star",o);continue}if("star"===W.type){if(!0===d.noglobstar){Z(o);continue}let n=W.prev,s=n.prev,i="slash"===n.type||"bos"===n.type,r=s&&("star"===s.type||"globstar"===s.type);if(!0===d.bash&&(!i||e[0]&&"/"!==e[0])){te({type:"star",value:o,output:""});continue}let u=j.braces>0&&("comma"===n.type||"brace"===n.type),l=G.length&&("pipe"===n.type||"paren"===n.type);if(!i&&"paren"!==n.type&&!u&&!l){te({type:"star",value:o,output:""});continue}for(;"/**"===e.slice(0,3);){let o=t[j.index+4];if(o&&"/"!==o)break;e=e.slice(3),Z("/**",3)}if("bos"===n.type&&K()){W.type="globstar",W.value+=o,W.output=B(d),j.output=W.output,j.globstar=!0,Z(o);continue}if("slash"===n.type&&"bos"!==n.prev.type&&!r&&K()){j.output=j.output.slice(0,-(n.output+W.output).length),n.output=`(?:${n.output}`,W.type="globstar",W.output=B(d)+(d.strictSlashes?")":"|$)"),W.value+=o,j.globstar=!0,j.output+=n.output+W.output,Z(o);continue}if("slash"===n.type&&"bos"!==n.prev.type&&"/"===e[0]){let t=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(n.output+W.output).length),n.output=`(?:${n.output}`,W.type="globstar",W.output=`${B(d)}${S}|${S}${t})`,W.value+=o,j.output+=n.output+W.output,j.globstar=!0,Z(o+X()),te({type:"slash",value:"/",output:""});continue}if("bos"===n.type&&"/"===e[0]){W.type="globstar",W.value+=o,W.output=`(?:^|${S}|${B(d)}${S})`,j.output=W.output,j.globstar=!0,Z(o+X()),te({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-W.output.length),W.type="globstar",W.output=B(d),W.value+=o,j.output+=W.output,j.globstar=!0,Z(o);continue}let n={type:"star",value:o,output:M};if(!0===d.bash){n.output=".*?",("bos"===W.type||"slash"===W.type)&&(n.output=F+n.output),te(n);continue}if(W&&("bracket"===W.type||"paren"===W.type)&&!0===d.regex){n.output=o,te(n);continue}(j.index===j.start||"slash"===W.type||"dot"===W.type)&&("dot"===W.type?(j.output+=L,W.output+=L):!0===d.dot?(j.output+=O,W.output+=O):(j.output+=F,W.output+=F),"*"!==Q()&&(j.output+=C,W.output+=C)),te(n)}for(;j.brackets>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","]"));j.output=s.escapeLast(j.output,"["),tt("brackets")}for(;j.parens>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing",")"));j.output=s.escapeLast(j.output,"("),tt("parens")}for(;j.braces>0;){if(!0===d.strictBrackets)throw SyntaxError(c("closing","}"));j.output=s.escapeLast(j.output,"{"),tt("braces")}if(!0!==d.strictSlashes&&("star"===W.type||"bracket"===W.type)&&te({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack)for(let t of(j.output="",j.tokens))j.output+=null!=t.output?t.output:t.value,t.suffix&&(j.output+=t.suffix);return j};y.fastpaths=(t,e)=>{let o={...e},r="number"==typeof o.maxLength?Math.min(i,o.maxLength):i,u=t.length;if(u>r)throw SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${r}`);t=a[t]||t;let{DOT_LITERAL:l,SLASH_LITERAL:p,ONE_CHAR:c,DOTS_SLASH:h,NO_DOT:f,NO_DOTS:d,NO_DOTS_SLASH:g,STAR:m,START_ANCHOR:y}=n.globChars(o.windows),b=o.dot?d:f,_=o.dot?g:f,x=o.capture?"":"?:",A=!0===o.bash?".*?":m;o.capture&&(A=`(${A})`);let R=t=>!0===t.noglobstar?A:`(${x}(?:(?!${y}${t.dot?h:l}).)*?)`,$=t=>{switch(t){case"*":return`${b}${c}${A}`;case".*":return`${l}${c}${A}`;case"*.*":return`${b}${A}${l}${c}${A}`;case"*/*":return`${b}${A}${p}${c}${_}${A}`;case"**":return b+R(o);case"**/*":return`(?:${b}${R(o)}${p})?${_}${c}${A}`;case"**/*.*":return`(?:${b}${R(o)}${p})?${_}${A}${l}${c}${A}`;case"**/.*":return`(?:${b}${R(o)}${p})?${l}${c}${A}`;default:{let e=/^(.*?)\.(\w+)$/.exec(t);if(!e)return;let o=$(e[1]);if(!o)return;return o+l+e[2]}}},E=$(s.removePrefix(t,{negated:!1,prefix:""}));return E&&!0!==o.strictSlashes&&(E+=`${p}?`),E},t.exports=y},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js"),s=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js"),i=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"),r=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"),u=(t,e,o=!1)=>{if(Array.isArray(t)){let n=t.map(t=>u(t,e,o));return t=>{for(let e of n){let o=e(t);if(o)return o}return!1}}let n=t&&"object"==typeof t&&!Array.isArray(t)&&t.tokens&&t.input;if(""===t||"string"!=typeof t&&!n)throw TypeError("Expected pattern to be a non-empty string");let s=e||{},i=s.windows,r=n?u.compileRe(t,e):u.makeRe(t,e,!1,!0),l=r.state;delete r.state;let a=()=>!1;if(s.ignore){let t={...e,ignore:null,onMatch:null,onResult:null};a=u(s.ignore,t,o)}let p=(o,n=!1)=>{let{isMatch:p,match:c,output:h}=u.test(o,r,e,{glob:t,posix:i}),f={glob:t,state:l,regex:r,posix:i,input:o,output:h,match:c,isMatch:p};return("function"==typeof s.onResult&&s.onResult(f),!1===p)?(f.isMatch=!1,!!n&&f):a(o)?("function"==typeof s.onIgnore&&s.onIgnore(f),f.isMatch=!1,!!n&&f):("function"==typeof s.onMatch&&s.onMatch(f),!n||f)};return o&&(p.state=l),p};u.test=(t,e,o,{glob:n,posix:s}={})=>{if("string"!=typeof t)throw TypeError("Expected input to be a string");if(""===t)return{isMatch:!1,output:""};let r=o||{},l=r.format||(s?i.toPosixSlashes:null),a=t===n,p=a&&l?l(t):t;return!1===a&&(a=(p=l?l(t):t)===n),(!1===a||!0===r.capture)&&(a=!0===r.matchBase||!0===r.basename?u.matchBase(t,e,o,s):e.exec(p)),{isMatch:!!a,match:a,output:p}},u.matchBase=(t,e,o)=>(e instanceof RegExp?e:u.makeRe(e,o)).test(i.basename(t)),u.isMatch=(t,e,o)=>u(e,o)(t),u.parse=(t,e)=>Array.isArray(t)?t.map(t=>u.parse(t,e)):s(t,{...e,fastpaths:!1}),u.scan=(t,e)=>n(t,e),u.compileRe=(t,e,o=!1,n=!1)=>{if(!0===o)return t.output;let s=e||{},i=s.contains?"":"^",r=s.contains?"":"$",l=`${i}(?:${t.output})${r}`;t&&!0===t.negated&&(l=`^(?!${l}).*$`);let a=u.toRegex(l,e);return!0===n&&(a.state=t),a},u.makeRe=(t,e={},o=!1,n=!1)=>{if(!t||"string"!=typeof t)throw TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1!==e.fastpaths&&("."===t[0]||"*"===t[0])&&(i.output=s.fastpaths(t,e)),i.output||(i=s(t,e)),u.compileRe(i,e,o,n)},u.toRegex=(t,e)=>{try{let o=e||{};return new RegExp(t,o.flags||(o.nocase?"i":""))}catch(t){if(e&&!0===e.debug)throw t;return/$^/}},u.constants=r,t.exports=u},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js"(t,e,o){let n=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"),{CHAR_ASTERISK:s,CHAR_AT:i,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:u,CHAR_DOT:l,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:p,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:h,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:d,CHAR_QUESTION_MARK:g,CHAR_RIGHT_CURLY_BRACE:m,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:b}=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js"),_=t=>t===p||t===r,x=t=>{!0!==t.isPrefix&&(t.depth=t.isGlobstar?1/0:1)};t.exports=(t,e)=>{let o,A,R=e||{},$=t.length-1,E=!0===R.parts||!0===R.scanToEnd,v=[],k=[],S=[],C=t,w=-1,H=0,L=0,O=!1,T=!1,P=!1,D=!1,I=!1,B=!1,F=!1,N=!1,M=!1,j=!1,G=0,U={value:"",depth:0,isGlob:!1},q=()=>w>=$,W=()=>C.charCodeAt(w+1),K=()=>(o=A,C.charCodeAt(++w));for(;w<$;){let t;if((A=K())===r){F=U.backslashes=!0,(A=K())===c&&(B=!0);continue}if(!0===B||A===c){for(G++;!0!==q()&&(A=K());){if(A===r){F=U.backslashes=!0,K();continue}if(A===c){G++;continue}if(!0!==B&&A===l&&(A=K())===l||!0!==B&&A===u){if(O=U.isBrace=!0,P=U.isGlob=!0,j=!0,!0===E)continue;break}if(A===m&&0==--G){B=!1,O=U.isBrace=!0,j=!0;break}}if(!0===E)continue;break}if(A===p){if(v.push(w),k.push(U),U={value:"",depth:0,isGlob:!1},!0===j)continue;if(o===l&&w===H+1){H+=2;continue}L=w+1;continue}if(!0!==R.noext&&!0==(A===d||A===i||A===s||A===g||A===a)&&W()===h){if(P=U.isGlob=!0,D=U.isExtglob=!0,j=!0,A===a&&w===H&&(M=!0),!0===E){for(;!0!==q()&&(A=K());){if(A===r){F=U.backslashes=!0,A=K();continue}if(A===y){P=U.isGlob=!0,j=!0;break}}continue}break}if(A===s){if(o===s&&(I=U.isGlobstar=!0),P=U.isGlob=!0,j=!0,!0===E)continue;break}if(A===g){if(P=U.isGlob=!0,j=!0,!0===E)continue;break}if(A===f){for(;!0!==q()&&(t=K());){if(t===r){F=U.backslashes=!0,K();continue}if(t===b){T=U.isBracket=!0,P=U.isGlob=!0,j=!0;break}}if(!0===E)continue;break}if(!0!==R.nonegate&&A===a&&w===H){N=U.negated=!0,H++;continue}if(!0!==R.noparen&&A===h){if(P=U.isGlob=!0,!0===E){for(;!0!==q()&&(A=K());){if(A===h){F=U.backslashes=!0,A=K();continue}if(A===y){j=!0;break}}continue}break}if(!0===P){if(j=!0,!0===E)continue;break}}!0===R.noext&&(D=!1,P=!1);let Q=C,X="",z="";H>0&&(X=C.slice(0,H),C=C.slice(H),L-=H),Q&&!0===P&&L>0?(Q=C.slice(0,L),z=C.slice(L)):!0===P?(Q="",z=C):Q=C,Q&&""!==Q&&"/"!==Q&&Q!==C&&_(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===R.unescape&&(z&&(z=n.removeBackslashes(z)),Q&&!0===F&&(Q=n.removeBackslashes(Q)));let Z={prefix:X,input:t,start:H,base:Q,glob:z,isBrace:O,isBracket:T,isGlob:P,isExtglob:D,isGlobstar:I,negated:N,negatedExtglob:M};if(!0===R.tokens&&(Z.maxDepth=0,_(A)||k.push(U),Z.tokens=k),!0===R.parts||!0===R.tokens){let e;for(let o=0;o<v.length;o++){let n=e?e+1:H,s=v[o],i=t.slice(n,s);R.tokens&&(0===o&&0!==H?(k[o].isPrefix=!0,k[o].value=X):k[o].value=i,x(k[o]),Z.maxDepth+=k[o].depth),(0!==o||""!==i)&&S.push(i),e=s}if(e&&e+1<t.length){let o=t.slice(e+1);S.push(o),R.tokens&&(k[k.length-1].value=o,x(k[k.length-1]),Z.maxDepth+=k[k.length-1].depth)}Z.slashes=v,Z.parts=S}return Z}},"../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js"(t,e,o){let{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:r}=o("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js");e.isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),e.hasRegexChars=t=>i.test(t),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=t=>t.replace(r,"\\$1"),e.toPosixSlashes=t=>t.replace(n,"/"),e.isWindows=()=>{if("u">typeof navigator&&navigator.platform){let t=navigator.platform.toLowerCase();return"win32"===t||"windows"===t}return"u">typeof process&&!!process.platform&&"win32"===process.platform},e.removeBackslashes=t=>t.replace(s,t=>"\\"===t?"":t),e.escapeLast=(t,o,n)=>{let s=t.lastIndexOf(o,n);return -1===s?t:"\\"===t[s-1]?e.escapeLast(t,o,s-1):`${t.slice(0,s)}\\${t.slice(s)}`},e.removePrefix=(t,e={})=>{let o=t;return o.startsWith("./")&&(o=o.slice(2),e.prefix="./"),o},e.wrapOutput=(t,e={},o={})=>{let n=o.contains?"":"^",s=o.contains?"":"$",i=`${n}(?:${t})${s}`;return!0===e.negated&&(i=`(?:^(?!${i}).*$)`),i},e.basename=(t,{windows:e}={})=>{let o=t.split(e?/[\\/]/:"/"),n=o[o.length-1];return""===n?o[o.length-2]:n}}});var b=m("file:///home/runner/work/rsbuild/rsbuild/node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.4/node_modules/fdir/dist/index.mjs");let _=/[\\/]/g;function x(t,e){return t.replace(_,e)}let A=/^[a-z]:[\\/]$/i;function R(t,e){let o,{resolvePaths:n,normalizePath:s,pathSeparator:i}=e,r="win32"===process.platform&&t.includes("/")||t.startsWith(".");return n&&(t=f(t)),((s||r)&&((o=p(t)).length>1&&o[o.length-1]===d&&(o=o.substring(0,o.length-1)),t=o),"."===t)?"":x(t[t.length-1]!==i?t+i:t,i)}function $(t,e){return e+t}function E(t){return t}let v=(t,e)=>{e.push(t||".")},k=(t,e,o)=>{let n=t||".";o.every(t=>t(n,!0))&&e.push(n)},S=()=>{},C=(t,e,o,n)=>{n.every(e=>e(t,!1))&&o.files++},w=(t,e,o,n)=>{n.every(e=>e(t,!1))&&e.push(t)},H=(t,e,o,n)=>{o.files++},L=(t,e)=>{e.push(t)},O=()=>{},T=t=>t,P=()=>[""].slice(0,0),D=(t,e,o)=>{t.push({directory:e,files:o,dir:e})},I=()=>{},B=function(t,e,o){let{queue:n,fs:s,options:{suppressErrors:i}}=e;n.enqueue(),s.realpath(t,(r,u)=>{if(r)return n.dequeue(i?null:r,e);s.stat(u,(s,r)=>s?n.dequeue(i?null:s,e):r.isDirectory()&&N(t,u,e)?n.dequeue(null,e):void(o(r,u),n.dequeue(null,e)))})},F=function(t,e,o){let{queue:n,fs:s,options:{suppressErrors:i}}=e;n.enqueue();try{let n=s.realpathSync(t),i=s.statSync(n);if(i.isDirectory()&&N(t,n,e))return;o(i,n)}catch(t){if(!i)throw t}};function N(t,e,o){if(o.options.useRealPaths){var n,s;return n=e,(s=o).visited.includes(n+s.options.pathSeparator)}let i=l(t),r=1;for(;i!==o.root&&r<2;){let t=o.symlinks.get(i);t&&(t===e||t.startsWith(e)||e.startsWith(t))?r++:i=l(i)}return o.symlinks.set(t,e),r>1}let M=t=>t.counts,j=t=>t.groups,G=t=>t.paths,U=t=>t.paths.slice(0,t.options.maxFiles),q=(t,e,o)=>(X(e,o,t.counts,t.options.suppressErrors),null),W=(t,e,o)=>(X(e,o,t.paths,t.options.suppressErrors),null),K=(t,e,o)=>(X(e,o,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Q=(t,e,o)=>(X(e,o,t.groups,t.options.suppressErrors),null);function X(t,e,o,n){e(t&&!n?t:null,o)}let z={withFileTypes:!0},Z=(t,e,o,n,s)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",z,(e,i=[])=>{s(i,o,n),t.queue.dequeue(t.options.suppressErrors?null:e,t)})},Y=(t,e,o,n,s)=>{let{fs:i}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let r=[];try{r=i.readdirSync(e||".",z)}catch(e){if(!t.options.suppressErrors)throw e}s(r,o,n)};var V=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},J=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},tt=class{aborted=!1;abort(){this.aborted=!0}},te=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,o,n){var s,i;this.isSynchronous=!n,this.callbackInvoker=function(t,e){let{onlyCounts:o,group:n,maxFiles:s}=t;return o?e?M:q:n?e?j:Q:s?e?U:K:e?G:W}(o,this.isSynchronous),this.root=R(e,o),this.state={root:"/"===(s=this.root)||A.test(s)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new J,options:o,queue:new V((t,e)=>this.callbackInvoker(e,t,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new tt,fs:o.fs||t},this.joinPath=function(t,e){let{relativePaths:o,includeBasePath:n}=e;return o&&t?function(o,n){return n.startsWith(t)?n.slice(t.length)+o:x(h(t,n),e.pathSeparator)+e.pathSeparator+o}:n?$:E}(this.root,o),this.pushDirectory=function(t,e){let{includeDirs:o,filters:n,relativePaths:s}=e;if(!o)return S;if(s)return n&&n.length?function(e,o,n){let s=e.substring(t.length)||".";n.every(t=>t(s,!0))&&o.push(s)}:function(e,o){o.push(e.substring(t.length)||".")};return n&&n.length?k:v}(this.root,o),this.pushFile=function(t){let{excludeFiles:e,filters:o,onlyCounts:n}=t;return e?O:o&&o.length?n?C:w:n?H:L}(o),this.getArray=o.group?P:T,this.groupFiles=o.group?D:I,this.resolveSymlink=(i=this.isSynchronous,!o.resolveSymlinks||o.excludeSymlinks?null:i?F:B),this.walkDirectory=this.isSynchronous?Y:Z}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,o)=>{let{paths:n,options:{filters:s,resolveSymlinks:i,excludeSymlinks:r,exclude:a,maxFiles:p,signal:c,useRealPaths:h,pathSeparator:f},controller:d}=this.state;if(d.aborted||c&&c.aborted||p&&n.length>p)return;let g=this.getArray(this.state.paths);for(let p=0;p<t.length;++p){let c=t[p];if(c.isFile()||c.isSymbolicLink()&&!i&&!r){let t=this.joinPath(c.name,e);this.pushFile(t,g,this.state.counts,s)}else if(c.isDirectory()){let t=e+c.name+this.state.options.pathSeparator;if(a&&a(c.name,t))continue;this.pushDirectory(t,n,s),this.walkDirectory(this.state,t,t,o-1,this.walk)}else if(this.resolveSymlink&&c.isSymbolicLink()){let t=e+c.name;this.resolveSymlink(t,this.state,(e,n)=>{if(e.isDirectory())n=R(n,this.state.options),a&&a(c.name,h?n:t+f)||this.walkDirectory(this.state,n,h?n:t+f,o-1,this.walk);else{let e=u(n=h?n:t),o=R(l(n),this.state.options);n=this.joinPath(e,o),this.pushFile(n,g,this.state.counts,s)}})}}this.groupFiles(this.state.groups,e,g)}};function to(t,e,o){new te(t,e,o).start()}var tn=class{constructor(t,e){this.root=t,this.options=e}withPromise(){var t,e;return t=this.root,e=this.options,new Promise((o,n)=>{to(t,e,(t,e)=>{if(t)return n(t);o(e)})})}withCallback(t){to(this.root,this.options,t)}sync(){return new te(this.root,this.options).start()}};let ts=null;try{b.resolve("picomatch"),ts=y("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js")}catch{}var ti=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:d,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new tn(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new tn(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let o=this.globFunction||ts;if(!o)throw Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=o(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(t=>n(t)),this}};let tr=y("../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/index.js"),tu=Array.isArray,tl=/\\/g,ta=/^[A-Za-z]:$/,tp="win32"===process.platform,tc=/^(\/?\.\.)+$/,th=/^[A-Z]:\/$/i,tf=tp?t=>th.test(t):t=>"/"===t;function td(t,e,o){if(t===e||e.startsWith(`${t}/`)){if(o){let e=t.length+ +!tf(t);return(t,o)=>t.slice(e,o?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(t,e)=>{if("."===t)return n;let o=`${n}/${t}`;return e?o.slice(0,-1):o}:(t,e)=>e&&"."!==t?t.slice(0,-1):t}return o?e=>c.relative(t,e)||".":o=>c.relative(t,`${e}/${o}`)||"."}function tg(t){return t.replace(ta,t=>`${t}/`)}let tm={parts:!0};function ty(t){var e;let o=tr.scan(t,tm);return(null==(e=o.parts)?void 0:e.length)?o.parts:[t]}let tb=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,t_=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,tx=tp?t=>t.replace(t_,"\\$&"):t=>t.replace(tb,"\\$&");function tA(...t){console.log(`[tinyglobby ${(new Date).toLocaleTimeString("es")}]`,...t)}function tR(t){return"string"==typeof t?[t]:null!=t?t:[]}let t$=/^(\/?\.\.)+/,tE=/\\(?=[()[\]{}!*+?@|])/g;function tv(t,e,o,n){var s;let i=e.cwd,r=t;"/"===t[t.length-1]&&(r=t.slice(0,-1)),"*"!==r[r.length-1]&&e.expandDirectories&&(r+="/**");let u=tx(i);r=a(r.replace(tE,""))?c.relative(u,r):c.normalize(r);let l=null==(s=t$.exec(r))?void 0:s[0],p=ty(r);if(l){let t=(l.length+1)/3,e=0,n=u.split("/");for(;e<t&&p[e+t]===n[n.length+e-t];)r=r.slice(0,(t-e-1)*3)+r.slice((t-e)*3+p[e+t].length+1)||".",e++;let s=c.join(i,l.slice(3*e));"."!==s[0]&&o.root.length>s.length&&(o.root=tg(s),o.depthOffset=-t+e)}if(!n&&o.depthOffset>=0){null!=o.commonPath||(o.commonPath=p);let t=[],e=Math.min(o.commonPath.length,p.length);for(let n=0;n<e;n++){let e=p[n];if("**"===e&&!p[n+1]){t.pop();break}if(n===p.length-1||e!==o.commonPath[n]||function(t){let e=tr.scan(t);return e.isGlob||e.negated}(e))break;t.push(e)}o.depthOffset=t.length,o.commonPath=t,o.root=tg(t.length>0?c.join(i,...t):i)}return r}function tk(t,e){if(e)for(let o=t.length-1;o>=0;o--)t[o]=e(t[o]);return t}let tS={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function tC(t,u={}){var l;if(t&&(null==u?void 0:u.patterns))throw Error("Cannot pass patterns as both an argument and an option");let a=tu(t)||"string"==typeof t,p=tR(null!=(l=a?t:t.patterns)?l:"**/*"),h=function(t){let u=Object.assign({},t);for(let t in tS)void 0===u[t]&&Object.assign(u,{[t]:tS[t]});return u.cwd=(u.cwd instanceof URL?g(u.cwd):f(u.cwd||process.cwd())).replace(tl,"/"),u.ignore=tR(u.ignore),u.fs&&(u.fs={readdir:u.fs.readdir||e,readdirSync:u.fs.readdirSync||o,realpath:u.fs.realpath||n,realpathSync:u.fs.realpathSync||s,stat:u.fs.stat||i,statSync:u.fs.statSync||r}),u.debug&&tA("globbing with options:",u),u}(a?u:t);return p.length>0?function(t,e){let o,n=t.cwd,s={root:n,depthOffset:0},i=function(t,e,o){let n=[],s=[];for(let e of t.ignore)e&&("!"!==e[0]||"("===e[1])&&s.push(tv(e,t,o,!0));for(let i of e)i&&("!"!==i[0]||"("===i[1]?n.push(tv(i,t,o,!1)):("!"!==i[1]||"("===i[2])&&s.push(tv(i.slice(1),t,o,!0)));return{match:n,ignore:s}}(t,e,s);t.debug&&tA("internal processing patterns:",i);let{absolute:r,caseSensitiveMatch:u,debug:l,dot:a,followSymbolicLinks:p,onlyDirectories:h}=t,f=s.root.replace(tl,""),d={dot:a,nobrace:!1===t.braceExpansion,nocase:!u,noextglob:!1===t.extglob,noglobstar:!1===t.globstar,posix:!0},g=tr(i.match,d),m=tr(i.ignore,d),y=function(t,e={}){let o,n,s=t.length,i=Array(s),r=Array(s);for(o=0;o<s;o++){let s=ty(t[o]);i[o]=s;let u=s.length,l=Array(u);for(n=0;n<u;n++)l[n]=tr(s[n],e);r[o]=l}return t=>{let u=t.split("/");if(".."===u[0]&&tc.test(t))return!0;for(o=0;o<s;o++){let t=i[o],s=r[o],l=u.length,a=Math.min(l,t.length);for(n=0;n<a;){let o=t[n];if(o.includes("/"))return!0;if(!s[n](u[n]))break;if(!e.noglobstar&&"**"===o)return!0;n++}if(n===l)return!0}return!1}}(i.match,d),b=td(n,f,r),_=r?b:td(n,f,!0),x=(t,e)=>{let o=_(e,!0);return"."!==o&&!y(o)||m(o)};void 0!==t.deep&&(o=Math.round(t.deep-s.depthOffset));let A=new ti({filters:[l?(t,e)=>{let o=b(t,e),n=g(o)&&!m(o);return n&&tA(`matched ${o}`),n}:(t,e)=>{let o=b(t,e);return g(o)&&!m(o)}],exclude:l?(t,e)=>{let o=x(t,e);return tA(`${o?"skipped":"crawling"} ${e}`),o}:x,fs:t.fs,pathSeparator:"/",relativePaths:!r,resolvePaths:r,includeBasePath:r,resolveSymlinks:p,excludeSymlinks:!p,excludeFiles:h,includeDirs:h||!t.onlyFiles,maxDepth:o,signal:t.signal}).crawl(f);return t.debug&&tA("internal properties:",{...s,root:f}),[A,n!==f&&!r&&function(t,e){if(e.startsWith(`${t}/`)){let o=e.slice(t.length+1);return t=>`${o}/${t}`}return o=>{let n=c.relative(t,`${e}/${o}`);return"/"===o[o.length-1]&&""!==n?`${n}/`:n||"."}}(n,f)]}(h,p):[]}async function tw(t,e){let[o,n]=tC(t,e);return o?tk(await o.withPromise(),n):[]}function tH(t,e){let[o,n]=tC(t,e);return o?tk(o.sync(),n):[]}export{tw as glob,tH as globSync};
|
package/dist/ws.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__webpack_require__ as e}from"./rslib-runtime.js";import"./626.js";e.add({"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"(e,t,s){let{EMPTY_BUFFER:r}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),i=Buffer[Symbol.species];function o(e){let t;return(o.readOnly=!0,Buffer.isBuffer(e))?e:(e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),o.readOnly=!1),t)}e.exports={concat:function(e,t){if(0===e.length)return r;if(1===e.length)return e[0];let s=Buffer.allocUnsafe(t),o=0;for(let t=0;t<e.length;t++){let r=e[t];s.set(r,o),o+=r.length}return o<t?new i(s.buffer,s.byteOffset,o):s},mask:function(e,t,s,r,i){for(let o=0;o<i;o++)s[r+o]=e[o]^t[3&o]},toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:o,unmask:function(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"(e){let t=["nodebuffer","arraybuffer","fragments"],s="u">typeof Blob;s&&t.push("blob"),e.exports={BINARY_TYPES:t,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/event-target.js"(e,t,s){let{kForOnEventAttribute:r,kListener:i}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),o=Symbol("kCode"),n=Symbol("kData"),a=Symbol("kError"),l=Symbol("kMessage"),h=Symbol("kReason"),d=Symbol("kTarget"),c=Symbol("kType"),_=Symbol("kWasClean");class u{constructor(e){this[d]=null,this[c]=e}get target(){return this[d]}get type(){return this[c]}}Object.defineProperty(u.prototype,"target",{enumerable:!0}),Object.defineProperty(u.prototype,"type",{enumerable:!0});class f extends u{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[h]=void 0===t.reason?"":t.reason,this[_]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[h]}get wasClean(){return this[_]}}Object.defineProperty(f.prototype,"code",{enumerable:!0}),Object.defineProperty(f.prototype,"reason",{enumerable:!0}),Object.defineProperty(f.prototype,"wasClean",{enumerable:!0});class m extends u{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[l]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[l]}}Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});class p extends u{constructor(e,t={}){super(e),this[n]=void 0===t.data?null:t.data}get data(){return this[n]}}function b(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}Object.defineProperty(p.prototype,"data",{enumerable:!0}),e.exports={CloseEvent:f,ErrorEvent:m,Event:u,EventTarget:{addEventListener(e,t,s={}){let o;for(let o of this.listeners(e))if(!s[r]&&o[i]===t&&!o[r])return;if("message"===e)o=function(e,s){let r=new p("message",{data:s?e:e.toString()});r[d]=this,b(t,this,r)};else if("close"===e)o=function(e,s){let r=new f("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[d]=this,b(t,this,r)};else if("error"===e)o=function(e){let s=new m("error",{error:e,message:e.message});s[d]=this,b(t,this,s)};else{if("open"!==e)return;o=function(){let e=new u("open");e[d]=this,b(t,this,e)}}o[r]=!!s[r],o[i]=t,s.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let s of this.listeners(e))if(s[i]===t&&!s[r]){this.removeListener(e,s);break}}},MessageEvent:p}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"(e,t,s){let{tokenChars:r}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js");function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}e.exports={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){let t,s,o=Object.create(null),n=Object.create(null),a=!1,l=!1,h=!1,d=-1,c=-1,_=-1,u=0;for(;u<e.length;u++)if(c=e.charCodeAt(u),void 0===t)if(-1===_&&1===r[c])-1===d&&(d=u);else if(0!==u&&(32===c||9===c))-1===_&&-1!==d&&(_=u);else if(59===c||44===c){if(-1===d)throw SyntaxError(`Unexpected character at index ${u}`);-1===_&&(_=u);let s=e.slice(d,_);44===c?(i(o,s,n),n=Object.create(null)):t=s,d=_=-1}else throw SyntaxError(`Unexpected character at index ${u}`);else if(void 0===s)if(-1===_&&1===r[c])-1===d&&(d=u);else if(32===c||9===c)-1===_&&-1!==d&&(_=u);else if(59===c||44===c){if(-1===d)throw SyntaxError(`Unexpected character at index ${u}`);-1===_&&(_=u),i(n,e.slice(d,_),!0),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),d=_=-1}else if(61===c&&-1!==d&&-1===_)s=e.slice(d,u),d=_=-1;else throw SyntaxError(`Unexpected character at index ${u}`);else if(l){if(1!==r[c])throw SyntaxError(`Unexpected character at index ${u}`);-1===d?d=u:a||(a=!0),l=!1}else if(h)if(1===r[c])-1===d&&(d=u);else if(34===c&&-1!==d)h=!1,_=u;else if(92===c)l=!0;else throw SyntaxError(`Unexpected character at index ${u}`);else if(34===c&&61===e.charCodeAt(u-1))h=!0;else if(-1===_&&1===r[c])-1===d&&(d=u);else if(-1!==d&&(32===c||9===c))-1===_&&(_=u);else if(59===c||44===c){if(-1===d)throw SyntaxError(`Unexpected character at index ${u}`);-1===_&&(_=u);let r=e.slice(d,_);a&&(r=r.replace(/\\/g,""),a=!1),i(n,s,r),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),s=void 0,d=_=-1}else throw SyntaxError(`Unexpected character at index ${u}`);if(-1===d||h||32===c||9===c)throw SyntaxError("Unexpected end of input");-1===_&&(_=u);let f=e.slice(d,_);return void 0===t?i(o,f,n):(void 0===s?i(n,f,!0):a?i(n,s,f.replace(/\\/g,"")):i(n,s,f),i(o,t,n)),o}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/limiter.js"(e){let t=Symbol("kDone"),s=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[s]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[s]()}[s](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[t])}}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"(e,t,s){let r,i=s("zlib"),o=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"),n=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/limiter.js"),{kStatusCode:a}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),l=Buffer[Symbol.species],h=Buffer.from([0,0,255,255]),d=Symbol("permessage-deflate"),c=Symbol("total-length"),_=Symbol("callback"),u=Symbol("buffers"),f=Symbol("error");function m(e){this[u].push(e),this[c]+=e.length}function p(e){(this[c]+=e.length,this[d]._maxPayload<1||this[c]<=this[d]._maxPayload)?this[u].push(e):(this[f]=RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][a]=1009,this.removeListener("data",p),this.reset())}function b(e){(this[d]._inflate=null,this[f])?this[_](this[f]):(e[a]=1007,this[_](e))}e.exports=class{constructor(e){this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,r||(r=new n(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[_];this._deflate.close(),this._deflate=null,e&&e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,s=e.find(e=>(!1!==t.serverNoContextTakeover||!e.server_no_context_takeover)&&(!e.server_max_window_bits||!1!==t.serverMaxWindowBits&&("number"!=typeof t.serverMaxWindowBits||!(t.serverMaxWindowBits>e.server_max_window_bits)))&&("number"!=typeof t.clientMaxWindowBits||!!e.client_max_window_bits));if(!s)throw Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:(!0===s.client_max_window_bits||!1===t.clientMaxWindowBits)&&delete s.client_max_window_bits,s}acceptAsClient(e){let t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let s=e[t];if(s.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if("client_no_context_takeover"===t||"server_no_context_takeover"===t){if(!0!==s)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=s})}),e}decompress(e,t,s){r.add(r=>{this._decompress(e,t,(e,t)=>{r(),s(e,t)})})}compress(e,t,s){r.add(r=>{this._compress(e,t,(e,t)=>{r(),s(e,t)})})}_decompress(e,t,s){let r=this._isServer?"client":"server";if(!this._inflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=i.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[d]=this,this._inflate[c]=0,this._inflate[u]=[],this._inflate.on("error",b),this._inflate.on("data",p)}this._inflate[_]=s,this._inflate.write(e),t&&this._inflate.write(h),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,s(e);return}let i=o.concat(this._inflate[u],this._inflate[c]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[c]=0,this._inflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),s(null,i)})}_compress(e,t,s){let r=this._isServer?"server":"client";if(!this._deflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=i.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[c]=0,this._deflate[u]=[],this._deflate.on("data",m)}this._deflate[_]=s,this._deflate.write(e),this._deflate.flush(i.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=o.concat(this._deflate[u],this._deflate[c]);t&&(e=new l(e.buffer,e.byteOffset,e.length-4)),this._deflate[_]=null,this._deflate[c]=0,this._deflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),s(null,e)})}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js"(e,t,s){let{Writable:r}=s("stream"),i=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:l}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),{concat:h,toArrayBuffer:d,unmask:c}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"),{isValidStatusCode:_,isValidUTF8:u}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"),f=Buffer[Symbol.species];e.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=0|e.maxBufferedChunks,this._maxFragments=0|e.maxFragments,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[l]=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._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,s){return 8===this._opcode&&0==this._state?s():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void s(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new f(t.buffer,t.byteOffset+e,t.length-e),new f(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let s=this._buffers[0],r=t.length-e;e>=s.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),r),this._buffers[0]=new f(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((48&t[0])!=0)return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let s=(64&t[0])==64;if(s&&!this._extensions[i.extensionName])return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&t[0])==128,this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=s}else{if(!(this._opcode>7)||!(this._opcode<11))return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&t[1])==128,this._isServer){if(!this._masked)return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),s=t.readUInt32BE(0);s>2097151?e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*s+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&c(t,this._mask)}if(this._opcode>7)return void this.controlMessage(t,e);if(this._maxFragments>0&&++this._numFragments>this._maxFragments)return void e(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void t(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(s)}this.dataMessage(t),0===this._state&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?h(s,t):"arraybuffer"===this._binaryType?d(h(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)}))}else{let r=h(s,t);if(!this._skipUTF8Validation&&!u(r))return void e(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(8===this._opcode){if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{let s=e.readUInt16BE(0);if(!_(s))return void t(this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let r=new f(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!u(r))return void t(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)}))}createError(e,t,s,r,i){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[a]=r,o}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js"(e,t,s){let r,{Duplex:i}=s("stream"),{randomFillSync:o}=s("crypto"),{types:{isUint8Array:n}}=s("util"),a=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"),{EMPTY_BUFFER:l,kWebSocket:h,NOOP:d}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),{isBlob:c,isValidStatusCode:_}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"),{mask:u,toBuffer:f}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"),m=Symbol("kByteLength"),p=Buffer.alloc(4),b=8192;function y(e,t,s){"function"==typeof s&&s(t);for(let s=0;s<e._queue.length;s++){let r=e._queue[s],i=r[r.length-1];"function"==typeof i&&i(t)}}function g(e,t,s){y(e,t,s),e.onerror(t)}e.exports=class e{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=d,this[h]=void 0}static frame(e,t){let s,i,n=!1,a=2,l=!1;t.mask&&(s=t.maskBuffer||p,t.generateMask?t.generateMask(s):(8192===b&&(void 0===r&&(r=Buffer.alloc(8192)),o(r,0,8192),b=0),s[0]=r[b++],s[1]=r[b++],s[2]=r[b++],s[3]=r[b++]),l=(s[0]|s[1]|s[2]|s[3])==0,a=6),"string"==typeof e?i=(!t.mask||l)&&void 0!==t[m]?t[m]:(e=Buffer.from(e)).length:(i=e.length,n=t.mask&&t.readOnly&&!l);let h=i;i>=65536?(a+=8,h=127):i>125&&(a+=2,h=126);let d=Buffer.allocUnsafe(n?i+a:a);return(d[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(d[0]|=64),d[1]=h,126===h?d.writeUInt16BE(i,2):127===h&&(d[2]=d[3]=0,d.writeUIntBE(i,4,6)),t.mask)?(d[1]|=128,d[a-4]=s[0],d[a-3]=s[1],d[a-2]=s[2],d[a-1]=s[3],l)?[d,e]:n?(u(e,s,d,a,i),[d]):(u(e,s,e,0,i),[d,e]):[d,e]}close(t,s,r,i){let o;if(void 0===t)o=l;else if("number"==typeof t&&_(t))if(void 0!==s&&s.length){let e=Buffer.byteLength(s);if(e>123)throw RangeError("The message must not be greater than 123 bytes");if((o=Buffer.allocUnsafe(2+e)).writeUInt16BE(t,0),"string"==typeof s)o.write(s,2);else if(n(s))o.set(s,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(o=Buffer.allocUnsafe(2)).writeUInt16BE(t,0);else throw TypeError("First argument must be a valid error code number");let a={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,o,!1,a,i]):this.sendFrame(e.frame(o,a),i)}ping(t,s,r){let i,o;if("string"==typeof t?(i=Buffer.byteLength(t),o=!1):c(t)?(i=t.size,o=!1):(i=(t=f(t)).length,o=f.readOnly),i>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[m]:i,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};c(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,r]):this.getBlobData(t,!1,n,r):0!==this._state?this.enqueue([this.dispatch,t,!1,n,r]):this.sendFrame(e.frame(t,n),r)}pong(t,s,r){let i,o;if("string"==typeof t?(i=Buffer.byteLength(t),o=!1):c(t)?(i=t.size,o=!1):(i=(t=f(t)).length,o=f.readOnly),i>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[m]:i,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};c(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,r]):this.getBlobData(t,!1,n,r):0!==this._state?this.enqueue([this.dispatch,t,!1,n,r]):this.sendFrame(e.frame(t,n),r)}send(e,t,s){let r,i,o=this._extensions[a.extensionName],n=t.binary?2:1,l=t.compress;"string"==typeof e?(r=Buffer.byteLength(e),i=!1):c(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),this._firstFragment?(this._firstFragment=!1,l&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=r>=o._threshold),this._compress=l):(l=!1,n=0),t.fin&&(this._firstFragment=!0);let h={[m]:r,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:i,rsv1:l};c(e)?0!==this._state?this.enqueue([this.getBlobData,e,this._compress,h,s]):this.getBlobData(e,this._compress,h,s):0!==this._state?this.enqueue([this.dispatch,e,this._compress,h,s]):this.dispatch(e,this._compress,h,s)}getBlobData(t,s,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error("The socket was closed while the blob was being read");process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let o=f(t);s?this.dispatch(o,s,r,i):(this._state=0,this.sendFrame(e.frame(o,r),i),this.dequeue())}).catch(e=>{process.nextTick(g,this,e,i)})}dispatch(t,s,r,i){if(!s)return void this.sendFrame(e.frame(t,r),i);let o=this._extensions[a.extensionName];this._bufferedBytes+=r[m],this._state=1,o.compress(t,r.fin,(t,s)=>{this._socket.destroyed?y(this,Error("The socket was closed while data was being compressed"),i):(this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(s,r),i),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/stream.js"(e,t,s){s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js");let{Duplex:r}=s("stream");function i(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let s=!0,a=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(t,s){let r=!s&&a._readableState.objectMode?t.toString():t;a.push(r)||e.pause()}),e.once("error",function(e){a.destroyed||(s=!1,a.destroy(e))}),e.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,a);return}let o=!1;e.once("error",function(e){o=!0,r(e)}),e.once("close",function(){o||r(t),process.nextTick(i,a)}),s&&e.terminate()},a._final=function(t){e.readyState===e.CONNECTING?e.once("open",function(){a._final(t)}):null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",function(){t()}),e.close()))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,r){e.readyState===e.CONNECTING?e.once("open",function(){a._write(t,s,r)}):e.send(t,r)},a.on("end",o),a.on("error",n),a}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js"(e,t,s){let{tokenChars:r}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js");e.exports={parse:function(e){let t=new Set,s=-1,i=-1,o=0;for(;o<e.length;o++){let n=e.charCodeAt(o);if(-1===i&&1===r[n])-1===s&&(s=o);else if(0!==o&&(32===n||9===n))-1===i&&-1!==s&&(i=o);else if(44===n){if(-1===s)throw SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);let r=e.slice(s,i);if(t.has(r))throw SyntaxError(`The "${r}" subprotocol is duplicated`);t.add(r),s=i=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(-1===s||-1!==i)throw SyntaxError("Unexpected end of input");let n=e.slice(s,o);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"(e,t,s){let{isUtf8:r}=s("buffer"),{hasBlob:i}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js");function o(e){let t=e.length,s=0;for(;s<t;)if((128&e[s])==0)s++;else if((224&e[s])==192){if(s+1===t||(192&e[s+1])!=128||(254&e[s])==192)return!1;s+=2}else if((240&e[s])==224){if(s+2>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||224===e[s]&&(224&e[s+1])==128||237===e[s]&&(224&e[s+1])==160)return!1;s+=3}else{if((248&e[s])!=240||s+3>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||(192&e[s+3])!=128||240===e[s]&&(240&e[s+1])==128||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}e.exports={isBlob:function(e){return i&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:o,tokenChars:[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]},r&&(e.exports.isValidUTF8=function(e){return e.length<24?o(e):r(e)})},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket-server.js"(e,t,s){let r=s("events"),i=s("http"),{Duplex:o}=s("stream"),{createHash:n}=s("crypto"),a=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"),l=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"),h=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js"),d=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js"),{CLOSE_TIMEOUT:c,GUID:_,kWebSocket:u}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),f=/^[+/0-9A-Za-z]{22}==$/;function m(e){e._state=2,e.emit("close")}function p(){this.destroy()}function b(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r
|
|
2
|
-
`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join("\r\n")+"\r\n\r\n"+s)}function y(e,t,s,r,i,o){if(e.listenerCount("wsClientError")){let r=Error(i);Error.captureStackTrace(r,y),e.emit("wsClientError",r,s,t)}else b(s,r,i,o)}e.exports=class extends r{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:c,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer((e,t)=>{let s=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(let s of Object.keys(t))e.on(s,t[s]);return function(){for(let s of Object.keys(t))e.removeListener(s,t[s])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state){e&&this.once("close",()=>{e(Error("The server is not running"))}),process.nextTick(m,this);return}if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(m,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{m(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,r){t.on("error",p);let i=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method)return void y(this,e,t,405,"Invalid HTTP method");if(void 0===o||"websocket"!==o.toLowerCase())return void y(this,e,t,400,"Invalid Upgrade header");if(void 0===i||!f.test(i))return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==n&&8!==n)return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(e))return void b(t,400);let d=e.headers["sec-websocket-protocol"],c=new Set;if(void 0!==d)try{c=h.parse(d)}catch(s){y(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let _=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&void 0!==_){let s=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=a.parse(_);e[l.extensionName]&&(s.accept(e[l.extensionName]),u[l.extensionName]=s)}catch(s){y(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let o={origin:e.headers[`${8===n?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,l)=>{if(!o)return b(t,n||401,a,l);this.completeUpgrade(u,i,c,e,t,s,r)});if(!this.options.verifyClient(o))return b(t,401)}this.completeUpgrade(u,i,c,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,h){if(!i.readable||!i.writable)return i.destroy();if(i[u])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return b(i,503);let d=n("sha1").update(t+_).digest("base64"),c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${d}`],f=new this.options.WebSocket(null,void 0,this.options);if(s.size){let e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(c.push(`Sec-WebSocket-Protocol: ${e}`),f._protocol=e)}if(e[l.extensionName]){let t=e[l.extensionName].params,s=a.format({[l.extensionName]:[t]});c.push(`Sec-WebSocket-Extensions: ${s}`),f._extensions=e}this.emit("headers",c,r),i.write(c.concat("\r\n").join("\r\n")),i.removeListener("error",p),f.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&!this.clients.size&&process.nextTick(m,this)})),h(f,r)}}},"../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js"(e,t,s){let r=s("events"),i=s("https"),o=s("http"),n=s("net"),a=s("tls"),{randomBytes:l,createHash:h}=s("crypto"),{Duplex:d,Readable:c}=s("stream"),{URL:_}=s("url?5f07"),u=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"),f=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js"),m=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js"),{isBlob:p}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/validation.js"),{BINARY_TYPES:b,CLOSE_TIMEOUT:y,EMPTY_BUFFER:g,GUID:v,kForOnEventAttribute:w,kListener:S,kStatusCode:E,kWebSocket:x,NOOP:k}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/constants.js"),{EventTarget:{addEventListener:T,removeEventListener:C}}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/event-target.js"),{format:O,parse:N}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"),{toBuffer:L}=s("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/buffer-util.js"),P=Symbol("kAborted"),B=[8,13],R=["CONNECTING","OPEN","CLOSING","CLOSED"],j=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class U extends r{constructor(e,t,s){super(),this._binaryType=b[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=g,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=U.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),function e(t,s,r,n){let a,d,c,f,m={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:y,protocolVersion:B[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=m.autoPong,t._closeTimeout=m.closeTimeout,!B.includes(m.protocolVersion))throw RangeError(`Unsupported protocol version: ${m.protocolVersion} (supported versions: ${B.join(", ")})`);if(s instanceof _)a=s;else try{a=new _(s)}catch{throw SyntaxError(`Invalid URL: ${s}`)}"http:"===a.protocol?a.protocol="ws:":"https:"===a.protocol&&(a.protocol="wss:"),t._url=a.href;let p="wss:"===a.protocol,b="ws+unix:"===a.protocol;if("ws:"===a.protocol||p||b?b&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"):d='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',d){let e=SyntaxError(d);if(0!==t._redirects)return void I(t,e);throw e}let g=p?443:80,w=l(16).toString("base64"),S=p?i.request:o.request,E=new Set;if(m.createConnection=m.createConnection||(p?M:D),m.defaultPort=m.defaultPort||g,m.port=a.port||g,m.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,m.headers={...m.headers,"Sec-WebSocket-Version":m.protocolVersion,"Sec-WebSocket-Key":w,Connection:"Upgrade",Upgrade:"websocket"},m.path=a.pathname+a.search,m.timeout=m.handshakeTimeout,m.perMessageDeflate&&(c=new u({...m.perMessageDeflate,isServer:!1,maxPayload:m.maxPayload}),m.headers["Sec-WebSocket-Extensions"]=O({[u.extensionName]:c.offer()})),r.length){for(let e of r){if("string"!=typeof e||!j.test(e)||E.has(e))throw SyntaxError("An invalid or duplicated subprotocol was specified");E.add(e)}m.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(m.origin&&(m.protocolVersion<13?m.headers["Sec-WebSocket-Origin"]=m.origin:m.headers.Origin=m.origin),(a.username||a.password)&&(m.auth=`${a.username}:${a.password}`),b){let e=m.path.split(":");m.socketPath=e[0],m.path=e[1]}if(m.followRedirects){if(0===t._redirects){t._originalIpc=b,t._originalSecure=p,t._originalHostOrSocketPath=b?m.socketPath:a.host;let e=n&&n.headers;if(n={...n,headers:{}},e)for(let[t,s]of Object.entries(e))n.headers[t.toLowerCase()]=s}else if(0===t.listenerCount("redirect")){let e=b?!!t._originalIpc&&m.socketPath===t._originalHostOrSocketPath:!t._originalIpc&&a.host===t._originalHostOrSocketPath;e&&(!t._originalSecure||p)||(delete m.headers.authorization,delete m.headers.cookie,e||delete m.headers.host,m.auth=void 0)}m.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(m.auth).toString("base64")),f=t._req=S(m),t._redirects&&t.emit("redirect",t.url,f)}else f=t._req=S(m);m.timeout&&f.on("timeout",()=>{W(t,f,"Opening handshake has timed out")}),f.on("error",e=>{null===f||f[P]||(f=t._req=null,I(t,e))}),f.on("response",i=>{let o=i.headers.location,a=i.statusCode;if(o&&m.followRedirects&&a>=300&&a<400){let i;if(++t._redirects>m.maxRedirects)return void W(t,f,"Maximum redirects exceeded");f.abort();try{i=new _(o,s)}catch(e){I(t,SyntaxError(`Invalid URL: ${o}`));return}e(t,i,r,n)}else t.emit("unexpected-response",f,i)||W(t,f,`Unexpected server response: ${i.statusCode}`)}),f.on("upgrade",(e,s,r)=>{let i;if(t.emit("upgrade",e),t.readyState!==U.CONNECTING)return;f=t._req=null;let o=e.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void W(t,s,"Invalid Upgrade header");let n=h("sha1").update(w+v).digest("base64");if(e.headers["sec-websocket-accept"]!==n)return void W(t,s,"Invalid Sec-WebSocket-Accept header");let a=e.headers["sec-websocket-protocol"];if(void 0!==a?E.size?E.has(a)||(i="Server sent an invalid subprotocol"):i="Server sent a subprotocol but none was requested":E.size&&(i="Server sent no subprotocol"),i)return void W(t,s,i);a&&(t._protocol=a);let l=e.headers["sec-websocket-extensions"];if(void 0!==l){let e;if(!c)return void W(t,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{e=N(l)}catch(e){W(t,s,"Invalid Sec-WebSocket-Extensions header");return}let r=Object.keys(e);if(1!==r.length||r[0]!==u.extensionName)return void W(t,s,"Server indicated an extension that was not requested");try{c.accept(e[u.extensionName])}catch(e){W(t,s,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[u.extensionName]=c}t.setSocket(s,r,{allowSynchronousEvents:m.allowSynchronousEvents,generateMask:m.generateMask,maxBufferedChunks:m.maxBufferedChunks,maxFragments:m.maxFragments,maxPayload:m.maxPayload,skipUTF8Validation:m.skipUTF8Validation})}),m.finishRequest?m.finishRequest(f,t):f.end()}(this,e,t,s)):(this._autoPong=s.autoPong,this._closeTimeout=s.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){b.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}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(e,t,s){let r=new f({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),i=new m(e,this._extensions,s.generateMask);this._receiver=r,this._sender=i,this._socket=e,r[x]=this,i[x]=this,e[x]=this,r.on("conclude",A),r.on("drain",$),r.on("error",G),r.on("message",q),r.on("ping",z),r.on("pong",H),i.onerror=X,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Z),e.on("data",J),e.on("end",Q),e.on("error",ee),this._readyState=U.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==U.CLOSED){if(this.readyState===U.CONNECTING)return void W(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===U.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=U.CLOSING,this._sender.close(e,t,!this._isServer,e=>{!e&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)?F(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.ping(e||g,t,s))}pong(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)?F(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.pong(e||g,t,s))}resume(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)return void F(this,e,s);let r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(e||g,r,s)}terminate(){if(this.readyState!==U.CLOSED){if(this.readyState===U.CONNECTING)return void W(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=U.CLOSING,this._socket.destroy())}}}function I(e,t){e._readyState=U.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function D(e){return e.path=e.socketPath,n.connect(e)}function M(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function W(e,t,s){e._readyState=U.CLOSING;let r=Error(s);Error.captureStackTrace(r,W),t.setHeader?(t[P]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(I,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function F(e,t,s){if(t){let s=p(t)?t.size:L(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${R[e.readyState]})`);process.nextTick(s,t)}}function A(e,t){let s=this[x];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[x]&&(s._socket.removeListener("data",J),process.nextTick(K,s._socket),1005===e?s.close():s.close(e,t))}function $(){let e=this[x];e.isPaused||e._socket.resume()}function G(e){let t=this[x];void 0!==t._socket[x]&&(t._socket.removeListener("data",J),process.nextTick(K,t._socket),t.close(e[E])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function V(){this[x].emitClose()}function q(e,t){this[x].emit("message",e,t)}function z(e){let t=this[x];t._autoPong&&t.pong(e,!this._isServer,k),t.emit("ping",e)}function H(e){this[x].emit("pong",e)}function K(e){e.resume()}function X(e){let t=this[x];t.readyState!==U.CLOSED&&(t.readyState===U.OPEN&&(t._readyState=U.CLOSING,Y(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function Y(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function Z(){let e=this[x];if(this.removeListener("close",Z),this.removeListener("data",J),this.removeListener("end",Q),e._readyState=U.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&0!==this._readableState.length){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[x]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",V),e._receiver.on("finish",V))}function J(e){this[x]._receiver.write(e)||this.pause()}function Q(){let e=this[x];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function ee(){let e=this[x];this.removeListener("error",ee),this.on("error",k),e&&(e._readyState=U.CLOSING,this.destroy())}Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(U,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(U,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(U,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(U.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[w])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[w]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[w]:!0})}})}),U.prototype.addEventListener=T,U.prototype.removeEventListener=C,e.exports=U}});let t=e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket-server.js");e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/stream.js"),e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/extension.js"),e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/permessage-deflate.js"),e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/receiver.js"),e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/sender.js"),e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/subprotocol.js"),e("../../node_modules/.pnpm/ws@8.21.1/node_modules/ws/lib/websocket.js");export{t as WebSocketServer};
|
|
1
|
+
import{__webpack_require__ as e}from"./rslib-runtime.js";import"./626.js";e.add({"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js"(e,t,s){let{EMPTY_BUFFER:r}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),i=Buffer[Symbol.species];function o(e){let t;return(o.readOnly=!0,Buffer.isBuffer(e))?e:(e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),o.readOnly=!1),t)}e.exports={concat:function(e,t){if(0===e.length)return r;if(1===e.length)return e[0];let s=Buffer.allocUnsafe(t),o=0;for(let t=0;t<e.length;t++){let r=e[t];s.set(r,o),o+=r.length}return o<t?new i(s.buffer,s.byteOffset,o):s},mask:function(e,t,s,r,i){for(let o=0;o<i;o++)s[r+o]=e[o]^t[3&o]},toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:o,unmask:function(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"(e){let t=["nodebuffer","arraybuffer","fragments"],s="u">typeof Blob;s&&t.push("blob"),e.exports={BINARY_TYPES:t,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js"(e,t,s){let{kForOnEventAttribute:r,kListener:i}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),o=Symbol("kCode"),n=Symbol("kData"),a=Symbol("kError"),l=Symbol("kMessage"),h=Symbol("kReason"),d=Symbol("kTarget"),c=Symbol("kType"),_=Symbol("kWasClean");class u{constructor(e){this[d]=null,this[c]=e}get target(){return this[d]}get type(){return this[c]}}Object.defineProperty(u.prototype,"target",{enumerable:!0}),Object.defineProperty(u.prototype,"type",{enumerable:!0});class f extends u{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[h]=void 0===t.reason?"":t.reason,this[_]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[h]}get wasClean(){return this[_]}}Object.defineProperty(f.prototype,"code",{enumerable:!0}),Object.defineProperty(f.prototype,"reason",{enumerable:!0}),Object.defineProperty(f.prototype,"wasClean",{enumerable:!0});class m extends u{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[l]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[l]}}Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});class p extends u{constructor(e,t={}){super(e),this[n]=void 0===t.data?null:t.data}get data(){return this[n]}}function b(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}Object.defineProperty(p.prototype,"data",{enumerable:!0}),e.exports={CloseEvent:f,ErrorEvent:m,Event:u,EventTarget:{addEventListener(e,t,s={}){let o;for(let o of this.listeners(e))if(!s[r]&&o[i]===t&&!o[r])return;if("message"===e)o=function(e,s){let r=new p("message",{data:s?e:e.toString()});r[d]=this,b(t,this,r)};else if("close"===e)o=function(e,s){let r=new f("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[d]=this,b(t,this,r)};else if("error"===e)o=function(e){let s=new m("error",{error:e,message:e.message});s[d]=this,b(t,this,s)};else{if("open"!==e)return;o=function(){let e=new u("open");e[d]=this,b(t,this,e)}}o[r]=!!s[r],o[i]=t,s.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let s of this.listeners(e))if(s[i]===t&&!s[r]){this.removeListener(e,s);break}}},MessageEvent:p}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js"(e,t,s){let{tokenChars:r}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js");function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}e.exports={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){let t,s,o=Object.create(null),n=Object.create(null),a=!1,l=!1,h=!1,d=-1,c=-1,_=-1,u=0;for(;u<e.length;u++)if(c=e.charCodeAt(u),void 0===t)if(-1===_&&1===r[c])-1===d&&(d=u);else if(0!==u&&(32===c||9===c))-1===_&&-1!==d&&(_=u);else if(59===c||44===c){if(-1===d)throw SyntaxError(`Unexpected character at index ${u}`);-1===_&&(_=u);let s=e.slice(d,_);44===c?(i(o,s,n),n=Object.create(null)):t=s,d=_=-1}else throw SyntaxError(`Unexpected character at index ${u}`);else if(void 0===s)if(-1===_&&1===r[c])-1===d&&(d=u);else if(32===c||9===c)-1===_&&-1!==d&&(_=u);else if(59===c||44===c){if(-1===d)throw SyntaxError(`Unexpected character at index ${u}`);-1===_&&(_=u),i(n,e.slice(d,_),!0),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),d=_=-1}else if(61===c&&-1!==d&&-1===_)s=e.slice(d,u),d=_=-1;else throw SyntaxError(`Unexpected character at index ${u}`);else if(l){if(1!==r[c])throw SyntaxError(`Unexpected character at index ${u}`);-1===d?d=u:a||(a=!0),l=!1}else if(h)if(1===r[c])-1===d&&(d=u);else if(34===c&&-1!==d)h=!1,_=u;else if(92===c)l=!0;else throw SyntaxError(`Unexpected character at index ${u}`);else if(34===c&&61===e.charCodeAt(u-1))h=!0;else if(-1===_&&1===r[c])-1===d&&(d=u);else if(-1!==d&&(32===c||9===c))-1===_&&(_=u);else if(59===c||44===c){if(-1===d)throw SyntaxError(`Unexpected character at index ${u}`);-1===_&&(_=u);let r=e.slice(d,_);a&&(r=r.replace(/\\/g,""),a=!1),i(n,s,r),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),s=void 0,d=_=-1}else throw SyntaxError(`Unexpected character at index ${u}`);if(-1===d||h||32===c||9===c)throw SyntaxError("Unexpected end of input");-1===_&&(_=u);let f=e.slice(d,_);return void 0===t?i(o,f,n):(void 0===s?i(n,f,!0):a?i(n,s,f.replace(/\\/g,"")):i(n,s,f),i(o,t,n)),o}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js"(e){let t=Symbol("kDone"),s=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[s]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[s]()}[s](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[t])}}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"(e,t,s){let r,i=s("zlib"),o=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js"),n=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js"),{kStatusCode:a}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),l=Buffer[Symbol.species],h=Buffer.from([0,0,255,255]),d=Symbol("permessage-deflate"),c=Symbol("total-length"),_=Symbol("callback"),u=Symbol("buffers"),f=Symbol("error");function m(e){this[u].push(e),this[c]+=e.length}function p(e){(this[c]+=e.length,this[d]._maxPayload<1||this[c]<=this[d]._maxPayload)?this[u].push(e):(this[f]=RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][a]=1009,this.removeListener("data",p),this.reset())}function b(e){(this[d]._inflate=null,this[f])?this[_](this[f]):(e[a]=1007,this[_](e))}e.exports=class{constructor(e){this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,r||(r=new n(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[_];this._deflate.close(),this._deflate=null,e&&e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,s=e.find(e=>(!1!==t.serverNoContextTakeover||!e.server_no_context_takeover)&&(!e.server_max_window_bits||!1!==t.serverMaxWindowBits&&("number"!=typeof t.serverMaxWindowBits||!(t.serverMaxWindowBits>e.server_max_window_bits)))&&("number"!=typeof t.clientMaxWindowBits||("number"==typeof e.client_max_window_bits?!(t.clientMaxWindowBits>e.client_max_window_bits):!!e.client_max_window_bits)));if(!s)throw Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:(!0===s.client_max_window_bits||!1===t.clientMaxWindowBits)&&delete s.client_max_window_bits,s}acceptAsClient(e){let t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let s=e[t];if(s.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if("client_no_context_takeover"===t||"server_no_context_takeover"===t){if(!0!==s)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=s})}),e}decompress(e,t,s){r.add(r=>{this._decompress(e,t,(e,t)=>{r(),s(e,t)})})}compress(e,t,s){r.add(r=>{this._compress(e,t,(e,t)=>{r(),s(e,t)})})}_decompress(e,t,s){let r=this._isServer?"client":"server";if(!this._inflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=i.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[d]=this,this._inflate[c]=0,this._inflate[u]=[],this._inflate.on("error",b),this._inflate.on("data",p)}this._inflate[_]=s,this._inflate.write(e),t&&this._inflate.write(h),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,s(e);return}let i=o.concat(this._inflate[u],this._inflate[c]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[c]=0,this._inflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),s(null,i)})}_compress(e,t,s){let r=this._isServer?"server":"client";if(!this._deflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=i.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[c]=0,this._deflate[u]=[],this._deflate.on("data",m)}this._deflate[_]=s,this._deflate.write(e),this._deflate.flush(i.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=o.concat(this._deflate[u],this._deflate[c]);t&&(e=new l(e.buffer,e.byteOffset,e.length-4)),this._deflate[_]=null,this._deflate[c]=0,this._deflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),s(null,e)})}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js"(e,t,s){let{Writable:r}=s("stream"),i=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:l}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),{concat:h,toArrayBuffer:d,unmask:c}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js"),{isValidStatusCode:_,isValidUTF8:u}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js"),f=Buffer[Symbol.species];e.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=0|e.maxBufferedChunks,this._maxFragments=0|e.maxFragments,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[l]=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._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,s){return 8===this._opcode&&0==this._state?s():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void s(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new f(t.buffer,t.byteOffset+e,t.length-e),new f(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let s=this._buffers[0],r=t.length-e;e>=s.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),r),this._buffers[0]=new f(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((48&t[0])!=0)return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let s=(64&t[0])==64;if(s&&!this._extensions[i.extensionName])return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&t[0])==128,this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=s}else{if(!(this._opcode>7)||!(this._opcode<11))return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&t[1])==128,this._isServer){if(!this._masked)return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),s=t.readUInt32BE(0);s>2097151?e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*s+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&c(t,this._mask)}if(this._opcode>7)return void this.controlMessage(t,e);if(this._maxFragments>0&&++this._numFragments>this._maxFragments)return void e(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void t(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(s)}this.dataMessage(t),0===this._state&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?h(s,t):"arraybuffer"===this._binaryType?d(h(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)}))}else{let r=h(s,t);if(!this._skipUTF8Validation&&!u(r))return void e(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(8===this._opcode){if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{let s=e.readUInt16BE(0);if(!_(s))return void t(this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let r=new f(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!u(r))return void t(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)}))}createError(e,t,s,r,i){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[a]=r,o}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js"(e,t,s){let r,{Duplex:i}=s("stream"),{randomFillSync:o}=s("crypto"),{types:{isUint8Array:n}}=s("util"),a=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"),{EMPTY_BUFFER:l,kWebSocket:h,NOOP:d}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),{isBlob:c,isValidStatusCode:_}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js"),{mask:u,toBuffer:f}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js"),m=Symbol("kByteLength"),p=Buffer.alloc(4),b=8192;function y(e,t,s){"function"==typeof s&&s(t);for(let s=0;s<e._queue.length;s++){let r=e._queue[s],i=r[r.length-1];"function"==typeof i&&i(t)}}function g(e,t,s){y(e,t,s),e.onerror(t)}e.exports=class e{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=d,this[h]=void 0}static frame(e,t){let s,i,n=!1,a=2,l=!1;t.mask&&(s=t.maskBuffer||p,t.generateMask?t.generateMask(s):(8192===b&&(void 0===r&&(r=Buffer.alloc(8192)),o(r,0,8192),b=0),s[0]=r[b++],s[1]=r[b++],s[2]=r[b++],s[3]=r[b++]),l=(s[0]|s[1]|s[2]|s[3])==0,a=6),"string"==typeof e?i=(!t.mask||l)&&void 0!==t[m]?t[m]:(e=Buffer.from(e)).length:(i=e.length,n=t.mask&&t.readOnly&&!l);let h=i;i>=65536?(a+=8,h=127):i>125&&(a+=2,h=126);let d=Buffer.allocUnsafe(n?i+a:a);return(d[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(d[0]|=64),d[1]=h,126===h?d.writeUInt16BE(i,2):127===h&&(d[2]=d[3]=0,d.writeUIntBE(i,4,6)),t.mask)?(d[1]|=128,d[a-4]=s[0],d[a-3]=s[1],d[a-2]=s[2],d[a-1]=s[3],l)?[d,e]:n?(u(e,s,d,a,i),[d]):(u(e,s,e,0,i),[d,e]):[d,e]}close(t,s,r,i){let o;if(void 0===t)o=l;else if("number"==typeof t&&_(t))if(void 0!==s&&s.length){let e=Buffer.byteLength(s);if(e>123)throw RangeError("The message must not be greater than 123 bytes");if((o=Buffer.allocUnsafe(2+e)).writeUInt16BE(t,0),"string"==typeof s)o.write(s,2);else if(n(s))o.set(s,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(o=Buffer.allocUnsafe(2)).writeUInt16BE(t,0);else throw TypeError("First argument must be a valid error code number");let a={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,o,!1,a,i]):this.sendFrame(e.frame(o,a),i)}ping(t,s,r){let i,o;if("string"==typeof t?(i=Buffer.byteLength(t),o=!1):c(t)?(i=t.size,o=!1):(i=(t=f(t)).length,o=f.readOnly),i>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[m]:i,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};c(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,r]):this.getBlobData(t,!1,n,r):0!==this._state?this.enqueue([this.dispatch,t,!1,n,r]):this.sendFrame(e.frame(t,n),r)}pong(t,s,r){let i,o;if("string"==typeof t?(i=Buffer.byteLength(t),o=!1):c(t)?(i=t.size,o=!1):(i=(t=f(t)).length,o=f.readOnly),i>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[m]:i,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};c(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,r]):this.getBlobData(t,!1,n,r):0!==this._state?this.enqueue([this.dispatch,t,!1,n,r]):this.sendFrame(e.frame(t,n),r)}send(e,t,s){let r,i,o=this._extensions[a.extensionName],n=t.binary?2:1,l=t.compress;"string"==typeof e?(r=Buffer.byteLength(e),i=!1):c(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),this._firstFragment?(this._firstFragment=!1,l&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=r>=o._threshold),this._compress=l):(l=!1,n=0),t.fin&&(this._firstFragment=!0);let h={[m]:r,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:i,rsv1:l};c(e)?0!==this._state?this.enqueue([this.getBlobData,e,this._compress,h,s]):this.getBlobData(e,this._compress,h,s):0!==this._state?this.enqueue([this.dispatch,e,this._compress,h,s]):this.dispatch(e,this._compress,h,s)}getBlobData(t,s,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error("The socket was closed while the blob was being read");process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let o=f(t);s?this.dispatch(o,s,r,i):(this._state=0,this.sendFrame(e.frame(o,r),i),this.dequeue())}).catch(e=>{process.nextTick(g,this,e,i)})}dispatch(t,s,r,i){if(!s)return void this.sendFrame(e.frame(t,r),i);let o=this._extensions[a.extensionName];this._bufferedBytes+=r[m],this._state=1,o.compress(t,r.fin,(t,s)=>{this._socket.destroyed?y(this,Error("The socket was closed while data was being compressed"),i):(this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(s,r),i),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js"(e,t,s){s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js");let{Duplex:r}=s("stream");function i(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}e.exports=function(e,t){let s=!0,a=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(t,s){let r=!s&&a._readableState.objectMode?t.toString():t;a.push(r)||e.pause()}),e.once("error",function(e){a.destroyed||(s=!1,a.destroy(e))}),e.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,a);return}let o=!1;e.once("error",function(e){o=!0,r(e)}),e.once("close",function(){o||r(t),process.nextTick(i,a)}),s&&e.terminate()},a._final=function(t){e.readyState===e.CONNECTING?e.once("open",function(){a._final(t)}):null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",function(){t()}),e.close()))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,r){e.readyState===e.CONNECTING?e.once("open",function(){a._write(t,s,r)}):e.send(t,r)},a.on("end",o),a.on("error",n),a}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js"(e,t,s){let{tokenChars:r}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js");e.exports={parse:function(e){let t=new Set,s=-1,i=-1,o=0;for(;o<e.length;o++){let n=e.charCodeAt(o);if(-1===i&&1===r[n])-1===s&&(s=o);else if(0!==o&&(32===n||9===n))-1===i&&-1!==s&&(i=o);else if(44===n){if(-1===s)throw SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);let r=e.slice(s,i);if(t.has(r))throw SyntaxError(`The "${r}" subprotocol is duplicated`);t.add(r),s=i=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(-1===s||-1!==i)throw SyntaxError("Unexpected end of input");let n=e.slice(s,o);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js"(e,t,s){let{isUtf8:r}=s("buffer"),{hasBlob:i}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js");function o(e){let t=e.length,s=0;for(;s<t;)if((128&e[s])==0)s++;else if((224&e[s])==192){if(s+1===t||(192&e[s+1])!=128||(254&e[s])==192)return!1;s+=2}else if((240&e[s])==224){if(s+2>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||224===e[s]&&(224&e[s+1])==128||237===e[s]&&(224&e[s+1])==160)return!1;s+=3}else{if((248&e[s])!=240||s+3>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||(192&e[s+3])!=128||240===e[s]&&(240&e[s+1])==128||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}e.exports={isBlob:function(e){return i&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:o,tokenChars:[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]},r&&(e.exports.isValidUTF8=function(e){return e.length<24?o(e):r(e)})},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js"(e,t,s){let r=s("events"),i=s("http"),{Duplex:o}=s("stream"),{createHash:n}=s("crypto"),a=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js"),l=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"),h=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js"),d=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js"),{CLOSE_TIMEOUT:c,GUID:_,kWebSocket:u}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),f=/^[+/0-9A-Za-z]{22}==$/;function m(e){e._state=2,e.emit("close")}function p(){this.destroy()}function b(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r
|
|
2
|
+
`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join("\r\n")+"\r\n\r\n"+s)}function y(e,t,s,r,i,o){if(e.listenerCount("wsClientError")){let r=Error(i);Error.captureStackTrace(r,y),e.emit("wsClientError",r,s,t)}else b(s,r,i,o)}e.exports=class extends r{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:c,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer((e,t)=>{let s=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(let s of Object.keys(t))e.on(s,t[s]);return function(){for(let s of Object.keys(t))e.removeListener(s,t[s])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state){e&&this.once("close",()=>{e(Error("The server is not running"))}),process.nextTick(m,this);return}if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(m,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{m(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,r){t.on("error",p);let i=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method)return void y(this,e,t,405,"Invalid HTTP method");if(void 0===o||"websocket"!==o.toLowerCase())return void y(this,e,t,400,"Invalid Upgrade header");if(void 0===i||!f.test(i))return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==n&&8!==n)return void y(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(e))return void b(t,400);let d=e.headers["sec-websocket-protocol"],c=new Set;if(void 0!==d)try{c=h.parse(d)}catch(s){y(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let _=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&void 0!==_){let s=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=a.parse(_);e[l.extensionName]&&(s.accept(e[l.extensionName]),u[l.extensionName]=s)}catch(s){y(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let o={origin:e.headers[`${8===n?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,l)=>{if(!o)return b(t,n||401,a,l);this.completeUpgrade(u,i,c,e,t,s,r)});if(!this.options.verifyClient(o))return b(t,401)}this.completeUpgrade(u,i,c,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,h){if(!i.readable||!i.writable)return i.destroy();if(i[u])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return b(i,503);let d=n("sha1").update(t+_).digest("base64"),c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${d}`],f=new this.options.WebSocket(null,void 0,this.options);if(s.size){let e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(c.push(`Sec-WebSocket-Protocol: ${e}`),f._protocol=e)}if(e[l.extensionName]){let t=e[l.extensionName].params,s=a.format({[l.extensionName]:[t]});c.push(`Sec-WebSocket-Extensions: ${s}`),f._extensions=e}this.emit("headers",c,r),i.write(c.concat("\r\n").join("\r\n")),i.removeListener("error",p),f.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&!this.clients.size&&process.nextTick(m,this)})),h(f,r)}}},"../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js"(e,t,s){let r=s("events"),i=s("https"),o=s("http"),n=s("net"),a=s("tls"),{randomBytes:l,createHash:h}=s("crypto"),{Duplex:d,Readable:c}=s("stream"),{URL:_}=s("url?5f07"),u=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"),f=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js"),m=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js"),{isBlob:p}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js"),{BINARY_TYPES:b,CLOSE_TIMEOUT:y,EMPTY_BUFFER:g,GUID:w,kForOnEventAttribute:v,kListener:S,kStatusCode:E,kWebSocket:x,NOOP:k}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"),{EventTarget:{addEventListener:T,removeEventListener:C}}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js"),{format:O,parse:N}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js"),{toBuffer:L}=s("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js"),P=Symbol("kAborted"),B=[8,13],R=["CONNECTING","OPEN","CLOSING","CLOSED"],j=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class U extends r{constructor(e,t,s){super(),this._binaryType=b[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=g,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=U.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),function e(t,s,r,n){let a,d,c,f,m={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:y,protocolVersion:B[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=m.autoPong,t._closeTimeout=m.closeTimeout,!B.includes(m.protocolVersion))throw RangeError(`Unsupported protocol version: ${m.protocolVersion} (supported versions: ${B.join(", ")})`);if(s instanceof _)a=s;else try{a=new _(s)}catch{throw SyntaxError(`Invalid URL: ${s}`)}"http:"===a.protocol?a.protocol="ws:":"https:"===a.protocol&&(a.protocol="wss:"),t._url=a.href;let p="wss:"===a.protocol,b="ws+unix:"===a.protocol;if("ws:"===a.protocol||p||b?b&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"):d='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',d){let e=SyntaxError(d);if(0!==t._redirects)return void I(t,e);throw e}let g=p?443:80,v=l(16).toString("base64"),S=p?i.request:o.request,E=new Set;if(m.createConnection=m.createConnection||(p?D:M),m.defaultPort=m.defaultPort||g,m.port=a.port||g,m.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,m.headers={...m.headers,"Sec-WebSocket-Version":m.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},m.path=a.pathname+a.search,m.timeout=m.handshakeTimeout,m.perMessageDeflate&&(c=new u({...m.perMessageDeflate,isServer:!1,maxPayload:m.maxPayload}),m.headers["Sec-WebSocket-Extensions"]=O({[u.extensionName]:c.offer()})),r.length){for(let e of r){if("string"!=typeof e||!j.test(e)||E.has(e))throw SyntaxError("An invalid or duplicated subprotocol was specified");E.add(e)}m.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(m.origin&&(m.protocolVersion<13?m.headers["Sec-WebSocket-Origin"]=m.origin:m.headers.Origin=m.origin),(a.username||a.password)&&(m.auth=`${a.username}:${a.password}`),b){let e=m.path.split(":");m.socketPath=e[0],m.path=e[1]}if(m.followRedirects){if(0===t._redirects){t._originalIpc=b,t._originalSecure=p,t._originalHostOrSocketPath=b?m.socketPath:a.host;let e=n&&n.headers;if(n={...n,headers:{}},e)for(let[t,s]of Object.entries(e))n.headers[t.toLowerCase()]=s}else if(0===t.listenerCount("redirect")){let e=b?!!t._originalIpc&&m.socketPath===t._originalHostOrSocketPath:!t._originalIpc&&a.host===t._originalHostOrSocketPath;e&&(!t._originalSecure||p)||(delete m.headers.authorization,delete m.headers.cookie,e||delete m.headers.host,m.auth=void 0)}m.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(m.auth).toString("base64")),f=t._req=S(m),t._redirects&&t.emit("redirect",t.url,f)}else f=t._req=S(m);m.timeout&&f.on("timeout",()=>{W(t,f,"Opening handshake has timed out")}),f.on("error",e=>{null===f||f[P]||(f=t._req=null,I(t,e))}),f.on("response",i=>{let o=i.headers.location,a=i.statusCode;if(o&&m.followRedirects&&a>=300&&a<400){let i;if(++t._redirects>m.maxRedirects)return void W(t,f,"Maximum redirects exceeded");f.abort();try{i=new _(o,s)}catch(e){I(t,SyntaxError(`Invalid URL: ${o}`));return}e(t,i,r,n)}else t.emit("unexpected-response",f,i)||W(t,f,`Unexpected server response: ${i.statusCode}`)}),f.on("upgrade",(e,s,r)=>{let i;if(t.emit("upgrade",e),t.readyState!==U.CONNECTING)return;f=t._req=null;let o=e.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void W(t,s,"Invalid Upgrade header");let n=h("sha1").update(v+w).digest("base64");if(e.headers["sec-websocket-accept"]!==n)return void W(t,s,"Invalid Sec-WebSocket-Accept header");let a=e.headers["sec-websocket-protocol"];if(void 0!==a?E.size?E.has(a)||(i="Server sent an invalid subprotocol"):i="Server sent a subprotocol but none was requested":E.size&&(i="Server sent no subprotocol"),i)return void W(t,s,i);a&&(t._protocol=a);let l=e.headers["sec-websocket-extensions"];if(void 0!==l){let e;if(!c)return void W(t,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{e=N(l)}catch(e){W(t,s,"Invalid Sec-WebSocket-Extensions header");return}let r=Object.keys(e);if(1!==r.length||r[0]!==u.extensionName)return void W(t,s,"Server indicated an extension that was not requested");try{c.accept(e[u.extensionName])}catch(e){W(t,s,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[u.extensionName]=c}t.setSocket(s,r,{allowSynchronousEvents:m.allowSynchronousEvents,generateMask:m.generateMask,maxBufferedChunks:m.maxBufferedChunks,maxFragments:m.maxFragments,maxPayload:m.maxPayload,skipUTF8Validation:m.skipUTF8Validation})}),m.finishRequest?m.finishRequest(f,t):f.end()}(this,e,t,s)):(this._autoPong=s.autoPong,this._closeTimeout=s.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){b.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}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(e,t,s){let r=new f({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),i=new m(e,this._extensions,s.generateMask);this._receiver=r,this._sender=i,this._socket=e,r[x]=this,i[x]=this,e[x]=this,r.on("conclude",A),r.on("drain",$),r.on("error",G),r.on("message",q),r.on("ping",z),r.on("pong",H),i.onerror=X,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Z),e.on("data",J),e.on("end",Q),e.on("error",ee),this._readyState=U.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==U.CLOSED){if(this.readyState===U.CONNECTING)return void W(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===U.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=U.CLOSING,this._sender.close(e,t,!this._isServer,e=>{!e&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)?F(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.ping(e||g,t,s))}pong(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)?F(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.pong(e||g,t,s))}resume(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)return void F(this,e,s);let r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(e||g,r,s)}terminate(){if(this.readyState!==U.CLOSED){if(this.readyState===U.CONNECTING)return void W(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=U.CLOSING,this._socket.destroy())}}}function I(e,t){e._readyState=U.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function M(e){return e.path=e.socketPath,n.connect(e)}function D(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function W(e,t,s){e._readyState=U.CLOSING;let r=Error(s);Error.captureStackTrace(r,W),t.setHeader?(t[P]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(I,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function F(e,t,s){if(t){let s=p(t)?t.size:L(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${R[e.readyState]})`);process.nextTick(s,t)}}function A(e,t){let s=this[x];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[x]&&(s._socket.removeListener("data",J),process.nextTick(K,s._socket),1005===e?s.close():s.close(e,t))}function $(){let e=this[x];e.isPaused||e._socket.resume()}function G(e){let t=this[x];void 0!==t._socket[x]&&(t._socket.removeListener("data",J),process.nextTick(K,t._socket),t.close(e[E])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function V(){this[x].emitClose()}function q(e,t){this[x].emit("message",e,t)}function z(e){let t=this[x];t._autoPong&&t.pong(e,!this._isServer,k),t.emit("ping",e)}function H(e){this[x].emit("pong",e)}function K(e){e.resume()}function X(e){let t=this[x];t.readyState!==U.CLOSED&&(t.readyState===U.OPEN&&(t._readyState=U.CLOSING,Y(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function Y(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function Z(){let e=this[x];if(this.removeListener("close",Z),this.removeListener("data",J),this.removeListener("end",Q),e._readyState=U.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&0!==this._readableState.length){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[x]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",V),e._receiver.on("finish",V))}function J(e){this[x]._receiver.write(e)||this.pause()}function Q(){let e=this[x];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function ee(){let e=this[x];this.removeListener("error",ee),this.on("error",k),e&&(e._readyState=U.CLOSING,this.destroy())}Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(U,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(U,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(U,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(U.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[v])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[v]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[v]:!0})}})}),U.prototype.addEventListener=T,U.prototype.removeEventListener=C,e.exports=U}});let t=e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js");e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js"),e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js"),e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"),e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js"),e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js"),e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js"),e("../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js");export{t as WebSocketServer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.12",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"types.d.ts"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@rspack/core": "~2.1.
|
|
38
|
+
"@rspack/core": "~2.1.10",
|
|
39
39
|
"@swc/helpers": "^0.5.23"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"cac": "^7.0.0",
|
|
52
52
|
"chokidar": "^5.0.0",
|
|
53
53
|
"connect-next": "4.0.3",
|
|
54
|
-
"core-js": "^3.
|
|
54
|
+
"core-js": "^3.50.0",
|
|
55
55
|
"cors": "^2.8.6",
|
|
56
56
|
"css-loader": "7.1.4",
|
|
57
57
|
"deepmerge": "^4.3.1",
|
|
@@ -61,18 +61,18 @@
|
|
|
61
61
|
"http-proxy-middleware": "4.2.0",
|
|
62
62
|
"jiti": "^2.7.0",
|
|
63
63
|
"launch-editor-middleware": "^2.14.1",
|
|
64
|
-
"memfs": "^4.
|
|
64
|
+
"memfs": "^4.68.0",
|
|
65
65
|
"mrmime": "^2.0.1",
|
|
66
66
|
"on-finished": "2.4.1",
|
|
67
67
|
"open": "^11.0.0",
|
|
68
|
-
"postcss": "^8.5.
|
|
68
|
+
"postcss": "^8.5.26",
|
|
69
69
|
"postcss-load-config": "6.0.1",
|
|
70
70
|
"postcss-loader": "8.2.1",
|
|
71
71
|
"prebundle": "1.6.5",
|
|
72
72
|
"range-parser": "^1.3.0",
|
|
73
73
|
"reduce-configs": "^2.0.1",
|
|
74
74
|
"rslog": "^2.3.0",
|
|
75
|
-
"rspack-chain": "^2.
|
|
75
|
+
"rspack-chain": "^2.2.0",
|
|
76
76
|
"rspack-manifest-plugin": "5.2.2",
|
|
77
77
|
"rspack-merge": "1.0.1",
|
|
78
78
|
"sirv": "^3.0.2",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"style-loader": "^4.0.0",
|
|
81
81
|
"tinyglobby": "^0.2.17",
|
|
82
82
|
"typescript": "^6.0.3",
|
|
83
|
-
"ws": "^8.21.
|
|
83
|
+
"ws": "^8.21.3"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"core-js": ">= 3.0.0"
|