@bit-js/byte
Version:
A simple, performance-focused web framework that works on Bun, Deno, and browsers.
3 lines (2 loc) • 21.6 kB
JavaScript
// @bun
function serialize(input){switch(typeof input){case"string":return input;case"object":if(input===null)return null;const{constructor}=input;if(constructor===Object)return JSON.stringify(input);if(constructor===Promise)return input.then(serialize);if(constructor===Map)return JSON.stringify(Object.fromEntries(input));return input;case"number":return`${input}`;case"bigint":return`${input}`;case"boolean":return`${input}`;default:return null}}function buildPathInject(path){let parts="";let paramIdx=path.indexOf(":");let start=0;while(paramIdx!==-1){if(paramIdx!==start)parts+=path.substring(start,paramIdx);++paramIdx;start=path.indexOf("/",paramIdx);if(start===-1){parts+=`\${p.${path.substring(paramIdx)}}`;return Function(`return (p)=>\`${parts}\``)()}parts+=`\${p.${path.substring(paramIdx,start)}}`;paramIdx=path.indexOf(":",start+1)}parts+=path.charCodeAt(path.length-1)===42?`${path.substring(start,path.length-2)}\${p.$}`:path.substring(start);return Function(`return (p)=>\`${parts}\``)()}var injectPath={};function getInjectFn(path){return injectPath[path]??=buildPathInject(path)}function stringifyQuery(query){if(typeof query==="undefined")return"";const parts=[];for(const key in query){const value=query[key];switch(typeof value){case"boolean":if(value)parts.push(encodeURIComponent(key));continue;case"object":const encodedKey=encodeURIComponent(key);for(let i=0,{length}=value;i<length;++i)parts.push(`${encodedKey}=${encodeURIComponent(`${value[i]}`)}`);continue;default:parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(`${value}`)}`);continue}}return`?${parts.join("&")}`}var emptyObj={};var emptyList=[];var default404res=new Response(null,{status:404});var default403res=new Response(null,{status:403});var default404=()=>default404res;var noop=()=>null;var fetchFn=globalThis.fetch.bind(globalThis);class BitClient{url;fetch;defaultInit;constructor(url,options){if(typeof options==="undefined"){this.fetch=fetchFn;this.defaultInit=emptyObj}else{this.fetch=options.fetch??fetchFn;this.defaultInit=options.init??emptyObj}const lastIdx=url.length-1;this.url=url.charCodeAt(lastIdx)===47?url.substring(0,lastIdx):url}$(path,init){const{defaultInit}=this;if(typeof init==="undefined")return this.fetch(new Request(this.url+path,defaultInit));if(defaultInit!==emptyObj)for(const key in defaultInit)init[key]??=defaultInit[key];const{params,body,query}=init;if(typeof body!=="undefined")init.body=serialize(body);return this.fetch(new Request(`${this.url}${typeof params==="undefined"?path:getInjectFn(path)(params)}${stringifyQuery(query)}`,init))}get(path,init){if(typeof init==="undefined")return this.$(path,getInit);init.method="GET";return this.$(path,init)}head(path,init){if(typeof init==="undefined")return this.$(path,headInit);init.method="HEAD";return this.$(path,init)}post(path,init){if(typeof init==="undefined")return this.$(path,postInit);init.method="POST";return this.$(path,init)}put(path,init){if(typeof init==="undefined")return this.$(path,putInit);init.method="PUT";return this.$(path,init)}delete(path,init){if(typeof init==="undefined")return this.$(path,deleteInit);init.method="DELETE";return this.$(path,init)}options(path,init){if(typeof init==="undefined")return this.$(path,optionsInit);init.method="OPTIONS";return this.$(path,init)}patch(path,init){if(typeof init==="undefined")return this.$(path,patchInit);init.method="PATCH";return this.$(path,init)}connect(path,init){if(typeof init==="undefined")return this.$(path,connectInit);init.method="CONNECT";return this.$(path,init)}trace(path,init){if(typeof init==="undefined")return this.$(path,traceInit);init.method="TRACE";return this.$(path,init)}any(path,init){return typeof init==="undefined"?this.$(path):this.$(path,init)}}var getInit={method:"GET"};var headInit={method:"HEAD"};var postInit={method:"POST"};var putInit={method:"PUT"};var deleteInit={method:"DELETE"};var optionsInit={method:"OPTIONS"};var patchInit={method:"PATCH"};var connectInit={method:"CONNECT"};var traceInit={method:"TRACE"};function bit(url,options){return typeof options==="undefined"?new BitClient(url):new BitClient(url,options)}import Blitz from"@bit-js/blitz";function $async(fn){fn.constructor=AsyncFunction;return fn}function isAsync(fn){return fn.constructor===AsyncFunction}var AsyncFunction=async function(){}.constructor;class Route{method;path;handler;actions;defers;constructor(method,path,handler,actions,defers){this.method=method;this.path=path;this.handler=handler;this.actions=actions;this.defers=defers}clone(base,otherAppActions,otherAppDefers){const{path}=this;return new Route(this.method,base.length===1?path:path.length===1?base:base+path,this.handler,otherAppActions.length===0?this.actions:[otherAppActions,...this.actions],otherAppDefers.length===0?this.defers:[...this.defers,otherAppDefers])}register(router){if(this.method===null)router.handle(this.path,this.compile());else router.on(this.method,this.path,this.compile())}compile(){const{handler,actions,defers}=this;const noActions=actions.length===0;const noDefers=defers.length===0;if(noActions&&noDefers)return handler;const keys=[];const statements=[];const values=[];let hasAsync=false;let noContext=true;let idx=0;if(!noActions){for(let i=0,lI=actions.length;i<lI;++i){const list=actions[i];for(let j=0,lJ=list.length;j<lJ;++j,++idx){const action=list[j];const fn=action[1];const fnKey=`f${idx}`;keys.push(fnKey);values.push(fn);const fnAsync=isAsync(fn);hasAsync||=fnAsync;const fnNoContext=fn.length===0;noContext&&=fnNoContext;switch(action[0]){case 1:statements.push(`${fnAsync?"await ":""}${fnKey}(${noContext?"":"c"})`);continue;case 2:statements.push(`const c${idx}=${fnAsync?"await ":""}${fnKey}(${noContext?"":"c"});if(c${idx} instanceof Response)return c${idx}`);continue;case 3:statements.push(`c.${action[2]}=${fnAsync?"await ":""}${fnKey}(${noContext?"":"c"})`);continue;case 4:statements.push(`const c${idx}=${fnAsync?"await ":""}${fnKey}(${noContext?"":"c"});if(c${idx} instanceof Response)return c${idx};c.${action[2]}=c${idx}`);continue}}}}keys.push("$");values.push(handler);const handlerNoContext=handler.length===0;noContext&&=handlerNoContext;if(noDefers)statements.push(`return ${isAsync(handler)&&hasAsync?"await ":""}\$(${handlerNoContext?"":"c"});`);else{const fnAsync=isAsync(handler);hasAsync||=fnAsync;statements.push(`let r=${fnAsync?"await ":""}\$(${handlerNoContext?"":"c"});if(!(r instanceof Response))return null`);for(let i=0,{length}=defers;i<length;++i){const list=defers[i];for(let i2=list.length-1;i2>-1;--i2,++idx){const fn=list[i2];const fnKey=`f${idx}`;keys.push(fnKey);values.push(fn);const fnAsync2=isAsync(fn);hasAsync||=fnAsync2;const fnNoContext=fn.length<2;noContext&&=fnNoContext;statements.push(`const c${idx}=${fnAsync2?"await ":""}${fnKey}(${fn.length===0?"":noContext?"r":"r,c"});if(c${idx} instanceof Response)r=c${idx}`)}}statements.push("return r;")}return Function(...keys,`return ${hasAsync?"async ":""}(${noContext?"":"c"})=>{${statements.join(";")}}`)(...values)}}var jsonPair=["Content-Type","application/json"];var jsonHeaders=[jsonPair];var jsonInit={headers:jsonHeaders};var htmlPair=["Content-Type","text/html"];var htmlHeaders=[htmlPair];var htmlInit={headers:htmlHeaders};var send={body(body,init){const res=typeof init==="undefined"?new Response(body):new Response(body,init);return()=>res.clone()},json(body,init){if(typeof init==="undefined")init=jsonInit;else if(typeof init.headers==="undefined")init.headers=jsonHeaders;else init.headers.push(jsonPair);const res=new Response(JSON.stringify(body),init);return()=>res.clone()},html(body,init){if(typeof init==="undefined")init=htmlInit;else if(typeof init.headers==="undefined")init.headers=htmlHeaders;else init.headers.push(htmlPair);const res=new Response(body,init);return()=>res.clone()}};class Context{status;headers;path;pathStart;pathEnd;params;req;constructor(req){this.req=req;this.headers=[];const{url}=req;const start=url.indexOf("/",12);const end=url.indexOf("?",start+1);const pathEnd=end===-1?url.length:end;this.pathStart=start;this.pathEnd=pathEnd;this.path=url.substring(start,pathEnd)}body(body){return new Response(body,this)}json(body){this.headers.push(jsonPair);return new Response(JSON.stringify(body),this)}html(body){this.headers.push(htmlPair);return new Response(body,this)}redirect(location,status){this.headers.push(["Location",location]);this.status=status;return new Response(null,this)}end(){return new Response(null,this)}}class Byte{actions=[];defers=[];prepare(fn){this.actions.push([1,fn]);return this}use(fn){this.actions.push([2,fn]);return this}set(name,fn){this.actions.push([3,fn,name]);return this}state(name,fn){this.actions.push([4,fn,name]);return this}defer(fn){this.defers.push(fn);return this}register(...plugins){for(let i=0,{length}=plugins;i<length;++i)plugins[i].plug(this);return this}routes=[];route(base,{routes}){const currentRoutes=this.routes;const{actions,defers}=this;for(let i=0,{length}=routes;i<length;++i)currentRoutes.push(routes[i].clone(base,actions,defers));return this}#fetch;build(router=new Blitz){const{routes}=this;router.fallback=default404;for(let i=0,{length}=routes;i<length;++i)routes[i].register(router);return this.#fetch=router.build(Context)}get fetch(){return this.#fetch??=this.build()}client(){return bit("http://127.0.0.1",this)}static handle(fn){return fn}static defer(fn){return fn}static plugin(plugin2){return plugin2}static route(base,app){return new Byte().route(base,app)}handle(method,path,...args){const{actions,defers}=this;this.routes.push(new Route(method,path,args[0],actions.length===0?emptyList:[actions],defers.length===0?emptyList:[defers]));return this}get(...args){return this.handle("GET",...args)}head(...args){return this.handle("HEAD",...args)}post(...args){return this.handle("POST",...args)}put(...args){return this.handle("PUT",...args)}delete(...args){return this.handle("DELETE",...args)}options(...args){return this.handle("OPTIONS",...args)}patch(...args){return this.handle("PATCH",...args)}connect(...args){return this.handle("CONNECT",...args)}trace(...args){return this.handle("TRACE",...args)}any(...args){return this.handle(null,...args)}}function parseValue(value){return typeof value==="string"?value:value.join(",")}function cors(options){if(typeof options==="undefined")return defaultCors;const builder=[];if(typeof options.allowHeaders!=="undefined")builder.push(["Access-Control-Allow-Headers",parseValue(options.allowHeaders)]);if(typeof options.allowMethods!=="undefined")builder.push(["Access-Control-Allow-Methods",parseValue(options.allowMethods)]);if(typeof options.exposeHeaders!=="undefined")builder.push(["Access-Control-Expose-Headers",parseValue(options.exposeHeaders)]);if(typeof options.maxAge==="number")builder.push(["Access-Control-Max-Age",`${options.maxAge}`]);if(options.allowCredentials===true)builder.push(allowCredentials);if(typeof options.allowOrigin==="string"&&options.allowOrigin!=="*")builder.push(["Access-Control-Allow-Origin",options.allowOrigin],varyOrigin);else builder.push(allowAllOrigins);if(builder.length===1){const first=builder[0];return(c)=>{c.headers.push(first)}}return(c)=>{c.headers.push(...builder)}}var allowCredentials=["Access-Control-Allow-Credentials","true"];var allowAllOrigins=["Access-Control-Allow-Origin","*"];var varyOrigin=["Vary","Origin"];var defaultCors=(c)=>{c.headers.push(allowAllOrigins)};function csrf(options){if(typeof options==="undefined")return defaultCSRF;const literals=[];const keys=[];const values=[];if(typeof options.origins!=="undefined"){const obj={};const{origins}=options;for(let i=0,{length}=origins;i<length;++i)obj[origins[i]]=null;keys.push("o");values.push(obj);literals.push("_ in o")}if(typeof options.verify!=="undefined"){keys.push("f");values.push(options.verify);literals.push("f(_)")}if(literals.length===0)return defaultCSRF;let fallbackCall;if(typeof options.fallback==="undefined"){keys.push("h");values.push(default403res);fallbackCall="h"}else{const{fallback}=options;keys.push("h");values.push(fallback);fallbackCall=`h${fallback.length===0?"()":"(c)"}`}return Function(...keys,`return (c)=>{const _=c.req.headers.get('Origin');return ${literals.join("&&")}?null:${fallbackCall};}`)(...values)}var defaultCSRF=(ctx)=>{if(ctx.req.headers.get("Origin")!==ctx.req.url.substring(0,ctx.pathStart))return default403res};function createHex(shift){return[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,1<<shift,2<<shift,3<<shift,4<<shift,5<<shift,6<<shift,7<<shift,8<<shift,9<<shift,255,255,255,255,255,255,255,10<<shift,11<<shift,12<<shift,13<<shift,14<<shift,15<<shift,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,10<<shift,11<<shift,12<<shift,13<<shift,14<<shift,15<<shift]}function highHex(code){return code>102?255:h4[code]}function lowHex(code){return code>102?255:h0[code]}var h4=createHex(4);var h0=createHex(0);var data=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,256,256,256,256,256,256,256,256,256,256,256,256,268,256,256,256,256,280,292,304,316,328,340,352,256,268,268,268,256,256,256,256,256,256,256,256,256,256,256,280,256,256,256,256,256,256,256,256,256,280,280,280,256,256,256,256,256,256,256,256,256,280,280,256,256,256,256,256,256,256,256,256,256,304,304,304,256,256,256,256,256,256,256,256,256,256,304,304,256,256,256,256,256,256,256,256,256,304,256,256,256,256,256,256,256,256,256,256];var mask=[127,63,63,63,0,31,15,15,15,7,7,7];function decodeURIComponent(url,start,end){let percentPosition=url.indexOf("%",start);if(percentPosition===-1)return url.substring(start,end);let decoded="";let last=0;let codepoint=0;let startOfOctets=percentPosition;let state=268;while(percentPosition<end){const byte=highHex(url.charCodeAt(percentPosition+1))|lowHex(url.charCodeAt(percentPosition+2));const type=data[byte];codepoint=codepoint<<6|byte&mask[type];state=data[state+type];if(state===256)return url.substring(start,end);if(state===268){decoded+=url.substring(last,startOfOctets);decoded+=codepoint>65535?String.fromCharCode(55232+(codepoint>>10),56320+(codepoint&1023)):String.fromCharCode(codepoint);last=percentPosition+3;percentPosition=url.indexOf("%",last);if(percentPosition===-1)return decoded+url.substring(last);startOfOctets=percentPosition;codepoint=0}else{percentPosition+=3;if(percentPosition>=end||url.charCodeAt(percentPosition)!==37)return url.substring(start,end)}}return decoded+url.substring(last)}var defaultOptions4={type:"string"};var query={decodeValue:true,get(name,{type,maxItems}=defaultOptions4){if(type==="bool"){const search2=JSON.stringify(encodeURIComponent(name));const searchLen2=search2.length-2;return Function(`return ({pathEnd,req:{url}})=>{const i=url.indexOf(${search2},pathEnd+1);return i!==-1&&(i===pathEnd+1||url.charCodeAt(i-1)===38)&&(i+${searchLen2}===url.length||url.charCodeAt(i+${searchLen2})===38);}`)()}const search=JSON.stringify(`${encodeURIComponent(name)}=`);const searchLen=search.length-2;if(type==="string"){const{decodeValue}=this;return typeof maxItems==="undefined"||maxItems<2?Function("d",`return ({pathEnd,req:{url}})=>{const i=url.indexOf(${search},pathEnd+1)+${searchLen};if(i===${searchLen-1})return null;const n=url.indexOf("&",i);return ${decodeValue?"d(url,i,n===-1?url.length:n)":"n===-1?url.substring(i):url.substring(i,n)"};}`)(this.decode):Function("d",`return ({pathEnd,req:{url}})=>{let i=url.indexOf(${search},pathEnd+1)+${searchLen};if(i===${searchLen-1})return [];const r=[];${decodeValue?"const {length}=url;":""}let l=0;do{const n=url.indexOf("&",i);if(n===-1){r.push(${decodeValue?"d(url,i,length)":"url.substring(i)"});return r;}r.push(${decodeValue?"d(url,i,n)":"url.substring(i,n)"});if(l===${maxItems-1})return r;i=url.indexOf(${search},n+1)+${searchLen};++l;}while(i!==${searchLen-1});return r;}`)(this.decode)}return typeof maxItems==="undefined"||maxItems<2?Function(`return ({pathEnd,req:{url}})=>{const i=url.indexOf(${search},pathEnd+1)+${searchLen};if(i===${searchLen-1})return Number.NaN;const n=url.indexOf("&",i);return n===-1?+url.substring(i):+url.substring(i,n);}`)():Function(`return ({pathEnd,req:{url}})=>{let i=url.indexOf(${search},pathEnd+1)+${searchLen};if(i===${searchLen-1})return [];const r=[];let l=0;do{const n=url.indexOf("&",i);if(n===-1){const v=+url.substring(i);if(!Number.isNaN(v))r.push(v);return r;}const v=+url.substring(i,n);if(!Number.isNaN(v)){r.push(v);if(l===${maxItems-1})return r;++l}i=url.indexOf(${search},n+1)+${searchLen};}while(i!==${searchLen-1});return r;}`)()},schema(schema){const{decodeValue}=this;const idxChecks=["++pathEnd;const {length}=url;"];const valueChecks=[];const idxs=[];const objParts=[];let idx=0;for(const key in schema){const{type,maxItems}=schema[key];if(type==="bool"){const search=JSON.stringify(encodeURIComponent(key));const searchLen=search.length-2;idxs.push(`const i${idx}=url.indexOf(${search},pathEnd);`);objParts.push(`${key}:i${idx}!==-1&&(i${idx}===pathEnd||url.charCodeAt(i${idx}-1)===38)&&(i${idx}+${searchLen}===length||url.charCodeAt(i${idx}+${searchLen})===38)`)}else{const search=JSON.stringify(`${encodeURIComponent(key)}=`);const searchLen=search.length-2;if(type==="string"){if(typeof maxItems==="undefined"||maxItems<2){idxChecks.push(`const s${idx}=url.indexOf(${search},pathEnd)+${searchLen};if(s${idx}===${searchLen-1})return null;`);idxs.push(`const i${idx}=url.indexOf("&",s${idx});`);objParts.push(`${key}:${decodeValue?`d(url,s${idx},i${idx}===-1?length:i${idx})`:`i${idx}===-1?url.substring(s${idx}):url.substring(s${idx},i${idx})`}`)}else{idxs.push(`const ${key}=[];let l${idx}=0;let i${idx}=url.indexOf(${search},pathEnd)+${searchLen};while(i${idx}!==${searchLen-1}){const n=url.indexOf("&",i${idx});if(n===-1){${key}.push(${decodeValue?`d(url,i${idx},length)`:`url.substring(i${idx})`});break;}${key}.push(${decodeValue?`d(url,i${idx},n)`:`url.substring(i${idx},n)`});if(l${idx}===${maxItems-1})break;i${idx}=url.indexOf(${search},n+1)+${searchLen};++l${idx};}`);objParts.push(key)}}else if(typeof maxItems==="undefined"||maxItems<2){idxChecks.push(`const s${idx}=url.indexOf(${search},pathEnd)+${searchLen};if(s${idx}===${searchLen-1})return null;`);valueChecks.push(`const i${idx}=url.indexOf("&",s${idx});const ${key}=i${idx}===-1?+url.substring(s${idx}):+url.substring(s${idx},i${idx});if(Number.isNaN(${key}))return null;`);objParts.push(key)}else{idxs.push(`const ${key}=[];let l${idx}=0;let i${idx}=url.indexOf(${search},pathEnd)+${searchLen};while(i${idx}!==${searchLen-1}){const n=url.indexOf("&",i${idx});if(n===-1){const v=+url.substring(i${idx});if(!Number.isNaN(v))${key}.push(v);break;}const v=+url.substring(i${idx},n);if(!Number.isNaN(v)){${key}.push(v);if(l${idx}===${maxItems-1})break;}i${idx}=url.indexOf(${search},n+1)+${searchLen};++l${idx};}`);objParts.push(key)}}++idx}return Function("d",`return ({pathEnd,req:{url}})=>{${idxChecks.join("")}${valueChecks.join("")}${idxs.join("")}return {${objParts.join()}};}`)(this.decode)},decode:decodeURIComponent};var form={get(prop,{type,multipleItems}){return $async(Function("n",`const p=(f)=>${type==="string"?multipleItems===true?`{const v=f.getAll(${JSON.stringify(prop)});return v.every((x)=>typeof x==='string')?v:null;}`:`{const v=f.get(${JSON.stringify(prop)});return typeof v==='string'?v:null;}`:type==="number"?multipleItems===true?`{const v=f.getAll(${JSON.stringify(prop)}).map((t)=>+t);return v.some(Number.isNaN)?v:null;}`:`{return +f.get(${JSON.stringify(prop)});}`:type==="file"?multipleItems===true?`{const v=f.getAll(${JSON.stringify(prop)});return v.every((x)=>x instanceof File)?v:null;}`:`{const v=f.get(${JSON.stringify(prop)});return v instanceof File?v:null;}`:`f.has(${JSON.stringify(prop)})`};return (c)=>c.req.formData().then(p).catch(n);`)(noop))},schema(schema){const parts=[""];const sets=[];for(const key in schema){const item=schema[key];const{type}=item;if(type==="string"){parts.push(item.multipleItems===true?`const ${key}=f.getAll(${JSON.stringify(key)});if(${key}.some((x)=>typeof x!=='string'))return null;`:`const ${key}=f.get(${JSON.stringify(key)});if(typeof ${key}!=='string')return null;`);sets.push(key)}else if(type==="number"){parts.push(item.multipleItems===true?`const ${key}=f.getAll(${JSON.stringify(key)}).map((t)=>+t);if(${key}.some(Number.isNaN))return null;`:`const ${key}=+f.get(${JSON.stringify(key)});if(Number.isNaN(${key}))return null;`);sets.push(key)}else if(type==="file"){parts.push(item.multipleItems===true?`const ${key}=f.getAll(${JSON.stringify(key)});if(${key}.some((x)=>!(x instanceof File)))return null;`:`const ${key}=+f.get(${JSON.stringify(key)});if(!(${key} instanceof File))return null;`)}else sets.push(`${key}:f.has(${JSON.stringify(key)})`)}return $async(Function("n",`const p=(f)=>{${parts.join("")}return {${sets}};};return (c)=>c.req.formData().then(p).catch(n);`)(noop))}};export{stringifyQuery,serialize,send,query,jsonPair,isAsync,htmlPair,getInjectFn,form,csrf,cors,bit,Route,Context,Byte,BitClient,AsyncFunction,$async};