@d1g1tal/transportr
Version:
JavaScript wrapper for the Fetch API
4 lines (3 loc) • 18.4 kB
JavaScript
var X=class extends Map{set(a,e){return super.set(a,(super.get(a)??new Set).add(e)),this}hasValue(a,e){let t=super.get(a);return!!t&&t.has(e)}deleteValue(a,e){let t=super.get(a);return!!t&&t.delete(e)}get[Symbol.toStringTag](){return"SetMultiMap"}},$=class{#e;#t;constructor(a,e){this.#e=a,this.#t=e}handle(a,e){this.#t.call(this.#e,a,e)}get[Symbol.toStringTag](){return"ContextEventHandler"}},W=class{#e;#t;constructor(a,e){this.#e=a,this.#t=e}get eventName(){return this.#e}get contextEventHandler(){return this.#t}get[Symbol.toStringTag](){return"Subscription"}},y=class{#e;constructor(){this.#e=new X}subscribe(a,e,t=e){let r=new $(t,e);return this.#e.set(a,r),new W(a,r)}unsubscribe({eventName:a,contextEventHandler:e}){let t=this.#e.get(a),r=t?.delete(e);return r&&t.size==0&&this.#e.delete(a),r}publish(a,e=new CustomEvent(a),t){t!=null||e instanceof Event||([t,e]=[e,new CustomEvent(a)]),this.#e.get(a)?.forEach(r=>r.handle(e,t))}isSubscribed({eventName:a,contextEventHandler:e}){return this.#e.get(a)?.has(e)}get[Symbol.toStringTag](){return"Subscribr"}},h={OPTIONS:"OPTIONS",GET:"GET",HEAD:"HEAD",POST:"POST",PUT:"PUT",DELETE:"DELETE",TRACE:"TRACE",CONNECT:"CONNECT",PATCH:"PATCH"},b=class{#e;#t;constructor(a,e){this.#e=a,this.#t=e}get code(){return this.#e}get text(){return this.#t}get[Symbol.toStringTag](){return"ResponseStatus"}toString(){return`${this.#e} ${this.#t}`}},E=a=>a?.constructor??a?.prototype?.constructor??globalThis[Object.prototype.toString.call(a).slice(8,-1)]??a,P=(...a)=>{let e={};for(let t of a){let r,i;if(E(t)!=Object)return;for(let n of Object.getOwnPropertyNames(t))(r=Object.getOwnPropertyDescriptor(t,n)).enumerable&&((i=E(t[n]))==Object?r.value=E(e[n])==Object?P(e[n],t[n]):{...t[n]}:i==Array&&(r.value=Array.isArray(e[n])?[...new Set([...t[n],...e[n]])]:[...t[n]]),e[n]=r.value)}return e},A=/^[-!#$%&'*+.^_`|~A-Za-z0-9]*$/u,B=/(["\\])/ug,z=/^[\t\u0020-\u007E\u0080-\u00FF]*$/u,I=class F extends Map{constructor(e=[]){super(e)}static isValid(e,t){return A.test(e)&&z.test(t)}get(e){return super.get(e.toLowerCase())}has(e){return super.has(e.toLowerCase())}set(e,t){if(!F.isValid(e,t))throw 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&&A.test(t)?t:`"${t.replace(B,"\\$1")}"`}`).join("")}[Symbol.toStringTag](){return"MediaTypeParameters"}},V=[" "," ",`
`,"\r"],J=/[ \t\n\r]+$/u,Y=/^[ \t\n\r]+|[ \t\n\r]+$/ug,k=class O{static parse(e){let t=(e=e.replace(Y,"")).length,{position:r,result:i,subtype:n=""}=O.#e({input:e},"/");if(!i.length||r>=t||!A.test(i))throw TypeError(O.#r("type",i));if({position:r,result:n}=O.#e({position:++r,input:e,trim:!0},";"),!n.length||!A.test(n))throw TypeError(O.#r("subtype",n));let l="",u=null,c=new I;for(;r++<t;){for(;V.includes(e[r]);)++r;if({position:r,result:l}=O.#e({position:r,input:e,lowerCase:!1},";","="),r<t){if(e[r]==";")continue;++r}if(e[r]=='"')for([u,r]=O.#t(e,r);r<t&&e[r]!=";";)++r;else if({position:r,result:u}=O.#e({position:r,input:e,lowerCase:!1,trim:!0},";"),!u)continue;l&&I.isValid(l,u)&&!c.has(l)&&c.set(l,u)}return{type:i,subtype:n,parameters:c}}static#e({position:e=0,input:t,lowerCase:r=!0,trim:i=!1},...n){let l="";for(let u=t.length;e<u&&!n.includes(t[e]);e++)l+=t[e];return r&&(l=l.toLowerCase()),i&&(l=l.replace(J,"")),{position:e,result:l}}static#t(e,t){let r="";for(let i=e.length,n;++t<i&&(n=e[t])!='"';)r+=n=="\\"&&++t<i?e[t]:n;return[r,t]}static#r(e,t){return`Invalid ${e} "${t}": only HTTP token code points are valid.`}},g=class j{#e;#t;#r;constructor(e,t={}){if(E(t)!=Object)throw TypeError("The parameters argument must be an object");for(let[r,i]of({type:this.#e,subtype:this.#t,parameters:this.#r}=k.parse(e),Object.entries(t)))this.#r.set(r,i)}static parse(e){try{return new j(e)}catch{}return null}get type(){return this.#e}get subtype(){return this.#t}get essence(){return`${this.#e}/${this.#t}`}get parameters(){return this.#r}matches(e){return this.#e==e?.type&&this.#t==e?.subtype||this.essence.includes(e)}toString(){return`${this.essence}${this.#r.toString()}`}get[Symbol.toStringTag](){return"MediaType"}},s={AAC:"audio/aac",ABW:"application/x-abiword",ARC:"application/x-freearc",AVIF:"image/avif",AVI:"video/x-msvideo",AZW:"application/vnd.amazon.ebook",BIN:"application/octet-stream",BMP:"image/bmp",BZIP:"application/x-bzip",BZIP2:"application/x-bzip2",CDA:"application/x-cdf",CSH:"application/x-csh",CSS:"text/css",CSV:"text/csv",DOC:"application/msword",DOCX:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",EOT:"application/vnd.ms-fontobject",EPUB:"application/epub+zip",GZIP:"application/gzip",GIF:"image/gif",HTML:"text/html",ICO:"image/vnd.microsoft.icon",ICS:"text/calendar",JAR:"application/java-archive",JPEG:"image/jpeg",JAVA_SCRIPT:"text/javascript",JSON:"application/json",JSON_LD:"application/ld+json",JSON_MERGE_PATCH:"application/merge-patch+json",MID:"audio/midi",X_MID:"audio/x-midi",MP3:"audio/mpeg",MP4A:"audio/mp4",MP4:"video/mp4",MPEG:"video/mpeg",MPKG:"application/vnd.apple.installer+xml",ODP:"application/vnd.oasis.opendocument.presentation",ODS:"application/vnd.oasis.opendocument.spreadsheet",ODT:"application/vnd.oasis.opendocument.text",OGA:"audio/ogg",OGV:"video/ogg",OGX:"application/ogg",OPUS:"audio/opus",OTF:"font/otf",PNG:"image/png",PDF:"application/pdf",PHP:"application/x-httpd-php",PPT:"application/vnd.ms-powerpoint",PPTX:"application/vnd.openxmlformats-officedocument.presentationml.presentation",RAR:"application/vnd.rar",RTF:"application/rtf",SH:"application/x-sh",SVG:"image/svg+xml",TAR:"application/x-tar",TIFF:"image/tiff",TRANSPORT_STREAM:"video/mp2t",TTF:"font/ttf",TEXT:"text/plain",VSD:"application/vnd.visio",WAV:"audio/wav",WEBA:"audio/webm",WEBM:"video/webm",WEBP:"image/webp",WOFF:"font/woff",WOFF2:"font/woff2",FORM:"application/x-www-form-urlencoded",MULTIPART_FORM_DATA:"multipart/form-data",XHTML:"application/xhtml+xml",XLS:"application/vnd.ms-excel",XLSX:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",XML:"application/xml",XUL:"application/vnd.mozilla.xul+xml",ZIP:"application/zip","3GP":"video/3gpp","3G2":"video/3gpp2","7Z":"application/x-7z-compressed"},C="utf-8",q=/\/$/,p=new Map([[s.PNG,new g(s.PNG)],[s.TEXT,new g(s.TEXT,{defaultCharset:C})],[s.JSON,new g(s.JSON,{defaultCharset:C})],[s.HTML,new g(s.HTML,{defaultCharset:C})],[s.JAVA_SCRIPT,new g(s.JAVA_SCRIPT,{defaultCharset:C})],[s.CSS,new g(s.CSS,{defaultCharset:C})],[s.XML,new g(s.XML,{defaultCharset:C})],[s.BIN,new g(s.BIN)]]),T=Object.freeze({CONFIGURED:"configured",SUCCESS:"success",ERROR:"error",ABORTED:"aborted",TIMEOUT:"timeout",COMPLETE:"complete",ALL_COMPLETE:"all-complete"}),R=Object.freeze({ABORT:"abort",TIMEOUT:"timeout"}),w=new CustomEvent(R.ABORT,{detail:{cause:new DOMException("The request was aborted","AbortError")}}),Z=[h.POST,h.PUT,h.PATCH],K=new b(500,"Internal Server Error"),L=Object.freeze({[T.ABORTED]:new b(499,"Aborted"),[T.TIMEOUT]:new b(504,"Request Timeout")}),Q={get:(a,e)=>e=="signal"?a.signal.timeout(a.timeout):Reflect.get(a,e)},ee=class{#e;#t;constructor(a){this.#e=new AbortController,a?.addEventListener(R.ABORT,e=>this.#r(e))}get aborted(){return this.#e.signal.aborted}get reason(){return this.#e.signal.reason}timeout(a){if(a<0)throw RangeError("The timeout cannot be negative");return a!=1/0&&(this.#t??=setTimeout(()=>this.#r(new CustomEvent(R.TIMEOUT,{detail:{timeout:a,cause:new DOMException(`The request timed-out after ${a/1e3} seconds`,"TimeoutError")}}),!0),a)),this.#e.signal}clearTimeout(){clearTimeout(this.#t)}onAbort(a){return this.#e.signal.addEventListener(R.ABORT,a),this}onTimeout(a){return this.#e.signal.addEventListener(R.TIMEOUT,a),this}abort(a){this.#r(a)}#r(a=w,e=!1){clearTimeout(this.#t),this.#e.abort(a.detail?.cause),e&&this.#e.signal.dispatchEvent(a)}},te=class extends Error{#e;#t;constructor(a,{cause:e,status:t,entity:r}){super(a,{cause:e}),this.#e=r,this.#t=t}get entity(){return this.#e}get statusCode(){return this.#t?.code}get statusText(){return this.#t?.text}get name(){return"HttpError"}get[Symbol.toStringTag](){return"HttpError"}},d={ACCEPT:"accept",ACCEPT_CHARSET:"accept-charset",ACCEPT_ENCODING:"accept-encoding",ACCEPT_LANGUAGE:"accept-language",AUTHORIZATION:"authorization",CACHE_CONTROL:"cache-control",CONNECTION:"connection",COOKIE:"cookie",CONTENT_LENGTH:"content-length",CONTENT_MD5:"content-md5",CONTENT_TYPE:"content-type",DATE:"date",EXPECT:"expect",FROM:"from",HOST:"host",IF_MATCH:"if-match",IF_MODIFIED_SINCE:"if-modified-since",IF_NONE_MATCH:"if-none-match",IF_RANGE:"if-range",IF_UNMODIFIED_SINCE:"if-unmodified-since",MAX_FORWARDS:"max-forwards",ORIGIN:"origin",PRAGMA:"pragma",PROXY_AUTHORIZATION:"proxy-authorization",RANGE:"range",REFERER:"referer",TE:"te",USER_AGENT:"user-agent",UPGRADE:"upgrade",VIA:"via",WARNING:"warning",X_REQUESTED_WITH:"x-requested-with",DNT:"dnt",X_FORWARDED_FOR:"x-forwarded-for",X_FORWARDED_HOST:"x-forwarded-host",X_FORWARDED_PROTO:"x-forwarded-proto",FRONT_END_HTTPS:"front-end-https",X_HTTP_METHOD_OVERRIDE:"x-http-method-override",X_ATT_DEVICE_ID:"x-att-deviceid",X_WAP_PROFILE:"x-wap-profile"},v={PROXY_CONNECTION:"proxy-connection",X_UIDH:"x-uidh",X_CSRF_TOKEN:"x-csrf-token",ACCESS_CONTROL_ALLOW_ORIGIN:"access-control-allow-origin",ACCEPT_PATCH:"accept-patch",ACCEPT_RANGES:"accept-ranges",AGE:"age",ALLOW:"allow",CACHE_CONTROL:"cache-control",CONNECTION:"connection",CONTENT_DISPOSITION:"content-disposition",CONTENT_ENCODING:"content-encoding",CONTENT_LANGUAGE:"content-language",CONTENT_LENGTH:"content-length",CONTENT_LOCATION:"content-location",CONTENT_RANGE:"content-range",CONTENT_TYPE:"content-type",DATE:"date",ETAG:"etag",EXPIRES:"expires",LAST_MODIFIED:"last-modified",LINK:"link",LOCATION:"location",P3P:"p3p",PRAGMA:"pragma",PROXY_AUTHENTICATION:"proxy-authenticate",PUBLIC_KEY_PINS:"public-key-pins",RETRY_AFTER:"retry-after",SERVER:"server",SET_COOKIE:"set-cookie",STATUS:"status",STRICT_TRANSPORT_SECURITY:"strict-transport-security",TRAILER:"trailer",TRANSFER_ENCODING:"transfer-encoding",UPGRADE:"upgrade",VARY:"vary",VIA:"via",WARNING:"warning",WWW_AUTHENTICATE:"www-authenticate",X_XSS_PROTECTION:"x-xss-protection",CONTENT_SECURITY_POLICY:"content-security-policy",X_CONTENT_TYPE_OPTIONS:"x-content-type-options",X_POWERED_BY:"x-powered-by"},f=class N extends Map{constructor(e={}){for(let[t,r]of(super(),N.#e(e)))this.append(t,r)}set(e,t){let r=super.get(e);return r?.length>0?(r.length=0,r[0]=t):super.set(e,[t]),this}setAll(e){for(let[t,r]of N.#e(e))this.set(t,r);return this}get(e){return super.get(e)?.[0]}getAll(e){return super.get(e)}append(e,t){let r=super.get(e);return r?.length>0?r.push(t):super.set(e,[t]),this}appendAll(e){for(let[t,r]of N.#e(e))this.append(t,r);return this}hasValue(e){for(let t of super.values())if(t.includes(e))return!0;return!1}deleteValue(e){for(let t of this.values())if(t.includes(e))return t.splice(t.indexOf(e),1).length>0;return!1}isEmpty(){return this.size===0}toJSON(){let e=Object.create(null);for(let[t,r]of super.entries())e[t]=r.length===1?r[0]:r;return e}*entries(){for(let[e,t]of super.entries())for(let r of t)yield[e,r]}*[Symbol.iterator](){yield*this.entries()}static#e(e){return e[Symbol.iterator]?e:Object.entries(e)}get[Symbol.toStringTag](){return"ParameterMap"}},re=async a=>await a.text(),_=async a=>{let e=URL.createObjectURL(await a.blob());return document.head.removeChild(document.head.appendChild(Object.assign(document.createElement("script"),{src:e,type:s.JAVA_SCRIPT,async:!0}))),URL.revokeObjectURL(e),Promise.resolve()},M=async a=>{let e=URL.createObjectURL(await a.blob());return document.head.appendChild(Object.assign(document.createElement("link"),{href:e,type:s.CSS,rel:"stylesheet"})),URL.revokeObjectURL(e),Promise.resolve()},x=async a=>await a.json(),ae=async a=>await a.blob(),D=async a=>URL.createObjectURL(await a.blob()),se=async a=>await a.arrayBuffer(),U=async a=>a.body,G=async a=>new DOMParser().parseFromString(await a.text(),s.XML),H=async a=>new DOMParser().parseFromString(await a.text(),s.HTML),ne=async a=>document.createRange().createContextualFragment(await a.text()),ie=class o{#e;#t;#r;static#c=new y;static#o=new Set;static#p=new Map([[D,p.get(s.PNG).type],[re,p.get(s.TEXT).type],[x,p.get(s.JSON).subtype],[H,p.get(s.HTML).subtype],[_,p.get(s.JAVA_SCRIPT).subtype],[M,p.get(s.CSS).subtype],[G,p.get(s.XML).subtype],[U,p.get(s.BIN).subtype]]);constructor(e=globalThis.location.origin,t={}){E(e)==Object&&([e,t]=[globalThis.location.origin,e]),this.#e=o.#E(e),this.#t=o.#h(t,o.#d),this.#r=new y}static Method=Object.freeze(h);static MediaType=Object.freeze(s);static RequestHeader=Object.freeze(d);static ResponseHeader=Object.freeze(v);static CachingPolicy=Object.freeze({DEFAULT:"default",FORCE_CACHE:"force-cache",NO_CACHE:"no-cache",NO_STORE:"no-store",ONLY_IF_CACHED:"only-if-cached",RELOAD:"reload"});static CredentialsPolicy=Object.freeze({INCLUDE:"include",OMIT:"omit",SAME_ORIGIN:"same-origin"});static RequestMode=Object.freeze({CORS:"cors",NAVIGATE:"navigate",NO_CORS:"no-cors",SAME_ORIGIN:"same-origin"});static RedirectPolicy=Object.freeze({ERROR:"error",FOLLOW:"follow",MANUAL:"manual"});static ReferrerPolicy=Object.freeze({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 Events=T;static#d=Object.freeze({body:null,cache:o.CachingPolicy.NO_STORE,credentials:o.CredentialsPolicy.SAME_ORIGIN,headers:{[d.CONTENT_TYPE]:`${p.get(s.JSON)}`,[d.ACCEPT]:`${p.get(s.JSON)}`},searchParams:{},integrity:void 0,keepalive:void 0,method:h.GET,mode:o.RequestMode.CORS,redirect:o.RedirectPolicy.FOLLOW,referrer:"about:client",referrerPolicy:o.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN,signal:void 0,timeout:3e4,global:!0,window:null});static register(e,t,r){return o.#c.subscribe(e,t,r)}static unregister(e){return o.#c.unsubscribe(e)}static abortAll(){for(let e of this.#o)e.abort(w);this.#o.clear()}get baseUrl(){return this.#e}register(e,t,r){return this.#r.subscribe(e,t,r)}unregister(e){this.#r.unsubscribe(e)}async get(e,t){return this.#a(e,t)}async post(e,t={},r={}){return E(e)!=String&&([e,t,r]=[void 0,e,t]),this.#n(e,Object.assign(r,{body:t}),{method:h.POST})}async put(e,t){return this.#n(e,t,{method:h.PUT})}async patch(e,t){return this.#n(e,t,{method:h.PATCH})}async delete(e,t){return this.#n(e,t,{method:h.DELETE})}async head(e,t){return this.#n(e,t,{method:h.HEAD})}async options(e,t){return(await this.#n(e,t,{method:h.OPTIONS})).headers.get("allow").split(",").map(r=>r.trim())}async request(e,t){return this.#n(e,t,{},r=>r)}async getJson(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:`${p.get(s.JSON)}`}},x)}async getXml(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:`${p.get(s.XML)}`}},G)}async getHtml(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:`${p.get(s.HTML)}`}},H)}async getHtmlFragment(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:`${p.get(s.HTML)}`}},ne)}async getScript(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:`${p.get(s.JAVA_SCRIPT)}`}},_)}async getStylesheet(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:`${p.get(s.CSS)}`}},M)}async getBlob(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:s.BIN}},ae)}async getImage(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:"image/*"}},D)}async getBuffer(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:s.BIN}},se)}async getStream(e,t){return this.#a(e,t,{headers:{[d.ACCEPT]:s.BIN}},U)}async#a(e,t,r={},i){return this.#n(e,t,Object.assign(r,{method:h.GET}),i)}async#n(e,t={},r={},i){let n;E(e)==Object&&([e,t]=[void 0,e]),r=this.#T(t,r);let l=o.#g(this.#e,e,r.searchParams);try{o.#o.add(r.signal),n=await fetch(l,new Proxy(r,Q)),i||n.status==204||(i=this.#O(n.headers.get(v.CONTENT_TYPE)));let u=await i?.(n)??n;return n.ok?(this.#i({name:T.SUCCESS,data:u,global:r.global}),u):Promise.reject(this.#u(l,{status:o.#l("ResponseError",n),entity:u}))}catch(u){return Promise.reject(this.#u(l,{cause:u,status:o.#l(u.name,n)}))}finally{r.signal.clearTimeout(),r.signal.aborted||(this.#i({name:T.COMPLETE,data:n,global:r.global}),o.#o.delete(r.signal),o.#o.size==0&&this.#i({name:T.ALL_COMPLETE,global:r.global}))}}static#h({body:e,headers:t,searchParams:r,...i},{headers:n,searchParams:l,...u}){return P(u,i,{body:[FormData,URLSearchParams,Object].includes(E(e))?new f(e):e,headers:o.#s(new Headers,t,n),searchParams:o.#s(new URLSearchParams,r,l)})}static#s(e,t={},r={}){for(let i of[t,r])for(let[n,l]of i.entries?.()??Object.entries(i))e.set(n,l);return e}#T({body:e,headers:t,searchParams:r,...i},{headers:n,searchParams:l,...u}){let c=P(this.#t,i,u,{headers:o.#s(new Headers(this.#t.headers),t,n),searchParams:o.#s(new URLSearchParams(this.#t.searchParams),r,l)});if(Z.includes(c.method))if([f,FormData,URLSearchParams,Object].includes(E(e))){let m=c.headers.get(d.CONTENT_TYPE),S=(p.get(m)??g.parse(m))?.subtype;S==s.MULTIPART_FORM_DATA?c.body=o.#s(new FormData(c.body),e):S==s.FORM?c.body=o.#s(new URLSearchParams(c.body),e):S.includes("json")?c.body=JSON.stringify(o.#s(new f(c.body),e)):c.body=o.#s(new f(c.body),e)}else c.body=e;else c.headers.delete(d.CONTENT_TYPE),c.body&&o.#s(c.searchParams,c.body),c.body=void 0;return c.signal=new ee(c.signal).onAbort(m=>this.#i({name:T.ABORTED,event:m,global:c.global})).onTimeout(m=>this.#i({name:T.TIMEOUT,event:m,global:c.global})),this.#i({name:T.CONFIGURED,data:c,global:c.global}),c}static#E(e){switch(E(e)){case URL:return e;case String:return new URL(e,e.startsWith("/")?globalThis.location.origin:void 0);default:throw TypeError("Invalid URL")}}static#g(e,t,r){let i=t?new URL(`${e.pathname.replace(q,"")}${t}`,e.origin):new URL(e);return r?.forEach((n,l)=>i.searchParams.append(l,n)),i}static#l(e,t){switch(e){case"AbortError":return L[T.ABORTED];case"TimeoutError":return L[T.TIMEOUT];default:return t?new b(t.status,t.statusText):K}}#u(e,t){let r=new te(`An error has occurred with your request to: '${e}'`,t);return this.#i({name:T.ERROR,data:r}),r}#i({name:e,event:t=new CustomEvent(e),data:r,global:i=!0}={}){i&&o.#c.publish(e,t,r),this.#r.publish(e,t,r)}#O(e){let t=g.parse(e);if(t){for(let[r,i]of o.#p)if(t.matches(i))return r}}get[Symbol.toStringTag](){return"Transportr"}};export{ie as default};
//# sourceMappingURL=transportr.min.js.map