@d1g1tal/transportr 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [3.0.3](https://github.com/D1g1talEntr0py/transportr/compare/v3.0.2...v3.0.3) (2026-04-07)
2
+
3
+ ### Bug Fixes
4
+
5
+ * restores direct body parameter for request methods (a106100d6a7ba87e327a9823e32f692fe6c0fa9c)
6
+ Addresses a regression introduced during the TypeScript conversion where the signatures for body-accepting methods (POST, PUT, PATCH, DELETE) were inadvertently removed.
7
+ Restores the ability to pass the request body as a direct parameter rather than forcing it inside an options object, improving developer ergonomics and ensuring backwards compatibility.
8
+ Centralizes the overload resolution logic into a shared helper to cleanly resolve path, body, and options arguments.
9
+
1
10
  ## [3.0.2](https://github.com/D1g1talEntr0py/transportr/compare/v3.0.1...v3.0.2) (2026-04-07)
2
11
 
3
12
  ### Bug Fixes
@@ -982,35 +982,35 @@ declare class Transportr {
982
982
  unwrap: false;
983
983
  }): Promise<Result<T | undefined>>;
984
984
  /** Returns a Result tuple instead of throwing. */
985
- post<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & {
985
+ post<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & {
986
986
  unwrap: false;
987
987
  }): Promise<Result<T | undefined>>;
988
988
  /** Returns a Result tuple instead of throwing. */
989
- post<T extends ResponseBody = ResponseBody>(path: RequestOptions & {
989
+ post<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & {
990
990
  unwrap: false;
991
991
  }): Promise<Result<T | undefined>>;
992
992
  /** Returns a Result tuple instead of throwing. */
993
- put<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & {
993
+ put<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & {
994
994
  unwrap: false;
995
995
  }): Promise<Result<T | undefined>>;
996
996
  /** Returns a Result tuple instead of throwing. */
997
- put<T extends ResponseBody = ResponseBody>(path: RequestOptions & {
997
+ put<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & {
998
998
  unwrap: false;
999
999
  }): Promise<Result<T | undefined>>;
1000
1000
  /** Returns a Result tuple instead of throwing. */
1001
- patch<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & {
1001
+ patch<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & {
1002
1002
  unwrap: false;
1003
1003
  }): Promise<Result<T | undefined>>;
1004
1004
  /** Returns a Result tuple instead of throwing. */
1005
- patch<T extends ResponseBody = ResponseBody>(path: RequestOptions & {
1005
+ patch<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & {
1006
1006
  unwrap: false;
1007
1007
  }): Promise<Result<T | undefined>>;
1008
1008
  /** Returns a Result tuple instead of throwing. */
1009
- delete<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & {
1009
+ delete<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & {
1010
1010
  unwrap: false;
1011
1011
  }): Promise<Result<T | undefined>>;
1012
1012
  /** Returns a Result tuple instead of throwing. */
1013
- delete<T extends ResponseBody = ResponseBody>(path: RequestOptions & {
1013
+ delete<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & {
1014
1014
  unwrap: false;
1015
1015
  }): Promise<Result<T | undefined>>;
1016
1016
  /** Returns a Result tuple instead of throwing. */
@@ -1159,6 +1159,16 @@ declare class Transportr {
1159
1159
  * @returns A promise that resolves after the delay.
1160
1160
  */
1161
1161
  private static retryDelay;
1162
+ /**
1163
+ * Shared implementation for body-accepting HTTP methods (POST, PUT, PATCH, DELETE).
1164
+ * @param method The HTTP method to use.
1165
+ * @param path The request path, or the request body when called without a path.
1166
+ * @param body The request body, or options when called without a path.
1167
+ * @param options Additional request options.
1168
+ * @param responseHandler Optional response handler override.
1169
+ * @returns A promise that resolves to the response body.
1170
+ */
1171
+ private executeBodyMethod;
1162
1172
  /**
1163
1173
  * It returns a response handler based on the content type of the response.
1164
1174
  * @param path The path to the resource.
@@ -1,8 +1,8 @@
1
- var B=/^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u,Ue=/(["\\])/ug,xe=/^[\t\u0020-\u007E\u0080-\u00FF]*$/u,ie=class ae extends Map{constructor(e=[]){super(e)}static isValid(e,t){return B.test(e)&&xe.test(t)}get(e){return super.get(e.toLowerCase())}has(e){return super.has(e.toLowerCase())}set(e,t){if(!ae.isValid(e,t))throw new Error(`Invalid media type parameter name/value: ${e}/${t}`);return super.set(e.toLowerCase(),t),this}delete(e){return super.delete(e.toLowerCase())}toString(){return Array.from(this).map(([e,t])=>`;${e}=${!t||!B.test(t)?`"${t.replace(Ue,"\\$1")}"`:t}`).join("")}get[Symbol.toStringTag](){return"MediaTypeParameters"}},Le=new Set([" "," ",`
2
- `,"\r"]),Be=/[ \t\n\r]+$/u,Ie=/^[ \t\n\r]+|[ \t\n\r]+$/ug,Me=class O{static parse(e){e=e.replace(Ie,"");let t=0,[n,r]=O.collect(e,t,["/"]);if(t=r,!n.length||t>=e.length||!B.test(n))throw new TypeError(O.generateErrorMessage("type",n));++t;let[o,i]=O.collect(e,t,[";"],!0,!0);if(t=i,!o.length||!B.test(o))throw new TypeError(O.generateErrorMessage("subtype",o));let a=new ie;for(;t<e.length;){for(++t;Le.has(e[t]);)++t;let u;if([u,t]=O.collect(e,t,[";","="],!1),t>=e.length||e[t]===";")continue;++t;let R;if(e[t]==='"')for([R,t]=O.collectHttpQuotedString(e,t);t<e.length&&e[t]!==";";)++t;else if([R,t]=O.collect(e,t,[";"],!1,!0),!R)continue;u&&ie.isValid(u,R)&&!a.has(u)&&a.set(u,R)}return{type:n,subtype:o,parameters:a}}get[Symbol.toStringTag](){return"MediaTypeParser"}static collect(e,t,n,r=!0,o=!1){let i="";for(let{length:a}=e;t<a&&!n.includes(e[t]);t++)i+=e[t];return r&&(i=i.toLowerCase()),o&&(i=i.replace(Be,"")),[i,t]}static collectHttpQuotedString(e,t){let n="";for(let r=e.length,o;++t<r&&(o=e[t])!=='"';)n+=o=="\\"&&++t<r?e[t]:o;return[n,t]}static generateErrorMessage(e,t){return`Invalid ${e} "${t}": only HTTP token code points are valid.`}},b=class ue{_type;_subtype;_parameters;constructor(e,t={}){if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError("The parameters argument must be an object");({type:this._type,subtype:this._subtype,parameters:this._parameters}=Me.parse(e));for(let[n,r]of Object.entries(t))this._parameters.set(n,r)}static parse(e){try{return new ue(e)}catch{}return null}get type(){return this._type}get subtype(){return this._subtype}get essence(){return`${this._type}/${this._subtype}`}get parameters(){return this._parameters}matches(e){return typeof e=="string"?this.essence.includes(e):this._type===e._type&&this._subtype===e._subtype}toString(){return`${this.essence}${this._parameters.toString()}`}get[Symbol.toStringTag](){return"MediaType"}};var Ne=class extends Map{set(s,e){return super.set(s,e instanceof Set?e:(super.get(s)??new Set).add(e)),this}getOrInsert(s,e){return this.has(s)?super.get(s):(super.set(s,e instanceof Set?e:(super.get(s)??new Set).add(e)),e)}getOrInsertComputed(s,e){if(this.has(s))return super.get(s);let t=e(s);return super.set(s,t instanceof Set?t:(super.get(s)??new Set).add(t)),t}find(s,e){let t=this.get(s);if(t!==void 0)return Array.from(t).find(e)}hasValue(s,e){let t=super.get(s);return t?t.has(e):!1}deleteValue(s,e){if(e===void 0)return this.delete(s);let t=super.get(s);if(t){let n=t.delete(e);return t.size===0&&super.delete(s),n}return!1}get[Symbol.toStringTag](){return"SetMultiMap"}},De=class{context;eventHandler;constructor(s,e){this.context=s,this.eventHandler=e}handle(s,e){this.eventHandler.call(this.context,s,e)}get[Symbol.toStringTag](){return"ContextEventHandler"}},_e=class{_eventName;_contextEventHandler;constructor(s,e){this._eventName=s,this._contextEventHandler=e}get eventName(){return this._eventName}get contextEventHandler(){return this._contextEventHandler}get[Symbol.toStringTag](){return"Subscription"}},I=class{subscribers=new Ne;errorHandler;setErrorHandler(s){this.errorHandler=s}subscribe(s,e,t=e,n){if(this.validateEventName(s),n?.once){let i=e;e=(a,u)=>{i.call(t,a,u),this.unsubscribe(o)}}let r=new De(t,e);this.subscribers.set(s,r);let o=new _e(s,r);return o}unsubscribe({eventName:s,contextEventHandler:e}){let t=this.subscribers.get(s)??new Set,n=t.delete(e);return n&&t.size===0&&this.subscribers.delete(s),n}publish(s,e=new CustomEvent(s),t){this.validateEventName(s),this.subscribers.get(s)?.forEach(n=>{try{n.handle(e,t)}catch(r){this.errorHandler?this.errorHandler(r,s,e,t):console.error(`Error in event handler for '${s}':`,r)}})}isSubscribed({eventName:s,contextEventHandler:e}){return this.subscribers.get(s)?.has(e)??!1}validateEventName(s){if(!s||typeof s!="string")throw new TypeError("Event name must be a non-empty string");if(s.trim()!==s)throw new Error("Event name cannot have leading or trailing whitespace")}destroy(){this.subscribers.clear()}get[Symbol.toStringTag](){return"Subscribr"}};var A=class extends Error{_entity;responseStatus;_url;_method;_timing;constructor(e,{message:t,cause:n,entity:r,url:o,method:i,timing:a}={}){super(t,{cause:n}),this._entity=r,this.responseStatus=e,this._url=o,this._method=i,this._timing=a}get entity(){return this._entity}get statusCode(){return this.responseStatus.code}get statusText(){return this.responseStatus?.text}get url(){return this._url}get method(){return this._method}get timing(){return this._timing}get name(){return"HttpError"}get[Symbol.toStringTag](){return this.name}};var w=class{_code;_text;constructor(e,t){this._code=e,this._text=t}get code(){return this._code}get text(){return this._text}get[Symbol.toStringTag](){return"ResponseStatus"}toString(){return`${this._code} ${this._text}`}};var v={charset:"utf-8"},le=/\/$/,de="XSRF-TOKEN",ce="X-XSRF-TOKEN",m={PNG:new b("image/png"),TEXT:new b("text/plain",v),JSON:new b("application/json",v),HTML:new b("text/html",v),JAVA_SCRIPT:new b("text/javascript",v),CSS:new b("text/css",v),XML:new b("application/xml",v),BIN:new b("application/octet-stream"),EVENT_STREAM:new b("text/event-stream",v),NDJSON:new b("application/x-ndjson",v)},F=m.JSON.toString(),J=globalThis.location?.origin??"http://localhost",pe={DEFAULT:"default",FORCE_CACHE:"force-cache",NO_CACHE:"no-cache",NO_STORE:"no-store",ONLY_IF_CACHED:"only-if-cached",RELOAD:"reload"},y={CONFIGURED:"configured",SUCCESS:"success",ERROR:"error",ABORTED:"aborted",TIMEOUT:"timeout",RETRY:"retry",COMPLETE:"complete",ALL_COMPLETE:"all-complete"},P={ABORT:"abort",TIMEOUT:"timeout"},H={ABORT:"AbortError",TIMEOUT:"TimeoutError"},U={once:!0,passive:!0},M=()=>new CustomEvent(P.ABORT,{detail:{cause:H.ABORT}}),fe=()=>new CustomEvent(P.TIMEOUT,{detail:{cause:H.TIMEOUT}}),Re=["POST","PUT","PATCH","DELETE"],he=new w(500,"Internal Server Error"),ge=new w(499,"Aborted"),me=new w(504,"Request Timeout"),$=[408,413,429,500,502,503,504],G=["GET","PUT","HEAD","DELETE","OPTIONS"],N=300,D=2;var _=class{abortSignal;abortController=new AbortController;events=new Map;constructor({signal:e,timeout:t=1/0}={}){if(t<0)throw new RangeError("The timeout cannot be negative");let n=[this.abortController.signal];e!=null&&n.push(e),t!==1/0&&n.push(AbortSignal.timeout(t)),(this.abortSignal=AbortSignal.any(n)).addEventListener(P.ABORT,this,U)}handleEvent({target:{reason:e}}){this.abortController.signal.aborted||e instanceof DOMException&&e.name===H.TIMEOUT&&this.abortSignal.dispatchEvent(fe())}get signal(){return this.abortSignal}onAbort(e){return this.addEventListener(P.ABORT,e)}onTimeout(e){return this.addEventListener(P.TIMEOUT,e)}abort(e=M()){this.abortController.abort(e.detail?.cause)}destroy(){this.abortSignal.removeEventListener(P.ABORT,this,U);for(let[e,t]of this.events)this.abortSignal.removeEventListener(t,e,U);return this.events.clear(),this}addEventListener(e,t){return this.abortSignal.addEventListener(e,t,U),this.events.set(t,e),this}get[Symbol.toStringTag](){return"SignalController"}};var ye,je,X=()=>je??=import("./OP3JQ447.js").then(({default:s})=>e=>s.sanitize(e)),k=async()=>typeof document<"u"&&typeof DOMParser<"u"&&typeof DocumentFragment<"u"?Promise.resolve():ye??=import("jsdom").then(({JSDOM:s})=>{let{window:e}=new s("<!DOCTYPE html><html><head></head><body></body></html>",{url:"http://localhost"});globalThis.window=e,Object.assign(globalThis,{document:e.document,DOMParser:e.DOMParser,DocumentFragment:e.DocumentFragment})}).catch(()=>{throw ye=void 0,new Error("jsdom is required for HTML/XML/DOM features in Node.js environments. Install it with: npm install jsdom")}),be=async s=>await s.text(),V=async s=>{await k();let e=URL.createObjectURL(await s.blob());return new Promise((t,n)=>{let r=document.createElement("script");Object.assign(r,{src:e,type:"text/javascript",async:!0}),r.onload=()=>{URL.revokeObjectURL(e),document.head.removeChild(r),t()},r.onerror=()=>{URL.revokeObjectURL(e),document.head.removeChild(r),n(new Error("Script failed to load"))},document.head.appendChild(r)})},z=async s=>{await k();let e=URL.createObjectURL(await s.blob());return new Promise((t,n)=>{let r=document.createElement("link");Object.assign(r,{href:e,type:"text/css",rel:"stylesheet"}),r.onload=()=>t(URL.revokeObjectURL(e)),r.onerror=()=>{URL.revokeObjectURL(e),document.head.removeChild(r),n(new Error("Stylesheet load failed"))},document.head.appendChild(r)})},K=async s=>await s.json(),Te=async s=>await s.blob(),W=async s=>{await k();let e=URL.createObjectURL(await s.blob());return new Promise((t,n)=>{let r=new Image;r.onload=()=>{URL.revokeObjectURL(e),t(r)},r.onerror=()=>{URL.revokeObjectURL(e),n(new Error("Image failed to load"))},r.src=e})},Ee=async s=>await s.arrayBuffer(),Y=async s=>Promise.resolve(s.body),Q=async s=>{await k();let e=await X();return new DOMParser().parseFromString(e(await s.text()),"application/xml")},Z=async s=>{await k();let e=await X();return new DOMParser().parseFromString(e(await s.text()),"text/html")},Se=async s=>{await k();let e=await X();return document.createRange().createContextualFragment(e(await s.text()))},Oe=s=>({[Symbol.asyncIterator](){let e=s.body.getReader(),t=new TextDecoder,n="",r=!1;return{async next(){for(;!r;){let o=n.indexOf(`
1
+ var L=/^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u,Ce=/(["\\])/ug,Ue=/^[\t\u0020-\u007E\u0080-\u00FF]*$/u,ie=class ae extends Map{constructor(e=[]){super(e)}static isValid(e,t){return L.test(e)&&Ue.test(t)}get(e){return super.get(e.toLowerCase())}has(e){return super.has(e.toLowerCase())}set(e,t){if(!ae.isValid(e,t))throw new Error(`Invalid media type parameter name/value: ${e}/${t}`);return super.set(e.toLowerCase(),t),this}delete(e){return super.delete(e.toLowerCase())}toString(){return Array.from(this).map(([e,t])=>`;${e}=${!t||!L.test(t)?`"${t.replace(Ce,"\\$1")}"`:t}`).join("")}get[Symbol.toStringTag](){return"MediaTypeParameters"}},xe=new Set([" "," ",`
2
+ `,"\r"]),Le=/[ \t\n\r]+$/u,Ie=/^[ \t\n\r]+|[ \t\n\r]+$/ug,Me=class w{static parse(e){e=e.replace(Ie,"");let t=0,[n,r]=w.collect(e,t,["/"]);if(t=r,!n.length||t>=e.length||!L.test(n))throw new TypeError(w.generateErrorMessage("type",n));++t;let[o,i]=w.collect(e,t,[";"],!0,!0);if(t=i,!o.length||!L.test(o))throw new TypeError(w.generateErrorMessage("subtype",o));let a=new ie;for(;t<e.length;){for(++t;xe.has(e[t]);)++t;let d;if([d,t]=w.collect(e,t,[";","="],!1),t>=e.length||e[t]===";")continue;++t;let R;if(e[t]==='"')for([R,t]=w.collectHttpQuotedString(e,t);t<e.length&&e[t]!==";";)++t;else if([R,t]=w.collect(e,t,[";"],!1,!0),!R)continue;d&&ie.isValid(d,R)&&!a.has(d)&&a.set(d,R)}return{type:n,subtype:o,parameters:a}}get[Symbol.toStringTag](){return"MediaTypeParser"}static collect(e,t,n,r=!0,o=!1){let i="";for(let{length:a}=e;t<a&&!n.includes(e[t]);t++)i+=e[t];return r&&(i=i.toLowerCase()),o&&(i=i.replace(Le,"")),[i,t]}static collectHttpQuotedString(e,t){let n="";for(let r=e.length,o;++t<r&&(o=e[t])!=='"';)n+=o=="\\"&&++t<r?e[t]:o;return[n,t]}static generateErrorMessage(e,t){return`Invalid ${e} "${t}": only HTTP token code points are valid.`}},T=class ue{_type;_subtype;_parameters;constructor(e,t={}){if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError("The parameters argument must be an object");({type:this._type,subtype:this._subtype,parameters:this._parameters}=Me.parse(e));for(let[n,r]of Object.entries(t))this._parameters.set(n,r)}static parse(e){try{return new ue(e)}catch{}return null}get type(){return this._type}get subtype(){return this._subtype}get essence(){return`${this._type}/${this._subtype}`}get parameters(){return this._parameters}matches(e){return typeof e=="string"?this.essence.includes(e):this._type===e._type&&this._subtype===e._subtype}toString(){return`${this.essence}${this._parameters.toString()}`}get[Symbol.toStringTag](){return"MediaType"}};var Ne=class extends Map{set(s,e){return super.set(s,e instanceof Set?e:(super.get(s)??new Set).add(e)),this}getOrInsert(s,e){return this.has(s)?super.get(s):(super.set(s,e instanceof Set?e:(super.get(s)??new Set).add(e)),e)}getOrInsertComputed(s,e){if(this.has(s))return super.get(s);let t=e(s);return super.set(s,t instanceof Set?t:(super.get(s)??new Set).add(t)),t}find(s,e){let t=this.get(s);if(t!==void 0)return Array.from(t).find(e)}hasValue(s,e){let t=super.get(s);return t?t.has(e):!1}deleteValue(s,e){if(e===void 0)return this.delete(s);let t=super.get(s);if(t){let n=t.delete(e);return t.size===0&&super.delete(s),n}return!1}get[Symbol.toStringTag](){return"SetMultiMap"}},De=class{context;eventHandler;constructor(s,e){this.context=s,this.eventHandler=e}handle(s,e){this.eventHandler.call(this.context,s,e)}get[Symbol.toStringTag](){return"ContextEventHandler"}},_e=class{_eventName;_contextEventHandler;constructor(s,e){this._eventName=s,this._contextEventHandler=e}get eventName(){return this._eventName}get contextEventHandler(){return this._contextEventHandler}get[Symbol.toStringTag](){return"Subscription"}},I=class{subscribers=new Ne;errorHandler;setErrorHandler(s){this.errorHandler=s}subscribe(s,e,t=e,n){if(this.validateEventName(s),n?.once){let i=e;e=(a,d)=>{i.call(t,a,d),this.unsubscribe(o)}}let r=new De(t,e);this.subscribers.set(s,r);let o=new _e(s,r);return o}unsubscribe({eventName:s,contextEventHandler:e}){let t=this.subscribers.get(s)??new Set,n=t.delete(e);return n&&t.size===0&&this.subscribers.delete(s),n}publish(s,e=new CustomEvent(s),t){this.validateEventName(s),this.subscribers.get(s)?.forEach(n=>{try{n.handle(e,t)}catch(r){this.errorHandler?this.errorHandler(r,s,e,t):console.error(`Error in event handler for '${s}':`,r)}})}isSubscribed({eventName:s,contextEventHandler:e}){return this.subscribers.get(s)?.has(e)??!1}validateEventName(s){if(!s||typeof s!="string")throw new TypeError("Event name must be a non-empty string");if(s.trim()!==s)throw new Error("Event name cannot have leading or trailing whitespace")}destroy(){this.subscribers.clear()}get[Symbol.toStringTag](){return"Subscribr"}};var k=class extends Error{_entity;responseStatus;_url;_method;_timing;constructor(e,{message:t,cause:n,entity:r,url:o,method:i,timing:a}={}){super(t,{cause:n}),this._entity=r,this.responseStatus=e,this._url=o,this._method=i,this._timing=a}get entity(){return this._entity}get statusCode(){return this.responseStatus.code}get statusText(){return this.responseStatus?.text}get url(){return this._url}get method(){return this._method}get timing(){return this._timing}get name(){return"HttpError"}get[Symbol.toStringTag](){return this.name}};var v=class{_code;_text;constructor(e,t){this._code=e,this._text=t}get code(){return this._code}get text(){return this._text}get[Symbol.toStringTag](){return"ResponseStatus"}toString(){return`${this._code} ${this._text}`}};var q={charset:"utf-8"},de=/\/$/,le="XSRF-TOKEN",ce="X-XSRF-TOKEN",m={PNG:new T("image/png"),TEXT:new T("text/plain",q),JSON:new T("application/json",q),HTML:new T("text/html",q),JAVA_SCRIPT:new T("text/javascript",q),CSS:new T("text/css",q),XML:new T("application/xml",q),BIN:new T("application/octet-stream"),EVENT_STREAM:new T("text/event-stream",q),NDJSON:new T("application/x-ndjson",q)},$=m.JSON.toString(),G=globalThis.location?.origin??"http://localhost",pe={DEFAULT:"default",FORCE_CACHE:"force-cache",NO_CACHE:"no-cache",NO_STORE:"no-store",ONLY_IF_CACHED:"only-if-cached",RELOAD:"reload"},b={CONFIGURED:"configured",SUCCESS:"success",ERROR:"error",ABORTED:"aborted",TIMEOUT:"timeout",RETRY:"retry",COMPLETE:"complete",ALL_COMPLETE:"all-complete"},H={ABORT:"abort",TIMEOUT:"timeout"},A={ABORT:"AbortError",TIMEOUT:"TimeoutError"},U={once:!0,passive:!0},M=()=>new CustomEvent(H.ABORT,{detail:{cause:A.ABORT}}),fe=()=>new CustomEvent(H.TIMEOUT,{detail:{cause:A.TIMEOUT}}),Re=["POST","PUT","PATCH","DELETE"],he=new v(500,"Internal Server Error"),ge=new v(499,"Aborted"),me=new v(504,"Request Timeout"),X=[408,413,429,500,502,503,504],V=["GET","PUT","HEAD","DELETE","OPTIONS"],N=300,D=2;var _=class{abortSignal;abortController=new AbortController;events=new Map;constructor({signal:e,timeout:t=1/0}={}){if(t<0)throw new RangeError("The timeout cannot be negative");let n=[this.abortController.signal];e!=null&&n.push(e),t!==1/0&&n.push(AbortSignal.timeout(t)),(this.abortSignal=AbortSignal.any(n)).addEventListener(H.ABORT,this,U)}handleEvent({target:{reason:e}}){this.abortController.signal.aborted||e instanceof DOMException&&e.name===A.TIMEOUT&&this.abortSignal.dispatchEvent(fe())}get signal(){return this.abortSignal}onAbort(e){return this.addEventListener(H.ABORT,e)}onTimeout(e){return this.addEventListener(H.TIMEOUT,e)}abort(e=M()){this.abortController.abort(e.detail?.cause)}destroy(){this.abortSignal.removeEventListener(H.ABORT,this,U);for(let[e,t]of this.events)this.abortSignal.removeEventListener(t,e,U);return this.events.clear(),this}addEventListener(e,t){return this.abortSignal.addEventListener(e,t,U),this.events.set(t,e),this}get[Symbol.toStringTag](){return"SignalController"}};var ye,je,z=()=>je??=import("./OP3JQ447.js").then(({default:s})=>e=>s.sanitize(e)),B=async()=>typeof document<"u"&&typeof DOMParser<"u"&&typeof DocumentFragment<"u"?Promise.resolve():ye??=import("jsdom").then(({JSDOM:s})=>{let{window:e}=new s("<!DOCTYPE html><html><head></head><body></body></html>",{url:"http://localhost"});globalThis.window=e,Object.assign(globalThis,{document:e.document,DOMParser:e.DOMParser,DocumentFragment:e.DocumentFragment})}).catch(()=>{throw ye=void 0,new Error("jsdom is required for HTML/XML/DOM features in Node.js environments. Install it with: npm install jsdom")}),be=async s=>await s.text(),K=async s=>{await B();let e=URL.createObjectURL(await s.blob());return new Promise((t,n)=>{let r=document.createElement("script");Object.assign(r,{src:e,type:"text/javascript",async:!0}),r.onload=()=>{URL.revokeObjectURL(e),document.head.removeChild(r),t()},r.onerror=()=>{URL.revokeObjectURL(e),document.head.removeChild(r),n(new Error("Script failed to load"))},document.head.appendChild(r)})},W=async s=>{await B();let e=URL.createObjectURL(await s.blob());return new Promise((t,n)=>{let r=document.createElement("link");Object.assign(r,{href:e,type:"text/css",rel:"stylesheet"}),r.onload=()=>t(URL.revokeObjectURL(e)),r.onerror=()=>{URL.revokeObjectURL(e),document.head.removeChild(r),n(new Error("Stylesheet load failed"))},document.head.appendChild(r)})},Y=async s=>await s.json(),Te=async s=>await s.blob(),Q=async s=>{await B();let e=URL.createObjectURL(await s.blob());return new Promise((t,n)=>{let r=new Image;r.onload=()=>{URL.revokeObjectURL(e),t(r)},r.onerror=()=>{URL.revokeObjectURL(e),n(new Error("Image failed to load"))},r.src=e})},Ee=async s=>await s.arrayBuffer(),Z=async s=>Promise.resolve(s.body),ee=async s=>{await B();let e=await z();return new DOMParser().parseFromString(e(await s.text()),"application/xml")},te=async s=>{await B();let e=await z();return new DOMParser().parseFromString(e(await s.text()),"text/html")},Se=async s=>{await B();let e=await z();return document.createRange().createContextualFragment(e(await s.text()))},Oe=s=>({[Symbol.asyncIterator](){let e=s.body.getReader(),t=new TextDecoder,n="",r=!1;return{async next(){for(;!r;){let o=n.indexOf(`
3
3
 
4
- `);if(o!==-1){let a=n.slice(0,o);n=n.slice(o+2);let u={event:"message",data:"",id:"",retry:void 0},R=[],g=a.split(`
5
- `);for(let h=0;h<g.length;h++){let c=g[h];if(c.startsWith(":"))continue;let d=c.indexOf(":"),l,p;switch(d===-1?(l=c,p=""):(l=c.slice(0,d),p=c.slice(d+1),p.charCodeAt(0)===32&&(p=p.slice(1))),l){case"event":u.event=p;break;case"data":R.push(p);break;case"id":u.id=p;break;case"retry":{let x=parseInt(p,10);isNaN(x)||(u.retry=x);break}}}if(u.data=R.join(`
6
- `),u.data||u.event!=="message")return{value:u,done:!1};continue}let i=await e.read();if(i.done){r=!0;break}n+=t.decode(i.value,{stream:!0})}return{value:void 0,done:!0}},async return(){return await e.cancel(),r=!0,{value:void 0,done:!0}}}}}),we=s=>({[Symbol.asyncIterator](){let e=s.body.getReader(),t=new TextDecoder,n="",r=!1;return{async next(){for(;!r;){let o=n.indexOf(`
7
- `);if(o!==-1){let a=n.slice(0,o).trim();if(n=n.slice(o+1),a)return{value:JSON.parse(a),done:!1};continue}let i=await e.read();if(i.done){r=!0;let a=(n+t.decode()).trim();if(n="",a)return{value:JSON.parse(a),done:!1};break}n+=t.decode(i.value,{stream:!0})}return{value:void 0,done:!0}},async return(){return await e.cancel(),r=!0,{value:void 0,done:!0}}}}});var ve=s=>s!==void 0&&Re.includes(s),qe=s=>s instanceof FormData||s instanceof Blob||s instanceof ArrayBuffer||s instanceof ReadableStream||s instanceof URLSearchParams||ArrayBuffer.isView(s),Pe=s=>{if(typeof document>"u"||!document.cookie)return;let e=`${s}=`,t=document.cookie.split(";");for(let n=0,r=t.length;n<r;n++){let o=t[n].trim();if(o.startsWith(e))return decodeURIComponent(o.slice(e.length))}},He=s=>JSON.stringify(s),te=s=>s!==null&&typeof s=="string",Ae=s=>s instanceof ArrayBuffer||Object.prototype.toString.call(s)==="[object ArrayBuffer]",T=s=>s!==null&&typeof s=="object"&&!Array.isArray(s)&&Object.getPrototypeOf(s)===Object.prototype,se=(...s)=>{let e=s.length;if(e===0)return;if(e===1){let[n]=s;return T(n)?ee(n):n}let t={};for(let n of s){if(!T(n))return;for(let[r,o]of Object.entries(n)){let i=t[r];Array.isArray(o)?t[r]=[...o,...Array.isArray(i)?i.filter(a=>!o.includes(a)):[]]:T(o)?t[r]=T(i)?se(i,o):ee(o):t[r]=o}}return t};function ee(s){if(T(s)){let e={},t=Object.keys(s);for(let n=0,r=t.length,o;n<r;n++)o=t[n],e[o]=ee(s[o]);return e}return s}var ke=class s{_baseUrl;_options;subscribr;hooks={beforeRequest:[],afterResponse:[],beforeError:[]};static globalSubscribr=new I;static globalHooks={beforeRequest:[],afterResponse:[],beforeError:[]};static signalControllers=new Set;static inflightRequests=new Map;static mediaTypeCache=new Map(Object.values(m).map(e=>[e.toString(),e]));static contentTypeHandlers=[[m.TEXT.type,be],[m.JSON.subtype,K],[m.BIN.subtype,Y],[m.HTML.subtype,Z],[m.XML.subtype,Q],[m.PNG.type,W],[m.JAVA_SCRIPT.subtype,V],[m.CSS.subtype,z]];constructor(e=J,t={}){T(e)&&([e,t]=[J,e]),this._baseUrl=s.getBaseUrl(e),this._options=s.createOptions(t,s.defaultRequestOptions),this.subscribr=new I}static CredentialsPolicy={INCLUDE:"include",OMIT:"omit",SAME_ORIGIN:"same-origin"};static RequestMode={CORS:"cors",NAVIGATE:"navigate",NO_CORS:"no-cors",SAME_ORIGIN:"same-origin"};static RequestPriority={HIGH:"high",LOW:"low",AUTO:"auto"};static RedirectPolicy={ERROR:"error",FOLLOW:"follow",MANUAL:"manual"};static ReferrerPolicy={NO_REFERRER:"no-referrer",NO_REFERRER_WHEN_DOWNGRADE:"no-referrer-when-downgrade",ORIGIN:"origin",ORIGIN_WHEN_CROSS_ORIGIN:"origin-when-cross-origin",SAME_ORIGIN:"same-origin",STRICT_ORIGIN:"strict-origin",STRICT_ORIGIN_WHEN_CROSS_ORIGIN:"strict-origin-when-cross-origin",UNSAFE_URL:"unsafe-url"};static RequestEvent=y;static defaultRequestOptions={body:void 0,cache:pe.NO_STORE,credentials:s.CredentialsPolicy.SAME_ORIGIN,headers:new Headers({"content-type":F,accept:F}),searchParams:void 0,integrity:void 0,keepalive:void 0,method:"GET",mode:s.RequestMode.CORS,priority:s.RequestPriority.AUTO,redirect:s.RedirectPolicy.FOLLOW,referrer:"about:client",referrerPolicy:s.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN,signal:void 0,timeout:3e4,global:!0};static register(e,t,n){return s.globalSubscribr.subscribe(e,t,n)}static unregister(e){return s.globalSubscribr.unsubscribe(e)}static abortAll(){for(let e of this.signalControllers)e.abort(M());this.signalControllers.clear()}static all(e){return Promise.all(e)}static async race(e){let t=[],n=new Array(e.length);for(let r=0;r<e.length;r++){let o=new AbortController;t.push(o),n[r]=e[r](o.signal)}try{return await Promise.race(n)}finally{for(let r of t)r.abort()}}static registerContentTypeHandler(e,t){s.contentTypeHandlers.unshift([e,t])}static unregisterContentTypeHandler(e){let t=s.contentTypeHandlers.findIndex(([n])=>n===e);return t===-1?!1:(s.contentTypeHandlers.splice(t,1),!0)}static addHooks(e){e.beforeRequest&&s.globalHooks.beforeRequest.push(...e.beforeRequest),e.afterResponse&&s.globalHooks.afterResponse.push(...e.afterResponse),e.beforeError&&s.globalHooks.beforeError.push(...e.beforeError)}static clearHooks(){s.globalHooks={beforeRequest:[],afterResponse:[],beforeError:[]}}static unregisterAll(){s.abortAll(),s.globalSubscribr=new I,s.clearHooks(),s.inflightRequests.clear()}get baseUrl(){return this._baseUrl}register(e,t,n){return this.subscribr.subscribe(e,t,n)}unregister(e){return this.subscribr.unsubscribe(e)}addHooks(e){return e.beforeRequest&&this.hooks.beforeRequest.push(...e.beforeRequest),e.afterResponse&&this.hooks.afterResponse.push(...e.afterResponse),e.beforeError&&this.hooks.beforeError.push(...e.beforeError),this}clearHooks(){return this.hooks.beforeRequest.length=0,this.hooks.afterResponse.length=0,this.hooks.beforeError.length=0,this}configure({headers:e,searchParams:t,hooks:n,...r}){return e&&s.mergeHeaders(this._options.headers,e),t&&s.mergeSearchParams(this._options.searchParams,t),Object.keys(r).length>0&&Object.assign(this._options,r),n&&this.addHooks(n),this}destroy(){this.clearHooks(),this.subscribr.destroy()}async get(e,t){return this._get(e,t)}async post(e,t){return typeof e!="string"&&([e,t]=[void 0,e]),this.execute(e,t,{method:"POST"})}async put(e,t){return this.execute(e,t,{method:"PUT"})}async patch(e,t){return this.execute(e,t,{method:"PATCH"})}async delete(e,t){return this.execute(e,t,{method:"DELETE"})}async head(e,t){return this.execute(e,t,{method:"HEAD"})}async options(e,t={}){T(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t,{method:"OPTIONS"}),{requestOptions:r}=n,o=r.unwrap!==!1,i=r.hooks;try{let a=s.createUrl(this._baseUrl,e,r.searchParams),u=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,i?.beforeRequest];for(let c of u)if(c)for(let d of c){let l=await d(r,a);l&&(Object.assign(r,l),l.searchParams!==void 0&&(a=s.createUrl(this._baseUrl,e,r.searchParams)))}let R=await this._request(e,n),g=[s.globalHooks.afterResponse,this.hooks.afterResponse,i?.afterResponse];for(let c of g)if(c)for(let d of c){let l=await d(R,r);l&&(R=l)}let h=R.headers.get("allow")?.split(",").map(c=>c.trim());return this.publish({name:y.SUCCESS,data:h,global:t.global}),o?h:[!0,h]}catch(a){if(!o)return[!1,a];throw a}}async request(e,t={}){T(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t,{}),r=n.requestOptions.unwrap!==!1;try{let o=await this._request(e,n);return this.publish({name:y.SUCCESS,data:o,global:t.global}),r?o:[!0,o]}catch(o){if(!r)return[!1,o];throw o}}async getJson(e,t){return this._get(e,t,{headers:{accept:`${m.JSON}`}},K)}async getXml(e,t){return this._get(e,t,{headers:{accept:`${m.XML}`}},Q)}async getHtml(e,t,n){let r=await this._get(e,t,{headers:{accept:`${m.HTML}`}},Z);return Array.isArray(r)?r:n&&r?r.querySelector(n):r}async getHtmlFragment(e,t,n){let r=await this._get(e,t,{headers:{accept:`${m.HTML}`}},Se);return Array.isArray(r)?r:n&&r?r.querySelector(n):r}async getScript(e,t){return this._get(e,t,{headers:{accept:`${m.JAVA_SCRIPT}`}},V)}async getStylesheet(e,t){return this._get(e,t,{headers:{accept:`${m.CSS}`}},z)}async getBlob(e,t){return this._get(e,t,{headers:{accept:"application/octet-stream"}},Te)}async getImage(e,t){return this._get(e,t,{headers:{accept:"image/*"}},W)}async getBuffer(e,t){return this._get(e,t,{headers:{accept:"application/octet-stream"}},Ee)}async getStream(e,t){return this._get(e,t,{headers:{accept:"application/octet-stream"}},Y)}async getEventStream(e,t){T(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t??{},{method:t?.body?"POST":"GET",headers:{accept:`${m.EVENT_STREAM}`}}),{requestOptions:r}=n,o=r.unwrap!==!1,i=r.hooks;try{let a=s.createUrl(this._baseUrl,e,r.searchParams),u=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,i?.beforeRequest];for(let d of u)if(d)for(let l of d){let p=await l(r,a);p&&(Object.assign(r,p),p.searchParams!==void 0&&(a=s.createUrl(this._baseUrl,e,r.searchParams)))}let g=await this._request(e,n),h=[s.globalHooks.afterResponse,this.hooks.afterResponse,i?.afterResponse];for(let d of h)if(d)for(let l of d){let p=await l(g,r);p&&(g=p)}this.publish({name:y.SUCCESS,data:g,global:n.global});let c=Oe(g);return o?c:[!0,c]}catch(a){if(!o)return[!1,a];throw a}}async getJsonStream(e,t){T(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t??{},{method:"GET",headers:{accept:`${m.NDJSON}`}}),{requestOptions:r}=n,o=r.unwrap!==!1,i=r.hooks;try{let a=s.createUrl(this._baseUrl,e,r.searchParams),u=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,i?.beforeRequest];for(let d of u)if(d)for(let l of d){let p=await l(r,a);p&&(Object.assign(r,p),p.searchParams!==void 0&&(a=s.createUrl(this._baseUrl,e,r.searchParams)))}let g=await this._request(e,n),h=[s.globalHooks.afterResponse,this.hooks.afterResponse,i?.afterResponse];for(let d of h)if(d)for(let l of d){let p=await l(g,r);p&&(g=p)}this.publish({name:y.SUCCESS,data:g,global:n.global});let c=we(g);return o?c:[!0,c]}catch(a){if(!o)return[!1,a];throw a}}async _get(e,t,n={},r){return this.execute(e,t,{...n,method:"GET",body:void 0},r)}async _request(e,{signalController:t,requestOptions:n,global:r}){s.signalControllers.add(t);let o=s.normalizeRetryOptions(n.retry),i=n.method??"GET",a=o.limit>0&&o.methods.includes(i),u=n.dedupe===!0&&(i==="GET"||i==="HEAD"),R=0,g=performance.now(),h=()=>{let c=performance.now();return{start:g,end:c,duration:c-g}};try{let c=s.createUrl(this._baseUrl,e,n.searchParams),d=u?`${i}:${c.href}`:"";if(u){let f=s.inflightRequests.get(d);if(f)return(await f).clone()}let l=n.body,p=n.onUploadProgress,x=async()=>{if(!p||l==null)return;let f=null;if(typeof l=="string")f=new TextEncoder().encode(l);else if(l instanceof Blob)f=new Uint8Array(await l.arrayBuffer());else if(Ae(l))f=new Uint8Array(l);else if(ArrayBuffer.isView(l))f=new Uint8Array(l.buffer,l.byteOffset,l.byteLength);else if(!(l instanceof ReadableStream))return;let E=f?f.byteLength:null,L=f?new ReadableStream({start(q){q.enqueue(f),q.close()}}):l,S=0,C=new TransformStream({transform(q,j){S+=q.byteLength,p({loaded:S,total:E,percentage:E!==null&&E>0?Math.round(S/E*100):null}),j.enqueue(q)}});n.body=L.pipeThrough(C),Object.assign(n,{duplex:"half"})},ne=async()=>{for(;;)try{await x();let f=await fetch(c,n);if(!f.ok){if(a&&R<o.limit&&o.statusCodes.includes(f.status)){R++,this.publish({name:y.RETRY,data:{attempt:R,status:f.status,method:i,path:e,timing:h()},global:r}),await s.retryDelay(o,R);continue}let E;try{E=await f.text()}catch{}throw await this.handleError(e,f,{entity:E,url:c,method:i,timing:h()},n)}return f}catch(f){if(f instanceof A)throw f;if(a&&R<o.limit){R++,this.publish({name:y.RETRY,data:{attempt:R,error:f.message,method:i,path:e,timing:h()},global:r}),await s.retryDelay(o,R);continue}throw await this.handleError(e,void 0,{cause:f,url:c,method:i,timing:h()},n)}},re=f=>{let E=n.onDownloadProgress;if(!E||!f.body)return f;let L=f.headers.get("content-length"),S=L?parseInt(L,10):null,C=0,q=new TransformStream({transform(oe,Ce){C+=oe.byteLength,E({loaded:C,total:S,percentage:S!==null&&S>0?Math.round(C/S*100):null}),Ce.enqueue(oe)}}),j=f.body.pipeThrough(q);return new Response(j,{status:f.status,statusText:f.statusText,headers:f.headers})};if(u){let f=ne();s.inflightRequests.set(d,f);try{let E=await f;return re(E)}finally{s.inflightRequests.delete(d)}}return re(await ne())}finally{if(s.signalControllers.delete(t.destroy()),!n.signal?.aborted){let c=h();this.publish({name:y.COMPLETE,data:{timing:c},global:r}),s.signalControllers.size===0&&this.publish({name:y.ALL_COMPLETE,global:r})}}}static normalizeRetryOptions(e){return e===void 0?{limit:0,statusCodes:[],methods:[],delay:N,backoffFactor:D}:typeof e=="number"?{limit:e,statusCodes:[...$],methods:[...G],delay:N,backoffFactor:D}:{limit:e.limit??0,statusCodes:e.statusCodes??[...$],methods:e.methods??[...G],delay:e.delay??N,backoffFactor:e.backoffFactor??D}}static retryDelay(e,t){let n=typeof e.delay=="function"?e.delay(t):e.delay*e.backoffFactor**(t-1);return new Promise(r=>setTimeout(r,n))}async execute(e,t={},n={},r){T(e)&&([e,t]=[void 0,e]);let o=this.processRequestOptions(t,n),{requestOptions:i}=o,a=i.unwrap!==!1,u=i.hooks;try{let R=s.createUrl(this._baseUrl,e,i.searchParams),g=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,u?.beforeRequest];for(let d of g)if(d)for(let l of d){let p=await l(i,R);p&&(Object.assign(i,p),p.searchParams!==void 0&&(R=s.createUrl(this._baseUrl,e,i.searchParams)))}let h=await this._request(e,o),c=[s.globalHooks.afterResponse,this.hooks.afterResponse,u?.afterResponse];for(let d of c)if(d)for(let l of d){let p=await l(h,i);p&&(h=p)}try{!r&&h.status!==204&&(r=this.getResponseHandler(h.headers.get("content-type")));let d=await r?.(h);return this.publish({name:y.SUCCESS,data:d,global:o.global}),a?d:[!0,d]}catch(d){throw await this.handleError(e,h,{cause:d},i)}}catch(R){if(!a)return[!1,R];throw R}}static createOptions({headers:e,searchParams:t,...n},{headers:r,searchParams:o,...i}){return r=s.mergeHeaders(new Headers,e,r),o=s.mergeSearchParams(new URLSearchParams,t,o),{...se(i,n),headers:r,searchParams:o}}static mergeHeaders(e,...t){for(let n of t)if(n!==void 0)if(n instanceof Headers)n.forEach((r,o)=>e.set(o,r));else if(Array.isArray(n))for(let[r,o]of n)e.set(r,o);else{let r=n,o=Object.keys(r);for(let i=0;i<o.length;i++){let a=o[i],u=r[a];u!==void 0&&e.set(a,String(u))}}return e}static mergeSearchParams(e,...t){for(let n of t)if(n!==void 0)if(n instanceof URLSearchParams)n.forEach((r,o)=>e.set(o,r));else if(te(n)||Array.isArray(n))for(let[r,o]of new URLSearchParams(n))e.set(r,o);else{let r=Object.keys(n);for(let o=0;o<r.length;o++){let i=r[o],a=n[i];a!==void 0&&e.set(i,String(a))}}return e}processRequestOptions({body:e,headers:t,searchParams:n,...r},{headers:o,searchParams:i,...a}){let u={...this._options,...r,...a,headers:s.mergeHeaders(new Headers,this._options.headers,t,o),searchParams:s.mergeSearchParams(new URLSearchParams,this._options.searchParams,n,i)};if(ve(u.method))if(qe(e))u.body=e,u.headers.delete("content-type");else{let l=u.headers.get("content-type")?.includes("json")??!1;u.body=l&&T(e)?He(e):e}else u.headers.delete("content-type"),u.body instanceof URLSearchParams&&s.mergeSearchParams(u.searchParams,u.body),u.body=void 0;let{signal:R,timeout:g,global:h=!1,xsrf:c}=u;if(c){let l=typeof c=="object"?c:{},p=Pe(l.cookieName??de);p&&u.headers.set(l.headerName??ce,p)}let d=new _({signal:R,timeout:g}).onAbort(l=>this.publish({name:y.ABORTED,event:l,global:h})).onTimeout(l=>this.publish({name:y.TIMEOUT,event:l,global:h}));return u.signal=d.signal,this.publish({name:y.CONFIGURED,data:u,global:h}),{signalController:d,requestOptions:u,global:h}}static getBaseUrl(e){if(e instanceof URL)return e;if(!te(e))throw new TypeError("Invalid URL");return new URL(e,e.startsWith("/")?globalThis.location.origin:void 0)}static getOrParseMediaType(e){if(e===null)return;let t=s.mediaTypeCache.get(e);if(t!==void 0)return t;if(t=b.parse(e)??void 0,t!==void 0){if(s.mediaTypeCache.size>=100){let n=s.mediaTypeCache.keys().next();n.done||s.mediaTypeCache.delete(n.value)}s.mediaTypeCache.set(e,t)}return t}static createUrl(e,t,n){let r=t?new URL(`${e.pathname.replace(le,"")}${t}`,e.origin):new URL(e);return n&&s.mergeSearchParams(r.searchParams,n),r}static generateResponseStatusFromError(e,{status:t,statusText:n}=new Response){switch(e){case H.ABORT:return ge;case H.TIMEOUT:return me;default:return t>=400?new w(t,n):he}}async handleError(e,t,{cause:n,entity:r,url:o,method:i,timing:a}={},u){let R=i&&o?`${i} ${o.href} failed${t?` with status ${t.status}`:""}`:`An error has occurred with your request to: '${e}'`,g=new A(s.generateResponseStatusFromError(n?.name,t),{message:R,cause:n,entity:r,url:o,method:i,timing:a}),h=[s.globalHooks.beforeError,this.hooks.beforeError,u?.hooks?.beforeError];for(let c of h)if(c)for(let d of c){let l=await d(g);l instanceof A&&(g=l)}return this.publish({name:y.ERROR,data:g}),g}publish({name:e,event:t=new CustomEvent(e),data:n,global:r=!0}){r&&s.globalSubscribr.publish(e,t,n),this.subscribr.publish(e,t,n)}getResponseHandler(e){if(!e)return;let t=s.getOrParseMediaType(e);if(t){for(let[n,r]of s.contentTypeHandlers)if(t.matches(n))return r}}get[Symbol.toStringTag](){return"Transportr"}};export{ke as Transportr};
4
+ `);if(o!==-1){let a=n.slice(0,o);n=n.slice(o+2);let d={event:"message",data:"",id:"",retry:void 0},R=[],g=a.split(`
5
+ `);for(let h=0;h<g.length;h++){let p=g[h];if(p.startsWith(":"))continue;let l=p.indexOf(":"),u,c;switch(l===-1?(u=p,c=""):(u=p.slice(0,l),c=p.slice(l+1),c.charCodeAt(0)===32&&(c=c.slice(1))),u){case"event":d.event=c;break;case"data":R.push(c);break;case"id":d.id=c;break;case"retry":{let S=parseInt(c,10);isNaN(S)||(d.retry=S);break}}}if(d.data=R.join(`
6
+ `),d.data||d.event!=="message")return{value:d,done:!1};continue}let i=await e.read();if(i.done){r=!0;break}n+=t.decode(i.value,{stream:!0})}return{value:void 0,done:!0}},async return(){return await e.cancel(),r=!0,{value:void 0,done:!0}}}}}),we=s=>({[Symbol.asyncIterator](){let e=s.body.getReader(),t=new TextDecoder,n="",r=!1;return{async next(){for(;!r;){let o=n.indexOf(`
7
+ `);if(o!==-1){let a=n.slice(0,o).trim();if(n=n.slice(o+1),a)return{value:JSON.parse(a),done:!1};continue}let i=await e.read();if(i.done){r=!0;let a=(n+t.decode()).trim();if(n="",a)return{value:JSON.parse(a),done:!1};break}n+=t.decode(i.value,{stream:!0})}return{value:void 0,done:!0}},async return(){return await e.cancel(),r=!0,{value:void 0,done:!0}}}}});var ve=s=>s!==void 0&&Re.includes(s),qe=s=>s instanceof FormData||s instanceof Blob||s instanceof ArrayBuffer||s instanceof ReadableStream||s instanceof URLSearchParams||ArrayBuffer.isView(s),Pe=s=>{if(typeof document>"u"||!document.cookie)return;let e=`${s}=`,t=document.cookie.split(";");for(let n=0,r=t.length;n<r;n++){let o=t[n].trim();if(o.startsWith(e))return decodeURIComponent(o.slice(e.length))}},He=s=>JSON.stringify(s),j=s=>s!==null&&typeof s=="string",Ae=s=>s instanceof ArrayBuffer||Object.prototype.toString.call(s)==="[object ArrayBuffer]",y=s=>s!==null&&typeof s=="object"&&!Array.isArray(s)&&Object.getPrototypeOf(s)===Object.prototype,F=(...s)=>{let e=s.length;if(e===0)return;if(e===1){let[n]=s;return y(n)?se(n):n}let t={};for(let n of s){if(!y(n))return;for(let[r,o]of Object.entries(n)){let i=t[r];Array.isArray(o)?t[r]=[...o,...Array.isArray(i)?i.filter(a=>!o.includes(a)):[]]:y(o)?t[r]=y(i)?F(i,o):se(o):t[r]=o}}return t};function se(s){if(y(s)){let e={},t=Object.keys(s);for(let n=0,r=t.length,o;n<r;n++)o=t[n],e[o]=se(s[o]);return e}return s}var ke=class s{_baseUrl;_options;subscribr;hooks={beforeRequest:[],afterResponse:[],beforeError:[]};static globalSubscribr=new I;static globalHooks={beforeRequest:[],afterResponse:[],beforeError:[]};static signalControllers=new Set;static inflightRequests=new Map;static mediaTypeCache=new Map(Object.values(m).map(e=>[e.toString(),e]));static contentTypeHandlers=[[m.TEXT.type,be],[m.JSON.subtype,Y],[m.BIN.subtype,Z],[m.HTML.subtype,te],[m.XML.subtype,ee],[m.PNG.type,Q],[m.JAVA_SCRIPT.subtype,K],[m.CSS.subtype,W]];constructor(e=G,t={}){y(e)&&([e,t]=[G,e]),this._baseUrl=s.getBaseUrl(e),this._options=s.createOptions(t,s.defaultRequestOptions),this.subscribr=new I}static CredentialsPolicy={INCLUDE:"include",OMIT:"omit",SAME_ORIGIN:"same-origin"};static RequestMode={CORS:"cors",NAVIGATE:"navigate",NO_CORS:"no-cors",SAME_ORIGIN:"same-origin"};static RequestPriority={HIGH:"high",LOW:"low",AUTO:"auto"};static RedirectPolicy={ERROR:"error",FOLLOW:"follow",MANUAL:"manual"};static ReferrerPolicy={NO_REFERRER:"no-referrer",NO_REFERRER_WHEN_DOWNGRADE:"no-referrer-when-downgrade",ORIGIN:"origin",ORIGIN_WHEN_CROSS_ORIGIN:"origin-when-cross-origin",SAME_ORIGIN:"same-origin",STRICT_ORIGIN:"strict-origin",STRICT_ORIGIN_WHEN_CROSS_ORIGIN:"strict-origin-when-cross-origin",UNSAFE_URL:"unsafe-url"};static RequestEvent=b;static defaultRequestOptions={body:void 0,cache:pe.NO_STORE,credentials:s.CredentialsPolicy.SAME_ORIGIN,headers:new Headers({"content-type":$,accept:$}),searchParams:void 0,integrity:void 0,keepalive:void 0,method:"GET",mode:s.RequestMode.CORS,priority:s.RequestPriority.AUTO,redirect:s.RedirectPolicy.FOLLOW,referrer:"about:client",referrerPolicy:s.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN,signal:void 0,timeout:3e4,global:!0};static register(e,t,n){return s.globalSubscribr.subscribe(e,t,n)}static unregister(e){return s.globalSubscribr.unsubscribe(e)}static abortAll(){for(let e of this.signalControllers)e.abort(M());this.signalControllers.clear()}static all(e){return Promise.all(e)}static async race(e){let t=[],n=new Array(e.length);for(let r=0;r<e.length;r++){let o=new AbortController;t.push(o),n[r]=e[r](o.signal)}try{return await Promise.race(n)}finally{for(let r of t)r.abort()}}static registerContentTypeHandler(e,t){s.contentTypeHandlers.unshift([e,t])}static unregisterContentTypeHandler(e){let t=s.contentTypeHandlers.findIndex(([n])=>n===e);return t===-1?!1:(s.contentTypeHandlers.splice(t,1),!0)}static addHooks(e){e.beforeRequest&&s.globalHooks.beforeRequest.push(...e.beforeRequest),e.afterResponse&&s.globalHooks.afterResponse.push(...e.afterResponse),e.beforeError&&s.globalHooks.beforeError.push(...e.beforeError)}static clearHooks(){s.globalHooks={beforeRequest:[],afterResponse:[],beforeError:[]}}static unregisterAll(){s.abortAll(),s.globalSubscribr=new I,s.clearHooks(),s.inflightRequests.clear()}get baseUrl(){return this._baseUrl}register(e,t,n){return this.subscribr.subscribe(e,t,n)}unregister(e){return this.subscribr.unsubscribe(e)}addHooks(e){return e.beforeRequest&&this.hooks.beforeRequest.push(...e.beforeRequest),e.afterResponse&&this.hooks.afterResponse.push(...e.afterResponse),e.beforeError&&this.hooks.beforeError.push(...e.beforeError),this}clearHooks(){return this.hooks.beforeRequest.length=0,this.hooks.afterResponse.length=0,this.hooks.beforeError.length=0,this}configure({headers:e,searchParams:t,hooks:n,...r}){return e&&s.mergeHeaders(this._options.headers,e),t&&s.mergeSearchParams(this._options.searchParams,t),Object.keys(r).length>0&&Object.assign(this._options,r),n&&this.addHooks(n),this}destroy(){this.clearHooks(),this.subscribr.destroy()}async get(e,t){return this._get(e,t)}async post(e,t,n){return this.executeBodyMethod("POST",e,t,n)}async put(e,t,n){return this.executeBodyMethod("PUT",e,t,n)}async patch(e,t,n){return this.executeBodyMethod("PATCH",e,t,n)}async delete(e,t,n){return this.executeBodyMethod("DELETE",e,t,n)}async head(e,t){return this.execute(e,t,{method:"HEAD"})}async options(e,t={}){y(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t,{method:"OPTIONS"}),{requestOptions:r}=n,o=r.unwrap!==!1,i=r.hooks;try{let a=s.createUrl(this._baseUrl,e,r.searchParams),d=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,i?.beforeRequest];for(let p of d)if(p)for(let l of p){let u=await l(r,a);u&&(Object.assign(r,u),u.searchParams!==void 0&&(a=s.createUrl(this._baseUrl,e,r.searchParams)))}let R=await this._request(e,n),g=[s.globalHooks.afterResponse,this.hooks.afterResponse,i?.afterResponse];for(let p of g)if(p)for(let l of p){let u=await l(R,r);u&&(R=u)}let h=R.headers.get("allow")?.split(",").map(p=>p.trim());return this.publish({name:b.SUCCESS,data:h,global:t.global}),o?h:[!0,h]}catch(a){if(!o)return[!1,a];throw a}}async request(e,t={}){y(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t,{}),r=n.requestOptions.unwrap!==!1;try{let o=await this._request(e,n);return this.publish({name:b.SUCCESS,data:o,global:t.global}),r?o:[!0,o]}catch(o){if(!r)return[!1,o];throw o}}async getJson(e,t){return this._get(e,t,{headers:{accept:`${m.JSON}`}},Y)}async getXml(e,t){return this._get(e,t,{headers:{accept:`${m.XML}`}},ee)}async getHtml(e,t,n){let r=await this._get(e,t,{headers:{accept:`${m.HTML}`}},te);return Array.isArray(r)?r:n&&r?r.querySelector(n):r}async getHtmlFragment(e,t,n){let r=await this._get(e,t,{headers:{accept:`${m.HTML}`}},Se);return Array.isArray(r)?r:n&&r?r.querySelector(n):r}async getScript(e,t){return this._get(e,t,{headers:{accept:`${m.JAVA_SCRIPT}`}},K)}async getStylesheet(e,t){return this._get(e,t,{headers:{accept:`${m.CSS}`}},W)}async getBlob(e,t){return this._get(e,t,{headers:{accept:"application/octet-stream"}},Te)}async getImage(e,t){return this._get(e,t,{headers:{accept:"image/*"}},Q)}async getBuffer(e,t){return this._get(e,t,{headers:{accept:"application/octet-stream"}},Ee)}async getStream(e,t){return this._get(e,t,{headers:{accept:"application/octet-stream"}},Z)}async getEventStream(e,t){y(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t??{},{method:t?.body?"POST":"GET",headers:{accept:`${m.EVENT_STREAM}`}}),{requestOptions:r}=n,o=r.unwrap!==!1,i=r.hooks;try{let a=s.createUrl(this._baseUrl,e,r.searchParams),d=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,i?.beforeRequest];for(let l of d)if(l)for(let u of l){let c=await u(r,a);c&&(Object.assign(r,c),c.searchParams!==void 0&&(a=s.createUrl(this._baseUrl,e,r.searchParams)))}let g=await this._request(e,n),h=[s.globalHooks.afterResponse,this.hooks.afterResponse,i?.afterResponse];for(let l of h)if(l)for(let u of l){let c=await u(g,r);c&&(g=c)}this.publish({name:b.SUCCESS,data:g,global:n.global});let p=Oe(g);return o?p:[!0,p]}catch(a){if(!o)return[!1,a];throw a}}async getJsonStream(e,t){y(e)&&([e,t]=[void 0,e]);let n=this.processRequestOptions(t??{},{method:"GET",headers:{accept:`${m.NDJSON}`}}),{requestOptions:r}=n,o=r.unwrap!==!1,i=r.hooks;try{let a=s.createUrl(this._baseUrl,e,r.searchParams),d=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,i?.beforeRequest];for(let l of d)if(l)for(let u of l){let c=await u(r,a);c&&(Object.assign(r,c),c.searchParams!==void 0&&(a=s.createUrl(this._baseUrl,e,r.searchParams)))}let g=await this._request(e,n),h=[s.globalHooks.afterResponse,this.hooks.afterResponse,i?.afterResponse];for(let l of h)if(l)for(let u of l){let c=await u(g,r);c&&(g=c)}this.publish({name:b.SUCCESS,data:g,global:n.global});let p=we(g);return o?p:[!0,p]}catch(a){if(!o)return[!1,a];throw a}}async _get(e,t,n={},r){return this.execute(e,t,{...n,method:"GET",body:void 0},r)}async _request(e,{signalController:t,requestOptions:n,global:r}){s.signalControllers.add(t);let o=s.normalizeRetryOptions(n.retry),i=n.method??"GET",a=o.limit>0&&o.methods.includes(i),d=n.dedupe===!0&&(i==="GET"||i==="HEAD"),R=0,g=performance.now(),h=()=>{let p=performance.now();return{start:g,end:p,duration:p-g}};try{let p=s.createUrl(this._baseUrl,e,n.searchParams),l=d?`${i}:${p.href}`:"";if(d){let f=s.inflightRequests.get(l);if(f)return(await f).clone()}let u=n.body,c=n.onUploadProgress,S=async()=>{if(!c||u==null)return;let f=null;if(typeof u=="string")f=new TextEncoder().encode(u);else if(u instanceof Blob)f=new Uint8Array(await u.arrayBuffer());else if(Ae(u))f=new Uint8Array(u);else if(ArrayBuffer.isView(u))f=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);else if(!(u instanceof ReadableStream))return;let E=f?f.byteLength:null,x=f?new ReadableStream({start(P){P.enqueue(f),P.close()}}):u,O=0,C=new TransformStream({transform(P,J){O+=P.byteLength,c({loaded:O,total:E,percentage:E!==null&&E>0?Math.round(O/E*100):null}),J.enqueue(P)}});n.body=x.pipeThrough(C),Object.assign(n,{duplex:"half"})},ne=async()=>{for(;;)try{await S();let f=await fetch(p,n);if(!f.ok){if(a&&R<o.limit&&o.statusCodes.includes(f.status)){R++,this.publish({name:b.RETRY,data:{attempt:R,status:f.status,method:i,path:e,timing:h()},global:r}),await s.retryDelay(o,R);continue}let E;try{E=await f.text()}catch{}throw await this.handleError(e,f,{entity:E,url:p,method:i,timing:h()},n)}return f}catch(f){if(f instanceof k)throw f;if(a&&R<o.limit){R++,this.publish({name:b.RETRY,data:{attempt:R,error:f.message,method:i,path:e,timing:h()},global:r}),await s.retryDelay(o,R);continue}throw await this.handleError(e,void 0,{cause:f,url:p,method:i,timing:h()},n)}},re=f=>{let E=n.onDownloadProgress;if(!E||!f.body)return f;let x=f.headers.get("content-length"),O=x?parseInt(x,10):null,C=0,P=new TransformStream({transform(oe,Be){C+=oe.byteLength,E({loaded:C,total:O,percentage:O!==null&&O>0?Math.round(C/O*100):null}),Be.enqueue(oe)}}),J=f.body.pipeThrough(P);return new Response(J,{status:f.status,statusText:f.statusText,headers:f.headers})};if(d){let f=ne();s.inflightRequests.set(l,f);try{let E=await f;return re(E)}finally{s.inflightRequests.delete(l)}}return re(await ne())}finally{if(s.signalControllers.delete(t.destroy()),!n.signal?.aborted){let p=h();this.publish({name:b.COMPLETE,data:{timing:p},global:r}),s.signalControllers.size===0&&this.publish({name:b.ALL_COMPLETE,global:r})}}}static normalizeRetryOptions(e){return e===void 0?{limit:0,statusCodes:[],methods:[],delay:N,backoffFactor:D}:typeof e=="number"?{limit:e,statusCodes:[...X],methods:[...V],delay:N,backoffFactor:D}:{limit:e.limit??0,statusCodes:e.statusCodes??[...X],methods:e.methods??[...V],delay:e.delay??N,backoffFactor:e.backoffFactor??D}}static retryDelay(e,t){let n=typeof e.delay=="function"?e.delay(t):e.delay*e.backoffFactor**(t-1);return new Promise(r=>setTimeout(r,n))}executeBodyMethod(e,t,n,r,o){let[i,a,d]=j(t)?[t,n,r]:[void 0,t,n];return this.execute(i,Object.assign(d??{},{body:a,method:e}),{},o)}async execute(e,t={},n={},r){y(e)&&([e,t]=[void 0,e]);let o=this.processRequestOptions(t,n),{requestOptions:i}=o,a=i.unwrap!==!1,d=i.hooks;try{let R=s.createUrl(this._baseUrl,e,i.searchParams),g=[s.globalHooks.beforeRequest,this.hooks.beforeRequest,d?.beforeRequest];for(let l of g)if(l)for(let u of l){let c=await u(i,R);c&&(Object.assign(i,c),c.searchParams!==void 0&&(R=s.createUrl(this._baseUrl,e,i.searchParams)))}let h=await this._request(e,o),p=[s.globalHooks.afterResponse,this.hooks.afterResponse,d?.afterResponse];for(let l of p)if(l)for(let u of l){let c=await u(h,i);c&&(h=c)}try{!r&&h.status!==204&&(r=this.getResponseHandler(h.headers.get("content-type")));let l=await r?.(h);return this.publish({name:b.SUCCESS,data:l,global:o.global}),a?l:[!0,l]}catch(l){throw await this.handleError(e,h,{cause:l},i)}}catch(R){if(!a)return[!1,R];throw R}}static createOptions({headers:e,searchParams:t,...n},{headers:r,searchParams:o,...i}){return r=s.mergeHeaders(new Headers,e,r),o=s.mergeSearchParams(new URLSearchParams,t,o),{...F(i,n),headers:r,searchParams:o}}static mergeHeaders(e,...t){for(let n of t)if(n!==void 0){if(n instanceof Headers)n.forEach((r,o)=>e.set(o,r));else if(Array.isArray(n))for(let[r,o]of n)e.set(r,o);else if(y(n))for(let[r,o]of Object.entries(n))o!==void 0&&e.set(r,o)}return e}static mergeSearchParams(e,...t){for(let n of t)if(n!==void 0)if(n instanceof URLSearchParams)n.forEach((r,o)=>e.set(o,r));else if(j(n)||Array.isArray(n))for(let[r,o]of new URLSearchParams(n))e.set(r,o);else{let r=Object.keys(n);for(let o=0;o<r.length;o++){let i=r[o],a=n[i];a!==void 0&&e.set(i,String(a))}}return e}processRequestOptions({body:e,headers:t,searchParams:n,...r},{headers:o,searchParams:i,...a}){let d={...this._options,...r,...a,headers:s.mergeHeaders(new Headers,this._options.headers,t,o),searchParams:s.mergeSearchParams(new URLSearchParams,this._options.searchParams,n,i)};if(ve(d.method))if(qe(e))Object.assign(d,{body:e}),d.headers.delete("content-type");else{let u=this._options.body,c=y(u)&&y(e)?F(u,e):e!==void 0?e:u,S=d.headers.get("content-type")?.includes("json")??!1;Object.assign(d,{body:S&&y(c)?He(c):c})}else d.headers.delete("content-type"),d.body instanceof URLSearchParams&&s.mergeSearchParams(d.searchParams,d.body),d.body=void 0;let{signal:R,timeout:g,global:h=!1,xsrf:p}=d;if(p){let{cookieName:u,headerName:c}=typeof p=="object"?p:{},S=Pe(u??le);S&&d.headers.set(c??ce,S)}let l=new _({signal:R,timeout:g}).onAbort(u=>this.publish({name:b.ABORTED,event:u,global:h})).onTimeout(u=>this.publish({name:b.TIMEOUT,event:u,global:h}));return d.signal=l.signal,this.publish({name:b.CONFIGURED,data:d,global:h}),{signalController:l,requestOptions:d,global:h}}static getBaseUrl(e){if(e instanceof URL)return e;if(!j(e))throw new TypeError("Invalid URL");return new URL(e,e.startsWith("/")?globalThis.location.origin:void 0)}static getOrParseMediaType(e){if(e===null)return;let t=s.mediaTypeCache.get(e);if(t!==void 0)return t;if(t=T.parse(e)??void 0,t!==void 0){if(s.mediaTypeCache.size>=100){let n=s.mediaTypeCache.keys().next();n.done||s.mediaTypeCache.delete(n.value)}s.mediaTypeCache.set(e,t)}return t}static createUrl(e,t,n){let r=t?new URL(`${e.pathname.replace(de,"")}${t}`,e.origin):new URL(e);return n&&s.mergeSearchParams(r.searchParams,n),r}static generateResponseStatusFromError(e,{status:t,statusText:n}=new Response){switch(e){case A.ABORT:return ge;case A.TIMEOUT:return me;default:return t>=400?new v(t,n):he}}async handleError(e,t,{cause:n,entity:r,url:o,method:i,timing:a}={},d){let R=i&&o?`${i} ${o.href} failed${t?` with status ${t.status}`:""}`:`An error has occurred with your request to: '${e}'`,g=new k(s.generateResponseStatusFromError(n?.name,t),{message:R,cause:n,entity:r,url:o,method:i,timing:a}),h=[s.globalHooks.beforeError,this.hooks.beforeError,d?.hooks?.beforeError];for(let p of h)if(p)for(let l of p){let u=await l(g);u instanceof k&&(g=u)}return this.publish({name:b.ERROR,data:g}),g}publish({name:e,event:t=new CustomEvent(e),data:n,global:r=!0}){r&&s.globalSubscribr.publish(e,t,n),this.subscribr.publish(e,t,n)}getResponseHandler(e){if(!e)return;let t=s.getOrParseMediaType(e);if(t){for(let[n,r]of s.contentTypeHandlers)if(t.matches(n))return r}}get[Symbol.toStringTag](){return"Transportr"}};export{ke as Transportr};
8
8
  //# sourceMappingURL=transportr.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../node_modules/.pnpm/@d1g1tal+media-type@6.0.8/node_modules/@d1g1tal/media-type/src/utils.ts", "../node_modules/.pnpm/@d1g1tal+media-type@6.0.8/node_modules/@d1g1tal/media-type/src/media-type-parameters.ts", "../node_modules/.pnpm/@d1g1tal+media-type@6.0.8/node_modules/@d1g1tal/media-type/src/media-type-parser.ts", "../node_modules/.pnpm/@d1g1tal+media-type@6.0.8/node_modules/@d1g1tal/media-type/src/media-type.ts", "../node_modules/.pnpm/@d1g1tal+subscribr@4.1.13/node_modules/@d1g1tal/subscribr/node_modules/.pnpm/@d1g1tal+collections@2.2.0/node_modules/@d1g1tal/collections/src/set-multi-map.ts", "../node_modules/.pnpm/@d1g1tal+subscribr@4.1.13/node_modules/@d1g1tal/subscribr/src/context-event-handler.ts", "../node_modules/.pnpm/@d1g1tal+subscribr@4.1.13/node_modules/@d1g1tal/subscribr/src/subscription.ts", "../node_modules/.pnpm/@d1g1tal+subscribr@4.1.13/node_modules/@d1g1tal/subscribr/src/subscribr.ts", "../src/http-error.ts", "../src/response-status.ts", "../src/constants.ts", "../src/signal-controller.ts", "../src/response-handlers.ts", "../src/utils.ts", "../src/transportr.ts"],
4
- "sourcesContent": ["export const httpTokenCodePoints: RegExp = /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u;", "import { httpTokenCodePoints } from './utils.js';\n\nconst matcher: RegExp = /([\"\\\\])/ug;\nconst httpQuotedStringTokenCodePoints: RegExp = /^[\\t\\u0020-\\u007E\\u0080-\\u00FF]*$/u;\n\n/**\n * Class representing the parameters for a media type record.\n * This class extends a JavaScript Map<string, string>.\n *\n * However, MediaTypeParameters methods will always interpret their arguments\n * as appropriate for media types, so parameter names will be lowercased,\n * and attempting to set invalid characters will throw an Error.\n *\n * @see https://mimesniff.spec.whatwg.org\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class MediaTypeParameters extends Map<string, string> {\n\t/**\n\t * Create a new MediaTypeParameters instance.\n\t *\n\t * @param entries An array of [ name, value ] tuples.\n\t */\n\tconstructor(entries: Iterable<[string, string]> = []) {\n\t\tsuper(entries);\n\t}\n\n\t/**\n\t * Indicates whether the supplied name and value are valid media type parameters.\n\t *\n\t * @param name The name of the media type parameter to validate.\n\t * @param value The media type parameter value to validate.\n\t * @returns true if the media type parameter is valid, false otherwise.\n\t */\n\tstatic isValid(name: string, value: string): boolean {\n\t\treturn httpTokenCodePoints.test(name) && httpQuotedStringTokenCodePoints.test(value);\n\t}\n\n\t/**\n\t * Gets the media type parameter value for the supplied name.\n\t *\n\t * @param name The name of the media type parameter to retrieve.\n\t * @returns The media type parameter value.\n\t */\n\toverride get(name: string): string | undefined {\n\t\treturn super.get(name.toLowerCase());\n\t}\n\n\t/**\n\t * Indicates whether the media type parameter with the specified name exists or not.\n\t *\n\t * @param name The name of the media type parameter to check.\n\t * @returns true if the media type parameter exists, false otherwise.\n\t */\n\toverride has(name: string): boolean {\n\t\treturn super.has(name.toLowerCase());\n\t}\n\n\t/**\n\t * Adds a new media type parameter using the specified name and value to the MediaTypeParameters.\n\t * If an parameter with the same name already exists, the parameter will be updated.\n\t *\n\t * @param name The name of the media type parameter to set.\n\t * @param value The media type parameter value.\n\t * @returns This instance.\n\t */\n\toverride set(name: string, value: string): this {\n\t\tif (!MediaTypeParameters.isValid(name, value)) {\n\t\t\tthrow new Error(`Invalid media type parameter name/value: ${name}/${value}`);\n\t\t}\n\n\t\tsuper.set(name.toLowerCase(), value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes the media type parameter using the specified name.\n\t *\n\t * @param name The name of the media type parameter to delete.\n\t * @returns true if the parameter existed and has been removed, or false if the parameter does not exist.\n\t */\n\toverride delete(name: string): boolean {\n\t\treturn super.delete(name.toLowerCase());\n\t}\n\n\t/**\n\t * Returns a string representation of the media type parameters.\n\t *\n\t * @returns The string representation of the media type parameters.\n\t */\n\toverride toString(): string {\n\t\treturn Array.from(this).map(([ name, value ]) => `;${name}=${!value || !httpTokenCodePoints.test(value) ? `\"${value.replace(matcher, '\\\\$1')}\"` : value}`).join('');\n\t}\n\n\t/**\n\t * Returns the name of this class.\n\t *\n\t * @returns The name of this class.\n\t */\n\toverride get [Symbol.toStringTag](): string {\n\t\treturn 'MediaTypeParameters';\n\t}\n}", "import { MediaTypeParameters } from './media-type-parameters.js';\nimport { httpTokenCodePoints } from './utils.js';\n\nconst whitespaceChars = new Set([' ', '\\t', '\\n', '\\r']);\nconst trailingWhitespace: RegExp = /[ \\t\\n\\r]+$/u;\nconst leadingAndTrailingWhitespace: RegExp = /^[ \\t\\n\\r]+|[ \\t\\n\\r]+$/ug;\n\nexport interface MediaTypeComponent {\n\tposition?: number;\n\tinput: string;\n\tlowerCase?: boolean;\n\ttrim?: boolean;\n}\n\nexport interface ParsedMediaType {\n\ttype: string;\n\tsubtype: string;\n\tparameters: MediaTypeParameters;\n}\n\n/**\n * Parser for media types.\n * @see https://mimesniff.spec.whatwg.org/#parsing-a-mime-type\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class MediaTypeParser {\n\t/**\n\t * Function to parse a media type.\n\t * @param input The media type to parse\n\t * @returns An object populated with the parsed media type properties and any parameters.\n\t */\n\tstatic parse(input: string): ParsedMediaType {\n\t\tinput = input.replace(leadingAndTrailingWhitespace, '');\n\n\t\tlet position = 0;\n\t\tconst [ type, typeEnd ] = MediaTypeParser.collect(input, position, ['/']);\n\t\tposition = typeEnd;\n\n\t\tif (!type.length || position >= input.length || !httpTokenCodePoints.test(type)) {\n\t\t\tthrow new TypeError(MediaTypeParser.generateErrorMessage('type', type));\n\t\t}\n\n\t\t++position; // Skip \"/\"\n\t\tconst [ subtype, subtypeEnd ] = MediaTypeParser.collect(input, position, [';'], true, true);\n\t\tposition = subtypeEnd;\n\n\t\tif (!subtype.length || !httpTokenCodePoints.test(subtype)) {\n\t\t\tthrow new TypeError(MediaTypeParser.generateErrorMessage('subtype', subtype));\n\t\t}\n\n\t\tconst parameters = new MediaTypeParameters();\n\n\t\twhile (position < input.length) {\n\t\t\t++position; // Skip \";\"\n\t\t\twhile (whitespaceChars.has(input[position]!)) { ++position }\n\n\t\t\tlet name: string;\n\t\t\t[name, position] = MediaTypeParser.collect(input, position, [';', '='], false);\n\n\t\t\tif (position >= input.length || input[position] === ';') { continue }\n\n\t\t\t++position; // Skip \"=\"\n\n\t\t\tlet value: string;\n\t\t\tif (input[position] === '\"') {\n\t\t\t\t[ value, position ] = MediaTypeParser.collectHttpQuotedString(input, position);\n\t\t\t\twhile (position < input.length && input[position] !== ';') { ++position }\n\t\t\t} else {\n\t\t\t\t[ value, position ] = MediaTypeParser.collect(input, position, [';'], false, true);\n\t\t\t\tif (!value) { continue }\n\t\t\t}\n\n\t\t\tif (name && MediaTypeParameters.isValid(name, value) && !parameters.has(name)) {\n\t\t\t\tparameters.set(name, value);\n\t\t\t}\n\t\t}\n\n\t\treturn { type, subtype, parameters };\n\t}\n\n\t/**\n\t * Gets the name of this class.\n\t * @returns The string tag of this class.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'MediaTypeParser';\n\t}\n\n\t/**\n\t * Collects characters from `input` starting at `pos` until a stop character is found.\n\t * @param input The input string.\n\t * @param pos The starting position.\n\t * @param stopChars Characters that end collection.\n\t * @param lowerCase Whether to ASCII-lowercase the result.\n\t * @param trim Whether to strip trailing HTTP whitespace.\n\t * @returns A tuple of the collected string and the updated position.\n\t */\n\tprivate static collect(input: string, pos: number, stopChars: string[], lowerCase = true, trim = false): [string, number] {\n\t\tlet result = '';\n\t\tfor (const { length } = input; pos < length && !stopChars.includes(input[pos]!); pos++) {\n\t\t\tresult += input[pos];\n\t\t}\n\n\t\tif (lowerCase) { result = result.toLowerCase() }\n\t\tif (trim) { result = result.replace(trailingWhitespace, '') }\n\n\t\treturn [result, pos];\n\t}\n\n\t/**\n\t * Collects all the HTTP quoted strings.\n\t * This variant only implements it with the extract-value flag set.\n\t * @param input The string to process.\n\t * @param position The starting position.\n\t * @returns An array that includes the resulting string and updated position.\n\t */\n\tprivate static collectHttpQuotedString(input: string, position: number): [string, number] {\n\t\tlet value = '';\n\n\t\tfor (let length = input.length, char; ++position < length;) {\n\t\t\tif ((char = input[position]) === '\"') { break }\n\n\t\t\tvalue += char == '\\\\' && ++position < length ? input[position] : char;\n\t\t}\n\n\t\treturn [ value, position ];\n\t}\n\n\t/**\n\t * Generates an error message.\n\t * @param component The component name.\n\t * @param value The component value.\n\t * @returns The error message.\n\t */\n\tprivate static generateErrorMessage(component: string, value: string): string {\n\t\treturn `Invalid ${component} \"${value}\": only HTTP token code points are valid.`;\n\t}\n}", "import { MediaTypeParser } from './media-type-parser.js';\nimport { MediaTypeParameters } from './media-type-parameters.js';\n\n/**\n * Class used to parse media types.\n * @see https://mimesniff.spec.whatwg.org/#understanding-mime-types\n */\nexport class MediaType {\n\tprivate readonly _type: string;\n\tprivate readonly _subtype: string;\n\tprivate readonly _parameters: MediaTypeParameters;\n\n\t/**\n\t * Create a new MediaType instance from a string representation.\n\t * @param mediaType The media type to parse.\n\t * @param parameters Optional parameters.\n\t */\n\tconstructor(mediaType: string, parameters: Record<string, string> = {}) {\n\t\tif (parameters === null || typeof parameters !== 'object' || Array.isArray(parameters)) {\n\t\t\tthrow new TypeError('The parameters argument must be an object');\n\t\t}\n\n\t\t({ type: this._type, subtype: this._subtype, parameters: this._parameters } = MediaTypeParser.parse(mediaType));\n\n\t\tfor (const [ name, value ] of Object.entries(parameters)) { this._parameters.set(name, value) }\n\t}\n\n\t/**\n\t * Parses a media type string.\n\t * @param mediaType The media type to parse.\n\t * @returns The parsed media type or null if the mediaType cannot be parsed.\n\t */\n\tstatic parse(mediaType: string): MediaType | null {\n\t\ttry {\n\t\t\treturn new MediaType(mediaType);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Gets the type.\n\t * @returns The type.\n\t */\n\tget type(): string {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Gets the subtype.\n\t * @returns The subtype.\n\t */\n\tget subtype(): string {\n\t\treturn this._subtype;\n\t}\n\n\t/**\n\t * Gets the media type essence (type/subtype).\n\t * @returns The media type without any parameters\n\t */\n\tget essence(): string {\n\t\treturn `${this._type}/${this._subtype}`;\n\t}\n\n\t/**\n\t * Gets the parameters.\n\t * @returns The media type parameters.\n\t */\n\tget parameters(): MediaTypeParameters {\n\t\treturn this._parameters;\n\t}\n\n\t/**\n\t * Checks if the media type matches the specified type.\n\t *\n\t * @param mediaType The media type to check.\n\t * @returns true if the media type matches the specified type, false otherwise.\n\t */\n\tmatches(mediaType: MediaType | string): boolean {\n\t\treturn typeof mediaType === 'string' ? this.essence.includes(mediaType) : this._type === mediaType._type && this._subtype === mediaType._subtype;\n\t}\n\n\t/**\n\t * Gets the serialized version of the media type.\n\t *\n\t * @returns The serialized media type.\n\t */\n\ttoString(): string {\n\t\treturn `${this.essence}${this._parameters.toString()}`;\n\t}\n\n\t/**\n\t * Gets the name of the class.\n\t * @returns The class name\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'MediaType';\n\t}\n}", "/** A {@link Map} that can contain multiple, unique, values for the same key. */\nexport class SetMultiMap<K, V> extends Map<K, Set<V>>{\n\t/**\n\t * Adds a new element with a specified key and value to the SetMultiMap.\n\t * If an element with the same key already exists, the value will be added to the underlying {@link Set}.\n\t * If the value already exists in the {@link Set}, it will not be added again.\n\t *\n\t * @param key - The key to set.\n\t * @param value - The value to add to the SetMultiMap.\n\t * @returns The SetMultiMap with the updated key and value.\n\t */\n\toverride set(key: K, value: V): this;\n\t/**\n\t * Adds a new Set with a specified key and value to the SetMultiMap.\n\t * If an element with the same key already exists, the value will be added to the underlying {@link Set}.\n\t * If the value already exists in the {@link Set}, it will not be added again.\n\t *\n\t * @param key - The key to set.\n\t * @param value - The set of values to add to the SetMultiMap.\n\t * @returns The SetMultiMap with the updated key and value.\n\t */\n\toverride set(key: K, value: Set<V>): this;\n\t/**\n\t * Adds a new element with a specified key and value to the SetMultiMap.\n\t * If an element with the same key already exists, the value will be added to the underlying {@link Set}.\n\t * If the value already exists in the {@link Set}, it will not be added again.\n\t *\n\t * @param key The key to set.\n\t * @param value The value to add to the SetMultiMap\n\t * @returns The SetMultiMap with the updated key and value.\n\t */\n\toverride set(key: K, value: V | Set<V>) {\n\t\tsuper.set(key, value instanceof Set ? value : (super.get(key) ?? new Set<V>()).add(value));\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will insert the default value and return it.\n\t * @param key The key to get the value for.\n\t * @param defaultValue The default value to insert if the key does not exist.\n\t * @returns The value associated with the specified key, or the default value if the key does not exist.\n\t */\n\toverride getOrInsert(key: K, defaultValue: V): V;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will insert the default value and return it.\n\t * @param key The key to get the value for.\n\t * @param defaultValue The default value to insert if the key does not exist.\n\t * @returns The value associated with the specified key, or the default value if the key does not exist.\n\t */\n\toverride getOrInsert(key: K, defaultValue: Set<V>): Set<V>;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will insert the default value and return it.\n\t * @param key The key to get the value for.\n\t * @param defaultValue The default value to insert if the key does not exist.\n\t * @returns The value associated with the specified key, or the default value if the key does not exist.\n\t */\n\toverride getOrInsert(key: K, defaultValue: V | Set<V>): V | Set<V> {\n\t\tif (this.has(key)) { return super.get(key)! }\n\n\t\tsuper.set(key, defaultValue instanceof Set ? defaultValue : (super.get(key) ?? new Set<V>()).add(defaultValue));\n\n\t\treturn defaultValue;\n\t}\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will compute the value using the provided function, insert it, and return it.\n\t * @param key The key to get the value for.\n\t * @param compute The function to compute the value if the key does not exist.\n\t * @returns The value associated with the specified key, or the computed value if the key does not exist.\n\t */\n\toverride getOrInsertComputed(key: K, compute: (key: K) => V): V;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will compute the value using the provided function, insert it, and return it.\n\t * @param key The key to get the value for.\n\t * @param compute The function to compute the value if the key does not exist.\n\t * @returns The value associated with the specified key, or the computed value if the key does not exist.\n\t */\n\toverride getOrInsertComputed(key: K, compute: (key: K) => Set<V>): Set<V>;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will compute the value using the provided function, insert it, and return it.\n\t * @param key The key to get the value for.\n\t * @param compute The function to compute the value if the key does not exist.\n\t * @returns The value associated with the specified key, or the computed value if the key does not exist.\n\t */\n\toverride getOrInsertComputed(key: K, compute: (key: K) => V | Set<V>): V | Set<V> {\n\t\tif (this.has(key)) { return super.get(key)! }\n\n\t\tconst defaultValue = compute(key);\n\t\tsuper.set(key, defaultValue instanceof Set ? defaultValue : (super.get(key) ?? new Set<V>()).add(defaultValue));\n\n\t\treturn defaultValue;\n\t}\n\n\t/**\n\t * Finds a specific value for a specific key using an iterator function.\n\t * @param key The key to find the value for.\n\t * @param iterator The iterator function to use to find the value.\n\t * @returns The value for the specified key\n\t */\n\tfind(key: K, iterator: (value: V) => boolean) {\n\t\tconst values = this.get(key);\n\n\t\tif (values !== undefined) {\n\t\t\treturn Array.from(values).find(iterator);\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Checks if a specific key has a specific value.\n\t *\n\t * @param key The key to check.\n\t * @param value The value to check.\n\t * @returns True if the key has the value, false otherwise.\n\t */\n\thasValue(key: K, value: V) {\n\t\tconst values = super.get(key);\n\n\t\treturn values ? values.has(value) : false;\n\t}\n\n\t/**\n\t * Removes a specific value from a specific key.\n\t * @param key The key to remove the value from.\n\t * @param value The value to remove.\n\t * @returns True if the value was removed, false otherwise.\n\t */\n\tdeleteValue(key: K, value: V | undefined) {\n\t\tif (value === undefined) { return this.delete(key) }\n\n\t\tconst values = super.get(key);\n\t\tif (values) {\n\t\t\tconst deleted = values.delete(value);\n\n\t\t\tif (values.size === 0) {\n\t\t\t\tsuper.delete(key);\n\t\t\t}\n\n\t\t\treturn deleted;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * The string tag of the SetMultiMap.\n\t * @returns The string tag of the SetMultiMap.\n\t */\n\toverride get [Symbol.toStringTag]() {\n\t\treturn 'SetMultiMap';\n\t}\n}", "import type { EventHandler } from './@types';\n\n/** A wrapper for an event handler that binds a context to the event handler. */\nexport class ContextEventHandler {\n\tprivate readonly context: unknown;\n\tprivate readonly eventHandler: EventHandler;\n\n\t/**\n\t * @param context The context to bind to the event handler.\n\t * @param eventHandler The event handler to call when the event is published.\n\t */\n\tconstructor(context: unknown, eventHandler: EventHandler) {\n\t\tthis.context = context;\n\t\tthis.eventHandler = eventHandler;\n\t}\n\n\t/**\n\t * Call the event handler for the provided event.\n\t *\n\t * @param event The event to handle\n\t * @param data The value to be passed to the event handler as a parameter.\n\t */\n\thandle(event: Event, data?: unknown): void {\n\t\tthis.eventHandler.call(this.context, event, data);\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'ContextEventHandler';\n\t}\n}", "import type { ContextEventHandler } from './context-event-handler';\n\n/** Represents a subscription to an event. */\nexport class Subscription {\n\tprivate readonly _eventName: string;\n\tprivate readonly _contextEventHandler: ContextEventHandler;\n\n\t/**\n\t * @param eventName The event name.\n\t * @param contextEventHandler The context event handler.\n\t */\n\tconstructor(eventName: string, contextEventHandler: ContextEventHandler) {\n\t\tthis._eventName = eventName;\n\t\tthis._contextEventHandler = contextEventHandler;\n\t}\n\n\t/**\n\t * Gets the event name for the subscription.\n\t *\n\t * @returns The event name.\n\t */\n\tget eventName(): string {\n\t\treturn this._eventName;\n\t}\n\n\t/**\n\t * Gets the context event handler.\n\t *\n\t * @returns The context event handler\n\t */\n\tget contextEventHandler(): ContextEventHandler {\n\t\treturn this._contextEventHandler;\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'Subscription';\n\t}\n}", "import { SetMultiMap } from '@d1g1tal/collections';\nimport { ContextEventHandler } from './context-event-handler';\nimport { Subscription } from './subscription';\nimport type { EventHandler, ErrorHandler, SubscriptionOptions } from './@types';\n\n/** A class that allows objects to subscribe to events and be notified when the event is published. */\nexport class Subscribr {\n\tprivate readonly subscribers: SetMultiMap<string, ContextEventHandler> = new SetMultiMap();\n\tprivate errorHandler?: ErrorHandler;\n\n\t/**\n\t * Set a custom error handler for handling errors that occur in event listeners.\n\t * If not set, errors will be logged to the console.\n\t *\n\t * @param errorHandler The error handler function to call when an error occurs in an event listener.\n\t */\n\tsetErrorHandler(errorHandler: ErrorHandler): void {\n\t\tthis.errorHandler = errorHandler;\n\t}\n\n\t/**\n\t * Subscribe to an event\n\t *\n\t * @param eventName The event name to subscribe to.\n\t * @param eventHandler The event handler to call when the event is published.\n\t * @param context The context to bind to the event handler.\n\t * @param options Subscription options.\n\t * @returns An object used to check if the subscription still exists and to unsubscribe from the event.\n\t */\n\tsubscribe(eventName: string, eventHandler: EventHandler, context: unknown = eventHandler, options?: SubscriptionOptions): Subscription {\n\t\tthis.validateEventName(eventName);\n\n\t\t// If once option is set, wrap the handler to auto-unsubscribe\n\t\tif (options?.once) {\n\t\t\tconst originalHandler = eventHandler;\n\t\t\teventHandler = (event: Event, data?: unknown) => {\n\t\t\t\toriginalHandler.call(context, event, data);\n\t\t\t\tthis.unsubscribe(subscription);\n\t\t\t};\n\t\t}\n\n\t\tconst contextEventHandler = new ContextEventHandler(context, eventHandler);\n\t\tthis.subscribers.set(eventName, contextEventHandler);\n\n\t\tconst subscription = new Subscription(eventName, contextEventHandler);\n\n\t\treturn subscription;\n\t}\n\n\t/**\n\t * Unsubscribe from the event\n\t *\n\t * @param subscription The subscription to unsubscribe.\n\t * @returns true if eventListener has been removed successfully. false if the value is not found or if the value is not an object.\n\t */\n\tunsubscribe({ eventName, contextEventHandler }: Subscription): boolean {\n\t\tconst contextEventHandlers = this.subscribers.get(eventName) ?? new Set();\n\t\tconst removed = contextEventHandlers.delete(contextEventHandler);\n\n\t\tif (removed && contextEventHandlers.size === 0) {\tthis.subscribers.delete(eventName) }\n\n\t\treturn removed;\n\t}\n\n\t/**\n\t * Publish an event\n\t *\n\t * @template T\n\t * @param eventName The name of the event.\n\t * @param event The event to be handled.\n\t * @param data The value to be passed to the event handler as a parameter.\n\t */\n\tpublish<T>(eventName: string, event: Event = new CustomEvent(eventName), data?: T): void {\n\t\tthis.validateEventName(eventName);\n\t\tthis.subscribers.get(eventName)?.forEach((contextEventHandler: ContextEventHandler) => {\n\t\t\ttry {\n\t\t\t\tcontextEventHandler.handle(event, data);\n\t\t\t} catch (error) {\n\t\t\t\tif (this.errorHandler) {\n\t\t\t\t\tthis.errorHandler(error as Error, eventName, event, data);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in event handler for '${eventName}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Check if the event and handler are subscribed.\n\t *\n\t * @param subscription The subscription object.\n\t * @returns true if the event name and handler are subscribed, false otherwise.\n\t */\n\tisSubscribed({ eventName, contextEventHandler }: Subscription): boolean {\n\t\treturn this.subscribers.get(eventName)?.has(contextEventHandler) ?? false;\n\t}\n\n\t/**\n\t * Validate the event name\n\t *\n\t * @param eventName The event name to validate.\n\t * @throws {TypeError} If the event name is not a non-empty string.\n\t * @throws {Error} If the event name has leading or trailing whitespace.\n\t */\n\tprivate validateEventName(eventName: string): void {\n\t\tif (!eventName || typeof eventName !== 'string') {\n\t\t\tthrow new TypeError('Event name must be a non-empty string');\n\t\t}\n\n\t\tif (eventName.trim() !== eventName) {\n\t\t\tthrow new Error('Event name cannot have leading or trailing whitespace');\n\t\t}\n\t}\n\n\t/**\n\t * Clears all subscriptions. The instance should not be used after calling this method.\n\t */\n\tdestroy(): void {\n\t\tthis.subscribers.clear();\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'Subscribr';\n\t}\n}", "import type { ResponseStatus } from '@src/response-status';\nimport type { ResponseBody, RequestTiming, HttpErrorOptions } from '@src/@types/core';\n\n/**\n * An error that represents an HTTP error response.\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nclass HttpError extends Error {\n\tprivate readonly _entity: ResponseBody;\n\tprivate readonly responseStatus: ResponseStatus;\n\tprivate readonly _url: URL | undefined;\n\tprivate readonly _method: string | undefined;\n\tprivate readonly _timing: RequestTiming | undefined;\n\n\t/**\n\t * Creates an instance of HttpError.\n\t * @param status The status code and status text of the {@link Response}.\n\t * @param httpErrorOptions The http error options.\n\t */\n\tconstructor(status: ResponseStatus, { message, cause, entity, url, method, timing }: HttpErrorOptions = {}) {\n\t\tsuper(message, { cause });\n\t\tthis._entity = entity;\n\t\tthis.responseStatus = status;\n\t\tthis._url = url;\n\t\tthis._method = method;\n\t\tthis._timing = timing;\n\t}\n\n\t/**\n\t * It returns the value of the private variable #entity.\n\t * @returns The entity property of the class.\n\t */\n\tget entity(): ResponseBody {\n\t\treturn this._entity;\n\t}\n\n\t/**\n\t * It returns the status code of the {@link Response}.\n\t * @returns The status code of the {@link Response}.\n\t */\n\tget statusCode(): number {\n\t\treturn this.responseStatus.code;\n\t}\n\n\t/**\n\t * It returns the status text of the {@link Response}.\n\t * @returns The status code and status text of the {@link Response}.\n\t */\n\tget statusText(): string {\n\t\treturn this.responseStatus?.text;\n\t}\n\n\t/**\n\t * The request URL that caused the error.\n\t * @returns The URL or undefined.\n\t */\n\tget url(): URL | undefined {\n\t\treturn this._url;\n\t}\n\n\t/**\n\t * The HTTP method that was used for the failed request.\n\t * @returns The method string or undefined.\n\t */\n\tget method(): string | undefined {\n\t\treturn this._method;\n\t}\n\n\t/**\n\t * Timing information for the failed request.\n\t * @returns The timing object or undefined.\n\t */\n\tget timing(): RequestTiming | undefined {\n\t\treturn this._timing;\n\t}\n\n\t/**\n\t * A String value representing the name of the error.\n\t * @returns The name of the error.\n\t */\n\toverride get name(): string {\n\t\treturn 'HttpError';\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn this.name;\n\t}\n}\n\nexport { HttpError };", "/**\n * A class that holds a status code and a status text, typically from a {@link Response}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/status|Response.status\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class ResponseStatus {\n\tprivate readonly _code: number;\n\tprivate readonly _text: string;\n\n\t/**\n\t *\n\t * @param code The status code from the {@link Response}\n\t * @param text The status text from the {@link Response}\n\t */\n\tconstructor(code: number, text: string) {\n\t\tthis._code = code;\n\t\tthis._text = text;\n\t}\n\n\t/**\n\t * Returns the status code from the {@link Response}\n\t *\n\t * @returns The status code.\n\t */\n\tget code(): number {\n\t\treturn this._code;\n\t}\n\n\t/**\n\t * Returns the status text from the {@link Response}.\n\t *\n\t * @returns The status text.\n\t */\n\tget text(): string {\n\t\treturn this._text;\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'ResponseStatus';\n\t}\n\n\t/**\n\t * tostring method for the class.\n\t *\n\t * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString|Object.prototype.toString}\n\t * @returns The status code and status text.\n\t */\n\ttoString(): string {\n\t\treturn `${this._code} ${this._text}`;\n\t}\n}", "import { MediaType } from '@d1g1tal/media-type';\nimport { ResponseStatus } from './response-status';\nimport type { AbortEvent, TimeoutEvent, RequestMethod } from '@types';\n\nconst charset = { charset: 'utf-8' };\nconst endsWithSlashRegEx: RegExp = /\\/$/;\n/** Default XSRF cookie name */\nconst XSRF_COOKIE_NAME = 'XSRF-TOKEN';\n/** Default XSRF header name */\nconst XSRF_HEADER_NAME = 'X-XSRF-TOKEN';\n\ntype MediaTypeKey = 'PNG' | 'TEXT' | 'JSON' | 'HTML' | 'JAVA_SCRIPT' | 'CSS' | 'XML' | 'BIN' | 'EVENT_STREAM' | 'NDJSON';\n\nconst mediaTypes: { [key in MediaTypeKey]: MediaType } = {\n\tPNG: new MediaType('image/png'),\n\tTEXT: new MediaType('text/plain', charset),\n\tJSON: new MediaType('application/json', charset),\n\tHTML: new MediaType('text/html', charset),\n\tJAVA_SCRIPT: new MediaType('text/javascript', charset),\n\tCSS: new MediaType('text/css', charset),\n\tXML: new MediaType('application/xml', charset),\n\tBIN: new MediaType('application/octet-stream'),\n\tEVENT_STREAM: new MediaType('text/event-stream', charset),\n\tNDJSON: new MediaType('application/x-ndjson', charset)\n} as const;\n\nconst defaultMediaType: string = mediaTypes.JSON.toString();\nconst defaultOrigin: string = globalThis.location?.origin ?? 'http://localhost';\n\n/** Constant object for caching policies */\nconst RequestCachingPolicy = {\n\tDEFAULT: 'default',\n\tFORCE_CACHE: 'force-cache',\n\tNO_CACHE: 'no-cache',\n\tNO_STORE: 'no-store',\n\tONLY_IF_CACHED: 'only-if-cached',\n\tRELOAD: 'reload'\n} as const;\n\n/** Constant object for request events */\nexport const RequestEvent = {\n\tCONFIGURED: 'configured',\n\tSUCCESS: 'success',\n\tERROR: 'error',\n\tABORTED: 'aborted',\n\tTIMEOUT: 'timeout',\n\tRETRY: 'retry',\n\tCOMPLETE: 'complete',\n\tALL_COMPLETE: 'all-complete'\n} as const;\n\n/** Constant object for signal events */\nconst SignalEvents = {\n\tABORT: 'abort',\n\tTIMEOUT: 'timeout'\n} as const;\n\n/** Constant object for signal errors */\nconst SignalErrors = {\n\tABORT: 'AbortError',\n\tTIMEOUT: 'TimeoutError'\n} as const;\n\n/** Options for adding event listeners */\nconst eventListenerOptions: AddEventListenerOptions = { once: true, passive: true };\n\n/**\n * Creates a new custom abort event.\n * @returns A new AbortEvent instance.\n */\nconst abortEvent = (): AbortEvent => new CustomEvent(SignalEvents.ABORT, { detail: { cause: SignalErrors.ABORT } });\n\n/**\n * Creates a new custom timeout event.\n * @returns A new TimeoutEvent instance.\n */\nconst timeoutEvent = (): TimeoutEvent => new CustomEvent(SignalEvents.TIMEOUT, { detail: { cause: SignalErrors.TIMEOUT } });\n\n/** Array of request body methods */\nconst requestBodyMethods: ReadonlyArray<RequestMethod> = [ 'POST', 'PUT', 'PATCH', 'DELETE' ];\n\n/** Response status for internal server error */\nconst internalServerError: ResponseStatus = new ResponseStatus(500, 'Internal Server Error');\n\n/** Response status for aborted request */\nconst aborted: ResponseStatus = new ResponseStatus(499, 'Aborted');\n\n/** Response status for timed out request */\nconst timedOut: ResponseStatus = new ResponseStatus(504, 'Request Timeout');\n\n/** Default HTTP status codes that trigger a retry */\nconst retryStatusCodes: ReadonlyArray<number> = [ 408, 413, 429, 500, 502, 503, 504 ];\n\n/** Default HTTP methods allowed to retry (idempotent methods only) */\nconst retryMethods: ReadonlyArray<RequestMethod> = [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS' ];\n\n/** Default delay in ms before the first retry */\nconst retryDelay: number = 300;\n\n/** Default backoff factor applied after each retry attempt */\nconst retryBackoffFactor: number = 2;\n\nexport { aborted, abortEvent, endsWithSlashRegEx, eventListenerOptions, internalServerError, mediaTypes, defaultMediaType, defaultOrigin, requestBodyMethods, RequestCachingPolicy, retryBackoffFactor, retryDelay, retryMethods, retryStatusCodes, SignalErrors, SignalEvents, timedOut, timeoutEvent, XSRF_COOKIE_NAME, XSRF_HEADER_NAME };\nexport type RequestEvent = (typeof RequestEvent)[keyof typeof RequestEvent];\n", "import { SignalErrors, SignalEvents, abortEvent, eventListenerOptions, timeoutEvent } from './constants.js';\nimport type { AbortConfiguration, AbortEvent, AbortSignalEvent } from '@types';\n\n/** Class representing a controller for abort signals, allowing for aborting requests and handling timeout events */\nexport class SignalController {\n\tprivate readonly abortSignal: AbortSignal;\n\tprivate readonly abortController = new AbortController();\n\tprivate readonly events = new Map<EventListener, string>();\n\n\t/**\n\t * Creates a new SignalController instance.\n\t * @param options - The options for the SignalController.\n\t * @param options.signal - The signal to listen for abort events. Defaults to the internal abort signal.\n\t * @param options.timeout - The timeout value in milliseconds. Defaults to Infinity.\n\t * @throws {RangeError} If the timeout value is negative.\n\t */\n\tconstructor({ signal, timeout = Infinity }: AbortConfiguration = {}) {\n\t\tif (timeout < 0) { throw new RangeError('The timeout cannot be negative') }\n\n\t\tconst signals = [ this.abortController.signal ];\n\t\tif (signal != null) { signals.push(signal) }\n\t\tif (timeout !== Infinity) { signals.push(AbortSignal.timeout(timeout)) }\n\n\t\t(this.abortSignal = AbortSignal.any(signals)).addEventListener(SignalEvents.ABORT, this, eventListenerOptions);\n\t}\n\n\t/**\n\t * Handles the 'abort' event. If the event is caused by a timeout, the 'timeout' event is dispatched.\n\t * Guards against a timeout firing after a manual abort to prevent spurious timeout events.\n\t * @param event The event to abort with\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#specifying_this_using_bind\n\t */\n\thandleEvent({ target: { reason } }: AbortSignalEvent): void {\n\t\tif (this.abortController.signal.aborted) { return }\n\t\tif (reason instanceof DOMException && reason.name === SignalErrors.TIMEOUT) { this.abortSignal.dispatchEvent(timeoutEvent()) }\n\t}\n\n\t/**\n\t * Gets the signal. This signal will be able to abort the request, but will not be notified if the request is aborted by the timeout.\n\t * @returns The signal\n\t */\n\tget signal(): AbortSignal {\n\t\treturn this.abortSignal;\n\t}\n\n\t/**\n\t * Adds an event listener for the 'abort' event.\n\t *\n\t * @param eventListener The listener to add\n\t * @returns The SignalController\n\t */\n\tonAbort(eventListener: EventListener): SignalController {\n\t\treturn this.addEventListener(SignalEvents.ABORT, eventListener);\n\t}\n\n\t/**\n\t * Adds an event listener for the 'timeout' event.\n\t *\n\t * @param eventListener The listener to add\n\t * @returns The SignalController\n\t */\n\tonTimeout(eventListener: EventListener): SignalController {\n\t\treturn this.addEventListener(SignalEvents.TIMEOUT, eventListener);\n\t}\n\n\t/**\n\t * Aborts the signal.\n\t *\n\t * @param event The event to abort with\n\t */\n\tabort(event: AbortEvent = abortEvent()): void {\n\t\tthis.abortController.abort(event.detail?.cause);\n\t}\n\n\t/**\n\t * Removes all event listeners from the signal.\n\t *\n\t * @returns The SignalController\n\t */\n\tdestroy(): SignalController {\n\t\tthis.abortSignal.removeEventListener(SignalEvents.ABORT, this, eventListenerOptions);\n\n\t\tfor (const [ eventListener, type ] of this.events) {\n\t\t\tthis.abortSignal.removeEventListener(type, eventListener, eventListenerOptions);\n\t\t}\n\n\t\tthis.events.clear();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds an event listener for the specified event type.\n\t *\n\t * @param type The event type to listen for\n\t * @param eventListener The listener to add\n\t * @returns The SignalController\n\t */\n\tprivate addEventListener(type: string, eventListener: EventListener): SignalController {\n\t\tthis.abortSignal.addEventListener(type, eventListener, eventListenerOptions);\n\t\tthis.events.set(eventListener, type);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'SignalController';\n\t}\n}", "import type { Json, ResponseHandler, ServerSentEvent } from '@types';\n\n/** Cached promise for lazy jsdom initialization \u2014 resolved once, reused thereafter */\nlet domReady: Promise<void> | undefined;\n\n/** Cached promise for lazy DOMPurify initialization \u2014 resolved once, reused thereafter */\nlet purifyReady: Promise<(dirty: string) => string> | undefined;\n\n/**\n * Returns a bound sanitize function, lazily loading DOMPurify on first invocation.\n * Must be called after ensureDom() to ensure the DOM environment is ready.\n * @returns A Promise resolving to the sanitize function.\n */\nconst getSanitize = (): Promise<(dirty: string) => string> =>\n\tpurifyReady ??= import('dompurify').then(({ default: p }) => (dirty: string): string => p.sanitize(dirty));\n\n/**\n * Ensures a DOM environment is available (document, DOMParser, DocumentFragment).\n * In browser environments this is a no-op. In Node.js it lazily imports jsdom on first call.\n * @returns A Promise that resolves when the DOM environment is ready.\n */\nconst ensureDom = async (): Promise<void> => {\n\tif (typeof document !== 'undefined' && typeof DOMParser !== 'undefined' && typeof DocumentFragment !== 'undefined') { return Promise.resolve() }\n\n\treturn domReady ??= import('jsdom').then(({ JSDOM }) => {\n\t\tconst { window } = new JSDOM('<!DOCTYPE html><html><head></head><body></body></html>', { url: 'http://localhost' });\n\t\tglobalThis.window = window as unknown as Window & typeof globalThis;\n\t\tObject.assign(globalThis, { document: window.document, DOMParser: window.DOMParser, DocumentFragment: window.DocumentFragment });\n\t}).catch(() => {\n\t\tdomReady = undefined;\n\t\tthrow new Error('jsdom is required for HTML/XML/DOM features in Node.js environments. Install it with: npm install jsdom');\n\t});\n};\n\n/**\n * Handles a text response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a string\n */\nconst handleText: ResponseHandler<string> = async (response) => await response.text();\n\n/**\n * Handles a script response by appending it to the Document HTMLHeadElement\n * Only available in browser environments with DOM support.\n *\n * **Security Warning:** This handler executes arbitrary JavaScript from the server response.\n * Only use with fully trusted content sources. No sanitization is applied to script content.\n * Consider using a Content Security Policy (CSP) nonce for additional protection.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to void\n */\nconst handleScript: ResponseHandler<void> = async (response) => {\n\tawait ensureDom();\n\tconst objectURL = URL.createObjectURL(await response.blob());\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst script = document.createElement('script');\n\t\tObject.assign(script, { src: objectURL, type: 'text/javascript', async: true });\n\n\t\t/**\n\t\t * Revoke the object URL and resolve the promise once the script has loaded.\n\t\t */\n\t\tscript.onload = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tdocument.head.removeChild(script);\n\t\t\tresolve();\n\t\t};\n\n\t\t/**\n\t\t * Revoke the object URL and reject the promise if the script fails to load.\n\t\t */\n\t\tscript.onerror = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tdocument.head.removeChild(script);\n\t\t\treject(new Error('Script failed to load'));\n\t\t};\n\n\t\tdocument.head.appendChild(script);\n\t});\n};\n\n/**\n * Handles a CSS response by appending it to the Document HTMLHeadElement.\n * Only available in browser environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to void\n */\nconst handleCss: ResponseHandler<void> = async (response) => {\n\tawait ensureDom();\n\tconst objectURL = URL.createObjectURL(await response.blob());\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst link = document.createElement('link');\n\t\tObject.assign(link, { href: objectURL, type: 'text/css', rel: 'stylesheet' });\n\n\t\t/**\n\t\t * Revoke the object URL and resolve the promise once the stylesheet has loaded.\n\t\t * @returns A Promise that resolves to void\n\t\t */\n\t\tlink.onload = () => resolve(URL.revokeObjectURL(objectURL));\n\n\t\t/**\n\t\t * Revoke the object URL, remove the link element, and reject the promise if the stylesheet fails to load.\n\t\t */\n\t\tlink.onerror = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tdocument.head.removeChild(link);\n\t\t\treject(new Error('Stylesheet load failed'));\n\t\t};\n\n\t\tdocument.head.appendChild(link);\n\t});\n};\n\n/**\n * Handles a JSON response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a JsonObject\n */\nconst handleJson: ResponseHandler<Json> = async (response) => await response.json() as Json;\n\n/**\n * Handles a Blob response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a Blob\n */\nconst handleBlob: ResponseHandler<Blob> = async (response) => await response.blob();\n\n/**\n * Handles an image response by creating an object URL and returning an HTMLImageElement.\n * The object URL is revoked once the image is loaded to prevent memory leaks.\n * Works in both browser and Node.js (via JSDOM) environments.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to an HTMLImageElement\n */\nconst handleImage: ResponseHandler<HTMLImageElement> = async (response) => {\n\tawait ensureDom();\n\tconst objectURL = URL.createObjectURL(await response.blob());\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst img = new Image();\n\n\t\t/**\n\t\t * Revoke the object URL once the image has loaded to free up memory and resolve with the image.\n\t\t */\n\t\timg.onload = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tresolve(img);\n\t\t};\n\n\t\t/**\n\t\t * Revoke the object URL and reject the promise if the image fails to load.\n\t\t */\n\t\timg.onerror = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\treject(new Error('Image failed to load'));\n\t\t};\n\n\t\timg.src = objectURL;\n\t});\n};\n\n/**\n * Handles a buffer response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to an ArrayBuffer\n */\nconst handleBuffer: ResponseHandler<ArrayBuffer> = async (response) => await response.arrayBuffer();\n\n/**\n * Handles a ReadableStream response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a ReadableStream\n */\nconst handleReadableStream: ResponseHandler<ReadableStream<Uint8Array> | null> = async (response) => Promise.resolve(response.body);\n\n/**\n * Handles an XML response.\n * Only available in environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a Document\n */\nconst handleXml: ResponseHandler<Document> = async (response) => {\n\tawait ensureDom();\n\tconst sanitize = await getSanitize();\n\treturn new DOMParser().parseFromString(sanitize(await response.text()), 'application/xml');\n};\n\n/**\n * Handles an HTML response.\n * Only available in environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a Document\n */\nconst handleHtml: ResponseHandler<Document> = async (response) => {\n\tawait ensureDom();\n\tconst sanitize = await getSanitize();\n\treturn new DOMParser().parseFromString(sanitize(await response.text()), 'text/html');\n};\n\n/**\n * Handles an HTML fragment response.\n * Only available in environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a DocumentFragment\n */\nconst handleHtmlFragment: ResponseHandler<DocumentFragment> = async (response) => {\n\tawait ensureDom();\n\tconst sanitize = await getSanitize();\n\treturn document.createRange().createContextualFragment(sanitize(await response.text()));\n};\n\n/**\n * Parses a text/event-stream response into an AsyncIterable of ServerSentEvent objects.\n * Follows the EventStream specification for field parsing (event, data, id, retry).\n * The returned iterable respects abort signals \u2014 iteration ends when the stream closes or is aborted.\n * @param response The response object from the fetch request.\n * @returns An AsyncIterable of parsed ServerSentEvent objects.\n */\nconst handleEventStream = (response: Response): AsyncIterable<ServerSentEvent> => {\n\treturn {\n\t\t/** @returns An async iterator for SSE events. */\n\t\t[Symbol.asyncIterator](): AsyncIterator<ServerSentEvent> {\n\t\t\tconst reader = response.body!.getReader();\n\t\t\tconst decoder = new TextDecoder();\n\t\t\tlet buffer = '';\n\t\t\tlet done = false;\n\n\t\t\treturn {\n\t\t\t\t/** @returns The next parsed SSE event or done signal. */\n\t\t\t\tasync next(): Promise<IteratorResult<ServerSentEvent>> {\n\t\t\t\t\twhile (!done) {\n\t\t\t\t\t\t// Try to extract a complete event from the buffer\n\t\t\t\t\t\tconst eventEnd = buffer.indexOf('\\n\\n');\n\t\t\t\t\t\tif (eventEnd !== -1) {\n\t\t\t\t\t\t\tconst rawEvent = buffer.slice(0, eventEnd);\n\t\t\t\t\t\t\tbuffer = buffer.slice(eventEnd + 2);\n\n\t\t\t\t\t\t\tconst sse: ServerSentEvent = { event: 'message', data: '', id: '', retry: undefined };\n\t\t\t\t\t\t\tconst dataLines: string[] = [];\n\n\t\t\t\t\t\t\tconst lines = rawEvent.split('\\n');\n\t\t\t\t\t\t\tfor (let i = 0; i < lines.length; i++) {\n\t\t\t\t\t\t\t\tconst line = lines[i]!;\n\t\t\t\t\t\t\t\t// comment line, ignore\n\t\t\t\t\t\t\t\tif (line.startsWith(':')) { continue }\n\n\t\t\t\t\t\t\t\tconst colonIndex = line.indexOf(':');\n\t\t\t\t\t\t\t\tlet field: string;\n\t\t\t\t\t\t\t\tlet value: string;\n\t\t\t\t\t\t\t\tif (colonIndex === -1) {\n\t\t\t\t\t\t\t\t\tfield = line;\n\t\t\t\t\t\t\t\t\tvalue = '';\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfield = line.slice(0, colonIndex);\n\t\t\t\t\t\t\t\t\tvalue = line.slice(colonIndex + 1);\n\t\t\t\t\t\t\t\t\t// strip leading space\n\t\t\t\t\t\t\t\t\tif (value.charCodeAt(0) === 32) { value = value.slice(1) }\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tswitch (field) {\n\t\t\t\t\t\t\t\t\tcase 'event': sse.event = value; break;\n\t\t\t\t\t\t\t\t\tcase 'data': dataLines.push(value); break;\n\t\t\t\t\t\t\t\t\tcase 'id': sse.id = value; break;\n\t\t\t\t\t\t\t\t\tcase 'retry': {\n\t\t\t\t\t\t\t\t\t\tconst n = parseInt(value, 10);\n\t\t\t\t\t\t\t\t\t\tif (!isNaN(n)) sse.retry = n;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsse.data = dataLines.join('\\n');\n\t\t\t\t\t\t\tif (sse.data || sse.event !== 'message') {\n\t\t\t\t\t\t\t\treturn { value: sse, done: false };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue; // empty event, skip\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Read more data from the stream\n\t\t\t\t\t\tconst result = await reader.read();\n\t\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuffer += decoder.decode(result.value, { stream: true });\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { value: undefined as unknown as ServerSentEvent, done: true };\n\t\t\t\t},\n\n\t\t\t\t/** @returns Done signal after cancelling the reader. */\n\t\t\t\tasync return(): Promise<IteratorResult<ServerSentEvent>> {\n\t\t\t\t\tawait reader.cancel();\n\t\t\t\t\tdone = true;\n\t\t\t\t\treturn { value: undefined as unknown as ServerSentEvent, done: true };\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n};\n\n/**\n * Parses an NDJSON (Newline Delimited JSON) response into an AsyncIterable of typed JSON values.\n * Each line of the response is parsed as an independent JSON object.\n * The returned iterable respects abort signals \u2014 iteration ends when the stream closes or is aborted.\n * @param response The response object from the fetch request.\n * @returns An AsyncIterable of parsed JSON values.\n */\nconst handleNdjsonStream = <T = Json>(response: Response): AsyncIterable<T> => {\n\treturn {\n\t\t/** @returns An async iterator for NDJSON lines. */\n\t\t[Symbol.asyncIterator](): AsyncIterator<T> {\n\t\t\tconst reader = response.body!.getReader();\n\t\t\tconst decoder = new TextDecoder();\n\t\t\tlet buffer = '';\n\t\t\tlet done = false;\n\n\t\t\treturn {\n\t\t\t\t/** @returns The next parsed JSON value or done signal. */\n\t\t\t\tasync next(): Promise<IteratorResult<T>> {\n\t\t\t\t\twhile (!done) {\n\t\t\t\t\t\tconst lineEnd = buffer.indexOf('\\n');\n\t\t\t\t\t\tif (lineEnd !== -1) {\n\t\t\t\t\t\t\tconst line = buffer.slice(0, lineEnd).trim();\n\t\t\t\t\t\t\tbuffer = buffer.slice(lineEnd + 1);\n\t\t\t\t\t\t\tif (line) {\n\t\t\t\t\t\t\t\treturn { value: JSON.parse(line) as T, done: false };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue; // empty line, skip\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst result = await reader.read();\n\t\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\t// Process remaining buffer\n\t\t\t\t\t\t\tconst remaining = (buffer + decoder.decode()).trim();\n\t\t\t\t\t\t\tbuffer = '';\n\t\t\t\t\t\t\tif (remaining) {\n\t\t\t\t\t\t\t\treturn { value: JSON.parse(remaining) as T, done: false };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuffer += decoder.decode(result.value, { stream: true });\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { value: undefined as unknown as T, done: true };\n\t\t\t\t},\n\n\t\t\t\t/** @returns Done signal after cancelling the reader. */\n\t\t\t\tasync return(): Promise<IteratorResult<T>> {\n\t\t\t\t\tawait reader.cancel();\n\t\t\t\t\tdone = true;\n\t\t\t\t\treturn { value: undefined as unknown as T, done: true };\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n};\n\nexport { handleText, handleScript, handleCss, handleJson, handleBlob, handleImage, handleBuffer, handleReadableStream, handleXml, handleHtml, handleHtmlFragment, handleEventStream, handleNdjsonStream };\n", "import { requestBodyMethods } from './constants';\nimport type { JsonString, JsonValue, RequestBodyMethod, RequestMethod } from '@types';\n\n/**\n * Type guard to check if a request method accepts a body.\n * @param method The request method to check.\n * @returns True if the method accepts a body, false otherwise.\n */\nexport const isRequestBodyMethod = (method: RequestMethod | undefined): method is RequestBodyMethod =>\n\tmethod !== undefined && requestBodyMethods.includes(method);\n\n/**\n * Checks whether a body value is a raw BodyInit type that should be sent as-is\n * (no JSON serialization) and should have its Content-Type deleted so the runtime\n * can set it automatically (e.g. multipart/form-data boundary for FormData).\n * @param body The request body to check.\n * @returns True if the body is a FormData, Blob, ArrayBuffer, TypedArray, DataView, ReadableStream, or URLSearchParams.\n */\nexport const isRawBody = (body: unknown): boolean =>\n\tbody instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer || body instanceof ReadableStream || body instanceof URLSearchParams || ArrayBuffer.isView(body);\n\n/**\n * Reads a cookie value by name from document.cookie.\n * Returns undefined in non-browser environments or when the cookie is not found.\n * @param name The cookie name to look up.\n * @returns The cookie value or undefined.\n */\nexport const getCookieValue = (name: string): string | undefined => {\n\tif (typeof document === 'undefined' || !document.cookie) { return }\n\n\tconst prefix = `${name}=`;\n\tconst cookies = document.cookie.split(';');\n\tfor (let i = 0, length = cookies.length; i < length; i++) {\n\t\tconst cookie = cookies[i]!.trim();\n\t\tif (cookie.startsWith(prefix)) { return decodeURIComponent(cookie.slice(prefix.length)) }\n\t}\n\n\treturn undefined;\n};\n\n/**\n * Serialize an object of type T into a JSON string.\n * The type system ensures only JSON-serializable values can be passed.\n * @template T The type of data to serialize (will be validated for JSON compatibility)\n * @param data The object to serialize - must be JSON-serializable.\n * @returns The serialized JSON string.\n */\nexport const serialize = <const T>(data: JsonValue<T>): JsonString<T> => JSON.stringify(data) as JsonString<T>;\n\n/**\n * Type predicate to check if a value is a string\n * @param value The value to check\n * @returns True if value is a string, with type narrowing\n */\nexport const isString = (value: unknown): value is string => value !== null && typeof value === 'string';\n\n/**\n * Type predicate to check if a value is an ArrayBuffer (cross-realm safe).\n * @param value The value to check.\n * @returns True if value is an ArrayBuffer, with type narrowing.\n */\nexport const isArrayBuffer = (value: unknown): value is ArrayBuffer =>\n\tvalue instanceof ArrayBuffer || Object.prototype.toString.call(value) === '[object ArrayBuffer]';\n\n/**\n * Type predicate to check if a value is an object (not array or null)\n * @param value The value to check\n * @returns True if value is an object, with type narrowing\n */\nexport const isObject = <T = object>(value: unknown): value is T extends object ? T : never => value !== null && typeof value === 'object' && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;\n\n/**\n * Performs a deep merge of multiple objects\n * @param objects The objects to merge\n * @returns The merged object\n */\nexport const objectMerge = (...objects: Record<PropertyKey, unknown>[]): Record<PropertyKey, unknown> | undefined => {\n\t// Early return for empty input\n\tconst length = objects.length;\n\tif (length === 0) { return undefined }\n\n\t// Early return for single object - just clone it\n\tif (length === 1) {\n\t\tconst [ obj ] = objects;\n\t\tif (!isObject(obj)) { return obj }\n\t\treturn deepClone(obj);\n\t}\n\n\tconst target = {} as Record<PropertyKey, unknown>;\n\n\tfor (const source of objects) {\n\t\tif (!isObject(source)) { return undefined }\n\n\t\tfor (const [property, sourceValue] of Object.entries(source)) {\n\t\t\tconst targetValue = target[property];\n\t\t\tif (Array.isArray(sourceValue)) {\n\t\t\t\t// Handle arrays - source values come first, then unique target values\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\ttarget[property] = [ ...sourceValue, ...(Array.isArray(targetValue) ? targetValue.filter((item) => !sourceValue.includes(item)) : []) ];\n\t\t\t} else if (isObject<Record<string, unknown>>(sourceValue)) {\n\t\t\t\t// Handle plain objects using the isObject function | I am already testing that the targetValue is an object\n\t\t\t\ttarget[property] = isObject<Record<string, unknown>>(targetValue) ? objectMerge(targetValue, sourceValue)! : deepClone(sourceValue);\n\t\t\t} else {\n\t\t\t\t// Primitive values and null/undefined\n\t\t\t\ttarget[property] = sourceValue;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn target;\n};\n\n/**\n * Creates a deep clone of an object for better performance than spread operator in merge scenarios\n * @param object The object to clone\n * @returns The cloned object\n */\nfunction deepClone<T = Record<PropertyKey, unknown>>(object: T): T {\n\tif (isObject<Record<PropertyKey, unknown>>(object)) {\n\t\tconst cloned: Record<PropertyKey, unknown> = {};\n\t\tconst keys = Object.keys(object);\n\t\tfor (let i = 0, length = keys.length, key; i < length; i++) {\n\t\t\tkey = keys[i]!;\n\t\t\tcloned[key] = deepClone(object[key]);\n\t\t}\n\n\t\treturn cloned as T;\n\t}\n\n\t// For other object types (Date, RegExp, etc.), return as-is\n\treturn object;\n}", "import { MediaType } from '@d1g1tal/media-type';\nimport { Subscribr } from '@d1g1tal/subscribr';\nimport { HttpError } from './http-error';\nimport { ResponseStatus } from './response-status';\nimport { SignalController } from './signal-controller.js';\nimport { handleText, handleScript, handleCss, handleJson, handleBlob, handleImage, handleBuffer, handleReadableStream, handleXml, handleHtml, handleHtmlFragment, handleEventStream, handleNdjsonStream } from './response-handlers';\nimport { isRequestBodyMethod, isRawBody, getCookieValue, isString, isArrayBuffer, isObject, objectMerge, serialize } from './utils';\nimport { RequestCachingPolicy, RequestEvent, SignalErrors, XSRF_COOKIE_NAME, XSRF_HEADER_NAME, abortEvent, aborted, defaultMediaType, defaultOrigin, endsWithSlashRegEx, internalServerError, mediaTypes, retryBackoffFactor, retryDelay, retryMethods, retryStatusCodes, timedOut } from './constants';\nimport type {\tRequestOptions, ResponseBody, RequestEventHandler, SearchParameters, EventRegistration, ResponseHandler, RequestHeaders, TypedResponse, Json, Entries, HookOptions, HttpErrorOptions, NormalizedRetryOptions, PublishOptions, RetryOptions, RequestTiming, XsrfOptions, ServerSentEvent, RequestEventDataMap, TypedRequestEventHandler, Result } from '@types';\n\ndeclare function fetch<R = unknown>(input: RequestInfo | URL, requestOptions?: RequestOptions): Promise<TypedResponse<R>>;\n\ntype RequestConfiguration = {\n\tsignalController: NonNullable<SignalController>,\n\trequestOptions: RequestOptions,\n\tglobal: boolean\n};\n\n/**\n * A wrapper around the fetch API that makes it easier to make HTTP requests.\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class Transportr {\n\tprivate readonly _baseUrl: URL;\n\tprivate readonly _options: RequestOptions;\n\tprivate readonly subscribr: Subscribr;\n\tprivate readonly hooks: Required<HookOptions> = { beforeRequest: [], afterResponse: [], beforeError: [] };\n\tprivate static globalSubscribr = new Subscribr();\n\tprivate static globalHooks: Required<HookOptions> = { beforeRequest: [], afterResponse: [], beforeError: [] };\n\tprivate static signalControllers = new Set<SignalController>();\n\t/** Map of in-flight deduplicated requests keyed by URL + method */\n\tprivate static inflightRequests = new Map<string, Promise<Response>>();\n\t/** Cache for parsed MediaType instances to avoid re-parsing the same content-type strings */\n\tprivate static mediaTypeCache = new Map(Object.values(mediaTypes).map((mediaType) => [ mediaType.toString(), mediaType ]));\n\tprivate static contentTypeHandlers: Entries<string, ResponseHandler<ResponseBody>> = [\n\t\t[ mediaTypes.TEXT.type, handleText ],\n\t\t[ mediaTypes.JSON.subtype, handleJson ],\n\t\t[ mediaTypes.BIN.subtype, handleReadableStream ],\n\t\t[ mediaTypes.HTML.subtype, handleHtml ],\n\t\t[ mediaTypes.XML.subtype, handleXml ],\n\t\t[ mediaTypes.PNG.type, handleImage as ResponseHandler<ResponseBody> ],\n\t\t[ mediaTypes.JAVA_SCRIPT.subtype, handleScript as ResponseHandler<ResponseBody> ],\n\t\t[ mediaTypes.CSS.subtype, handleCss as ResponseHandler<ResponseBody> ]\n\t];\n\n\t/**\n\t * Create a new Transportr instance with the provided location or origin and context path.\n\t *\n\t * @param url The URL for {@link fetch} requests.\n\t * @param options The default {@link RequestOptions} for this instance.\n\t */\n\tconstructor(url: URL | string | RequestOptions = defaultOrigin, options: RequestOptions = {}) {\n\t\tif (isObject(url)) { [ url, options ] = [ defaultOrigin, url ] }\n\n\t\tthis._baseUrl = Transportr.getBaseUrl(url);\n\t\tthis._options = Transportr.createOptions(options, Transportr.defaultRequestOptions);\n\t\tthis.subscribr = new Subscribr();\n\t}\n\n\t/** Credentials Policy */\n\tstatic readonly CredentialsPolicy = {\n\t\tINCLUDE: 'include',\n\t\tOMIT: 'omit',\n\t\tSAME_ORIGIN: 'same-origin'\n\t} as const;\n\n\t/** Request Mode */\n\tstatic readonly RequestMode = {\n\t\tCORS: 'cors',\n\t\tNAVIGATE: 'navigate',\n\t\tNO_CORS: 'no-cors',\n\t\tSAME_ORIGIN: 'same-origin'\n\t} as const;\n\n\t/** Request Priority */\n\tstatic readonly RequestPriority = {\n\t\tHIGH: 'high',\n\t\tLOW: 'low',\n\t\tAUTO: 'auto'\n\t} as const;\n\n\t/** Redirect Policy */\n\tstatic readonly RedirectPolicy = {\n\t\tERROR: 'error',\n\t\tFOLLOW: 'follow',\n\t\tMANUAL: 'manual'\n\t} as const;\n\n\t/** Referrer Policy */\n\tstatic readonly ReferrerPolicy = {\n\t\tNO_REFERRER: 'no-referrer',\n\t\tNO_REFERRER_WHEN_DOWNGRADE: 'no-referrer-when-downgrade',\n\t\tORIGIN: 'origin',\n\t\tORIGIN_WHEN_CROSS_ORIGIN: 'origin-when-cross-origin',\n\t\tSAME_ORIGIN: 'same-origin',\n\t\tSTRICT_ORIGIN: 'strict-origin',\n\t\tSTRICT_ORIGIN_WHEN_CROSS_ORIGIN: 'strict-origin-when-cross-origin',\n\t\tUNSAFE_URL: 'unsafe-url'\n\t} as const;\n\n\t/** Request Event */\n\tstatic readonly RequestEvent: typeof RequestEvent = RequestEvent;\n\n\t/** Default Request Options */\n\tprivate static readonly defaultRequestOptions: RequestOptions = {\n\t\tbody: undefined,\n\t\tcache: RequestCachingPolicy.NO_STORE,\n\t\tcredentials: Transportr.CredentialsPolicy.SAME_ORIGIN,\n\t\theaders: new Headers({ 'content-type': defaultMediaType, 'accept': defaultMediaType }),\n\t\tsearchParams: undefined,\n\t\tintegrity: undefined,\n\t\tkeepalive: undefined,\n\t\tmethod: 'GET',\n\t\tmode: Transportr.RequestMode.CORS,\n\t\tpriority: Transportr.RequestPriority.AUTO,\n\t\tredirect: Transportr.RedirectPolicy.FOLLOW,\n\t\treferrer: 'about:client',\n\t\treferrerPolicy: Transportr.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN,\n\t\tsignal: undefined,\n\t\ttimeout: 30000,\n\t\tglobal: true\n\t};\n\n\t/**\n\t * Returns a {@link EventRegistration} used for subscribing to global events with typed data.\n\t *\n\t * @param event The event to subscribe to.\n\t * @param handler The event handler with typed data parameter.\n\t * @param context The context to bind the handler to.\n\t * @returns A new {@link EventRegistration} instance.\n\t */\n\tstatic register<E extends keyof RequestEventDataMap>(event: E, handler: TypedRequestEventHandler<E>, context?: unknown): EventRegistration;\n\t/**\n\t * @internal\n\t * @param event The event to subscribe to.\n\t * @param handler The event handler.\n\t * @param context The context to bind the handler to.\n\t * @returns A new {@link EventRegistration} instance.\n\t */\n\tstatic register(event: RequestEvent, handler: RequestEventHandler, context?: unknown): EventRegistration {\n\t\treturn Transportr.globalSubscribr.subscribe(event, handler, context);\n\t}\n\n\t/**\n\t * Removes a {@link EventRegistration} from the global event handler.\n\t *\n\t * @param eventRegistration The {@link EventRegistration} to remove.\n\t * @returns True if the {@link EventRegistration} was removed, false otherwise.\n\t */\n\tstatic unregister(eventRegistration: EventRegistration): boolean {\n\t\treturn Transportr.globalSubscribr.unsubscribe(eventRegistration);\n\t}\n\n\t/**\n\t * Aborts all active requests.\n\t * This is useful for when the user navigates away from the current page.\n\t * This will also clear the {@link Transportr#signalControllers} set.\n\t */\n\tstatic abortAll(): void {\n\t\tfor (const signalController of this.signalControllers) {\n\t\t\tsignalController.abort(abortEvent());\n\t\t}\n\n\t\t// Clear the set after aborting all requests\n\t\tthis.signalControllers.clear();\n\t}\n\n\t/**\n\t * Executes multiple requests concurrently and resolves when all complete.\n\t * @param requests An array of promises from Transportr request methods.\n\t * @returns A promise resolving to an array of all results.\n\t */\n\tstatic all<T extends readonly Promise<unknown>[]>(requests: T): Promise<{ -readonly [K in keyof T]: Awaited<T[K]> }> {\n\t\treturn Promise.all(requests) as Promise<{ -readonly [K in keyof T]: Awaited<T[K]> }>;\n\t}\n\n\t/**\n\t * Races multiple requests concurrently. The first to settle wins; all others are aborted.\n\t * Each factory receives an AbortSignal that the caller should pass to the request options.\n\t * @template T The expected result type.\n\t * @param requests An array of functions that accept an AbortSignal and return a promise.\n\t * @returns A promise resolving to the first settled result.\n\t * @example\n\t * ```typescript\n\t * const result = await Transportr.race([\n\t * (signal) => api.getJson('/primary', { signal }),\n\t * (signal) => api.getJson('/fallback', { signal })\n\t * ]);\n\t * ```\n\t */\n\tstatic async race<T>(requests: ReadonlyArray<(signal: AbortSignal) => Promise<T>>): Promise<T> {\n\t\tconst controllers: AbortController[] = [];\n\n\t\tconst promises = new Array<Promise<T>>(requests.length);\n\t\tfor (let i = 0; i < requests.length; i++) {\n\t\t\tconst controller = new AbortController();\n\t\t\tcontrollers.push(controller);\n\t\t\tpromises[i] = requests[i]!(controller.signal);\n\t\t}\n\n\t\ttry {\n\t\t\treturn await Promise.race(promises);\n\t\t} finally {\n\t\t\tfor (const controller_1 of controllers) { controller_1.abort() }\n\t\t}\n\t}\n\n\t/**\n\t * Registers a custom content-type response handler.\n\t * The handler will be matched against response content-type headers using MediaType matching.\n\t * New handlers are prepended so they take priority over built-in handlers.\n\t *\n\t * @param contentType The content-type string to match (e.g. 'application/pdf', 'text', 'csv').\n\t * @param handler The response handler function.\n\t */\n\tstatic registerContentTypeHandler(contentType: string, handler: ResponseHandler): void {\n\t\t// Prepend so custom handlers take priority over built-in ones\n\t\tTransportr.contentTypeHandlers.unshift([ contentType, handler ]);\n\t}\n\n\t/**\n\t * Removes a previously registered content-type response handler.\n\t *\n\t * @param contentType The content-type string to remove.\n\t * @returns True if the handler was found and removed, false otherwise.\n\t */\n\tstatic unregisterContentTypeHandler(contentType: string): boolean {\n\t\tconst index = Transportr.contentTypeHandlers.findIndex(([ type ]) => type === contentType);\n\t\tif (index === -1) { return false }\n\n\t\tTransportr.contentTypeHandlers.splice(index, 1);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Registers global lifecycle hooks that run on all requests from all instances.\n\t * Global hooks execute before instance and per-request hooks.\n\t *\n\t * @param hooks The hooks to register globally.\n\t */\n\tstatic addHooks(hooks: HookOptions): void {\n\t\tif (hooks.beforeRequest) { Transportr.globalHooks.beforeRequest.push(...hooks.beforeRequest) }\n\t\tif (hooks.afterResponse) { Transportr.globalHooks.afterResponse.push(...hooks.afterResponse) }\n\t\tif (hooks.beforeError) { Transportr.globalHooks.beforeError.push(...hooks.beforeError) }\n\t}\n\n\t/**\n\t * Removes all global lifecycle hooks.\n\t */\n\tstatic clearHooks(): void {\n\t\tTransportr.globalHooks = { beforeRequest: [], afterResponse: [], beforeError: [] };\n\t}\n\n\t/**\n\t * Tears down all global state: aborts in-flight requests, clears global event subscriptions,\n\t * hooks, in-flight deduplication map, and media type cache (retaining built-in entries).\n\t */\n\tstatic unregisterAll(): void {\n\t\tTransportr.abortAll();\n\t\tTransportr.globalSubscribr = new Subscribr();\n\t\tTransportr.clearHooks();\n\t\tTransportr.inflightRequests.clear();\n\t}\n\n\t/**\n\t * It returns the base {@link URL} for the API.\n\t *\n\t * @returns The baseUrl property.\n\t */\n\tget baseUrl(): URL {\n\t\treturn this._baseUrl;\n\t}\n\n\t/**\n\t * Registers an event handler with a {@link Transportr} instance with typed data.\n\t *\n\t * @param event The name of the event to listen for.\n\t * @param handler The function to call when the event is triggered.\n\t * @param context The context to bind to the handler.\n\t * @returns An object that can be used to remove the event handler.\n\t */\n\tregister<E extends keyof RequestEventDataMap>(event: E, handler: TypedRequestEventHandler<E>, context?: unknown): EventRegistration;\n\t/**\n\t * @internal\n\t * @param event The event to subscribe to.\n\t * @param handler The event handler.\n\t * @param context The context to bind the handler to.\n\t * @returns An object that can be used to remove the event handler.\n\t */\n\tregister(event: RequestEvent, handler: RequestEventHandler, context?: unknown): EventRegistration {\n\t\treturn this.subscribr.subscribe(event, handler, context);\n\t}\n\n\t/**\n\t * Unregisters an event handler from a {@link Transportr} instance.\n\t *\n\t * @param eventRegistration The event registration to remove.\n\t * @returns True if the {@link EventRegistration} was removed, false otherwise.\n\t */\n\tunregister(eventRegistration: EventRegistration): boolean {\n\t\treturn this.subscribr.unsubscribe(eventRegistration);\n\t}\n\n\t/**\n\t * Registers instance-level lifecycle hooks that run on all requests from this instance.\n\t * Instance hooks execute after global hooks but before per-request hooks.\n\t *\n\t * @param hooks The hooks to register on this instance.\n\t * @returns This instance for method chaining.\n\t */\n\taddHooks(hooks: HookOptions): this {\n\t\tif (hooks.beforeRequest) { this.hooks.beforeRequest.push(...hooks.beforeRequest) }\n\t\tif (hooks.afterResponse) { this.hooks.afterResponse.push(...hooks.afterResponse) }\n\t\tif (hooks.beforeError) { this.hooks.beforeError.push(...hooks.beforeError) }\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes all instance-level lifecycle hooks.\n\t * @returns This instance for method chaining.\n\t */\n\tclearHooks(): this {\n\t\tthis.hooks.beforeRequest.length = 0;\n\t\tthis.hooks.afterResponse.length = 0;\n\t\tthis.hooks.beforeError.length = 0;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Updates the instance's default options after construction.\n\t * Mirrors what the constructor accepts: headers and searchParams are merged onto\n\t * the existing defaults; all other options overwrite the current value; hooks\n\t * are appended via {@link addHooks}.\n\t *\n\t * @param options The options to apply. Accepts the same shape as the constructor.\n\t * @returns This instance for method chaining.\n\t */\n\tconfigure({ headers, searchParams, hooks, ...options }: RequestOptions): this {\n\t\tif (headers) { Transportr.mergeHeaders(this._options.headers as Headers, headers) }\n\t\tif (searchParams) { Transportr.mergeSearchParams(this._options.searchParams as URLSearchParams, searchParams) }\n\t\tif (Object.keys(options).length > 0) { Object.assign(this._options, options) }\n\t\tif (hooks) { this.addHooks(hooks) }\n\t\treturn this;\n\t}\n\n\t/**\n\t * Tears down this instance: clears all instance subscriptions and hooks.\n\t * The instance should not be used after calling this method.\n\t */\n\tdestroy(): void {\n\t\tthis.clearHooks();\n\t\tthis.subscribr.destroy();\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tget<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tget<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * This function returns a promise that resolves to the result of a request to the specified path with\n\t * the specified options, where the method is GET.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to get.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response of the request.\n\t */\n\tasync get<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this._get<T>(path, options);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tpost<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tpost<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * This function makes a POST request to the given path with the given body and options.\n\t *\n\t * @async\n\t * @template T The expected response type (defaults to ResponseBody)\n\t * @param path The path to the endpoint you want to call.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response body.\n\t */\n\tasync post<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\tif (typeof(path) !== 'string') { [ path, options ] = [ undefined, path as RequestOptions ] }\n\n\t\treturn this.execute<T>(path, options, { method: 'POST' });\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tput<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tput<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * This function returns a promise that resolves to the result of a request to the specified path with\n\t * the specified options, where the method is PUT.\n\t *\n\t * @async\n\t * @template T The expected response type (defaults to ResponseBody)\n\t * @param path The path to the endpoint you want to call.\n\t * @param options The options for the request.\n\t * @returns The return value of the #request method.\n\t */\n\tasync put<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, options, { method: 'PUT' });\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tpatch<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tpatch<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * It takes a path and options, and returns a request with the method set to PATCH.\n\t *\n\t * @async\n\t * @template T The expected response type (defaults to ResponseBody)\n\t * @param path The path to the endpoint you want to hit.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response of the request.\n\t */\n\tasync patch<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, options, { method: 'PATCH' });\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tdelete<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tdelete<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * It takes a path and options, and returns a request with the method set to DELETE.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to access.\n\t * @param options The options for the request.\n\t * @returns The result of the request.\n\t */\n\tasync delete<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, options, { method: 'DELETE' });\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\thead<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\thead<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * Returns the response headers of a request to the given path.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to access.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response object.\n\t */\n\tasync head<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, options, { method: 'HEAD' });\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\toptions(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<string[] | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\toptions(path: RequestOptions & { unwrap: false }): Promise<Result<string[] | undefined>>;\n\t/**\n\t * It returns a promise that resolves to the allowed request methods for the given resource path.\n\t *\n\t * @async\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to an array of allowed request methods for this resource.\n\t */\n\tasync options(path?: string | RequestOptions, options: RequestOptions = {}): Promise<string[] | undefined | Result<string[] | undefined>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options, { method: 'OPTIONS' });\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\t// Run beforeRequest hooks: global \u2192 instance \u2192 per-request\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet response: Response = await this._request(path, requestConfig);\n\n\t\t\t// Run afterResponse hooks: global \u2192 instance \u2192 per-request\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(response, requestOptions);\n\t\t\t\t\tif (result) { response = result }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst allowedMethods = response.headers.get('allow')?.split(',').map((method: string) => method.trim());\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: allowedMethods, global: options.global });\n\n\t\t\treturn unwrap ? allowedMethods : [true, allowedMethods] as Result<string[] | undefined>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<string[] | undefined>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\trequest<T = unknown>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<TypedResponse<T>>>;\n\t/** Returns a Result tuple instead of throwing. */\n\trequest<T = unknown>(path: RequestOptions & { unwrap: false }): Promise<Result<TypedResponse<T>>>;\n\t/**\n\t * It takes a path and options, and makes a request to the server\n\t * @async\n\t * @param path The path to the endpoint you want to hit.\n\t * @param options The options for the request.\n\t * @returns The return value of the function is the return value of the function that is passed to the `then` method of the promise returned by the `fetch` method.\n\t * @throws {HttpError} If an error occurs during the request.\n\t */\n\tasync request<T = unknown>(path?: string | RequestOptions, options: RequestOptions = {}): Promise<TypedResponse<T> | Result<TypedResponse<T>>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options, {});\n\t\tconst unwrap = requestConfig.requestOptions.unwrap !== false;\n\n\t\ttry {\n\t\t\tconst response = await this._request<T>(path, requestConfig);\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: response, global: options.global });\n\n\t\t\treturn unwrap ? response : [true, response] as Result<TypedResponse<T>>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<TypedResponse<T>>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJson(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<Json | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJson(path: RequestOptions & { unwrap: false }): Promise<Result<Json | undefined>>;\n\t/**\n\t * It gets the JSON representation of the resource at the given path.\n\t *\n\t * @async\n\t * @template T The expected JSON response type (defaults to JsonObject)\n\t * @param path The path to the resource.\n\t * @param options The options object to pass to the request.\n\t * @returns A promise that resolves to the response body as a typed JSON value.\n\t */\n\tasync getJson(path?: string | RequestOptions, options?: RequestOptions): Promise<Json | undefined | Result<Json | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.JSON}` } }, handleJson);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetXml(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<Document | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetXml(path: RequestOptions & { unwrap: false }): Promise<Result<Document | undefined>>;\n\t/**\n\t * It gets the XML representation of the resource at the given path.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to get.\n\t * @param options The options for the request.\n\t * @returns The result of the function call to #get.\n\t */\n\tasync getXml(path?: string | RequestOptions, options?: RequestOptions): Promise<Document | undefined | Result<Document | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.XML}` } }, handleXml);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtml(path: string | undefined, options: RequestOptions & { unwrap: false }, selector?: string): Promise<Result<Document | Element | null | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtml(path: RequestOptions & { unwrap: false }): Promise<Result<Document | Element | null | undefined>>;\n\t/**\n\t * Get the HTML content of the specified path.\n\t * When a selector is provided, returns only the first matching element from the parsed document.\n\t *\n\t * @async\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @param selector An optional CSS selector to extract a specific element from the parsed HTML.\n\t * @returns A promise that resolves to a Document, an Element (if selector matched), or void.\n\t */\n\tasync getHtml(path?: string | RequestOptions, options?: RequestOptions, selector?: string): Promise<Document | Element | null | undefined | Result<Document | Element | null | undefined>> {\n\t\tconst doc = await this._get(path, options, { headers: { accept: `${mediaTypes.HTML}` } }, handleHtml);\n\t\tif (Array.isArray(doc)) return doc;\n\t\treturn selector && doc ? doc.querySelector(selector) : doc;\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtmlFragment(path: string | undefined, options: RequestOptions & { unwrap: false }, selector?: string): Promise<Result<DocumentFragment | Element | null | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtmlFragment(path: RequestOptions & { unwrap: false }): Promise<Result<DocumentFragment | Element | null | undefined>>;\n\t/**\n\t * It returns a promise that resolves to the HTML fragment at the given path.\n\t * When a selector is provided, returns only the first matching element from the parsed fragment.\n\t *\n\t * @async\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @param selector An optional CSS selector to extract a specific element from the parsed fragment.\n\t * @returns A promise that resolves to a DocumentFragment, an Element (if selector matched), or void.\n\t */\n\tasync getHtmlFragment(path?: string | RequestOptions, options?: RequestOptions, selector?: string): Promise<DocumentFragment | Element | null | undefined | Result<DocumentFragment | Element | null | undefined>> {\n\t\tconst fragment = await this._get(path, options, { headers: { accept: `${mediaTypes.HTML}` } }, handleHtmlFragment);\n\t\tif (Array.isArray(fragment)) return fragment;\n\t\treturn selector && fragment ? fragment.querySelector(selector) : fragment;\n\t}\n\t/** Returns a Result tuple instead of throwing. */\n\tgetScript(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetScript(path: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/**\n\t * It gets a script from the server, and appends the script to the Document HTMLHeadElement\n\t * @param path The path to the script.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to void.\n\t */\n\tasync getScript(path?: string | RequestOptions, options?: RequestOptions): Promise<void | Result<void>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.JAVA_SCRIPT}` } }, handleScript);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStylesheet(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStylesheet(path: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/**\n\t * Gets a stylesheet from the server, and adds it as a Blob URL.\n\t * @param path The path to the stylesheet.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to void.\n\t */\n\tasync getStylesheet(path?: string | RequestOptions, options?: RequestOptions): Promise<void | Result<void>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.CSS}` } }, handleCss);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBlob(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<Blob | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBlob(path: RequestOptions & { unwrap: false }): Promise<Result<Blob | undefined>>;\n\t/**\n\t * It returns a blob from the specified path.\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to a Blob or void.\n\t */\n\tasync getBlob(path?: string | RequestOptions, options?: RequestOptions): Promise<Blob | undefined | Result<Blob | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'application/octet-stream' } }, handleBlob);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetImage(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<HTMLImageElement | undefined>>;\n\t/**\n\t * It returns a promise that resolves to an `HTMLImageElement`.\n\t * The object URL created to load the image is automatically revoked to prevent memory leaks.\n\t * Works in both browser and Node.js (via JSDOM) environments.\n\t * @param path The path to the image.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to an `HTMLImageElement` or `void`.\n\t */\n\tasync getImage(path?: string, options?: RequestOptions): Promise<HTMLImageElement | undefined | Result<HTMLImageElement | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'image/*' } }, handleImage);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBuffer(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<ArrayBuffer | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBuffer(path: RequestOptions & { unwrap: false }): Promise<Result<ArrayBuffer | undefined>>;\n\t/**\n\t * It gets a buffer from the specified path\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to an ArrayBuffer or void.\n\t */\n\tasync getBuffer(path?: string | RequestOptions, options?: RequestOptions): Promise<ArrayBuffer | undefined | Result<ArrayBuffer | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'application/octet-stream' } }, handleBuffer);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStream(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<ReadableStream<Uint8Array> | null | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStream(path: RequestOptions & { unwrap: false }): Promise<Result<ReadableStream<Uint8Array> | null | undefined>>;\n\t/**\n\t * It returns a readable stream of the response body from the specified path.\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to a ReadableStream, null, or void.\n\t */\n\tasync getStream(path?: string | RequestOptions, options?: RequestOptions): Promise<ReadableStream<Uint8Array> | null | undefined | Result<ReadableStream<Uint8Array> | null | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'application/octet-stream' } }, handleReadableStream);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetEventStream(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<ServerSentEvent>>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetEventStream(path: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<ServerSentEvent>>>;\n\t/**\n\t * Opens a Server-Sent Events stream and returns an AsyncIterable of typed events.\n\t * Follows the EventStream specification for parsing event, data, id, and retry fields.\n\t * Iteration ends when the server closes the stream or the request is aborted.\n\t *\n\t * @async\n\t * @param path The path to the SSE endpoint.\n\t * @param options The options for the request.\n\t * @returns An AsyncIterable of parsed ServerSentEvent objects.\n\t * @example\n\t * ```typescript\n\t * for await (const event of api.getEventStream('/chat/completions', { body: { prompt } })) {\n\t * console.log(event.event, event.data);\n\t * }\n\t * ```\n\t */\n\tasync getEventStream(path?: string | RequestOptions, options?: RequestOptions): Promise<AsyncIterable<ServerSentEvent> | Result<AsyncIterable<ServerSentEvent>>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options ?? {}, { method: options?.body ? 'POST' : 'GET', headers: { accept: `${mediaTypes.EVENT_STREAM}` } });\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst response = await this._request(path, requestConfig);\n\n\t\t\tlet afterResponse: Response = response;\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(afterResponse, requestOptions);\n\t\t\t\t\tif (result) { afterResponse = result }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: afterResponse, global: requestConfig.global });\n\n\t\t\tconst stream = handleEventStream(afterResponse);\n\t\t\treturn unwrap ? stream : [true, stream] as Result<AsyncIterable<ServerSentEvent>>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<AsyncIterable<ServerSentEvent>>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJsonStream<T = Json>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<T>>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJsonStream<T = Json>(path: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<T>>>;\n\t/**\n\t * Opens an NDJSON (Newline Delimited JSON) stream and returns an AsyncIterable of typed JSON values.\n\t * Each line is independently parsed as JSON, making it suitable for streaming large datasets\n\t * or real-time JSON feeds.\n\t *\n\t * @async\n\t * @template T The expected type of each JSON line (defaults to Json).\n\t * @param path The path to the NDJSON endpoint.\n\t * @param options The options for the request.\n\t * @returns An AsyncIterable of parsed JSON values.\n\t * @example\n\t * ```typescript\n\t * for await (const user of api.getJsonStream<User>('/users/export')) {\n\t * processUser(user);\n\t * }\n\t * ```\n\t */\n\tasync getJsonStream<T = Json>(path?: string | RequestOptions, options?: RequestOptions): Promise<AsyncIterable<T> | Result<AsyncIterable<T>>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options ?? {}, { method: 'GET', headers: { accept: `${mediaTypes.NDJSON}` } });\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst response = await this._request(path, requestConfig);\n\n\t\t\tlet afterResponse: Response = response;\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(afterResponse, requestOptions);\n\t\t\t\t\tif (result) { afterResponse = result }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: afterResponse, global: requestConfig.global });\n\n\t\t\tconst stream = handleNdjsonStream<T>(afterResponse);\n\t\t\treturn unwrap ? stream : [ true, stream ] as Result<AsyncIterable<T>>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [ false, error as HttpError ] as Result<AsyncIterable<T>>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Handles a GET request.\n\t * @async\n\t * @param path The path to the resource.\n\t * @param userOptions The user options for the request.\n\t * @param options The options for the request.\n\t * @param responseHandler The response handler for the request.\n\t * @returns A promise that resolves to the response body or void.\n\t */\n\tprivate async _get<T extends ResponseBody>(path?: string | RequestOptions, userOptions?: RequestOptions, options: RequestOptions = {}, responseHandler?: ResponseHandler<T>): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, userOptions, { ...options, method: 'GET', body: undefined }, responseHandler);\n\t}\n\n\t/**\n\t * It processes the request options and returns a new object with the processed options.\n\t * @param path The path to the resource.\n\t * @param processedRequestOptions The user options for the request.\n\t * @returns A new object with the processed options.\n\t */\n\tprivate async _request<T = unknown>(path: string | undefined, { signalController, requestOptions, global }: RequestConfiguration): Promise<TypedResponse<T>> {\n\t\tTransportr.signalControllers.add(signalController);\n\n\t\tconst retryConfig = Transportr.normalizeRetryOptions(requestOptions.retry);\n\t\tconst method = requestOptions.method ?? 'GET';\n\t\tconst canRetry = retryConfig.limit > 0 && retryConfig.methods.includes(method);\n\t\tconst canDedupe = requestOptions.dedupe === true && (method === 'GET' || method === 'HEAD');\n\t\tlet attempt = 0;\n\t\tconst startTime = performance.now();\n\n\t\t/**\n\t\t * Creates a RequestTiming snapshot from the start time to now.\n\t\t * @returns Timing information for the request.\n\t\t */\n\t\tconst getTiming = (): RequestTiming => {\n\t\t\tconst end = performance.now();\n\t\t\treturn { start: startTime, end, duration: end - startTime };\n\t\t};\n\n\t\ttry {\n\t\t\tconst url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst dedupeKey = canDedupe ? `${method}:${url.href}` : '';\n\n\t\t\t// If deduplication is enabled and an in-flight request exists, clone its response\n\t\t\tif (canDedupe) {\n\t\t\t\tconst inflight = Transportr.inflightRequests.get(dedupeKey);\n\t\t\t\tif (inflight) { return (await inflight).clone() as TypedResponse<T> }\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Performs the fetch with retry logic.\n\t\t\t * @returns A promise resolving to the typed response.\n\t\t\t */\n\t\t\tconst originalBody = requestOptions.body;\n\t\t\tconst onUploadProgress = requestOptions.onUploadProgress;\n\n\t\t\t/**\n\t\t\t * Wraps the request body with a progress-tracking TransformStream when onUploadProgress is set.\n\t\t\t * Re-creates the stream from the original body on each call so retries get a fresh stream.\n\t\t\t */\n\t\t\tconst wrapUploadBody = async (): Promise<void> => {\n\t\t\t\tif (!onUploadProgress || originalBody == null) { return }\n\n\t\t\t\tlet bytes: Uint8Array | null = null;\n\n\t\t\t\tif (typeof originalBody === 'string') {\n\t\t\t\t\tbytes = new TextEncoder().encode(originalBody);\n\t\t\t\t} else if (originalBody instanceof Blob) {\n\t\t\t\t\tbytes = new Uint8Array(await originalBody.arrayBuffer());\n\t\t\t\t} else if (isArrayBuffer(originalBody)) {\n\t\t\t\t\tbytes = new Uint8Array(originalBody);\n\t\t\t\t} else if (ArrayBuffer.isView(originalBody)) {\n\t\t\t\t\tbytes = new Uint8Array(originalBody.buffer, originalBody.byteOffset, originalBody.byteLength);\n\t\t\t\t} else if (!(originalBody instanceof ReadableStream)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst total = bytes ? bytes.byteLength : null;\n\t\t\t\tconst readable: ReadableStream<Uint8Array> = bytes\n\t\t\t\t\t? new ReadableStream<Uint8Array>({\n\t\t\t\t\t\t/** @param controller The stream controller. */\n\t\t\t\t\t\tstart(controller) { controller.enqueue(bytes); controller.close() }\n\t\t\t\t\t})\n\t\t\t\t\t: originalBody as ReadableStream<Uint8Array>;\n\n\t\t\t\tlet loaded = 0;\n\t\t\t\tconst transform = new TransformStream<Uint8Array, Uint8Array>({\n\t\t\t\t\t/**\n\t\t\t\t\t * Tracks bytes and invokes upload progress callback.\n\t\t\t\t\t * @param chunk The data chunk.\n\t\t\t\t\t * @param controller The transform controller.\n\t\t\t\t\t */\n\t\t\t\t\ttransform(chunk, controller) {\n\t\t\t\t\t\tloaded += chunk.byteLength;\n\t\t\t\t\t\tonUploadProgress({\n\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\ttotal,\n\t\t\t\t\t\t\tpercentage: total !== null && total > 0 ? Math.round((loaded / total) * 100) : null\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\trequestOptions.body = readable.pipeThrough(transform);\n\t\t\t\tObject.assign(requestOptions, { duplex: 'half' });\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Performs the fetch with upload progress wrapping and retry logic.\n\t\t\t * @returns The typed response.\n\t\t\t */\n\t\t\tconst doFetch = async (): Promise<TypedResponse<T>> => {\n\t\t\t\twhile (true) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait wrapUploadBody();\n\t\t\t\t\t\tconst response = await fetch<T>(url, requestOptions);\n\t\t\t\t\t\tif (!response.ok) {\n\t\t\t\t\t\t\tif (canRetry && attempt < retryConfig.limit && retryConfig.statusCodes.includes(response.status)) {\n\t\t\t\t\t\t\t\tattempt++;\n\t\t\t\t\t\t\t\tthis.publish({ name: RequestEvent.RETRY, data: { attempt, status: response.status, method, path, timing: getTiming() }, global });\n\t\t\t\t\t\t\t\tawait Transportr.retryDelay(retryConfig, attempt);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Capture response body for error diagnostics\n\t\t\t\t\t\t\tlet entity: ResponseBody | undefined;\n\t\t\t\t\t\t\ttry { entity = await response.text() } catch { /* body may be unavailable */ }\n\t\t\t\t\t\t\tthrow await this.handleError(path, response, { entity, url, method, timing: getTiming() }, requestOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tif (cause instanceof HttpError) { throw cause }\n\n\t\t\t\t\t\t// Network error \u2014 retry if allowed\n\t\t\t\t\t\tif (canRetry && attempt < retryConfig.limit) {\n\t\t\t\t\t\t\tattempt++;\n\t\t\t\t\t\t\tthis.publish({ name: RequestEvent.RETRY, data: { attempt, error: (cause as Error).message, method, path, timing: getTiming() }, global });\n\t\t\t\t\t\t\tawait Transportr.retryDelay(retryConfig, attempt);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow await this.handleError(path, undefined, { cause: cause as Error, url, method, timing: getTiming() }, requestOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Wraps the response body with a progress-tracking TransformStream when onDownloadProgress is set.\n\t\t\t * @param response The response to potentially wrap.\n\t\t\t * @returns The original response or a new response with progress tracking.\n\t\t\t */\n\t\t\tconst wrapProgress = (response: TypedResponse<T>): TypedResponse<T> => {\n\t\t\t\tconst onDownloadProgress = requestOptions.onDownloadProgress;\n\t\t\t\tif (!onDownloadProgress || !response.body) return response;\n\n\t\t\t\tconst contentLength = response.headers.get('content-length');\n\t\t\t\tconst total = contentLength ? parseInt(contentLength, 10) : null;\n\t\t\t\tlet loaded = 0;\n\n\t\t\t\tconst transform = new TransformStream<Uint8Array, Uint8Array>({\n\t\t\t\t\t/**\n\t\t\t\t\t * Tracks bytes and invokes progress callback.\n\t\t\t\t\t * @param chunk The data chunk.\n\t\t\t\t\t * @param controller The transform controller.\n\t\t\t\t\t */\n\t\t\t\t\ttransform(chunk, controller) {\n\t\t\t\t\t\tloaded += chunk.byteLength;\n\t\t\t\t\t\tonDownloadProgress({\n\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\ttotal,\n\t\t\t\t\t\t\tpercentage: total !== null && total > 0 ? Math.round((loaded / total) * 100) : null\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tconst body = response.body.pipeThrough(transform);\n\t\t\t\treturn new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers }) as TypedResponse<T>;\n\t\t\t};\n\n\t\t\tif (canDedupe) {\n\t\t\t\tconst promise = doFetch();\n\t\t\t\tTransportr.inflightRequests.set(dedupeKey, promise as Promise<Response>);\n\t\t\t\ttry {\n\t\t\t\t\tconst response = await promise;\n\t\t\t\t\treturn wrapProgress(response);\n\t\t\t\t} finally {\n\t\t\t\t\tTransportr.inflightRequests.delete(dedupeKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn wrapProgress(await doFetch());\n\t\t} finally {\n\t\t\tTransportr.signalControllers.delete(signalController.destroy());\n\t\t\tif (!requestOptions.signal?.aborted) {\n\t\t\t\tconst timing = getTiming();\n\t\t\t\tthis.publish({ name: RequestEvent.COMPLETE, data: { timing }, global });\n\t\t\t\tif (Transportr.signalControllers.size === 0) {\n\t\t\t\t\tthis.publish({ name: RequestEvent.ALL_COMPLETE, global });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Normalizes a retry option into a full RetryOptions object.\n\t * @param retry The retry option from request options.\n\t * @returns Normalized retry configuration.\n\t */\n\tprivate static normalizeRetryOptions(retry?: number | RetryOptions): NormalizedRetryOptions {\n\t\tif (retry === undefined) { return { limit: 0, statusCodes: [], methods: [], delay: retryDelay, backoffFactor: retryBackoffFactor } }\n\t\tif (typeof retry === 'number') { return { limit: retry, statusCodes: [ ...retryStatusCodes ], methods: [ ...retryMethods ], delay: retryDelay, backoffFactor: retryBackoffFactor } }\n\n\t\treturn {\n\t\t\tlimit: retry.limit ?? 0,\n\t\t\tstatusCodes: retry.statusCodes ?? [ ...retryStatusCodes ],\n\t\t\tmethods: retry.methods ?? [ ...retryMethods ],\n\t\t\tdelay: retry.delay ?? retryDelay,\n\t\t\tbackoffFactor: retry.backoffFactor ?? retryBackoffFactor\n\t\t};\n\t}\n\n\t/**\n\t * Waits for the appropriate delay before a retry attempt.\n\t * @param config The retry configuration.\n\t * @param attempt The current attempt number (1-based).\n\t * @returns A promise that resolves after the delay.\n\t */\n\tprivate static retryDelay(config: NormalizedRetryOptions, attempt: number): Promise<void> {\n\t\tconst ms = typeof config.delay === 'function' ? config.delay(attempt) : config.delay * (config.backoffFactor ** (attempt - 1));\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\t/**\n\t * It returns a response handler based on the content type of the response.\n\t * @param path The path to the resource.\n\t * @param userOptions The user options for the request.\n\t * @param options The options for the request.\n\t * @param responseHandler The response handler for the request.\n\t * @returns A response handler function.\n\t */\n\tprivate async execute<T extends ResponseBody>(path?: string | RequestOptions, userOptions: RequestOptions = {}, options: RequestOptions = {}, responseHandler?: ResponseHandler<NoInfer<T>>): Promise<T | undefined | Result<T | undefined>> {\n\t\tif (isObject(path)) { [ path, userOptions ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(userOptions, options);\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\t// Run beforeRequest hooks: global \u2192 instance \u2192 per-request\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet response = await this._request<T>(path, requestConfig);\n\n\t\t\t// Run afterResponse hooks: global \u2192 instance \u2192 per-request\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(response, requestOptions);\n\t\t\t\t\tif (result) { response = result as TypedResponse<T> }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tif (!responseHandler && response.status !== 204) {\n\t\t\t\t\tresponseHandler = this.getResponseHandler<T>(response.headers.get('content-type'));\n\t\t\t\t}\n\n\t\t\t\tconst data = await responseHandler?.(response);\n\n\t\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data, global: requestConfig.global });\n\n\t\t\t\treturn unwrap ? data : [true, data] as Result<T | undefined>;\n\t\t\t} catch (cause) {\n\t\t\t\tthrow await this.handleError(path as string, response, { cause: cause as Error }, requestOptions);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<T | undefined>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new set of options for a request.\n\t * @param options The user options for the request.\n\t * @param userOptions The default options for the request.\n\t * @returns A new set of options for the request.\n\t */\n\tprivate static createOptions({ headers: userHeaders, searchParams: userSearchParams, ...userOptions }: RequestOptions, { headers, searchParams, ...options }: RequestOptions): RequestOptions {\n\t\theaders = Transportr.mergeHeaders(new Headers(), userHeaders, headers);\n\t\tsearchParams = Transportr.mergeSearchParams(new URLSearchParams(), userSearchParams, searchParams);\n\n\t\treturn { ...objectMerge(options, userOptions)!, headers, searchParams };\n\t}\n\n\t/**\n\t * Merges user and request headers into the target Headers object.\n\t * @param target The target Headers object.\n\t * @param headerSources Variable number of header sources to merge.\n\t * @returns The merged Headers object.\n\t */\n\tprivate static mergeHeaders(target: Headers, ...headerSources: (RequestHeaders | undefined)[]): Headers {\n\t\tfor (const headers of headerSources) {\n\t\t\tif (headers === undefined) { continue }\n\n\t\t\t// Handle different input types\n\t\t\tif (headers instanceof Headers) {\n\t\t\t\t// Use the native forEach method for Headers\n\t\t\t\theaders.forEach((value, name) => target.set(name, value));\n\t\t\t} else if (Array.isArray(headers)) {\n\t\t\t\t// Handle array of tuples format\n\t\t\t\tfor (const [ name, value ] of headers) { target.set(name, value) }\n\t\t\t} else {\n\t\t\t\t// Handle Record<string, string> format - use Object.keys() for better performance\n\t\t\t\tconst record = headers as Record<string, string | undefined>;\n\t\t\t\tconst keys = Object.keys(record);\n\t\t\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\t\t\tconst name = keys[i]!;\n\t\t\t\t\tconst value = record[name];\n\t\t\t\t\tif (value !== undefined) { target.set(name, String(value)) }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn target;\n\t}\n\n\t/**\n\t * Merges user and request search parameters into the target URLSearchParams object.\n\t * @param target The target URLSearchParams object.\n\t * @param sources The search parameters to merge.\n\t * @returns The merged URLSearchParams object.\n\t */\n\tprivate static mergeSearchParams(target: URLSearchParams, ...sources: (SearchParameters | undefined)[]): URLSearchParams {\n\t\tfor (const searchParams of sources) {\n\t\t\tif (searchParams === undefined) { continue }\n\n\t\t\t// Handle different input types\n\t\t\tif (searchParams instanceof URLSearchParams) {\n\t\t\t\t// Use the native forEach method for URLSearchParams\n\t\t\t\tsearchParams.forEach((value, name) => target.set(name, value));\n\t\t\t} else if (isString(searchParams) || Array.isArray(searchParams)) {\n\t\t\t\tfor (const [name, value] of new URLSearchParams(searchParams)) { target.set(name, value) }\n\t\t\t} else {\n\t\t\t\t// Handle Record<string, string> format - use Object.keys() for better performance\n\t\t\t\tconst keys = Object.keys(searchParams);\n\t\t\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\t\t\tconst name = keys[i]!;\n\t\t\t\t\tconst value = searchParams[name];\n\t\t\t\t\tif (value !== undefined) { target.set(name, String(value)) }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn target;\n\t}\n\n\t/**\n\t * Processes request options by merging user, instance, and method-specific options.\n\t * This method optimizes performance by using cached instance options and performing\n\t * shallow merges where possible instead of deep object cloning.\n\t * @param userOptions The user-provided options for the request.\n\t * @param options Additional method-specific options.\n\t * @returns Processed request options with signal controller and global flag.\n\t */\n\tprivate processRequestOptions({ body: userBody, headers: userHeaders, searchParams: userSearchParams, ...userOptions }: RequestOptions, { headers, searchParams, ...options }: RequestOptions): RequestConfiguration {\n\t\t// Optimize: Use shallow merge for non-nested properties instead of deep objectMerge\n\t\t// The instance _options are already merged with defaults in the constructor\n\t\tconst requestOptions = {\n\t\t\t// Spread instance options (already merged with defaults)\n\t\t\t...this._options,\n\t\t\t// Spread user options (shallow merge, sufficient for flat properties)\n\t\t\t...userOptions,\n\t\t\t// Spread method-specific options (e.g., method: 'POST')\n\t\t\t...options,\n\t\t\t// Deep merge required for headers and searchParams\n\t\t\theaders: Transportr.mergeHeaders(new Headers(), this._options.headers, userHeaders, headers),\n\t\t\tsearchParams: Transportr.mergeSearchParams(new URLSearchParams(), this._options.searchParams, userSearchParams, searchParams)\n\t\t};\n\n\t\tif (isRequestBodyMethod(requestOptions.method)) {\n\t\t\tif (isRawBody(userBody)) {\n\t\t\t\t// Raw BodyInit \u2014 send as-is, delete Content-Type so the runtime sets it automatically\n\t\t\t\trequestOptions.body = userBody;\n\t\t\t\trequestOptions.headers.delete('content-type');\n\t\t\t} else {\n\t\t\t\tconst isJson = requestOptions.headers.get('content-type')?.includes('json') ?? false;\n\t\t\t\trequestOptions.body = isJson && isObject(userBody) ? serialize(userBody) : userBody;\n\t\t\t}\n\t\t} else {\n\t\t\trequestOptions.headers.delete('content-type');\n\t\t\tif (requestOptions.body instanceof URLSearchParams) {\n\t\t\t\tTransportr.mergeSearchParams(requestOptions.searchParams, requestOptions.body);\n\t\t\t}\n\t\t\trequestOptions.body = undefined;\n\t\t}\n\n\t\tconst { signal, timeout, global = false, xsrf } = requestOptions;\n\n\t\t// XSRF/CSRF protection: read token from cookie and set as request header\n\t\tif (xsrf) {\n\t\t\tconst xsrfConfig: XsrfOptions = typeof xsrf === 'object' ? xsrf : {};\n\t\t\tconst token = getCookieValue(xsrfConfig.cookieName ?? XSRF_COOKIE_NAME);\n\t\t\tif (token) { requestOptions.headers.set(xsrfConfig.headerName ?? XSRF_HEADER_NAME, token) }\n\t\t}\n\n\t\tconst signalController = new SignalController({ signal, timeout })\n\t\t\t.onAbort((event) => this.publish({ name: RequestEvent.ABORTED, event, global }))\n\t\t\t.onTimeout((event) => this.publish({ name: RequestEvent.TIMEOUT, event, global }));\n\n\t\trequestOptions.signal = signalController.signal;\n\t\tthis.publish({ name: RequestEvent.CONFIGURED, data: requestOptions, global });\n\n\t\treturn { signalController, requestOptions, global } as RequestConfiguration;\n\t}\n\n\t/**\n\t * Gets the base URL from a URL or string.\n\t * @param url The URL or string to parse.\n\t * @returns The base URL.\n\t */\n\tprivate static getBaseUrl(url: URL | string): URL {\n\t\tif (url instanceof URL) { return url }\n\n\t\tif (!isString(url)) { throw new TypeError('Invalid URL') }\n\n\t\treturn new URL(url, url.startsWith('/') ? globalThis.location.origin : undefined);\n\t}\n\n\t/**\n\t * Parses a content-type string into a MediaType instance with caching.\n\t * This method caches parsed MediaType instances to avoid re-parsing the same content-type strings,\n\t * which significantly improves performance for repeated requests with the same content types.\n\t * @param contentType The content-type string to parse.\n\t * @returns The parsed MediaType instance, or undefined if parsing fails.\n\t */\n\tprivate static getOrParseMediaType(contentType: string | null): MediaType | undefined {\n\t\tif (contentType === null) { return }\n\n\t\t// Check the predefined mediaTypes map first (fastest lookup) or the cache\n\t\tlet mediaType = Transportr.mediaTypeCache.get(contentType);\n\n\t\tif (mediaType !== undefined) { return mediaType }\n\n\t\t// Parse and cache the new MediaType\n\t\tmediaType = MediaType.parse(contentType) ?? undefined;\n\n\t\tif (mediaType !== undefined) {\n\t\t\t// Evict oldest entries when cache exceeds limit to prevent unbounded growth\n\t\t\tif (Transportr.mediaTypeCache.size >= 100) {\n\t\t\t\tconst oldestEntry = Transportr.mediaTypeCache.keys().next();\n\n\t\t\t\tif (!oldestEntry.done) {\n\t\t\t\t\tTransportr.mediaTypeCache.delete(oldestEntry.value);\n\t\t\t\t}\n\t\t\t}\n\t\t\tTransportr.mediaTypeCache.set(contentType, mediaType);\n\t\t}\n\n\t\treturn mediaType;\n\t}\n\n\t/**\n\t * Creates a new URL with the given path and search parameters.\n\t * @param url The base URL.\n\t * @param path The path to append to the base URL.\n\t * @param searchParams The search parameters to append to the URL.\n\t * @returns A new URL with the given path and search parameters.\n\t */\n\tprivate static createUrl(url: URL, path?: string, searchParams?: SearchParameters): URL {\n\t\tconst requestUrl = path ? new URL(`${url.pathname.replace(endsWithSlashRegEx, '')}${path}`, url.origin) : new URL(url);\n\n\t\tif (searchParams) {\n\t\t\tTransportr.mergeSearchParams(requestUrl.searchParams, searchParams);\n\t\t}\n\n\t\treturn requestUrl;\n\t}\n\n\t/**\n\t * It generates a ResponseStatus object from an error name and a Response object.\n\t * @param errorName The name of the error.\n\t * @param response The Response object.\n\t * @returns A ResponseStatus object.\n\t */\n\tprivate static generateResponseStatusFromError(errorName?: string, { status, statusText }: Response = new Response()): ResponseStatus {\n\t\tswitch (errorName) {\n\t\t\tcase SignalErrors.ABORT: return aborted;\n\t\t\tcase SignalErrors.TIMEOUT: return timedOut;\n\t\t\tdefault: return status >= 400 ? new ResponseStatus(status, statusText) : internalServerError;\n\t\t}\n\t}\n\n\t/**\n\t * Handles an error that occurs during a request.\n\t * @param path The path of the request.\n\t * @param response The Response object.\n\t * @param options Additional error context including cause, entity, url, method, and timing.\n\t * @param requestOptions The original request options that led to the error, used for hooks context.\n\t * @returns An HttpError object.\n\t */\n\tprivate async handleError(path?: string, response?: Response, { cause, entity, url, method, timing }: Omit<HttpErrorOptions, 'message'> = {}, requestOptions?: RequestOptions): Promise<HttpError> {\n\t\tconst message = method && url\t? `${method} ${url.href} failed${response ? ` with status ${response.status}` : ''}` : `An error has occurred with your request to: '${path}'`;\n\t\tlet error = new HttpError(Transportr.generateResponseStatusFromError(cause?.name, response), { message, cause, entity, url, method, timing });\n\n\t\t// Run beforeError hooks: global \u2192 instance \u2192 per-request\n\t\tconst beforeErrorHookSets = [ Transportr.globalHooks.beforeError, this.hooks.beforeError, requestOptions?.hooks?.beforeError ];\n\t\tfor (const hooks of beforeErrorHookSets) {\n\t\t\tif (!hooks) { continue }\n\t\t\tfor (const hook of hooks) {\n\t\t\t\tconst result = await hook(error);\n\t\t\t\tif (result instanceof HttpError) { error = result }\n\t\t\t}\n\t\t}\n\n\t\tthis.publish({ name: RequestEvent.ERROR, data: error });\n\n\t\treturn error;\n\t}\n\n\t/**\n\t * Publishes an event to the global and instance event handlers.\n\t * @param eventObject The event object to publish.\n\t */\n\tprivate publish({ name, event = new CustomEvent(name), data, global = true }: PublishOptions): void {\n\t\tif (global) { Transportr.globalSubscribr.publish(name, event, data) }\n\t\tthis.subscribr.publish(name, event, data);\n\t}\n\n\t/**\n\t * It returns a response handler based on the content type of the response.\n\t * @param contentType The content type of the response.\n\t * @returns A response handler function.\n\t */\n\tprivate getResponseHandler<T extends ResponseBody>(contentType?: string | null): ResponseHandler<T> | undefined {\n\t\tif (!contentType) { return }\n\n\t\tconst mediaType = Transportr.getOrParseMediaType(contentType);\n\n\t\tif (!mediaType) { return }\n\n\t\tfor (const [ contentType, responseHandler ] of Transportr.contentTypeHandlers) {\n\t\t\tif (mediaType.matches(contentType)) { return responseHandler as ResponseHandler<T> }\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * A string representation of the Transportr instance.\n\t * @returns The string 'Transportr'.\n\t */\n\tget [Symbol.toStringTag](): string {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,GAAI,CAACA,EAAe,OAEpB,IAAM5B,EAAYH,EAAW,oBAAoB+B,CAAW,EAE5D,GAAK5B,GAEL,OAAW,CAAE4B,EAAa8B,CAAgB,IAAK7D,EAAW,oBACzD,GAAIG,EAAU,QAAQ4B,CAAW,EAAK,OAAO8B,EAI/C,CAMA,IAAK,OAAO,WAAW,GAAY,CAClC,MAAO,YACR,CACD",
6
- "names": ["httpTokenCodePoints", "matcher", "httpQuotedStringTokenCodePoints", "MediaTypeParameters", "_MediaTypeParameters", "entries", "name", "value", "whitespaceChars", "trailingWhitespace", "leadingAndTrailingWhitespace", "MediaTypeParser", "_MediaTypeParser", "input", "position", "type", "typeEnd", "subtype", "subtypeEnd", "parameters", "pos", "stopChars", "lowerCase", "trim", "result", "length", "char", "component", "MediaType", "_MediaType", "mediaType", "SetMultiMap", "key", "value", "defaultValue", "compute", "iterator", "values", "deleted", "ContextEventHandler", "context", "eventHandler", "event", "data", "Subscription", "eventName", "contextEventHandler", "Subscribr", "u", "errorHandler", "options", "originalHandler", "subscription", "contextEventHandlers", "removed", "error", "HttpError", "status", "message", "cause", "entity", "url", "method", "timing", "ResponseStatus", "code", "text", "charset", "endsWithSlashRegEx", "XSRF_COOKIE_NAME", "XSRF_HEADER_NAME", "mediaTypes", "h", "defaultMediaType", "defaultOrigin", "RequestCachingPolicy", "RequestEvent", "SignalEvents", "SignalErrors", "eventListenerOptions", "abortEvent", "timeoutEvent", "requestBodyMethods", "internalServerError", "ResponseStatus", "aborted", "timedOut", "retryStatusCodes", "retryMethods", "retryDelay", "retryBackoffFactor", "SignalController", "signal", "timeout", "signals", "SignalEvents", "eventListenerOptions", "reason", "SignalErrors", "timeoutEvent", "eventListener", "event", "abortEvent", "type", "domReady", "purifyReady", "getSanitize", "p", "dirty", "ensureDom", "JSDOM", "window", "handleText", "response", "handleScript", "objectURL", "resolve", "reject", "script", "handleCss", "link", "handleJson", "handleBlob", "handleImage", "img", "handleBuffer", "handleReadableStream", "handleXml", "sanitize", "handleHtml", "handleHtmlFragment", "handleEventStream", "reader", "decoder", "buffer", "done", "eventEnd", "rawEvent", "sse", "dataLines", "lines", "i", "line", "colonIndex", "field", "value", "n", "result", "handleNdjsonStream", "lineEnd", "remaining", "isRequestBodyMethod", "method", "requestBodyMethods", "isRawBody", "body", "getCookieValue", "name", "prefix", "cookies", "i", "length", "cookie", "serialize", "data", "isString", "value", "isArrayBuffer", "isObject", "objectMerge", "objects", "obj", "deepClone", "target", "source", "property", "sourceValue", "targetValue", "item", "object", "cloned", "keys", "key", "Transportr", "_Transportr", "d", "mediaTypes", "mediaType", "handleText", "handleJson", "handleReadableStream", "handleHtml", "handleXml", "handleImage", "handleScript", "handleCss", "url", "defaultOrigin", "options", "isObject", "RequestEvent", "RequestCachingPolicy", "defaultMediaType", "event", "handler", "context", "eventRegistration", "signalController", "abortEvent", "requests", "controllers", "promises", "i", "controller", "controller_1", "contentType", "index", "type", "hooks", "headers", "searchParams", "path", "requestConfig", "requestOptions", "unwrap", "requestHooks", "beforeRequestHookSets", "hook", "result", "response", "afterResponseHookSets", "allowedMethods", "method", "error", "selector", "doc", "fragment", "handleHtmlFragment", "handleBlob", "handleBuffer", "afterResponse", "stream", "handleEventStream", "handleNdjsonStream", "userOptions", "responseHandler", "global", "retryConfig", "canRetry", "canDedupe", "attempt", "startTime", "getTiming", "end", "dedupeKey", "inflight", "originalBody", "onUploadProgress", "wrapUploadBody", "bytes", "isArrayBuffer", "total", "readable", "loaded", "transform", "chunk", "doFetch", "entity", "cause", "HttpError", "wrapProgress", "onDownloadProgress", "contentLength", "body", "promise", "timing", "retry", "retryDelay", "retryBackoffFactor", "retryStatusCodes", "retryMethods", "config", "ms", "resolve", "data", "userHeaders", "userSearchParams", "objectMerge", "target", "headerSources", "value", "name", "record", "keys", "sources", "isString", "userBody", "isRequestBodyMethod", "isRawBody", "isJson", "serialize", "signal", "timeout", "xsrf", "xsrfConfig", "token", "getCookieValue", "XSRF_COOKIE_NAME", "XSRF_HEADER_NAME", "SignalController", "h", "oldestEntry", "requestUrl", "endsWithSlashRegEx", "errorName", "status", "statusText", "SignalErrors", "aborted", "timedOut", "ResponseStatus", "internalServerError", "message", "beforeErrorHookSets"]
4
+ "sourcesContent": ["export const httpTokenCodePoints: RegExp = /^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u;", "import { httpTokenCodePoints } from './utils.js';\n\nconst matcher: RegExp = /([\"\\\\])/ug;\nconst httpQuotedStringTokenCodePoints: RegExp = /^[\\t\\u0020-\\u007E\\u0080-\\u00FF]*$/u;\n\n/**\n * Class representing the parameters for a media type record.\n * This class extends a JavaScript Map<string, string>.\n *\n * However, MediaTypeParameters methods will always interpret their arguments\n * as appropriate for media types, so parameter names will be lowercased,\n * and attempting to set invalid characters will throw an Error.\n *\n * @see https://mimesniff.spec.whatwg.org\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class MediaTypeParameters extends Map<string, string> {\n\t/**\n\t * Create a new MediaTypeParameters instance.\n\t *\n\t * @param entries An array of [ name, value ] tuples.\n\t */\n\tconstructor(entries: Iterable<[string, string]> = []) {\n\t\tsuper(entries);\n\t}\n\n\t/**\n\t * Indicates whether the supplied name and value are valid media type parameters.\n\t *\n\t * @param name The name of the media type parameter to validate.\n\t * @param value The media type parameter value to validate.\n\t * @returns true if the media type parameter is valid, false otherwise.\n\t */\n\tstatic isValid(name: string, value: string): boolean {\n\t\treturn httpTokenCodePoints.test(name) && httpQuotedStringTokenCodePoints.test(value);\n\t}\n\n\t/**\n\t * Gets the media type parameter value for the supplied name.\n\t *\n\t * @param name The name of the media type parameter to retrieve.\n\t * @returns The media type parameter value.\n\t */\n\toverride get(name: string): string | undefined {\n\t\treturn super.get(name.toLowerCase());\n\t}\n\n\t/**\n\t * Indicates whether the media type parameter with the specified name exists or not.\n\t *\n\t * @param name The name of the media type parameter to check.\n\t * @returns true if the media type parameter exists, false otherwise.\n\t */\n\toverride has(name: string): boolean {\n\t\treturn super.has(name.toLowerCase());\n\t}\n\n\t/**\n\t * Adds a new media type parameter using the specified name and value to the MediaTypeParameters.\n\t * If an parameter with the same name already exists, the parameter will be updated.\n\t *\n\t * @param name The name of the media type parameter to set.\n\t * @param value The media type parameter value.\n\t * @returns This instance.\n\t */\n\toverride set(name: string, value: string): this {\n\t\tif (!MediaTypeParameters.isValid(name, value)) {\n\t\t\tthrow new Error(`Invalid media type parameter name/value: ${name}/${value}`);\n\t\t}\n\n\t\tsuper.set(name.toLowerCase(), value);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes the media type parameter using the specified name.\n\t *\n\t * @param name The name of the media type parameter to delete.\n\t * @returns true if the parameter existed and has been removed, or false if the parameter does not exist.\n\t */\n\toverride delete(name: string): boolean {\n\t\treturn super.delete(name.toLowerCase());\n\t}\n\n\t/**\n\t * Returns a string representation of the media type parameters.\n\t *\n\t * @returns The string representation of the media type parameters.\n\t */\n\toverride toString(): string {\n\t\treturn Array.from(this).map(([ name, value ]) => `;${name}=${!value || !httpTokenCodePoints.test(value) ? `\"${value.replace(matcher, '\\\\$1')}\"` : value}`).join('');\n\t}\n\n\t/**\n\t * Returns the name of this class.\n\t *\n\t * @returns The name of this class.\n\t */\n\toverride get [Symbol.toStringTag](): string {\n\t\treturn 'MediaTypeParameters';\n\t}\n}", "import { MediaTypeParameters } from './media-type-parameters.js';\nimport { httpTokenCodePoints } from './utils.js';\n\nconst whitespaceChars = new Set([' ', '\\t', '\\n', '\\r']);\nconst trailingWhitespace: RegExp = /[ \\t\\n\\r]+$/u;\nconst leadingAndTrailingWhitespace: RegExp = /^[ \\t\\n\\r]+|[ \\t\\n\\r]+$/ug;\n\nexport interface MediaTypeComponent {\n\tposition?: number;\n\tinput: string;\n\tlowerCase?: boolean;\n\ttrim?: boolean;\n}\n\nexport interface ParsedMediaType {\n\ttype: string;\n\tsubtype: string;\n\tparameters: MediaTypeParameters;\n}\n\n/**\n * Parser for media types.\n * @see https://mimesniff.spec.whatwg.org/#parsing-a-mime-type\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class MediaTypeParser {\n\t/**\n\t * Function to parse a media type.\n\t * @param input The media type to parse\n\t * @returns An object populated with the parsed media type properties and any parameters.\n\t */\n\tstatic parse(input: string): ParsedMediaType {\n\t\tinput = input.replace(leadingAndTrailingWhitespace, '');\n\n\t\tlet position = 0;\n\t\tconst [ type, typeEnd ] = MediaTypeParser.collect(input, position, ['/']);\n\t\tposition = typeEnd;\n\n\t\tif (!type.length || position >= input.length || !httpTokenCodePoints.test(type)) {\n\t\t\tthrow new TypeError(MediaTypeParser.generateErrorMessage('type', type));\n\t\t}\n\n\t\t++position; // Skip \"/\"\n\t\tconst [ subtype, subtypeEnd ] = MediaTypeParser.collect(input, position, [';'], true, true);\n\t\tposition = subtypeEnd;\n\n\t\tif (!subtype.length || !httpTokenCodePoints.test(subtype)) {\n\t\t\tthrow new TypeError(MediaTypeParser.generateErrorMessage('subtype', subtype));\n\t\t}\n\n\t\tconst parameters = new MediaTypeParameters();\n\n\t\twhile (position < input.length) {\n\t\t\t++position; // Skip \";\"\n\t\t\twhile (whitespaceChars.has(input[position]!)) { ++position }\n\n\t\t\tlet name: string;\n\t\t\t[name, position] = MediaTypeParser.collect(input, position, [';', '='], false);\n\n\t\t\tif (position >= input.length || input[position] === ';') { continue }\n\n\t\t\t++position; // Skip \"=\"\n\n\t\t\tlet value: string;\n\t\t\tif (input[position] === '\"') {\n\t\t\t\t[ value, position ] = MediaTypeParser.collectHttpQuotedString(input, position);\n\t\t\t\twhile (position < input.length && input[position] !== ';') { ++position }\n\t\t\t} else {\n\t\t\t\t[ value, position ] = MediaTypeParser.collect(input, position, [';'], false, true);\n\t\t\t\tif (!value) { continue }\n\t\t\t}\n\n\t\t\tif (name && MediaTypeParameters.isValid(name, value) && !parameters.has(name)) {\n\t\t\t\tparameters.set(name, value);\n\t\t\t}\n\t\t}\n\n\t\treturn { type, subtype, parameters };\n\t}\n\n\t/**\n\t * Gets the name of this class.\n\t * @returns The string tag of this class.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'MediaTypeParser';\n\t}\n\n\t/**\n\t * Collects characters from `input` starting at `pos` until a stop character is found.\n\t * @param input The input string.\n\t * @param pos The starting position.\n\t * @param stopChars Characters that end collection.\n\t * @param lowerCase Whether to ASCII-lowercase the result.\n\t * @param trim Whether to strip trailing HTTP whitespace.\n\t * @returns A tuple of the collected string and the updated position.\n\t */\n\tprivate static collect(input: string, pos: number, stopChars: string[], lowerCase = true, trim = false): [string, number] {\n\t\tlet result = '';\n\t\tfor (const { length } = input; pos < length && !stopChars.includes(input[pos]!); pos++) {\n\t\t\tresult += input[pos];\n\t\t}\n\n\t\tif (lowerCase) { result = result.toLowerCase() }\n\t\tif (trim) { result = result.replace(trailingWhitespace, '') }\n\n\t\treturn [result, pos];\n\t}\n\n\t/**\n\t * Collects all the HTTP quoted strings.\n\t * This variant only implements it with the extract-value flag set.\n\t * @param input The string to process.\n\t * @param position The starting position.\n\t * @returns An array that includes the resulting string and updated position.\n\t */\n\tprivate static collectHttpQuotedString(input: string, position: number): [string, number] {\n\t\tlet value = '';\n\n\t\tfor (let length = input.length, char; ++position < length;) {\n\t\t\tif ((char = input[position]) === '\"') { break }\n\n\t\t\tvalue += char == '\\\\' && ++position < length ? input[position] : char;\n\t\t}\n\n\t\treturn [ value, position ];\n\t}\n\n\t/**\n\t * Generates an error message.\n\t * @param component The component name.\n\t * @param value The component value.\n\t * @returns The error message.\n\t */\n\tprivate static generateErrorMessage(component: string, value: string): string {\n\t\treturn `Invalid ${component} \"${value}\": only HTTP token code points are valid.`;\n\t}\n}", "import { MediaTypeParser } from './media-type-parser.js';\nimport { MediaTypeParameters } from './media-type-parameters.js';\n\n/**\n * Class used to parse media types.\n * @see https://mimesniff.spec.whatwg.org/#understanding-mime-types\n */\nexport class MediaType {\n\tprivate readonly _type: string;\n\tprivate readonly _subtype: string;\n\tprivate readonly _parameters: MediaTypeParameters;\n\n\t/**\n\t * Create a new MediaType instance from a string representation.\n\t * @param mediaType The media type to parse.\n\t * @param parameters Optional parameters.\n\t */\n\tconstructor(mediaType: string, parameters: Record<string, string> = {}) {\n\t\tif (parameters === null || typeof parameters !== 'object' || Array.isArray(parameters)) {\n\t\t\tthrow new TypeError('The parameters argument must be an object');\n\t\t}\n\n\t\t({ type: this._type, subtype: this._subtype, parameters: this._parameters } = MediaTypeParser.parse(mediaType));\n\n\t\tfor (const [ name, value ] of Object.entries(parameters)) { this._parameters.set(name, value) }\n\t}\n\n\t/**\n\t * Parses a media type string.\n\t * @param mediaType The media type to parse.\n\t * @returns The parsed media type or null if the mediaType cannot be parsed.\n\t */\n\tstatic parse(mediaType: string): MediaType | null {\n\t\ttry {\n\t\t\treturn new MediaType(mediaType);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Gets the type.\n\t * @returns The type.\n\t */\n\tget type(): string {\n\t\treturn this._type;\n\t}\n\n\t/**\n\t * Gets the subtype.\n\t * @returns The subtype.\n\t */\n\tget subtype(): string {\n\t\treturn this._subtype;\n\t}\n\n\t/**\n\t * Gets the media type essence (type/subtype).\n\t * @returns The media type without any parameters\n\t */\n\tget essence(): string {\n\t\treturn `${this._type}/${this._subtype}`;\n\t}\n\n\t/**\n\t * Gets the parameters.\n\t * @returns The media type parameters.\n\t */\n\tget parameters(): MediaTypeParameters {\n\t\treturn this._parameters;\n\t}\n\n\t/**\n\t * Checks if the media type matches the specified type.\n\t *\n\t * @param mediaType The media type to check.\n\t * @returns true if the media type matches the specified type, false otherwise.\n\t */\n\tmatches(mediaType: MediaType | string): boolean {\n\t\treturn typeof mediaType === 'string' ? this.essence.includes(mediaType) : this._type === mediaType._type && this._subtype === mediaType._subtype;\n\t}\n\n\t/**\n\t * Gets the serialized version of the media type.\n\t *\n\t * @returns The serialized media type.\n\t */\n\ttoString(): string {\n\t\treturn `${this.essence}${this._parameters.toString()}`;\n\t}\n\n\t/**\n\t * Gets the name of the class.\n\t * @returns The class name\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'MediaType';\n\t}\n}", "/** A {@link Map} that can contain multiple, unique, values for the same key. */\nexport class SetMultiMap<K, V> extends Map<K, Set<V>>{\n\t/**\n\t * Adds a new element with a specified key and value to the SetMultiMap.\n\t * If an element with the same key already exists, the value will be added to the underlying {@link Set}.\n\t * If the value already exists in the {@link Set}, it will not be added again.\n\t *\n\t * @param key - The key to set.\n\t * @param value - The value to add to the SetMultiMap.\n\t * @returns The SetMultiMap with the updated key and value.\n\t */\n\toverride set(key: K, value: V): this;\n\t/**\n\t * Adds a new Set with a specified key and value to the SetMultiMap.\n\t * If an element with the same key already exists, the value will be added to the underlying {@link Set}.\n\t * If the value already exists in the {@link Set}, it will not be added again.\n\t *\n\t * @param key - The key to set.\n\t * @param value - The set of values to add to the SetMultiMap.\n\t * @returns The SetMultiMap with the updated key and value.\n\t */\n\toverride set(key: K, value: Set<V>): this;\n\t/**\n\t * Adds a new element with a specified key and value to the SetMultiMap.\n\t * If an element with the same key already exists, the value will be added to the underlying {@link Set}.\n\t * If the value already exists in the {@link Set}, it will not be added again.\n\t *\n\t * @param key The key to set.\n\t * @param value The value to add to the SetMultiMap\n\t * @returns The SetMultiMap with the updated key and value.\n\t */\n\toverride set(key: K, value: V | Set<V>) {\n\t\tsuper.set(key, value instanceof Set ? value : (super.get(key) ?? new Set<V>()).add(value));\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will insert the default value and return it.\n\t * @param key The key to get the value for.\n\t * @param defaultValue The default value to insert if the key does not exist.\n\t * @returns The value associated with the specified key, or the default value if the key does not exist.\n\t */\n\toverride getOrInsert(key: K, defaultValue: V): V;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will insert the default value and return it.\n\t * @param key The key to get the value for.\n\t * @param defaultValue The default value to insert if the key does not exist.\n\t * @returns The value associated with the specified key, or the default value if the key does not exist.\n\t */\n\toverride getOrInsert(key: K, defaultValue: Set<V>): Set<V>;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will insert the default value and return it.\n\t * @param key The key to get the value for.\n\t * @param defaultValue The default value to insert if the key does not exist.\n\t * @returns The value associated with the specified key, or the default value if the key does not exist.\n\t */\n\toverride getOrInsert(key: K, defaultValue: V | Set<V>): V | Set<V> {\n\t\tif (this.has(key)) { return super.get(key)! }\n\n\t\tsuper.set(key, defaultValue instanceof Set ? defaultValue : (super.get(key) ?? new Set<V>()).add(defaultValue));\n\n\t\treturn defaultValue;\n\t}\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will compute the value using the provided function, insert it, and return it.\n\t * @param key The key to get the value for.\n\t * @param compute The function to compute the value if the key does not exist.\n\t * @returns The value associated with the specified key, or the computed value if the key does not exist.\n\t */\n\toverride getOrInsertComputed(key: K, compute: (key: K) => V): V;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will compute the value using the provided function, insert it, and return it.\n\t * @param key The key to get the value for.\n\t * @param compute The function to compute the value if the key does not exist.\n\t * @returns The value associated with the specified key, or the computed value if the key does not exist.\n\t */\n\toverride getOrInsertComputed(key: K, compute: (key: K) => Set<V>): Set<V>;\n\n\t/**\n\t * Gets the value associated with the specified key. If the key does not exist, it will compute the value using the provided function, insert it, and return it.\n\t * @param key The key to get the value for.\n\t * @param compute The function to compute the value if the key does not exist.\n\t * @returns The value associated with the specified key, or the computed value if the key does not exist.\n\t */\n\toverride getOrInsertComputed(key: K, compute: (key: K) => V | Set<V>): V | Set<V> {\n\t\tif (this.has(key)) { return super.get(key)! }\n\n\t\tconst defaultValue = compute(key);\n\t\tsuper.set(key, defaultValue instanceof Set ? defaultValue : (super.get(key) ?? new Set<V>()).add(defaultValue));\n\n\t\treturn defaultValue;\n\t}\n\n\t/**\n\t * Finds a specific value for a specific key using an iterator function.\n\t * @param key The key to find the value for.\n\t * @param iterator The iterator function to use to find the value.\n\t * @returns The value for the specified key\n\t */\n\tfind(key: K, iterator: (value: V) => boolean) {\n\t\tconst values = this.get(key);\n\n\t\tif (values !== undefined) {\n\t\t\treturn Array.from(values).find(iterator);\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Checks if a specific key has a specific value.\n\t *\n\t * @param key The key to check.\n\t * @param value The value to check.\n\t * @returns True if the key has the value, false otherwise.\n\t */\n\thasValue(key: K, value: V) {\n\t\tconst values = super.get(key);\n\n\t\treturn values ? values.has(value) : false;\n\t}\n\n\t/**\n\t * Removes a specific value from a specific key.\n\t * @param key The key to remove the value from.\n\t * @param value The value to remove.\n\t * @returns True if the value was removed, false otherwise.\n\t */\n\tdeleteValue(key: K, value: V | undefined) {\n\t\tif (value === undefined) { return this.delete(key) }\n\n\t\tconst values = super.get(key);\n\t\tif (values) {\n\t\t\tconst deleted = values.delete(value);\n\n\t\t\tif (values.size === 0) {\n\t\t\t\tsuper.delete(key);\n\t\t\t}\n\n\t\t\treturn deleted;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * The string tag of the SetMultiMap.\n\t * @returns The string tag of the SetMultiMap.\n\t */\n\toverride get [Symbol.toStringTag]() {\n\t\treturn 'SetMultiMap';\n\t}\n}", "import type { EventHandler } from './@types';\n\n/** A wrapper for an event handler that binds a context to the event handler. */\nexport class ContextEventHandler {\n\tprivate readonly context: unknown;\n\tprivate readonly eventHandler: EventHandler;\n\n\t/**\n\t * @param context The context to bind to the event handler.\n\t * @param eventHandler The event handler to call when the event is published.\n\t */\n\tconstructor(context: unknown, eventHandler: EventHandler) {\n\t\tthis.context = context;\n\t\tthis.eventHandler = eventHandler;\n\t}\n\n\t/**\n\t * Call the event handler for the provided event.\n\t *\n\t * @param event The event to handle\n\t * @param data The value to be passed to the event handler as a parameter.\n\t */\n\thandle(event: Event, data?: unknown): void {\n\t\tthis.eventHandler.call(this.context, event, data);\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'ContextEventHandler';\n\t}\n}", "import type { ContextEventHandler } from './context-event-handler';\n\n/** Represents a subscription to an event. */\nexport class Subscription {\n\tprivate readonly _eventName: string;\n\tprivate readonly _contextEventHandler: ContextEventHandler;\n\n\t/**\n\t * @param eventName The event name.\n\t * @param contextEventHandler The context event handler.\n\t */\n\tconstructor(eventName: string, contextEventHandler: ContextEventHandler) {\n\t\tthis._eventName = eventName;\n\t\tthis._contextEventHandler = contextEventHandler;\n\t}\n\n\t/**\n\t * Gets the event name for the subscription.\n\t *\n\t * @returns The event name.\n\t */\n\tget eventName(): string {\n\t\treturn this._eventName;\n\t}\n\n\t/**\n\t * Gets the context event handler.\n\t *\n\t * @returns The context event handler\n\t */\n\tget contextEventHandler(): ContextEventHandler {\n\t\treturn this._contextEventHandler;\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'Subscription';\n\t}\n}", "import { SetMultiMap } from '@d1g1tal/collections';\nimport { ContextEventHandler } from './context-event-handler';\nimport { Subscription } from './subscription';\nimport type { EventHandler, ErrorHandler, SubscriptionOptions } from './@types';\n\n/** A class that allows objects to subscribe to events and be notified when the event is published. */\nexport class Subscribr {\n\tprivate readonly subscribers: SetMultiMap<string, ContextEventHandler> = new SetMultiMap();\n\tprivate errorHandler?: ErrorHandler;\n\n\t/**\n\t * Set a custom error handler for handling errors that occur in event listeners.\n\t * If not set, errors will be logged to the console.\n\t *\n\t * @param errorHandler The error handler function to call when an error occurs in an event listener.\n\t */\n\tsetErrorHandler(errorHandler: ErrorHandler): void {\n\t\tthis.errorHandler = errorHandler;\n\t}\n\n\t/**\n\t * Subscribe to an event\n\t *\n\t * @param eventName The event name to subscribe to.\n\t * @param eventHandler The event handler to call when the event is published.\n\t * @param context The context to bind to the event handler.\n\t * @param options Subscription options.\n\t * @returns An object used to check if the subscription still exists and to unsubscribe from the event.\n\t */\n\tsubscribe(eventName: string, eventHandler: EventHandler, context: unknown = eventHandler, options?: SubscriptionOptions): Subscription {\n\t\tthis.validateEventName(eventName);\n\n\t\t// If once option is set, wrap the handler to auto-unsubscribe\n\t\tif (options?.once) {\n\t\t\tconst originalHandler = eventHandler;\n\t\t\teventHandler = (event: Event, data?: unknown) => {\n\t\t\t\toriginalHandler.call(context, event, data);\n\t\t\t\tthis.unsubscribe(subscription);\n\t\t\t};\n\t\t}\n\n\t\tconst contextEventHandler = new ContextEventHandler(context, eventHandler);\n\t\tthis.subscribers.set(eventName, contextEventHandler);\n\n\t\tconst subscription = new Subscription(eventName, contextEventHandler);\n\n\t\treturn subscription;\n\t}\n\n\t/**\n\t * Unsubscribe from the event\n\t *\n\t * @param subscription The subscription to unsubscribe.\n\t * @returns true if eventListener has been removed successfully. false if the value is not found or if the value is not an object.\n\t */\n\tunsubscribe({ eventName, contextEventHandler }: Subscription): boolean {\n\t\tconst contextEventHandlers = this.subscribers.get(eventName) ?? new Set();\n\t\tconst removed = contextEventHandlers.delete(contextEventHandler);\n\n\t\tif (removed && contextEventHandlers.size === 0) {\tthis.subscribers.delete(eventName) }\n\n\t\treturn removed;\n\t}\n\n\t/**\n\t * Publish an event\n\t *\n\t * @template T\n\t * @param eventName The name of the event.\n\t * @param event The event to be handled.\n\t * @param data The value to be passed to the event handler as a parameter.\n\t */\n\tpublish<T>(eventName: string, event: Event = new CustomEvent(eventName), data?: T): void {\n\t\tthis.validateEventName(eventName);\n\t\tthis.subscribers.get(eventName)?.forEach((contextEventHandler: ContextEventHandler) => {\n\t\t\ttry {\n\t\t\t\tcontextEventHandler.handle(event, data);\n\t\t\t} catch (error) {\n\t\t\t\tif (this.errorHandler) {\n\t\t\t\t\tthis.errorHandler(error as Error, eventName, event, data);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in event handler for '${eventName}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Check if the event and handler are subscribed.\n\t *\n\t * @param subscription The subscription object.\n\t * @returns true if the event name and handler are subscribed, false otherwise.\n\t */\n\tisSubscribed({ eventName, contextEventHandler }: Subscription): boolean {\n\t\treturn this.subscribers.get(eventName)?.has(contextEventHandler) ?? false;\n\t}\n\n\t/**\n\t * Validate the event name\n\t *\n\t * @param eventName The event name to validate.\n\t * @throws {TypeError} If the event name is not a non-empty string.\n\t * @throws {Error} If the event name has leading or trailing whitespace.\n\t */\n\tprivate validateEventName(eventName: string): void {\n\t\tif (!eventName || typeof eventName !== 'string') {\n\t\t\tthrow new TypeError('Event name must be a non-empty string');\n\t\t}\n\n\t\tif (eventName.trim() !== eventName) {\n\t\t\tthrow new Error('Event name cannot have leading or trailing whitespace');\n\t\t}\n\t}\n\n\t/**\n\t * Clears all subscriptions. The instance should not be used after calling this method.\n\t */\n\tdestroy(): void {\n\t\tthis.subscribers.clear();\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'Subscribr';\n\t}\n}", "import type { ResponseStatus } from '@src/response-status';\nimport type { ResponseBody, RequestTiming, HttpErrorOptions } from '@src/@types/core';\n\n/**\n * An error that represents an HTTP error response.\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nclass HttpError extends Error {\n\tprivate readonly _entity: ResponseBody;\n\tprivate readonly responseStatus: ResponseStatus;\n\tprivate readonly _url: URL | undefined;\n\tprivate readonly _method: string | undefined;\n\tprivate readonly _timing: RequestTiming | undefined;\n\n\t/**\n\t * Creates an instance of HttpError.\n\t * @param status The status code and status text of the {@link Response}.\n\t * @param httpErrorOptions The http error options.\n\t */\n\tconstructor(status: ResponseStatus, { message, cause, entity, url, method, timing }: HttpErrorOptions = {}) {\n\t\tsuper(message, { cause });\n\t\tthis._entity = entity;\n\t\tthis.responseStatus = status;\n\t\tthis._url = url;\n\t\tthis._method = method;\n\t\tthis._timing = timing;\n\t}\n\n\t/**\n\t * It returns the value of the private variable #entity.\n\t * @returns The entity property of the class.\n\t */\n\tget entity(): ResponseBody {\n\t\treturn this._entity;\n\t}\n\n\t/**\n\t * It returns the status code of the {@link Response}.\n\t * @returns The status code of the {@link Response}.\n\t */\n\tget statusCode(): number {\n\t\treturn this.responseStatus.code;\n\t}\n\n\t/**\n\t * It returns the status text of the {@link Response}.\n\t * @returns The status code and status text of the {@link Response}.\n\t */\n\tget statusText(): string {\n\t\treturn this.responseStatus?.text;\n\t}\n\n\t/**\n\t * The request URL that caused the error.\n\t * @returns The URL or undefined.\n\t */\n\tget url(): URL | undefined {\n\t\treturn this._url;\n\t}\n\n\t/**\n\t * The HTTP method that was used for the failed request.\n\t * @returns The method string or undefined.\n\t */\n\tget method(): string | undefined {\n\t\treturn this._method;\n\t}\n\n\t/**\n\t * Timing information for the failed request.\n\t * @returns The timing object or undefined.\n\t */\n\tget timing(): RequestTiming | undefined {\n\t\treturn this._timing;\n\t}\n\n\t/**\n\t * A String value representing the name of the error.\n\t * @returns The name of the error.\n\t */\n\toverride get name(): string {\n\t\treturn 'HttpError';\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn this.name;\n\t}\n}\n\nexport { HttpError };", "/**\n * A class that holds a status code and a status text, typically from a {@link Response}\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Response/status|Response.status\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class ResponseStatus {\n\tprivate readonly _code: number;\n\tprivate readonly _text: string;\n\n\t/**\n\t *\n\t * @param code The status code from the {@link Response}\n\t * @param text The status text from the {@link Response}\n\t */\n\tconstructor(code: number, text: string) {\n\t\tthis._code = code;\n\t\tthis._text = text;\n\t}\n\n\t/**\n\t * Returns the status code from the {@link Response}\n\t *\n\t * @returns The status code.\n\t */\n\tget code(): number {\n\t\treturn this._code;\n\t}\n\n\t/**\n\t * Returns the status text from the {@link Response}.\n\t *\n\t * @returns The status text.\n\t */\n\tget text(): string {\n\t\treturn this._text;\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'ResponseStatus';\n\t}\n\n\t/**\n\t * tostring method for the class.\n\t *\n\t * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString|Object.prototype.toString}\n\t * @returns The status code and status text.\n\t */\n\ttoString(): string {\n\t\treturn `${this._code} ${this._text}`;\n\t}\n}", "import { MediaType } from '@d1g1tal/media-type';\nimport { ResponseStatus } from './response-status';\nimport type { AbortEvent, TimeoutEvent, RequestMethod } from '@types';\n\nconst charset = { charset: 'utf-8' };\nconst endsWithSlashRegEx: RegExp = /\\/$/;\n/** Default XSRF cookie name */\nconst XSRF_COOKIE_NAME = 'XSRF-TOKEN';\n/** Default XSRF header name */\nconst XSRF_HEADER_NAME = 'X-XSRF-TOKEN';\n\ntype MediaTypeKey = 'PNG' | 'TEXT' | 'JSON' | 'HTML' | 'JAVA_SCRIPT' | 'CSS' | 'XML' | 'BIN' | 'EVENT_STREAM' | 'NDJSON';\n\nconst mediaTypes: { [key in MediaTypeKey]: MediaType } = {\n\tPNG: new MediaType('image/png'),\n\tTEXT: new MediaType('text/plain', charset),\n\tJSON: new MediaType('application/json', charset),\n\tHTML: new MediaType('text/html', charset),\n\tJAVA_SCRIPT: new MediaType('text/javascript', charset),\n\tCSS: new MediaType('text/css', charset),\n\tXML: new MediaType('application/xml', charset),\n\tBIN: new MediaType('application/octet-stream'),\n\tEVENT_STREAM: new MediaType('text/event-stream', charset),\n\tNDJSON: new MediaType('application/x-ndjson', charset)\n} as const;\n\nconst defaultMediaType: string = mediaTypes.JSON.toString();\nconst defaultOrigin: string = globalThis.location?.origin ?? 'http://localhost';\n\n/** Constant object for caching policies */\nconst RequestCachingPolicy = {\n\tDEFAULT: 'default',\n\tFORCE_CACHE: 'force-cache',\n\tNO_CACHE: 'no-cache',\n\tNO_STORE: 'no-store',\n\tONLY_IF_CACHED: 'only-if-cached',\n\tRELOAD: 'reload'\n} as const;\n\n/** Constant object for request events */\nexport const RequestEvent = {\n\tCONFIGURED: 'configured',\n\tSUCCESS: 'success',\n\tERROR: 'error',\n\tABORTED: 'aborted',\n\tTIMEOUT: 'timeout',\n\tRETRY: 'retry',\n\tCOMPLETE: 'complete',\n\tALL_COMPLETE: 'all-complete'\n} as const;\n\n/** Constant object for signal events */\nconst SignalEvents = {\n\tABORT: 'abort',\n\tTIMEOUT: 'timeout'\n} as const;\n\n/** Constant object for signal errors */\nconst SignalErrors = {\n\tABORT: 'AbortError',\n\tTIMEOUT: 'TimeoutError'\n} as const;\n\n/** Options for adding event listeners */\nconst eventListenerOptions: AddEventListenerOptions = { once: true, passive: true };\n\n/**\n * Creates a new custom abort event.\n * @returns A new AbortEvent instance.\n */\nconst abortEvent = (): AbortEvent => new CustomEvent(SignalEvents.ABORT, { detail: { cause: SignalErrors.ABORT } });\n\n/**\n * Creates a new custom timeout event.\n * @returns A new TimeoutEvent instance.\n */\nconst timeoutEvent = (): TimeoutEvent => new CustomEvent(SignalEvents.TIMEOUT, { detail: { cause: SignalErrors.TIMEOUT } });\n\n/** Array of request body methods */\nconst requestBodyMethods: ReadonlyArray<RequestMethod> = [ 'POST', 'PUT', 'PATCH', 'DELETE' ];\n\n/** Response status for internal server error */\nconst internalServerError: ResponseStatus = new ResponseStatus(500, 'Internal Server Error');\n\n/** Response status for aborted request */\nconst aborted: ResponseStatus = new ResponseStatus(499, 'Aborted');\n\n/** Response status for timed out request */\nconst timedOut: ResponseStatus = new ResponseStatus(504, 'Request Timeout');\n\n/** Default HTTP status codes that trigger a retry */\nconst retryStatusCodes: ReadonlyArray<number> = [ 408, 413, 429, 500, 502, 503, 504 ];\n\n/** Default HTTP methods allowed to retry (idempotent methods only) */\nconst retryMethods: ReadonlyArray<RequestMethod> = [ 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS' ];\n\n/** Default delay in ms before the first retry */\nconst retryDelay: number = 300;\n\n/** Default backoff factor applied after each retry attempt */\nconst retryBackoffFactor: number = 2;\n\nexport { aborted, abortEvent, endsWithSlashRegEx, eventListenerOptions, internalServerError, mediaTypes, defaultMediaType, defaultOrigin, requestBodyMethods, RequestCachingPolicy, retryBackoffFactor, retryDelay, retryMethods, retryStatusCodes, SignalErrors, SignalEvents, timedOut, timeoutEvent, XSRF_COOKIE_NAME, XSRF_HEADER_NAME };\nexport type RequestEvent = (typeof RequestEvent)[keyof typeof RequestEvent];\n", "import { SignalErrors, SignalEvents, abortEvent, eventListenerOptions, timeoutEvent } from './constants.js';\nimport type { AbortConfiguration, AbortEvent, AbortSignalEvent } from '@types';\n\n/** Class representing a controller for abort signals, allowing for aborting requests and handling timeout events */\nexport class SignalController {\n\tprivate readonly abortSignal: AbortSignal;\n\tprivate readonly abortController = new AbortController();\n\tprivate readonly events = new Map<EventListener, string>();\n\n\t/**\n\t * Creates a new SignalController instance.\n\t * @param options - The options for the SignalController.\n\t * @param options.signal - The signal to listen for abort events. Defaults to the internal abort signal.\n\t * @param options.timeout - The timeout value in milliseconds. Defaults to Infinity.\n\t * @throws {RangeError} If the timeout value is negative.\n\t */\n\tconstructor({ signal, timeout = Infinity }: AbortConfiguration = {}) {\n\t\tif (timeout < 0) { throw new RangeError('The timeout cannot be negative') }\n\n\t\tconst signals = [ this.abortController.signal ];\n\t\tif (signal != null) { signals.push(signal) }\n\t\tif (timeout !== Infinity) { signals.push(AbortSignal.timeout(timeout)) }\n\n\t\t(this.abortSignal = AbortSignal.any(signals)).addEventListener(SignalEvents.ABORT, this, eventListenerOptions);\n\t}\n\n\t/**\n\t * Handles the 'abort' event. If the event is caused by a timeout, the 'timeout' event is dispatched.\n\t * Guards against a timeout firing after a manual abort to prevent spurious timeout events.\n\t * @param event The event to abort with\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#specifying_this_using_bind\n\t */\n\thandleEvent({ target: { reason } }: AbortSignalEvent): void {\n\t\tif (this.abortController.signal.aborted) { return }\n\t\tif (reason instanceof DOMException && reason.name === SignalErrors.TIMEOUT) { this.abortSignal.dispatchEvent(timeoutEvent()) }\n\t}\n\n\t/**\n\t * Gets the signal. This signal will be able to abort the request, but will not be notified if the request is aborted by the timeout.\n\t * @returns The signal\n\t */\n\tget signal(): AbortSignal {\n\t\treturn this.abortSignal;\n\t}\n\n\t/**\n\t * Adds an event listener for the 'abort' event.\n\t *\n\t * @param eventListener The listener to add\n\t * @returns The SignalController\n\t */\n\tonAbort(eventListener: EventListener): SignalController {\n\t\treturn this.addEventListener(SignalEvents.ABORT, eventListener);\n\t}\n\n\t/**\n\t * Adds an event listener for the 'timeout' event.\n\t *\n\t * @param eventListener The listener to add\n\t * @returns The SignalController\n\t */\n\tonTimeout(eventListener: EventListener): SignalController {\n\t\treturn this.addEventListener(SignalEvents.TIMEOUT, eventListener);\n\t}\n\n\t/**\n\t * Aborts the signal.\n\t *\n\t * @param event The event to abort with\n\t */\n\tabort(event: AbortEvent = abortEvent()): void {\n\t\tthis.abortController.abort(event.detail?.cause);\n\t}\n\n\t/**\n\t * Removes all event listeners from the signal.\n\t *\n\t * @returns The SignalController\n\t */\n\tdestroy(): SignalController {\n\t\tthis.abortSignal.removeEventListener(SignalEvents.ABORT, this, eventListenerOptions);\n\n\t\tfor (const [ eventListener, type ] of this.events) {\n\t\t\tthis.abortSignal.removeEventListener(type, eventListener, eventListenerOptions);\n\t\t}\n\n\t\tthis.events.clear();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds an event listener for the specified event type.\n\t *\n\t * @param type The event type to listen for\n\t * @param eventListener The listener to add\n\t * @returns The SignalController\n\t */\n\tprivate addEventListener(type: string, eventListener: EventListener): SignalController {\n\t\tthis.abortSignal.addEventListener(type, eventListener, eventListenerOptions);\n\t\tthis.events.set(eventListener, type);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * A String value that is used in the creation of the default string\n\t * description of an object. Called by the built-in method {@link Object.prototype.toString}.\n\t *\n\t * @returns The default string description of this object.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'SignalController';\n\t}\n}", "import type { Json, ResponseHandler, ServerSentEvent } from '@types';\n\n/** Cached promise for lazy jsdom initialization \u2014 resolved once, reused thereafter */\nlet domReady: Promise<void> | undefined;\n\n/** Cached promise for lazy DOMPurify initialization \u2014 resolved once, reused thereafter */\nlet purifyReady: Promise<(dirty: string) => string> | undefined;\n\n/**\n * Returns a bound sanitize function, lazily loading DOMPurify on first invocation.\n * Must be called after ensureDom() to ensure the DOM environment is ready.\n * @returns A Promise resolving to the sanitize function.\n */\nconst getSanitize = (): Promise<(dirty: string) => string> =>\n\tpurifyReady ??= import('dompurify').then(({ default: p }) => (dirty: string): string => p.sanitize(dirty));\n\n/**\n * Ensures a DOM environment is available (document, DOMParser, DocumentFragment).\n * In browser environments this is a no-op. In Node.js it lazily imports jsdom on first call.\n * @returns A Promise that resolves when the DOM environment is ready.\n */\nconst ensureDom = async (): Promise<void> => {\n\tif (typeof document !== 'undefined' && typeof DOMParser !== 'undefined' && typeof DocumentFragment !== 'undefined') { return Promise.resolve() }\n\n\treturn domReady ??= import('jsdom').then(({ JSDOM }) => {\n\t\tconst { window } = new JSDOM('<!DOCTYPE html><html><head></head><body></body></html>', { url: 'http://localhost' });\n\t\tglobalThis.window = window as unknown as Window & typeof globalThis;\n\t\tObject.assign(globalThis, { document: window.document, DOMParser: window.DOMParser, DocumentFragment: window.DocumentFragment });\n\t}).catch(() => {\n\t\tdomReady = undefined;\n\t\tthrow new Error('jsdom is required for HTML/XML/DOM features in Node.js environments. Install it with: npm install jsdom');\n\t});\n};\n\n/**\n * Handles a text response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a string\n */\nconst handleText: ResponseHandler<string> = async (response) => await response.text();\n\n/**\n * Handles a script response by appending it to the Document HTMLHeadElement\n * Only available in browser environments with DOM support.\n *\n * **Security Warning:** This handler executes arbitrary JavaScript from the server response.\n * Only use with fully trusted content sources. No sanitization is applied to script content.\n * Consider using a Content Security Policy (CSP) nonce for additional protection.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to void\n */\nconst handleScript: ResponseHandler<void> = async (response) => {\n\tawait ensureDom();\n\tconst objectURL = URL.createObjectURL(await response.blob());\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst script = document.createElement('script');\n\t\tObject.assign(script, { src: objectURL, type: 'text/javascript', async: true });\n\n\t\t/**\n\t\t * Revoke the object URL and resolve the promise once the script has loaded.\n\t\t */\n\t\tscript.onload = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tdocument.head.removeChild(script);\n\t\t\tresolve();\n\t\t};\n\n\t\t/**\n\t\t * Revoke the object URL and reject the promise if the script fails to load.\n\t\t */\n\t\tscript.onerror = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tdocument.head.removeChild(script);\n\t\t\treject(new Error('Script failed to load'));\n\t\t};\n\n\t\tdocument.head.appendChild(script);\n\t});\n};\n\n/**\n * Handles a CSS response by appending it to the Document HTMLHeadElement.\n * Only available in browser environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to void\n */\nconst handleCss: ResponseHandler<void> = async (response) => {\n\tawait ensureDom();\n\tconst objectURL = URL.createObjectURL(await response.blob());\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst link = document.createElement('link');\n\t\tObject.assign(link, { href: objectURL, type: 'text/css', rel: 'stylesheet' });\n\n\t\t/**\n\t\t * Revoke the object URL and resolve the promise once the stylesheet has loaded.\n\t\t * @returns A Promise that resolves to void\n\t\t */\n\t\tlink.onload = () => resolve(URL.revokeObjectURL(objectURL));\n\n\t\t/**\n\t\t * Revoke the object URL, remove the link element, and reject the promise if the stylesheet fails to load.\n\t\t */\n\t\tlink.onerror = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tdocument.head.removeChild(link);\n\t\t\treject(new Error('Stylesheet load failed'));\n\t\t};\n\n\t\tdocument.head.appendChild(link);\n\t});\n};\n\n/**\n * Handles a JSON response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a JsonObject\n */\nconst handleJson: ResponseHandler<Json> = async (response) => await response.json() as Json;\n\n/**\n * Handles a Blob response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a Blob\n */\nconst handleBlob: ResponseHandler<Blob> = async (response) => await response.blob();\n\n/**\n * Handles an image response by creating an object URL and returning an HTMLImageElement.\n * The object URL is revoked once the image is loaded to prevent memory leaks.\n * Works in both browser and Node.js (via JSDOM) environments.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to an HTMLImageElement\n */\nconst handleImage: ResponseHandler<HTMLImageElement> = async (response) => {\n\tawait ensureDom();\n\tconst objectURL = URL.createObjectURL(await response.blob());\n\n\treturn new Promise((resolve, reject) => {\n\t\tconst img = new Image();\n\n\t\t/**\n\t\t * Revoke the object URL once the image has loaded to free up memory and resolve with the image.\n\t\t */\n\t\timg.onload = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\tresolve(img);\n\t\t};\n\n\t\t/**\n\t\t * Revoke the object URL and reject the promise if the image fails to load.\n\t\t */\n\t\timg.onerror = () => {\n\t\t\tURL.revokeObjectURL(objectURL);\n\t\t\treject(new Error('Image failed to load'));\n\t\t};\n\n\t\timg.src = objectURL;\n\t});\n};\n\n/**\n * Handles a buffer response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to an ArrayBuffer\n */\nconst handleBuffer: ResponseHandler<ArrayBuffer> = async (response) => await response.arrayBuffer();\n\n/**\n * Handles a ReadableStream response.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a ReadableStream\n */\nconst handleReadableStream: ResponseHandler<ReadableStream<Uint8Array> | null> = async (response) => Promise.resolve(response.body);\n\n/**\n * Handles an XML response.\n * Only available in environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a Document\n */\nconst handleXml: ResponseHandler<Document> = async (response) => {\n\tawait ensureDom();\n\tconst sanitize = await getSanitize();\n\treturn new DOMParser().parseFromString(sanitize(await response.text()), 'application/xml');\n};\n\n/**\n * Handles an HTML response.\n * Only available in environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a Document\n */\nconst handleHtml: ResponseHandler<Document> = async (response) => {\n\tawait ensureDom();\n\tconst sanitize = await getSanitize();\n\treturn new DOMParser().parseFromString(sanitize(await response.text()), 'text/html');\n};\n\n/**\n * Handles an HTML fragment response.\n * Only available in environments with DOM support.\n * @param response The response object from the fetch request.\n * @returns A Promise that resolves to a DocumentFragment\n */\nconst handleHtmlFragment: ResponseHandler<DocumentFragment> = async (response) => {\n\tawait ensureDom();\n\tconst sanitize = await getSanitize();\n\treturn document.createRange().createContextualFragment(sanitize(await response.text()));\n};\n\n/**\n * Parses a text/event-stream response into an AsyncIterable of ServerSentEvent objects.\n * Follows the EventStream specification for field parsing (event, data, id, retry).\n * The returned iterable respects abort signals \u2014 iteration ends when the stream closes or is aborted.\n * @param response The response object from the fetch request.\n * @returns An AsyncIterable of parsed ServerSentEvent objects.\n */\nconst handleEventStream = (response: Response): AsyncIterable<ServerSentEvent> => {\n\treturn {\n\t\t/** @returns An async iterator for SSE events. */\n\t\t[Symbol.asyncIterator](): AsyncIterator<ServerSentEvent> {\n\t\t\tconst reader = response.body!.getReader();\n\t\t\tconst decoder = new TextDecoder();\n\t\t\tlet buffer = '';\n\t\t\tlet done = false;\n\n\t\t\treturn {\n\t\t\t\t/** @returns The next parsed SSE event or done signal. */\n\t\t\t\tasync next(): Promise<IteratorResult<ServerSentEvent>> {\n\t\t\t\t\twhile (!done) {\n\t\t\t\t\t\t// Try to extract a complete event from the buffer\n\t\t\t\t\t\tconst eventEnd = buffer.indexOf('\\n\\n');\n\t\t\t\t\t\tif (eventEnd !== -1) {\n\t\t\t\t\t\t\tconst rawEvent = buffer.slice(0, eventEnd);\n\t\t\t\t\t\t\tbuffer = buffer.slice(eventEnd + 2);\n\n\t\t\t\t\t\t\tconst sse: ServerSentEvent = { event: 'message', data: '', id: '', retry: undefined };\n\t\t\t\t\t\t\tconst dataLines: string[] = [];\n\n\t\t\t\t\t\t\tconst lines = rawEvent.split('\\n');\n\t\t\t\t\t\t\tfor (let i = 0; i < lines.length; i++) {\n\t\t\t\t\t\t\t\tconst line = lines[i]!;\n\t\t\t\t\t\t\t\t// comment line, ignore\n\t\t\t\t\t\t\t\tif (line.startsWith(':')) { continue }\n\n\t\t\t\t\t\t\t\tconst colonIndex = line.indexOf(':');\n\t\t\t\t\t\t\t\tlet field: string;\n\t\t\t\t\t\t\t\tlet value: string;\n\t\t\t\t\t\t\t\tif (colonIndex === -1) {\n\t\t\t\t\t\t\t\t\tfield = line;\n\t\t\t\t\t\t\t\t\tvalue = '';\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfield = line.slice(0, colonIndex);\n\t\t\t\t\t\t\t\t\tvalue = line.slice(colonIndex + 1);\n\t\t\t\t\t\t\t\t\t// strip leading space\n\t\t\t\t\t\t\t\t\tif (value.charCodeAt(0) === 32) { value = value.slice(1) }\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tswitch (field) {\n\t\t\t\t\t\t\t\t\tcase 'event': sse.event = value; break;\n\t\t\t\t\t\t\t\t\tcase 'data': dataLines.push(value); break;\n\t\t\t\t\t\t\t\t\tcase 'id': sse.id = value; break;\n\t\t\t\t\t\t\t\t\tcase 'retry': {\n\t\t\t\t\t\t\t\t\t\tconst n = parseInt(value, 10);\n\t\t\t\t\t\t\t\t\t\tif (!isNaN(n)) sse.retry = n;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsse.data = dataLines.join('\\n');\n\t\t\t\t\t\t\tif (sse.data || sse.event !== 'message') {\n\t\t\t\t\t\t\t\treturn { value: sse, done: false };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue; // empty event, skip\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Read more data from the stream\n\t\t\t\t\t\tconst result = await reader.read();\n\t\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuffer += decoder.decode(result.value, { stream: true });\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { value: undefined as unknown as ServerSentEvent, done: true };\n\t\t\t\t},\n\n\t\t\t\t/** @returns Done signal after cancelling the reader. */\n\t\t\t\tasync return(): Promise<IteratorResult<ServerSentEvent>> {\n\t\t\t\t\tawait reader.cancel();\n\t\t\t\t\tdone = true;\n\t\t\t\t\treturn { value: undefined as unknown as ServerSentEvent, done: true };\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n};\n\n/**\n * Parses an NDJSON (Newline Delimited JSON) response into an AsyncIterable of typed JSON values.\n * Each line of the response is parsed as an independent JSON object.\n * The returned iterable respects abort signals \u2014 iteration ends when the stream closes or is aborted.\n * @param response The response object from the fetch request.\n * @returns An AsyncIterable of parsed JSON values.\n */\nconst handleNdjsonStream = <T = Json>(response: Response): AsyncIterable<T> => {\n\treturn {\n\t\t/** @returns An async iterator for NDJSON lines. */\n\t\t[Symbol.asyncIterator](): AsyncIterator<T> {\n\t\t\tconst reader = response.body!.getReader();\n\t\t\tconst decoder = new TextDecoder();\n\t\t\tlet buffer = '';\n\t\t\tlet done = false;\n\n\t\t\treturn {\n\t\t\t\t/** @returns The next parsed JSON value or done signal. */\n\t\t\t\tasync next(): Promise<IteratorResult<T>> {\n\t\t\t\t\twhile (!done) {\n\t\t\t\t\t\tconst lineEnd = buffer.indexOf('\\n');\n\t\t\t\t\t\tif (lineEnd !== -1) {\n\t\t\t\t\t\t\tconst line = buffer.slice(0, lineEnd).trim();\n\t\t\t\t\t\t\tbuffer = buffer.slice(lineEnd + 1);\n\t\t\t\t\t\t\tif (line) {\n\t\t\t\t\t\t\t\treturn { value: JSON.parse(line) as T, done: false };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcontinue; // empty line, skip\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst result = await reader.read();\n\t\t\t\t\t\tif (result.done) {\n\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\t// Process remaining buffer\n\t\t\t\t\t\t\tconst remaining = (buffer + decoder.decode()).trim();\n\t\t\t\t\t\t\tbuffer = '';\n\t\t\t\t\t\t\tif (remaining) {\n\t\t\t\t\t\t\t\treturn { value: JSON.parse(remaining) as T, done: false };\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuffer += decoder.decode(result.value, { stream: true });\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { value: undefined as unknown as T, done: true };\n\t\t\t\t},\n\n\t\t\t\t/** @returns Done signal after cancelling the reader. */\n\t\t\t\tasync return(): Promise<IteratorResult<T>> {\n\t\t\t\t\tawait reader.cancel();\n\t\t\t\t\tdone = true;\n\t\t\t\t\treturn { value: undefined as unknown as T, done: true };\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t};\n};\n\nexport { handleText, handleScript, handleCss, handleJson, handleBlob, handleImage, handleBuffer, handleReadableStream, handleXml, handleHtml, handleHtmlFragment, handleEventStream, handleNdjsonStream };\n", "import { requestBodyMethods } from './constants';\nimport type { JsonString, JsonValue, RequestBodyMethod, RequestMethod } from '@types';\n\n/**\n * Type guard to check if a request method accepts a body.\n * @param method The request method to check.\n * @returns True if the method accepts a body, false otherwise.\n */\nexport const isRequestBodyMethod = (method: RequestMethod | undefined): method is RequestBodyMethod =>\n\tmethod !== undefined && requestBodyMethods.includes(method);\n\n/**\n * Checks whether a body value is a raw BodyInit type that should be sent as-is\n * (no JSON serialization) and should have its Content-Type deleted so the runtime\n * can set it automatically (e.g. multipart/form-data boundary for FormData).\n * @param body The request body to check.\n * @returns True if the body is a FormData, Blob, ArrayBuffer, TypedArray, DataView, ReadableStream, or URLSearchParams.\n */\nexport const isRawBody = (body: unknown): body is Exclude<BodyInit, string> =>\n\tbody instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer || body instanceof ReadableStream || body instanceof URLSearchParams || ArrayBuffer.isView(body);\n\n/**\n * Reads a cookie value by name from document.cookie.\n * Returns undefined in non-browser environments or when the cookie is not found.\n * @param name The cookie name to look up.\n * @returns The cookie value or undefined.\n */\nexport const getCookieValue = (name: string): string | undefined => {\n\tif (typeof document === 'undefined' || !document.cookie) { return }\n\n\tconst prefix = `${name}=`;\n\tconst cookies = document.cookie.split(';');\n\tfor (let i = 0, length = cookies.length; i < length; i++) {\n\t\tconst cookie = cookies[i]!.trim();\n\t\tif (cookie.startsWith(prefix)) { return decodeURIComponent(cookie.slice(prefix.length)) }\n\t}\n\n\treturn undefined;\n};\n\n/**\n * Serialize an object of type T into a JSON string.\n * The type system ensures only JSON-serializable values can be passed.\n * @template T The type of data to serialize (will be validated for JSON compatibility)\n * @param data The object to serialize - must be JSON-serializable.\n * @returns The serialized JSON string.\n */\nexport const serialize = <const T>(data: JsonValue<T>): JsonString<T> => JSON.stringify(data) as JsonString<T>;\n\n/**\n * Type predicate to check if a value is a string\n * @param value The value to check\n * @returns True if value is a string, with type narrowing\n */\nexport const isString = (value: unknown): value is string => value !== null && typeof value === 'string';\n\n/**\n * Type predicate to check if a value is an ArrayBuffer (cross-realm safe).\n * @param value The value to check.\n * @returns True if value is an ArrayBuffer, with type narrowing.\n */\nexport const isArrayBuffer = (value: unknown): value is ArrayBuffer =>\n\tvalue instanceof ArrayBuffer || Object.prototype.toString.call(value) === '[object ArrayBuffer]';\n\n/**\n * Type predicate to check if a value is an object (not array or null)\n * @param value The value to check\n * @returns True if value is an object, with type narrowing\n */\nexport const isObject = <T = object>(value: unknown): value is T extends object ? T : never => value !== null && typeof value === 'object' && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;\n\n/**\n * Performs a deep merge of multiple objects\n * @param objects The objects to merge\n * @returns The merged object\n */\nexport const objectMerge = (...objects: Record<string, unknown>[]): Record<string, unknown> | undefined => {\n\t// Early return for empty input\n\tconst length = objects.length;\n\tif (length === 0) { return undefined }\n\n\t// Early return for single object - just clone it\n\tif (length === 1) {\n\t\tconst [ obj ] = objects;\n\t\tif (!isObject(obj)) { return obj }\n\t\treturn deepClone(obj);\n\t}\n\n\tconst target = {} as Record<string, unknown>;\n\n\tfor (const source of objects) {\n\t\tif (!isObject(source)) { return undefined }\n\n\t\tfor (const [property, sourceValue] of Object.entries(source)) {\n\t\t\tconst targetValue = target[property];\n\t\t\tif (Array.isArray(sourceValue)) {\n\t\t\t\t// Handle arrays - source values come first, then unique target values\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\ttarget[property] = [ ...sourceValue, ...(Array.isArray(targetValue) ? targetValue.filter((item) => !sourceValue.includes(item)) : []) ];\n\t\t\t} else if (isObject<Record<string, unknown>>(sourceValue)) {\n\t\t\t\t// Handle plain objects using the isObject function | I am already testing that the targetValue is an object\n\t\t\t\ttarget[property] = isObject<Record<string, unknown>>(targetValue) ? objectMerge(targetValue, sourceValue)! : deepClone(sourceValue);\n\t\t\t} else {\n\t\t\t\t// Primitive values and null/undefined\n\t\t\t\ttarget[property] = sourceValue;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn target;\n};\n\n/**\n * Creates a deep clone of an object for better performance than spread operator in merge scenarios\n * @param object The object to clone\n * @returns The cloned object\n */\nfunction deepClone<T = Record<PropertyKey, unknown>>(object: T): T {\n\tif (isObject<Record<PropertyKey, unknown>>(object)) {\n\t\tconst cloned: Record<PropertyKey, unknown> = {};\n\t\tconst keys = Object.keys(object);\n\t\tfor (let i = 0, length = keys.length, key; i < length; i++) {\n\t\t\tkey = keys[i]!;\n\t\t\tcloned[key] = deepClone(object[key]);\n\t\t}\n\n\t\treturn cloned as T;\n\t}\n\n\t// For other object types (Date, RegExp, etc.), return as-is\n\treturn object;\n}\n", "import { MediaType } from '@d1g1tal/media-type';\nimport { Subscribr } from '@d1g1tal/subscribr';\nimport { HttpError } from './http-error';\nimport { ResponseStatus } from './response-status';\nimport { SignalController } from './signal-controller.js';\nimport { handleText, handleScript, handleCss, handleJson, handleBlob, handleImage, handleBuffer, handleReadableStream, handleXml, handleHtml, handleHtmlFragment, handleEventStream, handleNdjsonStream } from './response-handlers';\nimport { isRequestBodyMethod, isRawBody, getCookieValue, isString, isArrayBuffer, isObject, objectMerge, serialize } from './utils';\nimport { RequestCachingPolicy, RequestEvent, SignalErrors, XSRF_COOKIE_NAME, XSRF_HEADER_NAME, abortEvent, aborted, defaultMediaType, defaultOrigin, endsWithSlashRegEx, internalServerError, mediaTypes, retryBackoffFactor, retryDelay, retryMethods, retryStatusCodes, timedOut } from './constants';\nimport type {\tRequestBody, RequestBodyMethod, RequestOptions, ResponseBody, RequestEventHandler, SearchParameters, EventRegistration, ResponseHandler, RequestHeaders, TypedResponse, Json, Entries, HookOptions, HttpErrorOptions, NormalizedRetryOptions, PublishOptions, RetryOptions, RequestTiming, XsrfOptions, ServerSentEvent, RequestEventDataMap, TypedRequestEventHandler, Result } from '@types';\n\ndeclare function fetch<R = unknown>(input: RequestInfo | URL, requestOptions?: RequestOptions): Promise<TypedResponse<R>>;\n\ntype RequestConfiguration = {\n\tsignalController: NonNullable<SignalController>,\n\trequestOptions: RequestOptions,\n\tglobal: boolean\n};\n\n/**\n * A wrapper around the fetch API that makes it easier to make HTTP requests.\n * @author D1g1talEntr0py <jason.dimeo@gmail.com>\n */\nexport class Transportr {\n\tprivate readonly _baseUrl: URL;\n\tprivate readonly _options: RequestOptions;\n\tprivate readonly subscribr: Subscribr;\n\tprivate readonly hooks: Required<HookOptions> = { beforeRequest: [], afterResponse: [], beforeError: [] };\n\tprivate static globalSubscribr = new Subscribr();\n\tprivate static globalHooks: Required<HookOptions> = { beforeRequest: [], afterResponse: [], beforeError: [] };\n\tprivate static signalControllers = new Set<SignalController>();\n\t/** Map of in-flight deduplicated requests keyed by URL + method */\n\tprivate static inflightRequests = new Map<string, Promise<Response>>();\n\t/** Cache for parsed MediaType instances to avoid re-parsing the same content-type strings */\n\tprivate static mediaTypeCache = new Map(Object.values(mediaTypes).map((mediaType) => [ mediaType.toString(), mediaType ]));\n\tprivate static contentTypeHandlers: Entries<string, ResponseHandler<ResponseBody>> = [\n\t\t[ mediaTypes.TEXT.type, handleText ],\n\t\t[ mediaTypes.JSON.subtype, handleJson ],\n\t\t[ mediaTypes.BIN.subtype, handleReadableStream ],\n\t\t[ mediaTypes.HTML.subtype, handleHtml ],\n\t\t[ mediaTypes.XML.subtype, handleXml ],\n\t\t[ mediaTypes.PNG.type, handleImage as ResponseHandler<ResponseBody> ],\n\t\t[ mediaTypes.JAVA_SCRIPT.subtype, handleScript as ResponseHandler<ResponseBody> ],\n\t\t[ mediaTypes.CSS.subtype, handleCss as ResponseHandler<ResponseBody> ]\n\t];\n\n\t/**\n\t * Create a new Transportr instance with the provided location or origin and context path.\n\t *\n\t * @param url The URL for {@link fetch} requests.\n\t * @param options The default {@link RequestOptions} for this instance.\n\t */\n\tconstructor(url: URL | string | RequestOptions = defaultOrigin, options: RequestOptions = {}) {\n\t\tif (isObject(url)) { [ url, options ] = [ defaultOrigin, url ] }\n\n\t\tthis._baseUrl = Transportr.getBaseUrl(url);\n\t\tthis._options = Transportr.createOptions(options, Transportr.defaultRequestOptions);\n\t\tthis.subscribr = new Subscribr();\n\t}\n\n\t/** Credentials Policy */\n\tstatic readonly CredentialsPolicy = {\n\t\tINCLUDE: 'include',\n\t\tOMIT: 'omit',\n\t\tSAME_ORIGIN: 'same-origin'\n\t} as const;\n\n\t/** Request Mode */\n\tstatic readonly RequestMode = {\n\t\tCORS: 'cors',\n\t\tNAVIGATE: 'navigate',\n\t\tNO_CORS: 'no-cors',\n\t\tSAME_ORIGIN: 'same-origin'\n\t} as const;\n\n\t/** Request Priority */\n\tstatic readonly RequestPriority = {\n\t\tHIGH: 'high',\n\t\tLOW: 'low',\n\t\tAUTO: 'auto'\n\t} as const;\n\n\t/** Redirect Policy */\n\tstatic readonly RedirectPolicy = {\n\t\tERROR: 'error',\n\t\tFOLLOW: 'follow',\n\t\tMANUAL: 'manual'\n\t} as const;\n\n\t/** Referrer Policy */\n\tstatic readonly ReferrerPolicy = {\n\t\tNO_REFERRER: 'no-referrer',\n\t\tNO_REFERRER_WHEN_DOWNGRADE: 'no-referrer-when-downgrade',\n\t\tORIGIN: 'origin',\n\t\tORIGIN_WHEN_CROSS_ORIGIN: 'origin-when-cross-origin',\n\t\tSAME_ORIGIN: 'same-origin',\n\t\tSTRICT_ORIGIN: 'strict-origin',\n\t\tSTRICT_ORIGIN_WHEN_CROSS_ORIGIN: 'strict-origin-when-cross-origin',\n\t\tUNSAFE_URL: 'unsafe-url'\n\t} as const;\n\n\t/** Request Event */\n\tstatic readonly RequestEvent: typeof RequestEvent = RequestEvent;\n\n\t/** Default Request Options */\n\tprivate static readonly defaultRequestOptions: RequestOptions = {\n\t\tbody: undefined,\n\t\tcache: RequestCachingPolicy.NO_STORE,\n\t\tcredentials: Transportr.CredentialsPolicy.SAME_ORIGIN,\n\t\theaders: new Headers({ 'content-type': defaultMediaType, 'accept': defaultMediaType }),\n\t\tsearchParams: undefined,\n\t\tintegrity: undefined,\n\t\tkeepalive: undefined,\n\t\tmethod: 'GET',\n\t\tmode: Transportr.RequestMode.CORS,\n\t\tpriority: Transportr.RequestPriority.AUTO,\n\t\tredirect: Transportr.RedirectPolicy.FOLLOW,\n\t\treferrer: 'about:client',\n\t\treferrerPolicy: Transportr.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN,\n\t\tsignal: undefined,\n\t\ttimeout: 30000,\n\t\tglobal: true\n\t};\n\n\t/**\n\t * Returns a {@link EventRegistration} used for subscribing to global events with typed data.\n\t *\n\t * @param event The event to subscribe to.\n\t * @param handler The event handler with typed data parameter.\n\t * @param context The context to bind the handler to.\n\t * @returns A new {@link EventRegistration} instance.\n\t */\n\tstatic register<E extends keyof RequestEventDataMap>(event: E, handler: TypedRequestEventHandler<E>, context?: unknown): EventRegistration;\n\t/**\n\t * @internal\n\t * @param event The event to subscribe to.\n\t * @param handler The event handler.\n\t * @param context The context to bind the handler to.\n\t * @returns A new {@link EventRegistration} instance.\n\t */\n\tstatic register(event: RequestEvent, handler: RequestEventHandler, context?: unknown): EventRegistration {\n\t\treturn Transportr.globalSubscribr.subscribe(event, handler, context);\n\t}\n\n\t/**\n\t * Removes a {@link EventRegistration} from the global event handler.\n\t *\n\t * @param eventRegistration The {@link EventRegistration} to remove.\n\t * @returns True if the {@link EventRegistration} was removed, false otherwise.\n\t */\n\tstatic unregister(eventRegistration: EventRegistration): boolean {\n\t\treturn Transportr.globalSubscribr.unsubscribe(eventRegistration);\n\t}\n\n\t/**\n\t * Aborts all active requests.\n\t * This is useful for when the user navigates away from the current page.\n\t * This will also clear the {@link Transportr#signalControllers} set.\n\t */\n\tstatic abortAll(): void {\n\t\tfor (const signalController of this.signalControllers) {\n\t\t\tsignalController.abort(abortEvent());\n\t\t}\n\n\t\t// Clear the set after aborting all requests\n\t\tthis.signalControllers.clear();\n\t}\n\n\t/**\n\t * Executes multiple requests concurrently and resolves when all complete.\n\t * @param requests An array of promises from Transportr request methods.\n\t * @returns A promise resolving to an array of all results.\n\t */\n\tstatic all<T extends readonly Promise<unknown>[]>(requests: T): Promise<{ -readonly [K in keyof T]: Awaited<T[K]> }> {\n\t\treturn Promise.all(requests) as Promise<{ -readonly [K in keyof T]: Awaited<T[K]> }>;\n\t}\n\n\t/**\n\t * Races multiple requests concurrently. The first to settle wins; all others are aborted.\n\t * Each factory receives an AbortSignal that the caller should pass to the request options.\n\t * @template T The expected result type.\n\t * @param requests An array of functions that accept an AbortSignal and return a promise.\n\t * @returns A promise resolving to the first settled result.\n\t * @example\n\t * ```typescript\n\t * const result = await Transportr.race([\n\t * (signal) => api.getJson('/primary', { signal }),\n\t * (signal) => api.getJson('/fallback', { signal })\n\t * ]);\n\t * ```\n\t */\n\tstatic async race<T>(requests: ReadonlyArray<(signal: AbortSignal) => Promise<T>>): Promise<T> {\n\t\tconst controllers: AbortController[] = [];\n\n\t\tconst promises = new Array<Promise<T>>(requests.length);\n\t\tfor (let i = 0; i < requests.length; i++) {\n\t\t\tconst controller = new AbortController();\n\t\t\tcontrollers.push(controller);\n\t\t\tpromises[i] = requests[i]!(controller.signal);\n\t\t}\n\n\t\ttry {\n\t\t\treturn await Promise.race(promises);\n\t\t} finally {\n\t\t\tfor (const controller_1 of controllers) { controller_1.abort() }\n\t\t}\n\t}\n\n\t/**\n\t * Registers a custom content-type response handler.\n\t * The handler will be matched against response content-type headers using MediaType matching.\n\t * New handlers are prepended so they take priority over built-in handlers.\n\t *\n\t * @param contentType The content-type string to match (e.g. 'application/pdf', 'text', 'csv').\n\t * @param handler The response handler function.\n\t */\n\tstatic registerContentTypeHandler(contentType: string, handler: ResponseHandler): void {\n\t\t// Prepend so custom handlers take priority over built-in ones\n\t\tTransportr.contentTypeHandlers.unshift([ contentType, handler ]);\n\t}\n\n\t/**\n\t * Removes a previously registered content-type response handler.\n\t *\n\t * @param contentType The content-type string to remove.\n\t * @returns True if the handler was found and removed, false otherwise.\n\t */\n\tstatic unregisterContentTypeHandler(contentType: string): boolean {\n\t\tconst index = Transportr.contentTypeHandlers.findIndex(([ type ]) => type === contentType);\n\t\tif (index === -1) { return false }\n\n\t\tTransportr.contentTypeHandlers.splice(index, 1);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Registers global lifecycle hooks that run on all requests from all instances.\n\t * Global hooks execute before instance and per-request hooks.\n\t *\n\t * @param hooks The hooks to register globally.\n\t */\n\tstatic addHooks(hooks: HookOptions): void {\n\t\tif (hooks.beforeRequest) { Transportr.globalHooks.beforeRequest.push(...hooks.beforeRequest) }\n\t\tif (hooks.afterResponse) { Transportr.globalHooks.afterResponse.push(...hooks.afterResponse) }\n\t\tif (hooks.beforeError) { Transportr.globalHooks.beforeError.push(...hooks.beforeError) }\n\t}\n\n\t/**\n\t * Removes all global lifecycle hooks.\n\t */\n\tstatic clearHooks(): void {\n\t\tTransportr.globalHooks = { beforeRequest: [], afterResponse: [], beforeError: [] };\n\t}\n\n\t/**\n\t * Tears down all global state: aborts in-flight requests, clears global event subscriptions,\n\t * hooks, in-flight deduplication map, and media type cache (retaining built-in entries).\n\t */\n\tstatic unregisterAll(): void {\n\t\tTransportr.abortAll();\n\t\tTransportr.globalSubscribr = new Subscribr();\n\t\tTransportr.clearHooks();\n\t\tTransportr.inflightRequests.clear();\n\t}\n\n\t/**\n\t * It returns the base {@link URL} for the API.\n\t *\n\t * @returns The baseUrl property.\n\t */\n\tget baseUrl(): URL {\n\t\treturn this._baseUrl;\n\t}\n\n\t/**\n\t * Registers an event handler with a {@link Transportr} instance with typed data.\n\t *\n\t * @param event The name of the event to listen for.\n\t * @param handler The function to call when the event is triggered.\n\t * @param context The context to bind to the handler.\n\t * @returns An object that can be used to remove the event handler.\n\t */\n\tregister<E extends keyof RequestEventDataMap>(event: E, handler: TypedRequestEventHandler<E>, context?: unknown): EventRegistration;\n\t/**\n\t * @internal\n\t * @param event The event to subscribe to.\n\t * @param handler The event handler.\n\t * @param context The context to bind the handler to.\n\t * @returns An object that can be used to remove the event handler.\n\t */\n\tregister(event: RequestEvent, handler: RequestEventHandler, context?: unknown): EventRegistration {\n\t\treturn this.subscribr.subscribe(event, handler, context);\n\t}\n\n\t/**\n\t * Unregisters an event handler from a {@link Transportr} instance.\n\t *\n\t * @param eventRegistration The event registration to remove.\n\t * @returns True if the {@link EventRegistration} was removed, false otherwise.\n\t */\n\tunregister(eventRegistration: EventRegistration): boolean {\n\t\treturn this.subscribr.unsubscribe(eventRegistration);\n\t}\n\n\t/**\n\t * Registers instance-level lifecycle hooks that run on all requests from this instance.\n\t * Instance hooks execute after global hooks but before per-request hooks.\n\t *\n\t * @param hooks The hooks to register on this instance.\n\t * @returns This instance for method chaining.\n\t */\n\taddHooks(hooks: HookOptions): this {\n\t\tif (hooks.beforeRequest) { this.hooks.beforeRequest.push(...hooks.beforeRequest) }\n\t\tif (hooks.afterResponse) { this.hooks.afterResponse.push(...hooks.afterResponse) }\n\t\tif (hooks.beforeError) { this.hooks.beforeError.push(...hooks.beforeError) }\n\t\treturn this;\n\t}\n\n\t/**\n\t * Removes all instance-level lifecycle hooks.\n\t * @returns This instance for method chaining.\n\t */\n\tclearHooks(): this {\n\t\tthis.hooks.beforeRequest.length = 0;\n\t\tthis.hooks.afterResponse.length = 0;\n\t\tthis.hooks.beforeError.length = 0;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Updates the instance's default options after construction.\n\t * Mirrors what the constructor accepts: headers and searchParams are merged onto\n\t * the existing defaults; all other options overwrite the current value; hooks\n\t * are appended via {@link addHooks}.\n\t *\n\t * @param options The options to apply. Accepts the same shape as the constructor.\n\t * @returns This instance for method chaining.\n\t */\n\tconfigure({ headers, searchParams, hooks, ...options }: RequestOptions): this {\n\t\tif (headers) { Transportr.mergeHeaders(this._options.headers as Headers, headers) }\n\t\tif (searchParams) { Transportr.mergeSearchParams(this._options.searchParams as URLSearchParams, searchParams) }\n\t\tif (Object.keys(options).length > 0) { Object.assign(this._options, options) }\n\t\tif (hooks) { this.addHooks(hooks) }\n\t\treturn this;\n\t}\n\n\t/**\n\t * Tears down this instance: clears all instance subscriptions and hooks.\n\t * The instance should not be used after calling this method.\n\t */\n\tdestroy(): void {\n\t\tthis.clearHooks();\n\t\tthis.subscribr.destroy();\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tget<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tget<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * This function returns a promise that resolves to the result of a request to the specified path with\n\t * the specified options, where the method is GET.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to get.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response of the request.\n\t */\n\tasync get<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this._get<T>(path, options);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tpost<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tpost<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * This function makes a POST request to the given path with the given body and options.\n\t *\n\t * @async\n\t * @template T The expected response type (defaults to ResponseBody)\n\t * @param path The path to the endpoint you want to call.\n\t * @param body The body of the request.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response body.\n\t */\n\tasync post<T extends ResponseBody = ResponseBody>(path?: string | RequestBody, body?: RequestBody | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.executeBodyMethod<T>('POST', path, body, options);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tput<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tput<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * This function returns a promise that resolves to the result of a request to the specified path with\n\t * the specified options, where the method is PUT.\n\t *\n\t * @async\n\t * @template T The expected response type (defaults to ResponseBody)\n\t * @param path The path to the endpoint you want to call.\n\t * @param body The body of the request.\n\t * @param options The options for the request.\n\t * @returns The return value of the #request method.\n\t */\n\tasync put<T extends ResponseBody = ResponseBody>(path?: string | RequestBody, body?: RequestBody | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.executeBodyMethod<T>('PUT', path, body, options);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tpatch<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tpatch<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * It takes a path and options, and returns a request with the method set to PATCH.\n\t *\n\t * @async\n\t * @template T The expected response type (defaults to ResponseBody)\n\t * @param path The path to the endpoint you want to hit.\n\t * @param body The body of the request.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response of the request.\n\t */\n\tasync patch<T extends ResponseBody = ResponseBody>(path?: string | RequestBody, body?: RequestBody | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.executeBodyMethod<T>('PATCH', path, body, options);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tdelete<T extends ResponseBody = ResponseBody>(path: string | undefined, body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tdelete<T extends ResponseBody = ResponseBody>(body: RequestBody, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * It takes a path and options, and returns a request with the method set to DELETE.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to access.\n\t * @param body The body of the request.\n\t * @param options The options for the request.\n\t * @returns The result of the request.\n\t */\n\tasync delete<T extends ResponseBody = ResponseBody>(path?: string | RequestBody, body?: RequestBody | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.executeBodyMethod<T>('DELETE', path, body, options);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\thead<T extends ResponseBody = ResponseBody>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\thead<T extends ResponseBody = ResponseBody>(path: RequestOptions & { unwrap: false }): Promise<Result<T | undefined>>;\n\t/**\n\t * Returns the response headers of a request to the given path.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to access.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to the response object.\n\t */\n\tasync head<T extends ResponseBody = ResponseBody>(path?: string | RequestOptions, options?: RequestOptions): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, options, { method: 'HEAD' });\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\toptions(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<string[] | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\toptions(path: RequestOptions & { unwrap: false }): Promise<Result<string[] | undefined>>;\n\t/**\n\t * It returns a promise that resolves to the allowed request methods for the given resource path.\n\t *\n\t * @async\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to an array of allowed request methods for this resource.\n\t */\n\tasync options(path?: string | RequestOptions, options: RequestOptions = {}): Promise<string[] | undefined | Result<string[] | undefined>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options, { method: 'OPTIONS' });\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\t// Run beforeRequest hooks: global \u2192 instance \u2192 per-request\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet response: Response = await this._request(path, requestConfig);\n\n\t\t\t// Run afterResponse hooks: global \u2192 instance \u2192 per-request\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(response, requestOptions);\n\t\t\t\t\tif (result) { response = result }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst allowedMethods = response.headers.get('allow')?.split(',').map((method: string) => method.trim());\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: allowedMethods, global: options.global });\n\n\t\t\treturn unwrap ? allowedMethods : [true, allowedMethods] as Result<string[] | undefined>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<string[] | undefined>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\trequest<T = unknown>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<TypedResponse<T>>>;\n\t/** Returns a Result tuple instead of throwing. */\n\trequest<T = unknown>(path: RequestOptions & { unwrap: false }): Promise<Result<TypedResponse<T>>>;\n\t/**\n\t * It takes a path and options, and makes a request to the server\n\t * @async\n\t * @param path The path to the endpoint you want to hit.\n\t * @param options The options for the request.\n\t * @returns The return value of the function is the return value of the function that is passed to the `then` method of the promise returned by the `fetch` method.\n\t * @throws {HttpError} If an error occurs during the request.\n\t */\n\tasync request<T = unknown>(path?: string | RequestOptions, options: RequestOptions = {}): Promise<TypedResponse<T> | Result<TypedResponse<T>>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options, {});\n\t\tconst unwrap = requestConfig.requestOptions.unwrap !== false;\n\n\t\ttry {\n\t\t\tconst response = await this._request<T>(path, requestConfig);\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: response, global: options.global });\n\n\t\t\treturn unwrap ? response : [true, response] as Result<TypedResponse<T>>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<TypedResponse<T>>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJson(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<Json | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJson(path: RequestOptions & { unwrap: false }): Promise<Result<Json | undefined>>;\n\t/**\n\t * It gets the JSON representation of the resource at the given path.\n\t *\n\t * @async\n\t * @template T The expected JSON response type (defaults to JsonObject)\n\t * @param path The path to the resource.\n\t * @param options The options object to pass to the request.\n\t * @returns A promise that resolves to the response body as a typed JSON value.\n\t */\n\tasync getJson(path?: string | RequestOptions, options?: RequestOptions): Promise<Json | undefined | Result<Json | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.JSON}` } }, handleJson);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetXml(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<Document | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetXml(path: RequestOptions & { unwrap: false }): Promise<Result<Document | undefined>>;\n\t/**\n\t * It gets the XML representation of the resource at the given path.\n\t *\n\t * @async\n\t * @param path The path to the resource you want to get.\n\t * @param options The options for the request.\n\t * @returns The result of the function call to #get.\n\t */\n\tasync getXml(path?: string | RequestOptions, options?: RequestOptions): Promise<Document | undefined | Result<Document | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.XML}` } }, handleXml);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtml(path: string | undefined, options: RequestOptions & { unwrap: false }, selector?: string): Promise<Result<Document | Element | null | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtml(path: RequestOptions & { unwrap: false }): Promise<Result<Document | Element | null | undefined>>;\n\t/**\n\t * Get the HTML content of the specified path.\n\t * When a selector is provided, returns only the first matching element from the parsed document.\n\t *\n\t * @async\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @param selector An optional CSS selector to extract a specific element from the parsed HTML.\n\t * @returns A promise that resolves to a Document, an Element (if selector matched), or void.\n\t */\n\tasync getHtml(path?: string | RequestOptions, options?: RequestOptions, selector?: string): Promise<Document | Element | null | undefined | Result<Document | Element | null | undefined>> {\n\t\tconst doc = await this._get(path, options, { headers: { accept: `${mediaTypes.HTML}` } }, handleHtml);\n\t\tif (Array.isArray(doc)) return doc;\n\t\treturn selector && doc ? doc.querySelector(selector) : doc;\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtmlFragment(path: string | undefined, options: RequestOptions & { unwrap: false }, selector?: string): Promise<Result<DocumentFragment | Element | null | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetHtmlFragment(path: RequestOptions & { unwrap: false }): Promise<Result<DocumentFragment | Element | null | undefined>>;\n\t/**\n\t * It returns a promise that resolves to the HTML fragment at the given path.\n\t * When a selector is provided, returns only the first matching element from the parsed fragment.\n\t *\n\t * @async\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @param selector An optional CSS selector to extract a specific element from the parsed fragment.\n\t * @returns A promise that resolves to a DocumentFragment, an Element (if selector matched), or void.\n\t */\n\tasync getHtmlFragment(path?: string | RequestOptions, options?: RequestOptions, selector?: string): Promise<DocumentFragment | Element | null | undefined | Result<DocumentFragment | Element | null | undefined>> {\n\t\tconst fragment = await this._get(path, options, { headers: { accept: `${mediaTypes.HTML}` } }, handleHtmlFragment);\n\t\tif (Array.isArray(fragment)) return fragment;\n\t\treturn selector && fragment ? fragment.querySelector(selector) : fragment;\n\t}\n\t/** Returns a Result tuple instead of throwing. */\n\tgetScript(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetScript(path: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/**\n\t * It gets a script from the server, and appends the script to the Document HTMLHeadElement\n\t * @param path The path to the script.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to void.\n\t */\n\tasync getScript(path?: string | RequestOptions, options?: RequestOptions): Promise<void | Result<void>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.JAVA_SCRIPT}` } }, handleScript);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStylesheet(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStylesheet(path: RequestOptions & { unwrap: false }): Promise<Result<void>>;\n\t/**\n\t * Gets a stylesheet from the server, and adds it as a Blob URL.\n\t * @param path The path to the stylesheet.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to void.\n\t */\n\tasync getStylesheet(path?: string | RequestOptions, options?: RequestOptions): Promise<void | Result<void>> {\n\t\treturn this._get(path, options, { headers: { accept: `${mediaTypes.CSS}` } }, handleCss);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBlob(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<Blob | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBlob(path: RequestOptions & { unwrap: false }): Promise<Result<Blob | undefined>>;\n\t/**\n\t * It returns a blob from the specified path.\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to a Blob or void.\n\t */\n\tasync getBlob(path?: string | RequestOptions, options?: RequestOptions): Promise<Blob | undefined | Result<Blob | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'application/octet-stream' } }, handleBlob);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetImage(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<HTMLImageElement | undefined>>;\n\t/**\n\t * It returns a promise that resolves to an `HTMLImageElement`.\n\t * The object URL created to load the image is automatically revoked to prevent memory leaks.\n\t * Works in both browser and Node.js (via JSDOM) environments.\n\t * @param path The path to the image.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to an `HTMLImageElement` or `void`.\n\t */\n\tasync getImage(path?: string, options?: RequestOptions): Promise<HTMLImageElement | undefined | Result<HTMLImageElement | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'image/*' } }, handleImage);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBuffer(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<ArrayBuffer | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetBuffer(path: RequestOptions & { unwrap: false }): Promise<Result<ArrayBuffer | undefined>>;\n\t/**\n\t * It gets a buffer from the specified path\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to an ArrayBuffer or void.\n\t */\n\tasync getBuffer(path?: string | RequestOptions, options?: RequestOptions): Promise<ArrayBuffer | undefined | Result<ArrayBuffer | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'application/octet-stream' } }, handleBuffer);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStream(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<ReadableStream<Uint8Array> | null | undefined>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetStream(path: RequestOptions & { unwrap: false }): Promise<Result<ReadableStream<Uint8Array> | null | undefined>>;\n\t/**\n\t * It returns a readable stream of the response body from the specified path.\n\t * @param path The path to the resource.\n\t * @param options The options for the request.\n\t * @returns A promise that resolves to a ReadableStream, null, or void.\n\t */\n\tasync getStream(path?: string | RequestOptions, options?: RequestOptions): Promise<ReadableStream<Uint8Array> | null | undefined | Result<ReadableStream<Uint8Array> | null | undefined>> {\n\t\treturn this._get(path, options, { headers: { accept: 'application/octet-stream' } }, handleReadableStream);\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetEventStream(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<ServerSentEvent>>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetEventStream(path: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<ServerSentEvent>>>;\n\t/**\n\t * Opens a Server-Sent Events stream and returns an AsyncIterable of typed events.\n\t * Follows the EventStream specification for parsing event, data, id, and retry fields.\n\t * Iteration ends when the server closes the stream or the request is aborted.\n\t *\n\t * @async\n\t * @param path The path to the SSE endpoint.\n\t * @param options The options for the request.\n\t * @returns An AsyncIterable of parsed ServerSentEvent objects.\n\t * @example\n\t * ```typescript\n\t * for await (const event of api.getEventStream('/chat/completions', { body: { prompt } })) {\n\t * console.log(event.event, event.data);\n\t * }\n\t * ```\n\t */\n\tasync getEventStream(path?: string | RequestOptions, options?: RequestOptions): Promise<AsyncIterable<ServerSentEvent> | Result<AsyncIterable<ServerSentEvent>>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options ?? {}, { method: options?.body ? 'POST' : 'GET', headers: { accept: `${mediaTypes.EVENT_STREAM}` } });\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst response = await this._request(path, requestConfig);\n\n\t\t\tlet afterResponse: Response = response;\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(afterResponse, requestOptions);\n\t\t\t\t\tif (result) { afterResponse = result }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: afterResponse, global: requestConfig.global });\n\n\t\t\tconst stream = handleEventStream(afterResponse);\n\t\t\treturn unwrap ? stream : [true, stream] as Result<AsyncIterable<ServerSentEvent>>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<AsyncIterable<ServerSentEvent>>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJsonStream<T = Json>(path: string | undefined, options: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<T>>>;\n\t/** Returns a Result tuple instead of throwing. */\n\tgetJsonStream<T = Json>(path: RequestOptions & { unwrap: false }): Promise<Result<AsyncIterable<T>>>;\n\t/**\n\t * Opens an NDJSON (Newline Delimited JSON) stream and returns an AsyncIterable of typed JSON values.\n\t * Each line is independently parsed as JSON, making it suitable for streaming large datasets\n\t * or real-time JSON feeds.\n\t *\n\t * @async\n\t * @template T The expected type of each JSON line (defaults to Json).\n\t * @param path The path to the NDJSON endpoint.\n\t * @param options The options for the request.\n\t * @returns An AsyncIterable of parsed JSON values.\n\t * @example\n\t * ```typescript\n\t * for await (const user of api.getJsonStream<User>('/users/export')) {\n\t * processUser(user);\n\t * }\n\t * ```\n\t */\n\tasync getJsonStream<T = Json>(path?: string | RequestOptions, options?: RequestOptions): Promise<AsyncIterable<T> | Result<AsyncIterable<T>>> {\n\t\tif (isObject(path)) { [ path, options ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(options ?? {}, { method: 'GET', headers: { accept: `${mediaTypes.NDJSON}` } });\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst response = await this._request(path, requestConfig);\n\n\t\t\tlet afterResponse: Response = response;\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(afterResponse, requestOptions);\n\t\t\t\t\tif (result) { afterResponse = result }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data: afterResponse, global: requestConfig.global });\n\n\t\t\tconst stream = handleNdjsonStream<T>(afterResponse);\n\t\t\treturn unwrap ? stream : [ true, stream ] as Result<AsyncIterable<T>>;\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [ false, error as HttpError ] as Result<AsyncIterable<T>>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Handles a GET request.\n\t * @async\n\t * @param path The path to the resource.\n\t * @param userOptions The user options for the request.\n\t * @param options The options for the request.\n\t * @param responseHandler The response handler for the request.\n\t * @returns A promise that resolves to the response body or void.\n\t */\n\tprivate async _get<T extends ResponseBody>(path?: string | RequestOptions, userOptions?: RequestOptions, options: RequestOptions = {}, responseHandler?: ResponseHandler<T>): Promise<T | undefined | Result<T | undefined>> {\n\t\treturn this.execute<T>(path, userOptions, { ...options, method: 'GET', body: undefined }, responseHandler);\n\t}\n\n\t/**\n\t * It processes the request options and returns a new object with the processed options.\n\t * @param path The path to the resource.\n\t * @param processedRequestOptions The user options for the request.\n\t * @returns A new object with the processed options.\n\t */\n\tprivate async _request<T = unknown>(path: string | undefined, { signalController, requestOptions, global }: RequestConfiguration): Promise<TypedResponse<T>> {\n\t\tTransportr.signalControllers.add(signalController);\n\n\t\tconst retryConfig = Transportr.normalizeRetryOptions(requestOptions.retry);\n\t\tconst method = requestOptions.method ?? 'GET';\n\t\tconst canRetry = retryConfig.limit > 0 && retryConfig.methods.includes(method);\n\t\tconst canDedupe = requestOptions.dedupe === true && (method === 'GET' || method === 'HEAD');\n\t\tlet attempt = 0;\n\t\tconst startTime = performance.now();\n\n\t\t/**\n\t\t * Creates a RequestTiming snapshot from the start time to now.\n\t\t * @returns Timing information for the request.\n\t\t */\n\t\tconst getTiming = (): RequestTiming => {\n\t\t\tconst end = performance.now();\n\t\t\treturn { start: startTime, end, duration: end - startTime };\n\t\t};\n\n\t\ttry {\n\t\t\tconst url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\t\t\tconst dedupeKey = canDedupe ? `${method}:${url.href}` : '';\n\n\t\t\t// If deduplication is enabled and an in-flight request exists, clone its response\n\t\t\tif (canDedupe) {\n\t\t\t\tconst inflight = Transportr.inflightRequests.get(dedupeKey);\n\t\t\t\tif (inflight) { return (await inflight).clone() as TypedResponse<T> }\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Performs the fetch with retry logic.\n\t\t\t * @returns A promise resolving to the typed response.\n\t\t\t */\n\t\t\tconst originalBody = requestOptions.body;\n\t\t\tconst onUploadProgress = requestOptions.onUploadProgress;\n\n\t\t\t/**\n\t\t\t * Wraps the request body with a progress-tracking TransformStream when onUploadProgress is set.\n\t\t\t * Re-creates the stream from the original body on each call so retries get a fresh stream.\n\t\t\t */\n\t\t\tconst wrapUploadBody = async (): Promise<void> => {\n\t\t\t\tif (!onUploadProgress || originalBody == null) { return }\n\n\t\t\t\tlet bytes: Uint8Array | null = null;\n\n\t\t\t\tif (typeof originalBody === 'string') {\n\t\t\t\t\tbytes = new TextEncoder().encode(originalBody);\n\t\t\t\t} else if (originalBody instanceof Blob) {\n\t\t\t\t\tbytes = new Uint8Array(await originalBody.arrayBuffer());\n\t\t\t\t} else if (isArrayBuffer(originalBody)) {\n\t\t\t\t\tbytes = new Uint8Array(originalBody);\n\t\t\t\t} else if (ArrayBuffer.isView(originalBody)) {\n\t\t\t\t\tbytes = new Uint8Array(originalBody.buffer, originalBody.byteOffset, originalBody.byteLength);\n\t\t\t\t} else if (!(originalBody instanceof ReadableStream)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst total = bytes ? bytes.byteLength : null;\n\t\t\t\tconst readable: ReadableStream<Uint8Array> = bytes\n\t\t\t\t\t? new ReadableStream<Uint8Array>({\n\t\t\t\t\t\t/** @param controller The stream controller. */\n\t\t\t\t\t\tstart(controller) { controller.enqueue(bytes); controller.close() }\n\t\t\t\t\t})\n\t\t\t\t\t: originalBody as ReadableStream<Uint8Array>;\n\n\t\t\t\tlet loaded = 0;\n\t\t\t\tconst transform = new TransformStream<Uint8Array, Uint8Array>({\n\t\t\t\t\t/**\n\t\t\t\t\t * Tracks bytes and invokes upload progress callback.\n\t\t\t\t\t * @param chunk The data chunk.\n\t\t\t\t\t * @param controller The transform controller.\n\t\t\t\t\t */\n\t\t\t\t\ttransform(chunk, controller) {\n\t\t\t\t\t\tloaded += chunk.byteLength;\n\t\t\t\t\t\tonUploadProgress({\n\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\ttotal,\n\t\t\t\t\t\t\tpercentage: total !== null && total > 0 ? Math.round((loaded / total) * 100) : null\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\trequestOptions.body = readable.pipeThrough(transform);\n\t\t\t\tObject.assign(requestOptions, { duplex: 'half' });\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Performs the fetch with upload progress wrapping and retry logic.\n\t\t\t * @returns The typed response.\n\t\t\t */\n\t\t\tconst doFetch = async (): Promise<TypedResponse<T>> => {\n\t\t\t\twhile (true) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait wrapUploadBody();\n\t\t\t\t\t\tconst response = await fetch<T>(url, requestOptions);\n\t\t\t\t\t\tif (!response.ok) {\n\t\t\t\t\t\t\tif (canRetry && attempt < retryConfig.limit && retryConfig.statusCodes.includes(response.status)) {\n\t\t\t\t\t\t\t\tattempt++;\n\t\t\t\t\t\t\t\tthis.publish({ name: RequestEvent.RETRY, data: { attempt, status: response.status, method, path, timing: getTiming() }, global });\n\t\t\t\t\t\t\t\tawait Transportr.retryDelay(retryConfig, attempt);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Capture response body for error diagnostics\n\t\t\t\t\t\t\tlet entity: ResponseBody | undefined;\n\t\t\t\t\t\t\ttry { entity = await response.text() } catch { /* body may be unavailable */ }\n\t\t\t\t\t\t\tthrow await this.handleError(path, response, { entity, url, method, timing: getTiming() }, requestOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn response;\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tif (cause instanceof HttpError) { throw cause }\n\n\t\t\t\t\t\t// Network error \u2014 retry if allowed\n\t\t\t\t\t\tif (canRetry && attempt < retryConfig.limit) {\n\t\t\t\t\t\t\tattempt++;\n\t\t\t\t\t\t\tthis.publish({ name: RequestEvent.RETRY, data: { attempt, error: (cause as Error).message, method, path, timing: getTiming() }, global });\n\t\t\t\t\t\t\tawait Transportr.retryDelay(retryConfig, attempt);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthrow await this.handleError(path, undefined, { cause: cause as Error, url, method, timing: getTiming() }, requestOptions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * Wraps the response body with a progress-tracking TransformStream when onDownloadProgress is set.\n\t\t\t * @param response The response to potentially wrap.\n\t\t\t * @returns The original response or a new response with progress tracking.\n\t\t\t */\n\t\t\tconst wrapProgress = (response: TypedResponse<T>): TypedResponse<T> => {\n\t\t\t\tconst onDownloadProgress = requestOptions.onDownloadProgress;\n\t\t\t\tif (!onDownloadProgress || !response.body) return response;\n\n\t\t\t\tconst contentLength = response.headers.get('content-length');\n\t\t\t\tconst total = contentLength ? parseInt(contentLength, 10) : null;\n\t\t\t\tlet loaded = 0;\n\n\t\t\t\tconst transform = new TransformStream<Uint8Array, Uint8Array>({\n\t\t\t\t\t/**\n\t\t\t\t\t * Tracks bytes and invokes progress callback.\n\t\t\t\t\t * @param chunk The data chunk.\n\t\t\t\t\t * @param controller The transform controller.\n\t\t\t\t\t */\n\t\t\t\t\ttransform(chunk, controller) {\n\t\t\t\t\t\tloaded += chunk.byteLength;\n\t\t\t\t\t\tonDownloadProgress({\n\t\t\t\t\t\t\tloaded,\n\t\t\t\t\t\t\ttotal,\n\t\t\t\t\t\t\tpercentage: total !== null && total > 0 ? Math.round((loaded / total) * 100) : null\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontroller.enqueue(chunk);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tconst body = response.body.pipeThrough(transform);\n\t\t\t\treturn new Response(body, { status: response.status, statusText: response.statusText, headers: response.headers }) as TypedResponse<T>;\n\t\t\t};\n\n\t\t\tif (canDedupe) {\n\t\t\t\tconst promise = doFetch();\n\t\t\t\tTransportr.inflightRequests.set(dedupeKey, promise as Promise<Response>);\n\t\t\t\ttry {\n\t\t\t\t\tconst response = await promise;\n\t\t\t\t\treturn wrapProgress(response);\n\t\t\t\t} finally {\n\t\t\t\t\tTransportr.inflightRequests.delete(dedupeKey);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn wrapProgress(await doFetch());\n\t\t} finally {\n\t\t\tTransportr.signalControllers.delete(signalController.destroy());\n\t\t\tif (!requestOptions.signal?.aborted) {\n\t\t\t\tconst timing = getTiming();\n\t\t\t\tthis.publish({ name: RequestEvent.COMPLETE, data: { timing }, global });\n\t\t\t\tif (Transportr.signalControllers.size === 0) {\n\t\t\t\t\tthis.publish({ name: RequestEvent.ALL_COMPLETE, global });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Normalizes a retry option into a full RetryOptions object.\n\t * @param retry The retry option from request options.\n\t * @returns Normalized retry configuration.\n\t */\n\tprivate static normalizeRetryOptions(retry?: number | RetryOptions): NormalizedRetryOptions {\n\t\tif (retry === undefined) { return { limit: 0, statusCodes: [], methods: [], delay: retryDelay, backoffFactor: retryBackoffFactor } }\n\t\tif (typeof retry === 'number') { return { limit: retry, statusCodes: [ ...retryStatusCodes ], methods: [ ...retryMethods ], delay: retryDelay, backoffFactor: retryBackoffFactor } }\n\n\t\treturn {\n\t\t\tlimit: retry.limit ?? 0,\n\t\t\tstatusCodes: retry.statusCodes ?? [ ...retryStatusCodes ],\n\t\t\tmethods: retry.methods ?? [ ...retryMethods ],\n\t\t\tdelay: retry.delay ?? retryDelay,\n\t\t\tbackoffFactor: retry.backoffFactor ?? retryBackoffFactor\n\t\t};\n\t}\n\n\t/**\n\t * Waits for the appropriate delay before a retry attempt.\n\t * @param config The retry configuration.\n\t * @param attempt The current attempt number (1-based).\n\t * @returns A promise that resolves after the delay.\n\t */\n\tprivate static retryDelay(config: NormalizedRetryOptions, attempt: number): Promise<void> {\n\t\tconst ms = typeof config.delay === 'function' ? config.delay(attempt) : config.delay * (config.backoffFactor ** (attempt - 1));\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\t/**\n\t * Shared implementation for body-accepting HTTP methods (POST, PUT, PATCH, DELETE).\n\t * @param method The HTTP method to use.\n\t * @param path The request path, or the request body when called without a path.\n\t * @param body The request body, or options when called without a path.\n\t * @param options Additional request options.\n\t * @param responseHandler Optional response handler override.\n\t * @returns A promise that resolves to the response body.\n\t */\n\tprivate executeBodyMethod<T extends ResponseBody>(method: RequestBodyMethod, path: string | RequestBody | undefined, body?: RequestBody | RequestOptions, options?: RequestOptions, responseHandler?: ResponseHandler<NoInfer<T>>): Promise<T | undefined | Result<T | undefined>> {\n\t\tconst [resolvedPath, resolvedBody, resolvedOptions] = isString(path) ? [path, body as RequestBody, options] : [undefined, path, body as RequestOptions];\n\n\t\treturn this.execute<T>(resolvedPath, Object.assign(resolvedOptions ?? {}, { body: resolvedBody, method }), {}, responseHandler);\n\t}\n\n\t/**\n\t * It returns a response handler based on the content type of the response.\n\t * @param path The path to the resource.\n\t * @param userOptions The user options for the request.\n\t * @param options The options for the request.\n\t * @param responseHandler The response handler for the request.\n\t * @returns A response handler function.\n\t */\n\tprivate async execute<T extends ResponseBody>(path?: string | RequestOptions, userOptions: RequestOptions = {}, options: RequestOptions = {}, responseHandler?: ResponseHandler<NoInfer<T>>): Promise<T | undefined | Result<T | undefined>> {\n\t\tif (isObject(path)) { [ path, userOptions ] = [ undefined, path ] }\n\n\t\tconst requestConfig = this.processRequestOptions(userOptions, options);\n\t\tconst { requestOptions } = requestConfig;\n\t\tconst unwrap = requestOptions.unwrap !== false;\n\t\tconst requestHooks = requestOptions.hooks;\n\n\t\ttry {\n\t\t\t// Run beforeRequest hooks: global \u2192 instance \u2192 per-request\n\t\t\tlet url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams);\n\n\t\t\tconst beforeRequestHookSets = [ Transportr.globalHooks.beforeRequest, this.hooks.beforeRequest, requestHooks?.beforeRequest ];\n\t\t\tfor (const hooks of beforeRequestHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(requestOptions, url);\n\t\t\t\t\tif (result) {\n\t\t\t\t\t\tObject.assign(requestOptions, result);\n\t\t\t\t\t\tif (result.searchParams !== undefined) { url = Transportr.createUrl(this._baseUrl, path, requestOptions.searchParams) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet response = await this._request<T>(path, requestConfig);\n\n\t\t\t// Run afterResponse hooks: global \u2192 instance \u2192 per-request\n\t\t\tconst afterResponseHookSets = [ Transportr.globalHooks.afterResponse, this.hooks.afterResponse, requestHooks?.afterResponse ];\n\t\t\tfor (const hooks of afterResponseHookSets) {\n\t\t\t\tif (!hooks) { continue }\n\t\t\t\tfor (const hook of hooks) {\n\t\t\t\t\tconst result = await hook(response, requestOptions);\n\t\t\t\t\tif (result) { response = result as TypedResponse<T> }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tif (!responseHandler && response.status !== 204) {\n\t\t\t\t\tresponseHandler = this.getResponseHandler<T>(response.headers.get('content-type'));\n\t\t\t\t}\n\n\t\t\t\tconst data = await responseHandler?.(response);\n\n\t\t\t\tthis.publish({ name: RequestEvent.SUCCESS, data, global: requestConfig.global });\n\n\t\t\t\treturn unwrap ? data : [true, data] as Result<T | undefined>;\n\t\t\t} catch (cause) {\n\t\t\t\tthrow await this.handleError(path as string, response, { cause: cause as Error }, requestOptions);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (!unwrap) return [false, error as HttpError] as Result<T | undefined>;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Creates a new set of options for a request.\n\t * @param options The user options for the request.\n\t * @param userOptions The default options for the request.\n\t * @returns A new set of options for the request.\n\t */\n\tprivate static createOptions({ headers: userHeaders, searchParams: userSearchParams, ...userOptions }: RequestOptions, { headers, searchParams, ...options }: RequestOptions): RequestOptions {\n\t\theaders = Transportr.mergeHeaders(new Headers(), userHeaders, headers);\n\t\tsearchParams = Transportr.mergeSearchParams(new URLSearchParams(), userSearchParams, searchParams);\n\n\t\treturn { ...objectMerge(options, userOptions)!, headers, searchParams };\n\t}\n\n\t/**\n\t * Merges user and request headers into the target Headers object.\n\t * @param target The target Headers object.\n\t * @param headerSources Variable number of header sources to merge.\n\t * @returns The merged Headers object.\n\t */\n\tprivate static mergeHeaders(target: Headers, ...headerSources: (RequestHeaders | undefined)[]): Headers {\n\t\tfor (const headers of headerSources) {\n\t\t\tif (headers === undefined) { continue }\n\n\t\t\t// Handle different input types\n\t\t\tif (headers instanceof Headers) {\n\t\t\t\t// Use the native forEach method for Headers\n\t\t\t\theaders.forEach((value, name) => target.set(name, value));\n\t\t\t} else if (Array.isArray(headers)) {\n\t\t\t\t// Handle array of tuples format\n\t\t\t\tfor (const [ name, value ] of headers) { target.set(name, value) }\n\t\t\t} else if (isObject<Record<string, string | undefined>>(headers)) {\n\t\t\t\t// Handle Record<string, string> format - use Object.entries() for better performance\n\t\t\t\tfor (const [name, value] of Object.entries(headers)) {\n\t\t\t\t\tif (value !== undefined) { target.set(name, value) }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn target;\n\t}\n\n\t/**\n\t * Merges user and request search parameters into the target URLSearchParams object.\n\t * @param target The target URLSearchParams object.\n\t * @param sources The search parameters to merge.\n\t * @returns The merged URLSearchParams object.\n\t */\n\tprivate static mergeSearchParams(target: URLSearchParams, ...sources: (SearchParameters | undefined)[]): URLSearchParams {\n\t\tfor (const searchParams of sources) {\n\t\t\tif (searchParams === undefined) { continue }\n\n\t\t\t// Handle different input types\n\t\t\tif (searchParams instanceof URLSearchParams) {\n\t\t\t\t// Use the native forEach method for URLSearchParams\n\t\t\t\tsearchParams.forEach((value, name) => target.set(name, value));\n\t\t\t} else if (isString(searchParams) || Array.isArray(searchParams)) {\n\t\t\t\tfor (const [name, value] of new URLSearchParams(searchParams)) { target.set(name, value) }\n\t\t\t} else {\n\t\t\t\t// Handle Record<string, string> format - use Object.keys() for better performance\n\t\t\t\tconst keys = Object.keys(searchParams);\n\t\t\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\t\t\tconst name = keys[i]!;\n\t\t\t\t\tconst value = searchParams[name];\n\t\t\t\t\tif (value !== undefined) { target.set(name, String(value)) }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn target;\n\t}\n\n\t/**\n\t * Processes request options by merging user, instance, and method-specific options.\n\t * This method optimizes performance by using cached instance options and performing\n\t * shallow merges where possible instead of deep object cloning.\n\t * @param userOptions The user-provided options for the request.\n\t * @param options Additional method-specific options.\n\t * @returns Processed request options with signal controller and global flag.\n\t */\n\tprivate processRequestOptions({ body: userBody, headers: userHeaders, searchParams: userSearchParams, ...userOptions }: RequestOptions, { headers, searchParams, ...options }: RequestOptions): RequestConfiguration {\n\t\t// Optimize: Use shallow merge for non-nested properties instead of deep objectMerge\n\t\t// The instance _options are already merged with defaults in the constructor\n\t\tconst requestOptions = {\n\t\t\t// Spread instance options (already merged with defaults)\n\t\t\t...this._options,\n\t\t\t// Spread user options (shallow merge, sufficient for flat properties)\n\t\t\t...userOptions,\n\t\t\t// Spread method-specific options (e.g., method: 'POST')\n\t\t\t...options,\n\t\t\t// Deep merge required for headers and searchParams\n\t\t\theaders: Transportr.mergeHeaders(new Headers(), this._options.headers, userHeaders, headers),\n\t\t\tsearchParams: Transportr.mergeSearchParams(new URLSearchParams(), this._options.searchParams, userSearchParams, searchParams)\n\t\t};\n\n\t\tif (isRequestBodyMethod(requestOptions.method)) {\n\t\t\tif (isRawBody(userBody)) {\n\t\t\t\t// Raw BodyInit \u2014 send as-is, delete Content-Type so the runtime sets it automatically\n\t\t\t\tObject.assign(requestOptions, { body: userBody });\n\t\t\t\trequestOptions.headers.delete('content-type');\n\t\t\t} else {\n\t\t\t\tconst instanceBody = this._options.body;\n\t\t\t\tconst body = isObject<Record<string, unknown>>(instanceBody) && isObject<Record<string, unknown>>(userBody)\n\t\t\t\t\t? objectMerge(instanceBody, userBody)\n\t\t\t\t\t: (userBody !== undefined ? userBody : instanceBody);\n\t\t\t\tconst isJson = requestOptions.headers.get('content-type')?.includes('json') ?? false;\n\t\t\t\tObject.assign(requestOptions, { body: isJson && isObject(body) ? serialize(body) : body });\n\t\t\t}\n\t\t} else {\n\t\t\trequestOptions.headers.delete('content-type');\n\t\t\tif (requestOptions.body instanceof URLSearchParams) {\n\t\t\t\tTransportr.mergeSearchParams(requestOptions.searchParams, requestOptions.body);\n\t\t\t}\n\t\t\trequestOptions.body = undefined;\n\t\t}\n\n\t\tconst { signal, timeout, global = false, xsrf } = requestOptions;\n\n\t\t// XSRF/CSRF protection: read token from cookie and set as request header\n\t\tif (xsrf) {\n\t\t\tconst { cookieName, headerName }: XsrfOptions = typeof xsrf === 'object' ? xsrf : {};\n\t\t\tconst token = getCookieValue(cookieName ?? XSRF_COOKIE_NAME);\n\t\t\tif (token) { requestOptions.headers.set(headerName ?? XSRF_HEADER_NAME, token) }\n\t\t}\n\n\t\tconst signalController = new SignalController({ signal, timeout })\n\t\t\t.onAbort((event) => this.publish({ name: RequestEvent.ABORTED, event, global }))\n\t\t\t.onTimeout((event) => this.publish({ name: RequestEvent.TIMEOUT, event, global }));\n\n\t\trequestOptions.signal = signalController.signal;\n\t\tthis.publish({ name: RequestEvent.CONFIGURED, data: requestOptions, global });\n\n\t\treturn { signalController, requestOptions, global } as RequestConfiguration;\n\t}\n\n\t/**\n\t * Gets the base URL from a URL or string.\n\t * @param url The URL or string to parse.\n\t * @returns The base URL.\n\t */\n\tprivate static getBaseUrl(url: URL | string): URL {\n\t\tif (url instanceof URL) { return url }\n\n\t\tif (!isString(url)) { throw new TypeError('Invalid URL') }\n\n\t\treturn new URL(url, url.startsWith('/') ? globalThis.location.origin : undefined);\n\t}\n\n\t/**\n\t * Parses a content-type string into a MediaType instance with caching.\n\t * This method caches parsed MediaType instances to avoid re-parsing the same content-type strings,\n\t * which significantly improves performance for repeated requests with the same content types.\n\t * @param contentType The content-type string to parse.\n\t * @returns The parsed MediaType instance, or undefined if parsing fails.\n\t */\n\tprivate static getOrParseMediaType(contentType: string | null): MediaType | undefined {\n\t\tif (contentType === null) { return }\n\n\t\t// Check the predefined mediaTypes map first (fastest lookup) or the cache\n\t\tlet mediaType = Transportr.mediaTypeCache.get(contentType);\n\n\t\tif (mediaType !== undefined) { return mediaType }\n\n\t\t// Parse and cache the new MediaType\n\t\tmediaType = MediaType.parse(contentType) ?? undefined;\n\n\t\tif (mediaType !== undefined) {\n\t\t\t// Evict oldest entries when cache exceeds limit to prevent unbounded growth\n\t\t\tif (Transportr.mediaTypeCache.size >= 100) {\n\t\t\t\tconst oldestEntry = Transportr.mediaTypeCache.keys().next();\n\n\t\t\t\tif (!oldestEntry.done) {\n\t\t\t\t\tTransportr.mediaTypeCache.delete(oldestEntry.value);\n\t\t\t\t}\n\t\t\t}\n\t\t\tTransportr.mediaTypeCache.set(contentType, mediaType);\n\t\t}\n\n\t\treturn mediaType;\n\t}\n\n\t/**\n\t * Creates a new URL with the given path and search parameters.\n\t * @param url The base URL.\n\t * @param path The path to append to the base URL.\n\t * @param searchParams The search parameters to append to the URL.\n\t * @returns A new URL with the given path and search parameters.\n\t */\n\tprivate static createUrl(url: URL, path?: string, searchParams?: SearchParameters): URL {\n\t\tconst requestUrl = path ? new URL(`${url.pathname.replace(endsWithSlashRegEx, '')}${path}`, url.origin) : new URL(url);\n\n\t\tif (searchParams) {\n\t\t\tTransportr.mergeSearchParams(requestUrl.searchParams, searchParams);\n\t\t}\n\n\t\treturn requestUrl;\n\t}\n\n\t/**\n\t * It generates a ResponseStatus object from an error name and a Response object.\n\t * @param errorName The name of the error.\n\t * @param response The Response object.\n\t * @returns A ResponseStatus object.\n\t */\n\tprivate static generateResponseStatusFromError(errorName?: string, { status, statusText }: Response = new Response()): ResponseStatus {\n\t\tswitch (errorName) {\n\t\t\tcase SignalErrors.ABORT: return aborted;\n\t\t\tcase SignalErrors.TIMEOUT: return timedOut;\n\t\t\tdefault: return status >= 400 ? new ResponseStatus(status, statusText) : internalServerError;\n\t\t}\n\t}\n\n\t/**\n\t * Handles an error that occurs during a request.\n\t * @param path The path of the request.\n\t * @param response The Response object.\n\t * @param options Additional error context including cause, entity, url, method, and timing.\n\t * @param requestOptions The original request options that led to the error, used for hooks context.\n\t * @returns An HttpError object.\n\t */\n\tprivate async handleError(path?: string, response?: Response, { cause, entity, url, method, timing }: Omit<HttpErrorOptions, 'message'> = {}, requestOptions?: RequestOptions): Promise<HttpError> {\n\t\tconst message = method && url\t? `${method} ${url.href} failed${response ? ` with status ${response.status}` : ''}` : `An error has occurred with your request to: '${path}'`;\n\t\tlet error = new HttpError(Transportr.generateResponseStatusFromError(cause?.name, response), { message, cause, entity, url, method, timing });\n\n\t\t// Run beforeError hooks: global \u2192 instance \u2192 per-request\n\t\tconst beforeErrorHookSets = [ Transportr.globalHooks.beforeError, this.hooks.beforeError, requestOptions?.hooks?.beforeError ];\n\t\tfor (const hooks of beforeErrorHookSets) {\n\t\t\tif (!hooks) { continue }\n\t\t\tfor (const hook of hooks) {\n\t\t\t\tconst result = await hook(error);\n\t\t\t\tif (result instanceof HttpError) { error = result }\n\t\t\t}\n\t\t}\n\n\t\tthis.publish({ name: RequestEvent.ERROR, data: error });\n\n\t\treturn error;\n\t}\n\n\t/**\n\t * Publishes an event to the global and instance event handlers.\n\t * @param eventObject The event object to publish.\n\t */\n\tprivate publish({ name, event = new CustomEvent(name), data, global = true }: PublishOptions): void {\n\t\tif (global) { Transportr.globalSubscribr.publish(name, event, data) }\n\t\tthis.subscribr.publish(name, event, data);\n\t}\n\n\t/**\n\t * It returns a response handler based on the content type of the response.\n\t * @param contentType The content type of the response.\n\t * @returns A response handler function.\n\t */\n\tprivate getResponseHandler<T extends ResponseBody>(contentType?: string | null): ResponseHandler<T> | undefined {\n\t\tif (!contentType) { return }\n\n\t\tconst mediaType = Transportr.getOrParseMediaType(contentType);\n\n\t\tif (!mediaType) { return }\n\n\t\tfor (const [ contentType, responseHandler ] of Transportr.contentTypeHandlers) {\n\t\t\tif (mediaType.matches(contentType)) { return responseHandler as ResponseHandler<T> }\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * A string representation of the Transportr instance.\n\t * @returns The string 'Transportr'.\n\t */\n\tget [Symbol.toStringTag](): string {\n\t\treturn 'Transportr';\n\t}\n}\n"],
5
+ "mappings": "AAAO,IAAMA,EAA8B,iCCErCC,GAAkB,YAClBC,GAA0C,qCAanCC,GAAN,MAAMC,WAA4B,GAAoB,CAM5D,YAAYC,EAAsC,CAAC,EAAG,CACrD,MAAMA,CAAO,CACd,CASA,OAAO,QAAQC,EAAcC,EAAwB,CACpD,OAAOP,EAAoB,KAAKM,CAAI,GAAKJ,GAAgC,KAAKK,CAAK,CACpF,CAQS,IAAID,EAAkC,CAC9C,OAAO,MAAM,IAAIA,EAAK,YAAY,CAAC,CACpC,CAQS,IAAIA,EAAuB,CACnC,OAAO,MAAM,IAAIA,EAAK,YAAY,CAAC,CACpC,CAUS,IAAIA,EAAcC,EAAqB,CAC/C,GAAI,CAACH,GAAoB,QAAQE,EAAMC,CAAK,EAC3C,MAAM,IAAI,MAAM,4CAA4CD,CAAI,IAAIC,CAAK,EAAE,EAG5E,OAAA,MAAM,IAAID,EAAK,YAAY,EAAGC,CAAK,EAE5B,IACR,CAQS,OAAOD,EAAuB,CACtC,OAAO,MAAM,OAAOA,EAAK,YAAY,CAAC,CACvC,CAOS,UAAmB,CAC3B,OAAO,MAAM,KAAK,IAAI,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M,GAAGqC,CAAM,IAAIrC,EAAI,IAAI,UAAUkC,EAAW,gBAAgBA,EAAS,MAAM,GAAK,EAAE,GAAK,gDAAgDT,CAAI,IACrKa,EAAQ,IAAIoC,EAAUtF,EAAW,gCAAgCqF,GAAO,KAAMvC,CAAQ,EAAG,CAAE,QAAAgG,EAAS,MAAAzD,EAAO,OAAAD,EAAQ,IAAAxE,EAAK,OAAAqC,EAAQ,OAAA0C,CAAO,CAAC,EAGtIoD,EAAsB,CAAE/I,EAAW,YAAY,YAAa,KAAK,MAAM,YAAawC,GAAgB,OAAO,WAAY,EAC7H,QAAWN,KAAS6G,EACnB,GAAK7G,EACL,QAAWU,KAAQV,EAAO,CACzB,IAAMW,EAAS,MAAMD,EAAKM,CAAK,EAC3BL,aAAkByC,IAAapC,EAAQL,EAC5C,CAGD,YAAK,QAAQ,CAAE,KAAM7B,EAAa,MAAO,KAAMkC,CAAM,CAAC,EAE/CA,CACR,CAMQ,QAAQ,CAAE,KAAA6D,EAAM,MAAA5F,EAAQ,IAAI,YAAY4F,CAAI,EAAG,KAAAP,EAAM,OAAAzC,EAAS,EAAK,EAAyB,CAC/FA,GAAU/D,EAAW,gBAAgB,QAAQ+G,EAAM5F,EAAOqF,CAAI,EAClE,KAAK,UAAU,QAAQO,EAAM5F,EAAOqF,CAAI,CACzC,CAOQ,mBAA2CzE,EAA6D,CAC/G,GAAI,CAACA,EAAe,OAEpB,IAAM5B,EAAYH,EAAW,oBAAoB+B,CAAW,EAE5D,GAAK5B,GAEL,OAAW,CAAE4B,EAAa+B,CAAgB,IAAK9D,EAAW,oBACzD,GAAIG,EAAU,QAAQ4B,CAAW,EAAK,OAAO+B,EAI/C,CAMA,IAAK,OAAO,WAAW,GAAY,CAClC,MAAO,YACR,CACD",
6
+ "names": ["httpTokenCodePoints", "matcher", "httpQuotedStringTokenCodePoints", "MediaTypeParameters", "_MediaTypeParameters", "entries", "name", "value", "whitespaceChars", "trailingWhitespace", "leadingAndTrailingWhitespace", "MediaTypeParser", "_MediaTypeParser", "input", "position", "type", "typeEnd", "subtype", "subtypeEnd", "parameters", "pos", "stopChars", "lowerCase", "trim", "result", "length", "char", "component", "MediaType", "_MediaType", "mediaType", "SetMultiMap", "key", "value", "defaultValue", "compute", "iterator", "values", "deleted", "ContextEventHandler", "context", "eventHandler", "event", "data", "Subscription", "eventName", "contextEventHandler", "Subscribr", "u", "errorHandler", "options", "originalHandler", "subscription", "contextEventHandlers", "removed", "error", "HttpError", "status", "message", "cause", "entity", "url", "method", "timing", "ResponseStatus", "code", "text", "charset", "endsWithSlashRegEx", "XSRF_COOKIE_NAME", "XSRF_HEADER_NAME", "mediaTypes", "h", "defaultMediaType", "defaultOrigin", "RequestCachingPolicy", "RequestEvent", "SignalEvents", "SignalErrors", "eventListenerOptions", "abortEvent", "timeoutEvent", "requestBodyMethods", "internalServerError", "ResponseStatus", "aborted", "timedOut", "retryStatusCodes", "retryMethods", "retryDelay", "retryBackoffFactor", "SignalController", "signal", "timeout", "signals", "SignalEvents", "eventListenerOptions", "reason", "SignalErrors", "timeoutEvent", "eventListener", "event", "abortEvent", "type", "domReady", "purifyReady", "getSanitize", "p", "dirty", "ensureDom", "JSDOM", "window", "handleText", "response", "handleScript", "objectURL", "resolve", "reject", "script", "handleCss", "link", "handleJson", "handleBlob", "handleImage", "img", "handleBuffer", "handleReadableStream", "handleXml", "sanitize", "handleHtml", "handleHtmlFragment", "handleEventStream", "reader", "decoder", "buffer", "done", "eventEnd", "rawEvent", "sse", "dataLines", "lines", "i", "line", "colonIndex", "field", "value", "n", "result", "handleNdjsonStream", "lineEnd", "remaining", "isRequestBodyMethod", "method", "requestBodyMethods", "isRawBody", "body", "getCookieValue", "name", "prefix", "cookies", "i", "length", "cookie", "serialize", "data", "isString", "value", "isArrayBuffer", "isObject", "objectMerge", "objects", "obj", "deepClone", "target", "source", "property", "sourceValue", "targetValue", "item", "object", "cloned", "keys", "key", "Transportr", "_Transportr", "d", "mediaTypes", "mediaType", "handleText", "handleJson", "handleReadableStream", "handleHtml", "handleXml", "handleImage", "handleScript", "handleCss", "url", "defaultOrigin", "options", "isObject", "RequestEvent", "RequestCachingPolicy", "defaultMediaType", "event", "handler", "context", "eventRegistration", "signalController", "abortEvent", "requests", "controllers", "promises", "i", "controller", "controller_1", "contentType", "index", "type", "hooks", "headers", "searchParams", "path", "body", "requestConfig", "requestOptions", "unwrap", "requestHooks", "beforeRequestHookSets", "hook", "result", "response", "afterResponseHookSets", "allowedMethods", "method", "error", "selector", "doc", "fragment", "handleHtmlFragment", "handleBlob", "handleBuffer", "afterResponse", "stream", "handleEventStream", "handleNdjsonStream", "userOptions", "responseHandler", "global", "retryConfig", "canRetry", "canDedupe", "attempt", "startTime", "getTiming", "end", "dedupeKey", "inflight", "originalBody", "onUploadProgress", "wrapUploadBody", "bytes", "isArrayBuffer", "total", "readable", "loaded", "transform", "chunk", "doFetch", "entity", "cause", "HttpError", "wrapProgress", "onDownloadProgress", "contentLength", "promise", "timing", "retry", "retryDelay", "retryBackoffFactor", "retryStatusCodes", "retryMethods", "config", "ms", "resolve", "resolvedPath", "resolvedBody", "resolvedOptions", "isString", "data", "userHeaders", "userSearchParams", "objectMerge", "target", "headerSources", "value", "name", "sources", "keys", "userBody", "isRequestBodyMethod", "isRawBody", "instanceBody", "isJson", "serialize", "signal", "timeout", "xsrf", "cookieName", "headerName", "token", "getCookieValue", "XSRF_COOKIE_NAME", "XSRF_HEADER_NAME", "SignalController", "h", "oldestEntry", "requestUrl", "endsWithSlashRegEx", "errorName", "status", "statusText", "SignalErrors", "aborted", "timedOut", "ResponseStatus", "internalServerError", "message", "beforeErrorHookSets"]
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d1g1tal/transportr",
3
3
  "author": "D1g1talEntr0py",
4
- "version": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "license": "MIT",
6
6
  "description": "JavaScript wrapper for the Fetch API and more...",
7
7
  "homepage": "https://github.com/D1g1talEntr0py/transportr#readme",