Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elysiajs/eden

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elysiajs/eden - npm Package Compare versions

Comparing version 1.1.0-exp.1 to 1.1.0-rc.0

dist/chunk-2IHGLN7W.mjs

2

dist/fetch.d.ts
import { Elysia } from 'elysia';
import { T as TreatyToPath, I as IsNever, a as IsUnknown, P as Prettify, M as MapError, E as EdenFetchError } from './types-DcP_1Cpm.js';
import { T as TreatyToPath, a as IsNever, I as IsUnknown, P as Prettify, M as MapError, E as EdenFetchError } from './types-DNydNaKe.js';

@@ -4,0 +4,0 @@ declare namespace EdenFetch {

@@ -1,1 +0,1 @@

"use strict";var Eden=(()=>{var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var s in r)p(t,s,{get:r[s],enumerable:!0})},N=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of A(r))!x.call(t,a)&&a!==s&&p(t,a,{get:()=>r[a],enumerable:!(o=k(r,a))||o.enumerable});return t};var F=t=>N(p({},"__esModule",{value:!0}),t);var C={};T(C,{edenFetch:()=>O});var d=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var u=class extends Error{constructor(s,o){super(o+"");this.status=s;this.value=o}};var m=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,w=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,b=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;var O=(t,r)=>(s,{query:o,params:a,body:l,...f}={})=>{a&&Object.entries(a).forEach(([e,i])=>{s=s.replace(`:${e}`,i)});let h=f.headers?.["Content-Type"];if(!h||h==="application/json")try{l=JSON.stringify(l)}catch{}let S=r?.fetcher||globalThis.fetch,E=o?`?${new URLSearchParams(o).toString()}`:"",y=()=>S(t+s+E,{...f,method:f.method?.toUpperCase()||"GET",headers:l?{"content-type":"application/json",...f.headers}:f.headers,body:l}).then(async e=>{let i;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":i=await e.json();break;case"application/octet-stream":i=await e.arrayBuffer();break;case"multipart/form-data":let v=await e.formData();i={},v.forEach((n,c)=>{i[c]=n});break;default:i=await e.text().then(n=>{if(d(n))return+n;if(n==="true")return!0;if(n==="false")return!1;if(!n)return n;let c=n.replace(/"/g,"");if(m.test(c)||w.test(c)||b.test(c)){let g=new Date(c);if(!Number.isNaN(g.getTime()))return g}return n})}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:y,error:new u(e.status,i)}:{data:i,error:null,status:e.status,headers:e.headers,retry:y}});return y()};return F(C);})();
"use strict";var Eden=(()=>{var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)d(t,r,{get:e[r],enumerable:!0})},F=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!N.call(t,s)&&s!==r&&d(t,s,{get:()=>e[s],enumerable:!(n=T(e,s))||n.enumerable});return t};var j=t=>F(d({},"__esModule",{value:!0}),t);var V={};b(V,{edenFetch:()=>R});var o=class extends Error{constructor(r,n){super(n+"");this.status=r;this.value=n}};var w=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,A=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,C=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,D=t=>t.trim().length!==0&&!Number.isNaN(Number(t)),f=t=>{if(typeof t!="string")return null;let e=t.replace(/"/g,"");if(w.test(e)||A.test(e)||C.test(e)){let r=new Date(e);if(!Number.isNaN(r.getTime()))return r}return null},M=t=>{let e=t.charCodeAt(0),r=t.charCodeAt(t.length-1);return e===123&&r===125||e===91&&r===93},O=t=>JSON.parse(t,(e,r)=>{let n=f(r);return n||r}),h=t=>{if(!t)return t;if(D(t))return+t;if(t==="true")return!0;if(t==="false")return!1;let e=f(t);if(e)return e;if(M(t))try{return O(t)}catch{}return t};var $=async t=>{switch(t.headers.get("Content-Type")?.split(";")[0]){case"application/json":return t.json();case"application/octet-stream":return t.arrayBuffer();case"multipart/form-data":{let r=await t.formData(),n={};return r.forEach((s,a)=>{n[a]=s}),n}}return t.text().then(h)},J=async(t,e)=>{let r=await $(t);return t.status>300?{data:null,status:t.status,headers:t.headers,retry:e,error:new o(t.status,r)}:{data:r,error:null,status:t.status,headers:t.headers,retry:e}},R=(t,e)=>(r,{query:n,params:s,body:a,...c}={})=>{s&&Object.entries(s).forEach(([i,x])=>{r=r.replace(`:${i}`,x)});let u=c.headers?.["Content-Type"];if(!u||u==="application/json")try{a=JSON.stringify(a)}catch{}let y=e?.fetcher||globalThis.fetch,g=n?`?${new URLSearchParams(n).toString()}`:"",l=`${t}${r}${g}`,m=a?{"content-type":"application/json",...c.headers}:c.headers,S={...c,method:c.method?.toUpperCase()||"GET",headers:m,body:a},p=()=>y(l,S).then(i=>J(i,p));return p()};return j(V);})();

@@ -1,1 +0,1 @@

"use strict";var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var s in r)p(t,s,{get:r[s],enumerable:!0})},N=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of A(r))!x.call(t,a)&&a!==s&&p(t,a,{get:()=>r[a],enumerable:!(o=k(r,a))||o.enumerable});return t};var F=t=>N(p({},"__esModule",{value:!0}),t);var C={};T(C,{edenFetch:()=>O});module.exports=F(C);var d=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var u=class extends Error{constructor(s,o){super(o+"");this.status=s;this.value=o}};var m=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,w=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,b=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;var O=(t,r)=>(s,{query:o,params:a,body:l,...f}={})=>{a&&Object.entries(a).forEach(([e,i])=>{s=s.replace(`:${e}`,i)});let h=f.headers?.["Content-Type"];if(!h||h==="application/json")try{l=JSON.stringify(l)}catch{}let S=r?.fetcher||globalThis.fetch,E=o?`?${new URLSearchParams(o).toString()}`:"",y=()=>S(t+s+E,{...f,method:f.method?.toUpperCase()||"GET",headers:l?{"content-type":"application/json",...f.headers}:f.headers,body:l}).then(async e=>{let i;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":i=await e.json();break;case"application/octet-stream":i=await e.arrayBuffer();break;case"multipart/form-data":let v=await e.formData();i={},v.forEach((n,c)=>{i[c]=n});break;default:i=await e.text().then(n=>{if(d(n))return+n;if(n==="true")return!0;if(n==="false")return!1;if(!n)return n;let c=n.replace(/"/g,"");if(m.test(c)||w.test(c)||b.test(c)){let g=new Date(c);if(!Number.isNaN(g.getTime()))return g}return n})}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:y,error:new u(e.status,i)}:{data:i,error:null,status:e.status,headers:e.headers,retry:y}});return y()};0&&(module.exports={edenFetch});
"use strict";var d=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)d(t,r,{get:e[r],enumerable:!0})},F=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!N.call(t,s)&&s!==r&&d(t,s,{get:()=>e[s],enumerable:!(n=T(e,s))||n.enumerable});return t};var j=t=>F(d({},"__esModule",{value:!0}),t);var V={};b(V,{edenFetch:()=>R});module.exports=j(V);var o=class extends Error{constructor(r,n){super(n+"");this.status=r;this.value=n}};var w=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,A=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,C=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,D=t=>t.trim().length!==0&&!Number.isNaN(Number(t)),f=t=>{if(typeof t!="string")return null;let e=t.replace(/"/g,"");if(w.test(e)||A.test(e)||C.test(e)){let r=new Date(e);if(!Number.isNaN(r.getTime()))return r}return null},M=t=>{let e=t.charCodeAt(0),r=t.charCodeAt(t.length-1);return e===123&&r===125||e===91&&r===93},O=t=>JSON.parse(t,(e,r)=>{let n=f(r);return n||r}),h=t=>{if(!t)return t;if(D(t))return+t;if(t==="true")return!0;if(t==="false")return!1;let e=f(t);if(e)return e;if(M(t))try{return O(t)}catch{}return t};var $=async t=>{switch(t.headers.get("Content-Type")?.split(";")[0]){case"application/json":return t.json();case"application/octet-stream":return t.arrayBuffer();case"multipart/form-data":{let r=await t.formData(),n={};return r.forEach((s,a)=>{n[a]=s}),n}}return t.text().then(h)},J=async(t,e)=>{let r=await $(t);return t.status>300?{data:null,status:t.status,headers:t.headers,retry:e,error:new o(t.status,r)}:{data:r,error:null,status:t.status,headers:t.headers,retry:e}},R=(t,e)=>(r,{query:n,params:s,body:a,...c}={})=>{s&&Object.entries(s).forEach(([i,x])=>{r=r.replace(`:${i}`,x)});let u=c.headers?.["Content-Type"];if(!u||u==="application/json")try{a=JSON.stringify(a)}catch{}let y=e?.fetcher||globalThis.fetch,g=n?`?${new URLSearchParams(n).toString()}`:"",l=`${t}${r}${g}`,m=a?{"content-type":"application/json",...c.headers}:c.headers,S={...c,method:c.method?.toUpperCase()||"GET",headers:m,body:a},p=()=>y(l,S).then(i=>J(i,p));return p()};0&&(module.exports={edenFetch});

@@ -1,105 +0,5 @@

import { InputSchema, Elysia } from 'elysia';
import { P as Prettify, I as IsNever } from './types-DcP_1Cpm.js';
export { Treaty, treaty } from './treaty2.js';
export { edenTreaty } from './treaty.js';
export { edenFetch } from './fetch.js';
declare class EdenWS<in out Schema extends InputSchema<any> = {}> {
url: string;
ws: WebSocket;
constructor(url: string);
send(data: Schema['body'] | Schema['body'][]): this;
on<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
off<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
subscribe(onMessage: (event: Treaty.WSEvent<'message', Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
close(): this;
}
/// <reference lib="dom" />
type Files = File | FileList;
type ReplaceBlobWithFiles<in out RecordType extends Record<string, unknown>> = {
[K in keyof RecordType]: RecordType[K] extends Blob | Blob[] ? Files : RecordType[K];
} & {};
type ReplaceGeneratorWithAsyncGenerator<in out RecordType extends Record<string, unknown>> = {
[K in keyof RecordType]: RecordType[K] extends Generator<infer A, infer B, infer C> ? AsyncGenerator<A, B, C> : RecordType[K];
} & {};
type MaybeArray<T> = T | T[];
type MaybePromise<T> = T | Promise<T>;
declare namespace Treaty {
interface TreatyParam {
fetch?: RequestInit;
}
export type Create<App extends Elysia<any, any, any, any, any, any, any, any>> = App extends {
_routes: infer Schema extends Record<string, any>;
} ? Prettify<Sign<Schema>> : 'Please install Elysia before using Eden';
export type Sign<in out Route extends Record<string, any>> = {
[K in keyof Route as K extends `:${string}` ? never : K]: K extends 'subscribe' ? (undefined extends Route['subscribe']['headers'] ? {
headers?: Record<string, unknown>;
} : {
headers: Route['subscribe']['headers'];
}) & (undefined extends Route['subscribe']['query'] ? {
query?: Record<string, unknown>;
} : {
query: Route['subscribe']['query'];
}) extends infer Param ? {} extends Param ? (options?: Param) => EdenWS<Route['subscribe']> : (options?: Param) => EdenWS<Route['subscribe']> : never : Route[K] extends {
body: infer Body;
headers: infer Headers;
params: any;
query: infer Query;
response: infer Response extends Record<number, unknown>;
} ? (undefined extends Headers ? {
headers?: Record<string, unknown>;
} : {
headers: Headers;
}) & (undefined extends Query ? {
query?: Record<string, unknown>;
} : {
query: Query;
}) extends infer Param ? {} extends Param ? undefined extends Body ? K extends 'get' | 'head' ? (options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : (body?: Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : K extends 'get' | 'head' ? (options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : never : CreateParams<Route[K]>;
};
type CreateParams<Route extends Record<string, any>> = Extract<keyof Route, `:${string}`> extends infer Path extends string ? IsNever<Path> extends true ? Prettify<Sign<Route>> : // ! DO NOT USE PRETTIFY ON THIS LINE, OTHERWISE FUNCTION CALLING WILL BE OMITTED
((params: {
[param in Path extends `:${infer Param}` ? Param : never]: string | number;
}) => Prettify<Sign<Route[Path]>> & CreateParams<Route[Path]>) & Prettify<Sign<Route>> : never;
export interface Config {
fetch?: Omit<RequestInit, 'headers' | 'method'>;
fetcher?: typeof fetch;
headers?: MaybeArray<RequestInit['headers'] | ((path: string, options: RequestInit) => RequestInit['headers'] | void)>;
onRequest?: MaybeArray<(path: string, options: FetchRequestInit) => MaybePromise<FetchRequestInit | void>>;
onResponse?: MaybeArray<(response: Response) => MaybePromise<unknown>>;
keepDomain?: boolean;
}
type TreatyResponse<_Res extends Record<number, unknown>, Res extends Record<number, unknown> = ReplaceGeneratorWithAsyncGenerator<_Res>> = {
data: Res[200];
error: null;
response: Response;
status: number;
headers: FetchRequestInit['headers'];
} | {
data: null;
error: Exclude<keyof Res, 200> extends never ? {
status: unknown;
value: unknown;
} : {
[Status in keyof Res]: {
status: Status;
value: Res[Status];
};
}[Exclude<keyof Res, 200>];
response: Response;
status: number;
headers: FetchRequestInit['headers'];
};
export interface OnMessage<Data = unknown> extends MessageEvent {
data: Data;
rawData: MessageEvent['data'];
}
export type WSEvent<K extends keyof WebSocketEventMap, Data = unknown> = K extends 'message' ? OnMessage<Data> : WebSocketEventMap[K];
export { };
}
declare const treaty: <const App extends Elysia<any, any, any, any, any, any, any, any>>(domain: string | App, config?: Treaty.Config) => Treaty.Create<App>;
export { treaty };
import 'elysia';
import './types-DNydNaKe.js';

@@ -1,1 +0,1 @@

"use strict";var Eden=(()=>{var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},ce=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!ie.call(t,o)&&o!==r&&U(t,o,{get:()=>e[o],enumerable:!(s=se(e,o))||s.enumerable});return t};var fe=t=>ce(U({},"__esModule",{value:!0}),t);var pe={};oe(pe,{edenFetch:()=>ne,edenTreaty:()=>re,treaty:()=>Y});var V=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let s="";for(let[o,n]of Object.entries(r))s+=`${o}=${n}&`;return`${t}${e}?${s.slice(0,-1)}`},R=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var L=class extends Error{constructor(r,s){super(s+"");this.status=r;this.value=s}};var z=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,D=class{constructor(e){this.url=e;this.ws=new WebSocket(e)}ws;send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0),y=n.charCodeAt(n.length-1);if(a===91||a===123)try{n=JSON.parse(n,(T,p)=>{if(typeof p=="string"&&z.test(p)){let m=new Date(p);if(!Number.isNaN(m.getTime()))return m}return p})}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"?n=!1:n==="null"?n=null:a===34&&y===34&&z.test(n)&&(n=new Date(n.substring(1,n.length-1)));r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}};var ye=["get","post","put","delete","patch","options","head","connect","subscribe"],X=["localhost","127.0.0.1","0.0.0.0"],H=typeof FileList>"u",I=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,P=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,q=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,Q=t=>H?t instanceof Blob:t instanceof FileList||t instanceof File,ue=t=>{if(!t)return!1;for(let e in t)if(Q(t[e])||Array.isArray(t[e])&&t[e].find(Q))return!0;return!1},B=t=>H?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),j=(t,e,r={},s={})=>{if(Array.isArray(t)){for(let o of t)if(!Array.isArray(o))s=j(o,e,r,s);else{let n=o[0];if(typeof n=="string")s[n.toLowerCase()]=o[1];else for(let[a,y]of n)s[a.toLowerCase()]=y}return s}if(!t)return s;switch(typeof t){case"function":if(t instanceof Headers)return j(t,e,r,s);let o=t(e,r);return o?j(o,e,r,s):s;case"object":if(t instanceof Headers)return t.forEach((n,a)=>{s[a.toLowerCase()]=n}),s;for(let[n,a]of Object.entries(t))s[n.toLowerCase()]=a;default:return s}};async function*le(t){let e=t.body;if(!e)return;let r=e.getReader(),s=new TextDecoder;try{for(;;){let{done:o,value:n}=await r.read();if(o)break;let a=s.decode(n);if(R(a)){yield+a;continue}if(a==="true"){yield!0;continue}if(a==="false"){yield!1;continue}let y=a.charCodeAt(0),T=a.charCodeAt(a.length-1);if(y===123&&T===125||y===91&&T===93)try{yield JSON.parse(a);continue}catch{}let p=a.replace(/"/g,"");if(I.test(p)||P.test(p)||q.test(p)){let m=new Date(p);Number.isNaN(m.getTime())||(yield m);continue}yield a}}finally{r.releaseLock()}}var $=(t,e,r=[],s)=>new Proxy(()=>{},{get(o,n){return $(t,e,n==="index"?r:[...r,n],s)},apply(o,n,[a,y]){if(!a||y||typeof a=="object"&&Object.keys(a).length!==1||ye.includes(r.at(-1))){let T=[...r],p=T.pop(),m="/"+T.join("/"),{fetcher:l=fetch,headers:w,onRequest:E,onResponse:h,fetch:v}=e,A=p==="get"||p==="head"||p==="subscribe";w=j(w,m,y);let K=A?a?.query:y?.query,k="";if(K){let c=(N,F)=>{k+=(k?"&":"?")+`${encodeURIComponent(N)}=${encodeURIComponent(F)}`};for(let[N,F]of Object.entries(K)){if(Array.isArray(F)){for(let f of F)c(N,f);continue}c(N,`${F}`)}}if(p==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||X.find(N=>t.includes(N))?"ws://":"wss://")+m+k;return new D(c)}return(async()=>{let c={method:p?.toUpperCase(),body:a,...v,headers:w};c.headers={...w,...j(A?a?.headers:y?.headers,m,c)};let N=A&&typeof a=="object"?a.fetch:y?.fetch;if(c={...c,...N},A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...j(i.headers,m,c)}})}}if(A&&delete c.body,ue(a)){let g=new FormData;for(let[i,d]of Object.entries(c.body)){if(H){g.append(i,d);continue}if(d instanceof File){g.append(i,await B(d));continue}if(d instanceof FileList){for(let u=0;u<d.length;u++)g.append(i,await B(d[u]));continue}if(Array.isArray(d)){for(let u=0;u<d.length;u++){let x=d[u];g.append(i,x instanceof File?await B(x):x)}continue}g.append(i,d)}c.body=g}else typeof a=="object"?(c.headers["content-type"]="application/json",c.body=JSON.stringify(a)):a!=null&&(c.headers["content-type"]="text/plain");if(A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...i.headers}})}}let F=t+m+k,f=await(s?.handle(new Request(F,c))??l(F,c)),S=null,b=null;if(h){Array.isArray(h)||(h=[h]);for(let g of h)try{let i=await g(f.clone());if(i!=null){S=i;break}}catch(i){i instanceof L?b=i:b=new L(422,i);break}}if(S===null){switch(f.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":S=le(f);break;case"application/json":S=await f.json();break;case"application/octet-stream":S=await f.arrayBuffer();break;case"multipart/form-data":let g=await f.formData();S={},g.forEach((i,d)=>{S[d]=i});break;default:S=await f.text().then(i=>{if(R(i))return+i;if(i==="true")return!0;if(i==="false")return!1;if(!i)return i;let d=i.replace(/"/g,"");if(I.test(d)||P.test(d)||q.test(d)){let u=new Date(d);if(!Number.isNaN(u.getTime()))return u}return i})}(f.status>=300||f.status<200)&&(b=new L(f.status,S),S=null)}return{data:S,error:b,response:f,status:f.status,headers:f.headers}})()}return typeof a=="object"?$(t,e,[...r,Object.values(a)[0]],s):$(t,e,r)}}),Y=(t,e={})=>typeof t=="string"?(e.keepDomain||(t.includes("://")||(t=(X.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1))),$(t,e)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),$("http://e.ly",e,[],t));var Z=typeof FileList>"u",ee=t=>Z?t instanceof Blob:t instanceof FileList||t instanceof File,de=t=>{if(!t)return!1;for(let e in t){if(ee(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>ee(r)))return!0}return!1},_=t=>Z?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),G=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0);if(a===47||a===123)try{n=JSON.parse(n)}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}},te=(t,e="",r)=>new Proxy(()=>{},{get(s,o,n){return te(t,`${e}/${o.toString()}`,r)},apply(s,o,[n,a={}]=[{},{}]){let y=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:T,$fetch:p,$headers:m,$transform:l,getRaw:w,...E}=n??{};y??=E;let h=e.lastIndexOf("/"),v=e.slice(h+1).toUpperCase(),A=V(t,h===-1?"/":e.slice(0,h),Object.assign(a.query??{},T)),K=r.fetcher??fetch,k=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,c=l?Array.isArray(l)?l:[l]:void 0;return c&&(k?k=c.concat(k):k=c),v==="SUBSCRIBE"?new G(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async F=>{let f,S={...r.$fetch?.headers,...p?.headers,...a.headers,...m};if(v!=="GET"&&v!=="HEAD"){f=Object.keys(y).length||Array.isArray(y)?y:void 0;let u=f&&(typeof f=="object"||Array.isArray(y));if(u&&de(f)){let C=new FormData;for(let[M,O]of Object.entries(f))if(Z)C.append(M,O);else if(O instanceof File)C.append(M,await _(O));else if(O instanceof FileList)for(let W=0;W<O.length;W++)C.append(M,await _(O[W]));else if(Array.isArray(O))for(let W=0;W<O.length;W++){let J=O[W];C.append(M,J instanceof File?await _(J):J)}else C.append(M,O);f=C}else f!=null&&(S["content-type"]=u?"application/json":"text/plain",f=u?JSON.stringify(f):y)}let b=await K(A,{method:v,body:f,...r.$fetch,...a.fetch,...p,headers:S}),g;if(F.getRaw)return b;switch(b.headers.get("Content-Type")?.split(";")[0]){case"application/json":g=await b.json();break;default:g=await b.text().then(u=>R(u)?+u:u==="true"?!0:u==="false"?!1:u)}let i=b.status>=300||b.status<200?new L(b.status,g):null,d={data:g,error:i,response:b,status:b.status,headers:b.headers};if(k)for(let u of k){let x=u(d);x instanceof Promise&&(x=await x),x!=null&&(d=x)}return d})({getRaw:w})}}),re=(t,e={fetcher:fetch})=>new Proxy({},{get(r,s){return te(t,s,e)}});var ne=(t,e)=>(r,{query:s,params:o,body:n,...a}={})=>{o&&Object.entries(o).forEach(([l,w])=>{r=r.replace(`:${l}`,w)});let y=a.headers?.["Content-Type"];if(!y||y==="application/json")try{n=JSON.stringify(n)}catch{}let T=e?.fetcher||globalThis.fetch,p=s?`?${new URLSearchParams(s).toString()}`:"",m=()=>T(t+r+p,{...a,method:a.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...a.headers}:a.headers,body:n}).then(async l=>{let w;switch(l.headers.get("Content-Type")?.split(";")[0]){case"application/json":w=await l.json();break;case"application/octet-stream":w=await l.arrayBuffer();break;case"multipart/form-data":let E=await l.formData();w={},E.forEach((h,v)=>{w[v]=h});break;default:w=await l.text().then(h=>{if(R(h))return+h;if(h==="true")return!0;if(h==="false")return!1;if(!h)return h;let v=h.replace(/"/g,"");if(I.test(v)||P.test(v)||q.test(v)){let A=new Date(v);if(!Number.isNaN(A.getTime()))return A}return h})}return l.status>300?{data:null,status:l.status,headers:l.headers,retry:m,error:new L(l.status,w)}:{data:w,error:null,status:l.status,headers:l.headers,retry:m}});return m()};return fe(pe);})();
"use strict";var Eden=(()=>{var P=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var ae=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ie=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of re(t))!se.call(e,s)&&s!==n&&P(e,s,{get:()=>t[s],enumerable:!(r=ne(t,s))||r.enumerable});return e};var oe=e=>ie(P({},"__esModule",{value:!0}),e);var be={};ae(be,{edenFetch:()=>te,edenTreaty:()=>ee,treaty:()=>z});var k=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var ce=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,fe=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,de=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,ye=e=>e.trim().length!==0&&!Number.isNaN(Number(e)),_=e=>{if(typeof e!="string")return null;let t=e.replace(/"/g,"");if(ce.test(t)||fe.test(t)||de.test(t)){let n=new Date(t);if(!Number.isNaN(n.getTime()))return n}return null},ue=e=>{let t=e.charCodeAt(0),n=e.charCodeAt(e.length-1);return t===123&&n===125||t===91&&n===93},le=e=>JSON.parse(e,(t,n)=>{let r=_(n);return r||n}),L=e=>{if(!e)return e;if(ye(e))return+e;if(e==="true")return!0;if(e==="false")return!1;let t=_(e);if(t)return t;if(ue(e))try{return le(e)}catch{}return e},D=e=>{let t=e.data.toString();return t==="null"?null:L(t)};var I=class{constructor(t){this.url=t;this.ws=new WebSocket(t)}ws;send(t){return Array.isArray(t)?(t.forEach(n=>this.send(n)),this):(this.ws.send(typeof t=="object"?JSON.stringify(t):t.toString()),this)}on(t,n,r){return this.addEventListener(t,n,r)}off(t,n,r){return this.ws.removeEventListener(t,n,r),this}subscribe(t,n){return this.addEventListener("message",t,n)}addEventListener(t,n,r){return this.ws.addEventListener(t,s=>{if(t==="message"){let a=D(s);n({...s,data:a})}else n(s)},r),this}removeEventListener(t,n,r){return this.off(t,n,r),this}close(){return this.ws.close(),this}};var pe=["get","post","put","delete","patch","options","head","connect","subscribe"],Z=["localhost","127.0.0.1","0.0.0.0"],U=typeof FileList>"u",G=e=>U?e instanceof Blob:e instanceof FileList||e instanceof File,he=e=>{if(!e)return!1;for(let t in e)if(G(e[t])||Array.isArray(e[t])&&e[t].find(G))return!0;return!1},J=e=>U?e:new Promise(t=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],e.name,{lastModified:e.lastModified,type:e.type});t(r)},n.readAsArrayBuffer(e)}),j=(e,t,n={},r={})=>{if(Array.isArray(e)){for(let s of e)if(!Array.isArray(s))r=j(s,t,n,r);else{let a=s[0];if(typeof a=="string")r[a.toLowerCase()]=s[1];else for(let[i,y]of a)r[i.toLowerCase()]=y}return r}if(!e)return r;switch(typeof e){case"function":if(e instanceof Headers)return j(e,t,n,r);let s=e(t,n);return s?j(s,t,n,r):r;case"object":if(e instanceof Headers)return e.forEach((a,i)=>{r[i.toLowerCase()]=a}),r;for(let[a,i]of Object.entries(e))r[a.toLowerCase()]=i;return r;default:return r}};async function*ge(e){let t=e.body;if(!t)return;let n=t.getReader(),r=new TextDecoder;try{for(;;){let{done:s,value:a}=await n.read();if(s)break;let i=r.decode(a);yield L(i)}}finally{n.releaseLock()}}var K=(e,t,n=[],r)=>new Proxy(()=>{},{get(s,a){return K(e,t,a==="index"?n:[...n,a],r)},apply(s,a,[i,y]){if(!i||y||typeof i=="object"&&Object.keys(i).length!==1||pe.includes(n.at(-1))){let M=[...n],S=M.pop(),E="/"+M.join("/"),{fetcher:F=fetch,headers:R,onRequest:p,onResponse:g,fetch:O}=t,v=S==="get"||S==="head"||S==="subscribe";R=j(R,E,y);let N=v?i?.query:y?.query,w="";if(N){let o=(T,x)=>{w+=(w?"&":"?")+`${encodeURIComponent(T)}=${encodeURIComponent(x)}`};for(let[T,x]of Object.entries(N)){if(Array.isArray(x)){for(let c of x)o(T,c);continue}o(T,`${x}`)}}if(S==="subscribe"){let o=e.replace(/^([^]+):\/\//,e.startsWith("https://")?"wss://":e.startsWith("http://")||Z.find(T=>e.includes(T))?"ws://":"wss://")+E+w;return new I(o)}return(async()=>{let o={method:S?.toUpperCase(),body:i,...O,headers:R};o.headers={...R,...j(v?i?.headers:y?.headers,E,o)};let T=v&&typeof i=="object"?i.fetch:y?.fetch;if(o={...o,...T},v&&delete o.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let f=await d(E,o);typeof f=="object"&&(o={...o,...f,headers:{...o.headers,...j(f.headers,E,o)}})}}if(v&&delete o.body,he(i)){let d=new FormData;for(let[f,l]of Object.entries(o.body)){if(U){d.append(f,l);continue}if(l instanceof File){d.append(f,await J(l));continue}if(l instanceof FileList){for(let m=0;m<l.length;m++)d.append(f,await J(l[m]));continue}if(Array.isArray(l)){for(let m=0;m<l.length;m++){let b=l[m];d.append(f,b instanceof File?await J(b):b)}continue}d.append(f,l)}o.body=d}else typeof i=="object"?(o.headers["content-type"]="application/json",o.body=JSON.stringify(i)):i!=null&&(o.headers["content-type"]="text/plain");if(v&&delete o.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let f=await d(E,o);typeof f=="object"&&(o={...o,...f,headers:{...o.headers,...j(f.headers,E,o)}})}}let x=e+E+w,c=await(r?.handle(new Request(x,o))??F(x,o)),h=null,u=null;if(g){Array.isArray(g)||(g=[g]);for(let d of g)try{let f=await d(c.clone());if(f!=null){h=f;break}}catch(f){f instanceof k?u=f:u=new k(422,f);break}}if(h!==null)return{data:h,error:u,response:c,status:c.status,headers:c.headers};switch(c.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":h=ge(c);break;case"application/json":h=await c.json();break;case"application/octet-stream":h=await c.arrayBuffer();break;case"multipart/form-data":let d=await c.formData();h={},d.forEach((f,l)=>{h[l]=f});break;default:h=await c.text().then(L)}return(c.status>=300||c.status<200)&&(u=new k(c.status,h),h=null),{data:h,error:u,response:c,status:c.status,headers:c.headers}})()}return typeof i=="object"?K(e,t,[...n,Object.values(i)[0]],r):K(e,t,n)}}),z=(e,t={})=>typeof e=="string"?(t.keepDomain||(e.includes("://")||(e=(Z.find(n=>e.includes(n))?"http://":"https://")+e),e.endsWith("/")&&(e=e.slice(0,-1))),K(e,t)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),K("http://e.ly",t,[],e));var Q=(e,t,n)=>{if(e.endsWith("/")||(e+="/"),t==="index"&&(t=""),!n||!Object.keys(n).length)return`${e}${t}`;let r="";for(let[s,a]of Object.entries(n))r+=`${s}=${a}&`;return`${e}${t}?${r.slice(0,-1)}`};var V=typeof FileList>"u",X=e=>V?e instanceof Blob:e instanceof FileList||e instanceof File,me=e=>{if(!e)return!1;for(let t in e){if(X(e[t]))return!0;if(Array.isArray(e[t])&&e[t].find(n=>X(n)))return!0}return!1},B=e=>V?e:new Promise(t=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],e.name,{lastModified:e.lastModified,type:e.type});t(r)},n.readAsArrayBuffer(e)}),H=class{ws;url;constructor(t){this.ws=new WebSocket(t),this.url=t}send(t){return Array.isArray(t)?(t.forEach(n=>this.send(n)),this):(this.ws.send(typeof t=="object"?JSON.stringify(t):t.toString()),this)}on(t,n,r){return this.addEventListener(t,n,r)}off(t,n,r){return this.ws.removeEventListener(t,n,r),this}subscribe(t,n){return this.addEventListener("message",t,n)}addEventListener(t,n,r){return this.ws.addEventListener(t,s=>{if(t==="message"){let a=D(s);n({...s,data:a})}else n(s)},r),this}removeEventListener(t,n,r){return this.off(t,n,r),this}close(){return this.ws.close(),this}},Y=(e,t="",n)=>new Proxy(()=>{},{get(r,s,a){return Y(e,`${t}/${s.toString()}`,n)},apply(r,s,[a,i={}]=[{},{}]){let y=a!==void 0&&(typeof a!="object"||Array.isArray(a))?a:void 0,{$query:M,$fetch:S,$headers:E,$transform:F,getRaw:R,...p}=a??{};y??=p;let g=t.lastIndexOf("/"),O=t.slice(g+1).toUpperCase(),v=Q(e,g===-1?"/":t.slice(0,g),Object.assign(i.query??{},M)),N=n.fetcher??fetch,w=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,o=F?Array.isArray(F)?F:[F]:void 0;return o&&(w?w=o.concat(w):w=o),O==="SUBSCRIBE"?new H(v.replace(/^([^]+):\/\//,v.startsWith("https://")?"wss://":"ws://")):(async x=>{let c,h={...n.$fetch?.headers,...S?.headers,...i.headers,...E};if(O!=="GET"&&O!=="HEAD"){c=Object.keys(y).length||Array.isArray(y)?y:void 0;let m=c&&(typeof c=="object"||Array.isArray(y));if(m&&me(c)){let $=new FormData;for(let[C,A]of Object.entries(c))if(V)$.append(C,A);else if(A instanceof File)$.append(C,await B(A));else if(A instanceof FileList)for(let W=0;W<A.length;W++)$.append(C,await B(A[W]));else if(Array.isArray(A))for(let W=0;W<A.length;W++){let q=A[W];$.append(C,q instanceof File?await B(q):q)}else $.append(C,A);c=$}else c!=null&&(h["content-type"]=m?"application/json":"text/plain",c=m?JSON.stringify(c):y)}let u=await N(v,{method:O,body:c,...n.$fetch,...i.fetch,...S,headers:h}),d;if(x.getRaw)return u;switch(u.headers.get("Content-Type")?.split(";")[0]){case"application/json":d=await u.json();break;default:d=await u.text().then(L)}let f=u.status>=300||u.status<200?new k(u.status,d):null,l={data:d,error:f,response:u,status:u.status,headers:u.headers};if(w)for(let m of w){let b=m(l);b instanceof Promise&&(b=await b),b!=null&&(l=b)}return l})({getRaw:R})}}),ee=(e,t={fetcher:fetch})=>new Proxy({},{get(n,r){return Y(e,r,t)}});var Ee=async e=>{switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":return e.json();case"application/octet-stream":return e.arrayBuffer();case"multipart/form-data":{let n=await e.formData(),r={};return n.forEach((s,a)=>{r[a]=s}),r}}return e.text().then(L)},we=async(e,t)=>{let n=await Ee(e);return e.status>300?{data:null,status:e.status,headers:e.headers,retry:t,error:new k(e.status,n)}:{data:n,error:null,status:e.status,headers:e.headers,retry:t}},te=(e,t)=>(n,{query:r,params:s,body:a,...i}={})=>{s&&Object.entries(s).forEach(([g,O])=>{n=n.replace(`:${g}`,O)});let y=i.headers?.["Content-Type"];if(!y||y==="application/json")try{a=JSON.stringify(a)}catch{}let M=t?.fetcher||globalThis.fetch,S=r?`?${new URLSearchParams(r).toString()}`:"",E=`${e}${n}${S}`,F=a?{"content-type":"application/json",...i.headers}:i.headers,R={...i,method:i.method?.toUpperCase()||"GET",headers:F,body:a},p=()=>M(E,R).then(g=>we(g,p));return p()};return oe(be);})();

@@ -1,1 +0,1 @@

"use strict";var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},ce=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!ie.call(t,o)&&o!==r&&U(t,o,{get:()=>e[o],enumerable:!(s=se(e,o))||s.enumerable});return t};var fe=t=>ce(U({},"__esModule",{value:!0}),t);var pe={};oe(pe,{edenFetch:()=>ne,edenTreaty:()=>re,treaty:()=>Y});module.exports=fe(pe);var V=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let s="";for(let[o,n]of Object.entries(r))s+=`${o}=${n}&`;return`${t}${e}?${s.slice(0,-1)}`},R=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var L=class extends Error{constructor(r,s){super(s+"");this.status=r;this.value=s}};var z=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,D=class{constructor(e){this.url=e;this.ws=new WebSocket(e)}ws;send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0),y=n.charCodeAt(n.length-1);if(a===91||a===123)try{n=JSON.parse(n,(T,p)=>{if(typeof p=="string"&&z.test(p)){let m=new Date(p);if(!Number.isNaN(m.getTime()))return m}return p})}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"?n=!1:n==="null"?n=null:a===34&&y===34&&z.test(n)&&(n=new Date(n.substring(1,n.length-1)));r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}};var ye=["get","post","put","delete","patch","options","head","connect","subscribe"],X=["localhost","127.0.0.1","0.0.0.0"],H=typeof FileList>"u",I=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,P=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,q=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,Q=t=>H?t instanceof Blob:t instanceof FileList||t instanceof File,ue=t=>{if(!t)return!1;for(let e in t)if(Q(t[e])||Array.isArray(t[e])&&t[e].find(Q))return!0;return!1},B=t=>H?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),j=(t,e,r={},s={})=>{if(Array.isArray(t)){for(let o of t)if(!Array.isArray(o))s=j(o,e,r,s);else{let n=o[0];if(typeof n=="string")s[n.toLowerCase()]=o[1];else for(let[a,y]of n)s[a.toLowerCase()]=y}return s}if(!t)return s;switch(typeof t){case"function":if(t instanceof Headers)return j(t,e,r,s);let o=t(e,r);return o?j(o,e,r,s):s;case"object":if(t instanceof Headers)return t.forEach((n,a)=>{s[a.toLowerCase()]=n}),s;for(let[n,a]of Object.entries(t))s[n.toLowerCase()]=a;default:return s}};async function*le(t){let e=t.body;if(!e)return;let r=e.getReader(),s=new TextDecoder;try{for(;;){let{done:o,value:n}=await r.read();if(o)break;let a=s.decode(n);if(R(a)){yield+a;continue}if(a==="true"){yield!0;continue}if(a==="false"){yield!1;continue}let y=a.charCodeAt(0),T=a.charCodeAt(a.length-1);if(y===123&&T===125||y===91&&T===93)try{yield JSON.parse(a);continue}catch{}let p=a.replace(/"/g,"");if(I.test(p)||P.test(p)||q.test(p)){let m=new Date(p);Number.isNaN(m.getTime())||(yield m);continue}yield a}}finally{r.releaseLock()}}var $=(t,e,r=[],s)=>new Proxy(()=>{},{get(o,n){return $(t,e,n==="index"?r:[...r,n],s)},apply(o,n,[a,y]){if(!a||y||typeof a=="object"&&Object.keys(a).length!==1||ye.includes(r.at(-1))){let T=[...r],p=T.pop(),m="/"+T.join("/"),{fetcher:l=fetch,headers:w,onRequest:E,onResponse:h,fetch:v}=e,A=p==="get"||p==="head"||p==="subscribe";w=j(w,m,y);let K=A?a?.query:y?.query,k="";if(K){let c=(N,F)=>{k+=(k?"&":"?")+`${encodeURIComponent(N)}=${encodeURIComponent(F)}`};for(let[N,F]of Object.entries(K)){if(Array.isArray(F)){for(let f of F)c(N,f);continue}c(N,`${F}`)}}if(p==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||X.find(N=>t.includes(N))?"ws://":"wss://")+m+k;return new D(c)}return(async()=>{let c={method:p?.toUpperCase(),body:a,...v,headers:w};c.headers={...w,...j(A?a?.headers:y?.headers,m,c)};let N=A&&typeof a=="object"?a.fetch:y?.fetch;if(c={...c,...N},A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...j(i.headers,m,c)}})}}if(A&&delete c.body,ue(a)){let g=new FormData;for(let[i,d]of Object.entries(c.body)){if(H){g.append(i,d);continue}if(d instanceof File){g.append(i,await B(d));continue}if(d instanceof FileList){for(let u=0;u<d.length;u++)g.append(i,await B(d[u]));continue}if(Array.isArray(d)){for(let u=0;u<d.length;u++){let x=d[u];g.append(i,x instanceof File?await B(x):x)}continue}g.append(i,d)}c.body=g}else typeof a=="object"?(c.headers["content-type"]="application/json",c.body=JSON.stringify(a)):a!=null&&(c.headers["content-type"]="text/plain");if(A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...i.headers}})}}let F=t+m+k,f=await(s?.handle(new Request(F,c))??l(F,c)),S=null,b=null;if(h){Array.isArray(h)||(h=[h]);for(let g of h)try{let i=await g(f.clone());if(i!=null){S=i;break}}catch(i){i instanceof L?b=i:b=new L(422,i);break}}if(S===null){switch(f.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":S=le(f);break;case"application/json":S=await f.json();break;case"application/octet-stream":S=await f.arrayBuffer();break;case"multipart/form-data":let g=await f.formData();S={},g.forEach((i,d)=>{S[d]=i});break;default:S=await f.text().then(i=>{if(R(i))return+i;if(i==="true")return!0;if(i==="false")return!1;if(!i)return i;let d=i.replace(/"/g,"");if(I.test(d)||P.test(d)||q.test(d)){let u=new Date(d);if(!Number.isNaN(u.getTime()))return u}return i})}(f.status>=300||f.status<200)&&(b=new L(f.status,S),S=null)}return{data:S,error:b,response:f,status:f.status,headers:f.headers}})()}return typeof a=="object"?$(t,e,[...r,Object.values(a)[0]],s):$(t,e,r)}}),Y=(t,e={})=>typeof t=="string"?(e.keepDomain||(t.includes("://")||(t=(X.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1))),$(t,e)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),$("http://e.ly",e,[],t));var Z=typeof FileList>"u",ee=t=>Z?t instanceof Blob:t instanceof FileList||t instanceof File,de=t=>{if(!t)return!1;for(let e in t){if(ee(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>ee(r)))return!0}return!1},_=t=>Z?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),G=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0);if(a===47||a===123)try{n=JSON.parse(n)}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}},te=(t,e="",r)=>new Proxy(()=>{},{get(s,o,n){return te(t,`${e}/${o.toString()}`,r)},apply(s,o,[n,a={}]=[{},{}]){let y=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:T,$fetch:p,$headers:m,$transform:l,getRaw:w,...E}=n??{};y??=E;let h=e.lastIndexOf("/"),v=e.slice(h+1).toUpperCase(),A=V(t,h===-1?"/":e.slice(0,h),Object.assign(a.query??{},T)),K=r.fetcher??fetch,k=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,c=l?Array.isArray(l)?l:[l]:void 0;return c&&(k?k=c.concat(k):k=c),v==="SUBSCRIBE"?new G(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async F=>{let f,S={...r.$fetch?.headers,...p?.headers,...a.headers,...m};if(v!=="GET"&&v!=="HEAD"){f=Object.keys(y).length||Array.isArray(y)?y:void 0;let u=f&&(typeof f=="object"||Array.isArray(y));if(u&&de(f)){let C=new FormData;for(let[M,O]of Object.entries(f))if(Z)C.append(M,O);else if(O instanceof File)C.append(M,await _(O));else if(O instanceof FileList)for(let W=0;W<O.length;W++)C.append(M,await _(O[W]));else if(Array.isArray(O))for(let W=0;W<O.length;W++){let J=O[W];C.append(M,J instanceof File?await _(J):J)}else C.append(M,O);f=C}else f!=null&&(S["content-type"]=u?"application/json":"text/plain",f=u?JSON.stringify(f):y)}let b=await K(A,{method:v,body:f,...r.$fetch,...a.fetch,...p,headers:S}),g;if(F.getRaw)return b;switch(b.headers.get("Content-Type")?.split(";")[0]){case"application/json":g=await b.json();break;default:g=await b.text().then(u=>R(u)?+u:u==="true"?!0:u==="false"?!1:u)}let i=b.status>=300||b.status<200?new L(b.status,g):null,d={data:g,error:i,response:b,status:b.status,headers:b.headers};if(k)for(let u of k){let x=u(d);x instanceof Promise&&(x=await x),x!=null&&(d=x)}return d})({getRaw:w})}}),re=(t,e={fetcher:fetch})=>new Proxy({},{get(r,s){return te(t,s,e)}});var ne=(t,e)=>(r,{query:s,params:o,body:n,...a}={})=>{o&&Object.entries(o).forEach(([l,w])=>{r=r.replace(`:${l}`,w)});let y=a.headers?.["Content-Type"];if(!y||y==="application/json")try{n=JSON.stringify(n)}catch{}let T=e?.fetcher||globalThis.fetch,p=s?`?${new URLSearchParams(s).toString()}`:"",m=()=>T(t+r+p,{...a,method:a.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...a.headers}:a.headers,body:n}).then(async l=>{let w;switch(l.headers.get("Content-Type")?.split(";")[0]){case"application/json":w=await l.json();break;case"application/octet-stream":w=await l.arrayBuffer();break;case"multipart/form-data":let E=await l.formData();w={},E.forEach((h,v)=>{w[v]=h});break;default:w=await l.text().then(h=>{if(R(h))return+h;if(h==="true")return!0;if(h==="false")return!1;if(!h)return h;let v=h.replace(/"/g,"");if(I.test(v)||P.test(v)||q.test(v)){let A=new Date(v);if(!Number.isNaN(A.getTime()))return A}return h})}return l.status>300?{data:null,status:l.status,headers:l.headers,retry:m,error:new L(l.status,w)}:{data:w,error:null,status:l.status,headers:l.headers,retry:m}});return m()};0&&(module.exports={edenFetch,edenTreaty,treaty});
"use strict";var P=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var ae=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ie=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of re(t))!se.call(e,s)&&s!==n&&P(e,s,{get:()=>t[s],enumerable:!(r=ne(t,s))||r.enumerable});return e};var oe=e=>ie(P({},"__esModule",{value:!0}),e);var be={};ae(be,{edenFetch:()=>te,edenTreaty:()=>ee,treaty:()=>z});module.exports=oe(be);var k=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var ce=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,fe=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,de=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,ye=e=>e.trim().length!==0&&!Number.isNaN(Number(e)),_=e=>{if(typeof e!="string")return null;let t=e.replace(/"/g,"");if(ce.test(t)||fe.test(t)||de.test(t)){let n=new Date(t);if(!Number.isNaN(n.getTime()))return n}return null},ue=e=>{let t=e.charCodeAt(0),n=e.charCodeAt(e.length-1);return t===123&&n===125||t===91&&n===93},le=e=>JSON.parse(e,(t,n)=>{let r=_(n);return r||n}),L=e=>{if(!e)return e;if(ye(e))return+e;if(e==="true")return!0;if(e==="false")return!1;let t=_(e);if(t)return t;if(ue(e))try{return le(e)}catch{}return e},D=e=>{let t=e.data.toString();return t==="null"?null:L(t)};var I=class{constructor(t){this.url=t;this.ws=new WebSocket(t)}ws;send(t){return Array.isArray(t)?(t.forEach(n=>this.send(n)),this):(this.ws.send(typeof t=="object"?JSON.stringify(t):t.toString()),this)}on(t,n,r){return this.addEventListener(t,n,r)}off(t,n,r){return this.ws.removeEventListener(t,n,r),this}subscribe(t,n){return this.addEventListener("message",t,n)}addEventListener(t,n,r){return this.ws.addEventListener(t,s=>{if(t==="message"){let a=D(s);n({...s,data:a})}else n(s)},r),this}removeEventListener(t,n,r){return this.off(t,n,r),this}close(){return this.ws.close(),this}};var pe=["get","post","put","delete","patch","options","head","connect","subscribe"],Z=["localhost","127.0.0.1","0.0.0.0"],U=typeof FileList>"u",G=e=>U?e instanceof Blob:e instanceof FileList||e instanceof File,he=e=>{if(!e)return!1;for(let t in e)if(G(e[t])||Array.isArray(e[t])&&e[t].find(G))return!0;return!1},J=e=>U?e:new Promise(t=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],e.name,{lastModified:e.lastModified,type:e.type});t(r)},n.readAsArrayBuffer(e)}),j=(e,t,n={},r={})=>{if(Array.isArray(e)){for(let s of e)if(!Array.isArray(s))r=j(s,t,n,r);else{let a=s[0];if(typeof a=="string")r[a.toLowerCase()]=s[1];else for(let[i,y]of a)r[i.toLowerCase()]=y}return r}if(!e)return r;switch(typeof e){case"function":if(e instanceof Headers)return j(e,t,n,r);let s=e(t,n);return s?j(s,t,n,r):r;case"object":if(e instanceof Headers)return e.forEach((a,i)=>{r[i.toLowerCase()]=a}),r;for(let[a,i]of Object.entries(e))r[a.toLowerCase()]=i;return r;default:return r}};async function*ge(e){let t=e.body;if(!t)return;let n=t.getReader(),r=new TextDecoder;try{for(;;){let{done:s,value:a}=await n.read();if(s)break;let i=r.decode(a);yield L(i)}}finally{n.releaseLock()}}var K=(e,t,n=[],r)=>new Proxy(()=>{},{get(s,a){return K(e,t,a==="index"?n:[...n,a],r)},apply(s,a,[i,y]){if(!i||y||typeof i=="object"&&Object.keys(i).length!==1||pe.includes(n.at(-1))){let M=[...n],S=M.pop(),E="/"+M.join("/"),{fetcher:F=fetch,headers:R,onRequest:p,onResponse:g,fetch:O}=t,v=S==="get"||S==="head"||S==="subscribe";R=j(R,E,y);let N=v?i?.query:y?.query,w="";if(N){let o=(T,x)=>{w+=(w?"&":"?")+`${encodeURIComponent(T)}=${encodeURIComponent(x)}`};for(let[T,x]of Object.entries(N)){if(Array.isArray(x)){for(let c of x)o(T,c);continue}o(T,`${x}`)}}if(S==="subscribe"){let o=e.replace(/^([^]+):\/\//,e.startsWith("https://")?"wss://":e.startsWith("http://")||Z.find(T=>e.includes(T))?"ws://":"wss://")+E+w;return new I(o)}return(async()=>{let o={method:S?.toUpperCase(),body:i,...O,headers:R};o.headers={...R,...j(v?i?.headers:y?.headers,E,o)};let T=v&&typeof i=="object"?i.fetch:y?.fetch;if(o={...o,...T},v&&delete o.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let f=await d(E,o);typeof f=="object"&&(o={...o,...f,headers:{...o.headers,...j(f.headers,E,o)}})}}if(v&&delete o.body,he(i)){let d=new FormData;for(let[f,l]of Object.entries(o.body)){if(U){d.append(f,l);continue}if(l instanceof File){d.append(f,await J(l));continue}if(l instanceof FileList){for(let m=0;m<l.length;m++)d.append(f,await J(l[m]));continue}if(Array.isArray(l)){for(let m=0;m<l.length;m++){let b=l[m];d.append(f,b instanceof File?await J(b):b)}continue}d.append(f,l)}o.body=d}else typeof i=="object"?(o.headers["content-type"]="application/json",o.body=JSON.stringify(i)):i!=null&&(o.headers["content-type"]="text/plain");if(v&&delete o.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let f=await d(E,o);typeof f=="object"&&(o={...o,...f,headers:{...o.headers,...j(f.headers,E,o)}})}}let x=e+E+w,c=await(r?.handle(new Request(x,o))??F(x,o)),h=null,u=null;if(g){Array.isArray(g)||(g=[g]);for(let d of g)try{let f=await d(c.clone());if(f!=null){h=f;break}}catch(f){f instanceof k?u=f:u=new k(422,f);break}}if(h!==null)return{data:h,error:u,response:c,status:c.status,headers:c.headers};switch(c.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":h=ge(c);break;case"application/json":h=await c.json();break;case"application/octet-stream":h=await c.arrayBuffer();break;case"multipart/form-data":let d=await c.formData();h={},d.forEach((f,l)=>{h[l]=f});break;default:h=await c.text().then(L)}return(c.status>=300||c.status<200)&&(u=new k(c.status,h),h=null),{data:h,error:u,response:c,status:c.status,headers:c.headers}})()}return typeof i=="object"?K(e,t,[...n,Object.values(i)[0]],r):K(e,t,n)}}),z=(e,t={})=>typeof e=="string"?(t.keepDomain||(e.includes("://")||(e=(Z.find(n=>e.includes(n))?"http://":"https://")+e),e.endsWith("/")&&(e=e.slice(0,-1))),K(e,t)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),K("http://e.ly",t,[],e));var Q=(e,t,n)=>{if(e.endsWith("/")||(e+="/"),t==="index"&&(t=""),!n||!Object.keys(n).length)return`${e}${t}`;let r="";for(let[s,a]of Object.entries(n))r+=`${s}=${a}&`;return`${e}${t}?${r.slice(0,-1)}`};var V=typeof FileList>"u",X=e=>V?e instanceof Blob:e instanceof FileList||e instanceof File,me=e=>{if(!e)return!1;for(let t in e){if(X(e[t]))return!0;if(Array.isArray(e[t])&&e[t].find(n=>X(n)))return!0}return!1},B=e=>V?e:new Promise(t=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],e.name,{lastModified:e.lastModified,type:e.type});t(r)},n.readAsArrayBuffer(e)}),H=class{ws;url;constructor(t){this.ws=new WebSocket(t),this.url=t}send(t){return Array.isArray(t)?(t.forEach(n=>this.send(n)),this):(this.ws.send(typeof t=="object"?JSON.stringify(t):t.toString()),this)}on(t,n,r){return this.addEventListener(t,n,r)}off(t,n,r){return this.ws.removeEventListener(t,n,r),this}subscribe(t,n){return this.addEventListener("message",t,n)}addEventListener(t,n,r){return this.ws.addEventListener(t,s=>{if(t==="message"){let a=D(s);n({...s,data:a})}else n(s)},r),this}removeEventListener(t,n,r){return this.off(t,n,r),this}close(){return this.ws.close(),this}},Y=(e,t="",n)=>new Proxy(()=>{},{get(r,s,a){return Y(e,`${t}/${s.toString()}`,n)},apply(r,s,[a,i={}]=[{},{}]){let y=a!==void 0&&(typeof a!="object"||Array.isArray(a))?a:void 0,{$query:M,$fetch:S,$headers:E,$transform:F,getRaw:R,...p}=a??{};y??=p;let g=t.lastIndexOf("/"),O=t.slice(g+1).toUpperCase(),v=Q(e,g===-1?"/":t.slice(0,g),Object.assign(i.query??{},M)),N=n.fetcher??fetch,w=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,o=F?Array.isArray(F)?F:[F]:void 0;return o&&(w?w=o.concat(w):w=o),O==="SUBSCRIBE"?new H(v.replace(/^([^]+):\/\//,v.startsWith("https://")?"wss://":"ws://")):(async x=>{let c,h={...n.$fetch?.headers,...S?.headers,...i.headers,...E};if(O!=="GET"&&O!=="HEAD"){c=Object.keys(y).length||Array.isArray(y)?y:void 0;let m=c&&(typeof c=="object"||Array.isArray(y));if(m&&me(c)){let $=new FormData;for(let[C,A]of Object.entries(c))if(V)$.append(C,A);else if(A instanceof File)$.append(C,await B(A));else if(A instanceof FileList)for(let W=0;W<A.length;W++)$.append(C,await B(A[W]));else if(Array.isArray(A))for(let W=0;W<A.length;W++){let q=A[W];$.append(C,q instanceof File?await B(q):q)}else $.append(C,A);c=$}else c!=null&&(h["content-type"]=m?"application/json":"text/plain",c=m?JSON.stringify(c):y)}let u=await N(v,{method:O,body:c,...n.$fetch,...i.fetch,...S,headers:h}),d;if(x.getRaw)return u;switch(u.headers.get("Content-Type")?.split(";")[0]){case"application/json":d=await u.json();break;default:d=await u.text().then(L)}let f=u.status>=300||u.status<200?new k(u.status,d):null,l={data:d,error:f,response:u,status:u.status,headers:u.headers};if(w)for(let m of w){let b=m(l);b instanceof Promise&&(b=await b),b!=null&&(l=b)}return l})({getRaw:R})}}),ee=(e,t={fetcher:fetch})=>new Proxy({},{get(n,r){return Y(e,r,t)}});var Ee=async e=>{switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":return e.json();case"application/octet-stream":return e.arrayBuffer();case"multipart/form-data":{let n=await e.formData(),r={};return n.forEach((s,a)=>{r[a]=s}),r}}return e.text().then(L)},we=async(e,t)=>{let n=await Ee(e);return e.status>300?{data:null,status:e.status,headers:e.headers,retry:t,error:new k(e.status,n)}:{data:n,error:null,status:e.status,headers:e.headers,retry:t}},te=(e,t)=>(n,{query:r,params:s,body:a,...i}={})=>{s&&Object.entries(s).forEach(([g,O])=>{n=n.replace(`:${g}`,O)});let y=i.headers?.["Content-Type"];if(!y||y==="application/json")try{a=JSON.stringify(a)}catch{}let M=t?.fetcher||globalThis.fetch,S=r?`?${new URLSearchParams(r).toString()}`:"",E=`${e}${n}${S}`,F=a?{"content-type":"application/json",...i.headers}:i.headers,R={...i,method:i.method?.toUpperCase()||"GET",headers:F,body:a},p=()=>M(E,R).then(g=>we(g,p));return p()};0&&(module.exports={edenFetch,edenTreaty,treaty});
import { Elysia, InputSchema } from 'elysia';
import { P as Prettify, a as IsUnknown, M as MapError, I as IsNever, E as EdenFetchError } from './types-DcP_1Cpm.js';
import { P as Prettify, I as IsUnknown, M as MapError, a as IsNever, E as EdenFetchError } from './types-DNydNaKe.js';
/// <reference lib="dom" />
type Files = File | FileList;

@@ -7,0 +5,0 @@ type Replace<RecordType, TargetType, GenericType> = {

@@ -1,1 +0,1 @@

"use strict";var Eden=(()=>{var $=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var n in e)$(t,n,{get:e[n],enumerable:!0})},G=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of H(e))!U.call(t,a)&&a!==n&&$(t,a,{get:()=>e[a],enumerable:!(r=B(e,a))||r.enumerable});return t};var _=t=>G($({},"__esModule",{value:!0}),t);var X={};V(X,{EdenWS:()=>S,edenTreaty:()=>Q});var w=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var K=(t,e,n)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!n||!Object.keys(n).length)return`${t}${e}`;let r="";for(let[a,s]of Object.entries(n))r+=`${a}=${s}&`;return`${t}${e}?${r.slice(0,-1)}`},O=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var F=typeof FileList>"u",M=t=>F?t instanceof Blob:t instanceof FileList||t instanceof File,z=t=>{if(!t)return!1;for(let e in t){if(M(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(n=>M(n)))return!0}return!1},R=t=>F?t:new Promise(e=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],t.name,{lastModified:t.lastModified,type:t.type});e(r)},n.readAsArrayBuffer(t)}),S=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(n=>this.send(n)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,n,r){return this.addEventListener(e,n,r)}off(e,n,r){return this.ws.removeEventListener(e,n,r),this}subscribe(e,n){return this.addEventListener("message",e,n)}addEventListener(e,n,r){return this.ws.addEventListener(e,a=>{if(e==="message"){let s=a.data.toString(),l=s.charCodeAt(0);if(l===47||l===123)try{s=JSON.parse(s)}catch{}else O(s)?s=+s:s==="true"?s=!0:s==="false"&&(s=!1);n({...a,data:s})}else n(a)},r),this}removeEventListener(e,n,r){return this.off(e,n,r),this}close(){return this.ws.close(),this}},N=(t,e="",n)=>new Proxy(()=>{},{get(r,a,s){return N(t,`${e}/${a.toString()}`,n)},apply(r,a,[s,l={}]=[{},{}]){let y=s!==void 0&&(typeof s!="object"||Array.isArray(s))?s:void 0,{$query:j,$fetch:L,$headers:I,$transform:g,getRaw:P,...C}=s??{};y??=C;let v=e.lastIndexOf("/"),E=e.slice(v+1).toUpperCase(),x=K(t,v===-1?"/":e.slice(0,v),Object.assign(l.query??{},j)),q=n.fetcher??fetch,p=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,A=g?Array.isArray(g)?g:[g]:void 0;return A&&(p?p=A.concat(p):p=A),E==="SUBSCRIBE"?new S(x.replace(/^([^]+):\/\//,x.startsWith("https://")?"wss://":"ws://")):(async D=>{let i,W={...n.$fetch?.headers,...L?.headers,...l.headers,...I};if(E!=="GET"&&E!=="HEAD"){i=Object.keys(y).length||Array.isArray(y)?y:void 0;let o=i&&(typeof i=="object"||Array.isArray(y));if(o&&z(i)){let h=new FormData;for(let[m,f]of Object.entries(i))if(F)h.append(m,f);else if(f instanceof File)h.append(m,await R(f));else if(f instanceof FileList)for(let d=0;d<f.length;d++)h.append(m,await R(f[d]));else if(Array.isArray(f))for(let d=0;d<f.length;d++){let T=f[d];h.append(m,T instanceof File?await R(T):T)}else h.append(m,f);i=h}else i!=null&&(W["content-type"]=o?"application/json":"text/plain",i=o?JSON.stringify(i):y)}let c=await q(x,{method:E,body:i,...n.$fetch,...l.fetch,...L,headers:W}),b;if(D.getRaw)return c;switch(c.headers.get("Content-Type")?.split(";")[0]){case"application/json":b=await c.json();break;default:b=await c.text().then(o=>O(o)?+o:o==="true"?!0:o==="false"?!1:o)}let J=c.status>=300||c.status<200?new w(c.status,b):null,k={data:b,error:J,response:c,status:c.status,headers:c.headers};if(p)for(let o of p){let u=o(k);u instanceof Promise&&(u=await u),u!=null&&(k=u)}return k})({getRaw:P})}}),Q=(t,e={fetcher:fetch})=>new Proxy({},{get(n,r){return N(t,r,e)}});return _(X);})();
"use strict";var Eden=(()=>{var v=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)v(t,n,{get:e[n],enumerable:!0})},_=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of G(e))!H.call(t,s)&&s!==n&&v(t,s,{get:()=>e[s],enumerable:!(r=B(e,s))||r.enumerable});return t};var z=t=>_(v({},"__esModule",{value:!0}),t);var ae={};U(ae,{EdenWS:()=>b,edenTreaty:()=>se});var S=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var L=(t,e,n)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!n||!Object.keys(n).length)return`${t}${e}`;let r="";for(let[s,i]of Object.entries(n))r+=`${s}=${i}&`;return`${t}${e}?${r.slice(0,-1)}`};var Q=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,X=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,Y=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,ee=t=>t.trim().length!==0&&!Number.isNaN(Number(t)),N=t=>{if(typeof t!="string")return null;let e=t.replace(/"/g,"");if(Q.test(e)||X.test(e)||Y.test(e)){let n=new Date(e);if(!Number.isNaN(n.getTime()))return n}return null},te=t=>{let e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===123&&n===125||e===91&&n===93},ne=t=>JSON.parse(t,(e,n)=>{let r=N(n);return r||n}),$=t=>{if(!t)return t;if(ee(t))return+t;if(t==="true")return!0;if(t==="false")return!1;let e=N(t);if(e)return e;if(te(t))try{return ne(t)}catch{}return t},K=t=>{let e=t.data.toString();return e==="null"?null:$(e)};var M=typeof FileList>"u",j=t=>M?t instanceof Blob:t instanceof FileList||t instanceof File,re=t=>{if(!t)return!1;for(let e in t){if(j(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(n=>j(n)))return!0}return!1},F=t=>M?t:new Promise(e=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],t.name,{lastModified:t.lastModified,type:t.type});e(r)},n.readAsArrayBuffer(t)}),b=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(n=>this.send(n)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,n,r){return this.addEventListener(e,n,r)}off(e,n,r){return this.ws.removeEventListener(e,n,r),this}subscribe(e,n){return this.addEventListener("message",e,n)}addEventListener(e,n,r){return this.ws.addEventListener(e,s=>{if(e==="message"){let i=K(s);n({...s,data:i})}else n(s)},r),this}removeEventListener(e,n,r){return this.off(e,n,r),this}close(){return this.ws.close(),this}},D=(t,e="",n)=>new Proxy(()=>{},{get(r,s,i){return D(t,`${e}/${s.toString()}`,n)},apply(r,s,[i,w={}]=[{},{}]){let c=i!==void 0&&(typeof i!="object"||Array.isArray(i))?i:void 0,{$query:I,$fetch:R,$headers:P,$transform:g,getRaw:C,...J}=i??{};c??=J;let x=e.lastIndexOf("/"),m=e.slice(x+1).toUpperCase(),A=L(t,x===-1?"/":e.slice(0,x),Object.assign(w.query??{},I)),q=n.fetcher??fetch,u=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,T=g?Array.isArray(g)?g:[g]:void 0;return T&&(u?u=T.concat(u):u=T),m==="SUBSCRIBE"?new b(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async V=>{let a,W={...n.$fetch?.headers,...R?.headers,...w.headers,...P};if(m!=="GET"&&m!=="HEAD"){a=Object.keys(c).length||Array.isArray(c)?c:void 0;let l=a&&(typeof a=="object"||Array.isArray(c));if(l&&re(a)){let p=new FormData;for(let[h,d]of Object.entries(a))if(M)p.append(h,d);else if(d instanceof File)p.append(h,await F(d));else if(d instanceof FileList)for(let y=0;y<d.length;y++)p.append(h,await F(d[y]));else if(Array.isArray(d))for(let y=0;y<d.length;y++){let O=d[y];p.append(h,O instanceof File?await F(O):O)}else p.append(h,d);a=p}else a!=null&&(W["content-type"]=l?"application/json":"text/plain",a=l?JSON.stringify(a):c)}let o=await q(A,{method:m,body:a,...n.$fetch,...w.fetch,...R,headers:W}),E;if(V.getRaw)return o;switch(o.headers.get("Content-Type")?.split(";")[0]){case"application/json":E=await o.json();break;default:E=await o.text().then($)}let Z=o.status>=300||o.status<200?new S(o.status,E):null,k={data:E,error:Z,response:o,status:o.status,headers:o.headers};if(u)for(let l of u){let f=l(k);f instanceof Promise&&(f=await f),f!=null&&(k=f)}return k})({getRaw:C})}}),se=(t,e={fetcher:fetch})=>new Proxy({},{get(n,r){return D(t,r,e)}});return z(ae);})();

@@ -1,1 +0,1 @@

"use strict";var $=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var n in e)$(t,n,{get:e[n],enumerable:!0})},G=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of H(e))!U.call(t,a)&&a!==n&&$(t,a,{get:()=>e[a],enumerable:!(r=B(e,a))||r.enumerable});return t};var _=t=>G($({},"__esModule",{value:!0}),t);var X={};V(X,{EdenWS:()=>S,edenTreaty:()=>Q});module.exports=_(X);var w=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var K=(t,e,n)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!n||!Object.keys(n).length)return`${t}${e}`;let r="";for(let[a,s]of Object.entries(n))r+=`${a}=${s}&`;return`${t}${e}?${r.slice(0,-1)}`},O=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var F=typeof FileList>"u",M=t=>F?t instanceof Blob:t instanceof FileList||t instanceof File,z=t=>{if(!t)return!1;for(let e in t){if(M(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(n=>M(n)))return!0}return!1},R=t=>F?t:new Promise(e=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],t.name,{lastModified:t.lastModified,type:t.type});e(r)},n.readAsArrayBuffer(t)}),S=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(n=>this.send(n)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,n,r){return this.addEventListener(e,n,r)}off(e,n,r){return this.ws.removeEventListener(e,n,r),this}subscribe(e,n){return this.addEventListener("message",e,n)}addEventListener(e,n,r){return this.ws.addEventListener(e,a=>{if(e==="message"){let s=a.data.toString(),l=s.charCodeAt(0);if(l===47||l===123)try{s=JSON.parse(s)}catch{}else O(s)?s=+s:s==="true"?s=!0:s==="false"&&(s=!1);n({...a,data:s})}else n(a)},r),this}removeEventListener(e,n,r){return this.off(e,n,r),this}close(){return this.ws.close(),this}},N=(t,e="",n)=>new Proxy(()=>{},{get(r,a,s){return N(t,`${e}/${a.toString()}`,n)},apply(r,a,[s,l={}]=[{},{}]){let y=s!==void 0&&(typeof s!="object"||Array.isArray(s))?s:void 0,{$query:j,$fetch:L,$headers:I,$transform:g,getRaw:P,...C}=s??{};y??=C;let v=e.lastIndexOf("/"),E=e.slice(v+1).toUpperCase(),x=K(t,v===-1?"/":e.slice(0,v),Object.assign(l.query??{},j)),q=n.fetcher??fetch,p=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,A=g?Array.isArray(g)?g:[g]:void 0;return A&&(p?p=A.concat(p):p=A),E==="SUBSCRIBE"?new S(x.replace(/^([^]+):\/\//,x.startsWith("https://")?"wss://":"ws://")):(async D=>{let i,W={...n.$fetch?.headers,...L?.headers,...l.headers,...I};if(E!=="GET"&&E!=="HEAD"){i=Object.keys(y).length||Array.isArray(y)?y:void 0;let o=i&&(typeof i=="object"||Array.isArray(y));if(o&&z(i)){let h=new FormData;for(let[m,f]of Object.entries(i))if(F)h.append(m,f);else if(f instanceof File)h.append(m,await R(f));else if(f instanceof FileList)for(let d=0;d<f.length;d++)h.append(m,await R(f[d]));else if(Array.isArray(f))for(let d=0;d<f.length;d++){let T=f[d];h.append(m,T instanceof File?await R(T):T)}else h.append(m,f);i=h}else i!=null&&(W["content-type"]=o?"application/json":"text/plain",i=o?JSON.stringify(i):y)}let c=await q(x,{method:E,body:i,...n.$fetch,...l.fetch,...L,headers:W}),b;if(D.getRaw)return c;switch(c.headers.get("Content-Type")?.split(";")[0]){case"application/json":b=await c.json();break;default:b=await c.text().then(o=>O(o)?+o:o==="true"?!0:o==="false"?!1:o)}let J=c.status>=300||c.status<200?new w(c.status,b):null,k={data:b,error:J,response:c,status:c.status,headers:c.headers};if(p)for(let o of p){let u=o(k);u instanceof Promise&&(u=await u),u!=null&&(k=u)}return k})({getRaw:P})}}),Q=(t,e={fetcher:fetch})=>new Proxy({},{get(n,r){return N(t,r,e)}});0&&(module.exports={EdenWS,edenTreaty});
"use strict";var v=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)v(t,n,{get:e[n],enumerable:!0})},_=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of G(e))!H.call(t,s)&&s!==n&&v(t,s,{get:()=>e[s],enumerable:!(r=B(e,s))||r.enumerable});return t};var z=t=>_(v({},"__esModule",{value:!0}),t);var ae={};U(ae,{EdenWS:()=>b,edenTreaty:()=>se});module.exports=z(ae);var S=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var L=(t,e,n)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!n||!Object.keys(n).length)return`${t}${e}`;let r="";for(let[s,i]of Object.entries(n))r+=`${s}=${i}&`;return`${t}${e}?${r.slice(0,-1)}`};var Q=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,X=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,Y=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,ee=t=>t.trim().length!==0&&!Number.isNaN(Number(t)),N=t=>{if(typeof t!="string")return null;let e=t.replace(/"/g,"");if(Q.test(e)||X.test(e)||Y.test(e)){let n=new Date(e);if(!Number.isNaN(n.getTime()))return n}return null},te=t=>{let e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===123&&n===125||e===91&&n===93},ne=t=>JSON.parse(t,(e,n)=>{let r=N(n);return r||n}),$=t=>{if(!t)return t;if(ee(t))return+t;if(t==="true")return!0;if(t==="false")return!1;let e=N(t);if(e)return e;if(te(t))try{return ne(t)}catch{}return t},K=t=>{let e=t.data.toString();return e==="null"?null:$(e)};var M=typeof FileList>"u",j=t=>M?t instanceof Blob:t instanceof FileList||t instanceof File,re=t=>{if(!t)return!1;for(let e in t){if(j(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(n=>j(n)))return!0}return!1},F=t=>M?t:new Promise(e=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],t.name,{lastModified:t.lastModified,type:t.type});e(r)},n.readAsArrayBuffer(t)}),b=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(n=>this.send(n)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,n,r){return this.addEventListener(e,n,r)}off(e,n,r){return this.ws.removeEventListener(e,n,r),this}subscribe(e,n){return this.addEventListener("message",e,n)}addEventListener(e,n,r){return this.ws.addEventListener(e,s=>{if(e==="message"){let i=K(s);n({...s,data:i})}else n(s)},r),this}removeEventListener(e,n,r){return this.off(e,n,r),this}close(){return this.ws.close(),this}},D=(t,e="",n)=>new Proxy(()=>{},{get(r,s,i){return D(t,`${e}/${s.toString()}`,n)},apply(r,s,[i,w={}]=[{},{}]){let c=i!==void 0&&(typeof i!="object"||Array.isArray(i))?i:void 0,{$query:I,$fetch:R,$headers:P,$transform:g,getRaw:C,...J}=i??{};c??=J;let x=e.lastIndexOf("/"),m=e.slice(x+1).toUpperCase(),A=L(t,x===-1?"/":e.slice(0,x),Object.assign(w.query??{},I)),q=n.fetcher??fetch,u=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,T=g?Array.isArray(g)?g:[g]:void 0;return T&&(u?u=T.concat(u):u=T),m==="SUBSCRIBE"?new b(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async V=>{let a,W={...n.$fetch?.headers,...R?.headers,...w.headers,...P};if(m!=="GET"&&m!=="HEAD"){a=Object.keys(c).length||Array.isArray(c)?c:void 0;let l=a&&(typeof a=="object"||Array.isArray(c));if(l&&re(a)){let p=new FormData;for(let[h,d]of Object.entries(a))if(M)p.append(h,d);else if(d instanceof File)p.append(h,await F(d));else if(d instanceof FileList)for(let y=0;y<d.length;y++)p.append(h,await F(d[y]));else if(Array.isArray(d))for(let y=0;y<d.length;y++){let O=d[y];p.append(h,O instanceof File?await F(O):O)}else p.append(h,d);a=p}else a!=null&&(W["content-type"]=l?"application/json":"text/plain",a=l?JSON.stringify(a):c)}let o=await q(A,{method:m,body:a,...n.$fetch,...w.fetch,...R,headers:W}),E;if(V.getRaw)return o;switch(o.headers.get("Content-Type")?.split(";")[0]){case"application/json":E=await o.json();break;default:E=await o.text().then($)}let Z=o.status>=300||o.status<200?new S(o.status,E):null,k={data:E,error:Z,response:o,status:o.status,headers:o.headers};if(u)for(let l of u){let f=l(k);f instanceof Promise&&(f=await f),f!=null&&(k=f)}return k})({getRaw:C})}}),se=(t,e={fetcher:fetch})=>new Proxy({},{get(n,r){return D(t,r,e)}});0&&(module.exports={EdenWS,edenTreaty});

@@ -1,2 +0,1 @@

/// <reference lib="dom" />
import { Elysia } from 'elysia';

@@ -3,0 +2,0 @@ import type { EdenWS } from './index';

export declare const composePath: (domain: string, path: string, query: Record<string, string> | undefined) => string;
export declare const isNumericString: (message: string) => boolean;
import type { Elysia } from 'elysia';
import type { Treaty } from './types';
export declare const isISO8601: RegExp;
export declare const isFormalDate: RegExp;
export declare const isShortenDate: RegExp;
export declare function streamResponse(response: Response): AsyncGenerator<any, void, unknown>;
export declare const treaty: <const App extends Elysia<any, any, any, any, any, any, any, any>>(domain: string | App, config?: Treaty.Config) => Treaty.Create<App>;
export type { Treaty };

@@ -1,3 +0,1 @@

/// <reference types="bun-types" />
/// <reference lib="dom" />
import type { Elysia } from 'elysia';

@@ -45,3 +43,3 @@ import { EdenWS } from './ws';

query: Query;
}) extends infer Param ? {} extends Param ? undefined extends Body ? K extends 'get' | 'head' ? (options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : (body?: Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : K extends 'get' | 'head' ? (options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<Response>> : never : CreateParams<Route[K]>;
}) extends infer Param ? {} extends Param ? undefined extends Body ? K extends 'get' | 'head' ? (options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body?: Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : K extends 'get' | 'head' ? (options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : never : CreateParams<Route[K]>;
};

@@ -60,3 +58,3 @@ type CreateParams<Route extends Record<string, any>> = Extract<keyof Route, `:${string}`> extends infer Path extends string ? IsNever<Path> extends true ? Prettify<Sign<Route>> : // ! DO NOT USE PRETTIFY ON THIS LINE, OTHERWISE FUNCTION CALLING WILL BE OMITTED

}
type TreatyResponse<_Res extends Record<number, unknown>, Res extends Record<number, unknown> = ReplaceGeneratorWithAsyncGenerator<_Res>> = {
export type TreatyResponse<Res extends Record<number, unknown>> = {
data: Res[200];

@@ -63,0 +61,0 @@ error: null;

{
"name": "@elysiajs/eden",
"version": "1.1.0-exp.1",
"version": "1.1.0-rc.0",
"description": "Fully type-safe Elysia client",

@@ -28,2 +28,9 @@ "author": {

},
"./treaty2": {
"require": "./dist/2.js",
"import": "./dist/treaty2.mjs",
"node": "./dist/treaty2.js",
"default": "./dist/treaty2.js",
"types": "./dist/treaty2/index.d.ts"
},
"./fetch": {

@@ -58,3 +65,3 @@ "require": "./dist/fetch.js",

"peerDependencies": {
"elysia": ">= 1.1.0-exp.1"
"elysia": ">= 1.1.0-rc.2"
},

@@ -65,3 +72,3 @@ "devDependencies": {

"@types/node": "^18.15.5",
"elysia": "^1.1.0-exp.1",
"elysia": "^1.1.0-rc.3",
"esbuild": "^0.19.3",

@@ -71,4 +78,5 @@ "eslint": "^8.26.0",

"rimraf": "^4.4.1",
"tsup": "^7.2.0",
"typescript": "^5.4.5"
"tsup": "^8.1.0",
"typescript": "^5.4.5",
"vite": "^5.3.3"
},

@@ -80,6 +88,3 @@ "prettier": {

"trailingComma": "none"
},
"dependencies": {
"@elysiajs/stream": "^1.0.2"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc