@likec4/mcp 1.48.0 → 1.50.0
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 +11 -1
- package/dist/THIRD-PARTY-LICENSES.md +2413 -0
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +30 -0
- package/dist/_chunks/libs/@hono/mcp.mjs +34 -0
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -2
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +7 -36
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@smithy/is-array-buffer.mjs +1 -0
- package/dist/_chunks/libs/chevrotain-allstar.mjs +2 -2
- package/dist/_chunks/libs/chevrotain.mjs +35 -35
- package/dist/_chunks/libs/citty.mjs +1 -1
- package/dist/_chunks/libs/is-error-instance.mjs +1 -1
- package/dist/_chunks/libs/isexe.mjs +1 -0
- package/dist/_chunks/libs/khroma.mjs +1 -1
- package/dist/_chunks/libs/langium.mjs +18 -17
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +2 -2
- package/dist/_chunks/libs/mdast-util-gfm.mjs +9 -9
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +7 -7
- package/dist/_chunks/libs/merge-error-cause.mjs +2 -2
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -1
- package/dist/_chunks/libs/mnemonist.mjs +1 -1
- package/dist/_chunks/libs/nano-spawn.mjs +3 -0
- package/dist/_chunks/libs/p-limit.mjs +1 -1
- package/dist/_chunks/libs/remeda.mjs +2 -1
- package/dist/_chunks/libs/safe-stringify.mjs +1 -1
- package/dist/_chunks/libs/ufo.mjs +1 -1
- package/dist/_chunks/libs/unified.mjs +1 -1
- package/dist/_chunks/libs/which.mjs +1 -0
- package/dist/_chunks/rolldown-runtime.mjs +1 -1
- package/dist/index.mjs +749 -69
- package/package.json +16 -16
- package/dist/_chunks/libs/@chevrotain/gast.mjs +0 -1
- package/dist/_chunks/libs/hono.mjs +0 -1
- package/dist/_chunks/libs/nanoid.mjs +0 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@likec4/mcp",
|
|
3
3
|
"description": "Model Context Protocol server for LikeC4",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.50.0",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
8
8
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -47,31 +47,31 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@hpcc-js/wasm-graphviz": "1.
|
|
50
|
+
"@hpcc-js/wasm-graphviz": "1.21.0",
|
|
51
51
|
"bundle-require": "^5.1.0",
|
|
52
|
-
"esbuild": "0.27.
|
|
52
|
+
"esbuild": "0.27.3",
|
|
53
53
|
"std-env": "^3.10.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
57
|
-
"@types/node": "~22.19.
|
|
58
|
-
"citty": "^0.2.
|
|
59
|
-
"
|
|
56
|
+
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
57
|
+
"@types/node": "~22.19.11",
|
|
58
|
+
"citty": "^0.2.1",
|
|
59
|
+
"obuild": "^0.4.31",
|
|
60
|
+
"remeda": "^2.33.5",
|
|
60
61
|
"tsx": "4.21.0",
|
|
61
|
-
"turbo": "2.
|
|
62
|
+
"turbo": "2.8.10",
|
|
62
63
|
"typescript": "5.9.3",
|
|
63
|
-
"obuild": "^0.4.20",
|
|
64
64
|
"vitest": "4.0.18",
|
|
65
65
|
"vscode-uri": "3.1.0",
|
|
66
66
|
"wireit": "0.14.12",
|
|
67
67
|
"zod": "^3.25.76",
|
|
68
|
-
"@likec4/
|
|
69
|
-
"@likec4/
|
|
70
|
-
"@likec4/
|
|
71
|
-
"@likec4/
|
|
72
|
-
"@likec4/
|
|
73
|
-
"@likec4/
|
|
74
|
-
"@likec4/
|
|
68
|
+
"@likec4/config": "1.50.0",
|
|
69
|
+
"@likec4/devops": "1.42.0",
|
|
70
|
+
"@likec4/language-server": "1.50.0",
|
|
71
|
+
"@likec4/core": "1.50.0",
|
|
72
|
+
"@likec4/layouts": "1.50.0",
|
|
73
|
+
"@likec4/log": "1.50.0",
|
|
74
|
+
"@likec4/tsconfig": "1.50.0"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"typecheck": "tsc -b --verbose",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=typeof global==`object`&&global&&global.Object===Object&&global,t=typeof self==`object`&&self&&self.Object===Object&&self,n=e||t||Function(`return this`)(),r=n.Symbol,i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=r?r.toStringTag:void 0;function c(e){var t=a.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch{}var i=o.call(e);return r&&(t?e[s]=n:delete e[s]),i}var l=c,u=Object.prototype.toString;function d(e){return u.call(e)}var f=d,p=`[object Null]`,m=`[object Undefined]`,h=r?r.toStringTag:void 0;function g(e){return e==null?e===void 0?m:p:h&&h in Object(e)?l(e):f(e)}var _=g;function v(e){return typeof e==`object`&&!!e}var y=v,ee=`[object Symbol]`;function te(e){return typeof e==`symbol`||y(e)&&_(e)==ee}var b=te;function ne(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var x=ne,S=Array.isArray,re=1/0,ie=r?r.prototype:void 0,ae=ie?ie.toString:void 0;function oe(e){if(typeof e==`string`)return e;if(S(e))return x(e,oe)+``;if(b(e))return ae?ae.call(e):``;var t=e+``;return t==`0`&&1/e==-re?`-0`:t}var se=oe,ce=/\s/;function le(e){for(var t=e.length;t--&&ce.test(e.charAt(t)););return t}var ue=le,de=/^\s+/;function fe(e){return e&&e.slice(0,ue(e)+1).replace(de,``)}var pe=fe;function me(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var C=me,he=NaN,ge=/^[-+]0x[0-9a-f]+$/i,_e=/^0b[01]+$/i,ve=/^0o[0-7]+$/i,ye=parseInt;function be(e){if(typeof e==`number`)return e;if(b(e))return he;if(C(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=C(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=pe(e);var n=_e.test(e);return n||ve.test(e)?ye(e.slice(2),n?2:8):ge.test(e)?he:+e}var xe=be,Se=1/0,Ce=17976931348623157e292;function we(e){return e?(e=xe(e),e===Se||e===-Se?(e<0?-1:1)*Ce:e===e?e:0):e===0?e:0}var Te=we;function Ee(e){var t=Te(e),n=t%1;return t===t?n?t-n:t:0}var De=Ee;function Oe(e){return e}var w=Oe,ke=`[object AsyncFunction]`,Ae=`[object Function]`,je=`[object GeneratorFunction]`,Me=`[object Proxy]`;function Ne(e){if(!C(e))return!1;var t=_(e);return t==Ae||t==je||t==ke||t==Me}var Pe=Ne,Fe=n[`__core-js_shared__`],Ie=function(){var e=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function Le(e){return!!Ie&&Ie in e}var Re=Le,ze=Function.prototype.toString;function Be(e){if(e!=null){try{return ze.call(e)}catch{}try{return e+``}catch{}}return``}var T=Be,Ve=/[\\^$.*+?()[\]{}|]/g,He=/^\[object .+?Constructor\]$/,Ue=Function.prototype,We=Object.prototype,Ge=Ue.toString,Ke=We.hasOwnProperty,qe=RegExp(`^`+Ge.call(Ke).replace(Ve,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function Je(e){return!C(e)||Re(e)?!1:(Pe(e)?qe:He).test(T(e))}var Ye=Je;function Xe(e,t){return e?.[t]}var Ze=Xe;function Qe(e,t){var n=Ze(e,t);return Ye(n)?n:void 0}var E=Qe,$e=E(n,`WeakMap`);function et(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var tt=et,nt=800,rt=16,it=Date.now;function at(e){var t=0,n=0;return function(){var r=it(),i=rt-(r-n);if(n=r,i>0){if(++t>=nt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var ot=at;function st(e){return function(){return e}}var ct=st,lt=function(){try{var e=E(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),ut=ot(lt?function(e,t){return lt(e,`toString`,{configurable:!0,enumerable:!1,value:ct(t),writable:!0})}:w);function dt(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var ft=dt;function pt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var mt=pt;function ht(e){return e!==e}var gt=ht;function _t(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var vt=_t;function yt(e,t,n){return t===t?vt(e,t,n):mt(e,gt,n)}var bt=yt,xt=9007199254740991,St=/^(?:0|[1-9]\d*)$/;function Ct(e,t){var n=typeof e;return t??=xt,!!t&&(n==`number`||n!=`symbol`&&St.test(e))&&e>-1&&e%1==0&&e<t}var wt=Ct;function Tt(e,t,n){t==`__proto__`&<?lt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Et=Tt;function Dt(e,t){return e===t||e!==e&&t!==t}var D=Dt,Ot=Object.prototype.hasOwnProperty;function kt(e,t,n){var r=e[t];(!(Ot.call(e,t)&&D(r,n))||n===void 0&&!(t in e))&&Et(e,t,n)}var At=kt;function jt(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?Et(n,s,c):At(n,s,c)}return n}var Mt=jt,Nt=Math.max;function Pt(e,t,n){return t=Nt(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Nt(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),tt(e,this,s)}}var Ft=Pt;function It(e,t){return ut(Ft(e,t,w),e+``)}var Lt=It,Rt=9007199254740991;function zt(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Rt}var Bt=zt;function Vt(e){return e!=null&&Bt(e.length)&&!Pe(e)}var O=Vt;function Ht(e,t,n){if(!C(n))return!1;var r=typeof t;return(r==`number`?O(n)&&wt(t,n.length):r==`string`&&t in n)?D(n[t],e):!1}var Ut=Ht;function Wt(e){return Lt(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Ut(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Gt=Wt,Kt=Object.prototype;function qt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||Kt)}var Jt=qt;function Yt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Xt=Yt,Zt=`[object Arguments]`;function Qt(e){return y(e)&&_(e)==Zt}var $t=Qt,en=Object.prototype,tn=en.hasOwnProperty,nn=en.propertyIsEnumerable,rn=$t(function(){return arguments}())?$t:function(e){return y(e)&&tn.call(e,`callee`)&&!nn.call(e,`callee`)};function an(){return!1}var on=an,sn=typeof exports==`object`&&exports&&!exports.nodeType&&exports,cn=sn&&typeof module==`object`&&module&&!module.nodeType&&module,ln=cn&&cn.exports===sn?n.Buffer:void 0,un=(ln?ln.isBuffer:void 0)||on,dn=`[object Arguments]`,fn=`[object Array]`,pn=`[object Boolean]`,mn=`[object Date]`,hn=`[object Error]`,gn=`[object Function]`,_n=`[object Map]`,vn=`[object Number]`,yn=`[object Object]`,bn=`[object RegExp]`,xn=`[object Set]`,Sn=`[object String]`,Cn=`[object WeakMap]`,wn=`[object ArrayBuffer]`,Tn=`[object DataView]`,En=`[object Float32Array]`,Dn=`[object Float64Array]`,On=`[object Int8Array]`,kn=`[object Int16Array]`,An=`[object Int32Array]`,jn=`[object Uint8Array]`,Mn=`[object Uint8ClampedArray]`,Nn=`[object Uint16Array]`,Pn=`[object Uint32Array]`,k={};k[En]=k[Dn]=k[On]=k[kn]=k[An]=k[jn]=k[Mn]=k[Nn]=k[Pn]=!0,k[dn]=k[fn]=k[wn]=k[pn]=k[Tn]=k[mn]=k[hn]=k[gn]=k[_n]=k[vn]=k[yn]=k[bn]=k[xn]=k[Sn]=k[Cn]=!1;function Fn(e){return y(e)&&Bt(e.length)&&!!k[_(e)]}var In=Fn;function Ln(e){return function(t){return e(t)}}var Rn=Ln,zn=typeof exports==`object`&&exports&&!exports.nodeType&&exports,A=zn&&typeof module==`object`&&module&&!module.nodeType&&module,Bn=A&&A.exports===zn&&e.process,j=function(){try{return A&&A.require&&A.require(`util`).types||Bn&&Bn.binding&&Bn.binding(`util`)}catch{}}(),Vn=j&&j.isTypedArray,Hn=Vn?Rn(Vn):In,Un=Object.prototype.hasOwnProperty;function Wn(e,t){var n=S(e),r=!n&&rn(e),i=!n&&!r&&un(e),a=!n&&!r&&!i&&Hn(e),o=n||r||i||a,s=o?Xt(e.length,String):[],c=s.length;for(var l in e)(t||Un.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||wt(l,c)))&&s.push(l);return s}var Gn=Wn;function Kn(e,t){return function(n){return e(t(n))}}var qn=Kn,Jn=qn(Object.keys,Object),Yn=Object.prototype.hasOwnProperty;function Xn(e){if(!Jt(e))return Jn(e);var t=[];for(var n in Object(e))Yn.call(e,n)&&n!=`constructor`&&t.push(n);return t}var Zn=Xn;function Qn(e){return O(e)?Gn(e):Zn(e)}var M=Qn,$n=Object.prototype.hasOwnProperty,N=Gt(function(e,t){if(Jt(t)||O(t)){Mt(t,M(t),e);return}for(var n in t)$n.call(t,n)&&At(e,n,t[n])});function er(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var tr=er,nr=Object.prototype.hasOwnProperty;function rr(e){if(!C(e))return tr(e);var t=Jt(e),n=[];for(var r in e)r==`constructor`&&(t||!nr.call(e,r))||n.push(r);return n}var ir=rr;function ar(e){return O(e)?Gn(e,!0):ir(e)}var or=ar,sr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cr=/^\w*$/;function lr(e,t){if(S(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||b(e)?!0:cr.test(e)||!sr.test(e)||t!=null&&e in Object(t)}var ur=lr,P=E(Object,`create`);function dr(){this.__data__=P?P(null):{},this.size=0}var fr=dr;function pr(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var mr=pr,hr=`__lodash_hash_undefined__`,gr=Object.prototype.hasOwnProperty;function _r(e){var t=this.__data__;if(P){var n=t[e];return n===hr?void 0:n}return gr.call(t,e)?t[e]:void 0}var vr=_r,yr=Object.prototype.hasOwnProperty;function br(e){var t=this.__data__;return P?t[e]!==void 0:yr.call(t,e)}var xr=br,Sr=`__lodash_hash_undefined__`;function Cr(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=P&&t===void 0?Sr:t,this}var wr=Cr;function F(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}F.prototype.clear=fr,F.prototype.delete=mr,F.prototype.get=vr,F.prototype.has=xr,F.prototype.set=wr;var Tr=F;function Er(){this.__data__=[],this.size=0}var Dr=Er;function Or(e,t){for(var n=e.length;n--;)if(D(e[n][0],t))return n;return-1}var kr=Or,Ar=Array.prototype.splice;function jr(e){var t=this.__data__,n=kr(t,e);return n<0?!1:(n==t.length-1?t.pop():Ar.call(t,n,1),--this.size,!0)}var Mr=jr;function Nr(e){var t=this.__data__,n=kr(t,e);return n<0?void 0:t[n][1]}var Pr=Nr;function Fr(e){return kr(this.__data__,e)>-1}var Ir=Fr;function Lr(e,t){var n=this.__data__,r=kr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Rr=Lr;function I(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}I.prototype.clear=Dr,I.prototype.delete=Mr,I.prototype.get=Pr,I.prototype.has=Ir,I.prototype.set=Rr;var zr=I,L=E(n,`Map`);function Br(){this.size=0,this.__data__={hash:new Tr,map:new(L||zr),string:new Tr}}var Vr=Br;function Hr(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}var Ur=Hr;function Wr(e,t){var n=e.__data__;return Ur(t)?n[typeof t==`string`?`string`:`hash`]:n.map}var Gr=Wr;function Kr(e){var t=Gr(this,e).delete(e);return this.size-=t?1:0,t}var qr=Kr;function Jr(e){return Gr(this,e).get(e)}var Yr=Jr;function Xr(e){return Gr(this,e).has(e)}var Zr=Xr;function Qr(e,t){var n=Gr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var $r=Qr;function R(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}R.prototype.clear=Vr,R.prototype.delete=qr,R.prototype.get=Yr,R.prototype.has=Zr,R.prototype.set=$r;var ei=R,ti=`Expected a function`;function ni(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(ti);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(ni.Cache||ei),n}ni.Cache=ei;var ri=ni,ii=500;function ai(e){var t=ri(e,function(e){return n.size===ii&&n.clear(),e}),n=t.cache;return t}var oi=ai,si=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ci=/\\(\\)?/g,li=oi(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(si,function(e,n,r,i){t.push(r?i.replace(ci,`$1`):n||e)}),t});function ui(e){return e==null?``:se(e)}var di=ui;function fi(e,t){return S(e)?e:ur(e,t)?[e]:li(di(e))}var pi=fi,mi=1/0;function hi(e){if(typeof e==`string`||b(e))return e;var t=e+``;return t==`0`&&1/e==-mi?`-0`:t}var z=hi;function gi(e,t){t=pi(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[z(t[n++])];return n&&n==r?e:void 0}var _i=gi;function vi(e,t,n){var r=e==null?void 0:_i(e,t);return r===void 0?n:r}var yi=vi;function bi(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var xi=bi,Si=qn(Object.getPrototypeOf,Object);function Ci(){this.__data__=new zr,this.size=0}var wi=Ci;function Ti(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var Ei=Ti;function Di(e){return this.__data__.get(e)}var Oi=Di;function ki(e){return this.__data__.has(e)}var Ai=ki,ji=200;function Mi(e,t){var n=this.__data__;if(n instanceof zr){var r=n.__data__;if(!L||r.length<ji-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ei(r)}return n.set(e,t),this.size=n.size,this}var Ni=Mi;function B(e){this.size=(this.__data__=new zr(e)).size}B.prototype.clear=wi,B.prototype.delete=Ei,B.prototype.get=Oi,B.prototype.has=Ai,B.prototype.set=Ni;var V=B;function Pi(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}var Fi=Pi;function Ii(){return[]}var Li=Ii,Ri=Object.prototype.propertyIsEnumerable,zi=Object.getOwnPropertySymbols,Bi=zi?function(e){return e==null?[]:(e=Object(e),Fi(zi(e),function(t){return Ri.call(e,t)}))}:Li,Vi=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)xi(t,Bi(e)),e=Si(e);return t}:Li;function Hi(e,t,n){var r=t(e);return S(e)?r:xi(r,n(e))}var Ui=Hi;function Wi(e){return Ui(e,M,Bi)}var Gi=Wi;function Ki(e){return Ui(e,or,Vi)}var qi=Ki,Ji=E(n,`DataView`),Yi=E(n,`Promise`),Xi=E(n,`Set`),Zi=`[object Map]`,Qi=`[object Object]`,$i=`[object Promise]`,ea=`[object Set]`,ta=`[object WeakMap]`,na=`[object DataView]`,ra=T(Ji),ia=T(L),aa=T(Yi),oa=T(Xi),sa=T($e),H=_;(Ji&&H(new Ji(new ArrayBuffer(1)))!=na||L&&H(new L)!=Zi||Yi&&H(Yi.resolve())!=$i||Xi&&H(new Xi)!=ea||$e&&H(new $e)!=ta)&&(H=function(e){var t=_(e),n=t==Qi?e.constructor:void 0,r=n?T(n):``;if(r)switch(r){case ra:return na;case ia:return Zi;case aa:return $i;case oa:return ea;case sa:return ta}return t});var ca=H,la=n.Uint8Array,ua=`__lodash_hash_undefined__`;function da(e){return this.__data__.set(e,ua),this}var fa=da;function pa(e){return this.__data__.has(e)}var ma=pa;function ha(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new ei;++t<n;)this.add(e[t])}ha.prototype.add=ha.prototype.push=fa,ha.prototype.has=ma;var ga=ha;function _a(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var va=_a;function ya(e,t){return e.has(t)}var ba=ya,xa=1,Sa=2;function Ca(e,t,n,r,i,a){var o=n&xa,s=e.length,c=t.length;if(s!=c&&!(o&&c>s))return!1;var l=a.get(e),u=a.get(t);if(l&&u)return l==t&&u==e;var d=-1,f=!0,p=n&Sa?new ga:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var m=e[d],h=t[d];if(r)var g=o?r(h,m,d,t,e,a):r(m,h,d,e,t,a);if(g!==void 0){if(g)continue;f=!1;break}if(p){if(!va(t,function(e,t){if(!ba(p,t)&&(m===e||i(m,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(!(m===h||i(m,h,n,r,a))){f=!1;break}}return a.delete(e),a.delete(t),f}var wa=Ca;function Ta(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}var Ea=Ta;function Da(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Oa=Da,ka=1,Aa=2,ja=`[object Boolean]`,Ma=`[object Date]`,Na=`[object Error]`,Pa=`[object Map]`,Fa=`[object Number]`,Ia=`[object RegExp]`,La=`[object Set]`,Ra=`[object String]`,za=`[object Symbol]`,Ba=`[object ArrayBuffer]`,Va=`[object DataView]`,Ha=r?r.prototype:void 0,Ua=Ha?Ha.valueOf:void 0;function Wa(e,t,n,r,i,a,o){switch(n){case Va:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Ba:return!(e.byteLength!=t.byteLength||!a(new la(e),new la(t)));case ja:case Ma:case Fa:return D(+e,+t);case Na:return e.name==t.name&&e.message==t.message;case Ia:case Ra:return e==t+``;case Pa:var s=Ea;case La:var c=r&ka;if(s||=Oa,e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=Aa,o.set(e,t);var u=wa(s(e),s(t),r,i,a,o);return o.delete(e),u;case za:if(Ua)return Ua.call(e)==Ua.call(t)}return!1}var Ga=Wa,Ka=1,qa=Object.prototype.hasOwnProperty;function Ja(e,t,n,r,i,a){var o=n&Ka,s=Gi(e),c=s.length;if(c!=Gi(t).length&&!o)return!1;for(var l=c;l--;){var u=s[l];if(!(o?u in t:qa.call(t,u)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var m=o;++l<c;){u=s[l];var h=e[u],g=t[u];if(r)var _=o?r(g,h,u,t,e,a):r(h,g,u,e,t,a);if(!(_===void 0?h===g||i(h,g,n,r,a):_)){p=!1;break}m||=u==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}var Ya=Ja,Xa=1,Za=`[object Arguments]`,Qa=`[object Array]`,$a=`[object Object]`,eo=Object.prototype.hasOwnProperty;function to(e,t,n,r,i,a){var o=S(e),s=S(t),c=o?Qa:ca(e),l=s?Qa:ca(t);c=c==Za?$a:c,l=l==Za?$a:l;var u=c==$a,d=l==$a,f=c==l;if(f&&un(e)){if(!un(t))return!1;o=!0,u=!1}if(f&&!u)return a||=new V,o||Hn(e)?wa(e,t,n,r,i,a):Ga(e,t,c,n,r,i,a);if(!(n&Xa)){var p=u&&eo.call(e,`__wrapped__`),m=d&&eo.call(t,`__wrapped__`);if(p||m){var h=p?e.value():e,g=m?t.value():t;return a||=new V,i(h,g,n,r,a)}}return f?(a||=new V,Ya(e,t,n,r,i,a)):!1}var no=to;function ro(e,t,n,r,i){return e===t?!0:e==null||t==null||!y(e)&&!y(t)?e!==e&&t!==t:no(e,t,n,r,ro,i)}var io=ro,ao=1,oo=2;function so(e,t,n,r){var i=n.length,a=i,o=!r;if(e==null)return!a;for(e=Object(e);i--;){var s=n[i];if(o&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<a;){s=n[i];var c=s[0],l=e[c],u=s[1];if(o&&s[2]){if(l===void 0&&!(c in e))return!1}else{var d=new V;if(r)var f=r(l,u,c,e,t,d);if(!(f===void 0?io(u,l,ao|oo,r,d):f))return!1}}return!0}var co=so;function lo(e){return e===e&&!C(e)}var uo=lo;function fo(e){for(var t=M(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,uo(i)]}return t}var po=fo;function mo(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var ho=mo;function go(e){var t=po(e);return t.length==1&&t[0][2]?ho(t[0][0],t[0][1]):function(n){return n===e||co(n,e,t)}}var _o=go;function vo(e,t){return e!=null&&t in Object(e)}var yo=vo;function bo(e,t,n){t=pi(t,e);for(var r=-1,i=t.length,a=!1;++r<i;){var o=z(t[r]);if(!(a=e!=null&&n(e,o)))break;e=e[o]}return a||++r!=i?a:(i=e==null?0:e.length,!!i&&Bt(i)&&wt(o,i)&&(S(e)||rn(e)))}var xo=bo;function So(e,t){return e!=null&&xo(e,t,yo)}var Co=So,wo=1,To=2;function Eo(e,t){return ur(e)&&uo(t)?ho(z(e),t):function(n){var r=yi(n,e);return r===void 0&&r===t?Co(n,e):io(t,r,wo|To)}}var Do=Eo;function Oo(e){return function(t){return t?.[e]}}var ko=Oo;function Ao(e){return function(t){return _i(t,e)}}var jo=Ao;function Mo(e){return ur(e)?ko(z(e)):jo(e)}var No=Mo;function Po(e){return typeof e==`function`?e:e==null?w:typeof e==`object`?S(e)?Do(e[0],e[1]):_o(e):No(e)}var U=Po;function Fo(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var Io=Fo();function Lo(e,t){return e&&Io(e,t,M)}var Ro=Lo;function zo(e,t){return function(n,r){if(n==null)return n;if(!O(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}var W=zo(Ro);function Bo(e){return typeof e==`function`?e:w}var Vo=Bo;function Ho(e,t){return(S(e)?ft:W)(e,Vo(t))}var Uo=Ho;function Wo(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}var Go=Wo;function Ko(e,t){var n=!0;return W(e,function(e,r,i){return n=!!t(e,r,i),n}),n}var qo=Ko;function Jo(e,t,n){var r=S(e)?Go:qo;return n&&Ut(e,t,n)&&(t=void 0),r(e,U(t,3))}var Yo=Jo;function Xo(e,t){var n=-1,r=O(e)?Array(e.length):[];return W(e,function(e,i,a){r[++n]=t(e,i,a)}),r}var Zo=Xo;function Qo(e,t){return(S(e)?x:Zo)(e,U(t,3))}var $o=Qo,es=`[object String]`;function ts(e){return typeof e==`string`||!S(e)&&y(e)&&_(e)==es}var G=ts;function ns(e,t){return x(t,function(t){return e[t]})}var rs=ns;function is(e){return e==null?[]:rs(e,M(e))}var as=is,os=Math.max;function ss(e,t,n,r){e=O(e)?e:as(e),n=n&&!r?De(n):0;var i=e.length;return n<0&&(n=os(i+n,0)),G(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&bt(e,t,n)>-1}var cs=ss,ls=`[object RegExp]`;function us(e){return y(e)&&_(e)==ls}var ds=us,fs=j&&j.isRegExp,ps=fs?Rn(fs):ds;function ms(e,t,n,r){if(!C(e))return e;t=pi(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=z(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=C(u)?u:wt(t[i+1])?[]:{})}At(s,c,l),s=s[c]}return e}var hs=ms;function gs(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=_i(e,o);n(s,o)&&hs(a,pi(o,e),s)}return a}var _s=gs;function vs(e,t){if(e==null)return{};var n=x(qi(e),function(e){return[e]});return t=U(t),_s(e,n,function(e,n){return t(e,n[0])})}var K=vs;function ys(e,t){var n;return W(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}var bs=ys;function xs(e,t,n){var r=S(e)?va:bs;return n&&Ut(e,t,n)&&(t=void 0),r(e,U(t,3))}var Ss=xs;function Cs(e){return ws(e)?e.LABEL:e.name}function ws(e){return G(e.LABEL)&&e.LABEL!==``}var q=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),Uo(this.definition,t=>{t.accept(e)})}},J=class extends q{constructor(e){super([]),this.idx=1,N(this,K(e,e=>e!==void 0))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},Ts=class extends q{constructor(e){super(e.definition),this.orgText=``,N(this,K(e,e=>e!==void 0))}},Es=class extends q{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,N(this,K(e,e=>e!==void 0))}},Y=class extends q{constructor(e){super(e.definition),this.idx=1,N(this,K(e,e=>e!==void 0))}},Ds=class extends q{constructor(e){super(e.definition),this.idx=1,N(this,K(e,e=>e!==void 0))}},Os=class extends q{constructor(e){super(e.definition),this.idx=1,N(this,K(e,e=>e!==void 0))}},X=class extends q{constructor(e){super(e.definition),this.idx=1,N(this,K(e,e=>e!==void 0))}},Z=class extends q{constructor(e){super(e.definition),this.idx=1,N(this,K(e,e=>e!==void 0))}},Q=class extends q{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,N(this,K(e,e=>e!==void 0))}},$=class{constructor(e){this.idx=1,N(this,K(e,e=>e!==void 0))}accept(e){e.visit(this)}};function ks(e){return $o(e,As)}function As(e){function t(e){return $o(e,As)}if(e instanceof J){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return G(e.label)&&(t.label=e.label),t}else if(e instanceof Es)return{type:`Alternative`,definition:t(e.definition)};else if(e instanceof Y)return{type:`Option`,idx:e.idx,definition:t(e.definition)};else if(e instanceof Ds)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};else if(e instanceof Os)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:As(new $({terminalType:e.separator})),definition:t(e.definition)};else if(e instanceof Z)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:As(new $({terminalType:e.separator})),definition:t(e.definition)};else if(e instanceof X)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};else if(e instanceof Q)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};else if(e instanceof $){let t={type:`Terminal`,name:e.terminalType.name,label:Cs(e.terminalType),idx:e.idx};G(e.label)&&(t.terminalLabel=e.label);let n=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=ps(n)?n.source:n),t}else if(e instanceof Ts)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};else throw Error(`non exhaustive match`)}var js=class{visit(e){let t=e;switch(t.constructor){case J:return this.visitNonTerminal(t);case Es:return this.visitAlternative(t);case Y:return this.visitOption(t);case Ds:return this.visitRepetitionMandatory(t);case Os:return this.visitRepetitionMandatoryWithSeparator(t);case Z:return this.visitRepetitionWithSeparator(t);case X:return this.visitRepetition(t);case Q:return this.visitAlternation(t);case $:return this.visitTerminal(t);case Ts:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Ms(e){return e instanceof Es||e instanceof Y||e instanceof X||e instanceof Ds||e instanceof Os||e instanceof Z||e instanceof $||e instanceof Ts}function Ns(e,t=[]){return e instanceof Y||e instanceof X||e instanceof Z?!0:e instanceof Q?Ss(e.definition,e=>Ns(e,t)):e instanceof J&&cs(t,e)?!1:e instanceof q?(e instanceof J&&t.push(e),Yo(e.definition,e=>Ns(e,t))):!1}function Ps(e){return e instanceof Q}function Fs(e){if(e instanceof J)return`SUBRULE`;if(e instanceof Y)return`OPTION`;if(e instanceof Q)return`OR`;if(e instanceof Ds)return`AT_LEAST_ONE`;if(e instanceof Os)return`AT_LEAST_ONE_SEP`;if(e instanceof Z)return`MANY_SEP`;if(e instanceof X)return`MANY`;if(e instanceof $)return`CONSUME`;throw Error(`non exhaustive match`)}export{Ut as $,ba as A,V as B,$o as C,U as D,W as E,qi as F,M as G,xi as H,Gi as I,j as J,Zn as K,Vi as L,la as M,ca as N,xo as O,Xi as P,Jt as Q,Bi as R,G as S,Uo as T,or as U,Si as V,N as W,un as X,Rn as Y,rn as Z,Ss as _,r as _t,js as a,Et as at,cs as b,J as c,ft as ct,Ds as d,De as dt,O as et,Os as f,C as ft,ks as g,y as gt,$ as h,b as ht,Ms as i,D as it,ga as j,Oa as k,Y as l,Pe as lt,Ts as m,x as mt,Ps as n,Mt as nt,Q as o,bt as ot,Z as p,S as pt,Hn as q,Ns as r,At as rt,Es as s,mt as st,Fs as t,Lt as tt,X as u,w as ut,K as v,n as vt,Yo as w,as as x,ps as y,Fi as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=(e,t,n)=>(r,i)=>{let a=-1;return o(0);async function o(s){if(s<=a)throw Error(`next() called multiple times`);a=s;let c,l=!1,u;if(e[s]?(u=e[s][0][0],r.req.routeIndex=s):u=s===e.length&&i||void 0,u)try{c=await u(r,()=>o(s+1))}catch(e){if(e instanceof Error&&t)r.error=e,c=await t(e,r),l=!0;else throw e}else r.finalized===!1&&n&&(c=await n(r));return c&&(r.finalized===!1||l)&&(r.res=c),r}},t=Symbol(),n=async(e,t=Object.create(null))=>{let{all:n=!1,dot:i=!1}=t,a=(e instanceof T?e.raw.headers:e.headers).get(`Content-Type`);return a?.startsWith(`multipart/form-data`)||a?.startsWith(`application/x-www-form-urlencoded`)?r(e,{all:n,dot:i}):{}};async function r(e,t){let n=await e.formData();return n?i(n,t):{}}function i(e,t){let n=Object.create(null);return e.forEach((e,r)=>{t.all||r.endsWith(`[]`)?a(n,r,e):n[r]=e}),t.dot&&Object.entries(n).forEach(([e,t])=>{e.includes(`.`)&&(o(n,e,t),delete n[e])}),n}var a=(e,t,n)=>{e[t]===void 0?t.endsWith(`[]`)?e[t]=[n]:e[t]=n:Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]},o=(e,t,n)=>{let r=e,i=t.split(`.`);i.forEach((e,t)=>{t===i.length-1?r[e]=n:((!r[e]||typeof r[e]!=`object`||Array.isArray(r[e])||r[e]instanceof File)&&(r[e]=Object.create(null)),r=r[e])})},s=e=>{let t=e.split(`/`);return t[0]===``&&t.shift(),t},c=e=>{let{groups:t,path:n}=l(e);return u(s(n),t)},l=e=>{let t=[];return e=e.replace(/\{[^}]+\}/g,(e,n)=>{let r=`@${n}`;return t.push([r,e]),r}),{groups:t,path:e}},u=(e,t)=>{for(let n=t.length-1;n>=0;n--){let[r]=t[n];for(let i=e.length-1;i>=0;i--)if(e[i].includes(r)){e[i]=e[i].replace(r,t[n][1]);break}}return e},d={},f=(e,t)=>{if(e===`*`)return`*`;let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let r=`${e}#${t}`;return d[r]||(n[2]?d[r]=t&&t[0]!==`:`&&t[0]!==`*`?[r,n[1],RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],RegExp(`^${n[2]}$`)]:d[r]=[e,n[1],!0]),d[r]}return null},p=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,e=>{try{return t(e)}catch{return e}})}},m=e=>p(e,decodeURI),h=e=>{let t=e.url,n=t.indexOf(`/`,t.indexOf(`:`)+4),r=n;for(;r<t.length;r++){let e=t.charCodeAt(r);if(e===37){let e=t.indexOf(`?`,r),i=t.slice(n,e===-1?void 0:e);return m(i.includes(`%25`)?i.replace(/%25/g,`%2525`):i)}else if(e===63)break}return t.slice(n,r)},g=e=>{let t=h(e);return t.length>1&&t.at(-1)===`/`?t.slice(0,-1):t},_=(e,t,...n)=>(n.length&&(t=_(t,...n)),`${e?.[0]===`/`?``:`/`}${e}${t===`/`?``:`${e?.at(-1)===`/`?``:`/`}${t?.[0]===`/`?t.slice(1):t}`}`),v=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(`:`))return null;let t=e.split(`/`),n=[],r=``;return t.forEach(e=>{if(e!==``&&!/\:/.test(e))r+=`/`+e;else if(/\:/.test(e))if(/\?/.test(e)){n.length===0&&r===``?n.push(`/`):n.push(r);let t=e.replace(`?`,``);r+=`/`+t,n.push(r)}else r+=`/`+e}),n.filter((e,t,n)=>n.indexOf(e)===t)},y=e=>/[%+]/.test(e)?(e.indexOf(`+`)!==-1&&(e=e.replace(/\+/g,` `)),e.indexOf(`%`)===-1?e:p(e,C)):e,b=(e,t,n)=>{let r;if(!n&&t&&!/[%+]/.test(t)){let n=e.indexOf(`?`,8);if(n===-1)return;for(e.startsWith(t,n+1)||(n=e.indexOf(`&${t}`,n+1));n!==-1;){let r=e.charCodeAt(n+t.length+1);if(r===61){let r=n+t.length+2,i=e.indexOf(`&`,r);return y(e.slice(r,i===-1?void 0:i))}else if(r==38||isNaN(r))return``;n=e.indexOf(`&${t}`,n+1)}if(r=/[%+]/.test(e),!r)return}let i={};r??=/[%+]/.test(e);let a=e.indexOf(`?`,8);for(;a!==-1;){let t=e.indexOf(`&`,a+1),o=e.indexOf(`=`,a);o>t&&t!==-1&&(o=-1);let s=e.slice(a+1,o===-1?t===-1?void 0:t:o);if(r&&(s=y(s)),a=t,s===``)continue;let c;o===-1?c=``:(c=e.slice(o+1,t===-1?void 0:t),r&&(c=y(c))),n?(i[s]&&Array.isArray(i[s])||(i[s]=[]),i[s].push(c)):i[s]??=c}return t?i[t]:i},x=b,S=(e,t)=>b(e,t,!0),C=decodeURIComponent,w=e=>p(e,C),T=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t=`/`,n=[[]]){this.raw=e,this.path=t,this.#t=n,this.#e={}}param(e){return e?this.#n(e):this.#r()}#n(e){let t=this.#t[0][this.routeIndex][1][e],n=this.#i(t);return n&&/\%/.test(n)?w(n):n}#r(){let e={},t=Object.keys(this.#t[0][this.routeIndex][1]);for(let n of t){let t=this.#i(this.#t[0][this.routeIndex][1][n]);t!==void 0&&(e[n]=/\%/.test(t)?w(t):t)}return e}#i(e){return this.#t[1]?this.#t[1][e]:e}query(e){return x(this.url,e)}queries(e){return S(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t={};return this.raw.headers.forEach((e,n)=>{t[n]=e}),t}async parseBody(e){return this.bodyCache.parsedBody??=await n(this,e)}#a=e=>{let{bodyCache:t,raw:n}=this,r=t[e];if(r)return r;let i=Object.keys(t)[0];return i?t[i].then(t=>(i===`json`&&(t=JSON.stringify(t)),new Response(t)[e]())):t[e]=n[e]()};json(){return this.#a(`text`).then(e=>JSON.parse(e))}text(){return this.#a(`text`)}arrayBuffer(){return this.#a(`arrayBuffer`)}blob(){return this.#a(`blob`)}formData(){return this.#a(`formData`)}addValidatedData(e,t){this.#e[e]=t}valid(e){return this.#e[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[t](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}},E={Stringify:1,BeforeStream:2,Stream:3},D=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n},O=async(e,t,n,r,i)=>{typeof e==`object`&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let a=e.callbacks;if(!a?.length)return Promise.resolve(e);i?i[0]+=e:i=[e];let o=Promise.all(a.map(e=>e({phase:t,buffer:i,context:r}))).then(e=>Promise.all(e.filter(Boolean).map(e=>O(e,t,!1,r,i))).then(()=>i[0]));return n?D(await o,a):o},k=`text/plain; charset=UTF-8`,A=(e,t)=>({"Content-Type":e,...t}),j=class{#e;#t;env={};#n;finalized=!1;error;#r;#i;#a;#o;#s;#c;#l;#u;#d;constructor(e,t){this.#e=e,t&&(this.#i=t.executionCtx,this.env=t.env,this.#c=t.notFoundHandler,this.#d=t.path,this.#u=t.matchResult)}get req(){return this.#t??=new T(this.#e,this.#d,this.#u),this.#t}get event(){if(this.#i&&`respondWith`in this.#i)return this.#i;throw Error(`This context has no FetchEvent`)}get executionCtx(){if(this.#i)return this.#i;throw Error(`This context has no ExecutionContext`)}get res(){return this.#a||=new Response(null,{headers:this.#l??=new Headers})}set res(e){if(this.#a&&e){e=new Response(e.body,e);for(let[t,n]of this.#a.headers.entries())if(t!==`content-type`)if(t===`set-cookie`){let t=this.#a.headers.getSetCookie();e.headers.delete(`set-cookie`);for(let n of t)e.headers.append(`set-cookie`,n)}else e.headers.set(t,n)}this.#a=e,this.finalized=!0}render=(...e)=>(this.#s??=e=>this.html(e),this.#s(...e));setLayout=e=>this.#o=e;getLayout=()=>this.#o;setRenderer=e=>{this.#s=e};header=(e,t,n)=>{this.finalized&&(this.#a=new Response(this.#a.body,this.#a));let r=this.#a?this.#a.headers:this.#l??=new Headers;t===void 0?r.delete(e):n?.append?r.append(e,t):r.set(e,t)};status=e=>{this.#r=e};set=(e,t)=>{this.#n??=new Map,this.#n.set(e,t)};get=e=>this.#n?this.#n.get(e):void 0;get var(){return this.#n?Object.fromEntries(this.#n):{}}#f(e,t,n){let r=this.#a?new Headers(this.#a.headers):this.#l??new Headers;if(typeof t==`object`&&`headers`in t){let e=t.headers instanceof Headers?t.headers:new Headers(t.headers);for(let[t,n]of e)t.toLowerCase()===`set-cookie`?r.append(t,n):r.set(t,n)}if(n)for(let[e,t]of Object.entries(n))if(typeof t==`string`)r.set(e,t);else{r.delete(e);for(let n of t)r.append(e,n)}let i=typeof t==`number`?t:t?.status??this.#r;return new Response(e,{status:i,headers:r})}newResponse=(...e)=>this.#f(...e);body=(e,t,n)=>this.#f(e,t,n);text=(e,t,n)=>!this.#l&&!this.#r&&!t&&!n&&!this.finalized?new Response(e):this.#f(e,t,A(k,n));json=(e,t,n)=>this.#f(JSON.stringify(e),t,A(`application/json`,n));html=(e,t,n)=>{let r=e=>this.#f(e,t,A(`text/html; charset=UTF-8`,n));return typeof e==`object`?O(e,E.Stringify,!1,{}).then(r):r(e)};redirect=(e,t)=>{let n=String(e);return this.header(`Location`,/[^\x00-\xFF]/.test(n)?encodeURI(n):n),this.newResponse(null,t??302)};notFound=()=>(this.#c??=()=>new Response,this.#c(this))},M=`ALL`,ee=`all`,N=[`get`,`post`,`put`,`delete`,`options`,`patch`],P=`Can not add a route since the matcher is already built.`,F=class extends Error{},I=`__COMPOSED_HANDLER`,L=e=>e.text(`404 Not Found`,404),R=(e,t)=>{if(`getResponse`in e){let n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text(`Internal Server Error`,500)},te=class t{get;post;put;delete;options;patch;all;on;use;router;getPath;_basePath=`/`;#e=`/`;routes=[];constructor(e={}){[...N,ee].forEach(e=>{this[e]=(t,...n)=>(typeof t==`string`?this.#e=t:this.#r(e,this.#e,t),n.forEach(t=>{this.#r(e,this.#e,t)}),this)}),this.on=(e,t,...n)=>{for(let r of[t].flat()){this.#e=r;for(let t of[e].flat())n.map(e=>{this.#r(t.toUpperCase(),this.#e,e)})}return this},this.use=(e,...t)=>(typeof e==`string`?this.#e=e:(this.#e=`*`,t.unshift(e)),t.forEach(e=>{this.#r(M,this.#e,e)}),this);let{strict:t,...n}=e;Object.assign(this,n),this.getPath=t??!0?e.getPath??h:g}#t(){let e=new t({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#n=this.#n,e.routes=this.routes,e}#n=L;errorHandler=R;route(t,n){let r=this.basePath(t);return n.routes.map(t=>{let i;n.errorHandler===R?i=t.handler:(i=async(r,i)=>(await e([],n.errorHandler)(r,()=>t.handler(r,i))).res,i[I]=t.handler),r.#r(t.method,t.path,i)}),this}basePath(e){let t=this.#t();return t._basePath=_(this._basePath,e),t}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#n=e,this);mount(e,t,n){let r,i;n&&(typeof n==`function`?i=n:(i=n.optionHandler,r=n.replaceRequest===!1?e=>e:n.replaceRequest));let a=i?e=>{let t=i(e);return Array.isArray(t)?t:[t]}:e=>{let t;try{t=e.executionCtx}catch{}return[e.env,t]};return r||=(()=>{let t=_(this._basePath,e),n=t===`/`?0:t.length;return e=>{let t=new URL(e.url);return t.pathname=t.pathname.slice(n)||`/`,new Request(t,e)}})(),this.#r(M,_(e,`*`),async(e,n)=>{let i=await t(r(e.req.raw),...a(e));if(i)return i;await n()}),this}#r(e,t,n){e=e.toUpperCase(),t=_(this._basePath,t);let r={basePath:this._basePath,path:t,method:e,handler:n};this.router.add(e,t,[n,r]),this.routes.push(r)}#i(e,t){if(e instanceof Error)return this.errorHandler(e,t);throw e}#a(t,n,r,i){if(i===`HEAD`)return(async()=>new Response(null,await this.#a(t,n,r,`GET`)))();let a=this.getPath(t,{env:r}),o=this.router.match(i,a),s=new j(t,{path:a,matchResult:o,env:r,executionCtx:n,notFoundHandler:this.#n});if(o[0].length===1){let e;try{e=o[0][0][0][0](s,async()=>{s.res=await this.#n(s)})}catch(e){return this.#i(e,s)}return e instanceof Promise?e.then(e=>e||(s.finalized?s.res:this.#n(s))).catch(e=>this.#i(e,s)):e??this.#n(s)}let c=e(o[0],this.errorHandler,this.#n);return(async()=>{try{let e=await c(s);if(!e.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return e.res}catch(e){return this.#i(e,s)}})()}fetch=(e,...t)=>this.#a(e,t[1],t[0],e.method);request=(e,t,n,r)=>e instanceof Request?this.fetch(t?new Request(e,t):e,n,r):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${_(`/`,e)}`,t),n,r));fire=()=>{addEventListener(`fetch`,e=>{e.respondWith(this.#a(e.request,e,void 0,e.request.method))})}},z=[];function B(e,t){let n=this.buildAllMatchers(),r=((e,t)=>{let r=n[e]||n[M],i=r[2][t];if(i)return i;let a=t.match(r[0]);if(!a)return[[],z];let o=a.indexOf(``,1);return[r[1][o],a]});return this.match=r,r(e,t)}var V=`[^/]+`,H=`.*`,U=`(?:|/.*)`,W=Symbol(),G=new Set(`.\\+*[^]$()`);function K(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1||e===H||e===U?1:t===H||t===U?-1:e===V?1:t===V?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var q=class e{#e;#t;#n=Object.create(null);insert(t,n,r,i,a){if(t.length===0){if(this.#e!==void 0)throw W;if(a)return;this.#e=n;return}let[o,...s]=t,c=o===`*`?s.length===0?[``,``,H]:[``,``,V]:o===`/*`?[``,``,U]:o.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),l;if(c){let t=c[1],n=c[2]||V;if(t&&c[2]&&(n===`.*`||(n=n.replace(/^\((?!\?:)(?=[^)]+\)$)/,`(?:`),/\((?!\?:)/.test(n))))throw W;if(l=this.#n[n],!l){if(Object.keys(this.#n).some(e=>e!==H&&e!==U))throw W;if(a)return;l=this.#n[n]=new e,t!==``&&(l.#t=i.varIndex++)}!a&&t!==``&&r.push([t,l.#t])}else if(l=this.#n[o],!l){if(Object.keys(this.#n).some(e=>e.length>1&&e!==H&&e!==U))throw W;if(a)return;l=this.#n[o]=new e}l.insert(s,n,r,i,a)}buildRegExpStr(){let e=Object.keys(this.#n).sort(K).map(e=>{let t=this.#n[e];return(typeof t.#t==`number`?`(${e})@${t.#t}`:G.has(e)?`\\${e}`:e)+t.buildRegExpStr()});return typeof this.#e==`number`&&e.unshift(`#${this.#e}`),e.length===0?``:e.length===1?e[0]:`(?:`+e.join(`|`)+`)`}},J=class{#e={varIndex:0};#t=new q;insert(e,t,n){let r=[],i=[];for(let t=0;;){let n=!1;if(e=e.replace(/\{[^}]+\}/g,e=>{let r=`@\\${t}`;return i[t]=[r,e],t++,n=!0,r}),!n)break}let a=e.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let e=i.length-1;e>=0;e--){let[t]=i[e];for(let n=a.length-1;n>=0;n--)if(a[n].indexOf(t)!==-1){a[n]=a[n].replace(t,i[e][1]);break}}return this.#t.insert(a,t,r,this.#e,n),r}buildRegExp(){let e=this.#t.buildRegExpStr();if(e===``)return[/^$/,[],[]];let t=0,n=[],r=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(e,i,a)=>i===void 0?(a===void 0||(r[Number(a)]=++t),``):(n[++t]=Number(i),`$()`)),[RegExp(`^${e}`),n,r]}},Y=[/^$/,[],Object.create(null)],X=Object.create(null);function Z(e){return X[e]??=RegExp(e===`*`?``:`^${e.replace(/\/\*$|([.\\+*[^\]$()])/g,(e,t)=>t?`\\${t}`:`(?:|/.*)`)}$`)}function ne(){X=Object.create(null)}function re(e){let t=new J,n=[];if(e.length===0)return Y;let r=e.map(e=>[!/\*|\/:/.test(e[0]),...e]).sort(([e,t],[n,r])=>e?1:n?-1:t.length-r.length),i=Object.create(null);for(let e=0,a=-1,o=r.length;e<o;e++){let[o,s,c]=r[e];o?i[s]=[c.map(([e])=>[e,Object.create(null)]),z]:a++;let l;try{l=t.insert(s,a,o)}catch(e){throw e===W?new F(s):e}o||(n[a]=c.map(([e,t])=>{let n=Object.create(null);for(--t;t>=0;t--){let[e,r]=l[t];n[e]=r}return[e,n]}))}let[a,o,s]=t.buildRegExp();for(let e=0,t=n.length;e<t;e++)for(let t=0,r=n[e].length;t<r;t++){let r=n[e][t]?.[1];if(!r)continue;let i=Object.keys(r);for(let e=0,t=i.length;e<t;e++)r[i[e]]=s[r[i[e]]]}let c=[];for(let e in o)c[e]=n[o[e]];return[a,c,i]}function Q(e,t){if(e){for(let n of Object.keys(e).sort((e,t)=>t.length-e.length))if(Z(n).test(t))return[...e[n]]}}var ie=class{name=`RegExpRouter`;#e;#t;constructor(){this.#e={[M]:Object.create(null)},this.#t={[M]:Object.create(null)}}add(e,t,n){let r=this.#e,i=this.#t;if(!r||!i)throw Error(P);r[e]||[r,i].forEach(t=>{t[e]=Object.create(null),Object.keys(t[M]).forEach(n=>{t[e][n]=[...t[M][n]]})}),t===`/*`&&(t=`*`);let a=(t.match(/\/:/g)||[]).length;if(/\*$/.test(t)){let o=Z(t);e===M?Object.keys(r).forEach(e=>{r[e][t]||=Q(r[e],t)||Q(r[M],t)||[]}):r[e][t]||=Q(r[e],t)||Q(r[M],t)||[],Object.keys(r).forEach(t=>{(e===M||e===t)&&Object.keys(r[t]).forEach(e=>{o.test(e)&&r[t][e].push([n,a])})}),Object.keys(i).forEach(t=>{(e===M||e===t)&&Object.keys(i[t]).forEach(e=>o.test(e)&&i[t][e].push([n,a]))});return}let o=v(t)||[t];for(let t=0,s=o.length;t<s;t++){let c=o[t];Object.keys(i).forEach(o=>{(e===M||e===o)&&(i[o][c]||=[...Q(r[o],c)||Q(r[M],c)||[]],i[o][c].push([n,a-s+t+1]))})}}match=B;buildAllMatchers(){let e=Object.create(null);return Object.keys(this.#t).concat(Object.keys(this.#e)).forEach(t=>{e[t]||=this.#n(t)}),this.#e=this.#t=void 0,ne(),e}#n(e){let t=[],n=e===M;return[this.#e,this.#t].forEach(r=>{let i=r[e]?Object.keys(r[e]).map(t=>[t,r[e][t]]):[];i.length===0?e!==M&&t.push(...Object.keys(r[M]).map(e=>[e,r[M][e]])):(n||=!0,t.push(...i))}),n?re(t):null}},ae=class{name=`SmartRouter`;#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,n){if(!this.#t)throw Error(P);this.#t.push([e,t,n])}match(e,t){if(!this.#t)throw Error(`Fatal error`);let n=this.#e,r=this.#t,i=n.length,a=0,o;for(;a<i;a++){let i=n[a];try{for(let e=0,t=r.length;e<t;e++)i.add(...r[e]);o=i.match(e,t)}catch(e){if(e instanceof F)continue;throw e}this.match=i.match.bind(i),this.#e=[i],this.#t=void 0;break}if(a===i)throw Error(`Fatal error`);return this.name=`SmartRouter + ${this.activeRouter.name}`,o}get activeRouter(){if(this.#t||this.#e.length!==1)throw Error(`No active router has been determined yet.`);return this.#e[0]}},$=Object.create(null),oe=class e{#e;#t;#n;#r=0;#i=$;constructor(e,t,n){if(this.#t=n||Object.create(null),this.#e=[],e&&t){let n=Object.create(null);n[e]={handler:t,possibleKeys:[],score:0},this.#e=[n]}this.#n=[]}insert(t,n,r){this.#r=++this.#r;let i=this,a=c(n),o=[];for(let t=0,n=a.length;t<n;t++){let n=a[t],r=a[t+1],s=f(n,r),c=Array.isArray(s)?s[0]:n;if(c in i.#t){i=i.#t[c],s&&o.push(s[1]);continue}i.#t[c]=new e,s&&(i.#n.push(s),o.push(s[1])),i=i.#t[c]}return i.#e.push({[t]:{handler:r,possibleKeys:o.filter((e,t,n)=>n.indexOf(e)===t),score:this.#r}}),i}#a(e,t,n,r){let i=[];for(let a=0,o=e.#e.length;a<o;a++){let o=e.#e[a],s=o[t]||o[M],c={};if(s!==void 0&&(s.params=Object.create(null),i.push(s),n!==$||r&&r!==$))for(let e=0,t=s.possibleKeys.length;e<t;e++){let t=s.possibleKeys[e],i=c[s.score];s.params[t]=r?.[t]&&!i?r[t]:n[t]??r?.[t],c[s.score]=!0}}return i}search(e,t){let n=[];this.#i=$;let r=[this],i=s(t),a=[];for(let t=0,o=i.length;t<o;t++){let s=i[t],c=t===o-1,l=[];for(let o=0,u=r.length;o<u;o++){let u=r[o],d=u.#t[s];d&&(d.#i=u.#i,c?(d.#t[`*`]&&n.push(...this.#a(d.#t[`*`],e,u.#i)),n.push(...this.#a(d,e,u.#i))):l.push(d));for(let r=0,o=u.#n.length;r<o;r++){let o=u.#n[r],d=u.#i===$?{}:{...u.#i};if(o===`*`){let t=u.#t[`*`];t&&(n.push(...this.#a(t,e,u.#i)),t.#i=d,l.push(t));continue}let[f,p,m]=o;if(!s&&!(m instanceof RegExp))continue;let h=u.#t[f],g=i.slice(t).join(`/`);if(m instanceof RegExp){let t=m.exec(g);if(t){if(d[p]=t[0],n.push(...this.#a(h,e,u.#i,d)),Object.keys(h.#t).length){h.#i=d;let e=t[0].match(/\//)?.length??0;(a[e]||=[]).push(h)}continue}}(m===!0||m.test(s))&&(d[p]=s,c?(n.push(...this.#a(h,e,d,u.#i)),h.#t[`*`]&&n.push(...this.#a(h.#t[`*`],e,d,u.#i))):(h.#i=d,l.push(h)))}}r=l.concat(a.shift()??[])}return n.length>1&&n.sort((e,t)=>e.score-t.score),[n.map(({handler:e,params:t})=>[e,t])]}},se=class{name=`TrieRouter`;#e;constructor(){this.#e=new oe}add(e,t,n){let r=v(t);if(r){for(let t=0,i=r.length;t<i;t++)this.#e.insert(e,r[t],n);return}this.#e.insert(e,t,n)}match(e,t){return this.#e.search(e,t)}},ce=class extends te{constructor(e={}){super(e),this.router=e.router??new ae({routers:[new ie,new se]})}},le=e=>{let t={origin:`*`,allowMethods:[`GET`,`HEAD`,`PUT`,`POST`,`DELETE`,`PATCH`],allowHeaders:[],exposeHeaders:[],...e},n=(e=>typeof e==`string`?e===`*`?()=>e:t=>e===t?t:null:typeof e==`function`?e:t=>e.includes(t)?t:null)(t.origin),r=(e=>typeof e==`function`?e:Array.isArray(e)?()=>e:()=>[])(t.allowMethods);return async function(e,i){function a(t,n){e.res.headers.set(t,n)}let o=await n(e.req.header(`origin`)||``,e);if(o&&a(`Access-Control-Allow-Origin`,o),t.credentials&&a(`Access-Control-Allow-Credentials`,`true`),t.exposeHeaders?.length&&a(`Access-Control-Expose-Headers`,t.exposeHeaders.join(`,`)),e.req.method===`OPTIONS`){t.origin!==`*`&&a(`Vary`,`Origin`),t.maxAge!=null&&a(`Access-Control-Max-Age`,t.maxAge.toString());let n=await r(e.req.header(`origin`)||``,e);n.length&&a(`Access-Control-Allow-Methods`,n.join(`,`));let i=t.allowHeaders;if(!i?.length){let t=e.req.header(`Access-Control-Request-Headers`);t&&(i=t.split(/\s*,\s*/))}return i?.length&&(a(`Access-Control-Allow-Headers`,i.join(`,`)),e.res.headers.append(`Vary`,`Access-Control-Request-Headers`)),e.res.headers.delete(`Content-Length`),e.res.headers.delete(`Content-Type`),new Response(null,{headers:e.res.headers,status:204,statusText:`No Content`})}await i(),t.origin!==`*`&&e.header(`Vary`,`Origin`,{append:!0})}};export{ce as n,le as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{webcrypto as e}from"node:crypto";let t,n;function r(r){!t||t.length<r?(t=Buffer.allocUnsafe(r*128),e.getRandomValues(t),n=0):n+r>t.length&&(e.getRandomValues(t),n=0),n+=r}function i(e=21){r(e|=0);let i=``;for(let r=n-e;r<n;r++)i+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[t[r]&63];return i}export{i as t};
|