iboot-http-client 1.4.2 → 1.4.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/dist/iboot-http-client.cjs.js +1 -1
- package/dist/iboot-http-client.cjs.js.map +1 -1
- package/dist/iboot-http-client.es.js +1 -1
- package/dist/iboot-http-client.es.js.map +1 -1
- package/dist/iboot-http-client.umd.js +1 -1
- package/dist/iboot-http-client.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
|
8
|
-
`)}}class o extends Error{constructor(){super("The request.page has been deprecated in favour of `URLPattern`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n ")}}class n extends Error{constructor(){super("The request.ua has been removed in favour of `userAgent` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n ")}}})(Ge)),Ge}var Xe={},We,At;function vr(){if(At)return We;At=1;var i=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(a,v)=>{for(var p in v)i(a,p,{get:v[p],enumerable:!0})},s=(a,v,p,w)=>{if(v&&typeof v=="object"||typeof v=="function")for(let P of t(v))!o.call(a,P)&&P!==p&&i(a,P,{get:()=>v[P],enumerable:!(w=e(v,P))||w.enumerable});return a},u=a=>s(i({},"__esModule",{value:!0}),a),r={};n(r,{RequestCookies:()=>g,ResponseCookies:()=>f,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>l}),We=u(r);function l(a){var v;const p=["path"in a&&a.path&&`Path=${a.path}`,"expires"in a&&(a.expires||a.expires===0)&&`Expires=${(typeof a.expires=="number"?new Date(a.expires):a.expires).toUTCString()}`,"maxAge"in a&&typeof a.maxAge=="number"&&`Max-Age=${a.maxAge}`,"domain"in a&&a.domain&&`Domain=${a.domain}`,"secure"in a&&a.secure&&"Secure","httpOnly"in a&&a.httpOnly&&"HttpOnly","sameSite"in a&&a.sameSite&&`SameSite=${a.sameSite}`,"partitioned"in a&&a.partitioned&&"Partitioned","priority"in a&&a.priority&&`Priority=${a.priority}`].filter(Boolean),w=`${a.name}=${encodeURIComponent((v=a.value)!=null?v:"")}`;return p.length===0?w:`${w}; ${p.join("; ")}`}function d(a){const v=new Map;for(const p of a.split(/; */)){if(!p)continue;const w=p.indexOf("=");if(w===-1){v.set(p,"true");continue}const[P,N]=[p.slice(0,w),p.slice(w+1)];try{v.set(P,decodeURIComponent(N??"true"))}catch{}}return v}function c(a){if(!a)return;const[[v,p],...w]=d(a),{domain:P,expires:N,httponly:j,maxage:D,path:F,samesite:q,secure:Q,partitioned:Z,priority:B}=Object.fromEntries(w.map(([ie,V])=>[ie.toLowerCase(),V])),z={name:v,value:decodeURIComponent(p),domain:P,...N&&{expires:new Date(N)},...j&&{httpOnly:!0},...typeof D=="string"&&{maxAge:Number(D)},path:F,...q&&{sameSite:R(q)},...Q&&{secure:!0},...B&&{priority:I(B)},...Z&&{partitioned:!0}};return m(z)}function m(a){const v={};for(const p in a)a[p]&&(v[p]=a[p]);return v}var b=["strict","lax","none"];function R(a){return a=a.toLowerCase(),b.includes(a)?a:void 0}var y=["low","medium","high"];function I(a){return a=a.toLowerCase(),y.includes(a)?a:void 0}function h(a){if(!a)return[];var v=[],p=0,w,P,N,j,D;function F(){for(;p<a.length&&/\s/.test(a.charAt(p));)p+=1;return p<a.length}function q(){return P=a.charAt(p),P!=="="&&P!==";"&&P!==","}for(;p<a.length;){for(w=p,D=!1;F();)if(P=a.charAt(p),P===","){for(N=p,p+=1,F(),j=p;p<a.length&&q();)p+=1;p<a.length&&a.charAt(p)==="="?(D=!0,p=j,v.push(a.substring(w,N)),w=p):p=N+1}else p+=1;(!D||p>=a.length)&&v.push(a.substring(w,a.length))}return v}var g=class{constructor(a){this._parsed=new Map,this._headers=a;const v=a.get("cookie");if(v){const p=d(v);for(const[w,P]of p)this._parsed.set(w,{name:w,value:P})}}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...a){const v=typeof a[0]=="string"?a[0]:a[0].name;return this._parsed.get(v)}getAll(...a){var v;const p=Array.from(this._parsed);if(!a.length)return p.map(([P,N])=>N);const w=typeof a[0]=="string"?a[0]:(v=a[0])==null?void 0:v.name;return p.filter(([P])=>P===w).map(([P,N])=>N)}has(a){return this._parsed.has(a)}set(...a){const[v,p]=a.length===1?[a[0].name,a[0].value]:a,w=this._parsed;return w.set(v,{name:v,value:p}),this._headers.set("cookie",Array.from(w).map(([P,N])=>l(N)).join("; ")),this}delete(a){const v=this._parsed,p=Array.isArray(a)?a.map(w=>v.delete(w)):v.delete(a);return this._headers.set("cookie",Array.from(v).map(([w,P])=>l(P)).join("; ")),p}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(a=>`${a.name}=${encodeURIComponent(a.value)}`).join("; ")}},f=class{constructor(a){this._parsed=new Map;var v,p,w;this._headers=a;const P=(w=(p=(v=a.getSetCookie)==null?void 0:v.call(a))!=null?p:a.get("set-cookie"))!=null?w:[],N=Array.isArray(P)?P:h(P);for(const j of N){const D=c(j);D&&this._parsed.set(D.name,D)}}get(...a){const v=typeof a[0]=="string"?a[0]:a[0].name;return this._parsed.get(v)}getAll(...a){var v;const p=Array.from(this._parsed.values());if(!a.length)return p;const w=typeof a[0]=="string"?a[0]:(v=a[0])==null?void 0:v.name;return p.filter(P=>P.name===w)}has(a){return this._parsed.has(a)}set(...a){const[v,p,w]=a.length===1?[a[0].name,a[0].value,a[0]]:a,P=this._parsed;return P.set(v,E({name:v,value:p,...w})),_(P,this._headers),this}delete(...a){const[v,p,w]=typeof a[0]=="string"?[a[0]]:[a[0].name,a[0].path,a[0].domain];return this.set({name:v,path:p,domain:w,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(l).join("; ")}};function _(a,v){v.delete("set-cookie");for(const[,p]of a){const w=l(p);v.append("set-cookie",w)}}function E(a={name:"",value:""}){return typeof a.expires=="number"&&(a.expires=new Date(a.expires)),a.maxAge&&(a.expires=new Date(Date.now()+a.maxAge*1e3)),(a.path===null||a.path===void 0)&&(a.path="/"),a}return We}var It;function tt(){return It||(It=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(o,n){for(var s in n)Object.defineProperty(o,s,{enumerable:!0,get:n[s]})}e(i,{RequestCookies:function(){return t.RequestCookies},ResponseCookies:function(){return t.ResponseCookies},stringifyCookie:function(){return t.stringifyCookie}});const t=vr()})(Xe)),Xe}var Ot;function Rr(){return Ot||(Ot=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(l,d){for(var c in d)Object.defineProperty(l,c,{enumerable:!0,get:d[c]})}e(i,{INTERNALS:function(){return u},NextRequest:function(){return r}});const t=Bt(),o=Gt(),n=Er(),s=tt(),u=Symbol("internal request");class r extends Request{constructor(d,c={}){const m=typeof d!="string"&&"url"in d?d.url:String(d);(0,o.validateURL)(m),d instanceof Request?super(d,c):super(m,c);const b=new t.NextURL(m,{headers:(0,o.toNodeOutgoingHttpHeaders)(this.headers),nextConfig:c.nextConfig});this[u]={cookies:new s.RequestCookies(this.headers),geo:c.geo||{},ip:c.ip,nextUrl:b,url:process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE?m:b.toString()}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,geo:this.geo,ip:this.ip,nextUrl:this.nextUrl,url:this.url,bodyUsed:this.bodyUsed,cache:this.cache,credentials:this.credentials,destination:this.destination,headers:Object.fromEntries(this.headers),integrity:this.integrity,keepalive:this.keepalive,method:this.method,mode:this.mode,redirect:this.redirect,referrer:this.referrer,referrerPolicy:this.referrerPolicy,signal:this.signal}}get cookies(){return this[u].cookies}get geo(){return this[u].geo}get ip(){return this[u].ip}get nextUrl(){return this[u].nextUrl}get page(){throw new n.RemovedPageError}get ua(){throw new n.RemovedUAError}get url(){return this[u].url}}})(Ae)),Ae}var ze={},Ve={},xt;function Pr(){return xt||(xt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"ReflectAdapter",{enumerable:!0,get:function(){return e}});class e{static get(o,n,s){const u=Reflect.get(o,n,s);return typeof u=="function"?u.bind(o):u}static set(o,n,s,u){return Reflect.set(o,n,s,u)}static has(o,n){return Reflect.has(o,n)}static deleteProperty(o,n){return Reflect.deleteProperty(o,n)}}})(Ve)),Ve}var Nt;function yr(){return Nt||(Nt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"NextResponse",{enumerable:!0,get:function(){return d}});const e=tt(),t=Bt(),o=Gt(),n=Pr(),s=tt(),u=Symbol("internal response"),r=new Set([301,302,303,307,308]);function l(c,m){var b;if(!(c==null||(b=c.request)==null)&&b.headers){if(!(c.request.headers instanceof Headers))throw new Error("request.headers must be an instance of Headers");const R=[];for(const[y,I]of c.request.headers)m.set("x-middleware-request-"+y,I),R.push(y);m.set("x-middleware-override-headers",R.join(","))}}class d extends Response{constructor(m,b={}){super(m,b);const R=this.headers,y=new s.ResponseCookies(R),I=new Proxy(y,{get(h,g,f){switch(g){case"delete":case"set":return(..._)=>{const E=Reflect.apply(h[g],h,_),a=new Headers(R);return E instanceof s.ResponseCookies&&R.set("x-middleware-set-cookie",E.getAll().map(v=>(0,e.stringifyCookie)(v)).join(",")),l(b,a),E};default:return n.ReflectAdapter.get(h,g,f)}}});this[u]={cookies:I,url:b.url?new t.NextURL(b.url,{headers:(0,o.toNodeOutgoingHttpHeaders)(R),nextConfig:b.nextConfig}):void 0}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,url:this.url,body:this.body,bodyUsed:this.bodyUsed,headers:Object.fromEntries(this.headers),ok:this.ok,redirected:this.redirected,status:this.status,statusText:this.statusText,type:this.type}}get cookies(){return this[u].cookies}static json(m,b){const R=Response.json(m,b);return new d(R.body,R)}static redirect(m,b){const R=typeof b=="number"?b:b?.status??307;if(!r.has(R))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');const y=typeof b=="object"?b:{},I=new Headers(y?.headers);return I.set("Location",(0,o.validateURL)(m)),new d(null,{...y,headers:I,status:R})}static rewrite(m,b){const R=new Headers(b?.headers);return R.set("x-middleware-rewrite",(0,o.validateURL)(m)),l(b,R),new d(null,{...b,headers:R})}static next(m){const b=new Headers(m?.headers);return b.set("x-middleware-next","1"),l(m,b),new d(null,{...m,headers:b})}}})(ze)),ze}var Ye={},Ct;function Sr(){return Ct||(Ct=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"ImageResponse",{enumerable:!0,get:function(){return e}});function e(){throw new Error('ImageResponse moved from "next/server" to "next/og" since Next.js 14, please import from "next/og" instead')}})(Ye)),Ye}var Ke={},$e={exports:{}},Lt;function Tr(){return Lt||(Lt=1,(()=>{var i={226:function(n,s){(function(u,r){var l="1.0.35",d="",c="?",m="function",b="undefined",R="object",y="string",I="major",h="model",g="name",f="type",_="vendor",E="version",a="architecture",v="console",p="mobile",w="tablet",P="smarttv",N="wearable",j="embedded",D=350,F="Amazon",q="Apple",Q="ASUS",Z="BlackBerry",B="Browser",z="Chrome",ie="Edge",V="Firefox",ee="Google",fe="Huawei",se="LG",ae="Microsoft",pe="Motorola",te="Opera",ue="Samsung",me="Sharp",re="Sony",ce="Xiaomi",k="Zebra",_e="Facebook",ge="Chromium OS",be="Mac OS",we=function(A,x){var T={};for(var C in A)x[C]&&x[C].length%2===0?T[C]=x[C].concat(A[C]):T[C]=A[C];return T},J=function(A){for(var x={},T=0;T<A.length;T++)x[A[T].toUpperCase()]=A[T];return x},at=function(A,x){return typeof A===y?le(x).indexOf(le(A))!==-1:!1},le=function(A){return A.toLowerCase()},er=function(A){return typeof A===y?A.replace(/[^\d\.]/g,d).split(".")[0]:r},ye=function(A,x){if(typeof A===y)return A=A.replace(/^\s\s*/,d),typeof x===b?A:A.substring(0,D)},de=function(A,x){for(var T=0,C,Y,G,O,S,X;T<x.length&&!S;){var Te=x[T],lt=x[T+1];for(C=Y=0;C<Te.length&&!S&&Te[C];)if(S=Te[C++].exec(A),S)for(G=0;G<lt.length;G++)X=S[++Y],O=lt[G],typeof O===R&&O.length>0?O.length===2?typeof O[1]==m?this[O[0]]=O[1].call(this,X):this[O[0]]=O[1]:O.length===3?typeof O[1]===m&&!(O[1].exec&&O[1].test)?this[O[0]]=X?O[1].call(this,X,O[2]):r:this[O[0]]=X?X.replace(O[1],O[2]):r:O.length===4&&(this[O[0]]=X?O[3].call(this,X.replace(O[1],O[2])):r):this[O]=X||r;T+=2}},Se=function(A,x){for(var T in x)if(typeof x[T]===R&&x[T].length>0){for(var C=0;C<x[T].length;C++)if(at(x[T][C],A))return T===c?r:T}else if(at(x[T],A))return T===c?r:T;return A},tr={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},ut={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ct={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[E,[g,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[E,[g,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[g,E],[/opios[\/ ]+([\w\.]+)/i],[E,[g,te+" Mini"]],[/\bopr\/([\w\.]+)/i],[E,[g,te]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[g,E],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[E,[g,"UC"+B]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[E,[g,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[E,[g,"WeChat"]],[/konqueror\/([\w\.]+)/i],[E,[g,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[E,[g,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[E,[g,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[g,/(.+)/,"$1 Secure "+B],E],[/\bfocus\/([\w\.]+)/i],[E,[g,V+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[g,te+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[g,te+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[g,"MIUI "+B]],[/fxios\/([-\w\.]+)/i],[E,[g,V]],[/\bqihu|(qi?ho?o?|360)browser/i],[[g,"360 "+B]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[g,/(.+)/,"$1 "+B],E],[/(comodo_dragon)\/([\w\.]+)/i],[[g,/_/g," "],E],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[g,E],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[g],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[g,_e],E],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[g,E],[/\bgsa\/([\w\.]+) .*safari\//i],[E,[g,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[E,[g,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[E,[g,z+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,z+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[g,"Android "+B]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[g,E],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[E,[g,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[E,g],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[g,[E,Se,tr]],[/(webkit|khtml)\/([\w\.]+)/i],[g,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[g,"Netscape"],E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[g,V+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[g,E],[/(cobalt)\/([\w\.]+)/i],[g,[E,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[a,"amd64"]],[/(ia32(?=;))/i],[[a,le]],[/((?:i[346]|x)86)[;\)]/i],[[a,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[a,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[a,"armhf"]],[/windows (ce|mobile); ppc;/i],[[a,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[a,/ower/,d,le]],[/(sun4\w)[;\)]/i],[[a,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[a,le]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[_,ue],[f,w]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[_,ue],[f,p]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[_,q],[f,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[_,q],[f,w]],[/(macintosh);/i],[h,[_,q]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[_,me],[f,p]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[_,fe],[f,w]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[_,fe],[f,p]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[_,ce],[f,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[_,ce],[f,w]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[_,"OPPO"],[f,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[_,"Vivo"],[f,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[_,"Realme"],[f,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[_,pe],[f,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[_,pe],[f,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[_,se],[f,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[_,se],[f,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[_,"Lenovo"],[f,w]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[_,"Nokia"],[f,p]],[/(pixel c)\b/i],[h,[_,ee],[f,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[_,ee],[f,p]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[_,re],[f,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[_,re],[f,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[_,"OnePlus"],[f,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[_,F],[f,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[_,F],[f,p]],[/(playbook);[-\w\),; ]+(rim)/i],[h,_,[f,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[_,Z],[f,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[_,Q],[f,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[_,Q],[f,p]],[/(nexus 9)/i],[h,[_,"HTC"],[f,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[h,/_/g," "],[f,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[_,"Acer"],[f,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[_,"Meizu"],[f,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[_,h,[f,p]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[_,h,[f,w]],[/(surface duo)/i],[h,[_,ae],[f,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[_,"Fairphone"],[f,p]],[/(u304aa)/i],[h,[_,"AT&T"],[f,p]],[/\bsie-(\w*)/i],[h,[_,"Siemens"],[f,p]],[/\b(rct\w+) b/i],[h,[_,"RCA"],[f,w]],[/\b(venue[\d ]{2,7}) b/i],[h,[_,"Dell"],[f,w]],[/\b(q(?:mv|ta)\w+) b/i],[h,[_,"Verizon"],[f,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[_,"Barnes & Noble"],[f,w]],[/\b(tm\d{3}\w+) b/i],[h,[_,"NuVision"],[f,w]],[/\b(k88) b/i],[h,[_,"ZTE"],[f,w]],[/\b(nx\d{3}j) b/i],[h,[_,"ZTE"],[f,p]],[/\b(gen\d{3}) b.+49h/i],[h,[_,"Swiss"],[f,p]],[/\b(zur\d{3}) b/i],[h,[_,"Swiss"],[f,w]],[/\b((zeki)?tb.*\b) b/i],[h,[_,"Zeki"],[f,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],h,[f,w]],[/\b(ns-?\w{0,9}) b/i],[h,[_,"Insignia"],[f,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[_,"NextBook"],[f,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],h,[f,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],h,[f,p]],[/\b(ph-1) /i],[h,[_,"Essential"],[f,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[_,"Envizen"],[f,w]],[/\b(trio[-\w\. ]+) b/i],[h,[_,"MachSpeed"],[f,w]],[/\btu_(1491) b/i],[h,[_,"Rotor"],[f,w]],[/(shield[\w ]+) b/i],[h,[_,"Nvidia"],[f,w]],[/(sprint) (\w+)/i],[_,h,[f,p]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[_,ae],[f,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[_,k],[f,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[_,k],[f,p]],[/smart-tv.+(samsung)/i],[_,[f,P]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[_,ue],[f,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,se],[f,P]],[/(apple) ?tv/i],[_,[h,q+" TV"],[f,P]],[/crkey/i],[[h,z+"cast"],[_,ee],[f,P]],[/droid.+aft(\w)( bui|\))/i],[h,[_,F],[f,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[_,me],[f,P]],[/(bravia[\w ]+)( bui|\))/i],[h,[_,re],[f,P]],[/(mitv-\w{5}) bui/i],[h,[_,ce],[f,P]],[/Hbbtv.*(technisat) (.*);/i],[_,h,[f,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,ye],[h,ye],[f,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[f,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,h,[f,v]],[/droid.+; (shield) bui/i],[h,[_,"Nvidia"],[f,v]],[/(playstation [345portablevi]+)/i],[h,[_,re],[f,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[_,ae],[f,v]],[/((pebble))app/i],[_,h,[f,N]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[_,q],[f,N]],[/droid.+; (glass) \d/i],[h,[_,ee],[f,N]],[/droid.+; (wt63?0{2,3})\)/i],[h,[_,k],[f,N]],[/(quest( 2| pro)?)/i],[h,[_,_e],[f,N]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[f,j]],[/(aeobc)\b/i],[h,[_,F],[f,j]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[f,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[f,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[f,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[f,p]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[g,ie+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[E,[g,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[g,E],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[E,g]],os:[[/microsoft (windows) (vista|xp)/i],[g,E],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[g,[E,Se,ut]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,"Windows"],[E,Se,ut]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[E,/_/g,"."],[g,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[g,be],[E,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[E,g],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[g,E],[/\(bb(10);/i],[E,[g,Z]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[g,V+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[E,[g,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[E,[g,"watchOS"]],[/crkey\/([\d\.]+)/i],[E,[g,z+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,ge],E],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[g,E],[/(sunos) ?([\w\.\d]*)/i],[[g,"Solaris"],E],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[g,E]]},H=function(A,x){if(typeof A===R&&(x=A,A=r),!(this instanceof H))return new H(A,x).getResult();var T=typeof u!==b&&u.navigator?u.navigator:r,C=A||(T&&T.userAgent?T.userAgent:d),Y=T&&T.userAgentData?T.userAgentData:r,G=x?we(ct,x):ct,O=T&&T.userAgent==C;return this.getBrowser=function(){var S={};return S[g]=r,S[E]=r,de.call(S,C,G.browser),S[I]=er(S[E]),O&&T&&T.brave&&typeof T.brave.isBrave==m&&(S[g]="Brave"),S},this.getCPU=function(){var S={};return S[a]=r,de.call(S,C,G.cpu),S},this.getDevice=function(){var S={};return S[_]=r,S[h]=r,S[f]=r,de.call(S,C,G.device),O&&!S[f]&&Y&&Y.mobile&&(S[f]=p),O&&S[h]=="Macintosh"&&T&&typeof T.standalone!==b&&T.maxTouchPoints&&T.maxTouchPoints>2&&(S[h]="iPad",S[f]=w),S},this.getEngine=function(){var S={};return S[g]=r,S[E]=r,de.call(S,C,G.engine),S},this.getOS=function(){var S={};return S[g]=r,S[E]=r,de.call(S,C,G.os),O&&!S[g]&&Y&&Y.platform!="Unknown"&&(S[g]=Y.platform.replace(/chrome os/i,ge).replace(/macos/i,be)),S},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return C},this.setUA=function(S){return C=typeof S===y&&S.length>D?ye(S,D):S,this},this.setUA(C),this};H.VERSION=l,H.BROWSER=J([g,E,I]),H.CPU=J([a]),H.DEVICE=J([h,_,f,v,p,P,w,N,j]),H.ENGINE=H.OS=J([g,E]),typeof s!==b?(n.exports&&(s=n.exports=H),s.UAParser=H):typeof u!==b&&(u.UAParser=H);var ne=typeof u!==b&&(u.jQuery||u.Zepto);if(ne&&!ne.ua){var Ee=new H;ne.ua=Ee.getResult(),ne.ua.get=function(){return Ee.getUA()},ne.ua.set=function(A){Ee.setUA(A);var x=Ee.getResult();for(var T in x)ne.ua[T]=x[T]}}})(typeof window=="object"?window:this)}},e={};function t(n){var s=e[n];if(s!==void 0)return s.exports;var u=e[n]={exports:{}},r=!0;try{i[n].call(u.exports,u,u.exports,t),r=!1}finally{r&&delete e[n]}return u.exports}typeof t<"u"&&(t.ab=__dirname+"/");var o=t(226);$e.exports=o})()),$e.exports}var kt;function Ut(){return kt||(kt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(r,l){for(var d in l)Object.defineProperty(r,d,{enumerable:!0,get:l[d]})}e(i,{isBot:function(){return n},userAgent:function(){return u},userAgentFromString:function(){return s}});const t=o(Tr());function o(r){return r&&r.__esModule?r:{default:r}}function n(r){return/Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Google-InspectionTool|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(r)}function s(r){return{...(0,t.default)(r),isBot:r===void 0?!1:n(r)}}function u({headers:r}){return s(r.get("user-agent")||void 0)}})(Ke)),Ke}var Je={},Dt;function Ar(){return Dt||(Dt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"URLPattern",{enumerable:!0,get:function(){return e}});const e=typeof URLPattern>"u"?void 0:URLPattern})(Je)),Je}var Mt;function Ir(){return Mt||(Mt=1,(function(i,e){const t={NextRequest:Rr().NextRequest,NextResponse:yr().NextResponse,ImageResponse:Sr().ImageResponse,userAgentFromString:Ut().userAgentFromString,userAgent:Ut().userAgent,URLPattern:Ar().URLPattern};i.exports=t,e.NextRequest=t.NextRequest,e.NextResponse=t.NextResponse,e.ImageResponse=t.ImageResponse,e.userAgentFromString=t.userAgentFromString,e.userAgent=t.userAgent,e.URLPattern=t.URLPattern})(ve,ve.exports)),ve.exports}var Or=Ir();class xr{async parseRequest(e){const t=new URL(e.url),o=e.method,n=e.headers.get(W)??"",s={};e.cookies.getAll().forEach(l=>{s[l.name]=l.value});let u,r;if(o!=="GET"){if(n.includes(M.applicationJson))try{u=await e.json()}catch{L.warn("request body is null!")}else if(n.includes(M.multipartFormData)){const l=e.clone(),d=await e.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(M.applicationXwwwFormUrlencoded)){const l=await e.text();u=Pe(l,["m"])}}return{url:t,method:o,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const t=Or.NextResponse.json(e.body);if(Object.entries(e.cookies).forEach(([o,n])=>{typeof n=="object"&&n.value?t.cookies.set(o,n.value,n.options):typeof n=="string"&&t.cookies.set(o,n)}),e.cleanCookies){const o={set(n,s,u){t.cookies.set(n,s,u)},delete(n,s){t.cookies.delete({...s,name:n})}};e.cleanCookies(o)}return t}setCookie(e,t,o,n){e.cookies[t]={value:o,options:n}}}class Nr{async parseRequest(e){const t=new URL(K.getRequestURL(e)),o=e.req.method,n=e.req.headers.get(W)||"",s=K.parseCookies(e);let u,r;if(o!=="GET"){if(n.includes(M.applicationJson))try{u=await K.readBody(e)}catch{L.warn("request body is null!")}else if(n.includes(M.multipartFormData)){const l=e.req.clone(),d=await e.req.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(M.applicationXwwwFormUrlencoded))try{u=await K.readBody(e)}catch{L.warn("request body is null!")}}return{url:t,method:o,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const{status:t,headers:o,body:n,cookies:s,cleanCookies:u}=e;return r=>(r.res.status=t,Object.entries(o).forEach(([l,d])=>{r.res.headers.set(l,d)}),Object.entries(s).forEach(([l,d])=>{typeof d=="object"&&d.value?K.setCookie(r,l,d.value,d.options):typeof d=="string"&&K.setCookie(r,l,d)}),u&&u({set(d,c,m){K.setCookie(r,d,c,m)},delete(d,c){K.deleteCookie(r,d,c)}}),n)}setCookie(e,t,o,n){e.cookies[t]={value:o,options:n}}}var rt=(i=>(i[i.login=0]="login",i[i.logout=1]="logout",i))(rt||{});const Qe={login:"login",logout:"logout",unknown:""},W="Content-Type",M={applicationJson:"application/json",multipartFormData:"multipart/form-data",applicationXwwwFormUrlencoded:"application/x-www-form-urlencoded"};class Cr{config;http;adapter;constructor({config:e,adapter:t,storage:o}){this.config=e;let n=Yt(o.headers);(!n.deviceId||n.deviceId.trim().length===0)&&(n=Kt(o.cookies)),this.http=new Zt({...n,userType:e.userType,helloURL:e.helloURL}),this.adapter=t}async handleRequest(e){try{const t=await this.adapter.parseRequest(e),o=await this.processRequest(t);return this.adapter.createResponse(o)}catch(t){L.error({error:t?.toString()||"Internal server error"},"ROUTE ERROR");const o=this.createErrorResponse(500,t?.toString()||"Internal server error");return this.adapter.createResponse(o)}}async processRequest(e){const t=e.url.searchParams,o=t.get("m")??"unknown",s={...Qe,...this.config.APIMAP}[o],u=e.cookies;if(!s||s.length===0)return this.createErrorResponse(404,"API not found",u);let r;if((s.startsWith("admin/")||s.startsWith("api/"))&&(r=$t(u),L.debug(r,"token"),!r||r.username.length===0||r.token.length===0))return this.createErrorResponse(409,"Authentication required",u);L.debug({"content-type":e.contentType},"Content-Type"),L.debug({hostUrl:s,token:r?{...r}:""},"processRequest");const l=e.method;if(l==="GET"){const d=Pe(t.toString(),["m"]),c=await this.http.get({url:s,data:d,token:r});return this.createResponse({url:s,result:c,config:this.config,req:e})}else if(l==="POST"){let d;const c=e.contentType;if(c.includes(M.applicationJson)||c.includes(M.applicationXwwwFormUrlencoded))e.body&&(d={...e.body});else if(c.includes(M.multipartFormData)){const b=c.match(/boundary=([^\s;]+)/);if(!b||!e.requestFormData)return this.createErrorResponse(411,"Missing boundary in form data",u);const R=e.requestFormData.buffer;d={boundary:b[1],buffer:Buffer.from(R)};const I=e.requestFormData.formData;if(I)for(const[h,g]of Object.entries(I))h!=="file"&&(d[h]=g)}else return this.createErrorResponse(410,"Unsupported content type",u);const m=await this.http.post({url:s,data:d,token:r});return this.createResponse({url:s,result:m,config:this.config,req:e})}return this.createErrorResponse(405,"Method not allowed, only supported GET or POST",u)}createResponse({url:e,result:t,config:o,req:n}){const s={};s[W]=M.applicationJson;const u={status:t.success?200:t.code,headers:s,cookies:this.setCookies(n.cookies),body:t};if(t.success){switch(e){case Qe[rt[0]]:const r=t.data;Jt(r,u);break;case Qe[rt[1]]:u.cleanCookies=l=>Qt(l);break}o.onHandlerSuccess&&o.onHandlerSuccess({url:e,data:t.data,req:n,res:u})}return u}createErrorResponse(e,t,o){const n={};return n[W]=M.applicationJson,{status:e,headers:n,cookies:o?this.setCookies(o):{},body:{code:e,success:!1,msg:t}}}setCookies(e){const t={};return Object.entries(e).forEach(([o,n])=>{t[o]={value:n}}),t}}const Lr="zh-CN",Xt="_device_id_key",Wt="_current_website_key",jt="Get request error!",nt="Post request error!",U={IBOOT_DEVICE_ID:"dvid",IBOOT_LANG:"lang",IBOOT_WEBSITE_ID:"wid",IBOOT_WEBSITE_NO:"wno",IBOOT_TOKEN:"token",IBOOT_USER:"user"},$={DEVICE_ID:"Device-Id",LANG:"Lang",WEBSITE_ID:"Website-Id",WEBSITE_NO:"Website-No"},zt=i=>{if(!i.get)throw new Error("The get method of IStorage has not been implemented.");const e=i.get(Xt)??"",t=i.get(Wt),o=t!=null?JSON.parse(t):null,n={};return e.length>0&&(n["Device-Id"]=e),o&&(n.Lang=o.language,o.websiteId&&(n["Website-Id"]=o.websiteId),o.websiteNo&&(n["Website-No"]=o.websiteNo)),n},kr=({deviceId:i,website:e},t)=>{if(!t.set)throw new Error("The set method of IStorage has not been implemented.");t.set(Xt,i),e&&t.set(Wt,JSON.stringify(e))},Ur=i=>`${process.env.BASE_URL||"/api/services"}?m=${i}`,Vt=async(i,e)=>{let t=Ur(i);if(e?.data){const r=new URLSearchParams(e.data);t+=`&${r}`}const o=e&&e.storage&&e.storage.get?zt(e.storage):{},n=e?.headers;if(n)for(const r in n){const l=n[r];l&&(o[r]=l)}L.info({url:t,headers:o},"GET");const s=await fetch(t,{method:"GET",headers:o,cache:e?.useCache?"force-cache":"default"});if(s.ok){const r=Object.fromEntries(s.headers.entries()),l={...await s.json(),headers:r};return L.debug(l,"GET_RESULT"),l}const u={code:s.status,success:!1,msg:s.statusText};return L.error(u),u},st=async(i,e)=>{const t=e?.data??{},o=e?.headers;let n;const s=e&&e.storage&&e.storage.get?zt(e.storage):{},u=new Headers(s);if(t instanceof FormData?n=t:(n=JSON.stringify(t),u.set(W,M.applicationJson)),o)for(let d in o){const c=o[d];c&&u.set(d,c)}L.info({url:i,headers:u},"POST");const r=await fetch(i,{method:"POST",headers:u,body:n});if(r.ok){const d=Object.fromEntries(r.headers.entries()),c={...await r.json(),headers:d};return L.debug(c,"POST_RESULT"),c}const l={code:r.status,success:!1,msg:r.statusText};return L.error(l),l},Dr=async(i,e)=>{const t=await Vt(i,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??jt);return}throw Error(t.msg??jt)},Mr=async(i,e)=>{const t=await st(i,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??nt);return}throw Error(t.msg??nt)},jr=async(i,e)=>{const t=await st(i,e);return t.success?(e?.showSuccess&&e.showSuccess(t.msg??"SUCCESS"),!0):(e?.showError&&e.showError(t.msg??nt),!1)},Yt=i=>{if(i.get){const e=i.get($.DEVICE_ID),t=i.get($.LANG),o=i.get($.WEBSITE_ID),n=i.get($.WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),o&&o.length>0&&(s.websiteId=o),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of IStorage has not been implemented.")},qr=(i,e)=>{if(i.set)e.deviceId&&i.set($.DEVICE_ID,e.deviceId),e.lang&&i.set($.LANG,e.lang),e.websiteId&&i.set($.WEBSITE_ID,e.websiteId),e.websiteNo&&i.set($.WEBSITE_NO,e.websiteNo);else throw new Error("The set method of IStorage has not been implemented.")},Kt=i=>{if(i.get){const e=i.get(U.IBOOT_DEVICE_ID),t=i.get(U.IBOOT_LANG),o=i.get(U.IBOOT_WEBSITE_ID),n=i.get(U.IBOOT_WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),o&&o.length>0&&(s.websiteId=o),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of ICookies has not been implemented.")},Hr=(i,e)=>{if(i.set)e.deviceId&&i.set(U.IBOOT_DEVICE_ID,e.deviceId),e.lang&&i.set(U.IBOOT_LANG,e.lang),e.websiteId&&i.set(U.IBOOT_WEBSITE_ID,e.websiteId),e.websiteNo&&i.set(U.IBOOT_WEBSITE_NO,e.websiteNo);else throw new Error("The set method of ICookies has not been implemented.")},Fr=i=>{if(i.get){const e=i.get(U.IBOOT_USER);if(e&&e.length>0)return JSON.parse(e)}},$t=i=>{if(i.get){const e=i[U.IBOOT_USER];if(e&&e.length>0){const t=JSON.parse(e),o=t.username,n=t.userType.toString(),s=i[U.IBOOT_TOKEN];if(s)return{username:o,utype:n,token:s}}}},qt=()=>({path:"/",secure:process.env.APP_ENV==="production",httpOnly:!0,sameSite:"strict"}),Re={maxAge:-1,httpOnly:!0,path:"/"},Jt=(i,e)=>{const{id:t,name:o,username:n,nickname:s,headImg:u,token:r,lastLoginTime:l,deviceId:d,userType:c,mustChangePwd:m}=i,b={id:t,name:o,username:n,nickname:s||o,headImg:u,lastLoginTime:l,deviceId:d,userType:c,accountType:0,needToReview:!1,socketOnline:!1,mustChangePwd:m};e.cookies[U.IBOOT_TOKEN]={value:r,options:qt()},e.cookies[U.IBOOT_USER]={value:JSON.stringify(b),options:qt()}},Qt=i=>{if(!i.set)throw new Error("cookies set function is undefined");if(i.set(U.IBOOT_TOKEN,"",Re),i.set(U.IBOOT_USER,"",Re),!i.delete)throw new Error("cookies delete function is undefined");i.delete(U.IBOOT_TOKEN,Re),i.delete(U.IBOOT_USER,Re)};class Zt{baseUrl;helloMethod;apiKey;userType;userFrom;deviceId;version="1";lang;websiteId;websiteNo;constructor(e){process.env.APP_ENV==="production"||L.warn("This is currently a development environment!"),this.baseUrl=process.env.APP_BASEURL,this.apiKey=process.env.APP_APIKEY,this.userFrom=process.env.APP_USERFROM??"1",this.helloMethod=e.helloURL??"",this.userType=e.userType??Ht.TYPE_MGT,this.deviceId=e.deviceId??et(10),this.lang=e.lang??Lr,this.websiteId=e.websiteId,this.websiteNo=e.websiteNo}getDeviceId(){return this.deviceId}encrypt(e){const t=oe.enc.Utf8.parse(this.apiKey);return oe.AES.encrypt(e,t).toString()}decrypt(e){const t=oe.enc.Utf8.parse(this.apiKey);return oe.AES.decrypt(e,t,{mode:oe.mode.ECB}).toString(oe.enc.Utf8)}convertUrlParameter(e){const t=[];for(const o in e){let n=e[o];if(n&&typeof n=="string")n=n.trim();else if(n&&typeof n=="object"){if(Ze(n)){if(n.length===0)continue;for(let s=0;s<n.length;s++){const u=n[s];for(const r in u){const l=u[r]??void 0;if(l){if(typeof l=="object")Ze(l)&&l.forEach((d,c)=>{if(d)for(const m in d){const b=d[m];if(b&&b.toString().length>0){const R=`[${s.toString()}].${r+`[${c.toString()}].${m}`}=${he(b)}`;t.push(o+R)}}});else if(l.toString().length>0){const d=`[${s.toString()}].${r}=${he(l.toString())}`;t.push(o+d)}}}}}else for(const s in n){const u=n[s];if(u!=null&&u!=""&&u.length!=0){const r=`.${s}=${he(u)}`;t.push(o+r)}}continue}else n&&typeof n=="function"&&(n=null);n!=null&&n!=""&&n.length!=0&&t.push(o+"="+he(n))}return t&&t.join("&")}async sign(e){const t="&key="+await this.helloIboot(),o=[];for(const l in e)o.push(l);o.sort((l,d)=>l.toLowerCase().localeCompare(d.toLowerCase()));const n=[];o.forEach(l=>{let d=e[l];typeof d=="object"&&(d=JSON.stringify(d)),n.push(l+"="+d)});const s=n.join("&"),u=or.md5((s+t).toLocaleUpperCase()),r={params:s,md5:u};return L.debug(r,"API_SIGN"),u}assemblyParameter(e,t){const o=e??{};return o.timestamp=Date.now()+"",o.echostr=et(10),o.version=this.version,o.deviceId=this.deviceId,o.webid=this.websiteId,o.apiKey=this.apiKey,t&&t.length>0&&(o.username=t),o}async assemblyHeader({urlParams:e,token:t}){const o={"Res-Type":"json","Device-Id":this.deviceId,"User-Type":t?.utype.toString()??this.userType.toString(),"User-From":this.userFrom,"Api-Key":this.apiKey};o[W]=M.applicationXwwwFormUrlencoded,this.lang&&this.lang.length>0&&(o.Lang=this.lang),this.websiteId&&this.websiteId.length>0&&(o["Web-Id"]=this.websiteId),this.websiteNo&&this.websiteNo.length>0&&(o["Web-No"]=this.websiteNo),t&&(t.token&&t.token.length>0&&t.username&&t.username.length>0&&(o.Authorization=t.token,o.Username=t.username),t.xcsrf&&(o[t.xcsrf.csrfHeader]=t.xcsrf.csrfToken));const n=Pe(e),s=await this.sign(n);return o.Sign=s,o}async helloIboot(){if(this.helloMethod.length<=0)return this.apiKey;const e=this.getApiUrl(this.helloMethod),t={"Res-Type":"json","Api-Key":this.apiKey};t[W]=M.applicationXwwwFormUrlencoded;const o={url:e,headers:t};L.debug(o,"HELLO");const n=await fetch(e,{method:"GET",headers:t,credentials:"include",cache:"force-cache"});if(n.ok){const s=await n.json();return L.debug(s.data,"HELLO RESULT"),s.data}throw new Error("hello iBoot error!")}getApiUrl(e){return`${this.baseUrl}/${e}`}async csrf(){const e=await this.get({url:"guest/csrf"});if(e.success){const t=e.data;if(t)return t.csrfToken.toString()}}async get({url:e,data:t,token:o,cache:n="default"}){const s=this.assemblyParameter(t),u=this.convertUrlParameter(s),r=await this.assemblyHeader({urlParams:u,token:o}),l=`${this.getApiUrl(e)}?${u.toString()}`,d={url:l,headers:r};L.info(d,"GET");const c=await fetch(l,{method:"GET",headers:r,credentials:"include",cache:n});if(c.ok){const b=Object.fromEntries(c.headers.entries()),R={...await c.json(),headers:b};return L.debug(R,"GET_RESULT"),R}const m={code:c.status,success:!1,msg:c.statusText};return L.error(m),m}async post({url:e,data:t,token:o,cache:n="default"}){const s=t?{...t}:{},u=s.buffer??void 0,r=s.boundary??void 0;u&&delete s.buffer,r&&delete s.boundary;const l=this.assemblyParameter(s),d=this.convertUrlParameter(l),c=await this.assemblyHeader({urlParams:d,token:o});u&&r&&(c[W]=`multipart/form-data; boundary=${r}`);const m=this.getApiUrl(e),b={url:m,headers:c,params:l};L.info(b,"POST");const R=u?`${m}?${d}`:m,y=await fetch(R,{method:"POST",headers:c,body:u||d,credentials:"include",cache:n});if(y.ok){const h=Object.fromEntries(y.headers.entries()),g={...await y.json(),headers:h};return L.debug(g,"POST_RESULT"),g}const I={code:y.status,success:!1,msg:y.statusText};return L.error(I),I}async stream({url:e,data:t,token:o}){t=t?{...t}:{};const n=t.buffer??void 0,s=t.boundary??void 0;n&&delete t.buffer,s&&delete t.boundary;const u=this.assemblyParameter(t),r=this.convertUrlParameter(u),l=await this.assemblyHeader({urlParams:r,token:o});n&&s&&(l[W]=`multipart/form-data; boundary=${s}`),l.Connection="keep-alive",l["X-Accel-Buffering"]="no",l["Cache-Control"]="no-cache";const d=this.getApiUrl(e);try{const c=n?`${d}?${r}`:d,m={url:d,headers:l,params:u};L.info(m,"STREAM");const b=await fetch(c,{method:"POST",headers:l,body:n||r.toString(),credentials:"include"});if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);if(!b.body)throw new Error("No response body");const R=Object.fromEntries(b.headers.entries());return new Response(b.body,{headers:R})}catch(c){throw c}}}exports.ACCOUNT_TYPE_MAP=ir;exports.CONTENT_TYPE_KEY=W;exports.CONTENT_TYPE_MAP=M;exports.HTTPRouter=Cr;exports.HttpClient=Zt;exports.NextJsAdapter=xr;exports.NuxtJsAdapter=Nr;exports.USER_FORM_MAP=sr;exports.USER_SEX_MAP=ar;exports.USER_TYPE_MAP=Ht;exports.cleanToken=Qt;exports.dateFormat=cr;exports.get=Vt;exports.getLoginUser=Fr;exports.getServerHttpCookies=Kt;exports.getServerHttpOpts=Yt;exports.getToken=$t;exports.iGet=Dr;exports.iPost=Mr;exports.iPostSuccess=jr;exports.isArray=Ze;exports.logger=L;exports.post=st;exports.randomString=et;exports.setClientRequestHeader=kr;exports.setServerHttpCookies=Hr;exports.setServerHttpHeaders=qr;exports.setToken=Jt;exports.urlEncode=he;exports.urlParamToJson=Pe;
|
|
8
|
+
`)}}class o extends Error{constructor(){super("The request.page has been deprecated in favour of `URLPattern`.\n Read more: https://nextjs.org/docs/messages/middleware-request-page\n ")}}class n extends Error{constructor(){super("The request.ua has been removed in favour of `userAgent` function.\n Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent\n ")}}})(Ge)),Ge}var Xe={},We,At;function vr(){if(At)return We;At=1;var i=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(a,v)=>{for(var p in v)i(a,p,{get:v[p],enumerable:!0})},s=(a,v,p,w)=>{if(v&&typeof v=="object"||typeof v=="function")for(let P of t(v))!o.call(a,P)&&P!==p&&i(a,P,{get:()=>v[P],enumerable:!(w=e(v,P))||w.enumerable});return a},u=a=>s(i({},"__esModule",{value:!0}),a),r={};n(r,{RequestCookies:()=>g,ResponseCookies:()=>f,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>l}),We=u(r);function l(a){var v;const p=["path"in a&&a.path&&`Path=${a.path}`,"expires"in a&&(a.expires||a.expires===0)&&`Expires=${(typeof a.expires=="number"?new Date(a.expires):a.expires).toUTCString()}`,"maxAge"in a&&typeof a.maxAge=="number"&&`Max-Age=${a.maxAge}`,"domain"in a&&a.domain&&`Domain=${a.domain}`,"secure"in a&&a.secure&&"Secure","httpOnly"in a&&a.httpOnly&&"HttpOnly","sameSite"in a&&a.sameSite&&`SameSite=${a.sameSite}`,"partitioned"in a&&a.partitioned&&"Partitioned","priority"in a&&a.priority&&`Priority=${a.priority}`].filter(Boolean),w=`${a.name}=${encodeURIComponent((v=a.value)!=null?v:"")}`;return p.length===0?w:`${w}; ${p.join("; ")}`}function d(a){const v=new Map;for(const p of a.split(/; */)){if(!p)continue;const w=p.indexOf("=");if(w===-1){v.set(p,"true");continue}const[P,N]=[p.slice(0,w),p.slice(w+1)];try{v.set(P,decodeURIComponent(N??"true"))}catch{}}return v}function c(a){if(!a)return;const[[v,p],...w]=d(a),{domain:P,expires:N,httponly:j,maxage:D,path:F,samesite:q,secure:Q,partitioned:Z,priority:B}=Object.fromEntries(w.map(([ie,V])=>[ie.toLowerCase(),V])),z={name:v,value:decodeURIComponent(p),domain:P,...N&&{expires:new Date(N)},...j&&{httpOnly:!0},...typeof D=="string"&&{maxAge:Number(D)},path:F,...q&&{sameSite:R(q)},...Q&&{secure:!0},...B&&{priority:I(B)},...Z&&{partitioned:!0}};return m(z)}function m(a){const v={};for(const p in a)a[p]&&(v[p]=a[p]);return v}var b=["strict","lax","none"];function R(a){return a=a.toLowerCase(),b.includes(a)?a:void 0}var y=["low","medium","high"];function I(a){return a=a.toLowerCase(),y.includes(a)?a:void 0}function h(a){if(!a)return[];var v=[],p=0,w,P,N,j,D;function F(){for(;p<a.length&&/\s/.test(a.charAt(p));)p+=1;return p<a.length}function q(){return P=a.charAt(p),P!=="="&&P!==";"&&P!==","}for(;p<a.length;){for(w=p,D=!1;F();)if(P=a.charAt(p),P===","){for(N=p,p+=1,F(),j=p;p<a.length&&q();)p+=1;p<a.length&&a.charAt(p)==="="?(D=!0,p=j,v.push(a.substring(w,N)),w=p):p=N+1}else p+=1;(!D||p>=a.length)&&v.push(a.substring(w,a.length))}return v}var g=class{constructor(a){this._parsed=new Map,this._headers=a;const v=a.get("cookie");if(v){const p=d(v);for(const[w,P]of p)this._parsed.set(w,{name:w,value:P})}}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...a){const v=typeof a[0]=="string"?a[0]:a[0].name;return this._parsed.get(v)}getAll(...a){var v;const p=Array.from(this._parsed);if(!a.length)return p.map(([P,N])=>N);const w=typeof a[0]=="string"?a[0]:(v=a[0])==null?void 0:v.name;return p.filter(([P])=>P===w).map(([P,N])=>N)}has(a){return this._parsed.has(a)}set(...a){const[v,p]=a.length===1?[a[0].name,a[0].value]:a,w=this._parsed;return w.set(v,{name:v,value:p}),this._headers.set("cookie",Array.from(w).map(([P,N])=>l(N)).join("; ")),this}delete(a){const v=this._parsed,p=Array.isArray(a)?a.map(w=>v.delete(w)):v.delete(a);return this._headers.set("cookie",Array.from(v).map(([w,P])=>l(P)).join("; ")),p}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(a=>`${a.name}=${encodeURIComponent(a.value)}`).join("; ")}},f=class{constructor(a){this._parsed=new Map;var v,p,w;this._headers=a;const P=(w=(p=(v=a.getSetCookie)==null?void 0:v.call(a))!=null?p:a.get("set-cookie"))!=null?w:[],N=Array.isArray(P)?P:h(P);for(const j of N){const D=c(j);D&&this._parsed.set(D.name,D)}}get(...a){const v=typeof a[0]=="string"?a[0]:a[0].name;return this._parsed.get(v)}getAll(...a){var v;const p=Array.from(this._parsed.values());if(!a.length)return p;const w=typeof a[0]=="string"?a[0]:(v=a[0])==null?void 0:v.name;return p.filter(P=>P.name===w)}has(a){return this._parsed.has(a)}set(...a){const[v,p,w]=a.length===1?[a[0].name,a[0].value,a[0]]:a,P=this._parsed;return P.set(v,E({name:v,value:p,...w})),_(P,this._headers),this}delete(...a){const[v,p,w]=typeof a[0]=="string"?[a[0]]:[a[0].name,a[0].path,a[0].domain];return this.set({name:v,path:p,domain:w,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(l).join("; ")}};function _(a,v){v.delete("set-cookie");for(const[,p]of a){const w=l(p);v.append("set-cookie",w)}}function E(a={name:"",value:""}){return typeof a.expires=="number"&&(a.expires=new Date(a.expires)),a.maxAge&&(a.expires=new Date(Date.now()+a.maxAge*1e3)),(a.path===null||a.path===void 0)&&(a.path="/"),a}return We}var It;function tt(){return It||(It=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(o,n){for(var s in n)Object.defineProperty(o,s,{enumerable:!0,get:n[s]})}e(i,{RequestCookies:function(){return t.RequestCookies},ResponseCookies:function(){return t.ResponseCookies},stringifyCookie:function(){return t.stringifyCookie}});const t=vr()})(Xe)),Xe}var Ot;function Rr(){return Ot||(Ot=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(l,d){for(var c in d)Object.defineProperty(l,c,{enumerable:!0,get:d[c]})}e(i,{INTERNALS:function(){return u},NextRequest:function(){return r}});const t=Bt(),o=Gt(),n=Er(),s=tt(),u=Symbol("internal request");class r extends Request{constructor(d,c={}){const m=typeof d!="string"&&"url"in d?d.url:String(d);(0,o.validateURL)(m),d instanceof Request?super(d,c):super(m,c);const b=new t.NextURL(m,{headers:(0,o.toNodeOutgoingHttpHeaders)(this.headers),nextConfig:c.nextConfig});this[u]={cookies:new s.RequestCookies(this.headers),geo:c.geo||{},ip:c.ip,nextUrl:b,url:process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE?m:b.toString()}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,geo:this.geo,ip:this.ip,nextUrl:this.nextUrl,url:this.url,bodyUsed:this.bodyUsed,cache:this.cache,credentials:this.credentials,destination:this.destination,headers:Object.fromEntries(this.headers),integrity:this.integrity,keepalive:this.keepalive,method:this.method,mode:this.mode,redirect:this.redirect,referrer:this.referrer,referrerPolicy:this.referrerPolicy,signal:this.signal}}get cookies(){return this[u].cookies}get geo(){return this[u].geo}get ip(){return this[u].ip}get nextUrl(){return this[u].nextUrl}get page(){throw new n.RemovedPageError}get ua(){throw new n.RemovedUAError}get url(){return this[u].url}}})(Ae)),Ae}var ze={},Ve={},xt;function Pr(){return xt||(xt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"ReflectAdapter",{enumerable:!0,get:function(){return e}});class e{static get(o,n,s){const u=Reflect.get(o,n,s);return typeof u=="function"?u.bind(o):u}static set(o,n,s,u){return Reflect.set(o,n,s,u)}static has(o,n){return Reflect.has(o,n)}static deleteProperty(o,n){return Reflect.deleteProperty(o,n)}}})(Ve)),Ve}var Nt;function yr(){return Nt||(Nt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"NextResponse",{enumerable:!0,get:function(){return d}});const e=tt(),t=Bt(),o=Gt(),n=Pr(),s=tt(),u=Symbol("internal response"),r=new Set([301,302,303,307,308]);function l(c,m){var b;if(!(c==null||(b=c.request)==null)&&b.headers){if(!(c.request.headers instanceof Headers))throw new Error("request.headers must be an instance of Headers");const R=[];for(const[y,I]of c.request.headers)m.set("x-middleware-request-"+y,I),R.push(y);m.set("x-middleware-override-headers",R.join(","))}}class d extends Response{constructor(m,b={}){super(m,b);const R=this.headers,y=new s.ResponseCookies(R),I=new Proxy(y,{get(h,g,f){switch(g){case"delete":case"set":return(..._)=>{const E=Reflect.apply(h[g],h,_),a=new Headers(R);return E instanceof s.ResponseCookies&&R.set("x-middleware-set-cookie",E.getAll().map(v=>(0,e.stringifyCookie)(v)).join(",")),l(b,a),E};default:return n.ReflectAdapter.get(h,g,f)}}});this[u]={cookies:I,url:b.url?new t.NextURL(b.url,{headers:(0,o.toNodeOutgoingHttpHeaders)(R),nextConfig:b.nextConfig}):void 0}}[Symbol.for("edge-runtime.inspect.custom")](){return{cookies:this.cookies,url:this.url,body:this.body,bodyUsed:this.bodyUsed,headers:Object.fromEntries(this.headers),ok:this.ok,redirected:this.redirected,status:this.status,statusText:this.statusText,type:this.type}}get cookies(){return this[u].cookies}static json(m,b){const R=Response.json(m,b);return new d(R.body,R)}static redirect(m,b){const R=typeof b=="number"?b:b?.status??307;if(!r.has(R))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');const y=typeof b=="object"?b:{},I=new Headers(y?.headers);return I.set("Location",(0,o.validateURL)(m)),new d(null,{...y,headers:I,status:R})}static rewrite(m,b){const R=new Headers(b?.headers);return R.set("x-middleware-rewrite",(0,o.validateURL)(m)),l(b,R),new d(null,{...b,headers:R})}static next(m){const b=new Headers(m?.headers);return b.set("x-middleware-next","1"),l(m,b),new d(null,{...m,headers:b})}}})(ze)),ze}var Ye={},Ct;function Sr(){return Ct||(Ct=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"ImageResponse",{enumerable:!0,get:function(){return e}});function e(){throw new Error('ImageResponse moved from "next/server" to "next/og" since Next.js 14, please import from "next/og" instead')}})(Ye)),Ye}var Ke={},$e={exports:{}},Lt;function Tr(){return Lt||(Lt=1,(()=>{var i={226:function(n,s){(function(u,r){var l="1.0.35",d="",c="?",m="function",b="undefined",R="object",y="string",I="major",h="model",g="name",f="type",_="vendor",E="version",a="architecture",v="console",p="mobile",w="tablet",P="smarttv",N="wearable",j="embedded",D=350,F="Amazon",q="Apple",Q="ASUS",Z="BlackBerry",B="Browser",z="Chrome",ie="Edge",V="Firefox",ee="Google",fe="Huawei",se="LG",ae="Microsoft",pe="Motorola",te="Opera",ue="Samsung",me="Sharp",re="Sony",ce="Xiaomi",k="Zebra",_e="Facebook",ge="Chromium OS",be="Mac OS",we=function(A,x){var T={};for(var C in A)x[C]&&x[C].length%2===0?T[C]=x[C].concat(A[C]):T[C]=A[C];return T},J=function(A){for(var x={},T=0;T<A.length;T++)x[A[T].toUpperCase()]=A[T];return x},at=function(A,x){return typeof A===y?le(x).indexOf(le(A))!==-1:!1},le=function(A){return A.toLowerCase()},er=function(A){return typeof A===y?A.replace(/[^\d\.]/g,d).split(".")[0]:r},ye=function(A,x){if(typeof A===y)return A=A.replace(/^\s\s*/,d),typeof x===b?A:A.substring(0,D)},de=function(A,x){for(var T=0,C,Y,G,O,S,X;T<x.length&&!S;){var Te=x[T],lt=x[T+1];for(C=Y=0;C<Te.length&&!S&&Te[C];)if(S=Te[C++].exec(A),S)for(G=0;G<lt.length;G++)X=S[++Y],O=lt[G],typeof O===R&&O.length>0?O.length===2?typeof O[1]==m?this[O[0]]=O[1].call(this,X):this[O[0]]=O[1]:O.length===3?typeof O[1]===m&&!(O[1].exec&&O[1].test)?this[O[0]]=X?O[1].call(this,X,O[2]):r:this[O[0]]=X?X.replace(O[1],O[2]):r:O.length===4&&(this[O[0]]=X?O[3].call(this,X.replace(O[1],O[2])):r):this[O]=X||r;T+=2}},Se=function(A,x){for(var T in x)if(typeof x[T]===R&&x[T].length>0){for(var C=0;C<x[T].length;C++)if(at(x[T][C],A))return T===c?r:T}else if(at(x[T],A))return T===c?r:T;return A},tr={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},ut={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ct={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[E,[g,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[E,[g,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[g,E],[/opios[\/ ]+([\w\.]+)/i],[E,[g,te+" Mini"]],[/\bopr\/([\w\.]+)/i],[E,[g,te]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[g,E],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[E,[g,"UC"+B]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[E,[g,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[E,[g,"WeChat"]],[/konqueror\/([\w\.]+)/i],[E,[g,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[E,[g,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[E,[g,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[g,/(.+)/,"$1 Secure "+B],E],[/\bfocus\/([\w\.]+)/i],[E,[g,V+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[g,te+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[g,te+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[g,"MIUI "+B]],[/fxios\/([-\w\.]+)/i],[E,[g,V]],[/\bqihu|(qi?ho?o?|360)browser/i],[[g,"360 "+B]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[g,/(.+)/,"$1 "+B],E],[/(comodo_dragon)\/([\w\.]+)/i],[[g,/_/g," "],E],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[g,E],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[g],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[g,_e],E],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[g,E],[/\bgsa\/([\w\.]+) .*safari\//i],[E,[g,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[E,[g,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[E,[g,z+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,z+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[g,"Android "+B]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[g,E],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[E,[g,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[E,g],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[g,[E,Se,tr]],[/(webkit|khtml)\/([\w\.]+)/i],[g,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[g,"Netscape"],E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[g,V+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[g,E],[/(cobalt)\/([\w\.]+)/i],[g,[E,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[a,"amd64"]],[/(ia32(?=;))/i],[[a,le]],[/((?:i[346]|x)86)[;\)]/i],[[a,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[a,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[a,"armhf"]],[/windows (ce|mobile); ppc;/i],[[a,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[a,/ower/,d,le]],[/(sun4\w)[;\)]/i],[[a,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[a,le]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[_,ue],[f,w]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[_,ue],[f,p]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[_,q],[f,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[_,q],[f,w]],[/(macintosh);/i],[h,[_,q]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[_,me],[f,p]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[_,fe],[f,w]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[_,fe],[f,p]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[_,ce],[f,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[_,ce],[f,w]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[_,"OPPO"],[f,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[_,"Vivo"],[f,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[_,"Realme"],[f,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[_,pe],[f,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[_,pe],[f,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[_,se],[f,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[_,se],[f,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[_,"Lenovo"],[f,w]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[_,"Nokia"],[f,p]],[/(pixel c)\b/i],[h,[_,ee],[f,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[_,ee],[f,p]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[_,re],[f,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[_,re],[f,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[_,"OnePlus"],[f,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[_,F],[f,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[_,F],[f,p]],[/(playbook);[-\w\),; ]+(rim)/i],[h,_,[f,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[_,Z],[f,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[_,Q],[f,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[_,Q],[f,p]],[/(nexus 9)/i],[h,[_,"HTC"],[f,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[h,/_/g," "],[f,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[_,"Acer"],[f,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[_,"Meizu"],[f,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[_,h,[f,p]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[_,h,[f,w]],[/(surface duo)/i],[h,[_,ae],[f,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[_,"Fairphone"],[f,p]],[/(u304aa)/i],[h,[_,"AT&T"],[f,p]],[/\bsie-(\w*)/i],[h,[_,"Siemens"],[f,p]],[/\b(rct\w+) b/i],[h,[_,"RCA"],[f,w]],[/\b(venue[\d ]{2,7}) b/i],[h,[_,"Dell"],[f,w]],[/\b(q(?:mv|ta)\w+) b/i],[h,[_,"Verizon"],[f,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[_,"Barnes & Noble"],[f,w]],[/\b(tm\d{3}\w+) b/i],[h,[_,"NuVision"],[f,w]],[/\b(k88) b/i],[h,[_,"ZTE"],[f,w]],[/\b(nx\d{3}j) b/i],[h,[_,"ZTE"],[f,p]],[/\b(gen\d{3}) b.+49h/i],[h,[_,"Swiss"],[f,p]],[/\b(zur\d{3}) b/i],[h,[_,"Swiss"],[f,w]],[/\b((zeki)?tb.*\b) b/i],[h,[_,"Zeki"],[f,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],h,[f,w]],[/\b(ns-?\w{0,9}) b/i],[h,[_,"Insignia"],[f,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[_,"NextBook"],[f,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],h,[f,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],h,[f,p]],[/\b(ph-1) /i],[h,[_,"Essential"],[f,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[_,"Envizen"],[f,w]],[/\b(trio[-\w\. ]+) b/i],[h,[_,"MachSpeed"],[f,w]],[/\btu_(1491) b/i],[h,[_,"Rotor"],[f,w]],[/(shield[\w ]+) b/i],[h,[_,"Nvidia"],[f,w]],[/(sprint) (\w+)/i],[_,h,[f,p]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[_,ae],[f,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[_,k],[f,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[_,k],[f,p]],[/smart-tv.+(samsung)/i],[_,[f,P]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[_,ue],[f,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,se],[f,P]],[/(apple) ?tv/i],[_,[h,q+" TV"],[f,P]],[/crkey/i],[[h,z+"cast"],[_,ee],[f,P]],[/droid.+aft(\w)( bui|\))/i],[h,[_,F],[f,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[_,me],[f,P]],[/(bravia[\w ]+)( bui|\))/i],[h,[_,re],[f,P]],[/(mitv-\w{5}) bui/i],[h,[_,ce],[f,P]],[/Hbbtv.*(technisat) (.*);/i],[_,h,[f,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,ye],[h,ye],[f,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[f,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,h,[f,v]],[/droid.+; (shield) bui/i],[h,[_,"Nvidia"],[f,v]],[/(playstation [345portablevi]+)/i],[h,[_,re],[f,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[_,ae],[f,v]],[/((pebble))app/i],[_,h,[f,N]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[_,q],[f,N]],[/droid.+; (glass) \d/i],[h,[_,ee],[f,N]],[/droid.+; (wt63?0{2,3})\)/i],[h,[_,k],[f,N]],[/(quest( 2| pro)?)/i],[h,[_,_e],[f,N]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[f,j]],[/(aeobc)\b/i],[h,[_,F],[f,j]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[f,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[f,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[f,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[f,p]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[g,ie+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[E,[g,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[g,E],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[E,g]],os:[[/microsoft (windows) (vista|xp)/i],[g,E],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[g,[E,Se,ut]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,"Windows"],[E,Se,ut]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[E,/_/g,"."],[g,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[g,be],[E,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[E,g],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[g,E],[/\(bb(10);/i],[E,[g,Z]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[g,V+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[E,[g,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[E,[g,"watchOS"]],[/crkey\/([\d\.]+)/i],[E,[g,z+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,ge],E],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[g,E],[/(sunos) ?([\w\.\d]*)/i],[[g,"Solaris"],E],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[g,E]]},H=function(A,x){if(typeof A===R&&(x=A,A=r),!(this instanceof H))return new H(A,x).getResult();var T=typeof u!==b&&u.navigator?u.navigator:r,C=A||(T&&T.userAgent?T.userAgent:d),Y=T&&T.userAgentData?T.userAgentData:r,G=x?we(ct,x):ct,O=T&&T.userAgent==C;return this.getBrowser=function(){var S={};return S[g]=r,S[E]=r,de.call(S,C,G.browser),S[I]=er(S[E]),O&&T&&T.brave&&typeof T.brave.isBrave==m&&(S[g]="Brave"),S},this.getCPU=function(){var S={};return S[a]=r,de.call(S,C,G.cpu),S},this.getDevice=function(){var S={};return S[_]=r,S[h]=r,S[f]=r,de.call(S,C,G.device),O&&!S[f]&&Y&&Y.mobile&&(S[f]=p),O&&S[h]=="Macintosh"&&T&&typeof T.standalone!==b&&T.maxTouchPoints&&T.maxTouchPoints>2&&(S[h]="iPad",S[f]=w),S},this.getEngine=function(){var S={};return S[g]=r,S[E]=r,de.call(S,C,G.engine),S},this.getOS=function(){var S={};return S[g]=r,S[E]=r,de.call(S,C,G.os),O&&!S[g]&&Y&&Y.platform!="Unknown"&&(S[g]=Y.platform.replace(/chrome os/i,ge).replace(/macos/i,be)),S},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return C},this.setUA=function(S){return C=typeof S===y&&S.length>D?ye(S,D):S,this},this.setUA(C),this};H.VERSION=l,H.BROWSER=J([g,E,I]),H.CPU=J([a]),H.DEVICE=J([h,_,f,v,p,P,w,N,j]),H.ENGINE=H.OS=J([g,E]),typeof s!==b?(n.exports&&(s=n.exports=H),s.UAParser=H):typeof u!==b&&(u.UAParser=H);var ne=typeof u!==b&&(u.jQuery||u.Zepto);if(ne&&!ne.ua){var Ee=new H;ne.ua=Ee.getResult(),ne.ua.get=function(){return Ee.getUA()},ne.ua.set=function(A){Ee.setUA(A);var x=Ee.getResult();for(var T in x)ne.ua[T]=x[T]}}})(typeof window=="object"?window:this)}},e={};function t(n){var s=e[n];if(s!==void 0)return s.exports;var u=e[n]={exports:{}},r=!0;try{i[n].call(u.exports,u,u.exports,t),r=!1}finally{r&&delete e[n]}return u.exports}typeof t<"u"&&(t.ab="undefined/");var o=t(226);$e.exports=o})()),$e.exports}var kt;function Ut(){return kt||(kt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0});function e(r,l){for(var d in l)Object.defineProperty(r,d,{enumerable:!0,get:l[d]})}e(i,{isBot:function(){return n},userAgent:function(){return u},userAgentFromString:function(){return s}});const t=o(Tr());function o(r){return r&&r.__esModule?r:{default:r}}function n(r){return/Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Google-InspectionTool|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(r)}function s(r){return{...(0,t.default)(r),isBot:r===void 0?!1:n(r)}}function u({headers:r}){return s(r.get("user-agent")||void 0)}})(Ke)),Ke}var Je={},Dt;function Ar(){return Dt||(Dt=1,(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"URLPattern",{enumerable:!0,get:function(){return e}});const e=typeof URLPattern>"u"?void 0:URLPattern})(Je)),Je}var Mt;function Ir(){return Mt||(Mt=1,(function(i,e){const t={NextRequest:Rr().NextRequest,NextResponse:yr().NextResponse,ImageResponse:Sr().ImageResponse,userAgentFromString:Ut().userAgentFromString,userAgent:Ut().userAgent,URLPattern:Ar().URLPattern};i.exports=t,e.NextRequest=t.NextRequest,e.NextResponse=t.NextResponse,e.ImageResponse=t.ImageResponse,e.userAgentFromString=t.userAgentFromString,e.userAgent=t.userAgent,e.URLPattern=t.URLPattern})(ve,ve.exports)),ve.exports}var Or=Ir();class xr{async parseRequest(e){const t=new URL(e.url),o=e.method,n=e.headers.get(W)??"",s={};e.cookies.getAll().forEach(l=>{s[l.name]=l.value});let u,r;if(o!=="GET"){if(n.includes(M.applicationJson))try{u=await e.json()}catch{L.warn("request body is null!")}else if(n.includes(M.multipartFormData)){const l=e.clone(),d=await e.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(M.applicationXwwwFormUrlencoded)){const l=await e.text();u=Pe(l,["m"])}}return{url:t,method:o,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const t=Or.NextResponse.json(e.body);if(Object.entries(e.cookies).forEach(([o,n])=>{typeof n=="object"&&n.value?t.cookies.set(o,n.value,n.options):typeof n=="string"&&t.cookies.set(o,n)}),e.cleanCookies){const o={set(n,s,u){t.cookies.set(n,s,u)},delete(n,s){t.cookies.delete({...s,name:n})}};e.cleanCookies(o)}return t}setCookie(e,t,o,n){e.cookies[t]={value:o,options:n}}}class Nr{async parseRequest(e){const t=new URL(K.getRequestURL(e)),o=e.req.method,n=e.req.headers.get(W)||"",s=K.parseCookies(e);let u,r;if(o!=="GET"){if(n.includes(M.applicationJson))try{u=await K.readBody(e)}catch{L.warn("request body is null!")}else if(n.includes(M.multipartFormData)){const l=e.req.clone(),d=await e.req.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(M.applicationXwwwFormUrlencoded))try{u=await K.readBody(e)}catch{L.warn("request body is null!")}}return{url:t,method:o,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const{status:t,headers:o,body:n,cookies:s,cleanCookies:u}=e;return r=>(r.res.status=t,Object.entries(o).forEach(([l,d])=>{r.res.headers.set(l,d)}),Object.entries(s).forEach(([l,d])=>{typeof d=="object"&&d.value?K.setCookie(r,l,d.value,d.options):typeof d=="string"&&K.setCookie(r,l,d)}),u&&u({set(d,c,m){K.setCookie(r,d,c,m)},delete(d,c){K.deleteCookie(r,d,c)}}),n)}setCookie(e,t,o,n){e.cookies[t]={value:o,options:n}}}var rt=(i=>(i[i.login=0]="login",i[i.logout=1]="logout",i))(rt||{});const Qe={login:"login",logout:"logout",unknown:""},W="Content-Type",M={applicationJson:"application/json",multipartFormData:"multipart/form-data",applicationXwwwFormUrlencoded:"application/x-www-form-urlencoded"};class Cr{config;http;adapter;constructor({config:e,adapter:t,storage:o}){this.config=e;let n=Yt(o.headers);(!n.deviceId||n.deviceId.trim().length===0)&&(n=Kt(o.cookies)),this.http=new Zt({...n,userType:e.userType,helloURL:e.helloURL}),this.adapter=t}async handleRequest(e){try{const t=await this.adapter.parseRequest(e),o=await this.processRequest(t);return this.adapter.createResponse(o)}catch(t){L.error({error:t?.toString()||"Internal server error"},"ROUTE ERROR");const o=this.createErrorResponse(500,t?.toString()||"Internal server error");return this.adapter.createResponse(o)}}async processRequest(e){const t=e.url.searchParams,o=t.get("m")??"unknown",s={...Qe,...this.config.APIMAP}[o],u=e.cookies;if(!s||s.length===0)return this.createErrorResponse(404,"API not found",u);let r;if((s.startsWith("admin/")||s.startsWith("api/"))&&(r=$t(u),L.debug(r,"token"),!r||r.username.length===0||r.token.length===0))return this.createErrorResponse(409,"Authentication required",u);L.debug({"content-type":e.contentType},"Content-Type"),L.debug({hostUrl:s,token:r?{...r}:""},"processRequest");const l=e.method;if(l==="GET"){const d=Pe(t.toString(),["m"]),c=await this.http.get({url:s,data:d,token:r});return this.createResponse({url:s,result:c,config:this.config,req:e})}else if(l==="POST"){let d;const c=e.contentType;if(c.includes(M.applicationJson)||c.includes(M.applicationXwwwFormUrlencoded))e.body&&(d={...e.body});else if(c.includes(M.multipartFormData)){const b=c.match(/boundary=([^\s;]+)/);if(!b||!e.requestFormData)return this.createErrorResponse(411,"Missing boundary in form data",u);const R=e.requestFormData.buffer;d={boundary:b[1],buffer:Buffer.from(R)};const I=e.requestFormData.formData;if(I)for(const[h,g]of Object.entries(I))h!=="file"&&(d[h]=g)}else return this.createErrorResponse(410,"Unsupported content type",u);const m=await this.http.post({url:s,data:d,token:r});return this.createResponse({url:s,result:m,config:this.config,req:e})}return this.createErrorResponse(405,"Method not allowed, only supported GET or POST",u)}createResponse({url:e,result:t,config:o,req:n}){const s={};s[W]=M.applicationJson;const u={status:t.success?200:t.code,headers:s,cookies:this.setCookies(n.cookies),body:t};if(t.success){switch(e){case Qe[rt[0]]:const r=t.data;Jt(r,u);break;case Qe[rt[1]]:u.cleanCookies=l=>Qt(l);break}o.onHandlerSuccess&&o.onHandlerSuccess({url:e,data:t.data,req:n,res:u})}return u}createErrorResponse(e,t,o){const n={};return n[W]=M.applicationJson,{status:e,headers:n,cookies:o?this.setCookies(o):{},body:{code:e,success:!1,msg:t}}}setCookies(e){const t={};return Object.entries(e).forEach(([o,n])=>{t[o]={value:n}}),t}}const Lr="zh-CN",Xt="_device_id_key",Wt="_current_website_key",jt="Get request error!",nt="Post request error!",U={IBOOT_DEVICE_ID:"dvid",IBOOT_LANG:"lang",IBOOT_WEBSITE_ID:"wid",IBOOT_WEBSITE_NO:"wno",IBOOT_TOKEN:"token",IBOOT_USER:"user"},$={DEVICE_ID:"Device-Id",LANG:"Lang",WEBSITE_ID:"Website-Id",WEBSITE_NO:"Website-No"},zt=i=>{if(!i.get)throw new Error("The get method of IStorage has not been implemented.");const e=i.get(Xt)??"",t=i.get(Wt),o=t!=null?JSON.parse(t):null,n={};return e.length>0&&(n["Device-Id"]=e),o&&(n.Lang=o.language,o.websiteId&&(n["Website-Id"]=o.websiteId),o.websiteNo&&(n["Website-No"]=o.websiteNo)),n},kr=({deviceId:i,website:e},t)=>{if(!t.set)throw new Error("The set method of IStorage has not been implemented.");t.set(Xt,i),e&&t.set(Wt,JSON.stringify(e))},Ur=i=>`${process.env.BASE_URL||"/api/services"}?m=${i}`,Vt=async(i,e)=>{let t=Ur(i);if(e?.data){const r=new URLSearchParams(e.data);t+=`&${r}`}const o=e&&e.storage&&e.storage.get?zt(e.storage):{},n=e?.headers;if(n)for(const r in n){const l=n[r];l&&(o[r]=l)}L.info({url:t,headers:o},"GET");const s=await fetch(t,{method:"GET",headers:o,cache:e?.useCache?"force-cache":"default"});if(s.ok){const r=Object.fromEntries(s.headers.entries()),l={...await s.json(),headers:r};return L.debug(l,"GET_RESULT"),l}const u={code:s.status,success:!1,msg:s.statusText};return L.error(u),u},st=async(i,e)=>{const t=e?.data??{},o=e?.headers;let n;const s=e&&e.storage&&e.storage.get?zt(e.storage):{},u=new Headers(s);if(t instanceof FormData?n=t:(n=JSON.stringify(t),u.set(W,M.applicationJson)),o)for(let d in o){const c=o[d];c&&u.set(d,c)}L.info({url:i,headers:u},"POST");const r=await fetch(i,{method:"POST",headers:u,body:n});if(r.ok){const d=Object.fromEntries(r.headers.entries()),c={...await r.json(),headers:d};return L.debug(c,"POST_RESULT"),c}const l={code:r.status,success:!1,msg:r.statusText};return L.error(l),l},Dr=async(i,e)=>{const t=await Vt(i,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??jt);return}throw Error(t.msg??jt)},Mr=async(i,e)=>{const t=await st(i,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??nt);return}throw Error(t.msg??nt)},jr=async(i,e)=>{const t=await st(i,e);return t.success?(e?.showSuccess&&e.showSuccess(t.msg??"SUCCESS"),!0):(e?.showError&&e.showError(t.msg??nt),!1)},Yt=i=>{if(i.get){const e=i.get($.DEVICE_ID),t=i.get($.LANG),o=i.get($.WEBSITE_ID),n=i.get($.WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),o&&o.length>0&&(s.websiteId=o),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of IStorage has not been implemented.")},qr=(i,e)=>{if(i.set)e.deviceId&&i.set($.DEVICE_ID,e.deviceId),e.lang&&i.set($.LANG,e.lang),e.websiteId&&i.set($.WEBSITE_ID,e.websiteId),e.websiteNo&&i.set($.WEBSITE_NO,e.websiteNo);else throw new Error("The set method of IStorage has not been implemented.")},Kt=i=>{if(i.get){const e=i.get(U.IBOOT_DEVICE_ID),t=i.get(U.IBOOT_LANG),o=i.get(U.IBOOT_WEBSITE_ID),n=i.get(U.IBOOT_WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),o&&o.length>0&&(s.websiteId=o),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of ICookies has not been implemented.")},Hr=(i,e)=>{if(i.set)e.deviceId&&i.set(U.IBOOT_DEVICE_ID,e.deviceId),e.lang&&i.set(U.IBOOT_LANG,e.lang),e.websiteId&&i.set(U.IBOOT_WEBSITE_ID,e.websiteId),e.websiteNo&&i.set(U.IBOOT_WEBSITE_NO,e.websiteNo);else throw new Error("The set method of ICookies has not been implemented.")},Fr=i=>{if(i.get){const e=i.get(U.IBOOT_USER);if(e&&e.length>0)return JSON.parse(e)}},$t=i=>{if(i.get){const e=i[U.IBOOT_USER];if(e&&e.length>0){const t=JSON.parse(e),o=t.username,n=t.userType.toString(),s=i[U.IBOOT_TOKEN];if(s)return{username:o,utype:n,token:s}}}},qt=()=>({path:"/",secure:process.env.APP_ENV==="production",httpOnly:!0,sameSite:"strict"}),Re={maxAge:-1,httpOnly:!0,path:"/"},Jt=(i,e)=>{const{id:t,name:o,username:n,nickname:s,headImg:u,token:r,lastLoginTime:l,deviceId:d,userType:c,mustChangePwd:m}=i,b={id:t,name:o,username:n,nickname:s||o,headImg:u,lastLoginTime:l,deviceId:d,userType:c,accountType:0,needToReview:!1,socketOnline:!1,mustChangePwd:m};e.cookies[U.IBOOT_TOKEN]={value:r,options:qt()},e.cookies[U.IBOOT_USER]={value:JSON.stringify(b),options:qt()}},Qt=i=>{if(!i.set)throw new Error("cookies set function is undefined");if(i.set(U.IBOOT_TOKEN,"",Re),i.set(U.IBOOT_USER,"",Re),!i.delete)throw new Error("cookies delete function is undefined");i.delete(U.IBOOT_TOKEN,Re),i.delete(U.IBOOT_USER,Re)};class Zt{baseUrl;helloMethod;apiKey;userType;userFrom;deviceId;version="1";lang;websiteId;websiteNo;constructor(e){process.env.APP_ENV==="production"||L.warn("This is currently a development environment!"),this.baseUrl=process.env.APP_BASEURL,this.apiKey=process.env.APP_APIKEY,this.userFrom=process.env.APP_USERFROM??"1",this.helloMethod=e.helloURL??"",this.userType=e.userType??Ht.TYPE_MGT,this.deviceId=e.deviceId??et(10),this.lang=e.lang??Lr,this.websiteId=e.websiteId,this.websiteNo=e.websiteNo}getDeviceId(){return this.deviceId}encrypt(e){const t=oe.enc.Utf8.parse(this.apiKey);return oe.AES.encrypt(e,t).toString()}decrypt(e){const t=oe.enc.Utf8.parse(this.apiKey);return oe.AES.decrypt(e,t,{mode:oe.mode.ECB}).toString(oe.enc.Utf8)}convertUrlParameter(e){const t=[];for(const o in e){let n=e[o];if(n&&typeof n=="string")n=n.trim();else if(n&&typeof n=="object"){if(Ze(n)){if(n.length===0)continue;for(let s=0;s<n.length;s++){const u=n[s];for(const r in u){const l=u[r]??void 0;if(l){if(typeof l=="object")Ze(l)&&l.forEach((d,c)=>{if(d)for(const m in d){const b=d[m];if(b&&b.toString().length>0){const R=`[${s.toString()}].${r+`[${c.toString()}].${m}`}=${he(b)}`;t.push(o+R)}}});else if(l.toString().length>0){const d=`[${s.toString()}].${r}=${he(l.toString())}`;t.push(o+d)}}}}}else for(const s in n){const u=n[s];if(u!=null&&u!=""&&u.length!=0){const r=`.${s}=${he(u)}`;t.push(o+r)}}continue}else n&&typeof n=="function"&&(n=null);n!=null&&n!=""&&n.length!=0&&t.push(o+"="+he(n))}return t&&t.join("&")}async sign(e){const t="&key="+await this.helloIboot(),o=[];for(const l in e)o.push(l);o.sort((l,d)=>l.toLowerCase().localeCompare(d.toLowerCase()));const n=[];o.forEach(l=>{let d=e[l];typeof d=="object"&&(d=JSON.stringify(d)),n.push(l+"="+d)});const s=n.join("&"),u=or.md5((s+t).toLocaleUpperCase()),r={params:s,md5:u};return L.debug(r,"API_SIGN"),u}assemblyParameter(e,t){const o=e??{};return o.timestamp=Date.now()+"",o.echostr=et(10),o.version=this.version,o.deviceId=this.deviceId,o.webid=this.websiteId,o.apiKey=this.apiKey,t&&t.length>0&&(o.username=t),o}async assemblyHeader({urlParams:e,token:t}){const o={"Res-Type":"json","Device-Id":this.deviceId,"User-Type":t?.utype.toString()??this.userType.toString(),"User-From":this.userFrom,"Api-Key":this.apiKey};o[W]=M.applicationXwwwFormUrlencoded,this.lang&&this.lang.length>0&&(o.Lang=this.lang),this.websiteId&&this.websiteId.length>0&&(o["Web-Id"]=this.websiteId),this.websiteNo&&this.websiteNo.length>0&&(o["Web-No"]=this.websiteNo),t&&(t.token&&t.token.length>0&&t.username&&t.username.length>0&&(o.Authorization=t.token,o.Username=t.username),t.xcsrf&&(o[t.xcsrf.csrfHeader]=t.xcsrf.csrfToken));const n=Pe(e),s=await this.sign(n);return o.Sign=s,o}async helloIboot(){if(this.helloMethod.length<=0)return this.apiKey;const e=this.getApiUrl(this.helloMethod),t={"Res-Type":"json","Api-Key":this.apiKey};t[W]=M.applicationXwwwFormUrlencoded;const o={url:e,headers:t};L.debug(o,"HELLO");const n=await fetch(e,{method:"GET",headers:t,credentials:"include",cache:"force-cache"});if(n.ok){const s=await n.json();return L.debug(s.data,"HELLO RESULT"),s.data}throw new Error("hello iBoot error!")}getApiUrl(e){return`${this.baseUrl}/${e}`}async csrf(){const e=await this.get({url:"guest/csrf"});if(e.success){const t=e.data;if(t)return t.csrfToken.toString()}}async get({url:e,data:t,token:o,cache:n="default"}){const s=this.assemblyParameter(t),u=this.convertUrlParameter(s),r=await this.assemblyHeader({urlParams:u,token:o}),l=`${this.getApiUrl(e)}?${u.toString()}`,d={url:l,headers:r};L.info(d,"GET");const c=await fetch(l,{method:"GET",headers:r,credentials:"include",cache:n});if(c.ok){const b=Object.fromEntries(c.headers.entries()),R={...await c.json(),headers:b};return L.debug(R,"GET_RESULT"),R}const m={code:c.status,success:!1,msg:c.statusText};return L.error(m),m}async post({url:e,data:t,token:o,cache:n="default"}){const s=t?{...t}:{},u=s.buffer??void 0,r=s.boundary??void 0;u&&delete s.buffer,r&&delete s.boundary;const l=this.assemblyParameter(s),d=this.convertUrlParameter(l),c=await this.assemblyHeader({urlParams:d,token:o});u&&r&&(c[W]=`multipart/form-data; boundary=${r}`);const m=this.getApiUrl(e),b={url:m,headers:c,params:l};L.info(b,"POST");const R=u?`${m}?${d}`:m,y=await fetch(R,{method:"POST",headers:c,body:u||d,credentials:"include",cache:n});if(y.ok){const h=Object.fromEntries(y.headers.entries()),g={...await y.json(),headers:h};return L.debug(g,"POST_RESULT"),g}const I={code:y.status,success:!1,msg:y.statusText};return L.error(I),I}async stream({url:e,data:t,token:o}){t=t?{...t}:{};const n=t.buffer??void 0,s=t.boundary??void 0;n&&delete t.buffer,s&&delete t.boundary;const u=this.assemblyParameter(t),r=this.convertUrlParameter(u),l=await this.assemblyHeader({urlParams:r,token:o});n&&s&&(l[W]=`multipart/form-data; boundary=${s}`),l.Connection="keep-alive",l["X-Accel-Buffering"]="no",l["Cache-Control"]="no-cache";const d=this.getApiUrl(e);try{const c=n?`${d}?${r}`:d,m={url:d,headers:l,params:u};L.info(m,"STREAM");const b=await fetch(c,{method:"POST",headers:l,body:n||r.toString(),credentials:"include"});if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);if(!b.body)throw new Error("No response body");const R=Object.fromEntries(b.headers.entries());return new Response(b.body,{headers:R})}catch(c){throw c}}}exports.ACCOUNT_TYPE_MAP=ir;exports.CONTENT_TYPE_KEY=W;exports.CONTENT_TYPE_MAP=M;exports.HTTPRouter=Cr;exports.HttpClient=Zt;exports.NextJsAdapter=xr;exports.NuxtJsAdapter=Nr;exports.USER_FORM_MAP=sr;exports.USER_SEX_MAP=ar;exports.USER_TYPE_MAP=Ht;exports.cleanToken=Qt;exports.dateFormat=cr;exports.get=Vt;exports.getLoginUser=Fr;exports.getServerHttpCookies=Kt;exports.getServerHttpOpts=Yt;exports.getToken=$t;exports.iGet=Dr;exports.iPost=Mr;exports.iPostSuccess=jr;exports.isArray=Ze;exports.logger=L;exports.post=st;exports.randomString=et;exports.setClientRequestHeader=kr;exports.setServerHttpCookies=Hr;exports.setServerHttpHeaders=qr;exports.setToken=Jt;exports.urlEncode=he;exports.urlParamToJson=Pe;
|
|
9
9
|
//# sourceMappingURL=iboot-http-client.cjs.js.map
|