diesel-core 1.6.6 → 1.6.7
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/README.md +12 -6
- package/dist/handleRequest.js +12 -12
- package/dist/main.d.ts +4 -4
- package/dist/main.js +15 -15
- package/dist/request_pipeline.js +1 -1
- package/dist/utils/request.util.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ app.head() app.options() , app.onMethod(method,path,handler)
|
|
|
51
51
|
import {Diesel} from "diesel-core"
|
|
52
52
|
const app = new Diesel({
|
|
53
53
|
platform: 'cf',
|
|
54
|
-
|
|
54
|
+
logger: true
|
|
55
55
|
})
|
|
56
56
|
.get("/", (ctx) => ctx.text("Welcome to Diesel.js on Cloudflare Workers!"));
|
|
57
57
|
|
|
@@ -60,17 +60,23 @@ export default {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
```
|
|
63
|
-
**Note make sure to call fetch(), it gives you real fetch handler**
|
|
63
|
+
**Note make sure to add platform:'cf' & call fetch(), it gives you real fetch handler**
|
|
64
64
|
|
|
65
65
|
# Node.js adaptor
|
|
66
66
|
### Now you can use Diesel.js for Node.js
|
|
67
67
|
|
|
68
68
|
```ts
|
|
69
|
-
import {Diesel} from
|
|
70
|
-
import {serve} from 'diesel-core/node'
|
|
69
|
+
import { Diesel } from "diesel-core"
|
|
70
|
+
import { serve } from 'diesel-core/node'
|
|
71
|
+
|
|
72
|
+
const app =
|
|
73
|
+
new Diesel({
|
|
74
|
+
logger:true
|
|
75
|
+
})
|
|
76
|
+
.get("/", (c) => {
|
|
77
|
+
return c.text(`hello from node diesel/`)
|
|
78
|
+
})
|
|
71
79
|
|
|
72
|
-
const app = new Diesel({})
|
|
73
|
-
.get("/", (c) => c.text(`hello from node diesel/`))
|
|
74
80
|
|
|
75
81
|
serve({
|
|
76
82
|
fetch: app.fetch(),
|
package/dist/handleRequest.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var bf=Object.create;var{getPrototypeOf:Sf,defineProperty:
|
|
1
|
+
var bf=Object.create;var{getPrototypeOf:Sf,defineProperty:M,getOwnPropertyNames:i,getOwnPropertyDescriptor:qf}=Object,u=Object.prototype.hasOwnProperty;var Ef=(f,w,g)=>{g=f!=null?bf(Sf(f)):{};let A=w||!f||!f.__esModule?M(g,"default",{value:f,enumerable:!0}):g;for(let $ of i(f))if(!u.call(A,$))M(A,$,{get:()=>f[$],enumerable:!0});return A},n=new WeakMap,cf=(f)=>{var w=n.get(f),g;if(w)return w;if(w=M({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function")i(f).map((A)=>!u.call(w,A)&&M(w,A,{get:()=>f[A],enumerable:!(g=qf(f,A))||g.enumerable}));return n.set(f,w),w},L=(f,w)=>()=>(w||f((w={exports:{}}).exports,w),w.exports);var Tf=(f,w)=>{for(var g in w)M(f,g,{get:w[g],enumerable:!0,configurable:!0,set:(A)=>w[g]=()=>A})};var yf=(f,w)=>()=>(f&&(w=f(f=0)),w);var Pf=((f)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(f,{get:(w,g)=>(typeof require!=="undefined"?require:w)[g]}):f)(function(f){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var Af={};Tf(Af,{sep:()=>ff,resolve:()=>K,relative:()=>l,posix:()=>wf,parse:()=>e,normalize:()=>b,join:()=>d,isAbsolute:()=>m,format:()=>t,extname:()=>p,dirname:()=>s,delimiter:()=>gf,default:()=>kf,basename:()=>a,_makeLong:()=>o});function W(f){if(typeof f!=="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(f))}function h(f,w){var g="",A=0,$=-1,j=0,z;for(var J=0;J<=f.length;++J){if(J<f.length)z=f.charCodeAt(J);else if(z===47)break;else z=47;if(z===47){if($===J-1||j===1);else if($!==J-1&&j===2){if(g.length<2||A!==2||g.charCodeAt(g.length-1)!==46||g.charCodeAt(g.length-2)!==46){if(g.length>2){var Z=g.lastIndexOf("/");if(Z!==g.length-1){if(Z===-1)g="",A=0;else g=g.slice(0,Z),A=g.length-1-g.lastIndexOf("/");$=J,j=0;continue}}else if(g.length===2||g.length===1){g="",A=0,$=J,j=0;continue}}if(w){if(g.length>0)g+="/..";else g="..";A=2}}else{if(g.length>0)g+="/"+f.slice($+1,J);else g=f.slice($+1,J);A=J-$-1}$=J,j=0}else if(z===46&&j!==-1)++j;else j=-1}return g}function _f(f,w){var g=w.dir||w.root,A=w.base||(w.name||"")+(w.ext||"");if(!g)return A;if(g===w.root)return g+A;return g+f+A}function K(){var f="",w=!1,g;for(var A=arguments.length-1;A>=-1&&!w;A--){var $;if(A>=0)$=arguments[A];else{if(g===void 0)g=process.cwd();$=g}if(W($),$.length===0)continue;f=$+"/"+f,w=$.charCodeAt(0)===47}if(f=h(f,!w),w)if(f.length>0)return"/"+f;else return"/";else if(f.length>0)return f;else return"."}function b(f){if(W(f),f.length===0)return".";var w=f.charCodeAt(0)===47,g=f.charCodeAt(f.length-1)===47;if(f=h(f,!w),f.length===0&&!w)f=".";if(f.length>0&&g)f+="/";if(w)return"/"+f;return f}function m(f){return W(f),f.length>0&&f.charCodeAt(0)===47}function d(){if(arguments.length===0)return".";var f;for(var w=0;w<arguments.length;++w){var g=arguments[w];if(W(g),g.length>0)if(f===void 0)f=g;else f+="/"+g}if(f===void 0)return".";return b(f)}function l(f,w){if(W(f),W(w),f===w)return"";if(f=K(f),w=K(w),f===w)return"";var g=1;for(;g<f.length;++g)if(f.charCodeAt(g)!==47)break;var A=f.length,$=A-g,j=1;for(;j<w.length;++j)if(w.charCodeAt(j)!==47)break;var z=w.length,J=z-j,Z=$<J?$:J,B=-1,Y=0;for(;Y<=Z;++Y){if(Y===Z){if(J>Z){if(w.charCodeAt(j+Y)===47)return w.slice(j+Y+1);else if(Y===0)return w.slice(j+Y)}else if($>Z){if(f.charCodeAt(g+Y)===47)B=Y;else if(Y===0)B=0}break}var G=f.charCodeAt(g+Y),V=w.charCodeAt(j+Y);if(G!==V)break;else if(G===47)B=Y}var C="";for(Y=g+B+1;Y<=A;++Y)if(Y===A||f.charCodeAt(Y)===47)if(C.length===0)C+="..";else C+="/..";if(C.length>0)return C+w.slice(j+B);else{if(j+=B,w.charCodeAt(j)===47)++j;return w.slice(j)}}function o(f){return f}function s(f){if(W(f),f.length===0)return".";var w=f.charCodeAt(0),g=w===47,A=-1,$=!0;for(var j=f.length-1;j>=1;--j)if(w=f.charCodeAt(j),w===47){if(!$){A=j;break}}else $=!1;if(A===-1)return g?"/":".";if(g&&A===1)return"//";return f.slice(0,A)}function a(f,w){if(w!==void 0&&typeof w!=="string")throw new TypeError('"ext" argument must be a string');W(f);var g=0,A=-1,$=!0,j;if(w!==void 0&&w.length>0&&w.length<=f.length){if(w.length===f.length&&w===f)return"";var z=w.length-1,J=-1;for(j=f.length-1;j>=0;--j){var Z=f.charCodeAt(j);if(Z===47){if(!$){g=j+1;break}}else{if(J===-1)$=!1,J=j+1;if(z>=0)if(Z===w.charCodeAt(z)){if(--z===-1)A=j}else z=-1,A=J}}if(g===A)A=J;else if(A===-1)A=f.length;return f.slice(g,A)}else{for(j=f.length-1;j>=0;--j)if(f.charCodeAt(j)===47){if(!$){g=j+1;break}}else if(A===-1)$=!1,A=j+1;if(A===-1)return"";return f.slice(g,A)}}function p(f){W(f);var w=-1,g=0,A=-1,$=!0,j=0;for(var z=f.length-1;z>=0;--z){var J=f.charCodeAt(z);if(J===47){if(!$){g=z+1;break}continue}if(A===-1)$=!1,A=z+1;if(J===46){if(w===-1)w=z;else if(j!==1)j=1}else if(w!==-1)j=-1}if(w===-1||A===-1||j===0||j===1&&w===A-1&&w===g+1)return"";return f.slice(w,A)}function t(f){if(f===null||typeof f!=="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof f);return _f("/",f)}function e(f){W(f);var w={root:"",dir:"",base:"",ext:"",name:""};if(f.length===0)return w;var g=f.charCodeAt(0),A=g===47,$;if(A)w.root="/",$=1;else $=0;var j=-1,z=0,J=-1,Z=!0,B=f.length-1,Y=0;for(;B>=$;--B){if(g=f.charCodeAt(B),g===47){if(!Z){z=B+1;break}continue}if(J===-1)Z=!1,J=B+1;if(g===46){if(j===-1)j=B;else if(Y!==1)Y=1}else if(j!==-1)Y=-1}if(j===-1||J===-1||Y===0||Y===1&&j===J-1&&j===z+1){if(J!==-1)if(z===0&&A)w.base=w.name=f.slice(1,J);else w.base=w.name=f.slice(z,J)}else{if(z===0&&A)w.name=f.slice(1,j),w.base=f.slice(1,J);else w.name=f.slice(z,j),w.base=f.slice(z,J);w.ext=f.slice(j,J)}if(z>0)w.dir=f.slice(0,z-1);else if(A)w.dir="/";return w}var ff="/",gf=":",wf,kf;var $f=yf(()=>{wf=((f)=>(f.posix=f,f))({resolve:K,normalize:b,isAbsolute:m,join:d,relative:l,_makeLong:o,dirname:s,basename:a,extname:p,format:t,parse:e,sep:ff,delimiter:gf,win32:null,posix:null}),kf=wf});var Jf=L((mf)=>{var If=/[|\\{}()[\]^$+*?.]/g,xf=Object.prototype.hasOwnProperty,q=function(f,w){return xf.apply(f,[w])};mf.escapeRegExpChars=function(f){if(!f)return"";return String(f).replace(If,"\\$&")};var rf={"&":"&","<":"<",">":">",'"':""","'":"'"},nf=/[&<>'"]/g;function uf(f){return rf[f]||f}var hf=`var _ENCODE_HTML_RULES = {
|
|
2
2
|
"&": "&"
|
|
3
3
|
, "<": "<"
|
|
4
4
|
, ">": ">"
|
|
@@ -9,17 +9,17 @@ var bf=Object.create;var{getPrototypeOf:Sf,defineProperty:R,getOwnPropertyNames:
|
|
|
9
9
|
function encode_char(c) {
|
|
10
10
|
return _ENCODE_HTML_RULES[c] || c;
|
|
11
11
|
};
|
|
12
|
-
`;mf.escapeXML=function(f){return f==null?"":String(f).replace(nf,uf)};function
|
|
13
|
-
`+hf}try{if(typeof Object.defineProperty==="function")Object.defineProperty(mf.escapeXML,"toString",{value
|
|
14
|
-
`),z=Math.max(A-3,0),J=Math.min(j.length,A+3),Z=$(g),
|
|
12
|
+
`;mf.escapeXML=function(f){return f==null?"":String(f).replace(nf,uf)};function jf(){return Function.prototype.toString.call(this)+`;
|
|
13
|
+
`+hf}try{if(typeof Object.defineProperty==="function")Object.defineProperty(mf.escapeXML,"toString",{value:jf});else mf.escapeXML.toString=jf}catch(f){console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)")}mf.shallowCopy=function(f,w){if(w=w||{},f!==null&&f!==void 0)for(var g in w){if(!q(w,g))continue;if(g==="__proto__"||g==="constructor")continue;f[g]=w[g]}return f};mf.shallowCopyFromList=function(f,w,g){if(g=g||[],w=w||{},f!==null&&f!==void 0)for(var A=0;A<g.length;A++){var $=g[A];if(typeof w[$]!="undefined"){if(!q(w,$))continue;if($==="__proto__"||$==="constructor")continue;f[$]=w[$]}}return f};mf.cache={_data:{},set:function(f,w){this._data[f]=w},get:function(f){return this._data[f]},remove:function(f){delete this._data[f]},reset:function(){this._data={}}};mf.hyphenToCamel=function(f){return f.replace(/-[a-z]/g,function(w){return w[1].toUpperCase()})};mf.createNullProtoObjWherePossible=function(){if(typeof Object.create=="function")return function(){return Object.create(null)};if(!({__proto__:null}instanceof Object))return function(){return{__proto__:null}};return function(){return{}}}();mf.hasOwnOnlyObject=function(f){var w=mf.createNullProtoObjWherePossible();for(var g in f)if(q(f,g))w[g]=f[g];return w}});var Yf=L((S1,tf)=>{tf.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.1.10",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",bin:{ejs:"./bin/cli.js"},main:"./lib/ejs.js",jsdelivr:"ejs.min.js",unpkg:"ejs.min.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{jake:"^10.8.5"},devDependencies:{browserify:"^16.5.1",eslint:"^6.8.0","git-directory-deploy":"^1.5.1",jsdoc:"^4.0.2","lru-cache":"^4.0.1",mocha:"^10.2.0","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"npx jake test"}}});var Hf=L((Wf)=>{var T=(()=>({})),R=($f(),cf(Af)),F=Jf(),Zf=!1,ef=Yf().version,f1="<",g1=">",w1="%",Cf="locals",A1="ejs",$1="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)",Gf=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"],j1=Gf.concat("cache"),Vf=/^\uFEFF/,E=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;Wf.cache=F.cache;Wf.fileLoader=T.readFileSync;Wf.localsName=Cf;Wf.promiseImpl=new Function("return this;")().Promise;Wf.resolveInclude=function(f,w,g){var{dirname:A,extname:$,resolve:j}=R,z=j(g?w:A(w),f),J=$(f);if(!J)z+=".ejs";return z};function Bf(f,w){var g;if(w.some(function(A){return g=Wf.resolveInclude(f,A,!0),T.existsSync(g)}))return g}function z1(f,w){var g,A,$=w.views,j=/^[A-Za-z]+:\\|^\//.exec(f);if(j&&j.length)if(f=f.replace(/^\/*/,""),Array.isArray(w.root))g=Bf(f,w.root);else g=Wf.resolveInclude(f,w.root||"/",!0);else{if(w.filename){if(A=Wf.resolveInclude(f,w.filename),T.existsSync(A))g=A}if(!g&&Array.isArray($))g=Bf(f,$);if(!g&&typeof w.includer!=="function")throw new Error('Could not find the include file "'+w.escapeFunction(f)+'"')}return g}function U(f,w){var g,A=f.filename,$=arguments.length>1;if(f.cache){if(!A)throw new Error("cache option requires a filename");if(g=Wf.cache.get(A),g)return g;if(!$)w=Ff(A).toString().replace(Vf,"")}else if(!$){if(!A)throw new Error("Internal EJS error: no file name or template provided");w=Ff(A).toString().replace(Vf,"")}if(g=Wf.compile(w,f),f.cache)Wf.cache.set(A,g);return g}function J1(f,w,g){var A;if(!g)if(typeof Wf.promiseImpl=="function")return new Wf.promiseImpl(function($,j){try{A=U(f)(w),$(A)}catch(z){j(z)}});else throw new Error("Please provide a callback function");else{try{A=U(f)(w)}catch($){return g($)}g(null,A)}}function Ff(f){return Wf.fileLoader(f)}function Y1(f,w){var g=F.shallowCopy(F.createNullProtoObjWherePossible(),w);if(g.filename=z1(f,g),typeof w.includer==="function"){var A=w.includer(f,g.filename);if(A){if(A.filename)g.filename=A.filename;if(A.template)return U(g,A.template)}}return U(g)}function Qf(f,w,g,A,$){var j=w.split(`
|
|
14
|
+
`),z=Math.max(A-3,0),J=Math.min(j.length,A+3),Z=$(g),B=j.slice(z,J).map(function(Y,G){var V=G+z+1;return(V==A?" >> ":" ")+V+"| "+Y}).join(`
|
|
15
15
|
`);throw f.path=Z,f.message=(Z||"ejs")+":"+A+`
|
|
16
|
-
`+
|
|
16
|
+
`+B+`
|
|
17
17
|
|
|
18
|
-
`+f.message,f}function
|
|
18
|
+
`+f.message,f}function Xf(f){return f.replace(/;(\s*$)/,"$1")}Wf.compile=function f(w,g){var A;if(g&&g.scope){if(!Zf)console.warn("`scope` option is deprecated and will be removed in EJS 3"),Zf=!0;if(!g.context)g.context=g.scope;delete g.scope}return A=new Q(w,g),A.compile()};Wf.render=function(f,w,g){var A=w||F.createNullProtoObjWherePossible(),$=g||F.createNullProtoObjWherePossible();if(arguments.length==2)F.shallowCopyFromList($,A,Gf);return U($,f)(A)};Wf.renderFile=function(){var f=Array.prototype.slice.call(arguments),w=f.shift(),g,A={filename:w},$,j;if(typeof arguments[arguments.length-1]=="function")g=f.pop();if(f.length){if($=f.shift(),f.length)F.shallowCopy(A,f.pop());else{if($.settings){if($.settings.views)A.views=$.settings.views;if($.settings["view cache"])A.cache=!0;if(j=$.settings["view options"],j)F.shallowCopy(A,j)}F.shallowCopyFromList(A,$,j1)}A.filename=w}else $=F.createNullProtoObjWherePossible();return J1(A,$,g)};Wf.Template=Q;Wf.clearCache=function(){Wf.cache.reset()};function Q(f,w){var g=F.hasOwnOnlyObject(w),A=F.createNullProtoObjWherePossible();if(this.templateText=f,this.mode=null,this.truncate=!1,this.currentLine=1,this.source="",A.client=g.client||!1,A.escapeFunction=g.escape||g.escapeFunction||F.escapeXML,A.compileDebug=g.compileDebug!==!1,A.debug=!!g.debug,A.filename=g.filename,A.openDelimiter=g.openDelimiter||Wf.openDelimiter||f1,A.closeDelimiter=g.closeDelimiter||Wf.closeDelimiter||g1,A.delimiter=g.delimiter||Wf.delimiter||w1,A.strict=g.strict||!1,A.context=g.context,A.cache=g.cache||!1,A.rmWhitespace=g.rmWhitespace,A.root=g.root,A.includer=g.includer,A.outputFunctionName=g.outputFunctionName,A.localsName=g.localsName||Wf.localsName||Cf,A.views=g.views,A.async=g.async,A.destructuredLocals=g.destructuredLocals,A.legacyInclude=typeof g.legacyInclude!="undefined"?!!g.legacyInclude:!0,A.strict)A._with=!1;else A._with=typeof g._with!="undefined"?g._with:!0;this.opts=A,this.regex=this.createRegex()}Q.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Q.prototype={createRegex:function(){var f=$1,w=F.escapeRegExpChars(this.opts.delimiter),g=F.escapeRegExpChars(this.opts.openDelimiter),A=F.escapeRegExpChars(this.opts.closeDelimiter);return f=f.replace(/%/g,w).replace(/</g,g).replace(/>/g,A),new RegExp(f)},compile:function(){var f,w,g=this.opts,A="",$="",j=g.escapeFunction,z,J=g.filename?JSON.stringify(g.filename):"undefined";if(!this.source){if(this.generateSource(),A+=` var __output = "";
|
|
19
19
|
function __append(s) { if (s !== undefined && s !== null) __output += s }
|
|
20
20
|
`,g.outputFunctionName){if(!E.test(g.outputFunctionName))throw new Error("outputFunctionName is not a valid JS identifier.");A+=" var "+g.outputFunctionName+` = __append;
|
|
21
21
|
`}if(g.localsName&&!E.test(g.localsName))throw new Error("localsName is not a valid JS identifier.");if(g.destructuredLocals&&g.destructuredLocals.length){var Z=" var __locals = ("+g.localsName+` || {}),
|
|
22
|
-
`;for(var
|
|
22
|
+
`;for(var B=0;B<g.destructuredLocals.length;B++){var Y=g.destructuredLocals[B];if(!E.test(Y))throw new Error("destructuredLocals["+B+"] is not a valid JS identifier.");if(B>0)Z+=`,
|
|
23
23
|
`;Z+=Y+" = __locals."+Y}A+=Z+`;
|
|
24
24
|
`}if(g._with!==!1)A+=" with ("+g.localsName+` || {}) {
|
|
25
25
|
`,$+=` }
|
|
@@ -32,7 +32,7 @@ try {
|
|
|
32
32
|
rethrow(e, __lines, __filename, __line, escapeFn);
|
|
33
33
|
}
|
|
34
34
|
`;else f=this.source;if(g.client){if(f="escapeFn = escapeFn || "+j.toString()+`;
|
|
35
|
-
`+f,g.compileDebug)f="rethrow = rethrow || "+
|
|
35
|
+
`+f,g.compileDebug)f="rethrow = rethrow || "+Qf.toString()+`;
|
|
36
36
|
`+f}if(g.strict)f=`"use strict";
|
|
37
37
|
`+f;if(g.debug)console.log(f);if(g.compileDebug&&g.filename)f=f+`
|
|
38
38
|
//# sourceURL=`+J+`
|
|
@@ -40,7 +40,7 @@ try {
|
|
|
40
40
|
|
|
41
41
|
`,X.message+=`If the above error is not helpful, you may want to try EJS-Lint:
|
|
42
42
|
`,X.message+="https://github.com/RyanZim/EJS-Lint",!g.async)X.message+=`
|
|
43
|
-
`,X.message+="Or, if you meant to create an async function, pass `async: true` as an option."}throw X}var
|
|
43
|
+
`,X.message+="Or, if you meant to create an async function, pass `async: true` as an option."}throw X}var G=g.client?w:function X(x){var Of=function(Lf,r){var O=F.shallowCopy(F.createNullProtoObjWherePossible(),x);if(r)O=F.shallowCopy(O,r);return Y1(Lf,g)(O)};return w.apply(g.context,[x||F.createNullProtoObjWherePossible(),j,Of,Qf])};if(g.filename&&typeof Object.defineProperty==="function"){var V=g.filename,C=R.basename(V,R.extname(V));try{Object.defineProperty(G,"name",{value:C,writable:!1,enumerable:!1,configurable:!0})}catch(X){}}return G},generateSource:function(){var f=this.opts;if(f.rmWhitespace)this.templateText=this.templateText.replace(/[\r\n]+/g,`
|
|
44
44
|
`).replace(/^\s+|\s+$/gm,"");this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var w=this,g=this.parseTemplateText(),A=this.opts.delimiter,$=this.opts.openDelimiter,j=this.opts.closeDelimiter;if(g&&g.length)g.forEach(function(z,J){var Z;if(z.indexOf($+A)===0&&z.indexOf($+A+A)!==0){if(Z=g[J+2],!(Z==A+j||Z=="-"+A+j||Z=="_"+A+j))throw new Error('Could not find matching close tag for "'+z+'".')}w.scanLine(z)})},parseTemplateText:function(){var f=this.templateText,w=this.regex,g=w.exec(f),A=[],$;while(g){if($=g.index,$!==0)A.push(f.substring(0,$)),f=f.slice($);A.push(g[0]),f=f.slice(g[0].length),g=w.exec(f)}if(f)A.push(f);return A},_addOutput:function(f){if(this.truncate)f=f.replace(/^(?:\r\n|\r|\n)/,""),this.truncate=!1;if(!f)return f;f=f.replace(/\\/g,"\\\\"),f=f.replace(/\n/g,"\\n"),f=f.replace(/\r/g,"\\r"),f=f.replace(/"/g,"\\\""),this.source+=' ; __append("'+f+`")
|
|
45
45
|
`},scanLine:function(f){var w=this,g=this.opts.delimiter,A=this.opts.openDelimiter,$=this.opts.closeDelimiter,j=0;switch(j=f.split(`
|
|
46
46
|
`).length-1,f){case A+g:case A+g+"_":this.mode=Q.modes.EVAL;break;case A+g+"=":this.mode=Q.modes.ESCAPED;break;case A+g+"-":this.mode=Q.modes.RAW;break;case A+g+"#":this.mode=Q.modes.COMMENT;break;case A+g+g:this.mode=Q.modes.LITERAL,this.source+=' ; __append("'+f.replace(A+g+g,A+g)+`")
|
|
@@ -48,7 +48,7 @@ try {
|
|
|
48
48
|
`;break;case g+$:case"-"+g+$:case"_"+g+$:if(this.mode==Q.modes.LITERAL)this._addOutput(f);this.mode=null,this.truncate=f.indexOf("-")===0||f.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case Q.modes.EVAL:case Q.modes.ESCAPED:case Q.modes.RAW:if(f.lastIndexOf("//")>f.lastIndexOf(`
|
|
49
49
|
`))f+=`
|
|
50
50
|
`}switch(this.mode){case Q.modes.EVAL:this.source+=" ; "+f+`
|
|
51
|
-
`;break;case Q.modes.ESCAPED:this.source+=" ; __append(escapeFn("+
|
|
52
|
-
`;break;case Q.modes.RAW:this.source+=" ; __append("+
|
|
51
|
+
`;break;case Q.modes.ESCAPED:this.source+=" ; __append(escapeFn("+Xf(f)+`))
|
|
52
|
+
`;break;case Q.modes.RAW:this.source+=" ; __append("+Xf(f)+`)
|
|
53
53
|
`;break;case Q.modes.COMMENT:break;case Q.modes.LITERAL:this._addOutput(f);break}}else this._addOutput(f)}if(w.opts.compileDebug&&j)this.currentLine+=j,this.source+=" ; __line = "+this.currentLine+`
|
|
54
|
-
`}};
|
|
54
|
+
`}};Wf.escapeXML=F.escapeXML;Wf.__express=Wf.renderFile;Wf.VERSION=ef;Wf.name=A1;if(typeof window!="undefined")window.ejs=Wf});function D(f){switch(f.split(".").pop()?.toLowerCase()){case"js":return"application/javascript";case"css":return"text/css";case"html":return"text/html";case"json":return"application/json";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"woff":return"font/woff";case"woff2":return"font/woff2";default:return"application/octet-stream"}}var y=null;async function W1(){if(!y){let f=await Promise.resolve().then(() => Ef(Hf(),1));y=f.default||f}return y}var M1={string:"text/plain; charset=utf-8",object:"application/json; charset=utf-8",Uint8Array:"application/octet-stream",ArrayBuffer:"application/octet-stream"};class P{req;server;path;routePattern;paramNames;env;executionContext;headers=new Headers;parsedQuery=null;parsedParams=null;parsedCookies=null;parsedBody=null;contextData={};urlObject=null;constructor(f,w,g,A,$,j,z){this.req=f,this.server=w,this.path=g,this.routePattern=A,this.executionContext=z,this.env=j,this.paramNames=$}setHeader(f,w){return this.headers.set(f,w),this}removeHeader(f){return this.headers.delete(f),this}set(f,w){return this.contextData[f]=w,this}get(f){return this.contextData[f]}get ip(){if(this.server)return this.server.requestIP(this.req)?.address??null;return this.req.headers.get("CF-Connecting-IP")||null}get url(){if(!this.urlObject)this.urlObject=new URL(this.req.url);return this.urlObject}get query(){if(!this.parsedQuery)this.parsedQuery=this.url.search?Object.fromEntries(this.url.searchParams):{};return this.parsedQuery}get params(){if(!Array.isArray(this.paramNames))return this.paramNames;if(!this.parsedParams)try{this.parsedParams=U1(this.paramNames,this.path)}catch(f){let w=f instanceof Error?f.message:String(f);throw new Error(`Failed to extract route parameters: ${w}`)}return this.parsedParams??{}}get body(){if(this.req.method==="GET")return Promise.resolve({});if(!this.parsedBody)this.parsedBody=(async()=>{try{let f=await H1(this.req);if(f.error)throw new Error(f.error);return Object.keys(f).length===0?null:f}catch(f){throw new Error("Invalid request body format")}})();return this.parsedBody}text(f,w=200){return new Response(f,{status:w,headers:this.headers})}send(f,w=200){let g;if(f instanceof Uint8Array)g="Uint8Array";else if(f instanceof ArrayBuffer)g="ArrayBuffer";else g=typeof f;if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",M1[g]??"text/plain; charset=utf-8");let A=g==="object"&&f!==null?JSON.stringify(f):f;return new Response(A,{status:w,headers:this.headers})}json(f,w=200){return Response.json(f,{status:w,headers:this.headers})}file(f,w,g=200){let A=Bun.file(f);if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",w??D(f));return new Response(A,{status:g,headers:this.headers})}async ejs(f,w={},g=200){let A=await W1();try{let $=await Bun.file(f).text(),j=A.render($,w),z=new Headers({"Content-Type":"text/html; charset=utf-8"});return new Response(j,{status:g,headers:z})}catch($){return console.error("EJS Rendering Error:",$),new Response("Error rendering template",{status:500})}}redirect(f,w=302){return this.headers.set("Location",f),new Response(null,{status:w,headers:this.headers})}setCookie(f,w,g={}){let A=`${encodeURIComponent(f)}=${encodeURIComponent(w)}`;if(g.maxAge)A+=`; Max-Age=${g.maxAge}`;if(g.expires)A+=`; Expires=${g.expires.toUTCString()}`;if(g.path)A+=`; Path=${g.path}`;if(g.domain)A+=`; Domain=${g.domain}`;if(g.secure)A+="; Secure";if(g.httpOnly)A+="; HttpOnly";if(g.sameSite)A+=`; SameSite=${g.sameSite}`;return this.headers.append("Set-Cookie",A),this}get cookies(){if(!this.parsedCookies){let f=this.req.headers.get("cookie");this.parsedCookies=f?R1(f):{}}return this.parsedCookies}stream(f){let w=new Headers(this.headers),g=new ReadableStream({async start(A){await f(A),A.close()}});return new Response(g,{headers:w})}yieldStream(f){return new Response}}function R1(f){return Object.fromEntries(f.split(";").map((w)=>{let[g,...A]=w.trim().split("=");return[g,decodeURIComponent(A.join("="))]}))}function U1(f,w){let g={},[A]=w.split("?"),$=A.split("/").filter((z)=>z!==""),j=$.length-f.length;for(let z=0;z<f.length;z++)g[f[z]]=$[j+z];return g}function P1(f,w){let g={},A=f.split("/"),[$]=w.split("?"),j=$.split("/");if(A.length!==j.length)return null;for(let z=0;z<A.length;z++){let J=A[z];if(J.charCodeAt(0)===58)g[J.slice(1)]=j[z]}return g}async function H1(f){let w=f.headers.get("Content-Type")||"";if(!w)return{};if(f.headers.get("Content-Length")==="0"||!f.body)return{};if(w.startsWith("application/json"))return await f.json();if(w.startsWith("application/x-www-form-urlencoded")){let A=await f.text();return Object.fromEntries(new URLSearchParams(A))}if(w.startsWith("multipart/form-data")){let A=await f.formData(),$={};for(let[j,z]of A.entries())$[j]=z;return $}return{error:"Unknown request body type"}}var D1=(f,w)=>{try{return w(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(g)=>{try{return w(g)}catch{return g}})}},_=(f)=>D1(f,decodeURI),k1=(f)=>{let w=f.indexOf("/",f.indexOf(":")+4),g=w;for(;g<f.length;g++){let A=f.charCodeAt(g);if(A===37){let $=f.indexOf("?",g),j=f.slice(w,$===-1?void 0:$);return _(j.includes("%25")?j.replace(/%25/g,"%2525"):j)}else if(A===63)break}return f.slice(w,g)};var H=(f)=>f!==null&&typeof f==="object"&&typeof f.then==="function",Df=(f)=>f!==null&&typeof f==="object"&&typeof f.status==="number"&&typeof f.headers==="object";async function k(f,w,g){if(!w?.length)return;for(let A=0;A<w.length;A++){let $=w[A](...g),j=$ instanceof Promise?await $:$;if(j&&f!=="onRequest")return j}}async function Kf(f,w,g){let A=f.globalMiddlewares;if(A.length)for(let j of A){let z=await j(g);if(z)return z}let $=f.middlewares.get(w);if($&&$.length)for(let j of $){let z=await j(g);if(z)return z}return null}async function i1(f,w,g){for(let A of f){let $=await A(w,g);if($)return $}}async function vf(f,w,g){let A=await K1(f,w,g),$=H(A)?await A:A;if($)return $}async function K1(f,w,g){if(w.endsWith("/"))w=w.slice(0,-1);if(!f.filters.has(w))if(f.filterFunction.length)for(let A of f.filterFunction){let $=await A(g);if($)return $}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function Nf(f,w,g){if(f.staticPath){let J=!0;if(f.staticRequestPath)J=g.startsWith(f.staticRequestPath);if(J){let Z=await v1(f,g,w);if(Z)return Z}}let j=(f.router.find(w.req.method,"*")?.handler).slice(-1);if(j.length>0){let J=await j[0](w);if(Df(J))return J}let z=f.routeNotFoundFunc(w);return z instanceof Promise?await z:z||I(404,`404 Route not found for ${g}`)}function I(f,w){return new Response(JSON.stringify({error:w}),{status:f,headers:{"Content-Type":"application/json"}})}async function v1(f,w,g){if(!f.staticPath)return null;let A=`${f.staticPath}${w}`;if(await Bun.file(A).exists()){let j=D(A);return g.file(A,j,200)}return null}async function N1(f,w,g,A,$){let j,z=f.url.indexOf("/",f.url.indexOf(":")+4),J=z;for(;J<f.url.length;J++){let V=f.url.charCodeAt(J);if(V===37){let C=f.url.indexOf("?",J),X=f.url.slice(z,C===-1?void 0:C);j=_(X.includes("%25")?X.replace(/%25/g,"%2525"):X);break}else if(V===63)break}if(!j)j=f.url.slice(z,J);let Z=g.router.find(f.method,j),B=new P(f,w,j,Z?.path,A,$);if(g.hasMiddleware){let V=await Kf(g,j,B);if(V)return V}if(g.hasFilterEnabled){let V=await vf(g,j,B);if(V)return V}if(g.hasPreHandlerHook){let V=await k("preHandler",g.hooks.preHandler,[B]);if(V)return V}let Y,G=Z?.handler;if(G.length===1){let V=G[0](B);Y=H(V)?await V:V}else for(let V=0;V<G.length;V++){let C=G[V](B);if(Y=H(C)?await C:C,Y)break}if(g.hasOnSendHook){let V=await k("onSend",g.hooks.onSend,[B,Y]);if(V)return V}return Y??await Nf(g,B,j)}export{N1 as default};
|
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompileConfig, ContextType, corsT, DieselOptions, errorFormat, FilterMethods, HookType, listenArgsT, middlewareFunc, RouteHandler, RouteNotFoundHandler, type Hooks } from "./types.js";
|
|
1
|
+
import { CompileConfig, ContextType, corsT, DieselOptions, errorFormat, FilterMethods, HookType, listenArgsT, middlewareFunc, RouteHandler, RouteNotFoundHandler, type handlerFunction, type Hooks, type HttpMethod } from "./types.js";
|
|
2
2
|
import { Server } from "bun";
|
|
3
3
|
import { AdvancedLoggerOptions, LoggerOptions } from "./middlewares/logger/logger.js";
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
@@ -54,7 +54,6 @@ export default class Diesel {
|
|
|
54
54
|
*/
|
|
55
55
|
setupFilter(): FilterMethods;
|
|
56
56
|
redirect(incomingPath: string, redirectPath: string, statusCode?: 302): this;
|
|
57
|
-
serveStatic(filePath: string, requestPath?: string): this;
|
|
58
57
|
static(path: string, requestPath?: string): this;
|
|
59
58
|
staticHtml(args: Record<string, string>): this;
|
|
60
59
|
addHooks<T extends HookType>(typeOfHook: T, fnc: Hooks[T][number]): this;
|
|
@@ -93,6 +92,7 @@ export default class Diesel {
|
|
|
93
92
|
*/
|
|
94
93
|
use(pathORHandler?: string | string[] | middlewareFunc | middlewareFunc[] | Function | Function[], ...handlers: middlewareFunc | middlewareFunc[] | Function | Function[] | any): this;
|
|
95
94
|
routeNotFound(handler: RouteNotFoundHandler): this;
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
onMethod(methods: string | (HttpMethod | string)[], path: string, ...handlers: handlerFunction[]): this;
|
|
96
|
+
on(event: string | symbol, listener: EventListener): this;
|
|
97
|
+
emit(event: string | symbol, ...args: any): this;
|
|
98
98
|
}
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var XZ=Object.create;var{getPrototypeOf:WZ,defineProperty:W1,getOwnPropertyNames:Y4,getOwnPropertyDescriptor:wZ}=Object,X4=Object.prototype.hasOwnProperty;var W4=(f,$,Z)=>{Z=f!=null?XZ(WZ(f)):{};let J=$||!f||!f.__esModule?W1(Z,"default",{value:f,enumerable:!0}):Z;for(let z of Y4(f))if(!X4.call(J,z))W1(J,z,{get:()=>f[z],enumerable:!0});return J},Q4=new WeakMap,o0=(f)=>{var $=Q4.get(f),Z;if($)return $;if($=W1({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function")Y4(f).map((J)=>!X4.call($,J)&&W1($,J,{get:()=>f[J],enumerable:!(Z=wZ(f,J))||Z.enumerable}));return Q4.set(f,$),$},Z0=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports);var
|
|
1
|
+
var XZ=Object.create;var{getPrototypeOf:WZ,defineProperty:W1,getOwnPropertyNames:Y4,getOwnPropertyDescriptor:wZ}=Object,X4=Object.prototype.hasOwnProperty;var W4=(f,$,Z)=>{Z=f!=null?XZ(WZ(f)):{};let J=$||!f||!f.__esModule?W1(Z,"default",{value:f,enumerable:!0}):Z;for(let z of Y4(f))if(!X4.call(J,z))W1(J,z,{get:()=>f[z],enumerable:!0});return J},Q4=new WeakMap,o0=(f)=>{var $=Q4.get(f),Z;if($)return $;if($=W1({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function")Y4(f).map((J)=>!X4.call($,J)&&W1($,J,{get:()=>f[J],enumerable:!(Z=wZ(f,J))||Z.enumerable}));return Q4.set(f,$),$},Z0=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports);var Jf=(f,$)=>{for(var Z in $)W1(f,Z,{get:$[Z],enumerable:!0,configurable:!0,set:(J)=>$[Z]=()=>J})};var zf=(f,$)=>()=>(f&&($=f(f=0)),$);var HZ=((f)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy(f,{get:($,Z)=>(typeof require!=="undefined"?require:$)[Z]}):f)(function(f){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});var q4={};Jf(q4,{sep:()=>L4,resolve:()=>j1,relative:()=>U4,posix:()=>A4,parse:()=>O4,normalize:()=>Qf,join:()=>V4,isAbsolute:()=>H4,format:()=>D4,extname:()=>K4,dirname:()=>F4,delimiter:()=>M4,default:()=>UZ,basename:()=>G4,_makeLong:()=>B4});function v0(f){if(typeof f!=="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(f))}function w4(f,$){var Z="",J=0,z=-1,Q=0,Y;for(var X=0;X<=f.length;++X){if(X<f.length)Y=f.charCodeAt(X);else if(Y===47)break;else Y=47;if(Y===47){if(z===X-1||Q===1);else if(z!==X-1&&Q===2){if(Z.length<2||J!==2||Z.charCodeAt(Z.length-1)!==46||Z.charCodeAt(Z.length-2)!==46){if(Z.length>2){var W=Z.lastIndexOf("/");if(W!==Z.length-1){if(W===-1)Z="",J=0;else Z=Z.slice(0,W),J=Z.length-1-Z.lastIndexOf("/");z=X,Q=0;continue}}else if(Z.length===2||Z.length===1){Z="",J=0,z=X,Q=0;continue}}if($){if(Z.length>0)Z+="/..";else Z="..";J=2}}else{if(Z.length>0)Z+="/"+f.slice(z+1,X);else Z=f.slice(z+1,X);J=X-z-1}z=X,Q=0}else if(Y===46&&Q!==-1)++Q;else Q=-1}return Z}function VZ(f,$){var Z=$.dir||$.root,J=$.base||($.name||"")+($.ext||"");if(!Z)return J;if(Z===$.root)return Z+J;return Z+f+J}function j1(){var f="",$=!1,Z;for(var J=arguments.length-1;J>=-1&&!$;J--){var z;if(J>=0)z=arguments[J];else{if(Z===void 0)Z=process.cwd();z=Z}if(v0(z),z.length===0)continue;f=z+"/"+f,$=z.charCodeAt(0)===47}if(f=w4(f,!$),$)if(f.length>0)return"/"+f;else return"/";else if(f.length>0)return f;else return"."}function Qf(f){if(v0(f),f.length===0)return".";var $=f.charCodeAt(0)===47,Z=f.charCodeAt(f.length-1)===47;if(f=w4(f,!$),f.length===0&&!$)f=".";if(f.length>0&&Z)f+="/";if($)return"/"+f;return f}function H4(f){return v0(f),f.length>0&&f.charCodeAt(0)===47}function V4(){if(arguments.length===0)return".";var f;for(var $=0;$<arguments.length;++$){var Z=arguments[$];if(v0(Z),Z.length>0)if(f===void 0)f=Z;else f+="/"+Z}if(f===void 0)return".";return Qf(f)}function U4(f,$){if(v0(f),v0($),f===$)return"";if(f=j1(f),$=j1($),f===$)return"";var Z=1;for(;Z<f.length;++Z)if(f.charCodeAt(Z)!==47)break;var J=f.length,z=J-Z,Q=1;for(;Q<$.length;++Q)if($.charCodeAt(Q)!==47)break;var Y=$.length,X=Y-Q,W=z<X?z:X,H=-1,w=0;for(;w<=W;++w){if(w===W){if(X>W){if($.charCodeAt(Q+w)===47)return $.slice(Q+w+1);else if(w===0)return $.slice(Q+w)}else if(z>W){if(f.charCodeAt(Z+w)===47)H=w;else if(w===0)H=0}break}var K=f.charCodeAt(Z+w),O=$.charCodeAt(Q+w);if(K!==O)break;else if(K===47)H=w}var j="";for(w=Z+H+1;w<=J;++w)if(w===J||f.charCodeAt(w)===47)if(j.length===0)j+="..";else j+="/..";if(j.length>0)return j+$.slice(Q+H);else{if(Q+=H,$.charCodeAt(Q)===47)++Q;return $.slice(Q)}}function B4(f){return f}function F4(f){if(v0(f),f.length===0)return".";var $=f.charCodeAt(0),Z=$===47,J=-1,z=!0;for(var Q=f.length-1;Q>=1;--Q)if($=f.charCodeAt(Q),$===47){if(!z){J=Q;break}}else z=!1;if(J===-1)return Z?"/":".";if(Z&&J===1)return"//";return f.slice(0,J)}function G4(f,$){if($!==void 0&&typeof $!=="string")throw new TypeError('"ext" argument must be a string');v0(f);var Z=0,J=-1,z=!0,Q;if($!==void 0&&$.length>0&&$.length<=f.length){if($.length===f.length&&$===f)return"";var Y=$.length-1,X=-1;for(Q=f.length-1;Q>=0;--Q){var W=f.charCodeAt(Q);if(W===47){if(!z){Z=Q+1;break}}else{if(X===-1)z=!1,X=Q+1;if(Y>=0)if(W===$.charCodeAt(Y)){if(--Y===-1)J=Q}else Y=-1,J=X}}if(Z===J)J=X;else if(J===-1)J=f.length;return f.slice(Z,J)}else{for(Q=f.length-1;Q>=0;--Q)if(f.charCodeAt(Q)===47){if(!z){Z=Q+1;break}}else if(J===-1)z=!1,J=Q+1;if(J===-1)return"";return f.slice(Z,J)}}function K4(f){v0(f);var $=-1,Z=0,J=-1,z=!0,Q=0;for(var Y=f.length-1;Y>=0;--Y){var X=f.charCodeAt(Y);if(X===47){if(!z){Z=Y+1;break}continue}if(J===-1)z=!1,J=Y+1;if(X===46){if($===-1)$=Y;else if(Q!==1)Q=1}else if($!==-1)Q=-1}if($===-1||J===-1||Q===0||Q===1&&$===J-1&&$===Z+1)return"";return f.slice($,J)}function D4(f){if(f===null||typeof f!=="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof f);return VZ("/",f)}function O4(f){v0(f);var $={root:"",dir:"",base:"",ext:"",name:""};if(f.length===0)return $;var Z=f.charCodeAt(0),J=Z===47,z;if(J)$.root="/",z=1;else z=0;var Q=-1,Y=0,X=-1,W=!0,H=f.length-1,w=0;for(;H>=z;--H){if(Z=f.charCodeAt(H),Z===47){if(!W){Y=H+1;break}continue}if(X===-1)W=!1,X=H+1;if(Z===46){if(Q===-1)Q=H;else if(w!==1)w=1}else if(Q!==-1)w=-1}if(Q===-1||X===-1||w===0||w===1&&Q===X-1&&Q===Y+1){if(X!==-1)if(Y===0&&J)$.base=$.name=f.slice(1,X);else $.base=$.name=f.slice(Y,X)}else{if(Y===0&&J)$.name=f.slice(1,Q),$.base=f.slice(1,X);else $.name=f.slice(Y,Q),$.base=f.slice(Y,X);$.ext=f.slice(Q,X)}if(Y>0)$.dir=f.slice(0,Y-1);else if(J)$.dir="/";return $}var L4="/",M4=":",A4,UZ;var j4=zf(()=>{A4=((f)=>(f.posix=f,f))({resolve:j1,normalize:Qf,isAbsolute:H4,join:V4,relative:U4,_makeLong:B4,dirname:F4,basename:G4,extname:K4,format:D4,parse:O4,sep:L4,delimiter:M4,win32:null,posix:null}),UZ=A4});var N4=Z0((LZ)=>{var BZ=/[|\\{}()[\]^$+*?.]/g,FZ=Object.prototype.hasOwnProperty,Xf=function(f,$){return FZ.apply(f,[$])};LZ.escapeRegExpChars=function(f){if(!f)return"";return String(f).replace(BZ,"\\$&")};var GZ={"&":"&","<":"<",">":">",'"':""","'":"'"},KZ=/[&<>'"]/g;function DZ(f){return GZ[f]||f}var OZ=`var _ENCODE_HTML_RULES = {
|
|
2
2
|
"&": "&"
|
|
3
3
|
, "<": "<"
|
|
4
4
|
, ">": ">"
|
|
@@ -10,16 +10,16 @@ function encode_char(c) {
|
|
|
10
10
|
return _ENCODE_HTML_RULES[c] || c;
|
|
11
11
|
};
|
|
12
12
|
`;LZ.escapeXML=function(f){return f==null?"":String(f).replace(KZ,DZ)};function T4(){return Function.prototype.toString.call(this)+`;
|
|
13
|
-
`+OZ}try{if(typeof Object.defineProperty==="function")Object.defineProperty(LZ.escapeXML,"toString",{value:T4});else LZ.escapeXML.toString=T4}catch(f){console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)")}LZ.shallowCopy=function(f,$){if($=$||{},f!==null&&f!==void 0)for(var Z in $){if(!
|
|
13
|
+
`+OZ}try{if(typeof Object.defineProperty==="function")Object.defineProperty(LZ.escapeXML,"toString",{value:T4});else LZ.escapeXML.toString=T4}catch(f){console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)")}LZ.shallowCopy=function(f,$){if($=$||{},f!==null&&f!==void 0)for(var Z in $){if(!Xf($,Z))continue;if(Z==="__proto__"||Z==="constructor")continue;f[Z]=$[Z]}return f};LZ.shallowCopyFromList=function(f,$,Z){if(Z=Z||[],$=$||{},f!==null&&f!==void 0)for(var J=0;J<Z.length;J++){var z=Z[J];if(typeof $[z]!="undefined"){if(!Xf($,z))continue;if(z==="__proto__"||z==="constructor")continue;f[z]=$[z]}}return f};LZ.cache={_data:{},set:function(f,$){this._data[f]=$},get:function(f){return this._data[f]},remove:function(f){delete this._data[f]},reset:function(){this._data={}}};LZ.hyphenToCamel=function(f){return f.replace(/-[a-z]/g,function($){return $[1].toUpperCase()})};LZ.createNullProtoObjWherePossible=function(){if(typeof Object.create=="function")return function(){return Object.create(null)};if(!({__proto__:null}instanceof Object))return function(){return{__proto__:null}};return function(){return{}}}();LZ.hasOwnOnlyObject=function(f){var $=LZ.createNullProtoObjWherePossible();for(var Z in f)if(Xf(f,Z))$[Z]=f[Z];return $}});var R4=Z0((w6,NZ)=>{NZ.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.1.10",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",bin:{ejs:"./bin/cli.js"},main:"./lib/ejs.js",jsdelivr:"ejs.min.js",unpkg:"ejs.min.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{jake:"^10.8.5"},devDependencies:{browserify:"^16.5.1",eslint:"^6.8.0","git-directory-deploy":"^1.5.1",jsdoc:"^4.0.2","lru-cache":"^4.0.1",mocha:"^10.2.0","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"npx jake test"}}});var c4=Z0((x4)=>{var Hf=(()=>({})),w1=(j4(),o0(q4)),G0=N4(),I4=!1,RZ=R4().version,IZ="<",SZ=">",PZ="%",v4="locals",EZ="ejs",bZ="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)",g4=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"],_Z=g4.concat("cache"),S4=/^\uFEFF/,Wf=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;x4.cache=G0.cache;x4.fileLoader=Hf.readFileSync;x4.localsName=v4;x4.promiseImpl=new Function("return this;")().Promise;x4.resolveInclude=function(f,$,Z){var{dirname:J,extname:z,resolve:Q}=w1,Y=Q(Z?$:J($),f),X=z(f);if(!X)Y+=".ejs";return Y};function P4(f,$){var Z;if($.some(function(J){return Z=x4.resolveInclude(f,J,!0),Hf.existsSync(Z)}))return Z}function vZ(f,$){var Z,J,z=$.views,Q=/^[A-Za-z]+:\\|^\//.exec(f);if(Q&&Q.length)if(f=f.replace(/^\/*/,""),Array.isArray($.root))Z=P4(f,$.root);else Z=x4.resolveInclude(f,$.root||"/",!0);else{if($.filename){if(J=x4.resolveInclude(f,$.filename),Hf.existsSync(J))Z=J}if(!Z&&Array.isArray(z))Z=P4(f,z);if(!Z&&typeof $.includer!=="function")throw new Error('Could not find the include file "'+$.escapeFunction(f)+'"')}return Z}function H1(f,$){var Z,J=f.filename,z=arguments.length>1;if(f.cache){if(!J)throw new Error("cache option requires a filename");if(Z=x4.cache.get(J),Z)return Z;if(!z)$=E4(J).toString().replace(S4,"")}else if(!z){if(!J)throw new Error("Internal EJS error: no file name or template provided");$=E4(J).toString().replace(S4,"")}if(Z=x4.compile($,f),f.cache)x4.cache.set(J,Z);return Z}function gZ(f,$,Z){var J;if(!Z)if(typeof x4.promiseImpl=="function")return new x4.promiseImpl(function(z,Q){try{J=H1(f)($),z(J)}catch(Y){Q(Y)}});else throw new Error("Please provide a callback function");else{try{J=H1(f)($)}catch(z){return Z(z)}Z(null,J)}}function E4(f){return x4.fileLoader(f)}function xZ(f,$){var Z=G0.shallowCopy(G0.createNullProtoObjWherePossible(),$);if(Z.filename=vZ(f,Z),typeof $.includer==="function"){var J=$.includer(f,Z.filename);if(J){if(J.filename)Z.filename=J.filename;if(J.template)return H1(Z,J.template)}}return H1(Z)}function b4(f,$,Z,J,z){var Q=$.split(`
|
|
14
14
|
`),Y=Math.max(J-3,0),X=Math.min(Q.length,J+3),W=z(Z),H=Q.slice(Y,X).map(function(w,K){var O=K+Y+1;return(O==J?" >> ":" ")+O+"| "+w}).join(`
|
|
15
15
|
`);throw f.path=W,f.message=(W||"ejs")+":"+J+`
|
|
16
16
|
`+H+`
|
|
17
17
|
|
|
18
18
|
`+f.message,f}function _4(f){return f.replace(/;(\s*$)/,"$1")}x4.compile=function f($,Z){var J;if(Z&&Z.scope){if(!I4)console.warn("`scope` option is deprecated and will be removed in EJS 3"),I4=!0;if(!Z.context)Z.context=Z.scope;delete Z.scope}return J=new M0($,Z),J.compile()};x4.render=function(f,$,Z){var J=$||G0.createNullProtoObjWherePossible(),z=Z||G0.createNullProtoObjWherePossible();if(arguments.length==2)G0.shallowCopyFromList(z,J,g4);return H1(z,f)(J)};x4.renderFile=function(){var f=Array.prototype.slice.call(arguments),$=f.shift(),Z,J={filename:$},z,Q;if(typeof arguments[arguments.length-1]=="function")Z=f.pop();if(f.length){if(z=f.shift(),f.length)G0.shallowCopy(J,f.pop());else{if(z.settings){if(z.settings.views)J.views=z.settings.views;if(z.settings["view cache"])J.cache=!0;if(Q=z.settings["view options"],Q)G0.shallowCopy(J,Q)}G0.shallowCopyFromList(J,z,_Z)}J.filename=$}else z=G0.createNullProtoObjWherePossible();return gZ(J,z,Z)};x4.Template=M0;x4.clearCache=function(){x4.cache.reset()};function M0(f,$){var Z=G0.hasOwnOnlyObject($),J=G0.createNullProtoObjWherePossible();if(this.templateText=f,this.mode=null,this.truncate=!1,this.currentLine=1,this.source="",J.client=Z.client||!1,J.escapeFunction=Z.escape||Z.escapeFunction||G0.escapeXML,J.compileDebug=Z.compileDebug!==!1,J.debug=!!Z.debug,J.filename=Z.filename,J.openDelimiter=Z.openDelimiter||x4.openDelimiter||IZ,J.closeDelimiter=Z.closeDelimiter||x4.closeDelimiter||SZ,J.delimiter=Z.delimiter||x4.delimiter||PZ,J.strict=Z.strict||!1,J.context=Z.context,J.cache=Z.cache||!1,J.rmWhitespace=Z.rmWhitespace,J.root=Z.root,J.includer=Z.includer,J.outputFunctionName=Z.outputFunctionName,J.localsName=Z.localsName||x4.localsName||v4,J.views=Z.views,J.async=Z.async,J.destructuredLocals=Z.destructuredLocals,J.legacyInclude=typeof Z.legacyInclude!="undefined"?!!Z.legacyInclude:!0,J.strict)J._with=!1;else J._with=typeof Z._with!="undefined"?Z._with:!0;this.opts=J,this.regex=this.createRegex()}M0.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};M0.prototype={createRegex:function(){var f=bZ,$=G0.escapeRegExpChars(this.opts.delimiter),Z=G0.escapeRegExpChars(this.opts.openDelimiter),J=G0.escapeRegExpChars(this.opts.closeDelimiter);return f=f.replace(/%/g,$).replace(/</g,Z).replace(/>/g,J),new RegExp(f)},compile:function(){var f,$,Z=this.opts,J="",z="",Q=Z.escapeFunction,Y,X=Z.filename?JSON.stringify(Z.filename):"undefined";if(!this.source){if(this.generateSource(),J+=` var __output = "";
|
|
19
19
|
function __append(s) { if (s !== undefined && s !== null) __output += s }
|
|
20
|
-
`,Z.outputFunctionName){if(!
|
|
21
|
-
`}if(Z.localsName&&!
|
|
22
|
-
`;for(var H=0;H<Z.destructuredLocals.length;H++){var w=Z.destructuredLocals[H];if(!
|
|
20
|
+
`,Z.outputFunctionName){if(!Wf.test(Z.outputFunctionName))throw new Error("outputFunctionName is not a valid JS identifier.");J+=" var "+Z.outputFunctionName+` = __append;
|
|
21
|
+
`}if(Z.localsName&&!Wf.test(Z.localsName))throw new Error("localsName is not a valid JS identifier.");if(Z.destructuredLocals&&Z.destructuredLocals.length){var W=" var __locals = ("+Z.localsName+` || {}),
|
|
22
|
+
`;for(var H=0;H<Z.destructuredLocals.length;H++){var w=Z.destructuredLocals[H];if(!Wf.test(w))throw new Error("destructuredLocals["+H+"] is not a valid JS identifier.");if(H>0)W+=`,
|
|
23
23
|
`;W+=w+" = __locals."+w}J+=W+`;
|
|
24
24
|
`}if(Z._with!==!1)J+=" with ("+Z.localsName+` || {}) {
|
|
25
25
|
`,z+=` }
|
|
@@ -51,7 +51,7 @@ try {
|
|
|
51
51
|
`;break;case M0.modes.ESCAPED:this.source+=" ; __append(escapeFn("+_4(f)+`))
|
|
52
52
|
`;break;case M0.modes.RAW:this.source+=" ; __append("+_4(f)+`)
|
|
53
53
|
`;break;case M0.modes.COMMENT:break;case M0.modes.LITERAL:this._addOutput(f);break}}else this._addOutput(f)}if($.opts.compileDebug&&Q)this.currentLine+=Q,this.source+=" ; __line = "+this.currentLine+`
|
|
54
|
-
`}};x4.escapeXML=G0.escapeXML;x4.__express=x4.renderFile;x4.VERSION=RZ;x4.name=EZ;if(typeof window!="undefined")window.ejs=x4});var s4={};
|
|
54
|
+
`}};x4.escapeXML=G0.escapeXML;x4.__express=x4.renderFile;x4.VERSION=RZ;x4.name=EZ;if(typeof window!="undefined")window.ejs=x4});var s4={};Jf(s4,{types:()=>W8,promisify:()=>D8,log:()=>G8,isUndefined:()=>s0,isSymbol:()=>H8,isString:()=>g1,isRegExp:()=>P1,isPrimitive:()=>V8,isObject:()=>a0,isNumber:()=>l4,isNullOrUndefined:()=>w8,isNull:()=>v1,isFunction:()=>b1,isError:()=>E1,isDate:()=>Lf,isBuffer:()=>U8,isBoolean:()=>Af,isArray:()=>n4,inspect:()=>m0,inherits:()=>K8,format:()=>Mf,deprecate:()=>f8,debuglog:()=>$8,callbackifyOnRejected:()=>r4,callbackify:()=>O8,_extend:()=>p4,TextEncoder:()=>L8,TextDecoder:()=>M8});function Mf(f,...$){if(!g1(f)){var Z=[f];for(var J=0;J<$.length;J++)Z.push(m0($[J]));return Z.join(" ")}var J=0,z=$.length,Q=String(f).replace(eZ,function(X){if(X==="%%")return"%";if(J>=z)return X;switch(X){case"%s":return String($[J++]);case"%d":return Number($[J++]);case"%j":try{return JSON.stringify($[J++])}catch(W){return"[Circular]"}default:return X}});for(var Y=$[J];J<z;Y=$[++J])if(v1(Y)||!a0(Y))Q+=" "+Y;else Q+=" "+m0(Y);return Q}function f8(f,$){if(typeof process==="undefined"||process?.noDeprecation===!0)return f;var Z=!1;function J(...z){if(!Z){if(process.throwDeprecation)throw new Error($);else if(process.traceDeprecation)console.trace($);else console.error($);Z=!0}return f.apply(this,...z)}return J}function Z8(f,$){var Z=m0.styles[$];if(Z)return"\x1B["+m0.colors[Z][0]+"m"+f+"\x1B["+m0.colors[Z][1]+"m";else return f}function J8(f,$){return f}function z8(f){var $={};return f.forEach(function(Z,J){$[Z]=!0}),$}function _1(f,$,Z){if(f.customInspect&&$&&b1($.inspect)&&$.inspect!==m0&&!($.constructor&&$.constructor.prototype===$)){var J=$.inspect(Z,f);if(!g1(J))J=_1(f,J,Z);return J}var z=Q8(f,$);if(z)return z;var Q=Object.keys($),Y=z8(Q);if(f.showHidden)Q=Object.getOwnPropertyNames($);if(E1($)&&(Q.indexOf("message")>=0||Q.indexOf("description")>=0))return Kf($);if(Q.length===0){if(b1($)){var X=$.name?": "+$.name:"";return f.stylize("[Function"+X+"]","special")}if(P1($))return f.stylize(RegExp.prototype.toString.call($),"regexp");if(Lf($))return f.stylize(Date.prototype.toString.call($),"date");if(E1($))return Kf($)}var W="",H=!1,w=["{","}"];if(n4($))H=!0,w=["[","]"];if(b1($)){var K=$.name?": "+$.name:"";W=" [Function"+K+"]"}if(P1($))W=" "+RegExp.prototype.toString.call($);if(Lf($))W=" "+Date.prototype.toUTCString.call($);if(E1($))W=" "+Kf($);if(Q.length===0&&(!H||$.length==0))return w[0]+W+w[1];if(Z<0)if(P1($))return f.stylize(RegExp.prototype.toString.call($),"regexp");else return f.stylize("[Object]","special");f.seen.push($);var O;if(H)O=Y8(f,$,Z,Y,Q);else O=Q.map(function(j){return Of(f,$,Z,Y,j,H)});return f.seen.pop(),X8(O,W,w)}function Q8(f,$){if(s0($))return f.stylize("undefined","undefined");if(g1($)){var Z="'"+JSON.stringify($).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return f.stylize(Z,"string")}if(l4($))return f.stylize(""+$,"number");if(Af($))return f.stylize(""+$,"boolean");if(v1($))return f.stylize("null","null")}function Kf(f){return"["+Error.prototype.toString.call(f)+"]"}function Y8(f,$,Z,J,z){var Q=[];for(var Y=0,X=$.length;Y<X;++Y)if(o4($,String(Y)))Q.push(Of(f,$,Z,J,String(Y),!0));else Q.push("");return z.forEach(function(W){if(!W.match(/^\d+$/))Q.push(Of(f,$,Z,J,W,!0))}),Q}function Of(f,$,Z,J,z,Q){var Y,X,W;if(W=Object.getOwnPropertyDescriptor($,z)||{value:$[z]},W.get)if(W.set)X=f.stylize("[Getter/Setter]","special");else X=f.stylize("[Getter]","special");else if(W.set)X=f.stylize("[Setter]","special");if(!o4(J,z))Y="["+z+"]";if(!X)if(f.seen.indexOf(W.value)<0){if(v1(Z))X=_1(f,W.value,null);else X=_1(f,W.value,Z-1);if(X.indexOf(`
|
|
55
55
|
`)>-1)if(Q)X=X.split(`
|
|
56
56
|
`).map(function(H){return" "+H}).join(`
|
|
57
57
|
`).slice(2);else X=`
|
|
@@ -60,7 +60,7 @@ try {
|
|
|
60
60
|
`)}else X=f.stylize("[Circular]","special");if(s0(Y)){if(Q&&z.match(/^\d+$/))return X;if(Y=JSON.stringify(""+z),Y.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/))Y=Y.slice(1,-1),Y=f.stylize(Y,"name");else Y=Y.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Y=f.stylize(Y,"string")}return Y+": "+X}function X8(f,$,Z){var J=0,z=f.reduce(function(Q,Y){if(J++,Y.indexOf(`
|
|
61
61
|
`)>=0)J++;return Q+Y.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(z>60)return Z[0]+($===""?"":$+`
|
|
62
62
|
`)+" "+f.join(`,
|
|
63
|
-
`)+" "+Z[1];return Z[0]+$+" "+f.join(", ")+" "+Z[1]}function n4(f){return Array.isArray(f)}function Af(f){return typeof f==="boolean"}function g1(f){return f===null}function w8(f){return f==null}function l4(f){return typeof f==="number"}function x1(f){return typeof f==="string"}function H8(f){return typeof f==="symbol"}function s0(f){return f===void 0}function E1(f){return a0(f)&&qf(f)==="[object RegExp]"}function a0(f){return typeof f==="object"&&f!==null}function Lf(f){return a0(f)&&qf(f)==="[object Date]"}function b1(f){return a0(f)&&(qf(f)==="[object Error]"||f instanceof Error)}function _1(f){return typeof f==="function"}function V8(f){return f===null||typeof f==="boolean"||typeof f==="number"||typeof f==="string"||typeof f==="symbol"||typeof f==="undefined"}function U8(f){return f instanceof Buffer}function qf(f){return Object.prototype.toString.call(f)}function Df(f){return f<10?"0"+f.toString(10):f.toString(10)}function F8(){var f=new Date,$=[Df(f.getHours()),Df(f.getMinutes()),Df(f.getSeconds())].join(":");return[f.getDate(),B8[f.getMonth()],$].join(" ")}function G8(...f){console.log("%s - %s",F8(),Mf.apply(null,f))}function K8(f,$){if($)f.super_=$,f.prototype=Object.create($.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}})}function p4(f,$){if(!$||!a0($))return f;var Z=Object.keys($),J=Z.length;while(J--)f[Z[J]]=$[Z[J]];return f}function o4(f,$){return Object.prototype.hasOwnProperty.call(f,$)}function r4(f,$){if(!f){var Z=new Error("Promise was rejected with a falsy value");Z.reason=f,f=Z}return $(f)}function O8(f){if(typeof f!=="function")throw new TypeError('The "original" argument must be of type Function');function $(...Z){var J=Z.pop();if(typeof J!=="function")throw new TypeError("The last argument must be of type Function");var z=this,Q=function(...Y){return J.apply(z,...Y)};f.apply(this,Z).then(function(Y){process.nextTick(Q.bind(null,null,Y))},function(Y){process.nextTick(r4.bind(null,Y,Q))})}return Object.setPrototypeOf($,Object.getPrototypeOf(f)),Object.defineProperties($,Object.getOwnPropertyDescriptors(f)),$}var eZ,$8,m0,W8=()=>{},B8,D8,L8,M8;var a4=Qf(()=>{eZ=/%[sdj%]/g;$8=((f={},$={},Z)=>((Z=typeof process!=="undefined"&&process.env.NODE_DEBUG)&&(Z=Z.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),$=new RegExp("^"+Z+"$","i"),(J)=>{if(J=J.toUpperCase(),!f[J])if($.test(J))f[J]=function(...z){console.error("%s: %s",J,pid,Mf.apply(null,...z))};else f[J]=function(){};return f[J]}))(),m0=((f)=>(f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},f.custom=Symbol.for("nodejs.util.inspect.custom"),f))(function f($,Z,...J){var z={seen:[],stylize:J8};if(J.length>=1)z.depth=J[0];if(J.length>=2)z.colors=J[1];if(Af(Z))z.showHidden=Z;else if(Z)p4(z,Z);if(s0(z.showHidden))z.showHidden=!1;if(s0(z.depth))z.depth=2;if(s0(z.colors))z.colors=!1;if(z.colors)z.stylize=Z8;return v1(z,$,z.depth)});B8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];D8=((f)=>(f.custom=Symbol.for("nodejs.util.promisify.custom"),f))(function f($){if(typeof $!=="function")throw new TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var Z=$[kCustomPromisifiedSymbol];if(typeof Z!=="function")throw new TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0}),Z}function Z(...J){var z,Q,Y=new Promise(function(X,W){z=X,Q=W});J.push(function(X,W){if(X)Q(X);else z(W)});try{$.apply(this,J)}catch(X){Q(X)}return Y}if(Object.setPrototypeOf(Z,Object.getPrototypeOf($)),kCustomPromisifiedSymbol)Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(Z,Object.getOwnPropertyDescriptors($))});({TextEncoder:L8,TextDecoder:M8}=globalThis)});var K1={};zf(K1,{throws:()=>vJ,strictEqual:()=>_J,strict:()=>bJ,rejects:()=>EJ,ok:()=>PJ,notStrictEqual:()=>SJ,notEqual:()=>IJ,notDeepStrictEqual:()=>RJ,notDeepEqual:()=>NJ,match:()=>CJ,ifError:()=>TJ,fail:()=>jJ,equal:()=>qJ,doesNotThrow:()=>AJ,doesNotReject:()=>MJ,doesNotMatch:()=>LJ,default:()=>gJ,deepStrictEqual:()=>OJ,deepEqual:()=>DJ,CallTracker:()=>KJ,AssertionError:()=>GJ});var A8,q8,t4,j8,T8,C8=(f,$,Z)=>{Z=f!=null?A8(q8(f)):{};let J=$||!f||!f.__esModule?t4(Z,"default",{value:f,enumerable:!0}):Z;for(let z of j8(f))if(!T8.call(J,z))t4(J,z,{get:()=>f[z],enumerable:!0});return J},y=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports),Tf,k1,Cf,N8,R8,I8,S8,e4,F1,P8,E8,b8,_8,v8,g8,x8,k8,u8,y8,t0,u1,c8,f$,$$,h8,G1,Nf,Rf,m8,Z$,If,d8,Sf,J$,Pf,e0,i8,n8,l8,p8,o8,r8,s8,a8,z$,Q$,t8,e8,y1,Y$,fJ,$J,ZJ,JJ,zJ,B1,X$,QJ,W$,YJ,w$,XJ,WJ,H$,Ef,wJ,c1,HJ,VJ,V$,U$,UJ,BJ,FJ,jf,B$,GJ,KJ,DJ,OJ,LJ,MJ,AJ,qJ,jJ,TJ,CJ,NJ,RJ,IJ,SJ,PJ,EJ,bJ,_J,vJ,gJ;var D1=Qf(()=>{A8=Object.create,{getPrototypeOf:q8,defineProperty:t4,getOwnPropertyNames:j8}=Object,T8=Object.prototype.hasOwnProperty,Tf=y((f,$)=>{$.exports=function Z(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var J={},z=Symbol("test"),Q=Object(z);if(typeof z==="string")return!1;if(Object.prototype.toString.call(z)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;var Y=42;J[z]=Y;for(var X in J)return!1;if(typeof Object.keys==="function"&&Object.keys(J).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(J).length!==0)return!1;var W=Object.getOwnPropertySymbols(J);if(W.length!==1||W[0]!==z)return!1;if(!Object.prototype.propertyIsEnumerable.call(J,z))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var H=Object.getOwnPropertyDescriptor(J,z);if(H.value!==Y||H.enumerable!==!0)return!1}return!0}}),k1=y((f,$)=>{var Z=Tf();$.exports=function J(){return Z()&&!!Symbol.toStringTag}}),Cf=y((f,$)=>{$.exports=Object}),N8=y((f,$)=>{$.exports=Error}),R8=y((f,$)=>{$.exports=EvalError}),I8=y((f,$)=>{$.exports=RangeError}),S8=y((f,$)=>{$.exports=ReferenceError}),e4=y((f,$)=>{$.exports=SyntaxError}),F1=y((f,$)=>{$.exports=TypeError}),P8=y((f,$)=>{$.exports=URIError}),E8=y((f,$)=>{$.exports=Math.abs}),b8=y((f,$)=>{$.exports=Math.floor}),_8=y((f,$)=>{$.exports=Math.max}),v8=y((f,$)=>{$.exports=Math.min}),g8=y((f,$)=>{$.exports=Math.pow}),x8=y((f,$)=>{$.exports=Math.round}),k8=y((f,$)=>{$.exports=Number.isNaN||function Z(J){return J!==J}}),u8=y((f,$)=>{var Z=k8();$.exports=function J(z){if(Z(z)||z===0)return z;return z<0?-1:1}}),y8=y((f,$)=>{$.exports=Object.getOwnPropertyDescriptor}),t0=y((f,$)=>{var Z=y8();if(Z)try{Z([],"length")}catch(J){Z=null}$.exports=Z}),u1=y((f,$)=>{var Z=Object.defineProperty||!1;if(Z)try{Z({},"a",{value:1})}catch(J){Z=!1}$.exports=Z}),c8=y((f,$)=>{var Z=typeof Symbol!=="undefined"&&Symbol,J=Tf();$.exports=function z(){if(typeof Z!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof Z("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return J()}}),f$=y((f,$)=>{$.exports=typeof Reflect!=="undefined"&&Reflect.getPrototypeOf||null}),$$=y((f,$)=>{var Z=Cf();$.exports=Z.getPrototypeOf||null}),h8=y((f,$)=>{var Z="Function.prototype.bind called on incompatible ",J=Object.prototype.toString,z=Math.max,Q="[object Function]",Y=function H(w,K){var O=[];for(var j=0;j<w.length;j+=1)O[j]=w[j];for(var M=0;M<K.length;M+=1)O[M+w.length]=K[M];return O},X=function H(w,K){var O=[];for(var j=K||0,M=0;j<w.length;j+=1,M+=1)O[M]=w[j];return O},W=function(H,w){var K="";for(var O=0;O<H.length;O+=1)if(K+=H[O],O+1<H.length)K+=w;return K};$.exports=function H(w){var K=this;if(typeof K!=="function"||J.apply(K)!==Q)throw new TypeError(Z+K);var O=X(arguments,1),j,M=function(){if(this instanceof j){var _=K.apply(this,Y(O,arguments));if(Object(_)===_)return _;return this}return K.apply(w,Y(O,arguments))},S=z(0,K.length-O.length),v=[];for(var g=0;g<S;g++)v[g]="$"+g;if(j=Function("binder","return function ("+W(v,",")+"){ return binder.apply(this,arguments); }")(M),K.prototype){var x=function _(){};x.prototype=K.prototype,j.prototype=new x,x.prototype=null}return j}}),G1=y((f,$)=>{var Z=h8();$.exports=Function.prototype.bind||Z}),Nf=y((f,$)=>{$.exports=Function.prototype.call}),Rf=y((f,$)=>{$.exports=Function.prototype.apply}),m8=y((f,$)=>{$.exports=typeof Reflect!=="undefined"&&Reflect&&Reflect.apply}),Z$=y((f,$)=>{var Z=G1(),J=Rf(),z=Nf(),Q=m8();$.exports=Q||Z.call(z,J)}),If=y((f,$)=>{var Z=G1(),J=F1(),z=Nf(),Q=Z$();$.exports=function Y(X){if(X.length<1||typeof X[0]!=="function")throw new J("a function is required");return Q(Z,z,X)}}),d8=y((f,$)=>{var Z=If(),J=t0(),z;try{z=[].__proto__===Array.prototype}catch(W){if(!W||typeof W!=="object"||!("code"in W)||W.code!=="ERR_PROTO_ACCESS")throw W}var Q=!!z&&J&&J(Object.prototype,"__proto__"),Y=Object,X=Y.getPrototypeOf;$.exports=Q&&typeof Q.get==="function"?Z([Q.get]):typeof X==="function"?function W(H){return X(H==null?H:Y(H))}:!1}),Sf=y((f,$)=>{var Z=f$(),J=$$(),z=d8();$.exports=Z?function Q(Y){return Z(Y)}:J?function Q(Y){if(!Y||typeof Y!=="object"&&typeof Y!=="function")throw new TypeError("getProto: not an object");return J(Y)}:z?function Q(Y){return z(Y)}:null}),J$=y((f,$)=>{var Z=Function.prototype.call,J=Object.prototype.hasOwnProperty,z=G1();$.exports=z.call(Z,J)}),Pf=y((f,$)=>{var Z,J=Cf(),z=N8(),Q=R8(),Y=I8(),X=S8(),W=e4(),H=F1(),w=P8(),K=E8(),O=b8(),j=_8(),M=v8(),S=g8(),v=x8(),g=u8(),x=Function,_=function(B){try{return x('"use strict"; return ('+B+").constructor;")()}catch(A){}},b=t0(),i=u1(),a=function(){throw new H},N=b?function(){try{return arguments.callee,a}catch(B){try{return b(arguments,"callee").get}catch(A){return a}}}():a,T=c8()(),R=Sf(),h=$$(),r=f$(),m=Rf(),$0=Nf(),n={},w0=typeof Uint8Array==="undefined"||!R?Z:R(Uint8Array),H0={__proto__:null,"%AggregateError%":typeof AggregateError==="undefined"?Z:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer==="undefined"?Z:ArrayBuffer,"%ArrayIteratorPrototype%":T&&R?R([][Symbol.iterator]()):Z,"%AsyncFromSyncIteratorPrototype%":Z,"%AsyncFunction%":n,"%AsyncGenerator%":n,"%AsyncGeneratorFunction%":n,"%AsyncIteratorPrototype%":n,"%Atomics%":typeof Atomics==="undefined"?Z:Atomics,"%BigInt%":typeof BigInt==="undefined"?Z:BigInt,"%BigInt64Array%":typeof BigInt64Array==="undefined"?Z:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array==="undefined"?Z:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView==="undefined"?Z:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":z,"%eval%":eval,"%EvalError%":Q,"%Float16Array%":typeof Float16Array==="undefined"?Z:Float16Array,"%Float32Array%":typeof Float32Array==="undefined"?Z:Float32Array,"%Float64Array%":typeof Float64Array==="undefined"?Z:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry==="undefined"?Z:FinalizationRegistry,"%Function%":x,"%GeneratorFunction%":n,"%Int8Array%":typeof Int8Array==="undefined"?Z:Int8Array,"%Int16Array%":typeof Int16Array==="undefined"?Z:Int16Array,"%Int32Array%":typeof Int32Array==="undefined"?Z:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":T&&R?R(R([][Symbol.iterator]())):Z,"%JSON%":typeof JSON==="object"?JSON:Z,"%Map%":typeof Map==="undefined"?Z:Map,"%MapIteratorPrototype%":typeof Map==="undefined"||!T||!R?Z:R(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":J,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise==="undefined"?Z:Promise,"%Proxy%":typeof Proxy==="undefined"?Z:Proxy,"%RangeError%":Y,"%ReferenceError%":X,"%Reflect%":typeof Reflect==="undefined"?Z:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set==="undefined"?Z:Set,"%SetIteratorPrototype%":typeof Set==="undefined"||!T||!R?Z:R(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer==="undefined"?Z:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":T&&R?R(""[Symbol.iterator]()):Z,"%Symbol%":T?Symbol:Z,"%SyntaxError%":W,"%ThrowTypeError%":N,"%TypedArray%":w0,"%TypeError%":H,"%Uint8Array%":typeof Uint8Array==="undefined"?Z:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray==="undefined"?Z:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array==="undefined"?Z:Uint16Array,"%Uint32Array%":typeof Uint32Array==="undefined"?Z:Uint32Array,"%URIError%":w,"%WeakMap%":typeof WeakMap==="undefined"?Z:WeakMap,"%WeakRef%":typeof WeakRef==="undefined"?Z:WeakRef,"%WeakSet%":typeof WeakSet==="undefined"?Z:WeakSet,"%Function.prototype.call%":$0,"%Function.prototype.apply%":m,"%Object.defineProperty%":i,"%Object.getPrototypeOf%":h,"%Math.abs%":K,"%Math.floor%":O,"%Math.max%":j,"%Math.min%":M,"%Math.pow%":S,"%Math.round%":v,"%Math.sign%":g,"%Reflect.getPrototypeOf%":r};if(R)try{null.error}catch(B){A0=R(R(B)),H0["%Error.prototype%"]=A0}var A0,V0=function B(A){var u;if(A==="%AsyncFunction%")u=_("async function () {}");else if(A==="%GeneratorFunction%")u=_("function* () {}");else if(A==="%AsyncGeneratorFunction%")u=_("async function* () {}");else if(A==="%AsyncGenerator%"){var P=B("%AsyncGeneratorFunction%");if(P)u=P.prototype}else if(A==="%AsyncIteratorPrototype%"){var p=B("%AsyncGenerator%");if(p&&R)u=R(p.prototype)}return H0[A]=u,u},O0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},F0=G1(),I=J$(),V=F0.call($0,Array.prototype.concat),G=F0.call(m,Array.prototype.splice),L=F0.call($0,String.prototype.replace),E=F0.call($0,String.prototype.slice),d=F0.call($0,RegExp.prototype.exec),s=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,c=/\\(\\)?/g,D=function B(A){var u=E(A,0,1),P=E(A,-1);if(u==="%"&&P!=="%")throw new W("invalid intrinsic syntax, expected closing `%`");else if(P==="%"&&u!=="%")throw new W("invalid intrinsic syntax, expected opening `%`");var p=[];return L(A,s,function(t,Y0,X0,C){p[p.length]=X0?L(C,c,"$1"):Y0||t}),p},U=function B(A,u){var P=A,p;if(I(O0,P))p=O0[P],P="%"+p[0]+"%";if(I(H0,P)){var t=H0[P];if(t===n)t=V0(P);if(typeof t==="undefined"&&!u)throw new H("intrinsic "+A+" exists, but is not available. Please file an issue!");return{alias:p,name:P,value:t}}throw new W("intrinsic "+A+" does not exist!")};$.exports=function B(A,u){if(typeof A!=="string"||A.length===0)throw new H("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof u!=="boolean")throw new H('"allowMissing" argument must be a boolean');if(d(/^%?[^%]*%?$/,A)===null)throw new W("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var P=D(A),p=P.length>0?P[0]:"",t=U("%"+p+"%",u),Y0=t.name,X0=t.value,C=!1,L0=t.alias;if(L0)p=L0[0],G(P,V([0,1],L0));for(var b0=1,E0=!0;b0<P.length;b0+=1){var U0=P[b0],R0=E(U0,0,1),N0=E(U0,-1);if((R0==='"'||R0==="'"||R0==="`"||(N0==='"'||N0==="'"||N0==="`"))&&R0!==N0)throw new W("property names with quotes must have matching quotes");if(U0==="constructor"||!E0)C=!0;if(p+="."+U0,Y0="%"+p+"%",I(H0,Y0))X0=H0[Y0];else if(X0!=null){if(!(U0 in X0)){if(!u)throw new H("base intrinsic for "+A+" exists, but the property is not available.");return}if(b&&b0+1>=P.length){var _0=b(X0,U0);if(E0=!!_0,E0&&"get"in _0&&!("originalValue"in _0.get))X0=_0.get;else X0=X0[U0]}else E0=I(X0,U0),X0=X0[U0];if(E0&&!C)H0[Y0]=X0}}return X0}}),e0=y((f,$)=>{var Z=Pf(),J=If(),z=J([Z("%String.prototype.indexOf%")]);$.exports=function Q(Y,X){var W=Z(Y,!!X);if(typeof W==="function"&&z(Y,".prototype.")>-1)return J([W]);return W}}),i8=y((f,$)=>{var Z=k1()(),J=e0(),z=J("Object.prototype.toString"),Q=function W(H){if(Z&&H&&typeof H==="object"&&Symbol.toStringTag in H)return!1;return z(H)==="[object Arguments]"},Y=function W(H){if(Q(H))return!0;return H!==null&&typeof H==="object"&&"length"in H&&typeof H.length==="number"&&H.length>=0&&z(H)!=="[object Array]"&&"callee"in H&&z(H.callee)==="[object Function]"},X=function(){return Q(arguments)}();Q.isLegacyArguments=Y,$.exports=X?Q:Y}),n8=y((f,$)=>{var Z=e0(),J=k1()(),z=J$(),Q=t0(),Y;if(J){if(X=Z("RegExp.prototype.exec"),W={},H=function(){throw W},w={toString:H,valueOf:H},typeof Symbol.toPrimitive==="symbol")w[Symbol.toPrimitive]=H;Y=function j(M){if(!M||typeof M!=="object")return!1;var S=Q(M,"lastIndex"),v=S&&z(S,"value");if(!v)return!1;try{X(M,w)}catch(g){return g===W}}}else K=Z("Object.prototype.toString"),O="[object RegExp]",Y=function j(M){if(!M||typeof M!=="object"&&typeof M!=="function")return!1;return K(M)===O};var X,W,H,w,K,O;$.exports=Y}),l8=y((f,$)=>{var Z=e0(),J=n8(),z=Z("RegExp.prototype.exec"),Q=F1();$.exports=function Y(X){if(!J(X))throw new Q("`regex` must be a RegExp");return function W(H){return z(X,H)!==null}}}),p8=y((f,$)=>{var Z=e0(),J=l8(),z=J(/^\s*(?:function)?\*/),Q=k1()(),Y=Sf(),X=Z("Object.prototype.toString"),W=Z("Function.prototype.toString"),H=function(){if(!Q)return!1;try{return Function("return function*() {}")()}catch(K){}},w;$.exports=function K(O){if(typeof O!=="function")return!1;if(z(W(O)))return!0;if(!Q){var j=X(O);return j==="[object GeneratorFunction]"}if(!Y)return!1;if(typeof w==="undefined"){var M=H();w=M?Y(M):!1}return Y(O)===w}}),o8=y((f,$)=>{var Z=Function.prototype.toString,J=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,z,Q;if(typeof J==="function"&&typeof Object.defineProperty==="function")try{z=Object.defineProperty({},"length",{get:function(){throw Q}}),Q={},J(function(){throw 42},null,z)}catch(b){if(b!==Q)J=null}else J=null;var Y=/^\s*class\b/,X=function b(i){try{var a=Z.call(i);return Y.test(a)}catch(N){return!1}},W=function b(i){try{if(X(i))return!1;return Z.call(i),!0}catch(a){return!1}},H=Object.prototype.toString,w="[object Object]",K="[object Function]",O="[object GeneratorFunction]",j="[object HTMLAllCollection]",M="[object HTML document.all class]",S="[object HTMLCollection]",v=typeof Symbol==="function"&&!!Symbol.toStringTag,g=!(0 in[,]),x=function b(){return!1};if(typeof document==="object"){if(_=document.all,H.call(_)===H.call(document.all))x=function b(i){if((g||!i)&&(typeof i==="undefined"||typeof i==="object"))try{var a=H.call(i);return(a===j||a===M||a===S||a===w)&&i("")==null}catch(N){}return!1}}var _;$.exports=J?function b(i){if(x(i))return!0;if(!i)return!1;if(typeof i!=="function"&&typeof i!=="object")return!1;try{J(i,null,z)}catch(a){if(a!==Q)return!1}return!X(i)&&W(i)}:function b(i){if(x(i))return!0;if(!i)return!1;if(typeof i!=="function"&&typeof i!=="object")return!1;if(v)return W(i);if(X(i))return!1;var a=H.call(i);if(a!==K&&a!==O&&!/^\[object HTML/.test(a))return!1;return W(i)}}),r8=y((f,$)=>{var Z=o8(),J=Object.prototype.toString,z=Object.prototype.hasOwnProperty,Q=function H(w,K,O){for(var j=0,M=w.length;j<M;j++)if(z.call(w,j))if(O==null)K(w[j],j,w);else K.call(O,w[j],j,w)},Y=function H(w,K,O){for(var j=0,M=w.length;j<M;j++)if(O==null)K(w.charAt(j),j,w);else K.call(O,w.charAt(j),j,w)},X=function H(w,K,O){for(var j in w)if(z.call(w,j))if(O==null)K(w[j],j,w);else K.call(O,w[j],j,w)};function W(H){return J.call(H)==="[object Array]"}$.exports=function H(w,K,O){if(!Z(K))throw new TypeError("iterator must be a function");var j;if(arguments.length>=3)j=O;if(W(w))Q(w,K,j);else if(typeof w==="string")Y(w,K,j);else X(w,K,j)}}),s8=y((f,$)=>{$.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),a8=y((f,$)=>{var Z=s8(),J=typeof globalThis==="undefined"?global:globalThis;$.exports=function z(){var Q=[];for(var Y=0;Y<Z.length;Y++)if(typeof J[Z[Y]]==="function")Q[Q.length]=Z[Y];return Q}}),z$=y((f,$)=>{var Z=u1(),J=e4(),z=F1(),Q=t0();$.exports=function Y(X,W,H){if(!X||typeof X!=="object"&&typeof X!=="function")throw new z("`obj` must be an object or a function`");if(typeof W!=="string"&&typeof W!=="symbol")throw new z("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new z("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new z("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new z("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new z("`loose`, if provided, must be a boolean");var w=arguments.length>3?arguments[3]:null,K=arguments.length>4?arguments[4]:null,O=arguments.length>5?arguments[5]:null,j=arguments.length>6?arguments[6]:!1,M=!!Q&&Q(X,W);if(Z)Z(X,W,{configurable:O===null&&M?M.configurable:!O,enumerable:w===null&&M?M.enumerable:!w,value:H,writable:K===null&&M?M.writable:!K});else if(j||!w&&!K&&!O)X[W]=H;else throw new J("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),Q$=y((f,$)=>{var Z=u1(),J=function z(){return!!Z};J.hasArrayLengthDefineBug=function z(){if(!Z)return null;try{return Z([],"length",{value:1}).length!==1}catch(Q){return!0}},$.exports=J}),t8=y((f,$)=>{var Z=Pf(),J=z$(),z=Q$()(),Q=t0(),Y=F1(),X=Z("%Math.floor%");$.exports=function W(H,w){if(typeof H!=="function")throw new Y("`fn` is not a function");if(typeof w!=="number"||w<0||w>4294967295||X(w)!==w)throw new Y("`length` must be a positive 32-bit integer");var K=arguments.length>2&&!!arguments[2],O=!0,j=!0;if("length"in H&&Q){var M=Q(H,"length");if(M&&!M.configurable)O=!1;if(M&&!M.writable)j=!1}if(O||j||!K)if(z)J(H,"length",w,!0,!0);else J(H,"length",w);return H}}),e8=y((f,$)=>{var Z=G1(),J=Rf(),z=Z$();$.exports=function Q(){return z(Z,J,arguments)}}),y1=y((f,$)=>{var Z=t8(),J=u1(),z=If(),Q=e8();if($.exports=function Y(X){var W=z(arguments),H=X.length-(arguments.length-1);return Z(W,1+(H>0?H:0),!0)},J)J($.exports,"apply",{value:Q});else $.exports.apply=Q}),Y$=y((f,$)=>{var Z=r8(),J=a8(),z=y1(),Q=e0(),Y=t0(),X=Sf(),W=Q("Object.prototype.toString"),H=k1()(),w=typeof globalThis==="undefined"?global:globalThis,K=J(),O=Q("String.prototype.slice"),j=Q("Array.prototype.indexOf",!0)||function g(x,_){for(var b=0;b<x.length;b+=1)if(x[b]===_)return b;return-1},M={__proto__:null};if(H&&Y&&X)Z(K,function(g){var x=new w[g];if(Symbol.toStringTag in x&&X){var _=X(x),b=Y(_,Symbol.toStringTag);if(!b&&_){var i=X(_);b=Y(i,Symbol.toStringTag)}M["$"+g]=z(b.get)}});else Z(K,function(g){var x=new w[g],_=x.slice||x.set;if(_)M["$"+g]=z(_)});var S=function g(x){var _=!1;return Z(M,function(b,i){if(!_)try{if("$"+b(x)===i)_=O(i,1)}catch(a){}}),_},v=function g(x){var _=!1;return Z(M,function(b,i){if(!_)try{b(x),_=O(i,1)}catch(a){}}),_};$.exports=function g(x){if(!x||typeof x!=="object")return!1;if(!H){var _=O(W(x),8,-1);if(j(K,_)>-1)return _;if(_!=="Object")return!1;return v(x)}if(!Y)return null;return S(x)}}),fJ=y((f,$)=>{var Z=Y$();$.exports=function J(z){return!!Z(z)}}),$J=y((f)=>{var $=i8(),Z=p8(),J=Y$(),z=fJ();function Q(C){return C.call.bind(C)}var Y=typeof BigInt!=="undefined",X=typeof Symbol!=="undefined",W=Q(Object.prototype.toString),H=Q(Number.prototype.valueOf),w=Q(String.prototype.valueOf),K=Q(Boolean.prototype.valueOf);if(Y)O=Q(BigInt.prototype.valueOf);var O;if(X)j=Q(Symbol.prototype.valueOf);var j;function M(C,L0){if(typeof C!=="object")return!1;try{return L0(C),!0}catch(b0){return!1}}f.isArgumentsObject=$,f.isGeneratorFunction=Z,f.isTypedArray=z;function S(C){return typeof Promise!=="undefined"&&C instanceof Promise||C!==null&&typeof C==="object"&&typeof C.then==="function"&&typeof C.catch==="function"}f.isPromise=S;function v(C){if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView)return ArrayBuffer.isView(C);return z(C)||G(C)}f.isArrayBufferView=v;function g(C){return J(C)==="Uint8Array"}f.isUint8Array=g;function x(C){return J(C)==="Uint8ClampedArray"}f.isUint8ClampedArray=x;function _(C){return J(C)==="Uint16Array"}f.isUint16Array=_;function b(C){return J(C)==="Uint32Array"}f.isUint32Array=b;function i(C){return J(C)==="Int8Array"}f.isInt8Array=i;function a(C){return J(C)==="Int16Array"}f.isInt16Array=a;function N(C){return J(C)==="Int32Array"}f.isInt32Array=N;function T(C){return J(C)==="Float32Array"}f.isFloat32Array=T;function R(C){return J(C)==="Float64Array"}f.isFloat64Array=R;function h(C){return J(C)==="BigInt64Array"}f.isBigInt64Array=h;function r(C){return J(C)==="BigUint64Array"}f.isBigUint64Array=r;function m(C){return W(C)==="[object Map]"}m.working=typeof Map!=="undefined"&&m(new Map);function $0(C){if(typeof Map==="undefined")return!1;return m.working?m(C):C instanceof Map}f.isMap=$0;function n(C){return W(C)==="[object Set]"}n.working=typeof Set!=="undefined"&&n(new Set);function w0(C){if(typeof Set==="undefined")return!1;return n.working?n(C):C instanceof Set}f.isSet=w0;function H0(C){return W(C)==="[object WeakMap]"}H0.working=typeof WeakMap!=="undefined"&&H0(new WeakMap);function A0(C){if(typeof WeakMap==="undefined")return!1;return H0.working?H0(C):C instanceof WeakMap}f.isWeakMap=A0;function V0(C){return W(C)==="[object WeakSet]"}V0.working=typeof WeakSet!=="undefined"&&V0(new WeakSet);function O0(C){return V0(C)}f.isWeakSet=O0;function F0(C){return W(C)==="[object ArrayBuffer]"}F0.working=typeof ArrayBuffer!=="undefined"&&F0(new ArrayBuffer);function I(C){if(typeof ArrayBuffer==="undefined")return!1;return F0.working?F0(C):C instanceof ArrayBuffer}f.isArrayBuffer=I;function V(C){return W(C)==="[object DataView]"}V.working=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"&&V(new DataView(new ArrayBuffer(1),0,1));function G(C){if(typeof DataView==="undefined")return!1;return V.working?V(C):C instanceof DataView}f.isDataView=G;var L=typeof SharedArrayBuffer!=="undefined"?SharedArrayBuffer:void 0;function E(C){return W(C)==="[object SharedArrayBuffer]"}function d(C){if(typeof L==="undefined")return!1;if(typeof E.working==="undefined")E.working=E(new L);return E.working?E(C):C instanceof L}f.isSharedArrayBuffer=d;function s(C){return W(C)==="[object AsyncFunction]"}f.isAsyncFunction=s;function c(C){return W(C)==="[object Map Iterator]"}f.isMapIterator=c;function D(C){return W(C)==="[object Set Iterator]"}f.isSetIterator=D;function U(C){return W(C)==="[object Generator]"}f.isGeneratorObject=U;function B(C){return W(C)==="[object WebAssembly.Module]"}f.isWebAssemblyCompiledModule=B;function A(C){return M(C,H)}f.isNumberObject=A;function u(C){return M(C,w)}f.isStringObject=u;function P(C){return M(C,K)}f.isBooleanObject=P;function p(C){return Y&&M(C,O)}f.isBigIntObject=p;function t(C){return X&&M(C,j)}f.isSymbolObject=t;function Y0(C){return A(C)||u(C)||P(C)||p(C)||t(C)}f.isBoxedPrimitive=Y0;function X0(C){return typeof Uint8Array!=="undefined"&&(I(C)||d(C))}f.isAnyArrayBuffer=X0,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(C){Object.defineProperty(f,C,{enumerable:!1,value:function(){throw new Error(C+" is not supported in userland")}})})}),ZJ=y((f,$)=>{$.exports=function Z(J){return J instanceof Buffer}}),JJ=y((f,$)=>{if(typeof Object.create==="function")$.exports=function Z(J,z){if(z)J.super_=z,J.prototype=Object.create(z.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}})};else $.exports=function Z(J,z){if(z){J.super_=z;var Q=function(){};Q.prototype=z.prototype,J.prototype=new Q,J.prototype.constructor=J}}}),zJ=y((f,$)=>{try{if(Z=(a4(),o0(s4)),typeof Z.inherits!=="function")throw"";$.exports=Z.inherits}catch(J){$.exports=JJ()}var Z}),B1=y((f)=>{var $=Object.getOwnPropertyDescriptors||function V(G){var L=Object.keys(G),E={};for(var d=0;d<L.length;d++)E[L[d]]=Object.getOwnPropertyDescriptor(G,L[d]);return E},Z=/%[sdj%]/g;f.format=function(V){if(!i(V)){var G=[];for(var L=0;L<arguments.length;L++)G.push(Y(arguments[L]));return G.join(" ")}var L=1,E=arguments,d=E.length,s=String(V).replace(Z,function(D){if(D==="%%")return"%";if(L>=d)return D;switch(D){case"%s":return String(E[L++]);case"%d":return Number(E[L++]);case"%j":try{return JSON.stringify(E[L++])}catch(U){return"[Circular]"}default:return D}});for(var c=E[L];L<d;c=E[++L])if(x(c)||!R(c))s+=" "+c;else s+=" "+Y(c);return s},f.deprecate=function(V,G){if(typeof process!=="undefined"&&process.noDeprecation===!0)return V;if(typeof process==="undefined")return function(){return f.deprecate(V,G).apply(this,arguments)};var L=!1;function E(){if(!L){if(process.throwDeprecation)throw new Error(G);else if(process.traceDeprecation)console.trace(G);else console.error(G);L=!0}return V.apply(this,arguments)}return E};var J={},z=/^$/;if(process.env.NODE_DEBUG)Q=process.env.NODE_DEBUG,Q=Q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),z=new RegExp("^"+Q+"$","i");var Q;f.debuglog=function(V){if(V=V.toUpperCase(),!J[V])if(z.test(V)){var G=process.pid;J[V]=function(){var L=f.format.apply(f,arguments);console.error("%s %d: %s",V,G,L)}}else J[V]=function(){};return J[V]};function Y(V,G){var L={seen:[],stylize:W};if(arguments.length>=3)L.depth=arguments[2];if(arguments.length>=4)L.colors=arguments[3];if(g(G))L.showHidden=G;else if(G)f._extend(L,G);if(N(L.showHidden))L.showHidden=!1;if(N(L.depth))L.depth=2;if(N(L.colors))L.colors=!1;if(N(L.customInspect))L.customInspect=!0;if(L.colors)L.stylize=X;return w(L,V,L.depth)}f.inspect=Y,Y.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Y.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function X(V,G){var L=Y.styles[G];if(L)return"\x1B["+Y.colors[L][0]+"m"+V+"\x1B["+Y.colors[L][1]+"m";else return V}function W(V,G){return V}function H(V){var G={};return V.forEach(function(L,E){G[L]=!0}),G}function w(V,G,L){if(V.customInspect&&G&&m(G.inspect)&&G.inspect!==f.inspect&&!(G.constructor&&G.constructor.prototype===G)){var E=G.inspect(L,V);if(!i(E))E=w(V,E,L);return E}var d=K(V,G);if(d)return d;var s=Object.keys(G),c=H(s);if(V.showHidden)s=Object.getOwnPropertyNames(G);if(r(G)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return O(G);if(s.length===0){if(m(G)){var D=G.name?": "+G.name:"";return V.stylize("[Function"+D+"]","special")}if(T(G))return V.stylize(RegExp.prototype.toString.call(G),"regexp");if(h(G))return V.stylize(Date.prototype.toString.call(G),"date");if(r(G))return O(G)}var U="",B=!1,A=["{","}"];if(v(G))B=!0,A=["[","]"];if(m(G)){var u=G.name?": "+G.name:"";U=" [Function"+u+"]"}if(T(G))U=" "+RegExp.prototype.toString.call(G);if(h(G))U=" "+Date.prototype.toUTCString.call(G);if(r(G))U=" "+O(G);if(s.length===0&&(!B||G.length==0))return A[0]+U+A[1];if(L<0)if(T(G))return V.stylize(RegExp.prototype.toString.call(G),"regexp");else return V.stylize("[Object]","special");V.seen.push(G);var P;if(B)P=j(V,G,L,c,s);else P=s.map(function(p){return M(V,G,L,c,p,B)});return V.seen.pop(),S(P,U,A)}function K(V,G){if(N(G))return V.stylize("undefined","undefined");if(i(G)){var L="'"+JSON.stringify(G).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return V.stylize(L,"string")}if(b(G))return V.stylize(""+G,"number");if(g(G))return V.stylize(""+G,"boolean");if(x(G))return V.stylize("null","null")}function O(V){return"["+Error.prototype.toString.call(V)+"]"}function j(V,G,L,E,d){var s=[];for(var c=0,D=G.length;c<D;++c)if(V0(G,String(c)))s.push(M(V,G,L,E,String(c),!0));else s.push("");return d.forEach(function(U){if(!U.match(/^\d+$/))s.push(M(V,G,L,E,U,!0))}),s}function M(V,G,L,E,d,s){var c,D,U;if(U=Object.getOwnPropertyDescriptor(G,d)||{value:G[d]},U.get)if(U.set)D=V.stylize("[Getter/Setter]","special");else D=V.stylize("[Getter]","special");else if(U.set)D=V.stylize("[Setter]","special");if(!V0(E,d))c="["+d+"]";if(!D)if(V.seen.indexOf(U.value)<0){if(x(L))D=w(V,U.value,null);else D=w(V,U.value,L-1);if(D.indexOf(`
|
|
63
|
+
`)+" "+Z[1];return Z[0]+$+" "+f.join(", ")+" "+Z[1]}function n4(f){return Array.isArray(f)}function Af(f){return typeof f==="boolean"}function v1(f){return f===null}function w8(f){return f==null}function l4(f){return typeof f==="number"}function g1(f){return typeof f==="string"}function H8(f){return typeof f==="symbol"}function s0(f){return f===void 0}function P1(f){return a0(f)&&qf(f)==="[object RegExp]"}function a0(f){return typeof f==="object"&&f!==null}function Lf(f){return a0(f)&&qf(f)==="[object Date]"}function E1(f){return a0(f)&&(qf(f)==="[object Error]"||f instanceof Error)}function b1(f){return typeof f==="function"}function V8(f){return f===null||typeof f==="boolean"||typeof f==="number"||typeof f==="string"||typeof f==="symbol"||typeof f==="undefined"}function U8(f){return f instanceof Buffer}function qf(f){return Object.prototype.toString.call(f)}function Df(f){return f<10?"0"+f.toString(10):f.toString(10)}function F8(){var f=new Date,$=[Df(f.getHours()),Df(f.getMinutes()),Df(f.getSeconds())].join(":");return[f.getDate(),B8[f.getMonth()],$].join(" ")}function G8(...f){console.log("%s - %s",F8(),Mf.apply(null,f))}function K8(f,$){if($)f.super_=$,f.prototype=Object.create($.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}})}function p4(f,$){if(!$||!a0($))return f;var Z=Object.keys($),J=Z.length;while(J--)f[Z[J]]=$[Z[J]];return f}function o4(f,$){return Object.prototype.hasOwnProperty.call(f,$)}function r4(f,$){if(!f){var Z=new Error("Promise was rejected with a falsy value");Z.reason=f,f=Z}return $(f)}function O8(f){if(typeof f!=="function")throw new TypeError('The "original" argument must be of type Function');function $(...Z){var J=Z.pop();if(typeof J!=="function")throw new TypeError("The last argument must be of type Function");var z=this,Q=function(...Y){return J.apply(z,...Y)};f.apply(this,Z).then(function(Y){process.nextTick(Q.bind(null,null,Y))},function(Y){process.nextTick(r4.bind(null,Y,Q))})}return Object.setPrototypeOf($,Object.getPrototypeOf(f)),Object.defineProperties($,Object.getOwnPropertyDescriptors(f)),$}var eZ,$8,m0,W8=()=>{},B8,D8,L8,M8;var a4=zf(()=>{eZ=/%[sdj%]/g;$8=((f={},$={},Z)=>((Z=typeof process!=="undefined"&&process.env.NODE_DEBUG)&&(Z=Z.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),$=new RegExp("^"+Z+"$","i"),(J)=>{if(J=J.toUpperCase(),!f[J])if($.test(J))f[J]=function(...z){console.error("%s: %s",J,pid,Mf.apply(null,...z))};else f[J]=function(){};return f[J]}))(),m0=((f)=>(f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},f.custom=Symbol.for("nodejs.util.inspect.custom"),f))(function f($,Z,...J){var z={seen:[],stylize:J8};if(J.length>=1)z.depth=J[0];if(J.length>=2)z.colors=J[1];if(Af(Z))z.showHidden=Z;else if(Z)p4(z,Z);if(s0(z.showHidden))z.showHidden=!1;if(s0(z.depth))z.depth=2;if(s0(z.colors))z.colors=!1;if(z.colors)z.stylize=Z8;return _1(z,$,z.depth)});B8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];D8=((f)=>(f.custom=Symbol.for("nodejs.util.promisify.custom"),f))(function f($){if(typeof $!=="function")throw new TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&$[kCustomPromisifiedSymbol]){var Z=$[kCustomPromisifiedSymbol];if(typeof Z!=="function")throw new TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0}),Z}function Z(...J){var z,Q,Y=new Promise(function(X,W){z=X,Q=W});J.push(function(X,W){if(X)Q(X);else z(W)});try{$.apply(this,J)}catch(X){Q(X)}return Y}if(Object.setPrototypeOf(Z,Object.getPrototypeOf($)),kCustomPromisifiedSymbol)Object.defineProperty(Z,kCustomPromisifiedSymbol,{value:Z,enumerable:!1,writable:!1,configurable:!0});return Object.defineProperties(Z,Object.getOwnPropertyDescriptors($))});({TextEncoder:L8,TextDecoder:M8}=globalThis)});var K1={};Jf(K1,{throws:()=>vJ,strictEqual:()=>_J,strict:()=>bJ,rejects:()=>EJ,ok:()=>PJ,notStrictEqual:()=>SJ,notEqual:()=>IJ,notDeepStrictEqual:()=>RJ,notDeepEqual:()=>NJ,match:()=>CJ,ifError:()=>TJ,fail:()=>jJ,equal:()=>qJ,doesNotThrow:()=>AJ,doesNotReject:()=>MJ,doesNotMatch:()=>LJ,default:()=>gJ,deepStrictEqual:()=>OJ,deepEqual:()=>DJ,CallTracker:()=>KJ,AssertionError:()=>GJ});var A8,q8,t4,j8,T8,C8=(f,$,Z)=>{Z=f!=null?A8(q8(f)):{};let J=$||!f||!f.__esModule?t4(Z,"default",{value:f,enumerable:!0}):Z;for(let z of j8(f))if(!T8.call(J,z))t4(J,z,{get:()=>f[z],enumerable:!0});return J},y=(f,$)=>()=>($||f(($={exports:{}}).exports,$),$.exports),Tf,x1,Cf,N8,R8,I8,S8,e4,F1,P8,E8,b8,_8,v8,g8,x8,k8,u8,y8,t0,k1,c8,f$,$$,h8,G1,Nf,Rf,m8,Z$,If,d8,Sf,J$,Pf,e0,i8,n8,l8,p8,o8,r8,s8,a8,z$,Q$,t8,e8,u1,Y$,fJ,$J,ZJ,JJ,zJ,B1,X$,QJ,W$,YJ,w$,XJ,WJ,H$,Ef,wJ,y1,HJ,VJ,V$,U$,UJ,BJ,FJ,jf,B$,GJ,KJ,DJ,OJ,LJ,MJ,AJ,qJ,jJ,TJ,CJ,NJ,RJ,IJ,SJ,PJ,EJ,bJ,_J,vJ,gJ;var D1=zf(()=>{A8=Object.create,{getPrototypeOf:q8,defineProperty:t4,getOwnPropertyNames:j8}=Object,T8=Object.prototype.hasOwnProperty,Tf=y((f,$)=>{$.exports=function Z(){if(typeof Symbol!=="function"||typeof Object.getOwnPropertySymbols!=="function")return!1;if(typeof Symbol.iterator==="symbol")return!0;var J={},z=Symbol("test"),Q=Object(z);if(typeof z==="string")return!1;if(Object.prototype.toString.call(z)!=="[object Symbol]")return!1;if(Object.prototype.toString.call(Q)!=="[object Symbol]")return!1;var Y=42;J[z]=Y;for(var X in J)return!1;if(typeof Object.keys==="function"&&Object.keys(J).length!==0)return!1;if(typeof Object.getOwnPropertyNames==="function"&&Object.getOwnPropertyNames(J).length!==0)return!1;var W=Object.getOwnPropertySymbols(J);if(W.length!==1||W[0]!==z)return!1;if(!Object.prototype.propertyIsEnumerable.call(J,z))return!1;if(typeof Object.getOwnPropertyDescriptor==="function"){var H=Object.getOwnPropertyDescriptor(J,z);if(H.value!==Y||H.enumerable!==!0)return!1}return!0}}),x1=y((f,$)=>{var Z=Tf();$.exports=function J(){return Z()&&!!Symbol.toStringTag}}),Cf=y((f,$)=>{$.exports=Object}),N8=y((f,$)=>{$.exports=Error}),R8=y((f,$)=>{$.exports=EvalError}),I8=y((f,$)=>{$.exports=RangeError}),S8=y((f,$)=>{$.exports=ReferenceError}),e4=y((f,$)=>{$.exports=SyntaxError}),F1=y((f,$)=>{$.exports=TypeError}),P8=y((f,$)=>{$.exports=URIError}),E8=y((f,$)=>{$.exports=Math.abs}),b8=y((f,$)=>{$.exports=Math.floor}),_8=y((f,$)=>{$.exports=Math.max}),v8=y((f,$)=>{$.exports=Math.min}),g8=y((f,$)=>{$.exports=Math.pow}),x8=y((f,$)=>{$.exports=Math.round}),k8=y((f,$)=>{$.exports=Number.isNaN||function Z(J){return J!==J}}),u8=y((f,$)=>{var Z=k8();$.exports=function J(z){if(Z(z)||z===0)return z;return z<0?-1:1}}),y8=y((f,$)=>{$.exports=Object.getOwnPropertyDescriptor}),t0=y((f,$)=>{var Z=y8();if(Z)try{Z([],"length")}catch(J){Z=null}$.exports=Z}),k1=y((f,$)=>{var Z=Object.defineProperty||!1;if(Z)try{Z({},"a",{value:1})}catch(J){Z=!1}$.exports=Z}),c8=y((f,$)=>{var Z=typeof Symbol!=="undefined"&&Symbol,J=Tf();$.exports=function z(){if(typeof Z!=="function")return!1;if(typeof Symbol!=="function")return!1;if(typeof Z("foo")!=="symbol")return!1;if(typeof Symbol("bar")!=="symbol")return!1;return J()}}),f$=y((f,$)=>{$.exports=typeof Reflect!=="undefined"&&Reflect.getPrototypeOf||null}),$$=y((f,$)=>{var Z=Cf();$.exports=Z.getPrototypeOf||null}),h8=y((f,$)=>{var Z="Function.prototype.bind called on incompatible ",J=Object.prototype.toString,z=Math.max,Q="[object Function]",Y=function H(w,K){var O=[];for(var j=0;j<w.length;j+=1)O[j]=w[j];for(var M=0;M<K.length;M+=1)O[M+w.length]=K[M];return O},X=function H(w,K){var O=[];for(var j=K||0,M=0;j<w.length;j+=1,M+=1)O[M]=w[j];return O},W=function(H,w){var K="";for(var O=0;O<H.length;O+=1)if(K+=H[O],O+1<H.length)K+=w;return K};$.exports=function H(w){var K=this;if(typeof K!=="function"||J.apply(K)!==Q)throw new TypeError(Z+K);var O=X(arguments,1),j,M=function(){if(this instanceof j){var _=K.apply(this,Y(O,arguments));if(Object(_)===_)return _;return this}return K.apply(w,Y(O,arguments))},S=z(0,K.length-O.length),v=[];for(var g=0;g<S;g++)v[g]="$"+g;if(j=Function("binder","return function ("+W(v,",")+"){ return binder.apply(this,arguments); }")(M),K.prototype){var x=function _(){};x.prototype=K.prototype,j.prototype=new x,x.prototype=null}return j}}),G1=y((f,$)=>{var Z=h8();$.exports=Function.prototype.bind||Z}),Nf=y((f,$)=>{$.exports=Function.prototype.call}),Rf=y((f,$)=>{$.exports=Function.prototype.apply}),m8=y((f,$)=>{$.exports=typeof Reflect!=="undefined"&&Reflect&&Reflect.apply}),Z$=y((f,$)=>{var Z=G1(),J=Rf(),z=Nf(),Q=m8();$.exports=Q||Z.call(z,J)}),If=y((f,$)=>{var Z=G1(),J=F1(),z=Nf(),Q=Z$();$.exports=function Y(X){if(X.length<1||typeof X[0]!=="function")throw new J("a function is required");return Q(Z,z,X)}}),d8=y((f,$)=>{var Z=If(),J=t0(),z;try{z=[].__proto__===Array.prototype}catch(W){if(!W||typeof W!=="object"||!("code"in W)||W.code!=="ERR_PROTO_ACCESS")throw W}var Q=!!z&&J&&J(Object.prototype,"__proto__"),Y=Object,X=Y.getPrototypeOf;$.exports=Q&&typeof Q.get==="function"?Z([Q.get]):typeof X==="function"?function W(H){return X(H==null?H:Y(H))}:!1}),Sf=y((f,$)=>{var Z=f$(),J=$$(),z=d8();$.exports=Z?function Q(Y){return Z(Y)}:J?function Q(Y){if(!Y||typeof Y!=="object"&&typeof Y!=="function")throw new TypeError("getProto: not an object");return J(Y)}:z?function Q(Y){return z(Y)}:null}),J$=y((f,$)=>{var Z=Function.prototype.call,J=Object.prototype.hasOwnProperty,z=G1();$.exports=z.call(Z,J)}),Pf=y((f,$)=>{var Z,J=Cf(),z=N8(),Q=R8(),Y=I8(),X=S8(),W=e4(),H=F1(),w=P8(),K=E8(),O=b8(),j=_8(),M=v8(),S=g8(),v=x8(),g=u8(),x=Function,_=function(B){try{return x('"use strict"; return ('+B+").constructor;")()}catch(A){}},b=t0(),i=k1(),a=function(){throw new H},N=b?function(){try{return arguments.callee,a}catch(B){try{return b(arguments,"callee").get}catch(A){return a}}}():a,T=c8()(),R=Sf(),h=$$(),r=f$(),m=Rf(),$0=Nf(),n={},w0=typeof Uint8Array==="undefined"||!R?Z:R(Uint8Array),H0={__proto__:null,"%AggregateError%":typeof AggregateError==="undefined"?Z:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer==="undefined"?Z:ArrayBuffer,"%ArrayIteratorPrototype%":T&&R?R([][Symbol.iterator]()):Z,"%AsyncFromSyncIteratorPrototype%":Z,"%AsyncFunction%":n,"%AsyncGenerator%":n,"%AsyncGeneratorFunction%":n,"%AsyncIteratorPrototype%":n,"%Atomics%":typeof Atomics==="undefined"?Z:Atomics,"%BigInt%":typeof BigInt==="undefined"?Z:BigInt,"%BigInt64Array%":typeof BigInt64Array==="undefined"?Z:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array==="undefined"?Z:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView==="undefined"?Z:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":z,"%eval%":eval,"%EvalError%":Q,"%Float16Array%":typeof Float16Array==="undefined"?Z:Float16Array,"%Float32Array%":typeof Float32Array==="undefined"?Z:Float32Array,"%Float64Array%":typeof Float64Array==="undefined"?Z:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry==="undefined"?Z:FinalizationRegistry,"%Function%":x,"%GeneratorFunction%":n,"%Int8Array%":typeof Int8Array==="undefined"?Z:Int8Array,"%Int16Array%":typeof Int16Array==="undefined"?Z:Int16Array,"%Int32Array%":typeof Int32Array==="undefined"?Z:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":T&&R?R(R([][Symbol.iterator]())):Z,"%JSON%":typeof JSON==="object"?JSON:Z,"%Map%":typeof Map==="undefined"?Z:Map,"%MapIteratorPrototype%":typeof Map==="undefined"||!T||!R?Z:R(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":J,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise==="undefined"?Z:Promise,"%Proxy%":typeof Proxy==="undefined"?Z:Proxy,"%RangeError%":Y,"%ReferenceError%":X,"%Reflect%":typeof Reflect==="undefined"?Z:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set==="undefined"?Z:Set,"%SetIteratorPrototype%":typeof Set==="undefined"||!T||!R?Z:R(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer==="undefined"?Z:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":T&&R?R(""[Symbol.iterator]()):Z,"%Symbol%":T?Symbol:Z,"%SyntaxError%":W,"%ThrowTypeError%":N,"%TypedArray%":w0,"%TypeError%":H,"%Uint8Array%":typeof Uint8Array==="undefined"?Z:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray==="undefined"?Z:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array==="undefined"?Z:Uint16Array,"%Uint32Array%":typeof Uint32Array==="undefined"?Z:Uint32Array,"%URIError%":w,"%WeakMap%":typeof WeakMap==="undefined"?Z:WeakMap,"%WeakRef%":typeof WeakRef==="undefined"?Z:WeakRef,"%WeakSet%":typeof WeakSet==="undefined"?Z:WeakSet,"%Function.prototype.call%":$0,"%Function.prototype.apply%":m,"%Object.defineProperty%":i,"%Object.getPrototypeOf%":h,"%Math.abs%":K,"%Math.floor%":O,"%Math.max%":j,"%Math.min%":M,"%Math.pow%":S,"%Math.round%":v,"%Math.sign%":g,"%Reflect.getPrototypeOf%":r};if(R)try{null.error}catch(B){A0=R(R(B)),H0["%Error.prototype%"]=A0}var A0,V0=function B(A){var u;if(A==="%AsyncFunction%")u=_("async function () {}");else if(A==="%GeneratorFunction%")u=_("function* () {}");else if(A==="%AsyncGeneratorFunction%")u=_("async function* () {}");else if(A==="%AsyncGenerator%"){var P=B("%AsyncGeneratorFunction%");if(P)u=P.prototype}else if(A==="%AsyncIteratorPrototype%"){var p=B("%AsyncGenerator%");if(p&&R)u=R(p.prototype)}return H0[A]=u,u},O0={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},F0=G1(),I=J$(),V=F0.call($0,Array.prototype.concat),G=F0.call(m,Array.prototype.splice),L=F0.call($0,String.prototype.replace),E=F0.call($0,String.prototype.slice),d=F0.call($0,RegExp.prototype.exec),s=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,c=/\\(\\)?/g,D=function B(A){var u=E(A,0,1),P=E(A,-1);if(u==="%"&&P!=="%")throw new W("invalid intrinsic syntax, expected closing `%`");else if(P==="%"&&u!=="%")throw new W("invalid intrinsic syntax, expected opening `%`");var p=[];return L(A,s,function(t,Y0,X0,C){p[p.length]=X0?L(C,c,"$1"):Y0||t}),p},U=function B(A,u){var P=A,p;if(I(O0,P))p=O0[P],P="%"+p[0]+"%";if(I(H0,P)){var t=H0[P];if(t===n)t=V0(P);if(typeof t==="undefined"&&!u)throw new H("intrinsic "+A+" exists, but is not available. Please file an issue!");return{alias:p,name:P,value:t}}throw new W("intrinsic "+A+" does not exist!")};$.exports=function B(A,u){if(typeof A!=="string"||A.length===0)throw new H("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof u!=="boolean")throw new H('"allowMissing" argument must be a boolean');if(d(/^%?[^%]*%?$/,A)===null)throw new W("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var P=D(A),p=P.length>0?P[0]:"",t=U("%"+p+"%",u),Y0=t.name,X0=t.value,C=!1,L0=t.alias;if(L0)p=L0[0],G(P,V([0,1],L0));for(var b0=1,E0=!0;b0<P.length;b0+=1){var U0=P[b0],R0=E(U0,0,1),N0=E(U0,-1);if((R0==='"'||R0==="'"||R0==="`"||(N0==='"'||N0==="'"||N0==="`"))&&R0!==N0)throw new W("property names with quotes must have matching quotes");if(U0==="constructor"||!E0)C=!0;if(p+="."+U0,Y0="%"+p+"%",I(H0,Y0))X0=H0[Y0];else if(X0!=null){if(!(U0 in X0)){if(!u)throw new H("base intrinsic for "+A+" exists, but the property is not available.");return}if(b&&b0+1>=P.length){var _0=b(X0,U0);if(E0=!!_0,E0&&"get"in _0&&!("originalValue"in _0.get))X0=_0.get;else X0=X0[U0]}else E0=I(X0,U0),X0=X0[U0];if(E0&&!C)H0[Y0]=X0}}return X0}}),e0=y((f,$)=>{var Z=Pf(),J=If(),z=J([Z("%String.prototype.indexOf%")]);$.exports=function Q(Y,X){var W=Z(Y,!!X);if(typeof W==="function"&&z(Y,".prototype.")>-1)return J([W]);return W}}),i8=y((f,$)=>{var Z=x1()(),J=e0(),z=J("Object.prototype.toString"),Q=function W(H){if(Z&&H&&typeof H==="object"&&Symbol.toStringTag in H)return!1;return z(H)==="[object Arguments]"},Y=function W(H){if(Q(H))return!0;return H!==null&&typeof H==="object"&&"length"in H&&typeof H.length==="number"&&H.length>=0&&z(H)!=="[object Array]"&&"callee"in H&&z(H.callee)==="[object Function]"},X=function(){return Q(arguments)}();Q.isLegacyArguments=Y,$.exports=X?Q:Y}),n8=y((f,$)=>{var Z=e0(),J=x1()(),z=J$(),Q=t0(),Y;if(J){if(X=Z("RegExp.prototype.exec"),W={},H=function(){throw W},w={toString:H,valueOf:H},typeof Symbol.toPrimitive==="symbol")w[Symbol.toPrimitive]=H;Y=function j(M){if(!M||typeof M!=="object")return!1;var S=Q(M,"lastIndex"),v=S&&z(S,"value");if(!v)return!1;try{X(M,w)}catch(g){return g===W}}}else K=Z("Object.prototype.toString"),O="[object RegExp]",Y=function j(M){if(!M||typeof M!=="object"&&typeof M!=="function")return!1;return K(M)===O};var X,W,H,w,K,O;$.exports=Y}),l8=y((f,$)=>{var Z=e0(),J=n8(),z=Z("RegExp.prototype.exec"),Q=F1();$.exports=function Y(X){if(!J(X))throw new Q("`regex` must be a RegExp");return function W(H){return z(X,H)!==null}}}),p8=y((f,$)=>{var Z=e0(),J=l8(),z=J(/^\s*(?:function)?\*/),Q=x1()(),Y=Sf(),X=Z("Object.prototype.toString"),W=Z("Function.prototype.toString"),H=function(){if(!Q)return!1;try{return Function("return function*() {}")()}catch(K){}},w;$.exports=function K(O){if(typeof O!=="function")return!1;if(z(W(O)))return!0;if(!Q){var j=X(O);return j==="[object GeneratorFunction]"}if(!Y)return!1;if(typeof w==="undefined"){var M=H();w=M?Y(M):!1}return Y(O)===w}}),o8=y((f,$)=>{var Z=Function.prototype.toString,J=typeof Reflect==="object"&&Reflect!==null&&Reflect.apply,z,Q;if(typeof J==="function"&&typeof Object.defineProperty==="function")try{z=Object.defineProperty({},"length",{get:function(){throw Q}}),Q={},J(function(){throw 42},null,z)}catch(b){if(b!==Q)J=null}else J=null;var Y=/^\s*class\b/,X=function b(i){try{var a=Z.call(i);return Y.test(a)}catch(N){return!1}},W=function b(i){try{if(X(i))return!1;return Z.call(i),!0}catch(a){return!1}},H=Object.prototype.toString,w="[object Object]",K="[object Function]",O="[object GeneratorFunction]",j="[object HTMLAllCollection]",M="[object HTML document.all class]",S="[object HTMLCollection]",v=typeof Symbol==="function"&&!!Symbol.toStringTag,g=!(0 in[,]),x=function b(){return!1};if(typeof document==="object"){if(_=document.all,H.call(_)===H.call(document.all))x=function b(i){if((g||!i)&&(typeof i==="undefined"||typeof i==="object"))try{var a=H.call(i);return(a===j||a===M||a===S||a===w)&&i("")==null}catch(N){}return!1}}var _;$.exports=J?function b(i){if(x(i))return!0;if(!i)return!1;if(typeof i!=="function"&&typeof i!=="object")return!1;try{J(i,null,z)}catch(a){if(a!==Q)return!1}return!X(i)&&W(i)}:function b(i){if(x(i))return!0;if(!i)return!1;if(typeof i!=="function"&&typeof i!=="object")return!1;if(v)return W(i);if(X(i))return!1;var a=H.call(i);if(a!==K&&a!==O&&!/^\[object HTML/.test(a))return!1;return W(i)}}),r8=y((f,$)=>{var Z=o8(),J=Object.prototype.toString,z=Object.prototype.hasOwnProperty,Q=function H(w,K,O){for(var j=0,M=w.length;j<M;j++)if(z.call(w,j))if(O==null)K(w[j],j,w);else K.call(O,w[j],j,w)},Y=function H(w,K,O){for(var j=0,M=w.length;j<M;j++)if(O==null)K(w.charAt(j),j,w);else K.call(O,w.charAt(j),j,w)},X=function H(w,K,O){for(var j in w)if(z.call(w,j))if(O==null)K(w[j],j,w);else K.call(O,w[j],j,w)};function W(H){return J.call(H)==="[object Array]"}$.exports=function H(w,K,O){if(!Z(K))throw new TypeError("iterator must be a function");var j;if(arguments.length>=3)j=O;if(W(w))Q(w,K,j);else if(typeof w==="string")Y(w,K,j);else X(w,K,j)}}),s8=y((f,$)=>{$.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),a8=y((f,$)=>{var Z=s8(),J=typeof globalThis==="undefined"?global:globalThis;$.exports=function z(){var Q=[];for(var Y=0;Y<Z.length;Y++)if(typeof J[Z[Y]]==="function")Q[Q.length]=Z[Y];return Q}}),z$=y((f,$)=>{var Z=k1(),J=e4(),z=F1(),Q=t0();$.exports=function Y(X,W,H){if(!X||typeof X!=="object"&&typeof X!=="function")throw new z("`obj` must be an object or a function`");if(typeof W!=="string"&&typeof W!=="symbol")throw new z("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=="boolean"&&arguments[3]!==null)throw new z("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=="boolean"&&arguments[4]!==null)throw new z("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=="boolean"&&arguments[5]!==null)throw new z("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=="boolean")throw new z("`loose`, if provided, must be a boolean");var w=arguments.length>3?arguments[3]:null,K=arguments.length>4?arguments[4]:null,O=arguments.length>5?arguments[5]:null,j=arguments.length>6?arguments[6]:!1,M=!!Q&&Q(X,W);if(Z)Z(X,W,{configurable:O===null&&M?M.configurable:!O,enumerable:w===null&&M?M.enumerable:!w,value:H,writable:K===null&&M?M.writable:!K});else if(j||!w&&!K&&!O)X[W]=H;else throw new J("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),Q$=y((f,$)=>{var Z=k1(),J=function z(){return!!Z};J.hasArrayLengthDefineBug=function z(){if(!Z)return null;try{return Z([],"length",{value:1}).length!==1}catch(Q){return!0}},$.exports=J}),t8=y((f,$)=>{var Z=Pf(),J=z$(),z=Q$()(),Q=t0(),Y=F1(),X=Z("%Math.floor%");$.exports=function W(H,w){if(typeof H!=="function")throw new Y("`fn` is not a function");if(typeof w!=="number"||w<0||w>4294967295||X(w)!==w)throw new Y("`length` must be a positive 32-bit integer");var K=arguments.length>2&&!!arguments[2],O=!0,j=!0;if("length"in H&&Q){var M=Q(H,"length");if(M&&!M.configurable)O=!1;if(M&&!M.writable)j=!1}if(O||j||!K)if(z)J(H,"length",w,!0,!0);else J(H,"length",w);return H}}),e8=y((f,$)=>{var Z=G1(),J=Rf(),z=Z$();$.exports=function Q(){return z(Z,J,arguments)}}),u1=y((f,$)=>{var Z=t8(),J=k1(),z=If(),Q=e8();if($.exports=function Y(X){var W=z(arguments),H=X.length-(arguments.length-1);return Z(W,1+(H>0?H:0),!0)},J)J($.exports,"apply",{value:Q});else $.exports.apply=Q}),Y$=y((f,$)=>{var Z=r8(),J=a8(),z=u1(),Q=e0(),Y=t0(),X=Sf(),W=Q("Object.prototype.toString"),H=x1()(),w=typeof globalThis==="undefined"?global:globalThis,K=J(),O=Q("String.prototype.slice"),j=Q("Array.prototype.indexOf",!0)||function g(x,_){for(var b=0;b<x.length;b+=1)if(x[b]===_)return b;return-1},M={__proto__:null};if(H&&Y&&X)Z(K,function(g){var x=new w[g];if(Symbol.toStringTag in x&&X){var _=X(x),b=Y(_,Symbol.toStringTag);if(!b&&_){var i=X(_);b=Y(i,Symbol.toStringTag)}M["$"+g]=z(b.get)}});else Z(K,function(g){var x=new w[g],_=x.slice||x.set;if(_)M["$"+g]=z(_)});var S=function g(x){var _=!1;return Z(M,function(b,i){if(!_)try{if("$"+b(x)===i)_=O(i,1)}catch(a){}}),_},v=function g(x){var _=!1;return Z(M,function(b,i){if(!_)try{b(x),_=O(i,1)}catch(a){}}),_};$.exports=function g(x){if(!x||typeof x!=="object")return!1;if(!H){var _=O(W(x),8,-1);if(j(K,_)>-1)return _;if(_!=="Object")return!1;return v(x)}if(!Y)return null;return S(x)}}),fJ=y((f,$)=>{var Z=Y$();$.exports=function J(z){return!!Z(z)}}),$J=y((f)=>{var $=i8(),Z=p8(),J=Y$(),z=fJ();function Q(C){return C.call.bind(C)}var Y=typeof BigInt!=="undefined",X=typeof Symbol!=="undefined",W=Q(Object.prototype.toString),H=Q(Number.prototype.valueOf),w=Q(String.prototype.valueOf),K=Q(Boolean.prototype.valueOf);if(Y)O=Q(BigInt.prototype.valueOf);var O;if(X)j=Q(Symbol.prototype.valueOf);var j;function M(C,L0){if(typeof C!=="object")return!1;try{return L0(C),!0}catch(b0){return!1}}f.isArgumentsObject=$,f.isGeneratorFunction=Z,f.isTypedArray=z;function S(C){return typeof Promise!=="undefined"&&C instanceof Promise||C!==null&&typeof C==="object"&&typeof C.then==="function"&&typeof C.catch==="function"}f.isPromise=S;function v(C){if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView)return ArrayBuffer.isView(C);return z(C)||G(C)}f.isArrayBufferView=v;function g(C){return J(C)==="Uint8Array"}f.isUint8Array=g;function x(C){return J(C)==="Uint8ClampedArray"}f.isUint8ClampedArray=x;function _(C){return J(C)==="Uint16Array"}f.isUint16Array=_;function b(C){return J(C)==="Uint32Array"}f.isUint32Array=b;function i(C){return J(C)==="Int8Array"}f.isInt8Array=i;function a(C){return J(C)==="Int16Array"}f.isInt16Array=a;function N(C){return J(C)==="Int32Array"}f.isInt32Array=N;function T(C){return J(C)==="Float32Array"}f.isFloat32Array=T;function R(C){return J(C)==="Float64Array"}f.isFloat64Array=R;function h(C){return J(C)==="BigInt64Array"}f.isBigInt64Array=h;function r(C){return J(C)==="BigUint64Array"}f.isBigUint64Array=r;function m(C){return W(C)==="[object Map]"}m.working=typeof Map!=="undefined"&&m(new Map);function $0(C){if(typeof Map==="undefined")return!1;return m.working?m(C):C instanceof Map}f.isMap=$0;function n(C){return W(C)==="[object Set]"}n.working=typeof Set!=="undefined"&&n(new Set);function w0(C){if(typeof Set==="undefined")return!1;return n.working?n(C):C instanceof Set}f.isSet=w0;function H0(C){return W(C)==="[object WeakMap]"}H0.working=typeof WeakMap!=="undefined"&&H0(new WeakMap);function A0(C){if(typeof WeakMap==="undefined")return!1;return H0.working?H0(C):C instanceof WeakMap}f.isWeakMap=A0;function V0(C){return W(C)==="[object WeakSet]"}V0.working=typeof WeakSet!=="undefined"&&V0(new WeakSet);function O0(C){return V0(C)}f.isWeakSet=O0;function F0(C){return W(C)==="[object ArrayBuffer]"}F0.working=typeof ArrayBuffer!=="undefined"&&F0(new ArrayBuffer);function I(C){if(typeof ArrayBuffer==="undefined")return!1;return F0.working?F0(C):C instanceof ArrayBuffer}f.isArrayBuffer=I;function V(C){return W(C)==="[object DataView]"}V.working=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"&&V(new DataView(new ArrayBuffer(1),0,1));function G(C){if(typeof DataView==="undefined")return!1;return V.working?V(C):C instanceof DataView}f.isDataView=G;var L=typeof SharedArrayBuffer!=="undefined"?SharedArrayBuffer:void 0;function E(C){return W(C)==="[object SharedArrayBuffer]"}function d(C){if(typeof L==="undefined")return!1;if(typeof E.working==="undefined")E.working=E(new L);return E.working?E(C):C instanceof L}f.isSharedArrayBuffer=d;function s(C){return W(C)==="[object AsyncFunction]"}f.isAsyncFunction=s;function c(C){return W(C)==="[object Map Iterator]"}f.isMapIterator=c;function D(C){return W(C)==="[object Set Iterator]"}f.isSetIterator=D;function U(C){return W(C)==="[object Generator]"}f.isGeneratorObject=U;function B(C){return W(C)==="[object WebAssembly.Module]"}f.isWebAssemblyCompiledModule=B;function A(C){return M(C,H)}f.isNumberObject=A;function u(C){return M(C,w)}f.isStringObject=u;function P(C){return M(C,K)}f.isBooleanObject=P;function p(C){return Y&&M(C,O)}f.isBigIntObject=p;function t(C){return X&&M(C,j)}f.isSymbolObject=t;function Y0(C){return A(C)||u(C)||P(C)||p(C)||t(C)}f.isBoxedPrimitive=Y0;function X0(C){return typeof Uint8Array!=="undefined"&&(I(C)||d(C))}f.isAnyArrayBuffer=X0,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(C){Object.defineProperty(f,C,{enumerable:!1,value:function(){throw new Error(C+" is not supported in userland")}})})}),ZJ=y((f,$)=>{$.exports=function Z(J){return J instanceof Buffer}}),JJ=y((f,$)=>{if(typeof Object.create==="function")$.exports=function Z(J,z){if(z)J.super_=z,J.prototype=Object.create(z.prototype,{constructor:{value:J,enumerable:!1,writable:!0,configurable:!0}})};else $.exports=function Z(J,z){if(z){J.super_=z;var Q=function(){};Q.prototype=z.prototype,J.prototype=new Q,J.prototype.constructor=J}}}),zJ=y((f,$)=>{try{if(Z=(a4(),o0(s4)),typeof Z.inherits!=="function")throw"";$.exports=Z.inherits}catch(J){$.exports=JJ()}var Z}),B1=y((f)=>{var $=Object.getOwnPropertyDescriptors||function V(G){var L=Object.keys(G),E={};for(var d=0;d<L.length;d++)E[L[d]]=Object.getOwnPropertyDescriptor(G,L[d]);return E},Z=/%[sdj%]/g;f.format=function(V){if(!i(V)){var G=[];for(var L=0;L<arguments.length;L++)G.push(Y(arguments[L]));return G.join(" ")}var L=1,E=arguments,d=E.length,s=String(V).replace(Z,function(D){if(D==="%%")return"%";if(L>=d)return D;switch(D){case"%s":return String(E[L++]);case"%d":return Number(E[L++]);case"%j":try{return JSON.stringify(E[L++])}catch(U){return"[Circular]"}default:return D}});for(var c=E[L];L<d;c=E[++L])if(x(c)||!R(c))s+=" "+c;else s+=" "+Y(c);return s},f.deprecate=function(V,G){if(typeof process!=="undefined"&&process.noDeprecation===!0)return V;if(typeof process==="undefined")return function(){return f.deprecate(V,G).apply(this,arguments)};var L=!1;function E(){if(!L){if(process.throwDeprecation)throw new Error(G);else if(process.traceDeprecation)console.trace(G);else console.error(G);L=!0}return V.apply(this,arguments)}return E};var J={},z=/^$/;if(process.env.NODE_DEBUG)Q=process.env.NODE_DEBUG,Q=Q.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),z=new RegExp("^"+Q+"$","i");var Q;f.debuglog=function(V){if(V=V.toUpperCase(),!J[V])if(z.test(V)){var G=process.pid;J[V]=function(){var L=f.format.apply(f,arguments);console.error("%s %d: %s",V,G,L)}}else J[V]=function(){};return J[V]};function Y(V,G){var L={seen:[],stylize:W};if(arguments.length>=3)L.depth=arguments[2];if(arguments.length>=4)L.colors=arguments[3];if(g(G))L.showHidden=G;else if(G)f._extend(L,G);if(N(L.showHidden))L.showHidden=!1;if(N(L.depth))L.depth=2;if(N(L.colors))L.colors=!1;if(N(L.customInspect))L.customInspect=!0;if(L.colors)L.stylize=X;return w(L,V,L.depth)}f.inspect=Y,Y.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Y.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function X(V,G){var L=Y.styles[G];if(L)return"\x1B["+Y.colors[L][0]+"m"+V+"\x1B["+Y.colors[L][1]+"m";else return V}function W(V,G){return V}function H(V){var G={};return V.forEach(function(L,E){G[L]=!0}),G}function w(V,G,L){if(V.customInspect&&G&&m(G.inspect)&&G.inspect!==f.inspect&&!(G.constructor&&G.constructor.prototype===G)){var E=G.inspect(L,V);if(!i(E))E=w(V,E,L);return E}var d=K(V,G);if(d)return d;var s=Object.keys(G),c=H(s);if(V.showHidden)s=Object.getOwnPropertyNames(G);if(r(G)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return O(G);if(s.length===0){if(m(G)){var D=G.name?": "+G.name:"";return V.stylize("[Function"+D+"]","special")}if(T(G))return V.stylize(RegExp.prototype.toString.call(G),"regexp");if(h(G))return V.stylize(Date.prototype.toString.call(G),"date");if(r(G))return O(G)}var U="",B=!1,A=["{","}"];if(v(G))B=!0,A=["[","]"];if(m(G)){var u=G.name?": "+G.name:"";U=" [Function"+u+"]"}if(T(G))U=" "+RegExp.prototype.toString.call(G);if(h(G))U=" "+Date.prototype.toUTCString.call(G);if(r(G))U=" "+O(G);if(s.length===0&&(!B||G.length==0))return A[0]+U+A[1];if(L<0)if(T(G))return V.stylize(RegExp.prototype.toString.call(G),"regexp");else return V.stylize("[Object]","special");V.seen.push(G);var P;if(B)P=j(V,G,L,c,s);else P=s.map(function(p){return M(V,G,L,c,p,B)});return V.seen.pop(),S(P,U,A)}function K(V,G){if(N(G))return V.stylize("undefined","undefined");if(i(G)){var L="'"+JSON.stringify(G).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return V.stylize(L,"string")}if(b(G))return V.stylize(""+G,"number");if(g(G))return V.stylize(""+G,"boolean");if(x(G))return V.stylize("null","null")}function O(V){return"["+Error.prototype.toString.call(V)+"]"}function j(V,G,L,E,d){var s=[];for(var c=0,D=G.length;c<D;++c)if(V0(G,String(c)))s.push(M(V,G,L,E,String(c),!0));else s.push("");return d.forEach(function(U){if(!U.match(/^\d+$/))s.push(M(V,G,L,E,U,!0))}),s}function M(V,G,L,E,d,s){var c,D,U;if(U=Object.getOwnPropertyDescriptor(G,d)||{value:G[d]},U.get)if(U.set)D=V.stylize("[Getter/Setter]","special");else D=V.stylize("[Getter]","special");else if(U.set)D=V.stylize("[Setter]","special");if(!V0(E,d))c="["+d+"]";if(!D)if(V.seen.indexOf(U.value)<0){if(x(L))D=w(V,U.value,null);else D=w(V,U.value,L-1);if(D.indexOf(`
|
|
64
64
|
`)>-1)if(s)D=D.split(`
|
|
65
65
|
`).map(function(B){return" "+B}).join(`
|
|
66
66
|
`).slice(2);else D=`
|
|
@@ -115,7 +115,7 @@ try {
|
|
|
115
115
|
|
|
116
116
|
should equal
|
|
117
117
|
|
|
118
|
-
`);else t=" ".concat(c," ").concat(t)}d=G.call(this,"".concat(p).concat(t))}}if(Error.stackTraceLimit=A,d.generatedMessage=!s,Object.defineProperty(j(d),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),d.code="ERR_ASSERTION",d.actual=U,d.expected=B,d.operator=c,Error.captureStackTrace)Error.captureStackTrace(j(d),D);return d.stack,d.name="AssertionError",O(d)}return X(L,[{key:"toString",value:function E(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:V,value:function E(d,s){return a(this,J(J({},s),{},{customInspect:!1,depth:0}))}}]),L}(M(Error),a.custom);$.exports=F0}),W$=y((f,$)=>{var Z=Object.prototype.toString;$.exports=function J(z){var Q=Z.call(z),Y=Q==="[object Arguments]";if(!Y)Y=Q!=="[object Array]"&&z!==null&&typeof z==="object"&&typeof z.length==="number"&&z.length>=0&&Z.call(z.callee)==="[object Function]";return Y}}),YJ=y((f,$)=>{var Z;if(!Object.keys)J=Object.prototype.hasOwnProperty,z=Object.prototype.toString,Q=W$(),Y=Object.prototype.propertyIsEnumerable,X=!Y.call({toString:null},"toString"),W=Y.call(function(){},"prototype"),H=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],w=function(M){var S=M.constructor;return S&&S.prototype===M},K={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},O=function(){if(typeof window==="undefined")return!1;for(var M in window)try{if(!K["$"+M]&&J.call(window,M)&&window[M]!==null&&typeof window[M]==="object")try{w(window[M])}catch(S){return!0}}catch(S){return!0}return!1}(),j=function(M){if(typeof window==="undefined"||!O)return w(M);try{return w(M)}catch(S){return!1}},Z=function M(S){var v=S!==null&&typeof S==="object",g=z.call(S)==="[object Function]",x=Q(S),_=v&&z.call(S)==="[object String]",b=[];if(!v&&!g&&!x)throw new TypeError("Object.keys called on a non-object");var i=W&&g;if(_&&S.length>0&&!J.call(S,0))for(var a=0;a<S.length;++a)b.push(String(a));if(x&&S.length>0)for(var N=0;N<S.length;++N)b.push(String(N));else for(var T in S)if(!(i&&T==="prototype")&&J.call(S,T))b.push(String(T));if(X){var R=j(S);for(var h=0;h<H.length;++h)if(!(R&&H[h]==="constructor")&&J.call(S,H[h]))b.push(H[h])}return b};var J,z,Q,Y,X,W,H,w,K,O,j;$.exports=Z}),w$=y((f,$)=>{var Z=Array.prototype.slice,J=W$(),z=Object.keys,Q=z?function X(W){return z(W)}:YJ(),Y=Object.keys;Q.shim=function X(){if(Object.keys){var W=function(){var H=Object.keys(arguments);return H&&H.length===arguments.length}(1,2);if(!W)Object.keys=function H(w){if(J(w))return Y(Z.call(w));return Y(w)}}else Object.keys=Q;return Object.keys||Q},$.exports=Q}),XJ=y((f,$)=>{var Z=w$(),J=Tf()(),z=e0(),Q=Cf(),Y=z("Array.prototype.push"),X=z("Object.prototype.propertyIsEnumerable"),W=J?Q.getOwnPropertySymbols:null;$.exports=function H(w,K){if(w==null)throw new TypeError("target must be an object");var O=Q(w);if(arguments.length===1)return O;for(var j=1;j<arguments.length;++j){var M=Q(arguments[j]),S=Z(M),v=J&&(Q.getOwnPropertySymbols||W);if(v){var g=v(M);for(var x=0;x<g.length;++x){var _=g[x];if(X(M,_))Y(S,_)}}for(var b=0;b<S.length;++b){var i=S[b];if(X(M,i)){var a=M[i];O[i]=a}}}return O}}),WJ=y((f,$)=>{var Z=XJ(),J=function(){if(!Object.assign)return!1;var Q="abcdefghijklmnopqrst",Y=Q.split(""),X={};for(var W=0;W<Y.length;++W)X[Y[W]]=Y[W];var H=Object.assign({},X),w="";for(var K in H)w+=K;return Q!==w},z=function(){if(!Object.assign||!Object.preventExtensions)return!1;var Q=Object.preventExtensions({1:2});try{Object.assign(Q,"xy")}catch(Y){return Q[1]==="y"}return!1};$.exports=function Q(){if(!Object.assign)return Z;if(J())return Z;if(z())return Z;return Object.assign}}),H$=y((f,$)=>{var Z=function(J){return J!==J};$.exports=function J(z,Q){if(z===0&&Q===0)return 1/z===1/Q;if(z===Q)return!0;if(Z(z)&&Z(Q))return!0;return!1}}),Ef=y((f,$)=>{var Z=H$();$.exports=function J(){return typeof Object.is==="function"?Object.is:Z}}),wJ=y((f,$)=>{var Z=Pf(),J=
|
|
118
|
+
`);else t=" ".concat(c," ").concat(t)}d=G.call(this,"".concat(p).concat(t))}}if(Error.stackTraceLimit=A,d.generatedMessage=!s,Object.defineProperty(j(d),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),d.code="ERR_ASSERTION",d.actual=U,d.expected=B,d.operator=c,Error.captureStackTrace)Error.captureStackTrace(j(d),D);return d.stack,d.name="AssertionError",O(d)}return X(L,[{key:"toString",value:function E(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:V,value:function E(d,s){return a(this,J(J({},s),{},{customInspect:!1,depth:0}))}}]),L}(M(Error),a.custom);$.exports=F0}),W$=y((f,$)=>{var Z=Object.prototype.toString;$.exports=function J(z){var Q=Z.call(z),Y=Q==="[object Arguments]";if(!Y)Y=Q!=="[object Array]"&&z!==null&&typeof z==="object"&&typeof z.length==="number"&&z.length>=0&&Z.call(z.callee)==="[object Function]";return Y}}),YJ=y((f,$)=>{var Z;if(!Object.keys)J=Object.prototype.hasOwnProperty,z=Object.prototype.toString,Q=W$(),Y=Object.prototype.propertyIsEnumerable,X=!Y.call({toString:null},"toString"),W=Y.call(function(){},"prototype"),H=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],w=function(M){var S=M.constructor;return S&&S.prototype===M},K={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},O=function(){if(typeof window==="undefined")return!1;for(var M in window)try{if(!K["$"+M]&&J.call(window,M)&&window[M]!==null&&typeof window[M]==="object")try{w(window[M])}catch(S){return!0}}catch(S){return!0}return!1}(),j=function(M){if(typeof window==="undefined"||!O)return w(M);try{return w(M)}catch(S){return!1}},Z=function M(S){var v=S!==null&&typeof S==="object",g=z.call(S)==="[object Function]",x=Q(S),_=v&&z.call(S)==="[object String]",b=[];if(!v&&!g&&!x)throw new TypeError("Object.keys called on a non-object");var i=W&&g;if(_&&S.length>0&&!J.call(S,0))for(var a=0;a<S.length;++a)b.push(String(a));if(x&&S.length>0)for(var N=0;N<S.length;++N)b.push(String(N));else for(var T in S)if(!(i&&T==="prototype")&&J.call(S,T))b.push(String(T));if(X){var R=j(S);for(var h=0;h<H.length;++h)if(!(R&&H[h]==="constructor")&&J.call(S,H[h]))b.push(H[h])}return b};var J,z,Q,Y,X,W,H,w,K,O,j;$.exports=Z}),w$=y((f,$)=>{var Z=Array.prototype.slice,J=W$(),z=Object.keys,Q=z?function X(W){return z(W)}:YJ(),Y=Object.keys;Q.shim=function X(){if(Object.keys){var W=function(){var H=Object.keys(arguments);return H&&H.length===arguments.length}(1,2);if(!W)Object.keys=function H(w){if(J(w))return Y(Z.call(w));return Y(w)}}else Object.keys=Q;return Object.keys||Q},$.exports=Q}),XJ=y((f,$)=>{var Z=w$(),J=Tf()(),z=e0(),Q=Cf(),Y=z("Array.prototype.push"),X=z("Object.prototype.propertyIsEnumerable"),W=J?Q.getOwnPropertySymbols:null;$.exports=function H(w,K){if(w==null)throw new TypeError("target must be an object");var O=Q(w);if(arguments.length===1)return O;for(var j=1;j<arguments.length;++j){var M=Q(arguments[j]),S=Z(M),v=J&&(Q.getOwnPropertySymbols||W);if(v){var g=v(M);for(var x=0;x<g.length;++x){var _=g[x];if(X(M,_))Y(S,_)}}for(var b=0;b<S.length;++b){var i=S[b];if(X(M,i)){var a=M[i];O[i]=a}}}return O}}),WJ=y((f,$)=>{var Z=XJ(),J=function(){if(!Object.assign)return!1;var Q="abcdefghijklmnopqrst",Y=Q.split(""),X={};for(var W=0;W<Y.length;++W)X[Y[W]]=Y[W];var H=Object.assign({},X),w="";for(var K in H)w+=K;return Q!==w},z=function(){if(!Object.assign||!Object.preventExtensions)return!1;var Q=Object.preventExtensions({1:2});try{Object.assign(Q,"xy")}catch(Y){return Q[1]==="y"}return!1};$.exports=function Q(){if(!Object.assign)return Z;if(J())return Z;if(z())return Z;return Object.assign}}),H$=y((f,$)=>{var Z=function(J){return J!==J};$.exports=function J(z,Q){if(z===0&&Q===0)return 1/z===1/Q;if(z===Q)return!0;if(Z(z)&&Z(Q))return!0;return!1}}),Ef=y((f,$)=>{var Z=H$();$.exports=function J(){return typeof Object.is==="function"?Object.is:Z}}),wJ=y((f,$)=>{var Z=Pf(),J=u1(),z=J(Z("String.prototype.indexOf"));$.exports=function Q(Y,X){var W=Z(Y,!!X);if(typeof W==="function"&&z(Y,".prototype.")>-1)return J(W);return W}}),y1=y((f,$)=>{var Z=w$(),J=typeof Symbol==="function"&&typeof Symbol("foo")==="symbol",z=Object.prototype.toString,Q=Array.prototype.concat,Y=z$(),X=function(K){return typeof K==="function"&&z.call(K)==="[object Function]"},W=Q$()(),H=function(K,O,j,M){if(O in K){if(M===!0){if(K[O]===j)return}else if(!X(M)||!M())return}if(W)Y(K,O,j,!0);else Y(K,O,j)},w=function(K,O){var j=arguments.length>2?arguments[2]:{},M=Z(O);if(J)M=Q.call(M,Object.getOwnPropertySymbols(O));for(var S=0;S<M.length;S+=1)H(K,M[S],O[M[S]],j[M[S]])};w.supportsDescriptors=!!W,$.exports=w}),HJ=y((f,$)=>{var Z=Ef(),J=y1();$.exports=function z(){var Q=Z();return J(Object,{is:Q},{is:function Y(){return Object.is!==Q}}),Q}}),VJ=y((f,$)=>{var Z=y1(),J=u1(),z=H$(),Q=Ef(),Y=HJ(),X=J(Q(),Object);Z(X,{getPolyfill:Q,implementation:z,shim:Y}),$.exports=X}),V$=y((f,$)=>{$.exports=function Z(J){return J!==J}}),U$=y((f,$)=>{var Z=V$();$.exports=function J(){if(Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a"))return Number.isNaN;return Z}}),UJ=y((f,$)=>{var Z=y1(),J=U$();$.exports=function z(){var Q=J();return Z(Number,{isNaN:Q},{isNaN:function Y(){return Number.isNaN!==Q}}),Q}}),BJ=y((f,$)=>{var Z=u1(),J=y1(),z=V$(),Q=U$(),Y=UJ(),X=Z(Q(),Number);J(X,{getPolyfill:Q,implementation:z,shim:Y}),$.exports=X}),FJ=y((f,$)=>{function Z(F,q){return X(F)||Y(F,q)||z(F,q)||J()}function J(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
119
119
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z(F,q){if(!F)return;if(typeof F==="string")return Q(F,q);var k=Object.prototype.toString.call(F).slice(8,-1);if(k==="Object"&&F.constructor)k=F.constructor.name;if(k==="Map"||k==="Set")return Array.from(F);if(k==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(k))return Q(F,q)}function Q(F,q){if(q==null||q>F.length)q=F.length;for(var k=0,l=new Array(q);k<q;k++)l[k]=F[k];return l}function Y(F,q){var k=F==null?null:typeof Symbol!="undefined"&&F[Symbol.iterator]||F["@@iterator"];if(k!=null){var l,o,f0,e,J0=[],z0=!0,q0=!1;try{if(f0=(k=k.call(F)).next,q===0){if(Object(k)!==k)return;z0=!1}else for(;!(z0=(l=f0.call(k)).done)&&(J0.push(l.value),J0.length!==q);z0=!0);}catch(C0){q0=!0,o=C0}finally{try{if(!z0&&k.return!=null&&(e=k.return(),Object(e)!==e))return}finally{if(q0)throw o}}return J0}}function X(F){if(Array.isArray(F))return F}function W(F){return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(q){return typeof q}:function(q){return q&&typeof Symbol=="function"&&q.constructor===Symbol&&q!==Symbol.prototype?"symbol":typeof q},W(F)}var H=/a/g.flags!==void 0,w=function F(q){var k=[];return q.forEach(function(l){return k.push(l)}),k},K=function F(q){var k=[];return q.forEach(function(l,o){return k.push([o,l])}),k},O=Object.is?Object.is:VJ(),j=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},M=Number.isNaN?Number.isNaN:BJ();function S(F){return F.call.bind(F)}var v=S(Object.prototype.hasOwnProperty),g=S(Object.prototype.propertyIsEnumerable),x=S(Object.prototype.toString),_=B1().types,b=_.isAnyArrayBuffer,i=_.isArrayBufferView,a=_.isDate,N=_.isMap,T=_.isRegExp,R=_.isSet,h=_.isNativeError,r=_.isBoxedPrimitive,m=_.isNumberObject,$0=_.isStringObject,n=_.isBooleanObject,w0=_.isBigIntObject,H0=_.isSymbolObject,A0=_.isFloat32Array,V0=_.isFloat64Array;function O0(F){if(F.length===0||F.length>10)return!0;for(var q=0;q<F.length;q++){var k=F.charCodeAt(q);if(k<48||k>57)return!0}return F.length===10&&F>=Math.pow(2,32)}function F0(F){return Object.keys(F).filter(O0).concat(j(F).filter(Object.prototype.propertyIsEnumerable.bind(F)))}/*!
|
|
120
120
|
* The buffer module from node.js, for the browser.
|
|
121
121
|
*
|
|
@@ -130,12 +130,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
130
130
|
`))}throw A}};function s(D,U,B,A,u){if(!b(U))throw new K("regexp","RegExp",U);var P=u==="match";if(typeof D!=="string"||N(U,D)!==P){if(B instanceof Error)throw B;var p=!B;B=B||(typeof D!=="string"?'The "string" argument must be of type string. Received type '+"".concat(Z(D)," (").concat(g(D),")"):(P?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(g(U),`. Input:
|
|
131
131
|
|
|
132
132
|
`).concat(g(D),`
|
|
133
|
-
`));var t=new S({actual:D,expected:U,message:B,operator:u,stackStartFn:A});throw t.generatedMessage=p,t}}m.match=function D(U,B,A){s(U,B,A,D,"match")},m.doesNotMatch=function D(U,B,A){s(U,B,A,D,"doesNotMatch")};function c(){for(var D=arguments.length,U=new Array(D),B=0;B<D;B++)U[B]=arguments[B];H0.apply(void 0,[c,U.length].concat(U))}m.strict=i(c,m,{equal:m.strictEqual,deepEqual:m.deepStrictEqual,notEqual:m.notStrictEqual,notDeepEqual:m.notDeepStrictEqual}),m.strict.strict=m.strict}),B$=C8(jf(),1),{AssertionError:GJ,CallTracker:KJ,deepEqual:DJ,deepStrictEqual:OJ,doesNotMatch:LJ,doesNotReject:MJ,doesNotThrow:AJ,equal:qJ,fail:jJ,ifError:TJ,match:CJ,notDeepEqual:NJ,notDeepStrictEqual:RJ,notEqual:IJ,notStrictEqual:SJ,ok:PJ,rejects:EJ,strict:bJ,strictEqual:_J,throws:vJ}=B$,gJ=B$});var D$=Z0((N6,K$)=>{var F$=12,xJ=0,bf=[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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function kJ(f){var $=f.indexOf("%");if($===-1)return f;var Z=f.length,J="",z=0,Q=0,Y=$,X=F$;while($>-1&&$<Z){var W=G$(f[$+1],4),H=G$(f[$+2],0),w=W|H,K=bf[w];if(X=bf[256+X+K],Q=Q<<6|w&bf[364+K],X===F$)J+=f.slice(z,Y),J+=Q<=65535?String.fromCharCode(Q):String.fromCharCode(55232+(Q>>10),56320+(Q&1023)),Q=0,z=$+3,$=Y=f.indexOf("%",z);else if(X===xJ)return null;else{if($+=3,$<Z&&f.charCodeAt($)===37)continue;return null}}return J+f.slice(z)}var uJ={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function G$(f,$){var Z=uJ[f];return Z===void 0?255:Z<<$}K$.exports=kJ});var q$=Z0((R6,A$)=>{var O$=D$(),L$=/\+/g,M$=function(){};M$.prototype=Object.create(null);function yJ(f){let $=new M$;if(typeof f!=="string")return $;let Z=f.length,J="",z="",Q=-1,Y=-1,X=!1,W=!1,H=!1,w=!1,K=!1,O=0;for(let j=0;j<Z+1;j++)if(O=j!==Z?f.charCodeAt(j):38,O===38){if(K=Y>Q,!K)Y=j;if(J=f.slice(Q+1,Y),K||J.length>0){if(H)J=J.replace(L$," ");if(X)J=O$(J)||J;if(K){if(z=f.slice(Y+1,j),w)z=z.replace(L$," ");if(W)z=O$(z)||z}let M=$[J];if(M===void 0)$[J]=z;else if(M.pop)M.push(z);else $[J]=[M,z]}z="",Q=j,Y=j,X=!1,W=!1,H=!1,w=!1}else if(O===61)if(Y<=Q)Y=j;else W=!0;else if(O===43)if(Y>Q)w=!0;else H=!0;else if(O===37)if(Y>Q)W=!0;else X=!0;return $}A$.exports=yJ});var T$=Z0((I6,j$)=>{var g0=Array.from({length:256},(f,$)=>"%"+(($<16?"0":"")+$.toString(16)).toUpperCase()),cJ=new Int8Array([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,0,0,0,0,1,1,1,1,0,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,0,1,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,0]);function hJ(f){let $=f.length;if($===0)return"";let Z="",J=0,z=0;f:for(;z<$;z++){let Q=f.charCodeAt(z);while(Q<128){if(cJ[Q]!==1){if(J<z)Z+=f.slice(J,z);J=z+1,Z+=g0[Q]}if(++z===$)break f;Q=f.charCodeAt(z)}if(J<z)Z+=f.slice(J,z);if(Q<2048){J=z+1,Z+=g0[192|Q>>6]+g0[128|Q&63];continue}if(Q<55296||Q>=57344){J=z+1,Z+=g0[224|Q>>12]+g0[128|Q>>6&63]+g0[128|Q&63];continue}if(++z,z>=$)throw new Error("URI malformed");let Y=f.charCodeAt(z)&1023;J=z+1,Q=65536+((Q&1023)<<10|Y),Z+=g0[240|Q>>18]+g0[128|Q>>12&63]+g0[128|Q>>6&63]+g0[128|Q&63]}if(J===0)return f;if(J<$)return Z+f.slice(J);return Z}j$.exports={encodeString:hJ}});var R$=Z0((S6,N$)=>{var{encodeString:_f}=T$();function C$(f){let $=typeof f;if($==="string")return _f(f);else if($==="bigint")return f.toString();else if($==="boolean")return f?"true":"false";else if($==="number"&&Number.isFinite(f))return f<1000000000000000000000?""+f:_f(""+f);return""}function mJ(f){let $="";if(f===null||typeof f!=="object")return $;let Z="&",J=Object.keys(f),z=J.length,Q=0;for(let Y=0;Y<z;Y++){let X=J[Y],W=f[X],H=_f(X)+"=";if(Y)$+=Z;if(Array.isArray(W)){Q=W.length;for(let w=0;w<Q;w++){if(w)$+=Z;$+=H,$+=C$(W[w])}}else $+=H,$+=C$(W)}return $}N$.exports=mJ});var E$=Z0((P6,O1)=>{var I$=q$(),S$=R$(),P$={parse:I$,stringify:S$};O1.exports=P$;O1.exports.default=P$;O1.exports.parse=I$;O1.exports.stringify=S$});var _$=Z0((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0})});var g$=Z0((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});v$.types=void 0;var dJ;(function(f){f[f.ROOT=0]="ROOT",f[f.GROUP=1]="GROUP",f[f.POSITION=2]="POSITION",f[f.SET=3]="SET",f[f.RANGE=4]="RANGE",f[f.REPETITION=5]="REPETITION",f[f.REFERENCE=6]="REFERENCE",f[f.CHAR=7]="CHAR"})(dJ=v$.types||(v$.types={}))});var k$=Z0((x$)=>{Object.defineProperty(x$,"__esModule",{value:!0})});var y0=Z0((u0)=>{var iJ=u0&&u0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),gf=u0&&u0.__exportStar||function(f,$){for(var Z in f)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call($,Z))iJ($,f,Z)};Object.defineProperty(u0,"__esModule",{value:!0});gf(_$(),u0);gf(g$(),u0);gf(k$(),u0)});var h1=Z0((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0});h$.anyChar=h$.notWhitespace=h$.whitespace=h$.notInts=h$.ints=h$.notWords=h$.words=void 0;var Q0=y0(),u$=()=>[{type:Q0.types.RANGE,from:48,to:57}],y$=()=>[{type:Q0.types.CHAR,value:95},{type:Q0.types.RANGE,from:97,to:122},{type:Q0.types.RANGE,from:65,to:90},{type:Q0.types.RANGE,from:48,to:57}],c$=()=>[{type:Q0.types.CHAR,value:9},{type:Q0.types.CHAR,value:10},{type:Q0.types.CHAR,value:11},{type:Q0.types.CHAR,value:12},{type:Q0.types.CHAR,value:13},{type:Q0.types.CHAR,value:32},{type:Q0.types.CHAR,value:160},{type:Q0.types.CHAR,value:5760},{type:Q0.types.RANGE,from:8192,to:8202},{type:Q0.types.CHAR,value:8232},{type:Q0.types.CHAR,value:8233},{type:Q0.types.CHAR,value:8239},{type:Q0.types.CHAR,value:8287},{type:Q0.types.CHAR,value:12288},{type:Q0.types.CHAR,value:65279}],nJ=()=>[{type:Q0.types.CHAR,value:10},{type:Q0.types.CHAR,value:13},{type:Q0.types.CHAR,value:8232},{type:Q0.types.CHAR,value:8233}];h$.words=()=>({type:Q0.types.SET,set:y$(),not:!1});h$.notWords=()=>({type:Q0.types.SET,set:y$(),not:!0});h$.ints=()=>({type:Q0.types.SET,set:u$(),not:!1});h$.notInts=()=>({type:Q0.types.SET,set:u$(),not:!0});h$.whitespace=()=>({type:Q0.types.SET,set:c$(),not:!1});h$.notWhitespace=()=>({type:Q0.types.SET,set:c$(),not:!0});h$.anyChar=()=>({type:Q0.types.SET,set:nJ(),not:!0})});var i$=Z0((I0)=>{var tJ=I0&&I0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),eJ=I0&&I0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),f9=I0&&I0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))tJ($,f,Z)}return eJ($,f),$};Object.defineProperty(I0,"__esModule",{value:!0});I0.tokenizeClass=I0.strToChars=void 0;var d$=y0(),f1=f9(h1()),$9="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";I0.strToChars=(f)=>{let $=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return f.replace($,(Z,J,z,Q,Y,X,W)=>{if(z)return Z;let H=J?8:Q?parseInt(Q,16):Y?parseInt(Y,16):X?$9.indexOf(X):{0:0,t:9,n:10,v:11,f:12,r:13}[W],w=String.fromCharCode(H);return/[[\]{}^$.|?*+()]/.test(w)?`\\${w}`:w})};I0.tokenizeClass=(f,$)=>{var Z,J,z,Q,Y,X,W;let H=[],w,K,O=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;while((w=O.exec(f))!==null){let j=(W=(X=(Y=(Q=(z=(J=(Z=w[1]&&f1.words())!==null&&Z!==void 0?Z:w[2]&&f1.ints())!==null&&J!==void 0?J:w[3]&&f1.whitespace())!==null&&z!==void 0?z:w[4]&&f1.notWords())!==null&&Q!==void 0?Q:w[5]&&f1.notInts())!==null&&Y!==void 0?Y:w[6]&&f1.notWhitespace())!==null&&X!==void 0?X:w[7]&&{type:d$.types.RANGE,from:(w[8]||w[9]).charCodeAt(0),to:(K=w[10]).charCodeAt(K.length-1)})!==null&&W!==void 0?W:(K=w[16])&&{type:d$.types.CHAR,value:K.charCodeAt(0)};if(j)H.push(j);else return[H,O.lastIndex]}throw new SyntaxError(`Invalid regular expression: /${$}/: Unterminated character class`)}});var xf=Z0((x0)=>{var Z9=x0&&x0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),J9=x0&&x0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),p$=x0&&x0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))Z9($,f,Z)}return J9($,f),$};Object.defineProperty(x0,"__esModule",{value:!0});x0.tokenizer=void 0;var n$=p$(i$()),j0=y0(),d0=p$(h1()),z9=/^[a-zA-Z_$]$/i,Q9=/^[a-zA-Z0-9_$]$/i,l$=/\d/;x0.tokenizer=(f)=>{let $=0,Z,J={type:j0.types.ROOT,stack:[]},z=J,Q=J.stack,Y=[],X=[],W=0,H=(K)=>{throw new SyntaxError(`Invalid regular expression: /${f}/: Nothing to repeat at column ${K-1}`)},w=n$.strToChars(f);while($<w.length)switch(Z=w[$++]){case"\\":if($===w.length)throw new SyntaxError(`Invalid regular expression: /${f}/: \\ at end of pattern`);switch(Z=w[$++]){case"b":Q.push({type:j0.types.POSITION,value:"b"});break;case"B":Q.push({type:j0.types.POSITION,value:"B"});break;case"w":Q.push(d0.words());break;case"W":Q.push(d0.notWords());break;case"d":Q.push(d0.ints());break;case"D":Q.push(d0.notInts());break;case"s":Q.push(d0.whitespace());break;case"S":Q.push(d0.notWhitespace());break;default:if(l$.test(Z)){let K=Z;while($<w.length&&l$.test(w[$]))K+=w[$++];let O=parseInt(K,10),j={type:j0.types.REFERENCE,value:O};Q.push(j),X.push({reference:j,stack:Q,index:Q.length-1})}else Q.push({type:j0.types.CHAR,value:Z.charCodeAt(0)})}break;case"^":Q.push({type:j0.types.POSITION,value:"^"});break;case"$":Q.push({type:j0.types.POSITION,value:"$"});break;case"[":{let K;if(w[$]==="^")K=!0,$++;else K=!1;let O=n$.tokenizeClass(w.slice($),f);$+=O[1],Q.push({type:j0.types.SET,set:O[0],not:K});break}case".":Q.push(d0.anyChar());break;case"(":{let K={type:j0.types.GROUP,stack:[],remember:!0};if(w[$]==="?")if(Z=w[$+1],$+=2,Z==="=")K.followedBy=!0,K.remember=!1;else if(Z==="!")K.notFollowedBy=!0,K.remember=!1;else if(Z==="<"){let O="";if(z9.test(w[$]))O+=w[$],$++;else throw new SyntaxError(`Invalid regular expression: /${f}/: Invalid capture group name, character '${w[$]}' after '<' at column ${$+1}`);while($<w.length&&Q9.test(w[$]))O+=w[$],$++;if(!O)throw new SyntaxError(`Invalid regular expression: /${f}/: Invalid capture group name, character '${w[$]}' after '<' at column ${$+1}`);if(w[$]!==">")throw new SyntaxError(`Invalid regular expression: /${f}/: Unclosed capture group name, expected '>', found '${w[$]}' at column ${$+1}`);K.name=O,$++}else if(Z===":")K.remember=!1;else throw new SyntaxError(`Invalid regular expression: /${f}/: Invalid group, character '${Z}' after '?' at column ${$-1}`);else W+=1;Q.push(K),Y.push(z),z=K,Q=K.stack;break}case")":if(Y.length===0)throw new SyntaxError(`Invalid regular expression: /${f}/: Unmatched ) at column ${$-1}`);z=Y.pop(),Q=z.options?z.options[z.options.length-1]:z.stack;break;case"|":{if(!z.options)z.options=[z.stack],delete z.stack;let K=[];z.options.push(K),Q=K;break}case"{":{let K=/^(\d+)(,(\d+)?)?\}/.exec(w.slice($)),O,j;if(K!==null){if(Q.length===0)H($);O=parseInt(K[1],10),j=K[2]?K[3]?parseInt(K[3],10):1/0:O,$+=K[0].length,Q.push({type:j0.types.REPETITION,min:O,max:j,value:Q.pop()})}else Q.push({type:j0.types.CHAR,value:123});break}case"?":if(Q.length===0)H($);Q.push({type:j0.types.REPETITION,min:0,max:1,value:Q.pop()});break;case"+":if(Q.length===0)H($);Q.push({type:j0.types.REPETITION,min:1,max:1/0,value:Q.pop()});break;case"*":if(Q.length===0)H($);Q.push({type:j0.types.REPETITION,min:0,max:1/0,value:Q.pop()});break;default:Q.push({type:j0.types.CHAR,value:Z.charCodeAt(0)})}if(Y.length!==0)throw new SyntaxError(`Invalid regular expression: /${f}/: Unterminated group`);return Y9(X,W),J};function Y9(f,$){for(let Z of f.reverse())if($<Z.reference.value){Z.reference.type=j0.types.CHAR;let J=Z.reference.value.toString();if(Z.reference.value=parseInt(J,8),!/^[0-7]+$/.test(J)){let z=0;while(J[z]!=="8"&&J[z]!=="9")z+=1;if(z===0)Z.reference.value=J.charCodeAt(0),z+=1;else Z.reference.value=parseInt(J.slice(0,z),8);if(J.length>z){let Q=Z.stack.splice(Z.index+1);for(let Y of J.slice(z))Z.stack.push({type:j0.types.CHAR,value:Y.charCodeAt(0)});Z.stack.push(...Q)}}}}});var r$=Z0((T0)=>{var X9=T0&&T0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),W9=T0&&T0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),w9=T0&&T0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))X9($,f,Z)}return W9($,f),$};Object.defineProperty(T0,"__esModule",{value:!0});T0.NOTANYCHAR=T0.WHITESPACE=T0.WORDS=T0.INTS=void 0;var m1=w9(h1()),o$=y0();function d1(f){let $={},Z=0;for(let J of f){if(J.type===o$.types.CHAR)$[J.value]=!0;if(J.type===o$.types.RANGE)$[`${J.from}-${J.to}`]=!0;Z+=1}return{lookup:()=>Object.assign({},$),len:Z}}T0.INTS=d1(m1.ints().set);T0.WORDS=d1(m1.words().set);T0.WHITESPACE=d1(m1.whitespace().set);T0.NOTANYCHAR=d1(m1.anyChar().set)});var a$=Z0((S0)=>{var H9=S0&&S0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),V9=S0&&S0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),U9=S0&&S0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))H9($,f,Z)}return V9($,f),$};Object.defineProperty(S0,"__esModule",{value:!0});S0.writeSetTokens=S0.setChar=void 0;var p1=y0(),i1=U9(r$());function l1(f){return f===94?"\\^":f===92?"\\\\":f===93?"\\]":f===45?"\\-":String.fromCharCode(f)}S0.setChar=l1;function n1(f,{lookup:$,len:Z}){if(Z!==f.length)return!1;let J=$();for(let z of f){if(z.type===p1.types.SET)return!1;let Q=z.type===p1.types.CHAR?z.value:`${z.from}-${z.to}`;if(J[Q])J[Q]=!1;else return!1}return!0}function s$(f,$=!1){if(n1(f.set,i1.INTS))return f.not?"\\D":"\\d";if(n1(f.set,i1.WORDS))return f.not?"\\W":"\\w";if(f.not&&n1(f.set,i1.NOTANYCHAR))return".";if(n1(f.set,i1.WHITESPACE))return f.not?"\\S":"\\s";let Z="";for(let z=0;z<f.set.length;z++){let Q=f.set[z];Z+=B9(Q)}let J=`${f.not?"^":""}${Z}`;return $?J:`[${J}]`}S0.writeSetTokens=s$;function B9(f){if(f.type===p1.types.CHAR)return l1(f.value);else if(f.type===p1.types.RANGE)return`${l1(f.from)}-${l1(f.to)}`;return s$(f,!0)}});var uf=Z0((f7)=>{Object.defineProperty(f7,"__esModule",{value:!0});f7.reconstruct=void 0;var c0=y0(),kf=a$(),t$=(f)=>f.map(f7.reconstruct).join(""),e$=(f)=>{if("options"in f)return f.options.map(t$).join("|");else if("stack"in f)return t$(f.stack);else throw new Error("options or stack must be Root or Group token")};f7.reconstruct=(f)=>{switch(f.type){case c0.types.ROOT:return e$(f);case c0.types.CHAR:{let $=String.fromCharCode(f.value);return(/[[\\{}$^.|?*+()]/.test($)?"\\":"")+$}case c0.types.POSITION:if(f.value==="^"||f.value==="$")return f.value;else return`\\${f.value}`;case c0.types.REFERENCE:return`\\${f.value}`;case c0.types.SET:return kf.writeSetTokens(f);case c0.types.GROUP:return`(${f.name?`?<${f.name}>`:f.remember?"":f.followedBy?"?=":f.notFollowedBy?"?!":"?:"}${e$(f)})`;case c0.types.REPETITION:{let{min:$,max:Z}=f,J;if($===0&&Z===1)J="?";else if($===1&&Z===1/0)J="+";else if($===0&&Z===1/0)J="*";else if(Z===1/0)J=`{${$},}`;else if($===Z)J=`{${$}}`;else J=`{${$},${Z}}`;return`${f7.reconstruct(f.value)}${J}`}case c0.types.RANGE:return`${kf.setChar(f.from)}-${kf.setChar(f.to)}`;default:throw new Error(`Invalid token type ${f}`)}}});var J7=Z0((P0,r1)=>{var F9=P0&&P0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),yf=P0&&P0.__exportStar||function(f,$){for(var Z in f)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call($,Z))F9($,f,Z)};Object.defineProperty(P0,"__esModule",{value:!0});P0.types=void 0;var $7=y0();Object.defineProperty(P0,"types",{enumerable:!0,get:function(){return $7.types}});yf(xf(),P0);yf(uf(),P0);var Z7=xf(),G9=uf();yf(y0(),P0);P0.default=Z7.tokenizer;r1.exports=Z7.tokenizer;r1.exports.types=$7.types;r1.exports.reconstruct=G9.reconstruct});var Q7=Z0((h6,s1)=>{var z7=J7(),K9=z7.types;function cf(f,$){if(!$)$={};let Z=$.limit===void 0?25:$.limit;if(D9(f))f=f.source;else if(typeof f!=="string")f=String(f);try{f=z7(f)}catch{return!1}let J=0;return function z(Q,Y){let X,W,H;if(Q.type===K9.REPETITION){if(Y++,J++,Y>1)return!1;if(J>Z)return!1}if(Q.options){for(X=0,H=Q.options.length;X<H;X++)if(W=z({stack:Q.options[X]},Y),!W)return!1}let w=Q.stack||Q.value?.stack;if(!w)return!0;for(X=0;X<w.length;X++)if(W=z(w[X],Y),!W)return!1;return!0}(f,0)}function D9(f){return{}.toString.call(f)==="[object RegExp]"}s1.exports=cf;s1.exports.default=cf;s1.exports.safeRegex=cf});var hf=Z0((m6,Y7)=>{Y7.exports=function f($,Z){if($===Z)return!0;if($&&Z&&typeof $=="object"&&typeof Z=="object"){if($.constructor!==Z.constructor)return!1;var J,z,Q;if(Array.isArray($)){if(J=$.length,J!=Z.length)return!1;for(z=J;z--!==0;)if(!f($[z],Z[z]))return!1;return!0}if($.constructor===RegExp)return $.source===Z.source&&$.flags===Z.flags;if($.valueOf!==Object.prototype.valueOf)return $.valueOf()===Z.valueOf();if($.toString!==Object.prototype.toString)return $.toString()===Z.toString();if(Q=Object.keys($),J=Q.length,J!==Object.keys(Z).length)return!1;for(z=J;z--!==0;)if(!Object.prototype.hasOwnProperty.call(Z,Q[z]))return!1;for(z=J;z--!==0;){var Y=Q[z];if(!f($[Y],Z[Y]))return!1}return!0}return $!==$&&Z!==Z}});var a1=Z0((d6,X7)=>{X7.exports={name:"__fmw_internal_strategy_merged_tree_http_method__",storage:function(){let f=new Map;return{get:($)=>{return f.get($)||null},set:($,Z)=>{f.set($,Z)}}},deriveConstraint:(f)=>f.method,mustMatchWhenDerived:!0}});var F7=Z0((i6,B7)=>{var W7=hf(),w7=a1(),H7=Symbol("treeData");function V7(f,$=""){let Z="",J=Object.keys(f);for(let z=0;z<J.length;z++){let Q=J[z],Y=f[Q],X=z===J.length-1,W=X?"└── ":"├── ",H=X?" ":"│ ",K=(Y[H7]||"").replaceAll(`
|
|
133
|
+
`));var t=new S({actual:D,expected:U,message:B,operator:u,stackStartFn:A});throw t.generatedMessage=p,t}}m.match=function D(U,B,A){s(U,B,A,D,"match")},m.doesNotMatch=function D(U,B,A){s(U,B,A,D,"doesNotMatch")};function c(){for(var D=arguments.length,U=new Array(D),B=0;B<D;B++)U[B]=arguments[B];H0.apply(void 0,[c,U.length].concat(U))}m.strict=i(c,m,{equal:m.strictEqual,deepEqual:m.deepStrictEqual,notEqual:m.notStrictEqual,notDeepEqual:m.notDeepStrictEqual}),m.strict.strict=m.strict}),B$=C8(jf(),1),{AssertionError:GJ,CallTracker:KJ,deepEqual:DJ,deepStrictEqual:OJ,doesNotMatch:LJ,doesNotReject:MJ,doesNotThrow:AJ,equal:qJ,fail:jJ,ifError:TJ,match:CJ,notDeepEqual:NJ,notDeepStrictEqual:RJ,notEqual:IJ,notStrictEqual:SJ,ok:PJ,rejects:EJ,strict:bJ,strictEqual:_J,throws:vJ}=B$,gJ=B$});var D$=Z0((N6,K$)=>{var F$=12,xJ=0,bf=[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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function kJ(f){var $=f.indexOf("%");if($===-1)return f;var Z=f.length,J="",z=0,Q=0,Y=$,X=F$;while($>-1&&$<Z){var W=G$(f[$+1],4),H=G$(f[$+2],0),w=W|H,K=bf[w];if(X=bf[256+X+K],Q=Q<<6|w&bf[364+K],X===F$)J+=f.slice(z,Y),J+=Q<=65535?String.fromCharCode(Q):String.fromCharCode(55232+(Q>>10),56320+(Q&1023)),Q=0,z=$+3,$=Y=f.indexOf("%",z);else if(X===xJ)return null;else{if($+=3,$<Z&&f.charCodeAt($)===37)continue;return null}}return J+f.slice(z)}var uJ={"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function G$(f,$){var Z=uJ[f];return Z===void 0?255:Z<<$}K$.exports=kJ});var q$=Z0((R6,A$)=>{var O$=D$(),L$=/\+/g,M$=function(){};M$.prototype=Object.create(null);function yJ(f){let $=new M$;if(typeof f!=="string")return $;let Z=f.length,J="",z="",Q=-1,Y=-1,X=!1,W=!1,H=!1,w=!1,K=!1,O=0;for(let j=0;j<Z+1;j++)if(O=j!==Z?f.charCodeAt(j):38,O===38){if(K=Y>Q,!K)Y=j;if(J=f.slice(Q+1,Y),K||J.length>0){if(H)J=J.replace(L$," ");if(X)J=O$(J)||J;if(K){if(z=f.slice(Y+1,j),w)z=z.replace(L$," ");if(W)z=O$(z)||z}let M=$[J];if(M===void 0)$[J]=z;else if(M.pop)M.push(z);else $[J]=[M,z]}z="",Q=j,Y=j,X=!1,W=!1,H=!1,w=!1}else if(O===61)if(Y<=Q)Y=j;else W=!0;else if(O===43)if(Y>Q)w=!0;else H=!0;else if(O===37)if(Y>Q)W=!0;else X=!0;return $}A$.exports=yJ});var T$=Z0((I6,j$)=>{var g0=Array.from({length:256},(f,$)=>"%"+(($<16?"0":"")+$.toString(16)).toUpperCase()),cJ=new Int8Array([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,0,0,0,0,1,1,1,1,0,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,0,1,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,0]);function hJ(f){let $=f.length;if($===0)return"";let Z="",J=0,z=0;f:for(;z<$;z++){let Q=f.charCodeAt(z);while(Q<128){if(cJ[Q]!==1){if(J<z)Z+=f.slice(J,z);J=z+1,Z+=g0[Q]}if(++z===$)break f;Q=f.charCodeAt(z)}if(J<z)Z+=f.slice(J,z);if(Q<2048){J=z+1,Z+=g0[192|Q>>6]+g0[128|Q&63];continue}if(Q<55296||Q>=57344){J=z+1,Z+=g0[224|Q>>12]+g0[128|Q>>6&63]+g0[128|Q&63];continue}if(++z,z>=$)throw new Error("URI malformed");let Y=f.charCodeAt(z)&1023;J=z+1,Q=65536+((Q&1023)<<10|Y),Z+=g0[240|Q>>18]+g0[128|Q>>12&63]+g0[128|Q>>6&63]+g0[128|Q&63]}if(J===0)return f;if(J<$)return Z+f.slice(J);return Z}j$.exports={encodeString:hJ}});var R$=Z0((S6,N$)=>{var{encodeString:_f}=T$();function C$(f){let $=typeof f;if($==="string")return _f(f);else if($==="bigint")return f.toString();else if($==="boolean")return f?"true":"false";else if($==="number"&&Number.isFinite(f))return f<1000000000000000000000?""+f:_f(""+f);return""}function mJ(f){let $="";if(f===null||typeof f!=="object")return $;let Z="&",J=Object.keys(f),z=J.length,Q=0;for(let Y=0;Y<z;Y++){let X=J[Y],W=f[X],H=_f(X)+"=";if(Y)$+=Z;if(Array.isArray(W)){Q=W.length;for(let w=0;w<Q;w++){if(w)$+=Z;$+=H,$+=C$(W[w])}}else $+=H,$+=C$(W)}return $}N$.exports=mJ});var E$=Z0((P6,O1)=>{var I$=q$(),S$=R$(),P$={parse:I$,stringify:S$};O1.exports=P$;O1.exports.default=P$;O1.exports.parse=I$;O1.exports.stringify=S$});var _$=Z0((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0})});var g$=Z0((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});v$.types=void 0;var dJ;(function(f){f[f.ROOT=0]="ROOT",f[f.GROUP=1]="GROUP",f[f.POSITION=2]="POSITION",f[f.SET=3]="SET",f[f.RANGE=4]="RANGE",f[f.REPETITION=5]="REPETITION",f[f.REFERENCE=6]="REFERENCE",f[f.CHAR=7]="CHAR"})(dJ=v$.types||(v$.types={}))});var k$=Z0((x$)=>{Object.defineProperty(x$,"__esModule",{value:!0})});var y0=Z0((u0)=>{var iJ=u0&&u0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),gf=u0&&u0.__exportStar||function(f,$){for(var Z in f)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call($,Z))iJ($,f,Z)};Object.defineProperty(u0,"__esModule",{value:!0});gf(_$(),u0);gf(g$(),u0);gf(k$(),u0)});var c1=Z0((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0});h$.anyChar=h$.notWhitespace=h$.whitespace=h$.notInts=h$.ints=h$.notWords=h$.words=void 0;var Q0=y0(),u$=()=>[{type:Q0.types.RANGE,from:48,to:57}],y$=()=>[{type:Q0.types.CHAR,value:95},{type:Q0.types.RANGE,from:97,to:122},{type:Q0.types.RANGE,from:65,to:90},{type:Q0.types.RANGE,from:48,to:57}],c$=()=>[{type:Q0.types.CHAR,value:9},{type:Q0.types.CHAR,value:10},{type:Q0.types.CHAR,value:11},{type:Q0.types.CHAR,value:12},{type:Q0.types.CHAR,value:13},{type:Q0.types.CHAR,value:32},{type:Q0.types.CHAR,value:160},{type:Q0.types.CHAR,value:5760},{type:Q0.types.RANGE,from:8192,to:8202},{type:Q0.types.CHAR,value:8232},{type:Q0.types.CHAR,value:8233},{type:Q0.types.CHAR,value:8239},{type:Q0.types.CHAR,value:8287},{type:Q0.types.CHAR,value:12288},{type:Q0.types.CHAR,value:65279}],nJ=()=>[{type:Q0.types.CHAR,value:10},{type:Q0.types.CHAR,value:13},{type:Q0.types.CHAR,value:8232},{type:Q0.types.CHAR,value:8233}];h$.words=()=>({type:Q0.types.SET,set:y$(),not:!1});h$.notWords=()=>({type:Q0.types.SET,set:y$(),not:!0});h$.ints=()=>({type:Q0.types.SET,set:u$(),not:!1});h$.notInts=()=>({type:Q0.types.SET,set:u$(),not:!0});h$.whitespace=()=>({type:Q0.types.SET,set:c$(),not:!1});h$.notWhitespace=()=>({type:Q0.types.SET,set:c$(),not:!0});h$.anyChar=()=>({type:Q0.types.SET,set:nJ(),not:!0})});var i$=Z0((I0)=>{var tJ=I0&&I0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),eJ=I0&&I0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),f9=I0&&I0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))tJ($,f,Z)}return eJ($,f),$};Object.defineProperty(I0,"__esModule",{value:!0});I0.tokenizeClass=I0.strToChars=void 0;var d$=y0(),f1=f9(c1()),$9="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?";I0.strToChars=(f)=>{let $=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return f.replace($,(Z,J,z,Q,Y,X,W)=>{if(z)return Z;let H=J?8:Q?parseInt(Q,16):Y?parseInt(Y,16):X?$9.indexOf(X):{0:0,t:9,n:10,v:11,f:12,r:13}[W],w=String.fromCharCode(H);return/[[\]{}^$.|?*+()]/.test(w)?`\\${w}`:w})};I0.tokenizeClass=(f,$)=>{var Z,J,z,Q,Y,X,W;let H=[],w,K,O=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(((?:\\)])|(((?:\\)?([^\]])))))|(\])|(?:\\)?([^])/g;while((w=O.exec(f))!==null){let j=(W=(X=(Y=(Q=(z=(J=(Z=w[1]&&f1.words())!==null&&Z!==void 0?Z:w[2]&&f1.ints())!==null&&J!==void 0?J:w[3]&&f1.whitespace())!==null&&z!==void 0?z:w[4]&&f1.notWords())!==null&&Q!==void 0?Q:w[5]&&f1.notInts())!==null&&Y!==void 0?Y:w[6]&&f1.notWhitespace())!==null&&X!==void 0?X:w[7]&&{type:d$.types.RANGE,from:(w[8]||w[9]).charCodeAt(0),to:(K=w[10]).charCodeAt(K.length-1)})!==null&&W!==void 0?W:(K=w[16])&&{type:d$.types.CHAR,value:K.charCodeAt(0)};if(j)H.push(j);else return[H,O.lastIndex]}throw new SyntaxError(`Invalid regular expression: /${$}/: Unterminated character class`)}});var xf=Z0((x0)=>{var Z9=x0&&x0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),J9=x0&&x0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),p$=x0&&x0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))Z9($,f,Z)}return J9($,f),$};Object.defineProperty(x0,"__esModule",{value:!0});x0.tokenizer=void 0;var n$=p$(i$()),j0=y0(),d0=p$(c1()),z9=/^[a-zA-Z_$]$/i,Q9=/^[a-zA-Z0-9_$]$/i,l$=/\d/;x0.tokenizer=(f)=>{let $=0,Z,J={type:j0.types.ROOT,stack:[]},z=J,Q=J.stack,Y=[],X=[],W=0,H=(K)=>{throw new SyntaxError(`Invalid regular expression: /${f}/: Nothing to repeat at column ${K-1}`)},w=n$.strToChars(f);while($<w.length)switch(Z=w[$++]){case"\\":if($===w.length)throw new SyntaxError(`Invalid regular expression: /${f}/: \\ at end of pattern`);switch(Z=w[$++]){case"b":Q.push({type:j0.types.POSITION,value:"b"});break;case"B":Q.push({type:j0.types.POSITION,value:"B"});break;case"w":Q.push(d0.words());break;case"W":Q.push(d0.notWords());break;case"d":Q.push(d0.ints());break;case"D":Q.push(d0.notInts());break;case"s":Q.push(d0.whitespace());break;case"S":Q.push(d0.notWhitespace());break;default:if(l$.test(Z)){let K=Z;while($<w.length&&l$.test(w[$]))K+=w[$++];let O=parseInt(K,10),j={type:j0.types.REFERENCE,value:O};Q.push(j),X.push({reference:j,stack:Q,index:Q.length-1})}else Q.push({type:j0.types.CHAR,value:Z.charCodeAt(0)})}break;case"^":Q.push({type:j0.types.POSITION,value:"^"});break;case"$":Q.push({type:j0.types.POSITION,value:"$"});break;case"[":{let K;if(w[$]==="^")K=!0,$++;else K=!1;let O=n$.tokenizeClass(w.slice($),f);$+=O[1],Q.push({type:j0.types.SET,set:O[0],not:K});break}case".":Q.push(d0.anyChar());break;case"(":{let K={type:j0.types.GROUP,stack:[],remember:!0};if(w[$]==="?")if(Z=w[$+1],$+=2,Z==="=")K.followedBy=!0,K.remember=!1;else if(Z==="!")K.notFollowedBy=!0,K.remember=!1;else if(Z==="<"){let O="";if(z9.test(w[$]))O+=w[$],$++;else throw new SyntaxError(`Invalid regular expression: /${f}/: Invalid capture group name, character '${w[$]}' after '<' at column ${$+1}`);while($<w.length&&Q9.test(w[$]))O+=w[$],$++;if(!O)throw new SyntaxError(`Invalid regular expression: /${f}/: Invalid capture group name, character '${w[$]}' after '<' at column ${$+1}`);if(w[$]!==">")throw new SyntaxError(`Invalid regular expression: /${f}/: Unclosed capture group name, expected '>', found '${w[$]}' at column ${$+1}`);K.name=O,$++}else if(Z===":")K.remember=!1;else throw new SyntaxError(`Invalid regular expression: /${f}/: Invalid group, character '${Z}' after '?' at column ${$-1}`);else W+=1;Q.push(K),Y.push(z),z=K,Q=K.stack;break}case")":if(Y.length===0)throw new SyntaxError(`Invalid regular expression: /${f}/: Unmatched ) at column ${$-1}`);z=Y.pop(),Q=z.options?z.options[z.options.length-1]:z.stack;break;case"|":{if(!z.options)z.options=[z.stack],delete z.stack;let K=[];z.options.push(K),Q=K;break}case"{":{let K=/^(\d+)(,(\d+)?)?\}/.exec(w.slice($)),O,j;if(K!==null){if(Q.length===0)H($);O=parseInt(K[1],10),j=K[2]?K[3]?parseInt(K[3],10):1/0:O,$+=K[0].length,Q.push({type:j0.types.REPETITION,min:O,max:j,value:Q.pop()})}else Q.push({type:j0.types.CHAR,value:123});break}case"?":if(Q.length===0)H($);Q.push({type:j0.types.REPETITION,min:0,max:1,value:Q.pop()});break;case"+":if(Q.length===0)H($);Q.push({type:j0.types.REPETITION,min:1,max:1/0,value:Q.pop()});break;case"*":if(Q.length===0)H($);Q.push({type:j0.types.REPETITION,min:0,max:1/0,value:Q.pop()});break;default:Q.push({type:j0.types.CHAR,value:Z.charCodeAt(0)})}if(Y.length!==0)throw new SyntaxError(`Invalid regular expression: /${f}/: Unterminated group`);return Y9(X,W),J};function Y9(f,$){for(let Z of f.reverse())if($<Z.reference.value){Z.reference.type=j0.types.CHAR;let J=Z.reference.value.toString();if(Z.reference.value=parseInt(J,8),!/^[0-7]+$/.test(J)){let z=0;while(J[z]!=="8"&&J[z]!=="9")z+=1;if(z===0)Z.reference.value=J.charCodeAt(0),z+=1;else Z.reference.value=parseInt(J.slice(0,z),8);if(J.length>z){let Q=Z.stack.splice(Z.index+1);for(let Y of J.slice(z))Z.stack.push({type:j0.types.CHAR,value:Y.charCodeAt(0)});Z.stack.push(...Q)}}}}});var r$=Z0((T0)=>{var X9=T0&&T0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),W9=T0&&T0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),w9=T0&&T0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))X9($,f,Z)}return W9($,f),$};Object.defineProperty(T0,"__esModule",{value:!0});T0.NOTANYCHAR=T0.WHITESPACE=T0.WORDS=T0.INTS=void 0;var h1=w9(c1()),o$=y0();function m1(f){let $={},Z=0;for(let J of f){if(J.type===o$.types.CHAR)$[J.value]=!0;if(J.type===o$.types.RANGE)$[`${J.from}-${J.to}`]=!0;Z+=1}return{lookup:()=>Object.assign({},$),len:Z}}T0.INTS=m1(h1.ints().set);T0.WORDS=m1(h1.words().set);T0.WHITESPACE=m1(h1.whitespace().set);T0.NOTANYCHAR=m1(h1.anyChar().set)});var a$=Z0((S0)=>{var H9=S0&&S0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),V9=S0&&S0.__setModuleDefault||(Object.create?function(f,$){Object.defineProperty(f,"default",{enumerable:!0,value:$})}:function(f,$){f.default=$}),U9=S0&&S0.__importStar||function(f){if(f&&f.__esModule)return f;var $={};if(f!=null){for(var Z in f)if(Z!=="default"&&Object.prototype.hasOwnProperty.call(f,Z))H9($,f,Z)}return V9($,f),$};Object.defineProperty(S0,"__esModule",{value:!0});S0.writeSetTokens=S0.setChar=void 0;var l1=y0(),d1=U9(r$());function n1(f){return f===94?"\\^":f===92?"\\\\":f===93?"\\]":f===45?"\\-":String.fromCharCode(f)}S0.setChar=n1;function i1(f,{lookup:$,len:Z}){if(Z!==f.length)return!1;let J=$();for(let z of f){if(z.type===l1.types.SET)return!1;let Q=z.type===l1.types.CHAR?z.value:`${z.from}-${z.to}`;if(J[Q])J[Q]=!1;else return!1}return!0}function s$(f,$=!1){if(i1(f.set,d1.INTS))return f.not?"\\D":"\\d";if(i1(f.set,d1.WORDS))return f.not?"\\W":"\\w";if(f.not&&i1(f.set,d1.NOTANYCHAR))return".";if(i1(f.set,d1.WHITESPACE))return f.not?"\\S":"\\s";let Z="";for(let z=0;z<f.set.length;z++){let Q=f.set[z];Z+=B9(Q)}let J=`${f.not?"^":""}${Z}`;return $?J:`[${J}]`}S0.writeSetTokens=s$;function B9(f){if(f.type===l1.types.CHAR)return n1(f.value);else if(f.type===l1.types.RANGE)return`${n1(f.from)}-${n1(f.to)}`;return s$(f,!0)}});var uf=Z0((f7)=>{Object.defineProperty(f7,"__esModule",{value:!0});f7.reconstruct=void 0;var c0=y0(),kf=a$(),t$=(f)=>f.map(f7.reconstruct).join(""),e$=(f)=>{if("options"in f)return f.options.map(t$).join("|");else if("stack"in f)return t$(f.stack);else throw new Error("options or stack must be Root or Group token")};f7.reconstruct=(f)=>{switch(f.type){case c0.types.ROOT:return e$(f);case c0.types.CHAR:{let $=String.fromCharCode(f.value);return(/[[\\{}$^.|?*+()]/.test($)?"\\":"")+$}case c0.types.POSITION:if(f.value==="^"||f.value==="$")return f.value;else return`\\${f.value}`;case c0.types.REFERENCE:return`\\${f.value}`;case c0.types.SET:return kf.writeSetTokens(f);case c0.types.GROUP:return`(${f.name?`?<${f.name}>`:f.remember?"":f.followedBy?"?=":f.notFollowedBy?"?!":"?:"}${e$(f)})`;case c0.types.REPETITION:{let{min:$,max:Z}=f,J;if($===0&&Z===1)J="?";else if($===1&&Z===1/0)J="+";else if($===0&&Z===1/0)J="*";else if(Z===1/0)J=`{${$},}`;else if($===Z)J=`{${$}}`;else J=`{${$},${Z}}`;return`${f7.reconstruct(f.value)}${J}`}case c0.types.RANGE:return`${kf.setChar(f.from)}-${kf.setChar(f.to)}`;default:throw new Error(`Invalid token type ${f}`)}}});var J7=Z0((P0,o1)=>{var F9=P0&&P0.__createBinding||(Object.create?function(f,$,Z,J){if(J===void 0)J=Z;Object.defineProperty(f,J,{enumerable:!0,get:function(){return $[Z]}})}:function(f,$,Z,J){if(J===void 0)J=Z;f[J]=$[Z]}),yf=P0&&P0.__exportStar||function(f,$){for(var Z in f)if(Z!=="default"&&!Object.prototype.hasOwnProperty.call($,Z))F9($,f,Z)};Object.defineProperty(P0,"__esModule",{value:!0});P0.types=void 0;var $7=y0();Object.defineProperty(P0,"types",{enumerable:!0,get:function(){return $7.types}});yf(xf(),P0);yf(uf(),P0);var Z7=xf(),G9=uf();yf(y0(),P0);P0.default=Z7.tokenizer;o1.exports=Z7.tokenizer;o1.exports.types=$7.types;o1.exports.reconstruct=G9.reconstruct});var Q7=Z0((h6,r1)=>{var z7=J7(),K9=z7.types;function cf(f,$){if(!$)$={};let Z=$.limit===void 0?25:$.limit;if(D9(f))f=f.source;else if(typeof f!=="string")f=String(f);try{f=z7(f)}catch{return!1}let J=0;return function z(Q,Y){let X,W,H;if(Q.type===K9.REPETITION){if(Y++,J++,Y>1)return!1;if(J>Z)return!1}if(Q.options){for(X=0,H=Q.options.length;X<H;X++)if(W=z({stack:Q.options[X]},Y),!W)return!1}let w=Q.stack||Q.value?.stack;if(!w)return!0;for(X=0;X<w.length;X++)if(W=z(w[X],Y),!W)return!1;return!0}(f,0)}function D9(f){return{}.toString.call(f)==="[object RegExp]"}r1.exports=cf;r1.exports.default=cf;r1.exports.safeRegex=cf});var hf=Z0((m6,Y7)=>{Y7.exports=function f($,Z){if($===Z)return!0;if($&&Z&&typeof $=="object"&&typeof Z=="object"){if($.constructor!==Z.constructor)return!1;var J,z,Q;if(Array.isArray($)){if(J=$.length,J!=Z.length)return!1;for(z=J;z--!==0;)if(!f($[z],Z[z]))return!1;return!0}if($.constructor===RegExp)return $.source===Z.source&&$.flags===Z.flags;if($.valueOf!==Object.prototype.valueOf)return $.valueOf()===Z.valueOf();if($.toString!==Object.prototype.toString)return $.toString()===Z.toString();if(Q=Object.keys($),J=Q.length,J!==Object.keys(Z).length)return!1;for(z=J;z--!==0;)if(!Object.prototype.hasOwnProperty.call(Z,Q[z]))return!1;for(z=J;z--!==0;){var Y=Q[z];if(!f($[Y],Z[Y]))return!1}return!0}return $!==$&&Z!==Z}});var s1=Z0((d6,X7)=>{X7.exports={name:"__fmw_internal_strategy_merged_tree_http_method__",storage:function(){let f=new Map;return{get:($)=>{return f.get($)||null},set:($,Z)=>{f.set($,Z)}}},deriveConstraint:(f)=>f.method,mustMatchWhenDerived:!0}});var F7=Z0((i6,B7)=>{var W7=hf(),w7=s1(),H7=Symbol("treeData");function V7(f,$=""){let Z="",J=Object.keys(f);for(let z=0;z<J.length;z++){let Q=J[z],Y=f[Q],X=z===J.length-1,W=X?"└── ":"├── ",H=X?" ":"│ ",K=(Y[H7]||"").replaceAll(`
|
|
134
134
|
`,`
|
|
135
135
|
`+$+H);Z+=$+W+Q+K+`
|
|
136
136
|
`,Z+=V7(Y,$+H)}return Z}function O9(f){let $=f.name||"";return $=$.replace("bound","").trim(),$=($||"anonymous")+"()",$}function U7(f){if(Array.isArray(f))return f.map(($)=>U7($));if(typeof f==="symbol")return f.toString();if(typeof f==="function")return O9(f);return f}function L9(f,$){if(!$.includeMeta)return{};let Z=$.buildPrettyMeta(f),J={},z=$.includeMeta;if(!Array.isArray(z))z=Reflect.ownKeys(Z);for(let Q of z){if(!Object.prototype.hasOwnProperty.call(Z,Q))continue;let Y=Q.toString(),X=Z[Q];if(X!==void 0&&X!==null){let W=JSON.stringify(U7(X));J[Y]=W}}return J}function M9(f){let $="";for(let[Z,J]of Object.entries(f))$+=`
|
|
137
137
|
• (${Z}) ${J}`;return $}function A9(f){let $={...f.opts.constraints},Z=$[w7.name];return delete $[w7.name],{...f,method:Z,opts:{constraints:$}}}function q9(f){let $=` (${f.method})`,Z=f.opts.constraints||{};if(Object.keys(Z).length!==0)$+=" "+JSON.stringify(Z);return $+=M9(f.metaData),$}function j9(f){return f.reduce(($,Z)=>{for(let J of $)if(W7(Z.opts.constraints,J.opts.constraints)&&W7(Z.metaData,J.metaData))return J.method+=", "+Z.method,$;return $.push(Z),$},[])}function T9(f,$,Z){let J=f.routes;if(Z.method===void 0)J=J.map(A9);if(J=J.map((z)=>{return z.metaData=L9(z,Z),z}),Z.method===void 0)J=j9(J);return J.map(q9).join(`
|
|
138
|
-
${$}`)}function
|
|
138
|
+
${$}`)}function a1(f,$,Z,J){if(f.isLeafNode||J.commonPrefix!==!1){if(Z=Z||"(empty root node)",$=$[Z]={},f.isLeafNode)$[H7]=T9(f,Z,J);Z=""}if(f.staticChildren)for(let z of Object.values(f.staticChildren))a1(z,$,Z+z.prefix,J);if(f.parametricChildren)for(let z of Object.values(f.parametricChildren)){let Q=Array.from(z.nodePaths).join("|");a1(z,$,Z+Q,J)}if(f.wildcardChild)a1(f.wildcardChild,$,"*",J)}function C9(f,$){let Z={};return a1(f,Z,f.prefix,$),V7(Z)}B7.exports={prettyPrintTree:C9}});var D7=Z0((n6,K7)=>{var G7=function(){};G7.prototype=Object.create(null);K7.exports={NullObject:G7}});var M7=Z0((l6,L7)=>{var{NullObject:N9}=D7(),R9=s1();class O7{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(f){if(f===void 0)return this.unconstrainedHandler;return this._getHandlerMatchingConstraints(f)}addHandler(f,$){let Z=$.params,J=$.opts.constraints||{},z={params:Z,constraints:J,handler:$.handler,store:$.store||null,_createParamsObject:this._compileCreateParamsObject(Z)},Q=Object.keys(J);if(Q.length===0)this.unconstrainedHandler=z;for(let X of Q)if(!this.constraints.includes(X))if(X==="version")this.constraints.unshift(X);else this.constraints.push(X);let Y=Q.includes(R9.name);if(!Y&&this.handlers.length>=31)throw new Error("find-my-way supports a maximum of 31 route handlers per node when there are constraints, limit reached");if(this.handlers.push(z),this.handlers.sort((X,W)=>Object.keys(X.constraints).length-Object.keys(W.constraints).length),!Y)this._compileGetHandlerMatchingConstraints(f,J)}_compileCreateParamsObject(f){let $=[];$.push("const fn = function _createParamsObject (paramsArray) {"),$.push("const params = new NullObject()");for(let Z=0;Z<f.length;Z++)$.push(`params['${f[Z]}'] = paramsArray[${Z}]`);return $.push("return params"),$.push("}"),$.push("return fn"),new Function("NullObject",$.join(`
|
|
139
139
|
`))(N9)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(f,$){for(let Z=0;Z<this.handlers.length;Z++){let z=this.handlers[Z].constraints[$];if(z!==void 0){let Q=f.get(z)||0;Q|=1<<Z,f.set(z,Q)}}}_constrainedIndexBitmask(f){let $=0;for(let Z=0;Z<this.handlers.length;Z++)if(this.handlers[Z].constraints[f]!==void 0)$|=1<<Z;return~$}_compileGetHandlerMatchingConstraints(f){this.constrainedHandlerStores={};for(let Z of this.constraints){let J=f.newStoreForConstraint(Z);this.constrainedHandlerStores[Z]=J,this._buildConstraintStore(J,Z)}let $=[];$.push(`
|
|
140
140
|
let candidates = ${(1<<this.handlers.length)-1}
|
|
141
141
|
let mask, matches
|
|
@@ -151,8 +151,8 @@ ${$}`)}function t1(f,$,Z,J){if(f.isLeafNode||J.commonPrefix!==!1){if(Z=Z||"(empt
|
|
|
151
151
|
}
|
|
152
152
|
if (candidates === 0) return null;
|
|
153
153
|
`)}for(let Z in f.strategies)if(f.strategies[Z].mustMatchWhenDerived&&!this.constraints.includes(Z))$.push(`if (derivedConstraints.${Z} !== undefined) return null`);$.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",$.join(`
|
|
154
|
-
`))}}L7.exports=O7});var q7=Z0((p6,A7)=>{var I9=M7(),
|
|
155
|
-
`)).bind(this)}}I7.exports=R7});var E7=Z0((a6,P7)=>{var v9=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];P7.exports=v9});var v7=Z0((t6,_7)=>{function b7(f,$){if(f===50){if($===53)return"%";if($===51)return"#";if($===52)return"$";if($===54)return"&";if($===66)return"+";if($===98)return"+";if($===67)return",";if($===99)return",";if($===70)return"/";if($===102)return"/";return null}if(f===51){if($===65)return":";if($===97)return":";if($===66)return";";if($===98)return";";if($===68)return"=";if($===100)return"=";if($===70)return"?";if($===102)return"?";return null}if(f===52&&$===48)return"@";return null}function g9(f,$){let Z=!1,J=!1,z="";for(let Y=1;Y<f.length;Y++){let X=f.charCodeAt(Y);if(X===37){let W=f.charCodeAt(Y+1),H=f.charCodeAt(Y+2);if(b7(W,H)===null)Z=!0;else{if(J=!0,W===50&&H===53)Z=!0,f=f.slice(0,Y+1)+"25"+f.slice(Y+1),Y+=2;Y+=2}}else if(X===63||X===35||X===59&&$){z=f.slice(Y+1),f=f.slice(0,Y);break}}return{path:Z?decodeURI(f):f,querystring:z,shouldDecodeParam:J}}function x9(f){let $=f.indexOf("%");if($===-1)return f;let Z="",J=$;for(let z=$;z<f.length;z++)if(f.charCodeAt(z)===37){let Q=f.charCodeAt(z+1),Y=f.charCodeAt(z+2),X=b7(Q,Y);Z+=f.slice(J,z)+X,J=z+3}return f.slice(0,$)+Z+f.slice(J)}_7.exports={safeDecodeURI:g9,safeDecodeURIComponent:x9}});var n7=Z0((e6,i7)=>{var K0=(D1(),o0(K1)),k9=E$(),Z1=Q7(),rf=hf(),{prettyPrintTree:u9}=F7(),{StaticNode:g7,NODE_TYPES:x7}=q7(),y9=S7(),$1=E7(),of=a1(),{safeDecodeURI:c9,safeDecodeURIComponent:k7}=v7(),u7=/^https?:\/\/.*?\//,i0=/(\/:[^/()]*?)\?(\/?)/,y7=/[.*+?^${}()|[\]\\]/g,c7=/\/\/+/g;if(!Z1(u7))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!Z1(i0))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!Z1(y7))throw new Error("the ESCAPE_REGEXP is not safe, update this module");if(!Z1(c7))throw new Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function B0(f){if(!(this instanceof B0))return new B0(f);if(f=f||{},this._opts=f,f.defaultRoute)K0(typeof f.defaultRoute==="function","The default route must be a function"),this.defaultRoute=f.defaultRoute;else this.defaultRoute=null;if(f.onBadUrl)K0(typeof f.onBadUrl==="function","The bad url handler must be a function"),this.onBadUrl=f.onBadUrl;else this.onBadUrl=null;if(f.buildPrettyMeta)K0(typeof f.buildPrettyMeta==="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=f.buildPrettyMeta;else this.buildPrettyMeta=h9;if(f.querystringParser)K0(typeof f.querystringParser==="function","querystringParser must be a function"),this.querystringParser=f.querystringParser;else this.querystringParser=($)=>$.length===0?{}:k9.parse($);this.caseSensitive=f.caseSensitive===void 0?!0:f.caseSensitive,this.ignoreTrailingSlash=f.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=f.ignoreDuplicateSlashes||!1,this.maxParamLength=f.maxParamLength||100,this.allowUnsafeRegex=f.allowUnsafeRegex||!1,this.constrainer=new y9(f.constraints),this.useSemicolonDelimiter=f.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}B0.prototype.on=function f($,Z,J,z,Q){if(typeof J==="function"){if(z!==void 0)Q=z;z=J,J={}}K0(typeof Z==="string","Path should be a string"),K0(Z.length>0,"The path could not be empty"),K0(Z[0]==="/"||Z[0]==="*","The first character of a path should be `/` or `*`"),K0(typeof z==="function","Handler should be a function");let Y=Z.match(i0);if(Y){K0(Z.length===Y.index+Y[0].length,"Optional Parameter needs to be the last parameter of the path");let H=Z.replace(i0,"$1$2"),w=Z.replace(i0,"$2")||"/";this.on($,H,J,z,Q),this.on($,w,J,z,Q);return}let X=Z;if(this.ignoreDuplicateSlashes)Z=sf(Z);if(this.ignoreTrailingSlash)Z=af(Z);let W=Array.isArray($)?$:[$];for(let H of W)K0(typeof H==="string","Method should be a string"),K0($1.includes(H),`Method '${H}' is not an http method.`),this._on(H,Z,J,z,Q,X)};B0.prototype._on=function f($,Z,J,z,Q){let Y={};if(J.constraints!==void 0){if(K0(typeof J.constraints==="object"&&J.constraints!==null,"Constraints should be an object"),Object.keys(J.constraints).length!==0)Y=J.constraints}if(this.constrainer.validateConstraints(Y),this.constrainer.noteUsage(Y),this.trees[$]===void 0)this.trees[$]=new g7("/");let X=Z;if(X==="*"&&this.trees[$].prefix.length!==0){let O=this.trees[$];this.trees[$]=new g7(""),this.trees[$].staticChildren["/"]=O}let W=this.trees[$],H=W.prefix.length,w=[];for(let O=0;O<=X.length;O++){if(X.charCodeAt(O)===58&&X.charCodeAt(O+1)===58){O++;continue}let j=X.charCodeAt(O)===58&&X.charCodeAt(O+1)!==58,M=X.charCodeAt(O)===42;if(j||M||O===X.length&&O!==H){let S=X.slice(H,O);if(!this.caseSensitive)S=S.toLowerCase();S=S.replaceAll("::",":"),S=S.replaceAll("%","%25"),W=W.createStaticChild(S)}if(j){let S=!1,v=!0,g="",x=[],_=O+1;for(let b=_;;b++){let i=X.charCodeAt(b),a=i===40,N=i===45||i===46,T=i===47||b===X.length;if(a||N||T){let R=X.slice(_,b);if(w.push(R),S=S||a||N,a){let m=d7(X,b),$0=X.slice(b,m+1);if(!this.allowUnsafeRegex)K0(Z1(new RegExp($0)),`The regex '${$0}' is not safe!`);x.push(m7($0)),b=m+1,v=!0}else x.push(v?"(.*?)":`(${g}|(?:(?!${g}).)*)`),v=!1;let h=b;for(;b<X.length;b++){let m=X.charCodeAt(b);if(m===47)break;if(m===58)if(X.charCodeAt(b+1)===58)b++;else break}let r=X.slice(h,b);if(r)r=r.replaceAll("::",":"),r=r.replaceAll("%","%25"),x.push(g=h7(r));if(_=b+1,T||X.charCodeAt(b)===47||b===X.length){let m=S?"()"+r:r,$0=X.slice(O,b);X=X.slice(0,O+1)+m+X.slice(b),O+=m.length;let n=S?new RegExp("^"+x.join("")+"$"):null;W=W.createParametricChild(n,r||null,$0),H=O+1;break}}}}else if(M){if(w.push("*"),W=W.createWildcardChild(),H=O+1,O!==X.length-1)throw new Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)X=X.toLowerCase();if(X==="*")X="/*";for(let O of this.routes){let j=O.opts.constraints||{};if(O.method===$&&O.pattern===X&&rf(j,Y))throw new Error(`Method '${$}' already declared for route '${X}' with constraints '${JSON.stringify(Y)}'`)}let K={method:$,path:Z,pattern:X,params:w,opts:J,handler:z,store:Q};this.routes.push(K),W.addRoute(K,this.constrainer)};B0.prototype.hasRoute=function f($,Z,J){return this.findRoute($,Z,J)!==null};B0.prototype.findRoute=function f($,Z,J={}){if(this.trees[$]===void 0)return null;let z=Z,Q=this.trees[$],Y=Q.prefix.length,X=[];for(let W=0;W<=z.length;W++){if(z.charCodeAt(W)===58&&z.charCodeAt(W+1)===58){W++;continue}let H=z.charCodeAt(W)===58&&z.charCodeAt(W+1)!==58,w=z.charCodeAt(W)===42;if(H||w||W===z.length&&W!==Y){let K=z.slice(Y,W);if(!this.caseSensitive)K=K.toLowerCase();if(K=K.replaceAll("::",":"),K=K.replaceAll("%","%25"),Q=Q.getStaticChild(K),Q===null)return null}if(H){let K=!1,O=!0,j="",M=[],S=W+1;for(let v=S;;v++){let g=z.charCodeAt(v),x=g===40,_=g===45||g===46,b=g===47||v===z.length;if(x||_||b){let i=z.slice(S,v);if(X.push(i),K=K||x||_,x){let T=d7(z,v),R=z.slice(v,T+1);if(!this.allowUnsafeRegex)K0(Z1(new RegExp(R)),`The regex '${R}' is not safe!`);M.push(m7(R)),v=T+1,O=!1}else M.push(O?"(.*?)":`(${j}|(?:(?!${j}).)*)`),O=!1;let a=v;for(;v<z.length;v++){let T=z.charCodeAt(v);if(T===47)break;if(T===58)if(z.charCodeAt(v+1)===58)v++;else break}let N=z.slice(a,v);if(N)N=N.replaceAll("::",":"),N=N.replaceAll("%","%25"),M.push(j=h7(N));if(S=v+1,b||z.charCodeAt(v)===47||v===z.length){let T=K?"()"+N:N,R=z.slice(W,v);z=z.slice(0,W+1)+T+z.slice(v),W+=T.length;let h=K?new RegExp("^"+M.join("")+"$"):null;if(Q=Q.getParametricChild(h,N||null,R),Q===null)return null;Y=W+1;break}}}}else if(w){if(X.push("*"),Q=Q.getWildcardChild(),Y=W+1,W!==z.length-1)throw new Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)z=z.toLowerCase();for(let W of this.routes){let H=W.opts.constraints||{};if(W.method===$&&W.pattern===z&&rf(H,J))return{handler:W.handler,store:W.store,params:W.params}}return null};B0.prototype.hasConstraintStrategy=function(f){return this.constrainer.hasConstraintStrategy(f)};B0.prototype.addConstraintStrategy=function(f){this.constrainer.addConstraintStrategy(f),this._rebuild(this.routes)};B0.prototype.reset=function f(){this.trees={},this.routes=[]};B0.prototype.off=function f($,Z,J){K0(typeof Z==="string","Path should be a string"),K0(Z.length>0,"The path could not be empty"),K0(Z[0]==="/"||Z[0]==="*","The first character of a path should be `/` or `*`"),K0(typeof J==="undefined"||typeof J==="object"&&!Array.isArray(J)&&J!==null,"Constraints should be an object or undefined.");let z=Z.match(i0);if(z){K0(Z.length===z.index+z[0].length,"Optional Parameter needs to be the last parameter of the path");let Y=Z.replace(i0,"$1$2"),X=Z.replace(i0,"$2");this.off($,Y,J),this.off($,X,J);return}if(this.ignoreDuplicateSlashes)Z=sf(Z);if(this.ignoreTrailingSlash)Z=af(Z);let Q=Array.isArray($)?$:[$];for(let Y of Q)this._off(Y,Z,J)};B0.prototype._off=function f($,Z,J){K0(typeof $==="string","Method should be a string"),K0($1.includes($),`Method '${$}' is not an http method.`);function z(W){return $!==W.method||Z!==W.path}function Q(W){return z(W)||!rf(J,W.opts.constraints||{})}let Y=J?Q:z,X=this.routes.filter(Y);this._rebuild(X)};B0.prototype.lookup=function f($,Z,J,z){if(typeof J==="function")z=J,J=void 0;if(z===void 0){let Q=this.constrainer.deriveConstraints($,J),Y=this.find($.method,$.url,Q);return this.callHandler(Y,$,Z,J)}this.constrainer.deriveConstraints($,J,(Q,Y)=>{if(Q!==null){z(Q);return}try{let X=this.find($.method,$.url,Y),W=this.callHandler(X,$,Z,J);z(null,W)}catch(X){z(X)}})};B0.prototype.callHandler=function f($,Z,J,z){if($===null)return this._defaultRoute(Z,J,z);return z===void 0?$.handler(Z,J,$.params,$.store,$.searchParams):$.handler.call(z,Z,J,$.params,$.store,$.searchParams)};B0.prototype.find=function f($,Z,J){let z=this.trees[$];if(z===void 0)return null;if(Z.charCodeAt(0)!==47)Z=Z.replace(u7,"/");if(this.ignoreDuplicateSlashes)Z=sf(Z);let Q,Y,X;try{Q=c9(Z,this.useSemicolonDelimiter),Z=Q.path,Y=Q.querystring,X=Q.shouldDecodeParam}catch(M){return this._onBadUrl(Z)}if(this.ignoreTrailingSlash)Z=af(Z);let W=Z;if(this.caseSensitive===!1)Z=Z.toLowerCase();let H=this.maxParamLength,w=z.prefix.length,K=[],O=Z.length,j=[];while(!0){if(w===O&&z.isLeafNode){let g=z.handlerStorage.getMatchingHandler(J);if(g!==null)return{handler:g.handler,store:g.store,params:g._createParamsObject(K),searchParams:this.querystringParser(Y)}}let M=z.getNextNode(Z,w,j,K.length);if(M===null){if(j.length===0)return null;let g=j.pop();w=g.brotherPathIndex,K.splice(g.paramsCount),M=g.brotherNode}if(z=M,z.kind===x7.STATIC){w+=z.prefix.length;continue}if(z.kind===x7.WILDCARD){let g=W.slice(w);if(X)g=k7(g);K.push(g),w=O;continue}let S=W.indexOf("/",w);if(S===-1)S=O;let v=W.slice(w,S);if(X)v=k7(v);if(z.isRegex){let g=z.regex.exec(v);if(g===null)continue;for(let x=1;x<g.length;x++){let _=g[x];if(_.length>H)return null;K.push(_)}}else{if(v.length>H)return null;K.push(v)}w=S}};B0.prototype._rebuild=function(f){this.reset();for(let $ of f){let{method:Z,path:J,opts:z,handler:Q,store:Y}=$;this._on(Z,J,z,Q,Y)}};B0.prototype._defaultRoute=function(f,$,Z){if(this.defaultRoute!==null)return Z===void 0?this.defaultRoute(f,$):this.defaultRoute.call(Z,f,$);else $.statusCode=404,$.end()};B0.prototype._onBadUrl=function(f){if(this.onBadUrl===null)return null;let $=this.onBadUrl;return{handler:(Z,J,z)=>$(f,Z,J),params:{},store:null}};B0.prototype.prettyPrint=function(f={}){let $=f.method;f.buildPrettyMeta=this.buildPrettyMeta.bind(this);let Z=null;if($===void 0){let{version:J,host:z,...Q}=this.constrainer.strategies;Q[of.name]=of;let Y=new B0({...this._opts,constraints:Q}),X=this.routes.map((W)=>{let H={...W.opts.constraints,[of.name]:W.method};return{...W,method:"MERGED",opts:{constraints:H}}});Y._rebuild(X),Z=Y.trees.MERGED}else Z=this.trees[$];if(Z==null)return"(empty tree)";return u9(Z,f)};for(let f in $1){if(!$1.hasOwnProperty(f))continue;let $=$1[f],Z=$.toLowerCase();B0.prototype[Z]=function(J,z,Q){return this.on($,J,z,Q)}}B0.prototype.all=function(f,$,Z){this.on($1,f,$,Z)};i7.exports=B0;function h7(f){return f.replace(y7,"\\$&")}function sf(f){return f.indexOf("//")!==-1?f.replace(c7,"/"):f}function af(f){if(f.length>1&&f.charCodeAt(f.length-1)===47)return f.slice(0,-1);return f}function m7(f){if(f.charCodeAt(1)===94)f=f.slice(0,1)+f.slice(2);if(f.charCodeAt(f.length-2)===36)f=f.slice(0,f.length-2)+f.slice(f.length-1);return f}function d7(f,$){let Z=1;while($<f.length){if($++,f.charCodeAt($)===92){$++;continue}if(f.charCodeAt($)===41)Z--;else if(f.charCodeAt($)===40)Z++;if(!Z)return $}throw new TypeError('Invalid regexp expression in "'+f+'"')}function h9(f){if(!f)return{};if(!f.store)return{};return Object.assign({},f.store)}});function q1(f){switch(f.split(".").pop()?.toLowerCase()){case"js":return"application/javascript";case"css":return"text/css";case"html":return"text/html";case"json":return"application/json";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"woff":return"font/woff";case"woff2":return"font/woff2";default:return"application/octet-stream"}}var Uf=null;async function nZ(){if(!Uf){let f=await Promise.resolve().then(() => W4(c4(),1));Uf=f.default||f}return Uf}var lZ={string:"text/plain; charset=utf-8",object:"application/json; charset=utf-8",Uint8Array:"application/octet-stream",ArrayBuffer:"application/octet-stream"};class V1{req;server;path;routePattern;paramNames;env;executionContext;headers=new Headers;parsedQuery=null;parsedParams=null;parsedCookies=null;parsedBody=null;contextData={};urlObject=null;constructor(f,$,Z,J,z,Q,Y){this.req=f,this.server=$,this.path=Z,this.routePattern=J,this.executionContext=Y,this.env=Q,this.paramNames=z}setHeader(f,$){return this.headers.set(f,$),this}removeHeader(f){return this.headers.delete(f),this}set(f,$){return this.contextData[f]=$,this}get(f){return this.contextData[f]}get ip(){if(this.server)return this.server.requestIP(this.req)?.address??null;return this.req.headers.get("CF-Connecting-IP")||null}get url(){if(!this.urlObject)this.urlObject=new URL(this.req.url);return this.urlObject}get query(){if(!this.parsedQuery)this.parsedQuery=this.url.search?Object.fromEntries(this.url.searchParams):{};return this.parsedQuery}get params(){if(!Array.isArray(this.paramNames))return this.paramNames;if(!this.parsedParams)try{this.parsedParams=oZ(this.paramNames,this.path)}catch(f){let $=f instanceof Error?f.message:String(f);throw new Error(`Failed to extract route parameters: ${$}`)}return this.parsedParams??{}}get body(){if(this.req.method==="GET")return Promise.resolve({});if(!this.parsedBody)this.parsedBody=(async()=>{try{let f=await rZ(this.req);if(f.error)throw new Error(f.error);return Object.keys(f).length===0?null:f}catch(f){throw new Error("Invalid request body format")}})();return this.parsedBody}text(f,$=200){return new Response(f,{status:$,headers:this.headers})}send(f,$=200){let Z;if(f instanceof Uint8Array)Z="Uint8Array";else if(f instanceof ArrayBuffer)Z="ArrayBuffer";else Z=typeof f;if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",lZ[Z]??"text/plain; charset=utf-8");let J=Z==="object"&&f!==null?JSON.stringify(f):f;return new Response(J,{status:$,headers:this.headers})}json(f,$=200){return Response.json(f,{status:$,headers:this.headers})}file(f,$,Z=200){let J=Bun.file(f);if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",$??q1(f));return new Response(J,{status:Z,headers:this.headers})}async ejs(f,$={},Z=200){let J=await nZ();try{let z=await Bun.file(f).text(),Q=J.render(z,$),Y=new Headers({"Content-Type":"text/html; charset=utf-8"});return new Response(Q,{status:Z,headers:Y})}catch(z){return console.error("EJS Rendering Error:",z),new Response("Error rendering template",{status:500})}}redirect(f,$=302){return this.headers.set("Location",f),new Response(null,{status:$,headers:this.headers})}setCookie(f,$,Z={}){let J=`${encodeURIComponent(f)}=${encodeURIComponent($)}`;if(Z.maxAge)J+=`; Max-Age=${Z.maxAge}`;if(Z.expires)J+=`; Expires=${Z.expires.toUTCString()}`;if(Z.path)J+=`; Path=${Z.path}`;if(Z.domain)J+=`; Domain=${Z.domain}`;if(Z.secure)J+="; Secure";if(Z.httpOnly)J+="; HttpOnly";if(Z.sameSite)J+=`; SameSite=${Z.sameSite}`;return this.headers.append("Set-Cookie",J),this}get cookies(){if(!this.parsedCookies){let f=this.req.headers.get("cookie");this.parsedCookies=f?pZ(f):{}}return this.parsedCookies}stream(f){let $=new Headers(this.headers),Z=new ReadableStream({async start(J){await f(J),J.close()}});return new Response(Z,{headers:$})}yieldStream(f){return new Response}}function pZ(f){return Object.fromEntries(f.split(";").map(($)=>{let[Z,...J]=$.trim().split("=");return[Z,decodeURIComponent(J.join("="))]}))}function oZ(f,$){let Z={},[J]=$.split("?"),z=J.split("/").filter((Y)=>Y!==""),Q=z.length-f.length;for(let Y=0;Y<f.length;Y++)Z[f[Y]]=z[Q+Y];return Z}function G6(f,$){let Z={},J=f.split("/"),[z]=$.split("?"),Q=z.split("/");if(J.length!==Q.length)return null;for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X.charCodeAt(0)===58)Z[X.slice(1)]=Q[Y]}return Z}async function rZ(f){let $=f.headers.get("Content-Type")||"";if(!$)return{};if(f.headers.get("Content-Length")==="0"||!f.body)return{};if($.startsWith("application/json"))return await f.json();if($.startsWith("application/x-www-form-urlencoded")){let J=await f.text();return Object.fromEntries(new URLSearchParams(J))}if($.startsWith("multipart/form-data")){let J=await f.formData(),z={};for(let[Q,Y]of J.entries())z[Q]=Y;return z}return{error:"Unknown request body type"}}var N1=(f)=>f!==null&&typeof f==="object"&&typeof f.then==="function",h4=(f)=>f!==null&&typeof f==="object"&&typeof f.status==="number"&&typeof f.headers==="object";async function r0(f,$,Z){if(!$?.length)return;for(let J=0;J<$.length;J++){let z=$[J](...Z),Q=z instanceof Promise?await z:z;if(Q&&f!=="onRequest")return Q}}async function M6(f,$,Z){let J=f.globalMiddlewares;if(J.length)for(let Q of J){let Y=await Q(Z);if(Y)return Y}let z=f.middlewares.get($);if(z&&z.length)for(let Q of z){let Y=await Q(Z);if(Y)return Y}return null}async function m4(f,$,Z){for(let J of f){let z=await J($,Z);if(z)return z}}async function R1(f,$,Z){let J=await sZ(f,$,Z),z=N1(J)?await J:J;if(z)return z}async function sZ(f,$,Z){if($.endsWith("/"))$=$.slice(0,-1);if(!f.filters.has($))if(f.filterFunction.length)for(let J of f.filterFunction){let z=await J(Z);if(z)return z}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function I1(f,$,Z){if(f.staticPath){let W=!0;if(f.staticRequestPath)W=Z.startsWith(f.staticRequestPath);if(W){let H=await aZ(f,Z,$);if(H)return H}}let Y=await(f.router.find($.req.method,"*")?.handler).slice(-1)[0]($);if(h4(Y))return Y;let X=f.routeNotFoundFunc($);return X instanceof Promise?await X:X||U1(404,`404 Route not found for ${Z}`)}function U1(f,$){return new Response(JSON.stringify({error:$}),{status:f,headers:{"Content-Type":"application/json"}})}async function aZ(f,$,Z){if(!f.staticPath)return null;let J=`${f.staticPath}${$}`;if(await Bun.file(J).exists()){let Q=q1(J);return Z.file(J,Q,200)}return null}var Bf=(f)=>f.constructor.name==="AsyncFunction",d4=(f,$,Z,...J)=>{if($.length>5)f.push(`
|
|
154
|
+
`))}}L7.exports=O7});var q7=Z0((p6,A7)=>{var I9=M7(),t1={STATIC:0,PARAMETRIC:1,WILDCARD:2};class mf{constructor(){this.isLeafNode=!1,this.routes=null,this.handlerStorage=null}addRoute(f,$){if(this.routes===null)this.routes=[];if(this.handlerStorage===null)this.handlerStorage=new I9;this.isLeafNode=!0,this.routes.push(f),this.handlerStorage.addHandler($,f)}}class df extends mf{constructor(){super();this.staticChildren={}}findStaticMatchingChild(f,$){let Z=this.staticChildren[f.charAt($)];if(Z===void 0||!Z.matchPrefix(f,$))return null;return Z}getStaticChild(f,$=0){if(f.length===$)return this;let Z=this.findStaticMatchingChild(f,$);if(Z)return Z.getStaticChild(f,$+Z.prefix.length);return null}createStaticChild(f){if(f.length===0)return this;let $=this.staticChildren[f.charAt(0)];if($){let J=1;for(;J<$.prefix.length;J++)if(f.charCodeAt(J)!==$.prefix.charCodeAt(J)){$=$.split(this,J);break}return $.createStaticChild(f.slice(J))}let Z=f.charAt(0);return this.staticChildren[Z]=new e1(f),this.staticChildren[Z]}}class e1 extends df{constructor(f){super();this.prefix=f,this.wildcardChild=null,this.parametricChildren=[],this.kind=t1.STATIC,this._compilePrefixMatch()}getParametricChild(f){let $=f&&f.source,Z=this.parametricChildren.find((J)=>{return(J.regex&&J.regex.source)===$});if(Z)return Z;return null}createParametricChild(f,$,Z){let J=this.getParametricChild(f);if(J)return J.nodePaths.add(Z),J;return J=new nf(f,$,Z),this.parametricChildren.push(J),this.parametricChildren.sort((z,Q)=>{if(!z.isRegex)return 1;if(!Q.isRegex)return-1;if(z.staticSuffix===null)return 1;if(Q.staticSuffix===null)return-1;if(Q.staticSuffix.endsWith(z.staticSuffix))return 1;if(z.staticSuffix.endsWith(Q.staticSuffix))return-1;return 0}),J}getWildcardChild(){return this.wildcardChild}createWildcardChild(){return this.wildcardChild=this.getWildcardChild()||new lf,this.wildcardChild}split(f,$){let Z=this.prefix.slice(0,$),J=this.prefix.slice($);this.prefix=J,this._compilePrefixMatch();let z=new e1(Z);return z.staticChildren[J.charAt(0)]=this,f.staticChildren[Z.charAt(0)]=z,z}getNextNode(f,$,Z,J){let z=this.findStaticMatchingChild(f,$),Q=0;if(z===null){if(this.parametricChildren.length===0)return this.wildcardChild;z=this.parametricChildren[0],Q=1}if(this.wildcardChild!==null)Z.push({paramsCount:J,brotherPathIndex:$,brotherNode:this.wildcardChild});for(let Y=this.parametricChildren.length-1;Y>=Q;Y--)Z.push({paramsCount:J,brotherPathIndex:$,brotherNode:this.parametricChildren[Y]});return z}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let f=[];for(let $=1;$<this.prefix.length;$++){let Z=this.prefix.charCodeAt($);f.push(`path.charCodeAt(i + ${$}) === ${Z}`)}this.matchPrefix=new Function("path","i",`return ${f.join(" && ")}`)}}class nf extends df{constructor(f,$,Z){super();this.isRegex=!!f,this.regex=f||null,this.staticSuffix=$||null,this.kind=t1.PARAMETRIC,this.nodePaths=new Set([Z])}getNextNode(f,$){return this.findStaticMatchingChild(f,$)}}class lf extends mf{constructor(){super();this.kind=t1.WILDCARD}getNextNode(){return null}}A7.exports={StaticNode:e1,ParametricNode:nf,WildcardNode:lf,NODE_TYPES:t1}});var T7=Z0((o6,j7)=>{var S9=(D1(),o0(K1));function L1(){if(!(this instanceof L1))return new L1;this.store=new Map,this.maxMajor=0,this.maxMinors={},this.maxPatches={}}L1.prototype.set=function(f,$){if(typeof f!=="string")throw new TypeError("Version should be a string");let[Z,J,z]=f.split(".",3);if(isNaN(Z))throw new TypeError("Major version must be a numeric value");if(Z=Number(Z),J=Number(J)||0,z=Number(z)||0,Z>=this.maxMajor)this.maxMajor=Z,this.store.set("x",$),this.store.set("*",$),this.store.set("x.x",$),this.store.set("x.x.x",$);if(J>=(this.maxMinors[Z]||0))this.maxMinors[Z]=J,this.store.set(`${Z}.x`,$),this.store.set(`${Z}.x.x`,$);if(z>=(this.maxPatches[`${Z}.${J}`]||0))this.maxPatches[`${Z}.${J}`]=z,this.store.set(`${Z}.${J}.x`,$);return this.store.set(`${Z}.${J}.${z}`,$),this};L1.prototype.get=function(f){return this.store.get(f)};j7.exports={name:"version",mustMatchWhenDerived:!0,storage:L1,validate(f){S9(typeof f==="string","Version should be a string")}}});var N7=Z0((r6,C7)=>{var P9=(D1(),o0(K1));function E9(){let f=new Map,$=[];return{get:(Z)=>{let J=f.get(Z);if(J)return J;for(let z of $)if(z.host.test(Z))return z.value},set:(Z,J)=>{if(Z instanceof RegExp)$.push({host:Z,value:J});else f.set(Z,J)}}}C7.exports={name:"host",mustMatchWhenDerived:!1,storage:E9,validate(f){P9(typeof f==="string"||Object.prototype.toString.call(f)==="[object RegExp]","Host should be a string or a RegExp")}}});var S7=Z0((s6,I7)=>{var b9=T7(),_9=N7(),pf=(D1(),o0(K1));class R7{constructor(f){if(this.strategies={version:b9,host:_9},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,f)for(let $ of Object.values(f))this.addConstraintStrategy($)}isStrategyUsed(f){return this.strategiesInUse.has(f)||this.asyncStrategiesInUse.has(f)}hasConstraintStrategy(f){let $=this.strategies[f];if($!==void 0)return $.isCustom||this.isStrategyUsed(f);return!1}addConstraintStrategy(f){if(pf(typeof f.name==="string"&&f.name!=="","strategy.name is required."),pf(f.storage&&typeof f.storage==="function","strategy.storage function is required."),pf(f.deriveConstraint&&typeof f.deriveConstraint==="function","strategy.deriveConstraint function is required."),this.strategies[f.name]&&this.strategies[f.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${f.name}.`);if(this.isStrategyUsed(f.name))throw new Error(`There already exists a route with ${f.name} constraint.`);if(f.isCustom=!0,f.isAsync=f.deriveConstraint.length===3,this.strategies[f.name]=f,f.mustMatchWhenDerived)this.noteUsage({[f.name]:f})}deriveConstraints(f,$,Z){let J=this.deriveSyncConstraints(f,$);if(Z===void 0)return J;this.deriveAsyncConstraints(J,f,$,Z)}deriveSyncConstraints(f,$){return}noteUsage(f){if(f){let $=this.strategiesInUse.size;for(let Z in f)if(this.strategies[Z].isAsync)this.asyncStrategiesInUse.add(Z);else this.strategiesInUse.add(Z);if($!==this.strategiesInUse.size)this._buildDeriveConstraints()}}newStoreForConstraint(f){if(!this.strategies[f])throw new Error(`No strategy registered for constraint key ${f}`);return this.strategies[f].storage()}validateConstraints(f){for(let $ in f){let Z=f[$];if(typeof Z==="undefined")throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");let J=this.strategies[$];if(!J)throw new Error(`No strategy registered for constraint key ${$}`);if(J.validate)J.validate(Z)}}deriveAsyncConstraints(f,$,Z,J){let z=this.asyncStrategiesInUse.size;if(z===0){J(null,f);return}f=f||{};for(let Q of this.asyncStrategiesInUse)this.strategies[Q].deriveConstraint($,Z,(X,W)=>{if(X!==null){J(X);return}if(f[Q]=W,--z===0)J(null,f)})}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let f=["return {"];for(let $ of this.strategiesInUse){let Z=this.strategies[$];if(!Z.isCustom)if($==="version")f.push(" version: req.headers['accept-version'],");else f.push(" host: req.headers.host || req.headers[':authority'],");else f.push(` ${Z.name}: this.strategies.${$}.deriveConstraint(req, ctx),`)}f.push("}"),this.deriveSyncConstraints=new Function("req","ctx",f.join(`
|
|
155
|
+
`)).bind(this)}}I7.exports=R7});var E7=Z0((a6,P7)=>{var v9=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];P7.exports=v9});var v7=Z0((t6,_7)=>{function b7(f,$){if(f===50){if($===53)return"%";if($===51)return"#";if($===52)return"$";if($===54)return"&";if($===66)return"+";if($===98)return"+";if($===67)return",";if($===99)return",";if($===70)return"/";if($===102)return"/";return null}if(f===51){if($===65)return":";if($===97)return":";if($===66)return";";if($===98)return";";if($===68)return"=";if($===100)return"=";if($===70)return"?";if($===102)return"?";return null}if(f===52&&$===48)return"@";return null}function g9(f,$){let Z=!1,J=!1,z="";for(let Y=1;Y<f.length;Y++){let X=f.charCodeAt(Y);if(X===37){let W=f.charCodeAt(Y+1),H=f.charCodeAt(Y+2);if(b7(W,H)===null)Z=!0;else{if(J=!0,W===50&&H===53)Z=!0,f=f.slice(0,Y+1)+"25"+f.slice(Y+1),Y+=2;Y+=2}}else if(X===63||X===35||X===59&&$){z=f.slice(Y+1),f=f.slice(0,Y);break}}return{path:Z?decodeURI(f):f,querystring:z,shouldDecodeParam:J}}function x9(f){let $=f.indexOf("%");if($===-1)return f;let Z="",J=$;for(let z=$;z<f.length;z++)if(f.charCodeAt(z)===37){let Q=f.charCodeAt(z+1),Y=f.charCodeAt(z+2),X=b7(Q,Y);Z+=f.slice(J,z)+X,J=z+3}return f.slice(0,$)+Z+f.slice(J)}_7.exports={safeDecodeURI:g9,safeDecodeURIComponent:x9}});var n7=Z0((e6,i7)=>{var K0=(D1(),o0(K1)),k9=E$(),Z1=Q7(),rf=hf(),{prettyPrintTree:u9}=F7(),{StaticNode:g7,NODE_TYPES:x7}=q7(),y9=S7(),$1=E7(),of=s1(),{safeDecodeURI:c9,safeDecodeURIComponent:k7}=v7(),u7=/^https?:\/\/.*?\//,i0=/(\/:[^/()]*?)\?(\/?)/,y7=/[.*+?^${}()|[\]\\]/g,c7=/\/\/+/g;if(!Z1(u7))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!Z1(i0))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!Z1(y7))throw new Error("the ESCAPE_REGEXP is not safe, update this module");if(!Z1(c7))throw new Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function B0(f){if(!(this instanceof B0))return new B0(f);if(f=f||{},this._opts=f,f.defaultRoute)K0(typeof f.defaultRoute==="function","The default route must be a function"),this.defaultRoute=f.defaultRoute;else this.defaultRoute=null;if(f.onBadUrl)K0(typeof f.onBadUrl==="function","The bad url handler must be a function"),this.onBadUrl=f.onBadUrl;else this.onBadUrl=null;if(f.buildPrettyMeta)K0(typeof f.buildPrettyMeta==="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=f.buildPrettyMeta;else this.buildPrettyMeta=h9;if(f.querystringParser)K0(typeof f.querystringParser==="function","querystringParser must be a function"),this.querystringParser=f.querystringParser;else this.querystringParser=($)=>$.length===0?{}:k9.parse($);this.caseSensitive=f.caseSensitive===void 0?!0:f.caseSensitive,this.ignoreTrailingSlash=f.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=f.ignoreDuplicateSlashes||!1,this.maxParamLength=f.maxParamLength||100,this.allowUnsafeRegex=f.allowUnsafeRegex||!1,this.constrainer=new y9(f.constraints),this.useSemicolonDelimiter=f.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}B0.prototype.on=function f($,Z,J,z,Q){if(typeof J==="function"){if(z!==void 0)Q=z;z=J,J={}}K0(typeof Z==="string","Path should be a string"),K0(Z.length>0,"The path could not be empty"),K0(Z[0]==="/"||Z[0]==="*","The first character of a path should be `/` or `*`"),K0(typeof z==="function","Handler should be a function");let Y=Z.match(i0);if(Y){K0(Z.length===Y.index+Y[0].length,"Optional Parameter needs to be the last parameter of the path");let H=Z.replace(i0,"$1$2"),w=Z.replace(i0,"$2")||"/";this.on($,H,J,z,Q),this.on($,w,J,z,Q);return}let X=Z;if(this.ignoreDuplicateSlashes)Z=sf(Z);if(this.ignoreTrailingSlash)Z=af(Z);let W=Array.isArray($)?$:[$];for(let H of W)K0(typeof H==="string","Method should be a string"),K0($1.includes(H),`Method '${H}' is not an http method.`),this._on(H,Z,J,z,Q,X)};B0.prototype._on=function f($,Z,J,z,Q){let Y={};if(J.constraints!==void 0){if(K0(typeof J.constraints==="object"&&J.constraints!==null,"Constraints should be an object"),Object.keys(J.constraints).length!==0)Y=J.constraints}if(this.constrainer.validateConstraints(Y),this.constrainer.noteUsage(Y),this.trees[$]===void 0)this.trees[$]=new g7("/");let X=Z;if(X==="*"&&this.trees[$].prefix.length!==0){let O=this.trees[$];this.trees[$]=new g7(""),this.trees[$].staticChildren["/"]=O}let W=this.trees[$],H=W.prefix.length,w=[];for(let O=0;O<=X.length;O++){if(X.charCodeAt(O)===58&&X.charCodeAt(O+1)===58){O++;continue}let j=X.charCodeAt(O)===58&&X.charCodeAt(O+1)!==58,M=X.charCodeAt(O)===42;if(j||M||O===X.length&&O!==H){let S=X.slice(H,O);if(!this.caseSensitive)S=S.toLowerCase();S=S.replaceAll("::",":"),S=S.replaceAll("%","%25"),W=W.createStaticChild(S)}if(j){let S=!1,v=!0,g="",x=[],_=O+1;for(let b=_;;b++){let i=X.charCodeAt(b),a=i===40,N=i===45||i===46,T=i===47||b===X.length;if(a||N||T){let R=X.slice(_,b);if(w.push(R),S=S||a||N,a){let m=d7(X,b),$0=X.slice(b,m+1);if(!this.allowUnsafeRegex)K0(Z1(new RegExp($0)),`The regex '${$0}' is not safe!`);x.push(m7($0)),b=m+1,v=!0}else x.push(v?"(.*?)":`(${g}|(?:(?!${g}).)*)`),v=!1;let h=b;for(;b<X.length;b++){let m=X.charCodeAt(b);if(m===47)break;if(m===58)if(X.charCodeAt(b+1)===58)b++;else break}let r=X.slice(h,b);if(r)r=r.replaceAll("::",":"),r=r.replaceAll("%","%25"),x.push(g=h7(r));if(_=b+1,T||X.charCodeAt(b)===47||b===X.length){let m=S?"()"+r:r,$0=X.slice(O,b);X=X.slice(0,O+1)+m+X.slice(b),O+=m.length;let n=S?new RegExp("^"+x.join("")+"$"):null;W=W.createParametricChild(n,r||null,$0),H=O+1;break}}}}else if(M){if(w.push("*"),W=W.createWildcardChild(),H=O+1,O!==X.length-1)throw new Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)X=X.toLowerCase();if(X==="*")X="/*";for(let O of this.routes){let j=O.opts.constraints||{};if(O.method===$&&O.pattern===X&&rf(j,Y))throw new Error(`Method '${$}' already declared for route '${X}' with constraints '${JSON.stringify(Y)}'`)}let K={method:$,path:Z,pattern:X,params:w,opts:J,handler:z,store:Q};this.routes.push(K),W.addRoute(K,this.constrainer)};B0.prototype.hasRoute=function f($,Z,J){return this.findRoute($,Z,J)!==null};B0.prototype.findRoute=function f($,Z,J={}){if(this.trees[$]===void 0)return null;let z=Z,Q=this.trees[$],Y=Q.prefix.length,X=[];for(let W=0;W<=z.length;W++){if(z.charCodeAt(W)===58&&z.charCodeAt(W+1)===58){W++;continue}let H=z.charCodeAt(W)===58&&z.charCodeAt(W+1)!==58,w=z.charCodeAt(W)===42;if(H||w||W===z.length&&W!==Y){let K=z.slice(Y,W);if(!this.caseSensitive)K=K.toLowerCase();if(K=K.replaceAll("::",":"),K=K.replaceAll("%","%25"),Q=Q.getStaticChild(K),Q===null)return null}if(H){let K=!1,O=!0,j="",M=[],S=W+1;for(let v=S;;v++){let g=z.charCodeAt(v),x=g===40,_=g===45||g===46,b=g===47||v===z.length;if(x||_||b){let i=z.slice(S,v);if(X.push(i),K=K||x||_,x){let T=d7(z,v),R=z.slice(v,T+1);if(!this.allowUnsafeRegex)K0(Z1(new RegExp(R)),`The regex '${R}' is not safe!`);M.push(m7(R)),v=T+1,O=!1}else M.push(O?"(.*?)":`(${j}|(?:(?!${j}).)*)`),O=!1;let a=v;for(;v<z.length;v++){let T=z.charCodeAt(v);if(T===47)break;if(T===58)if(z.charCodeAt(v+1)===58)v++;else break}let N=z.slice(a,v);if(N)N=N.replaceAll("::",":"),N=N.replaceAll("%","%25"),M.push(j=h7(N));if(S=v+1,b||z.charCodeAt(v)===47||v===z.length){let T=K?"()"+N:N,R=z.slice(W,v);z=z.slice(0,W+1)+T+z.slice(v),W+=T.length;let h=K?new RegExp("^"+M.join("")+"$"):null;if(Q=Q.getParametricChild(h,N||null,R),Q===null)return null;Y=W+1;break}}}}else if(w){if(X.push("*"),Q=Q.getWildcardChild(),Y=W+1,W!==z.length-1)throw new Error("Wildcard must be the last character in the route")}}if(!this.caseSensitive)z=z.toLowerCase();for(let W of this.routes){let H=W.opts.constraints||{};if(W.method===$&&W.pattern===z&&rf(H,J))return{handler:W.handler,store:W.store,params:W.params}}return null};B0.prototype.hasConstraintStrategy=function(f){return this.constrainer.hasConstraintStrategy(f)};B0.prototype.addConstraintStrategy=function(f){this.constrainer.addConstraintStrategy(f),this._rebuild(this.routes)};B0.prototype.reset=function f(){this.trees={},this.routes=[]};B0.prototype.off=function f($,Z,J){K0(typeof Z==="string","Path should be a string"),K0(Z.length>0,"The path could not be empty"),K0(Z[0]==="/"||Z[0]==="*","The first character of a path should be `/` or `*`"),K0(typeof J==="undefined"||typeof J==="object"&&!Array.isArray(J)&&J!==null,"Constraints should be an object or undefined.");let z=Z.match(i0);if(z){K0(Z.length===z.index+z[0].length,"Optional Parameter needs to be the last parameter of the path");let Y=Z.replace(i0,"$1$2"),X=Z.replace(i0,"$2");this.off($,Y,J),this.off($,X,J);return}if(this.ignoreDuplicateSlashes)Z=sf(Z);if(this.ignoreTrailingSlash)Z=af(Z);let Q=Array.isArray($)?$:[$];for(let Y of Q)this._off(Y,Z,J)};B0.prototype._off=function f($,Z,J){K0(typeof $==="string","Method should be a string"),K0($1.includes($),`Method '${$}' is not an http method.`);function z(W){return $!==W.method||Z!==W.path}function Q(W){return z(W)||!rf(J,W.opts.constraints||{})}let Y=J?Q:z,X=this.routes.filter(Y);this._rebuild(X)};B0.prototype.lookup=function f($,Z,J,z){if(typeof J==="function")z=J,J=void 0;if(z===void 0){let Q=this.constrainer.deriveConstraints($,J),Y=this.find($.method,$.url,Q);return this.callHandler(Y,$,Z,J)}this.constrainer.deriveConstraints($,J,(Q,Y)=>{if(Q!==null){z(Q);return}try{let X=this.find($.method,$.url,Y),W=this.callHandler(X,$,Z,J);z(null,W)}catch(X){z(X)}})};B0.prototype.callHandler=function f($,Z,J,z){if($===null)return this._defaultRoute(Z,J,z);return z===void 0?$.handler(Z,J,$.params,$.store,$.searchParams):$.handler.call(z,Z,J,$.params,$.store,$.searchParams)};B0.prototype.find=function f($,Z,J){let z=this.trees[$];if(z===void 0)return null;if(Z.charCodeAt(0)!==47)Z=Z.replace(u7,"/");if(this.ignoreDuplicateSlashes)Z=sf(Z);let Q,Y,X;try{Q=c9(Z,this.useSemicolonDelimiter),Z=Q.path,Y=Q.querystring,X=Q.shouldDecodeParam}catch(M){return this._onBadUrl(Z)}if(this.ignoreTrailingSlash)Z=af(Z);let W=Z;if(this.caseSensitive===!1)Z=Z.toLowerCase();let H=this.maxParamLength,w=z.prefix.length,K=[],O=Z.length,j=[];while(!0){if(w===O&&z.isLeafNode){let g=z.handlerStorage.getMatchingHandler(J);if(g!==null)return{handler:g.handler,store:g.store,params:g._createParamsObject(K),searchParams:this.querystringParser(Y)}}let M=z.getNextNode(Z,w,j,K.length);if(M===null){if(j.length===0)return null;let g=j.pop();w=g.brotherPathIndex,K.splice(g.paramsCount),M=g.brotherNode}if(z=M,z.kind===x7.STATIC){w+=z.prefix.length;continue}if(z.kind===x7.WILDCARD){let g=W.slice(w);if(X)g=k7(g);K.push(g),w=O;continue}let S=W.indexOf("/",w);if(S===-1)S=O;let v=W.slice(w,S);if(X)v=k7(v);if(z.isRegex){let g=z.regex.exec(v);if(g===null)continue;for(let x=1;x<g.length;x++){let _=g[x];if(_.length>H)return null;K.push(_)}}else{if(v.length>H)return null;K.push(v)}w=S}};B0.prototype._rebuild=function(f){this.reset();for(let $ of f){let{method:Z,path:J,opts:z,handler:Q,store:Y}=$;this._on(Z,J,z,Q,Y)}};B0.prototype._defaultRoute=function(f,$,Z){if(this.defaultRoute!==null)return Z===void 0?this.defaultRoute(f,$):this.defaultRoute.call(Z,f,$);else $.statusCode=404,$.end()};B0.prototype._onBadUrl=function(f){if(this.onBadUrl===null)return null;let $=this.onBadUrl;return{handler:(Z,J,z)=>$(f,Z,J),params:{},store:null}};B0.prototype.prettyPrint=function(f={}){let $=f.method;f.buildPrettyMeta=this.buildPrettyMeta.bind(this);let Z=null;if($===void 0){let{version:J,host:z,...Q}=this.constrainer.strategies;Q[of.name]=of;let Y=new B0({...this._opts,constraints:Q}),X=this.routes.map((W)=>{let H={...W.opts.constraints,[of.name]:W.method};return{...W,method:"MERGED",opts:{constraints:H}}});Y._rebuild(X),Z=Y.trees.MERGED}else Z=this.trees[$];if(Z==null)return"(empty tree)";return u9(Z,f)};for(let f in $1){if(!$1.hasOwnProperty(f))continue;let $=$1[f],Z=$.toLowerCase();B0.prototype[Z]=function(J,z,Q){return this.on($,J,z,Q)}}B0.prototype.all=function(f,$,Z){this.on($1,f,$,Z)};i7.exports=B0;function h7(f){return f.replace(y7,"\\$&")}function sf(f){return f.indexOf("//")!==-1?f.replace(c7,"/"):f}function af(f){if(f.length>1&&f.charCodeAt(f.length-1)===47)return f.slice(0,-1);return f}function m7(f){if(f.charCodeAt(1)===94)f=f.slice(0,1)+f.slice(2);if(f.charCodeAt(f.length-2)===36)f=f.slice(0,f.length-2)+f.slice(f.length-1);return f}function d7(f,$){let Z=1;while($<f.length){if($++,f.charCodeAt($)===92){$++;continue}if(f.charCodeAt($)===41)Z--;else if(f.charCodeAt($)===40)Z++;if(!Z)return $}throw new TypeError('Invalid regexp expression in "'+f+'"')}function h9(f){if(!f)return{};if(!f.store)return{};return Object.assign({},f.store)}});function q1(f){switch(f.split(".").pop()?.toLowerCase()){case"js":return"application/javascript";case"css":return"text/css";case"html":return"text/html";case"json":return"application/json";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"woff":return"font/woff";case"woff2":return"font/woff2";default:return"application/octet-stream"}}var Vf=null;async function nZ(){if(!Vf){let f=await Promise.resolve().then(() => W4(c4(),1));Vf=f.default||f}return Vf}var lZ={string:"text/plain; charset=utf-8",object:"application/json; charset=utf-8",Uint8Array:"application/octet-stream",ArrayBuffer:"application/octet-stream"};class V1{req;server;path;routePattern;paramNames;env;executionContext;headers=new Headers;parsedQuery=null;parsedParams=null;parsedCookies=null;parsedBody=null;contextData={};urlObject=null;constructor(f,$,Z,J,z,Q,Y){this.req=f,this.server=$,this.path=Z,this.routePattern=J,this.executionContext=Y,this.env=Q,this.paramNames=z}setHeader(f,$){return this.headers.set(f,$),this}removeHeader(f){return this.headers.delete(f),this}set(f,$){return this.contextData[f]=$,this}get(f){return this.contextData[f]}get ip(){if(this.server)return this.server.requestIP(this.req)?.address??null;return this.req.headers.get("CF-Connecting-IP")||null}get url(){if(!this.urlObject)this.urlObject=new URL(this.req.url);return this.urlObject}get query(){if(!this.parsedQuery)this.parsedQuery=this.url.search?Object.fromEntries(this.url.searchParams):{};return this.parsedQuery}get params(){if(!Array.isArray(this.paramNames))return this.paramNames;if(!this.parsedParams)try{this.parsedParams=oZ(this.paramNames,this.path)}catch(f){let $=f instanceof Error?f.message:String(f);throw new Error(`Failed to extract route parameters: ${$}`)}return this.parsedParams??{}}get body(){if(this.req.method==="GET")return Promise.resolve({});if(!this.parsedBody)this.parsedBody=(async()=>{try{let f=await rZ(this.req);if(f.error)throw new Error(f.error);return Object.keys(f).length===0?null:f}catch(f){throw new Error("Invalid request body format")}})();return this.parsedBody}text(f,$=200){return new Response(f,{status:$,headers:this.headers})}send(f,$=200){let Z;if(f instanceof Uint8Array)Z="Uint8Array";else if(f instanceof ArrayBuffer)Z="ArrayBuffer";else Z=typeof f;if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",lZ[Z]??"text/plain; charset=utf-8");let J=Z==="object"&&f!==null?JSON.stringify(f):f;return new Response(J,{status:$,headers:this.headers})}json(f,$=200){return Response.json(f,{status:$,headers:this.headers})}file(f,$,Z=200){let J=Bun.file(f);if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",$??q1(f));return new Response(J,{status:Z,headers:this.headers})}async ejs(f,$={},Z=200){let J=await nZ();try{let z=await Bun.file(f).text(),Q=J.render(z,$),Y=new Headers({"Content-Type":"text/html; charset=utf-8"});return new Response(Q,{status:Z,headers:Y})}catch(z){return console.error("EJS Rendering Error:",z),new Response("Error rendering template",{status:500})}}redirect(f,$=302){return this.headers.set("Location",f),new Response(null,{status:$,headers:this.headers})}setCookie(f,$,Z={}){let J=`${encodeURIComponent(f)}=${encodeURIComponent($)}`;if(Z.maxAge)J+=`; Max-Age=${Z.maxAge}`;if(Z.expires)J+=`; Expires=${Z.expires.toUTCString()}`;if(Z.path)J+=`; Path=${Z.path}`;if(Z.domain)J+=`; Domain=${Z.domain}`;if(Z.secure)J+="; Secure";if(Z.httpOnly)J+="; HttpOnly";if(Z.sameSite)J+=`; SameSite=${Z.sameSite}`;return this.headers.append("Set-Cookie",J),this}get cookies(){if(!this.parsedCookies){let f=this.req.headers.get("cookie");this.parsedCookies=f?pZ(f):{}}return this.parsedCookies}stream(f){let $=new Headers(this.headers),Z=new ReadableStream({async start(J){await f(J),J.close()}});return new Response(Z,{headers:$})}yieldStream(f){return new Response}}function pZ(f){return Object.fromEntries(f.split(";").map(($)=>{let[Z,...J]=$.trim().split("=");return[Z,decodeURIComponent(J.join("="))]}))}function oZ(f,$){let Z={},[J]=$.split("?"),z=J.split("/").filter((Y)=>Y!==""),Q=z.length-f.length;for(let Y=0;Y<f.length;Y++)Z[f[Y]]=z[Q+Y];return Z}function G6(f,$){let Z={},J=f.split("/"),[z]=$.split("?"),Q=z.split("/");if(J.length!==Q.length)return null;for(let Y=0;Y<J.length;Y++){let X=J[Y];if(X.charCodeAt(0)===58)Z[X.slice(1)]=Q[Y]}return Z}async function rZ(f){let $=f.headers.get("Content-Type")||"";if(!$)return{};if(f.headers.get("Content-Length")==="0"||!f.body)return{};if($.startsWith("application/json"))return await f.json();if($.startsWith("application/x-www-form-urlencoded")){let J=await f.text();return Object.fromEntries(new URLSearchParams(J))}if($.startsWith("multipart/form-data")){let J=await f.formData(),z={};for(let[Q,Y]of J.entries())z[Q]=Y;return z}return{error:"Unknown request body type"}}var U1=(f)=>f!==null&&typeof f==="object"&&typeof f.then==="function",h4=(f)=>f!==null&&typeof f==="object"&&typeof f.status==="number"&&typeof f.headers==="object";async function r0(f,$,Z){if(!$?.length)return;for(let J=0;J<$.length;J++){let z=$[J](...Z),Q=z instanceof Promise?await z:z;if(Q&&f!=="onRequest")return Q}}async function M6(f,$,Z){let J=f.globalMiddlewares;if(J.length)for(let Q of J){let Y=await Q(Z);if(Y)return Y}let z=f.middlewares.get($);if(z&&z.length)for(let Q of z){let Y=await Q(Z);if(Y)return Y}return null}async function m4(f,$,Z){for(let J of f){let z=await J($,Z);if(z)return z}}async function N1(f,$,Z){let J=await sZ(f,$,Z),z=U1(J)?await J:J;if(z)return z}async function sZ(f,$,Z){if($.endsWith("/"))$=$.slice(0,-1);if(!f.filters.has($))if(f.filterFunction.length)for(let J of f.filterFunction){let z=await J(Z);if(z)return z}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function R1(f,$,Z){if(f.staticPath){let X=!0;if(f.staticRequestPath)X=Z.startsWith(f.staticRequestPath);if(X){let W=await aZ(f,Z,$);if(W)return W}}let Q=(f.router.find($.req.method,"*")?.handler).slice(-1);if(Q.length>0){let X=await Q[0]($);if(h4(X))return X}let Y=f.routeNotFoundFunc($);return Y instanceof Promise?await Y:Y||Uf(404,`404 Route not found for ${Z}`)}function Uf(f,$){return new Response(JSON.stringify({error:$}),{status:f,headers:{"Content-Type":"application/json"}})}async function aZ(f,$,Z){if(!f.staticPath)return null;let J=`${f.staticPath}${$}`;if(await Bun.file(J).exists()){let Q=q1(J);return Z.file(J,Q,200)}return null}var Bf=(f)=>f.constructor.name==="AsyncFunction",d4=(f,$,Z,...J)=>{if($.length>5)f.push(`
|
|
156
156
|
for (let i = 0; i < diesel.hooks.${Z}.length; i++) {
|
|
157
157
|
const result = diesel.hooks.${Z}[i](${J});
|
|
158
158
|
const finalResult = result instanceof Promise ? await result : result;
|
|
@@ -214,7 +214,7 @@ ${$}`)}function t1(f,$,Z,J){if(f.isLeafNode||J.commonPrefix!==!1){if(Z=Z||"(empt
|
|
|
214
214
|
${$.join(`
|
|
215
215
|
`)}
|
|
216
216
|
}
|
|
217
|
-
`;return new Function("runFilter","handleRouteNotFound","generateErrorResponse","Context",Q)(R1,
|
|
217
|
+
`;return new Function("runFilter","handleRouteNotFound","generateErrorResponse","Context",Q)(N1,R1,Uf,V1)},i4=(f,$,Z,...J)=>{let z=[],Q;if(typeof J[0]==="string"||typeof J[0]==="object")Q=J[0];let Y=J,X=f?.hasMiddleware?f.globalMiddlewares:[],W=f?.hasMiddleware?f.middlewares.get(Z)||[]:[],H=[...X,...W],w=f?.hasOnReqHook?f.hooks.onRequest:[],K=f.filters.has(Z),O=f.filterFunction;if(w&&w?.length>0)z.push(`
|
|
218
218
|
const onRequestResult = await runHooks(
|
|
219
219
|
"onRequest",
|
|
220
220
|
onRequestHooks,
|
|
@@ -261,6 +261,6 @@ ${$}`)}function t1(f,$,Z,J){if(f.isLeafNode||J.commonPrefix!==!1){if(Z=Z||"(empt
|
|
|
261
261
|
${z.join(`
|
|
262
262
|
`)}
|
|
263
263
|
}
|
|
264
|
-
`;return new Function("executeBunMiddlewares","handlers","runHooks","filterFunctions","onRequestHooks","allMiddlewares",j)(m4,Y,r0,O,w,H)};class
|
|
264
|
+
`;return new Function("executeBunMiddlewares","handlers","runHooks","filterFunctions","onRequestHooks","allMiddlewares",j)(m4,Y,r0,O,w,H)};class I1{children;isEndOfWord;handler;isDynamic;pattern;path;methodMap;segmentCount;params;middlewares;constructor(){this.children={},this.isEndOfWord=!1,this.handler=null,this.isDynamic=!1,this.pattern="",this.path="",this.methodMap=new Map,this.segmentCount=0,this.params=[],this.middlewares=[]}}class Gf{root;cachedSegments;globalMiddlewares;constructor(){this.root=new I1,this.cachedSegments=new Map,this.globalMiddlewares=[]}pushMidl(f,...$){let Z=this.root,J=f.split("/").filter(Boolean);if(f==="/"){Z.handler=$[0],this.globalMiddlewares.push(...$);return}for(let z of J){let Q=z;if(z.startsWith(":"))Q=":";else if(z.startsWith("*"))Z.middlewares.push(...$);if(!Z.children[Q])Z.children[Q]=new I1;Z=Z.children[Q]}Z.middlewares.push(...$),Z.handler=$[0]}insert(f,$){let Z=this.root,J=f.split("/").filter(Boolean);if(this.cachedSegments.set(f,J),f==="/"){Z.isEndOfWord=!0,Z.handler=$.handler,Z.path=f,Z.methodMap.set($.method,$.handler),Z.segmentCount=0,Z.params=[];return}for(let z of J){let Q=z,Y=!1;if(z.startsWith(":"))Y=!0,Q=":";if(z==="*")Q="*";if(!Z.children[Q])Z.children[Q]=new I1;Z=Z.children[Q],Z.isDynamic=Y,Z.pattern=z}Z.params=J.filter((z)=>z.startsWith(":")).map((z)=>z.slice(1)),Z.isEndOfWord=!0,Z.path=f,Z.segmentCount=J.length,Z.methodMap.set($.method,$.handler),Z.handler=$.handler}search(f,$){let Z=this.root,J=this.cachedSegments.get(f)||f.split("/").filter(Boolean),z=[...this.globalMiddlewares];for(let Y of J){let X=Y;if(Z.children[X])Z=Z.children[X];else if(Z.children[":"])Z=Z.children[":"];else if(Z.children["*"]){Z=Z.children["*"];break}else return{handler:z};if(Z.middlewares.length>0)z.push(...Z.middlewares)}if(!Z.isEndOfWord||Z.segmentCount!==J.length)return{handler:z};let Q=Z.methodMap.get($);if(Q)z.push(Q);return{params:Z.params,handler:z}}}class S1{trie=new Gf;cache=new Map;add(f,$,Z){this.trie.insert($,{method:f,handler:Z})}addMiddleware(f,...$){this.trie.pushMidl(f,...$)}find(f,$){return this.trie.search($,f)}}var l7=W4(n7(),1);class J1{router=l7.default({});add(f,$,Z){this.router.on(f,$,Z)}addMiddleware(f,...$){}find(f,$){let Z=this.router.find(f,$);if(Z)return{handler:[Z.handler],params:Z.params};return null}}class ff{children;isEndOfWord;handlers;paramName;middlewares;constructor(){this.children={},this.handlers=new Map,this.isEndOfWord=!1,this.paramName=[],this.middlewares=[]}}class p7{root;globalMiddlewares;constructor(){this.root=new ff,this.globalMiddlewares=[]}pushMiddleware(f,...$){if(f==="/"){this.globalMiddlewares.push(...$);return}let Z=this.root,J=f.split("/").filter(Boolean);for(let z of J){let Q=z;if(z.startsWith(":"))Q=":";else if(z.startsWith("*"))Z.middlewares.push(...$);if(!Z.children[Q])Z.children[Q]=new ff;Z=Z.children[Q]}Z.middlewares.push(...$)}insert(f,$,Z){let J=this.root,z=$.split("/").filter(Boolean);if($==="/"){J.isEndOfWord=!0,J.handlers.set(f,Z),J.paramName=[];return}for(let Q of z){let Y=Q;if(Q.startsWith(":"))Y=":";if(!J.children[Y])J.children[Y]=new ff;J=J.children[Y]}J.paramName=z.filter((Q)=>Q.startsWith(":")).map((Q)=>Q.slice(1)),J.handlers.set(f,Z),J.isEndOfWord=!0}search(f,$){let Z=this.root,J=$.split("/").filter(Boolean),z=[...this.globalMiddlewares];for(let Y of J){if(Z.children[Y])Z=Z.children[Y];else if(Z.children[":"])Z=Z.children[":"];else if(Z.children["*"]){Z=Z.children["*"];break}else return{handler:z};if(Z.middlewares.length>0)z.push(...Z.middlewares)}let Q=Z.handlers.get(f);if(Q)z.push(Q);return{params:Z.paramName,handler:z}}}class tf{trie;cache=new Map;constructor(){this.trie=new p7}add(f,$,Z){this.trie.insert(f,$,Z)}addMiddleware(f,...$){this.trie.pushMiddleware(f,...$)}find(f,$){return this.trie.search(f,$)}}class ef{static create(f){switch(f){case"t2":return new tf;case"trie":return new S1;case"fastify":return new J1;case"fs":return new J1;case"find-my-way":return new J1;case"findmyway":return new J1;default:return new S1}}}var D0={reset:"\x1B[0m",info:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m",method:{GET:"\x1B[32m",POST:"\x1B[34m",PUT:"\x1B[35m",DELETE:"\x1B[31m",PATCH:"\x1B[36m"}},f4=(f,$,Z)=>{let J=D0[f]||D0.reset,z=Z?.method?D0.method[Z.method]||D0.reset:D0.reset,Q=Z?.status?Z.status>=500?D0.error:Z.status>=400?D0.warn:D0.info:D0.reset;console.log(`
|
|
265
265
|
${J}[${f.toUpperCase()}]${D0.reset} ${$} - ${z}${Z?.method||""}${D0.reset}`);let Y={timestamp:new Date().toISOString(),...Z,status:Z?.status?`${Q}${Z.status}${D0.reset}`:void 0,method:Z?.method?`${z>J}${Z.method}${D0.reset}`:void 0};console.log(JSON.stringify(Y,null,2)+`
|
|
266
|
-
`)},o7=(f)=>{let{app:$,logger:Z,logLevel:J="info",onRequest:z,onSend:Q,onError:Y}=f||{};$?.addHooks("onRequest",(X)=>{X.req.startTime=Date.now(),Z?.()??f4(J,"Incoming Request",{method:X.req.method,url:X.path,headers:{"user-agent":X.req.headers.get("user-agent"),"content-type":X.req.headers.get("content-type")}}),z?.(X)}),$?.addHooks("onSend",async(X,W)=>{let H=`${Date.now()-X.req.startTime}ms`;Z?.()??f4(J,"Response Sent",{method:X.req.method,url:X.url.toString(),status:W.status,duration:H,reqId:X.get?.("requestId"),headers:{"content-type":W.headers.get("content-type")}});let w=await Q?.(X);if(w instanceof Response)return w}),$?.addHooks("onError",async(X,W,H)=>{Z?.()??f4("error","Unhandled Error",{method:H.method,url:W,status:500,error:X.message});let w=await Y?.(X,W,H);if(w instanceof Response)return w})},$4=(f,$,Z,J=0,z,Q)=>{let Y=D0.method[$]||D0.reset,X=J>=500?D0.error:J>=400?D0.warn:D0.info,W=Q?`[${Q}] `:"",H=f==="<--"?`${f} ${Y}${$}${D0.reset} ${Z} ${W}`:`${f} ${Y}${$}${D0.reset} ${Z} ${X}${J}${D0.reset} ${z??""} ${W}`;console.log(H)},m9=(f)=>{let $=Date.now()-f;return $<1000?`${$}ms`:`${Math.round($/1000)}s`},r7=(f)=>{let{app:$,log:Z,onRequest:J,onSend:z,onError:Q}=f;$.addHooks("onRequest",(Y)=>{let{req:X,path:W}=Y;X.startTime=Date.now(),Z?.()??$4("<--",X.method,W),J?.(X,W)}),$.addHooks("onSend",async(Y,X)=>{let{method:W,url:H}=Y.req,w=new URL(H).pathname,K=Y.get?.("requestId");Z?.()??$4("-->",W,w,X?.status,m9(Y.req.startTime),K);let O=await z?.(Y);return O instanceof Response?O:X}),$.addHooks("onError",async(Y,X,W)=>{let H=W.path;Z?.()??$4(Y.message,W.method,H,500);let w=await Q?.(Y,H,W);if(w instanceof Response)return w})};function s7(f,$){if(!f)throw new Error("JWT library is not defined, please provide jwt to authenticateJwt Function");return(Z)=>{try{let J=Z.cookies?.accessToken??Z.req?.headers?.get("Authorization");if(!J)return Z.json({message:"Unauthorized",error:"No token provided"},401);if(J.startsWith("Bearer "))J=J.slice(7);let z=f?.verify(J,$);if(!z)return Z.json({message:"Unauthorized",error:"Token could not be decoded"},401);Z.set("user",z)}catch(J){let z="Invalid token";if(J.name==="TokenExpiredError")z="Token expired";else if(J.name==="JsonWebTokenError")z="Malformed or tampered token";return Z.json({message:"Unauthorized",error:z},401)}}}function a7(f,$,Z){if(!f)throw new Error("JWT library is not defined, please provide jwt to authenticateJwtDB Function");if(!$)throw new Error("User model is not defined, please provide UserModel to authenticateJwtDB Function");return async(J)=>{try{let z=J.cookies?.accessToken??J.req?.headers?.get("Authorization");if(!z)return J.json({message:"Unauthorized",error:"No token provided"},401);if(z.startsWith("Bearer "))z=z.slice(7);let Q=f?.verify(z,Z);if(!Q)return J.json({message:"Unauthorized",error:"Token could not be decoded"},401);let Y=await $.findById(Q._id).select("-password -refreshToken");if(!Y)return J.json({message:"Unauthorized: User not found"},404);J.set("user",Y);return}catch(z){let Q="Invalid token";if(z.name==="TokenExpiredError")Q="Token expired";else if(z.name==="JsonWebTokenError")Q="Malformed or tampered token";return J.json({message:"Unauthorized",error:Q},401)}}}var d9=(f,$)=>{try{return $(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(Z)=>{try{return $(Z)}catch{return Z}})}},i9=(f)=>d9(f,decodeURI),Zf=(f)=>{let $=f.indexOf("/",f.indexOf(":")+4),Z=$;for(;Z<f.length;Z++){let J=f.charCodeAt(Z);if(J===37){let z=f.indexOf("?",Z),Q=f.slice($,z===-1?void 0:z);return i9(Q.includes("%25")?Q.replace(/%25/g,"%2525"):Q)}else if(J===63)break}return f.slice($,Z)};var J4=Symbol.for,n0=Symbol("kCapture"),$Z=J4("events.errorMonitor"),n9=Symbol("events.maxEventTargetListeners"),l9=Symbol("events.maxEventTargetListenersWarned"),t7=J4("nodejs.rejection"),p9=J4("nodejs.rejection"),e7=Array.prototype.slice,l0=10,h0=function f($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[n0]=$?.captureRejections?Boolean($?.captureRejections):W0[n0])this.emit=a9},W0=h0.prototype={};W0._events=void 0;W0._eventsCount=0;W0._maxListeners=void 0;W0.setMaxListeners=function f($){return z4($,"setMaxListeners",0),this._maxListeners=$,this};W0.constructor=h0;W0.getMaxListeners=function f(){return this?._maxListeners??l0};function ZZ(f,$){var{_events:Z}=f;if($[0]??=new Error("Unhandled error."),!Z)throw $[0];var J=Z[$Z];if(J)for(var z of e7.call(J))z.apply(f,$);var Q=Z.error;if(!Q)throw $[0];for(var z of e7.call(Q))z.apply(f,$);return!0}function o9(f,$,Z,J){$.then(void 0,function(z){queueMicrotask(()=>r9(f,z,Z,J))})}function r9(f,$,Z,J){if(typeof f[t7]==="function")f[t7]($,Z,...J);else try{f[n0]=!1,f.emit("error",$)}finally{f[n0]=!0}}var s9=function f($,...Z){if($==="error")return ZZ(this,Z);var{_events:J}=this;if(J===void 0)return!1;var z=J[$];if(z===void 0)return!1;let Q=z.length>1?z.slice():z;for(let Y=0,{length:X}=Q;Y<X;Y++){let W=Q[Y];switch(Z.length){case 0:W.call(this);break;case 1:W.call(this,Z[0]);break;case 2:W.call(this,Z[0],Z[1]);break;case 3:W.call(this,Z[0],Z[1],Z[2]);break;default:W.apply(this,Z);break}}return!0},a9=function f($,...Z){if($==="error")return ZZ(this,Z);var{_events:J}=this;if(J===void 0)return!1;var z=J[$];if(z===void 0)return!1;let Q=z.length>1?z.slice():z;for(let Y=0,{length:X}=Q;Y<X;Y++){let W=Q[Y],H;switch(Z.length){case 0:H=W.call(this);break;case 1:H=W.call(this,Z[0]);break;case 2:H=W.call(this,Z[0],Z[1]);break;case 3:H=W.call(this,Z[0],Z[1],Z[2]);break;default:H=W.apply(this,Z);break}if(H!==void 0&&typeof H?.then==="function"&&H.then===Promise.prototype.then)o9(this,H,$,Z)}return!0};W0.emit=s9;W0.addListener=function f($,Z){M1(Z);var J=this._events;if(!J)J=this._events={__proto__:null},this._eventsCount=0;else if(J.newListener)this.emit("newListener",$,Z.listener??Z);var z=J[$];if(!z)J[$]=[Z],this._eventsCount++;else{z.push(Z);var Q=this._maxListeners??l0;if(Q>0&&z.length>Q&&!z.warned)JZ(this,$,z)}return this};W0.on=W0.addListener;W0.prependListener=function f($,Z){M1(Z);var J=this._events;if(!J)J=this._events={__proto__:null},this._eventsCount=0;else if(J.newListener)this.emit("newListener",$,Z.listener??Z);var z=J[$];if(!z)J[$]=[Z],this._eventsCount++;else{z.unshift(Z);var Q=this._maxListeners??l0;if(Q>0&&z.length>Q&&!z.warned)JZ(this,$,z)}return this};function JZ(f,$,Z){Z.warned=!0;let J=new Error(`Possible EventEmitter memory leak detected. ${Z.length} ${String($)} listeners added to [${f.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);J.name="MaxListenersExceededWarning",J.emitter=f,J.type=$,J.count=Z.length,console.warn(J)}function zZ(f,$,...Z){this.removeListener(f,$),$.apply(this,Z)}W0.once=function f($,Z){M1(Z);let J=zZ.bind(this,$,Z);return J.listener=Z,this.addListener($,J),this};W0.prependOnceListener=function f($,Z){M1(Z);let J=zZ.bind(this,$,Z);return J.listener=Z,this.prependListener($,J),this};W0.removeListener=function f($,Z){M1(Z);var{_events:J}=this;if(!J)return this;var z=J[$];if(!z)return this;var Q=z.length;let Y=-1;for(let X=Q-1;X>=0;X--)if(z[X]===Z||z[X].listener===Z){Y=X;break}if(Y<0)return this;if(Y===0)z.shift();else z.splice(Y,1);if(z.length===0)delete J[$],this._eventsCount--;return this};W0.off=W0.removeListener;W0.removeAllListeners=function f($){var{_events:Z}=this;if($&&Z){if(Z[$])delete Z[$],this._eventsCount--}else this._events={__proto__:null};return this};W0.listeners=function f($){var{_events:Z}=this;if(!Z)return[];var J=Z[$];if(!J)return[];return J.map((z)=>z.listener??z)};W0.rawListeners=function f($){var{_events:Z}=this;if(!Z)return[];var J=Z[$];if(!J)return[];return J.slice()};W0.listenerCount=function f($){var{_events:Z}=this;if(!Z)return 0;return Z[$]?.length??0};W0.eventNames=function f(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};W0[n0]=!1;function t9(f,$,Z){var J=Z?.signal;if(QZ(J,"options.signal"),J?.aborted)throw new Z4(void 0,{cause:J?.reason});let{resolve:z,reject:Q,promise:Y}=$newPromiseCapability(Promise),X=(w)=>{if(f.removeListener($,W),J!=null)Jf(J,"abort",H);Q(w)},W=(...w)=>{if(typeof f.removeListener==="function")f.removeListener("error",X);if(J!=null)Jf(J,"abort",H);z(w)};if(fZ(f,$,W,{once:!0}),$!=="error"&&typeof f.once==="function")f.once("error",X);function H(){Jf(f,$,W),Jf(f,"error",X),Q(new Z4(void 0,{cause:J?.reason}))}if(J!=null)fZ(J,"abort",H,{once:!0});return Y}function e9(f,$){return f.listeners($)}function f6(f,...$){z4(f,"setMaxListeners",0);var Z;if($&&(Z=$.length))for(let J=0;J<Z;J++)$[J].setMaxListeners(f);else l0=f}function $6(f,$){return f.listenerCount($)}function Jf(f,$,Z,J){if(typeof f.removeListener==="function")f.removeListener($,Z);else f.removeEventListener($,Z,J)}function fZ(f,$,Z,J){if(typeof f.on==="function")if(J.once)f.once($,Z);else f.on($,Z);else f.addEventListener($,Z,J)}class Z4 extends Error{constructor(f="The operation was aborted",$=void 0){if($!==void 0&&typeof $!=="object")throw z1("options","Object",$);super(f,$);this.code="ABORT_ERR",this.name="AbortError"}}function z1(f,$,Z){let J=new TypeError(`The "${f}" argument must be of type ${$}. Received ${Z}`);return J.code="ERR_INVALID_ARG_TYPE",J}function Z6(f,$,Z){let J=new RangeError(`The "${f}" argument is out of range. It must be ${$}. Received ${Z}`);return J.code="ERR_OUT_OF_RANGE",J}function QZ(f,$){if(f!==void 0&&(f===null||typeof f!=="object"||!("aborted"in f)))throw z1($,"AbortSignal",f)}function z4(f,$,Z,J){if(typeof f!=="number")throw z1($,"number",f);if(Z!=null&&f<Z||J!=null&&f>J||(Z!=null||J!=null)&&Number.isNaN(f))throw Z6($,`${Z!=null?`>= ${Z}`:""}${Z!=null&&J!=null?" && ":""}${J!=null?`<= ${J}`:""}`,f)}function M1(f){if(typeof f!=="function")throw new TypeError("The listener must be a function")}function J6(f,$){if(typeof f!=="boolean")throw z1($,"boolean",f)}function z6(f){return f?._maxListeners??l0}function Q6(f,$){if(f===void 0)throw z1("signal","AbortSignal",f);if(QZ(f,"signal"),typeof $!=="function")throw z1("listener","function",$);let Z;if(f.aborted)queueMicrotask(()=>$());else f.addEventListener("abort",$,{__proto__:null,once:!0}),Z=()=>{f.removeEventListener("abort",$)};return{__proto__:null,[Symbol.dispose](){Z?.()}}}Object.defineProperties(h0,{captureRejections:{get(){return W0[n0]},set(f){J6(f,"EventEmitter.captureRejections"),W0[n0]=f},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return l0},set:(f)=>{z4(f,"defaultMaxListeners",0),l0=f}},kMaxEventTargetListeners:{value:n9,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:l9,enumerable:!1,configurable:!1,writable:!1}});Object.assign(h0,{once:t9,getEventListeners:e9,getMaxListeners:z6,setMaxListeners:f6,EventEmitter:h0,usingDomains:!1,captureRejectionSymbol:p9,errorMonitor:$Z,addAbortListener:Q6,init:h0,listenerCount:$6});var YZ=["GET","POST","PUT","PATCH","DELETE","ANY","HEAD","OPTIONS","PROPFIND"];class A1{static instance;routes;tempRoutes;tempMiddlewares=new Map;router;hasOnReqHook;hasPreHandlerHook;hasPostHandlerHook;hasOnSendHook;hasOnError;hooks;corsConfig;FilterRoutes;filters;filterFunction;hasFilterEnabled;serverInstance;staticFiles;user_jwt_secret;baseApiUrl;enableFileRouter;idleTimeOut;routeNotFoundFunc;prefixApiUrl;compileConfig;#f=!1;emitter;errorFormat;platform="bun";staticPath;staticRequestPath=void 0;get;post;put;patch;delete;any;head;options;propfind;constructor(f={}){YZ.forEach((j)=>{this[j.toLocaleLowerCase()]=(M,...S)=>{return this.addRoute(j,M,S),this}});let{router:$="trie",routerInstance:Z,errorFormat:J="json",platform:z="bun",enableFileRouting:Q=!1,prefixApiUrl:Y="",baseApiUrl:X="",jwtSecret:W,idleTimeOut:H=10,pipelineArchitecture:w=!1,logger:K,onError:O}=f;if(Z)this.router=Z;else this.router=ef.create($);if(this.errorFormat=J,this.platform=z,!A1.instance)A1.instance=this;if(w)this.#f=!0;if(this.errorFormat=J,this.emitter=new h0,this.prefixApiUrl=Y??"",this.fetch=this.fetch.bind(this),this.routes={},this.idleTimeOut=H??10,this.enableFileRouter=Q??!1,this.baseApiUrl=X||"",this.user_jwt_secret=W||process.env.DIESEL_JWT_SECRET||"default_diesel_secret_for_jwt",this.tempRoutes=new Map,this.corsConfig=null,this.hasOnReqHook=!1,this.hasPreHandlerHook=!1,this.hasPostHandlerHook=!1,this.hasOnSendHook=!1,this.hasOnError=!1,this.hooks={onRequest:[],preHandler:[],postHandler:[],onSend:[],onError:[],onClose:[]},O)this.addHooks("onError",(j,M)=>{console.log("Got an exception:",j),console.log("Request Path:",M)});if(K)this.useLogger({app:this,onError(j){console.error("Got an exception:",j)}});this.FilterRoutes=[],this.filters=new Set,this.filterFunction=[],this.hasFilterEnabled=!1,this.serverInstance=null,this.staticPath=null,this.staticFiles={},this.routeNotFoundFunc=()=>{},this.compileConfig=null}static router(f){if(!this.instance)this.instance=new A1;return new Proxy(this.instance,{get($,Z,J){return(z,Q)=>{let Y=f+z;return $[Z](Y,Q)}}})}setupFilter(){return this.hasFilterEnabled=!0,{publicRoutes:(...f)=>{return this.FilterRoutes=f,this.setupFilter()},permitAll:()=>{for(let f of this?.FilterRoutes){if(f.endsWith("/"))f=f.slice(0,-1);this.filters.add(f)}return this.FilterRoutes=null,this.setupFilter()},authenticate:(f)=>{if(f?.length)for(let $ of f)this.filterFunction.push($)},authenticateJwt:(f)=>{this.filterFunction.push(s7(f,this.user_jwt_secret))},authenticateJwtDB:(f,$)=>{this.filterFunction.push(a7(f,$,this.user_jwt_secret))}}}redirect(f,$,Z){return this.any(f,(J)=>{let z=J.params,Q=$;if(z)for(let X in z)Q=Q.replace(`:${X}`,z[X]);let Y=J.url.search;if(Y)Q+=Y;return J.redirect(Q,Z)}),this}serveStatic(f,$){return this.staticPath=f,this.staticRequestPath=$,this}static(f,$){return this.staticPath=f,this.staticRequestPath=$,this}staticHtml(f){return this.staticFiles={...this.staticFiles,...f},this}addHooks(f,$){if(typeof f!=="string")throw new Error("hookName must be a string");if(typeof $!=="function")throw new Error("callback must be a instance of function");switch(f){case"onRequest":this.router.addMiddleware("/",$),this.hasOnReqHook=!0;break;case"preHandler":this.hooks.preHandler?.push($),this.hasPreHandlerHook=!0;break;case"postHandler":this.hooks.postHandler?.push($),this.hasPostHandlerHook=!0;break;case"onSend":this.hooks.onSend?.push($),this.hasOnSendHook=!0;break;case"onError":this.hooks.onError?.push($),this.hasOnError=!0;break;case"onClose":this.hooks.onClose?.push($);break;default:throw new Error(`Unknown hook type: ${f}`)}return this}useLogger(f){return r7(f),this}useAdvancedLogger(f){return o7(f),this}BunRoute(f,$,...Z){if(!$||typeof $!=="string")throw new Error("give a path in string format");let J;if(typeof Z[0]==="string"||typeof Z[0]==="object")J=Z[0];if(typeof J!=="undefined"){let Q=typeof J==="string"?J:JSON.stringify(J)}let z=i4(this,f.toUpperCase(),$,...Z);return this.routes[$]=z,this}listen(f,...$){if(typeof Bun==="undefined")throw new Error(".listen() is designed to run on Bun only...");let Z="0.0.0.0",J=void 0,z={};for(let Y of $)if(typeof Y==="string")Z=Y;else if(typeof Y==="function")J=Y;else if(typeof Y==="object"&&Y!==null)z=Y;let Q={port:f,hostname:Z,idleTimeOut:this.idleTimeOut,fetch:this.fetch(),static:this.staticFiles};if(this.routes&&Object.keys(this.routes).length>0)Q.routes=this.routes;if(z.cert&&z.key)Q.certFile=z.cert,Q.keyFile=z.key;if(this.serverInstance=Bun?.serve(Q),J)J();return this.serverInstance}close(f){if(this.serverInstance)this.serverInstance.stop(!0),this.serverInstance=null,f?f():console.log("Server has been stopped");else console.warn("Server is not running.")}cfFetch(){return this.tempRoutes=null,this.tempMiddlewares=null,(f,$,Z)=>{return this.#$(f,void 0,$,Z)}}fetch(){if(this.tempRoutes=null,this.tempMiddlewares=null,this.platform==="cf"||this.platform==="cloudflare"){if(this.#f){let f=Ff(this);return($,Z,J)=>{return f($,this,void 0,Z,J).catch(async(z)=>{return this.handleError(z,Zf($.url),$)})}}return(f,$,Z)=>{return this.#$(f,void 0,$,Z)}}if(this.#f){let f=Ff(this);return($,Z)=>{return f($,this,Z,void 0,void 0).catch(async(J)=>{return this.handleError(J,Zf($.url),$)})}}return this.#$.bind(this)}async#$(f,$,Z,J){let z=Zf(f.url),Q=this.router.find(f.method,z),Y=new V1(f,$,z,Q?.path,Q?.params,Z,J);try{if(this.hasFilterEnabled){let H=await R1(this,z,Y);if(H)return H}if(this.hasPreHandlerHook){let H=await r0("preHandler",this.hooks.preHandler,[Y]);if(H)return H}let X,W=Q?.handler;for(let H=0;H<W?.length;H++){let w=W[H](Y);if(X=N1(w)?await w:w,X)break}if(this.hasOnSendHook){let H=await r0("onSend",this.hooks.onSend,[Y,X]);if(H)return H}if(X)return X;return await I1(this,Y,z)}catch(X){return this.handleError(X,z,f)}return U1(500,"No response returned from handler.")}async handleError(f,$,Z){let z=this.errorFormat,Q=await r0("onError",this.hooks.onError,[f,$,Z]);if(Q)return Q;if(f&&typeof f==="object"&&f.name==="HTTPException"){let W=f;if(W.res)return W.res;return z==="json"?Response.json({error:W.message},{status:W.status}):new Response(W.message,{status:W.status})}let Y=f instanceof Error?f.message:"Internal Server Error",X=f instanceof Error?f.stack:void 0;if(z==="json"){let W={error:Y,...!1,path:$};return Response.json(W,{status:500,headers:{"Content-Type":"application/json"}})}else{let W=`Error: ${Y}`;return new Response(W,{headers:{"Content-Type":"text/plain"},status:500})}}mount(f,$){let Z=f.endsWith("/*")?f.slice(0,-1):f,J=Z==="/"?0:Z.length;this.any(f,(z)=>{let Q=new URL(z.req.url);Q.pathname=Q.pathname.slice(J)||"/";let Y=new Request(Q.toString(),z.req);return $(Y,z.env,z.executionContext)})}route(f,$){f=f&&f.length>0?f:$?.prefixApiUrl;let Z=$?.tempRoutes??new Map;for(let[J,z]of Z.entries()){let Q=J.replace(/::\w+$/,""),Y=`${f}${Q}`,X=z.handlers.slice(0,-1);this.router.addMiddleware(Y,...X);let W=z.handlers[z.handlers.length-1],H=z.method;try{this.router.add(H,Y,W)}catch(w){console.error(`Error inserting ${Y}:`,w)}}for(let[J,z]of $?.tempMiddlewares?.entries()){let Q=J==="/"?f||"/":`${f}${J}`;this.router.addMiddleware(Q,...z)}return $=null,this}register(f,$){return this.route(f,$)}addRoute(f,$,Z){if(typeof $!=="string")throw new Error(`Error in ${Z[Z.length-1]}: Path must be a string. Received: ${typeof $}`);if(typeof f!=="string")throw new Error(`Error in addRoute: Method must be a string. Received: ${typeof f}`);this.tempRoutes?.set($+"::"+f,{method:f,handlers:Z});let J=Z.slice(0,-1),z=Z[Z.length-1];if(J.length>0)J.forEach((Q)=>{this.router.addMiddleware($,Q);return});try{if(f==="ANY"){let Q=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","PROPFIND"];for(let Y of Q)try{this.router.add(Y,$,z)}catch(X){}}else this.router.add(f,$,z)}catch(Q){console.error(`Error inserting ${$}:`,Q)}}use(f,...$){if(typeof f==="string"){let Z=f==="/"?"/":f;if(!this.tempMiddlewares?.has(Z))this.tempMiddlewares?.set(Z,[]);this.tempMiddlewares?.get(Z).push(...$),this.router.addMiddleware(Z,...$)}else if(typeof f==="function"){let Z=[f,...$];if(!this.tempMiddlewares?.has("/"))this.tempMiddlewares?.set("/",[]);this.tempMiddlewares?.get("/").push(...$);for(let J of Z)this.router.addMiddleware("/",J)}return this}routeNotFound(f){return this.routeNotFoundFunc=f,this}on(f,$){this.emitter.on(f,$)}emit(f,...$){this.emitter.emit(f,...$)}}export{A1 as default};
|
|
266
|
+
`)},o7=(f)=>{let{app:$,logger:Z,logLevel:J="info",onRequest:z,onSend:Q,onError:Y}=f||{};$?.addHooks("onRequest",(X)=>{X.req.startTime=Date.now(),Z?.()??f4(J,"Incoming Request",{method:X.req.method,url:X.path,headers:{"user-agent":X.req.headers.get("user-agent"),"content-type":X.req.headers.get("content-type")}}),z?.(X)}),$?.addHooks("onSend",async(X,W)=>{let H=`${Date.now()-X.req.startTime}ms`;Z?.()??f4(J,"Response Sent",{method:X.req.method,url:X.url.toString(),status:W.status,duration:H,reqId:X.get?.("requestId"),headers:{"content-type":W.headers.get("content-type")}});let w=await Q?.(X);if(w instanceof Response)return w}),$?.addHooks("onError",async(X,W,H)=>{Z?.()??f4("error","Unhandled Error",{method:H.method,url:W,status:500,error:X.message});let w=await Y?.(X,W,H);if(w instanceof Response)return w})},$4=(f,$,Z,J=0,z,Q)=>{let Y=D0.method[$]||D0.reset,X=J>=500?D0.error:J>=400?D0.warn:D0.info,W=Q?`[${Q}] `:"",H=f==="<--"?`${f} ${Y}${$}${D0.reset} ${Z} ${W}`:`${f} ${Y}${$}${D0.reset} ${Z} ${X}${J}${D0.reset} ${z??""} ${W}`;console.log(H)},m9=(f)=>{let $=Date.now()-f;return $<1000?`${$}ms`:`${Math.round($/1000)}s`},r7=(f)=>{let{app:$,log:Z,onRequest:J,onSend:z,onError:Q}=f;$.addHooks("onRequest",(Y)=>{let{req:X,path:W}=Y;X.startTime=Date.now(),Z?.()??$4("<--",X.method,W),J?.(X,W)}),$.addHooks("onSend",async(Y,X)=>{let{method:W,url:H}=Y.req,w=new URL(H).pathname,K=Y.get?.("requestId");Z?.()??$4("-->",W,w,X?.status,m9(Y.req.startTime),K);let O=await z?.(Y);return O instanceof Response?O:X}),$.addHooks("onError",async(Y,X,W)=>{let H=W.path;Z?.()??$4(Y.message,W.method,H,500);let w=await Q?.(Y,H,W);if(w instanceof Response)return w})};function s7(f,$){if(!f)throw new Error("JWT library is not defined, please provide jwt to authenticateJwt Function");return(Z)=>{try{let J=Z.cookies?.accessToken??Z.req?.headers?.get("Authorization");if(!J)return Z.json({message:"Unauthorized",error:"No token provided"},401);if(J.startsWith("Bearer "))J=J.slice(7);let z=f?.verify(J,$);if(!z)return Z.json({message:"Unauthorized",error:"Token could not be decoded"},401);Z.set("user",z)}catch(J){let z="Invalid token";if(J.name==="TokenExpiredError")z="Token expired";else if(J.name==="JsonWebTokenError")z="Malformed or tampered token";return Z.json({message:"Unauthorized",error:z},401)}}}function a7(f,$,Z){if(!f)throw new Error("JWT library is not defined, please provide jwt to authenticateJwtDB Function");if(!$)throw new Error("User model is not defined, please provide UserModel to authenticateJwtDB Function");return async(J)=>{try{let z=J.cookies?.accessToken??J.req?.headers?.get("Authorization");if(!z)return J.json({message:"Unauthorized",error:"No token provided"},401);if(z.startsWith("Bearer "))z=z.slice(7);let Q=f?.verify(z,Z);if(!Q)return J.json({message:"Unauthorized",error:"Token could not be decoded"},401);let Y=await $.findById(Q._id).select("-password -refreshToken");if(!Y)return J.json({message:"Unauthorized: User not found"},404);J.set("user",Y);return}catch(z){let Q="Invalid token";if(z.name==="TokenExpiredError")Q="Token expired";else if(z.name==="JsonWebTokenError")Q="Malformed or tampered token";return J.json({message:"Unauthorized",error:Q},401)}}}var d9=(f,$)=>{try{return $(f)}catch{return f.replace(/(?:%[0-9A-Fa-f]{2})+/g,(Z)=>{try{return $(Z)}catch{return Z}})}},i9=(f)=>d9(f,decodeURI),$f=(f)=>{let $=f.indexOf("/",f.indexOf(":")+4),Z=$;for(;Z<f.length;Z++){let J=f.charCodeAt(Z);if(J===37){let z=f.indexOf("?",Z),Q=f.slice($,z===-1?void 0:z);return i9(Q.includes("%25")?Q.replace(/%25/g,"%2525"):Q)}else if(J===63)break}return f.slice($,Z)};var J4=Symbol.for,n0=Symbol("kCapture"),$Z=J4("events.errorMonitor"),n9=Symbol("events.maxEventTargetListeners"),l9=Symbol("events.maxEventTargetListenersWarned"),t7=J4("nodejs.rejection"),p9=J4("nodejs.rejection"),e7=Array.prototype.slice,l0=10,h0=function f($){if(this._events===void 0||this._events===this.__proto__._events)this._events={__proto__:null},this._eventsCount=0;if(this._maxListeners??=void 0,this[n0]=$?.captureRejections?Boolean($?.captureRejections):W0[n0])this.emit=a9},W0=h0.prototype={};W0._events=void 0;W0._eventsCount=0;W0._maxListeners=void 0;W0.setMaxListeners=function f($){return z4($,"setMaxListeners",0),this._maxListeners=$,this};W0.constructor=h0;W0.getMaxListeners=function f(){return this?._maxListeners??l0};function ZZ(f,$){var{_events:Z}=f;if($[0]??=new Error("Unhandled error."),!Z)throw $[0];var J=Z[$Z];if(J)for(var z of e7.call(J))z.apply(f,$);var Q=Z.error;if(!Q)throw $[0];for(var z of e7.call(Q))z.apply(f,$);return!0}function o9(f,$,Z,J){$.then(void 0,function(z){queueMicrotask(()=>r9(f,z,Z,J))})}function r9(f,$,Z,J){if(typeof f[t7]==="function")f[t7]($,Z,...J);else try{f[n0]=!1,f.emit("error",$)}finally{f[n0]=!0}}var s9=function f($,...Z){if($==="error")return ZZ(this,Z);var{_events:J}=this;if(J===void 0)return!1;var z=J[$];if(z===void 0)return!1;let Q=z.length>1?z.slice():z;for(let Y=0,{length:X}=Q;Y<X;Y++){let W=Q[Y];switch(Z.length){case 0:W.call(this);break;case 1:W.call(this,Z[0]);break;case 2:W.call(this,Z[0],Z[1]);break;case 3:W.call(this,Z[0],Z[1],Z[2]);break;default:W.apply(this,Z);break}}return!0},a9=function f($,...Z){if($==="error")return ZZ(this,Z);var{_events:J}=this;if(J===void 0)return!1;var z=J[$];if(z===void 0)return!1;let Q=z.length>1?z.slice():z;for(let Y=0,{length:X}=Q;Y<X;Y++){let W=Q[Y],H;switch(Z.length){case 0:H=W.call(this);break;case 1:H=W.call(this,Z[0]);break;case 2:H=W.call(this,Z[0],Z[1]);break;case 3:H=W.call(this,Z[0],Z[1],Z[2]);break;default:H=W.apply(this,Z);break}if(H!==void 0&&typeof H?.then==="function"&&H.then===Promise.prototype.then)o9(this,H,$,Z)}return!0};W0.emit=s9;W0.addListener=function f($,Z){M1(Z);var J=this._events;if(!J)J=this._events={__proto__:null},this._eventsCount=0;else if(J.newListener)this.emit("newListener",$,Z.listener??Z);var z=J[$];if(!z)J[$]=[Z],this._eventsCount++;else{z.push(Z);var Q=this._maxListeners??l0;if(Q>0&&z.length>Q&&!z.warned)JZ(this,$,z)}return this};W0.on=W0.addListener;W0.prependListener=function f($,Z){M1(Z);var J=this._events;if(!J)J=this._events={__proto__:null},this._eventsCount=0;else if(J.newListener)this.emit("newListener",$,Z.listener??Z);var z=J[$];if(!z)J[$]=[Z],this._eventsCount++;else{z.unshift(Z);var Q=this._maxListeners??l0;if(Q>0&&z.length>Q&&!z.warned)JZ(this,$,z)}return this};function JZ(f,$,Z){Z.warned=!0;let J=new Error(`Possible EventEmitter memory leak detected. ${Z.length} ${String($)} listeners added to [${f.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);J.name="MaxListenersExceededWarning",J.emitter=f,J.type=$,J.count=Z.length,console.warn(J)}function zZ(f,$,...Z){this.removeListener(f,$),$.apply(this,Z)}W0.once=function f($,Z){M1(Z);let J=zZ.bind(this,$,Z);return J.listener=Z,this.addListener($,J),this};W0.prependOnceListener=function f($,Z){M1(Z);let J=zZ.bind(this,$,Z);return J.listener=Z,this.prependListener($,J),this};W0.removeListener=function f($,Z){M1(Z);var{_events:J}=this;if(!J)return this;var z=J[$];if(!z)return this;var Q=z.length;let Y=-1;for(let X=Q-1;X>=0;X--)if(z[X]===Z||z[X].listener===Z){Y=X;break}if(Y<0)return this;if(Y===0)z.shift();else z.splice(Y,1);if(z.length===0)delete J[$],this._eventsCount--;return this};W0.off=W0.removeListener;W0.removeAllListeners=function f($){var{_events:Z}=this;if($&&Z){if(Z[$])delete Z[$],this._eventsCount--}else this._events={__proto__:null};return this};W0.listeners=function f($){var{_events:Z}=this;if(!Z)return[];var J=Z[$];if(!J)return[];return J.map((z)=>z.listener??z)};W0.rawListeners=function f($){var{_events:Z}=this;if(!Z)return[];var J=Z[$];if(!J)return[];return J.slice()};W0.listenerCount=function f($){var{_events:Z}=this;if(!Z)return 0;return Z[$]?.length??0};W0.eventNames=function f(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};W0[n0]=!1;function t9(f,$,Z){var J=Z?.signal;if(QZ(J,"options.signal"),J?.aborted)throw new Z4(void 0,{cause:J?.reason});let{resolve:z,reject:Q,promise:Y}=$newPromiseCapability(Promise),X=(w)=>{if(f.removeListener($,W),J!=null)Zf(J,"abort",H);Q(w)},W=(...w)=>{if(typeof f.removeListener==="function")f.removeListener("error",X);if(J!=null)Zf(J,"abort",H);z(w)};if(fZ(f,$,W,{once:!0}),$!=="error"&&typeof f.once==="function")f.once("error",X);function H(){Zf(f,$,W),Zf(f,"error",X),Q(new Z4(void 0,{cause:J?.reason}))}if(J!=null)fZ(J,"abort",H,{once:!0});return Y}function e9(f,$){return f.listeners($)}function f6(f,...$){z4(f,"setMaxListeners",0);var Z;if($&&(Z=$.length))for(let J=0;J<Z;J++)$[J].setMaxListeners(f);else l0=f}function $6(f,$){return f.listenerCount($)}function Zf(f,$,Z,J){if(typeof f.removeListener==="function")f.removeListener($,Z);else f.removeEventListener($,Z,J)}function fZ(f,$,Z,J){if(typeof f.on==="function")if(J.once)f.once($,Z);else f.on($,Z);else f.addEventListener($,Z,J)}class Z4 extends Error{constructor(f="The operation was aborted",$=void 0){if($!==void 0&&typeof $!=="object")throw z1("options","Object",$);super(f,$);this.code="ABORT_ERR",this.name="AbortError"}}function z1(f,$,Z){let J=new TypeError(`The "${f}" argument must be of type ${$}. Received ${Z}`);return J.code="ERR_INVALID_ARG_TYPE",J}function Z6(f,$,Z){let J=new RangeError(`The "${f}" argument is out of range. It must be ${$}. Received ${Z}`);return J.code="ERR_OUT_OF_RANGE",J}function QZ(f,$){if(f!==void 0&&(f===null||typeof f!=="object"||!("aborted"in f)))throw z1($,"AbortSignal",f)}function z4(f,$,Z,J){if(typeof f!=="number")throw z1($,"number",f);if(Z!=null&&f<Z||J!=null&&f>J||(Z!=null||J!=null)&&Number.isNaN(f))throw Z6($,`${Z!=null?`>= ${Z}`:""}${Z!=null&&J!=null?" && ":""}${J!=null?`<= ${J}`:""}`,f)}function M1(f){if(typeof f!=="function")throw new TypeError("The listener must be a function")}function J6(f,$){if(typeof f!=="boolean")throw z1($,"boolean",f)}function z6(f){return f?._maxListeners??l0}function Q6(f,$){if(f===void 0)throw z1("signal","AbortSignal",f);if(QZ(f,"signal"),typeof $!=="function")throw z1("listener","function",$);let Z;if(f.aborted)queueMicrotask(()=>$());else f.addEventListener("abort",$,{__proto__:null,once:!0}),Z=()=>{f.removeEventListener("abort",$)};return{__proto__:null,[Symbol.dispose](){Z?.()}}}Object.defineProperties(h0,{captureRejections:{get(){return W0[n0]},set(f){J6(f,"EventEmitter.captureRejections"),W0[n0]=f},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:()=>{return l0},set:(f)=>{z4(f,"defaultMaxListeners",0),l0=f}},kMaxEventTargetListeners:{value:n9,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:l9,enumerable:!1,configurable:!1,writable:!1}});Object.assign(h0,{once:t9,getEventListeners:e9,getMaxListeners:z6,setMaxListeners:f6,EventEmitter:h0,usingDomains:!1,captureRejectionSymbol:p9,errorMonitor:$Z,addAbortListener:Q6,init:h0,listenerCount:$6});var YZ=["GET","POST","PUT","PATCH","DELETE","ANY","HEAD","OPTIONS","PROPFIND"];class A1{static instance;routes;tempRoutes;tempMiddlewares=new Map;router;hasOnReqHook;hasPreHandlerHook;hasPostHandlerHook;hasOnSendHook;hasOnError;hooks;corsConfig;FilterRoutes;filters;filterFunction;hasFilterEnabled;serverInstance;staticFiles;user_jwt_secret;baseApiUrl;enableFileRouter;idleTimeOut;routeNotFoundFunc;prefixApiUrl;compileConfig;#f=!1;emitter;errorFormat;platform="bun";staticPath;staticRequestPath=void 0;get;post;put;patch;delete;any;head;options;propfind;constructor(f={}){YZ.forEach((j)=>{this[j.toLocaleLowerCase()]=(M,...S)=>{return this.addRoute(j,M,S),this}});let{router:$="t2",routerInstance:Z,errorFormat:J="json",platform:z="bun",enableFileRouting:Q=!1,prefixApiUrl:Y="",baseApiUrl:X="",jwtSecret:W,idleTimeOut:H=10,pipelineArchitecture:w=!1,logger:K,onError:O}=f;if(Z)this.router=Z;else this.router=ef.create($);if(this.errorFormat=J,this.platform=z,!A1.instance)A1.instance=this;if(w)this.#f=!0;if(this.errorFormat=J,this.emitter=new h0,this.prefixApiUrl=Y??"",this.fetch=this.fetch.bind(this),this.routes={},this.idleTimeOut=H??10,this.enableFileRouter=Q??!1,this.baseApiUrl=X||"",this.user_jwt_secret=W||process.env.DIESEL_JWT_SECRET||"default_diesel_secret_for_jwt",this.tempRoutes=new Map,this.corsConfig=null,this.hasOnReqHook=!1,this.hasPreHandlerHook=!1,this.hasPostHandlerHook=!1,this.hasOnSendHook=!1,this.hasOnError=!1,this.hooks={onRequest:[],preHandler:[],postHandler:[],onSend:[],onError:[],onClose:[]},O)this.addHooks("onError",(j,M)=>{console.log("Got an exception:",j),console.log("Request Path:",M)});if(K)this.useLogger({app:this,onError(j){console.error("Got an exception:",j)}});this.FilterRoutes=[],this.filters=new Set,this.filterFunction=[],this.hasFilterEnabled=!1,this.serverInstance=null,this.staticPath=null,this.staticFiles={},this.routeNotFoundFunc=()=>{},this.compileConfig=null}static router(f){if(!this.instance)this.instance=new A1;return new Proxy(this.instance,{get($,Z,J){return(z,Q)=>{let Y=f+z;return $[Z](Y,Q)}}})}setupFilter(){return this.hasFilterEnabled=!0,{publicRoutes:(...f)=>{return this.FilterRoutes=f,this.setupFilter()},permitAll:()=>{for(let f of this?.FilterRoutes){if(f.endsWith("/"))f=f.slice(0,-1);this.filters.add(f)}return this.FilterRoutes=null,this.setupFilter()},authenticate:(f)=>{if(f?.length)for(let $ of f)this.filterFunction.push($)},authenticateJwt:(f)=>{this.filterFunction.push(s7(f,this.user_jwt_secret))},authenticateJwtDB:(f,$)=>{this.filterFunction.push(a7(f,$,this.user_jwt_secret))}}}redirect(f,$,Z){return this.any(f,(J)=>{let z=J.params,Q=$;if(z)for(let X in z)Q=Q.replace(`:${X}`,z[X]);let Y=J.url.search;if(Y)Q+=Y;return J.redirect(Q,Z)}),this}static(f,$){return this.staticPath=f,this.staticRequestPath=$,this}staticHtml(f){return this.staticFiles={...this.staticFiles,...f},this}addHooks(f,$){if(typeof f!=="string")throw new Error("hookName must be a string");if(typeof $!=="function")throw new Error("callback must be a instance of function");switch(f){case"onRequest":this.router.addMiddleware("/",$),this.hasOnReqHook=!0;break;case"preHandler":this.hooks.preHandler?.push($),this.hasPreHandlerHook=!0;break;case"postHandler":this.hooks.postHandler?.push($),this.hasPostHandlerHook=!0;break;case"onSend":this.hooks.onSend?.push($),this.hasOnSendHook=!0;break;case"onError":this.hooks.onError?.push($),this.hasOnError=!0;break;case"onClose":this.hooks.onClose?.push($);break;default:throw new Error(`Unknown hook type: ${f}`)}return this}useLogger(f){return r7(f),this}useAdvancedLogger(f){return o7(f),this}BunRoute(f,$,...Z){if(!$||typeof $!=="string")throw new Error("give a path in string format");let J;if(typeof Z[0]==="string"||typeof Z[0]==="object")J=Z[0];if(typeof J!=="undefined"){let Q=typeof J==="string"?J:JSON.stringify(J)}let z=i4(this,f.toUpperCase(),$,...Z);return this.routes[$]=z,this}listen(f,...$){if(typeof Bun==="undefined")throw new Error(".listen() is designed to run on Bun only...");let Z="0.0.0.0",J=void 0,z={};for(let Y of $)if(typeof Y==="string")Z=Y;else if(typeof Y==="function")J=Y;else if(typeof Y==="object"&&Y!==null)z=Y;let Q={port:f,hostname:Z,idleTimeOut:this.idleTimeOut,fetch:this.fetch(),static:this.staticFiles};if(this.routes&&Object.keys(this.routes).length>0)Q.routes=this.routes;if(z.cert&&z.key)Q.certFile=z.cert,Q.keyFile=z.key;if(this.serverInstance=Bun?.serve(Q),J)J();return this.serverInstance}close(f){if(this.serverInstance)this.serverInstance.stop(!0),this.serverInstance=null,f?f():console.log("Server has been stopped");else console.warn("Server is not running.")}cfFetch(){return this.tempRoutes=null,this.tempMiddlewares=null,(f,$,Z)=>{return this.#$(f,void 0,$,Z)}}fetch(){if(this.tempRoutes=null,this.tempMiddlewares=null,this.platform==="cf"||this.platform==="cloudflare"){if(this.#f){let f=Ff(this);return($,Z,J)=>{return f($,this,void 0,Z,J).catch(async(z)=>{return this.handleError(z,$f($.url),$)})}}return(f,$,Z)=>{return this.#$(f,void 0,$,Z)}}if(this.#f){let f=Ff(this);return($,Z)=>{return f($,this,Z,void 0,void 0).catch(async(J)=>{return this.handleError(J,$f($.url),$)})}}return this.#$.bind(this)}async#$(f,$,Z,J){let z=$f(f.url),Q=this.router.find(f.method,z),Y=new V1(f,$,z,Q?.path,Q?.params,Z,J);try{if(this.hasFilterEnabled){let H=await N1(this,z,Y);if(H)return H}if(this.hasPreHandlerHook){let H=await r0("preHandler",this.hooks.preHandler,[Y]);if(H)return H}let X,W=Q?.handler;if(W.length===1){let H=W[0](Y);X=U1(H)?await H:H}else for(let H=0;H<W.length;H++){let w=W[H](Y);if(X=U1(w)?await w:w,X)break}if(this.hasOnSendHook){let H=await r0("onSend",this.hooks.onSend,[Y,X]);if(H)return H}if(X)return X;return await R1(this,Y,z)}catch(X){return this.handleError(X,z,f)}}async handleError(f,$,Z){let z=this.errorFormat,Q=await r0("onError",this.hooks.onError,[f,$,Z]);if(Q)return Q;if(f&&typeof f==="object"&&f.name==="HTTPException"){let W=f;if(W.res)return W.res;return z==="json"?Response.json({error:W.message},{status:W.status}):new Response(W.message,{status:W.status})}let Y=f instanceof Error?f.message:"Internal Server Error",X=f instanceof Error?f.stack:void 0;if(z==="json"){let W={error:Y,...!1,path:$};return Response.json(W,{status:500,headers:{"Content-Type":"application/json"}})}else{let W=`Error: ${Y}`;return new Response(W,{headers:{"Content-Type":"text/plain"},status:500})}}mount(f,$){let Z=f.endsWith("/*")?f.slice(0,-1):f,J=Z==="/"?0:Z.length;this.any(f,(z)=>{let Q=new URL(z.req.url);Q.pathname=Q.pathname.slice(J)||"/";let Y=new Request(Q.toString(),z.req);return $(Y,z.env,z.executionContext)})}route(f,$){f=f&&f.length>0?f:$?.prefixApiUrl;let Z=$?.tempRoutes??new Map;for(let[J,z]of Z.entries()){let Q=J.replace(/::\w+$/,""),Y=`${f}${Q}`,X=z.handlers.slice(0,-1);this.router.addMiddleware(Y,...X);let W=z.handlers[z.handlers.length-1],H=z.method;try{this.router.add(H,Y,W)}catch(w){console.error(`Error inserting ${Y}:`,w)}}for(let[J,z]of $?.tempMiddlewares?.entries()){let Q=J==="/"?f||"/":`${f}${J}`;this.router.addMiddleware(Q,...z)}return $=null,this}register(f,$){return this.route(f,$)}addRoute(f,$,Z){if(typeof $!=="string")throw new Error(`Error in ${Z[Z.length-1]}: Path must be a string. Received: ${typeof $}`);if(typeof f!=="string")throw new Error(`Error in addRoute: Method must be a string. Received: ${typeof f}`);this.tempRoutes?.set($+"::"+f,{method:f,handlers:Z});let J=Z.slice(0,-1),z=Z[Z.length-1];if(J.length>0)J.forEach((Q)=>{this.router.addMiddleware($,Q);return});try{if(f==="ANY"){let Q=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","PROPFIND"];for(let Y of Q)try{this.router.add(Y,$,z)}catch(X){}}else this.router.add(f,$,z)}catch(Q){console.error(`Error inserting ${$}:`,Q)}}use(f,...$){if(typeof f==="string"){let Z=f==="/"?"/":f;if(!this.tempMiddlewares?.has(Z))this.tempMiddlewares?.set(Z,[]);this.tempMiddlewares?.get(Z).push(...$),this.router.addMiddleware(Z,...$)}else if(typeof f==="function"){let Z=[f,...$];if(!this.tempMiddlewares?.has("/"))this.tempMiddlewares?.set("/",[]);this.tempMiddlewares?.get("/").push(...$);for(let J of Z)this.router.addMiddleware("/",J)}return this}routeNotFound(f){return this.routeNotFoundFunc=f,this}onMethod(f,$,...Z){let J=Array.isArray(f)?f:[f];for(let z of J){let Q=z.toLowerCase();if(Q in this)this[Q]($,...Z);else this.addRoute(z.toUpperCase(),$,Z)}return this}on(f,$){return this.emitter.on(f,$),this}emit(f,...$){return this.emitter.emit(f,...$),this}}export{A1 as default};
|
package/dist/request_pipeline.js
CHANGED
|
@@ -51,7 +51,7 @@ try {
|
|
|
51
51
|
`;break;case J.modes.ESCAPED:this.source+=" ; __append(escapeFn("+Yf(f)+`))
|
|
52
52
|
`;break;case J.modes.RAW:this.source+=" ; __append("+Yf(f)+`)
|
|
53
53
|
`;break;case J.modes.COMMENT:break;case J.modes.LITERAL:this._addOutput(f);break}}else this._addOutput(f)}if(u.opts.compileDebug&&w)this.currentLine+=w,this.source+=" ; __line = "+this.currentLine+`
|
|
54
|
-
`}};Vf.escapeXML=z.escapeXML;Vf.__express=Vf.renderFile;Vf.VERSION=f1;Vf.name=v1;if(typeof window!="undefined")window.ejs=Vf});function F(f){switch(f.split(".").pop()?.toLowerCase()){case"js":return"application/javascript";case"css":return"text/css";case"html":return"text/html";case"json":return"application/json";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"woff":return"font/woff";case"woff2":return"font/woff2";default:return"application/octet-stream"}}var O=null;async function Q1(){if(!O){let f=await Promise.resolve().then(() => Lf(Xf(),1));O=f.default||f}return O}var G1={string:"text/plain; charset=utf-8",object:"application/json; charset=utf-8",Uint8Array:"application/octet-stream",ArrayBuffer:"application/octet-stream"};class E{req;server;path;routePattern;paramNames;env;executionContext;headers=new Headers;parsedQuery=null;parsedParams=null;parsedCookies=null;parsedBody=null;contextData={};urlObject=null;constructor(f,u,g,r,v,w,c){this.req=f,this.server=u,this.path=g,this.routePattern=r,this.executionContext=c,this.env=w,this.paramNames=v}setHeader(f,u){return this.headers.set(f,u),this}removeHeader(f){return this.headers.delete(f),this}set(f,u){return this.contextData[f]=u,this}get(f){return this.contextData[f]}get ip(){if(this.server)return this.server.requestIP(this.req)?.address??null;return this.req.headers.get("CF-Connecting-IP")||null}get url(){if(!this.urlObject)this.urlObject=new URL(this.req.url);return this.urlObject}get query(){if(!this.parsedQuery)this.parsedQuery=this.url.search?Object.fromEntries(this.url.searchParams):{};return this.parsedQuery}get params(){if(!Array.isArray(this.paramNames))return this.paramNames;if(!this.parsedParams)try{this.parsedParams=X1(this.paramNames,this.path)}catch(f){let u=f instanceof Error?f.message:String(f);throw new Error(`Failed to extract route parameters: ${u}`)}return this.parsedParams??{}}get body(){if(this.req.method==="GET")return Promise.resolve({});if(!this.parsedBody)this.parsedBody=(async()=>{try{let f=await W1(this.req);if(f.error)throw new Error(f.error);return Object.keys(f).length===0?null:f}catch(f){throw new Error("Invalid request body format")}})();return this.parsedBody}text(f,u=200){return new Response(f,{status:u,headers:this.headers})}send(f,u=200){let g;if(f instanceof Uint8Array)g="Uint8Array";else if(f instanceof ArrayBuffer)g="ArrayBuffer";else g=typeof f;if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",G1[g]??"text/plain; charset=utf-8");let r=g==="object"&&f!==null?JSON.stringify(f):f;return new Response(r,{status:u,headers:this.headers})}json(f,u=200){return Response.json(f,{status:u,headers:this.headers})}file(f,u,g=200){let r=Bun.file(f);if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",u??F(f));return new Response(r,{status:g,headers:this.headers})}async ejs(f,u={},g=200){let r=await Q1();try{let v=await Bun.file(f).text(),w=r.render(v,u),c=new Headers({"Content-Type":"text/html; charset=utf-8"});return new Response(w,{status:g,headers:c})}catch(v){return console.error("EJS Rendering Error:",v),new Response("Error rendering template",{status:500})}}redirect(f,u=302){return this.headers.set("Location",f),new Response(null,{status:u,headers:this.headers})}setCookie(f,u,g={}){let r=`${encodeURIComponent(f)}=${encodeURIComponent(u)}`;if(g.maxAge)r+=`; Max-Age=${g.maxAge}`;if(g.expires)r+=`; Expires=${g.expires.toUTCString()}`;if(g.path)r+=`; Path=${g.path}`;if(g.domain)r+=`; Domain=${g.domain}`;if(g.secure)r+="; Secure";if(g.httpOnly)r+="; HttpOnly";if(g.sameSite)r+=`; SameSite=${g.sameSite}`;return this.headers.append("Set-Cookie",r),this}get cookies(){if(!this.parsedCookies){let f=this.req.headers.get("cookie");this.parsedCookies=f?B1(f):{}}return this.parsedCookies}stream(f){let u=new Headers(this.headers),g=new ReadableStream({async start(r){await f(r),r.close()}});return new Response(g,{headers:u})}yieldStream(f){return new Response}}function B1(f){return Object.fromEntries(f.split(";").map((u)=>{let[g,...r]=u.trim().split("=");return[g,decodeURIComponent(r.join("="))]}))}function X1(f,u){let g={},[r]=u.split("?"),v=r.split("/").filter((c)=>c!==""),w=v.length-f.length;for(let c=0;c<f.length;c++)g[f[c]]=v[w+c];return g}function O1(f,u){let g={},r=f.split("/"),[v]=u.split("?"),w=v.split("/");if(r.length!==w.length)return null;for(let c=0;c<r.length;c++){let C=r[c];if(C.charCodeAt(0)===58)g[C.slice(1)]=w[c]}return g}async function W1(f){let u=f.headers.get("Content-Type")||"";if(!u)return{};if(f.headers.get("Content-Length")==="0"||!f.body)return{};if(u.startsWith("application/json"))return await f.json();if(u.startsWith("application/x-www-form-urlencoded")){let r=await f.text();return Object.fromEntries(new URLSearchParams(r))}if(u.startsWith("multipart/form-data")){let r=await f.formData(),v={};for(let[w,c]of r.entries())v[w]=c;return v}return{error:"Unknown request body type"}}var Wf=(f)=>f!==null&&typeof f==="object"&&typeof f.then==="function",Ff=(f)=>f!==null&&typeof f==="object"&&typeof f.status==="number"&&typeof f.headers==="object";async function Rf(f,u,g){if(!u?.length)return;for(let r=0;r<u.length;r++){let v=u[r](...g),w=v instanceof Promise?await v:v;if(w&&f!=="onRequest")return w}}async function T1(f,u,g){let r=f.globalMiddlewares;if(r.length)for(let w of r){let c=await w(g);if(c)return c}let v=f.middlewares.get(u);if(v&&v.length)for(let w of v){let c=await w(g);if(c)return c}return null}async function Uf(f,u,g){for(let r of f){let v=await r(u,g);if(v)return v}}async function qf(f,u,g){let r=await F1(f,u,g),v=Wf(r)?await r:r;if(v)return v}async function F1(f,u,g){if(u.endsWith("/"))u=u.slice(0,-1);if(!f.filters.has(u))if(f.filterFunction.length)for(let r of f.filterFunction){let v=await r(g);if(v)return v}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function Df(f,u,g){if(f.staticPath){let
|
|
54
|
+
`}};Vf.escapeXML=z.escapeXML;Vf.__express=Vf.renderFile;Vf.VERSION=f1;Vf.name=v1;if(typeof window!="undefined")window.ejs=Vf});function F(f){switch(f.split(".").pop()?.toLowerCase()){case"js":return"application/javascript";case"css":return"text/css";case"html":return"text/html";case"json":return"application/json";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"woff":return"font/woff";case"woff2":return"font/woff2";default:return"application/octet-stream"}}var O=null;async function Q1(){if(!O){let f=await Promise.resolve().then(() => Lf(Xf(),1));O=f.default||f}return O}var G1={string:"text/plain; charset=utf-8",object:"application/json; charset=utf-8",Uint8Array:"application/octet-stream",ArrayBuffer:"application/octet-stream"};class E{req;server;path;routePattern;paramNames;env;executionContext;headers=new Headers;parsedQuery=null;parsedParams=null;parsedCookies=null;parsedBody=null;contextData={};urlObject=null;constructor(f,u,g,r,v,w,c){this.req=f,this.server=u,this.path=g,this.routePattern=r,this.executionContext=c,this.env=w,this.paramNames=v}setHeader(f,u){return this.headers.set(f,u),this}removeHeader(f){return this.headers.delete(f),this}set(f,u){return this.contextData[f]=u,this}get(f){return this.contextData[f]}get ip(){if(this.server)return this.server.requestIP(this.req)?.address??null;return this.req.headers.get("CF-Connecting-IP")||null}get url(){if(!this.urlObject)this.urlObject=new URL(this.req.url);return this.urlObject}get query(){if(!this.parsedQuery)this.parsedQuery=this.url.search?Object.fromEntries(this.url.searchParams):{};return this.parsedQuery}get params(){if(!Array.isArray(this.paramNames))return this.paramNames;if(!this.parsedParams)try{this.parsedParams=X1(this.paramNames,this.path)}catch(f){let u=f instanceof Error?f.message:String(f);throw new Error(`Failed to extract route parameters: ${u}`)}return this.parsedParams??{}}get body(){if(this.req.method==="GET")return Promise.resolve({});if(!this.parsedBody)this.parsedBody=(async()=>{try{let f=await W1(this.req);if(f.error)throw new Error(f.error);return Object.keys(f).length===0?null:f}catch(f){throw new Error("Invalid request body format")}})();return this.parsedBody}text(f,u=200){return new Response(f,{status:u,headers:this.headers})}send(f,u=200){let g;if(f instanceof Uint8Array)g="Uint8Array";else if(f instanceof ArrayBuffer)g="ArrayBuffer";else g=typeof f;if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",G1[g]??"text/plain; charset=utf-8");let r=g==="object"&&f!==null?JSON.stringify(f):f;return new Response(r,{status:u,headers:this.headers})}json(f,u=200){return Response.json(f,{status:u,headers:this.headers})}file(f,u,g=200){let r=Bun.file(f);if(!this.headers.has("Content-Type"))this.headers.set("Content-Type",u??F(f));return new Response(r,{status:g,headers:this.headers})}async ejs(f,u={},g=200){let r=await Q1();try{let v=await Bun.file(f).text(),w=r.render(v,u),c=new Headers({"Content-Type":"text/html; charset=utf-8"});return new Response(w,{status:g,headers:c})}catch(v){return console.error("EJS Rendering Error:",v),new Response("Error rendering template",{status:500})}}redirect(f,u=302){return this.headers.set("Location",f),new Response(null,{status:u,headers:this.headers})}setCookie(f,u,g={}){let r=`${encodeURIComponent(f)}=${encodeURIComponent(u)}`;if(g.maxAge)r+=`; Max-Age=${g.maxAge}`;if(g.expires)r+=`; Expires=${g.expires.toUTCString()}`;if(g.path)r+=`; Path=${g.path}`;if(g.domain)r+=`; Domain=${g.domain}`;if(g.secure)r+="; Secure";if(g.httpOnly)r+="; HttpOnly";if(g.sameSite)r+=`; SameSite=${g.sameSite}`;return this.headers.append("Set-Cookie",r),this}get cookies(){if(!this.parsedCookies){let f=this.req.headers.get("cookie");this.parsedCookies=f?B1(f):{}}return this.parsedCookies}stream(f){let u=new Headers(this.headers),g=new ReadableStream({async start(r){await f(r),r.close()}});return new Response(g,{headers:u})}yieldStream(f){return new Response}}function B1(f){return Object.fromEntries(f.split(";").map((u)=>{let[g,...r]=u.trim().split("=");return[g,decodeURIComponent(r.join("="))]}))}function X1(f,u){let g={},[r]=u.split("?"),v=r.split("/").filter((c)=>c!==""),w=v.length-f.length;for(let c=0;c<f.length;c++)g[f[c]]=v[w+c];return g}function O1(f,u){let g={},r=f.split("/"),[v]=u.split("?"),w=v.split("/");if(r.length!==w.length)return null;for(let c=0;c<r.length;c++){let C=r[c];if(C.charCodeAt(0)===58)g[C.slice(1)]=w[c]}return g}async function W1(f){let u=f.headers.get("Content-Type")||"";if(!u)return{};if(f.headers.get("Content-Length")==="0"||!f.body)return{};if(u.startsWith("application/json"))return await f.json();if(u.startsWith("application/x-www-form-urlencoded")){let r=await f.text();return Object.fromEntries(new URLSearchParams(r))}if(u.startsWith("multipart/form-data")){let r=await f.formData(),v={};for(let[w,c]of r.entries())v[w]=c;return v}return{error:"Unknown request body type"}}var Wf=(f)=>f!==null&&typeof f==="object"&&typeof f.then==="function",Ff=(f)=>f!==null&&typeof f==="object"&&typeof f.status==="number"&&typeof f.headers==="object";async function Rf(f,u,g){if(!u?.length)return;for(let r=0;r<u.length;r++){let v=u[r](...g),w=v instanceof Promise?await v:v;if(w&&f!=="onRequest")return w}}async function T1(f,u,g){let r=f.globalMiddlewares;if(r.length)for(let w of r){let c=await w(g);if(c)return c}let v=f.middlewares.get(u);if(v&&v.length)for(let w of v){let c=await w(g);if(c)return c}return null}async function Uf(f,u,g){for(let r of f){let v=await r(u,g);if(v)return v}}async function qf(f,u,g){let r=await F1(f,u,g),v=Wf(r)?await r:r;if(v)return v}async function F1(f,u,g){if(u.endsWith("/"))u=u.slice(0,-1);if(!f.filters.has(u))if(f.filterFunction.length)for(let r of f.filterFunction){let v=await r(g);if(v)return v}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function Df(f,u,g){if(f.staticPath){let C=!0;if(f.staticRequestPath)C=g.startsWith(f.staticRequestPath);if(C){let b=await R1(f,g,u);if(b)return b}}let w=(f.router.find(u.req.method,"*")?.handler).slice(-1);if(w.length>0){let C=await w[0](u);if(Ff(C))return C}let c=f.routeNotFoundFunc(u);return c instanceof Promise?await c:c||P(404,`404 Route not found for ${g}`)}function P(f,u){return new Response(JSON.stringify({error:u}),{status:f,headers:{"Content-Type":"application/json"}})}async function R1(f,u,g){if(!f.staticPath)return null;let r=`${f.staticPath}${u}`;if(await Bun.file(r).exists()){let w=F(r);return g.file(r,w,200)}return null}var x=(f)=>f.constructor.name==="AsyncFunction",Mf=(f,u,g,...r)=>{if(u.length>5)f.push(`
|
|
55
55
|
for (let i = 0; i < diesel.hooks.${g}.length; i++) {
|
|
56
56
|
const result = diesel.hooks.${g}[i](${r});
|
|
57
57
|
const finalResult = result instanceof Promise ? await result : result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function c(e){switch(e.split(".").pop()?.toLowerCase()){case"js":return"application/javascript";case"css":return"text/css";case"html":return"text/html";case"json":return"application/json";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"svg":return"image/svg+xml";case"gif":return"image/gif";case"woff":return"font/woff";case"woff2":return"font/woff2";default:return"application/octet-stream"}}var f=(e)=>e!==null&&typeof e==="object"&&typeof e.then==="function",l=(e)=>e!==null&&typeof e==="object"&&typeof e.status==="number"&&typeof e.headers==="object";async function R(e,t,o){if(!t?.length)return;for(let n=0;n<t.length;n++){let r=t[n](...o),s=r instanceof Promise?await r:r;if(s&&e!=="onRequest")return s}}async function x(e,t,o){let n=e.globalMiddlewares;if(n.length)for(let s of n){let i=await s(o);if(i)return i}let r=e.middlewares.get(t);if(r&&r.length)for(let s of r){let i=await s(o);if(i)return i}return null}async function T(e,t,o){for(let n of e){let r=await n(t,o);if(r)return r}}async function F(e,t,o){let n=await p(e,t,o),r=f(n)?await n:n;if(r)return r}async function p(e,t,o){if(t.endsWith("/"))t=t.slice(0,-1);if(!e.filters.has(t))if(e.filterFunction.length)for(let n of e.filterFunction){let r=await n(o);if(r)return r}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function P(e,t,o,n){if(!e.filters.has(t))if(e.filterFunction.length)for(let r of e.filterFunction){let s=await r(o,n);if(s)return s}else return Response.json({error:"Protected route, authentication required"},{status:401})}async function j(e,t,o){if(e.staticPath){let a=!0;if(e.staticRequestPath)a=o.startsWith(e.staticRequestPath);if(a){let u=await y(e,o,t);if(u)return u}}let s=(e.router.find(t.req.method,"*")?.handler).slice(-1);if(s.length>0){let a=await s[0](t);if(l(a))return a}let i=e.routeNotFoundFunc(t);return i instanceof Promise?await i:i||g(404,`404 Route not found for ${o}`)}function g(e,t){return new Response(JSON.stringify({error:t}),{status:e,headers:{"Content-Type":"application/json"}})}async function y(e,t,o){if(!e.staticPath)return null;let n=`${e.staticPath}${t}`;if(await Bun.file(n).exists()){let s=c(n);return o.file(n,s,200)}return null}export{x as runMiddlewares,R as runHooks,F as runFilter,y as handleStaticFiles,j as handleRouteNotFound,p as handleFilterRequest,P as handleBunFilterRequest,g as generateErrorResponse,T as executeBunMiddlewares};
|