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.
@@ -5,5 +5,5 @@
5
5
  }
6
6
 
7
7
  Read more: https://nextjs.org/docs/messages/middleware-new-signature
8
- `)}}class i 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 ")}}})(ze)),ze}var Ve={},Ye,Ot;function Er(){if(Ot)return Ye;Ot=1;var o=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(a,v)=>{for(var p in v)o(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))!i.call(a,P)&&P!==p&&o(a,P,{get:()=>v[P],enumerable:!(w=e(v,P))||w.enumerable});return a},u=a=>s(o({},"__esModule",{value:!0}),a),r={};n(r,{RequestCookies:()=>g,ResponseCookies:()=>h,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>l}),Ye=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,C]=[p.slice(0,w),p.slice(w+1)];try{v.set(P,decodeURIComponent(C??"true"))}catch{}}return v}function c(a){if(!a)return;const[[v,p],...w]=d(a),{domain:P,expires:C,httponly:q,maxage:M,path:B,samesite:H,secure:ee,partitioned:te,priority:G}=Object.fromEntries(w.map(([ue,$])=>[ue.toLowerCase(),$])),K={name:v,value:decodeURIComponent(p),domain:P,...C&&{expires:new Date(C)},...q&&{httpOnly:!0},...typeof M=="string"&&{maxAge:Number(M)},path:B,...H&&{sameSite:R(H)},...ee&&{secure:!0},...G&&{priority:O(G)},...te&&{partitioned:!0}};return m(K)}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 O(a){return a=a.toLowerCase(),y.includes(a)?a:void 0}function f(a){if(!a)return[];var v=[],p=0,w,P,C,q,M;function B(){for(;p<a.length&&/\s/.test(a.charAt(p));)p+=1;return p<a.length}function H(){return P=a.charAt(p),P!=="="&&P!==";"&&P!==","}for(;p<a.length;){for(w=p,M=!1;B();)if(P=a.charAt(p),P===","){for(C=p,p+=1,B(),q=p;p<a.length&&H();)p+=1;p<a.length&&a.charAt(p)==="="?(M=!0,p=q,v.push(a.substring(w,C)),w=p):p=C+1}else p+=1;(!M||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,C])=>C);const w=typeof a[0]=="string"?a[0]:(v=a[0])==null?void 0:v.name;return p.filter(([P])=>P===w).map(([P,C])=>C)}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,C])=>l(C)).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("; ")}},h=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:[],C=Array.isArray(P)?P:f(P);for(const q of C){const M=c(q);M&&this._parsed.set(M.name,M)}}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 Ye}var Nt;function Ke(){return Nt||(Nt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0});function e(i,n){for(var s in n)Object.defineProperty(i,s,{enumerable:!0,get:n[s]})}e(o,{RequestCookies:function(){return t.RequestCookies},ResponseCookies:function(){return t.ResponseCookies},stringifyCookie:function(){return t.stringifyCookie}});const t=Er()})(Ve)),Ve}var xt;function vr(){return xt||(xt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0});function e(l,d){for(var c in d)Object.defineProperty(l,c,{enumerable:!0,get:d[c]})}e(o,{INTERNALS:function(){return u},NextRequest:function(){return r}});const t=yt(),i=At(),n=wr(),s=Ke(),u=Symbol("internal request");class r extends Request{constructor(d,c={}){const m=typeof d!="string"&&"url"in d?d.url:String(d);(0,i.validateURL)(m),d instanceof Request?super(d,c):super(m,c);const b=new t.NextURL(m,{headers:(0,i.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}}})(Ie)),Ie}var $e={},Je={},Ct;function Rr(){return Ct||(Ct=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"ReflectAdapter",{enumerable:!0,get:function(){return e}});class e{static get(i,n,s){const u=Reflect.get(i,n,s);return typeof u=="function"?u.bind(i):u}static set(i,n,s,u){return Reflect.set(i,n,s,u)}static has(i,n){return Reflect.has(i,n)}static deleteProperty(i,n){return Reflect.deleteProperty(i,n)}}})(Je)),Je}var Lt;function Pr(){return Lt||(Lt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"NextResponse",{enumerable:!0,get:function(){return d}});const e=Ke(),t=yt(),i=At(),n=Rr(),s=Ke(),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,O]of c.request.headers)m.set("x-middleware-request-"+y,O),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),O=new Proxy(y,{get(f,g,h){switch(g){case"delete":case"set":return(..._)=>{const E=Reflect.apply(f[g],f,_),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(f,g,h)}}});this[u]={cookies:O,url:b.url?new t.NextURL(b.url,{headers:(0,i.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:{},O=new Headers(y?.headers);return O.set("Location",(0,i.validateURL)(m)),new d(null,{...y,headers:O,status:R})}static rewrite(m,b){const R=new Headers(b?.headers);return R.set("x-middleware-rewrite",(0,i.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})}}})($e)),$e}var Qe={},kt;function yr(){return kt||(kt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"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')}})(Qe)),Qe}var Ze={},et={exports:{}},Ut;function Tr(){return Ut||(Ut=1,(()=>{var o={226:function(n,s){(function(u,r){var l="1.0.35",d="",c="?",m="function",b="undefined",R="object",y="string",O="major",f="model",g="name",h="type",_="vendor",E="version",a="architecture",v="console",p="mobile",w="tablet",P="smarttv",C="wearable",q="embedded",M=350,B="Amazon",H="Apple",ee="ASUS",te="BlackBerry",G="Browser",K="Chrome",ue="Edge",$="Firefox",re="Google",be="Huawei",ce="LG",le="Microsoft",we="Motorola",ne="Opera",de="Samsung",Ee="Sharp",ie="Sony",fe="Xiaomi",U="Zebra",ve="Facebook",Re="Chromium OS",Pe="Mac OS",ye=function(I,x){var S={};for(var L in I)x[L]&&x[L].length%2===0?S[L]=x[L].concat(I[L]):S[L]=I[L];return S},Q=function(I){for(var x={},S=0;S<I.length;S++)x[I[S].toUpperCase()]=I[S];return x},Qt=function(I,x){return typeof I===y?he(x).indexOf(he(I))!==-1:!1},he=function(I){return I.toLowerCase()},Fr=function(I){return typeof I===y?I.replace(/[^\d\.]/g,d).split(".")[0]:r},st=function(I,x){if(typeof I===y)return I=I.replace(/^\s\s*/,d),typeof x===b?I:I.substring(0,M)},pe=function(I,x){for(var S=0,L,J,W,N,T,z;S<x.length&&!T;){var ut=x[S],tr=x[S+1];for(L=J=0;L<ut.length&&!T&&ut[L];)if(T=ut[L++].exec(I),T)for(W=0;W<tr.length;W++)z=T[++J],N=tr[W],typeof N===R&&N.length>0?N.length===2?typeof N[1]==m?this[N[0]]=N[1].call(this,z):this[N[0]]=N[1]:N.length===3?typeof N[1]===m&&!(N[1].exec&&N[1].test)?this[N[0]]=z?N[1].call(this,z,N[2]):r:this[N[0]]=z?z.replace(N[1],N[2]):r:N.length===4&&(this[N[0]]=z?N[3].call(this,z.replace(N[1],N[2])):r):this[N]=z||r;S+=2}},at=function(I,x){for(var S in x)if(typeof x[S]===R&&x[S].length>0){for(var L=0;L<x[S].length;L++)if(Qt(x[S][L],I))return S===c?r:S}else if(Qt(x[S],I))return S===c?r:S;return I},Br={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Zt={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"},er={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,ne+" Mini"]],[/\bopr\/([\w\.]+)/i],[E,[g,ne]],[/(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"+G]],[/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 "+G],E],[/\bfocus\/([\w\.]+)/i],[E,[g,$+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[g,ne+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[g,ne+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[g,"MIUI "+G]],[/fxios\/([-\w\.]+)/i],[E,[g,$]],[/\bqihu|(qi?ho?o?|360)browser/i],[[g,"360 "+G]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[g,/(.+)/,"$1 "+G],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,ve],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,K+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,K+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[g,"Android "+G]],[/(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,at,Br]],[/(webkit|khtml)\/([\w\.]+)/i],[g,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[g,"Netscape"],E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[g,$+" 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,he]],[/((?: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,he]],[/(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,he]]],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],[f,[_,de],[h,w]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[f,[_,de],[h,p]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[_,H],[h,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[_,H],[h,w]],[/(macintosh);/i],[f,[_,H]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[_,Ee],[h,p]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[f,[_,be],[h,w]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[_,be],[h,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],[[f,/_/g," "],[_,fe],[h,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[f,/_/g," "],[_,fe],[h,w]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[_,"OPPO"],[h,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[_,"Vivo"],[h,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[f,[_,"Realme"],[h,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],[f,[_,we],[h,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[_,we],[h,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[_,ce],[h,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[_,ce],[h,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[f,[_,"Lenovo"],[h,w]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[f,/_/g," "],[_,"Nokia"],[h,p]],[/(pixel c)\b/i],[f,[_,re],[h,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[_,re],[h,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],[f,[_,ie],[h,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,"Xperia Tablet"],[_,ie],[h,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[_,"OnePlus"],[h,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[_,B],[h,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,"Fire Phone $1"],[_,B],[h,p]],[/(playbook);[-\w\),; ]+(rim)/i],[f,_,[h,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[_,te],[h,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[_,ee],[h,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[_,ee],[h,p]],[/(nexus 9)/i],[f,[_,"HTC"],[h,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[f,/_/g," "],[h,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[_,"Acer"],[h,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[_,"Meizu"],[h,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],[_,f,[h,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],[_,f,[h,w]],[/(surface duo)/i],[f,[_,le],[h,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[_,"Fairphone"],[h,p]],[/(u304aa)/i],[f,[_,"AT&T"],[h,p]],[/\bsie-(\w*)/i],[f,[_,"Siemens"],[h,p]],[/\b(rct\w+) b/i],[f,[_,"RCA"],[h,w]],[/\b(venue[\d ]{2,7}) b/i],[f,[_,"Dell"],[h,w]],[/\b(q(?:mv|ta)\w+) b/i],[f,[_,"Verizon"],[h,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[_,"Barnes & Noble"],[h,w]],[/\b(tm\d{3}\w+) b/i],[f,[_,"NuVision"],[h,w]],[/\b(k88) b/i],[f,[_,"ZTE"],[h,w]],[/\b(nx\d{3}j) b/i],[f,[_,"ZTE"],[h,p]],[/\b(gen\d{3}) b.+49h/i],[f,[_,"Swiss"],[h,p]],[/\b(zur\d{3}) b/i],[f,[_,"Swiss"],[h,w]],[/\b((zeki)?tb.*\b) b/i],[f,[_,"Zeki"],[h,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],f,[h,w]],[/\b(ns-?\w{0,9}) b/i],[f,[_,"Insignia"],[h,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[_,"NextBook"],[h,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],f,[h,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],f,[h,p]],[/\b(ph-1) /i],[f,[_,"Essential"],[h,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[_,"Envizen"],[h,w]],[/\b(trio[-\w\. ]+) b/i],[f,[_,"MachSpeed"],[h,w]],[/\btu_(1491) b/i],[f,[_,"Rotor"],[h,w]],[/(shield[\w ]+) b/i],[f,[_,"Nvidia"],[h,w]],[/(sprint) (\w+)/i],[_,f,[h,p]],[/(kin\.[onetw]{3})/i],[[f,/\./g," "],[_,le],[h,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[_,U],[h,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[_,U],[h,p]],[/smart-tv.+(samsung)/i],[_,[h,P]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,"SmartTV"],[_,de],[h,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,ce],[h,P]],[/(apple) ?tv/i],[_,[f,H+" TV"],[h,P]],[/crkey/i],[[f,K+"cast"],[_,re],[h,P]],[/droid.+aft(\w)( bui|\))/i],[f,[_,B],[h,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[_,Ee],[h,P]],[/(bravia[\w ]+)( bui|\))/i],[f,[_,ie],[h,P]],[/(mitv-\w{5}) bui/i],[f,[_,fe],[h,P]],[/Hbbtv.*(technisat) (.*);/i],[_,f,[h,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,st],[f,st],[h,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,f,[h,v]],[/droid.+; (shield) bui/i],[f,[_,"Nvidia"],[h,v]],[/(playstation [345portablevi]+)/i],[f,[_,ie],[h,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[_,le],[h,v]],[/((pebble))app/i],[_,f,[h,C]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[_,H],[h,C]],[/droid.+; (glass) \d/i],[f,[_,re],[h,C]],[/droid.+; (wt63?0{2,3})\)/i],[f,[_,U],[h,C]],[/(quest( 2| pro)?)/i],[f,[_,ve],[h,C]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[h,q]],[/(aeobc)\b/i],[f,[_,B],[h,q]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[f,[h,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[h,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,p]],[/(android[-\w\. ]{0,9});.+buil/i],[f,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[g,ue+"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,at,Zt]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,"Windows"],[E,at,Zt]],[/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,Pe],[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,te]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[g,$+" 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,K+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,Re],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]]},F=function(I,x){if(typeof I===R&&(x=I,I=r),!(this instanceof F))return new F(I,x).getResult();var S=typeof u!==b&&u.navigator?u.navigator:r,L=I||(S&&S.userAgent?S.userAgent:d),J=S&&S.userAgentData?S.userAgentData:r,W=x?ye(er,x):er,N=S&&S.userAgent==L;return this.getBrowser=function(){var T={};return T[g]=r,T[E]=r,pe.call(T,L,W.browser),T[O]=Fr(T[E]),N&&S&&S.brave&&typeof S.brave.isBrave==m&&(T[g]="Brave"),T},this.getCPU=function(){var T={};return T[a]=r,pe.call(T,L,W.cpu),T},this.getDevice=function(){var T={};return T[_]=r,T[f]=r,T[h]=r,pe.call(T,L,W.device),N&&!T[h]&&J&&J.mobile&&(T[h]=p),N&&T[f]=="Macintosh"&&S&&typeof S.standalone!==b&&S.maxTouchPoints&&S.maxTouchPoints>2&&(T[f]="iPad",T[h]=w),T},this.getEngine=function(){var T={};return T[g]=r,T[E]=r,pe.call(T,L,W.engine),T},this.getOS=function(){var T={};return T[g]=r,T[E]=r,pe.call(T,L,W.os),N&&!T[g]&&J&&J.platform!="Unknown"&&(T[g]=J.platform.replace(/chrome os/i,Re).replace(/macos/i,Pe)),T},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 L},this.setUA=function(T){return L=typeof T===y&&T.length>M?st(T,M):T,this},this.setUA(L),this};F.VERSION=l,F.BROWSER=Q([g,E,O]),F.CPU=Q([a]),F.DEVICE=Q([f,_,h,v,p,P,w,C,q]),F.ENGINE=F.OS=Q([g,E]),typeof s!==b?(n.exports&&(s=n.exports=F),s.UAParser=F):typeof u!==b&&(u.UAParser=F);var oe=typeof u!==b&&(u.jQuery||u.Zepto);if(oe&&!oe.ua){var Te=new F;oe.ua=Te.getResult(),oe.ua.get=function(){return Te.getUA()},oe.ua.set=function(I){Te.setUA(I);var x=Te.getResult();for(var S in x)oe.ua[S]=x[S]}}})(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{o[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 i=t(226);et.exports=i})()),et.exports}var Dt;function Mt(){return Dt||(Dt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0});function e(r,l){for(var d in l)Object.defineProperty(r,d,{enumerable:!0,get:l[d]})}e(o,{isBot:function(){return n},userAgent:function(){return u},userAgentFromString:function(){return s}});const t=i(Tr());function i(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)}})(Ze)),Ze}var tt={},jt;function Sr(){return jt||(jt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"URLPattern",{enumerable:!0,get:function(){return e}});const e=typeof URLPattern>"u"?void 0:URLPattern})(tt)),tt}var qt;function Ar(){return qt||(qt=1,(function(o,e){const t={NextRequest:vr().NextRequest,NextResponse:Pr().NextResponse,ImageResponse:yr().ImageResponse,userAgentFromString:Mt().userAgentFromString,userAgent:Mt().userAgent,URLPattern:Sr().URLPattern};o.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})(_e,_e.exports)),_e.exports}var Ir=Ar();class Or{async parseRequest(e){const t=new URL(e.url),i=e.method,n=e.headers.get(X)??"",s={};e.cookies.getAll().forEach(l=>{s[l.name]=l.value});let u,r;if(i!=="GET"){if(n.includes(j.applicationJson))try{u=await e.json()}catch{k.warn("request body is null!")}else if(n.includes(j.multipartFormData)){const l=e.clone(),d=await e.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(j.applicationXwwwFormUrlencoded)){const l=await e.text();u=me(l,["m"])}}return{url:t,method:i,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const t=Ir.NextResponse.json(e.body);if(Object.entries(e.cookies).forEach(([i,n])=>{typeof n=="object"&&n.value?t.cookies.set(i,n.value,n.options):typeof n=="string"&&t.cookies.set(i,n)}),e.cleanCookies){const i={set(n,s,u){t.cookies.set(n,s,u)},delete(n,s){t.cookies.delete({...s,name:n})}};e.cleanCookies(i)}return t}setCookie(e,t,i,n){e.cookies[t]={value:i,options:n}}}class Nr{async parseRequest(e){const t=new URL(V.getRequestURL(e)),i=e.req.method,n=e.req.headers.get(X)||"",s=V.parseCookies(e);let u,r;if(i!=="GET"){if(n.includes(j.applicationJson))try{u=await V.readBody(e)}catch{k.warn("request body is null!")}else if(n.includes(j.multipartFormData)){const l=e.req.clone(),d=await e.req.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(j.applicationXwwwFormUrlencoded))try{u=await V.readBody(e)}catch{k.warn("request body is null!")}}return{url:t,method:i,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const{status:t,headers:i,body:n,cookies:s,cleanCookies:u}=e;return r=>(r.res.status=t,Object.entries(i).forEach(([l,d])=>{r.res.headers.set(l,d)}),Object.entries(s).forEach(([l,d])=>{typeof d=="object"&&d.value?V.setCookie(r,l,d.value,d.options):typeof d=="string"&&V.setCookie(r,l,d)}),u&&u({set(d,c,m){V.setCookie(r,d,c,m)},delete(d,c){V.deleteCookie(r,d,c)}}),n)}setCookie(e,t,i,n){e.cookies[t]={value:i,options:n}}}var rt=(o=>(o[o.login=0]="login",o[o.logout=1]="logout",o))(rt||{});const nt={login:"login",logout:"logout",unknown:""},X="Content-Type",j={applicationJson:"application/json",multipartFormData:"multipart/form-data",applicationXwwwFormUrlencoded:"application/x-www-form-urlencoded"};class xr{config;http;adapter;constructor({config:e,adapter:t,storage:i}){this.config=e;let n=Wt(i.headers);(!n.deviceId||n.deviceId.trim().length===0)&&(n=zt(i.cookies)),this.http=new Jt({...n,userType:e.userType,helloURL:e.helloURL}),this.adapter=t}async handleRequest(e){try{const t=await this.adapter.parseRequest(e),i=await this.processRequest(t);return this.adapter.createResponse(i)}catch(t){k.error({error:t?.toString()||"Internal server error"},"ROUTE ERROR");const i=this.createErrorResponse(500,t?.toString()||"Internal server error");return this.adapter.createResponse(i)}}async processRequest(e){const t=e.url.searchParams,i=t.get("m")??"unknown",s={...nt,...this.config.APIMAP}[i],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=Vt(u),k.debug(r,"token"),!r||r.username.length===0||r.token.length===0))return this.createErrorResponse(409,"Authentication required",u);k.debug({"content-type":e.contentType},"Content-Type"),k.debug({hostUrl:s,token:r?{...r}:""},"processRequest");const l=e.method;if(l==="GET"){const d=me(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(j.applicationJson)||c.includes(j.applicationXwwwFormUrlencoded))e.body&&(d={...e.body});else if(c.includes(j.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 O=e.requestFormData.formData;if(O)for(const[f,g]of Object.entries(O))f!=="file"&&(d[f]=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:i,req:n}){const s={};s[X]=j.applicationJson;const u={status:t.success?200:t.code,headers:s,cookies:this.setCookies(n.cookies),body:t};if(t.success){switch(e){case nt[rt[0]]:const r=t.data;Kt(r,u);break;case nt[rt[1]]:u.cleanCookies=l=>$t(l);break}i.onHandlerSuccess&&i.onHandlerSuccess({url:e,data:t.data,req:n,res:u})}return u}createErrorResponse(e,t,i){const n={};return n[X]=j.applicationJson,{status:e,headers:n,cookies:i?this.setCookies(i):{},body:{code:e,success:!1,msg:t}}}setCookies(e){const t={};return Object.entries(e).forEach(([i,n])=>{t[i]={value:n}}),t}}const Cr="zh-CN",Ht="_device_id_key",Ft="_current_website_key",Bt="Get request error!",it="Post request error!",D={IBOOT_DEVICE_ID:"dvid",IBOOT_LANG:"lang",IBOOT_WEBSITE_ID:"wid",IBOOT_WEBSITE_NO:"wno",IBOOT_TOKEN:"token",IBOOT_USER:"user"},Y={DEVICE_ID:"Device-Id",LANG:"Lang",WEBSITE_ID:"Website-Id",WEBSITE_NO:"Website-No"},Gt=o=>{if(!o.get)throw new Error("The get method of IStorage has not been implemented.");const e=o.get(Ht)??"",t=o.get(Ft),i=t!=null?JSON.parse(t):null,n={};return e.length>0&&(n["Device-Id"]=e),i&&(n.Lang=i.language,i.websiteId&&(n["Website-Id"]=i.websiteId),i.websiteNo&&(n["Website-No"]=i.websiteNo)),n},Lr=({deviceId:o,website:e},t)=>{if(!t.set)throw new Error("The set method of IStorage has not been implemented.");t.set(Ht,o),e&&t.set(Ft,JSON.stringify(e))},kr=o=>`${process.env.BASE_URL||"/api/services"}?m=${o}`,Xt=async(o,e)=>{let t=kr(o);if(e?.data){const r=new URLSearchParams(e.data);t+=`&${r}`}const i=e&&e.storage&&e.storage.get?Gt(e.storage):{},n=e?.headers;if(n)for(const r in n){const l=n[r];l&&(i[r]=l)}k.info({url:t,headers:i},"GET");const s=await fetch(t,{method:"GET",headers:i,cache:e?.useCache?"force-cache":"default"});if(s.ok){const r=Object.fromEntries(s.headers.entries()),l={...await s.json(),headers:r};return k.debug(l,"GET_RESULT"),l}const u={code:s.status,success:!1,msg:s.statusText};return k.error(u),u},ot=async(o,e)=>{const t=e?.data??{},i=e?.headers;let n;const s=e&&e.storage&&e.storage.get?Gt(e.storage):{},u=new Headers(s);if(t instanceof FormData?n=t:(n=JSON.stringify(t),u.set(X,j.applicationJson)),i)for(let d in i){const c=i[d];c&&u.set(d,c)}k.info({url:o,headers:u},"POST");const r=await fetch(o,{method:"POST",headers:u,body:n});if(r.ok){const d=Object.fromEntries(r.headers.entries()),c={...await r.json(),headers:d};return k.debug(c,"POST_RESULT"),c}const l={code:r.status,success:!1,msg:r.statusText};return k.error(l),l},Ur=async(o,e)=>{const t=await Xt(o,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??Bt);return}throw Error(t.msg??Bt)},Dr=async(o,e)=>{const t=await ot(o,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??it);return}throw Error(t.msg??it)},Mr=async(o,e)=>{const t=await ot(o,e);return t.success?(e?.showSuccess&&e.showSuccess(t.msg??"SUCCESS"),!0):(e?.showError&&e.showError(t.msg??it),!1)},Wt=o=>{if(o.get){const e=o.get(Y.DEVICE_ID),t=o.get(Y.LANG),i=o.get(Y.WEBSITE_ID),n=o.get(Y.WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),i&&i.length>0&&(s.websiteId=i),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of IStorage has not been implemented.")},jr=(o,e)=>{if(o.set)e.deviceId&&o.set(Y.DEVICE_ID,e.deviceId),e.lang&&o.set(Y.LANG,e.lang),e.websiteId&&o.set(Y.WEBSITE_ID,e.websiteId),e.websiteNo&&o.set(Y.WEBSITE_NO,e.websiteNo);else throw new Error("The set method of IStorage has not been implemented.")},zt=o=>{if(o.get){const e=o.get(D.IBOOT_DEVICE_ID),t=o.get(D.IBOOT_LANG),i=o.get(D.IBOOT_WEBSITE_ID),n=o.get(D.IBOOT_WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),i&&i.length>0&&(s.websiteId=i),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of ICookies has not been implemented.")},qr=(o,e)=>{if(o.set)e.deviceId&&o.set(D.IBOOT_DEVICE_ID,e.deviceId),e.lang&&o.set(D.IBOOT_LANG,e.lang),e.websiteId&&o.set(D.IBOOT_WEBSITE_ID,e.websiteId),e.websiteNo&&o.set(D.IBOOT_WEBSITE_NO,e.websiteNo);else throw new Error("The set method of ICookies has not been implemented.")},Hr=o=>{if(o.get){const e=o.get(D.IBOOT_USER);if(e&&e.length>0)return JSON.parse(e)}},Vt=o=>{if(o.get){const e=o[D.IBOOT_USER];if(e&&e.length>0){const t=JSON.parse(e),i=t.username,n=t.userType.toString(),s=o[D.IBOOT_TOKEN];if(s)return{username:i,utype:n,token:s}}}},Yt=()=>({path:"/",secure:process.env.APP_ENV==="production",httpOnly:!0,sameSite:"strict"}),ge={maxAge:-1,httpOnly:!0,path:"/"},Kt=(o,e)=>{const{id:t,name:i,username:n,nickname:s,headImg:u,token:r,lastLoginTime:l,deviceId:d,userType:c,mustChangePwd:m}=o,b={id:t,name:i,username:n,nickname:s||i,headImg:u,lastLoginTime:l,deviceId:d,userType:c,accountType:0,needToReview:!1,socketOnline:!1,mustChangePwd:m};e.cookies[D.IBOOT_TOKEN]={value:r,options:Yt()},e.cookies[D.IBOOT_USER]={value:JSON.stringify(b),options:Yt()}},$t=o=>{if(!o.set)throw new Error("cookies set function is undefined");if(o.set(D.IBOOT_TOKEN,"",ge),o.set(D.IBOOT_USER,"",ge),!o.delete)throw new Error("cookies delete function is undefined");o.delete(D.IBOOT_TOKEN,ge),o.delete(D.IBOOT_USER,ge)};class Jt{baseUrl;helloMethod;apiKey;userType;userFrom;deviceId;version="1";lang;websiteId;websiteNo;constructor(e){process.env.APP_ENV==="production"||k.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??ct.TYPE_MGT,this.deviceId=e.deviceId??Ae(10),this.lang=e.lang??Cr,this.websiteId=e.websiteId,this.websiteNo=e.websiteNo}getDeviceId(){return this.deviceId}encrypt(e){const t=Z.enc.Utf8.parse(this.apiKey);return Z.AES.encrypt(e,t).toString()}decrypt(e){const t=Z.enc.Utf8.parse(this.apiKey);return Z.AES.decrypt(e,t,{mode:Z.mode.ECB}).toString(Z.enc.Utf8)}convertUrlParameter(e){const t=[];for(const i in e){let n=e[i];if(n&&typeof n=="string")n=n.trim();else if(n&&typeof n=="object"){if(Se(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")Se(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}`}=${ae(b)}`;t.push(i+R)}}});else if(l.toString().length>0){const d=`[${s.toString()}].${r}=${ae(l.toString())}`;t.push(i+d)}}}}}else for(const s in n){const u=n[s];if(u!=null&&u!=""&&u.length!=0){const r=`.${s}=${ae(u)}`;t.push(i+r)}}continue}else n&&typeof n=="function"&&(n=null);n!=null&&n!=""&&n.length!=0&&t.push(i+"="+ae(n))}return t&&t.join("&")}async sign(e){const t="&key="+await this.helloIboot(),i=[];for(const l in e)i.push(l);i.sort((l,d)=>l.toLowerCase().localeCompare(d.toLowerCase()));const n=[];i.forEach(l=>{let d=e[l];typeof d=="object"&&(d=JSON.stringify(d)),n.push(l+"="+d)});const s=n.join("&"),u=nr.md5((s+t).toLocaleUpperCase()),r={params:s,md5:u};return k.debug(r,"API_SIGN"),u}assemblyParameter(e,t){const i=e??{};return i.timestamp=Date.now()+"",i.echostr=Ae(10),i.version=this.version,i.deviceId=this.deviceId,i.webid=this.websiteId,i.apiKey=this.apiKey,t&&t.length>0&&(i.username=t),i}async assemblyHeader({urlParams:e,token:t}){const i={"Res-Type":"json","Device-Id":this.deviceId,"User-Type":t?.utype.toString()??this.userType.toString(),"User-From":this.userFrom,"Api-Key":this.apiKey};i[X]=j.applicationXwwwFormUrlencoded,this.lang&&this.lang.length>0&&(i.Lang=this.lang),this.websiteId&&this.websiteId.length>0&&(i["Web-Id"]=this.websiteId),this.websiteNo&&this.websiteNo.length>0&&(i["Web-No"]=this.websiteNo),t&&(t.token&&t.token.length>0&&t.username&&t.username.length>0&&(i.Authorization=t.token,i.Username=t.username),t.xcsrf&&(i[t.xcsrf.csrfHeader]=t.xcsrf.csrfToken));const n=me(e),s=await this.sign(n);return i.Sign=s,i}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[X]=j.applicationXwwwFormUrlencoded;const i={url:e,headers:t};k.debug(i,"HELLO");const n=await fetch(e,{method:"GET",headers:t,credentials:"include",cache:"force-cache"});if(n.ok){const s=await n.json();return k.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:i,cache:n="default"}){const s=this.assemblyParameter(t),u=this.convertUrlParameter(s),r=await this.assemblyHeader({urlParams:u,token:i}),l=`${this.getApiUrl(e)}?${u.toString()}`,d={url:l,headers:r};k.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 k.debug(R,"GET_RESULT"),R}const m={code:c.status,success:!1,msg:c.statusText};return k.error(m),m}async post({url:e,data:t,token:i,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:i});u&&r&&(c[X]=`multipart/form-data; boundary=${r}`);const m=this.getApiUrl(e),b={url:m,headers:c,params:l};k.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 f=Object.fromEntries(y.headers.entries()),g={...await y.json(),headers:f};return k.debug(g,"POST_RESULT"),g}const O={code:y.status,success:!1,msg:y.statusText};return k.error(O),O}async stream({url:e,data:t,token:i}){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:i});n&&s&&(l[X]=`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};k.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}}}A.ACCOUNT_TYPE_MAP=ir,A.CONTENT_TYPE_KEY=X,A.CONTENT_TYPE_MAP=j,A.HTTPRouter=xr,A.HttpClient=Jt,A.NextJsAdapter=Or,A.NuxtJsAdapter=Nr,A.USER_FORM_MAP=or,A.USER_SEX_MAP=sr,A.USER_TYPE_MAP=ct,A.cleanToken=$t,A.dateFormat=ur,A.get=Xt,A.getLoginUser=Hr,A.getServerHttpCookies=zt,A.getServerHttpOpts=Wt,A.getToken=Vt,A.iGet=Ur,A.iPost=Dr,A.iPostSuccess=Mr,A.isArray=Se,A.logger=k,A.post=ot,A.randomString=Ae,A.setClientRequestHeader=Lr,A.setServerHttpCookies=qr,A.setServerHttpHeaders=jr,A.setToken=Kt,A.urlEncode=ae,A.urlParamToJson=me,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
8
+ `)}}class i 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 ")}}})(ze)),ze}var Ve={},Ye,Ot;function Er(){if(Ot)return Ye;Ot=1;var o=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(a,v)=>{for(var p in v)o(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))!i.call(a,P)&&P!==p&&o(a,P,{get:()=>v[P],enumerable:!(w=e(v,P))||w.enumerable});return a},u=a=>s(o({},"__esModule",{value:!0}),a),r={};n(r,{RequestCookies:()=>g,ResponseCookies:()=>h,parseCookie:()=>d,parseSetCookie:()=>c,stringifyCookie:()=>l}),Ye=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,C]=[p.slice(0,w),p.slice(w+1)];try{v.set(P,decodeURIComponent(C??"true"))}catch{}}return v}function c(a){if(!a)return;const[[v,p],...w]=d(a),{domain:P,expires:C,httponly:q,maxage:M,path:B,samesite:H,secure:ee,partitioned:te,priority:G}=Object.fromEntries(w.map(([ue,$])=>[ue.toLowerCase(),$])),K={name:v,value:decodeURIComponent(p),domain:P,...C&&{expires:new Date(C)},...q&&{httpOnly:!0},...typeof M=="string"&&{maxAge:Number(M)},path:B,...H&&{sameSite:R(H)},...ee&&{secure:!0},...G&&{priority:O(G)},...te&&{partitioned:!0}};return m(K)}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 O(a){return a=a.toLowerCase(),y.includes(a)?a:void 0}function f(a){if(!a)return[];var v=[],p=0,w,P,C,q,M;function B(){for(;p<a.length&&/\s/.test(a.charAt(p));)p+=1;return p<a.length}function H(){return P=a.charAt(p),P!=="="&&P!==";"&&P!==","}for(;p<a.length;){for(w=p,M=!1;B();)if(P=a.charAt(p),P===","){for(C=p,p+=1,B(),q=p;p<a.length&&H();)p+=1;p<a.length&&a.charAt(p)==="="?(M=!0,p=q,v.push(a.substring(w,C)),w=p):p=C+1}else p+=1;(!M||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,C])=>C);const w=typeof a[0]=="string"?a[0]:(v=a[0])==null?void 0:v.name;return p.filter(([P])=>P===w).map(([P,C])=>C)}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,C])=>l(C)).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("; ")}},h=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:[],C=Array.isArray(P)?P:f(P);for(const q of C){const M=c(q);M&&this._parsed.set(M.name,M)}}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 Ye}var Nt;function Ke(){return Nt||(Nt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0});function e(i,n){for(var s in n)Object.defineProperty(i,s,{enumerable:!0,get:n[s]})}e(o,{RequestCookies:function(){return t.RequestCookies},ResponseCookies:function(){return t.ResponseCookies},stringifyCookie:function(){return t.stringifyCookie}});const t=Er()})(Ve)),Ve}var xt;function vr(){return xt||(xt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0});function e(l,d){for(var c in d)Object.defineProperty(l,c,{enumerable:!0,get:d[c]})}e(o,{INTERNALS:function(){return u},NextRequest:function(){return r}});const t=yt(),i=At(),n=wr(),s=Ke(),u=Symbol("internal request");class r extends Request{constructor(d,c={}){const m=typeof d!="string"&&"url"in d?d.url:String(d);(0,i.validateURL)(m),d instanceof Request?super(d,c):super(m,c);const b=new t.NextURL(m,{headers:(0,i.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}}})(Ie)),Ie}var $e={},Je={},Ct;function Rr(){return Ct||(Ct=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"ReflectAdapter",{enumerable:!0,get:function(){return e}});class e{static get(i,n,s){const u=Reflect.get(i,n,s);return typeof u=="function"?u.bind(i):u}static set(i,n,s,u){return Reflect.set(i,n,s,u)}static has(i,n){return Reflect.has(i,n)}static deleteProperty(i,n){return Reflect.deleteProperty(i,n)}}})(Je)),Je}var Lt;function Pr(){return Lt||(Lt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"NextResponse",{enumerable:!0,get:function(){return d}});const e=Ke(),t=yt(),i=At(),n=Rr(),s=Ke(),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,O]of c.request.headers)m.set("x-middleware-request-"+y,O),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),O=new Proxy(y,{get(f,g,h){switch(g){case"delete":case"set":return(..._)=>{const E=Reflect.apply(f[g],f,_),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(f,g,h)}}});this[u]={cookies:O,url:b.url?new t.NextURL(b.url,{headers:(0,i.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:{},O=new Headers(y?.headers);return O.set("Location",(0,i.validateURL)(m)),new d(null,{...y,headers:O,status:R})}static rewrite(m,b){const R=new Headers(b?.headers);return R.set("x-middleware-rewrite",(0,i.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})}}})($e)),$e}var Qe={},kt;function yr(){return kt||(kt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"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')}})(Qe)),Qe}var Ze={},et={exports:{}},Ut;function Tr(){return Ut||(Ut=1,(()=>{var o={226:function(n,s){(function(u,r){var l="1.0.35",d="",c="?",m="function",b="undefined",R="object",y="string",O="major",f="model",g="name",h="type",_="vendor",E="version",a="architecture",v="console",p="mobile",w="tablet",P="smarttv",C="wearable",q="embedded",M=350,B="Amazon",H="Apple",ee="ASUS",te="BlackBerry",G="Browser",K="Chrome",ue="Edge",$="Firefox",re="Google",be="Huawei",ce="LG",le="Microsoft",we="Motorola",ne="Opera",de="Samsung",Ee="Sharp",ie="Sony",fe="Xiaomi",U="Zebra",ve="Facebook",Re="Chromium OS",Pe="Mac OS",ye=function(I,x){var S={};for(var L in I)x[L]&&x[L].length%2===0?S[L]=x[L].concat(I[L]):S[L]=I[L];return S},Q=function(I){for(var x={},S=0;S<I.length;S++)x[I[S].toUpperCase()]=I[S];return x},Qt=function(I,x){return typeof I===y?he(x).indexOf(he(I))!==-1:!1},he=function(I){return I.toLowerCase()},Fr=function(I){return typeof I===y?I.replace(/[^\d\.]/g,d).split(".")[0]:r},st=function(I,x){if(typeof I===y)return I=I.replace(/^\s\s*/,d),typeof x===b?I:I.substring(0,M)},pe=function(I,x){for(var S=0,L,J,W,N,T,z;S<x.length&&!T;){var ut=x[S],tr=x[S+1];for(L=J=0;L<ut.length&&!T&&ut[L];)if(T=ut[L++].exec(I),T)for(W=0;W<tr.length;W++)z=T[++J],N=tr[W],typeof N===R&&N.length>0?N.length===2?typeof N[1]==m?this[N[0]]=N[1].call(this,z):this[N[0]]=N[1]:N.length===3?typeof N[1]===m&&!(N[1].exec&&N[1].test)?this[N[0]]=z?N[1].call(this,z,N[2]):r:this[N[0]]=z?z.replace(N[1],N[2]):r:N.length===4&&(this[N[0]]=z?N[3].call(this,z.replace(N[1],N[2])):r):this[N]=z||r;S+=2}},at=function(I,x){for(var S in x)if(typeof x[S]===R&&x[S].length>0){for(var L=0;L<x[S].length;L++)if(Qt(x[S][L],I))return S===c?r:S}else if(Qt(x[S],I))return S===c?r:S;return I},Br={"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Zt={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"},er={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,ne+" Mini"]],[/\bopr\/([\w\.]+)/i],[E,[g,ne]],[/(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"+G]],[/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 "+G],E],[/\bfocus\/([\w\.]+)/i],[E,[g,$+" Focus"]],[/\bopt\/([\w\.]+)/i],[E,[g,ne+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[E,[g,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[E,[g,"Dolphin"]],[/coast\/([\w\.]+)/i],[E,[g,ne+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[E,[g,"MIUI "+G]],[/fxios\/([-\w\.]+)/i],[E,[g,$]],[/\bqihu|(qi?ho?o?|360)browser/i],[[g,"360 "+G]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[g,/(.+)/,"$1 "+G],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,ve],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,K+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[g,K+" WebView"],E],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[E,[g,"Android "+G]],[/(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,at,Br]],[/(webkit|khtml)\/([\w\.]+)/i],[g,E],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[g,"Netscape"],E],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[E,[g,$+" 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,he]],[/((?: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,he]],[/(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,he]]],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],[f,[_,de],[h,w]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[f,[_,de],[h,p]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[_,H],[h,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[_,H],[h,w]],[/(macintosh);/i],[f,[_,H]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[_,Ee],[h,p]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[f,[_,be],[h,w]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[_,be],[h,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],[[f,/_/g," "],[_,fe],[h,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[f,/_/g," "],[_,fe],[h,w]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[_,"OPPO"],[h,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[_,"Vivo"],[h,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[f,[_,"Realme"],[h,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],[f,[_,we],[h,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[_,we],[h,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[_,ce],[h,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[_,ce],[h,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[f,[_,"Lenovo"],[h,w]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[f,/_/g," "],[_,"Nokia"],[h,p]],[/(pixel c)\b/i],[f,[_,re],[h,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[_,re],[h,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],[f,[_,ie],[h,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,"Xperia Tablet"],[_,ie],[h,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[_,"OnePlus"],[h,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[_,B],[h,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,"Fire Phone $1"],[_,B],[h,p]],[/(playbook);[-\w\),; ]+(rim)/i],[f,_,[h,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[_,te],[h,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[_,ee],[h,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[_,ee],[h,p]],[/(nexus 9)/i],[f,[_,"HTC"],[h,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[_,[f,/_/g," "],[h,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[_,"Acer"],[h,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[_,"Meizu"],[h,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],[_,f,[h,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],[_,f,[h,w]],[/(surface duo)/i],[f,[_,le],[h,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[_,"Fairphone"],[h,p]],[/(u304aa)/i],[f,[_,"AT&T"],[h,p]],[/\bsie-(\w*)/i],[f,[_,"Siemens"],[h,p]],[/\b(rct\w+) b/i],[f,[_,"RCA"],[h,w]],[/\b(venue[\d ]{2,7}) b/i],[f,[_,"Dell"],[h,w]],[/\b(q(?:mv|ta)\w+) b/i],[f,[_,"Verizon"],[h,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[_,"Barnes & Noble"],[h,w]],[/\b(tm\d{3}\w+) b/i],[f,[_,"NuVision"],[h,w]],[/\b(k88) b/i],[f,[_,"ZTE"],[h,w]],[/\b(nx\d{3}j) b/i],[f,[_,"ZTE"],[h,p]],[/\b(gen\d{3}) b.+49h/i],[f,[_,"Swiss"],[h,p]],[/\b(zur\d{3}) b/i],[f,[_,"Swiss"],[h,w]],[/\b((zeki)?tb.*\b) b/i],[f,[_,"Zeki"],[h,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[_,"Dragon Touch"],f,[h,w]],[/\b(ns-?\w{0,9}) b/i],[f,[_,"Insignia"],[h,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[_,"NextBook"],[h,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[_,"Voice"],f,[h,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[_,"LvTel"],f,[h,p]],[/\b(ph-1) /i],[f,[_,"Essential"],[h,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[_,"Envizen"],[h,w]],[/\b(trio[-\w\. ]+) b/i],[f,[_,"MachSpeed"],[h,w]],[/\btu_(1491) b/i],[f,[_,"Rotor"],[h,w]],[/(shield[\w ]+) b/i],[f,[_,"Nvidia"],[h,w]],[/(sprint) (\w+)/i],[_,f,[h,p]],[/(kin\.[onetw]{3})/i],[[f,/\./g," "],[_,le],[h,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[_,U],[h,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[_,U],[h,p]],[/smart-tv.+(samsung)/i],[_,[h,P]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,"SmartTV"],[_,de],[h,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[_,ce],[h,P]],[/(apple) ?tv/i],[_,[f,H+" TV"],[h,P]],[/crkey/i],[[f,K+"cast"],[_,re],[h,P]],[/droid.+aft(\w)( bui|\))/i],[f,[_,B],[h,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[_,Ee],[h,P]],[/(bravia[\w ]+)( bui|\))/i],[f,[_,ie],[h,P]],[/(mitv-\w{5}) bui/i],[f,[_,fe],[h,P]],[/Hbbtv.*(technisat) (.*);/i],[_,f,[h,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[_,st],[f,st],[h,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[_,f,[h,v]],[/droid.+; (shield) bui/i],[f,[_,"Nvidia"],[h,v]],[/(playstation [345portablevi]+)/i],[f,[_,ie],[h,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[_,le],[h,v]],[/((pebble))app/i],[_,f,[h,C]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[_,H],[h,C]],[/droid.+; (glass) \d/i],[f,[_,re],[h,C]],[/droid.+; (wt63?0{2,3})\)/i],[f,[_,U],[h,C]],[/(quest( 2| pro)?)/i],[f,[_,ve],[h,C]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[_,[h,q]],[/(aeobc)\b/i],[f,[_,B],[h,q]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[f,[h,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[h,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,p]],[/(android[-\w\. ]{0,9});.+buil/i],[f,[_,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[E,[g,ue+"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,at,Zt]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,"Windows"],[E,at,Zt]],[/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,Pe],[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,te]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[E,[g,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[E,[g,$+" 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,K+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[g,Re],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]]},F=function(I,x){if(typeof I===R&&(x=I,I=r),!(this instanceof F))return new F(I,x).getResult();var S=typeof u!==b&&u.navigator?u.navigator:r,L=I||(S&&S.userAgent?S.userAgent:d),J=S&&S.userAgentData?S.userAgentData:r,W=x?ye(er,x):er,N=S&&S.userAgent==L;return this.getBrowser=function(){var T={};return T[g]=r,T[E]=r,pe.call(T,L,W.browser),T[O]=Fr(T[E]),N&&S&&S.brave&&typeof S.brave.isBrave==m&&(T[g]="Brave"),T},this.getCPU=function(){var T={};return T[a]=r,pe.call(T,L,W.cpu),T},this.getDevice=function(){var T={};return T[_]=r,T[f]=r,T[h]=r,pe.call(T,L,W.device),N&&!T[h]&&J&&J.mobile&&(T[h]=p),N&&T[f]=="Macintosh"&&S&&typeof S.standalone!==b&&S.maxTouchPoints&&S.maxTouchPoints>2&&(T[f]="iPad",T[h]=w),T},this.getEngine=function(){var T={};return T[g]=r,T[E]=r,pe.call(T,L,W.engine),T},this.getOS=function(){var T={};return T[g]=r,T[E]=r,pe.call(T,L,W.os),N&&!T[g]&&J&&J.platform!="Unknown"&&(T[g]=J.platform.replace(/chrome os/i,Re).replace(/macos/i,Pe)),T},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 L},this.setUA=function(T){return L=typeof T===y&&T.length>M?st(T,M):T,this},this.setUA(L),this};F.VERSION=l,F.BROWSER=Q([g,E,O]),F.CPU=Q([a]),F.DEVICE=Q([f,_,h,v,p,P,w,C,q]),F.ENGINE=F.OS=Q([g,E]),typeof s!==b?(n.exports&&(s=n.exports=F),s.UAParser=F):typeof u!==b&&(u.UAParser=F);var oe=typeof u!==b&&(u.jQuery||u.Zepto);if(oe&&!oe.ua){var Te=new F;oe.ua=Te.getResult(),oe.ua.get=function(){return Te.getUA()},oe.ua.set=function(I){Te.setUA(I);var x=Te.getResult();for(var S in x)oe.ua[S]=x[S]}}})(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{o[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 i=t(226);et.exports=i})()),et.exports}var Dt;function Mt(){return Dt||(Dt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0});function e(r,l){for(var d in l)Object.defineProperty(r,d,{enumerable:!0,get:l[d]})}e(o,{isBot:function(){return n},userAgent:function(){return u},userAgentFromString:function(){return s}});const t=i(Tr());function i(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)}})(Ze)),Ze}var tt={},jt;function Sr(){return jt||(jt=1,(function(o){Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"URLPattern",{enumerable:!0,get:function(){return e}});const e=typeof URLPattern>"u"?void 0:URLPattern})(tt)),tt}var qt;function Ar(){return qt||(qt=1,(function(o,e){const t={NextRequest:vr().NextRequest,NextResponse:Pr().NextResponse,ImageResponse:yr().ImageResponse,userAgentFromString:Mt().userAgentFromString,userAgent:Mt().userAgent,URLPattern:Sr().URLPattern};o.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})(_e,_e.exports)),_e.exports}var Ir=Ar();class Or{async parseRequest(e){const t=new URL(e.url),i=e.method,n=e.headers.get(X)??"",s={};e.cookies.getAll().forEach(l=>{s[l.name]=l.value});let u,r;if(i!=="GET"){if(n.includes(j.applicationJson))try{u=await e.json()}catch{k.warn("request body is null!")}else if(n.includes(j.multipartFormData)){const l=e.clone(),d=await e.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(j.applicationXwwwFormUrlencoded)){const l=await e.text();u=me(l,["m"])}}return{url:t,method:i,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const t=Ir.NextResponse.json(e.body);if(Object.entries(e.cookies).forEach(([i,n])=>{typeof n=="object"&&n.value?t.cookies.set(i,n.value,n.options):typeof n=="string"&&t.cookies.set(i,n)}),e.cleanCookies){const i={set(n,s,u){t.cookies.set(n,s,u)},delete(n,s){t.cookies.delete({...s,name:n})}};e.cleanCookies(i)}return t}setCookie(e,t,i,n){e.cookies[t]={value:i,options:n}}}class Nr{async parseRequest(e){const t=new URL(V.getRequestURL(e)),i=e.req.method,n=e.req.headers.get(X)||"",s=V.parseCookies(e);let u,r;if(i!=="GET"){if(n.includes(j.applicationJson))try{u=await V.readBody(e)}catch{k.warn("request body is null!")}else if(n.includes(j.multipartFormData)){const l=e.req.clone(),d=await e.req.formData(),c=await l.arrayBuffer();r={formData:d,buffer:c}}else if(n.includes(j.applicationXwwwFormUrlencoded))try{u=await V.readBody(e)}catch{k.warn("request body is null!")}}return{url:t,method:i,contentType:n,body:u,requestFormData:r,cookies:s}}createResponse(e){const{status:t,headers:i,body:n,cookies:s,cleanCookies:u}=e;return r=>(r.res.status=t,Object.entries(i).forEach(([l,d])=>{r.res.headers.set(l,d)}),Object.entries(s).forEach(([l,d])=>{typeof d=="object"&&d.value?V.setCookie(r,l,d.value,d.options):typeof d=="string"&&V.setCookie(r,l,d)}),u&&u({set(d,c,m){V.setCookie(r,d,c,m)},delete(d,c){V.deleteCookie(r,d,c)}}),n)}setCookie(e,t,i,n){e.cookies[t]={value:i,options:n}}}var rt=(o=>(o[o.login=0]="login",o[o.logout=1]="logout",o))(rt||{});const nt={login:"login",logout:"logout",unknown:""},X="Content-Type",j={applicationJson:"application/json",multipartFormData:"multipart/form-data",applicationXwwwFormUrlencoded:"application/x-www-form-urlencoded"};class xr{config;http;adapter;constructor({config:e,adapter:t,storage:i}){this.config=e;let n=Wt(i.headers);(!n.deviceId||n.deviceId.trim().length===0)&&(n=zt(i.cookies)),this.http=new Jt({...n,userType:e.userType,helloURL:e.helloURL}),this.adapter=t}async handleRequest(e){try{const t=await this.adapter.parseRequest(e),i=await this.processRequest(t);return this.adapter.createResponse(i)}catch(t){k.error({error:t?.toString()||"Internal server error"},"ROUTE ERROR");const i=this.createErrorResponse(500,t?.toString()||"Internal server error");return this.adapter.createResponse(i)}}async processRequest(e){const t=e.url.searchParams,i=t.get("m")??"unknown",s={...nt,...this.config.APIMAP}[i],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=Vt(u),k.debug(r,"token"),!r||r.username.length===0||r.token.length===0))return this.createErrorResponse(409,"Authentication required",u);k.debug({"content-type":e.contentType},"Content-Type"),k.debug({hostUrl:s,token:r?{...r}:""},"processRequest");const l=e.method;if(l==="GET"){const d=me(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(j.applicationJson)||c.includes(j.applicationXwwwFormUrlencoded))e.body&&(d={...e.body});else if(c.includes(j.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 O=e.requestFormData.formData;if(O)for(const[f,g]of Object.entries(O))f!=="file"&&(d[f]=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:i,req:n}){const s={};s[X]=j.applicationJson;const u={status:t.success?200:t.code,headers:s,cookies:this.setCookies(n.cookies),body:t};if(t.success){switch(e){case nt[rt[0]]:const r=t.data;Kt(r,u);break;case nt[rt[1]]:u.cleanCookies=l=>$t(l);break}i.onHandlerSuccess&&i.onHandlerSuccess({url:e,data:t.data,req:n,res:u})}return u}createErrorResponse(e,t,i){const n={};return n[X]=j.applicationJson,{status:e,headers:n,cookies:i?this.setCookies(i):{},body:{code:e,success:!1,msg:t}}}setCookies(e){const t={};return Object.entries(e).forEach(([i,n])=>{t[i]={value:n}}),t}}const Cr="zh-CN",Ht="_device_id_key",Ft="_current_website_key",Bt="Get request error!",it="Post request error!",D={IBOOT_DEVICE_ID:"dvid",IBOOT_LANG:"lang",IBOOT_WEBSITE_ID:"wid",IBOOT_WEBSITE_NO:"wno",IBOOT_TOKEN:"token",IBOOT_USER:"user"},Y={DEVICE_ID:"Device-Id",LANG:"Lang",WEBSITE_ID:"Website-Id",WEBSITE_NO:"Website-No"},Gt=o=>{if(!o.get)throw new Error("The get method of IStorage has not been implemented.");const e=o.get(Ht)??"",t=o.get(Ft),i=t!=null?JSON.parse(t):null,n={};return e.length>0&&(n["Device-Id"]=e),i&&(n.Lang=i.language,i.websiteId&&(n["Website-Id"]=i.websiteId),i.websiteNo&&(n["Website-No"]=i.websiteNo)),n},Lr=({deviceId:o,website:e},t)=>{if(!t.set)throw new Error("The set method of IStorage has not been implemented.");t.set(Ht,o),e&&t.set(Ft,JSON.stringify(e))},kr=o=>`${process.env.BASE_URL||"/api/services"}?m=${o}`,Xt=async(o,e)=>{let t=kr(o);if(e?.data){const r=new URLSearchParams(e.data);t+=`&${r}`}const i=e&&e.storage&&e.storage.get?Gt(e.storage):{},n=e?.headers;if(n)for(const r in n){const l=n[r];l&&(i[r]=l)}k.info({url:t,headers:i},"GET");const s=await fetch(t,{method:"GET",headers:i,cache:e?.useCache?"force-cache":"default"});if(s.ok){const r=Object.fromEntries(s.headers.entries()),l={...await s.json(),headers:r};return k.debug(l,"GET_RESULT"),l}const u={code:s.status,success:!1,msg:s.statusText};return k.error(u),u},ot=async(o,e)=>{const t=e?.data??{},i=e?.headers;let n;const s=e&&e.storage&&e.storage.get?Gt(e.storage):{},u=new Headers(s);if(t instanceof FormData?n=t:(n=JSON.stringify(t),u.set(X,j.applicationJson)),i)for(let d in i){const c=i[d];c&&u.set(d,c)}k.info({url:o,headers:u},"POST");const r=await fetch(o,{method:"POST",headers:u,body:n});if(r.ok){const d=Object.fromEntries(r.headers.entries()),c={...await r.json(),headers:d};return k.debug(c,"POST_RESULT"),c}const l={code:r.status,success:!1,msg:r.statusText};return k.error(l),l},Ur=async(o,e)=>{const t=await Xt(o,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??Bt);return}throw Error(t.msg??Bt)},Dr=async(o,e)=>{const t=await ot(o,e);if(t.success)return t.data;if(e?.showError){e.showError(t.msg??it);return}throw Error(t.msg??it)},Mr=async(o,e)=>{const t=await ot(o,e);return t.success?(e?.showSuccess&&e.showSuccess(t.msg??"SUCCESS"),!0):(e?.showError&&e.showError(t.msg??it),!1)},Wt=o=>{if(o.get){const e=o.get(Y.DEVICE_ID),t=o.get(Y.LANG),i=o.get(Y.WEBSITE_ID),n=o.get(Y.WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),i&&i.length>0&&(s.websiteId=i),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of IStorage has not been implemented.")},jr=(o,e)=>{if(o.set)e.deviceId&&o.set(Y.DEVICE_ID,e.deviceId),e.lang&&o.set(Y.LANG,e.lang),e.websiteId&&o.set(Y.WEBSITE_ID,e.websiteId),e.websiteNo&&o.set(Y.WEBSITE_NO,e.websiteNo);else throw new Error("The set method of IStorage has not been implemented.")},zt=o=>{if(o.get){const e=o.get(D.IBOOT_DEVICE_ID),t=o.get(D.IBOOT_LANG),i=o.get(D.IBOOT_WEBSITE_ID),n=o.get(D.IBOOT_WEBSITE_NO),s={};return e&&e.length>0&&(s.deviceId=e),t&&t.length>0&&(s.lang=t),i&&i.length>0&&(s.websiteId=i),n&&n.length>0&&(s.websiteNo=n),s}throw new Error("The get method of ICookies has not been implemented.")},qr=(o,e)=>{if(o.set)e.deviceId&&o.set(D.IBOOT_DEVICE_ID,e.deviceId),e.lang&&o.set(D.IBOOT_LANG,e.lang),e.websiteId&&o.set(D.IBOOT_WEBSITE_ID,e.websiteId),e.websiteNo&&o.set(D.IBOOT_WEBSITE_NO,e.websiteNo);else throw new Error("The set method of ICookies has not been implemented.")},Hr=o=>{if(o.get){const e=o.get(D.IBOOT_USER);if(e&&e.length>0)return JSON.parse(e)}},Vt=o=>{if(o.get){const e=o[D.IBOOT_USER];if(e&&e.length>0){const t=JSON.parse(e),i=t.username,n=t.userType.toString(),s=o[D.IBOOT_TOKEN];if(s)return{username:i,utype:n,token:s}}}},Yt=()=>({path:"/",secure:process.env.APP_ENV==="production",httpOnly:!0,sameSite:"strict"}),ge={maxAge:-1,httpOnly:!0,path:"/"},Kt=(o,e)=>{const{id:t,name:i,username:n,nickname:s,headImg:u,token:r,lastLoginTime:l,deviceId:d,userType:c,mustChangePwd:m}=o,b={id:t,name:i,username:n,nickname:s||i,headImg:u,lastLoginTime:l,deviceId:d,userType:c,accountType:0,needToReview:!1,socketOnline:!1,mustChangePwd:m};e.cookies[D.IBOOT_TOKEN]={value:r,options:Yt()},e.cookies[D.IBOOT_USER]={value:JSON.stringify(b),options:Yt()}},$t=o=>{if(!o.set)throw new Error("cookies set function is undefined");if(o.set(D.IBOOT_TOKEN,"",ge),o.set(D.IBOOT_USER,"",ge),!o.delete)throw new Error("cookies delete function is undefined");o.delete(D.IBOOT_TOKEN,ge),o.delete(D.IBOOT_USER,ge)};class Jt{baseUrl;helloMethod;apiKey;userType;userFrom;deviceId;version="1";lang;websiteId;websiteNo;constructor(e){process.env.APP_ENV==="production"||k.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??ct.TYPE_MGT,this.deviceId=e.deviceId??Ae(10),this.lang=e.lang??Cr,this.websiteId=e.websiteId,this.websiteNo=e.websiteNo}getDeviceId(){return this.deviceId}encrypt(e){const t=Z.enc.Utf8.parse(this.apiKey);return Z.AES.encrypt(e,t).toString()}decrypt(e){const t=Z.enc.Utf8.parse(this.apiKey);return Z.AES.decrypt(e,t,{mode:Z.mode.ECB}).toString(Z.enc.Utf8)}convertUrlParameter(e){const t=[];for(const i in e){let n=e[i];if(n&&typeof n=="string")n=n.trim();else if(n&&typeof n=="object"){if(Se(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")Se(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}`}=${ae(b)}`;t.push(i+R)}}});else if(l.toString().length>0){const d=`[${s.toString()}].${r}=${ae(l.toString())}`;t.push(i+d)}}}}}else for(const s in n){const u=n[s];if(u!=null&&u!=""&&u.length!=0){const r=`.${s}=${ae(u)}`;t.push(i+r)}}continue}else n&&typeof n=="function"&&(n=null);n!=null&&n!=""&&n.length!=0&&t.push(i+"="+ae(n))}return t&&t.join("&")}async sign(e){const t="&key="+await this.helloIboot(),i=[];for(const l in e)i.push(l);i.sort((l,d)=>l.toLowerCase().localeCompare(d.toLowerCase()));const n=[];i.forEach(l=>{let d=e[l];typeof d=="object"&&(d=JSON.stringify(d)),n.push(l+"="+d)});const s=n.join("&"),u=nr.md5((s+t).toLocaleUpperCase()),r={params:s,md5:u};return k.debug(r,"API_SIGN"),u}assemblyParameter(e,t){const i=e??{};return i.timestamp=Date.now()+"",i.echostr=Ae(10),i.version=this.version,i.deviceId=this.deviceId,i.webid=this.websiteId,i.apiKey=this.apiKey,t&&t.length>0&&(i.username=t),i}async assemblyHeader({urlParams:e,token:t}){const i={"Res-Type":"json","Device-Id":this.deviceId,"User-Type":t?.utype.toString()??this.userType.toString(),"User-From":this.userFrom,"Api-Key":this.apiKey};i[X]=j.applicationXwwwFormUrlencoded,this.lang&&this.lang.length>0&&(i.Lang=this.lang),this.websiteId&&this.websiteId.length>0&&(i["Web-Id"]=this.websiteId),this.websiteNo&&this.websiteNo.length>0&&(i["Web-No"]=this.websiteNo),t&&(t.token&&t.token.length>0&&t.username&&t.username.length>0&&(i.Authorization=t.token,i.Username=t.username),t.xcsrf&&(i[t.xcsrf.csrfHeader]=t.xcsrf.csrfToken));const n=me(e),s=await this.sign(n);return i.Sign=s,i}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[X]=j.applicationXwwwFormUrlencoded;const i={url:e,headers:t};k.debug(i,"HELLO");const n=await fetch(e,{method:"GET",headers:t,credentials:"include",cache:"force-cache"});if(n.ok){const s=await n.json();return k.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:i,cache:n="default"}){const s=this.assemblyParameter(t),u=this.convertUrlParameter(s),r=await this.assemblyHeader({urlParams:u,token:i}),l=`${this.getApiUrl(e)}?${u.toString()}`,d={url:l,headers:r};k.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 k.debug(R,"GET_RESULT"),R}const m={code:c.status,success:!1,msg:c.statusText};return k.error(m),m}async post({url:e,data:t,token:i,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:i});u&&r&&(c[X]=`multipart/form-data; boundary=${r}`);const m=this.getApiUrl(e),b={url:m,headers:c,params:l};k.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 f=Object.fromEntries(y.headers.entries()),g={...await y.json(),headers:f};return k.debug(g,"POST_RESULT"),g}const O={code:y.status,success:!1,msg:y.statusText};return k.error(O),O}async stream({url:e,data:t,token:i}){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:i});n&&s&&(l[X]=`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};k.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}}}A.ACCOUNT_TYPE_MAP=ir,A.CONTENT_TYPE_KEY=X,A.CONTENT_TYPE_MAP=j,A.HTTPRouter=xr,A.HttpClient=Jt,A.NextJsAdapter=Or,A.NuxtJsAdapter=Nr,A.USER_FORM_MAP=or,A.USER_SEX_MAP=sr,A.USER_TYPE_MAP=ct,A.cleanToken=$t,A.dateFormat=ur,A.get=Xt,A.getLoginUser=Hr,A.getServerHttpCookies=zt,A.getServerHttpOpts=Wt,A.getToken=Vt,A.iGet=Ur,A.iPost=Dr,A.iPostSuccess=Mr,A.isArray=Se,A.logger=k,A.post=ot,A.randomString=Ae,A.setClientRequestHeader=Lr,A.setServerHttpCookies=qr,A.setServerHttpHeaders=jr,A.setToken=Kt,A.urlEncode=ae,A.urlParamToJson=me,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
9
9
  //# sourceMappingURL=iboot-http-client.umd.js.map